49#include "../tools_common.h" 
   50#include "../video_reader.h" 
   51#include "./vpx_config.h" 
   53static const char *exec_name;
 
   55void usage_exit(
void) {
 
   56  fprintf(stderr, 
"Usage: %s <infile> <outfile>\n", exec_name);
 
   60int main(
int argc, 
char **argv) {
 
   65  VpxVideoReader *reader = NULL;
 
   66  const VpxInterface *decoder = NULL;
 
   67  const VpxVideoInfo *info = NULL;
 
   71  if (argc != 3) die(
"Invalid number of arguments.");
 
   73  reader = vpx_video_reader_open(argv[1]);
 
   74  if (!reader) die(
"Failed to open %s for reading.", argv[1]);
 
   76  if (!(outfile = fopen(argv[2], 
"wb")))
 
   77    die(
"Failed to open %s for writing", argv[2]);
 
   79  info = vpx_video_reader_get_info(reader);
 
   81  decoder = get_vpx_decoder_by_fourcc(info->codec_fourcc);
 
   82  if (!decoder) die(
"Unknown input codec.");
 
   89    die(
"Postproc not supported by this decoder.");
 
   91  if (res) die(
"Failed to initialize decoder.");
 
   93  while (vpx_video_reader_read_frame(reader)) {
 
   96    size_t frame_size = 0;
 
   97    const unsigned char *frame =
 
   98        vpx_video_reader_get_frame(reader, &frame_size);
 
  102    if (frame_cnt % 30 == 1) {
 
  106        die_codec(&codec, 
"Failed to turn off postproc.");
 
  107    } 
else if (frame_cnt % 30 == 16) {
 
  111        die_codec(&codec, 
"Failed to turn on postproc.");
 
  116      die_codec(&codec, 
"Failed to decode frame");
 
  119      vpx_img_write(img, outfile);
 
  123  printf(
"Processed %d frames.\n", frame_cnt);
 
  126  printf(
"Play: ffplay -f rawvideo -pix_fmt yuv420p -s %dx%d %s\n",
 
  127         info->frame_width, info->frame_height, argv[2]);
 
  129  vpx_video_reader_close(reader);
 
vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx)
Destroy a codec instance.
const void * vpx_codec_iter_t
Iterator.
Definition vpx_codec.h:190
const char * vpx_codec_iface_name(vpx_codec_iface_t *iface)
Return the name for a given interface.
#define vpx_codec_control(ctx, id, data)
vpx_codec_control wrapper macro
Definition vpx_codec.h:407
vpx_codec_err_t
Algorithm return codes.
Definition vpx_codec.h:93
@ VPX_CODEC_INCAPABLE
Algorithm does not have required capability.
Definition vpx_codec.h:107
vpx_codec_err_t vpx_codec_decode(vpx_codec_ctx_t *ctx, const uint8_t *data, unsigned int data_sz, void *user_priv, long deadline)
Decode data.
#define VPX_CODEC_USE_POSTPROC
Initialization-time Feature Enabling.
Definition vpx_decoder.h:73
#define vpx_codec_dec_init(ctx, iface, cfg, flags)
Convenience macro for vpx_codec_dec_init_ver()
Definition vpx_decoder.h:143
vpx_image_t * vpx_codec_get_frame(vpx_codec_ctx_t *ctx, vpx_codec_iter_t *iter)
Decoded frames iterator.
@ VP8_SET_POSTPROC
Definition vp8.h:49
post process flags
Definition vp8.h:79
Codec context structure.
Definition vpx_codec.h:200
Image Descriptor.
Definition vpx_image.h:72
Provides definitions for using VP8 or VP9 within the vpx Decoder interface.
Describes the decoder algorithm interface to applications.