Go to the documentation of this file.
36 #define ON2AVC_SUBFRAME_SIZE 1024
92 int w,
b, band_off = 0;
97 for (
w = 0;
w <
c->num_windows;
w++) {
98 if (!
c->grouping[
w]) {
99 memcpy(
c->ms_info + band_off,
100 c->ms_info + band_off -
c->num_bands,
101 c->num_bands *
sizeof(*
c->ms_info));
102 band_off +=
c->num_bands;
105 for (
b = 0;
b <
c->num_bands;
b++)
113 int bits_per_sect =
c->is_long ? 5 : 3;
114 int esc_val = (1 << bits_per_sect) - 1;
128 }
while (
run == esc_val);
143 int w, w2,
b, scale,
first = 1;
146 for (
w = 0;
w <
c->num_windows;
w++) {
147 if (!
c->grouping[
w]) {
148 memcpy(
c->band_scales + band_off,
149 c->band_scales + band_off -
c->num_bands,
150 c->num_bands *
sizeof(*
c->band_scales));
151 band_off +=
c->num_bands;
154 for (
b = 0;
b <
c->num_bands;
b++) {
155 if (!
c->band_type[band_off]) {
157 for (w2 =
w + 1; w2 <
c->num_windows; w2++) {
160 if (
c->band_type[w2 *
c->num_bands +
b]) {
166 c->band_scales[band_off++] = 0;
174 scale +=
get_vlc2(gb,
c->scale_diff.table, 9, 3);
176 if (scale < 0 || scale > 127) {
181 c->band_scales[band_off++] =
c->scale_tab[scale];
190 return v * sqrtf(
abs(v)) * scale;
195 int dst_size,
int type,
float band_scale)
199 for (
i = 0;
i < dst_size;
i += 4) {
202 for (j = 0; j < 4; j++) {
228 int dst_size,
int type,
float band_scale)
230 int i,
val, val1, val2, sign;
232 for (
i = 0;
i < dst_size;
i += 2) {
238 if (val1 <= -16 || val1 >= 16) {
239 sign = 1 - (val1 < 0) * 2;
242 if (val2 <= -16 || val2 >= 16) {
243 sign = 1 - (val2 < 0) * 2;
266 coeff_ptr =
c->coeffs[ch];
269 for (
w = 0;
w <
c->num_windows;
w++) {
270 for (
b = 0;
b <
c->num_bands;
b++) {
271 int band_size =
c->band_start[
b + 1] -
c->band_start[
b];
275 coeff_ptr += band_size;
280 c->band_scales[band_idx +
b]);
283 c->band_scales[band_idx +
b]);
284 coeff_ptr += band_size;
286 band_idx +=
c->num_bands;
296 float *ch0 =
c->coeffs[0];
297 float *ch1 =
c->coeffs[1];
299 for (
w = 0;
w <
c->num_windows;
w++) {
300 for (
b = 0;
b <
c->num_bands;
b++) {
301 if (
c->ms_info[band_off +
b]) {
303 float l = *ch0,
r = *ch1;
308 ch0 +=
c->band_start[
b + 1] -
c->band_start[
b];
309 ch1 +=
c->band_start[
b + 1] -
c->band_start[
b];
312 band_off +=
c->num_bands;
319 memset(
src, 0,
sizeof(*
src) * order0);
320 memset(
src +
len - order1, 0,
sizeof(*
src) * order1);
324 int step,
int order0,
int order1,
const double *
const *
tabs)
332 for (
i = 0;
i < tab_step;
i++) {
334 for (j = 0; j < order0; j++)
335 sum +=
src[j] *
tab[j * tab_step +
i];
339 out = dst + dst_len - tab_step;
341 src2 =
src + (dst_len - tab_step) /
step + 1 + order0;
342 for (
i = 0;
i < tab_step;
i++) {
344 for (j = 0; j < order1; j++)
345 sum += src2[j] *
tab[j * tab_step +
i];
351 const double *
tab,
int tab_len,
int step,
352 int order0,
int order1,
const double *
const *
tabs)
358 steps = (src2_len - tab_len) /
step + 1;
362 for (
i = 0;
i < steps;
i++) {
363 float in0 =
src1[order0 +
i];
364 int pos = (src2_len - 1) &
mask;
367 const double *t =
tab;
368 for (j =
pos; j >= 0; j--)
369 src2[j] += in0 * *t++;
370 for (j = 0; j < tab_len -
pos - 1; j++)
371 src2[src2_len - j - 1] += in0 *
tab[
pos + 1 + j];
373 for (j = 0; j < tab_len; j++)
374 src2[
pos - j] += in0 *
tab[j];
380 #define CMUL1_R(s, t, is, it) \
381 s[is + 0] * t[it + 0] - s[is + 1] * t[it + 1]
382 #define CMUL1_I(s, t, is, it) \
383 s[is + 0] * t[it + 1] + s[is + 1] * t[it + 0]
384 #define CMUL2_R(s, t, is, it) \
385 s[is + 0] * t[it + 0] + s[is + 1] * t[it + 1]
386 #define CMUL2_I(s, t, is, it) \
387 s[is + 0] * t[it + 1] - s[is + 1] * t[it + 0]
389 #define CMUL0(dst, id, s0, s1, s2, s3, t0, t1, t2, t3, is, it) \
390 dst[id] = s0[is] * t0[it] + s1[is] * t1[it] \
391 + s2[is] * t2[it] + s3[is] * t3[it]; \
392 dst[id + 1] = s0[is] * t0[it + 1] + s1[is] * t1[it + 1] \
393 + s2[is] * t2[it + 1] + s3[is] * t3[it + 1];
395 #define CMUL1(dst, s0, s1, s2, s3, t0, t1, t2, t3, is, it) \
396 *dst++ = CMUL1_R(s0, t0, is, it) \
397 + CMUL1_R(s1, t1, is, it) \
398 + CMUL1_R(s2, t2, is, it) \
399 + CMUL1_R(s3, t3, is, it); \
400 *dst++ = CMUL1_I(s0, t0, is, it) \
401 + CMUL1_I(s1, t1, is, it) \
402 + CMUL1_I(s2, t2, is, it) \
403 + CMUL1_I(s3, t3, is, it);
405 #define CMUL2(dst, s0, s1, s2, s3, t0, t1, t2, t3, is, it) \
406 *dst++ = CMUL2_R(s0, t0, is, it) \
407 + CMUL2_R(s1, t1, is, it) \
408 + CMUL2_R(s2, t2, is, it) \
409 + CMUL2_R(s3, t3, is, it); \
410 *dst++ = CMUL2_I(s0, t0, is, it) \
411 + CMUL2_I(s1, t1, is, it) \
412 + CMUL2_I(s2, t2, is, it) \
413 + CMUL2_I(s3, t3, is, it);
416 const float *
t0,
const float *
t1,
417 const float *
t2,
const float *
t3,
int len,
int step)
419 const float *h0, *h1, *h2, *h3;
422 int len2 =
len >> 1, len4 =
len >> 2;
427 for (
half = len2;
tmp > 1; half <<= 1, tmp >>= 1);
434 CMUL0(dst, 0,
s0,
s1,
s2,
s3,
t0,
t1,
t2,
t3, 0, 0);
436 hoff = 2 *
step * (len4 >> 1);
441 d2 = dst + 2 + (
len >> 1);
442 for (
i = 0;
i < (len4 - 1) >> 1;
i++) {
443 CMUL1(d1,
s0,
s1,
s2,
s3,
t0,
t1,
t2,
t3, j, k);
444 CMUL1(d2,
s0,
s1,
s2,
s3, h0, h1, h2, h3, j, k);
448 CMUL0(dst, len4,
s0,
s1,
s2,
s3,
t0,
t1,
t2,
t3, 1, hoff);
449 CMUL0(dst, len4 + len2,
s0,
s1,
s2,
s3, h0, h1, h2, h3, 1, hoff);
452 k = hoff + 2 *
step * len4;
454 d2 = dst + len4 + 2 + len2;
455 for (
i = 0;
i < (len4 - 2) >> 1;
i++) {
456 CMUL2(d1,
s0,
s1,
s2,
s3,
t0,
t1,
t2,
t3, j, k);
457 CMUL2(d2,
s0,
s1,
s2,
s3, h0, h1, h2, h3, j, k);
461 CMUL0(dst, len2 + 4,
s0,
s1,
s2,
s3,
t0,
t1,
t2,
t3, 0, k);
465 float *tmp0,
float *tmp1)
467 memcpy(
src, tmp0, 384 *
sizeof(*tmp0));
468 memcpy(tmp0 + 384,
src + 384, 128 *
sizeof(*tmp0));
494 memcpy(
src, tmp1, 512 *
sizeof(
float));
498 float *tmp0,
float *tmp1)
500 memcpy(
src, tmp0, 768 *
sizeof(*tmp0));
501 memcpy(tmp0 + 768,
src + 768, 256 *
sizeof(*tmp0));
527 memcpy(
src, tmp1, 1024 *
sizeof(
float));
532 float *tmp0 =
c->temp, *tmp1 =
c->temp + 1024;
534 memset(tmp0, 0,
sizeof(*tmp0) * 1024);
535 memset(tmp1, 0,
sizeof(*tmp1) * 1024);
559 memset(tmp0, 0, 64 *
sizeof(*tmp0));
597 memset(tmp0, 0, 128 *
sizeof(*tmp0));
618 float *tmp0 =
c->temp, *tmp1 =
c->temp + 1024;
620 memset(tmp0, 0,
sizeof(*tmp0) * 1024);
621 memset(tmp1, 0,
sizeof(*tmp1) * 1024);
641 memset(tmp0, 0, 64 *
sizeof(*tmp0));
673 memset(tmp0, 0, 128 *
sizeof(*tmp0));
694 for (ch = 0; ch <
c->avctx->channels; ch++) {
696 float *
in =
c->coeffs[ch];
697 float *saved =
c->delay[ch];
698 float *buf =
c->mdct_buf;
699 float *wout =
out + 448;
701 switch (
c->window_type) {
703 c->mdct.imdct_half(&
c->mdct, buf,
in);
706 c->wtf(
c, buf,
in, 1024);
709 c->wtf(
c, buf,
in, 512);
710 c->mdct.imdct_half(&
c->mdct_half, buf + 512,
in + 512);
711 for (
i = 0;
i < 256;
i++) {
712 FFSWAP(
float, buf[
i + 512], buf[1023 -
i]);
716 c->mdct.imdct_half(&
c->mdct_half, buf,
in);
717 for (
i = 0;
i < 256;
i++) {
718 FFSWAP(
float, buf[
i], buf[511 -
i]);
720 c->wtf(
c, buf + 512,
in + 512, 512);
724 memcpy(
out, saved, 448 *
sizeof(
float));
725 c->fdsp->vector_fmul_window(wout, saved + 448, buf,
c->short_win, 64);
726 memcpy(wout + 128, buf + 64, 448 *
sizeof(
float));
727 memcpy(saved, buf + 512, 448 *
sizeof(
float));
728 memcpy(saved + 448, buf + 7*128 + 64, 64 *
sizeof(
float));
742 float *buf =
c->mdct_buf;
743 float *
temp =
c->temp;
745 switch (
c->window_type) {
749 c->mdct.imdct_half(&
c->mdct, buf,
in);
753 c->mdct_small.imdct_half(&
c->mdct_small, buf +
i,
in +
i);
761 c->fdsp->vector_fmul_window(
out, saved, buf,
c->long_win, 512);
763 float *wout =
out + 448;
764 memcpy(
out, saved, 448 *
sizeof(
float));
767 c->fdsp->vector_fmul_window(wout + 0*128, saved + 448, buf + 0*128,
c->short_win, 64);
768 c->fdsp->vector_fmul_window(wout + 1*128, buf + 0*128 + 64, buf + 1*128,
c->short_win, 64);
769 c->fdsp->vector_fmul_window(wout + 2*128, buf + 1*128 + 64, buf + 2*128,
c->short_win, 64);
770 c->fdsp->vector_fmul_window(wout + 3*128, buf + 2*128 + 64, buf + 3*128,
c->short_win, 64);
771 c->fdsp->vector_fmul_window(
temp, buf + 3*128 + 64, buf + 4*128,
c->short_win, 64);
772 memcpy(wout + 4*128,
temp, 64 *
sizeof(
float));
774 c->fdsp->vector_fmul_window(wout, saved + 448, buf,
c->short_win, 64);
775 memcpy(wout + 128, buf + 64, 448 *
sizeof(
float));
780 switch (
c->window_type) {
782 memcpy(saved,
temp + 64, 64 *
sizeof(
float));
783 c->fdsp->vector_fmul_window(saved + 64, buf + 4*128 + 64, buf + 5*128,
c->short_win, 64);
784 c->fdsp->vector_fmul_window(saved + 192, buf + 5*128 + 64, buf + 6*128,
c->short_win, 64);
785 c->fdsp->vector_fmul_window(saved + 320, buf + 6*128 + 64, buf + 7*128,
c->short_win, 64);
786 memcpy(saved + 448, buf + 7*128 + 64, 64 *
sizeof(
float));
789 memcpy(saved, buf + 512, 448 *
sizeof(
float));
790 memcpy(saved + 448, buf + 7*128 + 64, 64 *
sizeof(
float));
794 memcpy(saved, buf + 512, 512 *
sizeof(
float));
813 c->prev_window_type =
c->window_type;
816 c->band_start =
c->modes[
c->window_type].band_start;
817 c->num_windows =
c->modes[
c->window_type].num_windows;
818 c->num_bands =
c->modes[
c->window_type].num_bands;
822 for (
i = 1;
i <
c->num_windows;
i++)
826 for (
i = 0;
i <
c->avctx->channels;
i++)
829 if (
c->avctx->channels == 2 &&
c->ms_present)
832 for (
i = 0;
i <
c->avctx->channels;
i++)
842 int *got_frame_ptr,
AVPacket *avpkt)
846 int buf_size = avpkt->
size;
887 frame, audio_off)) < 0)
904 for (
i = 1;
i < 16;
i++)
929 "Stereo mode support is not good, patch is welcome\n");
934 for (
i = 0;
i < 20;
i++)
941 1024 *
sizeof(*
c->long_win));
944 1024 *
sizeof(*
c->long_win));
968 for (
i = 1;
i < 16;
i++) {
972 syms, 2, 2, 0, 0,
avctx);
static int on2avc_decode_quads(On2AVCContext *c, GetBitContext *gb, float *dst, int dst_size, int type, float band_scale)
static int get_egolomb(GetBitContext *gb)
@ AV_SAMPLE_FMT_FLTP
float, planar
static av_cold int on2avc_decode_init(AVCodecContext *avctx)
#define AV_LOG_WARNING
Something somehow does not look correct.
static int on2avc_apply_ms(On2AVCContext *c)
static av_always_inline double ff_exp10(double x)
Compute 10^x for floating point values.
static float on2avc_scale(int v, float scale)
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.
const uint8_t ff_on2avc_cb_lens[]
int sample_rate
samples per second
#define FFSWAP(type, a, b)
static enum AVSampleFormat sample_fmts[]
static const struct @94 tabs[]
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)
const double *const ff_on2avc_tabs_19_40_2[19]
#define AV_CH_LAYOUT_MONO
float delay[2][ON2AVC_SUBFRAME_SIZE]
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static void wtf_44(On2AVCContext *c, float *out, float *src, int size)
#define ON2AVC_SCALE_DIFFS
This structure describes decoded (raw) audio or video data.
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
int ms_info[ON2AVC_MAX_BANDS]
float short_win[ON2AVC_SUBFRAME_SIZE/8]
static int on2avc_reconstruct_channel(On2AVCContext *c, int channel, AVFrame *dst, int offset)
static uint8_t half(int a, int b)
static int on2avc_decode_pairs(On2AVCContext *c, GetBitContext *gb, float *dst, int dst_size, int type, float band_scale)
uint8_t band_run_end[ON2AVC_MAX_BANDS]
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
const double ff_on2avc_tab_84_1[]
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)
const float ff_on2avc_window_long_32000[1024]
const double *const ff_on2avc_tabs_9_20_2[9]
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
void(* wtf)(struct On2AVCContext *ctx, float *out, float *in, int size)
static void wtf_end_512(On2AVCContext *c, float *out, float *src, float *tmp0, float *tmp1)
static const struct twinvq_data tab
const double *const ff_on2avc_tabs_20_84_2[20]
int flags
AV_CODEC_FLAG_*.
static double val(void *priv, double ch)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
static int on2avc_reconstruct_channel_ext(On2AVCContext *c, AVFrame *dst, int offset)
static void pretwiddle(float *src, float *dst, int dst_len, int tab_step, int step, int order0, int order1, const double *const *tabs)
const On2AVCMode ff_on2avc_modes_44[8]
#define AV_CH_LAYOUT_STEREO
int ff_init_vlc_from_lengths(VLC *vlc_arg, int nb_bits, int nb_codes, const int8_t *lens, int lens_wrap, const void *symbols, int symbols_wrap, int symbols_size, int offset, int flags, void *logctx)
Build VLC decoding tables suitable for use with get_vlc2()
const int ff_on2avc_cb_elems[]
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But first
static __device__ float ceil(float a)
#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 const uint16_t mask[17]
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
#define ON2AVC_SUBFRAME_SIZE
float band_scales[ON2AVC_MAX_BANDS]
const double ff_on2avc_tab_10_1[]
void ff_free_vlc(VLC *vlc)
const double ff_on2avc_tab_84_3[]
const double *const ff_on2avc_tabs_20_84_3[20]
const uint8_t ff_on2avc_scale_diff_bits[ON2AVC_SCALE_DIFFS]
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
float coeffs[2][ON2AVC_SUBFRAME_SIZE]
const double *const ff_on2avc_tabs_20_84_4[20]
const double *const ff_on2avc_tabs_19_40_1[19]
float mdct_buf[ON2AVC_SUBFRAME_SIZE]
static unsigned int get_bits1(GetBitContext *s)
const double *const ff_on2avc_tabs_20_84_1[20]
const uint16_t ff_on2avc_cb_syms[]
const float ff_on2avc_ctab_4[2048]
const double ff_on2avc_tab_84_4[]
AVCodec ff_on2avc_decoder
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
const uint8_t ff_on2avc_scale_diff_syms[ON2AVC_SCALE_DIFFS]
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static av_cold int on2avc_decode_close(AVCodecContext *avctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_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.
#define CMUL2(dst, s0, s1, s2, s3, t0, t1, t2, t3, is, it)
#define CMUL1(dst, s0, s1, s2, s3, t0, t1, t2, t3, is, it)
static void wtf_40(On2AVCContext *c, float *out, float *src, int size)
#define CMUL0(dst, id, s0, s1, s2, s3, t0, t1, t2, t3, is, it)
enum AVSampleFormat sample_fmt
audio sample format
const float ff_on2avc_ctab_3[2048]
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
const double ff_on2avc_tab_40_2[]
int channels
number of audio channels
const double ff_on2avc_tab_20_2[]
#define DECLARE_ALIGNED(n, t, v)
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=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;} 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_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);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_log(ac->avr, AV_LOG_TRACE, "%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-> in
static int on2avc_read_channel_data(On2AVCContext *c, GetBitContext *gb, int ch)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static void zero_head_and_tail(float *src, int len, int order0, int order1)
uint8_t ** extended_data
pointers to the data planes/channels.
float long_win[ON2AVC_SUBFRAME_SIZE]
AVSampleFormat
Audio sample formats.
const char * name
Name of the codec implementation.
static void on2avc_read_ms_info(On2AVCContext *c, GetBitContext *gb)
static av_cold void on2avc_free_vlcs(On2AVCContext *c)
static int on2avc_decode_band_scales(On2AVCContext *c, GetBitContext *gb)
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
static int on2avc_decode_band_types(On2AVCContext *c, GetBitContext *gb)
const On2AVCMode ff_on2avc_modes_40[8]
const double *const ff_on2avc_tabs_9_20_1[9]
static const uint8_t run_len[7][16]
main external API structure.
static int on2avc_decode_subframe(On2AVCContext *c, const uint8_t *buf, int buf_size, AVFrame *dst, int offset)
const double ff_on2avc_tab_20_1[]
const double *const ff_on2avc_tabs_4_10_2[4]
static av_const int sign_extend(int val, unsigned bits)
const float ff_on2avc_window_long_24000[1024]
const double *const ff_on2avc_tabs_4_10_1[4]
static int on2avc_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
const float ff_on2avc_ctab_1[2048]
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
#define avpriv_request_sample(...)
const double ff_on2avc_tab_10_2[]
const float ff_on2avc_ctab_2[2048]
const double ff_on2avc_tab_40_1[]
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
This structure stores compressed data.
static void wtf_end_1024(On2AVCContext *c, float *out, float *src, float *tmp0, float *tmp1)
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context.
const double ff_on2avc_tab_84_2[]
const float ff_on2avc_window_short[128]
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
uint8_t band_type[ON2AVC_MAX_BANDS]
float temp[ON2AVC_SUBFRAME_SIZE *2]