Revision caeaabe7

View differences:

postproc/rgb2rgb.c
41 41
void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
42 42
	unsigned int width, unsigned int height,
43 43
	int lumStride, int chromStride, int dstStride);
44
void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
45
	unsigned int width, unsigned int height,
46
	int lumStride, int chromStride, int dstStride);
44 47
void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
45 48
	unsigned int width, unsigned int height,
46 49
	int lumStride, int chromStride, int dstStride);
......
213 216
		rgb32tobgr16= rgb32tobgr16_MMX2;
214 217
		rgb32tobgr15= rgb32tobgr15_MMX2;
215 218
		yv12toyuy2= yv12toyuy2_MMX2;
219
		yv12touyvy= yv12touyvy_MMX2;
216 220
		yuv422ptoyuy2= yuv422ptoyuy2_MMX2;
217 221
		yuy2toyv12= yuy2toyv12_MMX2;
218 222
		uyvytoyv12= uyvytoyv12_MMX2;
......
242 246
		rgb32tobgr16= rgb32tobgr16_3DNOW;
243 247
		rgb32tobgr15= rgb32tobgr15_3DNOW;
244 248
		yv12toyuy2= yv12toyuy2_3DNOW;
249
		yv12touyvy= yv12touyvy_3DNOW;
245 250
		yuv422ptoyuy2= yuv422ptoyuy2_3DNOW;
246 251
		yuy2toyv12= yuy2toyv12_3DNOW;
247 252
		uyvytoyv12= uyvytoyv12_3DNOW;
......
271 276
		rgb32tobgr16= rgb32tobgr16_MMX;
272 277
		rgb32tobgr15= rgb32tobgr15_MMX;
273 278
		yv12toyuy2= yv12toyuy2_MMX;
279
		yv12touyvy= yv12touyvy_MMX;
274 280
		yuv422ptoyuy2= yuv422ptoyuy2_MMX;
275 281
		yuy2toyv12= yuy2toyv12_MMX;
276 282
		uyvytoyv12= uyvytoyv12_MMX;
......
302 308
		rgb32tobgr16= rgb32tobgr16_C;
303 309
		rgb32tobgr15= rgb32tobgr15_C;
304 310
		yv12toyuy2= yv12toyuy2_C;
311
		yv12touyvy= yv12touyvy_C;
305 312
		yuv422ptoyuy2= yuv422ptoyuy2_C;
306 313
		yuy2toyv12= yuy2toyv12_C;
307 314
//		uyvytoyv12= uyvytoyv12_C;
postproc/rgb2rgb_template.c
1568 1568
	RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
1569 1569
}
1570 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);
1627
}
1628

  
1571 1629
/**
1572 1630
 *
1573 1631
 * width should be a multiple of 16
postproc/swscale.c
18 18

  
19 19
/*
20 20
  supported Input formats: YV12, I420/IYUV, YUY2, UYVY, BGR32, BGR24, BGR16, BGR15, RGB32, RGB24, Y8/Y800, YVU9/IF09
21
  supported output formats: YV12, I420/IYUV, YUY2, {BGR,RGB}{1,4,8,15,16,24,32}, Y8/Y800, YVU9/IF09
21
  supported output formats: YV12, I420/IYUV, YUY2, UYVY, {BGR,RGB}{1,4,8,15,16,24,32}, Y8/Y800, YVU9/IF09
22 22
  {BGR,RGB}{1,4,8,15,16} support dithering
23 23
  
24 24
  unscaled special converters (YV12=I420=IYUV, Y800=Y8)
......
107 107
			|| (x)==IMGFMT_RGB32|| (x)==IMGFMT_RGB24\
108 108
			|| (x)==IMGFMT_Y800 || (x)==IMGFMT_YVU9\
109 109
			|| (x)==IMGFMT_444P || (x)==IMGFMT_422P || (x)==IMGFMT_411P)
110
#define isSupportedOut(x) ((x)==IMGFMT_YV12 || (x)==IMGFMT_YUY2\
110
#define isSupportedOut(x) ((x)==IMGFMT_YV12 || (x)==IMGFMT_YUY2 || (x)==IMGFMT_UYVY\
111 111
			|| (x)==IMGFMT_444P || (x)==IMGFMT_422P || (x)==IMGFMT_411P\
112 112
			|| isRGB(x) || isBGR(x)\
113 113
			|| (x)==IMGFMT_Y800 || (x)==IMGFMT_YVU9)
......
503 503
			((uint8_t*)dest)[2*i2+3]= V;\
504 504
		}		\
505 505
		break;\
506
	case IMGFMT_UYVY:\
507
		func2\
508
			((uint8_t*)dest)[2*i2+0]= U;\
509
			((uint8_t*)dest)[2*i2+1]= Y1;\
510
			((uint8_t*)dest)[2*i2+2]= V;\
511
			((uint8_t*)dest)[2*i2+3]= Y2;\
512
		}		\
513
		break;\
506 514
	}\
507 515

  
508 516

  
......
647 655
			((uint8_t*)dest)[2*i2+3]= V;
648 656
		}
649 657
                break;
658
	case IMGFMT_UYVY:
659
		YSCALE_YUV_2_PACKEDX_C(void)
660
			((uint8_t*)dest)[2*i2+0]= U;
661
			((uint8_t*)dest)[2*i2+1]= Y1;
662
			((uint8_t*)dest)[2*i2+2]= V;
663
			((uint8_t*)dest)[2*i2+3]= Y2;
664
		}
665
                break;
650 666
	}
651 667
}
652 668

  
......
1336 1352
	return srcSliceH;
1337 1353
}
1338 1354

  
1355
static int PlanarToUyvyWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
1356
             int srcSliceH, uint8_t* dstParam[], int dstStride[]){
1357
	uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
1358

  
1359
	yv12touyvy( src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0] );
1360

  
1361
	return srcSliceH;
1362
}
1363

  
1339 1364
/* {RGB,BGR}{15,16,24,32} -> {RGB,BGR}{15,16,24,32} */
1340 1365
static int rgb2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
1341 1366
			   int srcSliceH, uint8_t* dst[], int dstStride[]){
......
1821 1846
				c->swScale= rgb2rgbWrapper;
1822 1847

  
1823 1848
			/* yv12_to_yuy2 */
1824
			if(srcFormat == IMGFMT_YV12 && dstFormat == IMGFMT_YUY2)
1849
			if(srcFormat == IMGFMT_YV12 && 
1850
			    (dstFormat == IMGFMT_YUY2 || dstFormat == IMGFMT_UYVY))
1825 1851
			{
1826
				c->swScale= PlanarToYuy2Wrapper;
1852
				if (dstFormat == IMGFMT_YUY2)
1853
				    c->swScale= PlanarToYuy2Wrapper;
1854
				else
1855
				    c->swScale= PlanarToUyvyWrapper;
1827 1856
			}
1828 1857
		}
1829 1858

  

Also available in: Unified diff