From 66070626481bb7e55bef45f473c3a6adba920ca4 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 8 Jan 2023 08:04:07 -0600 Subject: [PATCH] Fix divisor for YUV range (#728) --- src/video.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/video.cpp b/src/video.cpp index 7392fafc..1fd50e7e 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -1972,11 +1972,11 @@ color_t make_color_matrix(float Cr, float Cb, const float2 &range_Y, const float float Cr_i = 1.0f - Cr; float Cb_i = 1.0f - Cb; - float shift_y = range_Y[0] / 256.0f; - float shift_uv = range_UV[0] / 256.0f; + float shift_y = range_Y[0] / 255.0f; + float shift_uv = range_UV[0] / 255.0f; - float scale_y = (range_Y[1] - range_Y[0]) / 256.0f; - float scale_uv = (range_UV[1] - range_UV[0]) / 256.0f; + float scale_y = (range_Y[1] - range_Y[0]) / 255.0f; + float scale_uv = (range_UV[1] - range_UV[0]) / 255.0f; return { { Cr, Cg, Cb, 0.0f }, { -(Cr * 0.5f / Cb_i), -(Cg * 0.5f / Cb_i), 0.5f, 0.5f },