www.pudn.com > AVS_M_ver10.rar > decim_split.c
/* *********************************************************************** * COPYRIGHT AND WARRANTY INFORMATION * * Copyright 2007 Audio Video Coding Standard, Part ¢ú * * This software module was developed by AVS Audio sub-group * * DISCLAIMER OF WARRANTY * * These software programs are available to the users without any * license fee or royalty on an "as is" basis. The AVS disclaims * any and all warranties, whether express, implied, or statutory, * including any implied warranties of merchantability or of fitness * for a particular purpose. In no event shall the contributors or * the AVS be liable for any incidental, punitive, or consequential * damages of any kind whatsoever arising from the use of this program. * * This disclaimer of warranty extends to the user of this program * and user's customers, employees, agents, transferees, successors, * and assigns. * * The AVS does not represent or warrant that the program furnished * hereunder are free of infringement of any third-party patents. * Commercial implementations of AVS, including shareware, may be * subject to royalty fees to patent holders. Information regarding * the AVS patent policy is available from the AVS Web site at * http://www.avs.org.cn * * THIS IS NOT A GRANT OF PATENT RIGHTS - SEE THE AVS PATENT POLICY. ************************************************************************ */ #include#include #include #include "../include/amr_plus.h" #define L_FRAME_MAX (L_FRAME48k) /* local function */ static void interpol_mem( float *signal, float *signal_int, int L_frame_int, float *filter, int nb_coef, int fac_up, int fac_down, float gain, int *mem_frac); int decim_split_12k8( /* number of sample decimated */ float sig_fs[], /* input: signal to decimate */ int lg_input, /* input: 2*L_FRAME44k if 44kHz */ float sig12k8_lf[], /* output: LF decimated signal */ float sig12k8_hf[], /* output: HF decimated signal */ int lg, /* input: length of LF and HF */ int fac_fs, /* input: at 48kHz, scale fac = fac_fs/FSCALE_DENOM */ int fac_up, /* input: Upsampling factor */ int fac_down, /* input: Downsampling factor */ int L_frame, /* input: Working frame len */ float mem[], /* in/out: mem[L_MEM_DECIM_SPLIT] */ int *frac_mem /* in/out: interpol fraction memory */ ) { int i, j, ncoef, L_frame_int; float signal[(2*(L_FILT_SPLIT+L_FILT_DECIM))+2*L_FRAME_MAX], *sig; float *filter, gain, *x1, *x2, s; #ifdef FILTER_44kHz if (lg_input == (2*L_FRAME44k)) { filter = (float *)filter_LP165; } #endif #ifdef FILTER_48kHz if (lg_input == (2*L_FRAME48k)) { filter = (float *)filter_LP180; } #endif ncoef = (L_FILT_OVER+1)*fac_down/fac_up; gain = ((float)fac_up) / ((float)fac_down); /* frames length */ L_frame_int = 2*lg; /* 25k6 rate */ /* load buffer & update memory */ for (i=0; i<(2*(L_FILT_SPLIT+L_FILT_DECIM)); i++) { signal[i] = mem[i]; } for (i=0; i 2 x 12.8kHz) */ sig = signal + L_FILT_SPLIT; for(i=0; i 25.6kHz) */ /* load buffer (LF-HF) & update memory */ for (i=0; i<(2*L_FILT_JOIN); i++) { signal[i] = mem[i+(2*L_FILT_OVER)]; } for (i=0; i > 3; pos = 0; frac = *mem_frac; for(i=0; i > 3; c1 = &filter[frac_d]; c2 = &filter[fac_up_d-frac_d]; s = 0.0; for(j=0; j = fac_up_minus_frac_step) { pos += pos_step_plus_one; frac -= fac_up_minus_frac_step; } else { pos += pos_step; frac += frac_step; } } *mem_frac = frac; return; }