48 #define MAX_CHANNELS 64 49 #define MAX_ELEM_ID 16 51 #define TNS_MAX_ORDER 20 52 #define MAX_LTP_LONG_SFB 40 54 #define CLIP_AVOIDANCE_FACTOR 0.95f 93 #define IS_CODEBOOK_UNSIGNED(x) (((x) - 1) & 10) 147 #define MAX_PREDICTORS 672 149 #define SCALE_DIV_512 36 150 #define SCALE_ONE_POS 140
151 #define SCALE_MAX_POS 255
152 #define SCALE_MAX_DIFF 60
153 #define SCALE_DIFF_ZERO 60
155 #define POW_SF2_ZERO 200 157 #define NOISE_PRE 256 158 #define NOISE_PRE_BITS 9
159 #define NOISE_OFFSET 90
190 int predictor_reset_count[31];
255 int band_type_run_end[120];
int predictor_initialized
static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce)
Conduct IMDCT and windowing.
static void apply_ltp(AACContext *ac, SingleChannelElement *sce)
Apply the long term prediction.
Band types following are encoded differently from others.
This structure describes decoded (raw) audio or video data.
INTFLOAT * ret
PCM output.
int common_window
Set if channels share a common 'IndividualChannelStream' in bitstream.
static void update_ltp(AACContext *ac, SingleChannelElement *sce)
Update the LTP buffer for next frame.
static void vector_pow43(int *coefs, int len)
Dynamic Range Control - decoded from the bitstream but not processed further.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Spectral data are scaled white noise not coded in the bitstream.
int band_incr
Number of DRC bands greater than 1 having DRC info.
int dmono_mode
0->not dmono, 1->use first channel, 2->use second channel
const uint16_t * swb_offset
table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular wind...
uint8_t layout_map[MAX_ELEM_ID *4][3]
Output configuration under trial specified by an inband PCE.
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
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
CouplingPoint
The point during decoding at which channel coupling is applied.
int num_coupled
number of target elements
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
Scalefactor data are intensity stereo positions (in phase).
Output configuration set in a global header but not yet locked.
SpectralBandReplication sbr
Spectral Band Replication definitions and structures.
uint8_t max_sfb
number of scalefactor bands per group
int num_swb
number of scalefactor window bands
int prog_ref_level
A reference level for the long-term program audio level for all channels combined.
Output configuration locked in place.
int warned_remapping_once
int predictor_reset_group
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
void ff_aacdec_init_mips(AACContext *c)
int pce_instance_tag
Indicates with which program the DRC info is associated.
static void windowing_and_mdct_ltp(AACContext *ac, INTFLOAT *out, INTFLOAT *in, IndividualChannelStream *ics)
Apply windowing and MDCT to obtain the spectral coefficient from the predicted sample by LTP...
int interpolation_scheme
Indicates the interpolation scheme used in the SBR QMF domain.
int force_dmono_mode
0->not dmono, 1->use first channel, 2->use second channel
int is_saved
Set if elements have stored overlap from previous frame.
int warned_num_aac_frames
Libavcodec external API header.
static void apply_tns(INTFLOAT coef_param[1024], TemporalNoiseShaping *tns, IndividualChannelStream *ics, int decode)
Decode Temporal Noise Shaping filter coefficients and apply all-pole filters; reference: 4...
main external API structure.
IndividualChannelStream ics
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31))))#define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac){}void ff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map){AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);return NULL;}return ac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;}int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){int use_generic=1;int len=in->nb_samples;int p;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
Describe the class of an AVClass context structure.
Spectral data are coded with an escape sequence.
const uint8_t * swb_sizes
table of scalefactor band sizes for a particular window
OCStatus
Output configuration status.
int ms_mode
Signals mid/side stereo flags coding mode (used by encoder)
Output configuration under trial specified by a frame header.
uint8_t is_mode
Set if any bands have been encoded using intensity stereo (used by encoder)
Scalefactor data are intensity stereo positions (out of phase).
DynamicRangeControl che_drc
Single Channel Element - used for both SCE and LFE elements.
Individual Channel Stream.
float clip_avoidance_factor
set if any window is near clipping to the necessary atennuation factor to avoid it ...
channel element - generic struct for SCE/CPE/CCE/LFE
static void subband_scale(int *dst, int *src, int scale, int offset, int len, void *log_context)
Scalefactors and spectral data are all zero.
Spectral Band Replication.
This and later band types encode two values (rather than four) with one code word.