aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles 'Buck' Krasic <ckrasic@google.com>2014-01-06 15:18:04 -0800
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2014-01-06 15:18:04 -0800
commit11660c6b38007770a5dce844c972f57981cb0180 (patch)
treebe975453491b03c0ae833f58f3843cdbd01adf20
parenta224b0ddeded644aaa316ffaaf5e5557002de933 (diff)
parent8aa33ed6b1ae93b81652fa2e060e0cff5bd0aaa1 (diff)
downloadlibvpx-11660c6b38007770a5dce844c972f57981cb0180.tar
libvpx-11660c6b38007770a5dce844c972f57981cb0180.tar.gz
libvpx-11660c6b38007770a5dce844c972f57981cb0180.tar.bz2
libvpx-11660c6b38007770a5dce844c972f57981cb0180.zip
Merge "Write correct resolution to the IVF file header (b/11270652)"
-rw-r--r--vp9_spatial_scalable_encoder.c23
-rw-r--r--vpx/exports_enc1
2 files changed, 15 insertions, 9 deletions
diff --git a/vp9_spatial_scalable_encoder.c b/vp9_spatial_scalable_encoder.c
index a727f50d5..b637331c3 100644
--- a/vp9_spatial_scalable_encoder.c
+++ b/vp9_spatial_scalable_encoder.c
@@ -79,7 +79,9 @@ typedef struct {
struct VpxInputContext input_ctx;
} AppInput;
-void usage_exit(const char *exec_name) {
+static const char *exec_name;
+
+void usage_exit() {
fprintf(stderr, "Usage: %s <options> input_filename output_filename\n",
exec_name);
fprintf(stderr, "Options:\n");
@@ -95,12 +97,6 @@ static void die_codec(vpx_codec_ctx_t *ctx, const char *s) {
exit(EXIT_FAILURE);
}
-static int create_dummy_frame(vpx_image_t *img) {
- const size_t buf_size = img->w * img->h * 3 / 2;
- memset(img->planes[0], 129, buf_size);
- return 1;
-}
-
static void parse_command_line(int argc, const char **argv_,
AppInput *app_input, SvcContext *svc_ctx,
vpx_codec_enc_cfg_t *enc_cfg) {
@@ -170,7 +166,7 @@ static void parse_command_line(int argc, const char **argv_,
die("Error: Unrecognized option %s\n", *argi);
if (argv[0] == NULL || argv[1] == 0) {
- usage_exit(argv_[0]);
+ usage_exit();
}
app_input->input_ctx.filename = argv[0];
app_input->output_filename = argv[1];
@@ -210,6 +206,7 @@ int main(int argc, const char **argv) {
memset(&svc_ctx, 0, sizeof(svc_ctx));
svc_ctx.log_print = 1;
+ exec_name = argv[0];
parse_command_line(argc, argv, &app_input, &svc_ctx, &enc_cfg);
// Allocate image buffer
@@ -260,8 +257,16 @@ int main(int argc, const char **argv) {
fclose(app_input.input_ctx.file);
if (vpx_codec_destroy(&codec)) die_codec(&codec, "Failed to destroy codec");
- // rewrite the output file headers with the actual frame count
+ // rewrite the output file headers with the actual frame count, and
+ // resolution of the highest layer
if (!fseek(outfile, 0, SEEK_SET)) {
+ // get resolution of highest layer
+ if (VPX_CODEC_OK != vpx_svc_get_layer_resolution(&svc_ctx,
+ svc_ctx.spatial_layers - 1,
+ &enc_cfg.g_w,
+ &enc_cfg.g_h)) {
+ die("Failed to get output resolution");
+ }
ivf_write_file_header(outfile, &enc_cfg, VP9_FOURCC, frame_cnt);
}
fclose(outfile);
diff --git a/vpx/exports_enc b/vpx/exports_enc
index 1d9340c67..99b1bfacc 100644
--- a/vpx/exports_enc
+++ b/vpx/exports_enc
@@ -20,3 +20,4 @@ text vpx_svc_set_keyframe
text vpx_svc_set_options
text vpx_svc_set_quantizers
text vpx_svc_set_scale_factors
+text vpx_svc_get_layer_resolution