1 @TEMPLATE decoder_tmpl.c
2 Frame-by-frame MD5 Checksum
3 ===========================
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INTRODUCTION
5 This example builds upon the simple decoder loop to show how checksums
6 of the decoded output can be generated. These are used for validating
7 decoder implementations against the reference implementation, for example.
8 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INTRODUCTION
12 The Message-Digest 5 (MD5) is a well known hash function. We have provided
13 an implementation derived from the RSA Data Security, Inc. MD5 Message-Digest
14 Algorithm for your use. Our implmentation only changes the interface of this
15 reference code. You must include the `md5_utils.h` header for access to these
17 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EXTRA_INCLUDES
18 #include "md5_utils.h"
19 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EXTRA_INCLUDES
22 Processing The Decoded Data
23 ---------------------------
24 Each row of the image is passed to the MD5 accumulator. First the Y plane
25 is processed, then U, then V. It is important to honor the image's `stride`
27 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PROCESS_DX
28 unsigned char md5_sum[16];
34 for(plane=0; plane < 3; plane++) {
35 unsigned char *buf =img->planes[plane];
37 for(y=0; y<img->d_h >> (plane?1:0); y++) {
38 MD5Update(&md5, buf, img->d_w >> (plane?1:0));
39 buf += img->stride[plane];
43 MD5Final(md5_sum, &md5);
45 fprintf(outfile, "%02x",md5_sum[i]);
46 fprintf(outfile, " img-%dx%d-%04d.i420\n", img->d_w, img->d_h,
48 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PROCESS_DX