FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions | Variables
aacps.c File Reference
#include <stdint.h>
#include "libavutil/common.h"
#include "libavutil/mathematics.h"
#include "avcodec.h"
#include "get_bits.h"
#include "aacps.h"
#include "libavutil/internal.h"
#include "aacps_tablegen.h"
#include "aacpsdata.c"

Go to the source code of this file.

Macros

#define PS_BASELINE   0
 Operate in Baseline PS mode. More...
 
#define numQMFSlots   32
 
#define READ_PAR_DATA(PAR, OFFSET, MASK, ERR_CONDITION)
 
#define DECAY_SLOPE   Q30(0.05f)
 All-pass filter decay slope. More...
 
#define PS_INIT_VLC_STATIC(num, size)
 
#define PS_VLC_ROW(name)   { name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) }
 

Enumerations

enum  {
  huff_iid_df1, huff_iid_dt1, huff_iid_df0, huff_iid_dt0,
  huff_icc_df, huff_icc_dt, huff_ipd_df, huff_ipd_dt,
  huff_opd_df, huff_opd_dt
}
 

Functions

static int read_iid_data (AVCodecContext *avctx, GetBitContext *gb, PSContext *ps, int8_t(*iid)[34], int table_idx, int e, int dt)
 \ * Read Inter-channel Intensity Difference/Inter-Channel Coherence/ \ * Inter-channel Phase Difference/Overall Phase Difference parameters from the \ * bitstream. More...
 
static int read_icc_data (AVCodecContext *avctx, GetBitContext *gb, PSContext *ps, int8_t(*icc)[34], int table_idx, int e, int dt)
 \ * Read Inter-channel Intensity Difference/Inter-Channel Coherence/ \ * Inter-channel Phase Difference/Overall Phase Difference parameters from the \ * bitstream. More...
 
static int read_ipdopd_data (AVCodecContext *avctx, GetBitContext *gb, PSContext *ps, int8_t(*ipdopd)[34], int table_idx, int e, int dt)
 \ * Read Inter-channel Intensity Difference/Inter-Channel Coherence/ \ * Inter-channel Phase Difference/Overall Phase Difference parameters from the \ * bitstream. More...
 
static int ps_read_extension_data (GetBitContext *gb, PSContext *ps, int ps_extension_id)
 
static void ipdopd_reset (int8_t *ipd_hist, int8_t *opd_hist)
 
int AAC_RENAME() ff_ps_read_data (AVCodecContext *avctx, GetBitContext *gb_host, PSContext *ps, int bits_left)
 
static void hybrid2_re (INTFLOAT(*in)[2], INTFLOAT(*out)[32][2], const INTFLOAT filter[8], int len, int reverse)
 Split one subband into 2 subsubbands with a symmetric real filter. More...
 
static void hybrid6_cx (PSDSPContext *dsp, INTFLOAT(*in)[2], INTFLOAT(*out)[32][2], TABLE_CONST INTFLOAT(*filter)[8][2], int len)
 Split one subband into 6 subsubbands with a complex filter. More...
 
static void hybrid4_8_12_cx (PSDSPContext *dsp, INTFLOAT(*in)[2], INTFLOAT(*out)[32][2], TABLE_CONST INTFLOAT(*filter)[8][2], int N, int len)
 
static void hybrid_analysis (PSDSPContext *dsp, INTFLOAT out[91][32][2], INTFLOAT in[5][44][2], INTFLOAT L[2][38][64], int is34, int len)
 
static void hybrid_synthesis (PSDSPContext *dsp, INTFLOAT out[2][38][64], INTFLOAT in[91][32][2], int is34, int len)
 
static void map_idx_10_to_20 (int8_t *par_mapped, const int8_t *par, int full)
 Table 8.46. More...
 
static void map_idx_34_to_20 (int8_t *par_mapped, const int8_t *par, int full)
 
static void map_val_34_to_20 (INTFLOAT par[PS_MAX_NR_IIDICC])
 
static void map_idx_10_to_34 (int8_t *par_mapped, const int8_t *par, int full)
 
static void map_idx_20_to_34 (int8_t *par_mapped, const int8_t *par, int full)
 
static void map_val_20_to_34 (INTFLOAT par[PS_MAX_NR_IIDICC])
 
static void decorrelation (PSContext *ps, INTFLOAT(*out)[32][2], const INTFLOAT(*s)[32][2], int is34)
 
