swscale: implement >8bit scaling support.
This means that precision is retained when scaling between sample formats with >8 bits per component (48bit RGB, 16bit grayscale, 9/10/16bit YUV).
This commit is contained in:
@@ -877,8 +877,13 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
|
||||
}
|
||||
}
|
||||
|
||||
FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, FFALIGN(srcW, 16) * 2, fail);
|
||||
if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2) {
|
||||
// FIXME it's even nicer if bpp isn't 16, but max({src,dst}formatbpp)
|
||||
c->scalingBpp = FFMAX(av_pix_fmt_descriptors[srcFormat].comp[0].depth_minus1,
|
||||
av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1) >= 8 ? 16 : 8;
|
||||
if (c->scalingBpp == 16)
|
||||
dst_stride <<= 1;
|
||||
FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, FFALIGN(srcW, 16) * 2 * c->scalingBpp >> 3, fail);
|
||||
if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2 && c->scalingBpp == 8) {
|
||||
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)
|
||||
|
Reference in New Issue
Block a user