Go to the documentation of this file.
   34 #define ATRAC9_SF_VLC_BITS 8 
   35 #define ATRAC9_COEFF_VLC_BITS 9 
  128         grad_range[1] = 
get_bits(gb, 6) + 1;
 
  134     if (grad_range[0] >= grad_range[1] || grad_range[1] > 31)
 
  137     if (
b->grad_boundary > 
b->q_unit_cnt)
 
  140     values    = grad_value[1] - grad_value[0];
 
  141     sign      = 1 - 2*(
values < 0);
 
  142     base      = grad_value[0] + sign;
 
  144     curve     = 
s->alloc_curve[grad_range[1] - grad_range[0] - 1];
 
  146     for (
int i = 0; 
i <= 
b->q_unit_cnt; 
i++)
 
  147         b->gradient[
i] = grad_value[
i >= grad_range[0]];
 
  149     for (
int i = grad_range[0]; 
i < grad_range[1]; 
i++)
 
  150         b->gradient[
i] = 
base + sign*((
int)(
scale*curve[
i - grad_range[0]]));
 
  158     memset(
c->precision_mask, 0, 
sizeof(
c->precision_mask));
 
  159     for (
int i = 1; 
i < 
b->q_unit_cnt; 
i++) {
 
  160         const int delta = 
FFABS(
c->scalefactors[
i] - 
c->scalefactors[
i - 1]) - 1;
 
  162             const int neg = 
c->scalefactors[
i - 1] > 
c->scalefactors[
i];
 
  168         for (
int i = 0; 
i < 
b->q_unit_cnt; 
i++) {
 
  169             c->precision_coarse[
i] = 
c->scalefactors[
i];
 
  170             c->precision_coarse[
i] += 
c->precision_mask[
i] - 
b->gradient[
i];
 
  171             if (
c->precision_coarse[
i] < 0)
 
  173             switch (
b->grad_mode) {
 
  175                 c->precision_coarse[
i] >>= 1;
 
  178                 c->precision_coarse[
i] = (3 * 
c->precision_coarse[
i]) >> 3;
 
  181                 c->precision_coarse[
i] >>= 2;
 
  186         for (
int i = 0; 
i < 
b->q_unit_cnt; 
i++)
 
  187             c->precision_coarse[
i] = 
c->scalefactors[
i] - 
b->gradient[
i];
 
  191     for (
int i = 0; 
i < 
b->q_unit_cnt; 
i++)
 
  192         c->precision_coarse[
i] = 
FFMAX(
c->precision_coarse[
i], 1);
 
  194     for (
int i = 0; 
i < 
b->grad_boundary; 
i++)
 
  195         c->precision_coarse[
i]++;
 
  197     for (
int i = 0; 
i < 
b->q_unit_cnt; 
i++) {
 
  198         c->precision_fine[
i] = 0;
 
  199         if (
c->precision_coarse[
i] > 15) {
 
  200             c->precision_fine[
i] = 
FFMIN(
c->precision_coarse[
i], 30) - 15;
 
  201             c->precision_coarse[
i] = 15;
 
  211     if (
b->has_band_ext) {
 
  212         if (
b->q_unit_cnt < 13 || 
b->q_unit_cnt > 20)
 
  216             b->channel[1].band_ext = 
get_bits(gb, 2);
 
  217             b->channel[1].band_ext = ext_band > 2 ? 
b->channel[1].band_ext : 4;
 
  224     if (!
b->has_band_ext_data)
 
  227     if (!
b->has_band_ext) {
 
  233     b->channel[0].band_ext = 
get_bits(gb, 2);
 
  234     b->channel[0].band_ext = ext_band > 2 ? 
b->channel[0].band_ext : 4;
 
  237         for (
int i = 0; 
i <= stereo; 
i++) {
 
  240             for (
int j = 0; j < count; j++) {
 
  249     for (
int i = 0; 
i <= stereo; 
i++) {
 
  252         for (
int j = 0; j < count; j++) {
 
  263                                     int channel_idx, 
int first_in_pkt)
 
  265     static const uint8_t mode_map[2][4] = { { 0, 1, 2, 3 }, { 0, 2, 3, 4 } };
 
  266     const int mode = mode_map[channel_idx][
get_bits(gb, 2)];
 
  268     memset(
c->scalefactors, 0, 
sizeof(
c->scalefactors));
 
  270     if (first_in_pkt && (
mode == 4 || ((
mode == 3) && !channel_idx))) {
 
  284         for (
int i = 1; 
i < 
b->band_ext_q_unit; 
i++) {
 
  287             c->scalefactors[
i] = 
val & ((1 << 
len) - 1);
 
  290         for (
int i = 0; 
i < 
b->band_ext_q_unit; 
i++)
 
  291             c->scalefactors[
i] += 
base - sf_weights[
i];
 
  298         for (
int i = 0; 
i < 
b->band_ext_q_unit; 
i++)
 
  304         const int *baseline = 
mode == 4 ? 
c->scalefactors_prev :
 
  305                               channel_idx ? 
b->channel[0].scalefactors :
 
  306                               c->scalefactors_prev;
 
  307         const int baseline_len = 
mode == 4 ? 
b->q_unit_cnt_prev :
 
  308                                  channel_idx ? 
b->band_ext_q_unit :
 
  312         const int unit_cnt = 
FFMIN(
b->band_ext_q_unit, baseline_len);
 
  315         for (
int i = 0; 
i < unit_cnt; 
i++) {
 
  317             c->scalefactors[
i] = baseline[
i] + dist;
 
  320         for (
int i = unit_cnt; 
i < 
b->band_ext_q_unit; 
i++)
 
  326         const int *baseline = channel_idx ? 
b->channel[0].scalefactors :
 
  327                               c->scalefactors_prev;
 
  328         const int baseline_len = channel_idx ? 
b->band_ext_q_unit :
 
  333         const int unit_cnt = 
FFMIN(
b->band_ext_q_unit, baseline_len);
 
  338         for (
int i = 1; 
i < unit_cnt; 
i++) {
 
  341             c->scalefactors[
i] = 
val & ((1 << 
len) - 1);
 
  344         for (
int i = 0; 
i < unit_cnt; 
i++)
 
  345             c->scalefactors[
i] += 
base + baseline[
i];
 
  347         for (
int i = unit_cnt; 
i < 
b->band_ext_q_unit; 
i++)
 
  353     for (
int i = 0; 
i < 
b->band_ext_q_unit; 
i++)
 
  354         if (
c->scalefactors[
i] < 0 || 
c->scalefactors[
i] > 31)
 
  357     memcpy(
c->scalefactors_prev, 
c->scalefactors, 
sizeof(
c->scalefactors));
 
  366     const int last_sf = 
c->scalefactors[
c->q_unit_cnt];
 
  368     memset(
c->codebookset, 0, 
sizeof(
c->codebookset));
 
  370     if (
c->q_unit_cnt <= 1)
 
  372     if (
s->samplerate_idx > 7)
 
  375     c->scalefactors[
c->q_unit_cnt] = 
c->scalefactors[
c->q_unit_cnt - 1];
 
  377     if (
c->q_unit_cnt > 12) {
 
  378         for (
int i = 0; 
i < 12; 
i++)
 
  379             avg += 
c->scalefactors[
i];
 
  383     for (
int i = 8; 
i < 
c->q_unit_cnt; 
i++) {
 
  384         const int prev = 
c->scalefactors[
i - 1];
 
  385         const int cur  = 
c->scalefactors[
i    ];
 
  386         const int next = 
c->scalefactors[
i + 1];
 
  388         if ((cur - 
min >= 3 || 2*cur - prev - next >= 3))
 
  389             c->codebookset[
i] = 1;
 
  393     for (
int i = 12; 
i < 
c->q_unit_cnt; 
i++) {
 
  394         const int cur = 
c->scalefactors[
i];
 
  396         const int min = 
FFMIN(
c->scalefactors[
i + 1], 
c->scalefactors[
i - 1]);
 
  397         if (
c->codebookset[
i])
 
  400         c->codebookset[
i] = (((cur - 
min) >= 2) && (cur >= (
avg - cnd)));
 
  403     c->scalefactors[
c->q_unit_cnt] = last_sf;
 
  409     const int max_prec = 
s->samplerate_idx > 7 ? 1 : 7;
 
  411     memset(
c->q_coeffs_coarse, 0, 
sizeof(
c->q_coeffs_coarse));
 
  413     for (
int i = 0; 
i < 
c->q_unit_cnt; 
i++) {
 
  416         const int prec = 
c->precision_coarse[
i] + 1;
 
  418         if (prec <= max_prec) {
 
  419             const int cb = 
c->codebookset[
i];
 
  425             for (
int j = 0; j < groups; j++) {
 
  428                 for (
int k = 0; k < huff->
value_cnt; k++) {
 
  436             for (
int j = 0; j < 
bands; j++)
 
  445     memset(
c->q_coeffs_fine, 0, 
sizeof(
c->q_coeffs_fine));
 
  447     for (
int i = 0; 
i < 
c->q_unit_cnt; 
i++) {
 
  450         const int len   = 
c->precision_fine[
i] + 1;
 
  452         if (
c->precision_fine[
i] <= 0)
 
  455         for (
int j = start; j < end; j++)
 
  463     memset(
c->coeffs, 0, 
sizeof(
c->coeffs));
 
  465     for (
int i = 0; 
i < 
c->q_unit_cnt; 
i++) {
 
  472         for (
int j = start; j < end; j++) {
 
  473             const float vc = 
c->q_coeffs_coarse[j] * coarse_c;
 
  474             const float vf = 
c->q_coeffs_fine[j]   * fine_c;
 
  475             c->coeffs[j] = vc + vf;
 
  483     float *
src = 
b->channel[ 
b->cpe_base_channel].coeffs;
 
  484     float *dst = 
b->channel[!
b->cpe_base_channel].coeffs;
 
  489     if (
b->q_unit_cnt <= 
b->stereo_q_unit)
 
  492     for (
int i = 
b->stereo_q_unit; i < b->q_unit_cnt; 
i++) {
 
  493         const int sign  = 
b->is_signs[
i];
 
  496         for (
int j = start; j < end; j++)
 
  497             dst[j] = sign*
src[j];
 
  504     for (
int i = 0; 
i <= stereo; 
i++) {
 
  505         float *coeffs = 
b->channel[
i].coeffs;
 
  506         for (
int j = 0; j < 
b->q_unit_cnt; j++) {
 
  509             const int scalefactor = 
b->channel[
i].scalefactors[j];
 
  511             for (
int k = start; k < end; k++)
 
  518                                    int start, 
int count)
 
  521     for (
int i = 0; 
i < count; 
i += 2) {
 
  524         c->coeffs[start + 
i + 0] = 
tmp[0];
 
  525         c->coeffs[start + 
i + 1] = 
tmp[1];
 
  529     for (
int i = 0; 
i < count; 
i++)
 
  530         c->coeffs[start + 
i] /= maxval;
 
  534                                          const int s_unit, 
const int e_unit)
 
  536     for (
int i = s_unit; 
i < e_unit; 
i++) {
 
  539         for (
int j = start; j < end; j++)
 
  540             c->coeffs[j] *= sf[
i - s_unit];
 
  547     const int g_units[4] = { 
 
  551         FFMAX(g_units[2], 22),
 
  554     const int g_bins[4] = { 
 
  561     for (
int ch = 0; ch <= stereo; ch++) {
 
  565         for (
int i = 0; 
i < 3; 
i++)
 
  566             for (
int j = 0; j < (g_bins[
i + 1] - g_bins[
i + 0]); j++)
 
  567                 c->coeffs[g_bins[
i] + j] = 
c->coeffs[g_bins[
i] - j - 1];
 
  569         switch (
c->band_ext) {
 
  571             float sf[6] = { 0.0f };
 
  572             const int l = g_units[3] - g_units[0] - 1;
 
  605             for (
int i = g_units[0]; 
i < g_units[3]; 
i++)
 
  613             const float g_sf[2] = {
 
  618             for (
int i = 0; 
i < 2; 
i++)
 
  619                 for (
int j = g_bins[
i + 0]; j < g_bins[
i + 1]; j++)
 
  620                     c->coeffs[j] *= g_sf[
i];
 
  627             for (
int i = g_bins[0]; 
i < g_bins[3]; 
i++) {
 
  635             const float g_sf[3] = { 0.7079468f*m, 0.5011902f*m, 0.3548279f*m };
 
  637             for (
int i = 0; 
i < 3; 
i++)
 
  638                 for (
int j = g_bins[
i + 0]; j < g_bins[
i + 1]; j++)
 
  639                     c->coeffs[j] *= g_sf[
i];
 
  648                                int frame_idx, 
int block_idx)
 
  656         const int precision = reuse_params ? 8 : 4;
 
  657         c->q_unit_cnt = 
b->q_unit_cnt = 2;
 
  659         memset(
c->scalefactors, 0, 
sizeof(
c->scalefactors));
 
  660         memset(
c->q_coeffs_fine, 0, 
sizeof(
c->q_coeffs_fine));
 
  661         memset(
c->q_coeffs_coarse, 0, 
sizeof(
c->q_coeffs_coarse));
 
  663         for (
int i = 0; 
i < 
b->q_unit_cnt; 
i++) {
 
  665             c->precision_coarse[
i] = precision;
 
  666             c->precision_fine[
i] = 0;
 
  669         for (
int i = 0; 
i < 
c->q_unit_cnt; 
i++) {
 
  672             for (
int j = start; j < end; j++)
 
  673                 c->q_coeffs_coarse[j] = 
get_bits(gb, 
c->precision_coarse[
i] + 1);
 
  682     if (first_in_pkt && reuse_params) {
 
  689         int stereo_band, ext_band;
 
  690         const int min_band_count = 
s->samplerate_idx > 7 ? 1 : 3;
 
  692         b->band_count = 
get_bits(gb, 4) + min_band_count;
 
  695         b->band_ext_q_unit = 
b->stereo_q_unit = 
b->q_unit_cnt;
 
  704             stereo_band = 
get_bits(gb, 4) + min_band_count;
 
  705             if (stereo_band > 
b->band_count) {
 
  714         if (
b->has_band_ext) {
 
  715             ext_band = 
get_bits(gb, 4) + min_band_count;
 
  716             if (ext_band < b->band_count) {
 
  735     b->cpe_base_channel = 0;
 
  739             for (
int i = 
b->stereo_q_unit; i < b->q_unit_cnt; 
i++)
 
  752     for (
int i = 0; 
i <= stereo; 
i++) {
 
  754         c->q_unit_cnt = 
i == 
b->cpe_base_channel ? 
b->q_unit_cnt :
 
  766     b->q_unit_cnt_prev = 
b->has_band_ext ? 
b->band_ext_q_unit : 
b->q_unit_cnt;
 
  771     if (
b->has_band_ext && 
b->has_band_ext_data)
 
  775     for (
int i = 0; 
i <= stereo; 
i++) {
 
  777         const int dst_idx = 
s->block_config->plane_map[block_idx][
i];
 
  778         const int wsize = 1 << 
s->frame_log2;
 
  779         const ptrdiff_t 
offset = wsize*frame_idx*
sizeof(
float);
 
  782         s->tx_fn(
s->tx, 
s->temp, 
c->coeffs, 
sizeof(
float));
 
  783         s->fdsp->vector_fmul_window(dst, 
c->prev_win, 
s->temp,
 
  784                                     s->imdct_win, wsize >> 1);
 
  785         memcpy(
c->prev_win, 
s->temp + (wsize >> 1), 
sizeof(
float)*wsize >> 1);
 
  792                                int *got_frame_ptr, 
AVPacket *avpkt)
 
  807         for (
int j = 0; j < 
s->block_config->count; j++) {
 
  824     for (
int j = 0; j < 
s->block_config->count; j++) {
 
  827         for (
int i = 0; 
i <= stereo; 
i++) {
 
  829             memset(
c->prev_win, 0, 
sizeof(
c->prev_win));
 
  845                                     const uint8_t (**
tab)[2],
 
  846                                     unsigned *buf_offset, 
int offset)
 
  853                              &(*
tab)[0][1], 2, &(*
tab)[0][0], 2, 1,
 
  861     const uint8_t (*
tab)[2];
 
  866     for (
int i = 1; 
i < 7; 
i++) {
 
  875     for (
int i = 2; 
i < 6; 
i++) {
 
  887     for (
int i = 0; 
i < 2; 
i++) {
 
  888         for (
int j = 2; j < 8; j++) {
 
  889             for (
int k = 
i; k < 4; k++) {
 
  904     int err, 
version, block_config_idx, superframe_idx, alloc_c_len;
 
  936     block_config_idx = 
get_bits(&gb, 3);
 
  937     if (block_config_idx > 5) {
 
  944     avctx->
ch_layout      = 
s->block_config->channel_layout;
 
  953     s->avg_frame_size = 
get_bits(&gb, 11) + 1;
 
  956     if (superframe_idx & 1) {
 
  961     s->frame_count = 1 << superframe_idx;
 
  964     scale = 1.0f / 32768.0;
 
  966                      1 << 
s->frame_log2, &
scale, 0);
 
  975     for (
int i = 0; 
i < (1 << 
s->frame_log2); 
i++) {
 
  976         const int   len  = 1 << 
s->frame_log2;
 
  977         const float sidx = (      
i + 0.5f) / 
len;
 
  978         const float eidx = (
len - 
i - 0.5f) / 
len;
 
  981         s->imdct_win[
i]  = s_c / ((s_c * s_c) + (e_c * e_c));
 
  986     for (
int i = 1; 
i <= alloc_c_len; 
i++)
 
  987         for (
int j = 0; j < 
i; j++)
 
 1007 #if FF_API_SUBFRAMES 
 1008                       AV_CODEC_CAP_SUBFRAMES |
 
  
static av_cold int atrac9_decode_close(AVCodecContext *avctx)
int32_t q_coeffs_coarse[256]
@ AV_SAMPLE_FMT_FLTP
float, planar
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
int ff_vlc_init_from_lengths(VLC *vlc, int nb_bits, int nb_codes, const int8_t *lens, int lens_wrap, const void *symbols, int symbols_wrap, int symbols_size, int offset, int flags, void *logctx)
Build VLC decoding tables suitable for use with get_vlc2()
static VLC coeff_vlc[2][8][4]
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int sample_rate
samples per second
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
static double cb(void *priv, double x, double y)
static const float at9_band_ext_scales_m2[]
static int read_scalefactors(ATRAC9Context *s, ATRAC9BlockData *b, ATRAC9ChannelData *c, GetBitContext *gb, int channel_idx, int first_in_pkt)
This structure describes decoded (raw) audio or video data.
static const int at9_tab_samplerates[]
static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
Clip a signed integer to an unsigned power of two range.
static void calc_codebook_idx(ATRAC9Context *s, ATRAC9BlockData *b, ATRAC9ChannelData *c)
#define ATRAC9_COEFF_VLC_BITS
static const ATRAC9BlockConfig at9_block_layout[]
av_cold int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type, int inv, int len, const void *scale, uint64_t flags)
Initialize a transform context with the given configuration (i)MDCTs with an odd length are currently...
static void read_coeffs_fine(ATRAC9Context *s, ATRAC9BlockData *b, ATRAC9ChannelData *c, GetBitContext *gb)
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static const uint8_t at9_tab_band_ext_cnt[][6]
AVCodec p
The public AVCodec.
static void calc_precision(ATRAC9Context *s, ATRAC9BlockData *b, ATRAC9ChannelData *c)
AVChannelLayout ch_layout
Audio channel layout.
if it could not because there are no more frames
static const struct twinvq_data tab
int flags
AV_CODEC_FLAG_*.
static double val(void *priv, double ch)
uint8_t alloc_curve[48][48]
static av_always_inline float scale(float x, float s)
static void scale_band_ext_coeffs(ATRAC9ChannelData *c, float sf[6], const int s_unit, const int e_unit)
static int ff_thread_once(char *control, void(*routine)(void))
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
static int parse_band_ext(ATRAC9Context *s, ATRAC9BlockData *b, GetBitContext *gb, int stereo)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
static const uint8_t at9_tab_sri_max_bands[]
@ AV_TX_FLOAT_MDCT
Standard MDCT with a sample data type of float, double or int32_t, respecively.
#define FF_CODEC_DECODE_CB(func)
static const uint8_t at9_q_unit_to_codebookidx[]
int(* init)(AVBSFContext *ctx)
static void fill_with_noise(ATRAC9Context *s, ATRAC9ChannelData *c, int start, int count)
static VLCElem vlc_buf[16716]
void av_bmg_get(AVLFG *lfg, double out[2])
Get the next two numbers generated by a Box-Muller Gaussian generator using the random numbers issued...
static const float bands[]
static const float at9_band_ext_scales_m0[][5][32]
#define CODEC_LONG_NAME(str)
static const uint8_t at9_sfb_a_tab[][2]
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
#define ATRAC9_SF_VLC_BITS
static const HuffmanCodebook at9_huffman_sf_unsigned[]
static unsigned int get_bits1(GetBitContext *s)
static av_cold int atrac9_decode_init(AVCodecContext *avctx)
int32_t q_coeffs_fine[256]
static int parse_gradient(ATRAC9Context *s, ATRAC9BlockData *b, GetBitContext *gb)
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static av_cold void atrac9_init_static(void)
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Context structure for the Lagged Fibonacci PRNG.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define DECLARE_ALIGNED(n, t, v)
static void apply_band_extension(ATRAC9Context *s, ATRAC9BlockData *b, const int stereo)
enum AVSampleFormat sample_fmt
audio sample format
static void dequantize(ATRAC9Context *s, ATRAC9BlockData *b, ATRAC9ChannelData *c)
static const uint8_t at9_tab_band_q_unit_map[]
static const HuffmanCodebook at9_huffman_sf_signed[]
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
static void skip_bits1(GetBitContext *s)
static const int at9_q_unit_to_coeff_idx[]
av_cold void av_tx_uninit(AVTXContext **ctx)
Frees a context and sets *ctx to NULL, does nothing when *ctx == NULL.
static const float at9_quant_step_coarse[]
int32_t scalefactors_prev[31]
const ATRAC9BlockConfig * block_config
int nb_samples
number of audio samples (per channel) described by this frame
#define i(width, name, range_min, range_max)
static const uint8_t at9_tab_band_ext_lengths[][6][4]
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static int atrac9_decode_block(ATRAC9Context *s, GetBitContext *gb, ATRAC9BlockData *b, AVFrame *frame, int frame_idx, int block_idx)
uint8_t ** extended_data
pointers to the data planes/channels.
static const float at9_band_ext_scales_m3[][2]
static const float at9_scalefactor_c[]
static const float at9_band_ext_scales_m4[]
const char * name
Name of the codec implementation.
static av_cold void atrac9_init_vlc(VLC *vlc, int nb_bits, int nb_codes, const uint8_t(**tab)[2], unsigned *buf_offset, int offset)
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs.
static const uint8_t * align_get_bits(GetBitContext *s)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
static const uint8_t at9_coeffs_tab[][2]
main external API structure.
#define VLC_INIT_STATIC_OVERLONG
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
static const float at9_quant_step_fine[]
static av_const int sign_extend(int val, unsigned bits)
static void atrac9_decode_flush(AVCodecContext *avctx)
static void apply_scalefactors(ATRAC9Context *s, ATRAC9BlockData *b, const int stereo)
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return values
static int atrac9_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
static void read_coeffs_coarse(ATRAC9Context *s, ATRAC9BlockData *b, ATRAC9ChannelData *c, GetBitContext *gb)
static const uint8_t at9_tab_sf_weights[][32]
static const uint8_t at9_tab_band_ext_group[][3]
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
This structure stores compressed data.
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context.
static const uint8_t at9_sfb_b_tab[][2]
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static const uint8_t at9_tab_b_dist[]
const FFCodec ff_atrac9_decoder
static const HuffmanCodebook at9_huffman_coeffs[][8][4]
static const uint8_t at9_tab_sri_frame_log2[]
static void apply_intensity_stereo(ATRAC9Context *s, ATRAC9BlockData *b, const int stereo)
static const uint8_t at9_q_unit_to_coeff_cnt[]