Originally committed as revision 29523 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
Ramiro Polla authored on 2009/08/17 06:11:28... | ... |
@@ -71,7 +71,7 @@ int main(int argc, char **argv) |
71 | 71 |
av_log(NULL, AV_LOG_INFO, "CPU capabilities forced to %x\n", cpu_caps); |
72 | 72 |
sws_rgb2rgb_init(cpu_caps); |
73 | 73 |
|
74 |
- for(funcNum=0; ; funcNum++){ |
|
74 |
+ for(funcNum=0; ; funcNum++) { |
|
75 | 75 |
struct func_info_s { |
76 | 76 |
int src_bpp; |
77 | 77 |
int dst_bpp; |
... | ... |
@@ -118,13 +118,13 @@ int main(int argc, char **argv) |
118 | 118 |
av_log(NULL, AV_LOG_INFO,"."); |
119 | 119 |
memset(srcBuffer, srcByte, SIZE); |
120 | 120 |
|
121 |
- for(width=63; width>0; width--){ |
|
121 |
+ for(width=63; width>0; width--) { |
|
122 | 122 |
int dstOffset; |
123 |
- for(dstOffset=128; dstOffset<196; dstOffset+=4){ |
|
123 |
+ for(dstOffset=128; dstOffset<196; dstOffset+=4) { |
|
124 | 124 |
int srcOffset; |
125 | 125 |
memset(dstBuffer, dstByte, SIZE); |
126 | 126 |
|
127 |
- for(srcOffset=128; srcOffset<196; srcOffset+=4){ |
|
127 |
+ for(srcOffset=128; srcOffset<196; srcOffset+=4) { |
|
128 | 128 |
uint8_t *src= srcBuffer+srcOffset; |
129 | 129 |
uint8_t *dst= dstBuffer+dstOffset; |
130 | 130 |
const char *name=NULL; |
... | ... |
@@ -139,24 +139,24 @@ int main(int argc, char **argv) |
139 | 139 |
|
140 | 140 |
if(!srcBpp) break; |
141 | 141 |
|
142 |
- for(i=0; i<SIZE; i++){ |
|
143 |
- if(srcBuffer[i]!=srcByte){ |
|
142 |
+ for(i=0; i<SIZE; i++) { |
|
143 |
+ if(srcBuffer[i]!=srcByte) { |
|
144 | 144 |
av_log(NULL, AV_LOG_INFO, "src damaged at %d w:%d src:%d dst:%d %s\n", |
145 | 145 |
i, width, srcOffset, dstOffset, name); |
146 | 146 |
failed=1; |
147 | 147 |
break; |
148 | 148 |
} |
149 | 149 |
} |
150 |
- for(i=0; i<dstOffset; i++){ |
|
151 |
- if(dstBuffer[i]!=dstByte){ |
|
150 |
+ for(i=0; i<dstOffset; i++) { |
|
151 |
+ if(dstBuffer[i]!=dstByte) { |
|
152 | 152 |
av_log(NULL, AV_LOG_INFO, "dst damaged at %d w:%d src:%d dst:%d %s\n", |
153 | 153 |
i, width, srcOffset, dstOffset, name); |
154 | 154 |
failed=1; |
155 | 155 |
break; |
156 | 156 |
} |
157 | 157 |
} |
158 |
- for(i=dstOffset + width*dstBpp; i<SIZE; i++){ |
|
159 |
- if(dstBuffer[i]!=dstByte){ |
|
158 |
+ for(i=dstOffset + width*dstBpp; i<SIZE; i++) { |
|
159 |
+ if(dstBuffer[i]!=dstByte) { |
|
160 | 160 |
av_log(NULL, AV_LOG_INFO, "dst damaged at %d w:%d src:%d dst:%d %s\n", |
161 | 161 |
i, width, srcOffset, dstOffset, name); |
162 | 162 |
failed=1; |
... | ... |
@@ -31,8 +31,9 @@ |
31 | 31 |
#include "libswscale/swscale.h" |
32 | 32 |
|
33 | 33 |
static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
34 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){ |
|
35 |
- if(c->srcFormat == PIX_FMT_YUV422P){ |
|
34 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
35 |
+{ |
|
36 |
+ if(c->srcFormat == PIX_FMT_YUV422P) { |
|
36 | 37 |
srcStride[1] *= 2; |
37 | 38 |
srcStride[2] *= 2; |
38 | 39 |
} |
... | ... |
@@ -45,8 +46,9 @@ static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], i |
45 | 45 |
} |
46 | 46 |
|
47 | 47 |
static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
48 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){ |
|
49 |
- if(c->srcFormat == PIX_FMT_YUV422P){ |
|
48 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
49 |
+{ |
|
50 |
+ if(c->srcFormat == PIX_FMT_YUV422P) { |
|
50 | 51 |
srcStride[1] *= 2; |
51 | 52 |
srcStride[2] *= 2; |
52 | 53 |
} |
... | ... |
@@ -59,8 +61,9 @@ static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], i |
59 | 59 |
} |
60 | 60 |
|
61 | 61 |
static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
62 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){ |
|
63 |
- if(c->srcFormat == PIX_FMT_YUV422P){ |
|
62 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
63 |
+{ |
|
64 |
+ if(c->srcFormat == PIX_FMT_YUV422P) { |
|
64 | 65 |
srcStride[1] *= 2; |
65 | 66 |
srcStride[2] *= 2; |
66 | 67 |
} |
... | ... |
@@ -75,7 +78,7 @@ static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], in |
75 | 75 |
|
76 | 76 |
SwsFunc ff_yuv2rgb_init_mlib(SwsContext *c) |
77 | 77 |
{ |
78 |
- switch(c->dstFormat){ |
|
78 |
+ switch(c->dstFormat) { |
|
79 | 79 |
case PIX_FMT_RGB24: return mlib_YUV2RGB420_24; |
80 | 80 |
case PIX_FMT_BGR32: return mlib_YUV2ARGB420_32; |
81 | 81 |
case PIX_FMT_RGB32: return mlib_YUV2ABGR420_32; |
... | ... |
@@ -24,7 +24,8 @@ |
24 | 24 |
#define vzero vec_splat_s32(0) |
25 | 25 |
|
26 | 26 |
static inline void |
27 |
-altivec_packIntArrayToCharArray(int *val, uint8_t* dest, int dstW) { |
|
27 |
+altivec_packIntArrayToCharArray(int *val, uint8_t* dest, int dstW) |
|
28 |
+{ |
|
28 | 29 |
register int i; |
29 | 30 |
vector unsigned int altivec_vectorShiftInt19 = |
30 | 31 |
vec_add(vec_splat_u32(10), vec_splat_u32(9)); |
... | ... |
@@ -389,7 +390,8 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, |
389 | 389 |
} |
390 | 390 |
|
391 | 391 |
static inline int yv12toyuy2_unscaled_altivec(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
392 |
- int srcSliceH, uint8_t* dstParam[], int dstStride_a[]) { |
|
392 |
+ int srcSliceH, uint8_t* dstParam[], int dstStride_a[]) |
|
393 |
+{ |
|
393 | 394 |
uint8_t *dst=dstParam[0] + dstStride_a[0]*srcSliceY; |
394 | 395 |
// yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]); |
395 | 396 |
uint8_t *ysrc = src[0]; |
... | ... |
@@ -466,7 +468,8 @@ static inline int yv12toyuy2_unscaled_altivec(SwsContext *c, uint8_t* src[], int |
466 | 466 |
} |
467 | 467 |
|
468 | 468 |
static inline int yv12touyvy_unscaled_altivec(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
469 |
- int srcSliceH, uint8_t* dstParam[], int dstStride_a[]) { |
|
469 |
+ int srcSliceH, uint8_t* dstParam[], int dstStride_a[]) |
|
470 |
+{ |
|
470 | 471 |
uint8_t *dst=dstParam[0] + dstStride_a[0]*srcSliceY; |
471 | 472 |
// yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]); |
472 | 473 |
uint8_t *ysrc = src[0]; |
... | ... |
@@ -714,7 +714,7 @@ SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c) |
714 | 714 |
if ((c->srcH & 0x1) != 0) |
715 | 715 |
return NULL; |
716 | 716 |
|
717 |
- switch(c->dstFormat){ |
|
717 |
+ switch(c->dstFormat) { |
|
718 | 718 |
case PIX_FMT_RGB24: |
719 | 719 |
av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space RGB24\n"); |
720 | 720 |
return altivec_yuv2_rgb24; |
... | ... |
@@ -738,7 +738,7 @@ SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c) |
738 | 738 |
break; |
739 | 739 |
|
740 | 740 |
case PIX_FMT_UYVY422: |
741 |
- switch(c->dstFormat){ |
|
741 |
+ switch(c->dstFormat) { |
|
742 | 742 |
case PIX_FMT_BGR32: |
743 | 743 |
av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space UYVY -> RGB32\n"); |
744 | 744 |
return altivec_uyvy_rgb32; |
... | ... |
@@ -800,7 +800,7 @@ ff_yuv2packedX_altivec(SwsContext *c, |
800 | 800 |
|
801 | 801 |
out = (vector unsigned char *)dest; |
802 | 802 |
|
803 |
- for (i=0; i<dstW; i+=16){ |
|
803 |
+ for (i=0; i<dstW; i+=16) { |
|
804 | 804 |
Y0 = RND; |
805 | 805 |
Y1 = RND; |
806 | 806 |
/* extract 16 coeffs from lumSrc */ |
... | ... |
@@ -196,7 +196,8 @@ DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL; |
196 | 196 |
32-bit C version, and and&add trick by Michael Niedermayer |
197 | 197 |
*/ |
198 | 198 |
|
199 |
-void sws_rgb2rgb_init(int flags){ |
|
199 |
+void sws_rgb2rgb_init(int flags) |
|
200 |
+{ |
|
200 | 201 |
#if (HAVE_MMX2 || HAVE_AMD3DNOW || HAVE_MMX) && CONFIG_GPL |
201 | 202 |
if (flags & SWS_CPU_CAPS_MMX2) |
202 | 203 |
rgb2rgb_init_MMX2(); |
... | ... |
@@ -227,8 +228,7 @@ void palette8topacked24(const uint8_t *src, uint8_t *dst, long num_pixels, const |
227 | 227 |
{ |
228 | 228 |
long i; |
229 | 229 |
|
230 |
- for (i=0; i<num_pixels; i++) |
|
231 |
- { |
|
230 |
+ for (i=0; i<num_pixels; i++) { |
|
232 | 231 |
//FIXME slow? |
233 | 232 |
dst[0]= palette[src[i]*4+0]; |
234 | 233 |
dst[1]= palette[src[i]*4+1]; |
... | ... |
@@ -273,8 +273,7 @@ void rgb32to24(const uint8_t *src, uint8_t *dst, long src_size) |
273 | 273 |
{ |
274 | 274 |
long i; |
275 | 275 |
long num_pixels = src_size >> 2; |
276 |
- for (i=0; i<num_pixels; i++) |
|
277 |
- { |
|
276 |
+ for (i=0; i<num_pixels; i++) { |
|
278 | 277 |
#if HAVE_BIGENDIAN |
279 | 278 |
/* RGB32 (= A,B,G,R) -> BGR24 (= B,G,R) */ |
280 | 279 |
dst[3*i + 0] = src[4*i + 1]; |
... | ... |
@@ -291,8 +290,7 @@ void rgb32to24(const uint8_t *src, uint8_t *dst, long src_size) |
291 | 291 |
void rgb24to32(const uint8_t *src, uint8_t *dst, long src_size) |
292 | 292 |
{ |
293 | 293 |
long i; |
294 |
- for (i=0; 3*i<src_size; i++) |
|
295 |
- { |
|
294 |
+ for (i=0; 3*i<src_size; i++) { |
|
296 | 295 |
#if HAVE_BIGENDIAN |
297 | 296 |
/* RGB24 (= R,G,B) -> BGR32 (= A,R,G,B) */ |
298 | 297 |
dst[4*i + 0] = 255; |
... | ... |
@@ -314,8 +312,7 @@ void rgb16tobgr32(const uint8_t *src, uint8_t *dst, long src_size) |
314 | 314 |
uint8_t *d = dst; |
315 | 315 |
const uint16_t *s = (const uint16_t *)src; |
316 | 316 |
end = s + src_size/2; |
317 |
- while (s < end) |
|
318 |
- { |
|
317 |
+ while (s < end) { |
|
319 | 318 |
register uint16_t bgr; |
320 | 319 |
bgr = *s++; |
321 | 320 |
#if HAVE_BIGENDIAN |
... | ... |
@@ -338,8 +335,7 @@ void rgb16to24(const uint8_t *src, uint8_t *dst, long src_size) |
338 | 338 |
uint8_t *d = dst; |
339 | 339 |
const uint16_t *s = (const uint16_t *)src; |
340 | 340 |
end = s + src_size/2; |
341 |
- while (s < end) |
|
342 |
- { |
|
341 |
+ while (s < end) { |
|
343 | 342 |
register uint16_t bgr; |
344 | 343 |
bgr = *s++; |
345 | 344 |
*d++ = (bgr&0xF800)>>8; |
... | ... |
@@ -353,8 +349,7 @@ void rgb16tobgr16(const uint8_t *src, uint8_t *dst, long src_size) |
353 | 353 |
long i; |
354 | 354 |
long num_pixels = src_size >> 1; |
355 | 355 |
|
356 |
- for (i=0; i<num_pixels; i++) |
|
357 |
- { |
|
356 |
+ for (i=0; i<num_pixels; i++) { |
|
358 | 357 |
unsigned rgb = ((const uint16_t*)src)[i]; |
359 | 358 |
((uint16_t*)dst)[i] = (rgb>>11) | (rgb&0x7E0) | (rgb<<11); |
360 | 359 |
} |
... | ... |
@@ -365,8 +360,7 @@ void rgb16tobgr15(const uint8_t *src, uint8_t *dst, long src_size) |
365 | 365 |
long i; |
366 | 366 |
long num_pixels = src_size >> 1; |
367 | 367 |
|
368 |
- for (i=0; i<num_pixels; i++) |
|
369 |
- { |
|
368 |
+ for (i=0; i<num_pixels; i++) { |
|
370 | 369 |
unsigned rgb = ((const uint16_t*)src)[i]; |
371 | 370 |
((uint16_t*)dst)[i] = (rgb>>11) | ((rgb&0x7C0)>>1) | ((rgb&0x1F)<<10); |
372 | 371 |
} |
... | ... |
@@ -378,8 +372,7 @@ void rgb15tobgr32(const uint8_t *src, uint8_t *dst, long src_size) |
378 | 378 |
uint8_t *d = dst; |
379 | 379 |
const uint16_t *s = (const uint16_t *)src; |
380 | 380 |
end = s + src_size/2; |
381 |
- while (s < end) |
|
382 |
- { |
|
381 |
+ while (s < end) { |
|
383 | 382 |
register uint16_t bgr; |
384 | 383 |
bgr = *s++; |
385 | 384 |
#if HAVE_BIGENDIAN |
... | ... |
@@ -402,8 +395,7 @@ void rgb15to24(const uint8_t *src, uint8_t *dst, long src_size) |
402 | 402 |
uint8_t *d = dst; |
403 | 403 |
const uint16_t *s = (const uint16_t *)src; |
404 | 404 |
end = s + src_size/2; |
405 |
- while (s < end) |
|
406 |
- { |
|
405 |
+ while (s < end) { |
|
407 | 406 |
register uint16_t bgr; |
408 | 407 |
bgr = *s++; |
409 | 408 |
*d++ = (bgr&0x7C00)>>7; |
... | ... |
@@ -417,8 +409,7 @@ void rgb15tobgr16(const uint8_t *src, uint8_t *dst, long src_size) |
417 | 417 |
long i; |
418 | 418 |
long num_pixels = src_size >> 1; |
419 | 419 |
|
420 |
- for (i=0; i<num_pixels; i++) |
|
421 |
- { |
|
420 |
+ for (i=0; i<num_pixels; i++) { |
|
422 | 421 |
unsigned rgb = ((const uint16_t*)src)[i]; |
423 | 422 |
((uint16_t*)dst)[i] = ((rgb&0x7C00)>>10) | ((rgb&0x3E0)<<1) | (rgb<<11); |
424 | 423 |
} |
... | ... |
@@ -429,8 +420,7 @@ void rgb15tobgr15(const uint8_t *src, uint8_t *dst, long src_size) |
429 | 429 |
long i; |
430 | 430 |
long num_pixels = src_size >> 1; |
431 | 431 |
|
432 |
- for (i=0; i<num_pixels; i++) |
|
433 |
- { |
|
432 |
+ for (i=0; i<num_pixels; i++) { |
|
434 | 433 |
unsigned br; |
435 | 434 |
unsigned rgb = ((const uint16_t*)src)[i]; |
436 | 435 |
br = rgb&0x7c1F; |
... | ... |
@@ -442,8 +432,7 @@ void bgr8torgb8(const uint8_t *src, uint8_t *dst, long src_size) |
442 | 442 |
{ |
443 | 443 |
long i; |
444 | 444 |
long num_pixels = src_size; |
445 |
- for (i=0; i<num_pixels; i++) |
|
446 |
- { |
|
445 |
+ for (i=0; i<num_pixels; i++) { |
|
447 | 446 |
unsigned b,g,r; |
448 | 447 |
register uint8_t rgb; |
449 | 448 |
rgb = src[i]; |
... | ... |
@@ -84,8 +84,7 @@ static inline void RENAME(rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long s |
84 | 84 |
__asm__ volatile(PREFETCH" %0"::"m"(*s):"memory"); |
85 | 85 |
mm_end = end - 23; |
86 | 86 |
__asm__ volatile("movq %0, %%mm7"::"m"(mask32a):"memory"); |
87 |
- while (s < mm_end) |
|
88 |
- { |
|
87 |
+ while (s < mm_end) { |
|
89 | 88 |
__asm__ volatile( |
90 | 89 |
PREFETCH" 32%1 \n\t" |
91 | 90 |
"movd %1, %%mm0 \n\t" |
... | ... |
@@ -113,8 +112,7 @@ static inline void RENAME(rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long s |
113 | 113 |
__asm__ volatile(SFENCE:::"memory"); |
114 | 114 |
__asm__ volatile(EMMS:::"memory"); |
115 | 115 |
#endif |
116 |
- while (s < end) |
|
117 |
- { |
|
116 |
+ while (s < end) { |
|
118 | 117 |
#if HAVE_BIGENDIAN |
119 | 118 |
/* RGB24 (= R,G,B) -> RGB32 (= A,B,G,R) */ |
120 | 119 |
*dest++ = 255; |
... | ... |
@@ -143,8 +141,7 @@ static inline void RENAME(rgb32tobgr24)(const uint8_t *src, uint8_t *dst, long s |
143 | 143 |
#if HAVE_MMX |
144 | 144 |
__asm__ volatile(PREFETCH" %0"::"m"(*s):"memory"); |
145 | 145 |
mm_end = end - 31; |
146 |
- while (s < mm_end) |
|
147 |
- { |
|
146 |
+ while (s < mm_end) { |
|
148 | 147 |
__asm__ volatile( |
149 | 148 |
PREFETCH" 32%1 \n\t" |
150 | 149 |
"movq %1, %%mm0 \n\t" |
... | ... |
@@ -199,8 +196,7 @@ static inline void RENAME(rgb32tobgr24)(const uint8_t *src, uint8_t *dst, long s |
199 | 199 |
__asm__ volatile(SFENCE:::"memory"); |
200 | 200 |
__asm__ volatile(EMMS:::"memory"); |
201 | 201 |
#endif |
202 |
- while (s < end) |
|
203 |
- { |
|
202 |
+ while (s < end) { |
|
204 | 203 |
#if HAVE_BIGENDIAN |
205 | 204 |
/* RGB32 (= A,B,G,R) -> RGB24 (= R,G,B) */ |
206 | 205 |
s++; |
... | ... |
@@ -234,8 +230,7 @@ static inline void RENAME(rgb15to16)(const uint8_t *src, uint8_t *dst, long src_ |
234 | 234 |
__asm__ volatile(PREFETCH" %0"::"m"(*s)); |
235 | 235 |
__asm__ volatile("movq %0, %%mm4"::"m"(mask15s)); |
236 | 236 |
mm_end = end - 15; |
237 |
- while (s<mm_end) |
|
238 |
- { |
|
237 |
+ while (s<mm_end) { |
|
239 | 238 |
__asm__ volatile( |
240 | 239 |
PREFETCH" 32%1 \n\t" |
241 | 240 |
"movq %1, %%mm0 \n\t" |
... | ... |
@@ -258,15 +253,13 @@ static inline void RENAME(rgb15to16)(const uint8_t *src, uint8_t *dst, long src_ |
258 | 258 |
__asm__ volatile(EMMS:::"memory"); |
259 | 259 |
#endif |
260 | 260 |
mm_end = end - 3; |
261 |
- while (s < mm_end) |
|
262 |
- { |
|
261 |
+ while (s < mm_end) { |
|
263 | 262 |
register unsigned x= *((const uint32_t *)s); |
264 | 263 |
*((uint32_t *)d) = (x&0x7FFF7FFF) + (x&0x7FE07FE0); |
265 | 264 |
d+=4; |
266 | 265 |
s+=4; |
267 | 266 |
} |
268 |
- if (s < end) |
|
269 |
- { |
|
267 |
+ if (s < end) { |
|
270 | 268 |
register unsigned short x= *((const uint16_t *)s); |
271 | 269 |
*((uint16_t *)d) = (x&0x7FFF) + (x&0x7FE0); |
272 | 270 |
} |
... | ... |
@@ -284,8 +277,7 @@ static inline void RENAME(rgb16to15)(const uint8_t *src, uint8_t *dst, long src_ |
284 | 284 |
__asm__ volatile("movq %0, %%mm7"::"m"(mask15rg)); |
285 | 285 |
__asm__ volatile("movq %0, %%mm6"::"m"(mask15b)); |
286 | 286 |
mm_end = end - 15; |
287 |
- while (s<mm_end) |
|
288 |
- { |
|
287 |
+ while (s<mm_end) { |
|
289 | 288 |
__asm__ volatile( |
290 | 289 |
PREFETCH" 32%1 \n\t" |
291 | 290 |
"movq %1, %%mm0 \n\t" |
... | ... |
@@ -312,15 +304,13 @@ static inline void RENAME(rgb16to15)(const uint8_t *src, uint8_t *dst, long src_ |
312 | 312 |
__asm__ volatile(EMMS:::"memory"); |
313 | 313 |
#endif |
314 | 314 |
mm_end = end - 3; |
315 |
- while (s < mm_end) |
|
316 |
- { |
|
315 |
+ while (s < mm_end) { |
|
317 | 316 |
register uint32_t x= *((const uint32_t*)s); |
318 | 317 |
*((uint32_t *)d) = ((x>>1)&0x7FE07FE0) | (x&0x001F001F); |
319 | 318 |
s+=4; |
320 | 319 |
d+=4; |
321 | 320 |
} |
322 |
- if (s < end) |
|
323 |
- { |
|
321 |
+ if (s < end) { |
|
324 | 322 |
register uint16_t x= *((const uint16_t*)s); |
325 | 323 |
*((uint16_t *)d) = ((x>>1)&0x7FE0) | (x&0x001F); |
326 | 324 |
} |
... | ... |
@@ -378,8 +368,7 @@ static inline void RENAME(rgb32to16)(const uint8_t *src, uint8_t *dst, long src_ |
378 | 378 |
"movq %0, %%mm7 \n\t" |
379 | 379 |
"movq %1, %%mm6 \n\t" |
380 | 380 |
::"m"(red_16mask),"m"(green_16mask)); |
381 |
- while (s < mm_end) |
|
382 |
- { |
|
381 |
+ while (s < mm_end) { |
|
383 | 382 |
__asm__ volatile( |
384 | 383 |
PREFETCH" 32%1 \n\t" |
385 | 384 |
"movd %1, %%mm0 \n\t" |
... | ... |
@@ -417,8 +406,7 @@ static inline void RENAME(rgb32to16)(const uint8_t *src, uint8_t *dst, long src_ |
417 | 417 |
__asm__ volatile(SFENCE:::"memory"); |
418 | 418 |
__asm__ volatile(EMMS:::"memory"); |
419 | 419 |
#endif |
420 |
- while (s < end) |
|
421 |
- { |
|
420 |
+ while (s < end) { |
|
422 | 421 |
register int rgb = *(const uint32_t*)s; s += 4; |
423 | 422 |
*d++ = ((rgb&0xFF)>>3) + ((rgb&0xFC00)>>5) + ((rgb&0xF80000)>>8); |
424 | 423 |
} |
... | ... |
@@ -440,8 +428,7 @@ static inline void RENAME(rgb32tobgr16)(const uint8_t *src, uint8_t *dst, long s |
440 | 440 |
"movq %1, %%mm6 \n\t" |
441 | 441 |
::"m"(red_16mask),"m"(green_16mask)); |
442 | 442 |
mm_end = end - 15; |
443 |
- while (s < mm_end) |
|
444 |
- { |
|
443 |
+ while (s < mm_end) { |
|
445 | 444 |
__asm__ volatile( |
446 | 445 |
PREFETCH" 32%1 \n\t" |
447 | 446 |
"movd %1, %%mm0 \n\t" |
... | ... |
@@ -478,8 +465,7 @@ static inline void RENAME(rgb32tobgr16)(const uint8_t *src, uint8_t *dst, long s |
478 | 478 |
__asm__ volatile(SFENCE:::"memory"); |
479 | 479 |
__asm__ volatile(EMMS:::"memory"); |
480 | 480 |
#endif |
481 |
- while (s < end) |
|
482 |
- { |
|
481 |
+ while (s < end) { |
|
483 | 482 |
register int rgb = *(const uint32_t*)s; s += 4; |
484 | 483 |
*d++ = ((rgb&0xF8)<<8) + ((rgb&0xFC00)>>5) + ((rgb&0xF80000)>>19); |
485 | 484 |
} |
... | ... |
@@ -537,8 +523,7 @@ static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, long src_ |
537 | 537 |
"movq %0, %%mm7 \n\t" |
538 | 538 |
"movq %1, %%mm6 \n\t" |
539 | 539 |
::"m"(red_15mask),"m"(green_15mask)); |
540 |
- while (s < mm_end) |
|
541 |
- { |
|
540 |
+ while (s < mm_end) { |
|
542 | 541 |
__asm__ volatile( |
543 | 542 |
PREFETCH" 32%1 \n\t" |
544 | 543 |
"movd %1, %%mm0 \n\t" |
... | ... |
@@ -576,8 +561,7 @@ static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, long src_ |
576 | 576 |
__asm__ volatile(SFENCE:::"memory"); |
577 | 577 |
__asm__ volatile(EMMS:::"memory"); |
578 | 578 |
#endif |
579 |
- while (s < end) |
|
580 |
- { |
|
579 |
+ while (s < end) { |
|
581 | 580 |
register int rgb = *(const uint32_t*)s; s += 4; |
582 | 581 |
*d++ = ((rgb&0xFF)>>3) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>9); |
583 | 582 |
} |
... | ... |
@@ -599,8 +583,7 @@ static inline void RENAME(rgb32tobgr15)(const uint8_t *src, uint8_t *dst, long s |
599 | 599 |
"movq %1, %%mm6 \n\t" |
600 | 600 |
::"m"(red_15mask),"m"(green_15mask)); |
601 | 601 |
mm_end = end - 15; |
602 |
- while (s < mm_end) |
|
603 |
- { |
|
602 |
+ while (s < mm_end) { |
|
604 | 603 |
__asm__ volatile( |
605 | 604 |
PREFETCH" 32%1 \n\t" |
606 | 605 |
"movd %1, %%mm0 \n\t" |
... | ... |
@@ -637,8 +620,7 @@ static inline void RENAME(rgb32tobgr15)(const uint8_t *src, uint8_t *dst, long s |
637 | 637 |
__asm__ volatile(SFENCE:::"memory"); |
638 | 638 |
__asm__ volatile(EMMS:::"memory"); |
639 | 639 |
#endif |
640 |
- while (s < end) |
|
641 |
- { |
|
640 |
+ while (s < end) { |
|
642 | 641 |
register int rgb = *(const uint32_t*)s; s += 4; |
643 | 642 |
*d++ = ((rgb&0xF8)<<7) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>19); |
644 | 643 |
} |
... | ... |
@@ -660,8 +642,7 @@ static inline void RENAME(rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long s |
660 | 660 |
"movq %1, %%mm6 \n\t" |
661 | 661 |
::"m"(red_16mask),"m"(green_16mask)); |
662 | 662 |
mm_end = end - 11; |
663 |
- while (s < mm_end) |
|
664 |
- { |
|
663 |
+ while (s < mm_end) { |
|
665 | 664 |
__asm__ volatile( |
666 | 665 |
PREFETCH" 32%1 \n\t" |
667 | 666 |
"movd %1, %%mm0 \n\t" |
... | ... |
@@ -698,8 +679,7 @@ static inline void RENAME(rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long s |
698 | 698 |
__asm__ volatile(SFENCE:::"memory"); |
699 | 699 |
__asm__ volatile(EMMS:::"memory"); |
700 | 700 |
#endif |
701 |
- while (s < end) |
|
702 |
- { |
|
701 |
+ while (s < end) { |
|
703 | 702 |
const int b = *s++; |
704 | 703 |
const int g = *s++; |
705 | 704 |
const int r = *s++; |
... | ... |
@@ -723,8 +703,7 @@ static inline void RENAME(rgb24to16)(const uint8_t *src, uint8_t *dst, long src_ |
723 | 723 |
"movq %1, %%mm6 \n\t" |
724 | 724 |
::"m"(red_16mask),"m"(green_16mask)); |
725 | 725 |
mm_end = end - 15; |
726 |
- while (s < mm_end) |
|
727 |
- { |
|
726 |
+ while (s < mm_end) { |
|
728 | 727 |
__asm__ volatile( |
729 | 728 |
PREFETCH" 32%1 \n\t" |
730 | 729 |
"movd %1, %%mm0 \n\t" |
... | ... |
@@ -761,8 +740,7 @@ static inline void RENAME(rgb24to16)(const uint8_t *src, uint8_t *dst, long src_ |
761 | 761 |
__asm__ volatile(SFENCE:::"memory"); |
762 | 762 |
__asm__ volatile(EMMS:::"memory"); |
763 | 763 |
#endif |
764 |
- while (s < end) |
|
765 |
- { |
|
764 |
+ while (s < end) { |
|
766 | 765 |
const int r = *s++; |
767 | 766 |
const int g = *s++; |
768 | 767 |
const int b = *s++; |
... | ... |
@@ -786,8 +764,7 @@ static inline void RENAME(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long s |
786 | 786 |
"movq %1, %%mm6 \n\t" |
787 | 787 |
::"m"(red_15mask),"m"(green_15mask)); |
788 | 788 |
mm_end = end - 11; |
789 |
- while (s < mm_end) |
|
790 |
- { |
|
789 |
+ while (s < mm_end) { |
|
791 | 790 |
__asm__ volatile( |
792 | 791 |
PREFETCH" 32%1 \n\t" |
793 | 792 |
"movd %1, %%mm0 \n\t" |
... | ... |
@@ -824,8 +801,7 @@ static inline void RENAME(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long s |
824 | 824 |
__asm__ volatile(SFENCE:::"memory"); |
825 | 825 |
__asm__ volatile(EMMS:::"memory"); |
826 | 826 |
#endif |
827 |
- while (s < end) |
|
828 |
- { |
|
827 |
+ while (s < end) { |
|
829 | 828 |
const int b = *s++; |
830 | 829 |
const int g = *s++; |
831 | 830 |
const int r = *s++; |
... | ... |
@@ -849,8 +825,7 @@ static inline void RENAME(rgb24to15)(const uint8_t *src, uint8_t *dst, long src_ |
849 | 849 |
"movq %1, %%mm6 \n\t" |
850 | 850 |
::"m"(red_15mask),"m"(green_15mask)); |
851 | 851 |
mm_end = end - 15; |
852 |
- while (s < mm_end) |
|
853 |
- { |
|
852 |
+ while (s < mm_end) { |
|
854 | 853 |
__asm__ volatile( |
855 | 854 |
PREFETCH" 32%1 \n\t" |
856 | 855 |
"movd %1, %%mm0 \n\t" |
... | ... |
@@ -887,8 +862,7 @@ static inline void RENAME(rgb24to15)(const uint8_t *src, uint8_t *dst, long src_ |
887 | 887 |
__asm__ volatile(SFENCE:::"memory"); |
888 | 888 |
__asm__ volatile(EMMS:::"memory"); |
889 | 889 |
#endif |
890 |
- while (s < end) |
|
891 |
- { |
|
890 |
+ while (s < end) { |
|
892 | 891 |
const int r = *s++; |
893 | 892 |
const int g = *s++; |
894 | 893 |
const int b = *s++; |
... | ... |
@@ -929,8 +903,7 @@ static inline void RENAME(rgb15tobgr24)(const uint8_t *src, uint8_t *dst, long s |
929 | 929 |
#if HAVE_MMX |
930 | 930 |
__asm__ volatile(PREFETCH" %0"::"m"(*s):"memory"); |
931 | 931 |
mm_end = end - 7; |
932 |
- while (s < mm_end) |
|
933 |
- { |
|
932 |
+ while (s < mm_end) { |
|
934 | 933 |
__asm__ volatile( |
935 | 934 |
PREFETCH" 32%1 \n\t" |
936 | 935 |
"movq %1, %%mm0 \n\t" |
... | ... |
@@ -1049,8 +1022,7 @@ static inline void RENAME(rgb15tobgr24)(const uint8_t *src, uint8_t *dst, long s |
1049 | 1049 |
__asm__ volatile(SFENCE:::"memory"); |
1050 | 1050 |
__asm__ volatile(EMMS:::"memory"); |
1051 | 1051 |
#endif |
1052 |
- while (s < end) |
|
1053 |
- { |
|
1052 |
+ while (s < end) { |
|
1054 | 1053 |
register uint16_t bgr; |
1055 | 1054 |
bgr = *s++; |
1056 | 1055 |
*d++ = (bgr&0x1F)<<3; |
... | ... |
@@ -1071,8 +1043,7 @@ static inline void RENAME(rgb16tobgr24)(const uint8_t *src, uint8_t *dst, long s |
1071 | 1071 |
#if HAVE_MMX |
1072 | 1072 |
__asm__ volatile(PREFETCH" %0"::"m"(*s):"memory"); |
1073 | 1073 |
mm_end = end - 7; |
1074 |
- while (s < mm_end) |
|
1075 |
- { |
|
1074 |
+ while (s < mm_end) { |
|
1076 | 1075 |
__asm__ volatile( |
1077 | 1076 |
PREFETCH" 32%1 \n\t" |
1078 | 1077 |
"movq %1, %%mm0 \n\t" |
... | ... |
@@ -1190,8 +1161,7 @@ static inline void RENAME(rgb16tobgr24)(const uint8_t *src, uint8_t *dst, long s |
1190 | 1190 |
__asm__ volatile(SFENCE:::"memory"); |
1191 | 1191 |
__asm__ volatile(EMMS:::"memory"); |
1192 | 1192 |
#endif |
1193 |
- while (s < end) |
|
1194 |
- { |
|
1193 |
+ while (s < end) { |
|
1195 | 1194 |
register uint16_t bgr; |
1196 | 1195 |
bgr = *s++; |
1197 | 1196 |
*d++ = (bgr&0x1F)<<3; |
... | ... |
@@ -1233,8 +1203,7 @@ static inline void RENAME(rgb15to32)(const uint8_t *src, uint8_t *dst, long src_ |
1233 | 1233 |
__asm__ volatile("pxor %%mm7,%%mm7 \n\t":::"memory"); |
1234 | 1234 |
__asm__ volatile("pcmpeqd %%mm6,%%mm6 \n\t":::"memory"); |
1235 | 1235 |
mm_end = end - 3; |
1236 |
- while (s < mm_end) |
|
1237 |
- { |
|
1236 |
+ while (s < mm_end) { |
|
1238 | 1237 |
__asm__ volatile( |
1239 | 1238 |
PREFETCH" 32%1 \n\t" |
1240 | 1239 |
"movq %1, %%mm0 \n\t" |
... | ... |
@@ -1256,8 +1225,7 @@ static inline void RENAME(rgb15to32)(const uint8_t *src, uint8_t *dst, long src_ |
1256 | 1256 |
__asm__ volatile(SFENCE:::"memory"); |
1257 | 1257 |
__asm__ volatile(EMMS:::"memory"); |
1258 | 1258 |
#endif |
1259 |
- while (s < end) |
|
1260 |
- { |
|
1259 |
+ while (s < end) { |
|
1261 | 1260 |
register uint16_t bgr; |
1262 | 1261 |
bgr = *s++; |
1263 | 1262 |
#if HAVE_BIGENDIAN |
... | ... |
@@ -1288,8 +1256,7 @@ static inline void RENAME(rgb16to32)(const uint8_t *src, uint8_t *dst, long src_ |
1288 | 1288 |
__asm__ volatile("pxor %%mm7,%%mm7 \n\t":::"memory"); |
1289 | 1289 |
__asm__ volatile("pcmpeqd %%mm6,%%mm6 \n\t":::"memory"); |
1290 | 1290 |
mm_end = end - 3; |
1291 |
- while (s < mm_end) |
|
1292 |
- { |
|
1291 |
+ while (s < mm_end) { |
|
1293 | 1292 |
__asm__ volatile( |
1294 | 1293 |
PREFETCH" 32%1 \n\t" |
1295 | 1294 |
"movq %1, %%mm0 \n\t" |
... | ... |
@@ -1311,8 +1278,7 @@ static inline void RENAME(rgb16to32)(const uint8_t *src, uint8_t *dst, long src_ |
1311 | 1311 |
__asm__ volatile(SFENCE:::"memory"); |
1312 | 1312 |
__asm__ volatile(EMMS:::"memory"); |
1313 | 1313 |
#endif |
1314 |
- while (s < end) |
|
1315 |
- { |
|
1314 |
+ while (s < end) { |
|
1316 | 1315 |
register uint16_t bgr; |
1317 | 1316 |
bgr = *s++; |
1318 | 1317 |
#if HAVE_BIGENDIAN |
... | ... |
@@ -1453,8 +1419,7 @@ static inline void RENAME(rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long s |
1453 | 1453 |
src-= src_size; |
1454 | 1454 |
dst-= src_size; |
1455 | 1455 |
#endif |
1456 |
- for (i=0; i<src_size; i+=3) |
|
1457 |
- { |
|
1456 |
+ for (i=0; i<src_size; i+=3) { |
|
1458 | 1457 |
register uint8_t x; |
1459 | 1458 |
x = src[i + 2]; |
1460 | 1459 |
dst[i + 1] = src[i + 1]; |
... | ... |
@@ -1469,8 +1434,7 @@ static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *u |
1469 | 1469 |
{ |
1470 | 1470 |
long y; |
1471 | 1471 |
const x86_reg chromWidth= width>>1; |
1472 |
- for (y=0; y<height; y++) |
|
1473 |
- { |
|
1472 |
+ for (y=0; y<height; y++) { |
|
1474 | 1473 |
#if HAVE_MMX |
1475 | 1474 |
//FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway) |
1476 | 1475 |
__asm__ volatile( |
... | ... |
@@ -1530,7 +1494,7 @@ static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *u |
1530 | 1530 |
const uint32_t *yc = (uint32_t *) ysrc; |
1531 | 1531 |
const uint32_t *yc2 = (uint32_t *) (ysrc + lumStride); |
1532 | 1532 |
const uint16_t *uc = (uint16_t*) usrc, *vc = (uint16_t*) vsrc; |
1533 |
- for (i = 0; i < chromWidth; i += 8){ |
|
1533 |
+ for (i = 0; i < chromWidth; i += 8) { |
|
1534 | 1534 |
uint64_t y1, y2, yuv1, yuv2; |
1535 | 1535 |
uint64_t u, v; |
1536 | 1536 |
/* Prefetch */ |
... | ... |
@@ -1559,7 +1523,7 @@ static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *u |
1559 | 1559 |
int i; |
1560 | 1560 |
uint64_t *ldst = (uint64_t *) dst; |
1561 | 1561 |
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; |
1562 |
- for (i = 0; i < chromWidth; i += 2){ |
|
1562 |
+ for (i = 0; i < chromWidth; i += 2) { |
|
1563 | 1563 |
uint64_t k, l; |
1564 | 1564 |
k = yc[0] + (uc[0] << 8) + |
1565 | 1565 |
(yc[1] << 16) + (vc[0] << 24); |
... | ... |
@@ -1574,7 +1538,7 @@ static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *u |
1574 | 1574 |
#else |
1575 | 1575 |
int i, *idst = (int32_t *) dst; |
1576 | 1576 |
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; |
1577 |
- for (i = 0; i < chromWidth; i++){ |
|
1577 |
+ for (i = 0; i < chromWidth; i++) { |
|
1578 | 1578 |
#if HAVE_BIGENDIAN |
1579 | 1579 |
*idst++ = (yc[0] << 24)+ (uc[0] << 16) + |
1580 | 1580 |
(yc[1] << 8) + (vc[0] << 0); |
... | ... |
@@ -1588,8 +1552,7 @@ static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *u |
1588 | 1588 |
} |
1589 | 1589 |
#endif |
1590 | 1590 |
#endif |
1591 |
- if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) |
|
1592 |
- { |
|
1591 |
+ if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) { |
|
1593 | 1592 |
usrc += chromStride; |
1594 | 1593 |
vsrc += chromStride; |
1595 | 1594 |
} |
... | ... |
@@ -1621,8 +1584,7 @@ static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *u |
1621 | 1621 |
{ |
1622 | 1622 |
long y; |
1623 | 1623 |
const x86_reg chromWidth= width>>1; |
1624 |
- for (y=0; y<height; y++) |
|
1625 |
- { |
|
1624 |
+ for (y=0; y<height; y++) { |
|
1626 | 1625 |
#if HAVE_MMX |
1627 | 1626 |
//FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway) |
1628 | 1627 |
__asm__ volatile( |
... | ... |
@@ -1665,7 +1627,7 @@ static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *u |
1665 | 1665 |
int i; |
1666 | 1666 |
uint64_t *ldst = (uint64_t *) dst; |
1667 | 1667 |
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; |
1668 |
- for (i = 0; i < chromWidth; i += 2){ |
|
1668 |
+ for (i = 0; i < chromWidth; i += 2) { |
|
1669 | 1669 |
uint64_t k, l; |
1670 | 1670 |
k = uc[0] + (yc[0] << 8) + |
1671 | 1671 |
(vc[0] << 16) + (yc[1] << 24); |
... | ... |
@@ -1680,7 +1642,7 @@ static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *u |
1680 | 1680 |
#else |
1681 | 1681 |
int i, *idst = (int32_t *) dst; |
1682 | 1682 |
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; |
1683 |
- for (i = 0; i < chromWidth; i++){ |
|
1683 |
+ for (i = 0; i < chromWidth; i++) { |
|
1684 | 1684 |
#if HAVE_BIGENDIAN |
1685 | 1685 |
*idst++ = (uc[0] << 24)+ (yc[0] << 16) + |
1686 | 1686 |
(vc[0] << 8) + (yc[1] << 0); |
... | ... |
@@ -1694,8 +1656,7 @@ static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *u |
1694 | 1694 |
} |
1695 | 1695 |
#endif |
1696 | 1696 |
#endif |
1697 |
- if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) |
|
1698 |
- { |
|
1697 |
+ if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) { |
|
1699 | 1698 |
usrc += chromStride; |
1700 | 1699 |
vsrc += chromStride; |
1701 | 1700 |
} |
... | ... |
@@ -1751,8 +1712,7 @@ static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t |
1751 | 1751 |
{ |
1752 | 1752 |
long y; |
1753 | 1753 |
const x86_reg chromWidth= width>>1; |
1754 |
- for (y=0; y<height; y+=2) |
|
1755 |
- { |
|
1754 |
+ for (y=0; y<height; y+=2) { |
|
1756 | 1755 |
#if HAVE_MMX |
1757 | 1756 |
__asm__ volatile( |
1758 | 1757 |
"xor %%"REG_a", %%"REG_a" \n\t" |
... | ... |
@@ -1837,8 +1797,7 @@ static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t |
1837 | 1837 |
); |
1838 | 1838 |
#else |
1839 | 1839 |
long i; |
1840 |
- for (i=0; i<chromWidth; i++) |
|
1841 |
- { |
|
1840 |
+ for (i=0; i<chromWidth; i++) { |
|
1842 | 1841 |
ydst[2*i+0] = src[4*i+0]; |
1843 | 1842 |
udst[i] = src[4*i+1]; |
1844 | 1843 |
ydst[2*i+1] = src[4*i+2]; |
... | ... |
@@ -1847,8 +1806,7 @@ static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t |
1847 | 1847 |
ydst += lumStride; |
1848 | 1848 |
src += srcStride; |
1849 | 1849 |
|
1850 |
- for (i=0; i<chromWidth; i++) |
|
1851 |
- { |
|
1850 |
+ for (i=0; i<chromWidth; i++) { |
|
1852 | 1851 |
ydst[2*i+0] = src[4*i+0]; |
1853 | 1852 |
ydst[2*i+1] = src[4*i+2]; |
1854 | 1853 |
} |
... | ... |
@@ -1882,7 +1840,7 @@ static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWi |
1882 | 1882 |
dst[0]= src[0]; |
1883 | 1883 |
|
1884 | 1884 |
// first line |
1885 |
- for (x=0; x<srcWidth-1; x++){ |
|
1885 |
+ for (x=0; x<srcWidth-1; x++) { |
|
1886 | 1886 |
dst[2*x+1]= (3*src[x] + src[x+1])>>2; |
1887 | 1887 |
dst[2*x+2]= ( src[x] + 3*src[x+1])>>2; |
1888 | 1888 |
} |
... | ... |
@@ -1890,7 +1848,7 @@ static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWi |
1890 | 1890 |
|
1891 | 1891 |
dst+= dstStride; |
1892 | 1892 |
|
1893 |
- for (y=1; y<srcHeight; y++){ |
|
1893 |
+ for (y=1; y<srcHeight; y++) { |
|
1894 | 1894 |
#if HAVE_MMX2 || HAVE_AMD3DNOW |
1895 | 1895 |
const x86_reg mmxSize= srcWidth&~15; |
1896 | 1896 |
__asm__ volatile( |
... | ... |
@@ -1941,7 +1899,7 @@ static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWi |
1941 | 1941 |
dst[0 ]= (3*src[0] + src[srcStride])>>2; |
1942 | 1942 |
dst[dstStride]= ( src[0] + 3*src[srcStride])>>2; |
1943 | 1943 |
|
1944 |
- for (x=mmxSize-1; x<srcWidth-1; x++){ |
|
1944 |
+ for (x=mmxSize-1; x<srcWidth-1; x++) { |
|
1945 | 1945 |
dst[2*x +1]= (3*src[x+0] + src[x+srcStride+1])>>2; |
1946 | 1946 |
dst[2*x+dstStride+2]= ( src[x+0] + 3*src[x+srcStride+1])>>2; |
1947 | 1947 |
dst[2*x+dstStride+1]= ( src[x+1] + 3*src[x+srcStride ])>>2; |
... | ... |
@@ -1958,13 +1916,13 @@ static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWi |
1958 | 1958 |
#if 1 |
1959 | 1959 |
dst[0]= src[0]; |
1960 | 1960 |
|
1961 |
- for (x=0; x<srcWidth-1; x++){ |
|
1961 |
+ for (x=0; x<srcWidth-1; x++) { |
|
1962 | 1962 |
dst[2*x+1]= (3*src[x] + src[x+1])>>2; |
1963 | 1963 |
dst[2*x+2]= ( src[x] + 3*src[x+1])>>2; |
1964 | 1964 |
} |
1965 | 1965 |
dst[2*srcWidth-1]= src[srcWidth-1]; |
1966 | 1966 |
#else |
1967 |
- for (x=0; x<srcWidth; x++){ |
|
1967 |
+ for (x=0; x<srcWidth; x++) { |
|
1968 | 1968 |
dst[2*x+0]= |
1969 | 1969 |
dst[2*x+1]= src[x]; |
1970 | 1970 |
} |
... | ... |
@@ -1989,8 +1947,7 @@ static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t |
1989 | 1989 |
{ |
1990 | 1990 |
long y; |
1991 | 1991 |
const x86_reg chromWidth= width>>1; |
1992 |
- for (y=0; y<height; y+=2) |
|
1993 |
- { |
|
1992 |
+ for (y=0; y<height; y+=2) { |
|
1994 | 1993 |
#if HAVE_MMX |
1995 | 1994 |
__asm__ volatile( |
1996 | 1995 |
"xor %%"REG_a", %%"REG_a" \n\t" |
... | ... |
@@ -2075,8 +2032,7 @@ static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t |
2075 | 2075 |
); |
2076 | 2076 |
#else |
2077 | 2077 |
long i; |
2078 |
- for (i=0; i<chromWidth; i++) |
|
2079 |
- { |
|
2078 |
+ for (i=0; i<chromWidth; i++) { |
|
2080 | 2079 |
udst[i] = src[4*i+0]; |
2081 | 2080 |
ydst[2*i+0] = src[4*i+1]; |
2082 | 2081 |
vdst[i] = src[4*i+2]; |
... | ... |
@@ -2085,8 +2041,7 @@ static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t |
2085 | 2085 |
ydst += lumStride; |
2086 | 2086 |
src += srcStride; |
2087 | 2087 |
|
2088 |
- for (i=0; i<chromWidth; i++) |
|
2089 |
- { |
|
2088 |
+ for (i=0; i<chromWidth; i++) { |
|
2090 | 2089 |
ydst[2*i+0] = src[4*i+1]; |
2091 | 2090 |
ydst[2*i+1] = src[4*i+3]; |
2092 | 2091 |
} |
... | ... |
@@ -2117,11 +2072,9 @@ static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_ |
2117 | 2117 |
long y; |
2118 | 2118 |
const x86_reg chromWidth= width>>1; |
2119 | 2119 |
#if HAVE_MMX |
2120 |
- for (y=0; y<height-2; y+=2) |
|
2121 |
- { |
|
2120 |
+ for (y=0; y<height-2; y+=2) { |
|
2122 | 2121 |
long i; |
2123 |
- for (i=0; i<2; i++) |
|
2124 |
- { |
|
2122 |
+ for (i=0; i<2; i++) { |
|
2125 | 2123 |
__asm__ volatile( |
2126 | 2124 |
"mov %2, %%"REG_a" \n\t" |
2127 | 2125 |
"movq "MANGLE(ff_bgr2YCoeff)", %%mm6 \n\t" |
... | ... |
@@ -2355,11 +2308,9 @@ static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_ |
2355 | 2355 |
#else |
2356 | 2356 |
y=0; |
2357 | 2357 |
#endif |
2358 |
- for (; y<height; y+=2) |
|
2359 |
- { |
|
2358 |
+ for (; y<height; y+=2) { |
|
2360 | 2359 |
long i; |
2361 |
- for (i=0; i<chromWidth; i++) |
|
2362 |
- { |
|
2360 |
+ for (i=0; i<chromWidth; i++) { |
|
2363 | 2361 |
unsigned int b = src[6*i+0]; |
2364 | 2362 |
unsigned int g = src[6*i+1]; |
2365 | 2363 |
unsigned int r = src[6*i+2]; |
... | ... |
@@ -2382,8 +2333,7 @@ static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_ |
2382 | 2382 |
ydst += lumStride; |
2383 | 2383 |
src += srcStride; |
2384 | 2384 |
|
2385 |
- for (i=0; i<chromWidth; i++) |
|
2386 |
- { |
|
2385 |
+ for (i=0; i<chromWidth; i++) { |
|
2387 | 2386 |
unsigned int b = src[6*i+0]; |
2388 | 2387 |
unsigned int g = src[6*i+1]; |
2389 | 2388 |
unsigned int r = src[6*i+2]; |
... | ... |
@@ -2408,11 +2358,11 @@ static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_ |
2408 | 2408 |
|
2409 | 2409 |
static void RENAME(interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dest, |
2410 | 2410 |
long width, long height, long src1Stride, |
2411 |
- long src2Stride, long dstStride){ |
|
2411 |
+ long src2Stride, long dstStride) |
|
2412 |
+{ |
|
2412 | 2413 |
long h; |
2413 | 2414 |
|
2414 |
- for (h=0; h < height; h++) |
|
2415 |
- { |
|
2415 |
+ for (h=0; h < height; h++) { |
|
2416 | 2416 |
long w; |
2417 | 2417 |
|
2418 | 2418 |
#if HAVE_MMX |
... | ... |
@@ -2462,14 +2412,12 @@ static void RENAME(interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dest, |
2462 | 2462 |
: "memory", "%"REG_a |
2463 | 2463 |
); |
2464 | 2464 |
#endif |
2465 |
- for (w= (width&(~15)); w < width; w++) |
|
2466 |
- { |
|
2465 |
+ for (w= (width&(~15)); w < width; w++) { |
|
2467 | 2466 |
dest[2*w+0] = src1[w]; |
2468 | 2467 |
dest[2*w+1] = src2[w]; |
2469 | 2468 |
} |
2470 | 2469 |
#else |
2471 |
- for (w=0; w < width; w++) |
|
2472 |
- { |
|
2470 |
+ for (w=0; w < width; w++) { |
|
2473 | 2471 |
dest[2*w+0] = src1[w]; |
2474 | 2472 |
dest[2*w+1] = src2[w]; |
2475 | 2473 |
} |
... | ... |
@@ -2502,13 +2450,12 @@ static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2, |
2502 | 2502 |
PREFETCH" %1 \n\t" |
2503 | 2503 |
::"m"(*(src1+srcStride1)),"m"(*(src2+srcStride2)):"memory"); |
2504 | 2504 |
#endif |
2505 |
- for (y=0;y<h;y++){ |
|
2505 |
+ for (y=0;y<h;y++) { |
|
2506 | 2506 |
const uint8_t* s1=src1+srcStride1*(y>>1); |
2507 | 2507 |
uint8_t* d=dst1+dstStride1*y; |
2508 | 2508 |
x=0; |
2509 | 2509 |
#if HAVE_MMX |
2510 |
- for (;x<w-31;x+=32) |
|
2511 |
- { |
|
2510 |
+ for (;x<w-31;x+=32) { |
|
2512 | 2511 |
__asm__ volatile( |
2513 | 2512 |
PREFETCH" 32%1 \n\t" |
2514 | 2513 |
"movq %1, %%mm0 \n\t" |
... | ... |
@@ -2542,13 +2489,12 @@ static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2, |
2542 | 2542 |
#endif |
2543 | 2543 |
for (;x<w;x++) d[2*x]=d[2*x+1]=s1[x]; |
2544 | 2544 |
} |
2545 |
- for (y=0;y<h;y++){ |
|
2545 |
+ for (y=0;y<h;y++) { |
|
2546 | 2546 |
const uint8_t* s2=src2+srcStride2*(y>>1); |
2547 | 2547 |
uint8_t* d=dst2+dstStride2*y; |
2548 | 2548 |
x=0; |
2549 | 2549 |
#if HAVE_MMX |
2550 |
- for (;x<w-31;x+=32) |
|
2551 |
- { |
|
2550 |
+ for (;x<w-31;x+=32) { |
|
2552 | 2551 |
__asm__ volatile( |
2553 | 2552 |
PREFETCH" 32%1 \n\t" |
2554 | 2553 |
"movq %1, %%mm0 \n\t" |
... | ... |
@@ -2600,15 +2546,14 @@ static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2 |
2600 | 2600 |
x86_reg x; |
2601 | 2601 |
long y,w,h; |
2602 | 2602 |
w=width/2; h=height; |
2603 |
- for (y=0;y<h;y++){ |
|
2603 |
+ for (y=0;y<h;y++) { |
|
2604 | 2604 |
const uint8_t* yp=src1+srcStride1*y; |
2605 | 2605 |
const uint8_t* up=src2+srcStride2*(y>>2); |
2606 | 2606 |
const uint8_t* vp=src3+srcStride3*(y>>2); |
2607 | 2607 |
uint8_t* d=dst+dstStride*y; |
2608 | 2608 |
x=0; |
2609 | 2609 |
#if HAVE_MMX |
2610 |
- for (;x<w-7;x+=8) |
|
2611 |
- { |
|
2610 |
+ for (;x<w-7;x+=8) { |
|
2612 | 2611 |
__asm__ volatile( |
2613 | 2612 |
PREFETCH" 32(%1, %0) \n\t" |
2614 | 2613 |
PREFETCH" 32(%2, %0) \n\t" |
... | ... |
@@ -2661,8 +2606,7 @@ static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2 |
2661 | 2661 |
:"memory"); |
2662 | 2662 |
} |
2663 | 2663 |
#endif |
2664 |
- for (; x<w; x++) |
|
2665 |
- { |
|
2664 |
+ for (; x<w; x++) { |
|
2666 | 2665 |
const long x2 = x<<2; |
2667 | 2666 |
d[8*x+0] = yp[x2]; |
2668 | 2667 |
d[8*x+1] = up[x]; |
... | ... |
@@ -2690,7 +2634,7 @@ static void RENAME(extract_even)(const uint8_t *src, uint8_t *dst, x86_reg count |
2690 | 2690 |
count= - count; |
2691 | 2691 |
|
2692 | 2692 |
#if HAVE_MMX |
2693 |
- if(count <= -16){ |
|
2693 |
+ if(count <= -16) { |
|
2694 | 2694 |
count += 15; |
2695 | 2695 |
__asm__ volatile( |
2696 | 2696 |
"pcmpeqw %%mm7, %%mm7 \n\t" |
... | ... |
@@ -2716,7 +2660,7 @@ static void RENAME(extract_even)(const uint8_t *src, uint8_t *dst, x86_reg count |
2716 | 2716 |
count -= 15; |
2717 | 2717 |
} |
2718 | 2718 |
#endif |
2719 |
- while(count<0){ |
|
2719 |
+ while(count<0) { |
|
2720 | 2720 |
dst[count]= src[2*count]; |
2721 | 2721 |
count++; |
2722 | 2722 |
} |
... | ... |
@@ -2729,7 +2673,7 @@ static void RENAME(extract_even2)(const uint8_t *src, uint8_t *dst0, uint8_t *ds |
2729 | 2729 |
src += 4*count; |
2730 | 2730 |
count= - count; |
2731 | 2731 |
#if HAVE_MMX |
2732 |
- if(count <= -8){ |
|
2732 |
+ if(count <= -8) { |
|
2733 | 2733 |
count += 7; |
2734 | 2734 |
__asm__ volatile( |
2735 | 2735 |
"pcmpeqw %%mm7, %%mm7 \n\t" |
... | ... |
@@ -2763,7 +2707,7 @@ static void RENAME(extract_even2)(const uint8_t *src, uint8_t *dst0, uint8_t *ds |
2763 | 2763 |
count -= 7; |
2764 | 2764 |
} |
2765 | 2765 |
#endif |
2766 |
- while(count<0){ |
|
2766 |
+ while(count<0) { |
|
2767 | 2767 |
dst0[count]= src[4*count+0]; |
2768 | 2768 |
dst1[count]= src[4*count+2]; |
2769 | 2769 |
count++; |
... | ... |
@@ -2778,7 +2722,7 @@ static void RENAME(extract_even2avg)(const uint8_t *src0, const uint8_t *src1, u |
2778 | 2778 |
src1 += 4*count; |
2779 | 2779 |
count= - count; |
2780 | 2780 |
#ifdef PAVGB |
2781 |
- if(count <= -8){ |
|
2781 |
+ if(count <= -8) { |
|
2782 | 2782 |
count += 7; |
2783 | 2783 |
__asm__ volatile( |
2784 | 2784 |
"pcmpeqw %%mm7, %%mm7 \n\t" |
... | ... |
@@ -2816,7 +2760,7 @@ static void RENAME(extract_even2avg)(const uint8_t *src0, const uint8_t *src1, u |
2816 | 2816 |
count -= 7; |
2817 | 2817 |
} |
2818 | 2818 |
#endif |
2819 |
- while(count<0){ |
|
2819 |
+ while(count<0) { |
|
2820 | 2820 |
dst0[count]= (src0[4*count+0]+src1[4*count+0])>>1; |
2821 | 2821 |
dst1[count]= (src0[4*count+2]+src1[4*count+2])>>1; |
2822 | 2822 |
count++; |
... | ... |
@@ -2830,7 +2774,7 @@ static void RENAME(extract_odd2)(const uint8_t *src, uint8_t *dst0, uint8_t *dst |
2830 | 2830 |
src += 4*count; |
2831 | 2831 |
count= - count; |
2832 | 2832 |
#if HAVE_MMX |
2833 |
- if(count <= -8){ |
|
2833 |
+ if(count <= -8) { |
|
2834 | 2834 |
count += 7; |
2835 | 2835 |
__asm__ volatile( |
2836 | 2836 |
"pcmpeqw %%mm7, %%mm7 \n\t" |
... | ... |
@@ -2865,7 +2809,7 @@ static void RENAME(extract_odd2)(const uint8_t *src, uint8_t *dst0, uint8_t *dst |
2865 | 2865 |
} |
2866 | 2866 |
#endif |
2867 | 2867 |
src++; |
2868 |
- while(count<0){ |
|
2868 |
+ while(count<0) { |
|
2869 | 2869 |
dst0[count]= src[4*count+0]; |
2870 | 2870 |
dst1[count]= src[4*count+2]; |
2871 | 2871 |
count++; |
... | ... |
@@ -2880,7 +2824,7 @@ static void RENAME(extract_odd2avg)(const uint8_t *src0, const uint8_t *src1, ui |
2880 | 2880 |
src1 += 4*count; |
2881 | 2881 |
count= - count; |
2882 | 2882 |
#ifdef PAVGB |
2883 |
- if(count <= -8){ |
|
2883 |
+ if(count <= -8) { |
|
2884 | 2884 |
count += 7; |
2885 | 2885 |
__asm__ volatile( |
2886 | 2886 |
"pcmpeqw %%mm7, %%mm7 \n\t" |
... | ... |
@@ -2920,7 +2864,7 @@ static void RENAME(extract_odd2avg)(const uint8_t *src0, const uint8_t *src1, ui |
2920 | 2920 |
#endif |
2921 | 2921 |
src0++; |
2922 | 2922 |
src1++; |
2923 |
- while(count<0){ |
|
2923 |
+ while(count<0) { |
|
2924 | 2924 |
dst0[count]= (src0[4*count+0]+src1[4*count+0])>>1; |
2925 | 2925 |
dst1[count]= (src0[4*count+2]+src1[4*count+2])>>1; |
2926 | 2926 |
count++; |
... | ... |
@@ -2934,9 +2878,9 @@ static void RENAME(yuyvtoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, co |
2934 | 2934 |
long y; |
2935 | 2935 |
const long chromWidth= -((-width)>>1); |
2936 | 2936 |
|
2937 |
- for (y=0; y<height; y++){ |
|
2937 |
+ for (y=0; y<height; y++) { |
|
2938 | 2938 |
RENAME(extract_even)(src, ydst, width); |
2939 |
- if(y&1){ |
|
2939 |
+ if(y&1) { |
|
2940 | 2940 |
RENAME(extract_odd2avg)(src-srcStride, src, udst, vdst, chromWidth); |
2941 | 2941 |
udst+= chromStride; |
2942 | 2942 |
vdst+= chromStride; |
... | ... |
@@ -2961,7 +2905,7 @@ static void RENAME(yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, co |
2961 | 2961 |
long y; |
2962 | 2962 |
const long chromWidth= -((-width)>>1); |
2963 | 2963 |
|
2964 |
- for (y=0; y<height; y++){ |
|
2964 |
+ for (y=0; y<height; y++) { |
|
2965 | 2965 |
RENAME(extract_even)(src, ydst, width); |
2966 | 2966 |
RENAME(extract_odd2)(src, udst, vdst, chromWidth); |
2967 | 2967 |
|
... | ... |
@@ -2986,9 +2930,9 @@ static void RENAME(uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, co |
2986 | 2986 |
long y; |
2987 | 2987 |
const long chromWidth= -((-width)>>1); |
2988 | 2988 |
|
2989 |
- for (y=0; y<height; y++){ |
|
2989 |
+ for (y=0; y<height; y++) { |
|
2990 | 2990 |
RENAME(extract_even)(src+1, ydst, width); |
2991 |
- if(y&1){ |
|
2991 |
+ if(y&1) { |
|
2992 | 2992 |
RENAME(extract_even2avg)(src-srcStride, src, udst, vdst, chromWidth); |
2993 | 2993 |
udst+= chromStride; |
2994 | 2994 |
vdst+= chromStride; |
... | ... |
@@ -3013,7 +2957,7 @@ static void RENAME(uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, co |
3013 | 3013 |
long y; |
3014 | 3014 |
const long chromWidth= -((-width)>>1); |
3015 | 3015 |
|
3016 |
- for (y=0; y<height; y++){ |
|
3016 |
+ for (y=0; y<height; y++) { |
|
3017 | 3017 |
RENAME(extract_even)(src+1, ydst, width); |
3018 | 3018 |
RENAME(extract_even2)(src, udst, vdst, chromWidth); |
3019 | 3019 |
|
... | ... |
@@ -3031,7 +2975,8 @@ static void RENAME(uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, co |
3031 | 3031 |
#endif |
3032 | 3032 |
} |
3033 | 3033 |
|
3034 |
-static inline void RENAME(rgb2rgb_init)(void){ |
|
3034 |
+static inline void RENAME(rgb2rgb_init)(void) |
|
3035 |
+{ |
|
3035 | 3036 |
rgb15to16 = RENAME(rgb15to16); |
3036 | 3037 |
rgb15tobgr24 = RENAME(rgb15tobgr24); |
3037 | 3038 |
rgb15to32 = RENAME(rgb15to32); |
... | ... |
@@ -82,7 +82,8 @@ |
82 | 82 |
|
83 | 83 |
// FIXME: must be changed to set alpha to 255 instead of 0 |
84 | 84 |
static int vis_420P_ARGB32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
85 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){ |
|
85 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
86 |
+{ |
|
86 | 87 |
int y, out1, out2, out3, out4, out5, out6; |
87 | 88 |
|
88 | 89 |
for(y=0;y < srcSliceH;++y) { |
... | ... |
@@ -134,7 +135,8 @@ static int vis_420P_ARGB32(SwsContext *c, uint8_t* src[], int srcStride[], int s |
134 | 134 |
|
135 | 135 |
// FIXME: must be changed to set alpha to 255 instead of 0 |
136 | 136 |
static int vis_422P_ARGB32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
137 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){ |
|
137 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
138 |
+{ |
|
138 | 139 |
int y, out1, out2, out3, out4, out5, out6; |
139 | 140 |
|
140 | 141 |
for(y=0;y < srcSliceH;++y) { |
... | ... |
@@ -184,7 +186,8 @@ static int vis_422P_ARGB32(SwsContext *c, uint8_t* src[], int srcStride[], int s |
184 | 184 |
return srcSliceH; |
185 | 185 |
} |
186 | 186 |
|
187 |
-SwsFunc ff_yuv2rgb_init_vis(SwsContext *c){ |
|
187 |
+SwsFunc ff_yuv2rgb_init_vis(SwsContext *c) |
|
188 |
+{ |
|
188 | 189 |
c->sparc_coeffs[5]=c->yCoeff; |
189 | 190 |
c->sparc_coeffs[6]=c->vgCoeff; |
190 | 191 |
c->sparc_coeffs[7]=c->vrCoeff; |
... | ... |
@@ -50,14 +50,15 @@ const char *sws_format_name(enum PixelFormat format); |
50 | 50 |
|| (x)==PIX_FMT_YUVA420P \ |
51 | 51 |
) |
52 | 52 |
|
53 |
-static uint64_t getSSD(uint8_t *src1, uint8_t *src2, int stride1, int stride2, int w, int h){ |
|
53 |
+static uint64_t getSSD(uint8_t *src1, uint8_t *src2, int stride1, int stride2, int w, int h) |
|
54 |
+{ |
|
54 | 55 |
int x,y; |
55 | 56 |
uint64_t ssd=0; |
56 | 57 |
|
57 | 58 |
//printf("%d %d\n", w, h); |
58 | 59 |
|
59 |
- for (y=0; y<h; y++){ |
|
60 |
- for (x=0; x<w; x++){ |
|
60 |
+ for (y=0; y<h; y++) { |
|
61 |
+ for (x=0; x<w; x++) { |
|
61 | 62 |
int d= src1[x + y*stride1] - src2[x + y*stride2]; |
62 | 63 |
ssd+= d*d; |
63 | 64 |
//printf("%d", abs(src1[x + y*stride1] - src2[x + y*stride2])/26 ); |
... | ... |
@@ -70,7 +71,8 @@ static uint64_t getSSD(uint8_t *src1, uint8_t *src2, int stride1, int stride2, i |
70 | 70 |
// test by ref -> src -> dst -> out & compare out against ref |
71 | 71 |
// ref & out are YV12 |
72 | 72 |
static int doTest(uint8_t *ref[4], int refStride[4], int w, int h, int srcFormat, int dstFormat, |
73 |
- int srcW, int srcH, int dstW, int dstH, int flags){ |
|
73 |
+ int srcW, int srcH, int dstW, int dstH, int flags) |
|
74 |
+{ |
|
74 | 75 |
uint8_t *src[4] = {0}; |
75 | 76 |
uint8_t *dst[4] = {0}; |
76 | 77 |
uint8_t *out[4] = {0}; |
... | ... |
@@ -82,7 +84,7 @@ static int doTest(uint8_t *ref[4], int refStride[4], int w, int h, int srcFormat |
82 | 82 |
int res; |
83 | 83 |
|
84 | 84 |
res = 0; |
85 |
- for (i=0; i<4; i++){ |
|
85 |
+ for (i=0; i<4; i++) { |
|
86 | 86 |
// avoid stride % bpp != 0 |
87 | 87 |
if (srcFormat==PIX_FMT_RGB24 || srcFormat==PIX_FMT_BGR24) |
88 | 88 |
srcStride[i]= srcW*3; |
... | ... |
@@ -169,7 +171,7 @@ static int doTest(uint8_t *ref[4], int refStride[4], int w, int h, int srcFormat |
169 | 169 |
sws_freeContext(dstContext); |
170 | 170 |
sws_freeContext(outContext); |
171 | 171 |
|
172 |
- for (i=0; i<4; i++){ |
|
172 |
+ for (i=0; i<4; i++) { |
|
173 | 173 |
free(src[i]); |
174 | 174 |
free(dst[i]); |
175 | 175 |
free(out[i]); |
... | ... |
@@ -178,7 +180,8 @@ static int doTest(uint8_t *ref[4], int refStride[4], int w, int h, int srcFormat |
178 | 178 |
return res; |
179 | 179 |
} |
180 | 180 |
|
181 |
-static void selfTest(uint8_t *src[4], int stride[4], int w, int h){ |
|
181 |
+static void selfTest(uint8_t *src[4], int stride[4], int w, int h) |
|
182 |
+{ |
|
182 | 183 |
enum PixelFormat srcFormat, dstFormat; |
183 | 184 |
int srcW, srcH, dstW, dstH; |
184 | 185 |
int flags; |
... | ... |
@@ -206,7 +209,8 @@ static void selfTest(uint8_t *src[4], int stride[4], int w, int h){ |
206 | 206 |
#define W 96 |
207 | 207 |
#define H 96 |
208 | 208 |
|
209 |
-int main(int argc, char **argv){ |
|
209 |
+int main(int argc, char **argv) |
|
210 |
+{ |
|
210 | 211 |
uint8_t *rgb_data = malloc (W*H*4); |
211 | 212 |
uint8_t *rgb_src[3]= {rgb_data, NULL, NULL}; |
212 | 213 |
int rgb_stride[3]={4*W, 0, 0}; |
... | ... |
@@ -221,8 +225,8 @@ int main(int argc, char **argv){ |
221 | 221 |
|
222 | 222 |
av_lfg_init(&rand, 1); |
223 | 223 |
|
224 |
- for (y=0; y<H; y++){ |
|
225 |
- for (x=0; x<W*4; x++){ |
|
224 |
+ for (y=0; y<H; y++) { |
|
225 |
+ for (x=0; x<W*4; x++) { |
|
226 | 226 |
rgb_data[ x + y*4*W]= av_lfg_get(&rand); |
227 | 227 |
} |
228 | 228 |
} |
... | ... |
@@ -561,8 +561,7 @@ static inline void yuv2yuvXinC(const int16_t *lumFilter, const int16_t **lumSrc, |
561 | 561 |
{ |
562 | 562 |
//FIXME Optimize (just quickly written not optimized..) |
563 | 563 |
int i; |
564 |
- for (i=0; i<dstW; i++) |
|
565 |
- { |
|
564 |
+ for (i=0; i<dstW; i++) { |
|
566 | 565 |
int val=1<<18; |
567 | 566 |
int j; |
568 | 567 |
for (j=0; j<lumFilterSize; j++) |
... | ... |
@@ -572,13 +571,11 @@ static inline void yuv2yuvXinC(const int16_t *lumFilter, const int16_t **lumSrc, |
572 | 572 |
} |
573 | 573 |
|
574 | 574 |
if (uDest) |
575 |
- for (i=0; i<chrDstW; i++) |
|
576 |
- { |
|
575 |
+ for (i=0; i<chrDstW; i++) { |
|
577 | 576 |
int u=1<<18; |
578 | 577 |
int v=1<<18; |
579 | 578 |
int j; |
580 |
- for (j=0; j<chrFilterSize; j++) |
|
581 |
- { |
|
579 |
+ for (j=0; j<chrFilterSize; j++) { |
|
582 | 580 |
u += chrSrc[j][i] * chrFilter[j]; |
583 | 581 |
v += chrSrc[j][i + VOFW] * chrFilter[j]; |
584 | 582 |
} |
... | ... |
@@ -588,7 +585,7 @@ static inline void yuv2yuvXinC(const int16_t *lumFilter, const int16_t **lumSrc, |
588 | 588 |
} |
589 | 589 |
|
590 | 590 |
if (CONFIG_SWSCALE_ALPHA && aDest) |
591 |
- for (i=0; i<dstW; i++){ |
|
591 |
+ for (i=0; i<dstW; i++) { |
|
592 | 592 |
int val=1<<18; |
593 | 593 |
int j; |
594 | 594 |
for (j=0; j<lumFilterSize; j++) |
... | ... |
@@ -605,8 +602,7 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
605 | 605 |
{ |
606 | 606 |
//FIXME Optimize (just quickly written not optimized..) |
607 | 607 |
int i; |
608 |
- for (i=0; i<dstW; i++) |
|
609 |
- { |
|
608 |
+ for (i=0; i<dstW; i++) { |
|
610 | 609 |
int val=1<<18; |
611 | 610 |
int j; |
612 | 611 |
for (j=0; j<lumFilterSize; j++) |
... | ... |
@@ -619,13 +615,11 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
619 | 619 |
return; |
620 | 620 |
|
621 | 621 |
if (dstFormat == PIX_FMT_NV12) |
622 |
- for (i=0; i<chrDstW; i++) |
|
623 |
- { |
|
622 |
+ for (i=0; i<chrDstW; i++) { |
|
624 | 623 |
int u=1<<18; |
625 | 624 |
int v=1<<18; |
626 | 625 |
int j; |
627 |
- for (j=0; j<chrFilterSize; j++) |
|
628 |
- { |
|
626 |
+ for (j=0; j<chrFilterSize; j++) { |
|
629 | 627 |
u += chrSrc[j][i] * chrFilter[j]; |
630 | 628 |
v += chrSrc[j][i + VOFW] * chrFilter[j]; |
631 | 629 |
} |
... | ... |
@@ -634,13 +628,11 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
634 | 634 |
uDest[2*i+1]= av_clip_uint8(v>>19); |
635 | 635 |
} |
636 | 636 |
else |
637 |
- for (i=0; i<chrDstW; i++) |
|
638 |
- { |
|
637 |
+ for (i=0; i<chrDstW; i++) { |
|
639 | 638 |
int u=1<<18; |
640 | 639 |
int v=1<<18; |
641 | 640 |
int j; |
642 |
- for (j=0; j<chrFilterSize; j++) |
|
643 |
- { |
|
641 |
+ for (j=0; j<chrFilterSize; j++) { |
|
644 | 642 |
u += chrSrc[j][i] * chrFilter[j]; |
645 | 643 |
v += chrSrc[j][i + VOFW] * chrFilter[j]; |
646 | 644 |
} |
... | ... |
@@ -651,7 +643,7 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
651 | 651 |
} |
652 | 652 |
|
653 | 653 |
#define YSCALE_YUV_2_PACKEDX_NOCLIP_C(type,alpha) \ |
654 |
- for (i=0; i<(dstW>>1); i++){\ |
|
654 |
+ for (i=0; i<(dstW>>1); i++) {\ |
|
655 | 655 |
int j;\ |
656 | 656 |
int Y1 = 1<<18;\ |
657 | 657 |
int Y2 = 1<<18;\ |
... | ... |
@@ -661,13 +653,11 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
661 | 661 |
type av_unused *r, *b, *g;\ |
662 | 662 |
const int i2= 2*i;\ |
663 | 663 |
\ |
664 |
- for (j=0; j<lumFilterSize; j++)\ |
|
665 |
- {\ |
|
664 |
+ for (j=0; j<lumFilterSize; j++) {\ |
|
666 | 665 |
Y1 += lumSrc[j][i2] * lumFilter[j];\ |
667 | 666 |
Y2 += lumSrc[j][i2+1] * lumFilter[j];\ |
668 | 667 |
}\ |
669 |
- for (j=0; j<chrFilterSize; j++)\ |
|
670 |
- {\ |
|
668 |
+ for (j=0; j<chrFilterSize; j++) {\ |
|
671 | 669 |
U += chrSrc[j][i] * chrFilter[j];\ |
672 | 670 |
V += chrSrc[j][i+VOFW] * chrFilter[j];\ |
673 | 671 |
}\ |
... | ... |
@@ -675,10 +665,10 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
675 | 675 |
Y2>>=19;\ |
676 | 676 |
U >>=19;\ |
677 | 677 |
V >>=19;\ |
678 |
- if (alpha){\ |
|
678 |
+ if (alpha) {\ |
|
679 | 679 |
A1 = 1<<18;\ |
680 | 680 |
A2 = 1<<18;\ |
681 |
- for (j=0; j<lumFilterSize; j++){\ |
|
681 |
+ for (j=0; j<lumFilterSize; j++) {\ |
|
682 | 682 |
A1 += alpSrc[j][i2 ] * lumFilter[j];\ |
683 | 683 |
A2 += alpSrc[j][i2+1] * lumFilter[j];\ |
684 | 684 |
}\ |
... | ... |
@@ -688,8 +678,7 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
688 | 688 |
|
689 | 689 |
#define YSCALE_YUV_2_PACKEDX_C(type,alpha) \ |
690 | 690 |
YSCALE_YUV_2_PACKEDX_NOCLIP_C(type,alpha)\ |
691 |
- if ((Y1|Y2|U|V)&256)\ |
|
692 |
- {\ |
|
691 |
+ if ((Y1|Y2|U|V)&256) {\ |
|
693 | 692 |
if (Y1>255) Y1=255; \ |
694 | 693 |
else if (Y1<0)Y1=0; \ |
695 | 694 |
if (Y2>255) Y2=255; \ |
... | ... |
@@ -699,13 +688,13 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
699 | 699 |
if (V>255) V=255; \ |
700 | 700 |
else if (V<0) V=0; \ |
701 | 701 |
}\ |
702 |
- if (alpha && ((A1|A2)&256)){\ |
|
702 |
+ if (alpha && ((A1|A2)&256)) {\ |
|
703 | 703 |
A1=av_clip_uint8(A1);\ |
704 | 704 |
A2=av_clip_uint8(A2);\ |
705 | 705 |
} |
706 | 706 |
|
707 | 707 |
#define YSCALE_YUV_2_PACKEDX_FULL_C(rnd,alpha) \ |
708 |
- for (i=0; i<dstW; i++){\ |
|
708 |
+ for (i=0; i<dstW; i++) {\ |
|
709 | 709 |
int j;\ |
710 | 710 |
int Y = 0;\ |
711 | 711 |
int U = -128<<19;\ |
... | ... |
@@ -713,17 +702,17 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
713 | 713 |
int av_unused A;\ |
714 | 714 |
int R,G,B;\ |
715 | 715 |
\ |
716 |
- for (j=0; j<lumFilterSize; j++){\ |
|
716 |
+ for (j=0; j<lumFilterSize; j++) {\ |
|
717 | 717 |
Y += lumSrc[j][i ] * lumFilter[j];\ |
718 | 718 |
}\ |
719 |
- for (j=0; j<chrFilterSize; j++){\ |
|
719 |
+ for (j=0; j<chrFilterSize; j++) {\ |
|
720 | 720 |
U += chrSrc[j][i ] * chrFilter[j];\ |
721 | 721 |
V += chrSrc[j][i+VOFW] * chrFilter[j];\ |
722 | 722 |
}\ |
723 | 723 |
Y >>=10;\ |
724 | 724 |
U >>=10;\ |
725 | 725 |
V >>=10;\ |
726 |
- if (alpha){\ |
|
726 |
+ if (alpha) {\ |
|
727 | 727 |
A = rnd;\ |
728 | 728 |
for (j=0; j<lumFilterSize; j++)\ |
729 | 729 |
A += alpSrc[j][i ] * lumFilter[j];\ |
... | ... |
@@ -740,7 +729,7 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
740 | 740 |
R= Y + V*c->yuv2rgb_v2r_coeff;\ |
741 | 741 |
G= Y + V*c->yuv2rgb_v2g_coeff + U*c->yuv2rgb_u2g_coeff;\ |
742 | 742 |
B= Y + U*c->yuv2rgb_u2b_coeff;\ |
743 |
- if ((R|G|B)&(0xC0000000)){\ |
|
743 |
+ if ((R|G|B)&(0xC0000000)) {\ |
|
744 | 744 |
if (R>=(256<<22)) R=(256<<22)-1; \ |
745 | 745 |
else if (R<0)R=0; \ |
746 | 746 |
if (G>=(256<<22)) G=(256<<22)-1; \ |
... | ... |
@@ -751,7 +740,7 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
751 | 751 |
|
752 | 752 |
|
753 | 753 |
#define YSCALE_YUV_2_GRAY16_C \ |
754 |
- for (i=0; i<(dstW>>1); i++){\ |
|
754 |
+ for (i=0; i<(dstW>>1); i++) {\ |
|
755 | 755 |
int j;\ |
756 | 756 |
int Y1 = 1<<18;\ |
757 | 757 |
int Y2 = 1<<18;\ |
... | ... |
@@ -760,15 +749,13 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
760 | 760 |
\ |
761 | 761 |
const int i2= 2*i;\ |
762 | 762 |
\ |
763 |
- for (j=0; j<lumFilterSize; j++)\ |
|
764 |
- {\ |
|
763 |
+ for (j=0; j<lumFilterSize; j++) {\ |
|
765 | 764 |
Y1 += lumSrc[j][i2] * lumFilter[j];\ |
766 | 765 |
Y2 += lumSrc[j][i2+1] * lumFilter[j];\ |
767 | 766 |
}\ |
768 | 767 |
Y1>>=11;\ |
769 | 768 |
Y2>>=11;\ |
770 |
- if ((Y1|Y2|U|V)&65536)\ |
|
771 |
- {\ |
|
769 |
+ if ((Y1|Y2|U|V)&65536) {\ |
|
772 | 770 |
if (Y1>65535) Y1=65535; \ |
773 | 771 |
else if (Y1<0)Y1=0; \ |
774 | 772 |
if (Y2>65535) Y2=65535; \ |
... | ... |
@@ -782,7 +769,7 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
782 | 782 |
b = (type *)c->table_bU[U]; \ |
783 | 783 |
|
784 | 784 |
#define YSCALE_YUV_2_PACKED2_C(type,alpha) \ |
785 |
- for (i=0; i<(dstW>>1); i++){ \ |
|
785 |
+ for (i=0; i<(dstW>>1); i++) { \ |
|
786 | 786 |
const int i2= 2*i; \ |
787 | 787 |
int Y1= (buf0[i2 ]*yalpha1+buf1[i2 ]*yalpha)>>19; \ |
788 | 788 |
int Y2= (buf0[i2+1]*yalpha1+buf1[i2+1]*yalpha)>>19; \ |
... | ... |
@@ -790,13 +777,13 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
790 | 790 |
int V= (uvbuf0[i+VOFW]*uvalpha1+uvbuf1[i+VOFW]*uvalpha)>>19; \ |
791 | 791 |
type av_unused *r, *b, *g; \ |
792 | 792 |
int av_unused A1, A2; \ |
793 |
- if (alpha){\ |
|
793 |
+ if (alpha) {\ |
|
794 | 794 |
A1= (abuf0[i2 ]*yalpha1+abuf1[i2 ]*yalpha)>>19; \ |
795 | 795 |
A2= (abuf0[i2+1]*yalpha1+abuf1[i2+1]*yalpha)>>19; \ |
796 | 796 |
}\ |
797 | 797 |
|
798 | 798 |
#define YSCALE_YUV_2_GRAY16_2_C \ |
799 |
- for (i=0; i<(dstW>>1); i++){ \ |
|
799 |
+ for (i=0; i<(dstW>>1); i++) { \ |
|
800 | 800 |
const int i2= 2*i; \ |
801 | 801 |
int Y1= (buf0[i2 ]*yalpha1+buf1[i2 ]*yalpha)>>11; \ |
802 | 802 |
int Y2= (buf0[i2+1]*yalpha1+buf1[i2+1]*yalpha)>>11; \ |
... | ... |
@@ -808,7 +795,7 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
808 | 808 |
b = (type *)c->table_bU[U];\ |
809 | 809 |
|
810 | 810 |
#define YSCALE_YUV_2_PACKED1_C(type,alpha) \ |
811 |
- for (i=0; i<(dstW>>1); i++){\ |
|
811 |
+ for (i=0; i<(dstW>>1); i++) {\ |
|
812 | 812 |
const int i2= 2*i;\ |
813 | 813 |
int Y1= buf0[i2 ]>>7;\ |
814 | 814 |
int Y2= buf0[i2+1]>>7;\ |
... | ... |
@@ -816,13 +803,13 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
816 | 816 |
int V= (uvbuf1[i+VOFW])>>7;\ |
817 | 817 |
type av_unused *r, *b, *g;\ |
818 | 818 |
int av_unused A1, A2;\ |
819 |
- if (alpha){\ |
|
819 |
+ if (alpha) {\ |
|
820 | 820 |
A1= abuf0[i2 ]>>7;\ |
821 | 821 |
A2= abuf0[i2+1]>>7;\ |
822 | 822 |
}\ |
823 | 823 |
|
824 | 824 |
#define YSCALE_YUV_2_GRAY16_1_C \ |
825 |
- for (i=0; i<(dstW>>1); i++){\ |
|
825 |
+ for (i=0; i<(dstW>>1); i++) {\ |
|
826 | 826 |
const int i2= 2*i;\ |
827 | 827 |
int Y1= buf0[i2 ]<<1;\ |
828 | 828 |
int Y2= buf0[i2+1]<<1;\ |
... | ... |
@@ -834,7 +821,7 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
834 | 834 |
b = (type *)c->table_bU[U];\ |
835 | 835 |
|
836 | 836 |
#define YSCALE_YUV_2_PACKED1B_C(type,alpha) \ |
837 |
- for (i=0; i<(dstW>>1); i++){\ |
|
837 |
+ for (i=0; i<(dstW>>1); i++) {\ |
|
838 | 838 |
const int i2= 2*i;\ |
839 | 839 |
int Y1= buf0[i2 ]>>7;\ |
840 | 840 |
int Y2= buf0[i2+1]>>7;\ |
... | ... |
@@ -842,7 +829,7 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
842 | 842 |
int V= (uvbuf0[i+VOFW] + uvbuf1[i+VOFW])>>8;\ |
843 | 843 |
type av_unused *r, *b, *g;\ |
844 | 844 |
int av_unused A1, A2;\ |
845 |
- if (alpha){\ |
|
845 |
+ if (alpha) {\ |
|
846 | 846 |
A1= abuf0[i2 ]>>7;\ |
847 | 847 |
A2= abuf0[i2+1]>>7;\ |
848 | 848 |
}\ |
... | ... |
@@ -856,7 +843,7 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
856 | 856 |
#define YSCALE_YUV_2_MONO2_C \ |
857 | 857 |
const uint8_t * const d128=dither_8x8_220[y&7];\ |
858 | 858 |
uint8_t *g= c->table_gU[128] + c->table_gV[128];\ |
859 |
- for (i=0; i<dstW-7; i+=8){\ |
|
859 |
+ for (i=0; i<dstW-7; i+=8) {\ |
|
860 | 860 |
int acc;\ |
861 | 861 |
acc = g[((buf0[i ]*yalpha1+buf1[i ]*yalpha)>>19) + d128[0]];\ |
862 | 862 |
acc+= acc + g[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19) + d128[1]];\ |
... | ... |
@@ -875,20 +862,18 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
875 | 875 |
const uint8_t * const d128=dither_8x8_220[y&7];\ |
876 | 876 |
uint8_t *g= c->table_gU[128] + c->table_gV[128];\ |
877 | 877 |
int acc=0;\ |
878 |
- for (i=0; i<dstW-1; i+=2){\ |
|
878 |
+ for (i=0; i<dstW-1; i+=2) {\ |
|
879 | 879 |
int j;\ |
880 | 880 |
int Y1=1<<18;\ |
881 | 881 |
int Y2=1<<18;\ |
882 | 882 |
\ |
883 |
- for (j=0; j<lumFilterSize; j++)\ |
|
884 |
- {\ |
|
883 |
+ for (j=0; j<lumFilterSize; j++) {\ |
|
885 | 884 |
Y1 += lumSrc[j][i] * lumFilter[j];\ |
886 | 885 |
Y2 += lumSrc[j][i+1] * lumFilter[j];\ |
887 | 886 |
}\ |
888 | 887 |
Y1>>=19;\ |
889 | 888 |
Y2>>=19;\ |
890 |
- if ((Y1|Y2)&256)\ |
|
891 |
- {\ |
|
889 |
+ if ((Y1|Y2)&256) {\ |
|
892 | 890 |
if (Y1>255) Y1=255;\ |
893 | 891 |
else if (Y1<0)Y1=0;\ |
894 | 892 |
if (Y2>255) Y2=255;\ |
... | ... |
@@ -896,7 +881,7 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
896 | 896 |
}\ |
897 | 897 |
acc+= acc + g[Y1+d128[(i+0)&7]];\ |
898 | 898 |
acc+= acc + g[Y2+d128[(i+1)&7]];\ |
899 |
- if ((i&7)==6){\ |
|
899 |
+ if ((i&7)==6) {\ |
|
900 | 900 |
((uint8_t*)dest)[0]= c->dstFormat == PIX_FMT_MONOBLACK ? acc : ~acc;\ |
901 | 901 |
dest++;\ |
902 | 902 |
}\ |
... | ... |
@@ -904,8 +889,7 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
904 | 904 |
|
905 | 905 |
|
906 | 906 |
#define YSCALE_YUV_2_ANYRGB_C(func, func2, func_g16, func_monoblack)\ |
907 |
- switch(c->dstFormat)\ |
|
908 |
- {\ |
|
907 |
+ switch(c->dstFormat) {\ |
|
909 | 908 |
case PIX_FMT_RGB48BE:\ |
910 | 909 |
case PIX_FMT_RGB48LE:\ |
911 | 910 |
func(uint8_t,0)\ |
... | ... |
@@ -926,19 +910,19 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
926 | 926 |
break;\ |
927 | 927 |
case PIX_FMT_RGBA:\ |
928 | 928 |
case PIX_FMT_BGRA:\ |
929 |
- if (CONFIG_SMALL){\ |
|
929 |
+ if (CONFIG_SMALL) {\ |
|
930 | 930 |
int needAlpha = CONFIG_SWSCALE_ALPHA && c->alpPixBuf;\ |
931 | 931 |
func(uint32_t,needAlpha)\ |
932 | 932 |
((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1] + (needAlpha ? (A1<<24) : 0);\ |
933 | 933 |
((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2] + (needAlpha ? (A2<<24) : 0);\ |
934 | 934 |
}\ |
935 |
- }else{\ |
|
936 |
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf){\ |
|
935 |
+ } else {\ |
|
936 |
+ if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {\ |
|
937 | 937 |
func(uint32_t,1)\ |
938 | 938 |
((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1] + (A1<<24);\ |
939 | 939 |
((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2] + (A2<<24);\ |
940 | 940 |
}\ |
941 |
- }else{\ |
|
941 |
+ } else {\ |
|
942 | 942 |
func(uint32_t,0)\ |
943 | 943 |
((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1];\ |
944 | 944 |
((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2];\ |
... | ... |
@@ -948,19 +932,19 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc |
948 | 948 |
break;\ |
949 | 949 |
case PIX_FMT_ARGB:\ |
950 | 950 |
case PIX_FMT_ABGR:\ |
951 |
- if (CONFIG_SMALL){\ |
|
951 |
+ if (CONFIG_SMALL) {\ |
|
952 | 952 |
int needAlpha = CONFIG_SWSCALE_ALPHA && c->alpPixBuf;\ |
953 | 953 |
func(uint32_t,needAlpha)\ |
954 | 954 |
((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1] + (needAlpha ? A1 : 0);\ |
955 | 955 |
((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2] + (needAlpha ? A2 : 0);\ |
956 | 956 |
}\ |
957 |
- }else{\ |
|
958 |
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf){\ |
|
957 |
+ } else {\ |
|
958 |
+ if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {\ |
|
959 | 959 |
func(uint32_t,1)\ |
960 | 960 |
((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1] + A1;\ |
961 | 961 |
((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2] + A2;\ |
962 | 962 |
}\ |
963 |
- }else{\ |
|
963 |
+ } else {\ |
|
964 | 964 |
func(uint32_t,0)\ |
965 | 965 |
((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1];\ |
966 | 966 |
((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2];\ |
... | ... |
@@ -1110,14 +1094,14 @@ static inline void yuv2rgbXinC_full(SwsContext *c, const int16_t *lumFilter, con |
1110 | 1110 |
int step= fmt_depth(c->dstFormat)/8; |
1111 | 1111 |
int aidx= 3; |
1112 | 1112 |
|
1113 |
- switch(c->dstFormat){ |
|
1113 |
+ switch(c->dstFormat) { |
|
1114 | 1114 |
case PIX_FMT_ARGB: |
1115 | 1115 |
dest++; |
1116 | 1116 |
aidx= 0; |
1117 | 1117 |
case PIX_FMT_RGB24: |
1118 | 1118 |
aidx--; |
1119 | 1119 |
case PIX_FMT_RGBA: |
1120 |
- if (CONFIG_SMALL){ |
|
1120 |
+ if (CONFIG_SMALL) { |
|
1121 | 1121 |
int needAlpha = CONFIG_SWSCALE_ALPHA && c->alpPixBuf; |
1122 | 1122 |
YSCALE_YUV_2_RGBX_FULL_C(1<<21, needAlpha) |
1123 | 1123 |
dest[aidx]= needAlpha ? A : 255; |
... | ... |
@@ -1126,8 +1110,8 @@ static inline void yuv2rgbXinC_full(SwsContext *c, const int16_t *lumFilter, con |
1126 | 1126 |
dest[2]= B>>22; |
1127 | 1127 |
dest+= step; |
1128 | 1128 |
} |
1129 |
- }else{ |
|
1130 |
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf){ |
|
1129 |
+ } else { |
|
1130 |
+ if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { |
|
1131 | 1131 |
YSCALE_YUV_2_RGBX_FULL_C(1<<21, 1) |
1132 | 1132 |
dest[aidx]= A; |
1133 | 1133 |
dest[0]= R>>22; |
... | ... |
@@ -1135,7 +1119,7 @@ static inline void yuv2rgbXinC_full(SwsContext *c, const int16_t *lumFilter, con |
1135 | 1135 |
dest[2]= B>>22; |
1136 | 1136 |
dest+= step; |
1137 | 1137 |
} |
1138 |
- }else{ |
|
1138 |
+ } else { |
|
1139 | 1139 |
YSCALE_YUV_2_RGBX_FULL_C(1<<21, 0) |
1140 | 1140 |
dest[aidx]= 255; |
1141 | 1141 |
dest[0]= R>>22; |
... | ... |
@@ -1152,7 +1136,7 @@ static inline void yuv2rgbXinC_full(SwsContext *c, const int16_t *lumFilter, con |
1152 | 1152 |
case PIX_FMT_BGR24: |
1153 | 1153 |
aidx--; |
1154 | 1154 |
case PIX_FMT_BGRA: |
1155 |
- if (CONFIG_SMALL){ |
|
1155 |
+ if (CONFIG_SMALL) { |
|
1156 | 1156 |
int needAlpha = CONFIG_SWSCALE_ALPHA && c->alpPixBuf; |
1157 | 1157 |
YSCALE_YUV_2_RGBX_FULL_C(1<<21, needAlpha) |
1158 | 1158 |
dest[aidx]= needAlpha ? A : 255; |
... | ... |
@@ -1161,8 +1145,8 @@ static inline void yuv2rgbXinC_full(SwsContext *c, const int16_t *lumFilter, con |
1161 | 1161 |
dest[2]= R>>22; |
1162 | 1162 |
dest+= step; |
1163 | 1163 |
} |
1164 |
- }else{ |
|
1165 |
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf){ |
|
1164 |
+ } else { |
|
1165 |
+ if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { |
|
1166 | 1166 |
YSCALE_YUV_2_RGBX_FULL_C(1<<21, 1) |
1167 | 1167 |
dest[aidx]= A; |
1168 | 1168 |
dest[0]= B>>22; |
... | ... |
@@ -1170,7 +1154,7 @@ static inline void yuv2rgbXinC_full(SwsContext *c, const int16_t *lumFilter, con |
1170 | 1170 |
dest[2]= R>>22; |
1171 | 1171 |
dest+= step; |
1172 | 1172 |
} |
1173 |
- }else{ |
|
1173 |
+ } else { |
|
1174 | 1174 |
YSCALE_YUV_2_RGBX_FULL_C(1<<21, 0) |
1175 | 1175 |
dest[aidx]= 255; |
1176 | 1176 |
dest[0]= B>>22; |
... | ... |
@@ -1186,10 +1170,11 @@ static inline void yuv2rgbXinC_full(SwsContext *c, const int16_t *lumFilter, con |
1186 | 1186 |
} |
1187 | 1187 |
} |
1188 | 1188 |
|
1189 |
-static void fillPlane(uint8_t* plane, int stride, int width, int height, int y, uint8_t val){ |
|
1189 |
+static void fillPlane(uint8_t* plane, int stride, int width, int height, int y, uint8_t val) |
|
1190 |
+{ |
|
1190 | 1191 |
int i; |
1191 | 1192 |
uint8_t *ptr = plane + stride*y; |
1192 |
- for (i=0; i<height; i++){ |
|
1193 |
+ for (i=0; i<height; i++) { |
|
1193 | 1194 |
memset(ptr, val, width); |
1194 | 1195 |
ptr += stride; |
1195 | 1196 |
} |
... | ... |
@@ -1241,8 +1226,7 @@ static inline void rgb48ToUV_half(uint8_t *dstU, uint8_t *dstV, |
1241 | 1241 |
static inline void name(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)\ |
1242 | 1242 |
{\ |
1243 | 1243 |
int i;\ |
1244 |
- for (i=0; i<width; i++)\ |
|
1245 |
- {\ |
|
1244 |
+ for (i=0; i<width; i++) {\ |
|
1246 | 1245 |
int b= (((const type*)src)[i]>>shb)&maskb;\ |
1247 | 1246 |
int g= (((const type*)src)[i]>>shg)&maskg;\ |
1248 | 1247 |
int r= (((const type*)src)[i]>>shr)&maskr;\ |
... | ... |
@@ -1258,9 +1242,10 @@ BGR2Y(uint16_t, bgr15ToY, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, RY<<10, GY<<5, BY |
1258 | 1258 |
BGR2Y(uint16_t, rgb16ToY, 0, 0, 0, 0xF800, 0x07E0, 0x001F, RY , GY<<5, BY<<11, RGB2YUV_SHIFT+8) |
1259 | 1259 |
BGR2Y(uint16_t, rgb15ToY, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, RY , GY<<5, BY<<10, RGB2YUV_SHIFT+7) |
1260 | 1260 |
|
1261 |
-static inline void abgrToA(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused){ |
|
1261 |
+static inline void abgrToA(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused) |
|
1262 |
+{ |
|
1262 | 1263 |
int i; |
1263 |
- for (i=0; i<width; i++){ |
|
1264 |
+ for (i=0; i<width; i++) { |
|
1264 | 1265 |
dst[i]= src[4*i]; |
1265 | 1266 |
} |
1266 | 1267 |
} |
... | ... |
@@ -1269,8 +1254,7 @@ static inline void abgrToA(uint8_t *dst, const uint8_t *src, long width, uint32_ |
1269 | 1269 |
static inline void name(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, const uint8_t *dummy, long width, uint32_t *unused)\ |
1270 | 1270 |
{\ |
1271 | 1271 |
int i;\ |
1272 |
- for (i=0; i<width; i++)\ |
|
1273 |
- {\ |
|
1272 |
+ for (i=0; i<width; i++) {\ |
|
1274 | 1273 |
int b= (((const type*)src)[i]&maskb)>>shb;\ |
1275 | 1274 |
int g= (((const type*)src)[i]&maskg)>>shg;\ |
1276 | 1275 |
int r= (((const type*)src)[i]&maskr)>>shr;\ |
... | ... |
@@ -1282,8 +1266,7 @@ static inline void name(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, const |
1282 | 1282 |
static inline void name ## _half(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, const uint8_t *dummy, long width, uint32_t *unused)\ |
1283 | 1283 |
{\ |
1284 | 1284 |
int i;\ |
1285 |
- for (i=0; i<width; i++)\ |
|
1286 |
- {\ |
|
1285 |
+ for (i=0; i<width; i++) {\ |
|
1287 | 1286 |
int pix0= ((const type*)src)[2*i+0];\ |
1288 | 1287 |
int pix1= ((const type*)src)[2*i+1];\ |
1289 | 1288 |
int g= (pix0&~(maskr|maskb))+(pix1&~(maskr|maskb));\ |
... | ... |
@@ -1308,8 +1291,7 @@ BGR2UV(uint16_t, rgb15ToUV, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, RU |
1308 | 1308 |
static inline void palToY(uint8_t *dst, const uint8_t *src, long width, uint32_t *pal) |
1309 | 1309 |
{ |
1310 | 1310 |
int i; |
1311 |
- for (i=0; i<width; i++) |
|
1312 |
- { |
|
1311 |
+ for (i=0; i<width; i++) { |
|
1313 | 1312 |
int d= src[i]; |
1314 | 1313 |
|
1315 | 1314 |
dst[i]= pal[d] & 0xFF; |
... | ... |
@@ -1322,8 +1304,7 @@ static inline void palToUV(uint8_t *dstU, uint8_t *dstV, |
1322 | 1322 |
{ |
1323 | 1323 |
int i; |
1324 | 1324 |
assert(src1 == src2); |
1325 |
- for (i=0; i<width; i++) |
|
1326 |
- { |
|
1325 |
+ for (i=0; i<width; i++) { |
|
1327 | 1326 |
int p= pal[src1[i]]; |
1328 | 1327 |
|
1329 | 1328 |
dstU[i]= p>>8; |
... | ... |
@@ -1334,7 +1315,7 @@ static inline void palToUV(uint8_t *dstU, uint8_t *dstV, |
1334 | 1334 |
static inline void monowhite2Y(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused) |
1335 | 1335 |
{ |
1336 | 1336 |
int i, j; |
1337 |
- for (i=0; i<width/8; i++){ |
|
1337 |
+ for (i=0; i<width/8; i++) { |
|
1338 | 1338 |
int d= ~src[i]; |
1339 | 1339 |
for(j=0; j<8; j++) |
1340 | 1340 |
dst[8*i+j]= ((d>>(7-j))&1)*255; |
... | ... |
@@ -1344,7 +1325,7 @@ static inline void monowhite2Y(uint8_t *dst, const uint8_t *src, long width, uin |
1344 | 1344 |
static inline void monoblack2Y(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused) |
1345 | 1345 |
{ |
1346 | 1346 |
int i, j; |
1347 |
- for (i=0; i<width/8; i++){ |
|
1347 |
+ for (i=0; i<width/8; i++) { |
|
1348 | 1348 |
int d= src[i]; |
1349 | 1349 |
for(j=0; j<8; j++) |
1350 | 1350 |
dst[8*i+j]= ((d>>(7-j))&1)*255; |
... | ... |
@@ -1471,53 +1452,44 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF |
1471 | 1471 |
// NOTE: the +1 is for the MMX scaler which reads over the end |
1472 | 1472 |
*filterPos = av_malloc((dstW+1)*sizeof(int16_t)); |
1473 | 1473 |
|
1474 |
- if (FFABS(xInc - 0x10000) <10) // unscaled |
|
1475 |
- { |
|
1474 |
+ if (FFABS(xInc - 0x10000) <10) { // unscaled |
|
1476 | 1475 |
int i; |
1477 | 1476 |
filterSize= 1; |
1478 | 1477 |
filter= av_mallocz(dstW*sizeof(*filter)*filterSize); |
1479 | 1478 |
|
1480 |
- for (i=0; i<dstW; i++) |
|
1481 |
- { |
|
1479 |
+ for (i=0; i<dstW; i++) { |
|
1482 | 1480 |
filter[i*filterSize]= fone; |
1483 | 1481 |
(*filterPos)[i]=i; |
1484 | 1482 |
} |
1485 | 1483 |
|
1486 |
- } |
|
1487 |
- else if (flags&SWS_POINT) // lame looking point sampling mode |
|
1488 |
- { |
|
1484 |
+ } else if (flags&SWS_POINT) { // lame looking point sampling mode |
|
1489 | 1485 |
int i; |
1490 | 1486 |
int xDstInSrc; |
1491 | 1487 |
filterSize= 1; |
1492 | 1488 |
filter= av_malloc(dstW*sizeof(*filter)*filterSize); |
1493 | 1489 |
|
1494 | 1490 |
xDstInSrc= xInc/2 - 0x8000; |
1495 |
- for (i=0; i<dstW; i++) |
|
1496 |
- { |
|
1491 |
+ for (i=0; i<dstW; i++) { |
|
1497 | 1492 |
int xx= (xDstInSrc - ((filterSize-1)<<15) + (1<<15))>>16; |
1498 | 1493 |
|
1499 | 1494 |
(*filterPos)[i]= xx; |
1500 | 1495 |
filter[i]= fone; |
1501 | 1496 |
xDstInSrc+= xInc; |
1502 | 1497 |
} |
1503 |
- } |
|
1504 |
- else if ((xInc <= (1<<16) && (flags&SWS_AREA)) || (flags&SWS_FAST_BILINEAR)) // bilinear upscale |
|
1505 |
- { |
|
1498 |
+ } else if ((xInc <= (1<<16) && (flags&SWS_AREA)) || (flags&SWS_FAST_BILINEAR)) { // bilinear upscale |
|
1506 | 1499 |
int i; |
1507 | 1500 |
int xDstInSrc; |
1508 | 1501 |
filterSize= 2; |
1509 | 1502 |
filter= av_malloc(dstW*sizeof(*filter)*filterSize); |
1510 | 1503 |
|
1511 | 1504 |
xDstInSrc= xInc/2 - 0x8000; |
1512 |
- for (i=0; i<dstW; i++) |
|
1513 |
- { |
|
1505 |
+ for (i=0; i<dstW; i++) { |
|
1514 | 1506 |
int xx= (xDstInSrc - ((filterSize-1)<<15) + (1<<15))>>16; |
1515 | 1507 |
int j; |
1516 | 1508 |
|
1517 | 1509 |
(*filterPos)[i]= xx; |
1518 | 1510 |
//bilinear upscale / linear interpolate / area averaging |
1519 |
- for (j=0; j<filterSize; j++) |
|
1520 |
- { |
|
1511 |
+ for (j=0; j<filterSize; j++) { |
|
1521 | 1512 |
int64_t coeff= fone - FFABS((xx<<16) - xDstInSrc)*(fone>>16); |
1522 | 1513 |
if (coeff<0) coeff=0; |
1523 | 1514 |
filter[i*filterSize + j]= coeff; |
... | ... |
@@ -1525,9 +1497,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF |
1525 | 1525 |
} |
1526 | 1526 |
xDstInSrc+= xInc; |
1527 | 1527 |
} |
1528 |
- } |
|
1529 |
- else |
|
1530 |
- { |
|
1528 |
+ } else { |
|
1531 | 1529 |
int xDstInSrc; |
1532 | 1530 |
int sizeFactor; |
1533 | 1531 |
|
... | ... |
@@ -1552,13 +1522,11 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF |
1552 | 1552 |
filter= av_malloc(dstW*sizeof(*filter)*filterSize); |
1553 | 1553 |
|
1554 | 1554 |
xDstInSrc= xInc - 0x10000; |
1555 |
- for (i=0; i<dstW; i++) |
|
1556 |
- { |
|
1555 |
+ for (i=0; i<dstW; i++) { |
|
1557 | 1556 |
int xx= (xDstInSrc - ((filterSize-2)<<16)) / (1<<17); |
1558 | 1557 |
int j; |
1559 | 1558 |
(*filterPos)[i]= xx; |
1560 |
- for (j=0; j<filterSize; j++) |
|
1561 |
- { |
|
1559 |
+ for (j=0; j<filterSize; j++) { |
|
1562 | 1560 |
int64_t d= ((int64_t)FFABS((xx<<17) - xDstInSrc))<<13; |
1563 | 1561 |
double floatd; |
1564 | 1562 |
int64_t coeff; |
... | ... |
@@ -1567,8 +1535,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF |
1567 | 1567 |
d= d*dstW/srcW; |
1568 | 1568 |
floatd= d * (1.0/(1<<30)); |
1569 | 1569 |
|
1570 |
- if (flags & SWS_BICUBIC) |
|
1571 |
- { |
|
1570 |
+ if (flags & SWS_BICUBIC) { |
|
1572 | 1571 |
int64_t B= (param[0] != SWS_PARAM_DEFAULT ? param[0] : 0) * (1<<24); |
1573 | 1572 |
int64_t C= (param[1] != SWS_PARAM_DEFAULT ? param[1] : 0.6) * (1<<24); |
1574 | 1573 |
int64_t dd = ( d*d)>>30; |
... | ... |
@@ -1582,14 +1549,12 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF |
1582 | 1582 |
coeff=0.0; |
1583 | 1583 |
coeff *= fone>>(30+24); |
1584 | 1584 |
} |
1585 |
-/* else if (flags & SWS_X) |
|
1586 |
- { |
|
1585 |
+/* else if (flags & SWS_X) { |
|
1587 | 1586 |
double p= param ? param*0.01 : 0.3; |
1588 | 1587 |
coeff = d ? sin(d*PI)/(d*PI) : 1.0; |
1589 | 1588 |
coeff*= pow(2.0, - p*d*d); |
1590 | 1589 |
}*/ |
1591 |
- else if (flags & SWS_X) |
|
1592 |
- { |
|
1590 |
+ else if (flags & SWS_X) { |
|
1593 | 1591 |
double A= param[0] != SWS_PARAM_DEFAULT ? param[0] : 1.0; |
1594 | 1592 |
double c; |
1595 | 1593 |
|
... | ... |
@@ -1600,42 +1565,29 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF |
1600 | 1600 |
if (c<0.0) c= -pow(-c, A); |
1601 | 1601 |
else c= pow( c, A); |
1602 | 1602 |
coeff= (c*0.5 + 0.5)*fone; |
1603 |
- } |
|
1604 |
- else if (flags & SWS_AREA) |
|
1605 |
- { |
|
1603 |
+ } else if (flags & SWS_AREA) { |
|
1606 | 1604 |
int64_t d2= d - (1<<29); |
1607 | 1605 |
if (d2*xInc < -(1LL<<(29+16))) coeff= 1.0 * (1LL<<(30+16)); |
1608 | 1606 |
else if (d2*xInc < (1LL<<(29+16))) coeff= -d2*xInc + (1LL<<(29+16)); |
1609 | 1607 |
else coeff=0.0; |
1610 | 1608 |
coeff *= fone>>(30+16); |
1611 |
- } |
|
1612 |
- else if (flags & SWS_GAUSS) |
|
1613 |
- { |
|
1609 |
+ } else if (flags & SWS_GAUSS) { |
|
1614 | 1610 |
double p= param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0; |
1615 | 1611 |
coeff = (pow(2.0, - p*floatd*floatd))*fone; |
1616 |
- } |
|
1617 |
- else if (flags & SWS_SINC) |
|
1618 |
- { |
|
1612 |
+ } else if (flags & SWS_SINC) { |
|
1619 | 1613 |
coeff = (d ? sin(floatd*PI)/(floatd*PI) : 1.0)*fone; |
1620 |
- } |
|
1621 |
- else if (flags & SWS_LANCZOS) |
|
1622 |
- { |
|
1614 |
+ } else if (flags & SWS_LANCZOS) { |
|
1623 | 1615 |
double p= param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0; |
1624 | 1616 |
coeff = (d ? sin(floatd*PI)*sin(floatd*PI/p)/(floatd*floatd*PI*PI/p) : 1.0)*fone; |
1625 | 1617 |
if (floatd>p) coeff=0; |
1626 |
- } |
|
1627 |
- else if (flags & SWS_BILINEAR) |
|
1628 |
- { |
|
1618 |
+ } else if (flags & SWS_BILINEAR) { |
|
1629 | 1619 |
coeff= (1<<30) - d; |
1630 | 1620 |
if (coeff<0) coeff=0; |
1631 | 1621 |
coeff *= fone >> 30; |
1632 |
- } |
|
1633 |
- else if (flags & SWS_SPLINE) |
|
1634 |
- { |
|
1622 |
+ } else if (flags & SWS_SPLINE) { |
|
1635 | 1623 |
double p=-2.196152422706632; |
1636 | 1624 |
coeff = getSplineCoeff(1.0, 0.0, p, -p-1.0, floatd) * fone; |
1637 |
- } |
|
1638 |
- else { |
|
1625 |
+ } else { |
|
1639 | 1626 |
coeff= 0.0; //GCC warning killer |
1640 | 1627 |
assert(0); |
1641 | 1628 |
} |
... | ... |
@@ -1657,16 +1609,15 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF |
1657 | 1657 |
assert(filter2Size>0); |
1658 | 1658 |
filter2= av_mallocz(filter2Size*dstW*sizeof(*filter2)); |
1659 | 1659 |
|
1660 |
- for (i=0; i<dstW; i++) |
|
1661 |
- { |
|
1660 |
+ for (i=0; i<dstW; i++) { |
|
1662 | 1661 |
int j, k; |
1663 | 1662 |
|
1664 |
- if(srcFilter){ |
|
1665 |
- for (k=0; k<srcFilter->length; k++){ |
|
1663 |
+ if(srcFilter) { |
|
1664 |
+ for (k=0; k<srcFilter->length; k++) { |
|
1666 | 1665 |
for (j=0; j<filterSize; j++) |
1667 | 1666 |
filter2[i*filter2Size + k + j] += srcFilter->coeff[k]*filter[i*filterSize + j]; |
1668 | 1667 |
} |
1669 |
- }else{ |
|
1668 |
+ } else { |
|
1670 | 1669 |
for (j=0; j<filterSize; j++) |
1671 | 1670 |
filter2[i*filter2Size + j]= filter[i*filterSize + j]; |
1672 | 1671 |
} |
... | ... |
@@ -1679,15 +1630,13 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF |
1679 | 1679 |
/* try to reduce the filter-size (step1 find size and shift left) */ |
1680 | 1680 |
// Assume it is near normalized (*0.5 or *2.0 is OK but * 0.001 is not). |
1681 | 1681 |
minFilterSize= 0; |
1682 |
- for (i=dstW-1; i>=0; i--) |
|
1683 |
- { |
|
1682 |
+ for (i=dstW-1; i>=0; i--) { |
|
1684 | 1683 |
int min= filter2Size; |
1685 | 1684 |
int j; |
1686 | 1685 |
int64_t cutOff=0.0; |
1687 | 1686 |
|
1688 | 1687 |
/* get rid off near zero elements on the left by shifting left */ |
1689 |
- for (j=0; j<filter2Size; j++) |
|
1690 |
- { |
|
1688 |
+ for (j=0; j<filter2Size; j++) { |
|
1691 | 1689 |
int k; |
1692 | 1690 |
cutOff += FFABS(filter2[i*filter2Size]); |
1693 | 1691 |
|
... | ... |
@@ -1705,8 +1654,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF |
1705 | 1705 |
|
1706 | 1706 |
cutOff=0; |
1707 | 1707 |
/* count near zeros on the right */ |
1708 |
- for (j=filter2Size-1; j>0; j--) |
|
1709 |
- { |
|
1708 |
+ for (j=filter2Size-1; j>0; j--) { |
|
1710 | 1709 |
cutOff += FFABS(filter2[i*filter2Size + j]); |
1711 | 1710 |
|
1712 | 1711 |
if (cutOff > SWS_MAX_REDUCE_CUTOFF*fone) break; |
... | ... |
@@ -1748,12 +1696,10 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF |
1748 | 1748 |
if (flags&SWS_PRINT_INFO) |
1749 | 1749 |
av_log(NULL, AV_LOG_VERBOSE, "SwScaler: reducing / aligning filtersize %d -> %d\n", filter2Size, filterSize); |
1750 | 1750 |
/* try to reduce the filter-size (step2 reduce it) */ |
1751 |
- for (i=0; i<dstW; i++) |
|
1752 |
- { |
|
1751 |
+ for (i=0; i<dstW; i++) { |
|
1753 | 1752 |
int j; |
1754 | 1753 |
|
1755 |
- for (j=0; j<filterSize; j++) |
|
1756 |
- { |
|
1754 |
+ for (j=0; j<filterSize; j++) { |
|
1757 | 1755 |
if (j>=filter2Size) filter[i*filterSize + j]= 0; |
1758 | 1756 |
else filter[i*filterSize + j]= filter2[i*filter2Size + j]; |
1759 | 1757 |
if((flags & SWS_BITEXACT) && j>=minFilterSize) |
... | ... |
@@ -1765,14 +1711,11 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF |
1765 | 1765 |
//FIXME try to align filterPos if possible |
1766 | 1766 |
|
1767 | 1767 |
//fix borders |
1768 |
- for (i=0; i<dstW; i++) |
|
1769 |
- { |
|
1768 |
+ for (i=0; i<dstW; i++) { |
|
1770 | 1769 |
int j; |
1771 |
- if ((*filterPos)[i] < 0) |
|
1772 |
- { |
|
1770 |
+ if ((*filterPos)[i] < 0) { |
|
1773 | 1771 |
// move filter coefficients left to compensate for filterPos |
1774 |
- for (j=1; j<filterSize; j++) |
|
1775 |
- { |
|
1772 |
+ for (j=1; j<filterSize; j++) { |
|
1776 | 1773 |
int left= FFMAX(j + (*filterPos)[i], 0); |
1777 | 1774 |
filter[i*filterSize + left] += filter[i*filterSize + j]; |
1778 | 1775 |
filter[i*filterSize + j]=0; |
... | ... |
@@ -1780,12 +1723,10 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF |
1780 | 1780 |
(*filterPos)[i]= 0; |
1781 | 1781 |
} |
1782 | 1782 |
|
1783 |
- if ((*filterPos)[i] + filterSize > srcW) |
|
1784 |
- { |
|
1783 |
+ if ((*filterPos)[i] + filterSize > srcW) { |
|
1785 | 1784 |
int shift= (*filterPos)[i] + filterSize - srcW; |
1786 | 1785 |
// move filter coefficients right to compensate for filterPos |
1787 |
- for (j=filterSize-2; j>=0; j--) |
|
1788 |
- { |
|
1786 |
+ for (j=filterSize-2; j>=0; j--) { |
|
1789 | 1787 |
int right= FFMIN(j + shift, filterSize-1); |
1790 | 1788 |
filter[i*filterSize +right] += filter[i*filterSize +j]; |
1791 | 1789 |
filter[i*filterSize +j]=0; |
... | ... |
@@ -1799,19 +1740,16 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF |
1799 | 1799 |
*outFilter= av_mallocz(*outFilterSize*(dstW+1)*sizeof(int16_t)); |
1800 | 1800 |
|
1801 | 1801 |
/* normalize & store in outFilter */ |
1802 |
- for (i=0; i<dstW; i++) |
|
1803 |
- { |
|
1802 |
+ for (i=0; i<dstW; i++) { |
|
1804 | 1803 |
int j; |
1805 | 1804 |
int64_t error=0; |
1806 | 1805 |
int64_t sum=0; |
1807 | 1806 |
|
1808 |
- for (j=0; j<filterSize; j++) |
|
1809 |
- { |
|
1807 |
+ for (j=0; j<filterSize; j++) { |
|
1810 | 1808 |
sum+= filter[i*filterSize + j]; |
1811 | 1809 |
} |
1812 | 1810 |
sum= (sum + one/2)/ one; |
1813 |
- for (j=0; j<*outFilterSize; j++) |
|
1814 |
- { |
|
1811 |
+ for (j=0; j<*outFilterSize; j++) { |
|
1815 | 1812 |
int64_t v= filter[i*filterSize + j] + error; |
1816 | 1813 |
int intV= ROUNDED_DIV(v, sum); |
1817 | 1814 |
(*outFilter)[i*(*outFilterSize) + j]= intV; |
... | ... |
@@ -1820,8 +1758,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF |
1820 | 1820 |
} |
1821 | 1821 |
|
1822 | 1822 |
(*filterPos)[dstW]= (*filterPos)[dstW-1]; // the MMX scaler will read over the end |
1823 |
- for (i=0; i<*outFilterSize; i++) |
|
1824 |
- { |
|
1823 |
+ for (i=0; i<*outFilterSize; i++) { |
|
1825 | 1824 |
int j= dstW*(*outFilterSize); |
1826 | 1825 |
(*outFilter)[j + i]= (*outFilter)[j + i - (*outFilterSize)]; |
1827 | 1826 |
} |
... | ... |
@@ -1933,12 +1870,10 @@ static int initMMX2HScaler(int dstW, int xInc, uint8_t *filterCode, int16_t *fil |
1933 | 1933 |
xpos= 0; //lumXInc/2 - 0x8000; // difference between pixel centers |
1934 | 1934 |
fragmentPos=0; |
1935 | 1935 |
|
1936 |
- for (i=0; i<dstW/numSplits; i++) |
|
1937 |
- { |
|
1936 |
+ for (i=0; i<dstW/numSplits; i++) { |
|
1938 | 1937 |
int xx=xpos>>16; |
1939 | 1938 |
|
1940 |
- if ((i&3) == 0) |
|
1941 |
- { |
|
1939 |
+ if ((i&3) == 0) { |
|
1942 | 1940 |
int a=0; |
1943 | 1941 |
int b=((xpos+xInc)>>16) - xx; |
1944 | 1942 |
int c=((xpos+xInc*2)>>16) - xx; |
... | ... |
@@ -1968,8 +1903,7 @@ static int initMMX2HScaler(int dstW, int xInc, uint8_t *filterCode, int16_t *fil |
1968 | 1968 |
if (i+4-inc>=dstW) shift=maxShift; //avoid overread |
1969 | 1969 |
else if ((filterPos[i/2]&3) <= maxShift) shift=filterPos[i/2]&3; //Align |
1970 | 1970 |
|
1971 |
- if (shift && i>=shift) |
|
1972 |
- { |
|
1971 |
+ if (shift && i>=shift) { |
|
1973 | 1972 |
filterCode[fragmentPos + imm8OfPShufW1]+= 0x55*shift; |
1974 | 1973 |
filterCode[fragmentPos + imm8OfPShufW2]+= 0x55*shift; |
1975 | 1974 |
filterPos[i/2]-=shift; |
... | ... |
@@ -1990,10 +1924,11 @@ static int initMMX2HScaler(int dstW, int xInc, uint8_t *filterCode, int16_t *fil |
1990 | 1990 |
} |
1991 | 1991 |
#endif /* COMPILE_MMX2 */ |
1992 | 1992 |
|
1993 |
-static void globalInit(void){ |
|
1993 |
+static void globalInit(void) |
|
1994 |
+{ |
|
1994 | 1995 |
// generating tables: |
1995 | 1996 |
int i; |
1996 |
- for (i=0; i<768; i++){ |
|
1997 |
+ for (i=0; i<768; i++) { |
|
1997 | 1998 |
int c= av_clip_uint8(i-256); |
1998 | 1999 |
clip_table[i]=c; |
1999 | 2000 |
} |
... | ... |
@@ -2054,18 +1989,17 @@ static SwsFunc getSwsFunc(SwsContext *c) |
2054 | 2054 |
} |
2055 | 2055 |
|
2056 | 2056 |
static int PlanarToNV12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
2057 |
- int srcSliceH, uint8_t* dstParam[], int dstStride[]){ |
|
2057 |
+ int srcSliceH, uint8_t* dstParam[], int dstStride[]) |
|
2058 |
+{ |
|
2058 | 2059 |
uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY; |
2059 | 2060 |
/* Copy Y plane */ |
2060 | 2061 |
if (dstStride[0]==srcStride[0] && srcStride[0] > 0) |
2061 | 2062 |
memcpy(dst, src[0], srcSliceH*dstStride[0]); |
2062 |
- else |
|
2063 |
- { |
|
2063 |
+ else { |
|
2064 | 2064 |
int i; |
2065 | 2065 |
const uint8_t *srcPtr= src[0]; |
2066 | 2066 |
uint8_t *dstPtr= dst; |
2067 |
- for (i=0; i<srcSliceH; i++) |
|
2068 |
- { |
|
2067 |
+ for (i=0; i<srcSliceH; i++) { |
|
2069 | 2068 |
memcpy(dstPtr, srcPtr, c->srcW); |
2070 | 2069 |
srcPtr+= srcStride[0]; |
2071 | 2070 |
dstPtr+= dstStride[0]; |
... | ... |
@@ -2081,7 +2015,8 @@ static int PlanarToNV12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], i |
2081 | 2081 |
} |
2082 | 2082 |
|
2083 | 2083 |
static int PlanarToYuy2Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
2084 |
- int srcSliceH, uint8_t* dstParam[], int dstStride[]){ |
|
2084 |
+ int srcSliceH, uint8_t* dstParam[], int dstStride[]) |
|
2085 |
+{ |
|
2085 | 2086 |
uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY; |
2086 | 2087 |
|
2087 | 2088 |
yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]); |
... | ... |
@@ -2090,7 +2025,8 @@ static int PlanarToYuy2Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], i |
2090 | 2090 |
} |
2091 | 2091 |
|
2092 | 2092 |
static int PlanarToUyvyWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
2093 |
- int srcSliceH, uint8_t* dstParam[], int dstStride[]){ |
|
2093 |
+ int srcSliceH, uint8_t* dstParam[], int dstStride[]) |
|
2094 |
+{ |
|
2094 | 2095 |
uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY; |
2095 | 2096 |
|
2096 | 2097 |
yv12touyvy(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]); |
... | ... |
@@ -2099,7 +2035,8 @@ static int PlanarToUyvyWrapper(SwsContext *c, uint8_t* src[], int srcStride[], i |
2099 | 2099 |
} |
2100 | 2100 |
|
2101 | 2101 |
static int YUV422PToYuy2Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
2102 |
- int srcSliceH, uint8_t* dstParam[], int dstStride[]){ |
|
2102 |
+ int srcSliceH, uint8_t* dstParam[], int dstStride[]) |
|
2103 |
+{ |
|
2103 | 2104 |
uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY; |
2104 | 2105 |
|
2105 | 2106 |
yuv422ptoyuy2(src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0]); |
... | ... |
@@ -2108,7 +2045,8 @@ static int YUV422PToYuy2Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], |
2108 | 2108 |
} |
2109 | 2109 |
|
2110 | 2110 |
static int YUV422PToUyvyWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
2111 |
- int srcSliceH, uint8_t* dstParam[], int dstStride[]){ |
|
2111 |
+ int srcSliceH, uint8_t* dstParam[], int dstStride[]) |
|
2112 |
+{ |
|
2112 | 2113 |
uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY; |
2113 | 2114 |
|
2114 | 2115 |
yuv422ptouyvy(src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0]); |
... | ... |
@@ -2117,7 +2055,8 @@ static int YUV422PToUyvyWrapper(SwsContext *c, uint8_t* src[], int srcStride[], |
2117 | 2117 |
} |
2118 | 2118 |
|
2119 | 2119 |
static int YUYV2YUV420Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
2120 |
- int srcSliceH, uint8_t* dstParam[], int dstStride[]){ |
|
2120 |
+ int srcSliceH, uint8_t* dstParam[], int dstStride[]) |
|
2121 |
+{ |
|
2121 | 2122 |
uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY; |
2122 | 2123 |
uint8_t *udst=dstParam[1] + dstStride[1]*srcSliceY/2; |
2123 | 2124 |
uint8_t *vdst=dstParam[2] + dstStride[2]*srcSliceY/2; |
... | ... |
@@ -2131,7 +2070,8 @@ static int YUYV2YUV420Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], in |
2131 | 2131 |
} |
2132 | 2132 |
|
2133 | 2133 |
static int YUYV2YUV422Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
2134 |
- int srcSliceH, uint8_t* dstParam[], int dstStride[]){ |
|
2134 |
+ int srcSliceH, uint8_t* dstParam[], int dstStride[]) |
|
2135 |
+{ |
|
2135 | 2136 |
uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY; |
2136 | 2137 |
uint8_t *udst=dstParam[1] + dstStride[1]*srcSliceY; |
2137 | 2138 |
uint8_t *vdst=dstParam[2] + dstStride[2]*srcSliceY; |
... | ... |
@@ -2142,7 +2082,8 @@ static int YUYV2YUV422Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], in |
2142 | 2142 |
} |
2143 | 2143 |
|
2144 | 2144 |
static int UYVY2YUV420Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
2145 |
- int srcSliceH, uint8_t* dstParam[], int dstStride[]){ |
|
2145 |
+ int srcSliceH, uint8_t* dstParam[], int dstStride[]) |
|
2146 |
+{ |
|
2146 | 2147 |
uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY; |
2147 | 2148 |
uint8_t *udst=dstParam[1] + dstStride[1]*srcSliceY/2; |
2148 | 2149 |
uint8_t *vdst=dstParam[2] + dstStride[2]*srcSliceY/2; |
... | ... |
@@ -2156,7 +2097,8 @@ static int UYVY2YUV420Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], in |
2156 | 2156 |
} |
2157 | 2157 |
|
2158 | 2158 |
static int UYVY2YUV422Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
2159 |
- int srcSliceH, uint8_t* dstParam[], int dstStride[]){ |
|
2159 |
+ int srcSliceH, uint8_t* dstParam[], int dstStride[]) |
|
2160 |
+{ |
|
2160 | 2161 |
uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY; |
2161 | 2162 |
uint8_t *udst=dstParam[1] + dstStride[1]*srcSliceY; |
2162 | 2163 |
uint8_t *vdst=dstParam[2] + dstStride[2]*srcSliceY; |
... | ... |
@@ -2167,7 +2109,8 @@ static int UYVY2YUV422Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], in |
2167 | 2167 |
} |
2168 | 2168 |
|
2169 | 2169 |
static int pal2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
2170 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){ |
|
2170 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
2171 |
+{ |
|
2171 | 2172 |
const enum PixelFormat srcFormat= c->srcFormat; |
2172 | 2173 |
const enum PixelFormat dstFormat= c->dstFormat; |
2173 | 2174 |
void (*conv)(const uint8_t *src, uint8_t *dst, long num_pixels, |
... | ... |
@@ -2180,7 +2123,7 @@ static int pal2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int sr |
2180 | 2180 |
av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n", |
2181 | 2181 |
sws_format_name(srcFormat), sws_format_name(dstFormat)); |
2182 | 2182 |
|
2183 |
- switch(dstFormat){ |
|
2183 |
+ switch(dstFormat) { |
|
2184 | 2184 |
case PIX_FMT_RGB32 : conv = palette8topacked32; break; |
2185 | 2185 |
case PIX_FMT_BGR32 : conv = palette8topacked32; break; |
2186 | 2186 |
case PIX_FMT_BGR32_1: conv = palette8topacked32; break; |
... | ... |
@@ -2203,7 +2146,8 @@ static int pal2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int sr |
2203 | 2203 |
|
2204 | 2204 |
/* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */ |
2205 | 2205 |
static int rgb2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
2206 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){ |
|
2206 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
2207 |
+{ |
|
2207 | 2208 |
const enum PixelFormat srcFormat= c->srcFormat; |
2208 | 2209 |
const enum PixelFormat dstFormat= c->dstFormat; |
2209 | 2210 |
const int srcBpp= (fmt_depth(srcFormat) + 7) >> 3; |
... | ... |
@@ -2214,8 +2158,8 @@ static int rgb2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int sr |
2214 | 2214 |
|
2215 | 2215 |
/* BGR -> BGR */ |
2216 | 2216 |
if ( (isBGR(srcFormat) && isBGR(dstFormat)) |
2217 |
- || (isRGB(srcFormat) && isRGB(dstFormat))){ |
|
2218 |
- switch(srcId | (dstId<<4)){ |
|
2217 |
+ || (isRGB(srcFormat) && isRGB(dstFormat))) { |
|
2218 |
+ switch(srcId | (dstId<<4)) { |
|
2219 | 2219 |
case 0x34: conv= rgb16to15; break; |
2220 | 2220 |
case 0x36: conv= rgb24to15; break; |
2221 | 2221 |
case 0x38: conv= rgb32to15; break; |
... | ... |
@@ -2231,9 +2175,9 @@ static int rgb2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int sr |
2231 | 2231 |
default: av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n", |
2232 | 2232 |
sws_format_name(srcFormat), sws_format_name(dstFormat)); break; |
2233 | 2233 |
} |
2234 |
- }else if ( (isBGR(srcFormat) && isRGB(dstFormat)) |
|
2235 |
- || (isRGB(srcFormat) && isBGR(dstFormat))){ |
|
2236 |
- switch(srcId | (dstId<<4)){ |
|
2234 |
+ } else if ( (isBGR(srcFormat) && isRGB(dstFormat)) |
|
2235 |
+ || (isRGB(srcFormat) && isBGR(dstFormat))) { |
|
2236 |
+ switch(srcId | (dstId<<4)) { |
|
2237 | 2237 |
case 0x33: conv= rgb15tobgr15; break; |
2238 | 2238 |
case 0x34: conv= rgb16tobgr15; break; |
2239 | 2239 |
case 0x36: conv= rgb24tobgr15; break; |
... | ... |
@@ -2253,26 +2197,23 @@ static int rgb2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int sr |
2253 | 2253 |
default: av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n", |
2254 | 2254 |
sws_format_name(srcFormat), sws_format_name(dstFormat)); break; |
2255 | 2255 |
} |
2256 |
- }else{ |
|
2256 |
+ } else { |
|
2257 | 2257 |
av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n", |
2258 | 2258 |
sws_format_name(srcFormat), sws_format_name(dstFormat)); |
2259 | 2259 |
} |
2260 | 2260 |
|
2261 |
- if(conv) |
|
2262 |
- { |
|
2261 |
+ if(conv) { |
|
2263 | 2262 |
uint8_t *srcPtr= src[0]; |
2264 | 2263 |
if(srcFormat == PIX_FMT_RGB32_1 || srcFormat == PIX_FMT_BGR32_1) |
2265 | 2264 |
srcPtr += ALT32_CORR; |
2266 | 2265 |
|
2267 | 2266 |
if (dstStride[0]*srcBpp == srcStride[0]*dstBpp && srcStride[0] > 0) |
2268 | 2267 |
conv(srcPtr, dst[0] + dstStride[0]*srcSliceY, srcSliceH*srcStride[0]); |
2269 |
- else |
|
2270 |
- { |
|
2268 |
+ else { |
|
2271 | 2269 |
int i; |
2272 | 2270 |
uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY; |
2273 | 2271 |
|
2274 |
- for (i=0; i<srcSliceH; i++) |
|
2275 |
- { |
|
2272 |
+ for (i=0; i<srcSliceH; i++) { |
|
2276 | 2273 |
conv(srcPtr, dstPtr, c->srcW*srcBpp); |
2277 | 2274 |
srcPtr+= srcStride[0]; |
2278 | 2275 |
dstPtr+= dstStride[0]; |
... | ... |
@@ -2283,7 +2224,8 @@ static int rgb2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int sr |
2283 | 2283 |
} |
2284 | 2284 |
|
2285 | 2285 |
static int bgr24toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
2286 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){ |
|
2286 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
2287 |
+{ |
|
2287 | 2288 |
|
2288 | 2289 |
rgb24toyv12( |
2289 | 2290 |
src[0], |
... | ... |
@@ -2298,30 +2240,30 @@ static int bgr24toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], in |
2298 | 2298 |
} |
2299 | 2299 |
|
2300 | 2300 |
static int yvu9toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
2301 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){ |
|
2301 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
2302 |
+{ |
|
2302 | 2303 |
int i; |
2303 | 2304 |
|
2304 | 2305 |
/* copy Y */ |
2305 | 2306 |
if (srcStride[0]==dstStride[0] && srcStride[0] > 0) |
2306 | 2307 |
memcpy(dst[0]+ srcSliceY*dstStride[0], src[0], srcStride[0]*srcSliceH); |
2307 |
- else{ |
|
2308 |
+ else { |
|
2308 | 2309 |
uint8_t *srcPtr= src[0]; |
2309 | 2310 |
uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY; |
2310 | 2311 |
|
2311 |
- for (i=0; i<srcSliceH; i++) |
|
2312 |
- { |
|
2312 |
+ for (i=0; i<srcSliceH; i++) { |
|
2313 | 2313 |
memcpy(dstPtr, srcPtr, c->srcW); |
2314 | 2314 |
srcPtr+= srcStride[0]; |
2315 | 2315 |
dstPtr+= dstStride[0]; |
2316 | 2316 |
} |
2317 | 2317 |
} |
2318 | 2318 |
|
2319 |
- if (c->dstFormat==PIX_FMT_YUV420P || c->dstFormat==PIX_FMT_YUVA420P){ |
|
2319 |
+ if (c->dstFormat==PIX_FMT_YUV420P || c->dstFormat==PIX_FMT_YUVA420P) { |
|
2320 | 2320 |
planar2x(src[1], dst[1] + dstStride[1]*(srcSliceY >> 1), c->chrSrcW, |
2321 | 2321 |
srcSliceH >> 2, srcStride[1], dstStride[1]); |
2322 | 2322 |
planar2x(src[2], dst[2] + dstStride[2]*(srcSliceY >> 1), c->chrSrcW, |
2323 | 2323 |
srcSliceH >> 2, srcStride[2], dstStride[2]); |
2324 |
- }else{ |
|
2324 |
+ } else { |
|
2325 | 2325 |
planar2x(src[1], dst[2] + dstStride[2]*(srcSliceY >> 1), c->chrSrcW, |
2326 | 2326 |
srcSliceH >> 2, srcStride[1], dstStride[2]); |
2327 | 2327 |
planar2x(src[2], dst[1] + dstStride[1]*(srcSliceY >> 1), c->chrSrcW, |
... | ... |
@@ -2338,8 +2280,7 @@ static int packedCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli |
2338 | 2338 |
{ |
2339 | 2339 |
if (dstStride[0]==srcStride[0] && srcStride[0] > 0) |
2340 | 2340 |
memcpy(dst[0] + dstStride[0]*srcSliceY, src[0], srcSliceH*dstStride[0]); |
2341 |
- else |
|
2342 |
- { |
|
2341 |
+ else { |
|
2343 | 2342 |
int i; |
2344 | 2343 |
uint8_t *srcPtr= src[0]; |
2345 | 2344 |
uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY; |
... | ... |
@@ -2350,8 +2291,7 @@ static int packedCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli |
2350 | 2350 |
&& length+c->srcW <= FFABS(srcStride[0])) length+= c->srcW; |
2351 | 2351 |
assert(length!=0); |
2352 | 2352 |
|
2353 |
- for (i=0; i<srcSliceH; i++) |
|
2354 |
- { |
|
2353 |
+ for (i=0; i<srcSliceH; i++) { |
|
2355 | 2354 |
memcpy(dstPtr, srcPtr, length); |
2356 | 2355 |
srcPtr+= srcStride[0]; |
2357 | 2356 |
dstPtr+= dstStride[0]; |
... | ... |
@@ -2364,8 +2304,7 @@ static int planarCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli |
2364 | 2364 |
int srcSliceH, uint8_t* dst[], int dstStride[]) |
2365 | 2365 |
{ |
2366 | 2366 |
int plane, i, j; |
2367 |
- for (plane=0; plane<4; plane++) |
|
2368 |
- { |
|
2367 |
+ for (plane=0; plane<4; plane++) { |
|
2369 | 2368 |
int length= (plane==0 || plane==3) ? c->srcW : -((-c->srcW )>>c->chrDstHSubSample); |
2370 | 2369 |
int y= (plane==0 || plane==3) ? srcSliceY: -((-srcSliceY)>>c->chrDstVSubSample); |
2371 | 2370 |
int height= (plane==0 || plane==3) ? srcSliceH: -((-srcSliceH)>>c->chrDstVSubSample); |
... | ... |
@@ -2375,32 +2314,31 @@ static int planarCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli |
2375 | 2375 |
if (!dst[plane]) continue; |
2376 | 2376 |
// ignore palette for GRAY8 |
2377 | 2377 |
if (plane == 1 && !dst[2]) continue; |
2378 |
- if (!src[plane] || (plane == 1 && !src[2])){ |
|
2378 |
+ if (!src[plane] || (plane == 1 && !src[2])) { |
|
2379 | 2379 |
if(is16BPS(c->dstFormat)) |
2380 | 2380 |
length*=2; |
2381 | 2381 |
fillPlane(dst[plane], dstStride[plane], length, height, y, (plane==3) ? 255 : 128); |
2382 |
- }else |
|
2383 |
- { |
|
2384 |
- if(is16BPS(c->srcFormat) && !is16BPS(c->dstFormat)){ |
|
2382 |
+ } else { |
|
2383 |
+ if(is16BPS(c->srcFormat) && !is16BPS(c->dstFormat)) { |
|
2385 | 2384 |
if (!isBE(c->srcFormat)) srcPtr++; |
2386 |
- for (i=0; i<height; i++){ |
|
2385 |
+ for (i=0; i<height; i++) { |
|
2387 | 2386 |
for (j=0; j<length; j++) dstPtr[j] = srcPtr[j<<1]; |
2388 | 2387 |
srcPtr+= srcStride[plane]; |
2389 | 2388 |
dstPtr+= dstStride[plane]; |
2390 | 2389 |
} |
2391 |
- }else if(!is16BPS(c->srcFormat) && is16BPS(c->dstFormat)){ |
|
2392 |
- for (i=0; i<height; i++){ |
|
2393 |
- for (j=0; j<length; j++){ |
|
2390 |
+ } else if(!is16BPS(c->srcFormat) && is16BPS(c->dstFormat)) { |
|
2391 |
+ for (i=0; i<height; i++) { |
|
2392 |
+ for (j=0; j<length; j++) { |
|
2394 | 2393 |
dstPtr[ j<<1 ] = srcPtr[j]; |
2395 | 2394 |
dstPtr[(j<<1)+1] = srcPtr[j]; |
2396 | 2395 |
} |
2397 | 2396 |
srcPtr+= srcStride[plane]; |
2398 | 2397 |
dstPtr+= dstStride[plane]; |
2399 | 2398 |
} |
2400 |
- }else if(is16BPS(c->srcFormat) && is16BPS(c->dstFormat) |
|
2401 |
- && isBE(c->srcFormat) != isBE(c->dstFormat)){ |
|
2399 |
+ } else if(is16BPS(c->srcFormat) && is16BPS(c->dstFormat) |
|
2400 |
+ && isBE(c->srcFormat) != isBE(c->dstFormat)) { |
|
2402 | 2401 |
|
2403 |
- for (i=0; i<height; i++){ |
|
2402 |
+ for (i=0; i<height; i++) { |
|
2404 | 2403 |
for (j=0; j<length; j++) |
2405 | 2404 |
((uint16_t*)dstPtr)[j] = bswap_16(((uint16_t*)srcPtr)[j]); |
2406 | 2405 |
srcPtr+= srcStride[plane]; |
... | ... |
@@ -2408,12 +2346,10 @@ static int planarCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli |
2408 | 2408 |
} |
2409 | 2409 |
} else if (dstStride[plane]==srcStride[plane] && srcStride[plane] > 0) |
2410 | 2410 |
memcpy(dst[plane] + dstStride[plane]*y, src[plane], height*dstStride[plane]); |
2411 |
- else |
|
2412 |
- { |
|
2411 |
+ else { |
|
2413 | 2412 |
if(is16BPS(c->srcFormat) && is16BPS(c->dstFormat)) |
2414 | 2413 |
length*=2; |
2415 |
- for (i=0; i<height; i++) |
|
2416 |
- { |
|
2414 |
+ for (i=0; i<height; i++) { |
|
2417 | 2415 |
memcpy(dstPtr, srcPtr, length); |
2418 | 2416 |
srcPtr+= srcStride[plane]; |
2419 | 2417 |
dstPtr+= dstStride[plane]; |
... | ... |
@@ -2425,8 +2361,9 @@ static int planarCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli |
2425 | 2425 |
} |
2426 | 2426 |
|
2427 | 2427 |
|
2428 |
-static void getSubSampleFactors(int *h, int *v, int format){ |
|
2429 |
- switch(format){ |
|
2428 |
+static void getSubSampleFactors(int *h, int *v, int format) |
|
2429 |
+{ |
|
2430 |
+ switch(format) { |
|
2430 | 2431 |
case PIX_FMT_UYVY422: |
2431 | 2432 |
case PIX_FMT_YUYV422: |
2432 | 2433 |
*h=1; |
... | ... |
@@ -2475,14 +2412,16 @@ static void getSubSampleFactors(int *h, int *v, int format){ |
2475 | 2475 |
} |
2476 | 2476 |
} |
2477 | 2477 |
|
2478 |
-static uint16_t roundToInt16(int64_t f){ |
|
2478 |
+static uint16_t roundToInt16(int64_t f) |
|
2479 |
+{ |
|
2479 | 2480 |
int r= (f + (1<<15))>>16; |
2480 | 2481 |
if (r<-0x7FFF) return 0x8000; |
2481 | 2482 |
else if (r> 0x7FFF) return 0x7FFF; |
2482 | 2483 |
else return r; |
2483 | 2484 |
} |
2484 | 2485 |
|
2485 |
-int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation){ |
|
2486 |
+int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation) |
|
2487 |
+{ |
|
2486 | 2488 |
int64_t crv = inv_table[0]; |
2487 | 2489 |
int64_t cbu = inv_table[1]; |
2488 | 2490 |
int64_t cgu = -inv_table[2]; |
... | ... |
@@ -2503,10 +2442,10 @@ int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange |
2503 | 2503 |
c->uOffset= 0x0400040004000400LL; |
2504 | 2504 |
c->vOffset= 0x0400040004000400LL; |
2505 | 2505 |
|
2506 |
- if (!srcRange){ |
|
2506 |
+ if (!srcRange) { |
|
2507 | 2507 |
cy= (cy*255) / 219; |
2508 | 2508 |
oy= 16<<16; |
2509 |
- }else{ |
|
2509 |
+ } else { |
|
2510 | 2510 |
crv= (crv*224) / 255; |
2511 | 2511 |
cbu= (cbu*224) / 255; |
2512 | 2512 |
cgu= (cgu*224) / 255; |
... | ... |
@@ -2545,7 +2484,8 @@ int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange |
2545 | 2545 |
return 0; |
2546 | 2546 |
} |
2547 | 2547 |
|
2548 |
-int sws_getColorspaceDetails(SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation){ |
|
2548 |
+int sws_getColorspaceDetails(SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation) |
|
2549 |
+{ |
|
2549 | 2550 |
if (isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1; |
2550 | 2551 |
|
2551 | 2552 |
*inv_table = c->srcColorspaceTable; |
... | ... |
@@ -2619,13 +2559,11 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d |
2619 | 2619 |
srcRange = handle_jpeg(&srcFormat); |
2620 | 2620 |
dstRange = handle_jpeg(&dstFormat); |
2621 | 2621 |
|
2622 |
- if (!isSupportedIn(srcFormat)) |
|
2623 |
- { |
|
2622 |
+ if (!isSupportedIn(srcFormat)) { |
|
2624 | 2623 |
av_log(NULL, AV_LOG_ERROR, "swScaler: %s is not supported as input pixel format\n", sws_format_name(srcFormat)); |
2625 | 2624 |
return NULL; |
2626 | 2625 |
} |
2627 |
- if (!isSupportedOut(dstFormat)) |
|
2628 |
- { |
|
2626 |
+ if (!isSupportedOut(dstFormat)) { |
|
2629 | 2627 |
av_log(NULL, AV_LOG_ERROR, "swScaler: %s is not supported as output pixel format\n", sws_format_name(dstFormat)); |
2630 | 2628 |
return NULL; |
2631 | 2629 |
} |
... | ... |
@@ -2641,20 +2579,18 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d |
2641 | 2641 |
|SWS_SINC |
2642 | 2642 |
|SWS_SPLINE |
2643 | 2643 |
|SWS_BICUBLIN); |
2644 |
- if(!i || (i & (i-1))) |
|
2645 |
- { |
|
2644 |
+ if(!i || (i & (i-1))) { |
|
2646 | 2645 |
av_log(NULL, AV_LOG_ERROR, "swScaler: Exactly one scaler algorithm must be chosen\n"); |
2647 | 2646 |
return NULL; |
2648 | 2647 |
} |
2649 | 2648 |
|
2650 | 2649 |
/* sanity check */ |
2651 |
- if (srcW<4 || srcH<1 || dstW<8 || dstH<1) //FIXME check if these are enough and try to lowwer them after fixing the relevant parts of the code |
|
2652 |
- { |
|
2650 |
+ if (srcW<4 || srcH<1 || dstW<8 || dstH<1) { //FIXME check if these are enough and try to lowwer them after fixing the relevant parts of the code |
|
2653 | 2651 |
av_log(NULL, AV_LOG_ERROR, "swScaler: %dx%d -> %dx%d is invalid scaling dimension\n", |
2654 | 2652 |
srcW, srcH, dstW, dstH); |
2655 | 2653 |
return NULL; |
2656 | 2654 |
} |
2657 |
- if(srcW > VOFW || dstW > VOFW){ |
|
2655 |
+ if(srcW > VOFW || dstW > VOFW) { |
|
2658 | 2656 |
av_log(NULL, AV_LOG_ERROR, "swScaler: Compile-time maximum width is "AV_STRINGIFY(VOFW)" change VOF/VOFW and recompile\n"); |
2659 | 2657 |
return NULL; |
2660 | 2658 |
} |
... | ... |
@@ -2704,10 +2640,10 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d |
2704 | 2704 |
&& ((dstW>>c->chrDstHSubSample) <= (srcW>>1) || (flags&(SWS_FAST_BILINEAR|SWS_POINT)))) |
2705 | 2705 |
c->chrSrcHSubSample=1; |
2706 | 2706 |
|
2707 |
- if (param){ |
|
2707 |
+ if (param) { |
|
2708 | 2708 |
c->param[0] = param[0]; |
2709 | 2709 |
c->param[1] = param[1]; |
2710 |
- }else{ |
|
2710 |
+ } else { |
|
2711 | 2711 |
c->param[0] = |
2712 | 2712 |
c->param[1] = SWS_PARAM_DEFAULT; |
2713 | 2713 |
} |
... | ... |
@@ -2721,22 +2657,18 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d |
2721 | 2721 |
sws_setColorspaceDetails(c, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], srcRange, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT] /* FIXME*/, dstRange, 0, 1<<16, 1<<16); |
2722 | 2722 |
|
2723 | 2723 |
/* unscaled special cases */ |
2724 |
- if (unscaled && !usesHFilter && !usesVFilter && (srcRange == dstRange || isBGR(dstFormat) || isRGB(dstFormat))) |
|
2725 |
- { |
|
2724 |
+ if (unscaled && !usesHFilter && !usesVFilter && (srcRange == dstRange || isBGR(dstFormat) || isRGB(dstFormat))) { |
|
2726 | 2725 |
/* yv12_to_nv12 */ |
2727 |
- if ((srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P) && (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21)) |
|
2728 |
- { |
|
2726 |
+ if ((srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P) && (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21)) { |
|
2729 | 2727 |
c->swScale= PlanarToNV12Wrapper; |
2730 | 2728 |
} |
2731 | 2729 |
/* yuv2bgr */ |
2732 | 2730 |
if ((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P || srcFormat==PIX_FMT_YUVA420P) && (isBGR(dstFormat) || isRGB(dstFormat)) |
2733 |
- && !(flags & SWS_ACCURATE_RND) && !(dstH&1)) |
|
2734 |
- { |
|
2731 |
+ && !(flags & SWS_ACCURATE_RND) && !(dstH&1)) { |
|
2735 | 2732 |
c->swScale= ff_yuv2rgb_get_func_ptr(c); |
2736 | 2733 |
} |
2737 | 2734 |
|
2738 |
- if (srcFormat==PIX_FMT_YUV410P && (dstFormat==PIX_FMT_YUV420P || dstFormat==PIX_FMT_YUVA420P) && !(flags & SWS_BITEXACT)) |
|
2739 |
- { |
|
2735 |
+ if (srcFormat==PIX_FMT_YUV410P && (dstFormat==PIX_FMT_YUV420P || dstFormat==PIX_FMT_YUVA420P) && !(flags & SWS_BITEXACT)) { |
|
2740 | 2736 |
c->swScale= yvu9toyv12Wrapper; |
2741 | 2737 |
} |
2742 | 2738 |
|
... | ... |
@@ -2771,8 +2703,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d |
2771 | 2771 |
dstFormat == PIX_FMT_BGR24))) |
2772 | 2772 |
c->swScale= pal2rgbWrapper; |
2773 | 2773 |
|
2774 |
- if (srcFormat == PIX_FMT_YUV422P) |
|
2775 |
- { |
|
2774 |
+ if (srcFormat == PIX_FMT_YUV422P) { |
|
2776 | 2775 |
if (dstFormat == PIX_FMT_YUYV422) |
2777 | 2776 |
c->swScale= YUV422PToYuy2Wrapper; |
2778 | 2777 |
else if (dstFormat == PIX_FMT_UYVY422) |
... | ... |
@@ -2780,10 +2711,9 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d |
2780 | 2780 |
} |
2781 | 2781 |
|
2782 | 2782 |
/* LQ converters if -sws 0 or -sws 4*/ |
2783 |
- if (c->flags&(SWS_FAST_BILINEAR|SWS_POINT)){ |
|
2783 |
+ if (c->flags&(SWS_FAST_BILINEAR|SWS_POINT)) { |
|
2784 | 2784 |
/* yv12_to_yuy2 */ |
2785 |
- if (srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P) |
|
2786 |
- { |
|
2785 |
+ if (srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P) { |
|
2787 | 2786 |
if (dstFormat == PIX_FMT_YUYV422) |
2788 | 2787 |
c->swScale= PlanarToYuy2Wrapper; |
2789 | 2788 |
else if (dstFormat == PIX_FMT_UYVY422) |
... | ... |
@@ -2834,7 +2764,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d |
2834 | 2834 |
ff_bfin_get_unscaled_swscale (c); |
2835 | 2835 |
#endif |
2836 | 2836 |
|
2837 |
- if (c->swScale){ |
|
2837 |
+ if (c->swScale) { |
|
2838 | 2838 |
if (flags&SWS_PRINT_INFO) |
2839 | 2839 |
av_log(c, AV_LOG_INFO, "using unscaled %s -> %s special converter\n", |
2840 | 2840 |
sws_format_name(srcFormat), sws_format_name(dstFormat)); |
... | ... |
@@ -2842,11 +2772,9 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d |
2842 | 2842 |
} |
2843 | 2843 |
} |
2844 | 2844 |
|
2845 |
- if (flags & SWS_CPU_CAPS_MMX2) |
|
2846 |
- { |
|
2845 |
+ if (flags & SWS_CPU_CAPS_MMX2) { |
|
2847 | 2846 |
c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0; |
2848 |
- if (!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR)) |
|
2849 |
- { |
|
2847 |
+ if (!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR)) { |
|
2850 | 2848 |
if (flags&SWS_PRINT_INFO) |
2851 | 2849 |
av_log(c, AV_LOG_INFO, "output width is not a multiple of 32 -> no MMX2 scaler\n"); |
2852 | 2850 |
} |
... | ... |
@@ -2864,16 +2792,13 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d |
2864 | 2864 |
// this is not perfect, but no one should notice the difference, the more correct variant |
2865 | 2865 |
// would be like the vertical one, but that would require some special code for the |
2866 | 2866 |
// first and last pixel |
2867 |
- if (flags&SWS_FAST_BILINEAR) |
|
2868 |
- { |
|
2869 |
- if (c->canMMX2BeUsed) |
|
2870 |
- { |
|
2867 |
+ if (flags&SWS_FAST_BILINEAR) { |
|
2868 |
+ if (c->canMMX2BeUsed) { |
|
2871 | 2869 |
c->lumXInc+= 20; |
2872 | 2870 |
c->chrXInc+= 20; |
2873 | 2871 |
} |
2874 | 2872 |
//we don't use the x86 asm scaler if MMX is available |
2875 |
- else if (flags & SWS_CPU_CAPS_MMX) |
|
2876 |
- { |
|
2873 |
+ else if (flags & SWS_CPU_CAPS_MMX) { |
|
2877 | 2874 |
c->lumXInc = ((srcW-2)<<16)/(dstW-2) - 20; |
2878 | 2875 |
c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20; |
2879 | 2876 |
} |
... | ... |
@@ -2897,8 +2822,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d |
2897 | 2897 |
|
2898 | 2898 |
#if defined(COMPILE_MMX2) |
2899 | 2899 |
// can't downscale !!! |
2900 |
- if (c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) |
|
2901 |
- { |
|
2900 |
+ if (c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) { |
|
2902 | 2901 |
c->lumMmx2FilterCodeSize = initMMX2HScaler( dstW, c->lumXInc, NULL, NULL, NULL, 8); |
2903 | 2902 |
c->chrMmx2FilterCodeSize = initMMX2HScaler(c->chrDstW, c->chrXInc, NULL, NULL, NULL, 4); |
2904 | 2903 |
|
... | ... |
@@ -2970,8 +2894,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d |
2970 | 2970 |
// calculate buffer sizes so that they won't run out while handling these damn slices |
2971 | 2971 |
c->vLumBufSize= c->vLumFilterSize; |
2972 | 2972 |
c->vChrBufSize= c->vChrFilterSize; |
2973 |
- for (i=0; i<dstH; i++) |
|
2974 |
- { |
|
2973 |
+ for (i=0; i<dstH; i++) { |
|
2975 | 2974 |
int chrI= i*c->chrDstH / dstH; |
2976 | 2975 |
int nextSlice= FFMAX(c->vLumFilterPos[i ] + c->vLumFilterSize - 1, |
2977 | 2976 |
((c->vChrFilterPos[chrI] + c->vChrFilterSize - 1)<<c->chrSrcVSubSample)); |
... | ... |
@@ -3006,8 +2929,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d |
3006 | 3006 |
|
3007 | 3007 |
assert(c->chrDstH <= dstH); |
3008 | 3008 |
|
3009 |
- if (flags&SWS_PRINT_INFO) |
|
3010 |
- { |
|
3009 |
+ if (flags&SWS_PRINT_INFO) { |
|
3011 | 3010 |
#ifdef DITHER1XBPP |
3012 | 3011 |
const char *dither= " dithered"; |
3013 | 3012 |
#else |
... | ... |
@@ -3057,14 +2979,11 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d |
3057 | 3057 |
av_log(c, AV_LOG_INFO, "using C\n"); |
3058 | 3058 |
} |
3059 | 3059 |
|
3060 |
- if (flags & SWS_PRINT_INFO) |
|
3061 |
- { |
|
3062 |
- if (flags & SWS_CPU_CAPS_MMX) |
|
3063 |
- { |
|
3060 |
+ if (flags & SWS_PRINT_INFO) { |
|
3061 |
+ if (flags & SWS_CPU_CAPS_MMX) { |
|
3064 | 3062 |
if (c->canMMX2BeUsed && (flags&SWS_FAST_BILINEAR)) |
3065 | 3063 |
av_log(c, AV_LOG_VERBOSE, "using FAST_BILINEAR MMX2 scaler for horizontal scaling\n"); |
3066 |
- else |
|
3067 |
- { |
|
3064 |
+ else { |
|
3068 | 3065 |
if (c->hLumFilterSize==4) |
3069 | 3066 |
av_log(c, AV_LOG_VERBOSE, "using 4-tap MMX scaler for horizontal luminance scaling\n"); |
3070 | 3067 |
else if (c->hLumFilterSize==8) |
... | ... |
@@ -3079,9 +2998,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d |
3079 | 3079 |
else |
3080 | 3080 |
av_log(c, AV_LOG_VERBOSE, "using n-tap MMX scaler for horizontal chrominance scaling\n"); |
3081 | 3081 |
} |
3082 |
- } |
|
3083 |
- else |
|
3084 |
- { |
|
3082 |
+ } else { |
|
3085 | 3083 |
#if ARCH_X86 |
3086 | 3084 |
av_log(c, AV_LOG_VERBOSE, "using x86 asm scaler for horizontal scaling\n"); |
3087 | 3085 |
#else |
... | ... |
@@ -3091,15 +3008,12 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d |
3091 | 3091 |
av_log(c, AV_LOG_VERBOSE, "using C scaler for horizontal scaling\n"); |
3092 | 3092 |
#endif |
3093 | 3093 |
} |
3094 |
- if (isPlanarYUV(dstFormat)) |
|
3095 |
- { |
|
3094 |
+ if (isPlanarYUV(dstFormat)) { |
|
3096 | 3095 |
if (c->vLumFilterSize==1) |
3097 | 3096 |
av_log(c, AV_LOG_VERBOSE, "using 1-tap %s \"scaler\" for vertical scaling (YV12 like)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C"); |
3098 | 3097 |
else |
3099 | 3098 |
av_log(c, AV_LOG_VERBOSE, "using n-tap %s scaler for vertical scaling (YV12 like)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C"); |
3100 |
- } |
|
3101 |
- else |
|
3102 |
- { |
|
3099 |
+ } else { |
|
3103 | 3100 |
if (c->vLumFilterSize==1 && c->vChrFilterSize==2) |
3104 | 3101 |
av_log(c, AV_LOG_VERBOSE, "using 1-tap %s \"scaler\" for vertical luminance scaling (BGR)\n" |
3105 | 3102 |
" 2-tap scaler for vertical chrominance scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C"); |
... | ... |
@@ -3121,8 +3035,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d |
3121 | 3121 |
|
3122 | 3122 |
av_log(c, AV_LOG_VERBOSE, "%dx%d -> %dx%d\n", srcW, srcH, dstW, dstH); |
3123 | 3123 |
} |
3124 |
- if (flags & SWS_PRINT_INFO) |
|
3125 |
- { |
|
3124 |
+ if (flags & SWS_PRINT_INFO) { |
|
3126 | 3125 |
av_log(c, AV_LOG_DEBUG, "lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n", |
3127 | 3126 |
c->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc); |
3128 | 3127 |
av_log(c, AV_LOG_DEBUG, "chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n", |
... | ... |
@@ -3133,10 +3046,11 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d |
3133 | 3133 |
return c; |
3134 | 3134 |
} |
3135 | 3135 |
|
3136 |
-static void reset_ptr(uint8_t* src[], int format){ |
|
3136 |
+static void reset_ptr(uint8_t* src[], int format) |
|
3137 |
+{ |
|
3137 | 3138 |
if(!isALPHA(format)) |
3138 | 3139 |
src[3]=NULL; |
3139 |
- if(!isPlanarYUV(format)){ |
|
3140 |
+ if(!isPlanarYUV(format)) { |
|
3140 | 3141 |
src[3]=src[2]=NULL; |
3141 | 3142 |
if( format != PIX_FMT_PAL8 |
3142 | 3143 |
&& format != PIX_FMT_RGB8 |
... | ... |
@@ -3153,7 +3067,8 @@ static void reset_ptr(uint8_t* src[], int format){ |
3153 | 3153 |
* Assumes planar YUV to be in YUV order instead of YVU. |
3154 | 3154 |
*/ |
3155 | 3155 |
int sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
3156 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){ |
|
3156 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
3157 |
+{ |
|
3157 | 3158 |
int i; |
3158 | 3159 |
uint8_t* src2[4]= {src[0], src[1], src[2], src[3]}; |
3159 | 3160 |
uint8_t* dst2[4]= {dst[0], dst[1], dst[2], dst[3]}; |
... | ... |
@@ -3166,27 +3081,27 @@ int sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
3166 | 3166 |
if (srcSliceY == 0) c->sliceDir = 1; else c->sliceDir = -1; |
3167 | 3167 |
} |
3168 | 3168 |
|
3169 |
- if (usePal(c->srcFormat)){ |
|
3170 |
- for (i=0; i<256; i++){ |
|
3169 |
+ if (usePal(c->srcFormat)) { |
|
3170 |
+ for (i=0; i<256; i++) { |
|
3171 | 3171 |
int p, r, g, b,y,u,v; |
3172 |
- if(c->srcFormat == PIX_FMT_PAL8){ |
|
3172 |
+ if(c->srcFormat == PIX_FMT_PAL8) { |
|
3173 | 3173 |
p=((uint32_t*)(src[1]))[i]; |
3174 | 3174 |
r= (p>>16)&0xFF; |
3175 | 3175 |
g= (p>> 8)&0xFF; |
3176 | 3176 |
b= p &0xFF; |
3177 |
- }else if(c->srcFormat == PIX_FMT_RGB8){ |
|
3177 |
+ } else if(c->srcFormat == PIX_FMT_RGB8) { |
|
3178 | 3178 |
r= (i>>5 )*36; |
3179 | 3179 |
g= ((i>>2)&7)*36; |
3180 | 3180 |
b= (i&3 )*85; |
3181 |
- }else if(c->srcFormat == PIX_FMT_BGR8){ |
|
3181 |
+ } else if(c->srcFormat == PIX_FMT_BGR8) { |
|
3182 | 3182 |
b= (i>>6 )*85; |
3183 | 3183 |
g= ((i>>3)&7)*36; |
3184 | 3184 |
r= (i&7 )*36; |
3185 |
- }else if(c->srcFormat == PIX_FMT_RGB4_BYTE){ |
|
3185 |
+ } else if(c->srcFormat == PIX_FMT_RGB4_BYTE) { |
|
3186 | 3186 |
r= (i>>3 )*255; |
3187 | 3187 |
g= ((i>>1)&3)*85; |
3188 | 3188 |
b= (i&1 )*255; |
3189 |
- }else { |
|
3189 |
+ } else { |
|
3190 | 3190 |
assert(c->srcFormat == PIX_FMT_BGR4_BYTE); |
3191 | 3191 |
b= (i>>3 )*255; |
3192 | 3192 |
g= ((i>>1)&3)*85; |
... | ... |
@@ -3261,7 +3176,8 @@ int sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
3261 | 3261 |
|
3262 | 3262 |
#if LIBSWSCALE_VERSION_MAJOR < 1 |
3263 | 3263 |
int sws_scale_ordered(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
3264 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){ |
|
3264 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
3265 |
+{ |
|
3265 | 3266 |
return sws_scale(c, src, srcStride, srcSliceY, srcSliceH, dst, dstStride); |
3266 | 3267 |
} |
3267 | 3268 |
#endif |
... | ... |
@@ -3273,23 +3189,23 @@ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, |
3273 | 3273 |
{ |
3274 | 3274 |
SwsFilter *filter= av_malloc(sizeof(SwsFilter)); |
3275 | 3275 |
|
3276 |
- if (lumaGBlur!=0.0){ |
|
3276 |
+ if (lumaGBlur!=0.0) { |
|
3277 | 3277 |
filter->lumH= sws_getGaussianVec(lumaGBlur, 3.0); |
3278 | 3278 |
filter->lumV= sws_getGaussianVec(lumaGBlur, 3.0); |
3279 |
- }else{ |
|
3279 |
+ } else { |
|
3280 | 3280 |
filter->lumH= sws_getIdentityVec(); |
3281 | 3281 |
filter->lumV= sws_getIdentityVec(); |
3282 | 3282 |
} |
3283 | 3283 |
|
3284 |
- if (chromaGBlur!=0.0){ |
|
3284 |
+ if (chromaGBlur!=0.0) { |
|
3285 | 3285 |
filter->chrH= sws_getGaussianVec(chromaGBlur, 3.0); |
3286 | 3286 |
filter->chrV= sws_getGaussianVec(chromaGBlur, 3.0); |
3287 |
- }else{ |
|
3287 |
+ } else { |
|
3288 | 3288 |
filter->chrH= sws_getIdentityVec(); |
3289 | 3289 |
filter->chrV= sws_getIdentityVec(); |
3290 | 3290 |
} |
3291 | 3291 |
|
3292 |
- if (chromaSharpen!=0.0){ |
|
3292 |
+ if (chromaSharpen!=0.0) { |
|
3293 | 3293 |
SwsVector *id= sws_getIdentityVec(); |
3294 | 3294 |
sws_scaleVec(filter->chrH, -chromaSharpen); |
3295 | 3295 |
sws_scaleVec(filter->chrV, -chromaSharpen); |
... | ... |
@@ -3298,7 +3214,7 @@ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, |
3298 | 3298 |
sws_freeVec(id); |
3299 | 3299 |
} |
3300 | 3300 |
|
3301 |
- if (lumaSharpen!=0.0){ |
|
3301 |
+ if (lumaSharpen!=0.0) { |
|
3302 | 3302 |
SwsVector *id= sws_getIdentityVec(); |
3303 | 3303 |
sws_scaleVec(filter->lumH, -lumaSharpen); |
3304 | 3304 |
sws_scaleVec(filter->lumV, -lumaSharpen); |
... | ... |
@@ -3324,7 +3240,8 @@ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, |
3324 | 3324 |
return filter; |
3325 | 3325 |
} |
3326 | 3326 |
|
3327 |
-SwsVector *sws_getGaussianVec(double variance, double quality){ |
|
3327 |
+SwsVector *sws_getGaussianVec(double variance, double quality) |
|
3328 |
+{ |
|
3328 | 3329 |
const int length= (int)(variance*quality + 0.5) | 1; |
3329 | 3330 |
int i; |
3330 | 3331 |
double *coeff= av_malloc(length*sizeof(double)); |
... | ... |
@@ -3334,8 +3251,7 @@ SwsVector *sws_getGaussianVec(double variance, double quality){ |
3334 | 3334 |
vec->coeff= coeff; |
3335 | 3335 |
vec->length= length; |
3336 | 3336 |
|
3337 |
- for (i=0; i<length; i++) |
|
3338 |
- { |
|
3337 |
+ for (i=0; i<length; i++) { |
|
3339 | 3338 |
double dist= i-middle; |
3340 | 3339 |
coeff[i]= exp(-dist*dist/(2*variance*variance)) / sqrt(2*variance*PI); |
3341 | 3340 |
} |
... | ... |
@@ -3345,7 +3261,8 @@ SwsVector *sws_getGaussianVec(double variance, double quality){ |
3345 | 3345 |
return vec; |
3346 | 3346 |
} |
3347 | 3347 |
|
3348 |
-SwsVector *sws_getConstVec(double c, int length){ |
|
3348 |
+SwsVector *sws_getConstVec(double c, int length) |
|
3349 |
+{ |
|
3349 | 3350 |
int i; |
3350 | 3351 |
double *coeff= av_malloc(length*sizeof(double)); |
3351 | 3352 |
SwsVector *vec= av_malloc(sizeof(SwsVector)); |
... | ... |
@@ -3360,11 +3277,13 @@ SwsVector *sws_getConstVec(double c, int length){ |
3360 | 3360 |
} |
3361 | 3361 |
|
3362 | 3362 |
|
3363 |
-SwsVector *sws_getIdentityVec(void){ |
|
3363 |
+SwsVector *sws_getIdentityVec(void) |
|
3364 |
+{ |
|
3364 | 3365 |
return sws_getConstVec(1.0, 1); |
3365 | 3366 |
} |
3366 | 3367 |
|
3367 |
-double sws_dcVec(SwsVector *a){ |
|
3368 |
+double sws_dcVec(SwsVector *a) |
|
3369 |
+{ |
|
3368 | 3370 |
int i; |
3369 | 3371 |
double sum=0; |
3370 | 3372 |
|
... | ... |
@@ -3374,18 +3293,21 @@ double sws_dcVec(SwsVector *a){ |
3374 | 3374 |
return sum; |
3375 | 3375 |
} |
3376 | 3376 |
|
3377 |
-void sws_scaleVec(SwsVector *a, double scalar){ |
|
3377 |
+void sws_scaleVec(SwsVector *a, double scalar) |
|
3378 |
+{ |
|
3378 | 3379 |
int i; |
3379 | 3380 |
|
3380 | 3381 |
for (i=0; i<a->length; i++) |
3381 | 3382 |
a->coeff[i]*= scalar; |
3382 | 3383 |
} |
3383 | 3384 |
|
3384 |
-void sws_normalizeVec(SwsVector *a, double height){ |
|
3385 |
+void sws_normalizeVec(SwsVector *a, double height) |
|
3386 |
+{ |
|
3385 | 3387 |
sws_scaleVec(a, height/sws_dcVec(a)); |
3386 | 3388 |
} |
3387 | 3389 |
|
3388 |
-static SwsVector *sws_getConvVec(SwsVector *a, SwsVector *b){ |
|
3390 |
+static SwsVector *sws_getConvVec(SwsVector *a, SwsVector *b) |
|
3391 |
+{ |
|
3389 | 3392 |
int length= a->length + b->length - 1; |
3390 | 3393 |
double *coeff= av_malloc(length*sizeof(double)); |
3391 | 3394 |
int i, j; |
... | ... |
@@ -3396,10 +3318,8 @@ static SwsVector *sws_getConvVec(SwsVector *a, SwsVector *b){ |
3396 | 3396 |
|
3397 | 3397 |
for (i=0; i<length; i++) coeff[i]= 0.0; |
3398 | 3398 |
|
3399 |
- for (i=0; i<a->length; i++) |
|
3400 |
- { |
|
3401 |
- for (j=0; j<b->length; j++) |
|
3402 |
- { |
|
3399 |
+ for (i=0; i<a->length; i++) { |
|
3400 |
+ for (j=0; j<b->length; j++) { |
|
3403 | 3401 |
coeff[i+j]+= a->coeff[i]*b->coeff[j]; |
3404 | 3402 |
} |
3405 | 3403 |
} |
... | ... |
@@ -3407,7 +3327,8 @@ static SwsVector *sws_getConvVec(SwsVector *a, SwsVector *b){ |
3407 | 3407 |
return vec; |
3408 | 3408 |
} |
3409 | 3409 |
|
3410 |
-static SwsVector *sws_sumVec(SwsVector *a, SwsVector *b){ |
|
3410 |
+static SwsVector *sws_sumVec(SwsVector *a, SwsVector *b) |
|
3411 |
+{ |
|
3411 | 3412 |
int length= FFMAX(a->length, b->length); |
3412 | 3413 |
double *coeff= av_malloc(length*sizeof(double)); |
3413 | 3414 |
int i; |
... | ... |
@@ -3424,7 +3345,8 @@ static SwsVector *sws_sumVec(SwsVector *a, SwsVector *b){ |
3424 | 3424 |
return vec; |
3425 | 3425 |
} |
3426 | 3426 |
|
3427 |
-static SwsVector *sws_diffVec(SwsVector *a, SwsVector *b){ |
|
3427 |
+static SwsVector *sws_diffVec(SwsVector *a, SwsVector *b) |
|
3428 |
+{ |
|
3428 | 3429 |
int length= FFMAX(a->length, b->length); |
3429 | 3430 |
double *coeff= av_malloc(length*sizeof(double)); |
3430 | 3431 |
int i; |
... | ... |
@@ -3442,7 +3364,8 @@ static SwsVector *sws_diffVec(SwsVector *a, SwsVector *b){ |
3442 | 3442 |
} |
3443 | 3443 |
|
3444 | 3444 |
/* shift left / or right if "shift" is negative */ |
3445 |
-static SwsVector *sws_getShiftedVec(SwsVector *a, int shift){ |
|
3445 |
+static SwsVector *sws_getShiftedVec(SwsVector *a, int shift) |
|
3446 |
+{ |
|
3446 | 3447 |
int length= a->length + FFABS(shift)*2; |
3447 | 3448 |
double *coeff= av_malloc(length*sizeof(double)); |
3448 | 3449 |
int i; |
... | ... |
@@ -3453,15 +3376,15 @@ static SwsVector *sws_getShiftedVec(SwsVector *a, int shift){ |
3453 | 3453 |
|
3454 | 3454 |
for (i=0; i<length; i++) coeff[i]= 0.0; |
3455 | 3455 |
|
3456 |
- for (i=0; i<a->length; i++) |
|
3457 |
- { |
|
3456 |
+ for (i=0; i<a->length; i++) { |
|
3458 | 3457 |
coeff[i + (length-1)/2 - (a->length-1)/2 - shift]= a->coeff[i]; |
3459 | 3458 |
} |
3460 | 3459 |
|
3461 | 3460 |
return vec; |
3462 | 3461 |
} |
3463 | 3462 |
|
3464 |
-void sws_shiftVec(SwsVector *a, int shift){ |
|
3463 |
+void sws_shiftVec(SwsVector *a, int shift) |
|
3464 |
+{ |
|
3465 | 3465 |
SwsVector *shifted= sws_getShiftedVec(a, shift); |
3466 | 3466 |
av_free(a->coeff); |
3467 | 3467 |
a->coeff= shifted->coeff; |
... | ... |
@@ -3469,7 +3392,8 @@ void sws_shiftVec(SwsVector *a, int shift){ |
3469 | 3469 |
av_free(shifted); |
3470 | 3470 |
} |
3471 | 3471 |
|
3472 |
-void sws_addVec(SwsVector *a, SwsVector *b){ |
|
3472 |
+void sws_addVec(SwsVector *a, SwsVector *b) |
|
3473 |
+{ |
|
3473 | 3474 |
SwsVector *sum= sws_sumVec(a, b); |
3474 | 3475 |
av_free(a->coeff); |
3475 | 3476 |
a->coeff= sum->coeff; |
... | ... |
@@ -3477,7 +3401,8 @@ void sws_addVec(SwsVector *a, SwsVector *b){ |
3477 | 3477 |
av_free(sum); |
3478 | 3478 |
} |
3479 | 3479 |
|
3480 |
-void sws_subVec(SwsVector *a, SwsVector *b){ |
|
3480 |
+void sws_subVec(SwsVector *a, SwsVector *b) |
|
3481 |
+{ |
|
3481 | 3482 |
SwsVector *diff= sws_diffVec(a, b); |
3482 | 3483 |
av_free(a->coeff); |
3483 | 3484 |
a->coeff= diff->coeff; |
... | ... |
@@ -3485,7 +3410,8 @@ void sws_subVec(SwsVector *a, SwsVector *b){ |
3485 | 3485 |
av_free(diff); |
3486 | 3486 |
} |
3487 | 3487 |
|
3488 |
-void sws_convVec(SwsVector *a, SwsVector *b){ |
|
3488 |
+void sws_convVec(SwsVector *a, SwsVector *b) |
|
3489 |
+{ |
|
3489 | 3490 |
SwsVector *conv= sws_getConvVec(a, b); |
3490 | 3491 |
av_free(a->coeff); |
3491 | 3492 |
a->coeff= conv->coeff; |
... | ... |
@@ -3493,7 +3419,8 @@ void sws_convVec(SwsVector *a, SwsVector *b){ |
3493 | 3493 |
av_free(conv); |
3494 | 3494 |
} |
3495 | 3495 |
|
3496 |
-SwsVector *sws_cloneVec(SwsVector *a){ |
|
3496 |
+SwsVector *sws_cloneVec(SwsVector *a) |
|
3497 |
+{ |
|
3497 | 3498 |
double *coeff= av_malloc(a->length*sizeof(double)); |
3498 | 3499 |
int i; |
3499 | 3500 |
SwsVector *vec= av_malloc(sizeof(SwsVector)); |
... | ... |
@@ -3506,7 +3433,8 @@ SwsVector *sws_cloneVec(SwsVector *a){ |
3506 | 3506 |
return vec; |
3507 | 3507 |
} |
3508 | 3508 |
|
3509 |
-void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level){ |
|
3509 |
+void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level) |
|
3510 |
+{ |
|
3510 | 3511 |
int i; |
3511 | 3512 |
double max=0; |
3512 | 3513 |
double min=0; |
... | ... |
@@ -3520,8 +3448,7 @@ void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level){ |
3520 | 3520 |
|
3521 | 3521 |
range= max - min; |
3522 | 3522 |
|
3523 |
- for (i=0; i<a->length; i++) |
|
3524 |
- { |
|
3523 |
+ for (i=0; i<a->length; i++) { |
|
3525 | 3524 |
int x= (int)((a->coeff[i]-min)*60.0/range +0.5); |
3526 | 3525 |
av_log(log_ctx, log_level, "%1.3f ", a->coeff[i]); |
3527 | 3526 |
for (;x>0; x--) av_log(log_ctx, log_level, " "); |
... | ... |
@@ -3530,19 +3457,22 @@ void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level){ |
3530 | 3530 |
} |
3531 | 3531 |
|
3532 | 3532 |
#if LIBSWSCALE_VERSION_MAJOR < 1 |
3533 |
-void sws_printVec(SwsVector *a){ |
|
3533 |
+void sws_printVec(SwsVector *a) |
|
3534 |
+{ |
|
3534 | 3535 |
sws_printVec2(a, NULL, AV_LOG_DEBUG); |
3535 | 3536 |
} |
3536 | 3537 |
#endif |
3537 | 3538 |
|
3538 |
-void sws_freeVec(SwsVector *a){ |
|
3539 |
+void sws_freeVec(SwsVector *a) |
|
3540 |
+{ |
|
3539 | 3541 |
if (!a) return; |
3540 | 3542 |
av_freep(&a->coeff); |
3541 | 3543 |
a->length=0; |
3542 | 3544 |
av_free(a); |
3543 | 3545 |
} |
3544 | 3546 |
|
3545 |
-void sws_freeFilter(SwsFilter *filter){ |
|
3547 |
+void sws_freeFilter(SwsFilter *filter) |
|
3548 |
+{ |
|
3546 | 3549 |
if (!filter) return; |
3547 | 3550 |
|
3548 | 3551 |
if (filter->lumH) sws_freeVec(filter->lumH); |
... | ... |
@@ -3553,25 +3483,24 @@ void sws_freeFilter(SwsFilter *filter){ |
3553 | 3553 |
} |
3554 | 3554 |
|
3555 | 3555 |
|
3556 |
-void sws_freeContext(SwsContext *c){ |
|
3556 |
+void sws_freeContext(SwsContext *c) |
|
3557 |
+{ |
|
3557 | 3558 |
int i; |
3558 | 3559 |
if (!c) return; |
3559 | 3560 |
|
3560 |
- if (c->lumPixBuf) |
|
3561 |
- { |
|
3561 |
+ if (c->lumPixBuf) { |
|
3562 | 3562 |
for (i=0; i<c->vLumBufSize; i++) |
3563 | 3563 |
av_freep(&c->lumPixBuf[i]); |
3564 | 3564 |
av_freep(&c->lumPixBuf); |
3565 | 3565 |
} |
3566 | 3566 |
|
3567 |
- if (c->chrPixBuf) |
|
3568 |
- { |
|
3567 |
+ if (c->chrPixBuf) { |
|
3569 | 3568 |
for (i=0; i<c->vChrBufSize; i++) |
3570 | 3569 |
av_freep(&c->chrPixBuf[i]); |
3571 | 3570 |
av_freep(&c->chrPixBuf); |
3572 | 3571 |
} |
3573 | 3572 |
|
3574 |
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf){ |
|
3573 |
+ if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { |
|
3575 | 3574 |
for (i=0; i<c->vLumBufSize; i++) |
3576 | 3575 |
av_freep(&c->alpPixBuf[i]); |
3577 | 3576 |
av_freep(&c->alpPixBuf); |
... | ... |
@@ -64,7 +64,7 @@ typedef int (*SwsFunc)(struct SwsContext *context, uint8_t* src[], |
64 | 64 |
uint8_t* dst[], int dstStride[]); |
65 | 65 |
|
66 | 66 |
/* This struct should be aligned on at least a 32-byte boundary. */ |
67 |
-typedef struct SwsContext{ |
|
67 |
+typedef struct SwsContext { |
|
68 | 68 |
/** |
69 | 69 |
* info on struct for av_log |
70 | 70 |
*/ |
... | ... |
@@ -906,23 +906,23 @@ static inline void RENAME(yuv2yuvX)(SwsContext *c, const int16_t *lumFilter, con |
906 | 906 |
uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, long dstW, long chrDstW) |
907 | 907 |
{ |
908 | 908 |
#if COMPILE_TEMPLATE_MMX |
909 |
- if(!(c->flags & SWS_BITEXACT)){ |
|
910 |
- if (c->flags & SWS_ACCURATE_RND){ |
|
911 |
- if (uDest){ |
|
909 |
+ if(!(c->flags & SWS_BITEXACT)) { |
|
910 |
+ if (c->flags & SWS_ACCURATE_RND) { |
|
911 |
+ if (uDest) { |
|
912 | 912 |
YSCALEYUV2YV12X_ACCURATE( "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW) |
913 | 913 |
YSCALEYUV2YV12X_ACCURATE(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW) |
914 | 914 |
} |
915 |
- if (CONFIG_SWSCALE_ALPHA && aDest){ |
|
915 |
+ if (CONFIG_SWSCALE_ALPHA && aDest) { |
|
916 | 916 |
YSCALEYUV2YV12X_ACCURATE( "0", ALP_MMX_FILTER_OFFSET, aDest, dstW) |
917 | 917 |
} |
918 | 918 |
|
919 | 919 |
YSCALEYUV2YV12X_ACCURATE("0", LUM_MMX_FILTER_OFFSET, dest, dstW) |
920 |
- }else{ |
|
921 |
- if (uDest){ |
|
920 |
+ } else { |
|
921 |
+ if (uDest) { |
|
922 | 922 |
YSCALEYUV2YV12X( "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW) |
923 | 923 |
YSCALEYUV2YV12X(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW) |
924 | 924 |
} |
925 |
- if (CONFIG_SWSCALE_ALPHA && aDest){ |
|
925 |
+ if (CONFIG_SWSCALE_ALPHA && aDest) { |
|
926 | 926 |
YSCALEYUV2YV12X( "0", ALP_MMX_FILTER_OFFSET, aDest, dstW) |
927 | 927 |
} |
928 | 928 |
|
... | ... |
@@ -956,15 +956,15 @@ static inline void RENAME(yuv2yuv1)(SwsContext *c, const int16_t *lumSrc, const |
956 | 956 |
{ |
957 | 957 |
int i; |
958 | 958 |
#if COMPILE_TEMPLATE_MMX |
959 |
- if(!(c->flags & SWS_BITEXACT)){ |
|
959 |
+ if(!(c->flags & SWS_BITEXACT)) { |
|
960 | 960 |
long p= 4; |
961 | 961 |
uint8_t *src[4]= {alpSrc + dstW, lumSrc + dstW, chrSrc + chrDstW, chrSrc + VOFW + chrDstW}; |
962 | 962 |
uint8_t *dst[4]= {aDest, dest, uDest, vDest}; |
963 | 963 |
x86_reg counter[4]= {dstW, dstW, chrDstW, chrDstW}; |
964 | 964 |
|
965 |
- if (c->flags & SWS_ACCURATE_RND){ |
|
966 |
- while(p--){ |
|
967 |
- if (dst[p]){ |
|
965 |
+ if (c->flags & SWS_ACCURATE_RND) { |
|
966 |
+ while(p--) { |
|
967 |
+ if (dst[p]) { |
|
968 | 968 |
__asm__ volatile( |
969 | 969 |
YSCALEYUV2YV121_ACCURATE |
970 | 970 |
:: "r" (src[p]), "r" (dst[p] + counter[p]), |
... | ... |
@@ -973,9 +973,9 @@ static inline void RENAME(yuv2yuv1)(SwsContext *c, const int16_t *lumSrc, const |
973 | 973 |
); |
974 | 974 |
} |
975 | 975 |
} |
976 |
- }else{ |
|
977 |
- while(p--){ |
|
978 |
- if (dst[p]){ |
|
976 |
+ } else { |
|
977 |
+ while(p--) { |
|
978 |
+ if (dst[p]) { |
|
979 | 979 |
__asm__ volatile( |
980 | 980 |
YSCALEYUV2YV121 |
981 | 981 |
:: "r" (src[p]), "r" (dst[p] + counter[p]), |
... | ... |
@@ -988,11 +988,10 @@ static inline void RENAME(yuv2yuv1)(SwsContext *c, const int16_t *lumSrc, const |
988 | 988 |
return; |
989 | 989 |
} |
990 | 990 |
#endif |
991 |
- for (i=0; i<dstW; i++) |
|
992 |
- { |
|
991 |
+ for (i=0; i<dstW; i++) { |
|
993 | 992 |
int val= (lumSrc[i]+64)>>7; |
994 | 993 |
|
995 |
- if (val&256){ |
|
994 |
+ if (val&256) { |
|
996 | 995 |
if (val<0) val=0; |
997 | 996 |
else val=255; |
998 | 997 |
} |
... | ... |
@@ -1001,12 +1000,11 @@ static inline void RENAME(yuv2yuv1)(SwsContext *c, const int16_t *lumSrc, const |
1001 | 1001 |
} |
1002 | 1002 |
|
1003 | 1003 |
if (uDest) |
1004 |
- for (i=0; i<chrDstW; i++) |
|
1005 |
- { |
|
1004 |
+ for (i=0; i<chrDstW; i++) { |
|
1006 | 1005 |
int u=(chrSrc[i ]+64)>>7; |
1007 | 1006 |
int v=(chrSrc[i + VOFW]+64)>>7; |
1008 | 1007 |
|
1009 |
- if ((u|v)&256){ |
|
1008 |
+ if ((u|v)&256) { |
|
1010 | 1009 |
if (u<0) u=0; |
1011 | 1010 |
else if (u>255) u=255; |
1012 | 1011 |
if (v<0) v=0; |
... | ... |
@@ -1018,7 +1016,7 @@ static inline void RENAME(yuv2yuv1)(SwsContext *c, const int16_t *lumSrc, const |
1018 | 1018 |
} |
1019 | 1019 |
|
1020 | 1020 |
if (CONFIG_SWSCALE_ALPHA && aDest) |
1021 |
- for (i=0; i<dstW; i++){ |
|
1021 |
+ for (i=0; i<dstW; i++) { |
|
1022 | 1022 |
int val= (alpSrc[i]+64)>>7; |
1023 | 1023 |
aDest[i]= av_clip_uint8(val); |
1024 | 1024 |
} |
... | ... |
@@ -1034,11 +1032,11 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, const int16_t *lumFilter, |
1034 | 1034 |
{ |
1035 | 1035 |
#if COMPILE_TEMPLATE_MMX |
1036 | 1036 |
x86_reg dummy=0; |
1037 |
- if(!(c->flags & SWS_BITEXACT)){ |
|
1038 |
- if (c->flags & SWS_ACCURATE_RND){ |
|
1039 |
- switch(c->dstFormat){ |
|
1037 |
+ if(!(c->flags & SWS_BITEXACT)) { |
|
1038 |
+ if (c->flags & SWS_ACCURATE_RND) { |
|
1039 |
+ switch(c->dstFormat) { |
|
1040 | 1040 |
case PIX_FMT_RGB32: |
1041 |
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf){ |
|
1041 |
+ if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { |
|
1042 | 1042 |
YSCALEYUV2PACKEDX_ACCURATE |
1043 | 1043 |
YSCALEYUV2RGBX |
1044 | 1044 |
"movq %%mm2, "U_TEMP"(%0) \n\t" |
... | ... |
@@ -1052,7 +1050,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, const int16_t *lumFilter, |
1052 | 1052 |
WRITEBGR32(%4, %5, %%REGa, %%mm3, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm2, %%mm6) |
1053 | 1053 |
|
1054 | 1054 |
YSCALEYUV2PACKEDX_END |
1055 |
- }else{ |
|
1055 |
+ } else { |
|
1056 | 1056 |
YSCALEYUV2PACKEDX_ACCURATE |
1057 | 1057 |
YSCALEYUV2RGBX |
1058 | 1058 |
"pcmpeqd %%mm7, %%mm7 \n\t" |
... | ... |
@@ -1116,11 +1114,10 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, const int16_t *lumFilter, |
1116 | 1116 |
YSCALEYUV2PACKEDX_END |
1117 | 1117 |
return; |
1118 | 1118 |
} |
1119 |
- }else{ |
|
1120 |
- switch(c->dstFormat) |
|
1121 |
- { |
|
1119 |
+ } else { |
|
1120 |
+ switch(c->dstFormat) { |
|
1122 | 1121 |
case PIX_FMT_RGB32: |
1123 |
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf){ |
|
1122 |
+ if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { |
|
1124 | 1123 |
YSCALEYUV2PACKEDX |
1125 | 1124 |
YSCALEYUV2RGBX |
1126 | 1125 |
YSCALEYUV2PACKEDX_YA(ALP_MMX_FILTER_OFFSET, %%mm0, %%mm3, %%mm6, %%mm1, %%mm7) |
... | ... |
@@ -1129,7 +1126,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, const int16_t *lumFilter, |
1129 | 1129 |
"packuswb %%mm7, %%mm1 \n\t" |
1130 | 1130 |
WRITEBGR32(%4, %5, %%REGa, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6) |
1131 | 1131 |
YSCALEYUV2PACKEDX_END |
1132 |
- }else{ |
|
1132 |
+ } else { |
|
1133 | 1133 |
YSCALEYUV2PACKEDX |
1134 | 1134 |
YSCALEYUV2RGBX |
1135 | 1135 |
"pcmpeqd %%mm7, %%mm7 \n\t" |
... | ... |
@@ -1222,12 +1219,11 @@ static inline void RENAME(yuv2packed2)(SwsContext *c, const uint16_t *buf0, cons |
1222 | 1222 |
int i; |
1223 | 1223 |
|
1224 | 1224 |
#if COMPILE_TEMPLATE_MMX |
1225 |
- if(!(c->flags & SWS_BITEXACT)){ |
|
1226 |
- switch(c->dstFormat) |
|
1227 |
- { |
|
1225 |
+ if(!(c->flags & SWS_BITEXACT)) { |
|
1226 |
+ switch(c->dstFormat) { |
|
1228 | 1227 |
//Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :( |
1229 | 1228 |
case PIX_FMT_RGB32: |
1230 |
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf){ |
|
1229 |
+ if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { |
|
1231 | 1230 |
#if ARCH_X86_64 |
1232 | 1231 |
__asm__ volatile( |
1233 | 1232 |
YSCALEYUV2RGB(%%REGBP, %5) |
... | ... |
@@ -1268,7 +1264,7 @@ static inline void RENAME(yuv2packed2)(SwsContext *c, const uint16_t *buf0, cons |
1268 | 1268 |
"a" (&c->redDither) |
1269 | 1269 |
); |
1270 | 1270 |
#endif |
1271 |
- }else{ |
|
1271 |
+ } else { |
|
1272 | 1272 |
__asm__ volatile( |
1273 | 1273 |
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1274 | 1274 |
"mov %4, %%"REG_b" \n\t" |
... | ... |
@@ -1373,20 +1369,17 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, const uint16_t *buf0, cons |
1373 | 1373 |
const uint16_t *buf1= buf0; //FIXME needed for RGB1/BGR1 |
1374 | 1374 |
const int yalpha= 4096; //FIXME ... |
1375 | 1375 |
|
1376 |
- if (flags&SWS_FULL_CHR_H_INT) |
|
1377 |
- { |
|
1376 |
+ if (flags&SWS_FULL_CHR_H_INT) { |
|
1378 | 1377 |
c->yuv2packed2(c, buf0, buf0, uvbuf0, uvbuf1, abuf0, abuf0, dest, dstW, 0, uvalpha, y); |
1379 | 1378 |
return; |
1380 | 1379 |
} |
1381 | 1380 |
|
1382 | 1381 |
#if COMPILE_TEMPLATE_MMX |
1383 |
- if(!(flags & SWS_BITEXACT)){ |
|
1384 |
- if (uvalpha < 2048) // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster |
|
1385 |
- { |
|
1386 |
- switch(dstFormat) |
|
1387 |
- { |
|
1382 |
+ if(!(flags & SWS_BITEXACT)) { |
|
1383 |
+ if (uvalpha < 2048) { // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster |
|
1384 |
+ switch(dstFormat) { |
|
1388 | 1385 |
case PIX_FMT_RGB32: |
1389 |
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf){ |
|
1386 |
+ if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { |
|
1390 | 1387 |
__asm__ volatile( |
1391 | 1388 |
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1392 | 1389 |
"mov %4, %%"REG_b" \n\t" |
... | ... |
@@ -1400,7 +1393,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, const uint16_t *buf0, cons |
1400 | 1400 |
:: "c" (buf0), "d" (abuf0), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), |
1401 | 1401 |
"a" (&c->redDither) |
1402 | 1402 |
); |
1403 |
- }else{ |
|
1403 |
+ } else { |
|
1404 | 1404 |
__asm__ volatile( |
1405 | 1405 |
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1406 | 1406 |
"mov %4, %%"REG_b" \n\t" |
... | ... |
@@ -1489,13 +1482,10 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, const uint16_t *buf0, cons |
1489 | 1489 |
); |
1490 | 1490 |
return; |
1491 | 1491 |
} |
1492 |
- } |
|
1493 |
- else |
|
1494 |
- { |
|
1495 |
- switch(dstFormat) |
|
1496 |
- { |
|
1492 |
+ } else { |
|
1493 |
+ switch(dstFormat) { |
|
1497 | 1494 |
case PIX_FMT_RGB32: |
1498 |
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf){ |
|
1495 |
+ if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { |
|
1499 | 1496 |
__asm__ volatile( |
1500 | 1497 |
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1501 | 1498 |
"mov %4, %%"REG_b" \n\t" |
... | ... |
@@ -1509,7 +1499,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, const uint16_t *buf0, cons |
1509 | 1509 |
:: "c" (buf0), "d" (abuf0), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), |
1510 | 1510 |
"a" (&c->redDither) |
1511 | 1511 |
); |
1512 |
- }else{ |
|
1512 |
+ } else { |
|
1513 | 1513 |
__asm__ volatile( |
1514 | 1514 |
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1515 | 1515 |
"mov %4, %%"REG_b" \n\t" |
... | ... |
@@ -1601,10 +1591,9 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, const uint16_t *buf0, cons |
1601 | 1601 |
} |
1602 | 1602 |
} |
1603 | 1603 |
#endif /* COMPILE_TEMPLATE_MMX */ |
1604 |
- if (uvalpha < 2048) |
|
1605 |
- { |
|
1604 |
+ if (uvalpha < 2048) { |
|
1606 | 1605 |
YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C(void,0), YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C) |
1607 |
- }else{ |
|
1606 |
+ } else { |
|
1608 | 1607 |
YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1B_C, YSCALE_YUV_2_PACKED1B_C(void,0), YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C) |
1609 | 1608 |
} |
1610 | 1609 |
} |
... | ... |
@@ -1662,8 +1651,7 @@ static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t |
1662 | 1662 |
); |
1663 | 1663 |
#else |
1664 | 1664 |
int i; |
1665 |
- for (i=0; i<width; i++) |
|
1666 |
- { |
|
1665 |
+ for (i=0; i<width; i++) { |
|
1667 | 1666 |
dstU[i]= src1[4*i + 1]; |
1668 | 1667 |
dstV[i]= src1[4*i + 3]; |
1669 | 1668 |
} |
... | ... |
@@ -1696,8 +1684,7 @@ static inline void RENAME(LEToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *s |
1696 | 1696 |
); |
1697 | 1697 |
#else |
1698 | 1698 |
int i; |
1699 |
- for (i=0; i<width; i++) |
|
1700 |
- { |
|
1699 |
+ for (i=0; i<width; i++) { |
|
1701 | 1700 |
dstU[i]= src1[2*i + 1]; |
1702 | 1701 |
dstV[i]= src2[2*i + 1]; |
1703 | 1702 |
} |
... | ... |
@@ -1756,8 +1743,7 @@ static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t |
1756 | 1756 |
); |
1757 | 1757 |
#else |
1758 | 1758 |
int i; |
1759 |
- for (i=0; i<width; i++) |
|
1760 |
- { |
|
1759 |
+ for (i=0; i<width; i++) { |
|
1761 | 1760 |
dstU[i]= src1[4*i + 0]; |
1762 | 1761 |
dstV[i]= src1[4*i + 2]; |
1763 | 1762 |
} |
... | ... |
@@ -1791,8 +1777,7 @@ static inline void RENAME(BEToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *s |
1791 | 1791 |
); |
1792 | 1792 |
#else |
1793 | 1793 |
int i; |
1794 |
- for (i=0; i<width; i++) |
|
1795 |
- { |
|
1794 |
+ for (i=0; i<width; i++) { |
|
1796 | 1795 |
dstU[i]= src1[2*i]; |
1797 | 1796 |
dstV[i]= src2[2*i]; |
1798 | 1797 |
} |
... | ... |
@@ -1803,13 +1788,13 @@ static inline void RENAME(BEToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *s |
1803 | 1803 |
static inline void RENAME(bgr24ToY_mmx)(uint8_t *dst, const uint8_t *src, long width, int srcFormat) |
1804 | 1804 |
{ |
1805 | 1805 |
|
1806 |
- if(srcFormat == PIX_FMT_BGR24){ |
|
1806 |
+ if(srcFormat == PIX_FMT_BGR24) { |
|
1807 | 1807 |
__asm__ volatile( |
1808 | 1808 |
"movq "MANGLE(ff_bgr24toY1Coeff)", %%mm5 \n\t" |
1809 | 1809 |
"movq "MANGLE(ff_bgr24toY2Coeff)", %%mm6 \n\t" |
1810 | 1810 |
: |
1811 | 1811 |
); |
1812 |
- }else{ |
|
1812 |
+ } else { |
|
1813 | 1813 |
__asm__ volatile( |
1814 | 1814 |
"movq "MANGLE(ff_rgb24toY1Coeff)", %%mm5 \n\t" |
1815 | 1815 |
"movq "MANGLE(ff_rgb24toY2Coeff)", %%mm6 \n\t" |
... | ... |
@@ -1918,8 +1903,7 @@ static inline void RENAME(bgr24ToY)(uint8_t *dst, const uint8_t *src, long width |
1918 | 1918 |
RENAME(bgr24ToY_mmx)(dst, src, width, PIX_FMT_BGR24); |
1919 | 1919 |
#else |
1920 | 1920 |
int i; |
1921 |
- for (i=0; i<width; i++) |
|
1922 |
- { |
|
1921 |
+ for (i=0; i<width; i++) { |
|
1923 | 1922 |
int b= src[i*3+0]; |
1924 | 1923 |
int g= src[i*3+1]; |
1925 | 1924 |
int r= src[i*3+2]; |
... | ... |
@@ -1935,8 +1919,7 @@ static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t |
1935 | 1935 |
RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_BGR24); |
1936 | 1936 |
#else |
1937 | 1937 |
int i; |
1938 |
- for (i=0; i<width; i++) |
|
1939 |
- { |
|
1938 |
+ for (i=0; i<width; i++) { |
|
1940 | 1939 |
int b= src1[3*i + 0]; |
1941 | 1940 |
int g= src1[3*i + 1]; |
1942 | 1941 |
int r= src1[3*i + 2]; |
... | ... |
@@ -1951,8 +1934,7 @@ static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t |
1951 | 1951 |
static inline void RENAME(bgr24ToUV_half)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) |
1952 | 1952 |
{ |
1953 | 1953 |
int i; |
1954 |
- for (i=0; i<width; i++) |
|
1955 |
- { |
|
1954 |
+ for (i=0; i<width; i++) { |
|
1956 | 1955 |
int b= src1[6*i + 0] + src1[6*i + 3]; |
1957 | 1956 |
int g= src1[6*i + 1] + src1[6*i + 4]; |
1958 | 1957 |
int r= src1[6*i + 2] + src1[6*i + 5]; |
... | ... |
@@ -1969,8 +1951,7 @@ static inline void RENAME(rgb24ToY)(uint8_t *dst, const uint8_t *src, long width |
1969 | 1969 |
RENAME(bgr24ToY_mmx)(dst, src, width, PIX_FMT_RGB24); |
1970 | 1970 |
#else |
1971 | 1971 |
int i; |
1972 |
- for (i=0; i<width; i++) |
|
1973 |
- { |
|
1972 |
+ for (i=0; i<width; i++) { |
|
1974 | 1973 |
int r= src[i*3+0]; |
1975 | 1974 |
int g= src[i*3+1]; |
1976 | 1975 |
int b= src[i*3+2]; |
... | ... |
@@ -1988,8 +1969,7 @@ static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t |
1988 | 1988 |
#else |
1989 | 1989 |
int i; |
1990 | 1990 |
assert(src1==src2); |
1991 |
- for (i=0; i<width; i++) |
|
1992 |
- { |
|
1991 |
+ for (i=0; i<width; i++) { |
|
1993 | 1992 |
int r= src1[3*i + 0]; |
1994 | 1993 |
int g= src1[3*i + 1]; |
1995 | 1994 |
int b= src1[3*i + 2]; |
... | ... |
@@ -2004,8 +1984,7 @@ static inline void RENAME(rgb24ToUV_half)(uint8_t *dstU, uint8_t *dstV, const ui |
2004 | 2004 |
{ |
2005 | 2005 |
int i; |
2006 | 2006 |
assert(src1==src2); |
2007 |
- for (i=0; i<width; i++) |
|
2008 |
- { |
|
2007 |
+ for (i=0; i<width; i++) { |
|
2009 | 2008 |
int r= src1[6*i + 0] + src1[6*i + 3]; |
2010 | 2009 |
int g= src1[6*i + 1] + src1[6*i + 4]; |
2011 | 2010 |
int b= src1[6*i + 2] + src1[6*i + 5]; |
... | ... |
@@ -2022,8 +2001,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, const uint8_t *src, in |
2022 | 2022 |
{ |
2023 | 2023 |
#if COMPILE_TEMPLATE_MMX |
2024 | 2024 |
assert(filterSize % 4 == 0 && filterSize>0); |
2025 |
- if (filterSize==4) // Always true for upscaling, sometimes for down, too. |
|
2026 |
- { |
|
2025 |
+ if (filterSize==4) { // Always true for upscaling, sometimes for down, too. |
|
2027 | 2026 |
x86_reg counter= -2*dstW; |
2028 | 2027 |
filter-= counter*2; |
2029 | 2028 |
filterPos-= counter/2; |
... | ... |
@@ -2067,9 +2045,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, const uint8_t *src, in |
2067 | 2067 |
: "%"REG_b |
2068 | 2068 |
#endif |
2069 | 2069 |
); |
2070 |
- } |
|
2071 |
- else if (filterSize==8) |
|
2072 |
- { |
|
2070 |
+ } else if (filterSize==8) { |
|
2073 | 2071 |
x86_reg counter= -2*dstW; |
2074 | 2072 |
filter-= counter*4; |
2075 | 2073 |
filterPos-= counter/2; |
... | ... |
@@ -2124,9 +2100,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, const uint8_t *src, in |
2124 | 2124 |
: "%"REG_b |
2125 | 2125 |
#endif |
2126 | 2126 |
); |
2127 |
- } |
|
2128 |
- else |
|
2129 |
- { |
|
2127 |
+ } else { |
|
2130 | 2128 |
uint8_t *offset = src+filterSize; |
2131 | 2129 |
x86_reg counter= -2*dstW; |
2132 | 2130 |
//filter-= counter*filterSize/2; |
... | ... |
@@ -2180,14 +2154,12 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, const uint8_t *src, in |
2180 | 2180 |
hScale_altivec_real(dst, dstW, src, srcW, xInc, filter, filterPos, filterSize); |
2181 | 2181 |
#else |
2182 | 2182 |
int i; |
2183 |
- for (i=0; i<dstW; i++) |
|
2184 |
- { |
|
2183 |
+ for (i=0; i<dstW; i++) { |
|
2185 | 2184 |
int j; |
2186 | 2185 |
int srcPos= filterPos[i]; |
2187 | 2186 |
int val=0; |
2188 | 2187 |
//printf("filterPos: %d\n", filterPos[i]); |
2189 |
- for (j=0; j<filterSize; j++) |
|
2190 |
- { |
|
2188 |
+ for (j=0; j<filterSize; j++) { |
|
2191 | 2189 |
//printf("filter: %d, src: %d\n", filter[i], src[srcPos + j]); |
2192 | 2190 |
val += ((int)src[srcPos + j])*filter[filterSize*i + j]; |
2193 | 2191 |
} |
... | ... |
@@ -2213,8 +2185,7 @@ static inline void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst, |
2213 | 2213 |
{ |
2214 | 2214 |
int i; |
2215 | 2215 |
unsigned int xpos=0; |
2216 |
- for (i=0;i<dstWidth;i++) |
|
2217 |
- { |
|
2216 |
+ for (i=0;i<dstWidth;i++) { |
|
2218 | 2217 |
register unsigned int xx=xpos>>16; |
2219 | 2218 |
register unsigned int xalpha=(xpos&0xFFFF)>>9; |
2220 | 2219 |
dst[i]= (src[xx]<<7) + (src[xx+1] - src[xx])*xalpha; |
... | ... |
@@ -2259,17 +2230,14 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, |
2259 | 2259 |
#endif |
2260 | 2260 |
{ |
2261 | 2261 |
c->hScale(dst, dstWidth, src, srcW, xInc, hLumFilter, hLumFilterPos, hLumFilterSize); |
2262 |
- } |
|
2263 |
- else // fast bilinear upscale / crap downscale |
|
2264 |
- { |
|
2262 |
+ } else { // fast bilinear upscale / crap downscale |
|
2265 | 2263 |
#if ARCH_X86 && CONFIG_GPL |
2266 | 2264 |
#if COMPILE_TEMPLATE_MMX2 |
2267 | 2265 |
int i; |
2268 | 2266 |
#if defined(PIC) |
2269 | 2267 |
DECLARE_ALIGNED(8, uint64_t, ebxsave); |
2270 | 2268 |
#endif |
2271 |
- if (canMMX2BeUsed) |
|
2272 |
- { |
|
2269 |
+ if (canMMX2BeUsed) { |
|
2273 | 2270 |
__asm__ volatile( |
2274 | 2271 |
#if defined(PIC) |
2275 | 2272 |
"mov %%"REG_b", %5 \n\t" |
... | ... |
@@ -2328,9 +2296,7 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, |
2328 | 2328 |
#endif |
2329 | 2329 |
); |
2330 | 2330 |
for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) dst[i] = src[srcW-1]*128; |
2331 |
- } |
|
2332 |
- else |
|
2333 |
- { |
|
2331 |
+ } else { |
|
2334 | 2332 |
#endif /* COMPILE_TEMPLATE_MMX2 */ |
2335 | 2333 |
x86_reg xInc_shr16 = xInc >> 16; |
2336 | 2334 |
uint16_t xInc_mask = xInc & 0xffff; |
... | ... |
@@ -2372,14 +2338,14 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, |
2372 | 2372 |
#endif /* ARCH_X86 */ |
2373 | 2373 |
} |
2374 | 2374 |
|
2375 |
- if(!isAlpha && c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))){ |
|
2375 |
+ if(!isAlpha && c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))) { |
|
2376 | 2376 |
int i; |
2377 | 2377 |
//FIXME all pal and rgb srcFormats could do this convertion as well |
2378 | 2378 |
//FIXME all scalers more complex than bilinear could do half of this transform |
2379 |
- if(c->srcRange){ |
|
2379 |
+ if(c->srcRange) { |
|
2380 | 2380 |
for (i=0; i<dstWidth; i++) |
2381 | 2381 |
dst[i]= (dst[i]*14071 + 33561947)>>14; |
2382 |
- }else{ |
|
2382 |
+ } else { |
|
2383 | 2383 |
for (i=0; i<dstWidth; i++) |
2384 | 2384 |
dst[i]= (FFMIN(dst[i],30189)*19077 - 39057361)>>14; |
2385 | 2385 |
} |
... | ... |
@@ -2392,8 +2358,7 @@ static inline void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst, |
2392 | 2392 |
{ |
2393 | 2393 |
int i; |
2394 | 2394 |
unsigned int xpos=0; |
2395 |
- for (i=0;i<dstWidth;i++) |
|
2396 |
- { |
|
2395 |
+ for (i=0;i<dstWidth;i++) { |
|
2397 | 2396 |
register unsigned int xx=xpos>>16; |
2398 | 2397 |
register unsigned int xalpha=(xpos&0xFFFF)>>9; |
2399 | 2398 |
dst[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha); |
... | ... |
@@ -2445,17 +2410,14 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, |
2445 | 2445 |
{ |
2446 | 2446 |
c->hScale(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); |
2447 | 2447 |
c->hScale(dst+VOFW, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); |
2448 |
- } |
|
2449 |
- else // fast bilinear upscale / crap downscale |
|
2450 |
- { |
|
2448 |
+ } else { // fast bilinear upscale / crap downscale |
|
2451 | 2449 |
#if ARCH_X86 && CONFIG_GPL |
2452 | 2450 |
#if COMPILE_TEMPLATE_MMX2 |
2453 | 2451 |
int i; |
2454 | 2452 |
#if defined(PIC) |
2455 | 2453 |
DECLARE_ALIGNED(8, uint64_t, ebxsave); |
2456 | 2454 |
#endif |
2457 |
- if (canMMX2BeUsed) |
|
2458 |
- { |
|
2455 |
+ if (canMMX2BeUsed) { |
|
2459 | 2456 |
__asm__ volatile( |
2460 | 2457 |
#if defined(PIC) |
2461 | 2458 |
"mov %%"REG_b", %6 \n\t" |
... | ... |
@@ -2500,15 +2462,12 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, |
2500 | 2500 |
,"%"REG_b |
2501 | 2501 |
#endif |
2502 | 2502 |
); |
2503 |
- for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) |
|
2504 |
- { |
|
2503 |
+ for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) { |
|
2505 | 2504 |
//printf("%d %d %d\n", dstWidth, i, srcW); |
2506 | 2505 |
dst[i] = src1[srcW-1]*128; |
2507 | 2506 |
dst[i+VOFW] = src2[srcW-1]*128; |
2508 | 2507 |
} |
2509 |
- } |
|
2510 |
- else |
|
2511 |
- { |
|
2508 |
+ } else { |
|
2512 | 2509 |
#endif /* COMPILE_TEMPLATE_MMX2 */ |
2513 | 2510 |
x86_reg xInc_shr16 = (x86_reg) (xInc >> 16); |
2514 | 2511 |
uint16_t xInc_mask = xInc & 0xffff; |
... | ... |
@@ -2552,17 +2511,17 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, |
2552 | 2552 |
c->hcscale_fast(c, dst, dstWidth, src1, src2, srcW, xInc); |
2553 | 2553 |
#endif /* ARCH_X86 */ |
2554 | 2554 |
} |
2555 |
- if(c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))){ |
|
2555 |
+ if(c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))) { |
|
2556 | 2556 |
int i; |
2557 | 2557 |
//FIXME all pal and rgb srcFormats could do this convertion as well |
2558 | 2558 |
//FIXME all scalers more complex than bilinear could do half of this transform |
2559 |
- if(c->srcRange){ |
|
2560 |
- for (i=0; i<dstWidth; i++){ |
|
2559 |
+ if(c->srcRange) { |
|
2560 |
+ for (i=0; i<dstWidth; i++) { |
|
2561 | 2561 |
dst[i ]= (dst[i ]*1799 + 4081085)>>11; //1469 |
2562 | 2562 |
dst[i+VOFW]= (dst[i+VOFW]*1799 + 4081085)>>11; //1469 |
2563 | 2563 |
} |
2564 |
- }else{ |
|
2565 |
- for (i=0; i<dstWidth; i++){ |
|
2564 |
+ } else { |
|
2565 |
+ for (i=0; i<dstWidth; i++) { |
|
2566 | 2566 |
dst[i ]= (FFMIN(dst[i ],30775)*4663 - 9289992)>>12; //-264 |
2567 | 2567 |
dst[i+VOFW]= (FFMIN(dst[i+VOFW],30775)*4663 - 9289992)>>12; //-264 |
2568 | 2568 |
} |
... | ... |
@@ -2571,8 +2530,8 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, |
2571 | 2571 |
} |
2572 | 2572 |
|
2573 | 2573 |
static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
2574 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){ |
|
2575 |
- |
|
2574 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
2575 |
+{ |
|
2576 | 2576 |
/* load a few things into local vars to make the code more readable? and faster */ |
2577 | 2577 |
const int srcW= c->srcW; |
2578 | 2578 |
const int dstW= c->dstW; |
... | ... |
@@ -2617,7 +2576,7 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s |
2617 | 2617 |
int lastInLumBuf= c->lastInLumBuf; |
2618 | 2618 |
int lastInChrBuf= c->lastInChrBuf; |
2619 | 2619 |
|
2620 |
- if (isPacked(c->srcFormat)){ |
|
2620 |
+ if (isPacked(c->srcFormat)) { |
|
2621 | 2621 |
src[0]= |
2622 | 2622 |
src[1]= |
2623 | 2623 |
src[2]= |
... | ... |
@@ -2636,11 +2595,9 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s |
2636 | 2636 |
//printf("sws Strides:%d %d %d -> %d %d %d\n", srcStride[0],srcStride[1],srcStride[2], |
2637 | 2637 |
//dstStride[0],dstStride[1],dstStride[2]); |
2638 | 2638 |
|
2639 |
- if (dstStride[0]%8 !=0 || dstStride[1]%8 !=0 || dstStride[2]%8 !=0 || dstStride[3]%8 != 0) |
|
2640 |
- { |
|
2639 |
+ if (dstStride[0]%8 !=0 || dstStride[1]%8 !=0 || dstStride[2]%8 !=0 || dstStride[3]%8 != 0) { |
|
2641 | 2640 |
static int warnedAlready=0; //FIXME move this into the context perhaps |
2642 |
- if (flags & SWS_PRINT_INFO && !warnedAlready) |
|
2643 |
- { |
|
2641 |
+ if (flags & SWS_PRINT_INFO && !warnedAlready) { |
|
2644 | 2642 |
av_log(c, AV_LOG_WARNING, "Warning: dstStride is not aligned!\n" |
2645 | 2643 |
" ->cannot do aligned memory accesses anymore\n"); |
2646 | 2644 |
warnedAlready=1; |
... | ... |
@@ -2650,7 +2607,7 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s |
2650 | 2650 |
/* Note the user might start scaling the picture in the middle so this |
2651 | 2651 |
will not get executed. This is not really intended but works |
2652 | 2652 |
currently, so people might do it. */ |
2653 |
- if (srcSliceY ==0){ |
|
2653 |
+ if (srcSliceY ==0) { |
|
2654 | 2654 |
lumBufIndex=0; |
2655 | 2655 |
chrBufIndex=0; |
2656 | 2656 |
dstY=0; |
... | ... |
@@ -2660,7 +2617,7 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s |
2660 | 2660 |
|
2661 | 2661 |
lastDstY= dstY; |
2662 | 2662 |
|
2663 |
- for (;dstY < dstH; dstY++){ |
|
2663 |
+ for (;dstY < dstH; dstY++) { |
|
2664 | 2664 |
unsigned char *dest =dst[0]+dstStride[0]*dstY; |
2665 | 2665 |
const int chrDstY= dstY>>c->chrDstVSubSample; |
2666 | 2666 |
unsigned char *uDest=dst[1]+dstStride[1]*chrDstY; |
... | ... |
@@ -2695,8 +2652,7 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s |
2695 | 2695 |
vChrBufSize, vLumBufSize);*/ |
2696 | 2696 |
|
2697 | 2697 |
//Do horizontal scaling |
2698 |
- while(lastInLumBuf < lastLumSrcY) |
|
2699 |
- { |
|
2698 |
+ while(lastInLumBuf < lastLumSrcY) { |
|
2700 | 2699 |
uint8_t *src1= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0]; |
2701 | 2700 |
uint8_t *src2= src[3]+(lastInLumBuf + 1 - srcSliceY)*srcStride[3]; |
2702 | 2701 |
lumBufIndex++; |
... | ... |
@@ -2716,8 +2672,7 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s |
2716 | 2716 |
pal, 1); |
2717 | 2717 |
lastInLumBuf++; |
2718 | 2718 |
} |
2719 |
- while(lastInChrBuf < lastChrSrcY) |
|
2720 |
- { |
|
2719 |
+ while(lastInChrBuf < lastChrSrcY) { |
|
2721 | 2720 |
uint8_t *src1= src[1]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[1]; |
2722 | 2721 |
uint8_t *src2= src[2]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[2]; |
2723 | 2722 |
chrBufIndex++; |
... | ... |
@@ -2747,52 +2702,49 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s |
2747 | 2747 |
c->greenDither= ff_dither4[dstY&1]; |
2748 | 2748 |
c->redDither= ff_dither8[(dstY+1)&1]; |
2749 | 2749 |
#endif |
2750 |
- if (dstY < dstH-2) |
|
2751 |
- { |
|
2750 |
+ if (dstY < dstH-2) { |
|
2752 | 2751 |
const int16_t **lumSrcPtr= (const int16_t **) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize; |
2753 | 2752 |
const int16_t **chrSrcPtr= (const int16_t **) chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize; |
2754 | 2753 |
const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL; |
2755 | 2754 |
#if COMPILE_TEMPLATE_MMX |
2756 | 2755 |
int i; |
2757 |
- if (flags & SWS_ACCURATE_RND){ |
|
2756 |
+ if (flags & SWS_ACCURATE_RND) { |
|
2758 | 2757 |
int s= APCK_SIZE / 8; |
2759 |
- for (i=0; i<vLumFilterSize; i+=2){ |
|
2758 |
+ for (i=0; i<vLumFilterSize; i+=2) { |
|
2760 | 2759 |
*(void**)&lumMmxFilter[s*i ]= lumSrcPtr[i ]; |
2761 | 2760 |
*(void**)&lumMmxFilter[s*i+APCK_PTR2/4 ]= lumSrcPtr[i+(vLumFilterSize>1)]; |
2762 | 2761 |
lumMmxFilter[s*i+APCK_COEF/4 ]= |
2763 | 2762 |
lumMmxFilter[s*i+APCK_COEF/4+1]= vLumFilter[dstY*vLumFilterSize + i ] |
2764 | 2763 |
+ (vLumFilterSize>1 ? vLumFilter[dstY*vLumFilterSize + i + 1]<<16 : 0); |
2765 |
- if (CONFIG_SWSCALE_ALPHA && alpPixBuf){ |
|
2764 |
+ if (CONFIG_SWSCALE_ALPHA && alpPixBuf) { |
|
2766 | 2765 |
*(void**)&alpMmxFilter[s*i ]= alpSrcPtr[i ]; |
2767 | 2766 |
*(void**)&alpMmxFilter[s*i+APCK_PTR2/4 ]= alpSrcPtr[i+(vLumFilterSize>1)]; |
2768 | 2767 |
alpMmxFilter[s*i+APCK_COEF/4 ]= |
2769 | 2768 |
alpMmxFilter[s*i+APCK_COEF/4+1]= lumMmxFilter[s*i+APCK_COEF/4 ]; |
2770 | 2769 |
} |
2771 | 2770 |
} |
2772 |
- for (i=0; i<vChrFilterSize; i+=2){ |
|
2771 |
+ for (i=0; i<vChrFilterSize; i+=2) { |
|
2773 | 2772 |
*(void**)&chrMmxFilter[s*i ]= chrSrcPtr[i ]; |
2774 | 2773 |
*(void**)&chrMmxFilter[s*i+APCK_PTR2/4 ]= chrSrcPtr[i+(vChrFilterSize>1)]; |
2775 | 2774 |
chrMmxFilter[s*i+APCK_COEF/4 ]= |
2776 | 2775 |
chrMmxFilter[s*i+APCK_COEF/4+1]= vChrFilter[chrDstY*vChrFilterSize + i ] |
2777 | 2776 |
+ (vChrFilterSize>1 ? vChrFilter[chrDstY*vChrFilterSize + i + 1]<<16 : 0); |
2778 | 2777 |
} |
2779 |
- }else{ |
|
2780 |
- for (i=0; i<vLumFilterSize; i++) |
|
2781 |
- { |
|
2778 |
+ } else { |
|
2779 |
+ for (i=0; i<vLumFilterSize; i++) { |
|
2782 | 2780 |
lumMmxFilter[4*i+0]= (int32_t)lumSrcPtr[i]; |
2783 | 2781 |
lumMmxFilter[4*i+1]= (uint64_t)lumSrcPtr[i] >> 32; |
2784 | 2782 |
lumMmxFilter[4*i+2]= |
2785 | 2783 |
lumMmxFilter[4*i+3]= |
2786 | 2784 |
((uint16_t)vLumFilter[dstY*vLumFilterSize + i])*0x10001; |
2787 |
- if (CONFIG_SWSCALE_ALPHA && alpPixBuf){ |
|
2785 |
+ if (CONFIG_SWSCALE_ALPHA && alpPixBuf) { |
|
2788 | 2786 |
alpMmxFilter[4*i+0]= (int32_t)alpSrcPtr[i]; |
2789 | 2787 |
alpMmxFilter[4*i+1]= (uint64_t)alpSrcPtr[i] >> 32; |
2790 | 2788 |
alpMmxFilter[4*i+2]= |
2791 | 2789 |
alpMmxFilter[4*i+3]= lumMmxFilter[4*i+2]; |
2792 | 2790 |
} |
2793 | 2791 |
} |
2794 |
- for (i=0; i<vChrFilterSize; i++) |
|
2795 |
- { |
|
2792 |
+ for (i=0; i<vChrFilterSize; i++) { |
|
2796 | 2793 |
chrMmxFilter[4*i+0]= (int32_t)chrSrcPtr[i]; |
2797 | 2794 |
chrMmxFilter[4*i+1]= (uint64_t)chrSrcPtr[i] >> 32; |
2798 | 2795 |
chrMmxFilter[4*i+2]= |
... | ... |
@@ -2801,87 +2753,72 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s |
2801 | 2801 |
} |
2802 | 2802 |
} |
2803 | 2803 |
#endif |
2804 |
- if (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21){ |
|
2804 |
+ if (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21) { |
|
2805 | 2805 |
const int chrSkipMask= (1<<c->chrDstVSubSample)-1; |
2806 | 2806 |
if (dstY&chrSkipMask) uDest= NULL; //FIXME split functions in lumi / chromi |
2807 | 2807 |
c->yuv2nv12X(c, |
2808 | 2808 |
vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, |
2809 | 2809 |
vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, |
2810 | 2810 |
dest, uDest, dstW, chrDstW, dstFormat); |
2811 |
- } |
|
2812 |
- else if (isPlanarYUV(dstFormat) || dstFormat==PIX_FMT_GRAY8) //YV12 like |
|
2813 |
- { |
|
2811 |
+ } else if (isPlanarYUV(dstFormat) || dstFormat==PIX_FMT_GRAY8) { //YV12 like |
|
2814 | 2812 |
const int chrSkipMask= (1<<c->chrDstVSubSample)-1; |
2815 | 2813 |
if ((dstY&chrSkipMask) || isGray(dstFormat)) uDest=vDest= NULL; //FIXME split functions in lumi / chromi |
2816 |
- if (is16BPS(dstFormat)) |
|
2817 |
- { |
|
2814 |
+ if (is16BPS(dstFormat)) { |
|
2818 | 2815 |
yuv2yuvX16inC( |
2819 | 2816 |
vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, |
2820 | 2817 |
vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, |
2821 | 2818 |
alpSrcPtr, (uint16_t *) dest, (uint16_t *) uDest, (uint16_t *) vDest, (uint16_t *) aDest, dstW, chrDstW, |
2822 | 2819 |
dstFormat); |
2823 |
- } |
|
2824 |
- else |
|
2825 |
- if (vLumFilterSize == 1 && vChrFilterSize == 1) // unscaled YV12 |
|
2826 |
- { |
|
2820 |
+ } else if (vLumFilterSize == 1 && vChrFilterSize == 1) { // unscaled YV12 |
|
2827 | 2821 |
int16_t *lumBuf = lumPixBuf[0]; |
2828 | 2822 |
int16_t *chrBuf= chrPixBuf[0]; |
2829 | 2823 |
int16_t *alpBuf= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? alpPixBuf[0] : NULL; |
2830 | 2824 |
c->yuv2yuv1(c, lumBuf, chrBuf, alpBuf, dest, uDest, vDest, aDest, dstW, chrDstW); |
2831 |
- } |
|
2832 |
- else //General YV12 |
|
2833 |
- { |
|
2825 |
+ } else { //General YV12 |
|
2834 | 2826 |
c->yuv2yuvX(c, |
2835 | 2827 |
vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, |
2836 | 2828 |
vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, |
2837 | 2829 |
alpSrcPtr, dest, uDest, vDest, aDest, dstW, chrDstW); |
2838 | 2830 |
} |
2839 |
- } |
|
2840 |
- else |
|
2841 |
- { |
|
2831 |
+ } else { |
|
2842 | 2832 |
assert(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2); |
2843 | 2833 |
assert(chrSrcPtr + vChrFilterSize - 1 < chrPixBuf + vChrBufSize*2); |
2844 |
- if (vLumFilterSize == 1 && vChrFilterSize == 2) //unscaled RGB |
|
2845 |
- { |
|
2834 |
+ if (vLumFilterSize == 1 && vChrFilterSize == 2) { //unscaled RGB |
|
2846 | 2835 |
int chrAlpha= vChrFilter[2*dstY+1]; |
2847 |
- if(flags & SWS_FULL_CHR_H_INT){ |
|
2836 |
+ if(flags & SWS_FULL_CHR_H_INT) { |
|
2848 | 2837 |
yuv2rgbXinC_full(c, //FIXME write a packed1_full function |
2849 | 2838 |
vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, |
2850 | 2839 |
vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, |
2851 | 2840 |
alpSrcPtr, dest, dstW, dstY); |
2852 |
- }else{ |
|
2841 |
+ } else { |
|
2853 | 2842 |
c->yuv2packed1(c, *lumSrcPtr, *chrSrcPtr, *(chrSrcPtr+1), |
2854 | 2843 |
alpPixBuf ? *alpSrcPtr : NULL, |
2855 | 2844 |
dest, dstW, chrAlpha, dstFormat, flags, dstY); |
2856 | 2845 |
} |
2857 |
- } |
|
2858 |
- else if (vLumFilterSize == 2 && vChrFilterSize == 2) //bilinear upscale RGB |
|
2859 |
- { |
|
2846 |
+ } else if (vLumFilterSize == 2 && vChrFilterSize == 2) { //bilinear upscale RGB |
|
2860 | 2847 |
int lumAlpha= vLumFilter[2*dstY+1]; |
2861 | 2848 |
int chrAlpha= vChrFilter[2*dstY+1]; |
2862 | 2849 |
lumMmxFilter[2]= |
2863 | 2850 |
lumMmxFilter[3]= vLumFilter[2*dstY ]*0x10001; |
2864 | 2851 |
chrMmxFilter[2]= |
2865 | 2852 |
chrMmxFilter[3]= vChrFilter[2*chrDstY]*0x10001; |
2866 |
- if(flags & SWS_FULL_CHR_H_INT){ |
|
2853 |
+ if(flags & SWS_FULL_CHR_H_INT) { |
|
2867 | 2854 |
yuv2rgbXinC_full(c, //FIXME write a packed2_full function |
2868 | 2855 |
vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, |
2869 | 2856 |
vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, |
2870 | 2857 |
alpSrcPtr, dest, dstW, dstY); |
2871 |
- }else{ |
|
2858 |
+ } else { |
|
2872 | 2859 |
c->yuv2packed2(c, *lumSrcPtr, *(lumSrcPtr+1), *chrSrcPtr, *(chrSrcPtr+1), |
2873 | 2860 |
alpPixBuf ? *alpSrcPtr : NULL, alpPixBuf ? *(alpSrcPtr+1) : NULL, |
2874 | 2861 |
dest, dstW, lumAlpha, chrAlpha, dstY); |
2875 | 2862 |
} |
2876 |
- } |
|
2877 |
- else //general RGB |
|
2878 |
- { |
|
2879 |
- if(flags & SWS_FULL_CHR_H_INT){ |
|
2863 |
+ } else { //general RGB |
|
2864 |
+ if(flags & SWS_FULL_CHR_H_INT) { |
|
2880 | 2865 |
yuv2rgbXinC_full(c, |
2881 | 2866 |
vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, |
2882 | 2867 |
vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, |
2883 | 2868 |
alpSrcPtr, dest, dstW, dstY); |
2884 |
- }else{ |
|
2869 |
+ } else { |
|
2885 | 2870 |
c->yuv2packedX(c, |
2886 | 2871 |
vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, |
2887 | 2872 |
vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, |
... | ... |
@@ -2889,50 +2826,41 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s |
2889 | 2889 |
} |
2890 | 2890 |
} |
2891 | 2891 |
} |
2892 |
- } |
|
2893 |
- else // hmm looks like we can't use MMX here without overwriting this array's tail |
|
2894 |
- { |
|
2892 |
+ } else { // hmm looks like we can't use MMX here without overwriting this array's tail |
|
2895 | 2893 |
const int16_t **lumSrcPtr= (const int16_t **)lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize; |
2896 | 2894 |
const int16_t **chrSrcPtr= (const int16_t **)chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize; |
2897 | 2895 |
const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **)alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL; |
2898 |
- if (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21){ |
|
2896 |
+ if (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21) { |
|
2899 | 2897 |
const int chrSkipMask= (1<<c->chrDstVSubSample)-1; |
2900 | 2898 |
if (dstY&chrSkipMask) uDest= NULL; //FIXME split functions in lumi / chromi |
2901 | 2899 |
yuv2nv12XinC( |
2902 | 2900 |
vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, |
2903 | 2901 |
vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, |
2904 | 2902 |
dest, uDest, dstW, chrDstW, dstFormat); |
2905 |
- } |
|
2906 |
- else if (isPlanarYUV(dstFormat) || dstFormat==PIX_FMT_GRAY8) //YV12 |
|
2907 |
- { |
|
2903 |
+ } else if (isPlanarYUV(dstFormat) || dstFormat==PIX_FMT_GRAY8) { //YV12 |
|
2908 | 2904 |
const int chrSkipMask= (1<<c->chrDstVSubSample)-1; |
2909 | 2905 |
if ((dstY&chrSkipMask) || isGray(dstFormat)) uDest=vDest= NULL; //FIXME split functions in lumi / chromi |
2910 |
- if (is16BPS(dstFormat)) |
|
2911 |
- { |
|
2906 |
+ if (is16BPS(dstFormat)) { |
|
2912 | 2907 |
yuv2yuvX16inC( |
2913 | 2908 |
vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, |
2914 | 2909 |
vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, |
2915 | 2910 |
alpSrcPtr, (uint16_t *) dest, (uint16_t *) uDest, (uint16_t *) vDest, (uint16_t *) aDest, dstW, chrDstW, |
2916 | 2911 |
dstFormat); |
2917 |
- } |
|
2918 |
- else |
|
2919 |
- { |
|
2912 |
+ } else { |
|
2920 | 2913 |
yuv2yuvXinC( |
2921 | 2914 |
vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, |
2922 | 2915 |
vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, |
2923 | 2916 |
alpSrcPtr, dest, uDest, vDest, aDest, dstW, chrDstW); |
2924 | 2917 |
} |
2925 |
- } |
|
2926 |
- else |
|
2927 |
- { |
|
2918 |
+ } else { |
|
2928 | 2919 |
assert(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2); |
2929 | 2920 |
assert(chrSrcPtr + vChrFilterSize - 1 < chrPixBuf + vChrBufSize*2); |
2930 |
- if(flags & SWS_FULL_CHR_H_INT){ |
|
2921 |
+ if(flags & SWS_FULL_CHR_H_INT) { |
|
2931 | 2922 |
yuv2rgbXinC_full(c, |
2932 | 2923 |
vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, |
2933 | 2924 |
vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, |
2934 | 2925 |
alpSrcPtr, dest, dstW, dstY); |
2935 |
- }else{ |
|
2926 |
+ } else { |
|
2936 | 2927 |
yuv2packedXinC(c, |
2937 | 2928 |
vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, |
2938 | 2929 |
vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, |
... | ... |
@@ -63,15 +63,15 @@ SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c) |
63 | 63 |
if (c->flags & SWS_CPU_CAPS_MMX2) { |
64 | 64 |
switch (c->dstFormat) { |
65 | 65 |
case PIX_FMT_RGB32: |
66 |
- if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P){ |
|
66 |
+ if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) { |
|
67 | 67 |
if (HAVE_7REGS) return yuva420_rgb32_MMX2; |
68 | 68 |
break; |
69 |
- }else return yuv420_rgb32_MMX2; |
|
69 |
+ } else return yuv420_rgb32_MMX2; |
|
70 | 70 |
case PIX_FMT_BGR32: |
71 |
- if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P){ |
|
71 |
+ if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) { |
|
72 | 72 |
if (HAVE_7REGS) return yuva420_bgr32_MMX2; |
73 | 73 |
break; |
74 |
- }else return yuv420_bgr32_MMX2; |
|
74 |
+ } else return yuv420_bgr32_MMX2; |
|
75 | 75 |
case PIX_FMT_BGR24: return yuv420_rgb24_MMX2; |
76 | 76 |
case PIX_FMT_RGB565: return yuv420_rgb16_MMX2; |
77 | 77 |
case PIX_FMT_RGB555: return yuv420_rgb15_MMX2; |
... | ... |
@@ -80,15 +80,15 @@ SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c) |
80 | 80 |
if (c->flags & SWS_CPU_CAPS_MMX) { |
81 | 81 |
switch (c->dstFormat) { |
82 | 82 |
case PIX_FMT_RGB32: |
83 |
- if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P){ |
|
83 |
+ if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) { |
|
84 | 84 |
if (HAVE_7REGS) return yuva420_rgb32_MMX; |
85 | 85 |
break; |
86 |
- }else return yuv420_rgb32_MMX; |
|
86 |
+ } else return yuv420_rgb32_MMX; |
|
87 | 87 |
case PIX_FMT_BGR32: |
88 |
- if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P){ |
|
88 |
+ if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) { |
|
89 | 89 |
if (HAVE_7REGS) return yuva420_bgr32_MMX; |
90 | 90 |
break; |
91 |
- }else return yuv420_bgr32_MMX; |
|
91 |
+ } else return yuv420_bgr32_MMX; |
|
92 | 92 |
case PIX_FMT_BGR24: return yuv420_rgb24_MMX; |
93 | 93 |
case PIX_FMT_RGB565: return yuv420_rgb16_MMX; |
94 | 94 |
case PIX_FMT_RGB555: return yuv420_rgb15_MMX; |
... | ... |
@@ -122,7 +122,7 @@ |
122 | 122 |
|
123 | 123 |
|
124 | 124 |
#define YUV422_UNSHIFT \ |
125 |
- if(c->srcFormat == PIX_FMT_YUV422P){ \ |
|
125 |
+ if(c->srcFormat == PIX_FMT_YUV422P) {\ |
|
126 | 126 |
srcStride[1] *= 2; \ |
127 | 127 |
srcStride[2] *= 2; \ |
128 | 128 |
} \ |
... | ... |
@@ -180,7 +180,8 @@ |
180 | 180 |
return srcSliceH; \ |
181 | 181 |
|
182 | 182 |
static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
183 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){ |
|
183 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
184 |
+{ |
|
184 | 185 |
int y, h_size; |
185 | 186 |
|
186 | 187 |
YUV422_UNSHIFT |
... | ... |
@@ -236,7 +237,8 @@ static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* src[], int srcStr |
236 | 236 |
} |
237 | 237 |
|
238 | 238 |
static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
239 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){ |
|
239 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
240 |
+{ |
|
240 | 241 |
int y, h_size; |
241 | 242 |
|
242 | 243 |
YUV422_UNSHIFT |
... | ... |
@@ -294,7 +296,8 @@ static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* src[], int srcStr |
294 | 294 |
} |
295 | 295 |
|
296 | 296 |
static inline int RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
297 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){ |
|
297 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
298 |
+{ |
|
298 | 299 |
int y, h_size; |
299 | 300 |
|
300 | 301 |
YUV422_UNSHIFT |
... | ... |
@@ -470,7 +473,8 @@ etc. |
470 | 470 |
"movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ \ |
471 | 471 |
|
472 | 472 |
static inline int RENAME(yuv420_rgb32)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
473 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){ |
|
473 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
474 |
+{ |
|
474 | 475 |
int y, h_size; |
475 | 476 |
|
476 | 477 |
YUV422_UNSHIFT |
... | ... |
@@ -486,7 +490,8 @@ static inline int RENAME(yuv420_rgb32)(SwsContext *c, uint8_t* src[], int srcStr |
486 | 486 |
} |
487 | 487 |
|
488 | 488 |
static inline int RENAME(yuva420_rgb32)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
489 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){ |
|
489 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
490 |
+{ |
|
490 | 491 |
#if HAVE_7REGS |
491 | 492 |
int y, h_size; |
492 | 493 |
|
... | ... |
@@ -504,7 +509,8 @@ static inline int RENAME(yuva420_rgb32)(SwsContext *c, uint8_t* src[], int srcSt |
504 | 504 |
} |
505 | 505 |
|
506 | 506 |
static inline int RENAME(yuv420_bgr32)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY, |
507 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){ |
|
507 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
508 |
+{ |
|
508 | 509 |
int y, h_size; |
509 | 510 |
|
510 | 511 |
YUV422_UNSHIFT |
... | ... |
@@ -520,7 +526,8 @@ static inline int RENAME(yuv420_bgr32)(SwsContext *c, const uint8_t* src[], int |
520 | 520 |
} |
521 | 521 |
|
522 | 522 |
static inline int RENAME(yuva420_bgr32)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY, |
523 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){ |
|
523 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
524 |
+{ |
|
524 | 525 |
#if HAVE_7REGS |
525 | 526 |
int y, h_size; |
526 | 527 |
|
... | ... |
@@ -92,7 +92,8 @@ const int32_t ff_yuv2rgb_coeffs[8][4] = { |
92 | 92 |
|
93 | 93 |
#define YUV2RGBFUNC(func_name, dst_type, alpha) \ |
94 | 94 |
static int func_name(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, \ |
95 |
- int srcSliceH, uint8_t* dst[], int dstStride[]){\ |
|
95 |
+ int srcSliceH, uint8_t* dst[], int dstStride[]) \ |
|
96 |
+{\ |
|
96 | 97 |
int y;\ |
97 | 98 |
\ |
98 | 99 |
if (!alpha && c->srcFormat == PIX_FMT_YUV422P) {\ |
... | ... |
@@ -110,7 +111,7 @@ static int func_name(SwsContext *c, uint8_t* src[], int srcStride[], int srcSlic |
110 | 110 |
uint8_t *pv = src[2] + (y>>1)*srcStride[2];\ |
111 | 111 |
uint8_t av_unused *pa_1, *pa_2;\ |
112 | 112 |
unsigned int h_size = c->dstW>>3;\ |
113 |
- if (alpha){\ |
|
113 |
+ if (alpha) {\ |
|
114 | 114 |
pa_1 = src[3] + y*srcStride[3];\ |
115 | 115 |
pa_2 = pa_1 + srcStride[3];\ |
116 | 116 |
}\ |