int length= plane==0 ? c->srcW  : ((c->srcW+1)>>1); int y=      plane==0 ? srcSliceY: ((srcSliceY+1)>>1); int height= plane==0 ? srcSliceH: ((srcSliceH+1)>>1);
int length= plane==0 ? c->srcW  : -((-c->srcW  )>>c->chrDstHSubSample); int y=      plane==0 ? srcSliceY: -((-srcSliceY)>>c->chrDstVSubSample); int height= plane==0 ? srcSliceH: -((-srcSliceH)>>c->chrDstVSubSample);
static void simpleCopy(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,             int srcSliceH, uint8_t* dstParam[], int dstStrideParam[]){	int srcStride[3];	int dstStride[3];	uint8_t *src[3];	uint8_t *dst[3];	orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);	orderYUV(c->dstFormat, dst, dstStride, dstParam, dstStrideParam);	if(isPacked(c->srcFormat))	{		if(dstStride[0]==srcStride[0])			memcpy(dst[0] + dstStride[0]*srcSliceY, src[0], srcSliceH*dstStride[0]);		else		{			int i;			uint8_t *srcPtr= src[0];			uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;			int length=0;			/* universal length finder */			while(length+c->srcW <= ABS(dstStride[0]) 			   && length+c->srcW <= ABS(srcStride[0])) length+= c->srcW;			ASSERT(length!=0);			for(i=0; i<srcSliceH; i++)			{				memcpy(dstPtr, srcPtr, length);				srcPtr+= srcStride[0];				dstPtr+= dstStride[0];			}		}	}	else 	{ /* Planar YUV or gray */		int plane;		for(plane=0; plane<3; plane++)		{			int length= plane==0 ? c->srcW  : ((c->srcW+1)>>1);			int y=      plane==0 ? srcSliceY: ((srcSliceY+1)>>1);			int height= plane==0 ? srcSliceH: ((srcSliceH+1)>>1);			if((isGray(c->srcFormat) || isGray(c->dstFormat)) && plane>0)			{				if(!isGray(c->dstFormat))					memset(dst[plane], 0, dstStride[plane]*height);			}			else			{				if(dstStride[plane]==srcStride[plane])					memcpy(dst[plane] + dstStride[plane]*y, src[plane], height*dstStride[plane]);				else				{					int i;					uint8_t *srcPtr= src[plane];					uint8_t *dstPtr= dst[plane] + dstStride[plane]*y;					for(i=0; i<height; i++)					{						memcpy(dstPtr, srcPtr, length);						srcPtr+= srcStride[plane];						dstPtr+= dstStride[plane];					}				}			}		}	}}