[PATCH] libavcodec/dnxhd: add support more dnxhr header prefixes
Hi, The following patch adds support for detecting more dnxhr header prefixes. After generating many random resolution dnxhr files via quicktime, I have deduced that second 4 bytes in prefix is the header size or data offset to the end of the scan table. On heights smaller then 1080 the header size is always 0x0280 here are some samples with prefixes that aren't currently supported. https://dl.dropboxusercontent.com/u/170952/ffmpeg_samples/new_header_prefixs... https://dl.dropboxusercontent.com/u/170952/ffmpeg_samples/new_header_prefixs... https://dl.dropboxusercontent.com/u/170952/ffmpeg_samples/new_header_prefixs... https://dl.dropboxusercontent.com/u/170952/ffmpeg_samples/new_header_prefixs... Mark Reid (1): libavcodec/dnxhd: add support more dnxhr header prefixes libavcodec/dnxhddata.h | 15 +++++++++++---- libavcodec/dnxhddec.c | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) -- 2.7.3
--- 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 || -- 2.7.3
On Mon, Jul 11, 2016 at 07:07:21PM -0700, Mark Reid wrote:
--- libavcodec/dnxhddata.h | 15 +++++++++++---- libavcodec/dnxhddec.c | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-)
applied can you add a fate test for this ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB No snowflake in an avalanche ever feels responsible. -- Voltaire
On Sat, Jul 16, 2016 at 7:16 AM, Michael Niedermayer <michael@niedermayer.cc> wrote:
On Mon, Jul 11, 2016 at 07:07:21PM -0700, Mark Reid wrote:
--- libavcodec/dnxhddata.h | 15 +++++++++++---- libavcodec/dnxhddec.c | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-)
applied
can you add a fate test for this ?
yes, I'll send a patch.
[...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No snowflake in an avalanche ever feels responsible. -- Voltaire
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
On 7/12/16, Mark Reid <mindmark@gmail.com> wrote:
Hi, The following patch adds support for detecting more dnxhr header prefixes.
After generating many random resolution dnxhr files via quicktime, I have deduced that second 4 bytes in prefix is the header size or data offset to the end of the scan table. On heights smaller then 1080 the header size is always 0x0280
here are some samples with prefixes that aren't currently supported. https://dl.dropboxusercontent.com/u/170952/ffmpeg_samples/new_header_prefixs... https://dl.dropboxusercontent.com/u/170952/ffmpeg_samples/new_header_prefixs... https://dl.dropboxusercontent.com/u/170952/ffmpeg_samples/new_header_prefixs... https://dl.dropboxusercontent.com/u/170952/ffmpeg_samples/new_header_prefixs...
Mark Reid (1): libavcodec/dnxhd: add support more dnxhr header prefixes
libavcodec/dnxhddata.h | 15 +++++++++++---- libavcodec/dnxhddec.c | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-)
This one causes http://trac.ffmpeg.org/ticket/6214
On Mon, Mar 20, 2017 at 12:48 PM, Paul B Mahol <onemda@gmail.com> wrote:
Hi, The following patch adds support for detecting more dnxhr header
On 7/12/16, Mark Reid <mindmark@gmail.com> wrote: prefixes.
After generating many random resolution dnxhr files via quicktime, I have deduced that second 4 bytes in prefix is the header size or data offset to the end of the scan table. On heights smaller then 1080
the
header size is always 0x0280
here are some samples with prefixes that aren't currently supported. https://dl.dropboxusercontent.com/u/170952/ffmpeg_samples/ new_header_prefixs/lb_2k_2048x1536.mxf https://dl.dropboxusercontent.com/u/170952/ffmpeg_samples/ new_header_prefixs/lb_4k_Full_Aperture_4096x3112.mxf https://dl.dropboxusercontent.com/u/170952/ffmpeg_samples/ new_header_prefixs/lb_custom_2766x3234.mov https://dl.dropboxusercontent.com/u/170952/ffmpeg_samples/ new_header_prefixs/lb_custom_3462x2134.mov
Mark Reid (1): libavcodec/dnxhd: add support more dnxhr header prefixes
libavcodec/dnxhddata.h | 15 +++++++++++---- libavcodec/dnxhddec.c | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-)
This one causes http://trac.ffmpeg.org/ticket/6214
I've identified the issue, working on a fix.
On Tue, Mar 21, 2017 at 9:40 AM, Mark Reid <mindmark@gmail.com> wrote:
On Mon, Mar 20, 2017 at 12:48 PM, Paul B Mahol <onemda@gmail.com> wrote:
Hi, The following patch adds support for detecting more dnxhr header
On 7/12/16, Mark Reid <mindmark@gmail.com> wrote: prefixes.
After generating many random resolution dnxhr files via quicktime, I have deduced that second 4 bytes in prefix is the header size or data offset to the end of the scan table. On heights smaller then 1080
the
header size is always 0x0280
here are some samples with prefixes that aren't currently supported. https://dl.dropboxusercontent.com/u/170952/ffmpeg_samples/ne w_header_prefixs/lb_2k_2048x1536.mxf https://dl.dropboxusercontent.com/u/170952/ffmpeg_samples/ne w_header_prefixs/lb_4k_Full_Aperture_4096x3112.mxf https://dl.dropboxusercontent.com/u/170952/ffmpeg_samples/ne w_header_prefixs/lb_custom_2766x3234.mov https://dl.dropboxusercontent.com/u/170952/ffmpeg_samples/ne w_header_prefixs/lb_custom_3462x2134.mov
Mark Reid (1): libavcodec/dnxhd: add support more dnxhr header prefixes
libavcodec/dnxhddata.h | 15 +++++++++++---- libavcodec/dnxhddec.c | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-)
This one causes http://trac.ffmpeg.org/ticket/6214
I've identified the issue, working on a fix.
nevermind, see your already working on a similar fix.
participants (3)
-
Mark Reid -
Michael Niedermayer -
Paul B Mahol