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 @@ -40,9 +40,46 @@ int main( int argc, const char *argv[] )
4040 std::vector<std::vector<std::string>> batches =
4141 rta::util::collect_image_files ( files );
4242
43- // Process batch
43+ // Process raw files
4444 bool empty = true ;
45- bool result = converter.process_batch ( batches, empty );
45+ bool result = true ;
46+
47+ int file_index = 0 ;
48+ int total_files = 0 ;
49+
50+ for ( auto const &batch: batches )
51+ total_files += static_cast <int >( batch.size () );
52+
53+ for ( auto const &batch: batches )
54+ {
55+ for ( auto const &input_filename: batch )
56+ {
57+ ++file_index;
58+ if ( converter.settings .verbosity > 0 )
59+ {
60+ std::cerr << " [" << file_index << " /" << total_files
61+ << " ] Processing file: " << input_filename
62+ << std::endl;
63+ }
64+
65+ empty = false ;
66+ result = converter.process_image ( input_filename );
67+ if ( !result )
68+ {
69+
70+ if ( converter.settings .verbosity > 0 )
71+ {
72+ std::cerr << " Failed on file [" << file_index << " /"
73+ << total_files << " ]: " << input_filename
74+ << std::endl;
75+ }
76+
77+ break ;
78+ }
79+ }
80+ if ( !result )
81+ break ;
82+ }
4683
4784 if ( empty )
4885 arg_parser.print_help ();
Original file line number Diff line number Diff line change @@ -1915,51 +1915,6 @@ bool ImageConverter::process_image( const std::string &input_filename )
19151915 return ( true );
19161916}
19171917
1918- bool ImageConverter::process_batch (
1919- const std::vector<std::vector<std::string>> &batches, bool &empty )
1920- {
1921- empty = true ;
1922- bool result = true ;
1923-
1924- size_t total_files = 0 ;
1925- for ( const auto &batch: batches )
1926- total_files += batch.size ();
1927-
1928- size_t file_index = 0 ;
1929-
1930- for ( auto const &batch: batches )
1931- {
1932- for ( auto const &input_filename: batch )
1933- {
1934- empty = false ;
1935- ++file_index;
1936-
1937- if ( settings.verbosity > 0 )
1938- {
1939- std::cerr << " [" << file_index << " /" << total_files
1940- << " ] Processing file: " << input_filename
1941- << std::endl;
1942- }
1943-
1944- result = process_image ( input_filename );
1945- if ( !result )
1946- {
1947- if ( settings.verbosity > 0 )
1948- {
1949- std::cerr << " Failed on file [" << file_index << " /"
1950- << total_files << " ]: " << input_filename
1951- << std::endl;
1952- }
1953- break ;
1954- }
1955- }
1956- if ( !result )
1957- break ;
1958- }
1959-
1960- return result;
1961- }
1962-
19631918const std::vector<double > &ImageConverter::get_WB_multipliers ()
19641919{
19651920 return _WB_multipliers;
You can’t perform that action at this time.
0 commit comments