FFmpeg
|
Atrac 3 compatible decoder. More...
#include <math.h>
#include <stddef.h>
#include <stdio.h>
#include "libavutil/float_dsp.h"
#include "libavutil/libm.h"
#include "avcodec.h"
#include "bytestream.h"
#include "fft.h"
#include "fmtconvert.h"
#include "get_bits.h"
#include "internal.h"
#include "atrac.h"
#include "atrac3data.h"
Go to the source code of this file.
Data Structures | |
struct | GainInfo |
struct | GainBlock |
struct | TonalComponent |
struct | ChannelUnit |
struct | ATRAC3Context |
Macros | |
#define | JOINT_STEREO 0x12 |
#define | STEREO 0x2 |
#define | SAMPLES_PER_FRAME 1024 |
#define | MDCT_SIZE 512 |
#define | INTERPOLATE(old, new, nsample) ((old) + (nsample) * 0.125 * ((new) - (old))) |
Functions | |
static void | imlt (ATRAC3Context *q, float *input, float *output, int odd_band) |
Regular 512 points IMDCT without overlapping, with the exception of the swapping of odd bands caused by the reverse spectra of the QMF. | |
static int | decode_bytes (const uint8_t *input, uint8_t *out, int bytes) |
static av_cold void | init_atrac3_window (void) |
static av_cold int | atrac3_decode_close (AVCodecContext *avctx) |
static void | read_quant_spectral_coeffs (GetBitContext *gb, int selector, int coding_flag, int *mantissas, int num_codes) |
Mantissa decoding. | |
static int | decode_spectrum (GetBitContext *gb, float *output) |
Restore the quantized band spectrum coefficients. | |
static int | decode_tonal_components (GetBitContext *gb, TonalComponent *components, int num_bands) |
Restore the quantized tonal components. | |
static int | decode_gain_control (GetBitContext *gb, GainBlock *block, int num_bands) |
Decode gain parameters for the coded bands. | |
static void | gain_compensate_and_overlap (float *input, float *prev, float *output, GainInfo *gain1, GainInfo *gain2) |
Apply gain parameters and perform the MDCT overlapping part. | |
static int | add_tonal_components (float *spectrum, int num_components, TonalComponent *components) |
Combine the tonal band spectrum and regular band spectrum. | |
static void | reverse_matrixing (float *su1, float *su2, int *prev_code, int *curr_code) |
static void | get_channel_weights (int index, int flag, float ch[2]) |
static void | channel_weighting (float *su1, float *su2, int *p3) |
static int | decode_channel_sound_unit (ATRAC3Context *q, GetBitContext *gb, ChannelUnit *snd, float *output, int channel_num, int coding_mode) |
Decode a Sound Unit. | |
static int | decode_frame (AVCodecContext *avctx, const uint8_t *databuf, float **out_samples) |
static int | atrac3_decode_frame (AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) |
static void | atrac3_init_static_data (void) |
static av_cold int | atrac3_decode_init (AVCodecContext *avctx) |
Variables | |
static float | mdct_window [MDCT_SIZE] |
static VLC_TYPE | atrac3_vlc_table [4096][2] |
static VLC | spectral_coeff_tab [7] |
static float | gain_tab1 [16] |
static float | gain_tab2 [31] |
AVCodec | ff_atrac3_decoder |
Atrac 3 compatible decoder.
This decoder handles Sony's ATRAC3 data.
Container formats used to store atrac 3 data: RealMedia (.rm), RIFF WAV (.wav, .at3), Sony OpenMG (.oma, .aa3).
To use this decoder, a calling application must supply the extradata bytes provided in the containers above.
Definition in file atrac3.c.
#define JOINT_STEREO 0x12 |
Definition at line 51 of file atrac3.c.
Referenced by atrac3_decode_init(), decode_channel_sound_unit(), decode_frame(), and mp3lame_encode_init().
#define STEREO 0x2 |
Definition at line 52 of file atrac3.c.
Referenced by atrac3_decode_init().
#define SAMPLES_PER_FRAME 1024 |
Definition at line 54 of file atrac3.c.
Referenced by atrac3_decode_frame(), atrac3_decode_init(), decode_spectrum(), and decode_tonal_components().
#define INTERPOLATE | ( | old, | |
new, | |||
nsample | |||
) | ((old) + (nsample) * 0.125 * ((new) - (old))) |
Definition at line 530 of file atrac3.c.
Referenced by channel_weighting(), and reverse_matrixing().
|
static |
Regular 512 points IMDCT without overlapping, with the exception of the swapping of odd bands caused by the reverse spectra of the QMF.
odd_band | 1 if the band is an odd band |
Reverse the odd bands before IMDCT, this is an effect of the QMF transform or it gives better compression to do it this way. FIXME: It should be possible to handle this in imdct_calc for that to happen a modification of the prerotation step of all SIMD code and C code is needed. Or fix the functions before so they generate a pre reversed spectrum.
Definition at line 133 of file atrac3.c.
Referenced by decode_channel_sound_unit().
Definition at line 159 of file atrac3.c.
Referenced by atrac3_decode_frame().
Definition at line 182 of file atrac3.c.
Referenced by atrac3_init_static_data().
|
static |
Definition at line 197 of file atrac3.c.
Referenced by atrac3_decode_init().
|
static |
Mantissa decoding.
selector | which table the output values are coded with |
coding_flag | constant length coding or variable length coding |
mantissas | mantissa output table |
num_codes | number of values to get |
Definition at line 217 of file atrac3.c.
Referenced by decode_spectrum(), and decode_tonal_components().
|
static |
Restore the quantized band spectrum coefficients.
Definition at line 276 of file atrac3.c.
Referenced by decode_channel_sound_unit().
|
static |
Restore the quantized tonal components.
components | tonal components |
num_bands | number of coded bands |
Definition at line 334 of file atrac3.c.
Referenced by decode_channel_sound_unit().
|
static |
Decode gain parameters for the coded bands.
block | the gainblock for the current band |
num_bands | amount of coded bands |
Definition at line 418 of file atrac3.c.
Referenced by decode_channel_sound_unit().
|
static |
Apply gain parameters and perform the MDCT overlapping part.
input | input buffer |
prev | previous buffer to perform overlap against |
output | output buffer |
gain1 | current band gain info |
gain2 | next band gain info |
Definition at line 456 of file atrac3.c.
Referenced by decode_channel_sound_unit().
|
static |
Combine the tonal band spectrum and regular band spectrum.
spectrum | output spectrum buffer |
num_components | number of tonal components |
components | tonal components for this band |
Definition at line 512 of file atrac3.c.
Referenced by decode_channel_sound_unit().
|
static |
Definition at line 533 of file atrac3.c.
Referenced by decode_frame().
|
static |
Definition at line 595 of file atrac3.c.
Referenced by channel_weighting().
|
static |
Definition at line 608 of file atrac3.c.
Referenced by decode_frame().
|
static |
Decode a Sound Unit.
snd | the channel unit to be used |
output | the decoded samples before IQMF in float representation |
channel_num | channel number |
coding_mode | the coding mode (JOINT_STEREO or regular stereo/mono) |
Definition at line 639 of file atrac3.c.
Referenced by decode_frame().
|
static |
Definition at line 707 of file atrac3.c.
Referenced by atrac3_decode_frame().
|
static |
Definition at line 844 of file atrac3.c.
Referenced by atrac3_decode_init().
|
static |
|
static |
Definition at line 120 of file atrac3.c.
Referenced by imlt(), and init_atrac3_window().
|
static |
Definition at line 121 of file atrac3.c.
Referenced by atrac3_init_static_data().
|
static |
Definition at line 123 of file atrac3.c.
Referenced by atrac3_init_static_data(), and gain_compensate_and_overlap().
|
static |
Definition at line 124 of file atrac3.c.
Referenced by atrac3_init_static_data(), and gain_compensate_and_overlap().
AVCodec ff_atrac3_decoder |