* Decode pulse data; reference: table 4.7. */
| 825 | * Decode pulse data; reference: table 4.7. |
| 826 | */ |
| 827 | static int decode_pulses(Pulse *pulse, GetBitContext *gb, |
| 828 | const uint16_t *swb_offset, int num_swb) |
| 829 | { |
| 830 | int i, pulse_swb; |
| 831 | pulse->num_pulse = get_bits(gb, 2) + 1; |
| 832 | pulse_swb = get_bits(gb, 6); |
| 833 | if (pulse_swb >= num_swb) |
| 834 | return -1; |
| 835 | pulse->pos[0] = swb_offset[pulse_swb]; |
| 836 | pulse->pos[0] += get_bits(gb, 5); |
| 837 | if (pulse->pos[0] > 1023) |
| 838 | return -1; |
| 839 | pulse->amp[0] = get_bits(gb, 4); |
| 840 | for (i = 1; i < pulse->num_pulse; i++) { |
| 841 | pulse->pos[i] = get_bits(gb, 5) + pulse->pos[i - 1]; |
| 842 | if (pulse->pos[i] > 1023) |
| 843 | return -1; |
| 844 | pulse->amp[i] = get_bits(gb, 4); |
| 845 | } |
| 846 | return 0; |
| 847 | } |
| 848 | |
| 849 | /** |
| 850 | * Decode Temporal Noise Shaping data; reference: table 4.48. |
no test coverage detected