Mercurial > libavcodec.hg
comparison mpegaudiodec.c @ 9602:9e7665d68111 libavcodec
mpegaudio: avoid unnecessary copy in high-precision mode
author | mru |
---|---|
date | Tue, 05 May 2009 18:44:10 +0000 |
parents | 21225d993671 |
children | 875cd15dfd74 |
comparison
equal
deleted
inserted
replaced
9601:21225d993671 | 9602:9e7665d68111 |
---|---|
844 void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, | 844 void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, |
845 MPA_INT *window, int *dither_state, | 845 MPA_INT *window, int *dither_state, |
846 OUT_INT *samples, int incr, | 846 OUT_INT *samples, int incr, |
847 int32_t sb_samples[SBLIMIT]) | 847 int32_t sb_samples[SBLIMIT]) |
848 { | 848 { |
849 int32_t tmp[32]; | |
850 register MPA_INT *synth_buf; | 849 register MPA_INT *synth_buf; |
851 register const MPA_INT *w, *w2, *p; | 850 register const MPA_INT *w, *w2, *p; |
852 int j, offset, v; | 851 int j, offset; |
853 OUT_INT *samples2; | 852 OUT_INT *samples2; |
854 #if FRAC_BITS <= 15 | 853 #if FRAC_BITS <= 15 |
854 int32_t tmp[32]; | |
855 int sum, sum2; | 855 int sum, sum2; |
856 #else | 856 #else |
857 int64_t sum, sum2; | 857 int64_t sum, sum2; |
858 #endif | 858 #endif |
859 | 859 |
860 dct32(tmp, sb_samples); | |
861 | |
862 offset = *synth_buf_offset; | 860 offset = *synth_buf_offset; |
863 synth_buf = synth_buf_ptr + offset; | 861 synth_buf = synth_buf_ptr + offset; |
864 | 862 |
863 #if FRAC_BITS <= 15 | |
864 dct32(tmp, sb_samples); | |
865 for(j=0;j<32;j++) { | 865 for(j=0;j<32;j++) { |
866 v = tmp[j]; | |
867 #if FRAC_BITS <= 15 | |
868 /* NOTE: can cause a loss in precision if very high amplitude | 866 /* NOTE: can cause a loss in precision if very high amplitude |
869 sound */ | 867 sound */ |
870 v = av_clip_int16(v); | 868 synth_buf[j] = av_clip_int16(tmp[j]); |
869 } | |
870 #else | |
871 dct32(synth_buf, sb_samples); | |
871 #endif | 872 #endif |
872 synth_buf[j] = v; | 873 |
873 } | |
874 /* copy to avoid wrap */ | 874 /* copy to avoid wrap */ |
875 memcpy(synth_buf + 512, synth_buf, 32 * sizeof(MPA_INT)); | 875 memcpy(synth_buf + 512, synth_buf, 32 * sizeof(MPA_INT)); |
876 | 876 |
877 samples2 = samples + 31 * incr; | 877 samples2 = samples + 31 * incr; |
878 w = window; | 878 w = window; |