aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Reid <mindmark@gmail.com>2016-07-11 19:07:21 -0700
committerMichael Niedermayer <michael@niedermayer.cc>2016-07-16 15:39:28 +0200
commited0dc14ebba1d2e65fe39b7e8c10359adbfba36f (patch)
tree95b876b469819132ff9b1f7dc7db6b99f42581ee
parentdf9cc7f0a90cdaa2183040425623f479159f206d (diff)
downloadffmpeg-ed0dc14ebba1d2e65fe39b7e8c10359adbfba36f.tar.gz
libavcodec/dnxhd: add support more dnxhr header prefixes
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/dnxhddata.h15
-rw-r--r--libavcodec/dnxhddec.c2
2 files changed, 12 insertions, 5 deletions
diff --git a/libavcodec/dnxhddata.h b/libavcodec/dnxhddata.h
index 3ae4683a6c..2394e042a7 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 18080803fa..5b60326a01 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 ||