[FFmpeg-devel] [PATCH] libavcodec/dnxhddata.c: Fix quantization weights for id 1271

Neil Birkbeck neil.birkbeck at gmail.com
Mon Apr 20 20:12:32 EEST 2020


>From the ST 2019-1:2016 standard,
https://ieeexplore.ieee.org/abstract/document/7513364
in Table D.1, compression ID 1235, 1271 use the same weights.

This fixes what looks like a slight sharpening when decoding
samples encoded as DNxHR HQX 10- or 12-bit from other encoders
(e.g., like from DaVinci Resolve).

Signed-off-by: Neil Birkbeck <neil.birkbeck at gmail.com>
---
 libavcodec/dnxhddata.c     | 10 +++++-----
 tests/ref/fate/dnxhr-12bit |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/dnxhddata.c b/libavcodec/dnxhddata.c
index 154be89860..73260eadba 100644
--- a/libavcodec/dnxhddata.c
+++ b/libavcodec/dnxhddata.c
@@ -25,7 +25,7 @@
 
 /* The quantization tables below are in zigzag order! */
 
-/* Used in CID 1235, 1256, 1270 */
+/* Used in CID 1235, 1256, 1270, 1271 */
 static const uint8_t dnxhd_1235_luma_weight[] = {
      0, 32, 32, 32, 33, 32, 32, 32,
     32, 31, 32, 33, 33, 33, 33, 35,
@@ -37,7 +37,7 @@ static const uint8_t dnxhd_1235_luma_weight[] = {
     50, 50, 53, 55, 55, 56, 60, 60,
 };
 
-/* Used in CID 1235, 1256 */
+/* Used in CID 1235, 1256, 1271 */
 static const uint8_t dnxhd_1235_chroma_weight[] = {
      0, 32, 33, 34, 34, 33, 34, 35,
     37, 40, 43, 42, 39, 38, 39, 41,
@@ -97,7 +97,7 @@ static const uint8_t dnxhd_1238_chroma_weight[] = {
     82, 77, 80, 86, 84, 82, 82, 82,
 };
 
-/* Used in CID 1241, 1271 */
+/* Used in CID 1241 */
 static const uint8_t dnxhd_1241_luma_weight[] = {
      0, 32, 33, 34, 34, 35, 36, 37,
     36, 37, 38, 38, 38, 39, 39, 40,
@@ -109,7 +109,7 @@ static const uint8_t dnxhd_1241_luma_weight[] = {
     48, 46, 47, 48, 48, 49, 49, 49,
 };
 
-/* Used in CID 1241, 1271 */
+/* Used in CID 1241 */
 static const uint8_t dnxhd_1241_chroma_weight[] = {
      0, 32, 36, 38, 37, 37, 40, 41,
     40, 40, 42, 42, 41, 41, 41, 41,
@@ -1047,7 +1047,7 @@ const CIDEntry ff_dnxhd_cid_table[] = {
       { 0 }, { 57344, 255} },
     { 1271, DNXHD_VARIABLE, DNXHD_VARIABLE, DNXHD_VARIABLE, DNXHD_VARIABLE,
       0, 6, DNXHD_VARIABLE, 4,
-      dnxhd_1241_luma_weight, dnxhd_1241_chroma_weight,
+      dnxhd_1235_luma_weight, dnxhd_1235_chroma_weight,
       dnxhd_1235_dc_codes, dnxhd_1235_dc_bits,
       dnxhd_1235_ac_codes, dnxhd_1235_ac_bits, dnxhd_1235_ac_info,
       dnxhd_1235_run_codes, dnxhd_1235_run_bits, dnxhd_1235_run,
diff --git a/tests/ref/fate/dnxhr-12bit b/tests/ref/fate/dnxhr-12bit
index eb5716780c..c6e8fd99ae 100644
--- a/tests/ref/fate/dnxhr-12bit
+++ b/tests/ref/fate/dnxhr-12bit
@@ -3,4 +3,4 @@
 #codec_id 0: rawvideo
 #dimensions 0: 1920x1080
 #sar 0: 1/1
-0,          0,          0,        1,  8294400, 0x31bfa8f1
+0,          0,          0,        1,  8294400, 0xbe1dc546
-- 
2.26.1.301.g55bc3eb7cb9-goog



More information about the ffmpeg-devel mailing list