*/}}
浏览代码

yuv correction

YimingWu 4 月之前
父节点
当前提交
d614330145
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      la_tns_kernel.c

+ 5 - 3
la_tns_kernel.c

@@ -4944,9 +4944,11 @@ void tnsHSL2RGB(real *hsl, real *rgb) {
   }
 }
 void tnsYUV2RGB(real* yuv,real* rgb){
-    rgb[0] = (yuv[0] + 1.28033 * yuv[2]) * 0.2126;
-    rgb[1] = (yuv[0] - 0.21482 * yuv[1] - 0.38059 * yuv[2]) * 0.7152;
-    rgb[2] = (yuv[0] + 2.12798 * yuv[1]) * 0.0722;
+    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]);
 }
 
 void tnsClearAll(){