FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
dss_sp.c File Reference
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "get_bits.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  DssSpSubframe
 
struct  DssSpFrame
 
struct  DssSpContext
 

Macros

#define SUBFRAMES   4
 
#define PULSE_MAX   8
 
#define DSS_SP_FRAME_SIZE   42
 
#define DSS_SP_SAMPLE_COUNT   (66 * SUBFRAMES)
 
#define DSS_SP_FORMULA(a, b, c)   ((int)((((a) * (1 << 15)) + (b) * (unsigned)(c)) + 0x4000) >> 15)
 

Functions

static av_cold int dss_sp_decode_init (AVCodecContext *avctx)
 
static void dss_sp_unpack_coeffs (DssSpContext *p, const uint8_t *src)
 
static void dss_sp_unpack_filter (DssSpContext *p)
 
static void dss_sp_convert_coeffs (int32_t *lpc_filter, int32_t *coeffs)
 
static void dss_sp_add_pulses (int32_t *vector_buf, const struct DssSpSubframe *sf)
 
static void dss_sp_gen_exc (int32_t *vector, int32_t *prev_exc, int pitch_lag, int gain)
 
static void dss_sp_scale_vector (int32_t *vec, int bits, int size)
 
static void dss_sp_update_buf (int32_t *hist, int32_t *vector)
 
static void dss_sp_shift_sq_sub (const int32_t *filter_buf, int32_t *error_buf, int32_t *dst)
 
static void dss_sp_shift_sq_add (const int32_t *filter_buf, int32_t *audio_buf, int32_t *dst)
 
static void dss_sp_vec_mult (const int32_t *src, int32_t *dst, const int16_t *mult)
 
static int dss_sp_get_normalize_bits (int32_t *vector_buf, int16_t size)
 
static int dss_sp_vector_sum (DssSpContext *p, int size)
 
static void dss_sp_sf_synthesis (DssSpContext *p, int32_t lpc_filter, int32_t *dst, int size)
 
static void dss_sp_update_state (DssSpContext *p, int32_t *dst)
 
static void dss_sp_32to16bit (int16_t *dst, int32_t *src, int size)
 
static int dss_sp_decode_one_frame (DssSpContext *p, int16_t *abuf_dst, const uint8_t *abuf_src)
 
static int dss_sp_decode_frame (AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
 

Variables

static const uint32_t dss_sp_combinatorial_table [PULSE_MAX][72]
 
static const int16_t dss_sp_filter_cb [14][32]
 
static const uint16_t dss_sp_fixed_cb_gain [64]
 
static const int16_t dss_sp_pulse_val [8]
 
static const uint16_t binary_decreasing_array []
 
static const uint16_t dss_sp_unc_decreasing_array []
 
static const uint16_t dss_sp_adaptive_gain []
 
static const int32_t dss_sp_sinc [67]
 
AVCodec ff_dss_sp_decoder
 

Macro Definition Documentation

#define SUBFRAMES   4

Definition at line 31 of file dss_sp.c.

Referenced by dss_sp_decode_one_frame(), dss_sp_unpack_coeffs(), and dss_sp_update_state().

#define PULSE_MAX   8

Definition at line 32 of file dss_sp.c.

Referenced by dss_sp_unpack_coeffs(), gen_fcb_excitation(), and pack_fcb_param().

#define DSS_SP_FRAME_SIZE   42

Definition at line 34 of file dss_sp.c.

Referenced by dss_sp_decode_frame(), and dss_sp_unpack_coeffs().

#define DSS_SP_SAMPLE_COUNT   (66 * SUBFRAMES)

Definition at line 35 of file dss_sp.c.

Referenced by dss_sp_decode_frame().

#define DSS_SP_FORMULA (   a,
  b,
  c 
)    ((int)((((a) * (1 << 15)) + (b) * (unsigned)(c)) + 0x4000) >> 15)

Definition at line 36 of file dss_sp.c.

Referenced by dss_sp_convert_coeffs(), and dss_sp_sf_synthesis().

Function Documentation

static av_cold int dss_sp_decode_init ( AVCodecContext avctx)
static

Definition at line 290 of file dss_sp.c.

static void dss_sp_unpack_coeffs ( DssSpContext p,
const uint8_t src 
)
static

Definition at line 305 of file dss_sp.c.

Referenced by dss_sp_decode_one_frame().

static void dss_sp_unpack_filter ( DssSpContext p)
static

Definition at line 429 of file dss_sp.c.

Referenced by dss_sp_decode_one_frame().

static void dss_sp_convert_coeffs ( int32_t lpc_filter,
int32_t coeffs 
)
static

Definition at line 437 of file dss_sp.c.

Referenced by dss_sp_decode_one_frame().

static void dss_sp_add_pulses ( int32_t vector_buf,
const struct DssSpSubframe sf 
)
static

Definition at line 462 of file dss_sp.c.

Referenced by dss_sp_decode_one_frame().

static void dss_sp_gen_exc ( int32_t vector,
int32_t prev_exc,
int  pitch_lag,
int  gain 
)
static

Definition at line 473 of file dss_sp.c.

Referenced by dss_sp_decode_one_frame().

static void dss_sp_scale_vector ( int32_t vec,
int  bits,
int  size 
)
static

Definition at line 493 of file dss_sp.c.

Referenced by dss_sp_sf_synthesis().

static void dss_sp_update_buf ( int32_t hist,
int32_t vector 
)
static

Definition at line 505 of file dss_sp.c.

Referenced by dss_sp_decode_one_frame().

static void dss_sp_shift_sq_sub ( const int32_t filter_buf,
int32_t error_buf,
int32_t dst 
)
static

Definition at line 516 of file dss_sp.c.

