webkit
2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
|
#include <assert.h>
#include <stdio.h>
#include <time.h>
#include <stdarg.h>
#include <sys/stat.h>
#include "gflags/gflags.h"
#include "webrtc/base/format_macros.h"
#include "webrtc/common_types.h"
#include "webrtc/modules/video_coding/codecs/test/packet_manipulator.h"
#include "webrtc/modules/video_coding/codecs/test/stats.h"
#include "webrtc/modules/video_coding/codecs/test/videoprocessor.h"
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
#include "webrtc/modules/video_coding/include/video_coding.h"
#include "webrtc/system_wrappers/include/trace.h"
#include "webrtc/test/testsupport/frame_reader.h"
#include "webrtc/test/testsupport/frame_writer.h"
#include "webrtc/test/testsupport/metrics/video_metrics.h"
#include "webrtc/test/testsupport/packet_reader.h"
Macros | |
#define | S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR) |
Functions | |
DEFINE_string (test_name, "Quality test", "The name of the test to run. ") | |
DEFINE_string (test_description, "", "A more detailed description about what " "the current test is about.") | |
DEFINE_string (input_filename, "", "Input file. " "The source video file to be encoded and decoded. Must be in " ".yuv format") | |
DEFINE_int32 (width, -1, "Width in pixels of the frames in the input file.") | |
DEFINE_int32 (height, -1, "Height in pixels of the frames in the input file.") | |
DEFINE_int32 (framerate, 30, "Frame rate of the input file, in FPS " "(frames-per-second). ") | |
DEFINE_string (output_dir, ".", "Output directory. " "The directory where the output file will be put. Must already " "exist.") | |
DEFINE_bool (use_single_core, false, "Force using a single core. If set to " "true, only one core will be used for processing. Using a single " "core is necessary to get a deterministic behavior for the" "encoded frames - using multiple cores will produce different " "encoded frames since multiple cores are competing to consume the " "byte budget for each frame in parallel. If set to false, " "the maximum detected number of cores will be used. ") | |
DEFINE_bool (disable_fixed_random_seed, false, "Set this flag to disable the" "usage of a fixed random seed for the random generator used " "for packet loss. Disabling this will cause consecutive runs " "loose packets at different locations, which is bad for " "reproducibility.") | |
DEFINE_string (output_filename, "", "Output file. " "The name of the output video file resulting of the processing " "of the source file. By default this is the same name as the " "input file with '_out' appended before the extension.") | |
DEFINE_int32 (bitrate, 500, "Bit rate in kilobits/second.") | |
DEFINE_int32 (keyframe_interval, 0, "Forces a keyframe every Nth frame. " "0 means the encoder decides when to insert keyframes. Note that " "the encoder may create a keyframe in other locations in addition " "to the interval that is set using this parameter.") | |
DEFINE_int32 (temporal_layers, 0, "The number of temporal layers to use " "(VP8 specific codec setting). Must be 0-4.") | |
DEFINE_int32 (packet_size, 1500, "Simulated network packet size in bytes (MTU). " "Used for packet loss simulation.") | |
DEFINE_int32 (max_payload_size, 1440, "Max payload size in bytes for the " "encoder.") | |
DEFINE_string (packet_loss_mode, "uniform", "Packet loss mode. Two different " "packet loss models are supported: uniform or burst. This " "setting has no effect unless packet_loss_rate is >0. ") | |
DEFINE_double (packet_loss_probability, 0.0, "Packet loss probability. A value " "between 0.0 and 1.0 that defines the probability of a packet " "being lost. 0.1 means 10% and so on.") | |
DEFINE_int32 (packet_loss_burst_length, 1, "Packet loss burst length. Defines " "how many packets will be lost in a burst when a packet has been " "decided to be lost. Must be >=1.") | |
DEFINE_bool (csv, false, "CSV output. Enabling this will output all frame " "statistics at the end of execution. Recommended to run combined " "with --noverbose to avoid mixing output.") | |
DEFINE_bool (python, false, "Python output. Enabling this will output all frame " "statistics as a Python script at the end of execution. " "Recommended to run combine with --noverbose to avoid mixing " "output.") | |
DEFINE_bool (verbose, true, "Verbose mode. Prints a lot of debugging info. " "Suitable for tracking progress but not for capturing output. " "Disable with --noverbose flag.") | |
int | Log (const char *format,...) |
int | HandleCommandLineFlags (webrtc::test::TestConfig *config) |
void | CalculateSsimVideoMetrics (webrtc::test::TestConfig *config, webrtc::test::QualityMetricsResult *result) |
void | CalculatePsnrVideoMetrics (webrtc::test::TestConfig *config, webrtc::test::QualityMetricsResult *result) |
void | PrintConfigurationSummary (const webrtc::test::TestConfig &config) |
void | PrintCsvOutput (const webrtc::test::Stats &stats, const webrtc::test::QualityMetricsResult &ssim_result, const webrtc::test::QualityMetricsResult &psnr_result) |
void | PrintPythonOutput (const webrtc::test::TestConfig &config, const webrtc::test::Stats &stats, const webrtc::test::QualityMetricsResult &ssim_result, const webrtc::test::QualityMetricsResult &psnr_result) |
int | main (int argc, char *argv[]) |
void CalculatePsnrVideoMetrics | ( | webrtc::test::TestConfig * | config, |
webrtc::test::QualityMetricsResult * | result | ||
) |
void CalculateSsimVideoMetrics | ( | webrtc::test::TestConfig * | config, |
webrtc::test::QualityMetricsResult * | result | ||
) |
DEFINE_bool | ( | use_single_core | , |
false | , | ||
"Force using a single core. If set to " " | true, | ||
only one core will be used for processing. Using a single " "core is necessary to get a deterministic behavior for the" "encoded frames - using multiple cores will produce different " "encoded frames since multiple cores are competing to consume the " "byte budget for each frame in parallel. If set to | false, | ||
" "the maximum detected number of cores will be used. " | |||
) |
DEFINE_bool | ( | disable_fixed_random_seed | , |
false | , | ||
"Set this flag to disable the" "usage of a fixed random seed for the random generator used " "for packet loss. Disabling this will cause consecutive runs " "loose packets at different | locations, | ||
which is bad for " "reproducibility." | |||
) |
DEFINE_bool | ( | csv | , |
false | , | ||
"CSV output. Enabling this will output all frame " "statistics at the end of execution. Recommended to run combined " "with --noverbose to avoid mixing output." | |||
) |
DEFINE_bool | ( | python | , |
false | , | ||
"Python output. Enabling this will output all frame " "statistics as a Python script at the end of execution. " "Recommended to run combine with --noverbose to avoid mixing " "output." | |||
) |
DEFINE_bool | ( | verbose | , |
true | , | ||
"Verbose mode. Prints a lot of debugging info. " "Suitable for tracking progress but not for capturing output. " "Disable with --noverbose flag." | |||
) |
DEFINE_double | ( | packet_loss_probability | , |
0. | 0, | ||
"Packet loss probability. A value " "between 0.0 and 1.0 that defines the probability of a packet " "being lost. 0.1 means 10% and so on." | |||
) |
DEFINE_int32 | ( | bitrate | , |
500 | , | ||
"Bit rate in kilobits/second." | |||
) |
DEFINE_int32 | ( | keyframe_interval | , |
0 | , | ||
"Forces a keyframe every Nth frame. " "0 means the encoder decides when to insert keyframes. Note that " "the encoder may create a keyframe in other locations in addition " "to the interval that is set using this parameter." | |||
) |
DEFINE_int32 | ( | temporal_layers | , |
0 | , | ||
"The number of temporal layers to use " "(VP8 specific codec setting). Must be 0-4." | |||
) |
DEFINE_int32 | ( | packet_size | , |
1500 | , | ||
"Simulated network packet size in bytes (MTU). " "Used for packet loss simulation." | |||
) |
DEFINE_int32 | ( | packet_loss_burst_length | , |
1 | , | ||
"Packet loss burst length. Defines " "how many packets will be lost in a burst when a packet has been " "decided to be lost. Must be >=1." | |||
) |
DEFINE_string | ( | test_description | , |
"" | , | ||
"A more detailed description about what " "the current test is about." | |||
) |
DEFINE_string | ( | input_filename | , |
"" | , | ||
"Input file. " "The source video file to be encoded and decoded. Must be in " ".yuv format" | |||
) |
DEFINE_string | ( | output_dir | , |
"." | , | ||
"Output directory. " "The directory where the output file will be put. Must already " "exist." | |||
) |
DEFINE_string | ( | output_filename | , |
"" | , | ||
"Output file. " "The name of the output video file resulting of the processing " "of the source file. By default this is the same name as the " "input file with '_out' appended before the extension." | |||
) |
DEFINE_string | ( | packet_loss_mode | , |
"uniform" | , | ||
"Packet loss mode. Two different " "packet loss models are supported: uniform or burst. This " "setting has no effect unless packet_loss_rate | is, | ||
0. " | |||
) |
int HandleCommandLineFlags | ( | webrtc::test::TestConfig * | config | ) |
int Log | ( | const char * | format, |
... | |||
) |
int main | ( | int | argc, |
char * | argv[] | ||
) |
void PrintConfigurationSummary | ( | const webrtc::test::TestConfig & | config | ) |
void PrintCsvOutput | ( | const webrtc::test::Stats & | stats, |
const webrtc::test::QualityMetricsResult & | ssim_result, | ||
const webrtc::test::QualityMetricsResult & | psnr_result | ||
) |
void PrintPythonOutput | ( | const webrtc::test::TestConfig & | config, |
const webrtc::test::Stats & | stats, | ||
const webrtc::test::QualityMetricsResult & | ssim_result, | ||
const webrtc::test::QualityMetricsResult & | psnr_result | ||
) |