• Yunqing Wang's avatar
    Multiple-resolution encoder · aa7335e6
    Yunqing Wang authored
    The example encoder down-samples the input video frames a number of
    times with a down-sampling factor, and then encodes and outputs
    bitstreams with different resolutions.
    
    Support arbitrary down-sampling factor, and down-sampling factor
    can be different for each encoding level.
    
    For example, the encoder can be tested as follows.
    1. Configure with multi-resolution encoding enabled:
    ../libvpx/configure --target=x86-linux-gcc --disable-codecs
    --enable-vp8 --enable-runtime_cpu_detect --enable-debug
    --disable-install-docs --enable-error-concealment
    --enable-multi-res-encoding
    2. Run make
    3. Encode:
    If input video is 1280x720, run:
    ./vp8_multi_resolution_encoder 1280 720 input.yuv 1.ivf 2.ivf 3.ivf 1
    (output: 1.ivf(1280x720); 2.ivf(640x360); 3.ivf(320x180).
    The last parameter is set to 1/0 to show/not show PSNR.)
    4. Decode:
    ./simple_decoder 1.ivf 1.yuv
    ./simple_decoder 2.ivf 2.yuv
    ./simple_decoder 3.ivf 3.yuv
    5. View video:
    mplayer 1.yuv -demuxer rawvideo -rawvideo w=1280:h=720 -loop 0 -fps 30
    mplayer 2.yuv -demuxer rawvideo -rawvideo w=640:h=360 -loop 0 -fps 30
    mplayer 3.yuv -demuxer rawvideo -rawvideo w=320:h=180 -loop 0 -fps 30
    
    The encoding parameters can be modified in vp8_multi_resolution_encoder.c,
    for example, target bitrate, frame rate...
    
    Modified API. John helped a lot with that. Thanks!
    
    Change-Id: I03be9a51167eddf94399f92d269599fb3f3d54f5
    aa7335e6
args.h 1.46 KiB
/*
 *  Copyright (c) 2010 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 ARGS_H
#define ARGS_H
#include <stdio.h>
struct arg {
  char                 **argv;
  const char            *name;
  const char            *val;
  unsigned int           argv_step;
  const struct arg_def  *def;
struct arg_enum_list {
  const char *name;
  int         val;
#define ARG_ENUM_LIST_END {0}
typedef struct arg_def {
  const char *short_name;
  const char *long_name;
  int         has_val;
  const char *desc;
  const struct arg_enum_list *enums;
} arg_def_t;
#define ARG_DEF(s,l,v,d) {s,l,v,d, NULL}
#define ARG_DEF_ENUM(s,l,v,d,e) {s,l,v,d,e}
#define ARG_DEF_LIST_END {0}
struct arg arg_init(char **argv);
int arg_match(struct arg *arg_, const struct arg_def *def, char **argv);
const char *arg_next(struct arg *arg);
void arg_show_usage(FILE *fp, const struct arg_def *const *defs);
char **argv_dup(int argc, const char **argv);
unsigned int arg_parse_uint(const struct arg *arg);
int arg_parse_int(const struct arg *arg);
struct vpx_rational arg_parse_rational(const struct arg *arg);
int arg_parse_enum_or_int(const struct arg *arg);
#endif