cosmetics attack, part II: Remove all tabs and prettyprint/reindent the code.

Originally committed as revision 23173 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
This commit is contained in:
Diego Biurrun 2007-04-29 13:39:27 +00:00
parent 07d84a4e9f
commit 221b804f34
4 changed files with 2313 additions and 2314 deletions

View File

@ -31,129 +31,129 @@
#include "rgb2rgb.h"
static uint64_t getSSD(uint8_t *src1, uint8_t *src2, int stride1, int stride2, int w, int h){
int x,y;
uint64_t ssd=0;
int x,y;
uint64_t ssd=0;
//printf("%d %d\n", w, h);
for(y=0; y<h; y++){
for(x=0; x<w; x++){
int d= src1[x + y*stride1] - src2[x + y*stride2];
ssd+= d*d;
for (y=0; y<h; y++){
for (x=0; x<w; x++){
int d= src1[x + y*stride1] - src2[x + y*stride2];
ssd+= d*d;
//printf("%d", abs(src1[x + y*stride1] - src2[x + y*stride2])/26 );
}
}
//printf("\n");
}
return ssd;
}
return ssd;
}
// test by ref -> src -> dst -> out & compare out against ref
// ref & out are YV12
static int doTest(uint8_t *ref[3], int refStride[3], int w, int h, int srcFormat, int dstFormat,
int srcW, int srcH, int dstW, int dstH, int flags){
uint8_t *src[3];
uint8_t *dst[3];
uint8_t *out[3];
int srcStride[3], dstStride[3];
int i;
uint64_t ssdY, ssdU, ssdV;
struct SwsContext *srcContext, *dstContext, *outContext;
int res;
int srcW, int srcH, int dstW, int dstH, int flags){
uint8_t *src[3];
uint8_t *dst[3];
uint8_t *out[3];
int srcStride[3], dstStride[3];
int i;
uint64_t ssdY, ssdU, ssdV;
struct SwsContext *srcContext, *dstContext, *outContext;
int res;
res = 0;
for(i=0; i<3; i++){
// avoid stride % bpp != 0
if(srcFormat==PIX_FMT_RGB24 || srcFormat==PIX_FMT_BGR24)
srcStride[i]= srcW*3;
else
srcStride[i]= srcW*4;
res = 0;
for (i=0; i<3; i++){
// avoid stride % bpp != 0
if (srcFormat==PIX_FMT_RGB24 || srcFormat==PIX_FMT_BGR24)
srcStride[i]= srcW*3;
else
srcStride[i]= srcW*4;
if(dstFormat==PIX_FMT_RGB24 || dstFormat==PIX_FMT_BGR24)
dstStride[i]= dstW*3;
else
dstStride[i]= dstW*4;
if (dstFormat==PIX_FMT_RGB24 || dstFormat==PIX_FMT_BGR24)
dstStride[i]= dstW*3;
else
dstStride[i]= dstW*4;
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");
res = -1;
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");
res = -1;
goto end;
}
}
goto end;
}
}
dstContext = outContext = NULL;
srcContext= sws_getContext(w, h, PIX_FMT_YUV420P, srcW, srcH, srcFormat, flags, NULL, NULL, NULL);
if (srcContext == NULL) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(PIX_FMT_YUV420P),
sws_format_name(srcFormat));
res = -1;
dstContext = outContext = NULL;
srcContext= sws_getContext(w, h, PIX_FMT_YUV420P, srcW, srcH, srcFormat, flags, NULL, NULL, NULL);
if (srcContext == NULL) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(PIX_FMT_YUV420P),
sws_format_name(srcFormat));
res = -1;
goto end;
}
dstContext= sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags, NULL, NULL, NULL);
if (dstContext == NULL) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(srcFormat),
sws_format_name(dstFormat));
res = -1;
goto end;
}
dstContext= sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags, NULL, NULL, NULL);
if (dstContext == NULL) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(srcFormat),
sws_format_name(dstFormat));
res = -1;
goto end;
}
outContext= sws_getContext(dstW, dstH, dstFormat, w, h, PIX_FMT_YUV420P, flags, NULL, NULL, NULL);
if (outContext == NULL) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(dstFormat),
sws_format_name(PIX_FMT_YUV420P));
res = -1;
goto end;
}
outContext= sws_getContext(dstW, dstH, dstFormat, w, h, PIX_FMT_YUV420P, flags, NULL, NULL, NULL);
if (outContext == NULL) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(dstFormat),
sws_format_name(PIX_FMT_YUV420P));
res = -1;
goto end;
}
// printf("test %X %X %X -> %X %X %X\n", (int)ref[0], (int)ref[1], (int)ref[2],
// (int)src[0], (int)src[1], (int)src[2]);
goto end;
}
// printf("test %X %X %X -> %X %X %X\n", (int)ref[0], (int)ref[1], (int)ref[2],
// (int)src[0], (int)src[1], (int)src[2]);
sws_scale(srcContext, ref, refStride, 0, h , src, srcStride);
sws_scale(dstContext, src, srcStride, 0, srcH, dst, dstStride);
sws_scale(outContext, dst, dstStride, 0, dstH, out, refStride);
sws_scale(srcContext, ref, refStride, 0, h , src, srcStride);
sws_scale(dstContext, src, srcStride, 0, srcH, dst, dstStride);
sws_scale(outContext, dst, dstStride, 0, dstH, out, refStride);
#if defined(ARCH_X86)
asm volatile ("emms\n\t");
asm volatile ("emms\n\t");
#endif
ssdY= getSSD(ref[0], out[0], refStride[0], refStride[0], w, h);
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);
ssdY= getSSD(ref[0], out[0], refStride[0], refStride[0], w, h);
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 == PIX_FMT_GRAY8 || dstFormat==PIX_FMT_GRAY8) 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;
ssdV/= w*h/4;
ssdY/= w*h;
ssdU/= w*h/4;
ssdV/= w*h/4;
if(ssdY>100 || ssdU>100 || ssdV>100){
printf(" %s %dx%d -> %s %4dx%4d flags=%2d SSD=%5lld,%5lld,%5lld\n",
sws_format_name(srcFormat), srcW, srcH,
sws_format_name(dstFormat), dstW, dstH,
flags,
ssdY, ssdU, ssdV);
}
if (ssdY>100 || ssdU>100 || ssdV>100){
printf(" %s %dx%d -> %s %4dx%4d flags=%2d SSD=%5lld,%5lld,%5lld\n",
sws_format_name(srcFormat), srcW, srcH,
sws_format_name(dstFormat), dstW, dstH,
flags,
ssdY, ssdU, ssdV);
}
end:
end:
sws_freeContext(srcContext);
sws_freeContext(dstContext);
sws_freeContext(outContext);
sws_freeContext(srcContext);
sws_freeContext(dstContext);
sws_freeContext(outContext);
for(i=0; i<3; i++){
free(src[i]);
free(dst[i]);
free(out[i]);
}
for (i=0; i<3; i++){
free(src[i]);
free(dst[i]);
free(out[i]);
}
return res;
return res;
}
void fast_memcpy(void *a, void *b, int s){ //FIXME
@ -161,69 +161,69 @@ void fast_memcpy(void *a, void *b, int s){ //FIXME
}
static void selfTest(uint8_t *src[3], int stride[3], int w, int h){
enum PixelFormat srcFormat, dstFormat;
int srcW, srcH, dstW, dstH;
int flags;
enum PixelFormat srcFormat, dstFormat;
int srcW, srcH, dstW, dstH;
int flags;
for(srcFormat = 0; srcFormat < PIX_FMT_NB; srcFormat++) {
for(dstFormat = 0; dstFormat < PIX_FMT_NB; dstFormat++) {
printf("%s -> %s\n",
sws_format_name(srcFormat),
sws_format_name(dstFormat));
for (srcFormat = 0; srcFormat < PIX_FMT_NB; srcFormat++) {
for (dstFormat = 0; dstFormat < PIX_FMT_NB; dstFormat++) {
printf("%s -> %s\n",
sws_format_name(srcFormat),
sws_format_name(dstFormat));
srcW= w;
srcH= h;
for(dstW=w - w/3; dstW<= 4*w/3; dstW+= w/3){
for(dstH=h - h/3; dstH<= 4*h/3; dstH+= h/3){
for(flags=1; flags<33; flags*=2) {
int res;
srcW= w;
srcH= h;
for (dstW=w - w/3; dstW<= 4*w/3; dstW+= w/3){
for (dstH=h - h/3; dstH<= 4*h/3; dstH+= h/3){
for (flags=1; flags<33; flags*=2) {
int res;
res = doTest(src, stride, w, h, srcFormat, dstFormat,
srcW, srcH, dstW, dstH, flags);
if (res < 0) {
dstW = 4 * w / 3;
dstH = 4 * h / 3;
flags = 33;
}
}
}
}
}
}
res = doTest(src, stride, w, h, srcFormat, dstFormat,
srcW, srcH, dstW, dstH, flags);
if (res < 0) {
dstW = 4 * w / 3;
dstH = 4 * h / 3;
flags = 33;
}
}
}
}
}
}
}
#define W 96
#define H 96
int main(int argc, char **argv){
uint8_t *rgb_data = malloc (W*H*4);
uint8_t *rgb_src[3]= {rgb_data, NULL, NULL};
int rgb_stride[3]={4*W, 0, 0};
uint8_t *data = malloc (3*W*H);
uint8_t *src[3]= {data, data+W*H, data+W*H*2};
int stride[3]={W, W, W};
int x, y;
struct SwsContext *sws;
uint8_t *rgb_data = malloc (W*H*4);
uint8_t *rgb_src[3]= {rgb_data, NULL, NULL};
int rgb_stride[3]={4*W, 0, 0};
uint8_t *data = malloc (3*W*H);
uint8_t *src[3]= {data, data+W*H, data+W*H*2};
int stride[3]={W, W, W};
int x, y;
struct SwsContext *sws;
sws= sws_getContext(W/12, H/12, PIX_FMT_RGB32, W, H, PIX_FMT_YUV420P, 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++){
rgb_data[ x + y*4*W]= random();
}
}
for (y=0; y<H; y++){
for (x=0; x<W*4; x++){
rgb_data[ x + y*4*W]= random();
}
}
#if defined(ARCH_X86)
sws_rgb2rgb_init(SWS_CPU_CAPS_MMX*0);
sws_rgb2rgb_init(SWS_CPU_CAPS_MMX*0);
#else
sws_rgb2rgb_init(0);
sws_rgb2rgb_init(0);
#endif
sws_scale(sws, rgb_src, rgb_stride, 0, H , src, stride);
sws_scale(sws, rgb_src, rgb_stride, 0, H , src, stride);
#if defined(ARCH_X86)
asm volatile ("emms\n\t");
asm volatile ("emms\n\t");
#endif
selfTest(src, stride, W, H);
selfTest(src, stride, W, H);
return 123;
return 123;
}

