diff --git a/src/color.h b/src/color.h index 7d0fce907..c875777de 100644 --- a/src/color.h +++ b/src/color.h @@ -71,6 +71,35 @@ static const comp_type_t cr_b = (-0.0722/1.5748*224/255) * (1< #include +#include "color.h" #include "host.h" #include "hwaccel_vdpau.h" #include "hwaccel_rpi4.h" @@ -83,51 +84,6 @@ #pragma GCC diagnostic ignored "-Wunknown-pragmas" #pragma clang diagnostic warning "-Wpass-failed" -// -// uv_to_av_convert conversions -// -// -/* @brief Color space coedfficients - RGB full range to YCbCr bt. 709 limited range - * - * RGB should use SDI full range [1<<(depth-8)..255<<(depth-8)-1], see [limits] - * - * Scaled by 1<= COMP_BASE + 18, "comp_type_t not wide enough (we are computing in up to 16 bits!)"); - -// matrix Y1^-1 = inv(Y) -static const comp_type_t y_scale = 1.164383 * (1< #include +#include "color.h" #include "debug.h" #include "gl_context.h" #include "host.h" @@ -136,10 +137,9 @@ uniform float imageWidthOrig; const vec3 yuvOffset = vec3(-0.0625, -0.5, -0.5); // RGB coefficients -// BT.601 colorspace -const vec3 Rcoeff = vec3(1.1643, 0.000, 1.5958); -const vec3 Gcoeff = vec3(1.1643, -0.39173, -0.81290); -const vec3 Bcoeff = vec3(1.1643, 2.017, 0.000); +const vec3 Rcoeff = vec3()raw" TOSTRING(Y_709) ", " TOSTRING(R_CB_709) ", " TOSTRING(R_CR_709) R"raw(); +const vec3 Gcoeff = vec3()raw" TOSTRING(Y_709) ", " TOSTRING(G_CB_709) ", " TOSTRING(G_CR_709) R"raw(); +const vec3 Bcoeff = vec3()raw" TOSTRING(Y_709) ", " TOSTRING(B_CB_709) ", " TOSTRING(B_CR_709) R"raw(); // U Y V A | Y U Y A | V Y U A | Y V Y A