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
43#define RA288_BLOCK_SIZE 5
44#define RA288_BLOCKS_PER_FRAME 32
98 float *gain_block = ractx->
gain_hist + 28;
104 for (
i=0;
i < 10;
i++)
112 sumsum =
exp(sum * 0.1151292546497) * gain * (1.0/(1<<23));
114 for (
i=0;
i < 5;
i++)
119 sum =
FFMAX(sum, 5.0 / (1<<24));
122 memmove(gain_block, gain_block + 1, 9 *
sizeof(*gain_block));
124 gain_block[9] = 10 * log10(sum) + (10*log10(((1<<24)/5.)) - 32);
133 float *hist,
float *rec,
const float *
window,
134 float *lpc,
const float *
tab,
135 int order,
int n,
int non_rec,
int move_size)
144 memmove(hist, hist + n, move_size*
sizeof(*hist));
148 int *got_frame_ptr,
AVPacket *avpkt)
150 const uint8_t *buf = avpkt->
data;
151 int buf_size = avpkt->
size;
157 if (buf_size < avctx->block_align) {
159 "Error! Input buffer is too small [%d<%d]\n",
178 decode(ractx, gain, cb_coef);
198 .p.name =
"real_288",
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
const FFCodec ff_ra_288_decoder
Libavcodec external API header.
#define i(width, name, range_min, range_max)
void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs, const float *in, int buffer_length, int filter_length)
LP synthesis filter.
Public libavutil channel layout APIs header.
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int(* init)(AVBSFContext *ctx)
static SDL_Window * window
float ff_scalarproduct_float_c(const float *v1, const float *v2, int len)
Return the scalar product of two vectors of floats.
static void do_hybrid_window(void(*vector_fmul)(float *dst, const float *src0, const float *src1, int len), int order, int n, int non_rec, float *out, const float *hist, float *out2, const float *window)
Hybrid window filtering, see blocks 36 and 49 of the G.728 specification.
bitstream reader API header.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
#define AV_CHANNEL_LAYOUT_MONO
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define MAX_BACKWARD_FILTER_ORDER
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context.
common internal API header
static int compute_lpc_coefs(const LPC_TYPE *autoc, int i, int max_order, LPC_TYPE *lpc, int lpc_stride, int fail, int normalize, LPC_TYPE *err_ptr)
Levinson-Durbin recursion.
Memory handling functions.
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
static int ra288_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
static void decode(RA288Context *ractx, float gain, int cb_coef)
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.
static av_cold int ra288_decode_init(AVCodecContext *avctx)
#define RA288_BLOCKS_PER_FRAME
static const float gain_bw_tab[FFALIGN(10, 16)]
gain bandwidth broadening table
static const int16_t codetable[128][5]
static const float syn_bw_tab[FFALIGN(36, 16)]
synthesis bandwidth broadening table
static const float amptable[8]
static const float gain_window[FFALIGN(38, 16)]
static const float syn_window[FFALIGN(111, 16)]
An AVChannelLayout holds information about the channel layout of audio data.
main external API structure.
AVChannelLayout ch_layout
Audio channel layout.
enum AVSampleFormat sample_fmt
audio sample format
int flags
AV_CODEC_FLAG_*.
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs.
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.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
float gain_hist[38]
log-gain history (spec: SBLG).
float gain_lpc[FFALIGN(10, 16)]
LPC coefficients for gain (spec: GB)
float sp_rec[37]
speech part of the gain autocorrelation (spec: REXP)
float gain_rec[11]
recursive part of the gain autocorrelation (spec: REXPLG)
float sp_lpc[FFALIGN(36, 16)]
LPC coefficients for speech data (spec: A)
float sp_hist[111]
speech data history (spec: SB).
void(* vector_fmul)(float *dst, const float *src0, const float *src1, int len)
static const struct twinvq_data tab