summaryrefslogtreecommitdiff
path: root/libavcodec/motionpixels.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-03 21:02:32 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-03 21:02:32 +0200
commit27744fe439c59182e608c381928817d64bb21d96 (patch)
tree62b70361f060197a5f8fc961cea0877c0df443d5 /libavcodec/motionpixels.c
parentaf58a77f0a9760c97c736bb54ae2884dcf73cf4f (diff)
parent1d4a01474d54a4d3bb59dc94d285334f7bcbd889 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: mpeg12: fixed parsing in some mpeg2 streams Add SMPTE240M transfer characteristics flag. mpegts: Some additional HDMV types and reg descriptors for mpegts motionpixels: Clip YUV values after applying a gradient. jpeg: handle progressive in second field of interlaced. ituh263dec: Implement enough of Annex O (scalability) to fix a FPE. h263: more strictly forbid frame size changes with frame-mt. h264: additional protection against unsupported size/bitdepth changes. tta: prevents overflows for 32bit integers in header. configure: remove malloc_aligned. vp8: update frame size changes on thread context switches. snowdsp: explicitily state instruction size. wmall: fix reconstructing audio with uncoded channels WMAL cosmetics: fix indentation gitignore: add Win32 library suffixes Conflicts: configure libavcodec/h263dec.c libavcodec/h264.c libavcodec/ituh263dec.c libavcodec/mjpegdec.c libavcodec/wmalosslessdec.c libavcodec/x86/snowdsp_mmx.c libavformat/mpegts.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/motionpixels.c')
-rw-r--r--libavcodec/motionpixels.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c
index 8c34e8b113..0ff8f3a54f 100644
--- a/libavcodec/motionpixels.c
+++ b/libavcodec/motionpixels.c
@@ -191,10 +191,13 @@ static void mp_decode_line(MotionPixelsContext *mp, GetBitContext *gb, int y)
p = mp_get_yuv_from_rgb(mp, x - 1, y);
} else {
p.y += mp_gradient(mp, 0, mp_get_vlc(mp, gb));
+ p.y = av_clip(p.y, 0, 31);
if ((x & 3) == 0) {
if ((y & 3) == 0) {
p.v += mp_gradient(mp, 1, mp_get_vlc(mp, gb));
+ p.v = av_clip(p.v, -32, 31);
p.u += mp_gradient(mp, 2, mp_get_vlc(mp, gb));
+ p.u = av_clip(p.u, -32, 31);
mp->hpt[((y / 4) * mp->avctx->width + x) / 4] = p;
} else {
p.v = mp->hpt[((y / 4) * mp->avctx->width + x) / 4].v;
@@ -218,9 +221,12 @@ static void mp_decode_frame_helper(MotionPixelsContext *mp, GetBitContext *gb)
p = mp_get_yuv_from_rgb(mp, 0, y);
} else {
p.y += mp_gradient(mp, 0, mp_get_vlc(mp, gb));
+ p.y = av_clip(p.y, 0, 31);
if ((y & 3) == 0) {
p.v += mp_gradient(mp, 1, mp_get_vlc(mp, gb));
+ p.v = av_clip(p.v, -32, 31);
p.u += mp_gradient(mp, 2, mp_get_vlc(mp, gb));
+ p.u = av_clip(p.u, -32, 31);
}
mp->vpt[y] = p;
mp_set_rgb_from_yuv(mp, 0, y, &p);