| 522 | } |
| 523 | |
| 524 | static void wav_decode(uint16_t *in, int nx, int ox, |
| 525 | int ny, int oy, uint16_t mx) |
| 526 | { |
| 527 | int w14 = (mx < (1 << 14)); |
| 528 | int n = (nx > ny) ? ny : nx; |
| 529 | int p = 1; |
| 530 | int p2; |
| 531 | |
| 532 | while (p <= n) |
| 533 | p <<= 1; |
| 534 | |
| 535 | p >>= 1; |
| 536 | p2 = p; |
| 537 | p >>= 1; |
| 538 | |
| 539 | while (p >= 1) { |
| 540 | uint16_t *py = in; |
| 541 | uint16_t *ey = in + oy * (ny - p2); |
| 542 | uint16_t i00, i01, i10, i11; |
| 543 | int oy1 = oy * p; |
| 544 | int oy2 = oy * p2; |
| 545 | int ox1 = ox * p; |
| 546 | int ox2 = ox * p2; |
| 547 | |
| 548 | for (; py <= ey; py += oy2) { |
| 549 | uint16_t *px = py; |
| 550 | uint16_t *ex = py + ox * (nx - p2); |
| 551 | |
| 552 | for (; px <= ex; px += ox2) { |
| 553 | uint16_t *p01 = px + ox1; |
| 554 | uint16_t *p10 = px + oy1; |
| 555 | uint16_t *p11 = p10 + ox1; |
| 556 | |
| 557 | if (w14) { |
| 558 | wdec14(*px, *p10, &i00, &i10); |
| 559 | wdec14(*p01, *p11, &i01, &i11); |
| 560 | wdec14(i00, i01, px, p01); |
| 561 | wdec14(i10, i11, p10, p11); |
| 562 | } else { |
| 563 | wdec16(*px, *p10, &i00, &i10); |
| 564 | wdec16(*p01, *p11, &i01, &i11); |
| 565 | wdec16(i00, i01, px, p01); |
| 566 | wdec16(i10, i11, p10, p11); |
| 567 | } |
| 568 | } |
| 569 | |
| 570 | if (nx & p) { |
| 571 | uint16_t *p10 = px + oy1; |
| 572 | |
| 573 | if (w14) |
| 574 | wdec14(*px, *p10, &i00, p10); |
| 575 | else |
| 576 | wdec16(*px, *p10, &i00, p10); |
| 577 | |
| 578 | *px = i00; |
| 579 | } |
| 580 | } |
| 581 |
no test coverage detected