mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-20 18:19:42 +07:00
drm/sun4i: Move the BT.601 CSC coefficients to the frontend
Both the backend and the frontend need the BT.601 CSC coefficients for YUV to RGB conversion. Since the backend has a dependency on the frontend (and not the other way round), move the coefficients there so that both can access them without having to duplicate them. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190118145133.21281-7-paul.kocialkowski@bootlin.com
This commit is contained in:
parent
1b89dba5f7
commit
e6ae40bd94
@ -45,28 +45,6 @@ static const u32 sunxi_rgb2yuv_coef[12] = {
|
||||
0x000001c1, 0x00003e88, 0x00003fb8, 0x00000808
|
||||
};
|
||||
|
||||
/*
|
||||
* These coefficients are taken from the A33 BSP from Allwinner.
|
||||
*
|
||||
* The first three values of each row are coded as 13-bit signed fixed-point
|
||||
* numbers, with 10 bits for the fractional part. The fourth value is a
|
||||
* constant coded as a 14-bit signed fixed-point number with 4 bits for the
|
||||
* fractional part.
|
||||
*
|
||||
* The values in table order give the following colorspace translation:
|
||||
* G = 1.164 * Y - 0.391 * U - 0.813 * V + 135
|
||||
* R = 1.164 * Y + 1.596 * V - 222
|
||||
* B = 1.164 * Y + 2.018 * U + 276
|
||||
*
|
||||
* This seems to be a conversion from Y[16:235] UV[16:240] to RGB[0:255],
|
||||
* following the BT601 spec.
|
||||
*/
|
||||
static const u32 sunxi_bt601_yuv2rgb_coef[12] = {
|
||||
0x000004a7, 0x00001e6f, 0x00001cbf, 0x00000877,
|
||||
0x000004a7, 0x00000000, 0x00000662, 0x00003211,
|
||||
0x000004a7, 0x00000812, 0x00000000, 0x00002eb1,
|
||||
};
|
||||
|
||||
static void sun4i_backend_apply_color_correction(struct sunxi_engine *engine)
|
||||
{
|
||||
int i;
|
||||
|
@ -48,6 +48,29 @@ static const u32 sun4i_frontend_horz_coef[64] = {
|
||||
0x03ff0000, 0x0000fd41, 0x01ff0000, 0x0000fe42,
|
||||
};
|
||||
|
||||
/*
|
||||
* These coefficients are taken from the A33 BSP from Allwinner.
|
||||
*
|
||||
* The first three values of each row are coded as 13-bit signed fixed-point
|
||||
* numbers, with 10 bits for the fractional part. The fourth value is a
|
||||
* constant coded as a 14-bit signed fixed-point number with 4 bits for the
|
||||
* fractional part.
|
||||
*
|
||||
* The values in table order give the following colorspace translation:
|
||||
* G = 1.164 * Y - 0.391 * U - 0.813 * V + 135
|
||||
* R = 1.164 * Y + 1.596 * V - 222
|
||||
* B = 1.164 * Y + 2.018 * U + 276
|
||||
*
|
||||
* This seems to be a conversion from Y[16:235] UV[16:240] to RGB[0:255],
|
||||
* following the BT601 spec.
|
||||
*/
|
||||
const u32 sunxi_bt601_yuv2rgb_coef[12] = {
|
||||
0x000004a7, 0x00001e6f, 0x00001cbf, 0x00000877,
|
||||
0x000004a7, 0x00000000, 0x00000662, 0x00003211,
|
||||
0x000004a7, 0x00000812, 0x00000000, 0x00002eb1,
|
||||
};
|
||||
EXPORT_SYMBOL(sunxi_bt601_yuv2rgb_coef);
|
||||
|
||||
static void sun4i_frontend_scaler_init(struct sun4i_frontend *frontend)
|
||||
{
|
||||
int i;
|
||||
|
@ -86,6 +86,7 @@ struct sun4i_frontend {
|
||||
};
|
||||
|
||||
extern const struct of_device_id sun4i_frontend_of_table[];
|
||||
extern const u32 sunxi_bt601_yuv2rgb_coef[12];
|
||||
|
||||
int sun4i_frontend_init(struct sun4i_frontend *frontend);
|
||||
void sun4i_frontend_exit(struct sun4i_frontend *frontend);
|
||||
|
Loading…
Reference in New Issue
Block a user