Unverified Commit 377a095d authored by Lynne's avatar Lynne

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.
parent 3530fdc7
...@@ -867,6 +867,7 @@ static int dwt_plane(AVCodecContext *avctx, void *arg) ...@@ -867,6 +867,7 @@ static int dwt_plane(AVCodecContext *avctx, void *arg)
for (x = 0; x < p->width; x++) { for (x = 0; x < p->width; x++) {
buf[x] = pix[x] - s->diff_offset; buf[x] = pix[x] - s->diff_offset;
} }
memset(&buf[x], 0, (p->coef_stride - p->width)*sizeof(dwtcoef));
buf += p->coef_stride; buf += p->coef_stride;
pix += pix_stride; pix += pix_stride;
} }
...@@ -876,6 +877,7 @@ static int dwt_plane(AVCodecContext *avctx, void *arg) ...@@ -876,6 +877,7 @@ static int dwt_plane(AVCodecContext *avctx, void *arg)
for (x = 0; x < p->width; x++) { for (x = 0; x < p->width; x++) {
buf[x] = pix[x] - s->diff_offset; buf[x] = pix[x] - s->diff_offset;
} }
memset(&buf[x], 0, (p->coef_stride - p->width)*sizeof(dwtcoef));
buf += p->coef_stride; buf += p->coef_stride;
pix += pix_stride; pix += pix_stride;
} }
......
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