comparison postproc/rgb2rgb_template.c @ 2725:5bba527c9a4c

unsigned stuff
author michael
date Mon, 05 Nov 2001 19:55:11 +0000
parents c08b7af26782
children ae79207a3055
comparison
equal deleted inserted replaced
2724:c08b7af26782 2725:5bba527c9a4c
293 * 293 *
294 * height should be a multiple of 2 and width should be a multiple of 16 (if this is a 294 * height should be a multiple of 2 and width should be a multiple of 16 (if this is a
295 * problem for anyone then tell me, and ill fix it) 295 * problem for anyone then tell me, and ill fix it)
296 */ 296 */
297 void yv12toyuy2(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, 297 void yv12toyuy2(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
298 int width, int height, int lumStride, int chromStride, int dstStride) 298 unsigned int width, unsigned int height,
299 unsigned int lumStride, unsigned int chromStride, unsigned int dstStride)
299 { 300 {
300 int y; 301 int y;
301 const int chromWidth= width>>1; 302 const int chromWidth= width>>1;
302 for(y=0; y<height; y++) 303 for(y=0; y<height; y++)
303 { 304 {
364 * 365 *
365 * height should be a multiple of 2 and width should be a multiple of 16 (if this is a 366 * height should be a multiple of 2 and width should be a multiple of 16 (if this is a
366 * problem for anyone then tell me, and ill fix it) 367 * problem for anyone then tell me, and ill fix it)
367 */ 368 */
368 void yuy2toyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, 369 void yuy2toyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
369 int width, int height, int lumStride, int chromStride, int srcStride) 370 unsigned int width, unsigned int height,
371 unsigned int lumStride, unsigned int chromStride, unsigned int srcStride)
370 { 372 {
371 int y; 373 int y;
372 const int chromWidth= width>>1; 374 const int chromWidth= width>>1;
373 for(y=0; y<height; y+=2) 375 for(y=0; y<height; y+=2)
374 { 376 {
418 MOVNTQ" %%mm2, (%2, %%eax) \n\t" 420 MOVNTQ" %%mm2, (%2, %%eax) \n\t"
419 421
420 "addl $8, %%eax \n\t" 422 "addl $8, %%eax \n\t"
421 "cmpl %4, %%eax \n\t" 423 "cmpl %4, %%eax \n\t"
422 " jb 1b \n\t" 424 " jb 1b \n\t"
423 425 ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "r" (chromWidth)
426 : "memory", "%eax"
427 );
428
429 asm volatile(
430 "xorl %%eax, %%eax \n\t"
424 "1: \n\t" 431 "1: \n\t"
425 PREFETCH" 64(%0, %%eax, 4) \n\t" 432 PREFETCH" 64(%0, %%eax, 4) \n\t"
426 "movq (%0, %%eax, 4), %%mm0 \n\t" // YUYV YUYV(0) 433 "movq (%0, %%eax, 4), %%mm0 \n\t" // YUYV YUYV(0)
427 "movq 8(%0, %%eax, 4), %%mm1 \n\t" // YUYV YUYV(4) 434 "movq 8(%0, %%eax, 4), %%mm1 \n\t" // YUYV YUYV(4)
428 "movq 16(%0, %%eax, 4), %%mm2 \n\t" // YUYV YUYV(8) 435 "movq 16(%0, %%eax, 4), %%mm2 \n\t" // YUYV YUYV(8)
436 443
437 MOVNTQ" %%mm0, (%1, %%eax, 2) \n\t" 444 MOVNTQ" %%mm0, (%1, %%eax, 2) \n\t"
438 MOVNTQ" %%mm2, 8(%1, %%eax, 2) \n\t" 445 MOVNTQ" %%mm2, 8(%1, %%eax, 2) \n\t"
439 446
440 "addl $8, %%eax \n\t" 447 "addl $8, %%eax \n\t"
441 "cmpl %5, %%eax \n\t" 448 "cmpl %4, %%eax \n\t"
442 " jb 1b \n\t" 449 " jb 1b \n\t"
443 450
444 ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "r" (chromWidth), "m"(width) 451 ::"r"(src+srcStride), "r"(ydst+lumStride), "r"(udst), "r"(vdst), "r" (chromWidth)
445 : "memory", "%eax" 452 : "memory", "%eax"
446 ); 453 );
447 #else 454 #else
448 int i; 455 int i;
449 for(i=0; i<chromWidth; i++) 456 for(i=0; i<chromWidth; i++)