comparison mpegaudiodec.c @ 2473:73afecc117a3 libavcodec

10l (didnt test code after cvs up ...)
author michael
date Sun, 30 Jan 2005 14:10:30 +0000
parents 021dc26e760f
children 7b65742a88ac
comparison
equal deleted inserted replaced
2472:021dc26e760f 2473:73afecc117a3
862 862
863 /* 32 sub band synthesis filter. Input: 32 sub band samples, Output: 863 /* 32 sub band synthesis filter. Input: 32 sub band samples, Output:
864 32 samples. */ 864 32 samples. */
865 /* XXX: optimize by avoiding ring buffer usage */ 865 /* XXX: optimize by avoiding ring buffer usage */
866 void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, 866 void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
867 MPA_INT *window, 867 MPA_INT *window, int *dither_state,
868 int16_t *samples, int incr, 868 int16_t *samples, int incr,
869 int32_t sb_samples[SBLIMIT]) 869 int32_t sb_samples[SBLIMIT])
870 { 870 {
871 int32_t tmp[32]; 871 int32_t tmp[32];
872 register MPA_INT *synth_buf; 872 register MPA_INT *synth_buf;
901 901
902 samples2 = samples + 31 * incr; 902 samples2 = samples + 31 * incr;
903 w = window; 903 w = window;
904 w2 = window + 31; 904 w2 = window + 31;
905 905
906 sum = s1->dither_state; 906 sum = *dither_state;
907 p = synth_buf + 16; 907 p = synth_buf + 16;
908 SUM8(sum, +=, w, p); 908 SUM8(sum, +=, w, p);
909 p = synth_buf + 48; 909 p = synth_buf + 48;
910 SUM8(sum, -=, w + 32, p); 910 SUM8(sum, -=, w + 32, p);
911 *samples = round_sample(&sum); 911 *samples = round_sample(&sum);
931 } 931 }
932 932
933 p = synth_buf + 32; 933 p = synth_buf + 32;
934 SUM8(sum, -=, w + 32, p); 934 SUM8(sum, -=, w + 32, p);
935 *samples = round_sample(&sum); 935 *samples = round_sample(&sum);
936 s1->dither_state= sum; 936 *dither_state= sum;
937 937
938 offset = (offset - 32) & 511; 938 offset = (offset - 32) & 511;
939 *synth_buf_offset = offset; 939 *synth_buf_offset = offset;
940 } 940 }
941 941
2492 /* apply the synthesis filter */ 2492 /* apply the synthesis filter */
2493 for(ch=0;ch<s->nb_channels;ch++) { 2493 for(ch=0;ch<s->nb_channels;ch++) {
2494 samples_ptr = samples + ch; 2494 samples_ptr = samples + ch;
2495 for(i=0;i<nb_frames;i++) { 2495 for(i=0;i<nb_frames;i++) {
2496 ff_mpa_synth_filter(s->synth_buf[ch], &(s->synth_buf_offset[ch]), 2496 ff_mpa_synth_filter(s->synth_buf[ch], &(s->synth_buf_offset[ch]),
2497 window, 2497 window, &s->dither_state,
2498 samples_ptr, s->nb_channels, 2498 samples_ptr, s->nb_channels,
2499 s->sb_samples[ch][i]); 2499 s->sb_samples[ch][i]);
2500 samples_ptr += 32 * s->nb_channels; 2500 samples_ptr += 32 * s->nb_channels;
2501 } 2501 }
2502 } 2502 }