FFmpeg
Macros | Functions | Variables
atrac3plus.c File Reference
#include "libavutil/avassert.h"
#include "avcodec.h"
#include "get_bits.h"
#include "atrac3plus.h"
#include "atrac3plus_data.h"

Go to the source code of this file.

Macros

#define UNPACK_SF_VQ_SHAPE(gb, dst, num_vals)
 
#define DEC_CT_IDX_COMMON(OP)
 
#define CODING_DIRECT   get_bits(gb, num_bits)
 
#define CODING_VLC   get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1)
 
#define CODING_VLC_DELTA
 
#define CODING_VLC_DIFF
 

Functions

static av_cold void build_canonical_huff (const uint8_t *cb, const uint8_t **xlat, int *tab_offset, VLC *out_vlc)
 Generate canonical VLC table from given descriptor. More...
 
av_cold void ff_atrac3p_init_vlcs (void)
 Initialize VLC tables for bitstream parsing. More...
 
static int num_coded_units (GetBitContext *gb, Atrac3pChanParams *chan, Atrac3pChanUnitCtx *ctx, AVCodecContext *avctx)
 Decode number of coded quantization units. More...
 
static int add_wordlen_weights (Atrac3pChanUnitCtx *ctx, Atrac3pChanParams *chan, int wtab_idx, AVCodecContext *avctx)
 Add weighting coefficients to the decoded word-length information. More...
 
static int subtract_sf_weights (Atrac3pChanUnitCtx *ctx, Atrac3pChanParams *chan, int wtab_idx, AVCodecContext *avctx)
 Subtract weighting coefficients from decoded scalefactors. More...
 
static void unpack_vq_shape (int start_val, const int8_t *shape_vec, int *dst, int num_values)
 Unpack vector quantization tables. More...
 
static int decode_channel_wordlen (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, AVCodecContext *avctx)
 Decode word length for each quantization unit of a channel. More...
 
static int decode_channel_sf_idx (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, AVCodecContext *avctx)
 Decode scale factor indexes for each quant unit of a channel. More...
 
