36#define MAX_BACKWARD_FILTER_ORDER LPC
37#define MAX_BACKWARD_FILTER_LEN NFRSZ
38#define MAX_BACKWARD_FILTER_NONREC NONR
58 for (
int j = 0; j <
IDIM; j++)
67 for (
int i = 0;
i <
LPC;
i++)
117 int order,
int n,
int non_rec,
float *
out,
118 const float *hist,
float *out2,
const float *
window)
121 return out[order] != 0.0f;
126 float *gstate =
s->sbg +
NSBGSZ - 2;
128 for (
int idx = 0; idx <
NUPDATE; idx++) {
136 gain_db -=
s->gp[
i] * gstate[-
i];
142 gain =
powf(10.0f, (gain_db +
GOFF) * .05f) *
amptable[ig] * (1.0f/(1<<11));
148 for (
int i = 0;
i <
IDIM;
i++) {
149 statelpc[
i] =
av_clipf(statelpc[
i], -4095.0f, 4095.0f);
150 dst[idx*
IDIM +
i] = statelpc[
i] * (1.0f/(1<<12));
167 }
else if (idx == 1) {
169 memcpy(
s->a,
s->atmp,
sizeof(
float)*
LPC);
182 int *got_frame_ptr,
AVPacket *avpkt)
187 int nb_frames = avpkt->
size / 5;
195#define SAMPLES_PER_FRAME 20
201 for (
int i = 0;
i < nb_frames;
i++)
206 return nb_frames * 5;
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
const FFCodec ff_g728_decoder
static av_cold void close(AVCodecParserContext *s)
#define SAMPLES_PER_FRAME
Libavcodec external API header.
#define is(width, name, range_min, range_max, subs,...)
#define i(width, name, range_min, range_max)
void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs, const float *in, int buffer_length, int filter_length)
LP synthesis filter.
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int(* init)(AVBSFContext *ctx)
static SDL_Window * window
float ff_scalarproduct_float_c(const float *v1, const float *v2, int len)
Return the scalar product of two vectors of floats.
static void do_hybrid_window(void(*vector_fmul)(float *dst, const float *src0, const float *src1, int len), int order, int n, int non_rec, float *out, const float *hist, float *out2, const float *window)
Hybrid window filtering, see blocks 36 and 49 of the G.728 specification.
static const uint16_t g728_wnr[NSBSZ]
static const uint16_t g728_wnrg[NSBGSZ]
static const uint16_t g728_facv[LPC]
bitstream reader API header.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
#define AV_CHANNEL_LAYOUT_MONO
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int g728_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
static int hybrid_window(AVFloatDSPContext *fdsp, int order, int n, int non_rec, float *out, const float *hist, float *out2, const float *window)
static void decode_frame(G728Context *s, GetBitContext *gb, float *dst)
static av_cold int g728_decode_init(AVCodecContext *avctx)
static float g728_gq_db[8]
static float g728_facv_f[FFALIGN(LPC, 16)]
static float g728_y_db[128]
static av_cold int g728_decode_close(AVCodecContext *avctx)
static float g728_wnr_r[FFALIGN(NSBSZ, 16)]
static av_cold void g728_init_static_data(void)
static float g728_wnrg_r[FFALIGN(NSBGSZ, 16)]
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context.
static int ff_thread_once(char *control, void(*routine)(void))
static int compute_lpc_coefs(const LPC_TYPE *autoc, int i, int max_order, LPC_TYPE *lpc, int lpc_stride, int fail, int normalize, LPC_TYPE *err_ptr)
Levinson-Durbin recursion.
Memory handling functions.
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
static const float gain_bw_tab[FFALIGN(10, 16)]
gain bandwidth broadening table
static const int16_t codetable[128][5]
static const float amptable[8]
#define FF_ARRAY_ELEMS(a)
An AVChannelLayout holds information about the channel layout of audio data.
main external API structure.
AVChannelLayout ch_layout
Audio channel layout.
enum AVSampleFormat sample_fmt
audio sample format
int sample_rate
samples per second
int flags
AV_CODEC_FLAG_*.
void(* vector_fmul)(float *dst, const float *src0, const float *src1, int len)
Calculate the entry wise product of two vectors of floats and store the result in a vector of floats.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
float atmp[FFALIGN(LPC, 16)]
float gp[FFALIGN(LPCLG, 16)]