File diff suppressed because it is too large Load Diff

View File

@ -43,63 +43,63 @@ extern "C" {
#define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION)
/* values for the flags, the stuff on the command line is different */
#define SWS_FAST_BILINEAR 1
#define SWS_BILINEAR 2
#define SWS_BICUBIC 4
#define SWS_X 8
#define SWS_POINT 0x10
#define SWS_AREA 0x20
#define SWS_BICUBLIN 0x40
#define SWS_GAUSS 0x80
#define SWS_SINC 0x100
#define SWS_LANCZOS 0x200
#define SWS_SPLINE 0x400
#define SWS_FAST_BILINEAR 1
#define SWS_BILINEAR 2
#define SWS_BICUBIC 4
#define SWS_X 8
#define SWS_POINT 0x10
#define SWS_AREA 0x20
#define SWS_BICUBLIN 0x40
#define SWS_GAUSS 0x80
#define SWS_SINC 0x100
#define SWS_LANCZOS 0x200
#define SWS_SPLINE 0x400
#define SWS_SRC_V_CHR_DROP_MASK 0x30000
#define SWS_SRC_V_CHR_DROP_SHIFT 16
#define SWS_SRC_V_CHR_DROP_MASK 0x30000
#define SWS_SRC_V_CHR_DROP_SHIFT 16
#define SWS_PARAM_DEFAULT 123456
#define SWS_PARAM_DEFAULT 123456
#define SWS_PRINT_INFO 0x1000
#define SWS_PRINT_INFO 0x1000
//the following 3 flags are not completly implemented
//internal chrominace subsamling info
#define SWS_FULL_CHR_H_INT 0x2000
#define SWS_FULL_CHR_H_INT 0x2000
//input subsampling info
#define SWS_FULL_CHR_H_INP 0x4000
#define SWS_DIRECT_BGR 0x8000
#define SWS_ACCURATE_RND 0x40000
#define SWS_FULL_CHR_H_INP 0x4000
#define SWS_DIRECT_BGR 0x8000
#define SWS_ACCURATE_RND 0x40000
#define SWS_CPU_CAPS_MMX 0x80000000
#define SWS_CPU_CAPS_MMX2 0x20000000
#define SWS_CPU_CAPS_3DNOW 0x40000000
#define SWS_CPU_CAPS_ALTIVEC 0x10000000
#define SWS_CPU_CAPS_MMX 0x80000000
#define SWS_CPU_CAPS_MMX2 0x20000000
#define SWS_CPU_CAPS_3DNOW 0x40000000
#define SWS_CPU_CAPS_ALTIVEC 0x10000000
#define SWS_MAX_REDUCE_CUTOFF 0.002
#define SWS_CS_ITU709 1
#define SWS_CS_FCC 4
#define SWS_CS_ITU601 5
#define SWS_CS_ITU624 5
#define SWS_CS_SMPTE170M 5
#define SWS_CS_SMPTE240M 7
#define SWS_CS_DEFAULT 5
#define SWS_CS_ITU709 1
#define SWS_CS_FCC 4
#define SWS_CS_ITU601 5
#define SWS_CS_ITU624 5
#define SWS_CS_SMPTE170M 5
#define SWS_CS_SMPTE240M 7
#define SWS_CS_DEFAULT 5
// when used for filters they must have an odd number of elements
// coeffs cannot be shared between vectors
typedef struct {
double *coeff;
int length;
double *coeff;
int length;
} SwsVector;
// vectors can be shared
typedef struct {
SwsVector *lumH;
SwsVector *lumV;
SwsVector *chrH;
SwsVector *chrV;
SwsVector *lumH;
SwsVector *lumV;
SwsVector *chrH;
SwsVector *chrV;
} SwsFilter;
struct SwsContext;
@ -107,11 +107,11 @@ struct SwsContext;
void sws_freeContext(struct SwsContext *swsContext);
struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags,
SwsFilter *srcFilter, SwsFilter *dstFilter, double *param);
SwsFilter *srcFilter, SwsFilter *dstFilter, double *param);
int sws_scale(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[]);
int srcSliceH, uint8_t* dst[], int dstStride[]);
int sws_scale_ordered(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[]) attribute_deprecated;
int srcSliceH, uint8_t* dst[], int dstStride[]) attribute_deprecated;
int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation);
@ -131,15 +131,15 @@ void sws_printVec(SwsVector *a);
void sws_freeVec(SwsVector *a);
SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
float lumaSarpen, float chromaSharpen,
float chromaHShift, float chromaVShift,
int verbose);
float lumaSarpen, float chromaSharpen,
float chromaHShift, float chromaVShift,
int verbose);
void sws_freeFilter(SwsFilter *filter);
struct SwsContext *sws_getCachedContext(struct SwsContext *context,
int srcW, int srcH, int srcFormat,
int dstW, int dstH, int dstFormat, int flags,
SwsFilter *srcFilter, SwsFilter *dstFilter, double *param);
int srcW, int srcH, int srcFormat,
int dstW, int dstH, int dstFormat, int flags,
SwsFilter *srcFilter, SwsFilter *dstFilter, double *param);
#ifdef __cplusplus
}

