(x)==PIX_FMT_PAL8 \
|| (x)==PIX_FMT_YUYV422 \
|| (x)==PIX_FMT_UYVY422 \
- || isRGB(x) \
- || isBGR(x) \
+ || isAnyRGB(x) \
)
#define usePal(x) (av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL)
const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
{
int i;
- int step= fmt_depth(c->dstFormat)/8;
+ int step= c->dstFormatBpp/8;
int aidx= 3;
switch(c->dstFormat) {
#endif //!CONFIG_RUNTIME_CPUDETECT
}
-static int PlanarToNV12Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
+static int planarToNv12Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dstParam[], int dstStride[])
{
uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
return srcSliceH;
}
-static int PlanarToYuy2Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
+static int planarToYuy2Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dstParam[], int dstStride[])
{
uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
return srcSliceH;
}
-static int PlanarToUyvyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
+static int planarToUyvyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dstParam[], int dstStride[])
{
uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
return srcSliceH;
}
-static int YUV422PToYuy2Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
+static int yuv422pToYuy2Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dstParam[], int dstStride[])
{
uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
return srcSliceH;
}
-static int YUV422PToUyvyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
+static int yuv422pToUyvyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dstParam[], int dstStride[])
{
uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
return srcSliceH;
}
-static int YUYV2YUV420Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
+static int yuyvToYuv420Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dstParam[], int dstStride[])
{
uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
return srcSliceH;
}
-static int YUYV2YUV422Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
+static int yuyvToYuv422Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dstParam[], int dstStride[])
{
uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
return srcSliceH;
}
-static int UYVY2YUV420Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
+static int uyvyToYuv420Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dstParam[], int dstStride[])
{
uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
return srcSliceH;
}
-static int UYVY2YUV422Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
+static int uyvyToYuv422Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dstParam[], int dstStride[])
{
uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
return srcSliceH;
}
-static int pal2rgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
+static int palToRgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
+ int srcSliceH, uint8_t* dst[], int dstStride[])
{
const enum PixelFormat srcFormat= c->srcFormat;
const enum PixelFormat dstFormat= c->dstFormat;
return srcSliceH;
}
+#define isRGBA32(x) ( \
+ (x) == PIX_FMT_ARGB \
+ || (x) == PIX_FMT_RGBA \
+ || (x) == PIX_FMT_BGRA \
+ || (x) == PIX_FMT_ABGR \
+ )
+
/* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */
-static int rgb2rgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
+static int rgbToRgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
+ int srcSliceH, uint8_t* dst[], int dstStride[])
{
const enum PixelFormat srcFormat= c->srcFormat;
const enum PixelFormat dstFormat= c->dstFormat;
- const int srcBpp= (fmt_depth(srcFormat) + 7) >> 3;
- const int dstBpp= (fmt_depth(dstFormat) + 7) >> 3;
- const int srcId= fmt_depth(srcFormat) >> 2; /* 1:0, 4:1, 8:2, 15:3, 16:4, 24:6, 32:8 */
- const int dstId= fmt_depth(dstFormat) >> 2;
+ const int srcBpp= (c->srcFormatBpp + 7) >> 3;
+ const int dstBpp= (c->dstFormatBpp + 7) >> 3;
+ const int srcId= c->srcFormatBpp >> 2; /* 1:0, 4:1, 8:2, 15:3, 16:4, 24:6, 32:8 */
+ const int dstId= c->dstFormatBpp >> 2;
void (*conv)(const uint8_t *src, uint8_t *dst, long src_size)=NULL;
+#define CONV_IS(src, dst) (srcFormat == PIX_FMT_##src && dstFormat == PIX_FMT_##dst)
+
+ if (isRGBA32(srcFormat) && isRGBA32(dstFormat)) {
+ if ( CONV_IS(ABGR, RGBA)
+ || CONV_IS(ARGB, BGRA)
+ || CONV_IS(BGRA, ARGB)
+ || CONV_IS(RGBA, ABGR)) conv = shuffle_bytes_3210;
+ else if (CONV_IS(ABGR, ARGB)
+ || CONV_IS(ARGB, ABGR)) conv = shuffle_bytes_0321;
+ else if (CONV_IS(ABGR, BGRA)
+ || CONV_IS(ARGB, RGBA)) conv = shuffle_bytes_1230;
+ else if (CONV_IS(BGRA, RGBA)
+ || CONV_IS(RGBA, BGRA)) conv = shuffle_bytes_2103;
+ else if (CONV_IS(BGRA, ABGR)
+ || CONV_IS(RGBA, ARGB)) conv = shuffle_bytes_3012;
+ } else
/* BGR -> BGR */
- if ( (isBGR(srcFormat) && isBGR(dstFormat))
- || (isRGB(srcFormat) && isRGB(dstFormat))) {
+ if ( (isBGRinInt(srcFormat) && isBGRinInt(dstFormat))
+ || (isRGBinInt(srcFormat) && isRGBinInt(dstFormat))) {
switch(srcId | (dstId<<4)) {
case 0x34: conv= rgb16to15; break;
case 0x36: conv= rgb24to15; break;
case 0x84: conv= rgb16to32; break;
case 0x86: conv= rgb24to32; break;
}
- } else if ( (isBGR(srcFormat) && isRGB(dstFormat))
- || (isRGB(srcFormat) && isBGR(dstFormat))) {
+ } else if ( (isBGRinInt(srcFormat) && isRGBinInt(dstFormat))
+ || (isRGBinInt(srcFormat) && isBGRinInt(dstFormat))) {
switch(srcId | (dstId<<4)) {
case 0x33: conv= rgb15tobgr15; break;
case 0x34: conv= rgb16tobgr15; break;
case 0x83: conv= rgb15tobgr32; break;
case 0x84: conv= rgb16tobgr32; break;
case 0x86: conv= rgb24tobgr32; break;
- case 0x88: conv= rgb32tobgr32; break;
}
}
sws_format_name(srcFormat), sws_format_name(dstFormat));
} else {
const uint8_t *srcPtr= src[0];
- if(srcFormat == PIX_FMT_RGB32_1 || srcFormat == PIX_FMT_BGR32_1)
+ uint8_t *dstPtr= dst[0];
+ if ((srcFormat == PIX_FMT_RGB32_1 || srcFormat == PIX_FMT_BGR32_1) && !isRGBA32(dstFormat))
srcPtr += ALT32_CORR;
+ if ((dstFormat == PIX_FMT_RGB32_1 || dstFormat == PIX_FMT_BGR32_1) && !isRGBA32(srcFormat))
+ dstPtr += ALT32_CORR;
+
if (dstStride[0]*srcBpp == srcStride[0]*dstBpp && srcStride[0] > 0)
- conv(srcPtr, dst[0] + dstStride[0]*srcSliceY, srcSliceH*srcStride[0]);
+ conv(srcPtr, dstPtr + dstStride[0]*srcSliceY, srcSliceH*srcStride[0]);
else {
int i;
- uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
+ dstPtr += dstStride[0]*srcSliceY;
for (i=0; i<srcSliceH; i++) {
conv(srcPtr, dstPtr, c->srcW*srcBpp);
return srcSliceH;
}
-static int bgr24toyv12Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
+static int bgr24ToYv12Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[])
{
rgb24toyv12(
return srcSliceH;
}
-static int yvu9toyv12Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
+static int yvu9ToYv12Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[])
{
int i;
}
/* unscaled copy like stuff (assumes nearly identical formats) */
-static int packedCopy(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
+static int packedCopyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
+ int srcSliceH, uint8_t* dst[], int dstStride[])
{
if (dstStride[0]==srcStride[0] && srcStride[0] > 0)
memcpy(dst[0] + dstStride[0]*srcSliceY, src[0], srcSliceH*dstStride[0]);
return srcSliceH;
}
-static int planarCopy(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
+static int planarCopyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
+ int srcSliceH, uint8_t* dst[], int dstStride[])
{
int plane, i, j;
for (plane=0; plane<4; plane++) {
const int dstH = c->dstH;
int needsDither;
- needsDither= (isBGR(dstFormat) || isRGB(dstFormat))
- && (fmt_depth(dstFormat))<24
- && ((fmt_depth(dstFormat))<(fmt_depth(srcFormat)) || (!(isRGB(srcFormat) || isBGR(srcFormat))));
+ needsDither= isAnyRGB(dstFormat)
+ && c->dstFormatBpp < 24
+ && (c->dstFormatBpp < c->srcFormatBpp || (!isAnyRGB(srcFormat)));
- /* yv12_to_nv12 */
- if ((srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P) && (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21)) {
- c->swScale= PlanarToNV12Wrapper;
- }
- /* yuv2bgr */
- if ((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P || srcFormat==PIX_FMT_YUVA420P) && (isBGR(dstFormat) || isRGB(dstFormat))
- && !(flags & SWS_ACCURATE_RND) && !(dstH&1)) {
- c->swScale= ff_yuv2rgb_get_func_ptr(c);
- }
+ /* yv12_to_nv12 */
+ if ((srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P) && (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21)) {
+ c->swScale= planarToNv12Wrapper;
+ }
+ /* yuv2bgr */
+ if ((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P || srcFormat==PIX_FMT_YUVA420P) && isAnyRGB(dstFormat)
+ && !(flags & SWS_ACCURATE_RND) && !(dstH&1)) {
+ c->swScale= ff_yuv2rgb_get_func_ptr(c);
+ }
- if (srcFormat==PIX_FMT_YUV410P && (dstFormat==PIX_FMT_YUV420P || dstFormat==PIX_FMT_YUVA420P) && !(flags & SWS_BITEXACT)) {
- c->swScale= yvu9toyv12Wrapper;
- }
+ if (srcFormat==PIX_FMT_YUV410P && (dstFormat==PIX_FMT_YUV420P || dstFormat==PIX_FMT_YUVA420P) && !(flags & SWS_BITEXACT)) {
+ c->swScale= yvu9ToYv12Wrapper;
+ }
+
+ /* bgr24toYV12 */
+ if (srcFormat==PIX_FMT_BGR24 && (dstFormat==PIX_FMT_YUV420P || dstFormat==PIX_FMT_YUVA420P) && !(flags & SWS_ACCURATE_RND))
+ c->swScale= bgr24ToYv12Wrapper;
+
+ /* RGB/BGR -> RGB/BGR (no dither needed forms) */
+ if ( isAnyRGB(srcFormat)
+ && isAnyRGB(dstFormat)
+ && srcFormat != PIX_FMT_BGR8 && dstFormat != PIX_FMT_BGR8
+ && srcFormat != PIX_FMT_RGB8 && dstFormat != PIX_FMT_RGB8
+ && srcFormat != PIX_FMT_BGR4 && dstFormat != PIX_FMT_BGR4
+ && srcFormat != PIX_FMT_RGB4 && dstFormat != PIX_FMT_RGB4
+ && srcFormat != PIX_FMT_BGR4_BYTE && dstFormat != PIX_FMT_BGR4_BYTE
+ && srcFormat != PIX_FMT_RGB4_BYTE && dstFormat != PIX_FMT_RGB4_BYTE
+ && srcFormat != PIX_FMT_MONOBLACK && dstFormat != PIX_FMT_MONOBLACK
+ && srcFormat != PIX_FMT_MONOWHITE && dstFormat != PIX_FMT_MONOWHITE
+ && srcFormat != PIX_FMT_RGB48LE && dstFormat != PIX_FMT_RGB48LE
+ && srcFormat != PIX_FMT_RGB48BE && dstFormat != PIX_FMT_RGB48BE
+ && (!needsDither || (c->flags&(SWS_FAST_BILINEAR|SWS_POINT))))
+ c->swScale= rgbToRgbWrapper;
+
+ if ((usePal(srcFormat) && (
+ dstFormat == PIX_FMT_RGB32 ||
+ dstFormat == PIX_FMT_RGB32_1 ||
+ dstFormat == PIX_FMT_RGB24 ||
+ dstFormat == PIX_FMT_BGR32 ||
+ dstFormat == PIX_FMT_BGR32_1 ||
+ dstFormat == PIX_FMT_BGR24)))
+ c->swScale= palToRgbWrapper;
+
+ if (srcFormat == PIX_FMT_YUV422P) {
+ if (dstFormat == PIX_FMT_YUYV422)
+ c->swScale= yuv422pToYuy2Wrapper;
+ else if (dstFormat == PIX_FMT_UYVY422)
+ c->swScale= yuv422pToUyvyWrapper;
+ }
- /* bgr24toYV12 */
- if (srcFormat==PIX_FMT_BGR24 && (dstFormat==PIX_FMT_YUV420P || dstFormat==PIX_FMT_YUVA420P) && !(flags & SWS_ACCURATE_RND))
- c->swScale= bgr24toyv12Wrapper;
-
- /* RGB/BGR -> RGB/BGR (no dither needed forms) */
- if ( (isBGR(srcFormat) || isRGB(srcFormat))
- && (isBGR(dstFormat) || isRGB(dstFormat))
- && srcFormat != PIX_FMT_BGR8 && dstFormat != PIX_FMT_BGR8
- && srcFormat != PIX_FMT_RGB8 && dstFormat != PIX_FMT_RGB8
- && srcFormat != PIX_FMT_BGR4 && dstFormat != PIX_FMT_BGR4
- && srcFormat != PIX_FMT_RGB4 && dstFormat != PIX_FMT_RGB4
- && srcFormat != PIX_FMT_BGR4_BYTE && dstFormat != PIX_FMT_BGR4_BYTE
- && srcFormat != PIX_FMT_RGB4_BYTE && dstFormat != PIX_FMT_RGB4_BYTE
- && srcFormat != PIX_FMT_MONOBLACK && dstFormat != PIX_FMT_MONOBLACK
- && srcFormat != PIX_FMT_MONOWHITE && dstFormat != PIX_FMT_MONOWHITE
- && dstFormat != PIX_FMT_RGB32_1
- && dstFormat != PIX_FMT_BGR32_1
- && srcFormat != PIX_FMT_RGB48LE && dstFormat != PIX_FMT_RGB48LE
- && srcFormat != PIX_FMT_RGB48BE && dstFormat != PIX_FMT_RGB48BE
- && (!needsDither || (c->flags&(SWS_FAST_BILINEAR|SWS_POINT))))
- c->swScale= rgb2rgbWrapper;
-
- if ((usePal(srcFormat) && (
- dstFormat == PIX_FMT_RGB32 ||
- dstFormat == PIX_FMT_RGB32_1 ||
- dstFormat == PIX_FMT_RGB24 ||
- dstFormat == PIX_FMT_BGR32 ||
- dstFormat == PIX_FMT_BGR32_1 ||
- dstFormat == PIX_FMT_BGR24)))
- c->swScale= pal2rgbWrapper;
-
- if (srcFormat == PIX_FMT_YUV422P) {
+ /* LQ converters if -sws 0 or -sws 4*/
+ if (c->flags&(SWS_FAST_BILINEAR|SWS_POINT)) {
+ /* yv12_to_yuy2 */
+ if (srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P) {
if (dstFormat == PIX_FMT_YUYV422)
- c->swScale= YUV422PToYuy2Wrapper;
+ c->swScale= planarToYuy2Wrapper;
else if (dstFormat == PIX_FMT_UYVY422)
- c->swScale= YUV422PToUyvyWrapper;
- }
-
- /* LQ converters if -sws 0 or -sws 4*/
- if (c->flags&(SWS_FAST_BILINEAR|SWS_POINT)) {
- /* yv12_to_yuy2 */
- if (srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P) {
- if (dstFormat == PIX_FMT_YUYV422)
- c->swScale= PlanarToYuy2Wrapper;
- else if (dstFormat == PIX_FMT_UYVY422)
- c->swScale= PlanarToUyvyWrapper;
- }
+ c->swScale= planarToUyvyWrapper;
}
- if(srcFormat == PIX_FMT_YUYV422 && (dstFormat == PIX_FMT_YUV420P || dstFormat == PIX_FMT_YUVA420P))
- c->swScale= YUYV2YUV420Wrapper;
- if(srcFormat == PIX_FMT_UYVY422 && (dstFormat == PIX_FMT_YUV420P || dstFormat == PIX_FMT_YUVA420P))
- c->swScale= UYVY2YUV420Wrapper;
- if(srcFormat == PIX_FMT_YUYV422 && dstFormat == PIX_FMT_YUV422P)
- c->swScale= YUYV2YUV422Wrapper;
- if(srcFormat == PIX_FMT_UYVY422 && dstFormat == PIX_FMT_YUV422P)
- c->swScale= UYVY2YUV422Wrapper;
+ }
+ if(srcFormat == PIX_FMT_YUYV422 && (dstFormat == PIX_FMT_YUV420P || dstFormat == PIX_FMT_YUVA420P))
+ c->swScale= yuyvToYuv420Wrapper;
+ if(srcFormat == PIX_FMT_UYVY422 && (dstFormat == PIX_FMT_YUV420P || dstFormat == PIX_FMT_YUVA420P))
+ c->swScale= uyvyToYuv420Wrapper;
+ if(srcFormat == PIX_FMT_YUYV422 && dstFormat == PIX_FMT_YUV422P)
+ c->swScale= yuyvToYuv422Wrapper;
+ if(srcFormat == PIX_FMT_UYVY422 && dstFormat == PIX_FMT_YUV422P)
+ c->swScale= uyvyToYuv422Wrapper;
#ifdef COMPILE_ALTIVEC
- if ((c->flags & SWS_CPU_CAPS_ALTIVEC) &&
- !(c->flags & SWS_BITEXACT) &&
- srcFormat == PIX_FMT_YUV420P) {
- // unscaled YV12 -> packed YUV, we want speed
- if (dstFormat == PIX_FMT_YUYV422)
- c->swScale= yv12toyuy2_unscaled_altivec;
- else if (dstFormat == PIX_FMT_UYVY422)
- c->swScale= yv12touyvy_unscaled_altivec;
- }
+ if ((c->flags & SWS_CPU_CAPS_ALTIVEC) &&
+ !(c->flags & SWS_BITEXACT) &&
+ srcFormat == PIX_FMT_YUV420P) {
+ // unscaled YV12 -> packed YUV, we want speed
+ if (dstFormat == PIX_FMT_YUYV422)
+ c->swScale= yv12toyuy2_unscaled_altivec;
+ else if (dstFormat == PIX_FMT_UYVY422)
+ c->swScale= yv12touyvy_unscaled_altivec;
+ }
#endif
- /* simple copy */
- if ( srcFormat == dstFormat
- || (srcFormat == PIX_FMT_YUVA420P && dstFormat == PIX_FMT_YUV420P)
- || (srcFormat == PIX_FMT_YUV420P && dstFormat == PIX_FMT_YUVA420P)
- || (isPlanarYUV(srcFormat) && isGray(dstFormat))
- || (isPlanarYUV(dstFormat) && isGray(srcFormat))
- || (isGray(dstFormat) && isGray(srcFormat))
- || (isPlanarYUV(srcFormat) && isPlanarYUV(dstFormat)
- && c->chrDstHSubSample == c->chrSrcHSubSample
- && c->chrDstVSubSample == c->chrSrcVSubSample
- && dstFormat != PIX_FMT_NV12 && dstFormat != PIX_FMT_NV21
- && srcFormat != PIX_FMT_NV12 && srcFormat != PIX_FMT_NV21))
- {
- if (isPacked(c->srcFormat))
- c->swScale= packedCopy;
- else /* Planar YUV or gray */
- c->swScale= planarCopy;
- }
+ /* simple copy */
+ if ( srcFormat == dstFormat
+ || (srcFormat == PIX_FMT_YUVA420P && dstFormat == PIX_FMT_YUV420P)
+ || (srcFormat == PIX_FMT_YUV420P && dstFormat == PIX_FMT_YUVA420P)
+ || (isPlanarYUV(srcFormat) && isGray(dstFormat))
+ || (isPlanarYUV(dstFormat) && isGray(srcFormat))
+ || (isGray(dstFormat) && isGray(srcFormat))
+ || (isPlanarYUV(srcFormat) && isPlanarYUV(dstFormat)
+ && c->chrDstHSubSample == c->chrSrcHSubSample
+ && c->chrDstVSubSample == c->chrSrcVSubSample
+ && dstFormat != PIX_FMT_NV12 && dstFormat != PIX_FMT_NV21
+ && srcFormat != PIX_FMT_NV12 && srcFormat != PIX_FMT_NV21))
+ {
+ if (isPacked(c->srcFormat))
+ c->swScale= packedCopyWrapper;
+ else /* Planar YUV or gray */
+ c->swScale= planarCopyWrapper;
+ }
#if ARCH_BFIN
- if (flags & SWS_CPU_CAPS_BFIN)
- ff_bfin_get_unscaled_swscale (c);
+ if (flags & SWS_CPU_CAPS_BFIN)
+ ff_bfin_get_unscaled_swscale (c);
#endif
}