1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00

libavcodec/dnxhd: add support more dnxhr header prefixes

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Mark Reid 2016-07-11 19:07:21 -07:00 committed by Michael Niedermayer
parent df9cc7f0a9
commit ed0dc14ebb
2 changed files with 12 additions and 5 deletions

View File

@ -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;
}

View File

@ -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 ||