From be46eb71013906c94f8487b19a7fa0d1e8e4a16f Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Thu, 19 Jan 2017 12:49:41 +0100 Subject: avcodec/pixlet: clip chroma before shifting Fixes artifacts. Signed-off-by: Paul B Mahol --- libavcodec/pixlet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libavcodec/pixlet.c') diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c index c2583b10c7..8e27655542 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; -- cgit v1.2.3