This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM36x JPEG YUV Range

Other Parts Discussed in Thread: TVP70025I

Hello TI Experts,

I have a system using a DM368, with video capture coming from a YUV source (component input attached to a TVP70025i).  I am using the resizer to convert this input into YUV420SP, as required by the H.264 codec.

However, I am also running the JPEG codec on the same input frames, and I am seeing that the resulting JPEG image is a bit "washed out".  I believe this is because the source imagery is using 16 for the black level and 235/240 for the white level, as is normal for YUV.  The JPEG encoder then does not convert this imagery into the range 0-255 used by standard JPEG decoders, so when the image is decoded, the black and white levels are not correct.

Is this the expected behavior for the JPEG codec on the DM36x platform?  I will not be able to conver the YUV ranges in the application code, due to the amount of processing involved, and I cannot see any way to indicate to the codec that the source YUV data is in the range 16-235/240.

Please let me know if there is any codec flag I am missing or if there is simply nothing to be done about this issue.

Thank you for your time,

Chris Richardson

  • Hi,

    I have seen such phenomenon before. And it is not due to JPEGenc, but the PC h264/jpeg decoder.

    The problem is due to the h264 decoder and jpeg decoder you used using differet YUV to RGB covert matrix.

    If you uses tool to decode the JPEG fie to YUV and decode the h264 stream to YUV, then use same YUV player to open them and compare, you will find they are almost same.

  • Hi Chris,

    Thanks for the reply!  I think you are correct in that the YUV data for both will be the same.  The difference is that the H.264 encoder has a parameter in the VUI buffer (pixelRange) to specify what the color range is, while the JPEG encoder lacks such a parameter as far as I can tell.

    There are two different cases I am actually looking at:

    1. Browser based decode of normal/full JPEG images.  All browsers that I tested (IE, Chrome, Firefox) show the washed out image.

    2. FFMPEG based decode of an MJPEG stream in our own application.  This also shows the washed out image, but FFMPEG allows me to override the desired YUV range by inserting a special comment into the JPEG image.  Unfortunately this will not apply to third party video streaming applications.

    I do not know of a standards compliant way to indicate the YUV range inside the JPEG data, so I am hoping there is a way to tell the JPEG codec what YUV range the source data is using.

    Thanks,

    Chris Richardson