@@ -2231,7 +2231,7 @@ void process(dt_iop_module_t *self,
22312231 dt_aligned_pixel_t correction_ratios ;
22322232 _get_d65_correction_ratios (self , correction_ratios );
22332233
2234- if (find_temperature_from_as_shot_coeffs (& (self -> dev -> image_storage ), correction_ratios , & (x ), & (y )))
2234+ if (find_illuminant_xy_from_as_shot_coeffs (& (self -> dev -> image_storage ), correction_ratios , & (x ), & (y )))
22352235 {
22362236 // Convert illuminant from xyY to XYZ
22372237 dt_aligned_pixel_t XYZ ;
@@ -2244,9 +2244,11 @@ void process(dt_iop_module_t *self,
22442244 }
22452245 else if (data -> illuminant_type == DT_ILLUMINANT_FROM_WB )
22462246 {
2247+ // Same logic as above (we depend on the coefficients from white balance,
2248+ // which don't come from the EXIF this time).
22472249 float x , y ;
22482250
2249- if (find_temperature_from_wb_coeffs (& (self -> dev -> image_storage ), self -> dev -> chroma .wb_coeffs , & (x ), & (y )))
2251+ if (find_illuminant_xy_from_wb_coeffs (& (self -> dev -> image_storage ), self -> dev -> chroma .wb_coeffs , & (x ), & (y )))
22502252 {
22512253 // Convert illuminant from xyY to XYZ
22522254 dt_aligned_pixel_t XYZ ;
@@ -2357,7 +2359,7 @@ int process_cl(dt_iop_module_t *self,
23572359 dt_aligned_pixel_t correction_ratios ;
23582360 _get_d65_correction_ratios (self , correction_ratios );
23592361
2360- if (find_temperature_from_as_shot_coeffs (& (self -> dev -> image_storage ), correction_ratios , & (x ), & (y )))
2362+ if (find_illuminant_xy_from_as_shot_coeffs (& (self -> dev -> image_storage ), correction_ratios , & (x ), & (y )))
23612363 {
23622364 // Convert illuminant from xyY to XYZ
23632365 dt_aligned_pixel_t XYZ ;
@@ -2370,17 +2372,11 @@ int process_cl(dt_iop_module_t *self,
23702372 }
23712373 else if (d -> illuminant_type == DT_ILLUMINANT_FROM_WB )
23722374 {
2373- // The camera illuminant is a behaviour rather than a preset of
2374- // values: it uses whatever is in the RAW EXIF. But it depends on
2375- // what temperature.c is doing and needs to be updated
2376- // accordingly, to give a consistent result. We initialise the
2377- // CAT defaults using the temperature coeffs at startup, but if
2378- // temperature is changed later, we get no notification of the
2379- // change here, so we can't update the defaults. So we need to
2380- // re-run the detection at runtime…
2375+ // Same logic as above (we depend on the coefficients from white balance,
2376+ // which don't come from the EXIF this time).
23812377 float x , y ;
23822378
2383- if (find_temperature_from_wb_coeffs (& (self -> dev -> image_storage ), self -> dev -> chroma .wb_coeffs , & (x ), & (y )))
2379+ if (find_illuminant_xy_from_wb_coeffs (& (self -> dev -> image_storage ), self -> dev -> chroma .wb_coeffs , & (x ), & (y )))
23842380 {
23852381 // Convert illuminant from xyY to XYZ
23862382 dt_aligned_pixel_t XYZ ;
@@ -3107,7 +3103,7 @@ static void _preview_pipe_finished_callback(gpointer instance, dt_iop_module_t *
31073103 float x = p -> x ;
31083104 float y = p -> y ;
31093105
3110- if (find_temperature_from_wb_coeffs (& (self -> dev -> image_storage ), self -> dev -> chroma .wb_coeffs , & x , & y ))
3106+ if (find_illuminant_xy_from_wb_coeffs (& (self -> dev -> image_storage ), self -> dev -> chroma .wb_coeffs , & x , & y ))
31113107 {
31123108 p -> x = x ;
31133109 p -> y = y ;
@@ -3997,7 +3993,7 @@ void reload_defaults(dt_iop_module_t *self)
39973993 dt_aligned_pixel_t correction_ratios ;
39983994 if (!_get_d65_correction_ratios (self , correction_ratios ))
39993995 {
4000- if (find_temperature_from_as_shot_coeffs (img , correction_ratios , & (d -> x ), & (d -> y )))
3996+ if (find_illuminant_xy_from_as_shot_coeffs (img , correction_ratios , & (d -> x ), & (d -> y )))
40013997 d -> illuminant = DT_ILLUMINANT_CAMERA ;
40023998 _check_if_close_to_daylight (d -> x , d -> y ,
40033999 & (d -> temperature ), & (d -> illuminant ), & (d -> adaptation ));
@@ -4093,7 +4089,7 @@ void gui_changed(dt_iop_module_t *self,
40934089 // illuminant is changed.
40944090 dt_aligned_pixel_t correction_ratios ;
40954091 _get_d65_correction_ratios (self , correction_ratios );
4096- find_temperature_from_as_shot_coeffs (& (self -> dev -> image_storage ), correction_ratios ,
4092+ find_illuminant_xy_from_as_shot_coeffs (& (self -> dev -> image_storage ), correction_ratios ,
40974093 & (p -> x ), & (p -> y ));
40984094 _check_if_close_to_daylight (p -> x , p -> y , & (p -> temperature ), NULL , & (p -> adaptation ));
40994095 }
@@ -4103,7 +4099,7 @@ void gui_changed(dt_iop_module_t *self,
41034099 // (x, y) were computed at runtime from the WB module's coefficients
41044100 // and p->x, p->y may hold stale values. Recompute them now so
41054101 // the new illuminant mode starts from the correct chromaticity.
4106- find_temperature_from_wb_coeffs (& (self -> dev -> image_storage ), self -> dev -> chroma .wb_coeffs ,
4102+ find_illuminant_xy_from_wb_coeffs (& (self -> dev -> image_storage ), self -> dev -> chroma .wb_coeffs ,
41074103 & (p -> x ), & (p -> y ));
41084104 _check_if_close_to_daylight (p -> x , p -> y , & (p -> temperature ), NULL , & (p -> adaptation ));
41094105 }
@@ -4120,16 +4116,16 @@ void gui_changed(dt_iop_module_t *self,
41204116 // Get camera WB and update illuminant
41214117 dt_aligned_pixel_t correction_ratios ;
41224118 _get_d65_correction_ratios (self , correction_ratios );
4123- const gboolean found = find_temperature_from_as_shot_coeffs (& (self -> dev -> image_storage ),
4119+ const gboolean found = find_illuminant_xy_from_as_shot_coeffs (& (self -> dev -> image_storage ),
41244120 correction_ratios , & (p -> x ), & (p -> y ));
41254121 _check_if_close_to_daylight (p -> x , p -> y , & (p -> temperature ), NULL , & (p -> adaptation ));
41264122
41274123 if (found )
41284124 dt_control_log (_ ("white balance successfully extracted from raw image" ));
41294125 }
4130- if (p -> illuminant == DT_ILLUMINANT_FROM_WB )
4126+ else if (p -> illuminant == DT_ILLUMINANT_FROM_WB )
41314127 {
4132- const gboolean found = find_temperature_from_wb_coeffs (& (self -> dev -> image_storage ),
4128+ const gboolean found = find_illuminant_xy_from_wb_coeffs (& (self -> dev -> image_storage ),
41334129 self -> dev -> chroma .wb_coeffs , & (p -> x ), & (p -> y ));
41344130 _check_if_close_to_daylight (p -> x , p -> y , & (p -> temperature ), NULL , & (p -> adaptation ));
41354131
0 commit comments