39 #include "common/md5_utils.h" 
   40 #include "common/tools_common.h" 
   41 #include "common/video_reader.h" 
   43 static 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);
 
   64 static void print_md5(FILE *stream, 
unsigned char digest[16]) {
 
   67   for (i = 0; i < 16; ++i) fprintf(stream, 
"%02x", digest[i]);
 
   70 static const char *exec_name;
 
   72 void usage_exit(
void) {
 
   73   fprintf(stderr, 
"Usage: %s <infile> <outfile>\n", exec_name);
 
   77 int main(
int argc, 
char **argv) {
 
   81   AvxVideoReader *reader = NULL;
 
   82   const AvxVideoInfo *info = NULL;
 
   83   const AvxInterface *decoder = NULL;
 
   87   if (argc != 3) die(
"Invalid number of arguments.");
 
   89   reader = aom_video_reader_open(argv[1]);
 
   90   if (!reader) die(
"Failed to open %s for reading.", argv[1]);
 
   92   if (!(outfile = fopen(argv[2], 
"wb")))
 
   93     die(
"Failed to open %s for writing.", argv[2]);
 
   95   info = aom_video_reader_get_info(reader);
 
   97   decoder = get_aom_decoder_by_fourcc(info->codec_fourcc);
 
   98   if (!decoder) die(
"Unknown input codec.");
 
  103     die_codec(&codec, 
"Failed to initialize decoder");
 
  105   while (aom_video_reader_read_frame(reader)) {
 
  108     size_t frame_size = 0;
 
  109     const unsigned char *frame =
 
  110         aom_video_reader_get_frame(reader, &frame_size);
 
  112       die_codec(&codec, 
"Failed to decode frame");
 
  115       unsigned char digest[16];
 
  117       get_image_md5(img, digest);
 
  118       print_md5(outfile, digest);
 
  119       fprintf(outfile, 
"  img-%dx%d-%04d.i420\n", img->
d_w, img->
d_h,
 
  124   printf(
"Processed %d frames.\n", frame_cnt);
 
  127   aom_video_reader_close(reader);