diff mbox

[FFmpeg-devel] libavcodec/dnxhd: Enable 12-bit DNxHR support.

Message ID 1470119172-3485-2-git-send-email-steven@strobe.cc
State Accepted
Commit e1be80aa11cca765881d04f21119487db53c4ffa
Headers show

Commit Message

Steven Robertson Aug. 2, 2016, 6:26 a.m. UTC
10- and 12-bit DNxHR use the same DC coefficient decoding process and
VLC table, just with a different shift value. From SMPTE 2019-1:2016,
8.2.4 DC Coefficient Decoding:

"For 8-bit video sampling, the maximum value of η=11 and for
10-/12-bit video sampling, the maximum value of η=13."

A sample file will be uploaded to show that with this patch, things
decode correctly:
dnxhr_hqx_12bit_1080p_smpte_colorbars_davinci_resolve.mov

Signed-off-by: Steven Robertson <steven@strobe.cc>
---
 libavcodec/dnxhddec.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Michael Niedermayer Aug. 3, 2016, 1:19 a.m. UTC | #1
On Mon, Aug 01, 2016 at 11:26:12PM -0700, Steven Robertson wrote:
> 10- and 12-bit DNxHR use the same DC coefficient decoding process and
> VLC table, just with a different shift value. From SMPTE 2019-1:2016,
> 8.2.4 DC Coefficient Decoding:
> 
> "For 8-bit video sampling, the maximum value of η=11 and for
> 10-/12-bit video sampling, the maximum value of η=13."
> 
> A sample file will be uploaded to show that with this patch, things
> decode correctly:
> dnxhr_hqx_12bit_1080p_smpte_colorbars_davinci_resolve.mov
> 
> Signed-off-by: Steven Robertson <steven@strobe.cc>
> ---
>  libavcodec/dnxhddec.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)

applied

can you add a fate test

thx

[...]
diff mbox

Patch

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 4d3a4a6..4d1b006 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -119,11 +119,6 @@  static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, int bitdepth)
             av_log(ctx->avctx, AV_LOG_ERROR, "bit depth mismatches %d %d\n", ff_dnxhd_cid_table[index].bit_depth, bitdepth);
             return AVERROR_INVALIDDATA;
         }
-        if (bitdepth > 10) {
-            avpriv_request_sample(ctx->avctx, "DNXHR 12-bit");
-            if (ctx->avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL)
-                return AVERROR_PATCHWELCOME;
-        }
         ctx->cid_table = &ff_dnxhd_cid_table[index];
         av_log(ctx->avctx, AV_LOG_VERBOSE, "Profile cid %d.\n", cid);
 
@@ -134,7 +129,7 @@  static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, int bitdepth)
         init_vlc(&ctx->ac_vlc, DNXHD_VLC_BITS, 257,
                  ctx->cid_table->ac_bits, 1, 1,
                  ctx->cid_table->ac_codes, 2, 2, 0);
-        init_vlc(&ctx->dc_vlc, DNXHD_DC_VLC_BITS, bitdepth + 4,
+        init_vlc(&ctx->dc_vlc, DNXHD_DC_VLC_BITS, bitdepth > 8 ? 14 : 12,
                  ctx->cid_table->dc_bits, 1, 1,
                  ctx->cid_table->dc_codes, 1, 1, 0);
         init_vlc(&ctx->run_vlc, DNXHD_VLC_BITS, 62,