View File

@ -40,114 +40,114 @@ typedef int (*SwsFunc)(struct SwsContext *context, uint8_t* src[], int srcStride
/* this struct should be aligned on at least 32-byte boundary */
typedef struct SwsContext{
/**
* info on struct for av_log
*/
AVClass *av_class;
/**
* info on struct for av_log
*/
AVClass *av_class;
/**
*
* Note the src,dst,srcStride,dstStride will be copied, in the sws_scale() warper so they can freely be modified here
*/
SwsFunc swScale;
int srcW, srcH, dstH;
int chrSrcW, chrSrcH, chrDstW, chrDstH;
int lumXInc, chrXInc;
int lumYInc, chrYInc;
int dstFormat, srcFormat; ///< format 4:2:0 type is always YV12
int origDstFormat, origSrcFormat; ///< format
int chrSrcHSubSample, chrSrcVSubSample;
int chrIntHSubSample, chrIntVSubSample;
int chrDstHSubSample, chrDstVSubSample;
int vChrDrop;
int sliceDir;
double param[2];
/**
*
* Note the src,dst,srcStride,dstStride will be copied, in the sws_scale() warper so they can freely be modified here
*/
SwsFunc swScale;
int srcW, srcH, dstH;
int chrSrcW, chrSrcH, chrDstW, chrDstH;
int lumXInc, chrXInc;
int lumYInc, chrYInc;
int dstFormat, srcFormat; ///< format 4:2:0 type is always YV12
int origDstFormat, origSrcFormat; ///< format
int chrSrcHSubSample, chrSrcVSubSample;
int chrIntHSubSample, chrIntVSubSample;
int chrDstHSubSample, chrDstVSubSample;
int vChrDrop;
int sliceDir;
double param[2];
int16_t **lumPixBuf;
int16_t **chrPixBuf;
int16_t *hLumFilter;
int16_t *hLumFilterPos;
int16_t *hChrFilter;
int16_t *hChrFilterPos;
int16_t *vLumFilter;
int16_t *vLumFilterPos;
int16_t *vChrFilter;
int16_t *vChrFilterPos;
int16_t **lumPixBuf;
int16_t **chrPixBuf;
int16_t *hLumFilter;
int16_t *hLumFilterPos;
int16_t *hChrFilter;
int16_t *hChrFilterPos;
int16_t *vLumFilter;
int16_t *vLumFilterPos;
int16_t *vChrFilter;
int16_t *vChrFilterPos;
uint8_t formatConvBuffer[4000]; //FIXME dynamic alloc, but we have to change a lot of code for this to be useful
uint8_t formatConvBuffer[4000]; //FIXME dynamic alloc, but we have to change a lot of code for this to be useful
int hLumFilterSize;
int hChrFilterSize;
int vLumFilterSize;
int vChrFilterSize;
int vLumBufSize;
int vChrBufSize;
int hLumFilterSize;
int hChrFilterSize;
int vLumFilterSize;
int vChrFilterSize;
int vLumBufSize;
int vChrBufSize;
uint8_t *funnyYCode;
uint8_t *funnyUVCode;
int32_t *lumMmx2FilterPos;
int32_t *chrMmx2FilterPos;
int16_t *lumMmx2Filter;
int16_t *chrMmx2Filter;
uint8_t *funnyYCode;
uint8_t *funnyUVCode;
int32_t *lumMmx2FilterPos;
int32_t *chrMmx2FilterPos;
int16_t *lumMmx2Filter;
int16_t *chrMmx2Filter;
int canMMX2BeUsed;
int canMMX2BeUsed;
int lastInLumBuf;
int lastInChrBuf;
int lumBufIndex;
int chrBufIndex;
int dstY;
int flags;
void * yuvTable; // pointer to the yuv->rgb table start so it can be freed()
uint8_t * table_rV[256];
uint8_t * table_gU[256];
int table_gV[256];
uint8_t * table_bU[256];
int lastInLumBuf;
int lastInChrBuf;
int lumBufIndex;
int chrBufIndex;
int dstY;
int flags;
void * yuvTable; // pointer to the yuv->rgb table start so it can be freed()
uint8_t * table_rV[256];
uint8_t * table_gU[256];
int table_gV[256];
uint8_t * table_bU[256];
//Colorspace stuff
int contrast, brightness, saturation; // for sws_getColorspaceDetails
int srcColorspaceTable[4];
int dstColorspaceTable[4];
int srcRange, dstRange;
//Colorspace stuff
int contrast, brightness, saturation; // for sws_getColorspaceDetails
int srcColorspaceTable[4];
int dstColorspaceTable[4];
int srcRange, dstRange;
#define RED_DITHER "0*8"
#define GREEN_DITHER "1*8"
#define BLUE_DITHER "2*8"
#define Y_COEFF "3*8"
#define VR_COEFF "4*8"
#define UB_COEFF "5*8"
#define VG_COEFF "6*8"
#define UG_COEFF "7*8"
#define Y_OFFSET "8*8"
#define U_OFFSET "9*8"
#define V_OFFSET "10*8"
#define RED_DITHER "0*8"
#define GREEN_DITHER "1*8"
#define BLUE_DITHER "2*8"
#define Y_COEFF "3*8"
#define VR_COEFF "4*8"
#define UB_COEFF "5*8"
#define VG_COEFF "6*8"
#define UG_COEFF "7*8"
#define Y_OFFSET "8*8"
#define U_OFFSET "9*8"
#define V_OFFSET "10*8"
#define LUM_MMX_FILTER_OFFSET "11*8"
#define CHR_MMX_FILTER_OFFSET "11*8+4*4*256"
#define DSTW_OFFSET "11*8+4*4*256*2" //do not change, its hardcoded in the asm
#define ESP_OFFSET "11*8+4*4*256*2+8"
#define VROUNDER_OFFSET "11*8+4*4*256*2+16"
#define U_TEMP "11*8+4*4*256*2+24"
#define V_TEMP "11*8+4*4*256*2+32"
#define DSTW_OFFSET "11*8+4*4*256*2" //do not change, its hardcoded in the asm
#define ESP_OFFSET "11*8+4*4*256*2+8"
#define VROUNDER_OFFSET "11*8+4*4*256*2+16"
#define U_TEMP "11*8+4*4*256*2+24"
#define V_TEMP "11*8+4*4*256*2+32"
uint64_t redDither __attribute__((aligned(8)));
uint64_t greenDither __attribute__((aligned(8)));
uint64_t blueDither __attribute__((aligned(8)));
uint64_t redDither __attribute__((aligned(8)));
uint64_t greenDither __attribute__((aligned(8)));
uint64_t blueDither __attribute__((aligned(8)));
uint64_t yCoeff __attribute__((aligned(8)));
uint64_t vrCoeff __attribute__((aligned(8)));
uint64_t ubCoeff __attribute__((aligned(8)));
uint64_t vgCoeff __attribute__((aligned(8)));
uint64_t ugCoeff __attribute__((aligned(8)));
uint64_t yOffset __attribute__((aligned(8)));
uint64_t uOffset __attribute__((aligned(8)));
uint64_t vOffset __attribute__((aligned(8)));
int32_t lumMmxFilter[4*MAX_FILTER_SIZE];
int32_t chrMmxFilter[4*MAX_FILTER_SIZE];
int dstW;
uint64_t esp __attribute__((aligned(8)));
uint64_t vRounder __attribute__((aligned(8)));
uint64_t u_temp __attribute__((aligned(8)));
uint64_t v_temp __attribute__((aligned(8)));
uint64_t yCoeff __attribute__((aligned(8)));
uint64_t vrCoeff __attribute__((aligned(8)));
uint64_t ubCoeff __attribute__((aligned(8)));
uint64_t vgCoeff __attribute__((aligned(8)));
uint64_t ugCoeff __attribute__((aligned(8)));
uint64_t yOffset __attribute__((aligned(8)));
uint64_t uOffset __attribute__((aligned(8)));
uint64_t vOffset __attribute__((aligned(8)));
int32_t lumMmxFilter[4*MAX_FILTER_SIZE];
int32_t chrMmxFilter[4*MAX_FILTER_SIZE];
int dstW;
uint64_t esp __attribute__((aligned(8)));
uint64_t vRounder __attribute__((aligned(8)));
uint64_t u_temp __attribute__((aligned(8)));
uint64_t v_temp __attribute__((aligned(8)));
#ifdef HAVE_ALTIVEC
@ -158,7 +158,7 @@ typedef struct SwsContext{
vector signed short CGV;
vector signed short OY;
vector unsigned short CSHIFT;
vector signed short *vYCoeffsBank, *vCCoeffsBank;
vector signed short *vYCoeffsBank, *vCCoeffsBank;
#endif
@ -171,21 +171,21 @@ 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 || (x)==PIX_FMT_GRAY16BE || (x)==PIX_FMT_GRAY16LE)
#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 || (x)==PIX_FMT_GRAY16BE || (x)==PIX_FMT_GRAY16LE)
#define isGray16(x) ((x)==PIX_FMT_GRAY16BE || (x)==PIX_FMT_GRAY16LE)
#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_RGB4_BYTE \
|| (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_BGR4_BYTE \
|| (x)==PIX_FMT_MONOBLACK)
#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_RGB4_BYTE \
|| (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_BGR4_BYTE \
|| (x)==PIX_FMT_MONOBLACK)
static inline int fmt_depth(int fmt)
{