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.

Color Space - YUV vs. YCbCr 16-235-240 vs. YCbCr 0-255

Other Parts Discussed in Thread: DM3730

This question could go in a couple places.  I'm using TI's JPEG and H.264 encoders on a DM3730, receiving video over the parallel interface of the ISP, using the CCDC module and Preview module.


The linux kernel driver sets the preview module's color space conversion as follows:

    {    /* CSC Coef Matrix */
        {66, 129, 25},
        {-38, -75, 112},
        {112, -94 , -18}
    },    /* CSC Offset */
    {0x0, 0x0, 0x0}

The coefficients correspond to ITU-R BT.601 defined YCbCr, but I would expect the offsets to be {16,128,128}.  When I set them to that, I get images saturated at nearly every pixel.  Are the 16,128,128 offsets performed in the module, and the offsets loaded into registers are additional offsets applied on top of the standard ones?  Does the default table above produce Y values in the range [16:235] and Cb/Cr values in the range [16:240], in the strictest sense of YCbCr? 


The H.264 and JPEG encoders both specify YUV as their input format.  A TI Processor Wiki page clears up that YUV is used loosely and technically refers to YCbCr.  http://processors.wiki.ti.com/index.php/Codec_FAQ#Is_the_video_codec_input_data_format_YUV_or_YCbCr.3F .  JFIF JPEG specifies that all 3 values Y,Cb,Cr should use the full range 0:255.  Does the JPEG encoder expect YCbCr 16-235-240, or 0-255.  If it expects 16-235-240, does it do the necessary conversion to 0-255 to comply with JFIF?

Which format does the H.264 encoder expect?


Thanks.

  • Hi Andrew,

    The H.264 encoder expects YCbCr 16-235-240 color data format (Y values in the range [16:235] and Cb/Cr values in the range [16:240]). This color conversion refers not only to the H.264 encoder but for whole video-processing back end.

    The CSC coef matrix seems correct but for the CSC offset if the RGB digital source includes footroom and headroom, the footroom offset 16 needs to be subtracted first from each signal.

    You can obtain more detailed description from the AM/DM37x Technical reference manual section 6.4.7 Camera ISP Video-Processing Back End at the link:

    http://www.ti.com/product/DM3730/technicaldocuments

    BR

    Tsvetolin Shulev