[FFmpeg-cvslog] libavcodec/dnxhd: add support more dnxhr header prefixes

Mark Reid git at videolan.org
Sat Jul 16 16:17:28 CEST 2016


ffmpeg | branch: master | Mark Reid <mindmark at gmail.com> | Mon Jul 11 19:07:21 2016 -0700| [ed0dc14ebba1d2e65fe39b7e8c10359adbfba36f] | committer: Michael Niedermayer

libavcodec/dnxhd: add support more dnxhr header prefixes

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

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

 libavcodec/dnxhddata.h |   15 +++++++++++----
 libavcodec/dnxhddec.c  |    2 +-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/libavcodec/dnxhddata.h b/libavcodec/dnxhddata.h
index 3ae4683..2394e04 100644
--- a/libavcodec/dnxhddata.h
+++ b/libavcodec/dnxhddata.h
@@ -34,8 +34,6 @@
 /** Frame headers, extra 0x00 added to end for parser */
 #define DNXHD_HEADER_INITIAL 0x000002800100
 #define DNXHD_HEADER_444     0x000002800200
-#define DNXHD_HEADER_HR1     0x000002800300
-#define DNXHD_HEADER_HR2     0x0000038C0300
 
 /** Indicate that a CIDEntry value must be read in the bitstream */
 #define DNXHD_VARIABLE 0
@@ -65,12 +63,21 @@ int ff_dnxhd_get_cid_table(int cid);
 int ff_dnxhd_find_cid(AVCodecContext *avctx, int bit_depth);
 void ff_dnxhd_print_profiles(AVCodecContext *avctx, int loglevel);
 
+static av_always_inline uint64_t ff_dnxhd_check_header_prefix_hr(uint64_t prefix)
+{
+    uint64_t data_offset = prefix >> 16;
+    if ((prefix & 0xFFFF0000FFFFLL) == 0x0300 &&
+         data_offset >= 0x0280 && data_offset <= 0x2170 &&
+         data_offset % 4 == 0)
+        return prefix;
+    return 0;
+}
+
 static av_always_inline uint64_t ff_dnxhd_check_header_prefix(uint64_t prefix)
 {
     if (prefix == DNXHD_HEADER_INITIAL ||
         prefix == DNXHD_HEADER_444     ||
-        prefix == DNXHD_HEADER_HR1     ||
-        prefix == DNXHD_HEADER_HR2)
+        ff_dnxhd_check_header_prefix_hr(prefix))
         return prefix;
     return 0;
 }
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 1808080..5b60326 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -275,7 +275,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
            ctx->bit_depth, ctx->mbaff, ctx->act);
 
     // Newer format supports variable mb_scan_index sizes
-    if (header_prefix == DNXHD_HEADER_HR2) {
+    if (ctx->mb_height > 68 && ff_dnxhd_check_header_prefix_hr(header_prefix)) {
         ctx->data_offset = 0x170 + (ctx->mb_height << 2);
     } else {
         if (ctx->mb_height > 68 ||



More information about the ffmpeg-cvslog mailing list