aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale
diff options
context:
space:
mode:
authorLuca Abeni <lucabe72@email.it>2006-09-17 15:15:13 +0000
committerLuca Abeni <lucabe72@email.it>2006-09-17 15:15:13 +0000
commite9e12f0e11f43cab3e61257b95f6a6b0ac21b202 (patch)
tree056fc348845314980be2f0b560b70d2e9c0331c9 /libswscale
parent5784b620d2593be10b401eb5f8c317fd7ec2d83f (diff)
downloadffmpeg-e9e12f0e11f43cab3e61257b95f6a6b0ac21b202.tar.gz
Remove the dependency of libswscale on img_format.h
Originally committed as revision 19878 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
Diffstat (limited to 'libswscale')
-rw-r--r--libswscale/swscale-example.c46
-rw-r--r--libswscale/swscale.c353
-rw-r--r--libswscale/swscale_internal.h48
-rw-r--r--libswscale/swscale_template.c114
-rw-r--r--libswscale/yuv2rgb.c54
-rw-r--r--libswscale/yuv2rgb_altivec.c57
-rw-r--r--libswscale/yuv2rgb_mlib.c13
-rw-r--r--libswscale/yuv2rgb_template.c8
8 files changed, 351 insertions, 342 deletions
diff --git a/libswscale/swscale-example.c b/libswscale/swscale-example.c
index 3164377a0f..e9596f19b8 100644
--- a/libswscale/swscale-example.c
+++ b/libswscale/swscale-example.c
@@ -22,24 +22,25 @@
#include <inttypes.h>
#include <stdarg.h>
+#undef HAVE_AV_CONFIG_H
+#include "avutil.h"
#include "swscale.h"
-#include "libmpcodecs/img_format.h"
static int testFormat[]={
-IMGFMT_YVU9,
-IMGFMT_YV12,
+PIX_FMT_YUV410P,
+PIX_FMT_YUV420P,
//IMGFMT_IYUV,
-IMGFMT_I420,
-IMGFMT_BGR15,
-IMGFMT_BGR16,
-IMGFMT_BGR24,
-IMGFMT_BGR32,
-IMGFMT_RGB24,
-IMGFMT_RGB32,
+//IMGFMT_I420,
+PIX_FMT_BGR555,
+PIX_FMT_BGR565,
+PIX_FMT_BGR24,
+PIX_FMT_RGB32,
+PIX_FMT_RGB24,
+PIX_FMT_BGR32,
//IMGFMT_Y8,
-IMGFMT_Y800,
+PIX_FMT_GRAY8,
//IMGFMT_YUY2,
-0
+PIX_FMT_NONE
};
static uint64_t getSSD(uint8_t *src1, uint8_t *src2, int stride1, int stride2, int w, int h){
@@ -73,12 +74,12 @@ static void doTest(uint8_t *ref[3], int refStride[3], int w, int h, int srcForma
for(i=0; i<3; i++){
// avoid stride % bpp != 0
- if(srcFormat==IMGFMT_RGB24 || srcFormat==IMGFMT_BGR24)
+ if(srcFormat==PIX_FMT_RGB24 || srcFormat==PIX_FMT_BGR24)
srcStride[i]= srcW*3;
else
srcStride[i]= srcW*4;
- if(dstFormat==IMGFMT_RGB24 || dstFormat==IMGFMT_BGR24)
+ if(dstFormat==PIX_FMT_RGB24 || dstFormat==PIX_FMT_BGR24)
dstStride[i]= dstW*3;
else
dstStride[i]= dstW*4;
@@ -86,11 +87,16 @@ static void doTest(uint8_t *ref[3], int refStride[3], int w, int h, int srcForma
src[i]= (uint8_t*) malloc(srcStride[i]*srcH);
dst[i]= (uint8_t*) malloc(dstStride[i]*dstH);
out[i]= (uint8_t*) malloc(refStride[i]*h);
+ if ((src[i] == NULL) || (dst[i] == NULL) || (out[i] == NULL)) {
+ perror("Malloc");
+
+ goto end;
+ }
}
- srcContext= sws_getContext(w, h, IMGFMT_YV12, srcW, srcH, srcFormat, flags, NULL, NULL, NULL);
+ srcContext= sws_getContext(w, h, PIX_FMT_YUV420P, srcW, srcH, srcFormat, flags, NULL, NULL, NULL);
dstContext= sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags, NULL, NULL, NULL);
- outContext= sws_getContext(dstW, dstH, dstFormat, w, h, IMGFMT_YV12, flags, NULL, NULL, NULL);
+ outContext= sws_getContext(dstW, dstH, dstFormat, w, h, PIX_FMT_YUV420P, flags, NULL, NULL, NULL);
if(srcContext==NULL ||dstContext==NULL ||outContext==NULL){
printf("Failed allocating swsContext\n");
goto end;
@@ -110,7 +116,7 @@ static void doTest(uint8_t *ref[3], int refStride[3], int w, int h, int srcForma
ssdU= getSSD(ref[1], out[1], refStride[1], refStride[1], (w+1)>>1, (h+1)>>1);
ssdV= getSSD(ref[2], out[2], refStride[2], refStride[2], (w+1)>>1, (h+1)>>1);
- if(srcFormat == IMGFMT_Y800 || dstFormat==IMGFMT_Y800) ssdU=ssdV=0; //FIXME check that output is really gray
+ if(srcFormat == PIX_FMT_GRAY8 || dstFormat==PIX_FMT_GRAY8) ssdU=ssdV=0; //FIXME check that output is really gray
ssdY/= w*h;
ssdU/= w*h/4;
@@ -155,10 +161,10 @@ static void selfTest(uint8_t *src[3], int stride[3], int w, int h){
for(srcFormatIndex=0; ;srcFormatIndex++){
srcFormat= testFormat[srcFormatIndex];
- if(!srcFormat) break;
+ if(srcFormat == PIX_FMT_NONE) break;
for(dstFormatIndex=0; ;dstFormatIndex++){
dstFormat= testFormat[dstFormatIndex];
- if(!dstFormat) break;
+ if(dstFormat == PIX_FMT_NONE) break;
// if(!isSupportedOut(dstFormat)) continue;
printf("%s -> %s\n",
sws_format_name(srcFormat),
@@ -190,7 +196,7 @@ int main(int argc, char **argv){
int x, y;
struct SwsContext *sws;
- sws= sws_getContext(W/12, H/12, IMGFMT_BGR32, W, H, IMGFMT_YV12, 2, NULL, NULL, NULL);
+ sws= sws_getContext(W/12, H/12, PIX_FMT_RGB32, W, H, PIX_FMT_YUV420P, 2, NULL, NULL, NULL);
for(y=0; y<H; y++){
for(x=0; x<W*4; x++){
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 624bb77c16..8dd0d4fe77 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -74,7 +74,6 @@ untested special converters
#include "swscale_internal.h"
#include "x86_cpu.h"
#include "bswap.h"
-#include "libmpcodecs/img_format.h"
#include "rgb2rgb.h"
#ifdef USE_FASTMEMCPY
#include "libvo/fastmemcpy.h"
@@ -106,25 +105,17 @@ untested special converters
#define PI 3.14159265358979323846
#endif
-//FIXME replace this with something faster
-#define isPlanarYUV(x) ((x)==IMGFMT_YV12 || (x)==IMGFMT_YVU9 \
- || (x)==IMGFMT_NV12 || (x)==IMGFMT_NV21 \
- || (x)==IMGFMT_444P || (x)==IMGFMT_422P || (x)==IMGFMT_411P)
-#define isYUV(x) ((x)==IMGFMT_UYVY || (x)==IMGFMT_YUY2 || isPlanarYUV(x))
-#define isGray(x) ((x)==IMGFMT_Y800)
-#define isRGB(x) (((x)&IMGFMT_RGB_MASK)==IMGFMT_RGB)
-#define isBGR(x) (((x)&IMGFMT_BGR_MASK)==IMGFMT_BGR)
-#define isSupportedIn(x) ((x)==IMGFMT_YV12 || (x)==IMGFMT_YUY2 || (x)==IMGFMT_UYVY\
- || (x)==IMGFMT_BGR32|| (x)==IMGFMT_BGR24|| (x)==IMGFMT_BGR16|| (x)==IMGFMT_BGR15\
- || (x)==IMGFMT_RGB32|| (x)==IMGFMT_RGB24\
- || (x)==IMGFMT_Y800 || (x)==IMGFMT_YVU9\
- || (x)==IMGFMT_444P || (x)==IMGFMT_422P || (x)==IMGFMT_411P)
-#define isSupportedOut(x) ((x)==IMGFMT_YV12 || (x)==IMGFMT_YUY2 || (x)==IMGFMT_UYVY\
- || (x)==IMGFMT_444P || (x)==IMGFMT_422P || (x)==IMGFMT_411P\
+#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_GRAY8 || (x)==PIX_FMT_YUV410P\
+ || (x)==PIX_FMT_YUV444P || (x)==PIX_FMT_YUV422P || (x)==PIX_FMT_YUV411P)
+#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)==IMGFMT_NV12 || (x)==IMGFMT_NV21\
- || (x)==IMGFMT_Y800 || (x)==IMGFMT_YVU9)
-#define isPacked(x) ((x)==IMGFMT_YUY2 || (x)==IMGFMT_UYVY ||isRGB(x) || isBGR(x))
+ || (x)==PIX_FMT_NV12 || (x)==PIX_FMT_NV21\
+ || (x)==PIX_FMT_GRAY8 || (x)==PIX_FMT_YUV410P)
+#define isPacked(x) ((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))
@@ -213,37 +204,82 @@ extern const uint8_t dither_8x8_32[8][8];
extern const uint8_t dither_8x8_73[8][8];
extern const uint8_t dither_8x8_220[8][8];
-/* Used for ffmpeg --> MPlayer format name conversion */
-static const int fmt_name[PIX_FMT_NB] = {
- [PIX_FMT_YUV420P] = IMGFMT_I420, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples)
- [PIX_FMT_YUV422] = IMGFMT_Y422,
- [PIX_FMT_RGB24] = IMGFMT_RGB24, ///< Packed pixel, 3 bytes per pixel, RGBRGB...
- [PIX_FMT_BGR24] = IMGFMT_BGR24, ///< Packed pixel, 3 bytes per pixel, BGRBGR...
- [PIX_FMT_YUV422P] = IMGFMT_422P, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
- [PIX_FMT_YUV444P] = IMGFMT_444P, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
- [PIX_FMT_RGBA32] = IMGFMT_BGR32, ///< Packed pixel, 4 bytes per pixel, BGRABGRA..., stored in cpu endianness
- [PIX_FMT_YUV410P] = IMGFMT_YVU9, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
- [PIX_FMT_YUV411P] = IMGFMT_411P, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
- [PIX_FMT_RGB565] = IMGFMT_RGB16, ///< always stored in cpu endianness
- [PIX_FMT_RGB555] = IMGFMT_RGB15, ///< always stored in cpu endianness, most significant bit to 1
- [PIX_FMT_UYVY422] = IMGFMT_UYVY, ///< Packed pixel, Cb Y0 Cr Y1
- [PIX_FMT_GRAY8] = IMGFMT_Y800, ///< Gray jpeg
-};
-
-char *sws_format_name(int format)
+char *sws_format_name(enum PixelFormat format)
{
- static char fmt_name[64];
- char *res;
- static int buffer;
-
- res = fmt_name + buffer * 32;
- buffer = 1 - buffer;
- snprintf(res, 32, "0x%x (%c%c%c%c)", format,
- format >> 24, (format >> 16) & 0xFF,
- (format >> 8) & 0xFF,
- format & 0xFF);
-
- return res;
+ switch (format) {
+ case PIX_FMT_YUV420P:
+ return "yuv420p";
+ case PIX_FMT_YUYV422:
+ return "yuyv422";
+ case PIX_FMT_RGB24:
+ return "rgb24";
+ case PIX_FMT_BGR24:
+ return "bgr24";
+ case PIX_FMT_YUV422P:
+ return "yuv422p";
+ case PIX_FMT_YUV444P:
+ return "yuv444p";
+ case PIX_FMT_RGB32:
+ return "rgb32";
+ case PIX_FMT_YUV410P:
+ return "yuv410p";
+ case PIX_FMT_YUV411P:
+ return "yuv411p";
+ case PIX_FMT_RGB565:
+ return "rgb565";
+ case PIX_FMT_RGB555:
+ return "rgb555";
+ case PIX_FMT_GRAY8:
+ return "gray8";
+ case PIX_FMT_MONOWHITE:
+ return "mono white";
+ case PIX_FMT_MONOBLACK:
+ return "mono black";
+ case PIX_FMT_PAL8:
+ return "Palette";
+ case PIX_FMT_YUVJ420P:
+ return "yuvj420p";
+ case PIX_FMT_YUVJ422P:
+ return "yuvj422p";
+ case PIX_FMT_YUVJ444P:
+ return "yuvj444p";
+ case PIX_FMT_XVMC_MPEG2_MC:
+ return "xvmc_mpeg2_mc";
+ case PIX_FMT_XVMC_MPEG2_IDCT:
+ return "xvmc_mpeg2_idct";
+ case PIX_FMT_UYVY422:
+ return "uyvy422";
+ case PIX_FMT_UYYVYY411:
+ return "uyyvyy411";
+ case PIX_FMT_RGB32_1:
+ return "rgb32x";
+ case PIX_FMT_BGR32_1:
+ return "bgr32x";
+ case PIX_FMT_BGR32:
+ return "bgr32";
+ case PIX_FMT_BGR565:
+ return "bgr565";
+ case PIX_FMT_BGR555:
+ return "bgr555";
+ case PIX_FMT_BGR8:
+ return "bgr8";
+ case PIX_FMT_BGR4:
+ return "bgr4";
+ case PIX_FMT_BGR4_BYTE:
+ return "bgr4 byte";
+ case PIX_FMT_RGB8:
+ return "rgb8";
+ case PIX_FMT_RGB4:
+ return "rgb4";
+ case PIX_FMT_RGB4_BYTE:
+ return "rgb4 byte";
+ case PIX_FMT_NV12:
+ return "nv12";
+ case PIX_FMT_NV21:
+ return "nv21";
+ default:
+ return "Unknown format";
+ }
}
#if defined(ARCH_X86) || defined(ARCH_X86_64)
@@ -308,7 +344,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
if(uDest == NULL)
return;
- if(dstFormat == IMGFMT_NV12)
+ if(dstFormat == PIX_FMT_NV12)
for(i=0; i<chrDstW; i++)
{
int u=1<<18;
@@ -430,14 +466,14 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
#define YSCALE_YUV_2_ANYRGB_C(func, func2)\
switch(c->dstFormat)\
{\
- case IMGFMT_BGR32:\
- case IMGFMT_RGB32:\
+ case PIX_FMT_RGB32:\
+ case PIX_FMT_BGR32:\
func(uint32_t)\
((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1];\
((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2];\
} \
break;\
- case IMGFMT_RGB24:\
+ case PIX_FMT_RGB24:\
func(uint8_t)\
((uint8_t*)dest)[0]= r[Y1];\
((uint8_t*)dest)[1]= g[Y1];\
@@ -448,7 +484,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
dest+=6;\
}\
break;\
- case IMGFMT_BGR24:\
+ case PIX_FMT_BGR24:\
func(uint8_t)\
((uint8_t*)dest)[0]= b[Y1];\
((uint8_t*)dest)[1]= g[Y1];\
@@ -459,8 +495,8 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
dest+=6;\
}\
break;\
- case IMGFMT_RGB16:\
- case IMGFMT_BGR16:\
+ case PIX_FMT_RGB565:\
+ case PIX_FMT_BGR565:\
{\
const int dr1= dither_2x2_8[y&1 ][0];\
const int dg1= dither_2x2_4[y&1 ][0];\
@@ -474,8 +510,8 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
}\
}\
break;\
- case IMGFMT_RGB15:\
- case IMGFMT_BGR15:\
+ case PIX_FMT_RGB555:\
+ case PIX_FMT_BGR555:\
{\
const int dr1= dither_2x2_8[y&1 ][0];\
const int dg1= dither_2x2_8[y&1 ][1];\
@@ -489,8 +525,8 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
}\
}\
break;\
- case IMGFMT_RGB8:\
- case IMGFMT_BGR8:\
+ case PIX_FMT_RGB8:\
+ case PIX_FMT_BGR8:\
{\
const uint8_t * const d64= dither_8x8_73[y&7];\
const uint8_t * const d32= dither_8x8_32[y&7];\
@@ -500,8 +536,8 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
}\
}\
break;\
- case IMGFMT_RGB4:\
- case IMGFMT_BGR4:\
+ case PIX_FMT_RGB4:\
+ case PIX_FMT_BGR4:\
{\
const uint8_t * const d64= dither_8x8_73 [y&7];\
const uint8_t * const d128=dither_8x8_220[y&7];\
@@ -511,8 +547,8 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
}\
}\
break;\
- case IMGFMT_RG4B:\
- case IMGFMT_BG4B:\
+ case PIX_FMT_RGB4_BYTE:\
+ case PIX_FMT_BGR4_BYTE:\
{\
const uint8_t * const d64= dither_8x8_73 [y&7];\
const uint8_t * const d128=dither_8x8_220[y&7];\
@@ -522,8 +558,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
}\
}\
break;\
- case IMGFMT_RGB1:\
- case IMGFMT_BGR1:\
+ case PIX_FMT_MONOBLACK:\
{\
const uint8_t * const d128=dither_8x8_220[y&7];\
uint8_t *g= c->table_gU[128] + c->table_gV[128];\
@@ -587,7 +622,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
*/\
}\
break;\
- case IMGFMT_YUY2:\
+ case PIX_FMT_YUYV422:\
func2\
((uint8_t*)dest)[2*i2+0]= Y1;\
((uint8_t*)dest)[2*i2+1]= U;\
@@ -595,7 +630,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
((uint8_t*)dest)[2*i2+3]= V;\
} \
break;\
- case IMGFMT_UYVY:\
+ case PIX_FMT_UYVY422:\
func2\
((uint8_t*)dest)[2*i2+0]= U;\
((uint8_t*)dest)[2*i2+1]= Y1;\
@@ -613,14 +648,14 @@ static inline void yuv2packedXinC(SwsContext *c, int16_t *lumFilter, int16_t **l
int i;
switch(c->dstFormat)
{
- case IMGFMT_RGB32:
- case IMGFMT_BGR32:
+ case PIX_FMT_BGR32:
+ case PIX_FMT_RGB32:
YSCALE_YUV_2_RGBX_C(uint32_t)
((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1];
((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2];
}
break;
- case IMGFMT_RGB24:
+ case PIX_FMT_RGB24:
YSCALE_YUV_2_RGBX_C(uint8_t)
((uint8_t*)dest)[0]= r[Y1];
((uint8_t*)dest)[1]= g[Y1];
@@ -631,7 +666,7 @@ static inline void yuv2packedXinC(SwsContext *c, int16_t *lumFilter, int16_t **l
dest+=6;
}
break;
- case IMGFMT_BGR24:
+ case PIX_FMT_BGR24:
YSCALE_YUV_2_RGBX_C(uint8_t)
((uint8_t*)dest)[0]= b[Y1];
((uint8_t*)dest)[1]= g[Y1];
@@ -642,8 +677,8 @@ static inline void yuv2packedXinC(SwsContext *c, int16_t *lumFilter, int16_t **l
dest+=6;
}
break;
- case IMGFMT_RGB16:
- case IMGFMT_BGR16:
+ case PIX_FMT_RGB565:
+ case PIX_FMT_BGR565:
{
const int dr1= dither_2x2_8[y&1 ][0];
const int dg1= dither_2x2_4[y&1 ][0];
@@ -657,8 +692,8 @@ static inline void yuv2packedXinC(SwsContext *c, int16_t *lumFilter, int16_t **l
}
}
break;
- case IMGFMT_RGB15:
- case IMGFMT_BGR15:
+ case PIX_FMT_RGB555:
+ case PIX_FMT_BGR555:
{
const int dr1= dither_2x2_8[y&1 ][0];
const int dg1= dither_2x2_8[y&1 ][1];
@@ -672,8 +707,8 @@ static inline void yuv2packedXinC(SwsContext *c, int16_t *lumFilter, int16_t **l
}
}
break;
- case IMGFMT_RGB8:
- case IMGFMT_BGR8:
+ case PIX_FMT_RGB8:
+ case PIX_FMT_BGR8:
{
const uint8_t * const d64= dither_8x8_73[y&7];
const uint8_t * const d32= dither_8x8_32[y&7];
@@ -683,8 +718,8 @@ static inline void yuv2packedXinC(SwsContext *c, int16_t *lumFilter, int16_t **l
}
}
break;
- case IMGFMT_RGB4:
- case IMGFMT_BGR4:
+ case PIX_FMT_RGB4:
+ case PIX_FMT_BGR4:
{
const uint8_t * const d64= dither_8x8_73 [y&7];
const uint8_t * const d128=dither_8x8_220[y&7];
@@ -694,8 +729,8 @@ static inline void yuv2packedXinC(SwsContext *c, int16_t *lumFilter, int16_t **l
}
}
break;
- case IMGFMT_RG4B:
- case IMGFMT_BG4B:
+ case PIX_FMT_RGB4_BYTE:
+ case PIX_FMT_BGR4_BYTE:
{
const uint8_t * const d64= dither_8x8_73 [y&7];
const uint8_t * const d128=dither_8x8_220[y&7];
@@ -705,8 +740,7 @@ static inline void yuv2packedXinC(SwsContext *c, int16_t *lumFilter, int16_t **l
}
}
break;
- case IMGFMT_RGB1:
- case IMGFMT_BGR1:
+ case PIX_FMT_MONOBLACK:
{
const uint8_t * const d128=dither_8x8_220[y&7];
uint8_t *g= c->table_gU[128] + c->table_gV[128];
@@ -739,7 +773,7 @@ static inline void yuv2packedXinC(SwsContext *c, int16_t *lumFilter, int16_t **l
}
}
break;
- case IMGFMT_YUY2:
+ case PIX_FMT_YUYV422:
YSCALE_YUV_2_PACKEDX_C(void)
((uint8_t*)dest)[2*i2+0]= Y1;
((uint8_t*)dest)[2*i2+1]= U;
@@ -747,7 +781,7 @@ static inline void yuv2packedXinC(SwsContext *c, int16_t *lumFilter, int16_t **l
((uint8_t*)dest)[2*i2+3]= V;
}
break;
- case IMGFMT_UYVY:
+ case PIX_FMT_UYVY422:
YSCALE_YUV_2_PACKEDX_C(void)
((uint8_t*)dest)[2*i2+0]= U;
((uint8_t*)dest)[2*i2+1]= Y1;
@@ -1483,7 +1517,7 @@ static int PlanarToNV12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], i
}
}
dst = dstParam[1] + dstStride[1]*srcSliceY/2;
- if (c->dstFormat == IMGFMT_NV12)
+ if (c->dstFormat == PIX_FMT_NV12)
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] );
@@ -1514,10 +1548,10 @@ static int rgb2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int sr
int srcSliceH, uint8_t* dst[], int dstStride[]){
const int srcFormat= c->srcFormat;
const int dstFormat= c->dstFormat;
- const int srcBpp= ((srcFormat&0xFF) + 7)>>3;
- const int dstBpp= ((dstFormat&0xFF) + 7)>>3;
- const int srcId= (srcFormat&0xFF)>>2; // 1:0, 4:1, 8:2, 15:3, 16:4, 24:6, 32:8
- const int dstId= (dstFormat&0xFF)>>2;
+ 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;
void (*conv)(const uint8_t *src, uint8_t *dst, long src_size)=NULL;
/* BGR -> BGR */
@@ -1616,7 +1650,7 @@ static int yvu9toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int
}
}
- if(c->dstFormat==IMGFMT_YV12){
+ if(c->dstFormat==PIX_FMT_YUV420P){
planar2x(src[1], dst[1], c->chrSrcW, c->chrSrcH, srcStride[1], dstStride[1]);
planar2x(src[2], dst[2], c->chrSrcW, c->chrSrcH, srcStride[2], dstStride[2]);
}else{
@@ -1626,50 +1660,6 @@ static int yvu9toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int
return srcSliceH;
}
-/**
- * bring pointers in YUV order instead of YVU
- */
-static inline void sws_orderYUV(int format, uint8_t * sortedP[], int sortedStride[], uint8_t * p[], int stride[]){
- if(format == IMGFMT_YV12 || format == IMGFMT_YVU9
- || format == IMGFMT_444P || format == IMGFMT_422P || format == IMGFMT_411P){
- sortedP[0]= p[0];
- sortedP[1]= p[2];
- sortedP[2]= p[1];
- sortedStride[0]= stride[0];
- sortedStride[1]= stride[2];
- sortedStride[2]= stride[1];
- }
- else if(isPacked(format) || isGray(format) || format == IMGFMT_Y8)
- {
- sortedP[0]= p[0];
- sortedP[1]=
- sortedP[2]= NULL;
- sortedStride[0]= stride[0];
- sortedStride[1]=
- sortedStride[2]= 0;
- }
- else if(format == IMGFMT_I420 || format == IMGFMT_IYUV)
- {
- sortedP[0]= p[0];
- sortedP[1]= p[1];
- sortedP[2]= p[2];
- sortedStride[0]= stride[0];
- sortedStride[1]= stride[1];
- sortedStride[2]= stride[2];
- }
- else if(format == IMGFMT_NV12 || format == IMGFMT_NV21)
- {
- sortedP[0]= p[0];
- sortedP[1]= p[1];
- sortedP[2]= NULL;
- sortedStride[0]= stride[0];
- sortedStride[1]= stride[1];
- sortedStride[2]= 0;
- }else{
- MSG_ERR("internal error in orderYUV\n");
- }
-}
-
/* unscaled copy like stuff (assumes nearly identical formats) */
static int simpleCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[]){
@@ -1734,45 +1724,33 @@ static int simpleCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli
return srcSliceH;
}
-static int remove_dup_fourcc(int fourcc)
-{
- switch(fourcc)
- {
- case IMGFMT_I420:
- case IMGFMT_IYUV: return IMGFMT_YV12;
- case IMGFMT_Y8 : return IMGFMT_Y800;
- case IMGFMT_IF09: return IMGFMT_YVU9;
- default: return fourcc;
- }
-}
-
static void getSubSampleFactors(int *h, int *v, int format){
switch(format){
- case IMGFMT_UYVY:
- case IMGFMT_YUY2:
+ case PIX_FMT_UYVY422:
+ case PIX_FMT_YUYV422:
*h=1;
*v=0;
break;
- case IMGFMT_YV12:
- case IMGFMT_Y800: //FIXME remove after different subsamplings are fully implemented
- case IMGFMT_NV12:
- case IMGFMT_NV21:
+ case PIX_FMT_YUV420P:
+ case PIX_FMT_GRAY8: //FIXME remove after different subsamplings are fully implemented
+ case PIX_FMT_NV12:
+ case PIX_FMT_NV21:
*h=1;
*v=1;
break;
- case IMGFMT_YVU9:
+ case PIX_FMT_YUV410P:
*h=2;
*v=2;
break;
- case IMGFMT_444P:
+ case PIX_FMT_YUV444P:
*h=0;
*v=0;
break;
- case IMGFMT_422P:
+ case PIX_FMT_YUV422P:
*h=1;
*v=0;
break;
- case IMGFMT_411P:
+ case PIX_FMT_YUV411P:
*h=2;
*v=0;
break;
@@ -1863,14 +1841,13 @@ int sws_getColorspaceDetails(SwsContext *c, int **inv_table, int *srcRange, int
return 0;
}
-SwsContext *sws_getContext(int srcW, int srcH, int origSrcFormat, int dstW, int dstH, int origDstFormat, int flags,
+SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags,
SwsFilter *srcFilter, SwsFilter *dstFilter, double *param){
SwsContext *c;
int i;
int usesVFilter, usesHFilter;
int unscaled, needsDither;
- int srcFormat, dstFormat;
SwsFilter dummyFilter= {NULL, NULL, NULL, NULL};
#if defined(ARCH_X86) || defined(ARCH_X86_64)
if(flags & SWS_CPU_CAPS_MMX)
@@ -1892,20 +1869,10 @@ SwsContext *sws_getContext(int srcW, int srcH, int origSrcFormat, int dstW, int
if(clip_table[512] != 255) globalInit();
if(rgb15to16 == NULL) sws_rgb2rgb_init(flags);
- /* avoid duplicate Formats, so we don't need to check to much */
- if (origSrcFormat < PIX_FMT_NB) {
- origSrcFormat = fmt_name[origSrcFormat];
- }
- if (origDstFormat < PIX_FMT_NB) {
- origDstFormat = fmt_name[origDstFormat];
- }
- srcFormat = remove_dup_fourcc(origSrcFormat);
- dstFormat = remove_dup_fourcc(origDstFormat);
-
unscaled = (srcW == dstW && srcH == dstH);
needsDither= (isBGR(dstFormat) || isRGB(dstFormat))
- && (dstFormat&0xFF)<24
- && ((dstFormat&0xFF)<(srcFormat&0xFF) || (!(isRGB(srcFormat) || isBGR(srcFormat))));
+ && (fmt_depth(dstFormat))<24
+ && ((fmt_depth(dstFormat))<(fmt_depth(srcFormat)) || (!(isRGB(srcFormat) || isBGR(srcFormat))));
if(!isSupportedIn(srcFormat))
{
@@ -1941,8 +1908,6 @@ SwsContext *sws_getContext(int srcW, int srcH, int origSrcFormat, int dstW, int
c->flags= flags;
c->dstFormat= dstFormat;
c->srcFormat= srcFormat;
- c->origDstFormat= origDstFormat;
- c->origSrcFormat= origSrcFormat;
c->vRounder= 4* 0x0001000100010001ULL;
usesHFilter= usesVFilter= 0;
@@ -1992,23 +1957,23 @@ SwsContext *sws_getContext(int srcW, int srcH, int origSrcFormat, int dstW, int
if(unscaled && !usesHFilter && !usesVFilter)
{
/* yv12_to_nv12 */
- if(srcFormat == IMGFMT_YV12 && (dstFormat == IMGFMT_NV12 || dstFormat == IMGFMT_NV21))
+ if(srcFormat == PIX_FMT_YUV420P && (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21))
{
c->swScale= PlanarToNV12Wrapper;
}
/* yuv2bgr */
- if((srcFormat==IMGFMT_YV12 || srcFormat==IMGFMT_422P) && (isBGR(dstFormat) || isRGB(dstFormat)))
+ if((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P) && (isBGR(dstFormat) || isRGB(dstFormat)))
{
c->swScale= yuv2rgb_get_func_ptr(c);
}
- if( srcFormat==IMGFMT_YVU9 && dstFormat==IMGFMT_YV12 )
+ if( srcFormat==PIX_FMT_YUV410P && dstFormat==PIX_FMT_YUV420P )
{
c->swScale= yvu9toyv12Wrapper;
}
/* bgr24toYV12 */
- if(srcFormat==IMGFMT_BGR24 && dstFormat==IMGFMT_YV12)
+ if(srcFormat==PIX_FMT_BGR24 && dstFormat==PIX_FMT_YUV420P)
c->swScale= bgr24toyv12Wrapper;
/* rgb/bgr -> rgb/bgr (no dither needed forms) */
@@ -2026,10 +1991,10 @@ SwsContext *sws_getContext(int srcW, int srcH, int origSrcFormat, int dstW, int
c->swScale= rgb2rgbWrapper;
/* yv12_to_yuy2 */
- if(srcFormat == IMGFMT_YV12 &&
- (dstFormat == IMGFMT_YUY2 || dstFormat == IMGFMT_UYVY))
+ if(srcFormat == PIX_FMT_YUV420P &&
+ (dstFormat == PIX_FMT_YUYV422 || dstFormat == PIX_FMT_UYVY422))
{
- if (dstFormat == IMGFMT_YUY2)
+ if (dstFormat == PIX_FMT_YUYV422)
c->swScale= PlanarToYuy2Wrapper;
else
c->swScale= PlanarToUyvyWrapper;
@@ -2038,10 +2003,10 @@ SwsContext *sws_getContext(int srcW, int srcH, int origSrcFormat, int dstW, int
#ifdef COMPILE_ALTIVEC
if ((c->flags & SWS_CPU_CAPS_ALTIVEC) &&
- ((srcFormat == IMGFMT_YV12 &&
- (dstFormat == IMGFMT_YUY2 || dstFormat == IMGFMT_UYVY)))) {
+ ((srcFormat == PIX_FMT_YUV420P &&
+ (dstFormat == PIX_FMT_YUYV422 || dstFormat == PIX_FMT_UYVY422)))) {
// unscaled YV12 -> packed YUV, we want speed
- if (dstFormat == IMGFMT_YUY2)
+ if (dstFormat == PIX_FMT_YUYV422)
c->swScale= yv12toyuy2_unscaled_altivec;
else
c->swScale= yv12touyvy_unscaled_altivec;
@@ -2245,7 +2210,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int origSrcFormat, int dstW, int
else
MSG_INFO("\nSwScaler: ehh flags invalid?! ");
- if(dstFormat==IMGFMT_BGR15 || dstFormat==IMGFMT_BGR16)
+ if(dstFormat==PIX_FMT_BGR555 || dstFormat==PIX_FMT_BGR565)
MSG_INFO("from %s to%s %s ",
sws_format_name(srcFormat), dither, sws_format_name(dstFormat));
else
@@ -2316,14 +2281,14 @@ SwsContext *sws_getContext(int srcW, int srcH, int origSrcFormat, int dstW, int
MSG_V("SwScaler: using n-tap %s scaler for vertical scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
}
- if(dstFormat==IMGFMT_BGR24)
+ if(dstFormat==PIX_FMT_BGR24)
MSG_V("SwScaler: using %s YV12->BGR24 Converter\n",
(flags & SWS_CPU_CAPS_MMX2) ? "MMX2" : ((flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C"));
- else if(dstFormat==IMGFMT_BGR32)
+ else if(dstFormat==PIX_FMT_RGB32)
MSG_V("SwScaler: using %s YV12->BGR32 Converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
- else if(dstFormat==IMGFMT_BGR16)
+ else if(dstFormat==PIX_FMT_BGR565)
MSG_V("SwScaler: using %s YV12->BGR16 Converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
- else if(dstFormat==IMGFMT_BGR15)
+ else if(dstFormat==PIX_FMT_BGR555)
MSG_V("SwScaler: using %s YV12->BGR15 Converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
MSG_V("SwScaler: %dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);
@@ -2379,14 +2344,12 @@ int sws_scale_ordered(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli
/**
* swscale warper, so we don't need to export the SwsContext
*/
-int sws_scale(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[], int dstStrideParam[]){
- int srcStride[3];
- int dstStride[3];
+int sws_scale(SwsContext *c, uint8_t* srcParam[], int srcStride[], int srcSliceY,
+ int srcSliceH, uint8_t* dstParam[], int dstStride[]){
uint8_t *src[3];
uint8_t *dst[3];
- sws_orderYUV(c->origSrcFormat, src, srcStride, srcParam, srcStrideParam);
- sws_orderYUV(c->origDstFormat, dst, dstStride, dstParam, dstStrideParam);
+ src[0] = srcParam[0]; src[1] = srcParam[1]; src[2] = srcParam[2];
+ dst[0] = dstParam[0]; dst[1] = dstParam[1]; dst[2] = dstParam[2];
//printf("sws: slice %d %d\n", srcSliceY, srcSliceH);
return c->swScale(c, src, srcStride, srcSliceY, srcSliceH, dst, dstStride);
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index fd74ecb052..d338c4e3a4 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -173,4 +173,52 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange,
char *sws_format_name(int format);
+//FIXME replace this with something faster
+#define isPlanarYUV(x) ((x)==PIX_FMT_YUV410P || (x)==PIX_FMT_YUV420P \
+ || (x)==PIX_FMT_YUV411P || (x)==PIX_FMT_YUV422P \
+ || (x)==PIX_FMT_YUV444P || (x)==PIX_FMT_NV12 \
+ || (x)==PIX_FMT_NV21)
+#define isYUV(x) ((x)==PIX_FMT_UYVY422 || (x)==PIX_FMT_YUYV422 || isPlanarYUV(x))
+#define isGray(x) ((x)==PIX_FMT_GRAY8)
+#define isRGB(x) ((x)==PIX_FMT_BGR32 || (x)==PIX_FMT_RGB24 \
+ || (x)==PIX_FMT_RGB565 || (x)==PIX_FMT_RGB555 \
+ || (x)==PIX_FMT_RGB8 || (x)==PIX_FMT_RGB4 \
+ || (x)==PIX_FMT_MONOBLACK)
+#define isBGR(x) ((x)==PIX_FMT_RGB32 || (x)==PIX_FMT_BGR24 \
+ || (x)==PIX_FMT_BGR565 || (x)==PIX_FMT_BGR555 \
+ || (x)==PIX_FMT_BGR8 || (x)==PIX_FMT_BGR4 \
+ || (x)==PIX_FMT_MONOBLACK)
+
+static inline int fmt_depth(int fmt)
+{
+ switch(fmt) {
+ case PIX_FMT_BGRA:
+ case PIX_FMT_ABGR:
+ case PIX_FMT_RGBA:
+ case PIX_FMT_ARGB:
+ return 32;
+ case PIX_FMT_BGR24:
+ case PIX_FMT_RGB24:
+ return 24;
+ case PIX_FMT_BGR565:
+ case PIX_FMT_RGB565:
+ return 16;
+ case PIX_FMT_BGR555:
+ case PIX_FMT_RGB555:
+ return 15;
+ case PIX_FMT_BGR8:
+ case PIX_FMT_RGB8:
+ return 8;
+ case PIX_FMT_BGR4:
+ case PIX_FMT_RGB4:
+ case PIX_FMT_BGR4_BYTE:
+ case PIX_FMT_RGB4_BYTE:
+ return 4;
+ case PIX_FMT_MONOBLACK:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
#endif
diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c
index 0d1689cbf2..c73364fa50 100644
--- a/libswscale/swscale_template.c
+++ b/libswscale/swscale_template.c
@@ -1039,14 +1039,14 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_
#ifdef HAVE_MMX
if(c->flags & SWS_ACCURATE_RND){
switch(c->dstFormat){
- case IMGFMT_BGR32:
+ case PIX_FMT_RGB32:
YSCALEYUV2PACKEDX_ACCURATE
YSCALEYUV2RGBX
WRITEBGR32(%4, %5, %%REGa)
YSCALEYUV2PACKEDX_END
return;
- case IMGFMT_BGR24:
+ case PIX_FMT_BGR24:
YSCALEYUV2PACKEDX_ACCURATE
YSCALEYUV2RGBX
"lea (%%"REG_a", %%"REG_a", 2), %%"REG_c"\n\t" //FIXME optimize
@@ -1060,7 +1060,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_
: "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S
);
return;
- case IMGFMT_BGR15:
+ case PIX_FMT_BGR555:
YSCALEYUV2PACKEDX_ACCURATE
YSCALEYUV2RGBX
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
@@ -1073,7 +1073,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_
WRITEBGR15(%4, %5, %%REGa)
YSCALEYUV2PACKEDX_END
return;
- case IMGFMT_BGR16:
+ case PIX_FMT_BGR565:
YSCALEYUV2PACKEDX_ACCURATE
YSCALEYUV2RGBX
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
@@ -1086,7 +1086,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_
WRITEBGR16(%4, %5, %%REGa)
YSCALEYUV2PACKEDX_END
return;
- case IMGFMT_YUY2:
+ case PIX_FMT_YUYV422:
YSCALEYUV2PACKEDX_ACCURATE
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
@@ -1101,13 +1101,13 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_
}else{
switch(c->dstFormat)
{
- case IMGFMT_BGR32:
+ case PIX_FMT_RGB32:
YSCALEYUV2PACKEDX
YSCALEYUV2RGBX
WRITEBGR32(%4, %5, %%REGa)
YSCALEYUV2PACKEDX_END
return;
- case IMGFMT_BGR24:
+ case PIX_FMT_BGR24:
YSCALEYUV2PACKEDX
YSCALEYUV2RGBX
"lea (%%"REG_a", %%"REG_a", 2), %%"REG_c"\n\t" //FIXME optimize
@@ -1120,7 +1120,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_
: "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S
);
return;
- case IMGFMT_BGR15:
+ case PIX_FMT_BGR555:
YSCALEYUV2PACKEDX
YSCALEYUV2RGBX
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
@@ -1133,7 +1133,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_
WRITEBGR15(%4, %5, %%REGa)
YSCALEYUV2PACKEDX_END
return;
- case IMGFMT_BGR16:
+ case PIX_FMT_BGR565:
YSCALEYUV2PACKEDX
YSCALEYUV2RGBX
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
@@ -1146,7 +1146,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_
WRITEBGR16(%4, %5, %%REGa)
YSCALEYUV2PACKEDX_END
return;
- case IMGFMT_YUY2:
+ case PIX_FMT_YUYV422:
YSCALEYUV2PACKEDX
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
@@ -1163,9 +1163,9 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_
#ifdef HAVE_ALTIVEC
/* The following list of supported dstFormat values should
match what's found in the body of altivec_yuv2packedX() */
- if(c->dstFormat==IMGFMT_ABGR || c->dstFormat==IMGFMT_BGRA ||
- c->dstFormat==IMGFMT_BGR24 || c->dstFormat==IMGFMT_RGB24 ||
- c->dstFormat==IMGFMT_RGBA || c->dstFormat==IMGFMT_ARGB)
+ if(c->dstFormat==PIX_FMT_ABGR || c->dstFormat==PIX_FMT_BGRA ||
+ c->dstFormat==PIX_FMT_BGR24 || c->dstFormat==PIX_FMT_RGB24 ||
+ c->dstFormat==PIX_FMT_RGBA || c->dstFormat==PIX_FMT_ARGB)
altivec_yuv2packedX (c, lumFilter, lumSrc, lumFilterSize,
chrFilter, chrSrc, chrFilterSize,
dest, dstW, dstY);
@@ -1192,7 +1192,7 @@ static inline void RENAME(yuv2packed2)(SwsContext *c, uint16_t *buf0, uint16_t *
switch(dstFormat)
{
#ifdef HAVE_MMX
- case IMGFMT_BGR32:
+ case PIX_FMT_RGB32:
asm volatile(
@@ -1217,7 +1217,7 @@ FULL_YSCALEYUV2RGB
: "%"REG_a
);
break;
- case IMGFMT_BGR24:
+ case PIX_FMT_BGR24:
asm volatile(
FULL_YSCALEYUV2RGB
@@ -1266,7 +1266,7 @@ FULL_YSCALEYUV2RGB
: "%"REG_a, "%"REG_b
);
break;
- case IMGFMT_BGR15:
+ case PIX_FMT_BGR555:
asm volatile(
FULL_YSCALEYUV2RGB
@@ -1299,7 +1299,7 @@ FULL_YSCALEYUV2RGB
: "%"REG_a
);
break;
- case IMGFMT_BGR16:
+ case PIX_FMT_BGR565:
asm volatile(
FULL_YSCALEYUV2RGB
@@ -1333,11 +1333,11 @@ FULL_YSCALEYUV2RGB
);
break;
#endif
- case IMGFMT_RGB32:
+ case PIX_FMT_BGR32:
#ifndef HAVE_MMX
- case IMGFMT_BGR32:
+ case PIX_FMT_RGB32:
#endif
- if(dstFormat==IMGFMT_BGR32)
+ if(dstFormat==PIX_FMT_RGB32)
{
int i;
#ifdef WORDS_BIGENDIAN
@@ -1354,7 +1354,7 @@ FULL_YSCALEYUV2RGB
dest+= 4;
}
}
- else if(dstFormat==IMGFMT_BGR24)
+ else if(dstFormat==PIX_FMT_BGR24)
{
int i;
for(i=0;i<dstW;i++){
@@ -1368,7 +1368,7 @@ FULL_YSCALEYUV2RGB
dest+= 3;
}
}
- else if(dstFormat==IMGFMT_BGR16)
+ else if(dstFormat==PIX_FMT_BGR565)
{
int i;
for(i=0;i<dstW;i++){
@@ -1383,7 +1383,7 @@ FULL_YSCALEYUV2RGB
clip_table16r[(Y + yuvtab_3343[V]) >>13];
}
}
- else if(dstFormat==IMGFMT_BGR15)
+ else if(dstFormat==PIX_FMT_BGR555)
{
int i;
for(i=0;i<dstW;i++){
@@ -1406,7 +1406,7 @@ FULL_YSCALEYUV2RGB
switch(c->dstFormat)
{
//Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :(
- case IMGFMT_BGR32:
+ case PIX_FMT_RGB32:
asm volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1420,7 +1420,7 @@ FULL_YSCALEYUV2RGB
"a" (&c->redDither)
);
return;
- case IMGFMT_BGR24:
+ case PIX_FMT_BGR24:
asm volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1433,7 +1433,7 @@ FULL_YSCALEYUV2RGB
"a" (&c->redDither)
);
return;
- case IMGFMT_BGR15:
+ case PIX_FMT_BGR555:
asm volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1454,7 +1454,7 @@ FULL_YSCALEYUV2RGB
"a" (&c->redDither)
);
return;
- case IMGFMT_BGR16:
+ case PIX_FMT_BGR565:
asm volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1474,7 +1474,7 @@ FULL_YSCALEYUV2RGB
"a" (&c->redDither)
);
return;
- case IMGFMT_YUY2:
+ case PIX_FMT_YUYV422:
asm volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1516,7 +1516,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
{
switch(dstFormat)
{
- case IMGFMT_BGR32:
+ case PIX_FMT_RGB32:
asm volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1530,7 +1530,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
"a" (&c->redDither)
);
return;
- case IMGFMT_BGR24:
+ case PIX_FMT_BGR24:
asm volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1544,7 +1544,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
"a" (&c->redDither)
);
return;
- case IMGFMT_BGR15:
+ case PIX_FMT_BGR555:
asm volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1564,7 +1564,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
"a" (&c->redDither)
);
return;
- case IMGFMT_BGR16:
+ case PIX_FMT_BGR565:
asm volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1585,7 +1585,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
"a" (&c->redDither)
);
return;
- case IMGFMT_YUY2:
+ case PIX_FMT_YUYV422:
asm volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1605,7 +1605,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
{
switch(dstFormat)
{
- case IMGFMT_BGR32:
+ case PIX_FMT_RGB32:
asm volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1619,7 +1619,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
"a" (&c->redDither)
);
return;
- case IMGFMT_BGR24:
+ case PIX_FMT_BGR24:
asm volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1633,7 +1633,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
"a" (&c->redDither)
);
return;
- case IMGFMT_BGR15:
+ case PIX_FMT_BGR555:
asm volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1653,7 +1653,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
"a" (&c->redDither)
);
return;
- case IMGFMT_BGR16:
+ case PIX_FMT_BGR565:
asm volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1674,7 +1674,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
"a" (&c->redDither)
);
return;
- case IMGFMT_YUY2:
+ case PIX_FMT_YUYV422:
asm volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -2435,42 +2435,42 @@ static inline void RENAME(hyscale)(uint16_t *dst, long dstWidth, uint8_t *src, i
int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter,
int32_t *mmx2FilterPos)
{
- if(srcFormat==IMGFMT_YUY2)
+ if(srcFormat==PIX_FMT_YUYV422)
{
RENAME(yuy2ToY)(formatConvBuffer, src, srcW);
src= formatConvBuffer;
}
- else if(srcFormat==IMGFMT_UYVY)
+ else if(srcFormat==PIX_FMT_UYVY422)
{
RENAME(uyvyToY)(formatConvBuffer, src, srcW);
src= formatConvBuffer;
}
- else if(srcFormat==IMGFMT_BGR32)
+ else if(srcFormat==PIX_FMT_RGB32)
{
RENAME(bgr32ToY)(formatConvBuffer, src, srcW);
src= formatConvBuffer;
}
- else if(srcFormat==IMGFMT_BGR24)
+ else if(srcFormat==PIX_FMT_BGR24)
{
RENAME(bgr24ToY)(formatConvBuffer, src, srcW);
src= formatConvBuffer;
}
- else if(srcFormat==IMGFMT_BGR16)
+ else if(srcFormat==PIX_FMT_BGR565)
{
RENAME(bgr16ToY)(formatConvBuffer, src, srcW);
src= formatConvBuffer;
}
- else if(srcFormat==IMGFMT_BGR15)
+ else if(srcFormat==PIX_FMT_BGR555)
{
RENAME(bgr15ToY)(formatConvBuffer, src, srcW);
src= formatConvBuffer;
}
- else if(srcFormat==IMGFMT_RGB32)
+ else if(srcFormat==PIX_FMT_BGR32)
{
RENAME(rgb32ToY)(formatConvBuffer, src, srcW);
src= formatConvBuffer;
}
- else if(srcFormat==IMGFMT_RGB24)
+ else if(srcFormat==PIX_FMT_RGB24)
{
RENAME(rgb24ToY)(formatConvBuffer, src, srcW);
src= formatConvBuffer;
@@ -2622,49 +2622,49 @@ inline static void RENAME(hcscale)(uint16_t *dst, long dstWidth, uint8_t *src1,
int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter,
int32_t *mmx2FilterPos)
{
- if(srcFormat==IMGFMT_YUY2)
+ if(srcFormat==PIX_FMT_YUYV422)
{
RENAME(yuy2ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
src1= formatConvBuffer;
src2= formatConvBuffer+2048;
}
- else if(srcFormat==IMGFMT_UYVY)
+ else if(srcFormat==PIX_FMT_UYVY422)
{
RENAME(uyvyToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
src1= formatConvBuffer;
src2= formatConvBuffer+2048;
}
- else if(srcFormat==IMGFMT_BGR32)
+ else if(srcFormat==PIX_FMT_RGB32)
{
RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
src1= formatConvBuffer;
src2= formatConvBuffer+2048;
}
- else if(srcFormat==IMGFMT_BGR24)
+ else if(srcFormat==PIX_FMT_BGR24)
{
RENAME(bgr24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
src1= formatConvBuffer;
src2= formatConvBuffer+2048;
}
- else if(srcFormat==IMGFMT_BGR16)
+ else if(srcFormat==PIX_FMT_BGR565)
{
RENAME(bgr16ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
src1= formatConvBuffer;
src2= formatConvBuffer+2048;
}
- else if(srcFormat==IMGFMT_BGR15)
+ else if(srcFormat==PIX_FMT_BGR555)
{
RENAME(bgr15ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
src1= formatConvBuffer;
src2= formatConvBuffer+2048;
}
- else if(srcFormat==IMGFMT_RGB32)
+ else if(srcFormat==PIX_FMT_BGR32)
{
RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
src1= formatConvBuffer;
src2= formatConvBuffer+2048;
}
- else if(srcFormat==IMGFMT_RGB24)
+ else if(srcFormat==PIX_FMT_RGB24)
{
RENAME(rgb24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
src1= formatConvBuffer;
@@ -2902,7 +2902,7 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s
{
static volatile int i=0;
i++;
-if(srcFormat==IMGFMT_YV12 && i==1 && srcSliceH>= c->srcH)
+if(srcFormat==PIX_FMT_YUV420P && i==1 && srcSliceH>= c->srcH)
selfTest(src, srcStride, c->srcW, c->srcH);
i--;
}
@@ -3081,7 +3081,7 @@ i--;
}
}
#endif
- if(dstFormat == IMGFMT_NV12 || dstFormat == IMGFMT_NV21){
+ if(dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21){
const int chrSkipMask= (1<<c->chrDstVSubSample)-1;
if(dstY&chrSkipMask) uDest= NULL; //FIXME split functions in lumi / chromi
RENAME(yuv2nv12X)(c,
@@ -3141,7 +3141,7 @@ i--;
{
int16_t **lumSrcPtr= lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
int16_t **chrSrcPtr= chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
- if(dstFormat == IMGFMT_NV12 || dstFormat == IMGFMT_NV21){
+ if(dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21){
const int chrSkipMask= (1<<c->chrDstVSubSample)-1;
if(dstY&chrSkipMask) uDest= NULL; //FIXME split functions in lumi / chromi
yuv2nv12XinC(
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
index 8c116ba0b7..c7b7d40376 100644
--- a/libswscale/yuv2rgb.c
+++ b/libswscale/yuv2rgb.c
@@ -39,7 +39,6 @@
#include "rgb2rgb.h"
#include "swscale.h"
#include "swscale_internal.h"
-#include "libmpcodecs/img_format.h" //FIXME try to reduce dependency of such stuff
#ifdef HAVE_MLIB
#include "yuv2rgb_mlib.c"
@@ -259,7 +258,7 @@ static int func_name(SwsContext *c, uint8_t* src[], int srcStride[], int srcSlic
int srcSliceH, uint8_t* dst[], int dstStride[]){\
int y;\
\
- if(c->srcFormat == IMGFMT_422P){\
+ if(c->srcFormat == PIX_FMT_YUV422P){\
srcStride[1] *= 2;\
srcStride[2] *= 2;\
}\
@@ -581,18 +580,18 @@ SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
#if defined(HAVE_MMX2) || defined(HAVE_MMX)
if(c->flags & SWS_CPU_CAPS_MMX2){
switch(c->dstFormat){
- case IMGFMT_BGR32: return yuv420_rgb32_MMX2;
- case IMGFMT_BGR24: return yuv420_rgb24_MMX2;
- case IMGFMT_BGR16: return yuv420_rgb16_MMX2;
- case IMGFMT_BGR15: return yuv420_rgb15_MMX2;
+ case PIX_FMT_RGB32: return yuv420_rgb32_MMX2;
+ case PIX_FMT_BGR24: return yuv420_rgb24_MMX2;
+ case PIX_FMT_BGR565: return yuv420_rgb16_MMX2;
+ case PIX_FMT_BGR555: return yuv420_rgb15_MMX2;
}
}
if(c->flags & SWS_CPU_CAPS_MMX){
switch(c->dstFormat){
- case IMGFMT_BGR32: return yuv420_rgb32_MMX;
- case IMGFMT_BGR24: return yuv420_rgb24_MMX;
- case IMGFMT_BGR16: return yuv420_rgb16_MMX;
- case IMGFMT_BGR15: return yuv420_rgb15_MMX;
+ case PIX_FMT_RGB32: return yuv420_rgb32_MMX;
+ case PIX_FMT_BGR24: return yuv420_rgb24_MMX;
+ case PIX_FMT_BGR565: return yuv420_rgb16_MMX;
+ case PIX_FMT_BGR555: return yuv420_rgb15_MMX;
}
}
#endif
@@ -613,22 +612,21 @@ SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
MSG_WARN("No accelerated colorspace conversion found\n");
switch(c->dstFormat){
- case IMGFMT_RGB32:
- case IMGFMT_BGR32: return yuv2rgb_c_32;
- case IMGFMT_RGB24: return yuv2rgb_c_24_rgb;
- case IMGFMT_BGR24: return yuv2rgb_c_24_bgr;
- case IMGFMT_RGB16:
- case IMGFMT_BGR16:
- case IMGFMT_RGB15:
- case IMGFMT_BGR15: return yuv2rgb_c_16;
- case IMGFMT_RGB8:
- case IMGFMT_BGR8: return yuv2rgb_c_8_ordered_dither;
- case IMGFMT_RGB4:
- case IMGFMT_BGR4: return yuv2rgb_c_4_ordered_dither;
- case IMGFMT_RG4B:
- case IMGFMT_BG4B: return yuv2rgb_c_4b_ordered_dither;
- case IMGFMT_RGB1:
- case IMGFMT_BGR1: return yuv2rgb_c_1_ordered_dither;
+ case PIX_FMT_BGR32:
+ case PIX_FMT_RGB32: return yuv2rgb_c_32;
+ case PIX_FMT_RGB24: return yuv2rgb_c_24_rgb;
+ case PIX_FMT_BGR24: return yuv2rgb_c_24_bgr;
+ case PIX_FMT_RGB565:
+ case PIX_FMT_BGR565:
+ case PIX_FMT_RGB555:
+ case PIX_FMT_BGR555: return yuv2rgb_c_16;
+ case PIX_FMT_RGB8:
+ case PIX_FMT_BGR8: return yuv2rgb_c_8_ordered_dither;
+ case PIX_FMT_RGB4:
+ case PIX_FMT_BGR4: return yuv2rgb_c_4_ordered_dither;
+ case PIX_FMT_RGB4_BYTE:
+ case PIX_FMT_BGR4_BYTE: return yuv2rgb_c_4b_ordered_dither;
+ case PIX_FMT_MONOBLACK: return yuv2rgb_c_1_ordered_dither;
default:
assert(0);
}
@@ -645,8 +643,8 @@ static int div_round (int dividend, int divisor)
int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation)
{
- const int isRgb = IMGFMT_IS_BGR(c->dstFormat);
- const int bpp = isRgb?IMGFMT_RGB_DEPTH(c->dstFormat):IMGFMT_BGR_DEPTH(c->dstFormat);
+ const int isRgb = isBGR(c->dstFormat);
+ const int bpp = fmt_depth(c->dstFormat);
int i;
uint8_t table_Y[1024];
uint32_t *table_32 = 0;
diff --git a/libswscale/yuv2rgb_altivec.c b/libswscale/yuv2rgb_altivec.c
index 8cbfe9c276..441d7c45ce 100644
--- a/libswscale/yuv2rgb_altivec.c
+++ b/libswscale/yuv2rgb_altivec.c
@@ -88,7 +88,6 @@
#include "rgb2rgb.h"
#include "swscale.h"
#include "swscale_internal.h"
-#include "libmpcodecs/img_format.h" //FIXME try to reduce dependency of such stuff
#undef PROFILE_THE_BEAST
#undef INC_SCALING
@@ -697,45 +696,41 @@ SwsFunc yuv2rgb_init_altivec (SwsContext *c)
if ((c->srcW & 0xf) != 0) return NULL;
switch (c->srcFormat) {
- case IMGFMT_YVU9:
- case IMGFMT_IF09:
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_CLPL:
- case IMGFMT_Y800:
- case IMGFMT_Y8:
- case IMGFMT_NV12:
- case IMGFMT_NV21:
+ case PIX_FMT_YUV410P:
+ case PIX_FMT_YUV420P:
+ /*case IMGFMT_CLPL: ??? */
+ case PIX_FMT_GRAY8:
+ case PIX_FMT_NV12:
+ case PIX_FMT_NV21:
if ((c->srcH & 0x1) != 0)
return NULL;
switch(c->dstFormat){
- case IMGFMT_RGB24:
+ case PIX_FMT_RGB24:
MSG_WARN("ALTIVEC: Color Space RGB24\n");
return altivec_yuv2_rgb24;
- case IMGFMT_BGR24:
+ case PIX_FMT_BGR24:
MSG_WARN("ALTIVEC: Color Space BGR24\n");
return altivec_yuv2_bgr24;
- case IMGFMT_ARGB:
+ case PIX_FMT_ARGB:
MSG_WARN("ALTIVEC: Color Space ARGB\n");
return altivec_yuv2_argb;
- case IMGFMT_ABGR:
+ case PIX_FMT_ABGR:
MSG_WARN("ALTIVEC: Color Space ABGR\n");
return altivec_yuv2_abgr;
- case IMGFMT_RGBA:
+ case PIX_FMT_RGBA:
MSG_WARN("ALTIVEC: Color Space RGBA\n");
return altivec_yuv2_rgba;
- case IMGFMT_BGRA:
+ case PIX_FMT_BGRA:
MSG_WARN("ALTIVEC: Color Space BGRA\n");
return altivec_yuv2_bgra;
default: return NULL;
}
break;
- case IMGFMT_UYVY:
+ case PIX_FMT_UYVY422:
switch(c->dstFormat){
- case IMGFMT_RGB32:
+ case PIX_FMT_BGR32:
MSG_WARN("ALTIVEC: Color Space UYVY -> RGB32\n");
return altivec_uyvy_rgb32;
default: return NULL;
@@ -868,12 +863,12 @@ altivec_yuv2packedX (SwsContext *c,
B = vec_packclp (B0,B1);
switch(c->dstFormat) {
- case IMGFMT_ABGR: out_abgr (R,G,B,out); break;
- case IMGFMT_BGRA: out_bgra (R,G,B,out); break;
- case IMGFMT_RGBA: out_rgba (R,G,B,out); break;
- case IMGFMT_ARGB: out_argb (R,G,B,out); break;
- case IMGFMT_RGB24: out_rgb24 (R,G,B,out); break;
- case IMGFMT_BGR24: out_bgr24 (R,G,B,out); break;
+ case PIX_FMT_ABGR: out_abgr (R,G,B,out); break;
+ case PIX_FMT_BGRA: out_bgra (R,G,B,out); break;
+ case PIX_FMT_RGBA: out_rgba (R,G,B,out); break;
+ case PIX_FMT_ARGB: out_argb (R,G,B,out); break;
+ case PIX_FMT_RGB24: out_rgb24 (R,G,B,out); break;
+ case PIX_FMT_BGR24: out_bgr24 (R,G,B,out); break;
default:
{
/* If this is reached, the caller should have called yuv2packedXinC
@@ -947,12 +942,12 @@ altivec_yuv2packedX (SwsContext *c,
nout = (vector unsigned char *)scratch;
switch(c->dstFormat) {
- case IMGFMT_ABGR: out_abgr (R,G,B,nout); break;
- case IMGFMT_BGRA: out_bgra (R,G,B,nout); break;
- case IMGFMT_RGBA: out_rgba (R,G,B,nout); break;
- case IMGFMT_ARGB: out_argb (R,G,B,nout); break;
- case IMGFMT_RGB24: out_rgb24 (R,G,B,nout); break;
- case IMGFMT_BGR24: out_bgr24 (R,G,B,nout); break;
+ case PIX_FMT_ABGR: out_abgr (R,G,B,nout); break;
+ case PIX_FMT_BGRA: out_bgra (R,G,B,nout); break;
+ case PIX_FMT_RGBA: out_rgba (R,G,B,nout); break;
+ case PIX_FMT_ARGB: out_argb (R,G,B,nout); break;
+ case PIX_FMT_RGB24: out_rgb24 (R,G,B,nout); break;
+ case PIX_FMT_BGR24: out_bgr24 (R,G,B,nout); break;
default:
/* Unreachable, I think. */
MSG_ERR("altivec_yuv2packedX doesn't support %s output\n",
diff --git a/libswscale/yuv2rgb_mlib.c b/libswscale/yuv2rgb_mlib.c
index 69c4ad303d..824ee39d1b 100644
--- a/libswscale/yuv2rgb_mlib.c
+++ b/libswscale/yuv2rgb_mlib.c
@@ -30,12 +30,11 @@
#include <stdlib.h>
#include <assert.h>
-#include "libmpcodecs/img_format.h" //FIXME try to reduce dependency of such stuff
#include "swscale.h"
static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[]){
- if(c->srcFormat == IMGFMT_422P){
+ if(c->srcFormat == PIX_FMT_YUV422P){
srcStride[1] *= 2;
srcStride[2] *= 2;
}
@@ -49,7 +48,7 @@ static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], i
static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[]){
- if(c->srcFormat == IMGFMT_422P){
+ if(c->srcFormat == PIX_FMT_YUV422P){
srcStride[1] *= 2;
srcStride[2] *= 2;
}
@@ -63,7 +62,7 @@ static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], i
static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[]){
- if(c->srcFormat == IMGFMT_422P){
+ if(c->srcFormat == PIX_FMT_YUV422P){
srcStride[1] *= 2;
srcStride[2] *= 2;
}
@@ -79,9 +78,9 @@ static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], in
SwsFunc yuv2rgb_init_mlib(SwsContext *c)
{
switch(c->dstFormat){
- case IMGFMT_RGB24: return mlib_YUV2RGB420_24;
- case IMGFMT_RGB32: return mlib_YUV2ARGB420_32;
- case IMGFMT_BGR32: return mlib_YUV2ABGR420_32;
+ case PIX_FMT_RGB24: return mlib_YUV2RGB420_24;
+ case PIX_FMT_BGR32: return mlib_YUV2ARGB420_32;
+ case PIX_FMT_RGB32: return mlib_YUV2ABGR420_32;
default: return NULL;
}
}
diff --git a/libswscale/yuv2rgb_template.c b/libswscale/yuv2rgb_template.c
index 2f15931ead..fd222350ef 100644
--- a/libswscale/yuv2rgb_template.c
+++ b/libswscale/yuv2rgb_template.c
@@ -127,7 +127,7 @@ static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* src[], int srcStr
int srcSliceH, uint8_t* dst[], int dstStride[]){
int y, h_size;
- if(c->srcFormat == IMGFMT_422P){
+ if(c->srcFormat == PIX_FMT_YUV422P){
srcStride[1] *= 2;
srcStride[2] *= 2;
}
@@ -222,7 +222,7 @@ static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* src[], int srcStr
int srcSliceH, uint8_t* dst[], int dstStride[]){
int y, h_size;
- if(c->srcFormat == IMGFMT_422P){
+ if(c->srcFormat == PIX_FMT_YUV422P){
srcStride[1] *= 2;
srcStride[2] *= 2;
}
@@ -311,7 +311,7 @@ static inline int RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* src[], int srcStr
int srcSliceH, uint8_t* dst[], int dstStride[]){
int y, h_size;
- if(c->srcFormat == IMGFMT_422P){
+ if(c->srcFormat == PIX_FMT_YUV422P){
srcStride[1] *= 2;
srcStride[2] *= 2;
}
@@ -457,7 +457,7 @@ static inline int RENAME(yuv420_rgb32)(SwsContext *c, uint8_t* src[], int srcStr
int srcSliceH, uint8_t* dst[], int dstStride[]){
int y, h_size;
- if(c->srcFormat == IMGFMT_422P){
+ if(c->srcFormat == PIX_FMT_YUV422P){
srcStride[1] *= 2;
srcStride[2] *= 2;
}