• Steve Longerbeam's avatar
    gpu: ipu-v3: ipu-ic: Fully describe colorspace conversions · f208b26e
    Steve Longerbeam authored
    Only providing the input and output RGB/YUV space to the IC task init
    functions is not sufficient. To fully characterize a colorspace
    conversion, the Y'CbCr encoding standard, and quantization also
    need to be specified.
    
    Define a 'struct ipu_ic_colorspace' that includes all the above.
    
    This allows to actually enforce the fact that the IC:
    
    - can only encode to/from YUV and RGB full range. A follow-up patch will
      remove this restriction.
    - can only encode using BT.601 standard. A follow-up patch will add
      Rec.709 encoding support.
    
    The determination of the CSC coefficients based on the input/output
    'struct ipu_ic_colorspace' are moved to a new exported function
    ipu_ic_calc_csc(), and 'struct ic_csc_params' is exported as
    'struct ipu_ic_csc_params'. ipu_ic_calc_csc() fills a 'struct ipu_ic_csc'
    with the input/output 'struct ipu_ic_colorspace' and the calculated
    'struct ic_csc_params' from those input/output colorspaces.
    
    The functions ipu_ic_task_init(_rsc)() now take a filled 'struct
    ipu_ic_csc'.
    
    The existing CSC coefficient tables and ipu_ic_calc_csc() are moved
    to a new module ipu-ic-csc.c. This is in preparation for adding more
    coefficient tables for limited range quantization and more encoding
    standards.
    
    The existing ycbcr2rgb and inverse rgb2ycbcr tables defined the BT.601
    Y'CbCr encoding coefficients. The rgb2ycbcr table specifically described
    the BT.601 encoding from full range RGB to full range YUV. Table
    comments have been added in ipu-ic-csc.c to make this more clear.
    
    The ycbcr2rgb inverse table described encoding YUV limited range to RGB
    full range. To be consistent with the rgb2ycbcr table, this table is
    converted to YUV full range to RGB full range, and the comments are
    expanded in ipu-ic-csc.c.
    
    The ic_csc_rgb2rgb table was just an identity matrix, so it is renamed
    'identity' in ipu-ic-csc.c.
    Signed-off-by: default avatarSteve Longerbeam <slongerbeam@gmail.com>
    [p.zabel@pengutronix.de: removed a superfluous blank line]
    Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
    f208b26e
imx-ipu-v3.h 16.5 KB