Problem with converting, what do i wrong!!

Hey Devs,

i wanna convert a YUV422 Format to YUV444 Format. The Problem is that my U & V Colors are wrong.

The Pictures i am using have a size of 640x480 Pixels!! The Pitch is 1024!!

Can somebody tell what i do wrong, here my code!!

[b]__global__ void deviceYUV422ToYUV444_1Channel(char* dSrcPtr, char* dDestPtr, int srcPitch, int srcWidth, int srcHeight)
	int i = blockIdx.x * blockDim.x + threadIdx.x;
	int j = blockIdx.y * blockDim.y + threadIdx.y;

	if (((j*srcWidth) + i) < (srcWidth*srcHeight))
		int index = (j*srcWidth + i) * 2;
		index += (srcPitch - srcWidth) * (int)((index) / srcWidth);
		dDestPtr[index] = dSrcPtr[((j*srcPitch) + i)];
		dDestPtr[index + 1] = dSrcPtr[((j*srcPitch) + i)];

void hostYUV422ToYUV444_1Channel(char* dSrcPtr, char* dDestPtr, int srcPitch, int srcWidth, int srcHeight){

	deviceYUV422ToYUV444_1Channel <<<1024,512>>>(dSrcPtr,

Thanks for help


Found my Problem! I did a mistake by using the BlockIDs and ThreadIDs :-)

Here is the result!

int i = threadIdx.x;

int j = blockIdx.x;
deviceYUV422ToYUV444_1Channel <<<512,1024>>>(dSrcPtr,dDestPtr,srcPitch,srcWidth,srcHeight);