FFmpeg
g722.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) CMU 1993 Computer Science, Speech Group
3  * Chengxiang Lu and Alex Hauptmann
4  * Copyright (c) 2005 Steve Underwood <steveu at coppice.org>
5  * Copyright (c) 2009 Kenan Gillet
6  * Copyright (c) 2010 Martin Storsjo
7  *
8  * This file is part of FFmpeg.
9  *
10  * FFmpeg is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * FFmpeg is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with FFmpeg; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  */
24 
25 #ifndef AVCODEC_G722_H
26 #define AVCODEC_G722_H
27 
28 #include <stdint.h>
29 #include "avcodec.h"
30 #include "g722dsp.h"
31 
32 #define PREV_SAMPLES_BUF_SIZE 1024
33 
34 typedef struct G722Context {
35  const AVClass *class;
37  int16_t prev_samples[PREV_SAMPLES_BUF_SIZE]; ///< memory of past decoded samples
38  int prev_samples_pos; ///< the number of values in prev_samples
39 
40  /**
41  * The band[0] and band[1] correspond respectively to the lower band and higher band.
42  */
43  struct G722Band {
44  int16_t s_predictor; ///< predictor output value
45  int32_t s_zero; ///< previous output signal from zero predictor
46  int8_t part_reconst_mem[2]; ///< signs of previous partially reconstructed signals
47  int16_t prev_qtzd_reconst; ///< previous quantized reconstructed signal (internal value, using low_inv_quant4)
48  int16_t pole_mem[2]; ///< second-order pole section coefficient buffer
49  int32_t diff_mem[6]; ///< quantizer difference signal memory
50  int16_t zero_mem[6]; ///< Seventh-order zero section coefficient buffer
51  int16_t log_factor; ///< delayed 2-logarithmic quantizer factor
52  int16_t scale_factor; ///< delayed quantizer scale factor
53  } band[2];
54 
55  struct TrellisNode {
56  struct G722Band state;
57  uint32_t ssd;
58  int path;
59  } *node_buf[2], **nodep_buf[2];
60 
61  struct TrellisPath {
62  int value;
63  int prev;
64  } *paths[2];
65 
67 } G722Context;
68 
69 extern const int16_t ff_g722_high_inv_quant[4];
70 extern const int16_t ff_g722_low_inv_quant4[16];
71 extern const int16_t ff_g722_low_inv_quant6[64];
72 
73 void ff_g722_update_low_predictor(struct G722Band *band, const int ilow);
74 
75 void ff_g722_update_high_predictor(struct G722Band *band, const int dhigh,
76  const int ihigh);
77 
78 #endif /* AVCODEC_G722_H */
G722Context::TrellisPath::value
int value
Definition: g722.h:62
G722Context::prev_samples_pos
int prev_samples_pos
the number of values in prev_samples
Definition: g722.h:38
PREV_SAMPLES_BUF_SIZE
#define PREV_SAMPLES_BUF_SIZE
Definition: g722.h:32
G722DSPContext
Definition: g722dsp.h:26
G722Context::G722Band
The band[0] and band[1] correspond respectively to the lower band and higher band.
Definition: g722.h:43
G722Context::node_buf
struct G722Context::TrellisNode * node_buf[2]
G722Context::G722Band::zero_mem
int16_t zero_mem[6]
Seventh-order zero section coefficient buffer.
Definition: g722.h:50
G722Context::G722Band::part_reconst_mem
int8_t part_reconst_mem[2]
signs of previous partially reconstructed signals
Definition: g722.h:46
G722Context::G722Band::s_zero
int32_t s_zero
previous output signal from zero predictor
Definition: g722.h:45
G722Context::dsp
G722DSPContext dsp
Definition: g722.h:66
G722Context::bits_per_codeword
int bits_per_codeword
Definition: g722.h:36
G722Context::G722Band::prev_qtzd_reconst
int16_t prev_qtzd_reconst
previous quantized reconstructed signal (internal value, using low_inv_quant4)
Definition: g722.h:47
ff_g722_update_low_predictor
void ff_g722_update_low_predictor(struct G722Band *band, const int ilow)
Definition: g722.c:143
int32_t
int32_t
Definition: audio_convert.c:194
G722Context
Definition: g722.h:34
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:67
G722Context::G722Band::log_factor
int16_t log_factor
delayed 2-logarithmic quantizer factor
Definition: g722.h:51
G722Context::G722Band::diff_mem
int32_t diff_mem[6]
quantizer difference signal memory
Definition: g722.h:49
G722Context::TrellisPath::prev
int prev
Definition: g722.h:63
ff_g722_low_inv_quant4
const int16_t ff_g722_low_inv_quant4[16]
Definition: g722.c:59
ff_g722_low_inv_quant6
const int16_t ff_g722_low_inv_quant6[64]
Definition: g722.c:63
G722Context::band
struct G722Context::G722Band band[2]
G722Context::TrellisPath
Definition: g722.h:61
G722Context::paths
struct G722Context::TrellisPath * paths[2]
ff_g722_update_high_predictor
void ff_g722_update_high_predictor(struct G722Band *band, const int dhigh, const int ihigh)
Definition: g722.c:154
G722Context::TrellisNode::ssd
uint32_t ssd
Definition: g722.h:57
G722Context::G722Band::scale_factor
int16_t scale_factor
delayed quantizer scale factor
Definition: g722.h:52
G722Context::G722Band::pole_mem
int16_t pole_mem[2]
second-order pole section coefficient buffer
Definition: g722.h:48
avcodec.h
G722Context::nodep_buf
struct G722Context::TrellisNode ** nodep_buf[2]
G722Context::G722Band::s_predictor
int16_t s_predictor
predictor output value
Definition: g722.h:44
g722dsp.h
G722Context::TrellisNode::path
int path
Definition: g722.h:58
G722Context::prev_samples
int16_t prev_samples[PREV_SAMPLES_BUF_SIZE]
memory of past decoded samples
Definition: g722.h:37
ff_g722_high_inv_quant
const int16_t ff_g722_high_inv_quant[4]
Definition: g722.c:51
G722Context::TrellisNode::state
struct G722Band state
Definition: g722.h:56
G722Context::TrellisNode
Definition: g722.h:55