21 #define VPX_CODEC_DISABLE_COMPAT 1
22 #include "vpx_config.h"
24 #include "vpx_ports/vpx_timer.h"
25 #if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER
29 #include "md5_utils.h"
31 #include "tools_common.h"
32 #include "nestegg/include/nestegg/nestegg.h"
33 #include "third_party/libyuv/include/libyuv/scale.h"
38 #define snprintf _snprintf
39 #define isatty _isatty
40 #define fileno _fileno
50 static const char *exec_name;
52 #define VP8_FOURCC (0x00385056)
53 #define VP9_FOURCC (0x00395056)
58 unsigned int fourcc_mask;
60 #if CONFIG_VP8_DECODER
61 {
"vp8", vpx_codec_vp8_dx, VP8_FOURCC, 0x00FFFFFF},
63 #if CONFIG_VP9_DECODER
64 {
"vp9", vpx_codec_vp9_dx, VP9_FOURCC, 0x00FFFFFF},
69 static const arg_def_t codecarg = ARG_DEF(NULL,
"codec", 1,
71 static const arg_def_t use_yv12 = ARG_DEF(NULL,
"yv12", 0,
72 "Output raw YV12 frames");
73 static const arg_def_t use_i420 = ARG_DEF(NULL,
"i420", 0,
74 "Output raw I420 frames");
75 static const arg_def_t flipuvarg = ARG_DEF(NULL,
"flipuv", 0,
76 "Flip the chroma planes in the output");
77 static const arg_def_t noblitarg = ARG_DEF(NULL,
"noblit", 0,
78 "Don't process the decoded frames");
79 static const arg_def_t progressarg = ARG_DEF(NULL,
"progress", 0,
80 "Show progress after each frame decodes");
81 static const arg_def_t limitarg = ARG_DEF(NULL,
"limit", 1,
82 "Stop decoding after n frames");
83 static const arg_def_t skiparg = ARG_DEF(NULL,
"skip", 1,
84 "Skip the first n input frames");
85 static const arg_def_t postprocarg = ARG_DEF(NULL,
"postproc", 0,
86 "Postprocess decoded frames");
87 static const arg_def_t summaryarg = ARG_DEF(NULL,
"summary", 0,
88 "Show timing summary");
89 static const arg_def_t outputfile = ARG_DEF(
"o",
"output", 1,
90 "Output file name pattern (see below)");
91 static const arg_def_t threadsarg = ARG_DEF(
"t",
"threads", 1,
92 "Max threads to use");
93 static const arg_def_t verbosearg = ARG_DEF(
"v",
"verbose", 0,
94 "Show version string");
95 static const arg_def_t error_concealment = ARG_DEF(NULL,
"error-concealment", 0,
96 "Enable decoder error-concealment");
97 static const arg_def_t scalearg = ARG_DEF(
"S",
"scale", 0,
98 "Scale output frames uniformly");
102 static const arg_def_t md5arg = ARG_DEF(NULL,
"md5", 0,
103 "Compute the MD5 sum of the decoded frame");
105 static const arg_def_t *all_args[] = {
106 &codecarg, &use_yv12, &use_i420, &flipuvarg, &noblitarg,
107 &progressarg, &limitarg, &skiparg, &postprocarg, &summaryarg, &outputfile,
108 &threadsarg, &verbosearg, &scalearg,
116 #if CONFIG_VP8_DECODER
117 static const arg_def_t addnoise_level = ARG_DEF(NULL,
"noise-level", 1,
118 "Enable VP8 postproc add noise");
119 static const arg_def_t deblock = ARG_DEF(NULL,
"deblock", 0,
120 "Enable VP8 deblocking");
121 static const arg_def_t demacroblock_level = ARG_DEF(NULL,
"demacroblock-level", 1,
122 "Enable VP8 demacroblocking, w/ level");
123 static const arg_def_t pp_debug_info = ARG_DEF(NULL,
"pp-debug-info", 1,
124 "Enable VP8 visible debug info");
125 static const arg_def_t pp_disp_ref_frame = ARG_DEF(NULL,
"pp-dbg-ref-frame", 1,
126 "Display only selected reference frame per macro block");
127 static const arg_def_t pp_disp_mb_modes = ARG_DEF(NULL,
"pp-dbg-mb-modes", 1,
128 "Display only selected macro block modes");
129 static const arg_def_t pp_disp_b_modes = ARG_DEF(NULL,
"pp-dbg-b-modes", 1,
130 "Display only selected block modes");
131 static const arg_def_t pp_disp_mvs = ARG_DEF(NULL,
"pp-dbg-mvs", 1,
132 "Draw only selected motion vectors");
133 static const arg_def_t mfqe = ARG_DEF(NULL,
"mfqe", 0,
134 "Enable multiframe quality enhancement");
136 static const arg_def_t *vp8_pp_args[] = {
137 &addnoise_level, &deblock, &demacroblock_level, &pp_debug_info,
138 &pp_disp_ref_frame, &pp_disp_mb_modes, &pp_disp_b_modes, &pp_disp_mvs, &mfqe,
143 static void usage_exit() {
146 fprintf(stderr,
"Usage: %s <options> filename\n\n"
147 "Options:\n", exec_name);
148 arg_show_usage(stderr, all_args);
149 #if CONFIG_VP8_DECODER
150 fprintf(stderr,
"\nVP8 Postprocessing Options:\n");
151 arg_show_usage(stderr, vp8_pp_args);
154 "\nOutput File Patterns:\n\n"
155 " The -o argument specifies the name of the file(s) to "
156 "write to. If the\n argument does not include any escape "
157 "characters, the output will be\n written to a single file. "
158 "Otherwise, the filename will be calculated by\n expanding "
159 "the following escape characters:\n");
161 "\n\t%%w - Frame width"
162 "\n\t%%h - Frame height"
163 "\n\t%%<n> - Frame number, zero padded to <n> places (1..9)"
164 "\n\n Pattern arguments are only supported in conjunction "
165 "with the --yv12 and\n --i420 options. If the -o option is "
166 "not specified, the output will be\n directed to stdout.\n"
168 fprintf(stderr,
"\nIncluded decoders:\n\n");
170 for (i = 0; i <
sizeof(ifaces) /
sizeof(ifaces[0]); i++)
171 fprintf(stderr,
" %-6s - %s\n",
178 void die(
const char *fmt, ...) {
181 vfprintf(stderr, fmt, ap);
182 fprintf(stderr,
"\n");
186 static unsigned int mem_get_le16(
const void *vmem) {
188 const unsigned char *mem = (
const unsigned char *)vmem;
195 static unsigned int mem_get_le32(
const void *vmem) {
197 const unsigned char *mem = (
const unsigned char *)vmem;
215 nestegg *nestegg_ctx;
219 unsigned int video_track;
222 #define IVF_FRAME_HDR_SZ (sizeof(uint32_t) + sizeof(uint64_t))
223 #define RAW_FRAME_HDR_SZ (sizeof(uint32_t))
224 static int read_frame(
struct input_ctx *input,
227 size_t *buf_alloc_sz) {
228 char raw_hdr[IVF_FRAME_HDR_SZ];
230 FILE *infile = input->infile;
231 enum file_kind kind = input->kind;
232 if (kind == WEBM_FILE) {
233 if (input->chunk >= input->chunks) {
239 nestegg_free_packet(input->pkt);
241 if (nestegg_read_packet(input->nestegg_ctx, &input->pkt) <= 0
242 || nestegg_packet_track(input->pkt, &track))
245 }
while (track != input->video_track);
247 if (nestegg_packet_count(input->pkt, &input->chunks))
252 if (nestegg_packet_data(input->pkt, input->chunk, buf, buf_sz))
262 else if (fread(raw_hdr, kind == IVF_FILE
263 ? IVF_FRAME_HDR_SZ : RAW_FRAME_HDR_SZ, 1, infile) != 1) {
265 fprintf(stderr,
"Failed to read frame size\n");
269 new_buf_sz = mem_get_le32(raw_hdr);
271 if (new_buf_sz > 256 * 1024 * 1024) {
272 fprintf(stderr,
"Error: Read invalid frame size (%u)\n",
273 (
unsigned int)new_buf_sz);
277 if (kind == RAW_FILE && new_buf_sz > 256 * 1024)
278 fprintf(stderr,
"Warning: Read invalid frame size (%u)"
279 " - not a raw file?\n", (
unsigned int)new_buf_sz);
281 if (new_buf_sz > *buf_alloc_sz) {
282 uint8_t *new_buf = realloc(*buf, 2 * new_buf_sz);
286 *buf_alloc_sz = 2 * new_buf_sz;
288 fprintf(stderr,
"Failed to allocate compressed data buffer\n");
294 *buf_sz = new_buf_sz;
297 if (fread(*buf, 1, *buf_sz, infile) != *buf_sz) {
298 fprintf(stderr,
"Failed to read full frame\n");
308 void *out_open(
const char *out_fn,
int do_md5) {
313 MD5Context *md5_ctx = out = malloc(
sizeof(MD5Context));
318 FILE *outfile = out = strcmp(
"-", out_fn) ? fopen(out_fn,
"wb")
319 : set_binary_mode(stdout);
322 fprintf(stderr,
"Failed to output file");
330 void out_put(
void *out,
const uint8_t *buf,
unsigned int len,
int do_md5) {
333 MD5Update(out, buf, len);
336 (void) fwrite(buf, 1, len, out);
340 void out_close(
void *out,
const char *out_fn,
int do_md5) {
349 for (i = 0; i < 16; i++)
350 printf(
"%02x", md5[i]);
352 printf(
" %s\n", out_fn);
359 unsigned int file_is_ivf(FILE *infile,
360 unsigned int *fourcc,
362 unsigned int *height,
363 unsigned int *fps_den,
364 unsigned int *fps_num) {
368 if (fread(raw_hdr, 1, 32, infile) == 32) {
369 if (raw_hdr[0] ==
'D' && raw_hdr[1] ==
'K'
370 && raw_hdr[2] ==
'I' && raw_hdr[3] ==
'F') {
373 if (mem_get_le16(raw_hdr + 4) != 0)
374 fprintf(stderr,
"Error: Unrecognized IVF version! This file may not"
375 " decode properly.");
377 *fourcc = mem_get_le32(raw_hdr + 8);
378 *width = mem_get_le16(raw_hdr + 12);
379 *height = mem_get_le16(raw_hdr + 14);
380 *fps_num = mem_get_le32(raw_hdr + 16);
381 *fps_den = mem_get_le32(raw_hdr + 20);
388 if (*fps_num < 1000) {
392 if (*fps_num & 1)*fps_den <<= 1;
411 unsigned int file_is_raw(FILE *infile,
412 unsigned int *fourcc,
414 unsigned int *height,
415 unsigned int *fps_den,
416 unsigned int *fps_num) {
417 unsigned char buf[32];
423 if (fread(buf, 1, 32, infile) == 32) {
426 if (mem_get_le32(buf) < 256 * 1024 * 1024)
427 for (i = 0; i <
sizeof(ifaces) /
sizeof(ifaces[0]); i++)
429 buf + 4, 32 - 4, &si)) {
431 *fourcc = ifaces[i].fourcc;
446 nestegg_read_cb(
void *buffer,
size_t length,
void *userdata) {
449 if (fread(buffer, 1, length, f) < length) {
460 nestegg_seek_cb(int64_t offset,
int whence,
void *userdata) {
462 case NESTEGG_SEEK_SET:
465 case NESTEGG_SEEK_CUR:
468 case NESTEGG_SEEK_END:
472 return fseek(userdata, (
long)offset, whence) ? -1 : 0;
477 nestegg_tell_cb(
void *userdata) {
478 return ftell(userdata);
483 nestegg_log_cb(nestegg *context,
unsigned int severity,
char const *format,
487 va_start(ap, format);
488 vfprintf(stderr, format, ap);
489 fprintf(stderr,
"\n");
495 webm_guess_framerate(
struct input_ctx *input,
496 unsigned int *fps_den,
497 unsigned int *fps_num) {
504 for (i = 0; tstamp < 1000000000 && i < 50;) {
508 if (nestegg_read_packet(input->nestegg_ctx, &pkt) <= 0)
511 nestegg_packet_track(pkt, &track);
512 if (track == input->video_track) {
513 nestegg_packet_tstamp(pkt, &tstamp);
517 nestegg_free_packet(pkt);
520 if (nestegg_track_seek(input->nestegg_ctx, input->video_track, 0))
523 *fps_num = (i - 1) * 1000000;
524 *fps_den = (
unsigned int)(tstamp / 1000);
527 nestegg_destroy(input->nestegg_ctx);
528 input->nestegg_ctx = NULL;
529 rewind(input->infile);
535 file_is_webm(
struct input_ctx *input,
536 unsigned int *fourcc,
538 unsigned int *height,
539 unsigned int *fps_den,
540 unsigned int *fps_num) {
545 nestegg_io io = {nestegg_read_cb, nestegg_seek_cb, nestegg_tell_cb, 0};
546 nestegg_video_params params;
548 io.userdata = input->infile;
549 if (nestegg_init(&input->nestegg_ctx, io, NULL))
552 if (nestegg_track_count(input->nestegg_ctx, &n))
555 for (i = 0; i < n; i++) {
556 track_type = nestegg_track_type(input->nestegg_ctx, i);
558 if (track_type == NESTEGG_TRACK_VIDEO)
560 else if (track_type < 0)
564 codec_id = nestegg_track_codec_id(input->nestegg_ctx, i);
565 if (codec_id == NESTEGG_CODEC_VP8) {
566 *fourcc = VP8_FOURCC;
567 }
else if (codec_id == NESTEGG_CODEC_VP9) {
568 *fourcc = VP9_FOURCC;
570 fprintf(stderr,
"Not VPx video, quitting.\n");
574 input->video_track = i;
576 if (nestegg_track_video_params(input->nestegg_ctx, i, ¶ms))
581 *width = params.width;
582 *height = params.height;
585 input->nestegg_ctx = NULL;
586 rewind(input->infile);
591 void show_progress(
int frame_in,
int frame_out,
unsigned long dx_time) {
592 fprintf(stderr,
"%d decoded frames/%d showed frames in %lu us (%.2f fps)\r",
593 frame_in, frame_out, dx_time,
594 (
float)frame_out * 1000000.0 / (
float)dx_time);
598 void generate_filename(
const char *pattern,
char *out,
size_t q_len,
599 unsigned int d_w,
unsigned int d_h,
600 unsigned int frame_in) {
601 const char *p = pattern;
605 char *next_pat = strchr(p,
'%');
614 snprintf(q, q_len - 1,
"%d", d_w);
617 snprintf(q, q_len - 1,
"%d", d_h);
620 snprintf(q, q_len - 1,
"%d", frame_in);
623 snprintf(q, q_len - 1,
"%02d", frame_in);
626 snprintf(q, q_len - 1,
"%03d", frame_in);
629 snprintf(q, q_len - 1,
"%04d", frame_in);
632 snprintf(q, q_len - 1,
"%05d", frame_in);
635 snprintf(q, q_len - 1,
"%06d", frame_in);
638 snprintf(q, q_len - 1,
"%07d", frame_in);
641 snprintf(q, q_len - 1,
"%08d", frame_in);
644 snprintf(q, q_len - 1,
"%09d", frame_in);
647 die(
"Unrecognized pattern %%%c\n", p[1]);
651 if (pat_len >= q_len - 1)
652 die(
"Output filename too long.\n");
661 copy_len = strlen(p);
663 copy_len = next_pat - p;
665 if (copy_len >= q_len - 1)
666 die(
"Output filename too long.\n");
668 memcpy(q, p, copy_len);
678 int main(
int argc,
const char **argv_) {
683 size_t buf_sz = 0, buf_alloc_sz = 0;
685 int frame_in = 0, frame_out = 0, flipuv = 0, noblit = 0, do_md5 = 0, progress = 0;
686 int stop_after = 0, postproc = 0, summary = 0, quiet = 1;
691 unsigned long dx_time = 0;
693 char **argv, **argi, **argj;
694 const char *outfile_pattern = 0;
695 char outfile[PATH_MAX];
700 unsigned int fps_den;
701 unsigned int fps_num;
704 #if CONFIG_VP8_DECODER
706 int vp8_dbg_color_ref_frame = 0;
707 int vp8_dbg_color_mb_modes = 0;
708 int vp8_dbg_color_b_modes = 0;
709 int vp8_dbg_display_mv = 0;
711 struct input_ctx input = {0};
712 int frames_corrupted = 0;
715 int stream_w = 0, stream_h = 0;
719 exec_name = argv_[0];
720 argv = argv_dup(argc - 1, argv_ + 1);
722 for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step) {
723 memset(&arg, 0,
sizeof(arg));
726 if (arg_match(&arg, &codecarg, argi)) {
729 for (j = 0; j <
sizeof(ifaces) /
sizeof(ifaces[0]); j++)
730 if (!strcmp(ifaces[j].name, arg.val))
734 iface = ifaces[k].iface();
736 die(
"Error: Unrecognized argument (%s) to --codec\n",
738 }
else if (arg_match(&arg, &outputfile, argi))
739 outfile_pattern = arg.val;
740 else if (arg_match(&arg, &use_yv12, argi)) {
743 }
else if (arg_match(&arg, &use_i420, argi)) {
746 }
else if (arg_match(&arg, &flipuvarg, argi))
748 else if (arg_match(&arg, &noblitarg, argi))
750 else if (arg_match(&arg, &progressarg, argi))
752 else if (arg_match(&arg, &limitarg, argi))
753 stop_after = arg_parse_uint(&arg);
754 else if (arg_match(&arg, &skiparg, argi))
755 arg_skip = arg_parse_uint(&arg);
756 else if (arg_match(&arg, &postprocarg, argi))
758 else if (arg_match(&arg, &md5arg, argi))
760 else if (arg_match(&arg, &summaryarg, argi))
762 else if (arg_match(&arg, &threadsarg, argi))
763 cfg.
threads = arg_parse_uint(&arg);
764 else if (arg_match(&arg, &verbosearg, argi))
766 else if (arg_match(&arg, &scalearg, argi))
769 #if CONFIG_VP8_DECODER
770 else if (arg_match(&arg, &addnoise_level, argi)) {
774 }
else if (arg_match(&arg, &demacroblock_level, argi)) {
778 }
else if (arg_match(&arg, &deblock, argi)) {
781 }
else if (arg_match(&arg, &mfqe, argi)) {
784 }
else if (arg_match(&arg, &pp_debug_info, argi)) {
785 unsigned int level = arg_parse_uint(&arg);
792 }
else if (arg_match(&arg, &pp_disp_ref_frame, argi)) {
793 unsigned int flags = arg_parse_int(&arg);
796 vp8_dbg_color_ref_frame = flags;
798 }
else if (arg_match(&arg, &pp_disp_mb_modes, argi)) {
799 unsigned int flags = arg_parse_int(&arg);
802 vp8_dbg_color_mb_modes = flags;
804 }
else if (arg_match(&arg, &pp_disp_b_modes, argi)) {
805 unsigned int flags = arg_parse_int(&arg);
808 vp8_dbg_color_b_modes = flags;
810 }
else if (arg_match(&arg, &pp_disp_mvs, argi)) {
811 unsigned int flags = arg_parse_int(&arg);
814 vp8_dbg_display_mv = flags;
816 }
else if (arg_match(&arg, &error_concealment, argi)) {
826 for (argi = argv; *argi; argi++)
827 if (argi[0][0] ==
'-' && strlen(argi[0]) > 1)
828 die(
"Error: Unrecognized option %s\n", *argi);
837 infile = strcmp(fn,
"-") ? fopen(fn,
"rb") : set_binary_mode(stdin);
840 fprintf(stderr,
"Failed to open file '%s'",
841 strcmp(fn,
"-") ? fn :
"stdin");
844 #if CONFIG_OS_SUPPORT
846 if (!outfile_pattern && isatty(fileno(stdout)) && !do_md5 && !noblit) {
848 "Not dumping raw video to your terminal. Use '-o -' to "
853 input.infile = infile;
854 if (file_is_ivf(infile, &fourcc, &width, &height, &fps_den,
856 input.kind = IVF_FILE;
857 else if (file_is_webm(&input, &fourcc, &width, &height, &fps_den, &fps_num))
858 input.kind = WEBM_FILE;
859 else if (file_is_raw(infile, &fourcc, &width, &height, &fps_den, &fps_num))
860 input.kind = RAW_FILE;
862 fprintf(stderr,
"Unrecognized input file type.\n");
869 outfile_pattern = outfile_pattern ? outfile_pattern :
"-";
872 const char *p = outfile_pattern;
875 if (p && p[1] >=
'1' && p[1] <=
'9') {
885 if (single_file && !noblit) {
886 generate_filename(outfile_pattern, outfile,
sizeof(outfile) - 1,
888 out = out_open(outfile, do_md5);
891 if (use_y4m && !noblit) {
894 fprintf(stderr,
"YUV4MPEG2 not supported with output patterns,"
895 " try --i420 or --yv12.\n");
899 if (input.kind == WEBM_FILE)
900 if (webm_guess_framerate(&input, &fps_den, &fps_num)) {
901 fprintf(stderr,
"Failed to guess framerate -- error parsing "
910 sprintf(buffer,
"YUV4MPEG2 C%s W%u H%u F%u:%u I%c\n",
911 "420jpeg", width, height, fps_num, fps_den,
'p');
912 out_put(out, (
unsigned char *)buffer,
913 (
unsigned int)strlen(buffer), do_md5);
917 for (i = 0; i <
sizeof(ifaces) /
sizeof(ifaces[0]); i++)
918 if ((fourcc & ifaces[i].fourcc_mask) == ifaces[i].fourcc) {
921 if (iface && iface != ivf_iface)
922 fprintf(stderr,
"Notice -- IVF header indicates codec: %s\n",
931 (ec_enabled ? VPX_CODEC_USE_ERROR_CONCEALMENT : 0);
934 fprintf(stderr,
"Failed to initialize decoder: %s\n",
vpx_codec_error(&decoder));
939 fprintf(stderr,
"%s\n", decoder.
name);
941 #if CONFIG_VP8_DECODER
945 fprintf(stderr,
"Failed to configure postproc: %s\n",
vpx_codec_error(&decoder));
949 if (vp8_dbg_color_ref_frame
951 fprintf(stderr,
"Failed to configure reference block visualizer: %s\n",
vpx_codec_error(&decoder));
955 if (vp8_dbg_color_mb_modes
957 fprintf(stderr,
"Failed to configure macro block visualizer: %s\n",
vpx_codec_error(&decoder));
961 if (vp8_dbg_color_b_modes
963 fprintf(stderr,
"Failed to configure block visualizer: %s\n",
vpx_codec_error(&decoder));
967 if (vp8_dbg_display_mv
969 fprintf(stderr,
"Failed to configure motion vector visualizer: %s\n",
vpx_codec_error(&decoder));
976 fprintf(stderr,
"Skiping first %d frames.\n", arg_skip);
978 if (read_frame(&input, &buf, &buf_sz, &buf_alloc_sz))
984 while (!read_frame(&input, &buf, &buf_sz, &buf_alloc_sz)) {
987 struct vpx_usec_timer timer;
990 vpx_usec_timer_start(&timer);
994 fprintf(stderr,
"Failed to decode frame: %s\n",
vpx_codec_error(&decoder));
997 fprintf(stderr,
" Additional information: %s\n", detail);
1002 vpx_usec_timer_mark(&timer);
1003 dx_time += (
unsigned int)vpx_usec_timer_elapsed(&timer);
1008 fprintf(stderr,
"Failed VP8_GET_FRAME_CORRUPTED: %s\n",
1012 frames_corrupted += corrupted;
1014 vpx_usec_timer_start(&timer);
1019 vpx_usec_timer_mark(&timer);
1020 dx_time += (
unsigned int)vpx_usec_timer_elapsed(&timer);
1023 show_progress(frame_in, frame_out, dx_time);
1027 if (img && frame_out == 1) {
1028 stream_w = img->
d_w;
1029 stream_h = img->
d_h;
1031 stream_w, stream_h, 16);
1033 if (img && (img->
d_w != stream_w || img->
d_h != stream_h)) {
1034 I420Scale(img->
planes[VPX_PLANE_Y], img->
stride[VPX_PLANE_Y],
1038 scaled_img->
planes[VPX_PLANE_Y],
1039 scaled_img->
stride[VPX_PLANE_Y],
1040 scaled_img->
planes[VPX_PLANE_U],
1041 scaled_img->
stride[VPX_PLANE_U],
1052 char out_fn[PATH_MAX];
1056 size_t len =
sizeof(out_fn) - 1;
1059 generate_filename(outfile_pattern, out_fn, len - 1,
1060 img->
d_w, img->
d_h, frame_in);
1061 out = out_open(out_fn, do_md5);
1063 out_put(out, (
unsigned char *)
"FRAME\n", 6, do_md5);
1067 for (y = 0; y < img->
d_h; y++) {
1068 out_put(out, buf, img->
d_w, do_md5);
1074 for (y = 0; y < (1 + img->
d_h) / 2; y++) {
1075 out_put(out, buf, (1 + img->
d_w) / 2, do_md5);
1081 for (y = 0; y < (1 + img->
d_h) / 2; y++) {
1082 out_put(out, buf, (1 + img->
d_w) / 2, do_md5);
1087 out_close(out, out_fn, do_md5);
1091 if (stop_after && frame_in >= stop_after)
1095 if (summary || progress) {
1096 show_progress(frame_in, frame_out, dx_time);
1097 fprintf(stderr,
"\n");
1100 if (frames_corrupted)
1101 fprintf(stderr,
"WARNING: %d frames corrupted.\n", frames_corrupted);
1106 fprintf(stderr,
"Failed to destroy decoder: %s\n",
vpx_codec_error(&decoder));
1107 return EXIT_FAILURE;
1110 if (single_file && !noblit)
1111 out_close(out, outfile, do_md5);
1113 if (input.nestegg_ctx)
1114 nestegg_destroy(input.nestegg_ctx);
1115 if (input.kind != WEBM_FILE)
1120 return frames_corrupted ? EXIT_FAILURE : EXIT_SUCCESS;
struct vpx_codec_iface vpx_codec_iface_t
Codec interface structure.
Definition: vpx_codec.h:174
Image Descriptor.
Definition: vpx_image.h:97
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.
unsigned int threads
Definition: vpx_decoder.h:113
unsigned int sz
Definition: vpx_decoder.h:94
Stream properties.
Definition: vpx_decoder.h:93
int noise_level
Definition: vp8.h:83
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:114
const char * name
Definition: vpx_codec.h:201
#define VPX_PLANE_V
Definition: vpx_image.h:116
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:105
#define vpx_codec_dec_init(ctx, iface, cfg, flags)
Convenience macro for vpx_codec_dec_init_ver()
Definition: vpx_decoder.h:155
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.
int stride[4]
Definition: vpx_image.h:126
unsigned char * planes[4]
Definition: vpx_image.h:125
#define VPX_CODEC_USE_POSTPROC
Definition: vpx_decoder.h:74
const char * vpx_codec_error_detail(vpx_codec_ctx_t *ctx)
Retrieve detailed error information for codec context.
#define VPX_PLANE_U
Definition: vpx_image.h:115
int deblocking_level
Definition: vp8.h:82
unsigned int w
Definition: vpx_decoder.h:95
#define vpx_codec_control(ctx, id, data)
vpx_codec_control wrapper macro
Definition: vpx_codec.h:397
vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx)
Destroy a codec instance.
unsigned int d_h
Definition: vpx_image.h:106
post process flags
Definition: vp8.h:80
unsigned int h
Definition: vpx_decoder.h:96
const char * vpx_codec_error(vpx_codec_ctx_t *ctx)
Retrieve error synopsis for codec context.
Initialization Configurations.
Definition: vpx_decoder.h:112
const void * vpx_codec_iter_t
Iterator.
Definition: vpx_codec.h:189
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:81
Codec context structure.
Definition: vpx_codec.h:200