static int decode_quant_wordlen (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
 Decode word length information for each channel. More...
 
static int decode_scale_factors (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
 Decode scale factor indexes for each channel. More...
 
static int get_num_ct_values (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, AVCodecContext *avctx)
 Decode number of code table values. More...
 
static int decode_channel_code_tab (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, AVCodecContext *avctx)
 Decode code table indexes for each quant unit of a channel. More...
 
static int decode_code_table_indexes (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
 Decode code table indexes for each channel. More...
 
static void decode_qu_spectra (GetBitContext *gb, const Atrac3pSpecCodeTab *tab, VLC *vlc_tab, int16_t *out, const int num_specs)
 Decode huffman-coded spectral lines for a given quant unit. More...
 
static void decode_spectrum (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
 Decode huffman-coded IMDCT spectrum for all channels. More...
 
static int get_subband_flags (GetBitContext *gb, uint8_t *out, int num_flags)
 Retrieve specified amount of flag bits from the input bitstream. More...
 
static void decode_window_shape (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels)
 Decode mdct window shape flags for all channels. More...
 
static int decode_gainc_npoints (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, int coded_subbands)
 Decode number of gain control points. More...
 
static void gainc_level_mode3s (AtracGainInfo *dst, AtracGainInfo *ref)
 Implements coding mode 3 (slave) for gain compensation levels. More...
 
static void gainc_level_mode1m (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, AtracGainInfo *dst)
 Implements coding mode 1 (master) for gain compensation levels. More...
 
static int decode_gainc_levels (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, int coded_subbands)
 Decode level code for each gain control point. More...
 
static void gainc_loc_mode0 (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, AtracGainInfo *dst, int pos)
 Implements coding mode 0 for gain compensation locations. More...
 
static void gainc_loc_mode1 (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, AtracGainInfo *dst)
 Implements coding mode 1 for gain compensation locations. More...
 
static int decode_gainc_loc_codes (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, int coded_subbands, AVCodecContext *avctx)
 Decode location code for each gain control point. More...
 
static int decode_gainc_data (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
 Decode gain control data for all channels. More...
 
static void decode_tones_envelope (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, int band_has_tones[])
 Decode envelope for all tones of a channel. More...
 
static int decode_band_numwavs (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, int band_has_tones[], AVCodecContext *avctx)
 Decode number of tones for each subband of a channel. More...
 
static void decode_tones_frequency (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, int band_has_tones[])
 Decode frequency information for each subband of a channel. More...
 
static void decode_tones_amplitude (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, int band_has_tones[])
 Decode amplitude information for each subband of a channel. More...
 
static void decode_tones_phase (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, int band_has_tones[])
 Decode phase information for each subband of a channel. More...
 
static int decode_tones_info (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
 Decode tones info for all channels. More...
 
int ff_atrac3p_decode_channel_unit (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
 Decode bitstream data of a channel unit. More...
 

Variables

static VLCElem tables_data [154276]
 
static VLC wl_vlc_tabs [4]
 
static VLC sf_vlc_tabs [8]
 
static VLC ct_vlc_tabs [4]
 
static VLC spec_vlc_tabs [112]
 
static VLC gain_vlc_tabs [11]
 
static VLC tone_vlc_tabs [7]
 

Detailed Description

Bitstream parser for ATRAC3+ decoder.

Definition in file atrac3plus.c.

Macro Definition Documentation

◆ UNPACK_SF_VQ_SHAPE

#define UNPACK_SF_VQ_SHAPE (   gb,
  dst,
  num_vals 
)
Value:
start_val = get_bits((gb), 6); \
unpack_vq_shape(start_val, &atrac3p_sf_shapes[get_bits((gb), 6)][0], \
(dst), (num_vals))

Definition at line 226 of file atrac3plus.c.

◆ DEC_CT_IDX_COMMON

#define DEC_CT_IDX_COMMON (   OP)
Value:
num_vals = get_num_ct_values(gb, ctx, avctx); \
if (num_vals < 0) \
return num_vals; \
for (i = 0; i < num_vals; i++) { \
if (chan->qu_wordlen[i]) { \
chan->qu_tab_idx[i] = OP; \
} else if (ch_num && ref_chan->qu_wordlen[i]) \
/* get clone master flag */ \
chan->qu_tab_idx[i] = get_bits1(gb); \
}

Definition at line 599 of file atrac3plus.c.

◆ CODING_DIRECT

#define CODING_DIRECT   get_bits(gb, num_bits)

Definition at line 612 of file atrac3plus.c.

◆ CODING_VLC

#define CODING_VLC   get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1)

Definition at line 614 of file atrac3plus.c.

◆ CODING_VLC_DELTA

#define CODING_VLC_DELTA
Value:
(!i) ? CODING_VLC \
: (pred + get_vlc2(gb, delta_vlc->table, \
delta_vlc->bits, 1)) & mask; \
pred = chan->qu_tab_idx[i]

Definition at line 616 of file atrac3plus.c.

◆ CODING_VLC_DIFF

#define CODING_VLC_DIFF
Value:
(ref_chan->qu_tab_idx[i] + \
get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1)) & mask

Definition at line 622 of file atrac3plus.c.

Function Documentation

◆ build_canonical_huff()

static av_cold void build_canonical_huff ( const uint8_t *  cb,
const uint8_t **  xlat,
int *  tab_offset,
VLC out_vlc 
)
static

Generate canonical VLC table from given descriptor.

Parameters
[in]cbptr to codebook descriptor
[in,out]xlatptr to ptr to translation table
[in,out]tab_offsetstarting offset to the generated vlc table
[out]out_vlcptr to vlc table to be generated

Definition at line 50 of file atrac3plus.c.

Referenced by ff_atrac3p_init_vlcs().

◆ ff_atrac3p_init_vlcs()

av_cold void ff_atrac3p_init_vlcs ( void  )

Initialize VLC tables for bitstream parsing.

Definition at line 76 of file atrac3plus.c.

Referenced by atrac3p_init_static().

◆ num_coded_units()

static int num_coded_units ( GetBitContext gb,
Atrac3pChanParams chan,
Atrac3pChanUnitCtx ctx,
AVCodecContext avctx 
)
static

Decode number of coded quantization units.

Parameters
[in]gbthe GetBit context
[in,out]chanptr to the channel parameters
[in,out]ctxptr to the channel unit context
[in]avctxptr to the AVCodecContext
Returns
result code: 0 = OK, otherwise - error code

Definition at line 126 of file atrac3plus.c.

Referenced by decode_channel_wordlen().

◆ add_wordlen_weights()

static int add_wordlen_weights ( Atrac3pChanUnitCtx ctx,
Atrac3pChanParams chan,
int  wtab_idx,
AVCodecContext avctx 
)
static

Add weighting coefficients to the decoded word-length information.

Parameters
[in,out]ctxptr to the channel unit context
[in,out]chanptr to the channel parameters
[in]wtab_idxindex of the table of weights
[in]avctxptr to the AVCodecContext
Returns
result code: 0 = OK, otherwise - error code

Definition at line 156 of file atrac3plus.c.

Referenced by decode_channel_wordlen().

◆ subtract_sf_weights()

static int subtract_sf_weights ( Atrac3pChanUnitCtx ctx,
Atrac3pChanParams chan,
int  wtab_idx,
AVCodecContext avctx 
)
static

Subtract weighting coefficients from decoded scalefactors.

Parameters
[in,out]ctxptr to the channel unit context
[in,out]chanptr to the channel parameters
[in]wtab_idxindex of table of weights
[in]avctxptr to the AVCodecContext
Returns
result code: 0 = OK, otherwise - error code

Definition at line 186 of file atrac3plus.c.

Referenced by decode_channel_sf_idx().

◆ unpack_vq_shape()

static void unpack_vq_shape ( int  start_val,
const int8_t *  shape_vec,
int *  dst,
int  num_values 
)
inlinestatic

Unpack vector quantization tables.

Parameters
[in]start_valstart value for the unpacked table
[in]shape_vecptr to table to unpack
[out]dstptr to output array
[in]num_valuesnumber of values to unpack

Definition at line 214 of file atrac3plus.c.

Referenced by decode_channel_wordlen().

◆ decode_channel_wordlen()

static int decode_channel_wordlen ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  ch_num,
AVCodecContext avctx 
)
static

Decode word length for each quantization unit of a channel.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]ch_numchannel to process
[in]avctxptr to the AVCodecContext
Returns
result code: 0 = OK, otherwise - error code

Definition at line 240 of file atrac3plus.c.

Referenced by decode_quant_wordlen().

◆ decode_channel_sf_idx()

static int decode_channel_sf_idx ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  ch_num,
AVCodecContext avctx 
)
static

Decode scale factor indexes for each quant unit of a channel.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]ch_numchannel to process
[in]avctxptr to the AVCodecContext
Returns
result code: 0 = OK, otherwise - error code

Definition at line 387 of file atrac3plus.c.

Referenced by decode_scale_factors().

◆ decode_quant_wordlen()

static int decode_quant_wordlen ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  num_channels,
AVCodecContext avctx 
)
static

