Go to the documentation of this file.
55 int i, ch,
tag, chans, cur_channel, start_ch = 0;
58 for (
i = 0;
i <
s->chan_map[0];
i++) {
60 tag =
s->chan_map[
i+1];
62 for (ch = 0; ch < chans; ch++) {
64 cur_channel = start_ch + ch;
67 memcpy(&sce->
ltp_state[1024], &
s->planar_samples[cur_channel][2048], 1024*
sizeof(sce->
ltp_state[0]));
77 int i, j, lag = 0, max_corr = 0;
78 float max_ratio = 0.0f;
79 for (
i = 0;
i < 2048;
i++) {
80 float corr,
s0 = 0.0f,
s1 = 0.0f;
81 const int start =
FFMAX(0,
i - 1024);
82 for (j = start; j < 2048; j++) {
83 const int idx = j -
i + 1024;
84 s0 +=
new[j]*buf[idx];
85 s1 += buf[idx]*buf[idx];
87 corr =
s1 > 0.0f ?
s0/sqrt(
s1) : 0.0f;
88 if (corr > max_corr) {
91 max_ratio = corr/(2048-start);
101 int i, samples_num = 2048;
105 }
else if (ltp->
lag < 1024) {
106 samples_num = ltp->
lag + 1024;
108 for (
i = 0;
i < samples_num;
i++)
109 buf[
i] = ltp->
coef*buf[
i + 2048 - ltp->
lag];
110 memset(&buf[
i], 0, (2048 -
i)*
sizeof(
float));
120 const float *
samples = &
s->planar_samples[
s->cur_channel][1024];
162 int w,
g, w2,
i, start = 0, count = 0;
164 float *C34 = &
s->scoefs[128*0], *PCD = &
s->scoefs[128*1];
165 float *PCD34 = &
s->scoefs[128*2];
184 if (
w*16+
g > max_ltp) {
189 int bits_tmp1, bits_tmp2;
190 FFPsyBand *band = &
s->psy.ch[
s->cur_channel].psy_bands[(
w+w2)*16+
g];
void ff_aac_update_ltp(AACEncContext *s, SingleChannelElement *sce)
Process LTP parameters.
static void get_lag(float *buf, const float *new, LongTermPrediction *ltp)
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
#define FF_PROFILE_AAC_LTP
int8_t used[MAX_LTP_LONG_SFB]
int num_swb
number of scalefactor window bands
static const INTFLOAT ltp_coef[8]
INTFLOAT ret_buf[2048]
PCM output buffer.
IndividualChannelStream ics
INTFLOAT coeffs[1024]
coefficients for IMDCT, maybe processed
static const uint8_t bits1[81]
const uint8_t * swb_sizes
table of scalefactor band sizes for a particular window
void ff_aac_encode_ltp_info(AACEncContext *s, SingleChannelElement *sce, int common_window)
Encode LTP data.
Individual Channel Stream.
single band psychoacoustic information
int sf_idx[128]
scalefactor indices (used by encoder)
void ff_aac_ltp_insert_new_frame(AACEncContext *s)
AAC_FLOAT lcoeffs[1024]
MDCT of LTP coefficients (used by encoder)
SingleChannelElement ch[2]
static int quant_array_idx(const float val, const float *arr, const int num)
int common_window
Set if channels share a common 'IndividualChannelStream' in bitstream.
void ff_aac_adjust_common_ltp(AACEncContext *s, ChannelElement *cpe)
static void generate_samples(float *buf, LongTermPrediction *ltp)
Single Channel Element - used for both SCE and LFE elements.
#define i(width, name, range_min, range_max)
channel element - generic struct for SCE/CPE/CCE/LFE
enum WindowSequence window_sequence[2]
Filter the word “frame” indicates either a video frame or a group of audio samples
uint8_t max_sfb
number of scalefactor bands per group
void ff_aac_search_for_ltp(AACEncContext *s, SingleChannelElement *sce, int common_window)
Mark LTP sfb's.
static float quantize_band_cost(struct AACEncContext *s, const float *in, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits, float *energy, int rtz)
INTFLOAT ltp_state[3072]
time signal for LTP
enum BandType band_type[128]
band types
static const uint8_t bits2[81]