Message ID | 20240306-louis-vkms-conv-v1-2-5bfe7d129fdd@riseup.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Additions to "Reimplement line-per-line pixel conversion for plane reading" series | expand |
On 03/06, Arthur Grillo wrote: Hi, can you describe better the scope of your changes? Limiting the scope in the commit message and also describing in the body a summary of what you are documenting and reasons. Thanks, Melissa > Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net> > --- > drivers/gpu/drm/vkms/vkms_formats.c | 47 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 47 insertions(+) > > diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c > index 44d9b9b3bdc3..55ed3f598bd7 100644 > --- a/drivers/gpu/drm/vkms/vkms_formats.c > +++ b/drivers/gpu/drm/vkms/vkms_formats.c > @@ -577,6 +577,18 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding, > }, > .y_offset = 0, > }; > + > + /* > + * Those matrixies were generated using the colour python framework > + * > + * Below are the function calls used to generate eac matrix, go to > + * https://colour.readthedocs.io/en/develop/generated/colour.matrix_YCbCr.html > + * for more info: > + * > + * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.601"], > + * is_legal = False, > + * bits = 8) * 2**32).astype(int) > + */ > static struct conversion_matrix yuv_bt601_full = { > .matrix = { > { 4294967296, 0, 6021544149 }, > @@ -585,6 +597,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding, > }, > .y_offset = 0, > }; > + > + /* > + * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.601"], > + * is_legal = True, > + * bits = 8) * 2**32).astype(int) > + */ > static struct conversion_matrix yuv_bt601_limited = { > .matrix = { > { 5020601039, 0, 6881764740 }, > @@ -593,6 +611,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding, > }, > .y_offset = 16, > }; > + > + /* > + * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.709"], > + * is_legal = False, > + * bits = 8) * 2**32).astype(int) > + */ > static struct conversion_matrix yuv_bt709_full = { > .matrix = { > { 4294967296, 0, 6763714498 }, > @@ -601,6 +625,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding, > }, > .y_offset = 0, > }; > + > + /* > + * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.709"], > + * is_legal = True, > + * bits = 8) * 2**32).astype(int) > + */ > static struct conversion_matrix yuv_bt709_limited = { > .matrix = { > { 5020601039, 0, 7729959424 }, > @@ -609,6 +639,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding, > }, > .y_offset = 16, > }; > + > + /* > + * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.2020"], > + * is_legal = False, > + * bits = 8) * 2**32).astype(int) > + */ > static struct conversion_matrix yuv_bt2020_full = { > .matrix = { > { 4294967296, 0, 6333358775 }, > @@ -617,6 +653,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding, > }, > .y_offset = 0, > }; > + > + /* > + * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.2020"], > + * is_legal = True, > + * bits = 8) * 2**32).astype(int) > + */ > static struct conversion_matrix yuv_bt2020_limited = { > .matrix = { > { 5020601039, 0, 7238124312 }, > @@ -625,6 +667,11 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding, > }, > .y_offset = 16, > }; > + > + /* > + * The next matrices are just the previous ones, but with the first and > + * second columns swapped > + */ > static struct conversion_matrix yvu_bt601_full = { > .matrix = { > { 4294967296, 6021544149, 0 }, > > -- > 2.43.0 >
diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c index 44d9b9b3bdc3..55ed3f598bd7 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -577,6 +577,18 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding, }, .y_offset = 0, }; + + /* + * Those matrixies were generated using the colour python framework + * + * Below are the function calls used to generate eac matrix, go to + * https://colour.readthedocs.io/en/develop/generated/colour.matrix_YCbCr.html + * for more info: + * + * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.601"], + * is_legal = False, + * bits = 8) * 2**32).astype(int) + */ static struct conversion_matrix yuv_bt601_full = { .matrix = { { 4294967296, 0, 6021544149 }, @@ -585,6 +597,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding, }, .y_offset = 0, }; + + /* + * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.601"], + * is_legal = True, + * bits = 8) * 2**32).astype(int) + */ static struct conversion_matrix yuv_bt601_limited = { .matrix = { { 5020601039, 0, 6881764740 }, @@ -593,6 +611,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding, }, .y_offset = 16, }; + + /* + * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.709"], + * is_legal = False, + * bits = 8) * 2**32).astype(int) + */ static struct conversion_matrix yuv_bt709_full = { .matrix = { { 4294967296, 0, 6763714498 }, @@ -601,6 +625,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding, }, .y_offset = 0, }; + + /* + * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.709"], + * is_legal = True, + * bits = 8) * 2**32).astype(int) + */ static struct conversion_matrix yuv_bt709_limited = { .matrix = { { 5020601039, 0, 7729959424 }, @@ -609,6 +639,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding, }, .y_offset = 16, }; + + /* + * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.2020"], + * is_legal = False, + * bits = 8) * 2**32).astype(int) + */ static struct conversion_matrix yuv_bt2020_full = { .matrix = { { 4294967296, 0, 6333358775 }, @@ -617,6 +653,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding, }, .y_offset = 0, }; + + /* + * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.2020"], + * is_legal = True, + * bits = 8) * 2**32).astype(int) + */ static struct conversion_matrix yuv_bt2020_limited = { .matrix = { { 5020601039, 0, 7238124312 }, @@ -625,6 +667,11 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding, }, .y_offset = 16, }; + + /* + * The next matrices are just the previous ones, but with the first and + * second columns swapped + */ static struct conversion_matrix yvu_bt601_full = { .matrix = { { 4294967296, 6021544149, 0 },
Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net> --- drivers/gpu/drm/vkms/vkms_formats.c | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)