summaryrefslogtreecommitdiff
path: root/vpxenc.c
diff options
context:
space:
mode:
authorJerome Jiang <jianj@google.com>2019-01-28 15:49:42 -0800
committerJerome Jiang <jianj@google.com>2019-01-30 12:47:10 -0800
commit7199f7878371c3d38e77896aa3d3bcf6c08ce764 (patch)
tree484629b45b6dfc1534f00c969a8816c9e9c34d10 /vpxenc.c
parent5e5f6db6570112cd14098408dc07e8130f345ab0 (diff)
downloadlibvpx-7199f7878371c3d38e77896aa3d3bcf6c08ce764.tar
libvpx-7199f7878371c3d38e77896aa3d3bcf6c08ce764.tar.gz
libvpx-7199f7878371c3d38e77896aa3d3bcf6c08ce764.tar.bz2
libvpx-7199f7878371c3d38e77896aa3d3bcf6c08ce764.zip
add y4m support to vp9 example encoders.
vp9_spatial_svc_encoder and vpx_temporal_svc_encoder. Change-Id: I8dfa1dfad83c83a26ddac4e7c57b5f1ff161e588
Diffstat (limited to 'vpxenc.c')
-rw-r--r--vpxenc.c85
1 files changed, 0 insertions, 85 deletions
diff --git a/vpxenc.c b/vpxenc.c
index b7841522d..a6d3d41d7 100644
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -50,12 +50,6 @@
#endif
#include "./y4minput.h"
-/* Swallow warnings about unused results of fread/fwrite */
-static size_t wrap_fread(void *ptr, size_t size, size_t nmemb, FILE *stream) {
- return fread(ptr, size, nmemb, stream);
-}
-#define fread wrap_fread
-
static size_t wrap_fwrite(const void *ptr, size_t size, size_t nmemb,
FILE *stream) {
return fwrite(ptr, size, nmemb, stream);
@@ -95,34 +89,6 @@ static void warn_or_exit_on_error(vpx_codec_ctx_t *ctx, int fatal,
va_end(ap);
}
-static int read_frame(struct VpxInputContext *input_ctx, vpx_image_t *img) {
- FILE *f = input_ctx->file;
- y4m_input *y4m = &input_ctx->y4m;
- int shortread = 0;
-
- if (input_ctx->file_type == FILE_TYPE_Y4M) {
- if (y4m_input_fetch_frame(y4m, f, img) < 1) return 0;
- } else {
- shortread = read_yuv_frame(input_ctx, img);
- }
-
- return !shortread;
-}
-
-static int file_is_y4m(const char detect[4]) {
- if (memcmp(detect, "YUV4", 4) == 0) {
- return 1;
- }
- return 0;
-}
-
-static int fourcc_is_ivf(const char detect[4]) {
- if (memcmp(detect, "DKIF", 4) == 0) {
- return 1;
- }
- return 0;
-}
-
static const arg_def_t help =
ARG_DEF(NULL, "help", 0, "Show usage options and exit");
static const arg_def_t debugmode =
@@ -1020,57 +986,6 @@ static void parse_global_config(struct VpxEncoderConfig *global, char **argv) {
}
}
-static void open_input_file(struct VpxInputContext *input) {
- /* Parse certain options from the input file, if possible */
- input->file = strcmp(input->filename, "-") ? fopen(input->filename, "rb")
- : set_binary_mode(stdin);
-
- if (!input->file) fatal("Failed to open input file");
-
- if (!fseeko(input->file, 0, SEEK_END)) {
- /* Input file is seekable. Figure out how long it is, so we can get
- * progress info.
- */
- input->length = ftello(input->file);
- rewind(input->file);
- }
-
- /* Default to 1:1 pixel aspect ratio. */
- input->pixel_aspect_ratio.numerator = 1;
- input->pixel_aspect_ratio.denominator = 1;
-
- /* For RAW input sources, these bytes will applied on the first frame
- * in read_frame().
- */
- input->detect.buf_read = fread(input->detect.buf, 1, 4, input->file);
- input->detect.position = 0;
-
- if (input->detect.buf_read == 4 && file_is_y4m(input->detect.buf)) {
- if (y4m_input_open(&input->y4m, input->file, input->detect.buf, 4,
- input->only_i420) >= 0) {
- input->file_type = FILE_TYPE_Y4M;
- input->width = input->y4m.pic_w;
- input->height = input->y4m.pic_h;
- input->pixel_aspect_ratio.numerator = input->y4m.par_n;
- input->pixel_aspect_ratio.denominator = input->y4m.par_d;
- input->framerate.numerator = input->y4m.fps_n;
- input->framerate.denominator = input->y4m.fps_d;
- input->fmt = input->y4m.vpx_fmt;
- input->bit_depth = input->y4m.bit_depth;
- } else
- fatal("Unsupported Y4M stream.");
- } else if (input->detect.buf_read == 4 && fourcc_is_ivf(input->detect.buf)) {
- fatal("IVF is not supported as input.");
- } else {
- input->file_type = FILE_TYPE_RAW;
- }
-}
-
-static void close_input_file(struct VpxInputContext *input) {
- fclose(input->file);
- if (input->file_type == FILE_TYPE_Y4M) y4m_input_close(&input->y4m);
-}
-
static struct stream_state *new_stream(struct VpxEncoderConfig *global,
struct stream_state *prev) {
struct stream_state *stream;