HuffYUV uses its own weird variant of the BITMAPINFOHEADER that *does*
include the Huffman table size in biSize. That's the only exception as
far as I know.
http://wiki.multimedia.cx/index.php?title=HuffYUV
Mats
--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From d6cb26096e08e43a686ea67fd099ec523498f8b8 Mon Sep 17 00:00:00 2001
From: Mats Peterson <matsp...@yahoo.com>
Date: Thu, 10 Mar 2016 08:13:00 +0100
Subject: [PATCH 2/3 v2] lavf/riffenc: Improve spec compliance
---
libavformat/riffenc.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index 195a58e..c5bbc25 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -222,8 +222,13 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc,
if (!enc->extradata_size && pal_avi)
extradata_size = 4 * (1 << enc->bits_per_coded_sample);
- /* size */
- avio_wl32(pb, 40 + (ignore_extradata ? 0 :extradata_size));
+ /*
+ * Size (not including the size of extra data like the color table or
+ * color masks).
+ * An exception is made for HuffYUV, which includes the size of the
+ * Huffman tables here.
+ */
+ avio_wl32(pb, 40 + (enc->codec_id == AV_CODEC_ID_HUFFYUV ? extradata_size : 0));
avio_wl32(pb, enc->width);
//We always store RGB TopDown
avio_wl32(pb, enc->codec_tag || keep_height ? enc->height : -enc->height);
@@ -236,7 +241,8 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc,
avio_wl32(pb, (enc->width * enc->height * (enc->bits_per_coded_sample ? enc->bits_per_coded_sample : 24)+7) / 8);
avio_wl32(pb, 0);
avio_wl32(pb, 0);
- avio_wl32(pb, 0);
+ /* number of color indices in the color table that are used */
+ avio_wl32(pb, pal_avi ? 1 << enc->bits_per_coded_sample : 0);
avio_wl32(pb, 0);
if (!ignore_extradata) {
--
1.7.10.4
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel