www.pudn.com > AVS_M_ver10.rar > over_fs.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 over_fs(          /* number of sample oversampled       */ 
  float sig_in[],     /* input:  signal to oversample       */ 
  float sig_out[],    /* output: signal oversampled         */ 
  int lg,             /* input:  length of output           */ 
  int fac_down,       /* input:  fs*12/fac_down = 44k/48k   */ 
  float mem[],        /* in/out: mem[2*L_FILT_OVER_FS]      */ 
  int *frac_mem       /* in/out: interpol fraction memory   */ 
) 
{ 
  int i, ncoef, L_frame, L_frame_int; 
  float signal[(2*L_FILT_OVER_FS)+2*L_FRAME_MAX]; 
  float *filter, gain; 
  int fac_up; 
 
  if (fac_down >= 12) return(lg); 
 
  fac_up = 12; 
  filter = (float *)filter_LP12; 
 
  ncoef = L_FILT_OVER_FS; 
  gain = 1.0f; 
  L_frame = ((lg*fac_down)+(*frac_mem)) / fac_up; 
  L_frame_int = lg; 
 
  /* load buffer & update memory */ 
 
  for (i=0; i<(2*L_FILT_OVER_FS); i++) 
  { 
    signal[i] = mem[i]; 
  } 
  for (i=0; i= 12) return(lg); 
 
  fac_down = 12; 
  filter = (float *)filter_LP12; 
 
  ncoef = L_FILT_OVER_FS*fac_down/fac_up; 
  gain = ((float)fac_up) / ((float)fac_down); 
  L_frame = lg; 
  L_frame_int = ((lg*fac_up)-(*frac_mem)+(fac_down-1))/fac_down; 
 
 
  /* load buffer & update memory */ 
 
  for (i=0; i<(2*L_FILT_DECIM_FS); i++)  
  { 
    signal[i] = mem[i]; 
  } 
 
  for (i=0; i= 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; 
}