*/}}
YimingWu 4 kuukautta sitten
vanhempi
commit
b8a0ddb374
2 muutettua tiedostoa jossa 7 lisäystä ja 6 poistoa
  1. 4 3
      la_tns_kernel.c
  2. 3 3
      resources/la_tns_shaders.cpp

+ 4 - 3
la_tns_kernel.c

@@ -4950,12 +4950,13 @@ void tnsHSL2RGB(real *hsl, real *rgb) {
     rgb[2] = hue2rgb(p, q, hsl[0] - 1./3);
   }
 }
+// https://web.archive.org/web/20180423091842/http://www.equasys.de/colorconversion.html
 void tnsYUV2RGB(real* yuv,real* rgb){
     yuv[0]=1.1643*(yuv[0]-0.0625);
     yuv[1]-=0.5; yuv[2]-=0.5;
-    rgb[0] = (yuv[0] + 1.28033 * yuv[2]);
-    rgb[1] = (yuv[0] - 0.21482 * yuv[1] - 0.38059 * yuv[2]);
-    rgb[2] = (yuv[0] + 2.12798 * yuv[1]);
+    rgb[0] = (yuv[0] + 1.793 * yuv[2]);
+    rgb[1] = (yuv[0] - 0.213 * yuv[1] - 0.533 * yuv[2]);
+    rgb[2] = (yuv[0] + 2.112 * yuv[1]);
 }
 
 void tnsClearAll(){

+ 3 - 3
resources/la_tns_shaders.cpp

@@ -534,9 +534,9 @@ vec3 YUV2sRGB(vec3 yuv){
     yuv[0]=1.1643*(yuv[0]-0.0625);
     yuv[1]-=0.5; yuv[2]-=0.5;
 	vec3 rgb;
-    rgb[0] = (yuv[0] + 1.28033 * yuv[2]);
-    rgb[1] = (yuv[0] - 0.21482 * yuv[1] - 0.38059 * yuv[2]);
-    rgb[2] = (yuv[0] + 2.12798 * yuv[1]);
+    rgb[0] = (yuv[0] + 1.793 * yuv[2]);
+    rgb[1] = (yuv[0] - 0.213 * yuv[1] - 0.533 * yuv[2]);
+    rgb[2] = (yuv[0] + 2.112 * yuv[1]);
 	return rgb;
 }