Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6758 Discussions

IPP color conversion function RGBToYCrCb422 distorts original picture

Ilya_Zarezenko
Beginner
528 Views
Hi to everyone
IPP 7.0.6.300
We have tried to use IPP for RGB24 -> YUY2color space conversion (csc)and we found that this IPP function distorts the picture.
Lets look at the examplehttp://dl.dropbox.com/u/10903775/SC_RGB_YUV.png
(red lines in YUY2 seems more brightly, other pictures will have color artefacts also)
To repeat the bug, please convert RGB picture to YUY2 picture using RGBToYCrCb422 and compare them.
If we convert RGB24 to YUY2 using our not optimised csc function, we don't see any problem.
Can you check and confirm the problem?
0 Kudos
5 Replies
Andrey_B_Intel
Employee
528 Views
Hello Ilya.
Could you please be more specificand provide small C code example how you use RGBToYCrCb422 function? I'd likecompare your formulas with IPP's.
Thank for your message.
0 Kudos
Ilya_Zarezenko
Beginner
528 Views
Hi Andrey,
Thanks for your quick answer.
Please have a look at test application with IPP
It takes original picture http://dl.dropbox.com/u/10903775/Intel/TestImage.pngand displays the result of one conversion RGB to YUY2
As you can see, yellow colors are changed to orange in YUY2 picture (right side).
Also application does conversion RGB to YUY2 and back 100 times andcreates file in the app folder:
As you can see youl get absolutely distorted picture.
Could you check an IPP functionippiRGBToYCrCb422_8u_C3C2R and answer what is the problem: incorrect usage or bug in the function?
0 Kudos
Andrey_B_Intel
Employee
528 Views

Thanks for example.
The IPP function ippiRGBToYCrCb422_8u_C3C2R convert image from RGB to YCrCb using formulas

// Y = 0.257*R' + 0.504*G' + 0.098*B' + 16

// Cr = 0.439*R' - 0.368*G' - 0.071*B' + 128

// Cb = -0.148*R' - 0.291*G' + 0.439*B' + 128

IPP CC domain has many color conversion function. Look please at ippcc.h or to ippiman.pdf to make sure that you use correct function. May be you should use ippiRGBToYUV422

// Y' = 0.299*R' + 0.587*G' + 0.114*B'

// U = -0.147*R' - 0.289*G' + 0.436*B' = 0.492*(B' - Y' )

// V = 0.615*R' - 0.515*G' - 0.100*B' = 0.877*(R' - Y' )

0 Kudos
Sergey_P_Intel1
Employee
528 Views

I've studied your example, it's wrong.

1. Example used src image B0,G0,R0. B1,G1,R1 not R0,G0,B0. R1,G1,B1

2. Example wanted convert src image RGB to dst image YUY2

Actually you used convert RGB to UYVY (ippiRGBToYCrCb422_8u_C3C2R) and UYVY to RGB (ippiYCrCb422ToRGB_8u_C2C3R).

Use functions ippiBGRToYCbCr422_8u_C3C2R( BGR to YUY2) and ippiYCbCr422ToBGR_8u_C2C3R(YUY2 to BGR ) and everything will be ok.

0 Kudos
Ilya_Zarezenko
Beginner
528 Views
Andrey and Sergey, thanks for your replies, it helped us to solve the problem.
0 Kudos
Reply