47 spatial_filter = temporal_filter = holes_filter =
false;
48 spatial_alpha = temporal_alpha = 0;
49 spatial_iterations = temporal_persistence = holes_filling_mode = spatial_delta = temporal_delta = 0;
50 input_res_x = input_res_y = output_res_x = output_res_y = 0;
52 _input_frames.clear();
53 _output_frames.clear();
64 std::size_t
size = file.tellg();
65 file.seekg(0, std::ios_base::beg);
68 std::vector<uint8_t>
v(size);
71 file.read((
char*)&v[0], size);
102 {
res_x,
"Resolution_x" },
103 {
res_y,
"Resolution_y" },
125 std::map<std::string, std::string> dict;
127 std::ifstream
data(str.c_str());
129 int invalid_line = 0;
134 if (!std::getline(
data, key,
','))
137 std::getline(
data, value,
'\n');
138 std::stringstream ss(value);
142 if (invalid_line > 1)
184 static const std::map<std::string, std::string> test_file_names = {
185 {
"Input_pixels",
".Input.raw" },
186 {
"Input_metadata",
".Input.csv" },
187 {
"Output_pixels",
".Output.raw"},
188 {
"Output_metadata",
".Output.csv"}
191 std::vector<bool> fe;
193 for (
auto&
filename : test_file_names)
200 WARN(
"A required test file is not present: " << base_name +
filename.second <<
" .Test will be skipped");
204 if (
std::find(fe.begin(), fe.end(),
false) != fe.end())
210 test_config.
name = test_name;
217 WARN(
"The input sequence is too long - " << test_config.
frames_sequence_size <<
" frames. Performance may be affected");
230 test_config.
output_res_x = output_meta_params.input_res_x;
231 test_config.
output_res_y = output_meta_params.input_res_y;
237 test_config.
spatial_alpha = output_meta_params.spatial_alpha;
238 test_config.
spatial_delta = output_meta_params.spatial_delta;
240 test_config.
holes_filter = output_meta_params.holes_filter;
329 template <
typename T>
330 inline bool profile_diffs(
const std::string& plot_name, std::vector<T>& distances,
const float max_allowed_std,
const float outlier,
size_t frame_idx)
334 std::ofstream output_file(plot_name);
335 for (
const auto &
val : distances) output_file <<
val <<
"\n";
340 float mean = std::accumulate(distances.begin(),
341 distances.end(), 0.0f) / distances.size();
343 auto pixels = distances.size();
344 long long first_non_identical_index = -1;
345 auto first_difference = 0.f;
346 auto non_identical_count = distances.size() -
std::count(distances.begin(), distances.end(),
static_cast<T>(0));
347 auto first_non_identical_iter = std::find_if(distances.begin(), distances.end(), [](
const float&
val) {
return val != 0; });
348 if (first_non_identical_iter != distances.end())
350 first_non_identical_index = first_non_identical_iter - distances.begin();
351 first_difference = *first_non_identical_iter;
353 auto max = std::max_element(distances.begin(), distances.end());
354 auto max_val_index = max - distances.begin();
355 auto max_val = (max != distances.end()) ? *max : 0;
357 float inverse = 1.f / distances.size();
358 for (
auto elem : distances)
360 e += pow(elem - mean, 2);
363 float standard_deviation =
static_cast<float>(sqrt(inverse * e));
366 WARN(
"Frame" << frame_idx
367 <<
": Non-identical pixels = " << non_identical_count
368 <<
" \nFirst non-identical diff = " << first_difference <<
" at index " << first_non_identical_index
369 <<
"\nmax_diff=" << max_val <<
", index=" << max_val_index);
376 CAPTURE(first_non_identical_index);
383 CHECK( standard_deviation <= max_allowed_std );
384 CHECK( fabs(max_val) <= outlier );
386 return ((fabs(max_val) <= outlier) && (standard_deviation <= max_allowed_std));
float stof(const std::string &value)
GLuint const GLchar * name
bool load_test_configuration(const std::string test_name, ppf_test_config &test_config)
std::string get_folder_path(special_folder f)
GLsizei const GLchar *const * string
std::vector< std::vector< uint8_t > > _output_frames
ppf_test_config attrib_from_csv(const std::string &str)
std::vector< std::string > output_frame_names
size_t frames_sequence_size
GLint GLint GLsizei GLint GLenum GLenum const void * pixels
std::vector< std::string > input_frame_names
const GLuint GLenum const void * binary
bool profile_diffs(const std::string &plot_name, std::vector< T > &distances, const float max_allowed_std, const float outlier, size_t frame_idx)
typename::boost::move_detail::remove_reference< T >::type && move(T &&t) BOOST_NOEXCEPT
int stoi(const std::string &value)
const std::map< metadata_attrib, std::string > metadata_attributes
std::vector< uint8_t > load_from_binary(const std::string &str)
bool file_exists(const std::string &filename)
uint8_t temporal_persistence
std::vector< std::vector< uint8_t > > _input_frames
std::string to_string(T value)