aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale/output.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-02-14 20:33:39 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-02-14 21:33:40 +0100
commitf03a02993935420201b3cf60842e202475619ee3 (patch)
treed0eacae0c5c9c5f17e121b0439925513863efe71 /libswscale/output.c
parentef96bf294d8dd7064dbc01e81fc5dc9c9e7c6d86 (diff)
downloadffmpeg-f03a02993935420201b3cf60842e202475619ee3.tar.gz
swscale: Add cliping to yuv2422_1_c_template()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/output.c')
-rw-r--r--libswscale/output.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libswscale/output.c b/libswscale/output.c
index 658ee2c89f..d24cf1f1ea 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -519,6 +519,13 @@ yuv2422_1_c_template(SwsContext *c, const int16_t *buf0,
int U = (ubuf0[i] +64) >> 7;
int V = (vbuf0[i] +64) >> 7;
+ if ((Y1 | Y2 | U | V) & 0x100) {
+ Y1 = av_clip_uint8(Y1);
+ Y2 = av_clip_uint8(Y2);
+ U = av_clip_uint8(U);
+ V = av_clip_uint8(V);
+ }
+
output_pixels(i * 4, Y1, U, Y2, V);
}
} else {
@@ -529,6 +536,13 @@ yuv2422_1_c_template(SwsContext *c, const int16_t *buf0,
int U = (ubuf0[i] + ubuf1[i]+128) >> 8;
int V = (vbuf0[i] + vbuf1[i]+128) >> 8;
+ if ((Y1 | Y2 | U | V) & 0x100) {
+ Y1 = av_clip_uint8(Y1);
+ Y2 = av_clip_uint8(Y2);
+ U = av_clip_uint8(U);
+ V = av_clip_uint8(V);
+ }
+
output_pixels(i * 4, Y1, U, Y2, V);
}
}