FFmpeg
Classes | Macros | Typedefs | Variables
amrnbdec.c File Reference

AMR narrowband decoder. More...

#include <string.h>
#include <math.h>
#include "libavutil/channel_layout.h"
#include "libavutil/float_dsp.h"
#include "avcodec.h"
#include "libavutil/common.h"
#include "libavutil/avassert.h"
#include "celp_math.h"
#include "celp_filters.h"
#include "acelp_filters.h"
#include "acelp_vectors.h"
#include "acelp_pitch_delay.h"
#include "lsp.h"
#include "amr.h"
#include "internal.h"
#include "amrnbdata.h"

Classes

struct  AMRContext
 

Macros

#define AMR_BLOCK_SIZE   160
 samples per frame
 
#define AMR_SAMPLE_BOUND   32768.0
 threshold for synthesis overflow
 
#define AMR_SAMPLE_SCALE   (2.0 / 32768.0)
 Scale from constructed speech to [-1,1]. More...
 
#define PRED_FAC_MODE_12k2   0.65
 Prediction factor for 12.2kbit/s mode.
 
#define LSF_R_FAC   (8000.0 / 32768.0)
 LSF residual tables to Hertz.
 
#define MIN_LSF_SPACING   (50.0488 / 8000.0)
 Ensures stability of LPC filter.
 
#define PITCH_LAG_MIN_MODE_12k2   18
 Lower bound on decoded lag search in 12.2kbit/s mode.
 
#define MIN_ENERGY   -14.0
 Initial energy in dB. More...
 
#define SHARP_MAX   0.79449462890625
 Maximum sharpening factor. More...
 
#define AMR_TILT_RESPONSE   22
 Number of impulse response coefficients used for tilt factor.
 
#define AMR_TILT_GAMMA_T   0.8
 Tilt factor = 1st reflection coefficient * gamma_t.
 
#define AMR_AGC_ALPHA   0.9
 Adaptive gain control factor used in post-filter.
 

Typedefs

typedef struct AMRContext AMRContext
 

Variables

AVCodec ff_amrnb_decoder
 

Detailed Description

AMR narrowband decoder.

This decoder uses floats for simplicity and so is not bit-exact. One difference is that differences in phase can accumulate. The test sequences in 3GPP TS 26.074 can still be useful.

Macro Definition Documentation

§ AMR_SAMPLE_SCALE

#define AMR_SAMPLE_SCALE   (2.0 / 32768.0)

Scale from constructed speech to [-1,1].

AMR is designed to produce 16-bit PCM samples (3GPP TS 26.090 4.2) but upscales by two (section 6.2.2).

Fundamentally, this scale is determined by energy_mean through the fixed vector contribution to the excitation vector.

§ MIN_ENERGY

#define MIN_ENERGY   -14.0

Initial energy in dB.

Also used for bad frames (unimplemented).

§ SHARP_MAX

#define SHARP_MAX   0.79449462890625

Maximum sharpening factor.

The specification says 0.8, which should be 13107, but the reference C code uses 13017 instead. (Amusingly the same applies to SHARP_MAX in g729dec.c.)

Variable Documentation

§ ff_amrnb_decoder

AVCodec ff_amrnb_decoder
Initial value:
= {
.name = "amrnb",
.long_name = NULL_IF_CONFIG_SMALL("AMR-NB (Adaptive Multi-Rate NarrowBand)"),
.type = AVMEDIA_TYPE_AUDIO,
.id = AV_CODEC_ID_AMR_NB,
.priv_data_size = sizeof(AMRContext),
.init = amrnb_decode_init,
.decode = amrnb_decode_frame,
.capabilities = AV_CODEC_CAP_DR1,
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT,
AV_SAMPLE_FMT_NONE },
}
float
Definition: samplefmt.h:63
Definition: amrnbdec.c:100
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:959