*
* You should have received a copy of the GNU General Public License
* along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* the C code (not assembly, mmx, ...) of this file can be used
* under the LGPL license too
*/
/*
-tested special converters (most are tested actually but i didnt write it down ...)
+tested special converters (most are tested actually, but I did not write it down ...)
YV12 -> BGR16
YV12 -> YV12
BGR15 -> BGR16
YVU9 -> YV12
untested special converters
- YV12/I420 -> BGR15/BGR24/BGR32 (its the yuv2rgb stuff, so it should be ok)
+ YV12/I420 -> BGR15/BGR24/BGR32 (it is the yuv2rgb stuff, so it should be ok)
YV12/I420 -> YV12/I420
YUY2/BGR15/BGR24/BGR32/RGB24/RGB32 -> same format
BGR24 -> BGR32 & RGB24 -> RGB32
#endif
#include "swscale.h"
#include "swscale_internal.h"
-#include "x86_cpu.h"
-#include "bswap.h"
#include "rgb2rgb.h"
-#ifdef USE_FASTMEMCPY
-#include "libvo/fastmemcpy.h"
-#endif
+#include "libavutil/x86_cpu.h"
+#include "libavutil/bswap.h"
+#include "libavcodec/opt.h"
#undef MOVNTQ
#undef PAVGB
#define PI 3.14159265358979323846
#endif
-#define isSupportedIn(x) ((x)==PIX_FMT_YUV420P || (x)==PIX_FMT_YUYV422 || (x)==PIX_FMT_UYVY422 \
- || (x)==PIX_FMT_RGB32 || (x)==PIX_FMT_BGR24 || (x)==PIX_FMT_BGR565 || (x)==PIX_FMT_BGR555 \
- || (x)==PIX_FMT_BGR32 || (x)==PIX_FMT_RGB24 || (x)==PIX_FMT_RGB565 || (x)==PIX_FMT_RGB555 \
- || (x)==PIX_FMT_GRAY8 || (x)==PIX_FMT_YUV410P \
- || (x)==PIX_FMT_GRAY16BE || (x)==PIX_FMT_GRAY16LE \
- || (x)==PIX_FMT_YUV444P || (x)==PIX_FMT_YUV422P || (x)==PIX_FMT_YUV411P \
- || (x)==PIX_FMT_PAL8 || (x)==PIX_FMT_BGR8 || (x)==PIX_FMT_RGB8 \
- || (x)==PIX_FMT_BGR4_BYTE || (x)==PIX_FMT_RGB4_BYTE)
-#define isSupportedOut(x) ((x)==PIX_FMT_YUV420P || (x)==PIX_FMT_YUYV422 || (x)==PIX_FMT_UYVY422 \
- || (x)==PIX_FMT_YUV444P || (x)==PIX_FMT_YUV422P || (x)==PIX_FMT_YUV411P \
- || isRGB(x) || isBGR(x) \
- || (x)==PIX_FMT_NV12 || (x)==PIX_FMT_NV21 \
- || (x)==PIX_FMT_GRAY16BE || (x)==PIX_FMT_GRAY16LE \
- || (x)==PIX_FMT_GRAY8 || (x)==PIX_FMT_YUV410P)
-#define isPacked(x) ((x)==PIX_FMT_PAL8 || (x)==PIX_FMT_YUYV422 || \
- (x)==PIX_FMT_UYVY422 || isRGB(x) || isBGR(x))
+#define isSupportedIn(x) ( \
+ (x)==PIX_FMT_YUV420P \
+ || (x)==PIX_FMT_YUVA420P \
+ || (x)==PIX_FMT_YUYV422 \
+ || (x)==PIX_FMT_UYVY422 \
+ || (x)==PIX_FMT_RGB32 \
+ || (x)==PIX_FMT_BGR24 \
+ || (x)==PIX_FMT_BGR565 \
+ || (x)==PIX_FMT_BGR555 \
+ || (x)==PIX_FMT_BGR32 \
+ || (x)==PIX_FMT_RGB24 \
+ || (x)==PIX_FMT_RGB565 \
+ || (x)==PIX_FMT_RGB555 \
+ || (x)==PIX_FMT_GRAY8 \
+ || (x)==PIX_FMT_YUV410P \
+ || (x)==PIX_FMT_GRAY16BE \
+ || (x)==PIX_FMT_GRAY16LE \
+ || (x)==PIX_FMT_YUV444P \
+ || (x)==PIX_FMT_YUV422P \
+ || (x)==PIX_FMT_YUV411P \
+ || (x)==PIX_FMT_PAL8 \
+ || (x)==PIX_FMT_BGR8 \
+ || (x)==PIX_FMT_RGB8 \
+ || (x)==PIX_FMT_BGR4_BYTE \
+ || (x)==PIX_FMT_RGB4_BYTE \
+ || (x)==PIX_FMT_YUV440P \
+ )
+#define isSupportedOut(x) ( \
+ (x)==PIX_FMT_YUV420P \
+ || (x)==PIX_FMT_YUYV422 \
+ || (x)==PIX_FMT_UYVY422 \
+ || (x)==PIX_FMT_YUV444P \
+ || (x)==PIX_FMT_YUV422P \
+ || (x)==PIX_FMT_YUV411P \
+ || isRGB(x) \
+ || isBGR(x) \
+ || (x)==PIX_FMT_NV12 \
+ || (x)==PIX_FMT_NV21 \
+ || (x)==PIX_FMT_GRAY16BE \
+ || (x)==PIX_FMT_GRAY16LE \
+ || (x)==PIX_FMT_GRAY8 \
+ || (x)==PIX_FMT_YUV410P \
+ )
+#define isPacked(x) ( \
+ (x)==PIX_FMT_PAL8 \
+ || (x)==PIX_FMT_YUYV422 \
+ || (x)==PIX_FMT_UYVY422 \
+ || isRGB(x) \
+ || isBGR(x) \
+ )
#define RGB2YUV_SHIFT 16
#define BY ((int)( 0.098*(1<<RGB2YUV_SHIFT)+0.5))
Special versions: fast Y 1:1 scaling (no interpolation in y direction)
TODO
-more intelligent missalignment avoidance for the horizontal scaler
+more intelligent misalignment avoidance for the horizontal scaler
write special vertical cubic upscale version
Optimize C code (yv12 / minmax)
add support for packed pixel yuv input & output
*/
#if defined(ARCH_X86) && defined (CONFIG_GPL)
-static uint64_t attribute_used __attribute__((aligned(8))) bF8= 0xF8F8F8F8F8F8F8F8LL;
-static uint64_t attribute_used __attribute__((aligned(8))) bFC= 0xFCFCFCFCFCFCFCFCLL;
-static uint64_t __attribute__((aligned(8))) w10= 0x0010001000100010LL;
-static uint64_t attribute_used __attribute__((aligned(8))) w02= 0x0002000200020002LL;
-static uint64_t attribute_used __attribute__((aligned(8))) bm00001111=0x00000000FFFFFFFFLL;
-static uint64_t attribute_used __attribute__((aligned(8))) bm00000111=0x0000000000FFFFFFLL;
-static uint64_t attribute_used __attribute__((aligned(8))) bm11111000=0xFFFFFFFFFF000000LL;
-static uint64_t attribute_used __attribute__((aligned(8))) bm01010101=0x00FF00FF00FF00FFLL;
+DECLARE_ASM_CONST(8, uint64_t, bF8)= 0xF8F8F8F8F8F8F8F8LL;
+DECLARE_ASM_CONST(8, uint64_t, bFC)= 0xFCFCFCFCFCFCFCFCLL;
+DECLARE_ASM_CONST(8, uint64_t, w10)= 0x0010001000100010LL;
+DECLARE_ASM_CONST(8, uint64_t, w02)= 0x0002000200020002LL;
+DECLARE_ASM_CONST(8, uint64_t, bm00001111)=0x00000000FFFFFFFFLL;
+DECLARE_ASM_CONST(8, uint64_t, bm00000111)=0x0000000000FFFFFFLL;
+DECLARE_ASM_CONST(8, uint64_t, bm11111000)=0xFFFFFFFFFF000000LL;
+DECLARE_ASM_CONST(8, uint64_t, bm01010101)=0x00FF00FF00FF00FFLL;
static volatile uint64_t attribute_used __attribute__((aligned(8))) b5Dither;
static volatile uint64_t attribute_used __attribute__((aligned(8))) g5Dither;
static volatile uint64_t attribute_used __attribute__((aligned(8))) g6Dither;
static volatile uint64_t attribute_used __attribute__((aligned(8))) r5Dither;
-static uint64_t __attribute__((aligned(8))) dither4[2]={
+const DECLARE_ALIGNED(8, uint64_t, ff_dither4[2]) = {
0x0103010301030103LL,
0x0200020002000200LL,};
-static uint64_t __attribute__((aligned(8))) dither8[2]={
+const DECLARE_ALIGNED(8, uint64_t, ff_dither8[2]) = {
0x0602060206020602LL,
0x0004000400040004LL,};
-static uint64_t __attribute__((aligned(8))) b16Mask= 0x001F001F001F001FLL;
-static uint64_t attribute_used __attribute__((aligned(8))) g16Mask= 0x07E007E007E007E0LL;
-static uint64_t attribute_used __attribute__((aligned(8))) r16Mask= 0xF800F800F800F800LL;
-static uint64_t __attribute__((aligned(8))) b15Mask= 0x001F001F001F001FLL;
-static uint64_t attribute_used __attribute__((aligned(8))) g15Mask= 0x03E003E003E003E0LL;
-static uint64_t attribute_used __attribute__((aligned(8))) r15Mask= 0x7C007C007C007C00LL;
+DECLARE_ASM_CONST(8, uint64_t, b16Mask)= 0x001F001F001F001FLL;
+DECLARE_ASM_CONST(8, uint64_t, g16Mask)= 0x07E007E007E007E0LL;
+DECLARE_ASM_CONST(8, uint64_t, r16Mask)= 0xF800F800F800F800LL;
+DECLARE_ASM_CONST(8, uint64_t, b15Mask)= 0x001F001F001F001FLL;
+DECLARE_ASM_CONST(8, uint64_t, g15Mask)= 0x03E003E003E003E0LL;
+DECLARE_ASM_CONST(8, uint64_t, r15Mask)= 0x7C007C007C007C00LL;
-static uint64_t attribute_used __attribute__((aligned(8))) M24A= 0x00FF0000FF0000FFLL;
-static uint64_t attribute_used __attribute__((aligned(8))) M24B= 0xFF0000FF0000FF00LL;
-static uint64_t attribute_used __attribute__((aligned(8))) M24C= 0x0000FF0000FF0000LL;
+DECLARE_ALIGNED(8, const uint64_t, ff_M24A) = 0x00FF0000FF0000FFLL;
+DECLARE_ALIGNED(8, const uint64_t, ff_M24B) = 0xFF0000FF0000FF00LL;
+DECLARE_ALIGNED(8, const uint64_t, ff_M24C) = 0x0000FF0000FF0000LL;
#ifdef FAST_BGR2YV12
-static const uint64_t bgr2YCoeff attribute_used __attribute__((aligned(8))) = 0x000000210041000DULL;
-static const uint64_t bgr2UCoeff attribute_used __attribute__((aligned(8))) = 0x0000FFEEFFDC0038ULL;
-static const uint64_t bgr2VCoeff attribute_used __attribute__((aligned(8))) = 0x00000038FFD2FFF8ULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YCoeff) = 0x000000210041000DULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UCoeff) = 0x0000FFEEFFDC0038ULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_bgr2VCoeff) = 0x00000038FFD2FFF8ULL;
#else
-static const uint64_t bgr2YCoeff attribute_used __attribute__((aligned(8))) = 0x000020E540830C8BULL;
-static const uint64_t bgr2UCoeff attribute_used __attribute__((aligned(8))) = 0x0000ED0FDAC23831ULL;
-static const uint64_t bgr2VCoeff attribute_used __attribute__((aligned(8))) = 0x00003831D0E6F6EAULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YCoeff) = 0x000020E540830C8BULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UCoeff) = 0x0000ED0FDAC23831ULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_bgr2VCoeff) = 0x00003831D0E6F6EAULL;
#endif /* FAST_BGR2YV12 */
-static const uint64_t bgr2YOffset attribute_used __attribute__((aligned(8))) = 0x1010101010101010ULL;
-static const uint64_t bgr2UVOffset attribute_used __attribute__((aligned(8))) = 0x8080808080808080ULL;
-static const uint64_t w1111 attribute_used __attribute__((aligned(8))) = 0x0001000100010001ULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YOffset) = 0x1010101010101010ULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UVOffset) = 0x8080808080808080ULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_w1111) = 0x0001000100010001ULL;
#endif /* defined(ARCH_X86) */
// clipping helper table for C implementations:
return "swscaler";
}
-static AVClass sws_context_class = { "SWScaler", sws_context_to_name, NULL };
-
-char *sws_format_name(enum PixelFormat format)
+#define OFFSET(x) offsetof(SwsContext, x)
+#define DEFAULT 0
+#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
+
+static const AVOption options[] = {
+ { "sws_flags", "scaler/cpu flags", OFFSET(flags), FF_OPT_TYPE_FLAGS, DEFAULT, 0, UINT_MAX, VE, "sws_flags" },
+ { "fast_bilinear", "fast bilinear", 0, FF_OPT_TYPE_CONST, SWS_FAST_BILINEAR, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "bilinear", "bilinear", 0, FF_OPT_TYPE_CONST, SWS_BILINEAR, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "bicubic", "bicubic", 0, FF_OPT_TYPE_CONST, SWS_BICUBIC, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "experimental", "experimental", 0, FF_OPT_TYPE_CONST, SWS_X, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "neighbor", "nearest neighbor", 0, FF_OPT_TYPE_CONST, SWS_POINT, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "area", "averaging area", 0, FF_OPT_TYPE_CONST, SWS_AREA, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "bicublin", "luma bicubic, chroma bilinear", 0, FF_OPT_TYPE_CONST, SWS_BICUBLIN, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "gauss", "gaussian", 0, FF_OPT_TYPE_CONST, SWS_GAUSS, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "sinc", "sinc", 0, FF_OPT_TYPE_CONST, SWS_SINC, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "lanczos", "lanczos", 0, FF_OPT_TYPE_CONST, SWS_LANCZOS, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "spline", "natural bicubic spline", 0, FF_OPT_TYPE_CONST, SWS_SPLINE, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "print_info", "print info", 0, FF_OPT_TYPE_CONST, SWS_PRINT_INFO, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "accurate_rnd", "accurate rounding", 0, FF_OPT_TYPE_CONST, SWS_ACCURATE_RND, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "mmx", "MMX SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_MMX, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "mmx2", "MMX2 SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_MMX2, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "3dnow", "3DNOW SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_3DNOW, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "altivec", "AltiVec SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_ALTIVEC, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "bfin", "Blackfin SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_BFIN, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "full_chroma_int", "full chroma interpolation", 0 , FF_OPT_TYPE_CONST, SWS_FULL_CHR_H_INT, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "full_chroma_inp", "full chroma input", 0 , FF_OPT_TYPE_CONST, SWS_FULL_CHR_H_INP, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { NULL }
+};
+
+#undef VE
+#undef DEFAULT
+
+static const AVClass sws_context_class = { "SWScaler", sws_context_to_name, options };
+
+const char *sws_format_name(enum PixelFormat format)
{
switch (format) {
case PIX_FMT_YUV420P:
return "yuv420p";
+ case PIX_FMT_YUVA420P:
+ return "yuva420p";
case PIX_FMT_YUYV422:
return "yuyv422";
case PIX_FMT_RGB24:
return "nv12";
case PIX_FMT_NV21:
return "nv21";
+ case PIX_FMT_YUV440P:
+ return "yuv440p";
default:
return "Unknown format";
}
}
-#if defined(ARCH_X86) && defined (CONFIG_GPL)
-void in_asm_used_var_warning_killer()
-{
- volatile int i= bF8+bFC+w10+
- bm00001111+bm00000111+bm11111000+b16Mask+g16Mask+r16Mask+b15Mask+g15Mask+r15Mask+
- M24A+M24B+M24C+w02 + b5Dither+g5Dither+r5Dither+g6Dither+dither4[0]+dither8[0]+bm01010101;
- if (i) i=0;
-}
-#endif
-
static inline void yuv2yuvXinC(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW)
dest[i]= av_clip_uint8(val>>19);
}
- if (uDest != NULL)
+ if (uDest)
for (i=0; i<chrDstW; i++)
{
int u=1<<18;
for (j=0; j<chrFilterSize; j++)
{
u += chrSrc[j][i] * chrFilter[j];
- v += chrSrc[j][i + 2048] * chrFilter[j];
+ v += chrSrc[j][i + VOFW] * chrFilter[j];
}
uDest[i]= av_clip_uint8(u>>19);
dest[i]= av_clip_uint8(val>>19);
}
- if (uDest == NULL)
+ if (!uDest)
return;
if (dstFormat == PIX_FMT_NV12)
for (j=0; j<chrFilterSize; j++)
{
u += chrSrc[j][i] * chrFilter[j];
- v += chrSrc[j][i + 2048] * chrFilter[j];
+ v += chrSrc[j][i + VOFW] * chrFilter[j];
}
uDest[2*i]= av_clip_uint8(u>>19);
for (j=0; j<chrFilterSize; j++)
{
u += chrSrc[j][i] * chrFilter[j];
- v += chrSrc[j][i + 2048] * chrFilter[j];
+ v += chrSrc[j][i + VOFW] * chrFilter[j];
}
uDest[2*i]= av_clip_uint8(v>>19);
int Y2 = 1<<18;\
int U = 1<<18;\
int V = 1<<18;\
- type attribute_unused *r, *b, *g;\
+ type av_unused *r, *b, *g;\
const int i2= 2*i;\
\
for (j=0; j<lumFilterSize; j++)\
for (j=0; j<chrFilterSize; j++)\
{\
U += chrSrc[j][i] * chrFilter[j];\
- V += chrSrc[j][i+2048] * chrFilter[j];\
+ V += chrSrc[j][i+VOFW] * chrFilter[j];\
}\
Y1>>=19;\
Y2>>=19;\
int Y1= (buf0[i2 ]*yalpha1+buf1[i2 ]*yalpha)>>19; \
int Y2= (buf0[i2+1]*yalpha1+buf1[i2+1]*yalpha)>>19; \
int U= (uvbuf0[i ]*uvalpha1+uvbuf1[i ]*uvalpha)>>19; \
- int V= (uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19; \
+ int V= (uvbuf0[i+VOFW]*uvalpha1+uvbuf1[i+VOFW]*uvalpha)>>19; \
#define YSCALE_YUV_2_RGB2_C(type) \
YSCALE_YUV_2_PACKED2_C\
int Y1= buf0[i2 ]>>7;\
int Y2= buf0[i2+1]>>7;\
int U= (uvbuf1[i ])>>7;\
- int V= (uvbuf1[i+2048])>>7;\
+ int V= (uvbuf1[i+VOFW])>>7;\
#define YSCALE_YUV_2_RGB1_C(type) \
YSCALE_YUV_2_PACKED1_C\
int Y1= buf0[i2 ]>>7;\
int Y2= buf0[i2+1]>>7;\
int U= (uvbuf0[i ] + uvbuf1[i ])>>8;\
- int V= (uvbuf0[i+2048] + uvbuf1[i+2048])>>8;\
+ int V= (uvbuf0[i+VOFW] + uvbuf1[i+VOFW])>>8;\
#define YSCALE_YUV_2_RGB1B_C(type) \
YSCALE_YUV_2_PACKED1B_C\
#include "swscale_template.c"
#endif
-#ifdef ARCH_POWERPC
#ifdef COMPILE_ALTIVEC
#undef RENAME
#define HAVE_ALTIVEC
#define RENAME(a) a ## _altivec
#include "swscale_template.c"
#endif
-#endif //ARCH_POWERPC
#if defined(ARCH_X86)
double *filter2=NULL;
#if defined(ARCH_X86)
if (flags & SWS_CPU_CAPS_MMX)
- asm volatile("emms\n\t"::: "memory"); //FIXME this shouldnt be required but it IS (even for non mmx versions)
+ asm volatile("emms\n\t"::: "memory"); //FIXME this should not be required but it IS (even for non-MMX versions)
#endif
// Note the +1 is for the MMXscaler which reads over the end
av_free(filter); filter=NULL;
/* try to reduce the filter-size (step1 find size and shift left) */
- // Assume its near normalized (*0.5 or *2.0 is ok but * 0.001 is not)
+ // Assume it is near normalized (*0.5 or *2.0 is OK but * 0.001 is not).
minFilterSize= 0;
for (i=dstW-1; i>=0; i--)
{
if (cutOff > SWS_MAX_REDUCE_CUTOFF) break;
- /* preserve Monotonicity because the core can't handle the filter otherwise */
+ /* preserve monotonicity because the core can't handle the filter otherwise */
if (i<dstW-1 && (*filterPos)[i] >= (*filterPos)[i+1]) break;
// Move filter coeffs left
// End
"9: \n\t"
// "int $3 \n\t"
- "lea 0b, %0 \n\t"
- "lea 1b, %1 \n\t"
- "lea 2b, %2 \n\t"
+ "lea " LOCAL_MANGLE(0b) ", %0 \n\t"
+ "lea " LOCAL_MANGLE(1b) ", %1 \n\t"
+ "lea " LOCAL_MANGLE(2b) ", %2 \n\t"
"dec %1 \n\t"
"dec %2 \n\t"
"sub %0, %1 \n\t"
"sub %0, %2 \n\t"
- "lea 9b, %3 \n\t"
+ "lea " LOCAL_MANGLE(9b) ", %3 \n\t"
"sub %0, %3 \n\t"
// End
"9: \n\t"
// "int $3 \n\t"
- "lea 0b, %0 \n\t"
- "lea 1b, %1 \n\t"
- "lea 2b, %2 \n\t"
+ "lea " LOCAL_MANGLE(0b) ", %0 \n\t"
+ "lea " LOCAL_MANGLE(1b) ", %1 \n\t"
+ "lea " LOCAL_MANGLE(2b) ", %2 \n\t"
"dec %1 \n\t"
"dec %2 \n\t"
"sub %0, %1 \n\t"
"sub %0, %2 \n\t"
- "lea 9b, %3 \n\t"
+ "lea " LOCAL_MANGLE(9b) ", %3 \n\t"
"sub %0, %3 \n\t"
#if defined(RUNTIME_CPUDETECT) && defined (CONFIG_GPL)
#if defined(ARCH_X86)
- // ordered per speed fasterst first
+ // ordered per speed fastest first
if (flags & SWS_CPU_CAPS_MMX2)
return swScale_MMX2;
else if (flags & SWS_CPU_CAPS_3DNOW)
}
dst = dstParam[1] + dstStride[1]*srcSliceY/2;
if (c->dstFormat == PIX_FMT_NV12)
- interleaveBytes( src[1],src[2],dst,c->srcW/2,srcSliceH/2,srcStride[1],srcStride[2],dstStride[0] );
+ interleaveBytes(src[1], src[2], dst, c->srcW/2, srcSliceH/2, srcStride[1], srcStride[2], dstStride[0]);
else
- interleaveBytes( src[2],src[1],dst,c->srcW/2,srcSliceH/2,srcStride[2],srcStride[1],dstStride[0] );
+ interleaveBytes(src[2], src[1], dst, c->srcW/2, srcSliceH/2, srcStride[2], srcStride[1], dstStride[0]);
return srcSliceH;
}
int srcSliceH, uint8_t* dstParam[], int dstStride[]){
uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
- yv12toyuy2( src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0] );
+ yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
return srcSliceH;
}
int srcSliceH, uint8_t* dstParam[], int dstStride[]){
uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
- yv12touyvy( src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0] );
+ yv12touyvy(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
return srcSliceH;
}
case 0x83: conv= rgb15to32; break;
case 0x84: conv= rgb16to32; break;
case 0x86: conv= rgb24to32; break;
- default: av_log(c, AV_LOG_ERROR, "swScaler: internal error %s -> %s converter\n",
+ default: av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n",
sws_format_name(srcFormat), sws_format_name(dstFormat)); break;
}
}else if ( (isBGR(srcFormat) && isRGB(dstFormat))
case 0x84: conv= rgb16tobgr32; break;
case 0x86: conv= rgb24tobgr32; break;
case 0x88: conv= rgb32tobgr32; break;
- default: av_log(c, AV_LOG_ERROR, "swScaler: internal error %s -> %s converter\n",
+ default: av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n",
sws_format_name(srcFormat), sws_format_name(dstFormat)); break;
}
}else{
- av_log(c, AV_LOG_ERROR, "swScaler: internal error %s -> %s converter\n",
+ av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n",
sws_format_name(srcFormat), sws_format_name(dstFormat));
}
- if (dstStride[0]*srcBpp == srcStride[0]*dstBpp)
- conv(src[0], dst[0] + dstStride[0]*srcSliceY, srcSliceH*srcStride[0]);
- else
+ if(conv)
{
- int i;
- uint8_t *srcPtr= src[0];
- uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
-
- for (i=0; i<srcSliceH; i++)
+ if (dstStride[0]*srcBpp == srcStride[0]*dstBpp && srcStride[0] > 0)
+ conv(src[0], dst[0] + dstStride[0]*srcSliceY, srcSliceH*srcStride[0]);
+ else
{
- conv(srcPtr, dstPtr, c->srcW*srcBpp);
- srcPtr+= srcStride[0];
- dstPtr+= dstStride[0];
+ int i;
+ uint8_t *srcPtr= src[0];
+ uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
+
+ for (i=0; i<srcSliceH; i++)
+ {
+ conv(srcPtr, dstPtr, c->srcW*srcBpp);
+ srcPtr+= srcStride[0];
+ dstPtr+= dstStride[0];
+ }
}
}
return srcSliceH;
int y= srcSliceY;
int height= srcSliceH;
int i, j;
- uint16_t *srcPtr= src[0];
- uint16_t *dstPtr= dst[0] + dstStride[0]*y/2;
+ uint16_t *srcPtr= (uint16_t*)src[0];
+ uint16_t *dstPtr= (uint16_t*)(dst[0] + dstStride[0]*y/2);
for (i=0; i<height; i++)
{
for (j=0; j<length; j++) dstPtr[j] = bswap_16(srcPtr[j]);
*v=0;
break;
case PIX_FMT_YUV420P:
+ case PIX_FMT_YUVA420P:
case PIX_FMT_GRAY16BE:
case PIX_FMT_GRAY16LE:
case PIX_FMT_GRAY8: //FIXME remove after different subsamplings are fully implemented
*h=1;
*v=1;
break;
+ case PIX_FMT_YUV440P:
+ *h=0;
+ *v=1;
+ break;
case PIX_FMT_YUV410P:
*h=2;
*v=2;
/**
* @param inv_table the yuv2rgb coeffs, normally Inverse_Table_6_9[x]
- * @param fullRange if 1 then the luma range is 0..255 if 0 its 16..235
+ * @param fullRange if 1 then the luma range is 0..255 if 0 it is 16..235
* @return -1 if not supported
*/
int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation){
case PIX_FMT_YUVJ444P:
*format = PIX_FMT_YUV444P;
return 1;
+ case PIX_FMT_YUVJ440P:
+ *format = PIX_FMT_YUV440P;
+ return 1;
default:
return 0;
}
#endif
#if !defined(RUNTIME_CPUDETECT) || !defined (CONFIG_GPL) //ensure that the flags match the compiled variant if cpudetect is off
- flags &= ~(SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW|SWS_CPU_CAPS_ALTIVEC);
+ flags &= ~(SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW|SWS_CPU_CAPS_ALTIVEC|SWS_CPU_CAPS_BFIN);
#ifdef HAVE_MMX2
flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2;
#elif defined (HAVE_3DNOW)
flags |= SWS_CPU_CAPS_MMX;
#elif defined (HAVE_ALTIVEC)
flags |= SWS_CPU_CAPS_ALTIVEC;
+#elif defined (ARCH_BFIN)
+ flags |= SWS_CPU_CAPS_BFIN;
#endif
#endif /* RUNTIME_CPUDETECT */
if (clip_table[512] != 255) globalInit();
- if (rgb15to16 == NULL) sws_rgb2rgb_init(flags);
+ if (!rgb15to16) sws_rgb2rgb_init(flags);
unscaled = (srcW == dstW && srcH == dstH);
needsDither= (isBGR(dstFormat) || isRGB(dstFormat))
if (!isSupportedIn(srcFormat))
{
- av_log(NULL, AV_LOG_ERROR, "swScaler: %s is not supported as input format\n", sws_format_name(srcFormat));
+ av_log(NULL, AV_LOG_ERROR, "swScaler: %s is not supported as input pixel format\n", sws_format_name(srcFormat));
return NULL;
}
if (!isSupportedOut(dstFormat))
{
- av_log(NULL, AV_LOG_ERROR, "swScaler: %s is not supported as output format\n", sws_format_name(dstFormat));
+ av_log(NULL, AV_LOG_ERROR, "swScaler: %s is not supported as output pixel format\n", sws_format_name(dstFormat));
return NULL;
}
srcW, srcH, dstW, dstH);
return NULL;
}
+ if(srcW > VOFW || dstW > VOFW){
+ av_log(NULL, AV_LOG_ERROR, "swScaler: Compile time max width is "AV_STRINGIFY(VOFW)" change VOF/VOFW and recompile\n");
+ return NULL;
+ }
if (!dstFilter) dstFilter= &dummyFilter;
if (!srcFilter) srcFilter= &dummyFilter;
c->vRounder= 4* 0x0001000100010001ULL;
usesHFilter= usesVFilter= 0;
- if (dstFilter->lumV!=NULL && dstFilter->lumV->length>1) usesVFilter=1;
- if (dstFilter->lumH!=NULL && dstFilter->lumH->length>1) usesHFilter=1;
- if (dstFilter->chrV!=NULL && dstFilter->chrV->length>1) usesVFilter=1;
- if (dstFilter->chrH!=NULL && dstFilter->chrH->length>1) usesHFilter=1;
- if (srcFilter->lumV!=NULL && srcFilter->lumV->length>1) usesVFilter=1;
- if (srcFilter->lumH!=NULL && srcFilter->lumH->length>1) usesHFilter=1;
- if (srcFilter->chrV!=NULL && srcFilter->chrV->length>1) usesVFilter=1;
- if (srcFilter->chrH!=NULL && srcFilter->chrH->length>1) usesHFilter=1;
+ if (dstFilter->lumV && dstFilter->lumV->length>1) usesVFilter=1;
+ if (dstFilter->lumH && dstFilter->lumH->length>1) usesHFilter=1;
+ if (dstFilter->chrV && dstFilter->chrV->length>1) usesVFilter=1;
+ if (dstFilter->chrH && dstFilter->chrH->length>1) usesHFilter=1;
+ if (srcFilter->lumV && srcFilter->lumV->length>1) usesVFilter=1;
+ if (srcFilter->lumH && srcFilter->lumH->length>1) usesHFilter=1;
+ if (srcFilter->chrV && srcFilter->chrV->length>1) usesVFilter=1;
+ if (srcFilter->chrH && srcFilter->chrH->length>1) usesHFilter=1;
getSubSampleFactors(&c->chrSrcHSubSample, &c->chrSrcVSubSample, srcFormat);
getSubSampleFactors(&c->chrDstHSubSample, &c->chrDstVSubSample, dstFormat);
}
#endif
- if ( srcFormat==PIX_FMT_YUV410P && dstFormat==PIX_FMT_YUV420P )
+ if (srcFormat==PIX_FMT_YUV410P && dstFormat==PIX_FMT_YUV420P)
{
c->swScale= yvu9toyv12Wrapper;
}
/* simple copy */
if ( srcFormat == dstFormat
|| (isPlanarYUV(srcFormat) && isGray(dstFormat))
- || (isPlanarYUV(dstFormat) && isGray(srcFormat)) )
+ || (isPlanarYUV(dstFormat) && isGray(srcFormat)))
{
c->swScale= simpleCopy;
}
c->swScale= gray16swap;
}
+#ifdef ARCH_BFIN
+ if (flags & SWS_CPU_CAPS_BFIN)
+ ff_bfin_get_unscaled_swscale (c);
+#endif
+
if (c->swScale){
if (flags&SWS_PRINT_INFO)
- av_log(c, AV_LOG_INFO, "SwScaler: using unscaled %s -> %s special converter\n",
+ av_log(c, AV_LOG_INFO, "using unscaled %s -> %s special converter\n",
sws_format_name(srcFormat), sws_format_name(dstFormat));
return c;
}
if (!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR))
{
if (flags&SWS_PRINT_INFO)
- av_log(c, AV_LOG_INFO, "SwScaler: output Width is not a multiple of 32 -> no MMX2 scaler\n");
+ av_log(c, AV_LOG_INFO, "output Width is not a multiple of 32 -> no MMX2 scaler\n");
}
if (usesHFilter) c->canMMX2BeUsed=0;
}
// match pixel 0 of the src to pixel 0 of dst and match pixel n-2 of src to pixel n-2 of dst
// but only for the FAST_BILINEAR mode otherwise do correct scaling
// n-2 is the last chrominance sample available
- // this is not perfect, but noone shuld notice the difference, the more correct variant
+ // this is not perfect, but no one should notice the difference, the more correct variant
// would be like the vertical one, but that would require some special code for the
// first and last pixel
if (flags&SWS_FAST_BILINEAR)
nextSlice>>= c->chrSrcVSubSample;
nextSlice<<= c->chrSrcVSubSample;
if (c->vLumFilterPos[i ] + c->vLumBufSize < nextSlice)
- c->vLumBufSize= nextSlice - c->vLumFilterPos[i ];
+ c->vLumBufSize= nextSlice - c->vLumFilterPos[i];
if (c->vChrFilterPos[chrI] + c->vChrBufSize < (nextSlice>>c->chrSrcVSubSample))
c->vChrBufSize= (nextSlice>>c->chrSrcVSubSample) - c->vChrFilterPos[chrI];
}
//Note we need at least one pixel more at the end because of the mmx code (just in case someone wanna replace the 4000/8000)
/* align at 16 bytes for AltiVec */
for (i=0; i<c->vLumBufSize; i++)
- c->lumPixBuf[i]= c->lumPixBuf[i+c->vLumBufSize]= av_mallocz(4000);
+ c->lumPixBuf[i]= c->lumPixBuf[i+c->vLumBufSize]= av_mallocz(VOF+1);
for (i=0; i<c->vChrBufSize; i++)
- c->chrPixBuf[i]= c->chrPixBuf[i+c->vChrBufSize]= av_malloc(8000);
+ c->chrPixBuf[i]= c->chrPixBuf[i+c->vChrBufSize]= av_malloc((VOF+1)*2);
//try to avoid drawing green stuff between the right end and the stride end
- for (i=0; i<c->vChrBufSize; i++) memset(c->chrPixBuf[i], 64, 8000);
+ for (i=0; i<c->vChrBufSize; i++) memset(c->chrPixBuf[i], 64, (VOF+1)*2);
+
+ assert(2*VOFW == VOF);
ASSERT(c->chrDstH <= dstH)
if (flags&SWS_PRINT_INFO)
{
#ifdef DITHER1XBPP
- char *dither= " dithered";
+ const char *dither= " dithered";
#else
- char *dither= "";
+ const char *dither= "";
#endif
if (flags&SWS_FAST_BILINEAR)
- av_log(c, AV_LOG_INFO, "SwScaler: FAST_BILINEAR scaler, ");
+ av_log(c, AV_LOG_INFO, "FAST_BILINEAR scaler, ");
else if (flags&SWS_BILINEAR)
- av_log(c, AV_LOG_INFO, "SwScaler: BILINEAR scaler, ");
+ av_log(c, AV_LOG_INFO, "BILINEAR scaler, ");
else if (flags&SWS_BICUBIC)
- av_log(c, AV_LOG_INFO, "SwScaler: BICUBIC scaler, ");
+ av_log(c, AV_LOG_INFO, "BICUBIC scaler, ");
else if (flags&SWS_X)
- av_log(c, AV_LOG_INFO, "SwScaler: Experimental scaler, ");
+ av_log(c, AV_LOG_INFO, "Experimental scaler, ");
else if (flags&SWS_POINT)
- av_log(c, AV_LOG_INFO, "SwScaler: Nearest Neighbor / POINT scaler, ");
+ av_log(c, AV_LOG_INFO, "Nearest Neighbor / POINT scaler, ");
else if (flags&SWS_AREA)
- av_log(c, AV_LOG_INFO, "SwScaler: Area Averageing scaler, ");
+ av_log(c, AV_LOG_INFO, "Area Averageing scaler, ");
else if (flags&SWS_BICUBLIN)
- av_log(c, AV_LOG_INFO, "SwScaler: luma BICUBIC / chroma BILINEAR scaler, ");
+ av_log(c, AV_LOG_INFO, "luma BICUBIC / chroma BILINEAR scaler, ");
else if (flags&SWS_GAUSS)
- av_log(c, AV_LOG_INFO, "SwScaler: Gaussian scaler, ");
+ av_log(c, AV_LOG_INFO, "Gaussian scaler, ");
else if (flags&SWS_SINC)
- av_log(c, AV_LOG_INFO, "SwScaler: Sinc scaler, ");
+ av_log(c, AV_LOG_INFO, "Sinc scaler, ");
else if (flags&SWS_LANCZOS)
- av_log(c, AV_LOG_INFO, "SwScaler: Lanczos scaler, ");
+ av_log(c, AV_LOG_INFO, "Lanczos scaler, ");
else if (flags&SWS_SPLINE)
- av_log(c, AV_LOG_INFO, "SwScaler: Bicubic spline scaler, ");
+ av_log(c, AV_LOG_INFO, "Bicubic spline scaler, ");
else
- av_log(c, AV_LOG_INFO, "SwScaler: ehh flags invalid?! ");
+ av_log(c, AV_LOG_INFO, "ehh flags invalid?! ");
if (dstFormat==PIX_FMT_BGR555 || dstFormat==PIX_FMT_BGR565)
av_log(c, AV_LOG_INFO, "from %s to%s %s ",
if (flags & SWS_CPU_CAPS_MMX)
{
if (c->canMMX2BeUsed && (flags&SWS_FAST_BILINEAR))
- av_log(c, AV_LOG_VERBOSE, "SwScaler: using FAST_BILINEAR MMX2 scaler for horizontal scaling\n");
+ av_log(c, AV_LOG_VERBOSE, "using FAST_BILINEAR MMX2 scaler for horizontal scaling\n");
else
{
if (c->hLumFilterSize==4)
- av_log(c, AV_LOG_VERBOSE, "SwScaler: using 4-tap MMX scaler for horizontal luminance scaling\n");
+ av_log(c, AV_LOG_VERBOSE, "using 4-tap MMX scaler for horizontal luminance scaling\n");
else if (c->hLumFilterSize==8)
- av_log(c, AV_LOG_VERBOSE, "SwScaler: using 8-tap MMX scaler for horizontal luminance scaling\n");
+ av_log(c, AV_LOG_VERBOSE, "using 8-tap MMX scaler for horizontal luminance scaling\n");
else
- av_log(c, AV_LOG_VERBOSE, "SwScaler: using n-tap MMX scaler for horizontal luminance scaling\n");
+ av_log(c, AV_LOG_VERBOSE, "using n-tap MMX scaler for horizontal luminance scaling\n");
if (c->hChrFilterSize==4)
- av_log(c, AV_LOG_VERBOSE, "SwScaler: using 4-tap MMX scaler for horizontal chrominance scaling\n");
+ av_log(c, AV_LOG_VERBOSE, "using 4-tap MMX scaler for horizontal chrominance scaling\n");
else if (c->hChrFilterSize==8)
- av_log(c, AV_LOG_VERBOSE, "SwScaler: using 8-tap MMX scaler for horizontal chrominance scaling\n");
+ av_log(c, AV_LOG_VERBOSE, "using 8-tap MMX scaler for horizontal chrominance scaling\n");
else
- av_log(c, AV_LOG_VERBOSE, "SwScaler: using n-tap MMX scaler for horizontal chrominance scaling\n");
+ av_log(c, AV_LOG_VERBOSE, "using n-tap MMX scaler for horizontal chrominance scaling\n");
}
}
else
{
#if defined(ARCH_X86)
- av_log(c, AV_LOG_VERBOSE, "SwScaler: using X86-Asm scaler for horizontal scaling\n");
+ av_log(c, AV_LOG_VERBOSE, "using X86-Asm scaler for horizontal scaling\n");
#else
if (flags & SWS_FAST_BILINEAR)
- av_log(c, AV_LOG_VERBOSE, "SwScaler: using FAST_BILINEAR C scaler for horizontal scaling\n");
+ av_log(c, AV_LOG_VERBOSE, "using FAST_BILINEAR C scaler for horizontal scaling\n");
else
- av_log(c, AV_LOG_VERBOSE, "SwScaler: using C scaler for horizontal scaling\n");
+ av_log(c, AV_LOG_VERBOSE, "using C scaler for horizontal scaling\n");
#endif
}
if (isPlanarYUV(dstFormat))
{
if (c->vLumFilterSize==1)
- av_log(c, AV_LOG_VERBOSE, "SwScaler: using 1-tap %s \"scaler\" for vertical scaling (YV12 like)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
+ av_log(c, AV_LOG_VERBOSE, "using 1-tap %s \"scaler\" for vertical scaling (YV12 like)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
else
- av_log(c, AV_LOG_VERBOSE, "SwScaler: using n-tap %s scaler for vertical scaling (YV12 like)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
+ av_log(c, AV_LOG_VERBOSE, "using n-tap %s scaler for vertical scaling (YV12 like)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
}
else
{
if (c->vLumFilterSize==1 && c->vChrFilterSize==2)
- av_log(c, AV_LOG_VERBOSE, "SwScaler: using 1-tap %s \"scaler\" for vertical luminance scaling (BGR)\n"
- "SwScaler: 2-tap scaler for vertical chrominance scaling (BGR)\n",(flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
+ av_log(c, AV_LOG_VERBOSE, "using 1-tap %s \"scaler\" for vertical luminance scaling (BGR)\n"
+ " 2-tap scaler for vertical chrominance scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
else if (c->vLumFilterSize==2 && c->vChrFilterSize==2)
- av_log(c, AV_LOG_VERBOSE, "SwScaler: using 2-tap linear %s scaler for vertical scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
+ av_log(c, AV_LOG_VERBOSE, "using 2-tap linear %s scaler for vertical scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
else
- av_log(c, AV_LOG_VERBOSE, "SwScaler: using n-tap %s scaler for vertical scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
+ av_log(c, AV_LOG_VERBOSE, "using n-tap %s scaler for vertical scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
}
if (dstFormat==PIX_FMT_BGR24)
- av_log(c, AV_LOG_VERBOSE, "SwScaler: using %s YV12->BGR24 Converter\n",
+ av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR24 Converter\n",
(flags & SWS_CPU_CAPS_MMX2) ? "MMX2" : ((flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C"));
else if (dstFormat==PIX_FMT_RGB32)
- av_log(c, AV_LOG_VERBOSE, "SwScaler: using %s YV12->BGR32 Converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
+ av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR32 Converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
else if (dstFormat==PIX_FMT_BGR565)
- av_log(c, AV_LOG_VERBOSE, "SwScaler: using %s YV12->BGR16 Converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
+ av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR16 Converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
else if (dstFormat==PIX_FMT_BGR555)
- av_log(c, AV_LOG_VERBOSE, "SwScaler: using %s YV12->BGR15 Converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
+ av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR15 Converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
- av_log(c, AV_LOG_VERBOSE, "SwScaler: %dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);
+ av_log(c, AV_LOG_VERBOSE, "%dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);
}
if (flags & SWS_PRINT_INFO)
{
- av_log(c, AV_LOG_DEBUG, "SwScaler:Lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
+ av_log(c, AV_LOG_DEBUG, "Lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
c->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc);
- av_log(c, AV_LOG_DEBUG, "SwScaler:Chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
+ av_log(c, AV_LOG_DEBUG, "Chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH, c->chrXInc, c->chrYInc);
}
}
/**
- * swscale warper, so we don't need to export the SwsContext.
+ * swscale wrapper, so we don't need to export the SwsContext.
* assumes planar YUV to be in YUV order instead of YVU
*/
int sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
uint8_t* src2[4]= {src[0], src[1], src[2]};
uint32_t pal[256];
if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) {
- av_log(c, AV_LOG_ERROR, "swScaler: slices start in the middle!\n");
+ av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n");
return 0;
}
if (c->sliceDir == 0) {
int v= av_clip_uint8(((RV*r + GV*g + BV*b)>>RGB2YUV_SHIFT) + 128);
pal[i]= y + (u<<8) + (v<<16);
}
- src2[1]= pal;
+ src2[1]= (uint8_t*)pal;
}
// copy strides, so they can safely be modified
}
/**
- * swscale warper, so we don't need to export the SwsContext
+ * swscale wrapper, so we don't need to export the SwsContext
*/
int sws_scale_ordered(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[]){
for (i=0; i<length; i++)
{
double dist= i-middle;
- coeff[i]= exp( -dist*dist/(2*variance*variance) ) / sqrt(2*variance*PI);
+ coeff[i]= exp(-dist*dist/(2*variance*variance)) / sqrt(2*variance*PI);
}
sws_normalizeVec(vec, 1.0);
int dstW, int dstH, int dstFormat, int flags,
SwsFilter *srcFilter, SwsFilter *dstFilter, double *param)
{
- if (context != NULL) {
- if ((context->srcW != srcW) || (context->srcH != srcH) ||
- (context->srcFormat != srcFormat) ||
- (context->dstW != dstW) || (context->dstH != dstH) ||
- (context->dstFormat != dstFormat) || (context->flags != flags) ||
- (context->param != param))
+ static const double default_param[2] = {SWS_PARAM_DEFAULT, SWS_PARAM_DEFAULT};
+
+ if (!param)
+ param = default_param;
+
+ if (context) {
+ if (context->srcW != srcW || context->srcH != srcH ||
+ context->srcFormat != srcFormat ||
+ context->dstW != dstW || context->dstH != dstH ||
+ context->dstFormat != dstFormat || context->flags != flags ||
+ context->param[0] != param[0] || context->param[1] != param[1])
{
sws_freeContext(context);
context = NULL;
}
}
- if (context == NULL) {
+ if (!context) {
return sws_getContext(srcW, srcH, srcFormat,
dstW, dstH, dstFormat, flags,
srcFilter, dstFilter, param);