aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/pixlet.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2017-01-19 12:49:41 +0100
committerPaul B Mahol <onemda@gmail.com>2017-01-19 12:49:41 +0100
commitbe46eb71013906c94f8487b19a7fa0d1e8e4a16f (patch)
tree38825ecfbc7a040b9b6ae66a37e163711e84d176 /libavcodec/pixlet.c
parent1daa08bd96991d798ab883e049ef9177001efa98 (diff)
downloadffmpeg-be46eb71013906c94f8487b19a7fa0d1e8e4a16f.tar.gz
avcodec/pixlet: clip chroma before shifting
Fixes artifacts. Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec/pixlet.c')
-rw-r--r--libavcodec/pixlet.c4
1 files changed, 2 insertions, 2 deletions
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;