libplacebo
libplacebo copied to clipboard
demos/sdlimage: set palette as source lut
A 3D LUT can be used to describe the palette for indexed formats. This is not ideal, but probably more helpful for users who want to display indexed formats than converting to ABGR8888 on the CPU.
Remaining issues:
- Debanding must be turned off (see the comment).
- The palette commonly encoded as bytes must be converted to float, so byte LUT support in libplacebo would be nice.
- The LUT must be extended with trailing zeros to a power of two, so support for extending the LUT with trailing zeros in libplacebo while copying the data to the GPU would be nice.
- For some cases of video playback, the LUT should be changeable per frame without recreating the pipeline. In this case, libplacebo must store the LUT as texture or uniform (not as literal) and offer an interface for replacing the data.
- libplacebo should support PL_FMT_UINT as plane format when using indexed colors to avoid the useless intermediate step over float. The shader would directly index the lut array in the uniform or use texelFetch to access the lut texture.
- 3D LUTs are overly complex for the palette LUT, as two dimensions are always one. Also, they cannot output an alpha channel. Generic N-to-M-dimension-LUT support in libplacebo would be nice.
See also https://code.videolan.org/videolan/libplacebo/-/issues/29
I'm not sure I'm happy with this way of handling it. Besides debanding, a lot of other things are already distorting palettes, e.g. custom shaders, interpolation, color range expansion...
Proper palette format support needs to be implemented in libplacebo directly, as an initial input step before anything else. (It's also semantically unlike the custom_lut
, which is supposed to be for colorspace transformations)