[FFmpeg-cvslog] avcodec/pixlet: clip chroma before shifting

Paul B Mahol git at videolan.org
Thu Jan 19 13:52:22 EET 2017


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Jan 19 12:49:41 2017 +0100| [be46eb71013906c94f8487b19a7fa0d1e8e4a16f] | committer: Paul B Mahol

avcodec/pixlet: clip chroma before shifting

Fixes artifacts.

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

 libavcodec/pixlet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c
index c2583b1..8e27655 100644
--- a/libavcodec/pixlet.c
+++ b/libavcodec/pixlet.c
@@ -482,8 +482,8 @@ static void postprocess_chroma(AVFrame *frame, int w, int h, int depth)
 
     for (j = 0; j < h; j++) {
         for (i = 0; i < w; i++) {
-            dstu[i] = (add + srcu[i]) << shift;
-            dstv[i] = (add + srcv[i]) << shift;
+            dstu[i] = av_clip(add + srcu[i], 0, 32767) << shift;
+            dstv[i] = av_clip(add + srcv[i], 0, 32767) << shift;
         }
         dstu += strideu;
         dstv += stridev;



More information about the ffmpeg-cvslog mailing list