libavcodec/g729dec.c File Reference

#include <inttypes.h>
#include <string.h>
#include "avcodec.h"
#include "libavutil/avutil.h"
#include "get_bits.h"
#include "dsputil.h"
#include "g729.h"
#include "lsp.h"
#include "celp_math.h"
#include "celp_filters.h"
#include "acelp_filters.h"
#include "acelp_pitch_delay.h"
#include "acelp_vectors.h"
#include "g729data.h"
#include "g729postfilter.h"

Go to the source code of this file.

Data Structures

struct  G729FormatDescription
struct  G729Context

Defines

#define LSFQ_MIN   40
 minimum quantized LSF value (3.2.4) 0.005 in Q13
#define LSFQ_MAX   25681
 maximum quantized LSF value (3.2.4) 3.135 in Q13
#define LSFQ_DIFF_MIN   321
 minimum LSF distance (3.2.4) 0.0391 in Q13
#define INTERPOL_LEN   11
 interpolation filter length
#define SHARP_MIN   3277
 minimum gain pitch value (3.8, Equation 47) 0.2 in (1.14)
#define SHARP_MAX   13017
 maximum gain pitch value (3.8, Equation 47) (EE) This does not comply with the specification.
#define MR_ENERGY   1018156
 MR_ENERGY (mean removed energy) = mean_energy + 10 * log10(2^26 * subframe_size) in (7.13).
#define DECISION_NOISE   0
#define DECISION_INTERMEDIATE   1
#define DECISION_VOICE   2

Enumerations

enum  G729Formats { FORMAT_G729_8K = 0, FORMAT_G729D_6K4, FORMAT_COUNT }

Functions

static uint16_t g729_prng (uint16_t value)
 pseudo random number generator
static int get_parity (uint8_t value)
 Get parity bit of bit 2.
static void lsf_decode (int16_t *lsfq, int16_t *past_quantizer_outputs[MA_NP+1], int16_t ma_predictor, int16_t vq_1st, int16_t vq_2nd_low, int16_t vq_2nd_high)
static void lsf_restore_from_previous (int16_t *lsfq, int16_t *past_quantizer_outputs[MA_NP+1], int ma_predictor_prev)
 Restores past LSP quantizer output using LSF from previous frame.
static void g729d_get_new_exc (int16_t *out, const int16_t *in, const int16_t *fc_cur, int dstate, int gain_code, int subframe_size)
 Constructs new excitation signal and applies phase filter to it.
static int g729d_onset_decision (int past_onset, const int16_t *past_gain_code)
 Makes decision about onset in current subframe.
static int16_t g729d_voice_decision (int onset, int prev_voice_decision, const int16_t *past_gain_pitch)
 Makes decision about voice presence in current subframe.
static int32_t scalarproduct_int16_c (const int16_t *v1, const int16_t *v2, int order, int shift)
static av_cold int decoder_init (AVCodecContext *avctx)
static int decode_frame (AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)

Variables

static const G729FormatDescription format_g729_8k
static const G729FormatDescription format_g729d_6k4
AVCodec ff_g729_decoder


Define Documentation

#define DECISION_INTERMEDIATE   1

Definition at line 82 of file g729dec.c.

Referenced by g729d_voice_decision().

#define DECISION_NOISE   0

Definition at line 81 of file g729dec.c.

Referenced by g729d_voice_decision().

#define DECISION_VOICE   2

Definition at line 83 of file g729dec.c.

Referenced by decode_frame(), and g729d_voice_decision().

#define INTERPOL_LEN   11

interpolation filter length

Definition at line 59 of file g729dec.c.

Referenced by decode_frame(), and decoder_init().

#define LSFQ_DIFF_MIN   321

minimum LSF distance (3.2.4) 0.0391 in Q13

Definition at line 56 of file g729dec.c.

Referenced by ff_sipr_decode_frame_16k(), lsf_decode(), and lsf_decode_fp().

#define LSFQ_MAX   25681

maximum quantized LSF value (3.2.4) 3.135 in Q13

Definition at line 50 of file g729dec.c.

Referenced by lsf_decode().

#define LSFQ_MIN   40

minimum quantized LSF value (3.2.4) 0.005 in Q13

Definition at line 44 of file g729dec.c.

Referenced by lsf_decode().

#define MR_ENERGY   1018156

MR_ENERGY (mean removed energy) = mean_energy + 10 * log10(2^26 * subframe_size) in (7.13).

Definition at line 79 of file g729dec.c.

Referenced by decode_frame().

#define SHARP_MAX   13017

maximum gain pitch value (3.8, Equation 47) (EE) This does not comply with the specification.

Specification says about 0.8, which should be 13107 in (1.14), but reference C code uses 13017 (equals to 0.7945) instead of it.

Definition at line 74 of file g729dec.c.

#define SHARP_MIN   3277

minimum gain pitch value (3.8, Equation 47) 0.2 in (1.14)

Definition at line 65 of file g729dec.c.

