Go to the documentation of this file.
77 for (
i = 0;
i < 4;
i++) {
78 for (j = 0; j < pce->
num_ele[
i]; j++) {
98 int channels = (!
s->needs_pce)*(
s->channels - (
s->channels == 8 ? 1 : 0));
99 const int max_size = 32;
128 ++
s->quantize_band_cost_cache_generation;
129 if (
s->quantize_band_cost_cache_generation == 0) {
130 memset(
s->quantize_band_cost_cache, 0,
sizeof(
s->quantize_band_cost_cache));
131 s->quantize_band_cost_cache_generation = 1;
135 #define WINDOW_FUNC(type) \
136 static void apply_ ##type ##_window(AVFloatDSPContext *fdsp, \
137 SingleChannelElement *sce, \
144 float *
out = sce->ret_buf;
146 fdsp->vector_fmul (
out, audio, lwindow, 1024);
147 fdsp->vector_fmul_reverse(
out + 1024, audio + 1024, pwindow, 1024);
154 float *
out = sce->ret_buf;
156 fdsp->vector_fmul(
out, audio, lwindow, 1024);
157 memcpy(
out + 1024, audio + 1024,
sizeof(
out[0]) * 448);
158 fdsp->vector_fmul_reverse(
out + 1024 + 448, audio + 1024 + 448, swindow, 128);
159 memset(
out + 1024 + 576, 0,
sizeof(
out[0]) * 448);
166 float *
out = sce->ret_buf;
168 memset(
out, 0,
sizeof(
out[0]) * 448);
169 fdsp->vector_fmul(
out + 448, audio + 448, swindow, 128);
170 memcpy(
out + 576, audio + 576,
sizeof(
out[0]) * 448);
171 fdsp->vector_fmul_reverse(
out + 1024, audio + 1024, lwindow, 1024);
178 const float *in = audio + 448;
179 float *
out = sce->ret_buf;
182 for (
w = 0;
w < 8;
w++) {
183 fdsp->vector_fmul (
out, in,
w ? pwindow : swindow, 128);
186 fdsp->vector_fmul_reverse(
out, in, swindow, 128);
193 const float *audio) = {
211 for (
i = 0;
i < 1024;
i += 128)
213 memcpy(audio, audio + 1024,
sizeof(audio[0]) * 1024);
233 for (
w = 1;
w < 8;
w++)
261 for (ch = 0; ch < chans; ch++) {
267 for (cmaxsfb = ics->
num_swb; cmaxsfb > 0 && cpe->
ch[ch].
zeroes[
w*16+cmaxsfb-1]; cmaxsfb--)
269 maxsfb =
FFMAX(maxsfb, cmaxsfb);
299 if (msc == 0 || ics0->
max_sfb == 0)
314 int start = (
w+w2) * 128;
343 int start = (
w+w2) * 128;
374 if (
s->coder->set_special_band_scalefactors)
375 s->coder->set_special_band_scalefactors(
s, sce);
388 int off_is = 0, noise_flag = 1;
397 if (noise_flag-- > 0) {
451 s->coder->quantize_and_encode_band(
s, &
s->pb,
452 &sce->
coeffs[start + w2*128],
475 float *swb_coeffs = &sce->
coeffs[start +
w*128];
492 if (!common_window) {
494 if (
s->coder->encode_main_pred)
495 s->coder->encode_main_pred(
s, sce);
496 if (
s->coder->encode_ltp_info)
497 s->coder->encode_ltp_info(
s, sce, 0);
503 if (
s->coder->encode_tns_info)
504 s->coder->encode_tns_info(
s, sce);
515 int i, namelen, padbits;
517 namelen = strlen(
name) + 2;
525 for (
i = 0;
i < namelen - 2;
i++)
537 int end = 2048 + (
frame ?
frame->nb_samples : 0);
538 const uint8_t *channel_map =
s->reorder_map;
541 for (ch = 0; ch <
s->channels; ch++) {
543 memcpy(&
s->planar_samples[ch][1024], &
s->planar_samples[ch][2048], 1024 *
sizeof(
s->planar_samples[0][0]));
547 memcpy(&
s->planar_samples[ch][2048],
548 frame->extended_data[channel_map[ch]],
549 frame->nb_samples *
sizeof(
s->planar_samples[0][0]));
551 memset(&
s->planar_samples[ch][end], 0,
552 (3072 - end) *
sizeof(
s->planar_samples[0][0]));
560 float **
samples =
s->planar_samples, *samples2, *la, *overlap;
564 int i, its, ch,
w, chans,
tag, start_ch,
ret, frame_bits;
565 int target_bits, rate_bits, too_many_bits, too_few_bits;
566 int ms_mode = 0, is_mode = 0, tns_mode = 0, pred_mode = 0;
567 int chan_el_counter[4];
575 if (!
s->afq.remaining_samples || (!
s->afq.frame_alloc && !
s->afq.frame_count))
587 for (
i = 0;
i <
s->chan_map[0];
i++) {
589 tag =
s->chan_map[
i+1];
592 for (ch = 0; ch < chans; ch++) {
594 float clip_avoidance_factor;
597 s->cur_channel = start_ch + ch;
598 overlap = &
samples[
s->cur_channel][0];
599 samples2 = overlap + 1024;
600 la = samples2 + (448+64);
614 ics->
num_swb =
s->samplerate_index >= 8 ? 1 : 3;
616 wi[ch] =
s->psy.model->window(&
s->psy, samples2, la,
s->cur_channel,
638 clip_avoidance_factor = 0.0f;
640 const float *wbuf = overlap +
w * 128;
645 for (j = 0; j < wlen; j++)
652 clip_avoidance_factor =
FFMAX(clip_avoidance_factor, wi[ch].clipping[
w]);
665 if (
s->options.ltp &&
s->coder->update_ltp) {
666 s->coder->update_ltp(
s, sce);
671 for (k = 0; k < 1024; k++) {
683 frame_bits = its = 0;
691 memset(chan_el_counter, 0,
sizeof(chan_el_counter));
692 for (
i = 0;
i <
s->chan_map[0];
i++) {
694 const float *coeffs[2];
695 tag =
s->chan_map[
i+1];
703 for (ch = 0; ch < chans; ch++) {
711 for (
w = 0;
w < 128;
w++)
715 s->psy.bitres.alloc = -1;
716 s->psy.bitres.bits =
s->last_frame_pb_count /
s->channels;
717 s->psy.model->analyze(&
s->psy, start_ch, coeffs, wi);
718 if (
s->psy.bitres.alloc > 0) {
720 target_bits +=
s->psy.bitres.alloc
722 s->psy.bitres.alloc /= chans;
725 for (ch = 0; ch < chans; ch++) {
726 s->cur_channel = start_ch + ch;
727 if (
s->options.pns &&
s->coder->mark_pns)
728 s->coder->mark_pns(
s, avctx, &cpe->
ch[ch]);
729 s->coder->search_for_quantizers(avctx,
s, &cpe->
ch[ch],
s->lambda);
732 && wi[0].window_type[0] == wi[1].window_type[0]
733 && wi[0].window_shape == wi[1].window_shape) {
737 if (wi[0].grouping[
w] != wi[1].grouping[
w]) {
743 for (ch = 0; ch < chans; ch++) {
745 s->cur_channel = start_ch + ch;
746 if (
s->options.tns &&
s->coder->search_for_tns)
747 s->coder->search_for_tns(
s, sce);
748 if (
s->options.tns &&
s->coder->apply_tns_filt)
749 s->coder->apply_tns_filt(
s, sce);
752 if (
s->options.pns &&
s->coder->search_for_pns)
753 s->coder->search_for_pns(
s, avctx, sce);
755 s->cur_channel = start_ch;
756 if (
s->options.intensity_stereo) {
757 if (
s->coder->search_for_is)
758 s->coder->search_for_is(
s, avctx, cpe);
762 if (
s->options.pred) {
763 for (ch = 0; ch < chans; ch++) {
765 s->cur_channel = start_ch + ch;
766 if (
s->options.pred &&
s->coder->search_for_pred)
767 s->coder->search_for_pred(
s, sce);
770 if (
s->coder->adjust_common_pred)
771 s->coder->adjust_common_pred(
s, cpe);
772 for (ch = 0; ch < chans; ch++) {
774 s->cur_channel = start_ch + ch;
775 if (
s->options.pred &&
s->coder->apply_main_pred)
776 s->coder->apply_main_pred(
s, sce);
778 s->cur_channel = start_ch;
780 if (
s->options.mid_side) {
781 if (
s->options.mid_side == -1 &&
s->coder->search_for_ms)
782 s->coder->search_for_ms(
s, cpe);
788 if (
s->options.ltp) {
789 for (ch = 0; ch < chans; ch++) {
791 s->cur_channel = start_ch + ch;
792 if (
s->coder->search_for_ltp)
796 s->cur_channel = start_ch;
797 if (
s->coder->adjust_common_ltp)
798 s->coder->adjust_common_ltp(
s, cpe);
804 if (
s->coder->encode_main_pred)
805 s->coder->encode_main_pred(
s, &cpe->
ch[0]);
806 if (
s->coder->encode_ltp_info)
807 s->coder->encode_ltp_info(
s, &cpe->
ch[0], 1);
812 for (ch = 0; ch < chans; ch++) {
813 s->cur_channel = start_ch + ch;
830 rate_bits =
FFMIN(rate_bits, 6144 *
s->channels - 3);
831 too_many_bits =
FFMAX(target_bits, rate_bits);
832 too_many_bits =
FFMIN(too_many_bits, 6144 *
s->channels - 3);
833 too_few_bits =
FFMIN(
FFMAX(rate_bits - rate_bits/4, target_bits), too_many_bits);
836 too_few_bits = too_few_bits - too_few_bits/8;
837 too_many_bits = too_many_bits + too_many_bits/2;
840 || (its < 5 && (frame_bits < too_few_bits || frame_bits > too_many_bits))
841 || frame_bits >= 6144 *
s->channels - 3 )
843 float ratio = ((float)rate_bits) / frame_bits;
845 if (frame_bits >= too_few_bits && frame_bits <= too_many_bits) {
852 ratio = sqrtf(sqrtf(ratio));
856 ratio = sqrtf(ratio);
858 s->lambda =
av_clipf(
s->lambda * ratio, FLT_EPSILON, 65536.f);
861 if (ratio > 0.9
f && ratio < 1.1
f) {
864 if (is_mode || ms_mode || tns_mode || pred_mode) {
865 for (
i = 0;
i <
s->chan_map[0];
i++) {
869 for (ch = 0; ch < chans; ch++)
880 if (
s->options.ltp &&
s->coder->ltp_insert_new_frame)
881 s->coder->ltp_insert_new_frame(
s);
889 s->lambda_sum +=
s->lambda;
944 for(ch = 0; ch <
s->channels; ch++)
945 s->planar_samples[ch] =
s->buffer.samples + 3 * 1024 * ch;
954 const uint8_t *
sizes[2];
959 s->last_frame_pb_count = 0;
970 s->needs_pce =
s->options.pce;
982 av_log(avctx,
AV_LOG_INFO,
"Using a PCE to encode channel layout \"%s\"\n", buf);
984 s->reorder_map =
s->pce.reorder_map;
985 s->chan_map =
s->pce.config_map;
992 for (
i = 1;
i <=
s->chan_map[0];
i++) {
1000 for (
i = 0;
i < 16;
i++)
1003 s->samplerate_index =
i;
1007 "Unsupported sample rate %d\n", avctx->
sample_rate);
1011 "Too many bits %f > %d per frame requested, clamping to max\n",
1013 6144 *
s->channels);
1026 "Main prediction unavailable in the \"mpeg2_aac_low\" profile\n");
1028 "LTP prediction unavailable in the \"mpeg2_aac_low\" profile\n");
1030 "PNS unavailable in the \"mpeg2_aac_low\" profile, turning off\n");
1035 "Main prediction unavailable in the \"aac_ltp\" profile\n");
1037 s->options.pred = 1;
1039 "LTP prediction unavailable in the \"aac_main\" profile\n");
1040 }
else if (
s->options.ltp) {
1043 "Chainging profile to \"aac_ltp\"\n");
1045 "Main prediction unavailable in the \"aac_ltp\" profile\n");
1046 }
else if (
s->options.pred) {
1049 "Chainging profile to \"aac_main\"\n");
1051 "LTP prediction unavailable in the \"aac_main\" profile\n");
1059 "The ANMR coder is considered experimental, add -strict -2 to enable!\n");
1060 s->options.intensity_stereo = 0;
1064 "The LPT profile requires experimental compliance, add -strict -2 to enable!\n");
1067 if (
s->channels > 3)
1068 s->options.mid_side = 0;
1083 for (
i = 0;
i <
s->chan_map[0];
i++)
1086 s->chan_map[0], grouping)) < 0)
1090 s->random_state = 0x1f2e3d4c;
1107 #define AACENC_FLAGS AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
1109 {
"aac_coder",
"Coding algorithm", offsetof(
AACEncContext,
options.coder),
AV_OPT_TYPE_INT, {.i64 =
AAC_CODER_TWOLOOP}, 0,
AAC_CODER_NB-1,
AACENC_FLAGS,
"coder"},
#define FF_ALLOCZ_TYPED_ARRAY(p, nelem)
int frame_size
Number of samples per channel in an audio frame.
@ AV_SAMPLE_FMT_FLTP
float, planar
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
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 default minimum maximum flags name is the option name
const uint8_t ff_tns_max_bands_128[]
static const AVClass aacenc_class
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
uint64_t channel_layout
Audio channel layout.
static void put_bitstream_info(AACEncContext *s, const char *name)
Write some auxiliary information about the created AAC file.
float ff_aac_kbd_short_128[128]
static void align_put_bits(PutBitContext *s)
Pad the bitstream with zeros up to the next byte boundary.
void ff_af_queue_remove(AudioFrameQueue *afq, int nb_samples, int64_t *pts, int64_t *duration)
Remove frame(s) from the queue.
#define FF_COMPLIANCE_EXPERIMENTAL
Allow nonstandardized experimental things.
static int put_bytes_output(const PutBitContext *s)
int sample_rate
samples per second
void ff_af_queue_close(AudioFrameQueue *afq)
Close AudioFrameQueue.
static void abs_pow34_v(float *out, const float *in, const int size)
static enum AVSampleFormat sample_fmts[]
static void copy_input_samples(AACEncContext *s, const AVFrame *frame)
static av_cold int aac_encode_init(AVCodecContext *avctx)
static const int aacenc_profiles[]
#define AV_CODEC_FLAG_QSCALE
Use fixed qscale.
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
#define FF_PROFILE_AAC_MAIN
uint8_t zeroes[128]
band is not coded (used by encoder)
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
av_cold void ff_af_queue_init(AVCodecContext *avctx, AudioFrameQueue *afq)
Initialize AudioFrameQueue.
void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout)
Return a description of a channel layout.
This structure describes decoded (raw) audio or video data.
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
#define WARN_IF(cond,...)
const AACCoefficientsEncoder ff_aac_coders[AAC_CODER_NB]
#define FF_PROFILE_AAC_LTP
static void encode_band_info(AACEncContext *s, SingleChannelElement *sce)
Encode scalefactor band coding type.
int window_shape
window shape (sine/KBD/whatever)
static const uint8_t aac_chan_configs[AAC_MAX_CHANNELS][6]
default channel configurations
int8_t used[MAX_LTP_LONG_SFB]
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
INTFLOAT pcoeffs[1024]
coefficients for IMDCT, pristine
const uint16_t *const ff_swb_offset_128[]
static void encode_spectral_coeffs(AACEncContext *s, SingleChannelElement *sce)
Encode spectral coefficients processed by psychoacoustic model.
const uint8_t ff_tns_max_bands_1024[]
int num_swb
number of scalefactor window bands
#define WINDOW_FUNC(type)
static void avoid_clipping(AACEncContext *s, SingleChannelElement *sce)
Downscale spectral coefficients for near-clipping windows to avoid artifacts.
INTFLOAT ret_buf[2048]
PCM output buffer.
#define FF_PROFILE_MPEG2_AAC_LOW
static void apply_mid_side_stereo(ChannelElement *cpe)
int ms_mode
Signals mid/side stereo flags coding mode (used by encoder)
int initial_padding
Audio only.
static const AVCodecDefault defaults[]
int flags
AV_CODEC_FLAG_*.
static void put_pce(PutBitContext *pb, AVCodecContext *avctx)
av_cold void ff_psy_end(FFPsyContext *ctx)
Cleanup model context at the end.
static av_always_inline float scale(float x, float s)
static __device__ float fabsf(float a)
int ff_af_queue_add(AudioFrameQueue *afq, const AVFrame *f)
Add a frame to the queue.
uint8_t prediction_used[41]
int num_ele[4]
front, side, back, lfe
IndividualChannelStream ics
windowing related information
static void adjust_frame_information(ChannelElement *cpe, int chans)
Produce integer coefficients from scalefactors provided by the model.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
float clip_avoidance_factor
set if any window is near clipping to the necessary atennuation factor to avoid it
@ NOISE_BT
Spectral data are scaled white noise not coded in the bitstream.
INTFLOAT coeffs[1024]
coefficients for IMDCT, maybe processed
int global_quality
Global quality for codecs which cannot change it per frame.
const uint8_t * swb_sizes
table of scalefactor band sizes for a particular window
@ INTENSITY_BT2
Scalefactor data are intensity stereo positions (out of phase).
#define FF_PROFILE_UNKNOWN
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static const int64_t aac_normal_chan_layouts[7]
static av_cold int alloc_buffers(AVCodecContext *avctx, AACEncContext *s)
const int ff_aac_swb_size_128_len
void ff_put_string(PutBitContext *pb, const char *string, int terminate_string)
Put the string string in the bitstream.
Individual Channel Stream.
#define SCALE_DIFF_ZERO
codebook index corresponding to zero scalefactor indices difference
#define NOISE_PRE
preamble for NOISE_BT, put in bitstream with the first noise band
const uint16_t * swb_offset
table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular wind...
void ff_aac_tableinit(void)
static const uint8_t aac_chan_maps[AAC_MAX_CHANNELS][AAC_MAX_CHANNELS]
Table to remap channels from libavcodec's default order to AAC order.
@ INTENSITY_BT
Scalefactor data are intensity stereo positions (in phase).
int window_type[3]
window type (short/long/transitional, etc.) - current, previous and next
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
static const AACPCEInfo aac_pce_configs[]
List of PCE (Program Configuration Element) for the channel layouts listed in channel_layout....
static __device__ float fabs(float a)
uint8_t is_mask[128]
Set if intensity stereo is used (used by encoder)
static const int sizes[][2]
const int ff_aac_swb_size_1024_len
static void encode_pulses(AACEncContext *s, Pulse *pulse)
Encode pulse data.
float is_ener[128]
Intensity stereo pos (used by encoder)
const uint8_t ff_aac_num_swb_128[]
int64_t bit_rate
the average bitrate
const char * av_default_item_name(void *ptr)
Return the context name.
int grouping[8]
window grouping (for e.g. AAC)
int sf_idx[128]
scalefactor indices (used by encoder)
static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
const uint8_t ff_aac_scalefactor_bits[121]
float clipping[8]
maximum absolute normalized intensity in the given window for clip avoidance
const OptionDef options[]
AAC_FLOAT lcoeffs[1024]
MDCT of LTP coefficients (used by encoder)
SingleChannelElement ch[2]
const uint16_t *const ff_swb_offset_1024[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static void quantize_bands(int *out, const float *in, const float *scaled, int size, int is_signed, int maxval, const float Q34, const float rounding)
void ff_aac_float_common_init(void)
#define FF_PROFILE_AAC_LOW
static void encode_scale_factors(AVCodecContext *avctx, AACEncContext *s, SingleChannelElement *sce)
Encode scalefactors.
static void apply_window_and_mdct(AACEncContext *s, SingleChannelElement *sce, float *audio)
void ff_aac_coder_init_mips(AACEncContext *c)
int common_window
Set if channels share a common 'IndividualChannelStream' in bitstream.
static void apply_intensity_stereo(ChannelElement *cpe)
int index[4][8]
front, side, back, lfe
uint8_t ms_mask[128]
Set if mid/side stereo is used for each scalefactor window band.
av_cold void ff_lpc_end(LPCContext *s)
Uninitialize LPCContext.
#define AV_LOG_INFO
Standard information.
int channels
number of audio channels
av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext *avctx, int num_lens, const uint8_t **bands, const int *num_bands, int num_groups, const uint8_t *group_map)
Initialize psychoacoustic model.
Single Channel Element - used for both SCE and LFE elements.
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
static int put_bits_count(PutBitContext *s)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static const AVOption aacenc_options[]
channel element - generic struct for SCE/CPE/CCE/LFE
static void(*const apply_window[4])(AVFloatDSPContext *fdsp, SingleChannelElement *sce, const float *audio)
int pairing[3][8]
front, side, back
AVSampleFormat
Audio sample formats.
#define NOISE_PRE_BITS
length of preamble
av_cold struct FFPsyPreprocessContext * ff_psy_preprocess_init(AVCodecContext *avctx)
psychoacoustic model audio preprocessing initialization
float ff_aac_kbd_long_1024[1024]
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
const char * name
Name of the codec implementation.
void ff_aac_dsp_init_x86(AACEncContext *s)
const uint8_t ff_aac_num_swb_1024[]
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
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 or at least make progress towards producing a frame
int strict_std_compliance
strictly follow the standard (MPEG-4, ...).
static void encode_ms_info(PutBitContext *pb, ChannelElement *cpe)
Encode MS data.
@ RESERVED_BT
Band types following are encoded differently from others.
void ff_psy_preprocess(struct FFPsyPreprocessContext *ctx, float **audio, int channels)
Preprocess several channel in audio frame in order to compress it better.
#define CLIP_AVOIDANCE_FACTOR
main external API structure.
static int encode_individual_channel(AVCodecContext *avctx, AACEncContext *s, SingleChannelElement *sce, int common_window)
Encode one channel of audio data.
#define NOISE_OFFSET
subtracted from global gain, used as offset for the preamble
#define ERROR_IF(cond,...)
const uint8_t *const ff_aac_swb_size_1024[]
enum WindowSequence window_sequence[2]
@ AOT_SBR
Y Spectral Band Replication.
static int put_audio_specific_config(AVCodecContext *avctx)
Make AAC audio config object.
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Filter the word “frame” indicates either a video frame or a group of audio samples
uint8_t is_mode
Set if any bands have been encoded using intensity stereo (used by encoder)
static void put_ics_info(AACEncContext *s, IndividualChannelStream *info)
Encode ics_info element.
const int ff_mpeg4audio_sample_rates[16]
const uint8_t *const ff_aac_swb_size_128[]
static const AVCodecDefault aac_encode_defaults[]
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
static av_cold int aac_encode_end(AVCodecContext *avctx)
int frame_number
Frame counter, set by libavcodec.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
static av_always_inline int diff(const uint32_t a, const uint32_t b)
#define FF_AAC_PROFILE_OPTS
This structure stores compressed data.
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context.
uint8_t window_clipping[8]
set if a certain window is near clipping
uint8_t max_sfb
number of scalefactor bands per group
INTFLOAT ltp_state[3072]
time signal for LTP
static av_cold int dsp_init(AVCodecContext *avctx, AACEncContext *s)
av_cold void ff_psy_preprocess_end(struct FFPsyPreprocessContext *ctx)
Cleanup audio preprocessing module.
#define AV_CODEC_CAP_SMALL_LAST_FRAME
Codec can be fed a final frame with a smaller size.
enum BandType band_type[128]
band types
uint8_t use_kb_window[2]
If set, use Kaiser-Bessel window, otherwise use a sine window.
int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and allocate data.
@ FF_LPC_TYPE_LEVINSON
Levinson-Durbin recursion.
const AVCodec ff_aac_encoder
int num_windows
number of windows in a frame
av_cold int ff_lpc_init(LPCContext *s, int blocksize, int max_order, enum FFLPCType lpc_type)
Initialize LPCContext.
const uint32_t ff_aac_scalefactor_code[121]
void ff_quantize_band_cost_cache_init(struct AACEncContext *s)