Go to the documentation of this file.
28 #define BITSTREAM_READER_LE
37 #define MAX_BACKWARD_FILTER_ORDER 36
38 #define MAX_BACKWARD_FILTER_LEN 40
39 #define MAX_BACKWARD_FILTER_NONREC 35
41 #define RA288_BLOCK_SIZE 5
42 #define RA288_BLOCKS_PER_FRAME 32
103 float *gain_block = ractx->
gain_hist + 28;
109 for (
i=0;
i < 10;
i++)
117 sumsum =
exp(sum * 0.1151292546497) * gain * (1.0/(1<<23));
119 for (
i=0;
i < 5;
i++)
124 sum =
FFMAX(sum, 5.0 / (1<<24));
127 memmove(gain_block, gain_block + 1, 9 *
sizeof(*gain_block));
129 gain_block[9] = 10 * log10(sum) + (10*log10(((1<<24)/5.)) - 32);
147 int order,
int n,
int non_rec,
float *
out,
148 float *hist,
float *out2,
const float *
window)
164 for (
i=0;
i <= order;
i++) {
165 out2[
i] = out2[
i] * 0.5625 + buffer1[
i];
166 out [
i] = out2[
i] + buffer2[
i];
170 *
out *= 257.0 / 256.0;
177 float *hist,
float *rec,
const float *
window,
178 float *lpc,
const float *
tab,
179 int order,
int n,
int non_rec,
int move_size)
188 memmove(hist, hist + n, move_size*
sizeof(*hist));
192 int *got_frame_ptr,
AVPacket *avpkt)
194 const uint8_t *buf = avpkt->
data;
195 int buf_size = avpkt->
size;
201 if (buf_size < avctx->block_align) {
203 "Error! Input buffer is too small [%d<%d]\n",
222 decode(ractx, gain, cb_coef);
242 .
p.
name =
"real_288",
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
static const int16_t codetable[128][5]
const FFCodec ff_ra_288_decoder
This structure describes decoded (raw) audio or video data.
#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
AVCodec p
The public AVCodec.
AVChannelLayout ch_layout
Audio channel layout.
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.
#define LOCAL_ALIGNED(a, t, v,...)
#define FF_CODEC_DECODE_CB(func)
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 CODEC_LONG_NAME(str)
static int compute_lpc_coefs(const LPC_TYPE *autoc, int max_order, LPC_TYPE *lpc, int lpc_stride, int fail, int normalize)
Levinson-Durbin recursion.
#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)
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
An AVChannelLayout holds information about the channel layout of audio data.
#define DECLARE_ALIGNED(n, t, v)
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.
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
enum AVSampleFormat sample_fmt
audio sample format
static void convolve(float *tgt, const float *src, int len, int n)
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define i(width, name, range_min, range_max)
static int ra288_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
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).
void(* vector_fmul)(float *dst, const float *src0, const float *src1, int len)
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
float sp_rec[37]
speech part of the gain autocorrelation (spec: REXP)
float gain_rec[11]
recursive part of the gain autocorrelation (spec: REXPLG)
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
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len)
Return the scalar product of two vectors of floats.
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
#define AV_CHANNEL_LAYOUT_MONO
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