[FFmpeg-devel] [PATCH 3/4] dnxhddec: proper rule for interlaced mb flag

Christophe Gisquet christophe.gisquet at gmail.com
Fri Sep 25 23:25:08 CEST 2015


It currently only applies to CID 1260, but this flag is dependent on
a higher-level flag located in the header.
---
 libavcodec/dnxhddec.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 0722aa0..82a0d3c 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -58,6 +58,7 @@ typedef struct DNXHDContext {
     const CIDEntry *cid_table;
     int bit_depth; // 8, 10 or 0 if not initialized at all.
     int is_444;
+    int mbaff;
     void (*decode_dct_block)(const struct DNXHDContext *ctx,
                              RowContext *row, int16_t *block,
                              int n, int qscale);
@@ -153,6 +154,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
     } else {
         ctx->cur_field = 0;
     }
+    ctx->mbaff = buf[0x6] & 32;
 
     ctx->height = AV_RB16(buf + 0x18);
     ctx->width  = AV_RB16(buf + 0x1a);
@@ -192,6 +194,9 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
 
     if ((ret = dnxhd_init_vlc(ctx, cid)) < 0)
         return ret;
+    if (ctx->mbaff && ctx->cid_table->cid != 1260)
+        av_log(ctx->avctx, AV_LOG_WARNING,
+               "Adaptive MB interlace flag in an unsupported profile.\n");
 
     // make sure profile size constraints are respected
     // DNx100 allows 1920->1440 and 1280->960 subsampling
@@ -366,7 +371,7 @@ static int dnxhd_decode_macroblock(const DNXHDContext *ctx, RowContext *row,
     int qscale, i;
     int interlaced_mb = 0;
 
-    if (ctx->cid_table->cid == 1260) {
+    if (ctx->mbaff) {
         interlaced_mb = get_bits1(&row->gb);
         qscale = get_bits(&row->gb, 10);
     } else
-- 
2.5.3.windows.1



More information about the ffmpeg-devel mailing list