niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011 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 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 11 | |
| 12 | #include <stdlib.h> |
| 13 | #include <string.h> |
| 14 | |
pbos@webrtc.org | a440732 | 2013-07-16 12:32:05 +0000 | [diff] [blame] | 15 | #include "gflags/gflags.h" |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 16 | #include "webrtc/modules/video_coding/include/video_coding.h" |
| 17 | #include "webrtc/modules/video_coding/test/receiver_tests.h" |
stefan@webrtc.org | 2baf5f5 | 2013-03-13 08:46:25 +0000 | [diff] [blame] | 18 | #include "webrtc/test/testsupport/fileutils.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 19 | |
kjellander@webrtc.org | 81fb7bf | 2012-11-28 08:40:16 +0000 | [diff] [blame] | 20 | DEFINE_string(codec, "VP8", "Codec to use (VP8 or I420)."); |
| 21 | DEFINE_int32(width, 352, "Width in pixels of the frames in the input file."); |
| 22 | DEFINE_int32(height, 288, "Height in pixels of the frames in the input file."); |
kjellander@webrtc.org | 81fb7bf | 2012-11-28 08:40:16 +0000 | [diff] [blame] | 23 | DEFINE_int32(rtt, 0, "RTT (round-trip time), in milliseconds."); |
kjellander@webrtc.org | 81fb7bf | 2012-11-28 08:40:16 +0000 | [diff] [blame] | 24 | DEFINE_string(input_filename, webrtc::test::ProjectRootPath() + |
| 25 | "/resources/foreman_cif.yuv", "Input file."); |
| 26 | DEFINE_string(output_filename, webrtc::test::OutputPath() + |
| 27 | "video_coding_test_output_352x288.yuv", "Output file."); |
kjellander@webrtc.org | 81fb7bf | 2012-11-28 08:40:16 +0000 | [diff] [blame] | 28 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 29 | using namespace webrtc; |
| 30 | |
| 31 | /* |
henrik.lundin@webrtc.org | 7d8c72e | 2011-12-21 15:24:01 +0000 | [diff] [blame] | 32 | * Build with EVENT_DEBUG defined |
| 33 | * to build the tests with simulated events. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 34 | */ |
| 35 | |
holmer@google.com | e0f7d7b | 2011-08-03 07:49:56 +0000 | [diff] [blame] | 36 | int vcmMacrosTests = 0; |
| 37 | int vcmMacrosErrors = 0; |
| 38 | |
kjellander@webrtc.org | 81fb7bf | 2012-11-28 08:40:16 +0000 | [diff] [blame] | 39 | int ParseArguments(CmdArgs& args) { |
| 40 | args.width = FLAGS_width; |
| 41 | args.height = FLAGS_height; |
pbos@webrtc.org | d21406d | 2015-03-19 08:18:53 +0000 | [diff] [blame] | 42 | if (args.width < 1 || args.height < 1) { |
kjellander@webrtc.org | 81fb7bf | 2012-11-28 08:40:16 +0000 | [diff] [blame] | 43 | return -1; |
| 44 | } |
| 45 | args.codecName = FLAGS_codec; |
| 46 | if (args.codecName == "VP8") { |
| 47 | args.codecType = kVideoCodecVP8; |
marpan@webrtc.org | 5b88317 | 2014-11-01 06:10:48 +0000 | [diff] [blame] | 48 | } else if (args.codecName == "VP9") { |
| 49 | args.codecType = kVideoCodecVP9; |
kjellander@webrtc.org | 81fb7bf | 2012-11-28 08:40:16 +0000 | [diff] [blame] | 50 | } else if (args.codecName == "I420") { |
| 51 | args.codecType = kVideoCodecI420; |
| 52 | } else { |
| 53 | printf("Invalid codec: %s\n", args.codecName.c_str()); |
| 54 | return -1; |
| 55 | } |
| 56 | args.inputFile = FLAGS_input_filename; |
| 57 | args.outputFile = FLAGS_output_filename; |
kjellander@webrtc.org | 81fb7bf | 2012-11-28 08:40:16 +0000 | [diff] [blame] | 58 | args.rtt = FLAGS_rtt; |
kjellander@webrtc.org | 81fb7bf | 2012-11-28 08:40:16 +0000 | [diff] [blame] | 59 | return 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 60 | } |
| 61 | |
kjellander@webrtc.org | 81fb7bf | 2012-11-28 08:40:16 +0000 | [diff] [blame] | 62 | int main(int argc, char **argv) { |
| 63 | // Initialize WebRTC fileutils.h so paths to resources can be resolved. |
| 64 | webrtc::test::SetExecutablePath(argv[0]); |
| 65 | google::ParseCommandLineFlags(&argc, &argv, true); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 66 | |
kjellander@webrtc.org | 81fb7bf | 2012-11-28 08:40:16 +0000 | [diff] [blame] | 67 | CmdArgs args; |
| 68 | if (ParseArguments(args) != 0) { |
brykt@google.com | e8ef807 | 2012-11-09 16:16:41 +0000 | [diff] [blame] | 69 | printf("Unable to parse input arguments\n"); |
brykt@google.com | e8ef807 | 2012-11-09 16:16:41 +0000 | [diff] [blame] | 70 | return -1; |
| 71 | } |
mikhal@webrtc.org | d70b77d | 2011-08-22 21:08:15 +0000 | [diff] [blame] | 72 | |
kjellander@webrtc.org | 971278a | 2013-03-08 10:20:53 +0000 | [diff] [blame] | 73 | printf("Running video coding tests...\n"); |
pbos@webrtc.org | d21406d | 2015-03-19 08:18:53 +0000 | [diff] [blame] | 74 | return RtpPlay(args); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 75 | } |