File tree Expand file tree Collapse file tree 3 files changed +39
-58
lines changed
Expand file tree Collapse file tree 3 files changed +39
-58
lines changed Original file line number Diff line number Diff line change @@ -259,17 +259,6 @@ class ImageConverter
259259 // / `true` if processed successfully.
260260 bool process_image ( const std::string &input_filename );
261261
262- // / Process a batch of input files or directories.
263- // / This will iterate over each batch and call process_image() on every file.
264- // / @param batches
265- // / Vector of batches, each batch is a vector of filenames.
266- // / @param empty
267- // / Output flag that becomes true if no files were processed.
268- // / @result
269- // / true if all files were processed successfully, false otherwise.
270- bool process_batch (
271- const std::vector<std::vector<std::string>> &batches, bool &empty );
272-
273262 // / Get the solved white balance multipliers of the currently processed
274263 // / image. The multipliers become available after calling either of the
275264 // / two `configure` methods.
Original file line number Diff line number Diff line change @@ -50,9 +50,46 @@ int main( int argc, const char *argv[] )
5050 }
5151 }
5252
53- // Process batch
53+ // Process raw files
5454 bool empty = true ;
55- bool result = converter.process_batch ( batches, empty );
55+ bool result = true ;
56+
57+ int file_index = 0 ;
58+ int total_files = 0 ;
59+
60+ for ( auto const &batch: batches )
61+ total_files += static_cast <int >( batch.size () );
62+
63+ for ( auto const &batch: batches )
64+ {
65+ for ( auto const &input_filename: batch )
66+ {
67+ ++file_index;
68+ if ( converter.settings .verbosity > 0 )
69+ {
70+ std::cerr << " [" << file_index << " /" << total_files
71+ << " ] Processing file: " << input_filename
72+ << std::endl;
73+ }
74+
75+ empty = false ;
76+ result = converter.process_image ( input_filename );
77+ if ( !result )
78+ {
79+
80+ if ( converter.settings .verbosity > 0 )
81+ {
82+ std::cerr << " Failed on file [" << file_index << " /"
83+ << total_files << " ]: " << input_filename
84+ << std::endl;
85+ }
86+
87+ break ;
88+ }
89+ }
90+ if ( !result )
91+ break ;
92+ }
5693
5794 if ( empty )
5895 arg_parser.print_help ();
Original file line number Diff line number Diff line change @@ -1910,51 +1910,6 @@ bool ImageConverter::process_image( const std::string &input_filename )
19101910 return ( true );
19111911}
19121912
1913- bool ImageConverter::process_batch (
1914- const std::vector<std::vector<std::string>> &batches, bool &empty )
1915- {
1916- empty = true ;
1917- bool result = true ;
1918-
1919- size_t total_files = 0 ;
1920- for ( const auto &batch: batches )
1921- total_files += batch.size ();
1922-
1923- size_t file_index = 0 ;
1924-
1925- for ( auto const &batch: batches )
1926- {
1927- for ( auto const &input_filename: batch )
1928- {
1929- empty = false ;
1930- ++file_index;
1931-
1932- if ( settings.verbosity > 0 )
1933- {
1934- std::cerr << " [" << file_index << " /" << total_files
1935- << " ] Processing file: " << input_filename
1936- << std::endl;
1937- }
1938-
1939- result = process_image ( input_filename );
1940- if ( !result )
1941- {
1942- if ( settings.verbosity > 0 )
1943- {
1944- std::cerr << " Failed on file [" << file_index << " /"
1945- << total_files << " ]: " << input_filename
1946- << std::endl;
1947- }
1948- break ;
1949- }
1950- }
1951- if ( !result )
1952- break ;
1953- }
1954-
1955- return result;
1956- }
1957-
19581913const std::vector<double > &ImageConverter::get_WB_multipliers ()
19591914{
19601915 return _WB_multipliers;
You can’t perform that action at this time.
0 commit comments