diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-05-14 02:19:23 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-05-14 02:19:58 +0200 |
commit | 58c03f6d7d6eabdbc25103e8229a06ddf3718bb9 (patch) | |
tree | 9796a7be60b1b305a4e0235ffde5ede275f740b8 /libswscale/swscale.c | |
parent | 01d3ebaf219d83c0a70cdf9696ecb6b868e8a165 (diff) | |
parent | 9f54e461fecec7a97ec1b97ae4468135ea770609 (diff) | |
download | ffmpeg-58c03f6d7d6eabdbc25103e8229a06ddf3718bb9.tar.gz |
Merge remote branch 'qatar/master'
* qatar/master:
swscale: properly inline bits/endianness in yuv2yuvX16inC().
(We didnt pull the bug) swscale: fix clipping of 9/10bit YUV420P.
Add av_clip_uintp2() function
(our patch / duplicate) dfa: fix buffer overflow checks to avoid integer overflows.
(our patch / duplicate) movenc: always write esds descriptor length using 4 bytes.
(our patch / duplicate) ffmpeg: use parse_number_and_die() when it makes sense
(No thanks) ffmpeg: get rid of the 'q' key schizofrenia
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/swscale.c')
-rw-r--r-- | libswscale/swscale.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 16379182ac..c727408687 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -367,6 +367,20 @@ static av_always_inline void yuv2yuvX16inC_template(const int16_t *lumFilter, co //FIXME Optimize (just quickly written not optimized..) int i; +#define output_pixel(pos, val) \ + if (big_endian) { \ + if (output_bits == 16) { \ + AV_WB16(pos, av_clip_uint16(val >> shift)); \ + } else { \ + AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits)); \ + } \ + } else { \ + if (output_bits == 16) { \ + AV_WL16(pos, av_clip_uint16(val >> shift)); \ + } else { \ + AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits)); \ + } \ + } for (i = 0; i < dstW; i++) { int val = 1 << 10; int j; @@ -374,11 +388,7 @@ static av_always_inline void yuv2yuvX16inC_template(const int16_t *lumFilter, co for (j = 0; j < lumFilterSize; j++) val += lumSrc[j][i] * lumFilter[j]; - if (big_endian) { - AV_WB16(&dest[i], av_clip_uint16(val >> 11)); - } else { - AV_WL16(&dest[i], av_clip_uint16(val >> 11)); - } + output_pixel(&dest[i], val); } if (uDest) { @@ -392,13 +402,8 @@ static av_always_inline void yuv2yuvX16inC_template(const int16_t *lumFilter, co v += chrSrc[j][i + VOFW] * chrFilter[j]; } - if (big_endian) { - AV_WB16(&uDest[i], av_clip_uint16(u >> 11)); - AV_WB16(&vDest[i], av_clip_uint16(v >> 11)); - } else { - AV_WL16(&uDest[i], av_clip_uint16(u >> 11)); - AV_WL16(&vDest[i], av_clip_uint16(v >> 11)); - } + output_pixel(&uDest[i], u); + output_pixel(&vDest[i], v); } } @@ -410,11 +415,7 @@ static av_always_inline void yuv2yuvX16inC_template(const int16_t *lumFilter, co for (j = 0; j < lumFilterSize; j++) val += alpSrc[j][i] * lumFilter[j]; - if (big_endian) { - AV_WB16(&aDest[i], av_clip_uint16(val >> 11)); - } else { - AV_WL16(&aDest[i], av_clip_uint16(val >> 11)); - } + output_pixel(&aDest[i], val); } } } |