diff options
Diffstat (limited to 'media/libstagefright/codecs/amrwbenc/inc')
-rw-r--r-- | media/libstagefright/codecs/amrwbenc/inc/acelp.h | 406 | ||||
-rw-r--r-- | media/libstagefright/codecs/amrwbenc/inc/basic_op.h | 656 | ||||
-rw-r--r-- | media/libstagefright/codecs/amrwbenc/inc/bits.h | 34 | ||||
-rw-r--r-- | media/libstagefright/codecs/amrwbenc/inc/cod_main.h | 28 | ||||
-rw-r--r-- | media/libstagefright/codecs/amrwbenc/inc/dtx.h | 4 | ||||
-rw-r--r-- | media/libstagefright/codecs/amrwbenc/inc/log2.h | 18 | ||||
-rw-r--r-- | media/libstagefright/codecs/amrwbenc/inc/main.h | 4 | ||||
-rw-r--r-- | media/libstagefright/codecs/amrwbenc/inc/math_op.h | 40 | ||||
-rw-r--r-- | media/libstagefright/codecs/amrwbenc/inc/mem_align.h | 6 | ||||
-rw-r--r-- | media/libstagefright/codecs/amrwbenc/inc/p_med_o.h | 40 | ||||
-rw-r--r-- | media/libstagefright/codecs/amrwbenc/inc/q_pulse.h | 42 | ||||
-rw-r--r-- | media/libstagefright/codecs/amrwbenc/inc/stream.h | 18 | ||||
-rw-r--r-- | media/libstagefright/codecs/amrwbenc/inc/wb_vad.h | 38 | ||||
-rw-r--r-- | media/libstagefright/codecs/amrwbenc/inc/wb_vad_c.h | 4 |
14 files changed, 671 insertions, 667 deletions
diff --git a/media/libstagefright/codecs/amrwbenc/inc/acelp.h b/media/libstagefright/codecs/amrwbenc/inc/acelp.h index 5a1e536..97555d5 100644 --- a/media/libstagefright/codecs/amrwbenc/inc/acelp.h +++ b/media/libstagefright/codecs/amrwbenc/inc/acelp.h @@ -18,7 +18,7 @@ /*--------------------------------------------------------------------------* * ACELP.H * *--------------------------------------------------------------------------* - * Function * + * Function * *--------------------------------------------------------------------------*/ #ifndef __ACELP_H__ #define __ACELP_H__ @@ -33,68 +33,68 @@ Word16 median5(Word16 x[]); void Autocorr( - Word16 x[], /* (i) : Input signal */ - Word16 m, /* (i) : LPC order */ - Word16 r_h[], /* (o) : Autocorrelations (msb) */ - Word16 r_l[] /* (o) : Autocorrelations (lsb) */ - ); + Word16 x[], /* (i) : Input signal */ + Word16 m, /* (i) : LPC order */ + Word16 r_h[], /* (o) : Autocorrelations (msb) */ + Word16 r_l[] /* (o) : Autocorrelations (lsb) */ + ); void Lag_window( - Word16 r_h[], /* (i/o) : Autocorrelations (msb) */ - Word16 r_l[] /* (i/o) : Autocorrelations (lsb) */ - ); + Word16 r_h[], /* (i/o) : Autocorrelations (msb) */ + Word16 r_l[] /* (i/o) : Autocorrelations (lsb) */ + ); void Init_Levinson( - Word16 * mem /* output :static memory (18 words) */ - ); + Word16 * mem /* output :static memory (18 words) */ + ); void Levinson( - Word16 Rh[], /* (i) : Rh[M+1] Vector of autocorrelations (msb) */ - Word16 Rl[], /* (i) : Rl[M+1] Vector of autocorrelations (lsb) */ - Word16 A[], /* (o) Q12 : A[M] LPC coefficients (m = 16) */ - Word16 rc[], /* (o) Q15 : rc[M] Reflection coefficients. */ - Word16 * mem /* (i/o) :static memory (18 words) */ - ); + Word16 Rh[], /* (i) : Rh[M+1] Vector of autocorrelations (msb) */ + Word16 Rl[], /* (i) : Rl[M+1] Vector of autocorrelations (lsb) */ + Word16 A[], /* (o) Q12 : A[M] LPC coefficients (m = 16) */ + Word16 rc[], /* (o) Q15 : rc[M] Reflection coefficients. */ + Word16 * mem /* (i/o) :static memory (18 words) */ + ); void Az_isp( - Word16 a[], /* (i) Q12 : predictor coefficients */ - Word16 isp[], /* (o) Q15 : Immittance spectral pairs */ - Word16 old_isp[] /* (i) : old isp[] (in case not found M roots) */ - ); + Word16 a[], /* (i) Q12 : predictor coefficients */ + Word16 isp[], /* (o) Q15 : Immittance spectral pairs */ + Word16 old_isp[] /* (i) : old isp[] (in case not found M roots) */ + ); void Isp_Az( - Word16 isp[], /* (i) Q15 : Immittance spectral pairs */ - Word16 a[], /* (o) Q12 : predictor coefficients (order = M) */ - Word16 m, - Word16 adaptive_scaling /* (i) 0 : adaptive scaling disabled */ - /* 1 : adaptive scaling enabled */ - ); + Word16 isp[], /* (i) Q15 : Immittance spectral pairs */ + Word16 a[], /* (o) Q12 : predictor coefficients (order = M) */ + Word16 m, + Word16 adaptive_scaling /* (i) 0 : adaptive scaling disabled */ + /* 1 : adaptive scaling enabled */ + ); void Isp_isf( - Word16 isp[], /* (i) Q15 : isp[m] (range: -1<=val<1) */ - Word16 isf[], /* (o) Q15 : isf[m] normalized (range: 0.0<=val<=0.5) */ - Word16 m /* (i) : LPC order */ - ); + Word16 isp[], /* (i) Q15 : isp[m] (range: -1<=val<1) */ + Word16 isf[], /* (o) Q15 : isf[m] normalized (range: 0.0<=val<=0.5) */ + Word16 m /* (i) : LPC order */ + ); void Isf_isp( - Word16 isf[], /* (i) Q15 : isf[m] normalized (range: 0.0<=val<=0.5) */ - Word16 isp[], /* (o) Q15 : isp[m] (range: -1<=val<1) */ - Word16 m /* (i) : LPC order */ - ); + Word16 isf[], /* (i) Q15 : isf[m] normalized (range: 0.0<=val<=0.5) */ + Word16 isp[], /* (o) Q15 : isp[m] (range: -1<=val<1) */ + Word16 m /* (i) : LPC order */ + ); void Int_isp( - Word16 isp_old[], /* input : isps from past frame */ - Word16 isp_new[], /* input : isps from present frame */ - Word16 frac[], /* input : fraction for 3 first subfr (Q15) */ - Word16 Az[] /* output: LP coefficients in 4 subframes */ - ); + Word16 isp_old[], /* input : isps from past frame */ + Word16 isp_new[], /* input : isps from present frame */ + Word16 frac[], /* input : fraction for 3 first subfr (Q15) */ + Word16 Az[] /* output: LP coefficients in 4 subframes */ + ); void Weight_a( - Word16 a[], /* (i) Q12 : a[m+1] LPC coefficients */ - Word16 ap[], /* (o) Q12 : Spectral expanded LPC coefficients */ - Word16 gamma, /* (i) Q15 : Spectral expansion factor. */ - Word16 m /* (i) : LPC order. */ - ); + Word16 a[], /* (i) Q12 : a[m+1] LPC coefficients */ + Word16 ap[], /* (o) Q12 : Spectral expanded LPC coefficients */ + Word16 gamma, /* (i) Q15 : Spectral expansion factor. */ + Word16 m /* (i) : LPC order. */ + ); /*-----------------------------------------------------------------* @@ -102,214 +102,214 @@ void Weight_a( *-----------------------------------------------------------------*/ void Qpisf_2s_46b( - Word16 * isf1, /* (i) Q15 : ISF in the frequency domain (0..0.5) */ - Word16 * isf_q, /* (o) Q15 : quantized ISF (0..0.5) */ - Word16 * past_isfq, /* (io)Q15 : past ISF quantizer */ - Word16 * indice, /* (o) : quantization indices */ - Word16 nb_surv /* (i) : number of survivor (1, 2, 3 or 4) */ - ); + Word16 * isf1, /* (i) Q15 : ISF in the frequency domain (0..0.5) */ + Word16 * isf_q, /* (o) Q15 : quantized ISF (0..0.5) */ + Word16 * past_isfq, /* (io)Q15 : past ISF quantizer */ + Word16 * indice, /* (o) : quantization indices */ + Word16 nb_surv /* (i) : number of survivor (1, 2, 3 or 4) */ + ); void Qpisf_2s_36b( - Word16 * isf1, /* (i) Q15 : ISF in the frequency domain (0..0.5) */ - Word16 * isf_q, /* (o) Q15 : quantized ISF (0..0.5) */ - Word16 * past_isfq, /* (io)Q15 : past ISF quantizer */ - Word16 * indice, /* (o) : quantization indices */ - Word16 nb_surv /* (i) : number of survivor (1, 2, 3 or 4) */ - ); + Word16 * isf1, /* (i) Q15 : ISF in the frequency domain (0..0.5) */ + Word16 * isf_q, /* (o) Q15 : quantized ISF (0..0.5) */ + Word16 * past_isfq, /* (io)Q15 : past ISF quantizer */ + Word16 * indice, /* (o) : quantization indices */ + Word16 nb_surv /* (i) : number of survivor (1, 2, 3 or 4) */ + ); void Dpisf_2s_46b( - Word16 * indice, /* input: quantization indices */ - Word16 * isf_q, /* output: quantized ISF in frequency domain (0..0.5) */ - Word16 * past_isfq, /* i/0 : past ISF quantizer */ - Word16 * isfold, /* input : past quantized ISF */ - Word16 * isf_buf, /* input : isf buffer */ - Word16 bfi, /* input : Bad frame indicator */ - Word16 enc_dec - ); + Word16 * indice, /* input: quantization indices */ + Word16 * isf_q, /* output: quantized ISF in frequency domain (0..0.5) */ + Word16 * past_isfq, /* i/0 : past ISF quantizer */ + Word16 * isfold, /* input : past quantized ISF */ + Word16 * isf_buf, /* input : isf buffer */ + Word16 bfi, /* input : Bad frame indicator */ + Word16 enc_dec + ); void Dpisf_2s_36b( - Word16 * indice, /* input: quantization indices */ - Word16 * isf_q, /* output: quantized ISF in frequency domain (0..0.5) */ - Word16 * past_isfq, /* i/0 : past ISF quantizer */ - Word16 * isfold, /* input : past quantized ISF */ - Word16 * isf_buf, /* input : isf buffer */ - Word16 bfi, /* input : Bad frame indicator */ - Word16 enc_dec - ); + Word16 * indice, /* input: quantization indices */ + Word16 * isf_q, /* output: quantized ISF in frequency domain (0..0.5) */ + Word16 * past_isfq, /* i/0 : past ISF quantizer */ + Word16 * isfold, /* input : past quantized ISF */ + Word16 * isf_buf, /* input : isf buffer */ + Word16 bfi, /* input : Bad frame indicator */ + Word16 enc_dec + ); void Qisf_ns( - Word16 * isf1, /* input : ISF in the frequency domain (0..0.5) */ - Word16 * isf_q, /* output: quantized ISF */ - Word16 * indice /* output: quantization indices */ - ); + Word16 * isf1, /* input : ISF in the frequency domain (0..0.5) */ + Word16 * isf_q, /* output: quantized ISF */ + Word16 * indice /* output: quantization indices */ + ); void Disf_ns( - Word16 * indice, /* input: quantization indices */ - Word16 * isf_q /* input : ISF in the frequency domain (0..0.5) */ - ); + Word16 * indice, /* input: quantization indices */ + Word16 * isf_q /* input : ISF in the frequency domain (0..0.5) */ + ); Word16 Sub_VQ( /* output: return quantization index */ - Word16 * x, /* input : ISF residual vector */ - Word16 * dico, /* input : quantization codebook */ - Word16 dim, /* input : dimention of vector */ - Word16 dico_size, /* input : size of quantization codebook */ - Word32 * distance /* output: error of quantization */ - ); + Word16 * x, /* input : ISF residual vector */ + Word16 * dico, /* input : quantization codebook */ + Word16 dim, /* input : dimention of vector */ + Word16 dico_size, /* input : size of quantization codebook */ + Word32 * distance /* output: error of quantization */ + ); void Reorder_isf( - Word16 * isf, /* (i/o) Q15: ISF in the frequency domain (0..0.5) */ - Word16 min_dist, /* (i) Q15 : minimum distance to keep */ - Word16 n /* (i) : number of ISF */ - ); + Word16 * isf, /* (i/o) Q15: ISF in the frequency domain (0..0.5) */ + Word16 min_dist, /* (i) Q15 : minimum distance to keep */ + Word16 n /* (i) : number of ISF */ + ); /*-----------------------------------------------------------------* * filter prototypes * *-----------------------------------------------------------------*/ void Init_Decim_12k8( - Word16 mem[] /* output: memory (2*NB_COEF_DOWN) set to zeros */ - ); + Word16 mem[] /* output: memory (2*NB_COEF_DOWN) set to zeros */ + ); void Decim_12k8( - Word16 sig16k[], /* input: signal to downsampling */ - Word16 lg, /* input: length of input */ - Word16 sig12k8[], /* output: decimated signal */ - Word16 mem[] /* in/out: memory (2*NB_COEF_DOWN) */ - ); + Word16 sig16k[], /* input: signal to downsampling */ + Word16 lg, /* input: length of input */ + Word16 sig12k8[], /* output: decimated signal */ + Word16 mem[] /* in/out: memory (2*NB_COEF_DOWN) */ + ); void Init_HP50_12k8(Word16 mem[]); void HP50_12k8( - Word16 signal[], /* input/output signal */ - Word16 lg, /* lenght of signal */ - Word16 mem[] /* filter memory [6] */ - ); + Word16 signal[], /* input/output signal */ + Word16 lg, /* lenght of signal */ + Word16 mem[] /* filter memory [6] */ + ); void Init_HP400_12k8(Word16 mem[]); void HP400_12k8( - Word16 signal[], /* input/output signal */ - Word16 lg, /* lenght of signal */ - Word16 mem[] /* filter memory [6] */ - ); + Word16 signal[], /* input/output signal */ + Word16 lg, /* lenght of signal */ + Word16 mem[] /* filter memory [6] */ + ); void Init_Filt_6k_7k(Word16 mem[]); void Filt_6k_7k( - Word16 signal[], /* input: signal */ - Word16 lg, /* input: length of input */ - Word16 mem[] /* in/out: memory (size=30) */ - ); + Word16 signal[], /* input: signal */ + Word16 lg, /* input: length of input */ + Word16 mem[] /* in/out: memory (size=30) */ + ); void Filt_6k_7k_asm( - Word16 signal[], /* input: signal */ - Word16 lg, /* input: length of input */ - Word16 mem[] /* in/out: memory (size=30) */ - ); + Word16 signal[], /* input: signal */ + Word16 lg, /* input: length of input */ + Word16 mem[] /* in/out: memory (size=30) */ + ); void LP_Decim2( - Word16 x[], /* in/out: signal to process */ - Word16 l, /* input : size of filtering */ - Word16 mem[] /* in/out: memory (size=3) */ - ); + Word16 x[], /* in/out: signal to process */ + Word16 l, /* input : size of filtering */ + Word16 mem[] /* in/out: memory (size=3) */ + ); void Preemph( - Word16 x[], /* (i/o) : input signal overwritten by the output */ - Word16 mu, /* (i) Q15 : preemphasis coefficient */ - Word16 lg, /* (i) : lenght of filtering */ - Word16 * mem /* (i/o) : memory (x[-1]) */ - ); + Word16 x[], /* (i/o) : input signal overwritten by the output */ + Word16 mu, /* (i) Q15 : preemphasis coefficient */ + Word16 lg, /* (i) : lenght of filtering */ + Word16 * mem /* (i/o) : memory (x[-1]) */ + ); void Preemph2( - Word16 x[], /* (i/o) : input signal overwritten by the output */ - Word16 mu, /* (i) Q15 : preemphasis coefficient */ - Word16 lg, /* (i) : lenght of filtering */ - Word16 * mem /* (i/o) : memory (x[-1]) */ - ); + Word16 x[], /* (i/o) : input signal overwritten by the output */ + Word16 mu, /* (i) Q15 : preemphasis coefficient */ + Word16 lg, /* (i) : lenght of filtering */ + Word16 * mem /* (i/o) : memory (x[-1]) */ + ); void Deemph( - Word16 x[], /* (i/o) : input signal overwritten by the output */ - Word16 mu, /* (i) Q15 : deemphasis factor */ - Word16 L, /* (i) : vector size */ - Word16 * mem /* (i/o) : memory (y[-1]) */ - ); + Word16 x[], /* (i/o) : input signal overwritten by the output */ + Word16 mu, /* (i) Q15 : deemphasis factor */ + Word16 L, /* (i) : vector size */ + Word16 * mem /* (i/o) : memory (y[-1]) */ + ); void Deemph2( - Word16 x[], /* (i/o) : input signal overwritten by the output */ - Word16 mu, /* (i) Q15 : deemphasis factor */ - Word16 L, /* (i) : vector size */ - Word16 * mem /* (i/o) : memory (y[-1]) */ - ); + Word16 x[], /* (i/o) : input signal overwritten by the output */ + Word16 mu, /* (i) Q15 : deemphasis factor */ + Word16 L, /* (i) : vector size */ + Word16 * mem /* (i/o) : memory (y[-1]) */ + ); void Deemph_32( - Word16 x_hi[], /* (i) : input signal (bit31..16) */ - Word16 x_lo[], /* (i) : input signal (bit15..4) */ - Word16 y[], /* (o) : output signal (x16) */ - Word16 mu, /* (i) Q15 : deemphasis factor */ - Word16 L, /* (i) : vector size */ - Word16 * mem /* (i/o) : memory (y[-1]) */ - ); + Word16 x_hi[], /* (i) : input signal (bit31..16) */ + Word16 x_lo[], /* (i) : input signal (bit15..4) */ + Word16 y[], /* (o) : output signal (x16) */ + Word16 mu, /* (i) Q15 : deemphasis factor */ + Word16 L, /* (i) : vector size */ + Word16 * mem /* (i/o) : memory (y[-1]) */ + ); void Deemph_32_asm( - Word16 x_hi[], /* (i) : input signal (bit31..16) */ - Word16 x_lo[], /* (i) : input signal (bit15..4) */ - Word16 y[], /* (o) : output signal (x16) */ - Word16 * mem /* (i/o) : memory (y[-1]) */ - ); + Word16 x_hi[], /* (i) : input signal (bit31..16) */ + Word16 x_lo[], /* (i) : input signal (bit15..4) */ + Word16 y[], /* (o) : output signal (x16) */ + Word16 * mem /* (i/o) : memory (y[-1]) */ + ); void Convolve( - Word16 x[], /* (i) : input vector */ - Word16 h[], /* (i) Q15 : impulse response */ - Word16 y[], /* (o) 12 bits: output vector */ - Word16 L /* (i) : vector size */ - ); + Word16 x[], /* (i) : input vector */ + Word16 h[], /* (i) Q15 : impulse response */ + Word16 y[], /* (o) 12 bits: output vector */ + Word16 L /* (i) : vector size */ + ); void Convolve_asm( - Word16 x[], /* (i) : input vector */ - Word16 h[], /* (i) Q15 : impulse response */ - Word16 y[], /* (o) 12 bits: output vector */ - Word16 L /* (i) : vector size */ - ); + Word16 x[], /* (i) : input vector */ + Word16 h[], /* (i) Q15 : impulse response */ + Word16 y[], /* (o) 12 bits: output vector */ + Word16 L /* (i) : vector size */ + ); void Residu( - Word16 a[], /* (i) Q12 : prediction coefficients */ - Word16 x[], /* (i) : speech (values x[-m..-1] are needed */ - Word16 y[], /* (o) : residual signal */ - Word16 lg /* (i) : size of filtering */ - ); + Word16 a[], /* (i) Q12 : prediction coefficients */ + Word16 x[], /* (i) : speech (values x[-m..-1] are needed */ + Word16 y[], /* (o) : residual signal */ + Word16 lg /* (i) : size of filtering */ + ); void Residu_opt( - Word16 a[], /* (i) Q12 : prediction coefficients */ - Word16 x[], /* (i) : speech (values x[-m..-1] are needed */ - Word16 y[], /* (o) : residual signal */ - Word16 lg /* (i) : size of filtering */ - ); + Word16 a[], /* (i) Q12 : prediction coefficients */ + Word16 x[], /* (i) : speech (values x[-m..-1] are needed */ + Word16 y[], /* (o) : residual signal */ + Word16 lg /* (i) : size of filtering */ + ); void Syn_filt( - Word16 a[], /* (i) Q12 : a[m+1] prediction coefficients */ - Word16 x[], /* (i) : input signal */ - Word16 y[], /* (o) : output signal */ - Word16 lg, /* (i) : size of filtering */ - Word16 mem[], /* (i/o) : memory associated with this filtering. */ - Word16 update /* (i) : 0=no update, 1=update of memory. */ - ); + Word16 a[], /* (i) Q12 : a[m+1] prediction coefficients */ + Word16 x[], /* (i) : input signal */ + Word16 y[], /* (o) : output signal */ + Word16 lg, /* (i) : size of filtering */ + Word16 mem[], /* (i/o) : memory associated with this filtering. */ + Word16 update /* (i) : 0=no update, 1=update of memory. */ + ); void Syn_filt_asm( - Word16 a[], /* (i) Q12 : a[m+1] prediction coefficients */ - Word16 x[], /* (i) : input signal */ - Word16 y[], /* (o) : output signal */ - Word16 mem[] /* (i/o) : memory associated with this filtering. */ - ); + Word16 a[], /* (i) Q12 : a[m+1] prediction coefficients */ + Word16 x[], /* (i) : input signal */ + Word16 y[], /* (o) : output signal */ + Word16 mem[] /* (i/o) : memory associated with this filtering. */ + ); void Syn_filt_32( - Word16 a[], /* (i) Q12 : a[m+1] prediction coefficients */ - Word16 m, /* (i) : order of LP filter */ - Word16 exc[], /* (i) Qnew: excitation (exc[i] >> Qnew) */ - Word16 Qnew, /* (i) : exc scaling = 0(min) to 8(max) */ - Word16 sig_hi[], /* (o) /16 : synthesis high */ - Word16 sig_lo[], /* (o) /16 : synthesis low */ - Word16 lg /* (i) : size of filtering */ - ); + Word16 a[], /* (i) Q12 : a[m+1] prediction coefficients */ + Word16 m, /* (i) : order of LP filter */ + Word16 exc[], /* (i) Qnew: excitation (exc[i] >> Qnew) */ + Word16 Qnew, /* (i) : exc scaling = 0(min) to 8(max) */ + Word16 sig_hi[], /* (o) /16 : synthesis high */ + Word16 sig_lo[], /* (o) /16 : synthesis low */ + Word16 lg /* (i) : size of filtering */ + ); void Syn_filt_32_asm( - Word16 a[], /* (i) Q12 : a[m+1] prediction coefficients */ - Word16 m, /* (i) : order of LP filter */ - Word16 exc[], /* (i) Qnew: excitation (exc[i] >> Qnew) */ - Word16 Qnew, /* (i) : exc scaling = 0(min) to 8(max) */ - Word16 sig_hi[], /* (o) /16 : synthesis high */ - Word16 sig_lo[], /* (o) /16 : synthesis low */ - Word16 lg /* (i) : size of filtering */ - ); + Word16 a[], /* (i) Q12 : a[m+1] prediction coefficients */ + Word16 m, /* (i) : order of LP filter */ + Word16 exc[], /* (i) Qnew: excitation (exc[i] >> Qnew) */ + Word16 Qnew, /* (i) : exc scaling = 0(min) to 8(max) */ + Word16 sig_hi[], /* (o) /16 : synthesis high */ + Word16 sig_lo[], /* (o) /16 : synthesis low */ + Word16 lg /* (i) : size of filtering */ + ); /*-----------------------------------------------------------------* * pitch prototypes * *-----------------------------------------------------------------*/ @@ -443,12 +443,12 @@ void ACELP_4t64_fx( Word16 nbbits, /* (i) : 20, 36, 44, 52, 64, 72 or 88 bits */ Word16 ser_size, /* (i) : bit rate */ Word16 _index[] /* (o) : index (20): 5+5+5+5 = 20 bits. */ - /* (o) : index (36): 9+9+9+9 = 36 bits. */ - /* (o) : index (44): 13+9+13+9 = 44 bits. */ - /* (o) : index (52): 13+13+13+13 = 52 bits. */ - /* (o) : index (64): 2+2+2+2+14+14+14+14 = 64 bits. */ - /* (o) : index (72): 10+2+10+2+10+14+10+14 = 72 bits. */ - /* (o) : index (88): 11+11+11+11+11+11+11+11 = 88 bits. */ + /* (o) : index (36): 9+9+9+9 = 36 bits. */ + /* (o) : index (44): 13+9+13+9 = 44 bits. */ + /* (o) : index (52): 13+13+13+13 = 52 bits. */ + /* (o) : index (64): 2+2+2+2+14+14+14+14 = 64 bits. */ + /* (o) : index (72): 10+2+10+2+10+14+10+14 = 72 bits. */ + /* (o) : index (88): 11+11+11+11+11+11+11+11 = 88 bits. */ ); void Pit_shrp( diff --git a/media/libstagefright/codecs/amrwbenc/inc/basic_op.h b/media/libstagefright/codecs/amrwbenc/inc/basic_op.h index f42a27c..d36f455 100644 --- a/media/libstagefright/codecs/amrwbenc/inc/basic_op.h +++ b/media/libstagefright/codecs/amrwbenc/inc/basic_op.h @@ -25,8 +25,8 @@ #define MAX_32 (Word32)0x7fffffffL #define MIN_32 (Word32)0x80000000L -#define MAX_16 (Word16)+32767 /* 0x7fff */ -#define MIN_16 (Word16)-32768 /* 0x8000 */ +#define MAX_16 (Word16)+32767 /* 0x7fff */ +#define MIN_16 (Word16)-32768 /* 0x8000 */ #define static_vo static __inline @@ -41,22 +41,22 @@ #define L_negate(L_var1) (((L_var1) == (MIN_32)) ? (MAX_32) : (-(L_var1))) /* Long negate, 2*/ -#define extract_h(a) ((Word16)(a >> 16)) -#define extract_l(x) (Word16)((x)) -#define add1(a,b) (a + b) -#define vo_L_msu(a,b,c) ( a - (( b * c ) << 1) ) +#define extract_h(a) ((Word16)(a >> 16)) +#define extract_l(x) (Word16)((x)) +#define add1(a,b) (a + b) +#define vo_L_msu(a,b,c) ( a - (( b * c ) << 1) ) #define vo_mult32(a, b) ((a) * (b)) -#define vo_mult(a,b) (( a * b ) >> 15 ) -#define vo_L_mult(a,b) (((a) * (b)) << 1) -#define vo_shr_r(var1, var2) ((var1+((Word16)(1L<<(var2-1))))>>var2) -#define vo_sub(a,b) (a - b) -#define vo_L_deposit_h(a) ((Word32)((a) << 16)) -#define vo_round(a) ((a + 0x00008000) >> 16) -#define vo_extract_l(a) ((Word16)(a)) -#define vo_L_add(a,b) (a + b) -#define vo_L_sub(a,b) (a - b) -#define vo_mult_r(a,b) ((( a * b ) + 0x4000 ) >> 15 ) -#define vo_negate(a) (-a) +#define vo_mult(a,b) (( a * b ) >> 15 ) +#define vo_L_mult(a,b) (((a) * (b)) << 1) +#define vo_shr_r(var1, var2) ((var1+((Word16)(1L<<(var2-1))))>>var2) +#define vo_sub(a,b) (a - b) +#define vo_L_deposit_h(a) ((Word32)((a) << 16)) +#define vo_round(a) ((a + 0x00008000) >> 16) +#define vo_extract_l(a) ((Word16)(a)) +#define vo_L_add(a,b) (a + b) +#define vo_L_sub(a,b) (a - b) +#define vo_mult_r(a,b) ((( a * b ) + 0x4000 ) >> 15 ) +#define vo_negate(a) (-a) #define vo_L_shr_r(L_var1, var2) ((L_var1+((Word32)(1L<<(var2-1))))>>var2) @@ -65,25 +65,25 @@ | Prototypes for basic arithmetic operators | |___________________________________________________________________________| */ -static_vo Word16 add (Word16 var1, Word16 var2); /* Short add,1 */ -static_vo Word16 sub (Word16 var1, Word16 var2); /* Short sub,1 */ +static_vo Word16 add (Word16 var1, Word16 var2); /* Short add,1 */ +static_vo Word16 sub (Word16 var1, Word16 var2); /* Short sub,1 */ static_vo Word16 shl (Word16 var1, Word16 var2); /* Short shift left, 1 */ static_vo Word16 shr (Word16 var1, Word16 var2); /* Short shift right, 1 */ static_vo Word16 mult (Word16 var1, Word16 var2); /* Short mult, 1 */ static_vo Word32 L_mult (Word16 var1, Word16 var2); /* Long mult, 1 */ static_vo Word16 voround (Word32 L_var1); /* Round, 1 */ -static_vo Word32 L_mac (Word32 L_var3, Word16 var1, Word16 var2); /* Mac, 1 */ -static_vo Word32 L_msu (Word32 L_var3, Word16 var1, Word16 var2); /* Msu, 1 */ -static_vo Word32 L_add (Word32 L_var1, Word32 L_var2); /* Long add, 2 */ -static_vo Word32 L_sub (Word32 L_var1, Word32 L_var2); /* Long sub, 2 */ -static_vo Word16 mult_r (Word16 var1, Word16 var2); /* Mult with round, 2 */ -static_vo Word32 L_shl2(Word32 L_var1, Word16 var2); /* var2 > 0*/ -static_vo Word32 L_shl (Word32 L_var1, Word16 var2); /* Long shift left, 2 */ -static_vo Word32 L_shr (Word32 L_var1, Word16 var2); /* Long shift right, 2*/ -static_vo Word32 L_shr_r (Word32 L_var1, Word16 var2); /* Long shift right with round, 3 */ -static_vo Word16 norm_s (Word16 var1); /* Short norm, 15 */ -static_vo Word16 div_s (Word16 var1, Word16 var2); /* Short division, 18 */ -static_vo Word16 norm_l (Word32 L_var1); /* Long norm, 30 */ +static_vo Word32 L_mac (Word32 L_var3, Word16 var1, Word16 var2); /* Mac, 1 */ +static_vo Word32 L_msu (Word32 L_var3, Word16 var1, Word16 var2); /* Msu, 1 */ +static_vo Word32 L_add (Word32 L_var1, Word32 L_var2); /* Long add, 2 */ +static_vo Word32 L_sub (Word32 L_var1, Word32 L_var2); /* Long sub, 2 */ +static_vo Word16 mult_r (Word16 var1, Word16 var2); /* Mult with round, 2 */ +static_vo Word32 L_shl2(Word32 L_var1, Word16 var2); /* var2 > 0*/ +static_vo Word32 L_shl (Word32 L_var1, Word16 var2); /* Long shift left, 2 */ +static_vo Word32 L_shr (Word32 L_var1, Word16 var2); /* Long shift right, 2*/ +static_vo Word32 L_shr_r (Word32 L_var1, Word16 var2); /* Long shift right with round, 3 */ +static_vo Word16 norm_s (Word16 var1); /* Short norm, 15 */ +static_vo Word16 div_s (Word16 var1, Word16 var2); /* Short division, 18 */ +static_vo Word16 norm_l (Word32 L_var1); /* Long norm, 30 */ /*___________________________________________________________________________ | | @@ -125,11 +125,11 @@ static_vo Word16 norm_l (Word32 L_var1); /* Long norm, */ static_vo Word16 add (Word16 var1, Word16 var2) { - Word16 var_out; - Word32 L_sum; - L_sum = (Word32) var1 + var2; - var_out = saturate (L_sum); - return (var_out); + Word16 var_out; + Word32 L_sum; + L_sum = (Word32) var1 + var2; + var_out = saturate (L_sum); + return (var_out); } /*___________________________________________________________________________ @@ -168,11 +168,11 @@ static_vo Word16 add (Word16 var1, Word16 var2) static_vo Word16 sub (Word16 var1, Word16 var2) { - Word16 var_out; - Word32 L_diff; - L_diff = (Word32) var1 - var2; - var_out = saturate (L_diff); - return (var_out); + Word16 var_out; + Word32 L_diff; + L_diff = (Word32) var1 - var2; + var_out = saturate (L_diff); + return (var_out); } /*___________________________________________________________________________ @@ -212,27 +212,31 @@ static_vo Word16 sub (Word16 var1, Word16 var2) static_vo Word16 shl (Word16 var1, Word16 var2) { - Word16 var_out; - Word32 result; - if (var2 < 0) - { - if (var2 < -16) - var2 = -16; - var_out = var1 >> ((Word16)-var2); - } - else - { - result = (Word32) var1 *((Word32) 1 << var2); - if ((var2 > 15 && var1 != 0) || (result != (Word32) ((Word16) result))) - { - var_out = (Word16)((var1 > 0) ? MAX_16 : MIN_16); - } - else - { - var_out = extract_l (result); - } - } - return (var_out); + Word16 var_out; + Word32 result; + if (var2 < 0) + { + if (var2 < -16) + var2 = -16; + var_out = var1 >> ((Word16)-var2); + } + else + { + if (var2 > 15 && var1 != 0) + { + var_out = (Word16)((var1 > 0) ? MAX_16 : MIN_16); + } + else + { + result = (Word32) var1 *((Word32) 1 << var2); + if ((result != (Word32) ((Word16) result))) { + var_out = (Word16)((var1 > 0) ? MAX_16 : MIN_16); + } else { + var_out = extract_l (result); + } + } + } + return (var_out); } /*___________________________________________________________________________ @@ -272,32 +276,32 @@ static_vo Word16 shl (Word16 var1, Word16 var2) static_vo Word16 shr (Word16 var1, Word16 var2) { - Word16 var_out; - if (var2 < 0) - { - if (var2 < -16) - var2 = -16; - var_out = shl(var1, (Word16)-var2); - } - else - { - if (var2 >= 15) - { - var_out = (Word16)((var1 < 0) ? -1 : 0); - } - else - { - if (var1 < 0) - { - var_out = (Word16)(~((~var1) >> var2)); - } - else - { - var_out = (Word16)(var1 >> var2); - } - } - } - return (var_out); + Word16 var_out; + if (var2 < 0) + { + if (var2 < -16) + var2 = -16; + var_out = shl(var1, (Word16)-var2); + } + else + { + if (var2 >= 15) + { + var_out = (Word16)((var1 < 0) ? -1 : 0); + } + else + { + if (var1 < 0) + { + var_out = (Word16)(~((~var1) >> var2)); + } + else + { + var_out = (Word16)(var1 >> var2); + } + } + } + return (var_out); } /*___________________________________________________________________________ @@ -337,14 +341,14 @@ static_vo Word16 shr (Word16 var1, Word16 var2) static_vo Word16 mult (Word16 var1, Word16 var2) { - Word16 var_out; - Word32 L_product; - L_product = (Word32) var1 *(Word32) var2; - L_product = (L_product & (Word32) 0xffff8000L) >> 15; - if (L_product & (Word32) 0x00010000L) - L_product = L_product | (Word32) 0xffff0000L; - var_out = saturate (L_product); - return (var_out); + Word16 var_out; + Word32 L_product; + L_product = (Word32) var1 *(Word32) var2; + L_product = (L_product & (Word32) 0xffff8000L) >> 15; + if (L_product & (Word32) 0x00010000L) + L_product = L_product | (Word32) 0xffff0000L; + var_out = saturate (L_product); + return (var_out); } /*___________________________________________________________________________ @@ -384,17 +388,17 @@ static_vo Word16 mult (Word16 var1, Word16 var2) static_vo Word32 L_mult (Word16 var1, Word16 var2) { - Word32 L_var_out; - L_var_out = (Word32) var1 *(Word32) var2; - if (L_var_out != (Word32) 0x40000000L) - { - L_var_out *= 2; - } - else - { - L_var_out = MAX_32; - } - return (L_var_out); + Word32 L_var_out; + L_var_out = (Word32) var1 *(Word32) var2; + if (L_var_out != (Word32) 0x40000000L) + { + L_var_out *= 2; + } + else + { + L_var_out = MAX_32; + } + return (L_var_out); } /*___________________________________________________________________________ @@ -430,11 +434,11 @@ static_vo Word32 L_mult (Word16 var1, Word16 var2) static_vo Word16 voround (Word32 L_var1) { - Word16 var_out; - Word32 L_rounded; - L_rounded = L_add (L_var1, (Word32) 0x00008000L); - var_out = extract_h (L_rounded); - return (var_out); + Word16 var_out; + Word32 L_rounded; + L_rounded = L_add (L_var1, (Word32) 0x00008000L); + var_out = extract_h (L_rounded); + return (var_out); } /*___________________________________________________________________________ @@ -476,11 +480,11 @@ static_vo Word16 voround (Word32 L_var1) static_vo Word32 L_mac (Word32 L_var3, Word16 var1, Word16 var2) { - Word32 L_var_out; - Word32 L_product; - L_product = ((var1 * var2) << 1); - L_var_out = L_add (L_var3, L_product); - return (L_var_out); + Word32 L_var_out; + Word32 L_product; + L_product = ((var1 * var2) << 1); + L_var_out = L_add (L_var3, L_product); + return (L_var_out); } /*___________________________________________________________________________ @@ -522,11 +526,11 @@ static_vo Word32 L_mac (Word32 L_var3, Word16 var1, Word16 var2) static_vo Word32 L_msu (Word32 L_var3, Word16 var1, Word16 var2) { - Word32 L_var_out; - Word32 L_product; - L_product = (var1 * var2)<<1; - L_var_out = L_sub (L_var3, L_product); - return (L_var_out); + Word32 L_var_out; + Word32 L_product; + L_product = (var1 * var2)<<1; + L_var_out = L_sub (L_var3, L_product); + return (L_var_out); } /*___________________________________________________________________________ @@ -563,16 +567,16 @@ static_vo Word32 L_msu (Word32 L_var3, Word16 var1, Word16 var2) static_vo Word32 L_add (Word32 L_var1, Word32 L_var2) { - Word32 L_var_out; - L_var_out = L_var1 + L_var2; - if (((L_var1 ^ L_var2) & MIN_32) == 0) - { - if ((L_var_out ^ L_var1) & MIN_32) - { - L_var_out = (L_var1 < 0) ? MIN_32 : MAX_32; - } - } - return (L_var_out); + Word32 L_var_out; + L_var_out = L_var1 + L_var2; + if (((L_var1 ^ L_var2) & MIN_32) == 0) + { + if ((L_var_out ^ L_var1) & MIN_32) + { + L_var_out = (L_var1 < 0) ? MIN_32 : MAX_32; + } + } + return (L_var_out); } /*___________________________________________________________________________ @@ -609,16 +613,16 @@ static_vo Word32 L_add (Word32 L_var1, Word32 L_var2) static_vo Word32 L_sub (Word32 L_var1, Word32 L_var2) { - Word32 L_var_out; - L_var_out = L_var1 - L_var2; - if (((L_var1 ^ L_var2) & MIN_32) != 0) - { - if ((L_var_out ^ L_var1) & MIN_32) - { - L_var_out = (L_var1 < 0L) ? MIN_32 : MAX_32; - } - } - return (L_var_out); + Word32 L_var_out; + L_var_out = L_var1 - L_var2; + if (((L_var1 ^ L_var2) & MIN_32) != 0) + { + if ((L_var_out ^ L_var1) & MIN_32) + { + L_var_out = (L_var1 < 0L) ? MIN_32 : MAX_32; + } + } + return (L_var_out); } @@ -658,18 +662,18 @@ static_vo Word32 L_sub (Word32 L_var1, Word32 L_var2) static_vo Word16 mult_r (Word16 var1, Word16 var2) { - Word16 var_out; - Word32 L_product_arr; - L_product_arr = (Word32) var1 *(Word32) var2; /* product */ - L_product_arr += (Word32) 0x00004000L; /* round */ - L_product_arr &= (Word32) 0xffff8000L; - L_product_arr >>= 15; /* shift */ - if (L_product_arr & (Word32) 0x00010000L) /* sign extend when necessary */ - { - L_product_arr |= (Word32) 0xffff0000L; - } - var_out = saturate (L_product_arr); - return (var_out); + Word16 var_out; + Word32 L_product_arr; + L_product_arr = (Word32) var1 *(Word32) var2; /* product */ + L_product_arr += (Word32) 0x00004000L; /* round */ + L_product_arr &= (Word32) 0xffff8000L; + L_product_arr >>= 15; /* shift */ + if (L_product_arr & (Word32) 0x00010000L) /* sign extend when necessary */ + { + L_product_arr |= (Word32) 0xffff0000L; + } + var_out = saturate (L_product_arr); + return (var_out); } /*___________________________________________________________________________ @@ -708,61 +712,61 @@ static_vo Word16 mult_r (Word16 var1, Word16 var2) static_vo Word32 L_shl (Word32 L_var1, Word16 var2) { - Word32 L_var_out = 0L; - if (var2 <= 0) - { - if (var2 < -32) - var2 = -32; - L_var_out = (L_var1 >> (Word16)-var2); - } - else - { - for (; var2 > 0; var2--) - { - if (L_var1 > (Word32) 0X3fffffffL) - { - L_var_out = MAX_32; - break; - } - else - { - if (L_var1 < (Word32) 0xc0000000L) - { - //Overflow = 1; - L_var_out = MIN_32; - break; - } - } - L_var1 *= 2; - L_var_out = L_var1; - } - } - return (L_var_out); + Word32 L_var_out = 0L; + if (var2 <= 0) + { + if (var2 < -32) + var2 = -32; + L_var_out = (L_var1 >> (Word16)-var2); + } + else + { + for (; var2 > 0; var2--) + { + if (L_var1 > (Word32) 0X3fffffffL) + { + L_var_out = MAX_32; + break; + } + else + { + if (L_var1 < (Word32) 0xc0000000L) + { + //Overflow = 1; + L_var_out = MIN_32; + break; + } + } + L_var1 *= 2; + L_var_out = L_var1; + } + } + return (L_var_out); } static_vo Word32 L_shl2(Word32 L_var1, Word16 var2) { - Word32 L_var_out = 0L; + Word32 L_var_out = 0L; - for (; var2 > 0; var2--) - { - if (L_var1 > (Word32) 0X3fffffffL) - { - L_var_out = MAX_32; - break; - } - else - { - if (L_var1 < (Word32) 0xc0000000L) - { - L_var_out = MIN_32; - break; - } - } - L_var1 <<=1 ; - L_var_out = L_var1; - } - return (L_var_out); + for (; var2 > 0; var2--) + { + if (L_var1 > (Word32) 0X3fffffffL) + { + L_var_out = MAX_32; + break; + } + else + { + if (L_var1 < (Word32) 0xc0000000L) + { + L_var_out = MIN_32; + break; + } + } + L_var1 <<=1 ; + L_var_out = L_var1; + } + return (L_var_out); } /*___________________________________________________________________________ @@ -801,32 +805,32 @@ static_vo Word32 L_shl2(Word32 L_var1, Word16 var2) static_vo Word32 L_shr (Word32 L_var1, Word16 var2) { - Word32 L_var_out; - if (var2 < 0) - { - if (var2 < -32) - var2 = -32; - L_var_out = L_shl2(L_var1, (Word16)-var2); - } - else - { - if (var2 >= 31) - { - L_var_out = (L_var1 < 0L) ? -1 : 0; - } - else - { - if (L_var1 < 0) - { - L_var_out = ~((~L_var1) >> var2); - } - else - { - L_var_out = L_var1 >> var2; - } - } - } - return (L_var_out); + Word32 L_var_out; + if (var2 < 0) + { + if (var2 < -32) + var2 = -32; + L_var_out = L_shl2(L_var1, (Word16)-var2); + } + else + { + if (var2 >= 31) + { + L_var_out = (L_var1 < 0L) ? -1 : 0; + } + else + { + if (L_var1 < 0) + { + L_var_out = ~((~L_var1) >> var2); + } + else + { + L_var_out = L_var1 >> var2; + } + } + } + return (L_var_out); } /*___________________________________________________________________________ @@ -873,23 +877,23 @@ static_vo Word32 L_shr (Word32 L_var1, Word16 var2) static_vo Word32 L_shr_r (Word32 L_var1, Word16 var2) { - Word32 L_var_out; - if (var2 > 31) - { - L_var_out = 0; - } - else - { - L_var_out = L_shr (L_var1, var2); - if (var2 > 0) - { - if ((L_var1 & ((Word32) 1 << (var2 - 1))) != 0) - { - L_var_out++; - } - } - } - return (L_var_out); + Word32 L_var_out; + if (var2 > 31) + { + L_var_out = 0; + } + else + { + L_var_out = L_shr (L_var1, var2); + if (var2 > 0) + { + if ((L_var1 & ((Word32) 1 << (var2 - 1))) != 0) + { + L_var_out++; + } + } + } + return (L_var_out); } /*___________________________________________________________________________ @@ -927,30 +931,30 @@ static_vo Word32 L_shr_r (Word32 L_var1, Word16 var2) static_vo Word16 norm_s (Word16 var1) { - Word16 var_out = 0; - if (var1 == 0) - { - var_out = 0; - } - else - { - if (var1 == -1) - { - var_out = 15; - } - else - { - if (var1 < 0) - { - var1 = (Word16)~var1; - } - for (var_out = 0; var1 < 0x4000; var_out++) - { - var1 <<= 1; - } - } - } - return (var_out); + Word16 var_out = 0; + if (var1 == 0) + { + var_out = 0; + } + else + { + if (var1 == -1) + { + var_out = 15; + } + else + { + if (var1 < 0) + { + var1 = (Word16)~var1; + } + for (var_out = 0; var1 < 0x4000; var_out++) + { + var1 <<= 1; + } + } + } + return (var_out); } /*___________________________________________________________________________ @@ -992,47 +996,47 @@ static_vo Word16 norm_s (Word16 var1) static_vo Word16 div_s (Word16 var1, Word16 var2) { - Word16 var_out = 0; - Word16 iteration; - Word32 L_num; - Word32 L_denom; - if ((var1 < 0) || (var2 < 0)) - { - var_out = MAX_16; - return var_out; - } - if (var2 == 0) - { - var_out = MAX_16; - return var_out; - } - if (var1 == 0) - { - var_out = 0; - } - else - { - if (var1 == var2) - { - var_out = MAX_16; - } - else - { - L_num = L_deposit_l (var1); - L_denom = L_deposit_l(var2); - for (iteration = 0; iteration < 15; iteration++) - { - var_out <<= 1; - L_num <<= 1; - if (L_num >= L_denom) - { - L_num -= L_denom; - var_out += 1; - } - } - } - } - return (var_out); + Word16 var_out = 0; + Word16 iteration; + Word32 L_num; + Word32 L_denom; + if ((var1 < 0) || (var2 < 0)) + { + var_out = MAX_16; + return var_out; + } + if (var2 == 0) + { + var_out = MAX_16; + return var_out; + } + if (var1 == 0) + { + var_out = 0; + } + else + { + if (var1 == var2) + { + var_out = MAX_16; + } + else + { + L_num = L_deposit_l (var1); + L_denom = L_deposit_l(var2); + for (iteration = 0; iteration < 15; iteration++) + { + var_out <<= 1; + L_num <<= 1; + if (L_num >= L_denom) + { + L_num -= L_denom; + var_out += 1; + } + } + } + } + return (var_out); } /*___________________________________________________________________________ @@ -1070,20 +1074,20 @@ static_vo Word16 div_s (Word16 var1, Word16 var2) static_vo Word16 norm_l (Word32 L_var1) { - Word16 var_out = 0; - if (L_var1 != 0) - { - var_out = 31; - if (L_var1 != (Word32) 0xffffffffL) - { - L_var1 ^= (L_var1 >>31); - for (var_out = 0; L_var1 < (Word32) 0x40000000L; var_out++) - { - L_var1 <<= 1; - } - } - } - return (var_out); + Word16 var_out = 0; + if (L_var1 != 0) + { + var_out = 31; + if (L_var1 != (Word32) 0xffffffffL) + { + L_var1 ^= (L_var1 >>31); + for (var_out = 0; L_var1 < (Word32) 0x40000000L; var_out++) + { + L_var1 <<= 1; + } + } + } + return (var_out); } #endif //__BASIC_OP_H__ diff --git a/media/libstagefright/codecs/amrwbenc/inc/bits.h b/media/libstagefright/codecs/amrwbenc/inc/bits.h index e880684..ff9c0c1 100644 --- a/media/libstagefright/codecs/amrwbenc/inc/bits.h +++ b/media/libstagefright/codecs/amrwbenc/inc/bits.h @@ -18,7 +18,7 @@ /*--------------------------------------------------------------------------* * BITS.H * *--------------------------------------------------------------------------* -* Number of bits for different modes * +* Number of bits for different modes * *--------------------------------------------------------------------------*/ #ifndef __BITS_H__ @@ -52,16 +52,16 @@ #define RX_FRAME_TYPE (Word16)0x6b20 static const Word16 nb_of_bits[NUM_OF_MODES] = { - NBBITS_7k, - NBBITS_9k, - NBBITS_12k, - NBBITS_14k, - NBBITS_16k, - NBBITS_18k, - NBBITS_20k, - NBBITS_23k, - NBBITS_24k, - NBBITS_SID + NBBITS_7k, + NBBITS_9k, + NBBITS_12k, + NBBITS_14k, + NBBITS_16k, + NBBITS_18k, + NBBITS_20k, + NBBITS_23k, + NBBITS_24k, + NBBITS_SID }; /*typedef struct @@ -74,18 +74,18 @@ Word16 prev_ft; //typedef struct //{ -// Word16 prev_ft; -// Word16 prev_mode; +// Word16 prev_ft; +// Word16 prev_mode; //} RX_State; int PackBits(Word16 prms[], Word16 coding_mode, Word16 mode, Coder_State *st); void Parm_serial( - Word16 value, /* input : parameter value */ - Word16 no_of_bits, /* input : number of bits */ - Word16 ** prms - ); + Word16 value, /* input : parameter value */ + Word16 no_of_bits, /* input : number of bits */ + Word16 ** prms + ); #endif //__BITS_H__ diff --git a/media/libstagefright/codecs/amrwbenc/inc/cod_main.h b/media/libstagefright/codecs/amrwbenc/inc/cod_main.h index 53ca55e..170981e 100644 --- a/media/libstagefright/codecs/amrwbenc/inc/cod_main.h +++ b/media/libstagefright/codecs/amrwbenc/inc/cod_main.h @@ -18,7 +18,7 @@ /*--------------------------------------------------------------------------* * COD_MAIN.H * *--------------------------------------------------------------------------* - * Static memory in the encoder * + * Static memory in the encoder * *--------------------------------------------------------------------------*/ #ifndef __COD_MAIN_H__ #define __COD_MAIN_H__ @@ -79,21 +79,21 @@ typedef struct Word16 vad_hist; Word16 gain_alpha; /* TX_State structure */ - Word16 sid_update_counter; + Word16 sid_update_counter; Word16 sid_handover_debt; Word16 prev_ft; - Word16 allow_dtx; - /*some input/output buffer parameters */ - unsigned char *inputStream; - int inputSize; - VOAMRWBMODE mode; - VOAMRWBFRAMETYPE frameType; - unsigned short *outputStream; - int outputSize; - FrameStream *stream; - VO_MEM_OPERATOR *pvoMemop; - VO_MEM_OPERATOR voMemoprator; - VO_PTR hCheck; + Word16 allow_dtx; + /*some input/output buffer parameters */ + unsigned char *inputStream; + int inputSize; + VOAMRWBMODE mode; + VOAMRWBFRAMETYPE frameType; + unsigned short *outputStream; + int outputSize; + FrameStream *stream; + VO_MEM_OPERATOR *pvoMemop; + VO_MEM_OPERATOR voMemoprator; + VO_PTR hCheck; } Coder_State; typedef void* HAMRENC; diff --git a/media/libstagefright/codecs/amrwbenc/inc/dtx.h b/media/libstagefright/codecs/amrwbenc/inc/dtx.h index 0bdda67..82a9bf4 100644 --- a/media/libstagefright/codecs/amrwbenc/inc/dtx.h +++ b/media/libstagefright/codecs/amrwbenc/inc/dtx.h @@ -16,9 +16,9 @@ /*--------------------------------------------------------------------------* - * DTX.H * + * DTX.H * *--------------------------------------------------------------------------* - * Static memory, constants and frametypes for the DTX * + * Static memory, constants and frametypes for the DTX * *--------------------------------------------------------------------------*/ #ifndef __DTX_H__ diff --git a/media/libstagefright/codecs/amrwbenc/inc/log2.h b/media/libstagefright/codecs/amrwbenc/inc/log2.h index b065eb4..3d9a6c4 100644 --- a/media/libstagefright/codecs/amrwbenc/inc/log2.h +++ b/media/libstagefright/codecs/amrwbenc/inc/log2.h @@ -45,17 +45,17 @@ ******************************************************************************** */ void Log2 ( - Word32 L_x, /* (i) : input value */ - Word16 *exponent, /* (o) : Integer part of Log2. (range: 0<=val<=30) */ - Word16 *fraction /* (o) : Fractional part of Log2. (range: 0<=val<1)*/ - ); + Word32 L_x, /* (i) : input value */ + Word16 *exponent, /* (o) : Integer part of Log2. (range: 0<=val<=30) */ + Word16 *fraction /* (o) : Fractional part of Log2. (range: 0<=val<1)*/ + ); void Log2_norm ( - Word32 L_x, /* (i) : input value (normalized) */ - Word16 exp, /* (i) : norm_l (L_x) */ - Word16 *exponent, /* (o) : Integer part of Log2. (range: 0<=val<=30) */ - Word16 *fraction /* (o) : Fractional part of Log2. (range: 0<=val<1) */ - ); + Word32 L_x, /* (i) : input value (normalized) */ + Word16 exp, /* (i) : norm_l (L_x) */ + Word16 *exponent, /* (o) : Integer part of Log2. (range: 0<=val<=30) */ + Word16 *fraction /* (o) : Fractional part of Log2. (range: 0<=val<1) */ + ); #endif //__LOG2_H__ diff --git a/media/libstagefright/codecs/amrwbenc/inc/main.h b/media/libstagefright/codecs/amrwbenc/inc/main.h index 3a6f963..adef2df 100644 --- a/media/libstagefright/codecs/amrwbenc/inc/main.h +++ b/media/libstagefright/codecs/amrwbenc/inc/main.h @@ -17,9 +17,9 @@ /*--------------------------------------------------------------------------* - * MAIN.H * + * MAIN.H * *--------------------------------------------------------------------------* - * Main functions * + * Main functions * *--------------------------------------------------------------------------*/ #ifndef __MAIN_H__ diff --git a/media/libstagefright/codecs/amrwbenc/inc/math_op.h b/media/libstagefright/codecs/amrwbenc/inc/math_op.h index 7b6196b..c3c00bc 100644 --- a/media/libstagefright/codecs/amrwbenc/inc/math_op.h +++ b/media/libstagefright/codecs/amrwbenc/inc/math_op.h @@ -16,40 +16,40 @@ /*--------------------------------------------------------------------------* - * MATH_OP.H * + * MATH_OP.H * *--------------------------------------------------------------------------* - * Mathematical operations * + * Mathematical operations * *--------------------------------------------------------------------------*/ #ifndef __MATH_OP_H__ #define __MATH_OP_H__ Word32 Isqrt( /* (o) Q31 : output value (range: 0<=val<1) */ - Word32 L_x /* (i) Q0 : input value (range: 0<=val<=7fffffff) */ - ); + Word32 L_x /* (i) Q0 : input value (range: 0<=val<=7fffffff) */ + ); void Isqrt_n( - Word32 * frac, /* (i/o) Q31: normalized value (1.0 < frac <= 0.5) */ - Word16 * exp /* (i/o) : exponent (value = frac x 2^exponent) */ - ); + Word32 * frac, /* (i/o) Q31: normalized value (1.0 < frac <= 0.5) */ + Word16 * exp /* (i/o) : exponent (value = frac x 2^exponent) */ + ); Word32 Pow2( /* (o) Q0 : result (range: 0<=val<=0x7fffffff) */ - Word16 exponant, /* (i) Q0 : Integer part. (range: 0<=val<=30) */ - Word16 fraction /* (i) Q15 : Fractionnal part. (range: 0.0<=val<1.0) */ - ); + Word16 exponant, /* (i) Q0 : Integer part. (range: 0<=val<=30) */ + Word16 fraction /* (i) Q15 : Fractionnal part. (range: 0.0<=val<1.0) */ + ); Word32 Dot_product12( /* (o) Q31: normalized result (1 < val <= -1) */ - Word16 x[], /* (i) 12bits: x vector */ - Word16 y[], /* (i) 12bits: y vector */ - Word16 lg, /* (i) : vector length */ - Word16 * exp /* (o) : exponent of result (0..+30) */ - ); + Word16 x[], /* (i) 12bits: x vector */ + Word16 y[], /* (i) 12bits: y vector */ + Word16 lg, /* (i) : vector length */ + Word16 * exp /* (o) : exponent of result (0..+30) */ + ); Word32 Dot_product12_asm( /* (o) Q31: normalized result (1 < val <= -1) */ - Word16 x[], /* (i) 12bits: x vector */ - Word16 y[], /* (i) 12bits: y vector */ - Word16 lg, /* (i) : vector length */ - Word16 * exp /* (o) : exponent of result (0..+30) */ - ); + Word16 x[], /* (i) 12bits: x vector */ + Word16 y[], /* (i) 12bits: y vector */ + Word16 lg, /* (i) : vector length */ + Word16 * exp /* (o) : exponent of result (0..+30) */ + ); #endif //__MATH_OP_H__ diff --git a/media/libstagefright/codecs/amrwbenc/inc/mem_align.h b/media/libstagefright/codecs/amrwbenc/inc/mem_align.h index 442786a..2ae5a6c 100644 --- a/media/libstagefright/codecs/amrwbenc/inc/mem_align.h +++ b/media/libstagefright/codecs/amrwbenc/inc/mem_align.h @@ -14,9 +14,9 @@ ** limitations under the License. */ /******************************************************************************* - File: mem_align.h + File: mem_align.h - Content: Memory alloc alignments functions + Content: Memory alloc alignments functions *******************************************************************************/ @@ -29,7 +29,7 @@ extern void *mem_malloc(VO_MEM_OPERATOR *pMemop, unsigned int size, unsigned char alignment, unsigned int CodecID); extern void mem_free(VO_MEM_OPERATOR *pMemop, void *mem_ptr, unsigned int CodecID); -#endif /* __VO_MEM_ALIGN_H__ */ +#endif /* __VO_MEM_ALIGN_H__ */ diff --git a/media/libstagefright/codecs/amrwbenc/inc/p_med_o.h b/media/libstagefright/codecs/amrwbenc/inc/p_med_o.h index 4a13f16..77487ed 100644 --- a/media/libstagefright/codecs/amrwbenc/inc/p_med_o.h +++ b/media/libstagefright/codecs/amrwbenc/inc/p_med_o.h @@ -17,36 +17,36 @@ /*--------------------------------------------------------------------------* * P_MED_O.H * *--------------------------------------------------------------------------* - * Median open-loop lag search * + * Median open-loop lag search * *--------------------------------------------------------------------------*/ #ifndef __P_MED_O_H__ #define __P_MED_O_H__ Word16 Pitch_med_ol( /* output: open loop pitch lag */ - Word16 wsp[], /* input : signal used to compute the open loop pitch */ - /* wsp[-pit_max] to wsp[-1] should be known */ - Word16 L_min, /* input : minimum pitch lag */ - Word16 L_max, /* input : maximum pitch lag */ - Word16 L_frame, /* input : length of frame to compute pitch */ - Word16 L_0, /* input : old_ open-loop pitch */ - Word16 * gain, /* output: normalize correlation of hp_wsp for the Lag */ - Word16 * hp_wsp_mem, /* i:o : memory of the hypass filter for hp_wsp[] (lg=9) */ - Word16 * old_hp_wsp, /* i:o : hypass wsp[] */ - Word16 wght_flg /* input : is weighting function used */ - ); + Word16 wsp[], /* input : signal used to compute the open loop pitch */ + /* wsp[-pit_max] to wsp[-1] should be known */ + Word16 L_min, /* input : minimum pitch lag */ + Word16 L_max, /* input : maximum pitch lag */ + Word16 L_frame, /* input : length of frame to compute pitch */ + Word16 L_0, /* input : old_ open-loop pitch */ + Word16 * gain, /* output: normalize correlation of hp_wsp for the Lag */ + Word16 * hp_wsp_mem, /* i:o : memory of the hypass filter for hp_wsp[] (lg=9) */ + Word16 * old_hp_wsp, /* i:o : hypass wsp[] */ + Word16 wght_flg /* input : is weighting function used */ + ); Word16 Med_olag( /* output : median of 5 previous open-loop lags */ - Word16 prev_ol_lag, /* input : previous open-loop lag */ - Word16 old_ol_lag[5] - ); + Word16 prev_ol_lag, /* input : previous open-loop lag */ + Word16 old_ol_lag[5] + ); void Hp_wsp( - Word16 wsp[], /* i : wsp[] signal */ - Word16 hp_wsp[], /* o : hypass wsp[] */ - Word16 lg, /* i : lenght of signal */ - Word16 mem[] /* i/o : filter memory [9] */ - ); + Word16 wsp[], /* i : wsp[] signal */ + Word16 hp_wsp[], /* o : hypass wsp[] */ + Word16 lg, /* i : lenght of signal */ + Word16 mem[] /* i/o : filter memory [9] */ + ); #endif //__P_MED_O_H__ diff --git a/media/libstagefright/codecs/amrwbenc/inc/q_pulse.h b/media/libstagefright/codecs/amrwbenc/inc/q_pulse.h index b5d5280..67140fc 100644 --- a/media/libstagefright/codecs/amrwbenc/inc/q_pulse.h +++ b/media/libstagefright/codecs/amrwbenc/inc/q_pulse.h @@ -19,7 +19,7 @@ /*--------------------------------------------------------------------------* * Q_PULSE.H * *--------------------------------------------------------------------------* - * Coding and decoding of algebraic codebook * + * Coding and decoding of algebraic codebook * *--------------------------------------------------------------------------*/ #ifndef __Q_PULSE_H__ @@ -28,38 +28,38 @@ #include "typedef.h" Word32 quant_1p_N1( /* (o) return (N+1) bits */ - Word16 pos, /* (i) position of the pulse */ - Word16 N); /* (i) number of bits for position */ + Word16 pos, /* (i) position of the pulse */ + Word16 N); /* (i) number of bits for position */ Word32 quant_2p_2N1( /* (o) return (2*N)+1 bits */ - Word16 pos1, /* (i) position of the pulse 1 */ - Word16 pos2, /* (i) position of the pulse 2 */ - Word16 N); /* (i) number of bits for position */ + Word16 pos1, /* (i) position of the pulse 1 */ + Word16 pos2, /* (i) position of the pulse 2 */ + Word16 N); /* (i) number of bits for position */ Word32 quant_3p_3N1( /* (o) return (3*N)+1 bits */ - Word16 pos1, /* (i) position of the pulse 1 */ - Word16 pos2, /* (i) position of the pulse 2 */ - Word16 pos3, /* (i) position of the pulse 3 */ - Word16 N); /* (i) number of bits for position */ + Word16 pos1, /* (i) position of the pulse 1 */ + Word16 pos2, /* (i) position of the pulse 2 */ + Word16 pos3, /* (i) position of the pulse 3 */ + Word16 N); /* (i) number of bits for position */ Word32 quant_4p_4N1( /* (o) return (4*N)+1 bits */ - Word16 pos1, /* (i) position of the pulse 1 */ - Word16 pos2, /* (i) position of the pulse 2 */ - Word16 pos3, /* (i) position of the pulse 3 */ - Word16 pos4, /* (i) position of the pulse 4 */ - Word16 N); /* (i) number of bits for position */ + Word16 pos1, /* (i) position of the pulse 1 */ + Word16 pos2, /* (i) position of the pulse 2 */ + Word16 pos3, /* (i) position of the pulse 3 */ + Word16 pos4, /* (i) position of the pulse 4 */ + Word16 N); /* (i) number of bits for position */ Word32 quant_4p_4N( /* (o) return 4*N bits */ - Word16 pos[], /* (i) position of the pulse 1..4 */ - Word16 N); /* (i) number of bits for position */ + Word16 pos[], /* (i) position of the pulse 1..4 */ + Word16 N); /* (i) number of bits for position */ Word32 quant_5p_5N( /* (o) return 5*N bits */ - Word16 pos[], /* (i) position of the pulse 1..5 */ - Word16 N); /* (i) number of bits for position */ + Word16 pos[], /* (i) position of the pulse 1..5 */ + Word16 N); /* (i) number of bits for position */ Word32 quant_6p_6N_2( /* (o) return (6*N)-2 bits */ - Word16 pos[], /* (i) position of the pulse 1..6 */ - Word16 N); /* (i) number of bits for position */ + Word16 pos[], /* (i) position of the pulse 1..6 */ + Word16 N); /* (i) number of bits for position */ #endif //__Q_PULSE_H__ diff --git a/media/libstagefright/codecs/amrwbenc/inc/stream.h b/media/libstagefright/codecs/amrwbenc/inc/stream.h index 4c1d0f0..ec1a700 100644 --- a/media/libstagefright/codecs/amrwbenc/inc/stream.h +++ b/media/libstagefright/codecs/amrwbenc/inc/stream.h @@ -17,7 +17,7 @@ /*********************************************************************** -File: stream.h +File: stream.h Contains: VOME API Buffer Operator Implement Header @@ -28,16 +28,16 @@ Contains: VOME API Buffer Operator Implement Header #include "voMem.h" #define Frame_Maxsize 1024 * 2 //Work Buffer 10K #define Frame_MaxByte 640 //AMR_WB Encoder one frame 320 samples = 640 Bytes -#define MIN(a,b) ((a) < (b)? (a) : (b)) +#define MIN(a,b) ((a) < (b)? (a) : (b)) typedef struct{ - unsigned char *set_ptr; - unsigned char *frame_ptr; - unsigned char *frame_ptr_bk; - int set_len; - int framebuffer_len; - int frame_storelen; - int used_len; + unsigned char *set_ptr; + unsigned char *frame_ptr; + unsigned char *frame_ptr_bk; + int set_len; + int framebuffer_len; + int frame_storelen; + int used_len; }FrameStream; void voAWB_UpdateFrameBuffer(FrameStream *stream, VO_MEM_OPERATOR *pMemOP); diff --git a/media/libstagefright/codecs/amrwbenc/inc/wb_vad.h b/media/libstagefright/codecs/amrwbenc/inc/wb_vad.h index 6822f48..9a9af4f 100644 --- a/media/libstagefright/codecs/amrwbenc/inc/wb_vad.h +++ b/media/libstagefright/codecs/amrwbenc/inc/wb_vad.h @@ -37,28 +37,28 @@ typedef struct { - Word16 bckr_est[COMPLEN]; /* background noise estimate */ - Word16 ave_level[COMPLEN]; /* averaged input components for stationary */ - /* estimation */ - Word16 old_level[COMPLEN]; /* input levels of the previous frame */ - Word16 sub_level[COMPLEN]; /* input levels calculated at the end of a frame (lookahead) */ - Word16 a_data5[F_5TH_CNT][2]; /* memory for the filter bank */ - Word16 a_data3[F_3TH_CNT]; /* memory for the filter bank */ + Word16 bckr_est[COMPLEN]; /* background noise estimate */ + Word16 ave_level[COMPLEN]; /* averaged input components for stationary */ + /* estimation */ + Word16 old_level[COMPLEN]; /* input levels of the previous frame */ + Word16 sub_level[COMPLEN]; /* input levels calculated at the end of a frame (lookahead) */ + Word16 a_data5[F_5TH_CNT][2]; /* memory for the filter bank */ + Word16 a_data3[F_3TH_CNT]; /* memory for the filter bank */ - Word16 burst_count; /* counts length of a speech burst */ - Word16 hang_count; /* hangover counter */ - Word16 stat_count; /* stationary counter */ + Word16 burst_count; /* counts length of a speech burst */ + Word16 hang_count; /* hangover counter */ + Word16 stat_count; /* stationary counter */ - /* Note that each of the following two variables holds 15 flags. Each flag reserves 1 bit of the - * variable. The newest flag is in the bit 15 (assuming that LSB is bit 1 and MSB is bit 16). */ - Word16 vadreg; /* flags for intermediate VAD decisions */ - Word16 tone_flag; /* tone detection flags */ + /* Note that each of the following two variables holds 15 flags. Each flag reserves 1 bit of the + * variable. The newest flag is in the bit 15 (assuming that LSB is bit 1 and MSB is bit 16). */ + Word16 vadreg; /* flags for intermediate VAD decisions */ + Word16 tone_flag; /* tone detection flags */ - Word16 sp_est_cnt; /* counter for speech level estimation */ - Word16 sp_max; /* maximum level */ - Word16 sp_max_cnt; /* counts frames that contains speech */ - Word16 speech_level; /* estimated speech level */ - Word32 prev_pow_sum; /* power of previous frame */ + Word16 sp_est_cnt; /* counter for speech level estimation */ + Word16 sp_max; /* maximum level */ + Word16 sp_max_cnt; /* counts frames that contains speech */ + Word16 speech_level; /* estimated speech level */ + Word32 prev_pow_sum; /* power of previous frame */ } VadVars; diff --git a/media/libstagefright/codecs/amrwbenc/inc/wb_vad_c.h b/media/libstagefright/codecs/amrwbenc/inc/wb_vad_c.h index 04fd318..00b1779 100644 --- a/media/libstagefright/codecs/amrwbenc/inc/wb_vad_c.h +++ b/media/libstagefright/codecs/amrwbenc/inc/wb_vad_c.h @@ -16,9 +16,9 @@ /*-------------------------------------------------------------------* - * WB_VAD_C.H * + * WB_VAD_C.H * *-------------------------------------------------------------------* - * Constants for Voice Activity Detection. * + * Constants for Voice Activity Detection. * *-------------------------------------------------------------------*/ #ifndef __WB_VAD_C_H__ |