Decode word length information for each channel.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]num_channelsnumber of channels to process
[in]avctxptr to the AVCodecContext
Returns
result code: 0 = OK, otherwise - error code

Definition at line 522 of file atrac3plus.c.

Referenced by ff_atrac3p_decode_channel_unit().

◆ decode_scale_factors()

static int decode_scale_factors ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  num_channels,
AVCodecContext avctx 
)
static

Decode scale factor indexes for each channel.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]num_channelsnumber of channels to process
[in]avctxptr to the AVCodecContext
Returns
result code: 0 = OK, otherwise - error code

Definition at line 555 of file atrac3plus.c.

Referenced by ff_atrac3p_decode_channel_unit().

◆ get_num_ct_values()

static int get_num_ct_values ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
AVCodecContext avctx 
)
static

Decode number of code table values.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]avctxptr to the AVCodecContext
Returns
result code: 0 = OK, otherwise - error code

Definition at line 582 of file atrac3plus.c.

◆ decode_channel_code_tab()

static int decode_channel_code_tab ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  ch_num,
AVCodecContext avctx 
)
static

Decode code table indexes for each quant unit of a channel.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]ch_numchannel to process
[in]avctxptr to the AVCodecContext
Returns
result code: 0 = OK, otherwise - error code

Definition at line 635 of file atrac3plus.c.

