FFmpeg
Data Structures | Macros | Functions | Variables
sipr.c File Reference
#include <math.h>
#include <stdint.h>
#include <string.h>
#include "libavutil/channel_layout.h"
#include "libavutil/float_dsp.h"
#include "libavutil/mathematics.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "decode.h"
#include "get_bits.h"
#include "lsp.h"
#include "acelp_vectors.h"
#include "acelp_pitch_delay.h"
#include "acelp_filters.h"
#include "celp_filters.h"
#include "sipr.h"
#include "siprdata.h"

Go to the source code of this file.

Data Structures

struct  SiprModeParam
 

Macros

#define BITSTREAM_READER_LE
 
#define MAX_SUBFRAME_COUNT   5
 

Functions

static void dequant (float *out, const int *idx, const float *const cbs[])
 
static void lsf_decode_fp (float *lsfnew, float *lsf_history, const SiprParameters *parm)
 
static void pitch_sharpening (int pitch_lag_int, float beta, float *fixed_vector)
 Apply pitch lag to the fixed vector (AMR section 6.1.2). More...
 
static void decode_parameters (SiprParameters *parms, GetBitContext *pgb, const SiprModeParam *p)
 Extract decoding parameters from the input bitstream. More...
 
static void sipr_decode_lp (float *lsfnew, const float *lsfold, float *Az, int num_subfr)
 
static void eval_ir (const float *Az, int pitch_lag, float *freq, float pitch_sharp_factor)
 Evaluate the adaptive impulse response. More...
 
static void convolute_with_sparse (float *out, const AMRFixed *pulses, const float *shape, int length)
 Evaluate the convolution of a vector with a sparse vector. More...
 
static void postfilter_5k0 (SiprContext *ctx, const float *lpc, float *samples)
 Apply postfilter, very similar to AMR one. More...
 
static void decode_fixed_sparse (AMRFixed *fixed_sparse, const int16_t *pulses, SiprMode mode, int low_gain)
 
static void decode_frame (SiprContext *ctx, SiprParameters *params, float *out_data)
 
static av_cold int sipr_decoder_init (AVCodecContext *avctx)
 
static int sipr_decode_frame (AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
 

Variables

static const SiprModeParam modes [MODE_COUNT]
 
const float ff_pow_0_5 []
 
const FFCodec ff_sipr_decoder
 

Macro Definition Documentation

◆ BITSTREAM_READER_LE

#define BITSTREAM_READER_LE

Definition at line 32 of file sipr.c.

◆ MAX_SUBFRAME_COUNT

#define MAX_SUBFRAME_COUNT   5

Definition at line 43 of file sipr.c.

Function Documentation

◆ dequant()

static void dequant ( float out,
const int idx,
const float *const  cbs[] 
)
static

Definition at line 143 of file sipr.c.

Referenced by lsf_decode_fp().

◆ lsf_decode_fp()

static void lsf_decode_fp ( float lsfnew,
float lsf_history,
const SiprParameters parm 
)
static

Definition at line 154 of file sipr.c.

Referenced by decode_frame().

◆ pitch_sharpening()

static void pitch_sharpening ( int  pitch_lag_int,
float  beta,
float fixed_vector 
)
static

Apply pitch lag to the fixed vector (AMR section 6.1.2).

Definition at line 180 of file sipr.c.

Referenced by eval_ir().

◆ decode_parameters()

static void decode_parameters ( SiprParameters parms,
GetBitContext pgb,
const SiprModeParam p 
)
static

Extract decoding parameters from the input bitstream.

Parameters
parmsparameters structure
pgbpointer to initialized GetBitContext structure

Definition at line 194 of file sipr.c.

Referenced by sipr_decode_frame().

◆ sipr_decode_lp()

static void sipr_decode_lp ( float lsfnew,
const float lsfold,
float Az,
int  num_subfr 
)
static

Definition at line 217 of file sipr.c.

Referenced by decode_frame().

◆ eval_ir()

static void eval_ir ( const float Az,
int  pitch_lag,
float freq,
float  pitch_sharp_factor 
)
static

Evaluate the adaptive impulse response.

Definition at line 238 of file sipr.c.

Referenced by decode_frame().

◆ convolute_with_sparse()

static void convolute_with_sparse ( float out,
const AMRFixed pulses,
const float shape,
int  length 
)
static

Evaluate the convolution of a vector with a sparse vector.

Definition at line 260 of file sipr.c.

Referenced by decode_frame().

◆ postfilter_5k0()

static void postfilter_5k0 ( SiprContext ctx,
const float lpc,
float samples 
)
static

Apply postfilter, very similar to AMR one.

Definition at line 274 of file sipr.c.

Referenced by decode_frame().

◆ decode_fixed_sparse()

static void decode_fixed_sparse ( AMRFixed fixed_sparse,
const int16_t *  pulses,
SiprMode  mode,
int  low_gain 
)
static

Definition at line 309 of file sipr.c.

Referenced by decode_frame().

◆ decode_frame()

static void decode_frame ( SiprContext ctx,
SiprParameters params,
float out_data 
)
static

Definition at line 365 of file sipr.c.

Referenced by sipr_decoder_init().

◆ sipr_decoder_init()

static av_cold int sipr_decoder_init ( AVCodecContext avctx)
static

Definition at line 481 of file sipr.c.

◆ sipr_decode_frame()

static int sipr_decode_frame ( AVCodecContext avctx,
AVFrame frame,
int got_frame_ptr,
AVPacket avpkt 
)
static

Definition at line 523 of file sipr.c.

Variable Documentation

◆ modes

const SiprModeParam modes[MODE_COUNT]
static

◆ ff_pow_0_5

const float ff_pow_0_5[]
Initial value:
= {
1.0/(1 << 1), 1.0/(1 << 2), 1.0/(1 << 3), 1.0/(1 << 4),
1.0/(1 << 5), 1.0/(1 << 6), 1.0/(1 << 7), 1.0/(1 << 8),
1.0/(1 << 9), 1.0/(1 << 10), 1.0/(1 << 11), 1.0/(1 << 12),
1.0/(1 << 13), 1.0/(1 << 14), 1.0/(1 << 15), 1.0/(1 << 16)
}

Definition at line 136 of file sipr.c.

Referenced by postfilter(), and postfilter_5k0().

◆ ff_sipr_decoder

const FFCodec ff_sipr_decoder
Initial value:
= {
.p.name = "sipr",
CODEC_LONG_NAME("RealAudio SIPR / ACELP.NET"),
.p.type = AVMEDIA_TYPE_AUDIO,
.priv_data_size = sizeof(SiprContext),
}

Definition at line 564 of file sipr.c.

AV_CODEC_ID_SIPR
@ AV_CODEC_ID_SIPR
Definition: codec_id.h:481
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:286
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:271
AV_CODEC_CAP_CHANNEL_CONF
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition: codec.h:106
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:366
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
sipr_decode_frame
static int sipr_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
Definition: sipr.c:523
SiprContext
Definition: sipr.h:64
sipr_decoder_init
static av_cold int sipr_decoder_init(AVCodecContext *avctx)
Definition: sipr.c:481