On 01/10/15 17:06, Vittorio Giovara wrote:
> From: Joseph Artsimovich <[email protected]>
> 
> Convert them to zigzag order, as the rest of them are.
> 
> When I was adding support for 10-bit DNxHD, I just copy-pasted the
> missing quant matrices from the spec. Now it turns out the existing
> matrices in dnxhddata.c were in zigzag order. This resulted in wrong
> quantization for 10-bit DNxHD. The attached patch fixes the problem by
> converting 10-bit quant matrices to zigzag order.
> 
> Signed-off-by: Michael Niedermayer <[email protected]>
> ---
>  libavcodec/dnxhddata.c                    | 66 
> ++++++++++++++++---------------
>  tests/ref/vsynth/vsynth1-dnxhd-720p-10bit |  4 +-
>  tests/ref/vsynth/vsynth2-dnxhd-720p-10bit |  6 +--
>  3 files changed, 39 insertions(+), 37 deletions(-)
> 
> diff --git a/libavcodec/dnxhddata.c b/libavcodec/dnxhddata.c
> index 1bf7634..a6ef0b5 100644
> --- a/libavcodec/dnxhddata.c
> +++ b/libavcodec/dnxhddata.c
> @@ -23,27 +23,29 @@
>  #include "dnxhddata.h"
>  #include "libavutil/common.h"
>  
> +/* The quantization tables below are in zigzag order! */
> +
>  /* Used in CID 1235, 1256 */
>  static const uint8_t dnxhd_1235_luma_weight[] = {
> -     0, 32, 32, 32, 33, 35, 38, 39,
> -    32, 33, 32, 33, 36, 36, 39, 42,
> -    32, 32, 33, 36, 35, 37, 41, 43,
> -    31, 33, 34, 36, 36, 40, 42, 48,
> -    32, 34, 36, 37, 39, 42, 46, 51,
> -    36, 37, 37, 39, 41, 46, 51, 55,
> -    37, 39, 41, 41, 47, 50, 55, 56,
> -    41, 42, 41, 44, 50, 53, 60, 60
> +     0, 32, 32, 32, 33, 32, 32, 32,
> +    32, 31, 32, 33, 33, 33, 33, 35,
> +    36, 36, 34, 34, 36, 37, 37, 36,
> +    36, 35, 36, 38, 39, 39, 37, 36,
> +    37, 37, 39, 41, 42, 41, 39, 39,
> +    40, 41, 42, 43, 42, 42, 41, 41,
> +    41, 44, 47, 46, 46, 48, 51, 51,
> +    50, 50, 53, 55, 55, 56, 60, 60,
>  };
>  
>  static const uint8_t dnxhd_1235_chroma_weight[] = {
> -     0, 32, 33, 34, 39, 41, 54, 59,
> -    33, 34, 35, 38, 43, 49, 58, 84,
> -    34, 37, 39, 44, 46, 55, 74, 87,
> -    40, 42, 47, 48, 58, 70, 87, 86,
> -    43, 50, 56, 63, 72, 94, 91, 82,
> -    55, 63, 65, 75, 93, 89, 85, 73,
> -    61, 67, 82, 81, 83, 90, 79, 73,
> -    74, 84, 75, 78, 90, 85, 73, 73
> +     0, 32, 33, 34, 34, 33, 34, 35,
> +    37, 40, 43, 42, 39, 38, 39, 41,
> +    43, 44, 47, 50, 55, 61, 63, 56,
> +    48, 46, 49, 54, 59, 58, 55, 58,
> +    63, 65, 67, 74, 84, 82, 75, 72,
> +    70, 74, 84, 87, 87, 94, 93, 81,
> +    75, 78, 83, 89, 91, 86, 82, 85,
> +    90, 90, 85, 79, 73, 73, 73, 73,
>  };
>  
>  /* Used in CID 1237, 1253 */
> @@ -159,25 +161,25 @@ static const uint8_t dnxhd_1243_chroma_weight[] = {
>  };
>  
>  static const uint8_t dnxhd_1250_luma_weight[] = {
> -     0, 32, 35, 35, 36, 36, 41, 43,
> -    32, 34, 35, 36, 37, 39, 43, 47,
> -    33, 34, 36, 38, 38, 42, 42, 50,
> -    34, 36, 38, 38, 41, 40, 47, 54,
> -    35, 38, 39, 40, 39, 45, 49, 58,
> -    38, 39, 40, 39, 46, 47, 54, 60,
> -    38, 39, 41, 46, 46, 48, 57, 62,
> -    40, 41, 44, 45, 49, 54, 63, 63
> +     0, 32, 32, 33, 34, 35, 35, 35,
> +    34, 34, 35, 36, 36, 36, 36, 36,
> +    37, 38, 38, 38, 38, 38, 39, 39,
> +    38, 38, 39, 41, 43, 43, 42, 41,
> +    40, 40, 39, 40, 41, 41, 39, 39,
> +    40, 42, 47, 50, 47, 45, 46, 46,
> +    44, 45, 46, 47, 49, 54, 58, 54,
> +    48, 49, 54, 57, 60, 62, 63, 63,
>  };
>  
>  static const uint8_t dnxhd_1250_chroma_weight[] = {
> -     0, 32, 35, 36, 40, 42, 51, 51,
> -    35, 36, 39, 39, 43, 51, 52, 55,
> -    36, 41, 41, 43, 51, 53, 54, 56,
> -    43, 44, 45, 50, 54, 54, 55, 57,
> -    45, 48, 50, 51, 55, 58, 59, 58,
> -    49, 52, 49, 57, 58, 62, 58, 60,
> -    51, 51, 56, 58, 62, 61, 59, 62,
> -    52, 52, 60, 61, 59, 59, 63, 63
> +     0, 32, 35, 36, 36, 35, 36, 39,
> +    41, 43, 45, 44, 41, 39, 40, 42,
> +    43, 43, 45, 48, 49, 51, 52, 50,
> +    50, 51, 51, 51, 51, 52, 53, 54,
> +    51, 49, 51, 52, 52, 56, 57, 55,
> +    54, 54, 55, 56, 55, 58, 58, 58,
> +    60, 61, 62, 62, 59, 57, 58, 58,
> +    61, 59, 59, 59, 60, 62, 63, 63,
>  };
>  
>  static const uint8_t dnxhd_1251_luma_weight[] = {
> diff --git a/tests/ref/vsynth/vsynth1-dnxhd-720p-10bit 
> b/tests/ref/vsynth/vsynth1-dnxhd-720p-10bit
> index a667b9d..59423e7 100644
> --- a/tests/ref/vsynth/vsynth1-dnxhd-720p-10bit
> +++ b/tests/ref/vsynth/vsynth1-dnxhd-720p-10bit
> @@ -1,4 +1,4 @@
> -b5e24a055af02edec8674333260214fd 
> *tests/data/fate/vsynth1-dnxhd-720p-10bit.dnxhd
> +f8c4b7aa165a80df2485d526161290a3 
> *tests/data/fate/vsynth1-dnxhd-720p-10bit.dnxhd
>  2293760 tests/data/fate/vsynth1-dnxhd-720p-10bit.dnxhd
> -4466ff3d73d01bbe75ea25001d379b63 
> *tests/data/fate/vsynth1-dnxhd-720p-10bit.out.rawvideo
> +790777baa4bb70c4e32cb13649cc26bf 
> *tests/data/fate/vsynth1-dnxhd-720p-10bit.out.rawvideo
>  stddev:    6.27 PSNR: 32.18 MAXDIFF:   64 bytes:  7603200/   760320
> diff --git a/tests/ref/vsynth/vsynth2-dnxhd-720p-10bit 
> b/tests/ref/vsynth/vsynth2-dnxhd-720p-10bit
> index 749d5f0..30f546a 100644
> --- a/tests/ref/vsynth/vsynth2-dnxhd-720p-10bit
> +++ b/tests/ref/vsynth/vsynth2-dnxhd-720p-10bit
> @@ -1,4 +1,4 @@
> -4798978f178cdb91203cda27e76ce75e 
> *tests/data/fate/vsynth2-dnxhd-720p-10bit.dnxhd
> +e49cb87f69acc809aee55d64990c84a9 
> *tests/data/fate/vsynth2-dnxhd-720p-10bit.dnxhd
>  2293760 tests/data/fate/vsynth2-dnxhd-720p-10bit.dnxhd
> -7ce1b7e73432498b530c6aa970566757 
> *tests/data/fate/vsynth2-dnxhd-720p-10bit.out.rawvideo
> -stddev:    1.56 PSNR: 44.24 MAXDIFF:   31 bytes:  7603200/   760320
> +6354193e59c7b39a2781c41a2500c793 
> *tests/data/fate/vsynth2-dnxhd-720p-10bit.out.rawvideo
> +stddev:    1.56 PSNR: 44.25 MAXDIFF:   31 bytes:  7603200/   760320
> 


Ok, I guess. (the output looks correct?)
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to