[FFmpeg-cvslog] dnxhd: profile flags

Christophe Gisquet git at videolan.org
Mon Oct 5 12:43:58 CEST 2015


ffmpeg | branch: master | Christophe Gisquet <christophe.gisquet at gmail.com> | Sat Oct  3 18:59:15 2015 +0200| [4e7cba1d8a9c62016fb70fd13aca9df44d564481] | committer: Michael Niedermayer

dnxhd: profile flags

Move the 'interlaced' flag to this element (arbitrarily set to 16bits).
This should allow better detection/selection of profiles.

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4e7cba1d8a9c62016fb70fd13aca9df44d564481
---

 libavcodec/dnxhddata.c |   49 +++++++++++++++++++++++++++++++-----------------
 libavcodec/dnxhddata.h |    6 +++++-
 2 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/libavcodec/dnxhddata.c b/libavcodec/dnxhddata.c
index c45a225..4bb215a 100644
--- a/libavcodec/dnxhddata.c
+++ b/libavcodec/dnxhddata.c
@@ -950,7 +950,8 @@ static const uint8_t dnxhd_1250_run[62] = {
 };
 
 const CIDEntry ff_dnxhd_cid_table[] = {
-    { 1235, 1920, 1080, 0, 917504, 917504, 6, 10, 4,
+    { 1235, 1920, 1080, 917504, 917504,
+      0, 6, 10, 4,
       dnxhd_1235_luma_weight, dnxhd_1235_chroma_weight,
       dnxhd_1235_dc_codes, dnxhd_1235_dc_bits,
       dnxhd_1235_ac_codes, dnxhd_1235_ac_bits, dnxhd_1235_ac_level,
@@ -958,7 +959,8 @@ const CIDEntry ff_dnxhd_cid_table[] = {
       dnxhd_1235_run_codes, dnxhd_1235_run_bits, dnxhd_1235_run,
       { 175, 185, 365, 440 },
       { { 24000, 1001 }, { 25, 1 }, { 50, 1 }, { 60000, 1001 } } },
-    { 1237, 1920, 1080, 0, 606208, 606208, 4, 8, 3,
+    { 1237, 1920, 1080, 606208, 606208,
+      0, 4, 8, 3,
       dnxhd_1237_luma_weight, dnxhd_1237_chroma_weight,
       dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
       dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level,
@@ -966,7 +968,8 @@ const CIDEntry ff_dnxhd_cid_table[] = {
       dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run,
       { 115, 120, 145, 240, 290 },
       { { 24000, 1001 }, { 25, 1 }, { 30000, 1001 }, { 50, 1 }, { 60000, 1001 } } },
-    { 1238, 1920, 1080, 0, 917504, 917504, 4, 8, 4,
+    { 1238, 1920, 1080, 917504, 917504,
+      0, 4, 8, 4,
       dnxhd_1238_luma_weight, dnxhd_1238_chroma_weight,
       dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
       dnxhd_1238_ac_codes, dnxhd_1238_ac_bits, dnxhd_1238_ac_level,
@@ -974,7 +977,8 @@ const CIDEntry ff_dnxhd_cid_table[] = {
       dnxhd_1235_run_codes, dnxhd_1235_run_bits, dnxhd_1238_run,
       { 175, 185, 220, 365, 440 },
       { { 24000, 1001 }, { 25, 1 }, { 30000, 1001 }, { 50, 1 }, { 60000, 1001 } } },
-    { 1241, 1920, 1080, 1, 917504, 458752, 6, 10, 4,
+    { 1241, 1920, 1080, 917504, 458752,
+      DNXHD_INTERLACED, 6, 10, 4,
       dnxhd_1241_luma_weight, dnxhd_1241_chroma_weight,
       dnxhd_1235_dc_codes, dnxhd_1235_dc_bits,
       dnxhd_1235_ac_codes, dnxhd_1235_ac_bits, dnxhd_1235_ac_level,
@@ -982,7 +986,8 @@ const CIDEntry ff_dnxhd_cid_table[] = {
       dnxhd_1235_run_codes, dnxhd_1235_run_bits, dnxhd_1235_run,
       { 185, 220 },
       { { 25, 1 }, { 30000, 1001 } } },
-    { 1242, 1920, 1080, 1, 606208, 303104, 4, 8, 3,
+    { 1242, 1920, 1080, 606208, 303104,
+      DNXHD_INTERLACED, 4, 8, 3,
       dnxhd_1242_luma_weight, dnxhd_1242_chroma_weight,
       dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
       dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level,
@@ -990,7 +995,8 @@ const CIDEntry ff_dnxhd_cid_table[] = {
       dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run,
       { 120, 145 },
       { { 25, 1 }, { 30000, 1001 } } },
-    { 1243, 1920, 1080, 1, 917504, 458752, 4, 8, 4,
+    { 1243, 1920, 1080, 917504, 458752,
+      DNXHD_INTERLACED, 4, 8, 4,
       dnxhd_1243_luma_weight, dnxhd_1243_chroma_weight,
       dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
       dnxhd_1238_ac_codes, dnxhd_1238_ac_bits, dnxhd_1238_ac_level,
@@ -998,7 +1004,8 @@ const CIDEntry ff_dnxhd_cid_table[] = {
       dnxhd_1235_run_codes, dnxhd_1235_run_bits, dnxhd_1238_run,
       { 185, 220 },
       { { 25, 1 }, { 30000, 1001 } } },
-    { 1250, 1280,  720, 0, 458752, 458752, 6, 10, 4,
+    { 1250, 1280,  720, 458752, 458752,
+      0, 6, 10, 4,
       dnxhd_1250_luma_weight, dnxhd_1250_chroma_weight,
       dnxhd_1235_dc_codes, dnxhd_1235_dc_bits,
       dnxhd_1250_ac_codes, dnxhd_1250_ac_bits, dnxhd_1250_ac_level,
@@ -1006,7 +1013,8 @@ const CIDEntry ff_dnxhd_cid_table[] = {
       dnxhd_1250_run_codes, dnxhd_1250_run_bits, dnxhd_1250_run,
       { 90, 90, 180, 220 },
       { { 24000, 1001 }, { 25, 1 }, { 50, 1 }, { 60000, 1001 } } },
-    { 1251, 1280,  720, 0, 458752, 458752, 4, 8, 4,
+    { 1251, 1280,  720, 458752, 458752,
+      0, 4, 8, 4,
       dnxhd_1251_luma_weight, dnxhd_1251_chroma_weight,
       dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
       dnxhd_1251_ac_codes, dnxhd_1251_ac_bits, dnxhd_1251_ac_level,
@@ -1014,7 +1022,8 @@ const CIDEntry ff_dnxhd_cid_table[] = {
       dnxhd_1250_run_codes, dnxhd_1250_run_bits, dnxhd_1250_run,
       { 90, 90, 110, 180, 220 },
       { { 24000, 1001 }, { 25, 1 }, { 30000, 1001 }, { 50, 1 }, { 60000, 1001 } } },
-    { 1252, 1280,  720, 0, 303104, 303104, 4, 8, 5,
+    { 1252, 1280,  720, 303104, 303104,
+      0, 4, 8, 5,
       dnxhd_1252_luma_weight, dnxhd_1252_chroma_weight,
       dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
       dnxhd_1252_ac_codes, dnxhd_1252_ac_bits, dnxhd_1252_ac_level,
@@ -1022,7 +1031,8 @@ const CIDEntry ff_dnxhd_cid_table[] = {
       dnxhd_1250_run_codes, dnxhd_1250_run_bits, dnxhd_1250_run,
       { 60, 60, 75, 120, 145 },
       { { 24000, 1001 }, { 25, 1 }, { 30000, 1001 }, { 50, 1 }, { 60000, 1001 } } },
-    { 1253, 1920, 1080, 0, 188416, 188416, 4, 8, 3,
+    { 1253, 1920, 1080, 188416, 188416,
+      0, 4, 8, 3,
       dnxhd_1237_luma_weight, dnxhd_1237_chroma_weight,
       dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
       dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level,
@@ -1030,7 +1040,8 @@ const CIDEntry ff_dnxhd_cid_table[] = {
       dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run,
       { 36, 36, 45, 75, 90 },
       { { 24000, 1001 }, { 25, 1 }, { 30000, 1001 }, { 50, 1 }, { 60000, 1001 } } },
-    { 1256, 1920, 1080, 0, 1835008, 1835008, 6, 10, 4,
+    { 1256, 1920, 1080, 1835008, 1835008,
+      DNXHD_444, 6, 10, 4,
       dnxhd_1235_luma_weight, dnxhd_1235_luma_weight,
       dnxhd_1235_dc_codes, dnxhd_1235_dc_bits,
       dnxhd_1235_ac_codes, dnxhd_1235_ac_bits, dnxhd_1235_ac_level,
@@ -1038,21 +1049,24 @@ const CIDEntry ff_dnxhd_cid_table[] = {
       dnxhd_1235_run_codes, dnxhd_1235_run_bits, dnxhd_1235_run,
       { 350, 390, 440, 730, 880 },
       { { 24000, 1001 }, { 25, 1 }, { 30000, 1001 }, { 50, 1 }, { 60000, 1001 } } },
-    { 1258, 960, 720, 0, 212992, 212992, 4, 8, 5,
+    { 1258, 960, 720, 212992, 212992,
+      0, 4, 8, 5,
       dnxhd_1252_luma_weight, dnxhd_1252_chroma_weight,
       dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
       dnxhd_1252_ac_codes, dnxhd_1252_ac_bits, dnxhd_1252_ac_level,
       dnxhd_1252_ac_flags,
       dnxhd_1250_run_codes, dnxhd_1250_run_bits, dnxhd_1250_run,
       { 42, 60, 75, 115 } },
-    { 1259, 1440, 1080, 0, 417792, 417792, 4, 8, 3,
+    { 1259, 1440, 1080, 417792, 417792,
+      0, 4, 8, 3,
       dnxhd_1237_luma_weight, dnxhd_1237_chroma_weight,
       dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
       dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level,
       dnxhd_1237_ac_flags,
       dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run,
       { 63, 84, 100, 110 } },
-    { 1260, 1440, 1080, 1, 835584, 417792, 4, 8, 3,
+    { 1260, 1440, 1080, 835584, 417792,
+      DNXHD_INTERLACED, 4, 8, 3,
       dnxhd_1260_luma_weight, dnxhd_1260_chroma_weight,
       dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
       dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level,
@@ -1083,7 +1097,7 @@ int avpriv_dnxhd_get_interlaced(int cid)
     int i = ff_dnxhd_get_cid_table(cid);
     if (i < 0)
         return i;
-    return ff_dnxhd_cid_table[i].interlaced;
+    return ff_dnxhd_cid_table[i].flags & DNXHD_INTERLACED ? 1 : 0;
 }
 
 int ff_dnxhd_find_cid(AVCodecContext *avctx, int bit_depth)
@@ -1094,8 +1108,9 @@ int ff_dnxhd_find_cid(AVCodecContext *avctx, int bit_depth)
         return 0;
     for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++) {
         const CIDEntry *cid = &ff_dnxhd_cid_table[i];
+        int interlaced = cid->flags & DNXHD_INTERLACED ? 1 : 0;
         if (cid->width == avctx->width && cid->height == avctx->height &&
-            cid->interlaced == !!(avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) &&
+            interlaced == !!(avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) &&
             cid->bit_depth == bit_depth) {
             for (j = 0; j < FF_ARRAY_ELEMS(cid->bit_rates); j++) {
                 if (cid->bit_rates[j] == mbs)
@@ -1116,7 +1131,7 @@ void ff_dnxhd_print_profiles(AVCodecContext *avctx, int loglevel)
                 break;
 
             av_log(avctx, loglevel, "Frame size: %dx%d%c; bitrate: %dMbps; pixel format: %s; framerate: %d/%d\n",
-                   cid->width, cid->height, cid->interlaced ? 'i' : 'p', cid->bit_rates[j],
+                   cid->width, cid->height, cid->flags & DNXHD_INTERLACED ? 'i' : 'p', cid->bit_rates[j],
                    cid->bit_depth == 10 ? "yuv422p10" : "yuv422p", cid->frame_rates[j].num, cid->frame_rates[j].den);
         }
     }
diff --git a/libavcodec/dnxhddata.h b/libavcodec/dnxhddata.h
index 8cc27e8..ade0b0b 100644
--- a/libavcodec/dnxhddata.h
+++ b/libavcodec/dnxhddata.h
@@ -26,12 +26,16 @@
 #include "avcodec.h"
 #include "libavutil/internal.h"
 
+/** Additional profile info flags */
+#define DNXHD_INTERLACED   (1<<0)
+#define DNXHD_444          (1<<1)
+
 typedef struct CIDEntry {
     int cid;
     unsigned int width, height;
-    int interlaced;
     unsigned int frame_size;
     unsigned int coding_unit_size;
+    uint16_t flags;
     int index_bits;
     int bit_depth;
     int eob_index;



More information about the ffmpeg-cvslog mailing list