OLD | NEW |
1 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 1 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
2 # | 2 # |
3 # Use of this source code is governed by a BSD-style license | 3 # Use of this source code is governed by a BSD-style license |
4 # that can be found in the LICENSE file in the root of the source | 4 # that can be found in the LICENSE file in the root of the source |
5 # tree. An additional intellectual property rights grant can be found | 5 # tree. An additional intellectual property rights grant can be found |
6 # in the file PATENTS. All contributing project authors may | 6 # in the file PATENTS. All contributing project authors may |
7 # be found in the AUTHORS file in the root of the source tree. | 7 # be found in the AUTHORS file in the root of the source tree. |
8 | 8 |
9 """Plots statistics from WebRTC integration test logs. | 9 """Plots statistics from WebRTC integration test logs. |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 FRAME_SIZE_AVG = ('Frame sizes', 'frame size (bytes) avg') | 49 FRAME_SIZE_AVG = ('Frame sizes', 'frame size (bytes) avg') |
50 AVG_KEY_FRAME_SIZE = ('Average key frame size', 'avg key frame size (bytes)') | 50 AVG_KEY_FRAME_SIZE = ('Average key frame size', 'avg key frame size (bytes)') |
51 AVG_NON_KEY_FRAME_SIZE = ('Average non-key frame size', | 51 AVG_NON_KEY_FRAME_SIZE = ('Average non-key frame size', |
52 'avg non-key frame size (bytes)') | 52 'avg non-key frame size (bytes)') |
53 | 53 |
54 # Settings. | 54 # Settings. |
55 SETTINGS = [ | 55 SETTINGS = [ |
56 WIDTH, | 56 WIDTH, |
57 HEIGHT, | 57 HEIGHT, |
58 FILENAME, | 58 FILENAME, |
59 CODEC_TYPE, | |
60 NUM_FRAMES, | 59 NUM_FRAMES, |
61 ENCODER_IMPLEMENTATION_NAME, | |
62 DECODER_IMPLEMENTATION_NAME, | |
63 ENCODE_TIME, | 60 ENCODE_TIME, |
64 DECODE_TIME, | 61 DECODE_TIME, |
65 FRAME_SIZE, | 62 FRAME_SIZE, |
66 ] | 63 ] |
67 | 64 |
68 # Settings, options for x-axis. | 65 # Settings, options for x-axis. |
69 X_SETTINGS = [ | 66 X_SETTINGS = [ |
70 CORES, | 67 CORES, |
71 FRAMERATE, | 68 FRAMERATE, |
72 DENOISING, | 69 DENOISING, |
73 RESILIENCE, | 70 RESILIENCE, |
74 ERROR_CONCEALMENT, | 71 ERROR_CONCEALMENT, |
75 BITRATE, # TODO(asapersson): Needs to be last. | 72 BITRATE, # TODO(asapersson): Needs to be last. |
76 ] | 73 ] |
77 | 74 |
| 75 # Settings, options for subplots. |
| 76 SUBPLOT_SETTINGS = [ |
| 77 CODEC_TYPE, |
| 78 ENCODER_IMPLEMENTATION_NAME, |
| 79 DECODER_IMPLEMENTATION_NAME, |
| 80 ] + X_SETTINGS |
| 81 |
78 # Results. | 82 # Results. |
79 RESULTS = [ | 83 RESULTS = [ |
80 PSNR, | 84 PSNR, |
81 SSIM, | 85 SSIM, |
82 ENC_BITRATE, | 86 ENC_BITRATE, |
83 NUM_DROPPED_FRAMES, | 87 NUM_DROPPED_FRAMES, |
84 NUM_FRAMES_TO_TARGET, | 88 NUM_FRAMES_TO_TARGET, |
85 ENCODE_TIME_AVG, | 89 ENCODE_TIME_AVG, |
86 DECODE_TIME_AVG, | 90 DECODE_TIME_AVG, |
87 AVG_KEY_FRAME_SIZE, | 91 AVG_KEY_FRAME_SIZE, |
88 AVG_NON_KEY_FRAME_SIZE, | 92 AVG_NON_KEY_FRAME_SIZE, |
89 ] | 93 ] |
90 | 94 |
91 METRICS_TO_PARSE = SETTINGS + X_SETTINGS + RESULTS | 95 METRICS_TO_PARSE = SETTINGS + SUBPLOT_SETTINGS + RESULTS |
92 | 96 |
93 Y_METRICS = [res[1] for res in RESULTS] | 97 Y_METRICS = [res[1] for res in RESULTS] |
94 | 98 |
95 # Parameters for plotting. | 99 # Parameters for plotting. |
96 FIG_SIZE_SCALE_FACTOR_X = 2 | 100 FIG_SIZE_SCALE_FACTOR_X = 2 |
97 FIG_SIZE_SCALE_FACTOR_Y = 2.8 | 101 FIG_SIZE_SCALE_FACTOR_Y = 2.8 |
98 GRID_COLOR = [0.45, 0.45, 0.45] | 102 GRID_COLOR = [0.45, 0.45, 0.45] |
99 | 103 |
100 | 104 |
101 def ParseSetting(filename, setting): | 105 def ParseSetting(filename, setting): |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 cores = ParseSetting(filename, CORES[1]) | 390 cores = ParseSetting(filename, CORES[1]) |
387 setting1 = CORES[1] | 391 setting1 = CORES[1] |
388 setting2 = WIDTH[1] | 392 setting2 = WIDTH[1] |
389 sub_keys = [cores[0]] * len(Y_METRICS) | 393 sub_keys = [cores[0]] * len(Y_METRICS) |
390 y_metrics = Y_METRICS | 394 y_metrics = Y_METRICS |
391 x_metric = BITRATE[1] | 395 x_metric = BITRATE[1] |
392 else: | 396 else: |
393 resolutions = ParseSetting(filename, WIDTH[1]) | 397 resolutions = ParseSetting(filename, WIDTH[1]) |
394 idx = GetIdx("Select metric for x-axis:\n%s" % ToString(X_SETTINGS)) | 398 idx = GetIdx("Select metric for x-axis:\n%s" % ToString(X_SETTINGS)) |
395 if X_SETTINGS[idx] == BITRATE: | 399 if X_SETTINGS[idx] == BITRATE: |
396 idx = GetIdx("Plot per:\n%s" % ToStringWithoutMetric(X_SETTINGS, BITRATE)) | 400 idx = GetIdx("Plot per:\n%s" % ToStringWithoutMetric(SUBPLOT_SETTINGS, |
397 idx_setting = METRICS_TO_PARSE.index(X_SETTINGS[idx]) | 401 BITRATE)) |
| 402 idx_setting = METRICS_TO_PARSE.index(SUBPLOT_SETTINGS[idx]) |
398 # Plot one metric. One subplot for each resolution. | 403 # Plot one metric. One subplot for each resolution. |
399 # Per subplot: metric vs bitrate (per setting). | 404 # Per subplot: metric vs bitrate (per setting). |
400 setting1 = WIDTH[1] | 405 setting1 = WIDTH[1] |
401 setting2 = METRICS_TO_PARSE[idx_setting][1] | 406 setting2 = METRICS_TO_PARSE[idx_setting][1] |
402 sub_keys = resolutions | 407 sub_keys = resolutions |
403 y_metrics = [RESULTS[idx_metric][1]] * len(sub_keys) | 408 y_metrics = [RESULTS[idx_metric][1]] * len(sub_keys) |
404 x_metric = BITRATE[1] | 409 x_metric = BITRATE[1] |
405 else: | 410 else: |
406 # Plot one metric. One subplot for each resolution. | 411 # Plot one metric. One subplot for each resolution. |
407 # Per subplot: metric vs setting (per bitrate). | 412 # Per subplot: metric vs setting (per bitrate). |
(...skipping 11 matching lines...) Expand all Loading... |
419 figsize[1] *= FIG_SIZE_SCALE_FACTOR_Y | 424 figsize[1] *= FIG_SIZE_SCALE_FACTOR_Y |
420 plt.rcParams["figure.figsize"] = figsize | 425 plt.rcParams["figure.figsize"] = figsize |
421 | 426 |
422 PlotFigure(sub_keys, y_metrics, x_metric, metrics, GetTitle(filename)) | 427 PlotFigure(sub_keys, y_metrics, x_metric, metrics, GetTitle(filename)) |
423 | 428 |
424 plt.show() | 429 plt.show() |
425 | 430 |
426 | 431 |
427 if __name__ == '__main__': | 432 if __name__ == '__main__': |
428 main() | 433 main() |
OLD | NEW |