Referenced by decode_frame().


Enumeration Type Documentation

Enumerator:
FORMAT_G729_8K 
FORMAT_G729D_6K4 
FORMAT_COUNT 

Definition at line 85 of file g729dec.c.


Function Documentation

static int decode_frame ( AVCodecContext avctx,
void *  data,
int *  got_frame_ptr,
AVPacket avpkt 
) [static]

< frame erasure detected during decoding

< parity check failed

< switched MA predictor of LSP quantizer

< first stage vector of quantizer

< second stage lower vector of quantizer (size in bits)

< second stage higher vector of quantizer (size in bits)

< adaptive codebook index

< fixed-codebook vector pulse signs

< fixed-codebook indexes

< gain codebook (first stage) index

< gain codebook (second stage) index

Definition at line 390 of file g729dec.c.

static av_cold int decoder_init ( AVCodecContext avctx  )  [static]

Definition at line 346 of file g729dec.c.

static uint16_t g729_prng ( uint16_t  value  )  [inline, static]

pseudo random number generator

Definition at line 177 of file g729dec.c.

Referenced by decode_frame().

static void g729d_get_new_exc ( int16_t out,
const int16_t in,
const int16_t fc_cur,
int  dstate,
int  gain_code,
int  subframe_size 
) [static]

Constructs new excitation signal and applies phase filter to it.

Parameters:
out[out] constructed speech signal
in original excitation signal
fc_cur (2.13) original fixed-codebook vector
gain_code (14.1) gain code
subframe_size length of the subframe

Definition at line 265 of file g729dec.c.

Referenced by decode_frame().

static int g729d_onset_decision ( int  past_onset,
const int16_t past_gain_code 
) [static]

Makes decision about onset in current subframe.

Parameters:
past_onset decision result of previous subframe
past_gain_code gain code of current and previous subframe
Returns:
onset decision result for current subframe

Definition at line 293 of file g729dec.c.

Referenced by decode_frame().

static int16_t g729d_voice_decision ( int  onset,
int  prev_voice_decision,
const int16_t past_gain_pitch 
) [static]

Makes decision about voice presence in current subframe.

Parameters:
onset onset level
prev_voice_decision voice decision result from previous subframe
past_gain_pitch pitch gain of current and previous subframes
Returns:
voice decision result for current subframe

Definition at line 309 of file g729dec.c.

Referenced by decode_frame().

static int get_parity ( uint8_t  value  )  [inline, static]

Get parity bit of bit 2.

.7

Definition at line 185 of file g729dec.c.

Referenced by decode_frame().

static void lsf_decode ( int16_t lsfq,
int16_t past_quantizer_outputs[MA_NP+1],
int16_t  ma_predictor,
int16_t  vq_1st,
int16_t  vq_2nd_low,
int16_t  vq_2nd_high 
) [static]

Definition at line 199 of file g729dec.c.

Referenced by decode_frame().

static void lsf_restore_from_previous ( int16_t lsfq,
int16_t past_quantizer_outputs[MA_NP+1],
int  ma_predictor_prev 
) [static]

Restores past LSP quantizer output using LSF from previous frame.

Parameters:
lsfq [in/out] (2.13) quantized LSF coefficients
past_quantizer_outputs [in/out] (2.13) quantizer outputs from previous frames
ma_predictor_prev MA predictor from previous frame
lsfq_prev (2.13) quantized LSF coefficients from previous frame

Definition at line 240 of file g729dec.c.

Referenced by decode_frame().

static int32_t scalarproduct_int16_c ( const int16_t v1,
const int16_t v2,
int  order,
int  shift 
) [static]

Definition at line 336 of file g729dec.c.


Variable Documentation

Initial value:

{
    "g729",
    AVMEDIA_TYPE_AUDIO,
    CODEC_ID_G729,
    sizeof(G729Context),
    decoder_init,
    NULL,
    NULL,
    decode_frame,
    .capabilities = CODEC_CAP_DR1,
    .long_name = NULL_IF_CONFIG_SMALL("G.729"),
}

Definition at line 715 of file g729dec.c.

Initial value:

 {
    .ac_index_bits     = {8,5},
    .parity_bit        = 1,
    .gc_1st_index_bits = GC_1ST_IDX_BITS_8K,
    .gc_2nd_index_bits = GC_2ND_IDX_BITS_8K,
    .fc_signs_bits     = 4,
    .fc_indexes_bits   = 13,
}

Definition at line 156 of file g729dec.c.

Initial value:

 {
    .ac_index_bits     = {8,4},
    .parity_bit        = 0,
    .gc_1st_index_bits = GC_1ST_IDX_BITS_6K4,
    .gc_2nd_index_bits = GC_2ND_IDX_BITS_6K4,
    .fc_signs_bits     = 2,
    .fc_indexes_bits   = 9,
}

Definition at line 165 of file g729dec.c.


Generated on Fri Oct 26 02:43:47 2012 for FFmpeg by  doxygen 1.5.8