if(firstTime) { #ifdef ARCH_X86 if(gCpuCaps.hasMMX) asm volatile("emms\n\t"::: "memory"); #endif flags= SWS_PRINT_INFO; firstTime=0;  if(src_filter.lumH) freeVec(src_filter.lumH); if(src_filter.lumV) freeVec(src_filter.lumV); if(src_filter.chrH) freeVec(src_filter.chrH); if(src_filter.chrV) freeVec(src_filter.chrV);  if(sws_lum_gblur!=0.0){ src_filter.lumH= getGaussianVec(sws_lum_gblur, 3.0); src_filter.lumV= getGaussianVec(sws_lum_gblur, 3.0); }else{ src_filter.lumH= getIdentityVec(); src_filter.lumV= getIdentityVec(); }  if(sws_chr_gblur!=0.0){ src_filter.chrH= getGaussianVec(sws_chr_gblur, 3.0); src_filter.chrV= getGaussianVec(sws_chr_gblur, 3.0); }else{ src_filter.chrH= getIdentityVec(); src_filter.chrV= getIdentityVec(); }  if(sws_chr_sharpen!=0.0){ SwsVector *g= getConstVec(-1.0, 3); SwsVector *id= getConstVec(10.0/sws_chr_sharpen, 1); g->coeff[1]=2.0; addVec(id, g); convVec(src_filter.chrH, id); convVec(src_filter.chrV, id); freeVec(g); freeVec(id); }  if(sws_lum_sharpen!=0.0){ SwsVector *g= getConstVec(-1.0, 3); SwsVector *id= getConstVec(10.0/sws_lum_sharpen, 1); g->coeff[1]=2.0; addVec(id, g); convVec(src_filter.lumH, id); convVec(src_filter.lumV, id); freeVec(g); freeVec(id); }  if(sws_chr_hshift) shiftVec(src_filter.chrH, sws_chr_hshift);  if(sws_chr_vshift) shiftVec(src_filter.chrV, sws_chr_vshift);  normalizeVec(src_filter.chrH, 1.0); normalizeVec(src_filter.chrV, 1.0); normalizeVec(src_filter.lumH, 1.0); normalizeVec(src_filter.lumV, 1.0);  if(verbose > 1) printVec(src_filter.chrH); if(verbose > 1) printVec(src_filter.lumH); }
void SwScale_YV12slice(unsigned char* src[], int srcStride[], int srcSliceY ,			     int srcSliceH, uint8_t* dst[], int dstStride, int dstbpp,			     int srcW, int srcH, int dstW, int dstH){	static SwsContext *context=NULL;	int dstFormat;	int flags=0;	static int firstTime=1;	int dstStride3[3]= {dstStride, dstStride>>1, dstStride>>1};	if(firstTime)	{#ifdef ARCH_X86		if(gCpuCaps.hasMMX)			asm volatile("emms\n\t"::: "memory"); //FIXME this shouldnt be required but it IS (even for non mmx versions)#endif		flags= SWS_PRINT_INFO;		firstTime=0;		if(src_filter.lumH) freeVec(src_filter.lumH);		if(src_filter.lumV) freeVec(src_filter.lumV);		if(src_filter.chrH) freeVec(src_filter.chrH);		if(src_filter.chrV) freeVec(src_filter.chrV);		if(sws_lum_gblur!=0.0){			src_filter.lumH= getGaussianVec(sws_lum_gblur, 3.0);			src_filter.lumV= getGaussianVec(sws_lum_gblur, 3.0);		}else{			src_filter.lumH= getIdentityVec();			src_filter.lumV= getIdentityVec();		}		if(sws_chr_gblur!=0.0){			src_filter.chrH= getGaussianVec(sws_chr_gblur, 3.0);			src_filter.chrV= getGaussianVec(sws_chr_gblur, 3.0);		}else{			src_filter.chrH= getIdentityVec();			src_filter.chrV= getIdentityVec();		}		if(sws_chr_sharpen!=0.0){			SwsVector *g= getConstVec(-1.0, 3);			SwsVector *id= getConstVec(10.0/sws_chr_sharpen, 1);			g->coeff[1]=2.0;			addVec(id, g);			convVec(src_filter.chrH, id);			convVec(src_filter.chrV, id);			freeVec(g);			freeVec(id);		}		if(sws_lum_sharpen!=0.0){			SwsVector *g= getConstVec(-1.0, 3);			SwsVector *id= getConstVec(10.0/sws_lum_sharpen, 1);			g->coeff[1]=2.0;			addVec(id, g);			convVec(src_filter.lumH, id);			convVec(src_filter.lumV, id);			freeVec(g);			freeVec(id);		}		if(sws_chr_hshift)			shiftVec(src_filter.chrH, sws_chr_hshift);		if(sws_chr_vshift)			shiftVec(src_filter.chrV, sws_chr_vshift);		normalizeVec(src_filter.chrH, 1.0);		normalizeVec(src_filter.chrV, 1.0);		normalizeVec(src_filter.lumH, 1.0);		normalizeVec(src_filter.lumV, 1.0);		if(verbose > 1) printVec(src_filter.chrH);		if(verbose > 1) printVec(src_filter.lumH);	}	switch(dstbpp)	{		case 8 : dstFormat= IMGFMT_Y8;		break;		case 12: dstFormat= IMGFMT_YV12;	break;		case 15: dstFormat= IMGFMT_BGR15;	break;		case 16: dstFormat= IMGFMT_BGR16;	break;		case 24: dstFormat= IMGFMT_BGR24;	break;		case 32: dstFormat= IMGFMT_BGR32;	break;		default: return;	}	switch(sws_flags)	{		case 0: flags|= SWS_FAST_BILINEAR; break;		case 1: flags|= SWS_BILINEAR; break;		case 2: flags|= SWS_BICUBIC; break;		case 3: flags|= SWS_X; break;		case 4: flags|= SWS_POINT; break;		case 5: flags|= SWS_AREA; break;		default:flags|= SWS_BILINEAR; break;	}	if(!context) context=getSwsContext(srcW, srcH, IMGFMT_YV12, dstW, dstH, dstFormat, flags, &src_filter, NULL);	swScale(context, src, srcStride, srcSliceY, srcSliceH, dst, dstStride3);}