diff options
author | Oskar Arvidsson <oskar@irock.se> | 2011-03-29 17:48:47 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-04-10 22:33:41 +0200 |
commit | d4497f6dfb8dddf25b7be441f16d387aa18a65d6 (patch) | |
tree | a688c802bf50f533e5c66798c2aecc247c0e3a20 /libswscale/swscale.c | |
parent | af0b2d6736a99203fed3014a3e83f8226dade2af (diff) | |
download | ffmpeg-d4497f6dfb8dddf25b7be441f16d387aa18a65d6.tar.gz |
Add pixel formats for 9- and 10-bit yuv420p.
Also add support for these formats in libswscale.
Needed for high bit depth h264 decoding.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/swscale.c')
-rw-r--r-- | libswscale/swscale.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c index e0e48088fc..7047bb80f4 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1747,7 +1747,28 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[ length*=2; fillPlane(dst[plane], dstStride[plane], length, height, y, (plane==3) ? 255 : 128); } else { - if(is16BPS(c->srcFormat) && !is16BPS(c->dstFormat)) { + if(isNBPS(c->srcFormat)) { + const int depth = av_pix_fmt_descriptors[c->srcFormat].comp[plane].depth_minus1+1; + uint16_t *srcPtr2 = (uint16_t*)srcPtr; + + if (is16BPS(c->dstFormat)) { + uint16_t *dstPtr2 = (uint16_t*)dstPtr; + for (i = 0; i < height; i++) { + for (j = 0; j < length; j++) + dstPtr2[j] = (srcPtr2[j]<<(16-depth)) | (srcPtr2[j]>>(2*depth-16)); + dstPtr2 += dstStride[plane]/2; + srcPtr2 += srcStride[plane]/2; + } + } else { + // FIXME Maybe dither instead. + for (i = 0; i < height; i++) { + for (j = 0; j < length; j++) + dstPtr[j] = srcPtr2[j]>>(depth-8); + dstPtr += dstStride[plane]; + srcPtr2 += srcStride[plane]/2; + } + } + } else if(is16BPS(c->srcFormat) && !is16BPS(c->dstFormat)) { if (!isBE(c->srcFormat)) srcPtr++; for (i=0; i<height; i++) { for (j=0; j<length; j++) dstPtr[j] = srcPtr[j<<1]; |