Referenced by decode_code_table_indexes().

◆ decode_code_table_indexes()

static int decode_code_table_indexes ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  num_channels,
AVCodecContext avctx 
)
static

Decode code table indexes for each channel.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]num_channelsnumber of channels to process
[in]avctxptr to the AVCodecContext
Returns
result code: 0 = OK, otherwise - error code

Definition at line 688 of file atrac3plus.c.

Referenced by ff_atrac3p_decode_channel_unit().

◆ decode_qu_spectra()

static void decode_qu_spectra ( GetBitContext gb,
const Atrac3pSpecCodeTab tab,
VLC vlc_tab,
int16_t *  out,
const int  num_specs 
)
static

Decode huffman-coded spectral lines for a given quant unit.

This is a generalized version for all known coding modes. Its speed can be improved by creating separate functions for each mode.

Parameters
[in]gbthe GetBit context
[in]tabcode table telling how to decode spectral lines
[in]vlc_tabptr to the huffman table associated with the code table
[out]outpointer to buffer where decoded data should be stored
[in]num_specsnumber of spectral lines to decode

Definition at line 721 of file atrac3plus.c.

Referenced by decode_spectrum().

◆ decode_spectrum()

static void decode_spectrum ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  num_channels,
AVCodecContext avctx 
)
static

Decode huffman-coded IMDCT spectrum for all channels.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]num_channelsnumber of channels to process
[in]avctxptr to the AVCodecContext

Definition at line 760 of file atrac3plus.c.

Referenced by ff_atrac3p_decode_channel_unit().

◆ get_subband_flags()

static int get_subband_flags ( GetBitContext gb,
uint8_t *  out,
int  num_flags 
)
static

Retrieve specified amount of flag bits from the input bitstream.

The data can be shortened in the case of the following two common conditions: if all bits are zero then only one signal bit = 0 will be stored, if all bits are ones then two signal bits = 1,0 will be stored. Otherwise, all necessary bits will be directly stored prefixed by two signal bits = 1,1.

Parameters
[in]gbptr to the GetBitContext
[out]outwhere to place decoded flags
[in]num_flagsnumber of flags to process
Returns
: 0 = all flag bits are zero, 1 = there is at least one non-zero flag bit

Definition at line 826 of file atrac3plus.c.

Referenced by decode_tones_info(), decode_window_shape(), and ff_atrac3p_decode_channel_unit().

◆ decode_window_shape()

static void decode_window_shape ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  num_channels 
)
static

Decode mdct window shape flags for all channels.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]num_channelsnumber of channels to process

Definition at line 851 of file atrac3plus.c.

Referenced by ff_atrac3p_decode_channel_unit().

◆ decode_gainc_npoints()

static int decode_gainc_npoints ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  ch_num,
int  coded_subbands 
)
static

Decode number of gain control points.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]ch_numchannel to process
[in]coded_subbandsnumber of subbands to process
Returns
result code: 0 = OK, otherwise - error code

Definition at line 870 of file atrac3plus.c.

Referenced by decode_gainc_data().

◆ gainc_level_mode3s()

