| 2821 | } |
| 2822 | |
| 2823 | static void fill_buffer(WavPackEncodeContext *s, |
| 2824 | const int8_t *src, int32_t *dst, |
| 2825 | int nb_samples) |
| 2826 | { |
| 2827 | int i; |
| 2828 | |
| 2829 | #define COPY_SAMPLES(type, offset, shift) do { \ |
| 2830 | const type *sptr = (const type *)src; \ |
| 2831 | for (i = 0; i < nb_samples; i++) \ |
| 2832 | dst[i] = (sptr[i] - offset) >> shift; \ |
| 2833 | } while (0) |
| 2834 | |
| 2835 | switch (s->avctx->sample_fmt) { |
| 2836 | case AV_SAMPLE_FMT_U8P: |
| 2837 | COPY_SAMPLES(uint8_t, 0x80, 0); |
| 2838 | break; |
| 2839 | case AV_SAMPLE_FMT_S16P: |
| 2840 | COPY_SAMPLES(int16_t, 0, 0); |
| 2841 | break; |
| 2842 | case AV_SAMPLE_FMT_S32P: |
| 2843 | if (s->avctx->bits_per_raw_sample <= 24) { |
| 2844 | COPY_SAMPLES(int32_t, 0, 8); |
| 2845 | break; |
| 2846 | } |
| 2847 | case AV_SAMPLE_FMT_FLTP: |
| 2848 | memcpy(dst, src, nb_samples * 4); |
| 2849 | } |
| 2850 | } |
| 2851 | |
| 2852 | static void set_samplerate(WavPackEncodeContext *s) |
| 2853 | { |
no outgoing calls
no test coverage detected