Community
cancel
Showing results for 
Search instead for 
Did you mean: 
atvan
Beginner
164 Views

Jpeg U-V swapping

Jump to solution
TheIPP jpeg decoder works very well in most cases. But whendecodingimage froma certain type of encoder, red and blue are swapped in the output images.

Please refer to the attached two files.

I use the ipp decoder decode the jpeg image to YV12, then use the color space converter convert to RGB24 and save as a bmp file. And you can see the red and blue are swapped in the bmp image.

I hope some one can tell me why. Thx.
0 Kudos
1 Solution
jon_shadforth
Novice
164 Views
Quoting - 360360
TheIPP jpeg decoder works very well in most cases. But whendecodingimage froma certain type of encoder, red and blue are swapped in the output images.

Please refer to the attached two files.

I use the ipp decoder decode the jpeg image to YV12, then use the color space converter convert to RGB24 and save as a bmp file. And you can see the red and blue are swapped in the bmp image.

I hope some one can tell me why. Thx.

I found this thread because I had the same or a similar problem. I have written a .net library that uses the sample JPEG codec, but found that red and blue channels were incorrect. I found a link on this site to help build the IPPI sample code (at bottom of this post), and once I'd build the jpegview sample I could then debug it. I was suprised to find the following call in FileOpenDlg.cpp: m_frame.SwapChannels(dstOrder);. This fixes the problem of red and blue channels being in the wrong order.

What suprised me was that this call is made inside a file open dialog class, and is not part of the codec library! I've probably missed something re JPEGs. It is also a shame that the another, possibly important, function call (RGBA_FPX_to_BGRA) is used in this class, but doesn't have any comments/documentation.

My only remaining concern is that I have an additional step involved, which I'd assumed could have been done during decoding.

Feedback appreciated.

Regards,
Jon.

Link for generated Microsoft Studio 2005 solution files from IPPI sample code:

http://software.intel.com/en-us/articles/creating-microsoft-visual-studio-net-2005-project-files/

View solution in original post

5 Replies
robertd
Beginner
164 Views
Quoting - 360360
TheIPP jpeg decoder works very well in most cases. But whendecodingimage froma certain type of encoder, red and blue are swapped in the output images.

Please refer to the attached two files.

I use the ipp decoder decode the jpeg image to YV12, then use the color space converter convert to RGB24 and save as a bmp file. And you can see the red and blue are swapped in the bmp image.

I hope some one can tell me why. Thx.

I noticed a change in IPP samples umc_color_space_conversion.cpp line 255 of the w_ipp-samples_p_6.0.0.127.

status = ippiYCbCr422ToYCrCb420_8u_C2P3R(pSrc[0], pSrcStep[0], pDst, pDstStep, srcSize);

This change results in our application in exchanging the colors Red and Blue.

In the past it was working correct.
status = ippiYCbCr422ToYCrCb420_8u_C2P3R(pSrc[0], pSrcStep[0], pDstYVU, pDstStepYVU, srcSize);

atvan
Beginner
164 Views
Quoting - robertd
Quoting - 360360
TheIPP jpeg decoder works very well in most cases. But whendecodingimage froma certain type of encoder, red and blue are swapped in the output images.

Please refer to the attached two files.

I use the ipp decoder decode the jpeg image to YV12, then use the color space converter convert to RGB24 and save as a bmp file. And you can see the red and blue are swapped in the bmp image.

I hope some one can tell me why. Thx.

I noticed a change in IPP samples umc_color_space_conversion.cpp line 255 of the w_ipp-samples_p_6.0.0.127.

status = ippiYCbCr422ToYCrCb420_8u_C2P3R(pSrc[0], pSrcStep[0], pDst, pDstStep, srcSize);

This change results in our application in exchanging the colors Red and Blue.

In the past it was working correct.
status = ippiYCbCr422ToYCrCb420_8u_C2P3R(pSrc[0], pSrcStep[0], pDstYVU, pDstStepYVU, srcSize);


Yes, the change makes the YV12 output correct. Output colors are still not correctwhile usingother YUV formats.

Vladimir_Dudnik
Employee
164 Views
Hello,

I was not able to reproduce that issue with UIC picnic application.

Regards,
Vladimir

jon_shadforth
Novice
165 Views
Quoting - 360360
TheIPP jpeg decoder works very well in most cases. But whendecodingimage froma certain type of encoder, red and blue are swapped in the output images.

Please refer to the attached two files.

I use the ipp decoder decode the jpeg image to YV12, then use the color space converter convert to RGB24 and save as a bmp file. And you can see the red and blue are swapped in the bmp image.

I hope some one can tell me why. Thx.

I found this thread because I had the same or a similar problem. I have written a .net library that uses the sample JPEG codec, but found that red and blue channels were incorrect. I found a link on this site to help build the IPPI sample code (at bottom of this post), and once I'd build the jpegview sample I could then debug it. I was suprised to find the following call in FileOpenDlg.cpp: m_frame.SwapChannels(dstOrder);. This fixes the problem of red and blue channels being in the wrong order.

What suprised me was that this call is made inside a file open dialog class, and is not part of the codec library! I've probably missed something re JPEGs. It is also a shame that the another, possibly important, function call (RGBA_FPX_to_BGRA) is used in this class, but doesn't have any comments/documentation.

My only remaining concern is that I have an additional step involved, which I'd assumed could have been done during decoding.

Feedback appreciated.

Regards,
Jon.

Link for generated Microsoft Studio 2005 solution files from IPPI sample code:

http://software.intel.com/en-us/articles/creating-microsoft-visual-studio-net-2005-project-files/

View solution in original post

Vladimir_Dudnik
Employee
164 Views
Please check how do you call IPP JPEG decoder. If you set output color space as JC_RGB then codec will provide you with RGB data which in turn have to be swapped to be correctly displayed on Windows. Note, you may instruct IPP JPEG codec to produce BGR data by specifying JC_BGR as output color space.

Regards,
Vladimir

Reply