FFmpeg
|
aacsbr.c
Go to the documentation of this file.
552 sbr->patch_start_subband[sbr->num_patches] = sbr->k[0] - odd - sbr->patch_num_subbands[sbr->num_patches];
738 "Invalid bitstream, bs_pointer points to a middle noise border outside the time borders table: %d\n",
788 memcpy(dst->bs_freq_res+1, src->bs_freq_res+1, sizeof(dst->bs_freq_res)-sizeof(*dst->bs_freq_res));
862 ch_data->env_facs[i + 1][j] = ch_data->env_facs[i][j] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav);
866 ch_data->env_facs[i + 1][j] = ch_data->env_facs[i][k] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav);
871 ch_data->env_facs[i + 1][j] = ch_data->env_facs[i][k] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav);
877 ch_data->env_facs[i + 1][j] = ch_data->env_facs[i + 1][j - 1] + delta * (get_vlc2(gb, f_huff, 9, 3) - f_lav);
909 ch_data->noise_facs[i + 1][j] = ch_data->noise_facs[i][j] + delta * (get_vlc2(gb, t_huff, 9, 2) - t_lav);
911 ch_data->noise_facs[i + 1][0] = delta * get_bits(gb, 5); // bs_noise_start_value_balance or bs_noise_start_value_level
913 ch_data->noise_facs[i + 1][j] = ch_data->noise_facs[i + 1][j - 1] + delta * (get_vlc2(gb, f_huff, 9, 3) - f_lav);
929 av_log(ac->avctx, AV_LOG_ERROR, "Parametric Stereo signaled to be not-present but was found in the bitstream.\n");
986 memcpy(sbr->data[1].bs_invf_mode[1], sbr->data[1].bs_invf_mode[0], sizeof(sbr->data[1].bs_invf_mode[0]));
987 memcpy(sbr->data[1].bs_invf_mode[0], sbr->data[0].bs_invf_mode[0], sizeof(sbr->data[1].bs_invf_mode[0]));
1087 sbr->sample_rate = 2 * ac->oc[1].m4ac.sample_rate; //TODO use the nominal sample rate for arbitrary sample rate support
1486 memcpy(ch_data->s_indexmapped[0], ch_data->s_indexmapped[ch_data->bs_num_env], sizeof(ch_data->s_indexmapped[0]));
1567 gain_max = limgain[sbr->bs_limiter_gains] * sqrtf((FLT_EPSILON + sum[0]) / (FLT_EPSILON + sum[1]));
1619 memcpy(g_temp[2*ch_data->t_env[0]], g_temp[2*ch_data->t_env_num_env_old], 4*sizeof(g_temp[0]));
1620 memcpy(q_temp[2*ch_data->t_env[0]], q_temp[2*ch_data->t_env_num_env_old], 4*sizeof(q_temp[0]));
1701 sbr_qmf_analysis(&ac->fdsp, &sbr->mdct_ana, &sbr->dsp, ch ? R : L, sbr->data[ch].analysis_filterbank_samples,
Definition: start.py:1
int(* sbr_x_gen)(SpectralBandReplication *sbr, float X[2][38][64], const float Y0[38][64][2], const float Y1[38][64][2], const float X_low[32][40][2], int ch)
Definition: sbr.h:126
Definition: aacsbr.c:62
static int sbr_make_f_derived(AACContext *ac, SpectralBandReplication *sbr)
Derived Frequency Band Tables (14496-3 sp04 p197)
Definition: aacsbr.c:572
int ff_ps_apply(AVCodecContext *avctx, PSContext *ps, float L[2][38][64], float R[2][38][64], int top)
Definition: aacps.c:904
static void sbr_hf_assemble(float Y1[38][64][2], const float X_high[64][40][2], SpectralBandReplication *sbr, SBRData *ch_data, const int e_a[2])
Assembling HF Signals (14496-3 sp04 p220)
Definition: aacsbr.c:1593
static void read_sbr_noise(SpectralBandReplication *sbr, GetBitContext *gb, SBRData *ch_data, int ch)
Definition: aacsbr.c:886
About Git write you should know how to use GIT properly Luckily Git comes with excellent documentation git help man git shows you the available git< command > help man git< command > shows information about the subcommand< command > The most comprehensive manual is the website Git Reference visit they are quite exhaustive You do not need a special username or password All you need is to provide a ssh public key to the Git server admin What follows now is a basic introduction to Git and some FFmpeg specific guidelines Read it at least if you are granted commit privileges to the FFmpeg project you are expected to be familiar with these rules I if not You can get git from etc no matter how small Every one of them has been saved from looking like a fool by this many times It s very easy for stray debug output or cosmetic modifications to slip in
Definition: git-howto.txt:5
unsigned kx[2]
kx', and kx respectively, kx is the first QMF subband where SBR is used.
Definition: sbr.h:156
static void sbr_qmf_synthesis(FFTContext *mdct, SBRDSPContext *sbrdsp, AVFloatDSPContext *dsp, float *out, float X[2][38][64], float mdct_buf[2][64], float *v0, int *v_off, const unsigned int div)
Synthesis QMF Bank (14496-3 sp04 p206) and Downsampled Synthesis QMF Bank (14496-3 sp04 p206) ...
Definition: aacsbr.c:1210
static int sbr_hf_gen(AACContext *ac, SpectralBandReplication *sbr, float X_high[64][40][2], const float X_low[32][40][2], const float(*alpha0)[2], const float(*alpha1)[2], const float bw_array[5], const uint8_t *t_env, int bs_num_env)
High Frequency Generator (14496-3 sp04 p215)
Definition: aacsbr.c:1362
static int read_sbr_grid(AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb, SBRData *ch_data)
Definition: aacsbr.c:639
Definition: aacsbr.c:59
Definition: aacsbr.c:63
Definition: aacsbr.c:74
av_cold void ff_aac_sbr_ctx_close(SpectralBandReplication *sbr)
Close one SBR context.
Definition: aacsbr.c:167
initialize output if(nPeaks >3)%at least 3 peaks in spectrum for trying to find f0 nf0peaks
unsigned n[2]
N_Low and N_High respectively, the number of frequency bands for low and high resolution.
Definition: sbr.h:165
static const int8_t sbr_offset[6][16]
window coefficients for analysis/synthesis QMF banks
Definition: aacsbrdata.h:260
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
Definition: aacsbr.c:56
static int check_n_master(AVCodecContext *avctx, int n_master, int bs_xover_band)
Definition: aacsbr.c:315
Definition: aacsbr.c:64
void(* vector_fmul)(float *dst, const float *src0, const float *src1, int len)
Calculate the product of two vectors of floats and store the result in a vector of floats...
Definition: float_dsp.h:38
void ff_aacsbr_func_ptr_init_mips(AACSBRContext *c)
Definition: aacsbr_mips.c:608
Definition: aacsbr.c:60
static int qsort_comparison_function_int16(const void *a, const void *b)
Definition: aacsbr.c:173
int ff_decode_sbr_extension(AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb_host, int crc, int cnt, int id_aac)
Decode Spectral Band Replication extension data; reference: table 4.55.
Definition: aacsbr.c:1076
AAC Spectral Band Replication decoding data.
Definition: sbrdsp.h:26
static unsigned int read_sbr_header(SpectralBandReplication *sbr, GetBitContext *gb)
Definition: aacsbr.c:235
static void sbr_env_estimate(float(*e_curr)[48], float X_high[64][40][2], SpectralBandReplication *sbr, SBRData *ch_data)
Estimation of current envelope (14496-3 sp04 p218)
Definition: aacsbr.c:1491
static int sbr_mapping(AACContext *ac, SpectralBandReplication *sbr, SBRData *ch_data, int e_a[2])
High Frequency Adjustment (14496-3 sp04 p217) and Mapping (14496-3 sp04 p217)
Definition: aacsbr.c:1436
static av_always_inline void get_bits1_vector(GetBitContext *gb, uint8_t *vec, int elements)
Definition: aacsbr.c:625
static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr, SpectrumParameters *spectrum)
Master Frequency Band Table (14496-3 sp04 p194)
Definition: aacsbr.c:332
static void sbr_hf_inverse_filter(SBRDSPContext *dsp, float(*alpha0)[2], float(*alpha1)[2], const float X_low[32][40][2], int k0)
High Frequency Generation (14496-3 sp04 p214+) and Inverse Filtering (14496-3 sp04 p214) Warning: Thi...
Definition: aacsbr.c:1261
Spectral Band Replication header - spectrum parameters that invoke a reset if they differ from the pr...
Definition: sbr.h:42
static int read_sbr_channel_pair_element(AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb)
Definition: aacsbr.c:972
static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
Dequantization and stereo decoding (14496-3 sp04 p203)
Definition: aacsbr.c:1122
void(* sbr_hf_assemble)(float Y1[38][64][2], const float X_high[64][40][2], SpectralBandReplication *sbr, SBRData *ch_data, const int e_a[2])
Definition: sbr.h:122
static const struct endianess table[]
static int sbr_x_gen(SpectralBandReplication *sbr, float X[2][38][64], const float Y0[38][64][2], const float Y1[38][64][2], const float X_low[32][40][2], int ch)
Generate the subband filtered lowband.
Definition: aacsbr.c:1397
About Git write you should know how to use GIT properly Luckily Git comes with excellent documentation git help man git shows you the available git< command > help man git< command > shows information about the subcommand< command > The most comprehensive manual is the website Git Reference visit they are quite exhaustive You do not need a special username or password All you need is to provide a ssh public key to the Git server admin What follows now is a basic introduction to Git and some FFmpeg specific guidelines Read it at least if you are granted commit privileges to the FFmpeg project you are expected to be familiar with these rules I if not You can get git from etc no matter how small Every one of them has been saved from looking like a fool by this many times It s very easy for stray debug output or cosmetic modifications to slip please avoid problems through this extra level of scrutiny For cosmetics only commits you should e g by running git config global user name My Name git config global user email my email which is either set in your personal configuration file through git config core editor or set by one of the following environment VISUAL or EDITOR Log messages should be concise but descriptive Explain why you made a change
Definition: git-howto.txt:153
Spectral Band Replication definitions and structures.
Definition: aacsbr.c:61
simple assert() macros that are a bit more flexible than ISO C assert().
static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
High Frequency Generation - Patch Construction (14496-3 sp04 p216 fig. 4.46)
Definition: aacsbr.c:521
phase spectrum(unwrapped) ploc
void(* hf_apply_noise[4])(float(*Y)[2], const float *s_m, const float *q_filt, int noise, int kx, int m_max)
Definition: sbrdsp.h:40
void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac, float *L, float *R)
Apply one SBR element to one AAC element.
Definition: aacsbr.c:1681
Definition: aacsbr.c:55
Reference: libavcodec/aacsbr.c.
static void read_sbr_dtdf(SpectralBandReplication *sbr, GetBitContext *gb, SBRData *ch_data)
Read how the envelope and noise floor data is delta coded.
Definition: aacsbr.c:799
Definition: get_bits.h:63
static void sbr_qmf_analysis(AVFloatDSPContext *dsp, FFTContext *mdct, SBRDSPContext *sbrdsp, const float *in, float *x, float z[320], float W[2][32][32][2], int buf_idx)
Analysis QMF Bank (14496-3 sp04 p206)
Definition: aacsbr.c:1186
common internal API header
static unsigned int read_sbr_data(AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb, int id_aac)
Definition: aacsbr.c:1014
static void sbr_turnoff(SpectralBandReplication *sbr)
Places SBR in pure upsampling mode.
Definition: aacsbr.c:139
uint8_t t_env_num_env_old
Envelope time border of the last envelope of the previous frame.
Definition: sbr.h:105
AAC Spectral Band Replication function declarations.
Definition: fft.h:62
static void read_sbr_envelope(SpectralBandReplication *sbr, GetBitContext *gb, SBRData *ch_data, int ch)
Definition: aacsbr.c:817
static int read_sbr_single_channel_element(AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb)
Definition: aacsbr.c:952
Definition: aacsbr.c:73
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
Definition: get_bits.h:524
AAC definitions and structures.
Definition: float_dsp.h:24
static void sbr_gain_calc(AACContext *ac, SpectralBandReplication *sbr, SBRData *ch_data, const int e_a[2])
Calculation of levels of additional HF signal components (14496-3 sp04 p219) and Calculation of gain ...
Definition: aacsbr.c:1537
void(* autocorrelate)(const float x[40][2], float phi[3][2][2])
Definition: sbrdsp.h:34
Definition: aacsbr.c:72
static void sbr_make_f_tablelim(SpectralBandReplication *sbr)
Limiter Frequency Band Table (14496-3 sp04 p198)
Definition: aacsbr.c:188
unsigned m[2]
M' and M respectively, M is the number of QMF subbands that use SBR.
Definition: sbr.h:158
Replacements for frequently missing libm functions.
int synthesis_filterbank_samples_offset
Definition: sbr.h:85
static int sbr_lf_gen(AACContext *ac, SpectralBandReplication *sbr, float X_low[32][40][2], const float W[2][32][32][2], int buf_idx)
Generate the subband filtered lowband.
Definition: aacsbr.c:1337
static void sbr_chirp(SpectralBandReplication *sbr, SBRData *ch_data)
Chirp Factors (14496-3 sp04 p214)
Definition: aacsbr.c:1316
av_cold void ff_aac_sbr_ctx_init(AACContext *ac, SpectralBandReplication *sbr)
Initialize one SBR context.
Definition: aacsbr.c:149
void(* imdct_half)(struct FFTContext *s, FFTSample *output, const FFTSample *input)
Definition: fft.h:82
Definition: aacsbr.c:57
static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb, int bs_extension_id, int *num_bits_left)
Definition: aacsbr.c:922
Definition: aacsbr.c:58
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static int in_table_int16(const int16_t *table, int last_el, int16_t needle)
Definition: aacsbr.c:178
Definition: aacsbr.c:71
static void sbr_reset(AACContext *ac, SpectralBandReplication *sbr)
Definition: aacsbr.c:1055
int(* sbr_lf_gen)(AACContext *ac, SpectralBandReplication *sbr, float X_low[32][40][2], const float W[2][32][32][2], int buf_idx)
Definition: sbr.h:119
Definition: get_bits.h:54
void(* vector_fmul_add)(float *dst, const float *src0, const float *src1, const float *src2, int len)
Calculate the product of two vectors of floats, add a third vector of floats and store the result in ...
Definition: float_dsp.h:121
void(* sbr_hf_inverse_filter)(SBRDSPContext *dsp, float(*alpha0)[2], float(*alpha1)[2], const float X_low[32][40][2], int k0)
Definition: sbr.h:129
static void make_bands(int16_t *bands, int start, int stop, int num_bands)
Definition: aacsbr.c:297
void(* qmf_post_shuffle)(float W[32][2], const float *z)
Definition: sbrdsp.h:31
void(* qmf_deint_bfly)(float *v, const float *src0, const float *src1)
Definition: sbrdsp.h:33
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=av_sample_fmt_is_planar(in_fmt);out_planar=av_sample_fmt_is_planar(out_fmt);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_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_dlog(ac->avr,"%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-> out
Definition: audio_convert.c:194
void(* qmf_deint_neg)(float *v, const float *src)
Definition: sbrdsp.h:32
Definition: aacsbr.c:78
void(* hf_gen)(float(*X_high)[2], const float(*X_low)[2], const float alpha0[2], const float alpha1[2], float bw, int start, int end)
Definition: sbrdsp.h:35
void(* hf_g_filt)(float(*Y)[2], const float(*X_high)[40][2], const float *g_filt, int m_max, intptr_t ixh)
Definition: sbrdsp.h:38
int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb_host, PSContext *ps, int bits_left)
Definition: aacps.c:151
static void read_sbr_invf(SpectralBandReplication *sbr, GetBitContext *gb, SBRData *ch_data)
Read inverse filtering data.
Definition: aacsbr.c:807
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step
Definition: rate_distortion.txt:12
void(* vector_fmul_reverse)(float *dst, const float *src0, const float *src1, int len)
Calculate the product of two vectors of floats, and store the result in a vector of floats...
Definition: float_dsp.h:140
Generated on Mon Nov 18 2024 06:51:51 for FFmpeg by 1.8.11