mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-17 17:50:29 +01:00
nir/lower_tex: Fix minor error in YUV color conversion matrix
The matrix used for YCbCr to RGB is listed in:
https://en.wikipedia.org/wiki/YCbCr
There was an error in converting the offsets from integers to unorm
values: 0.0625=16/256 should be 16.0/255,and 0.5=128.0/256 should be
128.0/255. With this fix, the CSC result is bit aligned with wikipedia's
conversion result and FFMPeg's result.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100854
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
(cherry picked from commit a6fb943f3e)
This commit is contained in:
parent
d9164fd427
commit
dd10f220cf
1 changed files with 3 additions and 3 deletions
|
|
@ -243,9 +243,9 @@ convert_yuv_to_rgb(nir_builder *b, nir_tex_instr *tex,
|
|||
nir_ssa_def *yuv =
|
||||
nir_vec4(b,
|
||||
nir_fmul(b, nir_imm_float(b, 1.16438356f),
|
||||
nir_fadd(b, y, nir_imm_float(b, -0.0625f))),
|
||||
nir_channel(b, nir_fadd(b, u, nir_imm_float(b, -0.5f)), 0),
|
||||
nir_channel(b, nir_fadd(b, v, nir_imm_float(b, -0.5f)), 0),
|
||||
nir_fadd(b, y, nir_imm_float(b, -16.0f / 255.0f))),
|
||||
nir_channel(b, nir_fadd(b, u, nir_imm_float(b, -128.0f / 255.0f)), 0),
|
||||
nir_channel(b, nir_fadd(b, v, nir_imm_float(b, -128.0f / 255.0f)), 0),
|
||||
nir_imm_float(b, 0.0));
|
||||
|
||||
nir_ssa_def *red = nir_fdot4(b, yuv, nir_build_imm(b, 4, 32, m[0]));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue