Revision b935781b

View differences:

postproc/swscale.c
25 25
  YV12/I420/IYUV -> BGR15/BGR16/BGR24/BGR32
26 26
  YV12/I420/IYUV -> YV12/I420/IYUV
27 27
  YUY2/BGR15/BGR16/BGR24/BGR32/RGB24/RGB32 -> same format
28
  BGR24 -> BGR32 & RGB24 -> RGB32
29
  BGR32 -> BGR24 & RGB32 -> RGB24
30
*/
31

  
32
/* 
33
tested special converters
34
 YV12/I420 -> BGR16
35
 YV12 -> YV12
36

  
37
untested special converters
38
  YV12/I420/IYUV -> BGR15/BGR24/BGR32 (its the yuv2rgb stuff, so it should be ok)
39
  YV12/I420/IYUV -> YV12/I420/IYUV 
40
  YUY2/BGR15/BGR16/BGR24/BGR32/RGB24/RGB32 -> same format
41
  BGR24 -> BGR32 & RGB24 -> RGB32
42
  BGR32 -> BGR24 & RGB32 -> RGB24
28 43
*/
29 44

  
30 45
#include <inttypes.h>
......
1134 1149
		yuv2rgb( dst,src[0],src[2],src[1],c->srcW,srcSliceH,dstStride[0],srcStride[0],srcStride[1] );
1135 1150
}
1136 1151

  
1152
static void bgr24to32Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
1153
             int srcSliceH, uint8_t* dst[], int dstStride[]){
1154
	
1155
	if(dstStride[0]*3==srcStride[0]*4)
1156
		rgb24to32(src[0], dst[0] + dstStride[0]*srcSliceY, srcSliceH*dstStride[0]>>2);
1157
	else
1158
	{
1159
		int i;
1160
		uint8_t *srcPtr= src[0];
1161
		uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
1162

  
1163
		for(i=0; i<srcSliceH; i++)
1164
		{
1165
			rgb24to32(srcPtr, dstPtr, c->srcW);
1166
			srcPtr+= srcStride[0];
1167
			dstPtr+= dstStride[0];
1168
		}
1169
	}     
1170
}
1171

  
1172
static void bgr32to24Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
1173
             int srcSliceH, uint8_t* dst[], int dstStride[]){
1174
	
1175
	if(dstStride[0]*4==srcStride[0]*3)
1176
		rgb32to24(src[0], dst[0] + dstStride[0]*srcSliceY, srcSliceH*srcStride[0]>>2);
1177
	else
1178
	{
1179
		int i;
1180
		uint8_t *srcPtr= src[0];
1181
		uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
1182

  
1183
		for(i=0; i<srcSliceH; i++)
1184
		{
1185
			rgb32to24(srcPtr, dstPtr, c->srcW);
1186
			srcPtr+= srcStride[0];
1187
			dstPtr+= dstStride[0];
1188
		}
1189
	}     
1190
}
1191

  
1192

  
1137 1193
/* unscaled copy like stuff (assumes nearly identical formats) */
1138 1194
static void simpleCopy(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
1139 1195
             int srcSliceH, uint8_t* dstParam[], int dstStride[]){
......
1294 1350
	if(srcFilter->chrV!=NULL && srcFilter->chrV->length>1) usesFilter=1;
1295 1351
	if(srcFilter->chrH!=NULL && srcFilter->chrH->length>1) usesFilter=1;
1296 1352
	
1297
	/* special Cases */
1353
	/* unscaled special Cases */
1298 1354
	if(srcW==dstW && srcH==dstH && !usesFilter)
1299 1355
	{
1300 1356
		/* yuv2bgr */
......
1320 1376
					vo_format_name(srcFormat), vo_format_name(dstFormat));
1321 1377
			return c;
1322 1378
		}
1379
		
1380
		/* bgr32to24 & rgb32to24*/
1381
		if((srcFormat==IMGFMT_BGR32 && dstFormat==IMGFMT_BGR24)
1382
		 ||(srcFormat==IMGFMT_RGB32 && dstFormat==IMGFMT_RGB24))
1383
		{
1384
			c->swScale= bgr32to24Wrapper;
1385

  
1386
			if(flags&SWS_PRINT_INFO)
1387
				printf("SwScaler: using unscaled %s -> %s special converter\n", 
1388
					vo_format_name(srcFormat), vo_format_name(dstFormat));
1389
			return c;
1390
		}
1391
		
1392
		/* bgr24to32 & rgb24to32*/
1393
		if((srcFormat==IMGFMT_BGR24 && dstFormat==IMGFMT_BGR32)
1394
		 ||(srcFormat==IMGFMT_RGB24 && dstFormat==IMGFMT_RGB32))
1395
		{
1396
			c->swScale= bgr24to32Wrapper;
1397

  
1398
			if(flags&SWS_PRINT_INFO)
1399
				printf("SwScaler: using unscaled %s -> %s special converter\n", 
1400
					vo_format_name(srcFormat), vo_format_name(dstFormat));
1401
			return c;
1402
		}
1323 1403
	}
1324 1404

  
1325 1405
	if(cpuCaps.hasMMX2)

Also available in: Unified diff