-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathoutput_file.cpp
More file actions
57 lines (52 loc) · 1.97 KB
/
Copy pathoutput_file.cpp
File metadata and controls
57 lines (52 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* This file is part of Filmulator.
*
* Copyright 2013 Omer Mano and Carlo Vaccari
*
* Filmulator is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Filmulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Filmulator. If not, see <http://www.gnu.org/licenses/>
*/
#include "header.hpp"
void output_file(matrix<int> &output_r, matrix<int> &output_g,
matrix<int> &output_b,
vector<string> input_filename_list, bool jpeg_out,
Exiv2::ExifData exifData)
{
struct timeval write_start;
gettimeofday(&write_start,NULL);
string output_image_filename = input_filename_list[0];
int namelength = output_image_filename.length();
int extension_pos = namelength;
for(;extension_pos >= 0;extension_pos--)//Find extension so that it can be cleaved
if(output_image_filename[extension_pos] == '.')
break;
if(extension_pos == 0) //no extension
extension_pos = namelength;
output_image_filename = output_image_filename.substr(0,extension_pos);
if(input_filename_list.size() != 1)
{
output_image_filename = output_image_filename + "-HDR";
}
output_image_filename = output_image_filename + "-output";
if (jpeg_out)
{
imwrite_jpeg(output_r,output_g,output_b,
output_image_filename,exifData);
}
else
{
imwrite_tiff(output_r,output_g,output_b,
output_image_filename,exifData);
}
tout << "Write time: " << time_diff(write_start) << " seconds" << endl;
}