diff options
author | wm4 <wm4@nowhere> | 2020-04-13 02:36:46 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-04-13 15:56:52 +0200 |
commit | f7f947f96098bfca451ca85a9b4f36175907abd6 (patch) | |
tree | bb6592743e8fd0aad394514635c74999df9ad2d4 /LICENSE.GPL | |
parent | a8b84c9a1a8cfe6e08d8de183133f96511d9a32a (diff) | |
download | mpv-f7f947f96098bfca451ca85a9b4f36175907abd6.tar.bz2 mpv-f7f947f96098bfca451ca85a9b4f36175907abd6.tar.xz |
zimg: add support for some RGB fringe formats
This covers 8 and 16 bit packed RGB formats. It doesn't really help with
any actual use-cases, other than giving the finger to libswscale.
One problem is with different color depths. For example, rgb565 provides
1 bit more resolution to the green channel. zimg can only dither to a
uniform depth. I tried dithering to the highest depth and shifting away
1 bit for the lower channels, but that looked ugly (or I messed up
somewhere), so instead it dithers to the lowest depth, and adjusts the
value range if needed. Testing with bgr4_byte (extreme case with 1/2/1
depths), it looks more "grainy" (ordered dithering artifacts) than
libswscale, but it also looks cleaner and smoother. It doesn't have
libswscale's weird red-shift. So I call it a success.
Big endian formats need to be handled explicitly; the generic big endian
swapper code assumes byte-aligned components.
Unpacking is done with shifts and 3 LUTs. This is symmetric to the
packer. Using a generated palette might be better, but I preferred to
keep the symmetry, and not having to mess with a generated palette and
the pal8 code.
This uses FFmepg pixfmts constants directly. I would have preferred
keeping zimg completely separate. But neither do I want to add an IMGFMT
alias for every of these formats, nor do I want to extend our imgfmt
code such that it can provide a complete description of each packed RGB
format (similar to FFmpeg pixdesc).
It also appears that FFmpeg pixdesc as well as the FFmpeg pixfmt doxygen
have an error regarding RGB8: the R/B bit depths are swapped. libswscale
appears to be handling them differently. Not completely sure, as this is
the only packed format case with R/B havuing different depths (instead
of G, the middle component, where things are symmetric).
Diffstat (limited to 'LICENSE.GPL')
0 files changed, 0 insertions, 0 deletions