Referenced by dss_sp_decode_one_frame(), and dss_sp_sf_synthesis().

static void dss_sp_shift_sq_add ( const int32_t filter_buf,
int32_t audio_buf,
int32_t dst 
)
static

Definition at line 540 of file dss_sp.c.

Referenced by dss_sp_sf_synthesis().

static void dss_sp_vec_mult ( const int32_t src,
int32_t dst,
const int16_t *  mult 
)
static

Definition at line 562 of file dss_sp.c.

Referenced by dss_sp_sf_synthesis().

static int dss_sp_get_normalize_bits ( int32_t vector_buf,
int16_t  size 
)
static

Definition at line 573 of file dss_sp.c.

Referenced by dss_sp_sf_synthesis().

static int dss_sp_vector_sum ( DssSpContext p,
int  size 
)
static

Definition at line 588 of file dss_sp.c.

Referenced by dss_sp_sf_synthesis().

static void dss_sp_sf_synthesis ( DssSpContext p,
int32_t  lpc_filter,
int32_t dst,
int  size 
)
static

Definition at line 596 of file dss_sp.c.

Referenced by dss_sp_decode_one_frame().

static void dss_sp_update_state ( DssSpContext p,
int32_t dst 
)
static

Definition at line 669 of file dss_sp.c.

Referenced by dss_sp_decode_one_frame().

static void dss_sp_32to16bit ( int16_t *  dst,
int32_t src,
int  size 
)
static

Definition at line 698 of file dss_sp.c.

Referenced by dss_sp_decode_one_frame().

static int dss_sp_decode_one_frame ( DssSpContext p,
int16_t *  abuf_dst,
const uint8_t abuf_src 
)
static

Definition at line 706 of file dss_sp.c.

Referenced by dss_sp_decode_frame().

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

Definition at line 743 of file dss_sp.c.

Variable Documentation

const uint32_t dss_sp_combinatorial_table[PULSE_MAX][72]
static

Definition at line 75 of file dss_sp.c.

Referenced by dss_sp_unpack_coeffs().

const int16_t dss_sp_filter_cb[14][32]
static

Definition at line 174 of file dss_sp.c.

Referenced by dss_sp_unpack_filter().

const uint16_t dss_sp_fixed_cb_gain[64]
static
Initial value:
= {
0, 4, 8, 13, 17, 22, 26, 31,
35, 40, 44, 48, 53, 58, 63, 69,
76, 83, 91, 99, 109, 119, 130, 142,
155, 170, 185, 203, 222, 242, 265, 290,
317, 346, 378, 414, 452, 494, 540, 591,
646, 706, 771, 843, 922, 1007, 1101, 1204,
1316, 1438, 1572, 1719, 1879, 2053, 2244, 2453,
2682, 2931, 3204, 3502, 3828, 4184, 4574, 5000,
}

Definition at line 246 of file dss_sp.c.

Referenced by dss_sp_add_pulses().

const int16_t dss_sp_pulse_val[8]
static
Initial value:
= {
-31182, -22273, -13364, -4455, 4455, 13364, 22273, 31182
}

Definition at line 257 of file dss_sp.c.

Referenced by dss_sp_add_pulses().

const uint16_t binary_decreasing_array[]
static
Initial value:
= {
32767, 16384, 8192, 4096, 2048, 1024, 512, 256,
128, 64, 32, 16, 8, 4, 2,
}

Definition at line 261 of file dss_sp.c.

Referenced by dss_sp_sf_synthesis().

const uint16_t dss_sp_unc_decreasing_array[]
static
Initial value:
= {
32767, 26214, 20972, 16777, 13422, 10737, 8590, 6872,
5498, 4398, 3518, 2815, 2252, 1801, 1441,
}

Definition at line 266 of file dss_sp.c.

Referenced by dss_sp_sf_synthesis().

const uint16_t dss_sp_adaptive_gain[]
static
Initial value:
= {
102, 231, 360, 488, 617, 746, 875, 1004,
1133, 1261, 1390, 1519, 1648, 1777, 1905, 2034,
2163, 2292, 2421, 2550, 2678, 2807, 2936, 3065,
3194, 3323, 3451, 3580, 3709, 3838, 3967, 4096,
}

Definition at line 271 of file dss_sp.c.

Referenced by dss_sp_decode_one_frame().

const int32_t dss_sp_sinc[67]
static
Initial value:
= {
262, 293, 323, 348, 356, 336, 269, 139,
-67, -358, -733, -1178, -1668, -2162, -2607, -2940,
-3090, -2986, -2562, -1760, -541, 1110, 3187, 5651,
8435, 11446, 14568, 17670, 20611, 23251, 25460, 27125,
28160, 28512, 28160,
27125, 25460, 23251, 20611, 17670, 14568, 11446, 8435,
5651, 3187, 1110, -541, -1760, -2562, -2986, -3090,
-2940, -2607, -2162, -1668, -1178, -733, -358, -67,
139, 269, 336, 356, 348, 323, 293, 262,
}

Definition at line 278 of file dss_sp.c.

Referenced by dss_sp_update_state().

AVCodec ff_dss_sp_decoder
Initial value:
= {
.name = "dss_sp",
.long_name = NULL_IF_CONFIG_SMALL("Digital Speech Standard - Standard Play mode (DSS SP)"),
.priv_data_size = sizeof(DssSpContext),
.capabilities = AV_CODEC_CAP_DR1,
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:42
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
static av_cold int dss_sp_decode_init(AVCodecContext *avctx)
Definition: dss_sp.c:290
static int dss_sp_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Definition: dss_sp.c:743
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:1002

Definition at line 776 of file dss_sp.c.