Mercurial > libavcodec.hg
comparison dca.c @ 10467:212a837ebd27 libavcodec
Split synth filter out of dca.c.
author | michael |
---|---|
date | Wed, 28 Oct 2009 10:51:51 +0000 |
parents | 464ea00ac79e |
children | fedf07e14bee |
comparison
equal
deleted
inserted
replaced
10466:64ffd3bcd73e | 10467:212a837ebd27 |
---|---|
35 #include "get_bits.h" | 35 #include "get_bits.h" |
36 #include "put_bits.h" | 36 #include "put_bits.h" |
37 #include "dcadata.h" | 37 #include "dcadata.h" |
38 #include "dcahuff.h" | 38 #include "dcahuff.h" |
39 #include "dca.h" | 39 #include "dca.h" |
40 #include "synth_filter.h" | |
40 | 41 |
41 //#define TRACE | 42 //#define TRACE |
42 | 43 |
43 #define DCA_PRIM_CHANNELS_MAX (5) | 44 #define DCA_PRIM_CHANNELS_MAX (5) |
44 #define DCA_SUBBANDS (32) | 45 #define DCA_SUBBANDS (32) |
751 float scale, float bias) | 752 float scale, float bias) |
752 { | 753 { |
753 const float *prCoeff; | 754 const float *prCoeff; |
754 int i, j; | 755 int i, j; |
755 | 756 |
756 int hist_index= s->hist_index[chans]; | |
757 float *subband_fir_hist2 = s->subband_fir_noidea[chans]; | |
758 | |
759 int subindex; | 757 int subindex; |
760 | 758 |
761 scale *= sqrt(1/8.0); | 759 scale *= sqrt(1/8.0); |
762 | 760 |
763 /* Select filter */ | 761 /* Select filter */ |
766 else /* Perfect reconstruction */ | 764 else /* Perfect reconstruction */ |
767 prCoeff = fir_32bands_perfect; | 765 prCoeff = fir_32bands_perfect; |
768 | 766 |
769 /* Reconstructed channel sample index */ | 767 /* Reconstructed channel sample index */ |
770 for (subindex = 0; subindex < 8; subindex++) { | 768 for (subindex = 0; subindex < 8; subindex++) { |
771 float *subband_fir_hist = s->subband_fir_hist[chans] + hist_index; | |
772 /* Load in one sample from each subband and clear inactive subbands */ | 769 /* Load in one sample from each subband and clear inactive subbands */ |
773 for (i = 0; i < s->subband_activity[chans]; i++){ | 770 for (i = 0; i < s->subband_activity[chans]; i++){ |
774 if((i-1)&2) s->raXin[i] = -samples_in[i][subindex]; | 771 if((i-1)&2) s->raXin[i] = -samples_in[i][subindex]; |
775 else s->raXin[i] = samples_in[i][subindex]; | 772 else s->raXin[i] = samples_in[i][subindex]; |
776 } | 773 } |
777 for (; i < 32; i++) | 774 for (; i < 32; i++) |
778 s->raXin[i] = 0.0; | 775 s->raXin[i] = 0.0; |
779 | 776 |
780 ff_imdct_half(&s->imdct, subband_fir_hist, s->raXin); | 777 ff_synth_filter_float(&s->imdct, |
781 | 778 s->subband_fir_hist[chans], &s->hist_index[chans], |
782 /* Multiply by filter coefficients */ | 779 s->subband_fir_noidea[chans], prCoeff, |
783 for (i = 0; i < 16; i++){ | 780 samples_out, s->raXin, scale, bias); |
784 float a= subband_fir_hist2[i ]; | |
785 float b= subband_fir_hist2[i+16]; | |
786 float c= 0; | |
787 float d= 0; | |
788 for (j = 0; j < 512-hist_index; j += 64){ | |
789 a += prCoeff[i+j ]*(-subband_fir_hist[15-i+j]); | |
790 b += prCoeff[i+j+16]*( subband_fir_hist[ i+j]); | |
791 c += prCoeff[i+j+32]*( subband_fir_hist[16+i+j]); | |
792 d += prCoeff[i+j+48]*( subband_fir_hist[31-i+j]); | |
793 } | |
794 for ( ; j < 512; j += 64){ | |
795 a += prCoeff[i+j ]*(-subband_fir_hist[15-i+j-512]); | |
796 b += prCoeff[i+j+16]*( subband_fir_hist[ i+j-512]); | |
797 c += prCoeff[i+j+32]*( subband_fir_hist[16+i+j-512]); | |
798 d += prCoeff[i+j+48]*( subband_fir_hist[31-i+j-512]); | |
799 } | |
800 samples_out[i ] = a * scale + bias; | |
801 samples_out[i+16] = b * scale + bias; | |
802 subband_fir_hist2[i ] = c; | |
803 subband_fir_hist2[i+16] = d; | |
804 } | |
805 samples_out+= 32; | 781 samples_out+= 32; |
806 | 782 |
807 hist_index = (hist_index-32)&511; | 783 } |
808 } | |
809 s->hist_index[chans]= hist_index; | |
810 } | 784 } |
811 | 785 |
812 static void lfe_interpolation_fir(int decimation_select, | 786 static void lfe_interpolation_fir(int decimation_select, |
813 int num_deci_sample, float *samples_in, | 787 int num_deci_sample, float *samples_in, |
814 float *samples_out, float scale, | 788 float *samples_out, float scale, |