static void gainc_level_mode3s ( AtracGainInfo dst,
AtracGainInfo ref 
)
inlinestatic

Implements coding mode 3 (slave) for gain compensation levels.

Parameters
[out]dstptr to the output array
[in]refptr to the reference channel

Definition at line 935 of file atrac3plus.c.

Referenced by decode_gainc_levels().

◆ gainc_level_mode1m()

static void gainc_level_mode1m ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
AtracGainInfo dst 
)
inlinestatic

Implements coding mode 1 (master) for gain compensation levels.

Parameters
[in]gbthe GetBit context
[in]ctxptr to the channel unit context
[out]dstptr to the output array

Definition at line 950 of file atrac3plus.c.

Referenced by decode_gainc_levels().

◆ decode_gainc_levels()

static int decode_gainc_levels ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  ch_num,
int  coded_subbands 
)
static

Decode level code for each gain control point.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]ch_numchannel to process
[in]coded_subbandsnumber of subbands to process
Returns
result code: 0 = OK, otherwise - error code

Definition at line 976 of file atrac3plus.c.

Referenced by decode_gainc_data().

◆ gainc_loc_mode0()

static void gainc_loc_mode0 ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
AtracGainInfo dst,
int  pos 
)
inlinestatic

Implements coding mode 0 for gain compensation locations.

Parameters
[in]gbthe GetBit context
[in]ctxptr to the channel unit context
[out]dstptr to the output array
[in]posposition of the value to be processed

Definition at line 1058 of file atrac3plus.c.

Referenced by decode_gainc_loc_codes().

◆ gainc_loc_mode1()

static void gainc_loc_mode1 ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
AtracGainInfo dst 
)
inlinestatic

Implements coding mode 1 for gain compensation locations.

Parameters
[in]gbthe GetBit context
[in]ctxptr to the channel unit context
[out]dstptr to the output array

Definition at line 1081 of file atrac3plus.c.

Referenced by decode_gainc_loc_codes().

◆ decode_gainc_loc_codes()

static int decode_gainc_loc_codes ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  ch_num,
int  coded_subbands,
AVCodecContext avctx 
)
static

Decode location code for each gain control point.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]ch_numchannel to process
[in]coded_subbandsnumber of subbands to process
[in]avctxptr to the AVCodecContext
Returns
result code: 0 = OK, otherwise - error code

Definition at line 1113 of file atrac3plus.c.

Referenced by decode_gainc_data().

◆ decode_gainc_data()

static int decode_gainc_data ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  num_channels,
AVCodecContext avctx 
)
static

Decode gain control data for all channels.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]num_channelsnumber of channels to process
[in]avctxptr to the AVCodecContext
Returns
result code: 0 = OK, otherwise - error code

Definition at line 1267 of file atrac3plus.c.

Referenced by ff_atrac3p_decode_channel_unit().

◆ decode_tones_envelope()

static void decode_tones_envelope ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  ch_num,
int  band_has_tones[] 
)
static

Decode envelope for all tones of a channel.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]ch_numchannel to process
[in]band_has_tonesptr to an array of per-band-flags: 1 - tone data present

Definition at line 1310 of file atrac3plus.c.

Referenced by decode_tones_info().

◆ decode_band_numwavs()

static int decode_band_numwavs ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  ch_num,
int  band_has_tones[],
AVCodecContext avctx 
)
static

Decode number of tones for each subband of a channel.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]ch_numchannel to process
[in]band_has_tonesptr to an array of per-band-flags: 1 - tone data present
[in]avctxptr to the AVCodecContext
Returns
result code: 0 = OK, otherwise - error code

fixed-length coding

variable-length coding

VLC modulo delta to master (slave only)

copy master (slave only)

initialize start tone index for each subband

Definition at line 1351 of file atrac3plus.c.

Referenced by decode_tones_info().

◆ decode_tones_frequency()

static void decode_tones_frequency ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  ch_num,
int  band_has_tones[] 
)
static

