Parcourir la source

Fin debuggage des traitements. Rste un bug sur colorEditor

Rémi Synave il y a 2 ans
Parent
commit
20880bfdee
2 fichiers modifiés avec 14 ajouts et 12 suppressions
  1. 6 4
      HDRip/ImageHDR.cpp
  2. 8 8
      HDRip/all_processings.cpp

+ 6 - 4
HDRip/ImageHDR.cpp

@@ -645,10 +645,11 @@ void ImageHDR::saturation(float s)
 
 
   delete[](data);
-  data = dataLab;
+  data = Conversion::LCH_to_sRGB(dataLab, width * height);
+  delete[](dataLab);
 
   linear = false;
-  colorspace = Colorspace::LCH;
+  colorspace = Colorspace::RGB;
 }
 
 #else
@@ -678,10 +679,11 @@ void ImageHDR::saturation(float s)
   }
 
   delete[](data);
-  data = dataLab;
+  data = Conversion::LCH_to_sRGB(dataLab, width * height);
+  delete[](dataLab);
 
   linear = false;
-  colorspace = Colorspace::LCH;
+  colorspace = Colorspace::RGB;
 }
 
 #endif

+ 8 - 8
HDRip/all_processings.cpp

@@ -107,15 +107,9 @@ float* saturation(float* data, unsigned int width, unsigned int height, float sa
 
   img.saturation(saturation);
 
-  float* dataRGB = Conversion::LCH_to_sRGB(img.data, width * height);
-  free(img.data);
-  img.data = dataRGB;
-
   img.non_linear_to_linear();
   img.linear=true;
 
-  //img.display_debug();
-
   float* ret = new float[width * height * 3];
   memcpy(ret, img.data, width * height * 3 * sizeof(float));
 
@@ -167,11 +161,11 @@ float* full_process(float* data, unsigned int width, unsigned int height,
   // ******************************************
   img.lightnessMask(lms, lmb, lmm, lmw, lmh);
   // ******************************************
-
+  
   // ******************************************
   img.saturation(saturation);
   // ******************************************
-
+  
   // ******************************************
   float sel_light[2] = {ce_sel_light_l, ce_sel_light_h};
   float sel_chr[2] = {ce_sel_chr_l, ce_sel_chr_h};
@@ -180,6 +174,12 @@ float* full_process(float* data, unsigned int width, unsigned int height,
   img.colorEditor(sel_light, sel_chr, sel_hue, ce_tol, ce_edit_hue, ce_edit_expo, ce_edit_con, ce_edit_sat, ce_mask);
   // ******************************************
 
+
+  if(img.linear==false){
+    img.non_linear_to_linear();
+    img.linear=true;
+  }
+
   float *ret = new float[width*height*3];
   memcpy(ret, img.data, width * height * 3 * sizeof(float));