comparison postproc/rgb2rgb_template.c @ 9392:7bbe4bce6293

cleanup (unsigned stride -> int stride)
author michael
date Tue, 11 Feb 2003 12:57:53 +0000
parents 93e8d1655797
children 5f9c97070b56
comparison
equal deleted inserted replaced
9391:7c211b317e49 9392:7bbe4bce6293
1369 } 1369 }
1370 } 1370 }
1371 1371
1372 static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, 1372 static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
1373 unsigned int width, unsigned int height, 1373 unsigned int width, unsigned int height,
1374 unsigned int lumStride, unsigned int chromStride, unsigned int dstStride, int vertLumPerChroma) 1374 int lumStride, int chromStride, int dstStride, int vertLumPerChroma)
1375 { 1375 {
1376 unsigned y; 1376 unsigned y;
1377 const unsigned chromWidth= width>>1; 1377 const unsigned chromWidth= width>>1;
1378 for(y=0; y<height; y++) 1378 for(y=0; y<height; y++)
1379 { 1379 {
1461 * height should be a multiple of 2 and width should be a multiple of 16 (if this is a 1461 * height should be a multiple of 2 and width should be a multiple of 16 (if this is a
1462 * problem for anyone then tell me, and ill fix it) 1462 * problem for anyone then tell me, and ill fix it)
1463 */ 1463 */
1464 static inline void RENAME(yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, 1464 static inline void RENAME(yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
1465 unsigned int width, unsigned int height, 1465 unsigned int width, unsigned int height,
1466 unsigned int lumStride, unsigned int chromStride, unsigned int dstStride) 1466 int lumStride, int chromStride, int dstStride)
1467 { 1467 {
1468 //FIXME interpolate chroma 1468 //FIXME interpolate chroma
1469 RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2); 1469 RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
1470 } 1470 }
1471 1471
1473 * 1473 *
1474 * width should be a multiple of 16 1474 * width should be a multiple of 16
1475 */ 1475 */
1476 static inline void RENAME(yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, 1476 static inline void RENAME(yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
1477 unsigned int width, unsigned int height, 1477 unsigned int width, unsigned int height,
1478 unsigned int lumStride, unsigned int chromStride, unsigned int dstStride) 1478 int lumStride, int chromStride, int dstStride)
1479 { 1479 {
1480 RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 1); 1480 RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 1);
1481 } 1481 }
1482 1482
1483 /** 1483 /**
1485 * height should be a multiple of 2 and width should be a multiple of 16 (if this is a 1485 * height should be a multiple of 2 and width should be a multiple of 16 (if this is a
1486 * problem for anyone then tell me, and ill fix it) 1486 * problem for anyone then tell me, and ill fix it)
1487 */ 1487 */
1488 static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, 1488 static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
1489 unsigned int width, unsigned int height, 1489 unsigned int width, unsigned int height,
1490 unsigned int lumStride, unsigned int chromStride, unsigned int srcStride) 1490 int lumStride, int chromStride, int srcStride)
1491 { 1491 {
1492 unsigned y; 1492 unsigned y;
1493 const unsigned chromWidth= width>>1; 1493 const unsigned chromWidth= width>>1;
1494 for(y=0; y<height; y+=2) 1494 for(y=0; y<height; y+=2)
1495 { 1495 {
1605 #endif 1605 #endif
1606 } 1606 }
1607 1607
1608 static inline void RENAME(yvu9toyv12)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, 1608 static inline void RENAME(yvu9toyv12)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc,
1609 uint8_t *ydst, uint8_t *udst, uint8_t *vdst, 1609 uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
1610 unsigned int width, unsigned int height, unsigned int lumStride, unsigned int chromStride) 1610 unsigned int width, unsigned int height, int lumStride, int chromStride)
1611 { 1611 {
1612 /* Y Plane */ 1612 /* Y Plane */
1613 memcpy(ydst, ysrc, width*height); 1613 memcpy(ydst, ysrc, width*height);
1614 1614
1615 /* XXX: implement upscaling for U,V */ 1615 /* XXX: implement upscaling for U,V */
1723 * problem for anyone then tell me, and ill fix it) 1723 * problem for anyone then tell me, and ill fix it)
1724 * chrominance data is only taken from every secound line others are ignored FIXME write HQ version 1724 * chrominance data is only taken from every secound line others are ignored FIXME write HQ version
1725 */ 1725 */
1726 static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, 1726 static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
1727 unsigned int width, unsigned int height, 1727 unsigned int width, unsigned int height,
1728 unsigned int lumStride, unsigned int chromStride, unsigned int srcStride) 1728 int lumStride, int chromStride, int srcStride)
1729 { 1729 {
1730 unsigned y; 1730 unsigned y;
1731 const unsigned chromWidth= width>>1; 1731 const unsigned chromWidth= width>>1;
1732 for(y=0; y<height; y+=2) 1732 for(y=0; y<height; y+=2)
1733 { 1733 {
1849 * problem for anyone then tell me, and ill fix it) 1849 * problem for anyone then tell me, and ill fix it)
1850 * chrominance data is only taken from every secound line others are ignored in the C version FIXME write HQ version 1850 * chrominance data is only taken from every secound line others are ignored in the C version FIXME write HQ version
1851 */ 1851 */
1852 static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, 1852 static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
1853 unsigned int width, unsigned int height, 1853 unsigned int width, unsigned int height,
1854 unsigned int lumStride, unsigned int chromStride, unsigned int srcStride) 1854 int lumStride, int chromStride, int srcStride)
1855 { 1855 {
1856 unsigned y; 1856 unsigned y;
1857 const unsigned chromWidth= width>>1; 1857 const unsigned chromWidth= width>>1;
1858 #ifdef HAVE_MMX 1858 #ifdef HAVE_MMX
1859 for(y=0; y<height-2; y+=2) 1859 for(y=0; y<height-2; y+=2)
2145 src += srcStride; 2145 src += srcStride;
2146 } 2146 }
2147 } 2147 }
2148 2148
2149 void RENAME(interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dest, 2149 void RENAME(interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dest,
2150 unsigned width, unsigned height, unsigned src1Stride, 2150 unsigned width, unsigned height, int src1Stride,
2151 unsigned src2Stride, unsigned dstStride){ 2151 int src2Stride, int dstStride){
2152 unsigned h; 2152 unsigned h;
2153 2153
2154 for(h=0; h < height; h++) 2154 for(h=0; h < height; h++)
2155 { 2155 {
2156 unsigned w; 2156 unsigned w;
2228 } 2228 }
2229 2229
2230 static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2, 2230 static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
2231 uint8_t *dst1, uint8_t *dst2, 2231 uint8_t *dst1, uint8_t *dst2,
2232 unsigned width, unsigned height, 2232 unsigned width, unsigned height,
2233 unsigned srcStride1, unsigned srcStride2, 2233 int srcStride1, int srcStride2,
2234 unsigned dstStride1, unsigned dstStride2) 2234 int dstStride1, int dstStride2)
2235 { 2235 {
2236 unsigned y,x,w,h; 2236 unsigned int y,x,h;
2237 int w;
2237 w=width/2; h=height/2; 2238 w=width/2; h=height/2;
2238 #ifdef HAVE_MMX 2239 #ifdef HAVE_MMX
2239 asm volatile( 2240 asm volatile(
2240 PREFETCH" %0\n\t" 2241 PREFETCH" %0\n\t"
2241 PREFETCH" %1\n\t" 2242 PREFETCH" %1\n\t"
2244 for(y=0;y<h;y++){ 2245 for(y=0;y<h;y++){
2245 const uint8_t* s1=src1+srcStride1*(y>>1); 2246 const uint8_t* s1=src1+srcStride1*(y>>1);
2246 uint8_t* d=dst1+dstStride1*y; 2247 uint8_t* d=dst1+dstStride1*y;
2247 x=0; 2248 x=0;
2248 #ifdef HAVE_MMX 2249 #ifdef HAVE_MMX
2249 if(w > 32) 2250 for(;x<w-31;x+=32)
2250 for(;x<w;x+=32)
2251 { 2251 {
2252 asm volatile( 2252 asm volatile(
2253 PREFETCH" 32%1\n\t" 2253 PREFETCH" 32%1\n\t"
2254 "movq %1, %%mm0\n\t" 2254 "movq %1, %%mm0\n\t"
2255 "movq 8%1, %%mm2\n\t" 2255 "movq 8%1, %%mm2\n\t"
2285 for(y=0;y<h;y++){ 2285 for(y=0;y<h;y++){
2286 const uint8_t* s2=src2+srcStride2*(y>>1); 2286 const uint8_t* s2=src2+srcStride2*(y>>1);
2287 uint8_t* d=dst2+dstStride2*y; 2287 uint8_t* d=dst2+dstStride2*y;
2288 x=0; 2288 x=0;
2289 #ifdef HAVE_MMX 2289 #ifdef HAVE_MMX
2290 if(w > 32) 2290 for(;x<w-31;x+=32)
2291 for(;x<w;x+=32)
2292 { 2291 {
2293 asm volatile( 2292 asm volatile(
2294 PREFETCH" 32%1\n\t" 2293 PREFETCH" 32%1\n\t"
2295 "movq %1, %%mm0\n\t" 2294 "movq %1, %%mm0\n\t"
2296 "movq 8%1, %%mm2\n\t" 2295 "movq 8%1, %%mm2\n\t"
2333 } 2332 }
2334 2333
2335 static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, 2334 static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
2336 uint8_t *dst, 2335 uint8_t *dst,
2337 unsigned width, unsigned height, 2336 unsigned width, unsigned height,
2338 unsigned srcStride1, unsigned srcStride2, 2337 int srcStride1, int srcStride2,
2339 unsigned srcStride3, unsigned dstStride) 2338 int srcStride3, int dstStride)
2340 { 2339 {
2341 unsigned y,x,x2,w,h; 2340 unsigned y,x,x2,w,h;
2342 w=width/2; h=height; 2341 w=width/2; h=height;
2343 #ifdef HAVE_MMX 2342 #ifdef HAVE_MMX
2344 asm volatile( 2343 asm volatile(