| 462 | } |
| 463 | |
| 464 | static void idct248_error(const char *name, |
| 465 | void (*idct248_put)(uint8_t *dest, int line_size, int16_t *block)) |
| 466 | { |
| 467 | int it, i, it1, ti, ti1, err_max, v; |
| 468 | |
| 469 | AVLFG prng; |
| 470 | |
| 471 | av_lfg_init(&prng, 1); |
| 472 | |
| 473 | /* just one test to see if code is correct (precision is less |
| 474 | important here) */ |
| 475 | err_max = 0; |
| 476 | for(it=0;it<NB_ITS;it++) { |
| 477 | |
| 478 | /* XXX: use forward transform to generate values */ |
| 479 | for(i=0;i<64;i++) |
| 480 | block1[i] = av_lfg_get(&prng) % 256 - 128; |
| 481 | block1[0] += 1024; |
| 482 | |
| 483 | for(i=0; i<64; i++) |
| 484 | block[i]= block1[i]; |
| 485 | idct248_ref(img_dest1, 8, block); |
| 486 | |
| 487 | for(i=0; i<64; i++) |
| 488 | block[i]= block1[i]; |
| 489 | idct248_put(img_dest, 8, block); |
| 490 | |
| 491 | for(i=0;i<64;i++) { |
| 492 | v = abs((int)img_dest[i] - (int)img_dest1[i]); |
| 493 | if (v == 255) |
| 494 | printf("%d %d\n", img_dest[i], img_dest1[i]); |
| 495 | if (v > err_max) |
| 496 | err_max = v; |
| 497 | } |
| 498 | #if 0 |
| 499 | printf("ref=\n"); |
| 500 | for(i=0;i<8;i++) { |
| 501 | int j; |
| 502 | for(j=0;j<8;j++) { |
| 503 | printf(" %3d", img_dest1[i*8+j]); |
| 504 | } |
| 505 | printf("\n"); |
| 506 | } |
| 507 | |
| 508 | printf("out=\n"); |
| 509 | for(i=0;i<8;i++) { |
| 510 | int j; |
| 511 | for(j=0;j<8;j++) { |
| 512 | printf(" %3d", img_dest[i*8+j]); |
| 513 | } |
| 514 | printf("\n"); |
| 515 | } |
| 516 | #endif |
| 517 | } |
| 518 | printf("%s %s: err_inf=%d\n", |
| 519 | 1 ? "IDCT248" : "DCT248", |
| 520 | name, err_max); |
| 521 |
no test coverage detected