static void remap34 (int8_t(**p_par_mapped)[PS_MAX_NR_IIDICC], int8_t(*par)[PS_MAX_NR_IIDICC], int num_par, int num_env, int full)
 
static void remap20 (int8_t(**p_par_mapped)[PS_MAX_NR_IIDICC], int8_t(*par)[PS_MAX_NR_IIDICC], int num_par, int num_env, int full)
 
static void stereo_processing (PSContext *ps, INTFLOAT(*l)[32][2], INTFLOAT(*r)[32][2], int is34)
 
int AAC_RENAME() ff_ps_apply (AVCodecContext *avctx, PSContext *ps, INTFLOAT L[2][38][64], INTFLOAT R[2][38][64], int top)
 
av_cold void AAC_RENAME() ff_ps_init (void)
 
av_cold void AAC_RENAME() ff_ps_ctx_init (PSContext *ps)
 

Variables

static const int8_t num_env_tab [2][4]
 
static const int8_t nr_iidicc_par_tab []
 
static const int8_t nr_iidopd_par_tab []
 
static const int huff_iid []
 
static VLC vlc_ps [10]
 
static const int NR_PAR_BANDS [] = { 20, 34 }
 Number of frequency bands that can be addressed by the parameter index, b(k) More...
 
static const int NR_IPDOPD_BANDS [] = { 11, 17 }
 
static const int NR_BANDS [] = { 71, 91 }
 Number of frequency bands that can be addressed by the sub subband index, k. More...
 
static const int DECAY_CUTOFF [] = { 10, 32 }
 Start frequency band for the all-pass filter decay slope. More...
 
static const int NR_ALLPASS_BANDS [] = { 30, 50 }
 Number of all-pass filer bands. More...
 
static const int SHORT_DELAY_BAND [] = { 42, 62 }
 First stereo band using the short one sample delay. More...
 

Macro Definition Documentation

#define PS_BASELINE   0

Operate in Baseline PS mode.

Baseline implies 10 or 20 stereo bands, mixing mode A, and no ipd/opd

Definition at line 39 of file aacps.c.

Referenced by ff_ps_read_data(), and stereo_processing().

#define numQMFSlots   32

Definition at line 43 of file aacps.c.

Referenced by decorrelation(), and ff_ps_read_data().

#define READ_PAR_DATA (   PAR,
  OFFSET,
  MASK,
  ERR_CONDITION 
)

Definition at line 80 of file aacps.c.

#define DECAY_SLOPE   Q30(0.05f)

All-pass filter decay slope.

Definition at line 450 of file aacps.c.

Referenced by decorrelation().

#define PS_INIT_VLC_STATIC (   num,
  size 
)
Value:
INIT_VLC_STATIC(&vlc_ps[num], 9, ps_tmp[num].table_size / ps_tmp[num].elem_size, \
ps_tmp[num].ps_bits, 1, 1, \
ps_tmp[num].ps_codes, ps_tmp[num].elem_size, ps_tmp[num].elem_size, \
size);
#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size)
Definition: vlc.h:75
ptrdiff_t size
Definition: opengl_enc.c:101
static VLC vlc_ps[10]
Definition: aacps.c:78

Definition at line 1002 of file aacps.c.

Referenced by ff_ps_init().

#define PS_VLC_ROW (   name)    { name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) }

Definition at line 1008 of file aacps.c.

Referenced by ff_ps_init().

Enumeration Type Documentation

anonymous enum
Enumerator
huff_iid_df1 
huff_iid_dt1 
huff_iid_df0 
huff_iid_dt0 
huff_icc_df 
huff_icc_dt 
huff_ipd_df 
huff_ipd_dt 
huff_opd_df 
huff_opd_dt 

Definition at line 58 of file aacps.c.

Function Documentation

static int read_iid_data ( AVCodecContext avctx,
GetBitContext gb,
PSContext ps,
int8_t(*)  iid[34],
int  table_idx,
int  e,
int  dt 
)
static

\ * Read Inter-channel Intensity Difference/Inter-Channel Coherence/ \ * Inter-channel Phase Difference/Overall Phase Difference parameters from the \ * bitstream.

\ * \ *

Parameters
avctxcontains the current codec context \ *
gbpointer to the input bitstream \ *
pspointer to the Parametric Stereo context \ *
iidpointer to the parameter to be read \ *
eenvelope to decode \ *
dt1: time delta-coded, 0: frequency delta-coded \

