18 #include "third_party/libyuv/include/libyuv/scale.h"
23 #define VPX_CODEC_DISABLE_COMPAT 1
24 #include "./vpx_config.h"
26 #include "vpx_ports/mem_ops.h"
27 #include "vpx_ports/vpx_timer.h"
29 #if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER
33 #include "./md5_utils.h"
35 #include "./tools_common.h"
37 #include "./webmdec.h"
41 static const char *exec_name;
43 struct VpxDecInputContext {
44 struct VpxInputContext *vpx_input_ctx;
45 struct WebmInputContext *webm_ctx;
48 static const arg_def_t looparg = ARG_DEF(NULL,
"loops", 1,
49 "Number of times to decode the file");
50 static const arg_def_t codecarg = ARG_DEF(NULL,
"codec", 1,
52 static const arg_def_t use_yv12 = ARG_DEF(NULL,
"yv12", 0,
53 "Output raw YV12 frames");
54 static const arg_def_t use_i420 = ARG_DEF(NULL,
"i420", 0,
55 "Output raw I420 frames");
56 static const arg_def_t flipuvarg = ARG_DEF(NULL,
"flipuv", 0,
57 "Flip the chroma planes in the output");
58 static const arg_def_t rawvideo = ARG_DEF(NULL,
"rawvideo", 0,
59 "Output raw YUV frames");
60 static const arg_def_t noblitarg = ARG_DEF(NULL,
"noblit", 0,
61 "Don't process the decoded frames");
62 static const arg_def_t progressarg = ARG_DEF(NULL,
"progress", 0,
63 "Show progress after each frame decodes");
64 static const arg_def_t limitarg = ARG_DEF(NULL,
"limit", 1,
65 "Stop decoding after n frames");
66 static const arg_def_t skiparg = ARG_DEF(NULL,
"skip", 1,
67 "Skip the first n input frames");
68 static const arg_def_t postprocarg = ARG_DEF(NULL,
"postproc", 0,
69 "Postprocess decoded frames");
70 static const arg_def_t summaryarg = ARG_DEF(NULL,
"summary", 0,
71 "Show timing summary");
72 static const arg_def_t outputfile = ARG_DEF(
"o",
"output", 1,
73 "Output file name pattern (see below)");
74 static const arg_def_t threadsarg = ARG_DEF(
"t",
"threads", 1,
75 "Max threads to use");
76 static const arg_def_t verbosearg = ARG_DEF(
"v",
"verbose", 0,
77 "Show version string");
78 static const arg_def_t error_concealment = ARG_DEF(NULL,
"error-concealment", 0,
79 "Enable decoder error-concealment");
80 static const arg_def_t scalearg = ARG_DEF(
"S",
"scale", 0,
81 "Scale output frames uniformly");
82 static const arg_def_t continuearg =
83 ARG_DEF(
"k",
"keep-going", 0,
"(debug) Continue decoding after error");
85 static const arg_def_t fb_arg =
86 ARG_DEF(NULL,
"frame-buffers", 1,
"Number of frame buffers to use");
88 static const arg_def_t md5arg = ARG_DEF(NULL,
"md5", 0,
89 "Compute the MD5 sum of the decoded frame");
91 static const arg_def_t *all_args[] = {
92 &codecarg, &use_yv12, &use_i420, &flipuvarg, &rawvideo, &noblitarg,
93 &progressarg, &limitarg, &skiparg, &postprocarg, &summaryarg, &outputfile,
94 &threadsarg, &verbosearg, &scalearg, &fb_arg,
95 &md5arg, &error_concealment, &continuearg,
99 #if CONFIG_VP8_DECODER
100 static const arg_def_t addnoise_level = ARG_DEF(NULL,
"noise-level", 1,
101 "Enable VP8 postproc add noise");
102 static const arg_def_t deblock = ARG_DEF(NULL,
"deblock", 0,
103 "Enable VP8 deblocking");
104 static const arg_def_t demacroblock_level = ARG_DEF(NULL,
"demacroblock-level", 1,
105 "Enable VP8 demacroblocking, w/ level");
106 static const arg_def_t pp_debug_info = ARG_DEF(NULL,
"pp-debug-info", 1,
107 "Enable VP8 visible debug info");
108 static const arg_def_t pp_disp_ref_frame = ARG_DEF(NULL,
"pp-dbg-ref-frame", 1,
109 "Display only selected reference frame per macro block");
110 static const arg_def_t pp_disp_mb_modes = ARG_DEF(NULL,
"pp-dbg-mb-modes", 1,
111 "Display only selected macro block modes");
112 static const arg_def_t pp_disp_b_modes = ARG_DEF(NULL,
"pp-dbg-b-modes", 1,
113 "Display only selected block modes");
114 static const arg_def_t pp_disp_mvs = ARG_DEF(NULL,
"pp-dbg-mvs", 1,
115 "Draw only selected motion vectors");
116 static const arg_def_t mfqe = ARG_DEF(NULL,
"mfqe", 0,
117 "Enable multiframe quality enhancement");
119 static const arg_def_t *vp8_pp_args[] = {
120 &addnoise_level, &deblock, &demacroblock_level, &pp_debug_info,
121 &pp_disp_ref_frame, &pp_disp_mb_modes, &pp_disp_b_modes, &pp_disp_mvs, &mfqe,
127 FilterModeEnum mode) {
130 return I420Scale(src->
planes[VPX_PLANE_Y], src->
stride[VPX_PLANE_Y],
144 fprintf(stderr,
"Usage: %s <options> filename\n\n"
145 "Options:\n", exec_name);
146 arg_show_usage(stderr, all_args);
147 #if CONFIG_VP8_DECODER
148 fprintf(stderr,
"\nVP8 Postprocessing Options:\n");
149 arg_show_usage(stderr, vp8_pp_args);
152 "\nOutput File Patterns:\n\n"
153 " The -o argument specifies the name of the file(s) to "
154 "write to. If the\n argument does not include any escape "
155 "characters, the output will be\n written to a single file. "
156 "Otherwise, the filename will be calculated by\n expanding "
157 "the following escape characters:\n");
159 "\n\t%%w - Frame width"
160 "\n\t%%h - Frame height"
161 "\n\t%%<n> - Frame number, zero padded to <n> places (1..9)"
162 "\n\n Pattern arguments are only supported in conjunction "
163 "with the --yv12 and\n --i420 options. If the -o option is "
164 "not specified, the output will be\n directed to stdout.\n"
166 fprintf(stderr,
"\nIncluded decoders:\n\n");
168 for (i = 0; i < get_vpx_decoder_count(); ++i) {
169 const VpxInterface *
const decoder = get_vpx_decoder_by_index(i);
170 fprintf(stderr,
" %-6s - %s\n",
177 static int raw_read_frame(FILE *infile, uint8_t **buffer,
178 size_t *bytes_read,
size_t *buffer_size) {
179 char raw_hdr[RAW_FRAME_HDR_SZ];
180 size_t frame_size = 0;
182 if (fread(raw_hdr, RAW_FRAME_HDR_SZ, 1, infile) != 1) {
184 warn(
"Failed to read RAW frame size\n");
186 const size_t kCorruptFrameThreshold = 256 * 1024 * 1024;
187 const size_t kFrameTooSmallThreshold = 256 * 1024;
188 frame_size = mem_get_le32(raw_hdr);
190 if (frame_size > kCorruptFrameThreshold) {
191 warn(
"Read invalid frame size (%u)\n", (
unsigned int)frame_size);
195 if (frame_size < kFrameTooSmallThreshold) {
196 warn(
"Warning: Read invalid frame size (%u) - not a raw file?\n",
197 (
unsigned int)frame_size);
200 if (frame_size > *buffer_size) {
201 uint8_t *new_buf = realloc(*buffer, 2 * frame_size);
204 *buffer_size = 2 * frame_size;
206 warn(
"Failed to allocate compressed data buffer\n");
213 if (fread(*buffer, 1, frame_size, infile) != frame_size) {
214 warn(
"Failed to read full frame\n");
217 *bytes_read = frame_size;
223 static int read_frame(
struct VpxDecInputContext *input, uint8_t **buf,
224 size_t *bytes_in_buffer,
size_t *buffer_size) {
225 switch (input->vpx_input_ctx->file_type) {
228 return webm_read_frame(input->webm_ctx,
229 buf, bytes_in_buffer, buffer_size);
232 return raw_read_frame(input->vpx_input_ctx->file,
233 buf, bytes_in_buffer, buffer_size);
235 return ivf_read_frame(input->vpx_input_ctx->file,
236 buf, bytes_in_buffer, buffer_size);
242 static void update_image_md5(
const vpx_image_t *img,
const int planes[3],
246 for (i = 0; i < 3; ++i) {
247 const int plane = planes[i];
248 const unsigned char *buf = img->
planes[plane];
249 const int stride = img->
stride[plane];
250 const int w = vpx_img_plane_width(img, plane);
251 const int h = vpx_img_plane_height(img, plane);
253 for (y = 0; y < h; ++y) {
254 MD5Update(md5, buf, w);
260 static void write_image_file(
const vpx_image_t *img,
const int planes[3],
264 for (i = 0; i < 3; ++i) {
265 const int plane = planes[i];
266 const unsigned char *buf = img->
planes[plane];
267 const int stride = img->
stride[plane];
268 const int w = vpx_img_plane_width(img, plane);
269 const int h = vpx_img_plane_height(img, plane);
271 for (y = 0; y < h; ++y) {
272 fwrite(buf, 1, w, file);
278 int file_is_raw(
struct VpxInputContext *input) {
285 if (fread(buf, 1, 32, input->file) == 32) {
288 if (mem_get_le32(buf) < 256 * 1024 * 1024) {
289 for (i = 0; i < get_vpx_decoder_count(); ++i) {
290 const VpxInterface *
const decoder = get_vpx_decoder_by_index(i);
292 buf + 4, 32 - 4, &si)) {
294 input->fourcc = decoder->fourcc;
296 input->height = si.
h;
297 input->framerate.numerator = 30;
298 input->framerate.denominator = 1;
309 void show_progress(
int frame_in,
int frame_out, uint64_t dx_time) {
311 "%d decoded frames/%d showed frames in %"PRId64
" us (%.2f fps)\r",
312 frame_in, frame_out, dx_time,
313 (
double)frame_out * 1000000.0 / (
double)dx_time);
316 struct ExternalFrameBuffer {
322 struct ExternalFrameBufferList {
323 int num_external_frame_buffers;
324 struct ExternalFrameBuffer *ext_fb;
331 int get_vp9_frame_buffer(
void *cb_priv,
size_t min_size,
334 struct ExternalFrameBufferList *
const ext_fb_list =
335 (
struct ExternalFrameBufferList *)cb_priv;
336 if (ext_fb_list == NULL)
340 for (i = 0; i < ext_fb_list->num_external_frame_buffers; ++i) {
341 if (!ext_fb_list->ext_fb[i].in_use)
345 if (i == ext_fb_list->num_external_frame_buffers)
348 if (ext_fb_list->ext_fb[i].size < min_size) {
349 free(ext_fb_list->ext_fb[i].data);
350 ext_fb_list->ext_fb[i].data = (uint8_t *)malloc(min_size);
351 if (!ext_fb_list->ext_fb[i].data)
354 ext_fb_list->ext_fb[i].size = min_size;
357 fb->
data = ext_fb_list->ext_fb[i].data;
358 fb->
size = ext_fb_list->ext_fb[i].size;
359 ext_fb_list->ext_fb[i].in_use = 1;
362 fb->
priv = &ext_fb_list->ext_fb[i];
369 int release_vp9_frame_buffer(
void *cb_priv,
371 struct ExternalFrameBuffer *
const ext_fb =
372 (
struct ExternalFrameBuffer *)fb->
priv;
378 void generate_filename(
const char *pattern,
char *out,
size_t q_len,
379 unsigned int d_w,
unsigned int d_h,
380 unsigned int frame_in) {
381 const char *p = pattern;
385 char *next_pat = strchr(p,
'%');
394 snprintf(q, q_len - 1,
"%d", d_w);
397 snprintf(q, q_len - 1,
"%d", d_h);
400 snprintf(q, q_len - 1,
"%d", frame_in);
403 snprintf(q, q_len - 1,
"%02d", frame_in);
406 snprintf(q, q_len - 1,
"%03d", frame_in);
409 snprintf(q, q_len - 1,
"%04d", frame_in);
412 snprintf(q, q_len - 1,
"%05d", frame_in);
415 snprintf(q, q_len - 1,
"%06d", frame_in);
418 snprintf(q, q_len - 1,
"%07d", frame_in);
421 snprintf(q, q_len - 1,
"%08d", frame_in);
424 snprintf(q, q_len - 1,
"%09d", frame_in);
427 die(
"Unrecognized pattern %%%c\n", p[1]);
432 if (pat_len >= q_len - 1)
433 die(
"Output filename too long.\n");
442 copy_len = strlen(p);
444 copy_len = next_pat - p;
446 if (copy_len >= q_len - 1)
447 die(
"Output filename too long.\n");
449 memcpy(q, p, copy_len);
458 static int is_single_file(
const char *outfile_pattern) {
459 const char *p = outfile_pattern;
463 if (p && p[1] >=
'1' && p[1] <=
'9')
472 static void print_md5(
unsigned char digest[16],
const char *filename) {
475 for (i = 0; i < 16; ++i)
476 printf(
"%02x", digest[i]);
477 printf(
" %s\n", filename);
480 static FILE *open_outfile(
const char *name) {
481 if (strcmp(
"-", name) == 0) {
482 set_binary_mode(stdout);
485 FILE *file = fopen(name,
"wb");
487 fatal(
"Failed to output file %s", name);
492 int main_loop(
int argc,
const char **argv_) {
497 size_t bytes_in_buffer = 0, buffer_size = 0;
499 int frame_in = 0, frame_out = 0, flipuv = 0, noblit = 0;
500 int do_md5 = 0, progress = 0;
501 int stop_after = 0, postproc = 0, summary = 0, quiet = 1;
505 const VpxInterface *
interface = NULL;
506 const VpxInterface *fourcc_interface = NULL;
507 uint64_t dx_time = 0;
509 char **argv, **argi, **argj;
516 #if CONFIG_VP8_DECODER
518 int vp8_dbg_color_ref_frame = 0;
519 int vp8_dbg_color_mb_modes = 0;
520 int vp8_dbg_color_b_modes = 0;
521 int vp8_dbg_display_mv = 0;
523 int frames_corrupted = 0;
527 int frame_avail, got_data;
528 int num_external_frame_buffers = 0;
529 struct ExternalFrameBufferList ext_fb_list = {0, NULL};
531 const char *outfile_pattern = NULL;
532 char outfile_name[PATH_MAX] = {0};
533 FILE *outfile = NULL;
536 unsigned char md5_digest[16];
538 struct VpxDecInputContext input = {NULL, NULL};
539 struct VpxInputContext vpx_input_ctx;
541 struct WebmInputContext webm_ctx = {0};
542 input.webm_ctx = &webm_ctx;
544 input.vpx_input_ctx = &vpx_input_ctx;
547 exec_name = argv_[0];
548 argv = argv_dup(argc - 1, argv_ + 1);
550 for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step) {
551 memset(&arg, 0,
sizeof(arg));
554 if (arg_match(&arg, &codecarg, argi)) {
555 interface = get_vpx_decoder_by_name(arg.val);
557 die(
"Error: Unrecognized argument (%s) to --codec\n", arg.val);
558 }
else if (arg_match(&arg, &looparg, argi)) {
560 }
else if (arg_match(&arg, &outputfile, argi))
561 outfile_pattern = arg.val;
562 else if (arg_match(&arg, &use_yv12, argi)) {
566 }
else if (arg_match(&arg, &use_i420, argi)) {
570 }
else if (arg_match(&arg, &rawvideo, argi)) {
572 }
else if (arg_match(&arg, &flipuvarg, argi))
574 else if (arg_match(&arg, &noblitarg, argi))
576 else if (arg_match(&arg, &progressarg, argi))
578 else if (arg_match(&arg, &limitarg, argi))
579 stop_after = arg_parse_uint(&arg);
580 else if (arg_match(&arg, &skiparg, argi))
581 arg_skip = arg_parse_uint(&arg);
582 else if (arg_match(&arg, &postprocarg, argi))
584 else if (arg_match(&arg, &md5arg, argi))
586 else if (arg_match(&arg, &summaryarg, argi))
588 else if (arg_match(&arg, &threadsarg, argi))
589 cfg.
threads = arg_parse_uint(&arg);
590 else if (arg_match(&arg, &verbosearg, argi))
592 else if (arg_match(&arg, &scalearg, argi))
594 else if (arg_match(&arg, &fb_arg, argi))
595 num_external_frame_buffers = arg_parse_uint(&arg);
597 #if CONFIG_VP8_DECODER
598 else if (arg_match(&arg, &addnoise_level, argi)) {
602 }
else if (arg_match(&arg, &demacroblock_level, argi)) {
606 }
else if (arg_match(&arg, &deblock, argi)) {
609 }
else if (arg_match(&arg, &mfqe, argi)) {
612 }
else if (arg_match(&arg, &pp_debug_info, argi)) {
613 unsigned int level = arg_parse_uint(&arg);
620 }
else if (arg_match(&arg, &pp_disp_ref_frame, argi)) {
621 unsigned int flags = arg_parse_int(&arg);
624 vp8_dbg_color_ref_frame = flags;
626 }
else if (arg_match(&arg, &pp_disp_mb_modes, argi)) {
627 unsigned int flags = arg_parse_int(&arg);
630 vp8_dbg_color_mb_modes = flags;
632 }
else if (arg_match(&arg, &pp_disp_b_modes, argi)) {
633 unsigned int flags = arg_parse_int(&arg);
636 vp8_dbg_color_b_modes = flags;
638 }
else if (arg_match(&arg, &pp_disp_mvs, argi)) {
639 unsigned int flags = arg_parse_int(&arg);
642 vp8_dbg_display_mv = flags;
644 }
else if (arg_match(&arg, &error_concealment, argi)) {
646 }
else if (arg_match(&arg, &continuearg, argi)) {
656 for (argi = argv; *argi; argi++)
657 if (argi[0][0] ==
'-' && strlen(argi[0]) > 1)
658 die(
"Error: Unrecognized option %s\n", *argi);
667 infile = strcmp(fn,
"-") ? fopen(fn,
"rb") : set_binary_mode(stdin);
670 fprintf(stderr,
"Failed to open file '%s'", strcmp(fn,
"-") ? fn :
"stdin");
673 #if CONFIG_OS_SUPPORT
675 if (!outfile_pattern && isatty(fileno(stdout)) && !do_md5 && !noblit) {
677 "Not dumping raw video to your terminal. Use '-o -' to "
682 input.vpx_input_ctx->file = infile;
683 if (file_is_ivf(input.vpx_input_ctx))
684 input.vpx_input_ctx->file_type = FILE_TYPE_IVF;
686 else if (file_is_webm(input.webm_ctx, input.vpx_input_ctx))
687 input.vpx_input_ctx->file_type = FILE_TYPE_WEBM;
689 else if (file_is_raw(input.vpx_input_ctx))
690 input.vpx_input_ctx->file_type = FILE_TYPE_RAW;
692 fprintf(stderr,
"Unrecognized input file type.\n");
694 fprintf(stderr,
"vpxdec was built without WebM container support.\n");
699 outfile_pattern = outfile_pattern ? outfile_pattern :
"-";
700 single_file = is_single_file(outfile_pattern);
702 if (!noblit && single_file) {
703 generate_filename(outfile_pattern, outfile_name, PATH_MAX,
704 vpx_input_ctx.width, vpx_input_ctx.height, 0);
708 outfile = open_outfile(outfile_name);
711 if (use_y4m && !noblit) {
713 fprintf(stderr,
"YUV4MPEG2 not supported with output patterns,"
714 " try --i420 or --yv12.\n");
719 if (vpx_input_ctx.file_type == FILE_TYPE_WEBM) {
720 if (webm_guess_framerate(input.webm_ctx, input.vpx_input_ctx)) {
721 fprintf(stderr,
"Failed to guess framerate -- error parsing "
729 fourcc_interface = get_vpx_decoder_by_fourcc(vpx_input_ctx.fourcc);
730 if (interface && fourcc_interface && interface != fourcc_interface)
731 warn(
"Header indicates codec: %s\n", fourcc_interface->name);
733 interface = fourcc_interface;
736 interface = get_vpx_decoder_by_index(0);
739 (ec_enabled ? VPX_CODEC_USE_ERROR_CONCEALMENT : 0);
742 fprintf(stderr,
"Failed to initialize decoder: %s\n",
748 fprintf(stderr,
"%s\n", decoder.
name);
750 #if CONFIG_VP8_DECODER
754 fprintf(stderr,
"Failed to configure postproc: %s\n",
vpx_codec_error(&decoder));
758 if (vp8_dbg_color_ref_frame
760 fprintf(stderr,
"Failed to configure reference block visualizer: %s\n",
vpx_codec_error(&decoder));
764 if (vp8_dbg_color_mb_modes
766 fprintf(stderr,
"Failed to configure macro block visualizer: %s\n",
vpx_codec_error(&decoder));
770 if (vp8_dbg_color_b_modes
772 fprintf(stderr,
"Failed to configure block visualizer: %s\n",
vpx_codec_error(&decoder));
776 if (vp8_dbg_display_mv
778 fprintf(stderr,
"Failed to configure motion vector visualizer: %s\n",
vpx_codec_error(&decoder));
785 fprintf(stderr,
"Skipping first %d frames.\n", arg_skip);
787 if (read_frame(&input, &buf, &bytes_in_buffer, &buffer_size))
792 if (num_external_frame_buffers > 0) {
793 ext_fb_list.num_external_frame_buffers = num_external_frame_buffers;
794 ext_fb_list.ext_fb = (
struct ExternalFrameBuffer *)calloc(
795 num_external_frame_buffers,
sizeof(*ext_fb_list.ext_fb));
797 &decoder, get_vp9_frame_buffer, release_vp9_frame_buffer,
799 fprintf(stderr,
"Failed to configure external frame buffers: %s\n",
809 while (frame_avail || got_data) {
812 struct vpx_usec_timer timer;
816 if (!stop_after || frame_in < stop_after) {
817 if (!read_frame(&input, &buf, &bytes_in_buffer, &buffer_size)) {
821 vpx_usec_timer_start(&timer);
826 warn(
"Failed to decode frame %d: %s",
830 warn(
"Additional information: %s", detail);
835 vpx_usec_timer_mark(&timer);
836 dx_time += vpx_usec_timer_elapsed(&timer);
840 vpx_usec_timer_start(&timer);
848 vpx_usec_timer_mark(&timer);
849 dx_time += (
unsigned int)vpx_usec_timer_elapsed(&timer);
855 frames_corrupted += corrupted;
858 show_progress(frame_in, frame_out, dx_time);
860 if (!noblit && img) {
863 const int *planes = flipuv ? PLANES_YVU : PLANES_YUV;
866 if (frame_out == 1) {
872 int display_width = vpx_input_ctx.width;
873 int display_height = vpx_input_ctx.height;
874 if (!display_width || !display_height) {
879 display_width = img->
d_w;
880 display_height = img->
d_h;
882 display_width = display_size[0];
883 display_height = display_size[1];
891 if (img->
d_w != scaled_img->
d_w || img->
d_h != scaled_img->
d_h) {
893 vpx_image_scale(img, scaled_img, kFilterBox);
896 fprintf(stderr,
"Failed to scale output frame: %s.\n"
897 "Scaling is disabled in this configuration. "
898 "To enable scaling, configure with --enable-libyuv\n",
907 char buf[Y4M_BUFFER_SIZE] = {0};
909 if (frame_out == 1) {
911 len = y4m_write_file_header(buf,
sizeof(buf),
913 vpx_input_ctx.height,
914 &vpx_input_ctx.framerate,
917 MD5Update(&md5_ctx, (md5byte *)buf, (
unsigned int)len);
924 len = y4m_write_frame_header(buf,
sizeof(buf));
926 MD5Update(&md5_ctx, (md5byte *)buf, (
unsigned int)len);
931 if (frame_out == 1) {
937 fprintf(stderr,
"Cannot produce i420 output for bit-stream.\n");
944 fprintf(stderr,
"Cannot produce yv12 output for bit-stream.\n");
952 update_image_md5(img, planes, &md5_ctx);
954 write_image_file(img, planes, outfile);
957 generate_filename(outfile_pattern, outfile_name, PATH_MAX,
958 img->
d_w, img->
d_h, frame_in);
961 update_image_md5(img, planes, &md5_ctx);
962 MD5Final(md5_digest, &md5_ctx);
963 print_md5(md5_digest, outfile_name);
965 outfile = open_outfile(outfile_name);
966 write_image_file(img, planes, outfile);
972 if (stop_after && frame_in >= stop_after)
976 if (summary || progress) {
977 show_progress(frame_in, frame_out, dx_time);
978 fprintf(stderr,
"\n");
981 if (frames_corrupted)
982 fprintf(stderr,
"WARNING: %d frames corrupted.\n", frames_corrupted);
987 fprintf(stderr,
"Failed to destroy decoder: %s\n",
992 if (!noblit && single_file) {
994 MD5Final(md5_digest, &md5_ctx);
995 print_md5(md5_digest, outfile_name);
1002 if (input.vpx_input_ctx->file_type == FILE_TYPE_WEBM)
1003 webm_free(input.webm_ctx);
1006 if (input.vpx_input_ctx->file_type != FILE_TYPE_WEBM)
1011 for (i = 0; i < ext_fb_list.num_external_frame_buffers; ++i) {
1012 free(ext_fb_list.ext_fb[i].data);
1014 free(ext_fb_list.ext_fb);
1019 return frames_corrupted ? EXIT_FAILURE : EXIT_SUCCESS;
1022 int main(
int argc,
const char **argv_) {
1023 unsigned int loops = 1, i;
1024 char **argv, **argi, **argj;
1028 argv = argv_dup(argc - 1, argv_ + 1);
1029 for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step) {
1030 memset(&arg, 0,
sizeof(arg));
1033 if (arg_match(&arg, &looparg, argi)) {
1034 loops = arg_parse_uint(&arg);
1039 for (i = 0; !error && i < loops; i++)
1040 error = main_loop(argc, argv_);
Image Descriptor.
Definition: vpx_image.h:102
Describes the decoder algorithm interface to applications.
const char * vpx_codec_iface_name(vpx_codec_iface_t *iface)
Return the name for a given interface.
Definition: vpx_image.h:55
unsigned int threads
Definition: vpx_decoder.h:116
unsigned int sz
Definition: vpx_decoder.h:97
Stream properties.
Definition: vpx_decoder.h:96
int noise_level
Definition: vp8.h:88
unsigned int bit_depth
Definition: vpx_image.h:108
Provides definitions for using the VP8 algorithm within the vpx Decoder interface.
vpx_codec_err_t vpx_codec_peek_stream_info(vpx_codec_iface_t *iface, const uint8_t *data, unsigned int data_sz, vpx_codec_stream_info_t *si)
Parse stream info from a buffer.
#define VPX_PLANE_Y
Definition: vpx_image.h:120
uint8_t * data
Definition: vpx_frame_buffer.h:37
const char * name
Definition: vpx_codec.h:200
#define VPX_PLANE_V
Definition: vpx_image.h:122
vpx_image_t * vpx_img_alloc(vpx_image_t *img, vpx_img_fmt_t fmt, unsigned int d_w, unsigned int d_h, unsigned int align)
Open a descriptor, allocating storage for the underlying image.
Definition: vpx_image.h:56
unsigned int d_w
Definition: vpx_image.h:111
#define vpx_codec_dec_init(ctx, iface, cfg, flags)
Convenience macro for vpx_codec_dec_init_ver()
Definition: vpx_decoder.h:154
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.
size_t size
Definition: vpx_frame_buffer.h:38
int stride[4]
Definition: vpx_image.h:132
void vpx_img_free(vpx_image_t *img)
Close an image descriptor.
vpx_img_fmt_t fmt
Definition: vpx_image.h:103
unsigned char * planes[4]
Definition: vpx_image.h:131
#define VPX_CODEC_USE_POSTPROC
Definition: vpx_decoder.h:77
const char * vpx_codec_error_detail(vpx_codec_ctx_t *ctx)
Retrieve detailed error information for codec context.
void * priv
Definition: vpx_frame_buffer.h:39
#define VPX_PLANE_U
Definition: vpx_image.h:121
int deblocking_level
Definition: vp8.h:87
unsigned int w
Definition: vpx_decoder.h:98
Definition: vpx_image.h:62
External frame buffer.
Definition: vpx_frame_buffer.h:36
#define vpx_codec_control(ctx, id, data)
vpx_codec_control wrapper macro
Definition: vpx_codec.h:405
vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx)
Destroy a codec instance.
unsigned int d_h
Definition: vpx_image.h:112
post process flags
Definition: vp8.h:85
vpx_codec_err_t vpx_codec_set_frame_buffer_functions(vpx_codec_ctx_t *ctx, vpx_get_frame_buffer_cb_fn_t cb_get, vpx_release_frame_buffer_cb_fn_t cb_release, void *cb_priv)
Pass in external frame buffers for the decoder to use.
unsigned int h
Definition: vpx_decoder.h:99
const char * vpx_codec_error(vpx_codec_ctx_t *ctx)
Retrieve error synopsis for codec context.
Initialization Configurations.
Definition: vpx_decoder.h:115
const void * vpx_codec_iter_t
Iterator.
Definition: vpx_codec.h:188
vpx_image_t * vpx_codec_get_frame(vpx_codec_ctx_t *ctx, vpx_codec_iter_t *iter)
Decoded frames iterator.
int post_proc_flag
Definition: vp8.h:86
Codec context structure.
Definition: vpx_codec.h:199