diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-07-03 02:08:45 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-07-11 03:51:10 +0200 |
commit | 987e4c1787f18d97a39a5bce17b9c1f19a0996c9 (patch) | |
tree | 43c52700dff2dd2e9c903fbd4e03347792cca3e9 /libswscale | |
parent | b5ff61695f2c0493036b463666c5936ee10da344 (diff) | |
download | ffmpeg-987e4c1787f18d97a39a5bce17b9c1f19a0996c9.tar.gz |
sws: fix rgb -> 16bit
Diffstat (limited to 'libswscale')
-rw-r--r-- | libswscale/swscale.c | 11 | ||||
-rw-r--r-- | libswscale/x86/swscale_template.c | 2 |
2 files changed, 8 insertions, 5 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c index d1cb37185c..c39f1b6f93 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1979,6 +1979,9 @@ static void hScale16_c(SwsContext *c, int16_t *_dst, int dstW, const uint8_t *_s int bits = av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1; int sh = (bits <= 7) ? 11 : (bits - 4); + if((isAnyRGB(c->srcFormat) || c->srcFormat==PIX_FMT_PAL8) && av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1<15) + sh= 9; + for (i = 0; i < dstW; i++) { int j; int srcPos = filterPos[i]; @@ -2154,7 +2157,7 @@ static av_always_inline void hyscale(SwsContext *c, int16_t *dst, int dstWidth, src= formatConvBuffer; } - if (av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1 < 8 && c->scalingBpp == 16) { + if (av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1 < 8 && c->scalingBpp == 16 && !isAnyRGB(c->srcFormat)) { c->scale8To16Rv((uint16_t *) formatConvBuffer, src, srcW); src = formatConvBuffer; } @@ -2208,7 +2211,7 @@ static av_always_inline void hcscale(SwsContext *c, int16_t *dst1, int16_t *dst2 src2= buf2; } - if (av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1 < 8 && c->scalingBpp == 16) { + if (av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1 < 8 && c->scalingBpp == 16 && !isAnyRGB(c->srcFormat)) { uint8_t *buf2 = (formatConvBuffer + FFALIGN(srcW * 2+78, 16)); c->scale8To16Rv((uint16_t *) formatConvBuffer, src1, srcW); c->scale8To16Rv((uint16_t *) buf2, src2, srcW); @@ -2878,8 +2881,8 @@ static av_cold void sws_init_swScale_c(SwsContext *c) } } - if((isAnyRGB(c->srcFormat) && av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1<15) - || c->srcFormat == PIX_FMT_PAL8) + if(((isAnyRGB(c->srcFormat) && av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1<15) + || c->srcFormat == PIX_FMT_PAL8) && c->scalingBpp == 8) c->hScale16= hScale16N_c; if (c->scalingBpp == 8) { diff --git a/libswscale/x86/swscale_template.c b/libswscale/x86/swscale_template.c index 7603f1a415..8ab5556c61 100644 --- a/libswscale/x86/swscale_template.c +++ b/libswscale/x86/swscale_template.c @@ -2438,6 +2438,6 @@ static av_cold void RENAME(sws_init_swScale)(SwsContext *c) } } #endif /* !COMPILE_TEMPLATE_MMX2 */ - if(isAnyRGB(c->srcFormat) && av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1<15) + if(isAnyRGB(c->srcFormat) && av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1<15 && c->scalingBpp == 8) c->hScale16= RENAME(hScale16); } |