diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-08-13 22:23:40 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-08-13 22:24:47 +0200 |
commit | ca1dfea12771b585846fb86aa08c3d7f066a3cc4 (patch) | |
tree | 6db034b36245b9fe51d9a41d41be1718a3be8b89 /libswscale/utils.c | |
parent | 75af0e6a1601a4246d6409ca28dc80a3ba0e8d6e (diff) | |
parent | 3304a1e69a8a050eb66d2304acd2d01354fa1aac (diff) | |
download | ffmpeg-ca1dfea12771b585846fb86aa08c3d7f066a3cc4.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
swscale: add dithering to yuv2yuvX_altivec_real
rv34: free+allocate buffer instead of reallocating it to preserve alignment
h264: add missing brackets.
swscale: use 15-bit intermediates for 9/10-bit scaling.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/utils.c')
-rw-r--r-- | libswscale/utils.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c index d3451e4bbd..54a4c0d42f 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -842,14 +842,18 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter) } } - c->scalingBpp = FFMAX(av_pix_fmt_descriptors[srcFormat].comp[0].depth_minus1, - av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1) >= 15 ? 16 : 8; - - if (c->scalingBpp == 16) + c->srcBpc = 1 + av_pix_fmt_descriptors[srcFormat].comp[0].depth_minus1; + if (c->srcBpc < 8) + c->srcBpc = 8; + c->dstBpc = 1 + av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1; + if (c->dstBpc < 8) + c->dstBpc = 8; + if (isAnyRGB(srcFormat) && c->dstBpc == 16) + c->srcBpc = 16; + if (c->dstBpc == 16) dst_stride <<= 1; - av_assert0(c->scalingBpp<=16); FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, FFALIGN(srcW*2+78, 16) * 2, fail); - if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2 && c->scalingBpp == 8) { + if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2 && c->srcBpc == 8 && c->dstBpc <= 10) { c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0; if (!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR)) { if (flags&SWS_PRINT_INFO) @@ -875,7 +879,7 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter) c->chrXInc+= 20; } //we don't use the x86 asm scaler if MMX is available - else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX && c->scalingBpp == 8) { + else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX && c->dstBpc <= 10) { c->lumXInc = ((srcW-2)<<16)/(dstW-2) - 20; c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20; } @@ -1007,7 +1011,7 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter) c->lumPixBuf[i] = c->lumPixBuf[i+c->vLumBufSize]; } // 64 / c->scalingBpp is the same as 16 / sizeof(scaling_intermediate) - c->uv_off = (dst_stride>>1) + 64 / c->scalingBpp; + c->uv_off = (dst_stride>>1) + 64 / (c->dstBpc &~ 7); c->uv_offx2 = dst_stride + 16; for (i=0; i<c->vChrBufSize; i++) { FF_ALLOC_OR_GOTO(c, c->chrUPixBuf[i+c->vChrBufSize], dst_stride*2+32, fail); @@ -1023,7 +1027,7 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter) //try to avoid drawing green stuff between the right end and the stride end for (i=0; i<c->vChrBufSize; i++) if(av_pix_fmt_descriptors[c->dstFormat].comp[0].depth_minus1 == 15){ - av_assert0(c->scalingBpp == 16); + av_assert0(c->dstBpc > 10); for(j=0; j<dst_stride/2+1; j++) ((int32_t*)(c->chrUPixBuf[i]))[j] = 1<<18; } else |