ref: 65ac291f200d3fdaffabb6a1161c1b3eb442222d
parent: 5925ba08a33cafceb0a2d21ca6d30923dc58f372
parent: 49dc9cafa64d7bd4243b1efb77198dc96af2cc9f
author: Tom Finegan <tomfinegan@google.com>
date: Thu Nov 21 12:56:26 EST 2013
Merge "vpxenc: Add vpxenc.h and move/rename the global_config struct"
--- a/examples.mk
+++ b/examples.mk
@@ -37,7 +37,7 @@
vpxdec.GUID = BA5FE66F-38DD-E034-F542-B1578C5FB950
vpxdec.DESCRIPTION = Full featured decoder
UTILS-$(CONFIG_ENCODERS) += vpxenc.c
-vpxenc.SRCS += args.c args.h y4minput.c y4minput.h
+vpxenc.SRCS += args.c args.h y4minput.c y4minput.h vpxenc.h
vpxenc.SRCS += ivfdec.c ivfdec.h
vpxenc.SRCS += ivfenc.c ivfenc.h
vpxenc.SRCS += tools_common.c tools_common.h
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include "./vpxenc.h"
#include "./vpx_config.h"
#include <assert.h>
@@ -214,11 +215,7 @@
"Show encoder parameters");
static const arg_def_t psnrarg = ARG_DEF(NULL, "psnr", 0,
"Show PSNR in status line");
-enum TestDecodeFatality {
- TEST_DECODE_OFF,
- TEST_DECODE_FATAL,
- TEST_DECODE_WARN,
-};
+
static const struct arg_enum_list test_decode_enum[] = {
{"off", TEST_DECODE_OFF},
{"fatal", TEST_DECODE_FATAL},
@@ -861,30 +858,6 @@
NELEMENTS(vp9_arg_ctrl_map))
#endif
-/* Configuration elements common to all streams */
-struct global_config {
- const struct codec_item *codec;
- int passes;
- int pass;
- int usage;
- int deadline;
- int use_i420;
- int quiet;
- int verbose;
- int limit;
- int skip_frames;
- int show_psnr;
- enum TestDecodeFatality test_decode;
- int have_framerate;
- struct vpx_rational framerate;
- int out_part;
- int debug;
- int show_q_hist_buckets;
- int show_rate_hist_buckets;
- int disable_warnings;
-};
-
-
/* Per-stream configuration */
struct stream_config {
struct vpx_codec_enc_cfg cfg;
@@ -937,7 +910,7 @@
}
-static void parse_global_config(struct global_config *global, char **argv) {
+static void parse_global_config(struct VpxEncoderConfig *global, char **argv) {
char **argi, **argj;
struct arg arg;
@@ -1088,7 +1061,7 @@
y4m_input_close(&input->y4m);
}
-static struct stream_state *new_stream(struct global_config *global,
+static struct stream_state *new_stream(struct VpxEncoderConfig *global,
struct stream_state *prev) {
struct stream_state *stream;
@@ -1137,7 +1110,7 @@
}
-static int parse_stream_params(struct global_config *global,
+static int parse_stream_params(struct VpxEncoderConfig *global,
struct stream_state *stream,
char **argv) {
char **argi, **argj;
@@ -1341,8 +1314,8 @@
}
-static void set_default_kf_interval(struct stream_state *stream,
- struct global_config *global) {
+static void set_default_kf_interval(struct stream_state *stream,
+ struct VpxEncoderConfig *global) {
/* Use a max keyframe interval of 5 seconds, if none was
* specified on the command line.
*/
@@ -1354,8 +1327,8 @@
}
-static void show_stream_config(struct stream_state *stream,
- struct global_config *global,
+static void show_stream_config(struct stream_state *stream,
+ struct VpxEncoderConfig *global,
struct VpxInputContext *input) {
#define SHOW(field) \
@@ -1405,7 +1378,7 @@
static void open_output_file(struct stream_state *stream,
- struct global_config *global) {
+ struct VpxEncoderConfig *global) {
const char *fn = stream->config.out_fn;
stream->file = strcmp(fn, "-") ? fopen(fn, "wb") : set_binary_mode(stdout);
@@ -1445,9 +1418,9 @@
}
-static void setup_pass(struct stream_state *stream,
- struct global_config *global,
- int pass) {
+static void setup_pass(struct stream_state *stream,
+ struct VpxEncoderConfig *global,
+ int pass) {
if (stream->config.stats_fn) {
if (!stats_open_file(&stream->stats, stream->config.stats_fn,
pass))
@@ -1469,8 +1442,8 @@
}
-static void initialize_encoder(struct stream_state *stream,
- struct global_config *global) {
+static void initialize_encoder(struct stream_state *stream,
+ struct VpxEncoderConfig *global) {
int i;
int flags = 0;
@@ -1504,10 +1477,10 @@
}
-static void encode_frame(struct stream_state *stream,
- struct global_config *global,
- struct vpx_image *img,
- unsigned int frames_in) {
+static void encode_frame(struct stream_state *stream,
+ struct VpxEncoderConfig *global,
+ struct vpx_image *img,
+ unsigned int frames_in) {
vpx_codec_pts_t frame_start, next_frame_start;
struct vpx_codec_enc_cfg *cfg = &stream->config.cfg;
struct vpx_usec_timer timer;
@@ -1562,9 +1535,9 @@
}
-static void get_cx_data(struct stream_state *stream,
- struct global_config *global,
- int *got_data) {
+static void get_cx_data(struct stream_state *stream,
+ struct VpxEncoderConfig *global,
+ int *got_data) {
const vpx_codec_cx_pkt_t *pkt;
const struct vpx_codec_enc_cfg *cfg = &stream->config.cfg;
vpx_codec_iter_t iter = NULL;
@@ -1763,7 +1736,7 @@
return c == 'y';
}
-void check_quantizer(struct global_config* config, int min_q, int max_q) {
+void check_quantizer(struct VpxEncoderConfig* config, int min_q, int max_q) {
int check_failed = 0;
if (config->disable_warnings)
@@ -1788,7 +1761,7 @@
int frame_avail, got_data;
struct VpxInputContext input = {0};
- struct global_config global;
+ struct VpxEncoderConfig global;
struct stream_state *streams = NULL;
char **argv, **argi;
uint64_t cx_time = 0;
--- /dev/null
+++ b/vpxenc.h
@@ -1,0 +1,45 @@
+/*
+ * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+#ifndef VPXENC_H_
+#define VPXENC_H_
+
+#include "vpx/vpx_encoder.h"
+
+enum TestDecodeFatality {
+ TEST_DECODE_OFF,
+ TEST_DECODE_FATAL,
+ TEST_DECODE_WARN,
+};
+
+/* Configuration elements common to all streams. */
+struct VpxEncoderConfig {
+ const struct codec_item *codec;
+ int passes;
+ int pass;
+ int usage;
+ int deadline;
+ int use_i420;
+ int quiet;
+ int verbose;
+ int limit;
+ int skip_frames;
+ int show_psnr;
+ enum TestDecodeFatality test_decode;
+ int have_framerate;
+ struct vpx_rational framerate;
+ int out_part;
+ int debug;
+ int show_q_hist_buckets;
+ int show_rate_hist_buckets;
+ int disable_warnings;
+ int disable_warning_prompt;
+};
+
+#endif // VPXENC_H_
--
⑨