vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
pbos@webrtc.org | ba7f6a8 | 2013-06-04 08:14:10 +0000 | [diff] [blame] | 11 | #include "webrtc/tools/frame_analyzer/video_quality_analysis.h" |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 12 | |
pbos@webrtc.org | 12dc1a3 | 2013-08-05 16:22:53 +0000 | [diff] [blame] | 13 | #include <assert.h> |
| 14 | #include <stdio.h> |
| 15 | #include <stdlib.h> |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 16 | #include <string> |
| 17 | |
| 18 | #define STATS_LINE_LENGTH 32 |
mcasas@webrtc.org | 6e2d012 | 2014-03-14 12:45:45 +0000 | [diff] [blame] | 19 | #define Y4M_FILE_HEADER_MAX_SIZE 200 |
| 20 | #define Y4M_FRAME_DELIMITER "FRAME" |
| 21 | #define Y4M_FRAME_HEADER_SIZE 6 |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 22 | |
| 23 | namespace webrtc { |
| 24 | namespace test { |
| 25 | |
kjellander@webrtc.org | b2d7497 | 2013-01-26 16:36:40 +0000 | [diff] [blame] | 26 | using std::string; |
| 27 | |
Henrik Kjellander | 67bcb60 | 2015-10-07 08:42:52 +0200 | [diff] [blame] | 28 | ResultsContainer::ResultsContainer() {} |
| 29 | ResultsContainer::~ResultsContainer() {} |
| 30 | |
vspasova@webrtc.org | ac410e2 | 2012-08-27 14:57:19 +0000 | [diff] [blame] | 31 | int GetI420FrameSize(int width, int height) { |
| 32 | int half_width = (width + 1) >> 1; |
| 33 | int half_height = (height + 1) >> 1; |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 34 | |
vspasova@webrtc.org | ac410e2 | 2012-08-27 14:57:19 +0000 | [diff] [blame] | 35 | int y_plane = width * height; // I420 Y plane. |
| 36 | int u_plane = half_width * half_height; // I420 U plane. |
| 37 | int v_plane = half_width * half_height; // I420 V plane. |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 38 | |
| 39 | return y_plane + u_plane + v_plane; |
| 40 | } |
| 41 | |
| 42 | int ExtractFrameSequenceNumber(std::string line) { |
kjellander@webrtc.org | b2d7497 | 2013-01-26 16:36:40 +0000 | [diff] [blame] | 43 | size_t space_position = line.find(' '); |
| 44 | if (space_position == string::npos) { |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 45 | return -1; |
| 46 | } |
| 47 | std::string frame = line.substr(0, space_position); |
| 48 | |
kjellander@webrtc.org | b2d7497 | 2013-01-26 16:36:40 +0000 | [diff] [blame] | 49 | size_t underscore_position = frame.find('_'); |
| 50 | if (underscore_position == string::npos) { |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 51 | return -1; |
| 52 | } |
| 53 | std::string frame_number = frame.substr(underscore_position + 1); |
| 54 | |
| 55 | return strtol(frame_number.c_str(), NULL, 10); |
| 56 | } |
| 57 | |
| 58 | int ExtractDecodedFrameNumber(std::string line) { |
kjellander@webrtc.org | b2d7497 | 2013-01-26 16:36:40 +0000 | [diff] [blame] | 59 | size_t space_position = line.find(' '); |
| 60 | if (space_position == string::npos) { |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 61 | return -1; |
| 62 | } |
| 63 | std::string decoded_number = line.substr(space_position + 1); |
| 64 | |
| 65 | return strtol(decoded_number.c_str(), NULL, 10); |
| 66 | } |
| 67 | |
| 68 | bool IsThereBarcodeError(std::string line) { |
kjellander@webrtc.org | b2d7497 | 2013-01-26 16:36:40 +0000 | [diff] [blame] | 69 | size_t barcode_error_position = line.find("Barcode error"); |
| 70 | if (barcode_error_position != string::npos) { |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 71 | return true; |
| 72 | } |
| 73 | return false; |
| 74 | } |
| 75 | |
| 76 | bool GetNextStatsLine(FILE* stats_file, char* line) { |
| 77 | int chars = 0; |
| 78 | char buf = 0; |
| 79 | |
| 80 | while (buf != '\n') { |
| 81 | size_t chars_read = fread(&buf, 1, 1, stats_file); |
| 82 | if (chars_read != 1 || feof(stats_file)) { |
| 83 | return false; |
| 84 | } |
| 85 | line[chars] = buf; |
| 86 | ++chars; |
| 87 | } |
| 88 | line[chars-1] = '\0'; // Strip the trailing \n and put end of string. |
| 89 | return true; |
| 90 | } |
| 91 | |
Peter Boström | 0c4e06b | 2015-10-07 12:23:21 +0200 | [diff] [blame] | 92 | bool ExtractFrameFromYuvFile(const char* i420_file_name, |
| 93 | int width, |
| 94 | int height, |
| 95 | int frame_number, |
| 96 | uint8_t* result_frame) { |
vspasova@webrtc.org | ac410e2 | 2012-08-27 14:57:19 +0000 | [diff] [blame] | 97 | int frame_size = GetI420FrameSize(width, height); |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 98 | int offset = frame_number * frame_size; // Calculate offset for the frame. |
| 99 | bool errors = false; |
| 100 | |
| 101 | FILE* input_file = fopen(i420_file_name, "rb"); |
| 102 | if (input_file == NULL) { |
| 103 | fprintf(stderr, "Couldn't open input file for reading: %s\n", |
| 104 | i420_file_name); |
| 105 | return false; |
| 106 | } |
| 107 | |
| 108 | // Change stream pointer to new offset. |
| 109 | fseek(input_file, offset, SEEK_SET); |
| 110 | |
| 111 | size_t bytes_read = fread(result_frame, 1, frame_size, input_file); |
vspasova@webrtc.org | ac410e2 | 2012-08-27 14:57:19 +0000 | [diff] [blame] | 112 | if (bytes_read != static_cast<size_t>(frame_size) && |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 113 | ferror(input_file)) { |
| 114 | fprintf(stdout, "Error while reading frame no %d from file %s\n", |
| 115 | frame_number, i420_file_name); |
| 116 | errors = true; |
| 117 | } |
| 118 | fclose(input_file); |
| 119 | return !errors; |
| 120 | } |
| 121 | |
Peter Boström | 0c4e06b | 2015-10-07 12:23:21 +0200 | [diff] [blame] | 122 | bool ExtractFrameFromY4mFile(const char* y4m_file_name, |
| 123 | int width, |
| 124 | int height, |
| 125 | int frame_number, |
| 126 | uint8_t* result_frame) { |
mcasas@webrtc.org | 6e2d012 | 2014-03-14 12:45:45 +0000 | [diff] [blame] | 127 | int frame_size = GetI420FrameSize(width, height); |
charujain | 1b5b22d | 2016-11-29 02:00:52 -0800 | [diff] [blame] | 128 | int inital_offset = frame_number * (frame_size + Y4M_FRAME_HEADER_SIZE); |
| 129 | int frame_offset = 0; |
mcasas@webrtc.org | 6e2d012 | 2014-03-14 12:45:45 +0000 | [diff] [blame] | 130 | |
| 131 | FILE* input_file = fopen(y4m_file_name, "rb"); |
| 132 | if (input_file == NULL) { |
| 133 | fprintf(stderr, "Couldn't open input file for reading: %s\n", |
| 134 | y4m_file_name); |
| 135 | return false; |
| 136 | } |
| 137 | |
| 138 | // YUV4MPEG2, a.k.a. Y4M File format has a file header and a frame header. The |
| 139 | // file header has the aspect: "YUV4MPEG2 C420 W640 H360 Ip F30:1 A1:1". |
charujain | 1b5b22d | 2016-11-29 02:00:52 -0800 | [diff] [blame] | 140 | char frame_header[Y4M_FILE_HEADER_MAX_SIZE]; |
| 141 | size_t bytes_read = |
| 142 | fread(frame_header, 1, Y4M_FILE_HEADER_MAX_SIZE - 1, input_file); |
| 143 | if (bytes_read != static_cast<size_t>(frame_size) && ferror(input_file)) { |
| 144 | fprintf(stdout, "Error while reading frame from file %s\n", |
| 145 | y4m_file_name); |
| 146 | fclose(input_file); |
| 147 | return false; |
mcasas@webrtc.org | 6e2d012 | 2014-03-14 12:45:45 +0000 | [diff] [blame] | 148 | } |
charujain | 1b5b22d | 2016-11-29 02:00:52 -0800 | [diff] [blame] | 149 | frame_header[bytes_read] = '\0'; |
| 150 | std::string header_contents(frame_header); |
| 151 | std::size_t found = header_contents.find(Y4M_FRAME_DELIMITER); |
| 152 | if (found == std::string::npos) { |
| 153 | fprintf(stdout, "Corrupted Y4M header, could not find \"FRAME\" in %s\n", |
| 154 | header_contents.c_str()); |
| 155 | fclose(input_file); |
| 156 | return false; |
| 157 | } |
| 158 | frame_offset = static_cast<int>(found); |
mcasas@webrtc.org | 6e2d012 | 2014-03-14 12:45:45 +0000 | [diff] [blame] | 159 | |
| 160 | // Change stream pointer to new offset, skipping the frame header as well. |
charujain | 1b5b22d | 2016-11-29 02:00:52 -0800 | [diff] [blame] | 161 | fseek(input_file, inital_offset + frame_offset + Y4M_FRAME_HEADER_SIZE, |
| 162 | SEEK_SET); |
mcasas@webrtc.org | 6e2d012 | 2014-03-14 12:45:45 +0000 | [diff] [blame] | 163 | |
charujain | 1b5b22d | 2016-11-29 02:00:52 -0800 | [diff] [blame] | 164 | bytes_read = fread(result_frame, 1, frame_size, input_file); |
| 165 | if (feof(input_file)) { |
| 166 | fclose(input_file); |
| 167 | return false; |
| 168 | } |
| 169 | if (bytes_read != static_cast<size_t>(frame_size) && ferror(input_file)) { |
mcasas@webrtc.org | 6e2d012 | 2014-03-14 12:45:45 +0000 | [diff] [blame] | 170 | fprintf(stdout, "Error while reading frame no %d from file %s\n", |
| 171 | frame_number, y4m_file_name); |
charujain | 1b5b22d | 2016-11-29 02:00:52 -0800 | [diff] [blame] | 172 | fclose(input_file); |
| 173 | return false; |
mcasas@webrtc.org | 6e2d012 | 2014-03-14 12:45:45 +0000 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | fclose(input_file); |
charujain | 1b5b22d | 2016-11-29 02:00:52 -0800 | [diff] [blame] | 177 | return true; |
mcasas@webrtc.org | 6e2d012 | 2014-03-14 12:45:45 +0000 | [diff] [blame] | 178 | } |
| 179 | |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 180 | double CalculateMetrics(VideoAnalysisMetricsType video_metrics_type, |
Peter Boström | 0c4e06b | 2015-10-07 12:23:21 +0200 | [diff] [blame] | 181 | const uint8_t* ref_frame, |
| 182 | const uint8_t* test_frame, |
| 183 | int width, |
| 184 | int height) { |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 185 | if (!ref_frame || !test_frame) |
| 186 | return -1; |
| 187 | else if (height < 0 || width < 0) |
| 188 | return -1; |
| 189 | int half_width = (width + 1) >> 1; |
| 190 | int half_height = (height + 1) >> 1; |
Peter Boström | 0c4e06b | 2015-10-07 12:23:21 +0200 | [diff] [blame] | 191 | const uint8_t* src_y_a = ref_frame; |
| 192 | const uint8_t* src_u_a = src_y_a + width * height; |
| 193 | const uint8_t* src_v_a = src_u_a + half_width * half_height; |
| 194 | const uint8_t* src_y_b = test_frame; |
| 195 | const uint8_t* src_u_b = src_y_b + width * height; |
| 196 | const uint8_t* src_v_b = src_u_b + half_width * half_height; |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 197 | |
| 198 | int stride_y = width; |
| 199 | int stride_uv = half_width; |
| 200 | |
| 201 | double result = 0.0; |
| 202 | |
| 203 | switch (video_metrics_type) { |
| 204 | case kPSNR: |
| 205 | // In the following: stride is determined by width. |
| 206 | result = libyuv::I420Psnr(src_y_a, width, src_u_a, half_width, |
| 207 | src_v_a, half_width, src_y_b, width, |
| 208 | src_u_b, half_width, src_v_b, half_width, |
| 209 | width, height); |
| 210 | // LibYuv sets the max psnr value to 128, we restrict it to 48. |
| 211 | // In case of 0 mse in one frame, 128 can skew the results significantly. |
| 212 | result = (result > 48.0) ? 48.0 : result; |
| 213 | break; |
| 214 | case kSSIM: |
| 215 | result = libyuv::I420Ssim(src_y_a, stride_y, src_u_a, stride_uv, |
| 216 | src_v_a, stride_uv, src_y_b, stride_y, |
| 217 | src_u_b, stride_uv, src_v_b, stride_uv, |
| 218 | width, height); |
| 219 | break; |
| 220 | default: |
| 221 | assert(false); |
| 222 | } |
| 223 | |
| 224 | return result; |
| 225 | } |
| 226 | |
| 227 | void RunAnalysis(const char* reference_file_name, const char* test_file_name, |
| 228 | const char* stats_file_name, int width, int height, |
| 229 | ResultsContainer* results) { |
mcasas@webrtc.org | 6e2d012 | 2014-03-14 12:45:45 +0000 | [diff] [blame] | 230 | // Check if the reference_file_name ends with "y4m". |
| 231 | bool y4m_mode = false; |
jbauch | 0f2e939 | 2015-12-10 03:11:42 -0800 | [diff] [blame] | 232 | if (std::string(reference_file_name).find("y4m") != std::string::npos) { |
mcasas@webrtc.org | 6e2d012 | 2014-03-14 12:45:45 +0000 | [diff] [blame] | 233 | y4m_mode = true; |
| 234 | } |
| 235 | |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 236 | int size = GetI420FrameSize(width, height); |
| 237 | FILE* stats_file = fopen(stats_file_name, "r"); |
| 238 | |
| 239 | // String buffer for the lines in the stats file. |
| 240 | char line[STATS_LINE_LENGTH]; |
| 241 | |
| 242 | // Allocate buffers for test and reference frames. |
Peter Boström | 0c4e06b | 2015-10-07 12:23:21 +0200 | [diff] [blame] | 243 | uint8_t* test_frame = new uint8_t[size]; |
| 244 | uint8_t* reference_frame = new uint8_t[size]; |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 245 | int previous_frame_number = -1; |
| 246 | |
| 247 | // While there are entries in the stats file. |
| 248 | while (GetNextStatsLine(stats_file, line)) { |
| 249 | int extracted_test_frame = ExtractFrameSequenceNumber(line); |
| 250 | int decoded_frame_number = ExtractDecodedFrameNumber(line); |
| 251 | |
| 252 | // If there was problem decoding the barcode in this frame or the frame has |
| 253 | // been duplicated, continue. |
| 254 | if (IsThereBarcodeError(line) || |
| 255 | decoded_frame_number == previous_frame_number) { |
| 256 | continue; |
| 257 | } |
| 258 | |
| 259 | assert(extracted_test_frame != -1); |
| 260 | assert(decoded_frame_number != -1); |
| 261 | |
mcasas@webrtc.org | 6e2d012 | 2014-03-14 12:45:45 +0000 | [diff] [blame] | 262 | ExtractFrameFromYuvFile(test_file_name, width, height, extracted_test_frame, |
| 263 | test_frame); |
| 264 | if (y4m_mode) { |
| 265 | ExtractFrameFromY4mFile(reference_file_name, width, height, |
| 266 | decoded_frame_number, reference_frame); |
| 267 | } else { |
| 268 | ExtractFrameFromYuvFile(reference_file_name, width, height, |
| 269 | decoded_frame_number, reference_frame); |
| 270 | } |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 271 | |
| 272 | // Calculate the PSNR and SSIM. |
| 273 | double result_psnr = CalculateMetrics(kPSNR, reference_frame, test_frame, |
| 274 | width, height); |
| 275 | double result_ssim = CalculateMetrics(kSSIM, reference_frame, test_frame, |
| 276 | width, height); |
| 277 | |
| 278 | previous_frame_number = decoded_frame_number; |
| 279 | |
| 280 | // Fill in the result struct. |
| 281 | AnalysisResult result; |
| 282 | result.frame_number = decoded_frame_number; |
| 283 | result.psnr_value = result_psnr; |
| 284 | result.ssim_value = result_ssim; |
| 285 | |
| 286 | results->frames.push_back(result); |
| 287 | } |
| 288 | |
| 289 | // Cleanup. |
| 290 | fclose(stats_file); |
| 291 | delete[] test_frame; |
| 292 | delete[] reference_frame; |
| 293 | } |
| 294 | |
kjellander@webrtc.org | f880f86 | 2013-09-10 12:10:01 +0000 | [diff] [blame] | 295 | void PrintMaxRepeatedAndSkippedFrames(const std::string& label, |
| 296 | const std::string& stats_file_name) { |
kjellander@webrtc.org | e2df8b7 | 2013-11-03 18:34:51 +0000 | [diff] [blame] | 297 | PrintMaxRepeatedAndSkippedFrames(stdout, label, stats_file_name); |
| 298 | } |
| 299 | |
| 300 | void PrintMaxRepeatedAndSkippedFrames(FILE* output, const std::string& label, |
| 301 | const std::string& stats_file_name) { |
kjellander@webrtc.org | f880f86 | 2013-09-10 12:10:01 +0000 | [diff] [blame] | 302 | FILE* stats_file = fopen(stats_file_name.c_str(), "r"); |
| 303 | if (stats_file == NULL) { |
| 304 | fprintf(stderr, "Couldn't open stats file for reading: %s\n", |
| 305 | stats_file_name.c_str()); |
| 306 | return; |
| 307 | } |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 308 | char line[STATS_LINE_LENGTH]; |
| 309 | |
| 310 | int repeated_frames = 1; |
| 311 | int max_repeated_frames = 1; |
| 312 | int max_skipped_frames = 1; |
| 313 | int previous_frame_number = -1; |
| 314 | |
| 315 | while (GetNextStatsLine(stats_file, line)) { |
| 316 | int decoded_frame_number = ExtractDecodedFrameNumber(line); |
| 317 | |
| 318 | if (decoded_frame_number == -1) { |
| 319 | continue; |
| 320 | } |
| 321 | |
| 322 | // Calculate how many frames a cluster of repeated frames contains. |
| 323 | if (decoded_frame_number == previous_frame_number) { |
| 324 | ++repeated_frames; |
| 325 | if (repeated_frames > max_repeated_frames) { |
| 326 | max_repeated_frames = repeated_frames; |
| 327 | } |
| 328 | } else { |
| 329 | repeated_frames = 1; |
| 330 | } |
| 331 | |
| 332 | // Calculate how much frames have been skipped. |
| 333 | if (decoded_frame_number != 0 && previous_frame_number != -1) { |
| 334 | int skipped_frames = decoded_frame_number - previous_frame_number - 1; |
| 335 | if (skipped_frames > max_skipped_frames) { |
| 336 | max_skipped_frames = skipped_frames; |
| 337 | } |
| 338 | } |
| 339 | previous_frame_number = decoded_frame_number; |
| 340 | } |
kjellander@webrtc.org | e2df8b7 | 2013-11-03 18:34:51 +0000 | [diff] [blame] | 341 | fprintf(output, "RESULT Max_repeated: %s= %d\n", label.c_str(), |
kjellander@webrtc.org | f880f86 | 2013-09-10 12:10:01 +0000 | [diff] [blame] | 342 | max_repeated_frames); |
kjellander@webrtc.org | e2df8b7 | 2013-11-03 18:34:51 +0000 | [diff] [blame] | 343 | fprintf(output, "RESULT Max_skipped: %s= %d\n", label.c_str(), |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 344 | max_skipped_frames); |
kjellander@webrtc.org | f880f86 | 2013-09-10 12:10:01 +0000 | [diff] [blame] | 345 | fclose(stats_file); |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 346 | } |
| 347 | |
kjellander@webrtc.org | f880f86 | 2013-09-10 12:10:01 +0000 | [diff] [blame] | 348 | void PrintAnalysisResults(const std::string& label, ResultsContainer* results) { |
kjellander@webrtc.org | e2df8b7 | 2013-11-03 18:34:51 +0000 | [diff] [blame] | 349 | PrintAnalysisResults(stdout, label, results); |
| 350 | } |
| 351 | |
| 352 | void PrintAnalysisResults(FILE* output, const std::string& label, |
| 353 | ResultsContainer* results) { |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 354 | std::vector<AnalysisResult>::iterator iter; |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 355 | |
brandtr | d658ede | 2016-07-12 04:53:04 -0700 | [diff] [blame] | 356 | fprintf(output, "RESULT Unique_frames_count: %s= %u score\n", label.c_str(), |
pbos@webrtc.org | 319c98d | 2013-09-10 15:23:50 +0000 | [diff] [blame] | 357 | static_cast<unsigned int>(results->frames.size())); |
kjellander@webrtc.org | f880f86 | 2013-09-10 12:10:01 +0000 | [diff] [blame] | 358 | |
| 359 | if (results->frames.size() > 0u) { |
kjellander@webrtc.org | e2df8b7 | 2013-11-03 18:34:51 +0000 | [diff] [blame] | 360 | fprintf(output, "RESULT PSNR: %s= [", label.c_str()); |
kjellander@webrtc.org | f880f86 | 2013-09-10 12:10:01 +0000 | [diff] [blame] | 361 | for (iter = results->frames.begin(); iter != results->frames.end() - 1; |
| 362 | ++iter) { |
kjellander@webrtc.org | e2df8b7 | 2013-11-03 18:34:51 +0000 | [diff] [blame] | 363 | fprintf(output, "%f,", iter->psnr_value); |
kjellander@webrtc.org | f880f86 | 2013-09-10 12:10:01 +0000 | [diff] [blame] | 364 | } |
kjellander@webrtc.org | e2df8b7 | 2013-11-03 18:34:51 +0000 | [diff] [blame] | 365 | fprintf(output, "%f] dB\n", iter->psnr_value); |
kjellander@webrtc.org | f880f86 | 2013-09-10 12:10:01 +0000 | [diff] [blame] | 366 | |
kjellander@webrtc.org | e2df8b7 | 2013-11-03 18:34:51 +0000 | [diff] [blame] | 367 | fprintf(output, "RESULT SSIM: %s= [", label.c_str()); |
kjellander@webrtc.org | f880f86 | 2013-09-10 12:10:01 +0000 | [diff] [blame] | 368 | for (iter = results->frames.begin(); iter != results->frames.end() - 1; |
| 369 | ++iter) { |
kjellander@webrtc.org | e2df8b7 | 2013-11-03 18:34:51 +0000 | [diff] [blame] | 370 | fprintf(output, "%f,", iter->ssim_value); |
kjellander@webrtc.org | f880f86 | 2013-09-10 12:10:01 +0000 | [diff] [blame] | 371 | } |
kjellander@webrtc.org | 22c2f05 | 2015-01-28 13:52:08 +0000 | [diff] [blame] | 372 | fprintf(output, "%f] score\n", iter->ssim_value); |
vspasova@webrtc.org | fd80070 | 2012-08-16 14:07:02 +0000 | [diff] [blame] | 373 | } |
| 374 | } |
| 375 | |
| 376 | } // namespace test |
| 377 | } // namespace webrtc |