comparison wmadec.c @ 11451:01559518729e libavcodec

SIMD optimization using float_to_int16_interleave. Patch by Zhou Zongyi, zhouzy A os D pku D edu D cn
author cehoyos
date Tue, 09 Mar 2010 23:35:57 +0000
parents 964d01b50f17
children d5673aafc6bf
comparison
equal deleted inserted replaced
11450:95123a24a580 11451:01559518729e
788 } 788 }
789 789
790 /* convert frame to integer */ 790 /* convert frame to integer */
791 n = s->frame_len; 791 n = s->frame_len;
792 incr = s->nb_channels; 792 incr = s->nb_channels;
793 if (s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
793 for(ch = 0; ch < s->nb_channels; ch++) { 794 for(ch = 0; ch < s->nb_channels; ch++) {
794 ptr = samples + ch; 795 ptr = samples + ch;
795 iptr = s->frame_out[ch]; 796 iptr = s->frame_out[ch];
796 797
797 for(i=0;i<n;i++) { 798 for(i=0;i<n;i++) {
799 ptr += incr; 800 ptr += incr;
800 } 801 }
801 /* prepare for next block */ 802 /* prepare for next block */
802 memmove(&s->frame_out[ch][0], &s->frame_out[ch][s->frame_len], 803 memmove(&s->frame_out[ch][0], &s->frame_out[ch][s->frame_len],
803 s->frame_len * sizeof(float)); 804 s->frame_len * sizeof(float));
805 }
806 } else {
807 float *output[MAX_CHANNELS];
808 for (ch = 0; ch < MAX_CHANNELS; ch++)
809 output[ch] = s->frame_out[ch];
810 s->dsp.float_to_int16_interleave(samples, (const float **)output, n, incr);
811 for(ch = 0; ch < incr; ch++) {
812 /* prepare for next block */
813 memmove(&s->frame_out[ch][0], &s->frame_out[ch][n], n * sizeof(float));
814 }
804 } 815 }
805 816
806 #ifdef TRACE 817 #ifdef TRACE
807 dump_shorts(s, "samples", samples, n * s->nb_channels); 818 dump_shorts(s, "samples", samples, n * s->nb_channels);
808 #endif 819 #endif