Commit b6c207f5 authored by Rostislav Pehlivanov's avatar Rostislav Pehlivanov

vc2enc_dwt: use 32 bit coefficients by default

The problem is that with particularly complex images and especially at
high bit depths and 5-level transforms the coefficients would overflow,
causing huge artifacts to appear. This was discovered thanks to the fate
tests, which will have to be redone as this fixes a multitude of
problems and increases PSNR.

There is a slight performance drop associated with this change, making
the encoder slower by 1.15 times, however this is necessary in order to
avoid undefined behavior and overflows.

It would be worth to template the transforms to keep the performance for
8 bit images as 32 bit coefficients are unnecessary for that case, but
the primary use of the encoder is to encode video at 10 bits.
Reviewed-by: 's avatarChristophe Gisquet <christophe.gisquet@gmail.com>
Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
Signed-off-by: 's avatarRostislav Pehlivanov <atomnuker@gmail.com>
parent 64fd62d6
......@@ -25,7 +25,7 @@
#include <stddef.h>
#include <stdint.h>
typedef int16_t dwtcoef;
typedef int32_t dwtcoef;
enum VC2TransformType {
VC2_TRANSFORM_9_7 = 0, /* Deslauriers-Dubuc (9,7) */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment