Revision caeaabe7 postproc/swscale.c

View differences:

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