2525
2626const dt_noiseprofile_t dt_noiseprofile_generic = {N_ ("generic poissonian" ), "" , "" , 0 , {0.0001f , 0.0001f , 0.0001 }, {0.0f , 0.0f , 0.0f }};
2727
28- static gboolean dt_noiseprofile_verify (JsonParser * parser );
28+ static gboolean _noiseprofile_verify (JsonParser * parser );
2929
3030JsonParser * dt_noiseprofile_init (const char * alternative )
3131{
@@ -42,8 +42,11 @@ JsonParser *dt_noiseprofile_init(const char *alternative)
4242 else
4343 g_strlcpy (filename , alternative , sizeof (filename ));
4444
45- dt_print (DT_DEBUG_CONTROL , "[noiseprofile] loading noiseprofiles from `%s'" , filename );
46- if (!g_file_test (filename , G_FILE_TEST_EXISTS )) return NULL ;
45+ if (!g_file_test (filename , G_FILE_TEST_EXISTS ))
46+ {
47+ dt_print (DT_DEBUG_CONTROL , "[noiseprofile] can't load noiseprofiles from `%s'" , filename );
48+ return NULL ;
49+ }
4750
4851 // TODO: shall we cache the content? for now this looks fast enough(TM)
4952 JsonParser * parser = json_parser_new ();
@@ -56,7 +59,7 @@ JsonParser *dt_noiseprofile_init(const char *alternative)
5659 }
5760
5861 // run over the file once to verify that it is sane
59- if (!dt_noiseprofile_verify (parser ))
62+ if (!_noiseprofile_verify (parser ))
6063 {
6164 dt_control_log (_ ("noiseprofile file `%s' is not valid" ), filename );
6265 dt_print (DT_DEBUG_ALWAYS , "[noiseprofile] error: `%s' is not a valid noiseprofile file. run with -d control for details" , filename );
@@ -92,12 +95,12 @@ static gint _sort_by_iso(gconstpointer a, gconstpointer b)
9295 goto end;\
9396 }
9497
95- static gboolean dt_noiseprofile_verify (JsonParser * parser )
98+ static gboolean _noiseprofile_verify (JsonParser * parser )
9699{
97100 JsonReader * reader = NULL ;
98101 gboolean valid = TRUE;
99102
100- dt_print (DT_DEBUG_CONTROL , "[noiseprofile] verifying noiseprofile file" );
103+ dt_print (DT_DEBUG_CONTROL | DT_DEBUG_VERBOSE , "[noiseprofile] verifying noiseprofile file" );
101104
102105 JsonNode * root = json_parser_get_root (parser );
103106 if (!root ) _ERROR ("can't get the root node" );
@@ -120,35 +123,35 @@ static gboolean dt_noiseprofile_verify(JsonParser *parser)
120123
121124 // go through all makers
122125 const int n_makers = json_reader_count_elements (reader );
123- dt_print (DT_DEBUG_CONTROL , "[noiseprofile] found %d makers" , n_makers );
126+ dt_print (DT_DEBUG_CONTROL | DT_DEBUG_VERBOSE , "[noiseprofile] found %d makers" , n_makers );
124127 for (int i = 0 ; i < n_makers ; i ++ )
125128 {
126129 if (!json_reader_read_element (reader , i )) _ERROR ("can't access maker at position %d / %d" , i + 1 , n_makers );
127130
128131 if (!json_reader_read_member (reader , "maker" )) _ERROR ("missing `maker`" );
129132
130- dt_print (DT_DEBUG_CONTROL , "[noiseprofile] found maker `%s'" , json_reader_get_string_value (reader ));
133+ dt_print (DT_DEBUG_CONTROL | DT_DEBUG_VERBOSE , "[noiseprofile] found maker `%s'" , json_reader_get_string_value (reader ));
131134 // go through all models and check those
132135 json_reader_end_member (reader );
133136
134137 if (!json_reader_read_member (reader , "models" )) _ERROR ("missing `models`" );
135138
136139 const int n_models = json_reader_count_elements (reader );
137- dt_print (DT_DEBUG_CONTROL , "[noiseprofile] found %d models" , n_models );
140+ dt_print (DT_DEBUG_CONTROL | DT_DEBUG_VERBOSE , "[noiseprofile] found %d models" , n_models );
138141 n_profiles_total += n_models ;
139142 for (int j = 0 ; j < n_models ; j ++ )
140143 {
141144 if (!json_reader_read_element (reader , j )) _ERROR ("can't access model at position %d / %d" , j + 1 , n_models );
142145
143146 if (!json_reader_read_member (reader , "model" )) _ERROR ("missing `model`" );
144147
145- dt_print (DT_DEBUG_CONTROL , "[noiseprofile] found %s" , json_reader_get_string_value (reader ));
148+ dt_print (DT_DEBUG_CONTROL | DT_DEBUG_VERBOSE , "[noiseprofile] found %s" , json_reader_get_string_value (reader ));
146149 json_reader_end_member (reader );
147150
148151 if (!json_reader_read_member (reader , "profiles" )) _ERROR ("missing `profiles`" );
149152
150153 const int n_profiles = json_reader_count_elements (reader );
151- dt_print (DT_DEBUG_CONTROL , "[noiseprofile] found %d profiles" , n_profiles );
154+ dt_print (DT_DEBUG_CONTROL | DT_DEBUG_VERBOSE , "[noiseprofile] found %d profiles" , n_profiles );
152155 for (int k = 0 ; k < n_profiles ; k ++ )
153156 {
154157 if (!json_reader_read_element (reader , k )) _ERROR ("can't access profile at position %d / %d" , k + 1 , n_profiles );
@@ -212,8 +215,8 @@ static gboolean dt_noiseprofile_verify(JsonParser *parser)
212215
213216 json_reader_end_member (reader );
214217
215- dt_print (DT_DEBUG_CONTROL , "[noiseprofile] verifying noiseprofile completed" );
216- dt_print (DT_DEBUG_CONTROL , "[noiseprofile] found %zu profiles total" , n_profiles_total );
218+ dt_print (DT_DEBUG_CONTROL | DT_DEBUG_VERBOSE , "[noiseprofile] verifying noiseprofile completed" );
219+ dt_print (DT_DEBUG_CONTROL | DT_DEBUG_VERBOSE , "[noiseprofile] found %zu profiles total" , n_profiles_total );
217220
218221end :
219222 if (reader ) g_object_unref (reader );
@@ -229,7 +232,7 @@ GList *dt_noiseprofile_get_matching(const dt_image_t *cimg)
229232
230233 if (!parser ) goto end ;
231234
232- dt_print (DT_DEBUG_CONTROL , "[noiseprofile] looking for maker `%s', model `%s'" , cimg -> camera_maker , cimg -> camera_model );
235+ dt_print (DT_DEBUG_CONTROL | DT_DEBUG_VERBOSE , "[noiseprofile] looking for maker `%s', model `%s'" , cimg -> camera_maker , cimg -> camera_model );
233236
234237 JsonNode * root = json_parser_get_root (parser );
235238
@@ -239,7 +242,7 @@ GList *dt_noiseprofile_get_matching(const dt_image_t *cimg)
239242
240243 // go through all makers
241244 const int n_makers = json_reader_count_elements (reader );
242- dt_print (DT_DEBUG_CONTROL , "[noiseprofile] found %d makers" , n_makers );
245+ dt_print (DT_DEBUG_CONTROL | DT_DEBUG_VERBOSE , "[noiseprofile] found %d makers" , n_makers );
243246 for (int i = 0 ; i < n_makers ; i ++ )
244247 {
245248 json_reader_read_element (reader , i );
@@ -248,14 +251,14 @@ GList *dt_noiseprofile_get_matching(const dt_image_t *cimg)
248251
249252 if (g_strstr_len (cimg -> camera_maker , -1 , json_reader_get_string_value (reader )))
250253 {
251- dt_print (DT_DEBUG_CONTROL , "[noiseprofile] found `%s' as `%s'" , cimg -> camera_maker , json_reader_get_string_value (reader ));
254+ dt_print (DT_DEBUG_CONTROL | DT_DEBUG_VERBOSE , "[noiseprofile] found `%s' as `%s'" , cimg -> camera_maker , json_reader_get_string_value (reader ));
252255 // go through all models and check those
253256 json_reader_end_member (reader );
254257
255258 json_reader_read_member (reader , "models" );
256259
257260 const int n_models = json_reader_count_elements (reader );
258- dt_print (DT_DEBUG_CONTROL , "[noiseprofile] found %d models" , n_models );
261+ dt_print (DT_DEBUG_CONTROL | DT_DEBUG_VERBOSE , "[noiseprofile] found %d models" , n_models );
259262 for (int j = 0 ; j < n_models ; j ++ )
260263 {
261264 json_reader_read_element (reader , j );
@@ -264,7 +267,7 @@ GList *dt_noiseprofile_get_matching(const dt_image_t *cimg)
264267
265268 if (!g_strcmp0 (cimg -> camera_model , json_reader_get_string_value (reader )))
266269 {
267- dt_print (DT_DEBUG_CONTROL , "[noiseprofile] found %s" , cimg -> camera_model );
270+ dt_print (DT_DEBUG_CONTROL | DT_DEBUG_VERBOSE , "[noiseprofile] found %s" , cimg -> camera_model );
268271 // we got a match, return at most bufsize elements
269272 json_reader_end_member (reader );
270273
0 commit comments