indeo4: reuse context block VLC for band instead of defaulting
authorKostya Shishkov <kostya.shishkov@gmail.com>
Sat, 25 May 2013 10:35:12 +0000 (12:35 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 28 May 2013 12:10:58 +0000 (14:10 +0200)
Currently if no custom block VLC is specified for band, a default block VLC
will be used, while the global block VLC stored in the context should be used
instead.

This fixes decoding of one sample I have.

libavcodec/indeo4.c

index eb34688..7571435 100644 (file)
@@ -362,9 +362,12 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
         }
 
         /* decode block huffman codebook */
-        if (ff_ivi_dec_huff_desc(&ctx->gb, get_bits1(&ctx->gb), IVI_BLK_HUFF,
-                                 &band->blk_vlc, avctx))
-            return AVERROR_INVALIDDATA;
+        if (!get_bits1(&ctx->gb))
+            band->blk_vlc.tab = ctx->blk_vlc.tab;
+        else
+            if (ff_ivi_dec_huff_desc(&ctx->gb, 1, IVI_BLK_HUFF,
+                                     &band->blk_vlc, avctx))
+                return AVERROR_INVALIDDATA;
 
         /* select appropriate rvmap table for this band */
         band->rvmap_sel = get_bits1(&ctx->gb) ? get_bits(&ctx->gb, 3) : 8;