Commit 2da0d70d authored by Diego Biurrun's avatar Diego Biurrun

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

Originally committed as revision 23179 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
parent dcc3a30b
......@@ -73,15 +73,15 @@
#define YSCALEYUV2YV12X(x, offset, dest, width) \
asm volatile(\
"xor %%"REG_a", %%"REG_a" \n\t"\
"movq "VROUNDER_OFFSET"(%0), %%mm3\n\t"\
"movq "VROUNDER_OFFSET"(%0), %%mm3 \n\t"\
"movq %%mm3, %%mm4 \n\t"\
"lea " offset "(%0), %%"REG_d" \n\t"\
"mov (%%"REG_d"), %%"REG_S" \n\t"\
ASMALIGN(4) /* FIXME Unroll? */\
"1: \n\t"\
"movq 8(%%"REG_d"), %%mm0 \n\t" /* filterCoeff */\
"movq " #x "(%%"REG_S", %%"REG_a", 2), %%mm2\n\t" /* srcData */\
"movq 8+" #x "(%%"REG_S", %%"REG_a", 2), %%mm5\n\t" /* srcData */\
"movq " #x "(%%"REG_S", %%"REG_a", 2), %%mm2 \n\t" /* srcData */\
"movq 8+" #x "(%%"REG_S", %%"REG_a", 2), %%mm5 \n\t" /* srcData */\
"add $16, %%"REG_d" \n\t"\
"mov (%%"REG_d"), %%"REG_S" \n\t"\
"test %%"REG_S", %%"REG_S" \n\t"\
......@@ -96,7 +96,7 @@
MOVNTQ(%%mm3, (%1, %%REGa))\
"add $8, %%"REG_a" \n\t"\
"cmp %2, %%"REG_a" \n\t"\
"movq "VROUNDER_OFFSET"(%0), %%mm3\n\t"\
"movq "VROUNDER_OFFSET"(%0), %%mm3 \n\t"\
"movq %%mm3, %%mm4 \n\t"\
"lea " offset "(%0), %%"REG_d" \n\t"\
"mov (%%"REG_d"), %%"REG_S" \n\t"\
......@@ -117,10 +117,10 @@
"mov (%%"REG_d"), %%"REG_S" \n\t"\
ASMALIGN(4) \
"1: \n\t"\
"movq " #x "(%%"REG_S", %%"REG_a", 2), %%mm0\n\t" /* srcData */\
"movq 8+" #x "(%%"REG_S", %%"REG_a", 2), %%mm2\n\t" /* srcData */\
"movq " #x "(%%"REG_S", %%"REG_a", 2), %%mm0 \n\t" /* srcData */\
"movq 8+" #x "(%%"REG_S", %%"REG_a", 2), %%mm2 \n\t" /* srcData */\
"mov 4(%%"REG_d"), %%"REG_S" \n\t"\
"movq " #x "(%%"REG_S", %%"REG_a", 2), %%mm1\n\t" /* srcData */\
"movq " #x "(%%"REG_S", %%"REG_a", 2), %%mm1 \n\t" /* srcData */\
"movq %%mm0, %%mm3 \n\t"\
"punpcklwd %%mm1, %%mm0 \n\t"\
"punpckhwd %%mm1, %%mm3 \n\t"\
......@@ -129,7 +129,7 @@
"pmaddwd %%mm1, %%mm3 \n\t"\
"paddd %%mm0, %%mm4 \n\t"\
"paddd %%mm3, %%mm5 \n\t"\
"movq 8+" #x "(%%"REG_S", %%"REG_a", 2), %%mm3\n\t" /* srcData */\
"movq 8+" #x "(%%"REG_S", %%"REG_a", 2), %%mm3 \n\t" /* srcData */\
"mov 16(%%"REG_d"), %%"REG_S" \n\t"\
"add $16, %%"REG_d" \n\t"\
"test %%"REG_S", %%"REG_S" \n\t"\
......@@ -145,7 +145,7 @@
"psrad $16, %%mm5 \n\t"\
"psrad $16, %%mm6 \n\t"\
"psrad $16, %%mm7 \n\t"\
"movq "VROUNDER_OFFSET"(%0), %%mm0\n\t"\
"movq "VROUNDER_OFFSET"(%0), %%mm0 \n\t"\
"packssdw %%mm5, %%mm4 \n\t"\
"packssdw %%mm7, %%mm6 \n\t"\
"paddw %%mm0, %%mm4 \n\t"\
......@@ -173,7 +173,7 @@
ASMALIGN(4) /* FIXME Unroll? */\
"1: \n\t"\
"movq (%0, %%"REG_a", 2), %%mm0 \n\t"\
"movq 8(%0, %%"REG_a", 2), %%mm1\n\t"\
"movq 8(%0, %%"REG_a", 2), %%mm1 \n\t"\
"psraw $7, %%mm0 \n\t"\
"psraw $7, %%mm1 \n\t"\
"packuswb %%mm1, %%mm0 \n\t"\
......@@ -194,9 +194,9 @@
ASMALIGN(4)\
"nop \n\t"\
"1: \n\t"\
"lea "CHR_MMX_FILTER_OFFSET"(%0), %%"REG_d"\n\t"\
"lea "CHR_MMX_FILTER_OFFSET"(%0), %%"REG_d" \n\t"\
"mov (%%"REG_d"), %%"REG_S" \n\t"\
"movq "VROUNDER_OFFSET"(%0), %%mm3\n\t"\
"movq "VROUNDER_OFFSET"(%0), %%mm3 \n\t"\
"movq %%mm3, %%mm4 \n\t"\
ASMALIGN(4)\
"2: \n\t"\
......@@ -212,9 +212,9 @@
"test %%"REG_S", %%"REG_S" \n\t"\
" jnz 2b \n\t"\
\
"lea "LUM_MMX_FILTER_OFFSET"(%0), %%"REG_d"\n\t"\
"lea "LUM_MMX_FILTER_OFFSET"(%0), %%"REG_d" \n\t"\
"mov (%%"REG_d"), %%"REG_S" \n\t"\
"movq "VROUNDER_OFFSET"(%0), %%mm1\n\t"\
"movq "VROUNDER_OFFSET"(%0), %%mm1 \n\t"\
"movq %%mm1, %%mm7 \n\t"\
ASMALIGN(4)\
"2: \n\t"\
......@@ -230,11 +230,11 @@
"test %%"REG_S", %%"REG_S" \n\t"\
" jnz 2b \n\t"\
#define YSCALEYUV2PACKEDX_END\
#define YSCALEYUV2PACKEDX_END \
:: "r" (&c->redDither), \
"m" (dummy), "m" (dummy), "m" (dummy),\
"r" (dest), "m" (dstW)\
: "%"REG_a, "%"REG_d, "%"REG_S\
"r" (dest), "m" (dstW) \
: "%"REG_a, "%"REG_d, "%"REG_S \
);
#define YSCALEYUV2PACKEDX_ACCURATE \
......@@ -243,7 +243,7 @@
ASMALIGN(4)\
"nop \n\t"\
"1: \n\t"\
"lea "CHR_MMX_FILTER_OFFSET"(%0), %%"REG_d"\n\t"\
"lea "CHR_MMX_FILTER_OFFSET"(%0), %%"REG_d" \n\t"\
"mov (%%"REG_d"), %%"REG_S" \n\t"\
"pxor %%mm4, %%mm4 \n\t"\
"pxor %%mm5, %%mm5 \n\t"\
......@@ -279,7 +279,7 @@
"psrad $16, %%mm5 \n\t"\
"psrad $16, %%mm6 \n\t"\
"psrad $16, %%mm7 \n\t"\
"movq "VROUNDER_OFFSET"(%0), %%mm0\n\t"\
"movq "VROUNDER_OFFSET"(%0), %%mm0 \n\t"\
"packssdw %%mm5, %%mm4 \n\t"\
"packssdw %%mm7, %%mm6 \n\t"\
"paddw %%mm0, %%mm4 \n\t"\
......@@ -287,7 +287,7 @@
"movq %%mm4, "U_TEMP"(%0) \n\t"\
"movq %%mm6, "V_TEMP"(%0) \n\t"\
\
"lea "LUM_MMX_FILTER_OFFSET"(%0), %%"REG_d"\n\t"\
"lea "LUM_MMX_FILTER_OFFSET"(%0), %%"REG_d" \n\t"\
"mov (%%"REG_d"), %%"REG_S" \n\t"\
"pxor %%mm1, %%mm1 \n\t"\
"pxor %%mm5, %%mm5 \n\t"\
......@@ -323,7 +323,7 @@
"psrad $16, %%mm5 \n\t"\
"psrad $16, %%mm7 \n\t"\
"psrad $16, %%mm6 \n\t"\
"movq "VROUNDER_OFFSET"(%0), %%mm0\n\t"\
"movq "VROUNDER_OFFSET"(%0), %%mm0 \n\t"\
"packssdw %%mm5, %%mm1 \n\t"\
"packssdw %%mm6, %%mm7 \n\t"\
"paddw %%mm0, %%mm1 \n\t"\
......@@ -338,14 +338,14 @@
"movq %%mm4, %%mm5 \n\t" /* (V-128)8*/\
"pmulhw "UG_COEFF"(%0), %%mm3 \n\t"\
"pmulhw "VG_COEFF"(%0), %%mm4 \n\t"\
/* mm2=(U-128)8, mm3=ug, mm4=vg mm5=(V-128)8 */\
/* mm2=(U-128)8, mm3=ug, mm4=vg mm5=(V-128)8 */\
"pmulhw "UB_COEFF"(%0), %%mm2 \n\t"\
"pmulhw "VR_COEFF"(%0), %%mm5 \n\t"\
"psubw "Y_OFFSET"(%0), %%mm1 \n\t" /* 8(Y-16)*/\
"psubw "Y_OFFSET"(%0), %%mm7 \n\t" /* 8(Y-16)*/\
"pmulhw "Y_COEFF"(%0), %%mm1 \n\t"\
"pmulhw "Y_COEFF"(%0), %%mm7 \n\t"\
/* mm1= Y1, mm2=ub, mm3=ug, mm4=vg mm5=vr, mm7=Y2 */\
/* mm1= Y1, mm2=ub, mm3=ug, mm4=vg mm5=vr, mm7=Y2 */\
"paddw %%mm3, %%mm4 \n\t"\
"movq %%mm2, %%mm0 \n\t"\
"movq %%mm5, %%mm6 \n\t"\
......@@ -379,8 +379,8 @@
"xor %%"REG_a", %%"REG_a" \n\t"\
ASMALIGN(4)\
"1: \n\t"\
"movq (%0, %%"REG_a", 2), %%mm0 \n\t" /*buf0[eax]*/\
"movq (%1, %%"REG_a", 2), %%mm1 \n\t" /*buf1[eax]*/\
"movq (%0, %%"REG_a",2), %%mm0 \n\t" /*buf0[eax]*/\
"movq (%1, %%"REG_a",2), %%mm1 \n\t" /*buf1[eax]*/\
"movq (%2, %%"REG_a",2), %%mm2 \n\t" /* uvbuf0[eax]*/\
"movq (%3, %%"REG_a",2), %%mm3 \n\t" /* uvbuf1[eax]*/\
"psubw %%mm1, %%mm0 \n\t" /* buf0[eax] - buf1[eax]*/\
......@@ -401,16 +401,16 @@
\
"pmulhw %%mm5, %%mm4 \n\t" /* (uvbuf0[eax+2048] - uvbuf1[eax+2048])uvalpha1>>16*/\
"movq %%mm3, %%mm2 \n\t" /* (U-128)8*/\
"pmulhw "MANGLE(ubCoeff)", %%mm3\n\t"\
"pmulhw "MANGLE(ubCoeff)", %%mm3 \n\t"\
"psraw $4, %%mm0 \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048] >>4*/\
"pmulhw "MANGLE(ugCoeff)", %%mm2\n\t"\
"pmulhw "MANGLE(ugCoeff)", %%mm2 \n\t"\
"paddw %%mm4, %%mm0 \n\t" /* uvbuf0[eax+2048]uvalpha1 - uvbuf1[eax+2048](1-uvalpha1)*/\
"psubw "MANGLE(w400)", %%mm0 \n\t" /* (V-128)8*/\
\
\
"movq %%mm0, %%mm4 \n\t" /* (V-128)8*/\
"pmulhw "MANGLE(vrCoeff)", %%mm0\n\t"\
"pmulhw "MANGLE(vgCoeff)", %%mm4\n\t"\
"pmulhw "MANGLE(vrCoeff)", %%mm0 \n\t"\
"pmulhw "MANGLE(vgCoeff)", %%mm4 \n\t"\
"paddw %%mm1, %%mm3 \n\t" /* B*/\
"paddw %%mm1, %%mm0 \n\t" /* R*/\
"packuswb %%mm3, %%mm3 \n\t"\
......@@ -423,12 +423,12 @@
#endif
#define REAL_YSCALEYUV2PACKED(index, c) \
"movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0\n\t"\
"movq "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm1\n\t"\
"movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"\
"movq "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm1 \n\t"\
"psraw $3, %%mm0 \n\t"\
"psraw $3, %%mm1 \n\t"\
"movq %%mm0, "CHR_MMX_FILTER_OFFSET"+8("#c")\n\t"\
"movq %%mm1, "LUM_MMX_FILTER_OFFSET"+8("#c")\n\t"\
"movq %%mm0, "CHR_MMX_FILTER_OFFSET"+8("#c") \n\t"\
"movq %%mm1, "LUM_MMX_FILTER_OFFSET"+8("#c") \n\t"\
"xor "#index", "#index" \n\t"\
ASMALIGN(4)\
"1: \n\t"\
......@@ -438,7 +438,7 @@
"movq 4096(%3, "#index"), %%mm4 \n\t" /* uvbuf1[eax+2048]*/\
"psubw %%mm3, %%mm2 \n\t" /* uvbuf0[eax] - uvbuf1[eax]*/\
"psubw %%mm4, %%mm5 \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048]*/\
"movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0\n\t"\
"movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"\
"pmulhw %%mm0, %%mm2 \n\t" /* (uvbuf0[eax] - uvbuf1[eax])uvalpha1>>16*/\
"pmulhw %%mm0, %%mm5 \n\t" /* (uvbuf0[eax+2048] - uvbuf1[eax+2048])uvalpha1>>16*/\
"psraw $7, %%mm3 \n\t" /* uvbuf0[eax] - uvbuf1[eax] >>4*/\
......@@ -451,8 +451,8 @@
"movq 8(%1, "#index", 2), %%mm7 \n\t" /*buf1[eax]*/\
"psubw %%mm1, %%mm0 \n\t" /* buf0[eax] - buf1[eax]*/\
"psubw %%mm7, %%mm6 \n\t" /* buf0[eax] - buf1[eax]*/\
"pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm0\n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\
"pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm6\n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\
"pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\
"pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm6 \n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\
"psraw $7, %%mm1 \n\t" /* buf0[eax] - buf1[eax] >>4*/\
"psraw $7, %%mm7 \n\t" /* buf0[eax] - buf1[eax] >>4*/\
"paddw %%mm0, %%mm1 \n\t" /* buf0[eax]yalpha1 + buf1[eax](1-yalpha1) >>16*/\
......@@ -466,11 +466,11 @@
"1: \n\t"\
"movq (%2, "#index"), %%mm2 \n\t" /* uvbuf0[eax]*/\
"movq (%3, "#index"), %%mm3 \n\t" /* uvbuf1[eax]*/\
"movq 4096(%2, "#index"), %%mm5\n\t" /* uvbuf0[eax+2048]*/\
"movq 4096(%3, "#index"), %%mm4\n\t" /* uvbuf1[eax+2048]*/\
"movq 4096(%2, "#index"), %%mm5 \n\t" /* uvbuf0[eax+2048]*/\
"movq 4096(%3, "#index"), %%mm4 \n\t" /* uvbuf1[eax+2048]*/\
"psubw %%mm3, %%mm2 \n\t" /* uvbuf0[eax] - uvbuf1[eax]*/\
"psubw %%mm4, %%mm5 \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048]*/\
"movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0\n\t"\
"movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"\
"pmulhw %%mm0, %%mm2 \n\t" /* (uvbuf0[eax] - uvbuf1[eax])uvalpha1>>16*/\
"pmulhw %%mm0, %%mm5 \n\t" /* (uvbuf0[eax+2048] - uvbuf1[eax+2048])uvalpha1>>16*/\
"psraw $4, %%mm3 \n\t" /* uvbuf0[eax] - uvbuf1[eax] >>4*/\
......@@ -481,23 +481,23 @@
"psubw "V_OFFSET"("#c"), %%mm4 \n\t" /* (V-128)8*/\
"movq %%mm3, %%mm2 \n\t" /* (U-128)8*/\
"movq %%mm4, %%mm5 \n\t" /* (V-128)8*/\
"pmulhw "UG_COEFF"("#c"), %%mm3\n\t"\
"pmulhw "VG_COEFF"("#c"), %%mm4\n\t"\
"pmulhw "UG_COEFF"("#c"), %%mm3 \n\t"\
"pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\
/* mm2=(U-128)8, mm3=ug, mm4=vg mm5=(V-128)8 */\
"movq (%0, "#index", 2), %%mm0 \n\t" /*buf0[eax]*/\
"movq (%1, "#index", 2), %%mm1 \n\t" /*buf1[eax]*/\
"movq 8(%0, "#index", 2), %%mm6\n\t" /*buf0[eax]*/\
"movq 8(%1, "#index", 2), %%mm7\n\t" /*buf1[eax]*/\
"movq 8(%0, "#index", 2), %%mm6 \n\t" /*buf0[eax]*/\
"movq 8(%1, "#index", 2), %%mm7 \n\t" /*buf1[eax]*/\
"psubw %%mm1, %%mm0 \n\t" /* buf0[eax] - buf1[eax]*/\
"psubw %%mm7, %%mm6 \n\t" /* buf0[eax] - buf1[eax]*/\
"pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm0\n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\
"pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm6\n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\
"pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\
"pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm6 \n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\
"psraw $4, %%mm1 \n\t" /* buf0[eax] - buf1[eax] >>4*/\
"psraw $4, %%mm7 \n\t" /* buf0[eax] - buf1[eax] >>4*/\
"paddw %%mm0, %%mm1 \n\t" /* buf0[eax]yalpha1 + buf1[eax](1-yalpha1) >>16*/\
"paddw %%mm6, %%mm7 \n\t" /* buf0[eax]yalpha1 + buf1[eax](1-yalpha1) >>16*/\
"pmulhw "UB_COEFF"("#c"), %%mm2\n\t"\
"pmulhw "VR_COEFF"("#c"), %%mm5\n\t"\
"pmulhw "UB_COEFF"("#c"), %%mm2 \n\t"\
"pmulhw "VR_COEFF"("#c"), %%mm5 \n\t"\
"psubw "Y_OFFSET"("#c"), %%mm1 \n\t" /* 8(Y-16)*/\
"psubw "Y_OFFSET"("#c"), %%mm7 \n\t" /* 8(Y-16)*/\
"pmulhw "Y_COEFF"("#c"), %%mm1 \n\t"\
......@@ -553,15 +553,15 @@
"psubw "V_OFFSET"("#c"), %%mm4 \n\t" /* (V-128)8*/\
"movq %%mm3, %%mm2 \n\t" /* (U-128)8*/\
"movq %%mm4, %%mm5 \n\t" /* (V-128)8*/\
"pmulhw "UG_COEFF"("#c"), %%mm3\n\t"\
"pmulhw "VG_COEFF"("#c"), %%mm4\n\t"\
"pmulhw "UG_COEFF"("#c"), %%mm3 \n\t"\
"pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\
/* mm2=(U-128)8, mm3=ug, mm4=vg mm5=(V-128)8 */\
"movq (%0, "#index", 2), %%mm1 \n\t" /*buf0[eax]*/\
"movq 8(%0, "#index", 2), %%mm7 \n\t" /*buf0[eax]*/\
"psraw $4, %%mm1 \n\t" /* buf0[eax] - buf1[eax] >>4*/\
"psraw $4, %%mm7 \n\t" /* buf0[eax] - buf1[eax] >>4*/\
"pmulhw "UB_COEFF"("#c"), %%mm2\n\t"\
"pmulhw "VR_COEFF"("#c"), %%mm5\n\t"\
"pmulhw "UB_COEFF"("#c"), %%mm2 \n\t"\
"pmulhw "VR_COEFF"("#c"), %%mm5 \n\t"\
"psubw "Y_OFFSET"("#c"), %%mm1 \n\t" /* 8(Y-16)*/\
"psubw "Y_OFFSET"("#c"), %%mm7 \n\t" /* 8(Y-16)*/\
"pmulhw "Y_COEFF"("#c"), %%mm1 \n\t"\
......@@ -625,15 +625,15 @@
"psubw "V_OFFSET"("#c"), %%mm4 \n\t" /* (V-128)8*/\
"movq %%mm3, %%mm2 \n\t" /* (U-128)8*/\
"movq %%mm4, %%mm5 \n\t" /* (V-128)8*/\
"pmulhw "UG_COEFF"("#c"), %%mm3\n\t"\
"pmulhw "VG_COEFF"("#c"), %%mm4\n\t"\
"pmulhw "UG_COEFF"("#c"), %%mm3 \n\t"\
"pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\
/* mm2=(U-128)8, mm3=ug, mm4=vg mm5=(V-128)8 */\
"movq (%0, "#index", 2), %%mm1 \n\t" /*buf0[eax]*/\
"movq 8(%0, "#index", 2), %%mm7 \n\t" /*buf0[eax]*/\
"psraw $4, %%mm1 \n\t" /* buf0[eax] - buf1[eax] >>4*/\
"psraw $4, %%mm7 \n\t" /* buf0[eax] - buf1[eax] >>4*/\
"pmulhw "UB_COEFF"("#c"), %%mm2\n\t"\
"pmulhw "VR_COEFF"("#c"), %%mm5\n\t"\
"pmulhw "UB_COEFF"("#c"), %%mm2 \n\t"\
"pmulhw "VR_COEFF"("#c"), %%mm5 \n\t"\
"psubw "Y_OFFSET"("#c"), %%mm1 \n\t" /* 8(Y-16)*/\
"psubw "Y_OFFSET"("#c"), %%mm7 \n\t" /* 8(Y-16)*/\
"pmulhw "Y_COEFF"("#c"), %%mm1 \n\t"\
......@@ -761,8 +761,8 @@
\
"movq %%mm0, %%mm4 \n\t" /* 0RGB0RGB 0 */\
"psrlq $8, %%mm0 \n\t" /* 00RGB0RG 0 */\
"pand "MANGLE(bm00000111)", %%mm4\n\t" /* 00000RGB 0 */\
"pand "MANGLE(bm11111000)", %%mm0\n\t" /* 00RGB000 0.5 */\
"pand "MANGLE(bm00000111)", %%mm4 \n\t" /* 00000RGB 0 */\
"pand "MANGLE(bm11111000)", %%mm0 \n\t" /* 00RGB000 0.5 */\
"por %%mm4, %%mm0 \n\t" /* 00RGBRGB 0 */\
"movq %%mm2, %%mm4 \n\t" /* 0RGB0RGB 1 */\
"psllq $48, %%mm2 \n\t" /* GB000000 1 */\
......@@ -772,11 +772,11 @@
"psrld $16, %%mm4 \n\t" /* 000R000R 1 */\
"psrlq $24, %%mm2 \n\t" /* 0000RGB0 1.5 */\
"por %%mm4, %%mm2 \n\t" /* 000RRGBR 1 */\
"pand "MANGLE(bm00001111)", %%mm2\n\t" /* 0000RGBR 1 */\
"pand "MANGLE(bm00001111)", %%mm2 \n\t" /* 0000RGBR 1 */\
"movq %%mm1, %%mm4 \n\t" /* 0RGB0RGB 2 */\
"psrlq $8, %%mm1 \n\t" /* 00RGB0RG 2 */\
"pand "MANGLE(bm00000111)", %%mm4\n\t" /* 00000RGB 2 */\
"pand "MANGLE(bm11111000)", %%mm1\n\t" /* 00RGB000 2.5 */\
"pand "MANGLE(bm00000111)", %%mm4 \n\t" /* 00000RGB 2 */\
"pand "MANGLE(bm11111000)", %%mm1 \n\t" /* 00RGB000 2.5 */\
"por %%mm4, %%mm1 \n\t" /* 00RGBRGB 2 */\
"movq %%mm1, %%mm4 \n\t" /* 00RGBRGB 2 */\
"psllq $32, %%mm1 \n\t" /* BRGB0000 2 */\
......@@ -785,8 +785,8 @@
"psrlq $32, %%mm4 \n\t" /* 000000RG 2.5 */\
"movq %%mm3, %%mm5 \n\t" /* 0RGB0RGB 3 */\
"psrlq $8, %%mm3 \n\t" /* 00RGB0RG 3 */\
"pand "MANGLE(bm00000111)", %%mm5\n\t" /* 00000RGB 3 */\
"pand "MANGLE(bm11111000)", %%mm3\n\t" /* 00RGB000 3.5 */\
"pand "MANGLE(bm00000111)", %%mm5 \n\t" /* 00000RGB 3 */\
"pand "MANGLE(bm11111000)", %%mm3 \n\t" /* 00RGB000 3.5 */\
"por %%mm5, %%mm3 \n\t" /* 00RGBRGB 3 */\
"psllq $16, %%mm3 \n\t" /* RGBRGB00 3 */\
"por %%mm4, %%mm3 \n\t" /* RGBRGBRG 2.5 */\
......@@ -932,15 +932,15 @@ static inline void RENAME(yuv2yuvX)(SwsContext *c, int16_t *lumFilter, int16_t *
uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW)
{
#ifdef HAVE_MMX
if(c->flags & SWS_ACCURATE_RND){
if(uDest){
if (c->flags & SWS_ACCURATE_RND){
if (uDest){
YSCALEYUV2YV12X_ACCURATE( 0, CHR_MMX_FILTER_OFFSET, uDest, chrDstW)
YSCALEYUV2YV12X_ACCURATE(4096, CHR_MMX_FILTER_OFFSET, vDest, chrDstW)
}
YSCALEYUV2YV12X_ACCURATE(0, LUM_MMX_FILTER_OFFSET, dest, dstW)
}else{
if(uDest){
if (uDest){
YSCALEYUV2YV12X( 0, CHR_MMX_FILTER_OFFSET, uDest, chrDstW)
YSCALEYUV2YV12X(4096, CHR_MMX_FILTER_OFFSET, vDest, chrDstW)
}
......@@ -973,7 +973,7 @@ static inline void RENAME(yuv2yuv1)(int16_t *lumSrc, int16_t *chrSrc,
uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW)
{
#ifdef HAVE_MMX
if(uDest != NULL)
if (uDest != NULL)
{
asm volatile(
YSCALEYUV2YV121
......@@ -998,28 +998,28 @@ static inline void RENAME(yuv2yuv1)(int16_t *lumSrc, int16_t *chrSrc,
);
#else
int i;
for(i=0; i<dstW; i++)
for (i=0; i<dstW; i++)
{
int val= lumSrc[i]>>7;
if(val&256){
if(val<0) val=0;
if (val&256){
if (val<0) val=0;
else val=255;
}
dest[i]= val;
}
if(uDest != NULL)
for(i=0; i<chrDstW; i++)
if (uDest != NULL)
for (i=0; i<chrDstW; i++)
{
int u=chrSrc[i]>>7;
int v=chrSrc[i + 2048]>>7;
if((u|v)&256){
if(u<0) u=0;
if ((u|v)&256){
if (u<0) u=0;
else if (u>255) u=255;
if(v<0) v=0;
if (v<0) v=0;
else if (v>255) v=255;
}
......@@ -1039,7 +1039,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_
{
#ifdef HAVE_MMX
long dummy=0;
if(c->flags & SWS_ACCURATE_RND){
if (c->flags & SWS_ACCURATE_RND){
switch(c->dstFormat){
case PIX_FMT_RGB32:
YSCALEYUV2PACKEDX_ACCURATE
......@@ -1112,7 +1112,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_
case PIX_FMT_BGR24:
YSCALEYUV2PACKEDX
YSCALEYUV2RGBX
"lea (%%"REG_a", %%"REG_a", 2), %%"REG_c"\n\t" //FIXME optimize
"lea (%%"REG_a", %%"REG_a", 2), %%"REG_c" \n\t" //FIXME optimize
"add %4, %%"REG_c" \n\t"
WRITEBGR24(%%REGc, %5, %%REGa)
......@@ -1127,9 +1127,9 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_
YSCALEYUV2RGBX
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
#ifdef DITHER1XBPP
"paddusb "MANGLE(b5Dither)", %%mm2\n\t"
"paddusb "MANGLE(g5Dither)", %%mm4\n\t"
"paddusb "MANGLE(r5Dither)", %%mm5\n\t"
"paddusb "MANGLE(b5Dither)", %%mm2 \n\t"
"paddusb "MANGLE(g5Dither)", %%mm4 \n\t"
"paddusb "MANGLE(r5Dither)", %%mm5 \n\t"
#endif
WRITEBGR15(%4, %5, %%REGa)
......@@ -1140,9 +1140,9 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_
YSCALEYUV2RGBX
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
#ifdef DITHER1XBPP
"paddusb "MANGLE(b5Dither)", %%mm2\n\t"
"paddusb "MANGLE(g6Dither)", %%mm4\n\t"
"paddusb "MANGLE(r5Dither)", %%mm5\n\t"
"paddusb "MANGLE(b5Dither)", %%mm2 \n\t"
"paddusb "MANGLE(g6Dither)", %%mm4 \n\t"
"paddusb "MANGLE(r5Dither)", %%mm5 \n\t"
#endif
WRITEBGR16(%4, %5, %%REGa)
......@@ -1165,7 +1165,7 @@ 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==PIX_FMT_ABGR || c->dstFormat==PIX_FMT_BGRA ||
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,
......@@ -1189,7 +1189,7 @@ static inline void RENAME(yuv2packed2)(SwsContext *c, uint16_t *buf0, uint16_t *
int i;
#if 0 //isn't used
if(flags&SWS_FULL_CHR_H_INT)
if (flags&SWS_FULL_CHR_H_INT)
{
switch(dstFormat)
{
......@@ -1213,7 +1213,6 @@ FULL_YSCALEYUV2RGB
"cmp %5, %%"REG_a" \n\t"
" jb 1b \n\t"
:: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" ((long)dstW),
"m" (yalpha1), "m" (uvalpha1)
: "%"REG_a
......@@ -1234,8 +1233,8 @@ FULL_YSCALEYUV2RGB
"movq %%mm3, %%mm2 \n\t" // BGR0BGR0
"psrlq $8, %%mm3 \n\t" // GR0BGR00
"pand "MANGLE(bm00000111)", %%mm2\n\t" // BGR00000
"pand "MANGLE(bm11111000)", %%mm3\n\t" // 000BGR00
"pand "MANGLE(bm00000111)", %%mm2 \n\t" // BGR00000
"pand "MANGLE(bm11111000)", %%mm3 \n\t" // 000BGR00
"por %%mm2, %%mm3 \n\t" // BGRBGR00
"movq %%mm1, %%mm2 \n\t"
"psllq $48, %%mm1 \n\t" // 000000BG
......@@ -1251,8 +1250,8 @@ FULL_YSCALEYUV2RGB
#ifdef HAVE_MMX2
//FIXME Alignment
"movntq %%mm3, (%%"REG_b", %%"REG_a", 2)\n\t"
"movntq %%mm1, 8(%%"REG_b", %%"REG_a", 2)\n\t"
"movntq %%mm3, (%%"REG_b", %%"REG_a", 2) \n\t"
"movntq %%mm1, 8(%%"REG_b", %%"REG_a", 2) \n\t"
#else
"movd %%mm3, (%%"REG_b", %%"REG_a", 2) \n\t"
"psrlq $32, %%mm3 \n\t"
......@@ -1273,9 +1272,9 @@ FULL_YSCALEYUV2RGB
FULL_YSCALEYUV2RGB
#ifdef DITHER1XBPP
"paddusb "MANGLE(g5Dither)", %%mm1\n\t"
"paddusb "MANGLE(r5Dither)", %%mm0\n\t"
"paddusb "MANGLE(b5Dither)", %%mm3\n\t"
"paddusb "MANGLE(g5Dither)", %%mm1 \n\t"
"paddusb "MANGLE(r5Dither)", %%mm0 \n\t"
"paddusb "MANGLE(b5Dither)", %%mm3 \n\t"
#endif
"punpcklbw %%mm7, %%mm1 \n\t" // 0G0G0G0G
"punpcklbw %%mm7, %%mm3 \n\t" // 0B0B0B0B
......@@ -1306,9 +1305,9 @@ FULL_YSCALEYUV2RGB
FULL_YSCALEYUV2RGB
#ifdef DITHER1XBPP
"paddusb "MANGLE(g6Dither)", %%mm1\n\t"
"paddusb "MANGLE(r5Dither)", %%mm0\n\t"
"paddusb "MANGLE(b5Dither)", %%mm3\n\t"
"paddusb "MANGLE(g6Dither)", %%mm1 \n\t"
"paddusb "MANGLE(r5Dither)", %%mm0 \n\t"
"paddusb "MANGLE(b5Dither)", %%mm3 \n\t"
#endif
"punpcklbw %%mm7, %%mm1 \n\t" // 0G0G0G0G
"punpcklbw %%mm7, %%mm3 \n\t" // 0B0B0B0B
......@@ -1339,13 +1338,13 @@ FULL_YSCALEYUV2RGB
#ifndef HAVE_MMX
case PIX_FMT_RGB32:
#endif
if(dstFormat==PIX_FMT_RGB32)
if (dstFormat==PIX_FMT_RGB32)
{
int i;
#ifdef WORDS_BIGENDIAN
dest++;
#endif
for(i=0;i<dstW;i++){
for (i=0;i<dstW;i++){
// vertical linear interpolation && yuv2rgb in a single step:
int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)];
int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19);
......@@ -1356,10 +1355,10 @@ FULL_YSCALEYUV2RGB
dest+= 4;
}
}
else if(dstFormat==PIX_FMT_BGR24)
else if (dstFormat==PIX_FMT_BGR24)
{
int i;
for(i=0;i<dstW;i++){
for (i=0;i<dstW;i++){
// vertical linear interpolation && yuv2rgb in a single step:
int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)];
int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19);
......@@ -1370,10 +1369,10 @@ FULL_YSCALEYUV2RGB
dest+= 3;
}
}
else if(dstFormat==PIX_FMT_BGR565)
else if (dstFormat==PIX_FMT_BGR565)
{
int i;
for(i=0;i<dstW;i++){
for (i=0;i<dstW;i++){
// vertical linear interpolation && yuv2rgb in a single step:
int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)];
int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19);
......@@ -1385,10 +1384,10 @@ FULL_YSCALEYUV2RGB
clip_table16r[(Y + yuvtab_3343[V]) >>13];
}
}
else if(dstFormat==PIX_FMT_BGR555)
else if (dstFormat==PIX_FMT_BGR555)
{
int i;
for(i=0;i<dstW;i++){
for (i=0;i<dstW;i++){
// vertical linear interpolation && yuv2rgb in a single step:
int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)];
int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19);
......@@ -1407,7 +1406,7 @@ FULL_YSCALEYUV2RGB
#ifdef HAVE_MMX
switch(c->dstFormat)
{
//Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :(
//Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :(
case PIX_FMT_RGB32:
asm volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
......@@ -1443,9 +1442,9 @@ FULL_YSCALEYUV2RGB
YSCALEYUV2RGB(%%REGBP, %5)
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
#ifdef DITHER1XBPP
"paddusb "MANGLE(b5Dither)", %%mm2\n\t"
"paddusb "MANGLE(g5Dither)", %%mm4\n\t"
"paddusb "MANGLE(r5Dither)", %%mm5\n\t"
"paddusb "MANGLE(b5Dither)", %%mm2 \n\t"
"paddusb "MANGLE(g5Dither)", %%mm4 \n\t"
"paddusb "MANGLE(r5Dither)", %%mm5 \n\t"
#endif
WRITEBGR15(%%REGb, 8280(%5), %%REGBP)
......@@ -1464,9 +1463,9 @@ FULL_YSCALEYUV2RGB
YSCALEYUV2RGB(%%REGBP, %5)
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
#ifdef DITHER1XBPP
"paddusb "MANGLE(b5Dither)", %%mm2\n\t"
"paddusb "MANGLE(g6Dither)", %%mm4\n\t"
"paddusb "MANGLE(r5Dither)", %%mm5\n\t"
"paddusb "MANGLE(b5Dither)", %%mm2 \n\t"
"paddusb "MANGLE(g6Dither)", %%mm4 \n\t"
"paddusb "MANGLE(r5Dither)", %%mm5 \n\t"
#endif
WRITEBGR16(%%REGb, 8280(%5), %%REGBP)
......@@ -1507,14 +1506,14 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
uint16_t *buf1= buf0; //FIXME needed for the rgb1/bgr1
const int yalpha= 4096; //FIXME ...
if(flags&SWS_FULL_CHR_H_INT)
if (flags&SWS_FULL_CHR_H_INT)
{
RENAME(yuv2packed2)(c, buf0, buf0, uvbuf0, uvbuf1, dest, dstW, 0, uvalpha, y);
return;
}
#ifdef HAVE_MMX
if( uvalpha < 2048 ) // note this is not correct (shifts chrominance by 0.5 pixels) but its a bit faster
if ( uvalpha < 2048 ) // note this is not correct (shifts chrominance by 0.5 pixels) but its a bit faster
{
switch(dstFormat)
{
......@@ -1554,9 +1553,9 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
YSCALEYUV2RGB1(%%REGBP, %5)
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
#ifdef DITHER1XBPP
"paddusb "MANGLE(b5Dither)", %%mm2\n\t"
"paddusb "MANGLE(g5Dither)", %%mm4\n\t"
"paddusb "MANGLE(r5Dither)", %%mm5\n\t"
"paddusb "MANGLE(b5Dither)", %%mm2 \n\t"
"paddusb "MANGLE(g5Dither)", %%mm4 \n\t"
"paddusb "MANGLE(r5Dither)", %%mm5 \n\t"
#endif
WRITEBGR15(%%REGb, 8280(%5), %%REGBP)
"pop %%"REG_BP" \n\t"
......@@ -1574,9 +1573,9 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
YSCALEYUV2RGB1(%%REGBP, %5)
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
#ifdef DITHER1XBPP
"paddusb "MANGLE(b5Dither)", %%mm2\n\t"
"paddusb "MANGLE(g6Dither)", %%mm4\n\t"
"paddusb "MANGLE(r5Dither)", %%mm5\n\t"
"paddusb "MANGLE(b5Dither)", %%mm2 \n\t"
"paddusb "MANGLE(g6Dither)", %%mm4 \n\t"
"paddusb "MANGLE(r5Dither)", %%mm5 \n\t"
#endif
WRITEBGR16(%%REGb, 8280(%5), %%REGBP)
......@@ -1643,9 +1642,9 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
YSCALEYUV2RGB1b(%%REGBP, %5)
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
#ifdef DITHER1XBPP
"paddusb "MANGLE(b5Dither)", %%mm2\n\t"
"paddusb "MANGLE(g5Dither)", %%mm4\n\t"
"paddusb "MANGLE(r5Dither)", %%mm5\n\t"
"paddusb "MANGLE(b5Dither)", %%mm2 \n\t"
"paddusb "MANGLE(g5Dither)", %%mm4 \n\t"
"paddusb "MANGLE(r5Dither)", %%mm5 \n\t"
#endif
WRITEBGR15(%%REGb, 8280(%5), %%REGBP)
"pop %%"REG_BP" \n\t"
......@@ -1663,9 +1662,9 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
YSCALEYUV2RGB1b(%%REGBP, %5)
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
#ifdef DITHER1XBPP
"paddusb "MANGLE(b5Dither)", %%mm2\n\t"
"paddusb "MANGLE(g6Dither)", %%mm4\n\t"
"paddusb "MANGLE(r5Dither)", %%mm5\n\t"
"paddusb "MANGLE(b5Dither)", %%mm2 \n\t"
"paddusb "MANGLE(g6Dither)", %%mm4 \n\t"
"paddusb "MANGLE(r5Dither)", %%mm5 \n\t"
#endif
WRITEBGR16(%%REGb, 8280(%5), %%REGBP)
......@@ -1693,7 +1692,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
}
}
#endif
if( uvalpha < 2048 )
if ( uvalpha < 2048 )
{
YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C)
}else{
......@@ -1707,7 +1706,7 @@ static inline void RENAME(yuy2ToY)(uint8_t *dst, uint8_t *src, long width)
{
#ifdef HAVE_MMX
asm volatile(
"movq "MANGLE(bm01010101)", %%mm2\n\t"
"movq "MANGLE(bm01010101)", %%mm2 \n\t"
"mov %0, %%"REG_a" \n\t"
"1: \n\t"
"movq (%1, %%"REG_a",2), %%mm0 \n\t"
......@@ -1723,7 +1722,7 @@ static inline void RENAME(yuy2ToY)(uint8_t *dst, uint8_t *src, long width)
);
#else
int i;
for(i=0; i<width; i++)
for (i=0; i<width; i++)
dst[i]= src[2*i];
#endif
}
......@@ -1732,7 +1731,7 @@ static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1,
{
#ifdef HAVE_MMX
asm volatile(
"movq "MANGLE(bm01010101)", %%mm4\n\t"
"movq "MANGLE(bm01010101)", %%mm4 \n\t"
"mov %0, %%"REG_a" \n\t"
"1: \n\t"
"movq (%1, %%"REG_a",4), %%mm0 \n\t"
......@@ -1754,7 +1753,7 @@ static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1,
);
#else
int i;
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
dstU[i]= src1[4*i + 1];
dstV[i]= src1[4*i + 3];
......@@ -1783,7 +1782,7 @@ static inline void RENAME(uyvyToY)(uint8_t *dst, uint8_t *src, long width)
);
#else
int i;
for(i=0; i<width; i++)
for (i=0; i<width; i++)
dst[i]= src[2*i+1];
#endif
}
......@@ -1792,7 +1791,7 @@ static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1,
{
#ifdef HAVE_MMX
asm volatile(
"movq "MANGLE(bm01010101)", %%mm4\n\t"
"movq "MANGLE(bm01010101)", %%mm4 \n\t"
"mov %0, %%"REG_a" \n\t"
"1: \n\t"
"movq (%1, %%"REG_a",4), %%mm0 \n\t"
......@@ -1814,7 +1813,7 @@ static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1,
);
#else
int i;
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
dstU[i]= src1[4*i + 0];
dstV[i]= src1[4*i + 2];
......@@ -1826,7 +1825,7 @@ static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1,
static inline void RENAME(bgr32ToY)(uint8_t *dst, uint8_t *src, int width)
{
int i;
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
int b= ((uint32_t*)src)[i]&0xFF;
int g= (((uint32_t*)src)[i]>>8)&0xFF;
......@@ -1840,7 +1839,7 @@ static inline void RENAME(bgr32ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1
{
int i;
assert(src1 == src2);
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
const int a= ((uint32_t*)src1)[2*i+0];
const int e= ((uint32_t*)src1)[2*i+1];
......@@ -1863,7 +1862,7 @@ static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, long width)
"movq "MANGLE(bgr2YCoeff)", %%mm6 \n\t"
"movq "MANGLE(w1111)", %%mm5 \n\t"
"pxor %%mm7, %%mm7 \n\t"
"lea (%%"REG_a", %%"REG_a", 2), %%"REG_d"\n\t"
"lea (%%"REG_a", %%"REG_a", 2), %%"REG_d" \n\t"
ASMALIGN(4)
"1: \n\t"
PREFETCH" 64(%0, %%"REG_d") \n\t"
......@@ -1929,7 +1928,7 @@ static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, long width)
);
#else
int i;
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
int b= src[i*3+0];
int g= src[i*3+1];
......@@ -2061,7 +2060,7 @@ static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1
);
#else
int i;
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
int b= src1[6*i + 0] + src1[6*i + 3];
int g= src1[6*i + 1] + src1[6*i + 4];
......@@ -2077,7 +2076,7 @@ static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1
static inline void RENAME(bgr16ToY)(uint8_t *dst, uint8_t *src, int width)
{
int i;
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
int d= ((uint16_t*)src)[i];
int b= d&0x1F;
......@@ -2092,7 +2091,7 @@ static inline void RENAME(bgr16ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1
{
int i;
assert(src1==src2);
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
int d0= ((uint32_t*)src1)[i];
......@@ -2113,7 +2112,7 @@ static inline void RENAME(bgr16ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1
static inline void RENAME(bgr15ToY)(uint8_t *dst, uint8_t *src, int width)
{
int i;
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
int d= ((uint16_t*)src)[i];
int b= d&0x1F;
......@@ -2128,7 +2127,7 @@ static inline void RENAME(bgr15ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1
{
int i;
assert(src1==src2);
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
int d0= ((uint32_t*)src1)[i];
......@@ -2150,7 +2149,7 @@ static inline void RENAME(bgr15ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1
static inline void RENAME(rgb32ToY)(uint8_t *dst, uint8_t *src, int width)
{
int i;
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
int r= ((uint32_t*)src)[i]&0xFF;
int g= (((uint32_t*)src)[i]>>8)&0xFF;
......@@ -2164,7 +2163,7 @@ static inline void RENAME(rgb32ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1
{
int i;
assert(src1==src2);
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
const int a= ((uint32_t*)src1)[2*i+0];
const int e= ((uint32_t*)src1)[2*i+1];
......@@ -2182,7 +2181,7 @@ static inline void RENAME(rgb32ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1
static inline void RENAME(rgb24ToY)(uint8_t *dst, uint8_t *src, int width)
{
int i;
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
int r= src[i*3+0];
int g= src[i*3+1];
......@@ -2196,7 +2195,7 @@ static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1
{
int i;
assert(src1==src2);
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
int r= src1[6*i + 0] + src1[6*i + 3];
int g= src1[6*i + 1] + src1[6*i + 4];
......@@ -2210,7 +2209,7 @@ static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1
static inline void RENAME(rgb16ToY)(uint8_t *dst, uint8_t *src, int width)
{
int i;
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
int d= ((uint16_t*)src)[i];
int r= d&0x1F;
......@@ -2225,7 +2224,7 @@ static inline void RENAME(rgb16ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1
{
int i;
assert(src1 == src2);
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
int d0= ((uint32_t*)src1)[i];
......@@ -2246,7 +2245,7 @@ static inline void RENAME(rgb16ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1
static inline void RENAME(rgb15ToY)(uint8_t *dst, uint8_t *src, int width)
{
int i;
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
int d= ((uint16_t*)src)[i];
int r= d&0x1F;
......@@ -2261,7 +2260,7 @@ static inline void RENAME(rgb15ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1
{
int i;
assert(src1 == src2);
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
int d0= ((uint32_t*)src1)[i];
......@@ -2282,7 +2281,7 @@ static inline void RENAME(rgb15ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1
static inline void RENAME(palToY)(uint8_t *dst, uint8_t *src, int width, uint32_t *pal)
{
int i;
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
int d= src[i];
......@@ -2294,7 +2293,7 @@ static inline void RENAME(palToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1,
{
int i;
assert(src1 == src2);
for(i=0; i<width; i++)
for (i=0; i<width; i++)
{
int p= pal[src1[i]];
......@@ -2309,7 +2308,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW
{
#ifdef HAVE_MMX
assert(filterSize % 4 == 0 && filterSize>0);
if(filterSize==4) // Always true for upscaling, sometimes for down, too.
if (filterSize==4) // Always true for upscaling, sometimes for down, too.
{
long counter= -2*dstW;
filter-= counter*2;
......@@ -2326,9 +2325,9 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW
ASMALIGN(4)
"1: \n\t"
"movzwl (%2, %%"REG_BP"), %%eax \n\t"
"movzwl 2(%2, %%"REG_BP"), %%ebx\n\t"
"movq (%1, %%"REG_BP", 4), %%mm1\n\t"
"movq 8(%1, %%"REG_BP", 4), %%mm3\n\t"
"movzwl 2(%2, %%"REG_BP"), %%ebx \n\t"
"movq (%1, %%"REG_BP", 4), %%mm1 \n\t"
"movq 8(%1, %%"REG_BP", 4), %%mm3 \n\t"
"movd (%3, %%"REG_a"), %%mm0 \n\t"
"movd (%3, %%"REG_b"), %%mm2 \n\t"
"punpcklbw %%mm7, %%mm0 \n\t"
......@@ -2355,7 +2354,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW
#endif
);
}
else if(filterSize==8)
else if (filterSize==8)
{
long counter= -2*dstW;
filter-= counter*4;
......@@ -2372,9 +2371,9 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW
ASMALIGN(4)
"1: \n\t"
"movzwl (%2, %%"REG_BP"), %%eax \n\t"
"movzwl 2(%2, %%"REG_BP"), %%ebx\n\t"
"movq (%1, %%"REG_BP", 8), %%mm1\n\t"
"movq 16(%1, %%"REG_BP", 8), %%mm3\n\t"
"movzwl 2(%2, %%"REG_BP"), %%ebx \n\t"
"movq (%1, %%"REG_BP", 8), %%mm1 \n\t"
"movq 16(%1, %%"REG_BP", 8), %%mm3 \n\t"
"movd (%3, %%"REG_a"), %%mm0 \n\t"
"movd (%3, %%"REG_b"), %%mm2 \n\t"
"punpcklbw %%mm7, %%mm0 \n\t"
......@@ -2382,8 +2381,8 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW
"pmaddwd %%mm1, %%mm0 \n\t"
"pmaddwd %%mm2, %%mm3 \n\t"
"movq 8(%1, %%"REG_BP", 8), %%mm1\n\t"
"movq 24(%1, %%"REG_BP", 8), %%mm5\n\t"
"movq 8(%1, %%"REG_BP", 8), %%mm1 \n\t"
"movq 24(%1, %%"REG_BP", 8), %%mm5 \n\t"
"movd 4(%3, %%"REG_a"), %%mm4 \n\t"
"movd 4(%3, %%"REG_b"), %%mm2 \n\t"
"punpcklbw %%mm7, %%mm4 \n\t"
......@@ -2417,7 +2416,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW
{
uint8_t *offset = src+filterSize;
long counter= -2*dstW;
// filter-= counter*filterSize/2;
//filter-= counter*filterSize/2;
filterPos-= counter/2;
dst-= counter/2;
asm volatile(
......@@ -2434,8 +2433,8 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW
"2: \n\t"
"movq (%1), %%mm1 \n\t"
"movq (%1, %6), %%mm3 \n\t"
"movd (%%"REG_c", %%"REG_a"), %%mm0\n\t"
"movd (%%"REG_c", %%"REG_d"), %%mm2\n\t"
"movd (%%"REG_c", %%"REG_a"), %%mm0 \n\t"
"movd (%%"REG_c", %%"REG_d"), %%mm2 \n\t"
"punpcklbw %%mm7, %%mm0 \n\t"
"punpcklbw %%mm7, %%mm2 \n\t"
"pmaddwd %%mm1, %%mm0 \n\t"
......@@ -2468,20 +2467,20 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW
hScale_altivec_real(dst, dstW, src, srcW, xInc, filter, filterPos, filterSize);
#else
int i;
for(i=0; i<dstW; i++)
for (i=0; i<dstW; i++)
{
int j;
int srcPos= filterPos[i];
int val=0;
// printf("filterPos: %d\n", filterPos[i]);
for(j=0; j<filterSize; j++)
//printf("filterPos: %d\n", filterPos[i]);
for (j=0; j<filterSize; j++)
{
// printf("filter: %d, src: %d\n", filter[i], src[srcPos + j]);
//printf("filter: %d, src: %d\n", filter[i], src[srcPos + j]);
val += ((int)src[srcPos + j])*filter[filterSize*i + j];
}
// filter += hFilterSize;
//filter += hFilterSize;
dst[i] = av_clip(val>>7, 0, (1<<15)-1); // the cubic equation does overflow ...
// dst[i] = val>>7;
//dst[i] = val>>7;
}
#endif
#endif
......@@ -2493,57 +2492,57 @@ 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, uint8_t *pal)
{
if(srcFormat==PIX_FMT_YUYV422 || srcFormat==PIX_FMT_GRAY16BE)
if (srcFormat==PIX_FMT_YUYV422 || srcFormat==PIX_FMT_GRAY16BE)
{
RENAME(yuy2ToY)(formatConvBuffer, src, srcW);
src= formatConvBuffer;
}
else if(srcFormat==PIX_FMT_UYVY422 || srcFormat==PIX_FMT_GRAY16LE)
else if (srcFormat==PIX_FMT_UYVY422 || srcFormat==PIX_FMT_GRAY16LE)
{
RENAME(uyvyToY)(formatConvBuffer, src, srcW);
src= formatConvBuffer;
}
else if(srcFormat==PIX_FMT_RGB32)
else if (srcFormat==PIX_FMT_RGB32)
{
RENAME(bgr32ToY)(formatConvBuffer, src, srcW);
src= formatConvBuffer;
}
else if(srcFormat==PIX_FMT_BGR24)
else if (srcFormat==PIX_FMT_BGR24)
{
RENAME(bgr24ToY)(formatConvBuffer, src, srcW);
src= formatConvBuffer;
}
else if(srcFormat==PIX_FMT_BGR565)
else if (srcFormat==PIX_FMT_BGR565)
{
RENAME(bgr16ToY)(formatConvBuffer, src, srcW);
src= formatConvBuffer;
}
else if(srcFormat==PIX_FMT_BGR555)
else if (srcFormat==PIX_FMT_BGR555)
{
RENAME(bgr15ToY)(formatConvBuffer, src, srcW);
src= formatConvBuffer;
}
else if(srcFormat==PIX_FMT_BGR32)
else if (srcFormat==PIX_FMT_BGR32)
{
RENAME(rgb32ToY)(formatConvBuffer, src, srcW);
src= formatConvBuffer;
}
else if(srcFormat==PIX_FMT_RGB24)
else if (srcFormat==PIX_FMT_RGB24)
{
RENAME(rgb24ToY)(formatConvBuffer, src, srcW);
src= formatConvBuffer;
}
else if(srcFormat==PIX_FMT_RGB565)
else if (srcFormat==PIX_FMT_RGB565)
{
RENAME(rgb16ToY)(formatConvBuffer, src, srcW);
src= formatConvBuffer;
}
else if(srcFormat==PIX_FMT_RGB555)
else if (srcFormat==PIX_FMT_RGB555)
{
RENAME(rgb15ToY)(formatConvBuffer, src, srcW);
src= formatConvBuffer;
}
else if(srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE)
else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE)
{
RENAME(palToY)(formatConvBuffer, src, srcW, pal);
src= formatConvBuffer;
......@@ -2551,9 +2550,9 @@ static inline void RENAME(hyscale)(uint16_t *dst, long dstWidth, uint8_t *src, i
#ifdef HAVE_MMX
// use the new MMX scaler if the mmx2 can't be used (its faster than the x86asm one)
if(!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed))
if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed))
#else
if(!(flags&SWS_FAST_BILINEAR))
if (!(flags&SWS_FAST_BILINEAR))
#endif
{
RENAME(hScale)(dst, dstWidth, src, srcW, xInc, hLumFilter, hLumFilterPos, hLumFilterSize);
......@@ -2566,7 +2565,7 @@ static inline void RENAME(hyscale)(uint16_t *dst, long dstWidth, uint8_t *src, i
#if defined(PIC)
uint64_t ebxsave __attribute__((aligned(8)));
#endif
if(canMMX2BeUsed)
if (canMMX2BeUsed)
{
asm volatile(
#if defined(PIC)
......@@ -2587,7 +2586,7 @@ static inline void RENAME(hyscale)(uint16_t *dst, long dstWidth, uint8_t *src, i
#define FUNNY_Y_CODE \
"movl (%%"REG_b"), %%esi \n\t"\
"call *%4 \n\t"\
"movl (%%"REG_b", %%"REG_a"), %%esi\n\t"\
"movl (%%"REG_b", %%"REG_a"), %%esi \n\t"\
"add %%"REG_S", %%"REG_c" \n\t"\
"add %%"REG_a", %%"REG_D" \n\t"\
"xor %%"REG_a", %%"REG_a" \n\t"\
......@@ -2597,7 +2596,7 @@ static inline void RENAME(hyscale)(uint16_t *dst, long dstWidth, uint8_t *src, i
#define FUNNY_Y_CODE \
"movl (%%"REG_b"), %%esi \n\t"\
"call *%4 \n\t"\
"addl (%%"REG_b", %%"REG_a"), %%"REG_c"\n\t"\
"addl (%%"REG_b", %%"REG_a"), %%"REG_c" \n\t"\
"add %%"REG_a", %%"REG_D" \n\t"\
"xor %%"REG_a", %%"REG_a" \n\t"\
......@@ -2625,7 +2624,7 @@ FUNNY_Y_CODE
,"%"REG_b
#endif
);
for(i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) dst[i] = src[srcW-1]*128;
for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) dst[i] = src[srcW-1]*128;
}
else
{
......@@ -2647,7 +2646,7 @@ FUNNY_Y_CODE
"addl %%edi, %%esi \n\t" //src[xx+1]*2*xalpha + src[xx]*(1-2*xalpha)
"mov %1, %%"REG_D" \n\t"
"shrl $9, %%esi \n\t"
"movw %%si, (%%"REG_D", %%"REG_a", 2)\n\t"
"movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t"
"addw %4, %%cx \n\t" //2*xalpha += xInc&0xFF
"adc %3, %%"REG_d" \n\t" //xx+= xInc>>8 + carry
......@@ -2659,7 +2658,7 @@ FUNNY_Y_CODE
"addl %%edi, %%esi \n\t" //src[xx+1]*2*xalpha + src[xx]*(1-2*xalpha)
"mov %1, %%"REG_D" \n\t"
"shrl $9, %%esi \n\t"
"movw %%si, 2(%%"REG_D", %%"REG_a", 2)\n\t"
"movw %%si, 2(%%"REG_D", %%"REG_a", 2) \n\t"
"addw %4, %%cx \n\t" //2*xalpha += xInc&0xFF
"adc %3, %%"REG_d" \n\t" //xx+= xInc>>8 + carry
......@@ -2678,7 +2677,7 @@ FUNNY_Y_CODE
#else
int i;
unsigned int xpos=0;
for(i=0;i<dstWidth;i++)
for (i=0;i<dstWidth;i++)
{
register unsigned int xx=xpos>>16;
register unsigned int xalpha=(xpos&0xFFFF)>>9;
......@@ -2695,71 +2694,71 @@ inline static void RENAME(hcscale)(uint16_t *dst, long dstWidth, uint8_t *src1,
int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter,
int32_t *mmx2FilterPos, uint8_t *pal)
{
if(srcFormat==PIX_FMT_YUYV422)
if (srcFormat==PIX_FMT_YUYV422)
{
RENAME(yuy2ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
src1= formatConvBuffer;
src2= formatConvBuffer+2048;
}
else if(srcFormat==PIX_FMT_UYVY422)
else if (srcFormat==PIX_FMT_UYVY422)
{
RENAME(uyvyToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
src1= formatConvBuffer;
src2= formatConvBuffer+2048;
}
else if(srcFormat==PIX_FMT_RGB32)
else if (srcFormat==PIX_FMT_RGB32)
{
RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
src1= formatConvBuffer;
src2= formatConvBuffer+2048;
}
else if(srcFormat==PIX_FMT_BGR24)
else if (srcFormat==PIX_FMT_BGR24)
{
RENAME(bgr24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
src1= formatConvBuffer;
src2= formatConvBuffer+2048;
}
else if(srcFormat==PIX_FMT_BGR565)
else if (srcFormat==PIX_FMT_BGR565)
{
RENAME(bgr16ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
src1= formatConvBuffer;
src2= formatConvBuffer+2048;
}
else if(srcFormat==PIX_FMT_BGR555)
else if (srcFormat==PIX_FMT_BGR555)
{
RENAME(bgr15ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
src1= formatConvBuffer;
src2= formatConvBuffer+2048;
}
else if(srcFormat==PIX_FMT_BGR32)
else if (srcFormat==PIX_FMT_BGR32)
{
RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
src1= formatConvBuffer;
src2= formatConvBuffer+2048;
}
else if(srcFormat==PIX_FMT_RGB24)
else if (srcFormat==PIX_FMT_RGB24)
{
RENAME(rgb24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
src1= formatConvBuffer;
src2= formatConvBuffer+2048;
}
else if(srcFormat==PIX_FMT_RGB565)
else if (srcFormat==PIX_FMT_RGB565)
{
RENAME(rgb16ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
src1= formatConvBuffer;
src2= formatConvBuffer+2048;
}
else if(srcFormat==PIX_FMT_RGB555)
else if (srcFormat==PIX_FMT_RGB555)
{
RENAME(rgb15ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
src1= formatConvBuffer;
src2= formatConvBuffer+2048;
}
else if(isGray(srcFormat))
else if (isGray(srcFormat))
{
return;
}
else if(srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE)
else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE)
{
RENAME(palToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW, pal);
src1= formatConvBuffer;
......@@ -2768,9 +2767,9 @@ inline static void RENAME(hcscale)(uint16_t *dst, long dstWidth, uint8_t *src1,
#ifdef HAVE_MMX
// use the new MMX scaler if the mmx2 can't be used (its faster than the x86asm one)
if(!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed))
if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed))
#else
if(!(flags&SWS_FAST_BILINEAR))
if (!(flags&SWS_FAST_BILINEAR))
#endif
{
RENAME(hScale)(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);
......@@ -2784,7 +2783,7 @@ inline static void RENAME(hcscale)(uint16_t *dst, long dstWidth, uint8_t *src1,
#if defined(PIC)
uint64_t ebxsave __attribute__((aligned(8)));
#endif
if(canMMX2BeUsed)
if (canMMX2BeUsed)
{
asm volatile(
#if defined(PIC)
......@@ -2805,7 +2804,7 @@ inline static void RENAME(hcscale)(uint16_t *dst, long dstWidth, uint8_t *src1,
#define FUNNY_UV_CODE \
"movl (%%"REG_b"), %%esi \n\t"\
"call *%4 \n\t"\
"movl (%%"REG_b", %%"REG_a"), %%esi\n\t"\
"movl (%%"REG_b", %%"REG_a"), %%esi \n\t"\
"add %%"REG_S", %%"REG_c" \n\t"\
"add %%"REG_a", %%"REG_D" \n\t"\
"xor %%"REG_a", %%"REG_a" \n\t"\
......@@ -2815,7 +2814,7 @@ inline static void RENAME(hcscale)(uint16_t *dst, long dstWidth, uint8_t *src1,
#define FUNNY_UV_CODE \
"movl (%%"REG_b"), %%esi \n\t"\
"call *%4 \n\t"\
"addl (%%"REG_b", %%"REG_a"), %%"REG_c"\n\t"\
"addl (%%"REG_b", %%"REG_a"), %%"REG_c" \n\t"\
"add %%"REG_a", %%"REG_D" \n\t"\
"xor %%"REG_a", %%"REG_a" \n\t"\
......@@ -2851,9 +2850,9 @@ FUNNY_UV_CODE
,"%"REG_b
#endif
);
for(i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--)
for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--)
{
// printf("%d %d %d\n", dstWidth, i, srcW);
//printf("%d %d %d\n", dstWidth, i, srcW);
dst[i] = src1[srcW-1]*128;
dst[i+2048] = src2[srcW-1]*128;
}
......@@ -2878,7 +2877,7 @@ FUNNY_UV_CODE
"addl %%edi, %%esi \n\t" //src[xx+1]*2*xalpha + src[xx]*(1-2*xalpha)
"mov %1, %%"REG_D" \n\t"
"shrl $9, %%esi \n\t"
"movw %%si, (%%"REG_D", %%"REG_a", 2)\n\t"
"movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t"
"movzbl (%5, %%"REG_d"), %%edi \n\t" //src[xx]
"movzbl 1(%5, %%"REG_d"), %%esi \n\t" //src[xx+1]
......@@ -2888,7 +2887,7 @@ FUNNY_UV_CODE
"addl %%edi, %%esi \n\t" //src[xx+1]*2*xalpha + src[xx]*(1-2*xalpha)
"mov %1, %%"REG_D" \n\t"
"shrl $9, %%esi \n\t"
"movw %%si, 4096(%%"REG_D", %%"REG_a", 2)\n\t"
"movw %%si, 4096(%%"REG_D", %%"REG_a", 2) \n\t"
"addw %4, %%cx \n\t" //2*xalpha += xInc&0xFF
"adc %3, %%"REG_d" \n\t" //xx+= xInc>>8 + carry
......@@ -2912,16 +2911,16 @@ FUNNY_UV_CODE
#else
int i;
unsigned int xpos=0;
for(i=0;i<dstWidth;i++)
for (i=0;i<dstWidth;i++)
{
register unsigned int xx=xpos>>16;
register unsigned int xalpha=(xpos&0xFFFF)>>9;
dst[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha);
dst[i+2048]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha);
/* slower
/* slower
dst[i]= (src1[xx]<<7) + (src1[xx+1] - src1[xx])*xalpha;
dst[i+2048]=(src2[xx]<<7) + (src2[xx+1] - src2[xx])*xalpha;
*/
*/
xpos+=xInc;
}
#endif
......@@ -2976,7 +2975,7 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s
int lastInLumBuf= c->lastInLumBuf;
int lastInChrBuf= c->lastInChrBuf;
if(isPacked(c->srcFormat)){
if (isPacked(c->srcFormat)){
pal= src[1];
src[0]=
src[1]=
......@@ -2988,26 +2987,26 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s
srcStride[1]<<= c->vChrDrop;
srcStride[2]<<= c->vChrDrop;
// printf("swscale %X %X %X -> %X %X %X\n", (int)src[0], (int)src[1], (int)src[2],
// (int)dst[0], (int)dst[1], (int)dst[2]);
//printf("swscale %X %X %X -> %X %X %X\n", (int)src[0], (int)src[1], (int)src[2],
// (int)dst[0], (int)dst[1], (int)dst[2]);
#if 0 //self test FIXME move to a vfilter or something
{
static volatile int i=0;
i++;
if(srcFormat==PIX_FMT_YUV420P && i==1 && srcSliceH>= c->srcH)
{
static volatile int i=0;
i++;
if (srcFormat==PIX_FMT_YUV420P && i==1 && srcSliceH>= c->srcH)
selfTest(src, srcStride, c->srcW, c->srcH);
i--;
}
i--;
}
#endif
//printf("sws Strides:%d %d %d -> %d %d %d\n", srcStride[0],srcStride[1],srcStride[2],
//dstStride[0],dstStride[1],dstStride[2]);
//printf("sws Strides:%d %d %d -> %d %d %d\n", srcStride[0],srcStride[1],srcStride[2],
//dstStride[0],dstStride[1],dstStride[2]);
if(dstStride[0]%8 !=0 || dstStride[1]%8 !=0 || dstStride[2]%8 !=0)
if (dstStride[0]%8 !=0 || dstStride[1]%8 !=0 || dstStride[2]%8 !=0)
{
static int firstTime=1; //FIXME move this into the context perhaps
if(flags & SWS_PRINT_INFO && firstTime)
if (flags & SWS_PRINT_INFO && firstTime)
{
av_log(c, AV_LOG_WARNING, "SwScaler: Warning: dstStride is not aligned!\n"
"SwScaler: ->cannot do aligned memory acesses anymore\n");
......@@ -3017,7 +3016,7 @@ i--;
/* Note the user might start scaling the picture in the middle so this will not get executed
this is not really intended but works currently, so ppl might do it */
if(srcSliceY ==0){
if (srcSliceY ==0){
lumBufIndex=0;
chrBufIndex=0;
dstY=0;
......@@ -3027,7 +3026,7 @@ i--;
lastDstY= dstY;
for(;dstY < dstH; dstY++){
for (;dstY < dstH; dstY++){
unsigned char *dest =dst[0]+dstStride[0]*dstY;
const int chrDstY= dstY>>c->chrDstVSubSample;
unsigned char *uDest=dst[1]+dstStride[1]*chrDstY;
......@@ -3038,28 +3037,28 @@ i--;
const int lastLumSrcY= firstLumSrcY + vLumFilterSize -1; // Last line needed as input
const int lastChrSrcY= firstChrSrcY + vChrFilterSize -1; // Last line needed as input
//printf("dstY:%d dstH:%d firstLumSrcY:%d lastInLumBuf:%d vLumBufSize: %d vChrBufSize: %d slice: %d %d vLumFilterSize: %d firstChrSrcY: %d vChrFilterSize: %d c->chrSrcVSubSample: %d\n",
// dstY, dstH, firstLumSrcY, lastInLumBuf, vLumBufSize, vChrBufSize, srcSliceY, srcSliceH, vLumFilterSize, firstChrSrcY, vChrFilterSize, c->chrSrcVSubSample);
//printf("dstY:%d dstH:%d firstLumSrcY:%d lastInLumBuf:%d vLumBufSize: %d vChrBufSize: %d slice: %d %d vLumFilterSize: %d firstChrSrcY: %d vChrFilterSize: %d c->chrSrcVSubSample: %d\n",
// dstY, dstH, firstLumSrcY, lastInLumBuf, vLumBufSize, vChrBufSize, srcSliceY, srcSliceH, vLumFilterSize, firstChrSrcY, vChrFilterSize, c->chrSrcVSubSample);
//handle holes (FAST_BILINEAR & weird filters)
if(firstLumSrcY > lastInLumBuf) lastInLumBuf= firstLumSrcY-1;
if(firstChrSrcY > lastInChrBuf) lastInChrBuf= firstChrSrcY-1;
//printf("%d %d %d\n", firstChrSrcY, lastInChrBuf, vChrBufSize);
if (firstLumSrcY > lastInLumBuf) lastInLumBuf= firstLumSrcY-1;
if (firstChrSrcY > lastInChrBuf) lastInChrBuf= firstChrSrcY-1;
//printf("%d %d %d\n", firstChrSrcY, lastInChrBuf, vChrBufSize);
ASSERT(firstLumSrcY >= lastInLumBuf - vLumBufSize + 1)
ASSERT(firstChrSrcY >= lastInChrBuf - vChrBufSize + 1)
// Do we have enough lines in this slice to output the dstY line
if(lastLumSrcY < srcSliceY + srcSliceH && lastChrSrcY < -((-srcSliceY - srcSliceH)>>c->chrSrcVSubSample))
if (lastLumSrcY < srcSliceY + srcSliceH && lastChrSrcY < -((-srcSliceY - srcSliceH)>>c->chrSrcVSubSample))
{
//Do horizontal scaling
while(lastInLumBuf < lastLumSrcY)
{
uint8_t *s= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0];
lumBufIndex++;
// printf("%d %d %d %d\n", lumBufIndex, vLumBufSize, lastInLumBuf, lastLumSrcY);
//printf("%d %d %d %d\n", lumBufIndex, vLumBufSize, lastInLumBuf, lastLumSrcY);
ASSERT(lumBufIndex < 2*vLumBufSize)
ASSERT(lastInLumBuf + 1 - srcSliceY < srcSliceH)
ASSERT(lastInLumBuf + 1 - srcSliceY >= 0)
// printf("%d %d\n", lumBufIndex, vLumBufSize);
//printf("%d %d\n", lumBufIndex, vLumBufSize);
RENAME(hyscale)(lumPixBuf[ lumBufIndex ], dstW, s, srcW, lumXInc,
flags, canMMX2BeUsed, hLumFilter, hLumFilterPos, hLumFilterSize,
funnyYCode, c->srcFormat, formatConvBuffer,
......@@ -3076,7 +3075,7 @@ i--;
ASSERT(lastInChrBuf + 1 - chrSrcSliceY >= 0)
//FIXME replace parameters through context struct (some at least)
if(!(isGray(srcFormat) || isGray(dstFormat)))
if (!(isGray(srcFormat) || isGray(dstFormat)))
RENAME(hcscale)(chrPixBuf[ chrBufIndex ], chrDstW, src1, src2, chrSrcW, chrXInc,
flags, canMMX2BeUsed, hChrFilter, hChrFilterPos, hChrFilterSize,
funnyUVCode, c->srcFormat, formatConvBuffer,
......@@ -3084,12 +3083,12 @@ i--;
lastInChrBuf++;
}
//wrap buf index around to stay inside the ring buffer
if(lumBufIndex >= vLumBufSize ) lumBufIndex-= vLumBufSize;
if(chrBufIndex >= vChrBufSize ) chrBufIndex-= vChrBufSize;
if (lumBufIndex >= vLumBufSize ) lumBufIndex-= vLumBufSize;
if (chrBufIndex >= vChrBufSize ) chrBufIndex-= vChrBufSize;
}
else // not enough lines left in this slice -> load the rest in the buffer
{
/* printf("%d %d Last:%d %d LastInBuf:%d %d Index:%d %d Y:%d FSize: %d %d BSize: %d %d\n",
/* printf("%d %d Last:%d %d LastInBuf:%d %d Index:%d %d Y:%d FSize: %d %d BSize: %d %d\n",
firstChrSrcY,firstLumSrcY,lastChrSrcY,lastLumSrcY,
lastInChrBuf,lastInLumBuf,chrBufIndex,lumBufIndex,dstY,vChrFilterSize,vLumFilterSize,
vChrBufSize, vLumBufSize);*/
......@@ -3117,7 +3116,7 @@ i--;
ASSERT(lastInChrBuf + 1 - chrSrcSliceY < chrSrcSliceH)
ASSERT(lastInChrBuf + 1 - chrSrcSliceY >= 0)
if(!(isGray(srcFormat) || isGray(dstFormat)))
if (!(isGray(srcFormat) || isGray(dstFormat)))
RENAME(hcscale)(chrPixBuf[ chrBufIndex ], chrDstW, src1, src2, chrSrcW, chrXInc,
flags, canMMX2BeUsed, hChrFilter, hChrFilterPos, hChrFilterSize,
funnyUVCode, c->srcFormat, formatConvBuffer,
......@@ -3125,8 +3124,8 @@ i--;
lastInChrBuf++;
}
//wrap buf index around to stay inside the ring buffer
if(lumBufIndex >= vLumBufSize ) lumBufIndex-= vLumBufSize;
if(chrBufIndex >= vChrBufSize ) chrBufIndex-= vChrBufSize;
if (lumBufIndex >= vLumBufSize ) lumBufIndex-= vLumBufSize;
if (chrBufIndex >= vChrBufSize ) chrBufIndex-= vChrBufSize;
break; //we can't output a dstY line so let's try with the next slice
}
......@@ -3136,21 +3135,21 @@ i--;
g5Dither= dither8[dstY&1];
r5Dither= dither8[(dstY+1)&1];
#endif
if(dstY < dstH-2)
if (dstY < dstH-2)
{
int16_t **lumSrcPtr= lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
int16_t **chrSrcPtr= chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
#ifdef HAVE_MMX
int i;
if(flags & SWS_ACCURATE_RND){
for(i=0; i<vLumFilterSize; i+=2){
if (flags & SWS_ACCURATE_RND){
for (i=0; i<vLumFilterSize; i+=2){
lumMmxFilter[2*i+0]= (int32_t)lumSrcPtr[i ];
lumMmxFilter[2*i+1]= (int32_t)lumSrcPtr[i+(vLumFilterSize>1)];
lumMmxFilter[2*i+2]=
lumMmxFilter[2*i+3]= vLumFilter[dstY*vLumFilterSize + i ]
+ (vLumFilterSize>1 ? vLumFilter[dstY*vLumFilterSize + i + 1]<<16 : 0);
}
for(i=0; i<vChrFilterSize; i+=2){
for (i=0; i<vChrFilterSize; i+=2){
chrMmxFilter[2*i+0]= (int32_t)chrSrcPtr[i ];
chrMmxFilter[2*i+1]= (int32_t)chrSrcPtr[i+(vChrFilterSize>1)];
chrMmxFilter[2*i+2]=
......@@ -3158,7 +3157,7 @@ i--;
+ (vChrFilterSize>1 ? vChrFilter[chrDstY*vChrFilterSize + i + 1]<<16 : 0);
}
}else{
for(i=0; i<vLumFilterSize; i++)
for (i=0; i<vLumFilterSize; i++)
{
lumMmxFilter[4*i+0]= (int32_t)lumSrcPtr[i];
lumMmxFilter[4*i+1]= (uint64_t)lumSrcPtr[i] >> 32;
......@@ -3166,7 +3165,7 @@ i--;
lumMmxFilter[4*i+3]=
((uint16_t)vLumFilter[dstY*vLumFilterSize + i])*0x10001;
}
for(i=0; i<vChrFilterSize; i++)
for (i=0; i<vChrFilterSize; i++)
{
chrMmxFilter[4*i+0]= (int32_t)chrSrcPtr[i];
chrMmxFilter[4*i+1]= (uint64_t)chrSrcPtr[i] >> 32;
......@@ -3176,19 +3175,19 @@ i--;
}
}
#endif
if(dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_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
if (dstY&chrSkipMask) uDest= NULL; //FIXME split functions in lumi / chromi
RENAME(yuv2nv12X)(c,
vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize,
vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
dest, uDest, dstW, chrDstW, dstFormat);
}
else if(isPlanarYUV(dstFormat) || isGray(dstFormat)) //YV12 like
else if (isPlanarYUV(dstFormat) || isGray(dstFormat)) //YV12 like
{
const int chrSkipMask= (1<<c->chrDstVSubSample)-1;
if((dstY&chrSkipMask) || isGray(dstFormat)) uDest=vDest= NULL; //FIXME split functions in lumi / chromi
if(vLumFilterSize == 1 && vChrFilterSize == 1) // Unscaled YV12
if ((dstY&chrSkipMask) || isGray(dstFormat)) uDest=vDest= NULL; //FIXME split functions in lumi / chromi
if (vLumFilterSize == 1 && vChrFilterSize == 1) // Unscaled YV12
{
int16_t *lumBuf = lumPixBuf[0];
int16_t *chrBuf= chrPixBuf[0];
......@@ -3206,13 +3205,13 @@ i--;
{
ASSERT(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2);
ASSERT(chrSrcPtr + vChrFilterSize - 1 < chrPixBuf + vChrBufSize*2);
if(vLumFilterSize == 1 && vChrFilterSize == 2) //Unscaled RGB
if (vLumFilterSize == 1 && vChrFilterSize == 2) //Unscaled RGB
{
int chrAlpha= vChrFilter[2*dstY+1];
RENAME(yuv2packed1)(c, *lumSrcPtr, *chrSrcPtr, *(chrSrcPtr+1),
dest, dstW, chrAlpha, dstFormat, flags, dstY);
}
else if(vLumFilterSize == 2 && vChrFilterSize == 2) //BiLinear Upscale RGB
else if (vLumFilterSize == 2 && vChrFilterSize == 2) //BiLinear Upscale RGB
{
int lumAlpha= vLumFilter[2*dstY+1];
int chrAlpha= vChrFilter[2*dstY+1];
......@@ -3236,18 +3235,18 @@ i--;
{
int16_t **lumSrcPtr= lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
int16_t **chrSrcPtr= chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
if(dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_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
if (dstY&chrSkipMask) uDest= NULL; //FIXME split functions in lumi / chromi
yuv2nv12XinC(
vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize,
vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
dest, uDest, dstW, chrDstW, dstFormat);
}
else if(isPlanarYUV(dstFormat) || isGray(dstFormat)) //YV12
else if (isPlanarYUV(dstFormat) || isGray(dstFormat)) //YV12
{
const int chrSkipMask= (1<<c->chrDstVSubSample)-1;
if((dstY&chrSkipMask) || isGray(dstFormat)) uDest=vDest= NULL; //FIXME split functions in lumi / chromi
if ((dstY&chrSkipMask) || isGray(dstFormat)) uDest=vDest= NULL; //FIXME split functions in lumi / chromi
yuv2yuvXinC(
vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize,
vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment