Skip to content

Implement RGB to YCgCo-R #1572

Open
Open

Description

@farindk

We miss the RGB to YCbCr conversion for YCgCo(-R). This is matrix_coefficients=8.

While we are at it, we could also add support for matrix_coefficients=16 and 17 (YCgCo-Re / YCgCo-Ro) which were recently added to H.273 (https://www.itu.int/ITU-T/workprog/wp_item.aspx?isn=18689).

Activity

  1. novomesk commented on Dec 24, 2025

    @novomesk

    I have AVIF with matrix_coefficients=16

    http://188.121.162.14/zoo.avif

    heif-dec gives following output:

    Image

    output of avifdec:

    Image

  2. farindk commented on Dec 26, 2025

    @farindk
    MemberAuthor

    The above is a first, quick implementation of YCgCo-Re (matrix_coefficients=16). It is probably still incomplete, but works for the example image. A better implementation is still future work.

  3. farindk commented on Dec 26, 2025

    @farindk
    MemberAuthor

    Note: the example image's pixi box says that the image has 10 bits per pixel:

    | | | Box: pixi ----- (Pixel Information)
    | | | size: 16   (header size: 12)
    | | | bits_per_channel: 10,10,10
    

    This is the internal YCgCo-Re space. The desired output RGB depth is 8 bits per pixel. How can we communicate this cleanly through the API?

  4. novomesk commented on Dec 26, 2025

    @novomesk

    I understand it this way:

    The -RE indicate that "even" (2) bits were added to intended bit depth,
    so 10-2=8 is desired RGB depth for the output.

  5. farindk commented on Dec 26, 2025

    @farindk
    MemberAuthor

    I understand it this way:

    The -RE indicate that "even" (2) bits were added to intended bit depth, so 10-2=8 is desired RGB depth for the output.

    Yes, correct. My problem is that the color-conversion function where I added it, must have the same output bpp as the input. And the whole conversion pipeline does not expect that it is desired to have less bits in the output than in the input. This needs more work. But at least, we get a usable picture now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions