FFmpeg
|
twinvq.c
Go to the documentation of this file.
189 int16_t permut[4][4096];
1156 av_log(avctx, AV_LOG_ERROR, "This version does not support %d kHz - %d kbit/s/ch mode.\n", isampf, isampf);
static av_cold void init_bitstream_params(TwinContext *tctx)
Definition: twinvq.c:1014
static void read_and_decode_spectrum(TwinContext *tctx, GetBitContext *gb, float *out, enum FrameType ftype)
Definition: twinvq.c:724
static av_cold int twin_decode_close(AVCodecContext *avctx)
Definition: twinvq.c:1083
static void linear_perm(int16_t *out, int16_t *in, int n_blocks, int size)
Definition: twinvq.c:979
static void dec_lpc_spectrum_inv(TwinContext *tctx, float *lsp, enum FrameType ftype, float *lpc)
Definition: twinvq.c:590
Parameters and tables that are different for every combination of bitrate/sample rate.
Definition: twinvq.c:70
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
struct TwinContext TwinContext
initialize output if(nPeaks >3)%at least 3 peaks in spectrum for trying to find f0 nf0peaks
Definition: libavcodec/avcodec.h:425
Definition: samplefmt.h:50
static const struct @78 tabs[]
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
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: libavcodec/avcodec.h:1242
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: libavcodec/avcodec.h:743
static void interpolate(float *out, float v1, float v2, int size)
Definition: twinvq.c:280
bitstream reader API header.
#define CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
Definition: libavcodec/avcodec.h:715
static const int16_t cos_tab[COS_TBL_SIZE+1]
Cosine table scaled by 2^14.
Definition: g723_1_data.h:131
void(* vector_fmul_window)(float *dst, const float *src0, const float *src1, const float *win, int len)
Overlap/add with window function.
Definition: float_dsp.h:103
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
Definition: mem.c:183
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: libavutil/internal.h:123
static av_cold int init_mdct_win(TwinContext *tctx)
Init IMDCT and windowing tables.
Definition: twinvq.c:871
Definition: avutil.h:144
external API header
static void dequant(TwinContext *tctx, GetBitContext *gb, float *out, enum FrameType ftype, const int16_t *cb0, const int16_t *cb1, int cb_len)
Inverse quantization.
Definition: twinvq.c:362
Definition: fft.h:62
audio channel layout utility functions
static void imdct_and_window(TwinContext *tctx, enum FrameType ftype, int wtype, float *in, float *prev, int ch)
Definition: twinvq.c:612
static int very_broken_op(int a, int b)
Evaluate a*b/400 rounded to the nearest integer.
Definition: twinvq.c:432
static void permutate_in_line(int16_t *tab, int num_vect, int num_blocks, int block_size, const uint8_t line_len[2], int length_div, enum FrameType ftype)
Interpret the data as if it were a num_blocks x line_len[0] matrix and for each line do a cyclic perm...
Definition: twinvq.c:928
static void rearrange_lsp(int order, float *lsp, float min_dist)
Rearrange the LSP coefficients so that they have a minimum distance of min_dist.
Definition: twinvq.c:538
Definition: float_dsp.h:24
static void add_peak(int period, int width, const float *shape, float ppc_gain, float *speech, int len)
Sum to data a periodic peak of a given period, width and shape.
Definition: twinvq.c:453
1i.*Xphase exp()
static void decode_lsp(TwinContext *tctx, int lpc_idx1, uint8_t *lpc_idx2, int lpc_hist_idx, float *lsp, float *hist)
Definition: twinvq.c:551
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: libavcodec/utils.c:823
static void dec_bark_env(TwinContext *tctx, const uint8_t *in, int use_hist, int ch, float *out, float gain, enum FrameType ftype)
Definition: twinvq.c:697
void(* butterflies_float)(float *av_restrict v1, float *av_restrict v2, int len)
Calculate the sum and difference of two vectors of floats.
Definition: float_dsp.h:150
static int twin_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Definition: twinvq.c:809
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Definition: get_bits.h:379
static void imdct_output(TwinContext *tctx, enum FrameType ftype, int wtype, float **out)
Definition: twinvq.c:666
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFilterBuffer 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.Buffer references ownership and permissions
void(* imdct_half)(struct FFTContext *s, FFTSample *output, const FFTSample *input)
Definition: fft.h:82
static float eval_lpc_spectrum(const float *lsp, float cos_val, int order)
Evaluate a single LPC amplitude spectrum envelope coefficient from the line spectrum pairs...
Definition: twinvq.c:242
static void decode_ppc(TwinContext *tctx, int period_coef, const float *shape, float ppc_gain, float *speech)
Definition: twinvq.c:477
static void eval_lpcenv_or_interp(TwinContext *tctx, enum FrameType ftype, float *out, const float *in, int size, int step, int part)
Evaluate the LPC amplitude spectrum envelope from the line spectrum pairs.
Definition: twinvq.c:311
Definition: get_bits.h:54
common internal api header.
static double clip(void *opaque, double val)
Clip value val in the minval - maxval range.
Definition: vf_lut.c:139
void ff_sort_nearly_sorted_floats(float *vals, int len)
Sort values in ascending order.
Definition: lsp.c:228
static void eval_lpcenv(TwinContext *tctx, const float *cos_vals, float *lpc)
Evaluate the LPC amplitude spectrum envelope from the line spectrum pairs.
Definition: twinvq.c:267
static void dec_gain(TwinContext *tctx, GetBitContext *gb, enum FrameType ftype, float *out)
Definition: twinvq.c:502
static void transpose_perm(int16_t *out, int16_t *in, int num_vect, const uint8_t line_len[2], int length_div)
Interpret the input data as in the following table:
Definition: twinvq.c:969
Definition: twinvq.c:177
static float get_cos(int idx, int part, const float *cos_tab, int size)
Definition: twinvq.c:291
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
static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: crystalhd.c:868
void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int bit_exact)
Initialize a float DSP context.
Definition: float_dsp.c:118
static av_cold void construct_perm_table(TwinContext *tctx, enum FrameType ftype)
Definition: twinvq.c:988
static void eval_lpcenv_2parts(TwinContext *tctx, enum FrameType ftype, const float *buf, float *lpc, int size, int step)
Definition: twinvq.c:345
void ff_init_ff_sine_windows(int index)
initialize the specified entry of ff_sine_windows
Definition: sinewin_tablegen.h:60
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
Generated on Mon Nov 18 2024 06:52:01 for FFmpeg by 1.8.11