48 for (
int i = 0;
i < 8;
i++)
49 s->table[0][
i] = (
i - 159.5f) / 160.f;
50 for (
int i = 0;
i < 11;
i++)
51 s->table[0][
i + 8] = (
i - 37.5f) / 40.f;
52 for (
int i = 0;
i < 27;
i++)
53 s->table[0][
i + 8 + 11] = (
i - 13.f) / 20.f;
54 for (
int i = 0;
i < 11;
i++)
55 s->table[0][
i + 8 + 11 + 27] = (
i + 27.5f) / 40.f;
56 for (
int i = 0;
i < 7;
i++)
57 s->table[0][
i + 8 + 11 + 27 + 11] = (
i + 152.5f) / 160.f;
59 memcpy(
s->table[1],
s->table[0],
sizeof(
s->table[0]));
61 for (
int i = 0;
i < 7;
i++)
62 s->table[2][
i] = (
i - 33.5f) / 40.f;
63 for (
int i = 0;
i < 25;
i++)
64 s->table[2][
i + 7] = (
i - 13.f) / 20.f;
66 for (
int i = 0;
i < 32;
i++)
67 s->table[3][
i] = -
s->table[2][31 -
i];
69 for (
int i = 0;
i < 16;
i++)
70 s->table[4][
i] =
i * 0.22f / 3.f - 0.6f;
72 for (
int i = 0;
i < 16;
i++)
73 s->table[5][
i] =
i * 0.20f / 3.f - 0.3f;
75 for (
int i = 0;
i < 8;
i++)
76 s->table[6][
i] =
i * 0.36f / 3.f - 0.4f;
78 for (
int i = 0;
i < 8;
i++)
79 s->table[7][
i] =
i * 0.34f / 3.f - 0.2f;
97 return r & ((1 <<
bits) - 1);
100static const uint8_t
bits[8] = { 6, 6, 5, 5, 4, 0, 3, 3, };
104 result[
i * 64 + pads[
i] + j * 3] =
value * (2 * v - 7);
116 if (subframes <= 0 || subframes > INT_MAX / 256)
118 frame->nb_samples = subframes * 256;
124 for (
int subframe = 0; subframe < subframes; subframe++) {
127 float result[256] = { 0 };
129 int inds[4], pads[4];
133 for (
int i = 0;
i < 10;
i++)
134 src[
i] = bytestream2_get_le32(&gb);
136 for (
int i = 0;
i < 8;
i++)
139 for (
int i = 0;
i < 4;
i++)
142 for (
int i = 0;
i < 4;
i++)
145 for (
int i = 0, index5 = 0;
i < 4;
i++) {
148 for (
int j = 0,
tmp = 0; j < 21; j++) {
153 index5 =
FFMIN(2 * index5 +
tmp % 2, 63);
156 m[2] =
s->table[5][index5];
159 for (
int i = 0;
i < 256;
i++) {
162 for (
int j = 0; j < 8; j++) {
163 x -= m[j] * ch->
f[j];
164 ch->
f[j] += m[j] * x;
167 memmove(&ch->
f[0], &ch->
f[1],
sizeof(
float) * 7);
170 result[
i] = ch->
last * 2.f;
173 memcpy(
frame->extended_data[
channel] + 1024 * subframe, result, 256 *
sizeof(
float));
192 .p.name =
"fastaudio",
const FFCodec ff_fastaudio_decoder
Libavcodec external API header.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define i(width, name, range_min, range_max)
#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)
channel
Use these values when setting the channel map with ebur128_set_channel().
static av_cold int fastaudio_init(AVCodecContext *avctx)
static void set_sample(int i, int j, int v, float *result, int *pads, float value)
static int fastaudio_decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *pkt)
static const uint8_t bits[8]
static int read_bits(int bits, int *ppos, unsigned *src)
static av_cold int fastaudio_close(AVCodecContext *avctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
@ AV_SAMPLE_FMT_FLTP
float, planar
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
int nb_channels
Number of channels in this layout.
main external API structure.
AVChannelLayout ch_layout
Audio channel layout.
enum AVSampleFormat sample_fmt
audio sample format
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.