Definition at line 124 of file aacps.c.

Referenced by ff_ps_read_data().

static int read_icc_data ( AVCodecContext avctx,
GetBitContext gb,
PSContext ps,
int8_t(*)  icc[34],
int  table_idx,
int  e,
int  dt 
)
static

\ * Read Inter-channel Intensity Difference/Inter-Channel Coherence/ \ * Inter-channel Phase Difference/Overall Phase Difference parameters from the \ * bitstream.

\ * \ *

Parameters
avctxcontains the current codec context \ *
gbpointer to the input bitstream \ *
pspointer to the Parametric Stereo context \ *
iccpointer to the parameter to be read \ *
eenvelope to decode \ *
dt1: time delta-coded, 0: frequency delta-coded \

Definition at line 125 of file aacps.c.

Referenced by ff_ps_read_data().

static int read_ipdopd_data ( AVCodecContext avctx,
GetBitContext gb,
PSContext ps,
int8_t(*)  ipdopd[34],
int  table_idx,
int  e,
int  dt 
)
static

\ * Read Inter-channel Intensity Difference/Inter-Channel Coherence/ \ * Inter-channel Phase Difference/Overall Phase Difference parameters from the \ * bitstream.

\ * \ *

Parameters
avctxcontains the current codec context \ *
gbpointer to the input bitstream \ *
pspointer to the Parametric Stereo context \ *
ipdopdpointer to the parameter to be read \ *
eenvelope to decode \ *
dt1: time delta-coded, 0: frequency delta-coded \

Definition at line 126 of file aacps.c.

Referenced by ps_read_extension_data().

static int ps_read_extension_data ( GetBitContext gb,
PSContext ps,
int  ps_extension_id 
)
static

Definition at line 128 of file aacps.c.

Referenced by ff_ps_read_data().

static void ipdopd_reset ( int8_t *  ipd_hist,
int8_t *  opd_hist 
)
static

Definition at line 149 of file aacps.c.

Referenced by stereo_processing().

int AAC_RENAME() ff_ps_read_data ( AVCodecContext avctx,
GetBitContext gb_host,
PSContext ps,
int  bits_left 
)

Definition at line 158 of file aacps.c.

Referenced by read_sbr_extension().

static void hybrid2_re ( INTFLOAT(*)  in[2],
INTFLOAT(*)  out[32][2],
const INTFLOAT  filter[8],
int  len,
int  reverse 
)
static

Split one subband into 2 subsubbands with a symmetric real filter.

The filter must have its non-center even coefficients equal to zero.

Definition at line 317 of file aacps.c.

Referenced by hybrid_analysis().

static void hybrid6_cx ( PSDSPContext dsp,
INTFLOAT(*)  in[2],
INTFLOAT(*)  out[32][2],
TABLE_CONST INTFLOAT(*)  filter[8][2],
int  len 
)
static

Split one subband into 6 subsubbands with a complex filter.

Definition at line 343 of file aacps.c.

Referenced by hybrid_analysis().

static void hybrid4_8_12_cx ( PSDSPContext dsp,
INTFLOAT(*)  in[2],
INTFLOAT(*)  out[32][2],
TABLE_CONST INTFLOAT(*)  filter[8][2],
int  N,
int  len 
)
static

Definition at line 367 of file aacps.c.

Referenced by hybrid_analysis().

static void hybrid_analysis ( PSDSPContext dsp,
INTFLOAT  out[91][32][2],
INTFLOAT  in[5][44][2],
INTFLOAT  L[2][38][64],
int  is34,
int  len 
)
static

Definition at line 378 of file aacps.c.

Referenced by ff_ps_apply().

static void hybrid_synthesis ( PSDSPContext dsp,
INTFLOAT  out[2][38][64],
INTFLOAT  in[91][32][2],
int  is34,
int  len 
)
static

Definition at line 408 of file aacps.c.

Referenced by ff_ps_apply().

static void map_idx_10_to_20 ( int8_t *  par_mapped,
const int8_t *  par,
int  full 
)
static

Table 8.46.

Definition at line 464 of file aacps.c.

Referenced by remap20().

static void map_idx_34_to_20 ( int8_t *  par_mapped,
const int8_t *  par,
int  full 
)
static

Definition at line 478 of file aacps.c.

