Wrong colors when decoding h264

Wrong colors when decoding h264

Hello.

I am using IPP 6.1.1.0.35 and IPP samples 6.1.5.060.

When I decode a h264 stream from a Sony SNC-CH140 IP camera, it sometimes gets decoded with the wrong colors when the video stream has 320x240 resolution. This does not happen if the resolution is 640x480. See the attached screenshots to see what i mean by "wrong".

I am decoding to RGB24.

I have tested the following:

Starts up our user interface application, and starts live view. The colors sometimes get correct the first time live view is started after starting the application, and sometimes get the wrong colors. But every successive time live video is stopped and started again after the first time, the colors always get wrong. If i exit and start up the app again, the same scenario happens (1st time live is started colors is correct, but all other gets wrong colors).

I have saved the video stream to a file on disk, and have tested decoding it using the umc_h264_dec_con sample (specifying it to decode to RGB24), and the colors get correct. I have also tested having our user interface app decode from this file instead of retrieving from camera, and the colors gets wrong.

I have created a wrapper class for decoding h264 that is based on the umc_h264_dec_con example. This wrapper class is used in my user iterface app. I can't seem to find any difference between my code and the example code in regards to what it does, so i'm not sure where the problem is, maybe something wrong in my code, something wrong in the stream, or something else.

I have attached screenshots of the correct and wrong colors, and a file containing a video stream of 320x240 resolution from the camera. And I have attached the .cpp and .h files to my wrapper class.

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Have anyone experienced something like this, or have a solution?

I have done some more testing, and have found a solution.

When testing i noticed that the images that had the wrong colors got shifted a few pixels to the right (4 pixels maybe?) relative to the images with the correct colors. So I thought it might have something to do with byte-alignment.

The sample code for decoding h264 had this call that set alignment to 16:

out->SetAlignment(16)

So when I changed it to out->SetAlignment(1), I always got correct colors.

Don't know why this solved the problem though...

Leave a Comment

Please sign in to add a comment. Not a member? Join today