Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: source/libvpx/examples/simple_encoder.c

Issue 181493009: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/libvpx/examples/simple_decoder.c ('k') | source/libvpx/examples/twopass_encoder.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/libvpx/examples/simple_encoder.c
===================================================================
--- source/libvpx/examples/simple_encoder.c (revision 254565)
+++ source/libvpx/examples/simple_encoder.c (working copy)
@@ -36,7 +36,7 @@
// ---------------------------------
// Encoders have the notion of "usage profiles." For example, an encoder
// may want to publish default configurations for both a video
-// conferencing appliction and a best quality offline encoder. These
+// conferencing application and a best quality offline encoder. These
// obviously have very different default settings. Consult the
// documentation for your codec to see if it provides any default
// configurations. All codecs provide a default configuration, number 0,
@@ -80,6 +80,13 @@
// an error, a descriptive message is printed and the program exits. With
// few exeptions, vpx_codec functions return an enumerated error status,
// with the value `0` indicating success.
+//
+// Error Resiliency Features
+// -------------------------
+// Error resiliency is controlled by the g_error_resilient member of the
+// configuration structure. Use the `decode_with_drops` example to decode with
+// frames 5-10 dropped. Compare the output for a file encoded with this example
+// versus one encoded with the `simple_encoder` example.
#include <stdio.h>
#include <stdlib.h>
@@ -94,7 +101,10 @@
static const char *exec_name;
void usage_exit() {
- fprintf(stderr, "Usage: %s <codec> <width> <height> <infile> <outfile>\n",
+ fprintf(stderr,
+ "Usage: %s <codec> <width> <height> <infile> <outfile> "
+ "[<error-resilient>]\nSee comments in simple_encoder.c for more "
+ "information.\n",
exec_name);
exit(EXIT_FAILURE);
}
@@ -138,17 +148,23 @@
const VpxInterface *encoder = NULL;
const int fps = 30; // TODO(dkovalev) add command line argument
const int bitrate = 200; // kbit/s TODO(dkovalev) add command line argument
- const char *const codec_arg = argv[1];
- const char *const width_arg = argv[2];
- const char *const height_arg = argv[3];
- const char *const infile_arg = argv[4];
- const char *const outfile_arg = argv[5];
+ const char *codec_arg = NULL;
+ const char *width_arg = NULL;
+ const char *height_arg = NULL;
+ const char *infile_arg = NULL;
+ const char *outfile_arg = NULL;
exec_name = argv[0];
- if (argc != 6)
+ if (argc < 6)
die("Invalid number of arguments");
+ codec_arg = argv[1];
+ width_arg = argv[2];
+ height_arg = argv[3];
+ infile_arg = argv[4];
+ outfile_arg = argv[5];
+
encoder = get_vpx_encoder_by_name(codec_arg);
if (!encoder)
die("Unsupported codec.");
@@ -182,6 +198,7 @@
cfg.g_timebase.num = info.time_base.numerator;
cfg.g_timebase.den = info.time_base.denominator;
cfg.rc_target_bitrate = bitrate;
+ cfg.g_error_resilient = argc > 6 ? strtol(argv[6], NULL, 0) : 0;
writer = vpx_video_writer_open(outfile_arg, kContainerIVF, &info);
if (!writer)
« no previous file with comments | « source/libvpx/examples/simple_decoder.c ('k') | source/libvpx/examples/twopass_encoder.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698