diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-01-22 06:44:34 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-22 15:30:06 +0100 |
commit | 234405315f22c1b11531a7d313e7bd82b5283239 (patch) | |
tree | 3976d26b0bbabea2d233bc40728c3d8d32fcedc5 /libswscale/swscale_unscaled.c | |
parent | 378b7beff55ced231e43b6892f1e6ad5146dcafd (diff) | |
download | ffmpeg-234405315f22c1b11531a7d313e7bd82b5283239.tar.gz |
sws: Fix unscaled >8bit planar chroma handling.
Fixes Ticket840
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/swscale_unscaled.c')
-rw-r--r-- | libswscale/swscale_unscaled.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index b5b05744e5..b4686f7eff 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -56,6 +56,20 @@ static void fillPlane(uint8_t *plane, int stride, int width, int height, int y, } } +static void fillPlane16(uint8_t *plane, int stride, int width, int height, int y, + int alpha, int bits) +{ + int i, j; + uint8_t *ptr = plane + stride * y; + int v = alpha ? -1 : (1<<bits); + for (i = 0; i < height; i++) { + for (j = 0; j < width; j++) { + AV_WN16(ptr+2*j, v); + } + ptr += stride; + } +} + static void copyPlane(const uint8_t *src, int srcStride, int srcSliceY, int srcSliceH, int width, uint8_t *dst, int dstStride) @@ -615,10 +629,13 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[], // ignore palette for GRAY8 if (plane == 1 && !dst[2]) continue; if (!src[plane] || (plane == 1 && !src[2])) { - if (is16BPS(c->dstFormat)) - length *= 2; - fillPlane(dst[plane], dstStride[plane], length, height, y, - (plane == 3) ? 255 : 128); + if (is16BPS(c->dstFormat) || isNBPS(c->dstFormat)) { + fillPlane16(dst[plane], dstStride[plane], length, height, y, + plane == 3, av_pix_fmt_descriptors[c->dstFormat].comp[plane].depth_minus1); + } else { + fillPlane(dst[plane], dstStride[plane], length, height, y, + (plane == 3) ? 255 : 128); + } } else { if(isNBPS(c->srcFormat) || isNBPS(c->dstFormat) || (is16BPS(c->srcFormat) != is16BPS(c->dstFormat)) |