39#include "common/md5_utils.h"
40#include "common/tools_common.h"
41#include "common/video_reader.h"
43static void get_image_md5(
const aom_image_t *img,
unsigned char digest[16]) {
49 for (plane = 0; plane < 3; ++plane) {
50 const unsigned char *buf = img->
planes[plane];
51 const int stride = img->
stride[plane];
52 const int w = plane ? (img->
d_w + 1) >> 1 : img->d_w;
53 const int h = plane ? (img->
d_h + 1) >> 1 : img->d_h;
55 for (y = 0; y < h; ++y) {
56 MD5Update(&md5, buf, w);
61 MD5Final(digest, &md5);
64static void print_md5(FILE *stream,
unsigned char digest[16]) {
67 for (i = 0; i < 16; ++i) fprintf(stream,
"%02x", digest[i]);
70static const char *exec_name;
72void usage_exit(
void) {
73 fprintf(stderr,
"Usage: %s <infile> <outfile>\n", exec_name);
77int main(
int argc,
char **argv) {
80 AvxVideoReader *reader = NULL;
81 const AvxVideoInfo *info = NULL;
85 if (argc != 3) die(
"Invalid number of arguments.");
87 reader = aom_video_reader_open(argv[1]);
88 if (!reader) die(
"Failed to open %s for reading.", argv[1]);
90 if (!(outfile = fopen(argv[2],
"wb")))
91 die(
"Failed to open %s for writing.", argv[2]);
93 info = aom_video_reader_get_info(reader);
96 if (!decoder) die(
"Unknown input codec.");
102 die(
"Failed to initialize decoder");
104 while (aom_video_reader_read_frame(reader)) {
107 size_t frame_size = 0;
108 const unsigned char *frame =
109 aom_video_reader_get_frame(reader, &frame_size);
111 die_codec(&codec,
"Failed to decode frame");
114 unsigned char digest[16];
116 get_image_md5(img, digest);
117 print_md5(outfile, digest);
118 fprintf(outfile,
" img-%ux%u-%04d.i420\n", img->
d_w, img->
d_h,
123 printf(
"Processed %d frames.\n", frame_cnt);
126 aom_video_reader_close(reader);
Describes the decoder algorithm interface to applications.
Provides definitions for using AOM or AV1 within the aom Decoder interface.
const char * aom_codec_iface_name(aom_codec_iface_t *iface)
Return the name for a given interface.
const struct aom_codec_iface aom_codec_iface_t
Codec interface structure.
Definition aom_codec.h:271
aom_codec_err_t aom_codec_destroy(aom_codec_ctx_t *ctx)
Destroy a codec instance.
const void * aom_codec_iter_t
Iterator.
Definition aom_codec.h:305
aom_image_t * aom_codec_get_frame(aom_codec_ctx_t *ctx, aom_codec_iter_t *iter)
Decoded frames iterator.
aom_codec_err_t aom_codec_decode(aom_codec_ctx_t *ctx, const uint8_t *data, size_t data_sz, void *user_priv)
Decode data.
#define aom_codec_dec_init(ctx, iface, cfg, flags)
Convenience macro for aom_codec_dec_init_ver()
Definition aom_decoder.h:129
Codec context structure.
Definition aom_codec.h:315
Image Descriptor.
Definition aom_image.h:182
int stride[3]
Definition aom_image.h:216
unsigned int d_w
Definition aom_image.h:197
unsigned int d_h
Definition aom_image.h:198
unsigned char * planes[3]
Definition aom_image.h:215