Mercurial > libavcodec.hg
comparison dca.c @ 7737:d7ae1362a681 libavcodec
Get rid of the 512 sample memmove().
author | michael |
---|---|
date | Sat, 30 Aug 2008 10:41:53 +0000 |
parents | 5345b7938443 |
children | 93ba37a9098c |
comparison
equal
deleted
inserted
replaced
7736:968241bb5e88 | 7737:d7ae1362a681 |
---|---|
157 | 157 |
158 /* Subband samples history (for ADPCM) */ | 158 /* Subband samples history (for ADPCM) */ |
159 float subband_samples_hist[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][4]; | 159 float subband_samples_hist[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][4]; |
160 float subband_fir_hist[DCA_PRIM_CHANNELS_MAX][512]; | 160 float subband_fir_hist[DCA_PRIM_CHANNELS_MAX][512]; |
161 float subband_fir_noidea[DCA_PRIM_CHANNELS_MAX][32]; | 161 float subband_fir_noidea[DCA_PRIM_CHANNELS_MAX][32]; |
162 int hist_index[DCA_PRIM_CHANNELS_MAX]; | |
162 | 163 |
163 int output; ///< type of output | 164 int output; ///< type of output |
164 int bias; ///< output bias | 165 int bias; ///< output bias |
165 | 166 |
166 DECLARE_ALIGNED_16(float, samples[1536]); /* 6 * 256 = 1536, might only need 5 */ | 167 DECLARE_ALIGNED_16(float, samples[1536]); /* 6 * 256 = 1536, might only need 5 */ |
656 { | 657 { |
657 const float *prCoeff; | 658 const float *prCoeff; |
658 int i, j, k; | 659 int i, j, k; |
659 float praXin[33], *raXin = &praXin[1]; | 660 float praXin[33], *raXin = &praXin[1]; |
660 | 661 |
661 float *subband_fir_hist = s->subband_fir_hist[chans]; | 662 int hist_index= s->hist_index[chans]; |
662 float *subband_fir_hist2 = s->subband_fir_noidea[chans]; | 663 float *subband_fir_hist2 = s->subband_fir_noidea[chans]; |
663 | 664 |
664 int chindex = 0, subindex; | 665 int chindex = 0, subindex; |
665 | 666 |
666 praXin[0] = 0.0; | 667 praXin[0] = 0.0; |
671 else /* Perfect reconstruction */ | 672 else /* Perfect reconstruction */ |
672 prCoeff = fir_32bands_perfect; | 673 prCoeff = fir_32bands_perfect; |
673 | 674 |
674 /* Reconstructed channel sample index */ | 675 /* Reconstructed channel sample index */ |
675 for (subindex = 0; subindex < 8; subindex++) { | 676 for (subindex = 0; subindex < 8; subindex++) { |
677 float *subband_fir_hist = s->subband_fir_hist[chans] + hist_index; | |
676 /* Load in one sample from each subband and clear inactive subbands */ | 678 /* Load in one sample from each subband and clear inactive subbands */ |
677 for (i = 0; i < s->subband_activity[chans]; i++) | 679 for (i = 0; i < s->subband_activity[chans]; i++) |
678 raXin[i] = samples_in[i][subindex]; | 680 raXin[i] = samples_in[i][subindex]; |
679 for (; i < 32; i++) | 681 for (; i < 32; i++) |
680 raXin[i] = 0.0; | 682 raXin[i] = 0.0; |
694 | 696 |
695 /* Multiply by filter coefficients */ | 697 /* Multiply by filter coefficients */ |
696 for (k = 31, i = 0; i < 32; i++, k--){ | 698 for (k = 31, i = 0; i < 32; i++, k--){ |
697 float a= subband_fir_hist2[i]; | 699 float a= subband_fir_hist2[i]; |
698 float b= 0; | 700 float b= 0; |
699 for (j = 0; j < 512; j += 64){ | 701 for (j = 0; j < 512-hist_index; j += 64){ |
700 a += prCoeff[i+j ]*( subband_fir_hist[i+j] - subband_fir_hist[j+k]); | 702 a += prCoeff[i+j ]*( subband_fir_hist[i+j] - subband_fir_hist[j+k]); |
701 b += prCoeff[i+j+32]*(-subband_fir_hist[i+j] - subband_fir_hist[j+k]); | 703 b += prCoeff[i+j+32]*(-subband_fir_hist[i+j] - subband_fir_hist[j+k]); |
702 } | 704 } |
705 for ( ; j < 512; j += 64){ | |
706 a += prCoeff[i+j ]*( subband_fir_hist[i+j-512] - subband_fir_hist[j+k-512]); | |
707 b += prCoeff[i+j+32]*(-subband_fir_hist[i+j-512] - subband_fir_hist[j+k-512]); | |
708 } | |
703 samples_out[chindex++] = a * scale + bias; | 709 samples_out[chindex++] = a * scale + bias; |
704 subband_fir_hist2[i] = b; | 710 subband_fir_hist2[i] = b; |
705 } | 711 } |
706 | 712 |
707 /* Update working arrays */ | 713 hist_index = (hist_index-32)&511; |
708 memmove(&subband_fir_hist[32], &subband_fir_hist[0], (512 - 32) * sizeof(float)); | 714 } |
709 } | 715 s->hist_index[chans]= hist_index; |
710 } | 716 } |
711 | 717 |
712 static void lfe_interpolation_fir(int decimation_select, | 718 static void lfe_interpolation_fir(int decimation_select, |
713 int num_deci_sample, float *samples_in, | 719 int num_deci_sample, float *samples_in, |
714 float *samples_out, float scale, | 720 float *samples_out, float scale, |