comparison postproc/rgb2rgb_template.c @ 11068:f33f908ae085

uyvy output support in swscaler
author alex
date Thu, 09 Oct 2003 22:25:53 +0000
parents a32fb6812221
children 3254b413ef1c
comparison
equal deleted inserted replaced
11067:2340e006992f 11068:f33f908ae085
1564 unsigned int width, unsigned int height, 1564 unsigned int width, unsigned int height,
1565 int lumStride, int chromStride, int dstStride) 1565 int lumStride, int chromStride, int dstStride)
1566 { 1566 {
1567 //FIXME interpolate chroma 1567 //FIXME interpolate chroma
1568 RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2); 1568 RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
1569 }
1570
1571 static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
1572 unsigned int width, unsigned int height,
1573 int lumStride, int chromStride, int dstStride, int vertLumPerChroma)
1574 {
1575 unsigned y;
1576 const unsigned chromWidth= width>>1;
1577 for(y=0; y<height; y++)
1578 {
1579 #if __WORDSIZE >= 64
1580 int i;
1581 uint64_t *ldst = (uint64_t *) dst;
1582 const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
1583 for(i = 0; i < chromWidth; i += 2){
1584 uint64_t k, l;
1585 k = uc[0] + (yc[0] << 8) +
1586 (vc[0] << 16) + (yc[1] << 24);
1587 l = uc[1] + (yc[2] << 8) +
1588 (vc[1] << 16) + (yc[3] << 24);
1589 *ldst++ = k + (l << 32);
1590 yc += 4;
1591 uc += 2;
1592 vc += 2;
1593 }
1594
1595 #else
1596 int i, *idst = (int32_t *) dst;
1597 const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
1598 for(i = 0; i < chromWidth; i++){
1599 *idst++ = uc[0] + (yc[0] << 8) +
1600 (vc[0] << 16) + (yc[1] << 24);
1601 yc += 2;
1602 uc++;
1603 vc++;
1604 }
1605 #endif
1606 if((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) )
1607 {
1608 usrc += chromStride;
1609 vsrc += chromStride;
1610 }
1611 ysrc += lumStride;
1612 dst += dstStride;
1613 }
1614 }
1615
1616 /**
1617 *
1618 * height should be a multiple of 2 and width should be a multiple of 16 (if this is a
1619 * problem for anyone then tell me, and ill fix it)
1620 */
1621 static inline void RENAME(yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
1622 unsigned int width, unsigned int height,
1623 int lumStride, int chromStride, int dstStride)
1624 {
1625 //FIXME interpolate chroma
1626 RENAME(yuvPlanartouyvy)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
1569 } 1627 }
1570 1628
1571 /** 1629 /**
1572 * 1630 *
1573 * width should be a multiple of 16 1631 * width should be a multiple of 16