18 main(
int argc,
char **argv)
29 fprintf(stderr,
"%s [YUV file 1] [YUV file 2] width height pixelcmp|blockdump (# to skip)\n", argv[0]);
33 width = atoi(argv[3]);
36 to_skip = atoi(argv[6]);
38 uint8_t *
Y[2], *
C[2][2];
43 int cwidth =
width / 2;
52 print_pixels = strstr(argv[5],
"pixelcmp") ? 1 : 0;
53 dump_blocks = strstr(argv[5],
"blockdump") ? 1 : 0;
55 for(
i = 0;
i < 2;
i++) {
57 C[0][
i] = malloc(csiz);
58 C[1][
i] = malloc(csiz);
60 fd[
i] = open(argv[1 +
i], O_RDONLY);
65 fcntl(fd[
i], F_NOCACHE, 1);
68 lseek(fd[
i], to_skip * (lsiz + 2*csiz), SEEK_SET);
74 mberrors = malloc(mb_x * mb_y);
77 memset(mberrors, 0, mb_x * mb_y);
79 printf(
"Loading frame %d\n", ++fr);
81 for(
i = 0;
i < 2;
i++) {
84 fprintf(stderr,
"Unable to read Y from file %d, exiting\n",
i + 1);
90 for(
c = 0;
c < lsiz;
c++) {
91 if(
Y[0][
c] !=
Y[1][
c]) {
95 mb = x / 16 + (y / 16) * mb_x;
98 printf(
"Luma diff 0x%02x != 0x%02x at pixel (%4d,%-4d) mb(%d,%d) #%d\n",
112 for(p = 0; p < 2; p++) {
114 for(
i = 0;
i < 2;
i++) {
115 v =
read(fd[
i],
C[p][
i], csiz);
117 fprintf(stderr,
"Unable to read %c from file %d, exiting\n",
123 for(
c = 0;
c < csiz;
c++) {
124 if(
C[p][0][
c] !=
C[p][1][
c]) {
128 mb = x / 8 + (y / 8) * mb_x;
130 mberrors[
mb] |= 2 << p;
134 printf(
"c%c diff 0x%02x != 0x%02x at pixel (%4d,%-4d) "
135 "mb(%3d,%-3d) #%d\n",
143 x / 8 + y / 8 * cwidth / 8);
148 for(
i = 0;
i < mb_x * mb_y;
i++) {
155 printf(
"MB (%3d,%-3d) %4d %d %c%c%c damaged\n",
156 x, y,
i, mberrors[
i],
157 mberrors[
i] & 1 ?
'Y' :
' ',
158 mberrors[
i] & 2 ?
'U' :
' ',
159 mberrors[
i] & 4 ?
'V' :
' ');
162 a =
Y[0] + x * 16 + y * 16 *
width;
163 b =
Y[1] + x * 16 + y * 16 *
width;
165 for(y = 0; y < 16; y++) {
167 for(x = 0; x < 16; x++)
172 for(x = 0; x < 16; x++)