Decode frequency information for each subband of a channel.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]ch_numchannel to process
[in]band_has_tonesptr to an array of per-band-flags: 1 - tone data present

packed numbers in descending order

packed numbers in ascending order

Definition at line 1415 of file atrac3plus.c.

Referenced by decode_tones_info().

◆ decode_tones_amplitude()

static void decode_tones_amplitude ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  ch_num,
int  band_has_tones[] 
)
static

Decode amplitude information for each subband of a channel.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]ch_numchannel to process
[in]band_has_tonesptr to an array of per-band-flags: 1 - tone data present

fixed-length coding

min + VLC delta

VLC modulo delta to master (slave only)

clone master (slave only)

Definition at line 1475 of file atrac3plus.c.

Referenced by decode_tones_info().

◆ decode_tones_phase()

static void decode_tones_phase ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  ch_num,
int  band_has_tones[] 
)
static

Decode phase information for each subband of a channel.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]ch_numchannel to process
[in]band_has_tonesptr to an array of per-band-flags: 1 - tone data present

Definition at line 1575 of file atrac3plus.c.

Referenced by decode_tones_info().

◆ decode_tones_info()

static int decode_tones_info ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  num_channels,
AVCodecContext avctx 
)
static

Decode tones info for all channels.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]num_channelsnumber of channels to process
[in]avctxptr to the AVCodecContext
Returns
result code: 0 = OK, otherwise - error code

Definition at line 1600 of file atrac3plus.c.

Referenced by ff_atrac3p_decode_channel_unit().

◆ ff_atrac3p_decode_channel_unit()

int ff_atrac3p_decode_channel_unit ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  num_channels,
AVCodecContext avctx 
)

Decode bitstream data of a channel unit.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]num_channelsnumber of channels to process
[in]avctxptr to the AVCodecContext
Returns
result code: 0 = OK, otherwise - error code

Definition at line 1662 of file atrac3plus.c.

Referenced by atrac3p_decode_frame().

Variable Documentation

◆ tables_data

VLCElem tables_data[154276]
static

Definition at line 34 of file atrac3plus.c.

Referenced by build_canonical_huff().

◆ wl_vlc_tabs

VLC wl_vlc_tabs[4]
static

Definition at line 35 of file atrac3plus.c.

Referenced by decode_channel_wordlen(), and ff_atrac3p_init_vlcs().

◆ sf_vlc_tabs

VLC sf_vlc_tabs[8]
static

Definition at line 36 of file atrac3plus.c.

Referenced by decode_channel_sf_idx(), and ff_atrac3p_init_vlcs().

◆ ct_vlc_tabs

VLC ct_vlc_tabs[4]
static

Definition at line 37 of file atrac3plus.c.

Referenced by decode_channel_code_tab(), and ff_atrac3p_init_vlcs().

◆ spec_vlc_tabs

VLC spec_vlc_tabs[112]
static

Definition at line 38 of file atrac3plus.c.

Referenced by decode_spectrum(), and ff_atrac3p_init_vlcs().

◆ gain_vlc_tabs

VLC gain_vlc_tabs[11]
static

◆ tone_vlc_tabs

VLC tone_vlc_tabs[7]
static
get_num_ct_values
static int get_num_ct_values(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, AVCodecContext *avctx)
Decode number of code table values.
Definition: atrac3plus.c:582
mask
int mask
Definition: mediacodecdec_common.c:154
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:335
atrac3p_sf_shapes
static const int8_t atrac3p_sf_shapes[64][9]
2D base shape tables for scale factor coding.
Definition: atrac3plus_data.h:289
CODING_VLC
#define CODING_VLC
Definition: atrac3plus.c:614
ctx
AVFormatContext * ctx
Definition: movenc.c:49
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:388
get_vlc2
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
Definition: get_bits.h:652
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:425
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
pred
static const float pred[4]
Definition: siprdata.h:259
OP
#define OP(gb, pixel, count)