16 main(
int argc,
char **argv)
27 fprintf(stderr,
"%s [YUV file 1] [YUV file 2] width height pixelcmp|blockdump (# to skip)\n", argv[0]);
31 width = atoi(argv[3]);
32 height = atoi(argv[4]);
34 to_skip = atoi(argv[6]);
39 int csiz = width * height / 4;
41 int cwidth = width / 2;
50 print_pixels = strstr(argv[5],
"pixelcmp") ? 1 : 0;
51 dump_blocks = strstr(argv[5],
"blockdump") ? 1 : 0;
53 for(i = 0; i < 2; i++) {
55 C[0][
i] = malloc(csiz);
56 C[1][
i] = malloc(csiz);
58 fd[
i] = open(argv[1 + i], O_RDONLY);
63 fcntl(fd[i], F_NOCACHE, 1);
66 lseek(fd[i], to_skip * (lsiz + 2*csiz), SEEK_SET);
72 mberrors = malloc(mb_x * mb_y);
75 memset(mberrors, 0, mb_x * mb_y);
77 printf(
"Loading frame %d\n", ++fr);
79 for(i = 0; i < 2; i++) {
80 v = read(fd[i], Y[i], lsiz);
82 fprintf(stderr,
"Unable to read Y from file %d, exiting\n", i + 1);
88 for(c = 0; c < lsiz; c++) {
89 if(Y[0][c] != Y[1][c]) {
93 mb = x / 16 + (y / 16) * mb_x;
96 printf(
"Luma diff 0x%02x != 0x%02x at pixel (%4d,%-4d) mb(%d,%d) #%d\n",
110 for(p = 0; p < 2; p++) {
112 for(i = 0; i < 2; i++) {
113 v = read(fd[i], C[p][i], csiz);
115 fprintf(stderr,
"Unable to read %c from file %d, exiting\n",
121 for(c = 0; c < csiz; c++) {
122 if(C[p][0][c] != C[p][1][c]) {
126 mb = x / 8 + (y / 8) * mb_x;
128 mberrors[
mb] |= 2 << p;
132 printf(
"c%c diff 0x%02x != 0x%02x at pixel (%4d,%-4d) " 133 "mb(%3d,%-3d) #%d\n",
141 x / 8 + y / 8 * cwidth / 8);
146 for(i = 0; i < mb_x * mb_y; i++) {
153 printf(
"MB (%3d,%-3d) %4d %d %c%c%c damaged\n",
154 x, y, i, mberrors[i],
155 mberrors[i] & 1 ?
'Y' :
' ',
156 mberrors[i] & 2 ?
'U' :
' ',
157 mberrors[i] & 4 ?
'V' :
' ');
160 a = Y[0] + x * 16 + y * 16 *
width;
161 b = Y[1] + x * 16 + y * 16 *
width;
163 for(y = 0; y < 16; y++) {
165 for(x = 0; x < 16; x++)
166 printf(
"%02x%c", a[x + y * width],
167 a[x + y * width] != b[x + y * width] ?
'<' :
' ');
170 for(x = 0; x < 16; x++)
171 printf(
"%02x%c", b[x + y * width],
172 a[x + y * width] != b[x + y * width] ?
'<' :
' ');
int main(int argc, char **argv)
BYTE int const BYTE int int int height
synthesis window for stochastic i
printf("static const uint8_t my_array[100] = {\n")