• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

libavcodec/sipr.h

Go to the documentation of this file.
00001 /*
00002  * SIPR / ACELP.NET decoder
00003  *
00004  * Copyright (c) 2008 Vladimir Voroshilov
00005  * Copyright (c) 2009 Vitor Sessak
00006  *
00007  * This file is part of Libav.
00008  *
00009  * Libav is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2.1 of the License, or (at your option) any later version.
00013  *
00014  * Libav is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * Lesser General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public
00020  * License along with Libav; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00022  */
00023 
00024 #ifndef AVCODEC_SIPR_H
00025 #define AVCODEC_SIPR_H
00026 
00027 #include "avcodec.h"
00028 #include "dsputil.h"
00029 #include "acelp_pitch_delay.h"
00030 
00031 #define LP_FILTER_ORDER_16k  16
00032 #define L_SUBFR_16k          80
00033 #define PITCH_MIN            30
00034 #define PITCH_MAX            281
00035 
00036 #define LSFQ_DIFF_MIN        (0.0125 * M_PI)
00037 
00038 #define LP_FILTER_ORDER      10
00039 
00041 #define L_INTERPOL           (LP_FILTER_ORDER + 1)
00042 
00044 #define SUBFR_SIZE           48
00045 
00046 #define SUBFRAME_COUNT_16k   2
00047 
00048 typedef enum {
00049     MODE_16k,
00050     MODE_8k5,
00051     MODE_6k5,
00052     MODE_5k0,
00053     MODE_COUNT
00054 } SiprMode;
00055 
00056 typedef struct SiprParameters {
00057     int ma_pred_switch;        
00058     int vq_indexes[5];
00059     int pitch_delay[5];        
00060     int gp_index[5];           
00061     int16_t fc_indexes[5][10]; 
00062     int gc_index[5];           
00063 } SiprParameters;
00064 
00065 typedef struct SiprContext {
00066     AVCodecContext *avctx;
00067     AVFrame frame;
00068 
00069     SiprMode mode;
00070 
00071     float past_pitch_gain;
00072     float lsf_history[LP_FILTER_ORDER_16k];
00073 
00074     float excitation[L_INTERPOL + PITCH_MAX + 2 * L_SUBFR_16k];
00075 
00076     DECLARE_ALIGNED(16, float, synth_buf)[LP_FILTER_ORDER + 5*SUBFR_SIZE + 6];
00077 
00078     float lsp_history[LP_FILTER_ORDER];
00079     float gain_mem;
00080     float energy_history[4];
00081     float highpass_filt_mem[2];
00082     float postfilter_mem[PITCH_DELAY_MAX + LP_FILTER_ORDER];
00083 
00084     /* 5k0 */
00085     float tilt_mem;
00086     float postfilter_agc;
00087     float postfilter_mem5k0[PITCH_DELAY_MAX + LP_FILTER_ORDER];
00088     float postfilter_syn5k0[LP_FILTER_ORDER + SUBFR_SIZE*5];
00089 
00090     /* 16k */
00091     int pitch_lag_prev;
00092     float iir_mem[LP_FILTER_ORDER_16k+1];
00093     float filt_buf[2][LP_FILTER_ORDER_16k+1];
00094     float *filt_mem[2];
00095     float mem_preemph[LP_FILTER_ORDER_16k];
00096     float synth[LP_FILTER_ORDER_16k];
00097     double lsp_history_16k[16];
00098 
00099     void (*decode_frame)(struct SiprContext *ctx, SiprParameters *params,
00100                          float *out_data);
00101 } SiprContext;
00102 
00103 extern const float ff_pow_0_5[16];
00104 
00105 void ff_sipr_init_16k(SiprContext *ctx);
00106 
00107 void ff_sipr_decode_frame_16k(SiprContext *ctx, SiprParameters *params,
00108                               float *out_data);
00109 
00110 #endif /* AVCODEC_SIPR_H */
Generated on Thu Jul 11 2013 15:38:21 for Libav by doxygen 1.7.1