aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vc2enc.c
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2019-12-17 14:56:33 +0000
committerLynne <dev@lynne.ee>2019-12-17 14:56:33 +0000
commit377a095dc37222a373fba00579145e77629a5e81 (patch)
treeaab5acf0cfcfe07c7ce49a9971837370cd224e44 /libavcodec/vc2enc.c
parent3530fdc78ed8ca6f246dcaeb761bea0f5b76fc44 (diff)
downloadffmpeg-377a095dc37222a373fba00579145e77629a5e81.tar.gz
vc2enc: zero padding of the coefficient buffer
Wavelet types with large amounts of overreading/writing like 9_7 would write into the padding at high wavelet depths, which would remain and be read by the next frame's transform and quickly cause artifacts to appear for subsequent frames. This fix affects all frames encoded with a non-power-of-two width, with the artifacts varying between non-observable to very noticeable, depending on encoder settings, so reencoding is advisable.
Diffstat (limited to 'libavcodec/vc2enc.c')
-rw-r--r--libavcodec/vc2enc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c
index d0101e01e4..ba5a03e4ec 100644
--- a/libavcodec/vc2enc.c
+++ b/libavcodec/vc2enc.c
@@ -867,6 +867,7 @@ static int dwt_plane(AVCodecContext *avctx, void *arg)
for (x = 0; x < p->width; x++) {
buf[x] = pix[x] - s->diff_offset;
}
+ memset(&buf[x], 0, (p->coef_stride - p->width)*sizeof(dwtcoef));
buf += p->coef_stride;
pix += pix_stride;
}
@@ -876,6 +877,7 @@ static int dwt_plane(AVCodecContext *avctx, void *arg)
for (x = 0; x < p->width; x++) {
buf[x] = pix[x] - s->diff_offset;
}
+ memset(&buf[x], 0, (p->coef_stride - p->width)*sizeof(dwtcoef));
buf += p->coef_stride;
pix += pix_stride;
}