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 sample file below will be displayed properly with blue colors
in QuickTime in Windows or Mac *in spite of* the greyscale bit being
set.

Sample file:
https://drive.google.com/open?id=0B3_pEBoLs0faTThSek1EeXQ0ZHM

Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From 60798a04ef1204dadf5395cbf7205ea3957fafbb Mon Sep 17 00:00:00 2001
From: Mats Peterson <matsp...@yahoo.com>
Date: Wed, 30 Dec 2015 07:47:54 +0100
Subject: [PATCH] lavf/qtpalette: Ignore greyscale bit in 1-bit video

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 sample file below will be displayed properly with blue colors
in QuickTime in Windows or Mac *in spite of* the greyscale bit being
set.

Sample file:
https://drive.google.com/open?id=0B3_pEBoLs0faTThSek1EeXQ0ZHM

Mats

---
 libavformat/qtpalette.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/qtpalette.c b/libavformat/qtpalette.c
index 6544a55..0555605 100644
--- a/libavformat/qtpalette.c
+++ b/libavformat/qtpalette.c
@@ -51,7 +51,7 @@ int ff_get_qtpalette(int codec_id, AVIOContext *pb, uint32_t *palette)
         int color_count, color_start, color_end;
         uint32_t a, r, g, b;
 
-        if (greyscale) {
+        if (greyscale && bit_depth > 1) {
             int color_index, color_dec;
             /* compute the greyscale palette */
             color_count = 1 << bit_depth;
-- 
1.7.10.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to