www.pudn.com > av3dec_20050318.zip > sam_cbc_dec.h


/* 
*********************************************************************** 
* COPYRIGHT AND WARRANTY INFORMATION 
* 
* Copyright 2004,  Audio Video Coding Standard, Part III 
* 
* This software module was originally developed by 
* 
* JungHoe Kim (kjh94@samsung.com), Samsung AIT 
* 
* edited by 
* 
* Lei Miao (win.miaolei@samsung.com), Samsung AIT 
* 
* 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. 
************************************************************************ 
*/ 
 
#ifndef _sam_cbc_dec_h_ 
#define _sam_cbc_dec_h_ 
 
#define TRUE  1 
#define FALSE 0 
   
#define FRAMESIZE  1024 
    
#define NORMAL_WINDOW   0 
#define START_WINDOW    1 
#define SHORT_WINDOW    2 
#define STOP_WINDOW     3 
 
#define	MAX_SCFAC_BANDS	136 
 
typedef	float	Float; 
 
void decodeCBC(int  target, 
  int  stereo_mode, 
  int  windowSequence[], 
  int  num_window_groups, 
  int  window_group_length[], 
  int  scalefactors[][8][MAX_SCFAC_BANDS], 
  int  samples[][FRAMESIZE], 
  int  maxSfb[], 
  int  ps_mask[], 
  int  ubits, 
  int  frameSize, 
  int  enc_top_layer, 
  int  base_snf, 
  int  base_band, 
  int  nch, 
  int  fill_length); 
 
void dequantization(int target, 
  int  windowSequence, 
  int  scalefactors[][MAX_SCFAC_BANDS], 
  int  num_window_groups, 
  int  window_group_length[], 
  int  samples[], 
  int  maxSfb, 
  Float spectrums[], 
  int  ch); 
 
	/* bypass stereo decoding, just get swb_offset info 
	   from its 'samp_rate_info' in "sam_cbc_band.h" */ 
void cbc_swboffset_for_polarstereo(int*	swb_offset_short,  
								   int* swb_offset_long,    
								   int	fsidx); 
 
int init_cbc(int fsidx); 
 
void cbc_decode_init(int fsidx); 
 
void cbc_decode(int  windowSequence, 
  int  target, 
  int  sample_buf[][FRAMESIZE], 
  int  scalefactors[][8][MAX_SCFAC_BANDS], 
  int  maxSfb, 
  int  num_window_groups, 
  int  window_group_length[], 
  int  ps_mask[], 
  int  stereo_mode, 
  int  swb_offset[][52], 
  int  used_bits, 
  int  frameLength, 
  int  enc_top_layer, 
  int  base_snf, 
  int  base_band, 
  int  nch, 
  int  fill_length); 
 
void open_bitstream(char *bs_filenam); 
void close_bitstream(); 
unsigned int getbits(int N); 
unsigned long i_sstell(); 
int end_bs(); 
 
void init_layer_buf(); 
void setRBitBufPos(int pos); 
unsigned int getbitsfrombuf(int N); 
int putbits2buf( unsigned int val, int N); 
 
static int decode_cband_si( 
	int	model_index[][8][32], 
	int	start_cband[][64], 
	int end_cband[][64], 
	int g, 
	int nch); 
 
static int decode_scfband_si( 
	int	scf[][8][MAX_SCFAC_BANDS], 
	int	start_qband[][64], 
	int end_qband[][64], 
	int	stereo_mode, 
    int ps_mask[], 
	int maxSfb, 
	int stereo_si_coded[], 
	int g, 
	int nch); 
 
static int decode_spectra( 
	int	*sample[][8], 
	int s_reg, 
	int e_reg, 
	int s_freq[][64], 
	int e_freq[][64], 
	int min_bpl, 
	int available_len, 
	int model_index[][8][32], 
	int *cur_bpl[][8], 
	int *coded_samp_bit[][8], 
	int *sign_coded[][8], 
	int nch); 
 
static int initialize_layer_data( 
	int windowSequence, 
	int num_window_groups,  
	int window_group_length[], 
	int base_band, 
	int enc_top_layer, 
	int maxSfb, 
	int	swb_offset[][52], 
	int layer_max_freq[][64], 
	int layer_max_cband[][64],  
	int layer_max_qband[][64], 
	int layer_bit_flush[], 
	int layer_reg[2][64], 
	int nch); 
 
#endif