[FFmpeg-cvslog] vc2enc: zero padding of the coefficient buffer

Lynne git at videolan.org
Tue Dec 17 17:05:48 EET 2019


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Tue Dec 17 14:56:33 2019 +0000| [377a095dc37222a373fba00579145e77629a5e81] | committer: 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.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=377a095dc37222a373fba00579145e77629a5e81
---

 libavcodec/vc2enc.c | 2 ++
 1 file changed, 2 insertions(+)

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;
         }



More information about the ffmpeg-cvslog mailing list