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 "get_bits.h"
#include "internal.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"
Include dependency graph for sipr.c:

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 *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, void *data, int *got_frame_ptr, AVPacket *avpkt)
 

Variables

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

Macro Definition Documentation

#define BITSTREAM_READER_LE

Definition at line 32 of file sipr.c.

#define MAX_SUBFRAME_COUNT   5

Definition at line 42 of file sipr.c.

Referenced by decode_frame().

Function Documentation

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 259 of file sipr.c.

Referenced by decode_frame().

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

Definition at line 308 of file sipr.c.

Referenced by decode_frame().

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

Definition at line 364 of file sipr.c.

Referenced by sipr_decoder_init().

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 193 of file sipr.c.

Referenced by sipr_decode_frame().

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

Definition at line 142 of file sipr.c.

Referenced by lsf_decode_fp().

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 237 of file sipr.c.

Referenced by decode_frame().

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

Definition at line 153 of file sipr.c.

Referenced by decode_frame().

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 179 of file sipr.c.

Referenced by eval_ir().

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

Apply postfilter, very similar to AMR one.

Definition at line 273 of file sipr.c.

Referenced by decode_frame().

static int sipr_decode_frame ( AVCodecContext avctx,
void data,
int *  got_frame_ptr,
AVPacket avpkt 
)
static

Definition at line 522 of file sipr.c.

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

Definition at line 216 of file sipr.c.

Referenced by decode_frame().

static av_cold int sipr_decoder_init ( AVCodecContext avctx)
static

Definition at line 480 of file sipr.c.

Variable Documentation

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 135 of file sipr.c.

Referenced by postfilter(), and postfilter_5k0().

AVCodec ff_sipr_decoder
Initial value:
= {
.name = "sipr",
.priv_data_size = sizeof(SiprContext),
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("RealAudio SIPR / ACELP.NET"),
}
struct SiprContext SiprContext
static av_cold int sipr_decoder_init(AVCodecContext *avctx)
Definition: sipr.c:480
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int sipr_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Definition: sipr.c:522
static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: crystalhd.c:868

Definition at line 565 of file sipr.c.

const SiprModeParam modes[MODE_COUNT]
static

Definition at line 69 of file sipr.c.

Referenced by decode_mb_mode().