Referenced by remap20().

static void map_val_34_to_20 ( INTFLOAT  par[PS_MAX_NR_IIDICC])
static

Definition at line 504 of file aacps.c.

Referenced by stereo_processing().

static void map_idx_10_to_34 ( int8_t *  par_mapped,
const int8_t *  par,
int  full 
)
static

Definition at line 543 of file aacps.c.

Referenced by remap34().

static void map_idx_20_to_34 ( int8_t *  par_mapped,
const int8_t *  par,
int  full 
)
static

Definition at line 585 of file aacps.c.

Referenced by remap34().

static void map_val_20_to_34 ( INTFLOAT  par[PS_MAX_NR_IIDICC])
static

Definition at line 625 of file aacps.c.

Referenced by stereo_processing().

static void decorrelation ( PSContext ps,
INTFLOAT(*)  out[32][2],
const INTFLOAT(*)  s[32][2],
int  is34 
)
static

< Smoothing coefficient

Definition at line 662 of file aacps.c.

Referenced by ff_ps_apply().

static void remap34 ( int8_t(**)  p_par_mapped[PS_MAX_NR_IIDICC],
int8_t(*)  par[PS_MAX_NR_IIDICC],
int  num_par,
int  num_env,
int  full 
)
static

Definition at line 782 of file aacps.c.

Referenced by stereo_processing().

static void remap20 ( int8_t(**)  p_par_mapped[PS_MAX_NR_IIDICC],
int8_t(*)  par[PS_MAX_NR_IIDICC],
int  num_par,
int  num_env,
int  full 
)
static

Definition at line 801 of file aacps.c.

Referenced by stereo_processing().

static void stereo_processing ( PSContext ps,
INTFLOAT(*)  l[32][2],
INTFLOAT(*)  r[32][2],
int  is34 
)
static

Definition at line 820 of file aacps.c.

Referenced by ff_ps_apply().

int AAC_RENAME() ff_ps_apply ( AVCodecContext avctx,
PSContext ps,
INTFLOAT  L[2][38][64],
INTFLOAT  R[2][38][64],
int  top 
)

Definition at line 981 of file aacps.c.

Referenced by ff_sbr_apply().

av_cold void AAC_RENAME() ff_ps_init ( void  )

Definition at line 1011 of file aacps.c.

Referenced by ff_aac_sbr_init().

av_cold void AAC_RENAME() ff_ps_ctx_init ( PSContext ps)

Definition at line 1043 of file aacps.c.

Referenced by ff_aac_sbr_ctx_init().

Variable Documentation

const int8_t num_env_tab[2][4]
static
Initial value:
= {
{ 0, 1, 2, 4, },
{ 1, 2, 3, 4, },
}

Definition at line 45 of file aacps.c.

Referenced by ff_ps_read_data().

const int8_t nr_iidicc_par_tab[]
static
Initial value:
= {
10, 20, 34, 10, 20, 34,
}

Definition at line 50 of file aacps.c.

Referenced by ff_ps_read_data().

const int8_t nr_iidopd_par_tab[]
static
Initial value:
= {
5, 11, 17, 5, 11, 17,
}

Definition at line 54 of file aacps.c.

Referenced by ff_ps_read_data().

const int huff_iid[]
static
Initial value:

Definition at line 71 of file aacps.c.

Referenced by ff_ps_read_data().

VLC vlc_ps[10]
static

Definition at line 78 of file aacps.c.

const int NR_PAR_BANDS[] = { 20, 34 }
static

Number of frequency bands that can be addressed by the parameter index, b(k)

Definition at line 452 of file aacps.c.

const int NR_IPDOPD_BANDS[] = { 11, 17 }
static

Definition at line 453 of file aacps.c.

const int NR_BANDS[] = { 71, 91 }
static

Number of frequency bands that can be addressed by the sub subband index, k.

Definition at line 455 of file aacps.c.

const int DECAY_CUTOFF[] = { 10, 32 }
static

Start frequency band for the all-pass filter decay slope.

Definition at line 457 of file aacps.c.

const int NR_ALLPASS_BANDS[] = { 30, 50 }
static

Number of all-pass filer bands.

Definition at line 459 of file aacps.c.

const int SHORT_DELAY_BAND[] = { 42, 62 }
static

First stereo band using the short one sample delay.

Definition at line 461 of file aacps.c.