Go to the documentation of this file.
26 #define BITSTREAM_READER_LE
34 #define MAX_BACKWARD_FILTER_ORDER 36
35 #define MAX_BACKWARD_FILTER_LEN 40
36 #define MAX_BACKWARD_FILTER_NONREC 35
38 #define RA288_BLOCK_SIZE 5
39 #define RA288_BLOCKS_PER_FRAME 32
105 float *gain_block = ractx->
gain_hist + 28;
111 for (
i=0;
i < 10;
i++)
115 sum = av_clipf(sum, 0, 60);
119 sumsum =
exp(sum * 0.1151292546497) * gain * (1.0/(1<<23));
121 for (
i=0;
i < 5;
i++)
126 sum =
FFMAX(sum, 5.0 / (1<<24));
129 memmove(gain_block, gain_block + 1, 9 *
sizeof(*gain_block));
131 gain_block[9] = 10 * log10(sum) + (10*log10(((1<<24)/5.)) - 32);
149 int order,
int n,
int non_rec,
float *
out,
150 float *hist,
float *out2,
const float *
window)
166 for (
i=0;
i <= order;
i++) {
167 out2[
i] = out2[
i] * 0.5625 + buffer1[
i];
168 out [
i] = out2[
i] + buffer2[
i];
172 *
out *= 257.0 / 256.0;
179 float *hist,
float *rec,
const float *
window,
180 float *lpc,
const float *
tab,
181 int order,
int n,
int non_rec,
int move_size)
190 memmove(hist, hist + n, move_size*
sizeof(*hist));
194 int *got_frame_ptr,
AVPacket *avpkt)
198 int buf_size = avpkt->
size;
204 if (buf_size < avctx->block_align) {
206 "Error! Input buffer is too small [%d<%d]\n",
225 decode(ractx, gain, cb_coef);
static av_cold int init(AVCodecContext *avctx)
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 const int16_t codetable[128][5]
#define AV_CH_LAYOUT_MONO
This structure describes decoded (raw) audio or video data.
static int AAC_RENAME() compute_lpc_coefs(const LPC_TYPE *autoc, int max_order, LPC_TYPE *lpc, int lpc_stride, int fail, int normalize)
Levinson-Durbin recursion.
#define MAX_BACKWARD_FILTER_NONREC
static void backward_filter(RA288Context *ractx, float *hist, float *rec, const float *window, float *lpc, const float *tab, int order, int n, int non_rec, int move_size)
Backward synthesis filter, find the LPC coefficients from past speech data.
void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs, const float *in, int buffer_length, int filter_length)
LP synthesis filter.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static SDL_Window * window
static void decode(RA288Context *ractx, float gain, int cb_coef)
static const struct twinvq_data tab
#define MAX_BACKWARD_FILTER_ORDER
int flags
AV_CODEC_FLAG_*.
static const float gain_window[FFALIGN(38, 16)]
static const float syn_bw_tab[FFALIGN(36, 16)]
synthesis bandwidth broadening table
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static void do_hybrid_window(RA288Context *ractx, int order, int n, int non_rec, float *out, float *hist, float *out2, const float *window)
Hybrid window filtering, see blocks 36 and 49 of the G.728 specification.
static const float gain_bw_tab[FFALIGN(10, 16)]
gain bandwidth broadening table
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
must be printed separately If there s no standard function for printing the type you the WRITE_1D_FUNC_ARGV macro is a very quick way to create one See libavcodec dv_tablegen c for an example The h file This file should the initialization functions should not do and instead of the variable declarations the generated *_tables h file should be included Since that will be generated in the build the path must be i e not Makefile changes To make the automatic table creation work
#define RA288_BLOCKS_PER_FRAME
float sp_lpc[FFALIGN(36, 16)]
LPC coefficients for speech data (spec: A)
static av_cold int ra288_decode_init(AVCodecContext *avctx)
static av_cold int ra288_decode_close(AVCodecContext *avctx)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
void(* vector_fmul)(float *dst, const float *src0, const float *src1, int len)
Calculate the entry wise product of two vectors of floats and store the result in a vector of floats.
enum AVSampleFormat sample_fmt
audio sample format
static void convolve(float *tgt, const float *src, int len, int n)
int channels
number of audio channels
#define DECLARE_ALIGNED(n, t, v)
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define i(width, name, range_min, range_max)
const char * name
Name of the codec implementation.
float gain_lpc[FFALIGN(10, 16)]
LPC coefficients for gain (spec: GB)
static const float syn_window[FFALIGN(111, 16)]
float gain_hist[38]
log-gain history (spec: SBLG).
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs.
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
AVCodec ff_ra_288_decoder
float sp_rec[37]
speech part of the gain autocorrelation (spec: REXP)
float gain_rec[11]
recursive part of the gain autocorrelation (spec: REXPLG)
static int ra288_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
main external API structure.
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len)
Return the scalar product of two vectors.
#define LOCAL_ALIGNED(a, t, v,...)
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
static const float amptable[8]
This structure stores compressed data.
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context.
The exact code depends on how similar the blocks are and how related they are to the block
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
float sp_hist[111]
speech data history (spec: SB).
#define MAX_BACKWARD_FILTER_LEN