Hi.
In our system RGB input stream moves directly to LCD. Now we want to encode this rgb stream to H264 and sometime later decode it to LCD. Finally we can do encode and decode. But the colors on LCD are not the same in two cases. I understand that the colors cannot be almost the same. But now the difference is too evident.
The first case:
RGB24 stream -> LCD
The second case:
RGB24 stream -> NV12 -> h264 encoder -> avi file -> h264 decoder -> LCD
Here are pipelines for encoder and decoder:
appsrc name=mysource block=true ! video/x-raw-yuv, width=1024 , height=768, format=(fourcc)NV12, framerate=(fraction)8/1 ! omx_h264enc level=level-32 i-period=8 ! video/x-h264 ! avimux ! gstperf ! filesink sync=false location=%s
gst-launch -v filesrc location=___5M.avi ! avidemux ! 'video/x-h264' ! h264parse access-unit=true ! omx_h264dec ! omx_scaler ! gstperf ! v4l2sink device=/dev/video2
I guess there is something wrong with conversion from rgb to YCrCb. I have tried to use several standards, but with no luck.
Here is how i convert it now.
Y = 0.299f * r + 0.587f * g + 0.114f * b;
Cb = -0.14713f * r - 0.28886f * g + 0.436f * b + 128;
Cr = 0.615f * r - 0.51499f * g - 0.10001f * b + 128;
What is the correct formula to prepare images for the h264 encoder in dm8148?
Best regards,
Alexander Vasiljev.