| 769 | } |
| 770 | |
| 771 | static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb, |
| 772 | void *dst_l, void *dst_r, const int type) |
| 773 | { |
| 774 | int i, j, count = 0; |
| 775 | int last, t; |
| 776 | int A, B, L, L2, R, R2; |
| 777 | int pos = 0; |
| 778 | uint32_t crc = 0xFFFFFFFF; |
| 779 | uint32_t crc_extra_bits = 0xFFFFFFFF; |
| 780 | int16_t *dst16_l = dst_l; |
| 781 | int16_t *dst16_r = dst_r; |
| 782 | int32_t *dst32_l = dst_l; |
| 783 | int32_t *dst32_r = dst_r; |
| 784 | float *dstfl_l = dst_l; |
| 785 | float *dstfl_r = dst_r; |
| 786 | |
| 787 | s->one = s->zero = s->zeroes = 0; |
| 788 | do { |
| 789 | L = wv_get_value(s, gb, 0, &last); |
| 790 | if (last) |
| 791 | break; |
| 792 | R = wv_get_value(s, gb, 1, &last); |
| 793 | if (last) |
| 794 | break; |
| 795 | for (i = 0; i < s->terms; i++) { |
| 796 | Decorr *decorr = &s->decorr[i]; |
| 797 | |
| 798 | t = decorr->value; |
| 799 | if (t > 0) { |
| 800 | if (t > 8) { |
| 801 | if (t & 1) { |
| 802 | A = 2U * decorr->samplesA[0] - decorr->samplesA[1]; |
| 803 | B = 2U * decorr->samplesB[0] - decorr->samplesB[1]; |
| 804 | } else { |
| 805 | A = (int)(3U * decorr->samplesA[0] - decorr->samplesA[1]) >> 1; |
| 806 | B = (int)(3U * decorr->samplesB[0] - decorr->samplesB[1]) >> 1; |
| 807 | } |
| 808 | decorr->samplesA[1] = decorr->samplesA[0]; |
| 809 | decorr->samplesB[1] = decorr->samplesB[0]; |
| 810 | j = 0; |
| 811 | } else { |
| 812 | A = decorr->samplesA[pos]; |
| 813 | B = decorr->samplesB[pos]; |
| 814 | j = (pos + t) & 7; |
| 815 | } |
| 816 | if (type != AV_SAMPLE_FMT_S16P) { |
| 817 | L2 = L + ((decorr->weightA * (int64_t)A + 512) >> 10); |
| 818 | R2 = R + ((decorr->weightB * (int64_t)B + 512) >> 10); |
| 819 | } else { |
| 820 | L2 = L + (unsigned)((int)(decorr->weightA * (unsigned)A + 512) >> 10); |
| 821 | R2 = R + (unsigned)((int)(decorr->weightB * (unsigned)B + 512) >> 10); |
| 822 | } |
| 823 | if (A && L) |
| 824 | decorr->weightA -= ((((L ^ A) >> 30) & 2) - 1) * decorr->delta; |
| 825 | if (B && R) |
| 826 | decorr->weightB -= ((((R ^ B) >> 30) & 2) - 1) * decorr->delta; |
| 827 | decorr->samplesA[j] = L = L2; |
| 828 | decorr->samplesB[j] = R = R2; |
no test coverage detected