summaryrefslogtreecommitdiff
path: root/libswscale
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-11-16 20:34:05 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-11-16 21:15:05 +0100
commit6909a611d2057d50980c414a676abeab14174c15 (patch)
treeffafeab89e4b77a5fc3f0b6998df2b12c7e5280a /libswscale
parentab80d7e8c52d912b94aeca52f77c03492c71ea94 (diff)
swscale/swscale_unscaled: fix right column handling in planarCopyWrapper
Found-by: Михаил <Micky53@mail.ru> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale')
-rw-r--r--libswscale/swscale_unscaled.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 83086f7865..9f6d8193d8 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -1091,27 +1091,24 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[],
srcPtr += srcStride[plane];
}
} else if (src_depth <= dst_depth) {
- int orig_length = length;
for (i = 0; i < height; i++) {
+ j = 0;
if(isBE(c->srcFormat) == HAVE_BIGENDIAN &&
isBE(c->dstFormat) == HAVE_BIGENDIAN &&
shiftonly) {
unsigned shift = dst_depth - src_depth;
- length = orig_length;
#if HAVE_FAST_64BIT
#define FAST_COPY_UP(shift) \
- for (j = 0; j < length - 3; j += 4) { \
+ for (; j < length - 3; j += 4) { \
uint64_t v = AV_RN64A(srcPtr2 + j); \
AV_WN64A(dstPtr2 + j, v << shift); \
- } \
- length &= 3;
+ }
#else
#define FAST_COPY_UP(shift) \
- for (j = 0; j < length - 1; j += 2) { \
+ for (; j < length - 1; j += 2) { \
uint32_t v = AV_RN32A(srcPtr2 + j); \
AV_WN32A(dstPtr2 + j, v << shift); \
- } \
- length &= 1;
+ }
#endif
switch (shift)
{
@@ -1121,12 +1118,12 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[],
}
#define COPY_UP(r,w) \
if(shiftonly){\
- for (j = 0; j < length; j++){ \
+ for (; j < length; j++){ \
unsigned int v= r(&srcPtr2[j]);\
w(&dstPtr2[j], v<<(dst_depth-src_depth));\
}\
}else{\
- for (j = 0; j < length; j++){ \
+ for (; j < length; j++){ \
unsigned int v= r(&srcPtr2[j]);\
w(&dstPtr2[j], (v<<(dst_depth-src_depth)) | \
(v>>(2*src_depth-dst_depth)));\