Lines Matching +full:full +full:- +full:scale
1 // SPDX-License-Identifier: GPL-2.0+
11 #include "ipu-prv.h"
25 .scale = 2,
29 * RGB full-range to RGB limited-range
42 .scale = 1,
46 * RGB limited-range to RGB full-range
48 * R_full = 1.1644 * (R_lim - 16)
49 * G_full = 1.1644 * (G_lim - 16)
50 * B_full = 1.1644 * (B_lim - 16)
58 .offset = { -37, -37, -37, },
59 .scale = 2,
63 * YUV full-range to YUV limited-range
66 * Cb_lim = 0.8784 * (Cb_full - 128) + 128
67 * Cr_lim = 0.8784 * (Cr_full - 128) + 128
76 .scale = 1,
81 * YUV limited-range to YUV full-range
83 * Y_full = 1.1644 * (Y_lim - 16)
84 * Cb_full = 1.1384 * (Cb_lim - 128) + 128
85 * Cr_full = 1.1384 * (Cr_lim - 128) + 128
93 .offset = { -37, -35, -35, },
94 .scale = 2,
112 * BT.601 RGB full-range to YUV full-range
115 * U = -.1687 * R - .3313 * G + .5000 * B + 128
116 * V = .5000 * R - .4187 * G - .0813 * B + 128
121 { -43, -85, 128, },
122 { 128, -107, -21, },
125 .scale = 1,
128 /* BT.601 RGB full-range to YUV limited-range */
132 { -38, -74, 112, },
133 { 112, -94, -18, },
136 .scale = 1,
140 /* BT.601 RGB limited-range to YUV full-range */
144 { -50, -99, 149, },
145 { 149, -125, -24, },
147 .offset = { -75, 512, 512, },
148 .scale = 1,
151 /* BT.601 RGB limited-range to YUV limited-range */
155 { -44, -87, 131, },
156 { 131, -110, -21, },
159 .scale = 1,
164 * BT.601 YUV full-range to RGB full-range
166 * R = 1. * Y + 0 * (Cb - 128) + 1.4020 * (Cr - 128)
167 * G = 1. * Y - .3441 * (Cb - 128) - .7141 * (Cr - 128)
168 * B = 1. * Y + 1.7720 * (Cb - 128) + 0 * (Cr - 128)
172 * R = 1. * Y + 0 * Cb + 1.4020 * Cr - 179.456
173 * G = 1. * Y - .3441 * Cb - .7141 * Cr + 135.450
174 * B = 1. * Y + 1.7720 * Cb + 0 * Cr - 226.816
179 { 128, -44, -91, },
182 .offset = { -359, 271, -454, },
183 .scale = 2,
186 /* BT.601 YUV full-range to RGB limited-range */
190 { 110, -38, -78, },
193 .offset = { -276, 265, -358, },
194 .scale = 2,
197 /* BT.601 YUV limited-range to RGB full-range */
201 { 75, -25, -52, },
204 .offset = { -223, 136, -277, },
205 .scale = 3,
208 /* BT.601 YUV limited-range to RGB limited-range */
212 { 128, -43, -89, },
215 .offset = { -351, 265, -443, },
216 .scale = 2,
234 * REC.709 encoding from RGB full range to YUV full range:
237 * U = -.1146 * R - .3854 * G + .5000 * B + 128
238 * V = .5000 * R - .4542 * G - .0458 * B + 128
243 { -29, -99, 128 },
244 { 128, -116, -12 },
247 .scale = 1,
250 /* Rec.709 RGB full-range to YUV limited-range */
254 { -26, -87, 112, },
255 { 112, -102, -10, },
258 .scale = 1,
262 /* Rec.709 RGB limited-range to YUV full-range */
266 { -34, -115, 149, },
267 { 149, -135, -14, },
269 .offset = { -75, 512, 512, },
270 .scale = 1,
273 /* Rec.709 RGB limited-range to YUV limited-range */
277 { -30, -101, 131, },
278 { 131, -119, -12, },
281 .scale = 1,
286 * Inverse REC.709 encoding from YUV full range to RGB full range:
288 * R = 1. * Y + 0 * (Cb - 128) + 1.5748 * (Cr - 128)
289 * G = 1. * Y - .1873 * (Cb - 128) - .4681 * (Cr - 128)
290 * B = 1. * Y + 1.8556 * (Cb - 128) + 0 * (Cr - 128)
294 * R = 1. * Y + 0 * Cb + 1.5748 * Cr - 201.574
295 * G = 1. * Y - .1873 * Cb - .4681 * Cr + 83.891
296 * B = 1. * Y + 1.8556 * Cb + 0 * Cr - 237.517
301 { 128, -24, -60 },
304 .offset = { -403, 168, -475 },
305 .scale = 2,
308 /* Rec.709 YUV full-range to RGB limited-range */
312 { 110, -21, -51, },
315 .offset = { -314, 176, -376, },
316 .scale = 2,
319 /* Rec.709 YUV limited-range to RGB full-range */
323 { 75, -14, -34, },
326 .offset = { -248, 77, -289, },
327 .scale = 3,
330 /* Rec.709 YUV limited-range to RGB limited-range */
334 { 128, -23, -59, },
337 .offset = { -394, 164, -464, },
338 .scale = 2,
360 tbl_idx = (QUANT_MAP(csc->in_cs.quant) << 1) | in calc_csc_coeffs()
361 QUANT_MAP(csc->out_cs.quant); in calc_csc_coeffs()
363 if (csc->in_cs.cs == csc->out_cs.cs) { in calc_csc_coeffs()
364 csc->params = (csc->in_cs.cs == IPUV3_COLORSPACE_YUV) ? in calc_csc_coeffs()
370 /* YUV <-> RGB encoding is required */ in calc_csc_coeffs()
372 switch (csc->out_cs.enc) { in calc_csc_coeffs()
374 params_tbl = (csc->in_cs.cs == IPUV3_COLORSPACE_YUV) ? in calc_csc_coeffs()
378 params_tbl = (csc->in_cs.cs == IPUV3_COLORSPACE_YUV) ? in calc_csc_coeffs()
382 return -ENOTSUPP; in calc_csc_coeffs()
385 csc->params = *params_tbl[tbl_idx]; in calc_csc_coeffs()
404 ipu_ic_fill_colorspace(&csc->in_cs, in_enc, in_quant, in_cs); in ipu_ic_calc_csc()
405 ipu_ic_fill_colorspace(&csc->out_cs, out_enc, out_quant, out_cs); in ipu_ic_calc_csc()