34 #define ON2AVC_SUBFRAME_SIZE 1024
90 int w,
b, band_off = 0;
111 int bits_per_sect = c->
is_long ? 5 : 3;
112 int esc_val = (1 << bits_per_sect) - 1;
116 while (band < num_bands) {
121 if (run > num_bands - band - run_len) {
126 }
while (run == esc_val);
127 for (i = band; i < band +
run_len; i++) {
141 int w, w2,
b, scale, first = 1;
174 if (scale < 0 || scale > 127) {
188 return v * sqrtf(abs(v)) * scale;
193 int dst_size,
int type,
float band_scale)
197 for (i = 0; i < dst_size; i += 4) {
200 for (j = 0; j < 4; j++) {
201 val1 =
sign_extend((val >> (12 - j * 4)) & 0xF, 4);
226 int dst_size,
int type,
float band_scale)
228 int i,
val, val1, val2, sign;
230 for (i = 0; i < dst_size; i += 2) {
236 if (val1 <= -16 || val1 >= 16) {
237 sign = 1 - (val1 < 0) * 2;
240 if (val2 <= -16 || val2 >= 16) {
241 sign = 1 - (val2 < 0) * 2;
273 coeff_ptr += band_size;
282 coeff_ptr += band_size;
294 float *ch0 = c->
coeffs[0];
295 float *ch1 = c->
coeffs[1];
299 if (c->
ms_info[band_off + b]) {
301 float l = *ch0,
r = *ch1;
317 memset(src, 0,
sizeof(*src) * order0);
318 memset(src + len - order1, 0,
sizeof(*src) * order1);
322 int step,
int order0,
int order1,
const double *
const *
tabs)
330 for (i = 0; i < tab_step; i++) {
332 for (j = 0; j < order0; j++)
333 sum += src[j] * tab[j * tab_step + i];
337 out = dst + dst_len - tab_step;
339 src2 = src + (dst_len - tab_step) / step + 1 + order0;
340 for (i = 0; i < tab_step; i++) {
342 for (j = 0; j < order1; j++)
343 sum += src2[j] * tab[j * tab_step + i];
349 const double *
tab,
int tab_len,
int step,
350 int order0,
int order1,
const double *
const *
tabs)
356 steps = (src2_len - tab_len) / step + 1;
357 pretwiddle(src1, src2, src2_len, tab_len, step, order0, order1, tabs);
360 for (i = 0; i < steps; i++) {
361 float in0 = src1[order0 + i];
362 int pos = (src2_len - 1) & mask;
365 const double *t =
tab;
366 for (j = pos; j >= 0; j--)
367 src2[j] += in0 * *t++;
368 for (j = 0; j < tab_len - pos - 1; j++)
369 src2[src2_len - j - 1] += in0 * tab[pos + 1 + j];
371 for (j = 0; j < tab_len; j++)
372 src2[pos - j] += in0 * tab[j];
378 #define CMUL1_R(s, t, is, it) \
379 s[is + 0] * t[it + 0] - s[is + 1] * t[it + 1]
380 #define CMUL1_I(s, t, is, it) \
381 s[is + 0] * t[it + 1] + s[is + 1] * t[it + 0]
382 #define CMUL2_R(s, t, is, it) \
383 s[is + 0] * t[it + 0] + s[is + 1] * t[it + 1]
384 #define CMUL2_I(s, t, is, it) \
385 s[is + 0] * t[it + 1] - s[is + 1] * t[it + 0]
387 #define CMUL0(dst, id, s0, s1, s2, s3, t0, t1, t2, t3, is, it) \
388 dst[id] = s0[is] * t0[it] + s1[is] * t1[it] \
389 + s2[is] * t2[it] + s3[is] * t3[it]; \
390 dst[id + 1] = s0[is] * t0[it + 1] + s1[is] * t1[it + 1] \
391 + s2[is] * t2[it + 1] + s3[is] * t3[it + 1];
393 #define CMUL1(dst, s0, s1, s2, s3, t0, t1, t2, t3, is, it) \
394 *dst++ = CMUL1_R(s0, t0, is, it) \
395 + CMUL1_R(s1, t1, is, it) \
396 + CMUL1_R(s2, t2, is, it) \
397 + CMUL1_R(s3, t3, is, it); \
398 *dst++ = CMUL1_I(s0, t0, is, it) \
399 + CMUL1_I(s1, t1, is, it) \
400 + CMUL1_I(s2, t2, is, it) \
401 + CMUL1_I(s3, t3, is, it);
403 #define CMUL2(dst, s0, s1, s2, s3, t0, t1, t2, t3, is, it) \
404 *dst++ = CMUL2_R(s0, t0, is, it) \
405 + CMUL2_R(s1, t1, is, it) \
406 + CMUL2_R(s2, t2, is, it) \
407 + CMUL2_R(s3, t3, is, it); \
408 *dst++ = CMUL2_I(s0, t0, is, it) \
409 + CMUL2_I(s1, t1, is, it) \
410 + CMUL2_I(s2, t2, is, it) \
411 + CMUL2_I(s3, t3, is, it);
414 const float *
t0,
const float *
t1,
415 const float *
t2,
const float *
t3,
int len,
int step)
417 const float *h0, *h1, *h2, *h3;
420 int len2 = len >> 1, len4 = len >> 2;
425 for (half = len2; tmp > 1; half <<= 1, tmp >>= 1);
432 CMUL0(dst, 0, s0, s1, s2, s3, t0, t1, t2, t3, 0, 0);
434 hoff = 2 * step * (len4 >> 1);
439 d2 = dst + 2 + (len >> 1);
440 for (i = 0; i < (len4 - 1) >> 1; i++) {
441 CMUL1(d1, s0, s1, s2, s3, t0, t1, t2, t3, j, k);
442 CMUL1(d2, s0, s1, s2, s3, h0, h1, h2, h3, j, k);
446 CMUL0(dst, len4, s0, s1, s2, s3, t0, t1, t2, t3, 1, hoff);
447 CMUL0(dst, len4 + len2, s0, s1, s2, s3, h0, h1, h2, h3, 1, hoff);
450 k = hoff + 2 * step * len4;
452 d2 = dst + len4 + 2 + len2;
453 for (i = 0; i < (len4 - 2) >> 1; i++) {
454 CMUL2(d1, s0, s1, s2, s3, t0, t1, t2, t3, j, k);
455 CMUL2(d2, s0, s1, s2, s3, h0, h1, h2, h3, j, k);
459 CMUL0(dst, len2 + 4, s0, s1, s2, s3, t0, t1, t2, t3, 0, k);
463 float *tmp0,
float *tmp1)
465 memcpy(src, tmp0, 384 *
sizeof(*tmp0));
466 memcpy(tmp0 + 384, src + 384, 128 *
sizeof(*tmp0));
481 combine_fft(src, src + 128, src + 256, src + 384, tmp1,
492 memcpy(src, tmp1, 512 *
sizeof(
float));
496 float *tmp0,
float *tmp1)
498 memcpy(src, tmp0, 768 *
sizeof(*tmp0));
499 memcpy(tmp0 + 768, src + 768, 256 *
sizeof(*tmp0));
514 combine_fft(src, src + 256, src + 512, src + 768, tmp1,
525 memcpy(src, tmp1, 1024 *
sizeof(
float));
530 float *tmp0 = c->
temp, *tmp1 = c->
temp + 1024;
532 memset(tmp0, 0,
sizeof(*tmp0) * 1024);
533 memset(tmp1, 0,
sizeof(*tmp1) * 1024);
557 memset(tmp0, 0, 64 *
sizeof(*tmp0));
595 memset(tmp0, 0, 128 *
sizeof(*tmp0));
616 float *tmp0 = c->
temp, *tmp1 = c->
temp + 1024;
618 memset(tmp0, 0,
sizeof(*tmp0) * 1024);
619 memset(tmp1, 0,
sizeof(*tmp1) * 1024);
639 memset(tmp0, 0, 64 *
sizeof(*tmp0));
671 memset(tmp0, 0, 128 *
sizeof(*tmp0));
695 float *saved = c->
delay[ch];
697 float *wout = out + 448;
709 for (i = 0; i < 256; i++) {
715 for (i = 0; i < 256; i++) {
718 c->
wtf(c,
buf + 512,
in + 512, 512);
722 memcpy(out, saved, 448 *
sizeof(
float));
724 memcpy(wout + 128,
buf + 64, 448 *
sizeof(
float));
725 memcpy(saved,
buf + 512, 448 *
sizeof(
float));
726 memcpy(saved + 448,
buf + 7*128 + 64, 64 *
sizeof(
float));
739 float *saved = c->
delay[channel];
761 float *wout = out + 448;
762 memcpy(out, saved, 448 *
sizeof(
float));
770 memcpy(wout + 4*128,
temp, 64 *
sizeof(
float));
773 memcpy(wout + 128,
buf + 64, 448 *
sizeof(
float));
780 memcpy(saved,
temp + 64, 64 *
sizeof(
float));
784 memcpy(saved + 448,
buf + 7*128 + 64, 64 *
sizeof(
float));
787 memcpy(saved,
buf + 512, 448 *
sizeof(
float));
788 memcpy(saved + 448,
buf + 7*128 + 64, 64 *
sizeof(
float));
792 memcpy(saved,
buf + 512, 512 *
sizeof(
float));
840 int *got_frame_ptr,
AVPacket *avpkt)
844 int buf_size = avpkt->
size;
885 frame, audio_off)) < 0)
902 for (i = 1; i < 16; i++)
925 "Stereo mode support is not good, patch is welcome\n");
930 for (i = 0; i < 20; i++)
964 for (i = 1; i < 9; i++) {
973 for (i = 9; i < 16; i++) {
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static int on2avc_reconstruct_channel_ext(On2AVCContext *c, AVFrame *dst, int offset)
const double *const ff_on2avc_tabs_4_10_1[4]
const char const char void * val
void(* wtf)(struct On2AVCContext *ctx, float *out, float *in, int size)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int on2avc_read_channel_data(On2AVCContext *c, GetBitContext *gb, int ch)
const double ff_on2avc_tab_20_1[]
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
const uint8_t *const ff_on2avc_pair_cb_bits[]
float coeffs[2][ON2AVC_SUBFRAME_SIZE]
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
float delay[2][ON2AVC_SUBFRAME_SIZE]
static av_cold int init(AVCodecContext *avctx)
const On2AVCMode ff_on2avc_modes_40[8]
int ff_init_vlc_sparse(VLC *vlc_arg, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, const void *codes, int codes_wrap, int codes_size, const void *symbols, int symbols_wrap, int symbols_size, int flags)
static void on2avc_read_ms_info(On2AVCContext *c, GetBitContext *gb)
#define CMUL0(dst, id, s0, s1, s2, s3, t0, t1, t2, t3, is, it)
void(* fft_permute)(struct FFTContext *s, FFTComplex *z)
Do the permutation needed BEFORE calling fft_calc().
const double ff_on2avc_tab_84_4[]
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
const int ff_on2avc_quad_cb_elems[]
#define AV_CH_LAYOUT_STEREO
float mdct_buf[ON2AVC_SUBFRAME_SIZE]
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static int on2avc_apply_ms(On2AVCContext *c)
static float on2avc_scale(int v, float scale)
static int on2avc_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
static const uint8_t run_len[7][16]
const uint16_t *const ff_on2avc_pair_cb_codes[]
const float ff_on2avc_window_short[128]
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
void(* vector_fmul_window)(float *dst, const float *src0, const float *src1, const float *win, int len)
Overlap/add with window function.
uint8_t band_type[ON2AVC_MAX_BANDS]
enum AVSampleFormat sample_fmt
audio sample format
static void wtf_end_1024(On2AVCContext *c, float *out, float *src, float *tmp0, float *tmp1)
static av_cold int on2avc_decode_init(AVCodecContext *avctx)
const double ff_on2avc_tab_84_1[]
const float ff_on2avc_ctab_1[2048]
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
static int on2avc_decode_band_types(On2AVCContext *c, GetBitContext *gb)
const double *const ff_on2avc_tabs_20_84_1[20]
bitstream reader API header.
static void wtf_40(On2AVCContext *c, float *out, float *src, int size)
const uint32_t *const ff_on2avc_quad_cb_codes[]
uint8_t band_run_end[ON2AVC_MAX_BANDS]
const uint32_t ff_on2avc_scale_diff_codes[ON2AVC_SCALE_DIFFS]
const double ff_on2avc_tab_84_2[]
const double ff_on2avc_tab_40_2[]
static int on2avc_decode_subframe(On2AVCContext *c, const uint8_t *buf, int buf_size, AVFrame *dst, int offset)
static av_always_inline double ff_exp10(double x)
Compute 10^x for floating point values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context.
static const uint16_t mask[17]
#define init_vlc(vlc, nb_bits, nb_codes,bits, bits_wrap, bits_size,codes, codes_wrap, codes_size,flags)
const double *const ff_on2avc_tabs_9_20_2[9]
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
#define CMUL1(dst, s0, s1, s2, s3, t0, t1, t2, t3, is, it)
#define CMUL2(dst, s0, s1, s2, s3, t0, t1, t2, t3, is, it)
const float ff_on2avc_window_long_24000[1024]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
int flags
AV_CODEC_FLAG_*.
const char * name
Name of the codec implementation.
const double ff_on2avc_tab_20_2[]
const uint16_t *const ff_on2avc_pair_cb_syms[]
static const uint8_t offset[127][2]
const double ff_on2avc_tab_40_1[]
uint64_t channel_layout
Audio channel layout.
static int get_egolomb(GetBitContext *gb)
const double *const ff_on2avc_tabs_9_20_1[9]
const uint16_t *const ff_on2avc_quad_cb_syms[]
static av_cold void on2avc_free_vlcs(On2AVCContext *c)
audio channel layout utility functions
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
static int on2avc_reconstruct_channel(On2AVCContext *c, int channel, AVFrame *dst, int offset)
static void wtf_end_512(On2AVCContext *c, float *out, float *src, float *tmp0, float *tmp1)
int ms_info[ON2AVC_MAX_BANDS]
float short_win[ON2AVC_SUBFRAME_SIZE/8]
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
static void twiddle(float *src1, float *src2, int src2_len, const double *tab, int tab_len, int step, int order0, int order1, const double *const *tabs)
static void pretwiddle(float *src, float *dst, int dst_len, int tab_step, int step, int order0, int order1, const double *const *tabs)
const int ff_on2avc_pair_cb_elems[]
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
const On2AVCMode ff_on2avc_modes_44[8]
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
float long_win[ON2AVC_SUBFRAME_SIZE]
#define ON2AVC_SUBFRAME_SIZE
const double *const ff_on2avc_tabs_4_10_2[4]
const uint8_t *const ff_on2avc_quad_cb_bits[]
const uint8_t ff_on2avc_scale_diff_bits[ON2AVC_SCALE_DIFFS]
Libavcodec external API header.
static int on2avc_decode_quads(On2AVCContext *c, GetBitContext *gb, float *dst, int dst_size, int type, float band_scale)
AVSampleFormat
Audio sample formats.
int sample_rate
samples per second
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
main external API structure.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;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);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
const float ff_on2avc_ctab_2[2048]
void(* imdct_half)(struct FFTContext *s, FFTSample *output, const FFTSample *input)
static unsigned int get_bits1(GetBitContext *s)
AVCodec ff_on2avc_decoder
const double ff_on2avc_tab_10_2[]
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
const double *const ff_on2avc_tabs_20_84_4[20]
static av_const int sign_extend(int val, unsigned bits)
const float ff_on2avc_ctab_4[2048]
internal math functions header
common internal api header.
static av_cold int on2avc_decode_close(AVCodecContext *avctx)
channel
Use these values when setting the channel map with ebur128_set_channel().
const double *const ff_on2avc_tabs_20_84_2[20]
void(* fft_calc)(struct FFTContext *s, FFTComplex *z)
Do a complex FFT with the parameters defined in ff_fft_init().
static void zero_head_and_tail(float *src, int len, int order0, int order1)
static const struct @114 tabs[]
const double ff_on2avc_tab_84_3[]
float temp[ON2AVC_SUBFRAME_SIZE *2]
int channels
number of audio channels
VLC_TYPE(* table)[2]
code, bits
static int on2avc_decode_pairs(On2AVCContext *c, GetBitContext *gb, float *dst, int dst_size, int type, float band_scale)
const float ff_on2avc_window_long_32000[1024]
const double *const ff_on2avc_tabs_19_40_1[19]
static const struct twinvq_data tab
const double *const ff_on2avc_tabs_19_40_2[19]
const double *const ff_on2avc_tabs_20_84_3[20]
static int on2avc_decode_band_scales(On2AVCContext *c, GetBitContext *gb)
static enum AVSampleFormat sample_fmts[]
const float ff_on2avc_ctab_3[2048]
static void wtf_44(On2AVCContext *c, float *out, float *src, int size)
#define ON2AVC_SCALE_DIFFS
static void combine_fft(float *s0, float *s1, float *s2, float *s3, float *dst, const float *t0, const float *t1, const float *t2, const float *t3, int len, int step)
#define FFSWAP(type, a, b)
uint8_t ** extended_data
pointers to the data planes/channels.
#define AV_CH_LAYOUT_MONO
This structure stores compressed data.
void ff_free_vlc(VLC *vlc)
int nb_samples
number of audio samples (per channel) described by this frame
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
float band_scales[ON2AVC_MAX_BANDS]
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(constuint8_t *) pi-0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(constint16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(constint32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(constint64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(constfloat *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(constdouble *) pi *(INT64_C(1)<< 63)))#defineFMT_PAIR_FUNC(out, in) staticconv_func_type *constfmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64),};staticvoidcpy1(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, len);}staticvoidcpy2(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 2 *len);}staticvoidcpy4(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 4 *len);}staticvoidcpy8(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 8 *len);}AudioConvert *swri_audio_convert_alloc(enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, constint *ch_map, intflags){AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) returnNULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) returnNULL;if(channels==1){in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);}ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map){switch(av_get_bytes_per_sample(in_fmt)){case1:ctx->simd_f=cpy1;break;case2:ctx->simd_f=cpy2;break;case4:ctx->simd_f=cpy4;break;case8:ctx->simd_f=cpy8;break;}}if(HAVE_X86ASM &&1) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);returnctx;}voidswri_audio_convert_free(AudioConvert **ctx){av_freep(ctx);}intswri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, intlen){intch;intoff=0;constintos=(out->planar?1:out->ch_count)*out->bps;unsignedmisaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask){intplanes=in->planar?in->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;}if(ctx->out_simd_align_mask){intplanes=out->planar?out->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;}if(ctx->simd_f &&!ctx->ch_map &&!misaligned){off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){if(out->planar==in->planar){intplanes=out->planar?out->ch_count:1;for(ch=0;ch< planes;ch++){ctx->simd_f(out-> ch ch
const double ff_on2avc_tab_10_1[]