Skip to content

image/color.NYCbCrA.RGBA(): possible loss of information (Go 1.6) #13706

Closed
@pierrre

Description

@pierrre

image/color.YCbCr.RGBA() uses a custom code for the conversion YCbCr to RGB, and doesn't use YCbCrToRGB().
The comment in the method says:

    // This code is a copy of the YCbCrToRGB function above, except that it
    // returns values in the range [0, 0xffff] instead of [0, 0xff]. There is a
    // subtle difference between doing this and having YCbCr satisfy the Color
    // interface by first converting to an RGBA. The latter loses some
    // information by going to and from 8 bits per channel.

Go 1.6 adds a new image|color type: NYCbCrA.
But image/color.NYCbCrA.RGBA() calls YCbCrToRGB().
YCbCrToRGB() returns 8 bits per channel, I think there is a loss of information here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions