Commit 75afcee9 authored by John Koleszar's avatar John Koleszar
Browse files

vpxenc: add deterministic output option

By baking the version number into the output file, a hash of the file
will vary from commit to commit, even if the output is otherwise bit
exact. Add a -D option to suppress this behavior, for use when
bisecting or other debugging.

Change-Id: I5089a8ce5719920ffaf47620fa9069b81fa15673
parent ad760b96
...@@ -430,6 +430,8 @@ struct cue_entry ...@@ -430,6 +430,8 @@ struct cue_entry
struct EbmlGlobal struct EbmlGlobal
{ {
int debug;
FILE *stream; FILE *stream;
uint64_t last_pts_ms; uint64_t last_pts_ms;
vpx_rational_t framerate; vpx_rational_t framerate;
...@@ -552,8 +554,10 @@ write_webm_seek_info(EbmlGlobal *ebml) ...@@ -552,8 +554,10 @@ write_webm_seek_info(EbmlGlobal *ebml)
Ebml_SerializeUnsigned(ebml, TimecodeScale, 1000000); Ebml_SerializeUnsigned(ebml, TimecodeScale, 1000000);
Ebml_SerializeFloat(ebml, Segment_Duration, Ebml_SerializeFloat(ebml, Segment_Duration,
ebml->last_pts_ms + frame_time); ebml->last_pts_ms + frame_time);
Ebml_SerializeString(ebml, 0x4D80, "vpxenc" VERSION_STRING); Ebml_SerializeString(ebml, 0x4D80,
Ebml_SerializeString(ebml, 0x5741, "vpxenc" VERSION_STRING); ebml->debug ? "vpxenc" : "vpxenc" VERSION_STRING);
Ebml_SerializeString(ebml, 0x5741,
ebml->debug ? "vpxenc" : "vpxenc" VERSION_STRING);
Ebml_EndSubElement(ebml, &startInfo); Ebml_EndSubElement(ebml, &startInfo);
} }
} }
...@@ -740,6 +744,8 @@ write_webm_file_footer(EbmlGlobal *glob) ...@@ -740,6 +744,8 @@ write_webm_file_footer(EbmlGlobal *glob)
#include "args.h" #include "args.h"
static const arg_def_t debugmode = ARG_DEF("D", "debug", 0,
"Debug mode (makes output deterministic)");
static const arg_def_t outputfile = ARG_DEF("o", "output", 1, static const arg_def_t outputfile = ARG_DEF("o", "output", 1,
"Output filename"); "Output filename");
static const arg_def_t use_yv12 = ARG_DEF(NULL, "yv12", 0, static const arg_def_t use_yv12 = ARG_DEF(NULL, "yv12", 0,
...@@ -774,6 +780,7 @@ static const arg_def_t use_ivf = ARG_DEF(NULL, "ivf", 0, ...@@ -774,6 +780,7 @@ static const arg_def_t use_ivf = ARG_DEF(NULL, "ivf", 0,
"Output IVF (default is WebM)"); "Output IVF (default is WebM)");
static const arg_def_t *main_args[] = static const arg_def_t *main_args[] =
{ {
&debugmode,
&outputfile, &codecarg, &passes, &pass_arg, &fpf_name, &limit, &deadline, &outputfile, &codecarg, &passes, &pass_arg, &fpf_name, &limit, &deadline,
&best_dl, &good_dl, &rt_dl, &best_dl, &good_dl, &rt_dl,
&verbosearg, &psnrarg, &use_ivf, &framerate, &verbosearg, &psnrarg, &use_ivf, &framerate,
...@@ -1052,6 +1059,8 @@ int main(int argc, const char **argv_) ...@@ -1052,6 +1059,8 @@ int main(int argc, const char **argv_)
write_webm = 0; write_webm = 0;
else if (arg_match(&arg, &outputfile, argi)) else if (arg_match(&arg, &outputfile, argi))
out_fn = arg.val; out_fn = arg.val;
else if (arg_match(&arg, &debugmode, argi))
ebml.debug = 1;
else else
argj++; argj++;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment