*/}}
Browse Source

srgb clay conversion

YimingWu 1 year ago
parent
commit
2a104dcdaf
2 changed files with 10 additions and 0 deletions
  1. 2 0
      la_tns.h
  2. 8 0
      la_tns_kernel.c

+ 2 - 0
la_tns.h

@@ -1386,6 +1386,8 @@ void tnssRGB2XYZ(tnsVector3d rgb,tnsVector3d xyz);
 void tnsClay2XYZ(tnsVector3d rgb,tnsVector3d xyz);
 void tnsXYZ2sRGB(tnsVector3d xyz,tnsVector3d rgb);
 void tnsXYZ2Clay(tnsVector3d xyz,tnsVector3d rgb);
+void tnsRGB2Clay(tnsVector3d rgb, tnsVector3d clay);
+void tnsClay2RGB(tnsVector3d clay, tnsVector3d rgb);
 
 void tns2LogsRGBSingle(real* a);
 void tns2LinearsRGBSingle(real* a);

+ 8 - 0
la_tns_kernel.c

@@ -3828,6 +3828,14 @@ void tnsXYZ2Clay(tnsVector3d xyz,tnsVector3d rgb){
                       0.0134474,-0.1183897,1.0154096,0,0,0,0,0};
     tnsApplyRotation33d(rgb,mat,xyz);
 }
+void tnsRGB2Clay(tnsVector3d rgb, tnsVector3d clay){
+    tnsVector3d xyz; tnssRGB2XYZ(rgb,xyz);
+    tnsXYZ2Clay(xyz,clay);
+}
+void tnsClay2RGB(tnsVector3d clay, tnsVector3d rgb){
+    tnsVector3d xyz; tnsClay2XYZ(clay,xyz);
+    tnsXYZ2sRGB(xyz,rgb);
+}
 
 static real _srgb_transfer_function(real a){
 	return .0031308f >= a ? 12.92f * a : 1.055f * powf(a, .4166666666666667f) - .055f;