• Mats Peterson's avatar
    lavf/qtpalette: Ignore greyscale bit in certain cases · b6c61b7d
    Mats Peterson authored
    The QuickTime File Format Specification states the following:
    
    "Depth: A 16-bit integer that indicates the pixel depth of the
    compressed image. Values of 1, 2, 4, 8 ,16, 24, and 32 indicate the
    depth of color images. The value 32 should be used only if the image
    contains an alpha channel. Values of 34, 36, and 40 indicate 2-, 4-, and
    8-bit grayscale, respectively, for grayscale images."
    
    There is no mention of value 33, i.e. 1-bit video (0x01) with the
    greyscale bit (0x20) set. I therefore suggest that we ignore the
    greyscale bit when processing 1-bit video. Another reason to do this is
    that the first 1-bit sample file below will be displayed properly with
    blue colors in QuickTime in Windows or Mac *in spite of* the greyscale
    bit being set.
    
    Also, QuickTime in Windows or Mac ignores the greyscale bit if the
    video sample description contains a palette, regardless of bit depth.
    This is undocumented behaviour, but I think we should do the same, and
    it seems pretty logical after all, since one wouldn't really bother
    putting a customized palette into a grayscale file anyway. See the
    second 8-bit sample file below, which has the greyscale bit set, and
    which contains a palette in the video sample description. In Windows or
    Mac, it will be displayed with the palette in the sample description, in
    spite of the greyscale bit being set.
    
    Sample file 1 (1-bit QuickTime Animation):
    https://drive.google.com/open?id=0B3_pEBoLs0faTThSek1EeXQ0ZHM
    Earth Spin 1-bit qtrle orig.mov
    
    Sample file 2 (8-bit QuickTime Animation):
    https://drive.google.com/open?id=0B3_pEBoLs0fad2s0V1YzUWo5aDA
    quiz-palette+gs.mov
    Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
    b6c61b7d
Name
Last commit
Last update
compat Loading commit data...
doc Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavresample Loading commit data...
libavutil Loading commit data...
libpostproc Loading commit data...
libswresample Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
INSTALL.md Loading commit data...
LICENSE.md Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
RELEASE Loading commit data...
arch.mak Loading commit data...
cmdutils.c Loading commit data...
cmdutils.h Loading commit data...
cmdutils_common_opts.h Loading commit data...
cmdutils_opencl.c Loading commit data...
common.mak Loading commit data...
configure Loading commit data...
ffmpeg.c Loading commit data...
ffmpeg.h Loading commit data...
ffmpeg_dxva2.c Loading commit data...
ffmpeg_filter.c Loading commit data...
ffmpeg_opt.c Loading commit data...
ffmpeg_qsv.c Loading commit data...
ffmpeg_vdpau.c Loading commit data...
ffmpeg_videotoolbox.c Loading commit data...
ffplay.c Loading commit data...
ffprobe.c Loading commit data...
ffserver.c Loading commit data...
ffserver_config.c Loading commit data...
ffserver_config.h Loading commit data...
library.mak Loading commit data...
version.sh Loading commit data...