35 #define BITSTREAM_READER_LE 44 #define MAX_CHANNELS 2 45 #define BINK_BLOCK_MAX_SIZE (MAX_CHANNELS << 11) 97 if (sample_rate > INT_MAX / avctx->
channels)
111 sample_rate_half = (sample_rate + 1LL) / 2;
116 for (i = 0; i < 96; i++) {
136 else if (CONFIG_BINKAUDIO_DCT_DECODER)
158 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 32, 64
176 for (ch = 0; ch < s->
channels; ch++) {
220 memset(coeffs + i, 0, (j - i) *
sizeof(*coeffs));
222 while (s->
bands[k] < i)
226 if (s->
bands[k] == i)
244 if (CONFIG_BINKAUDIO_DCT_DECODER && use_dct) {
248 else if (CONFIG_BINKAUDIO_RDFT_DECODER)
252 for (ch = 0; ch < s->
channels; ch++) {
258 out[ch][i] = (s->
previous[ch][i] * (count - j) +
259 out[ch][i] * j) /
count;
275 else if (CONFIG_BINKAUDIO_DCT_DECODER)
326 memset(gb, 0,
sizeof(*gb));
339 .
name =
"binkaudio_rdft",
351 .
name =
"binkaudio_dct",
av_cold void ff_rdft_end(RDFTContext *s)
const struct AVCodec * codec
static float get_float(GetBitContext *gb)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static av_cold int decode_end(AVCodecContext *avctx)
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
static av_cold int init(AVCodecContext *avctx)
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
static const uint8_t rle_length_tab[16]
const uint16_t ff_wma_critical_freqs[25]
static CopyRet receive_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame)
#define AV_CH_LAYOUT_STEREO
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
enum AVSampleFormat sample_fmt
audio sample format
int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt)
Called by decoders to get the next packet for decoding.
GLsizei GLboolean const GLfloat * value
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
union BinkAudioContext::@24 trans
static int get_bits_count(const GetBitContext *s)
static int binkaudio_receive_frame(AVCodecContext *avctx, AVFrame *frame)
bitstream reader API header.
float previous[MAX_CHANNELS][BINK_BLOCK_MAX_SIZE/16]
coeffs from previous audio block
static int get_bits_left(GetBitContext *gb)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define BINK_BLOCK_MAX_SIZE
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static void get_bits_align32(GetBitContext *s)
static int decode_block(BinkAudioContext *s, float **out, int use_dct)
Decode Bink Audio block.
const char * name
Name of the codec implementation.
uint64_t channel_layout
Audio channel layout.
audio channel layout utility functions
void(* dct_calc)(struct DCTContext *s, FFTSample *data)
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 av_cold int decode_init(AVCodecContext *avctx)
void(* rdft_calc)(struct RDFTContext *s, FFTSample *z)
AVCodec ff_binkaudio_rdft_decoder
int overlap_len
overlap size (samples)
Libavcodec external API header.
int sample_rate
samples per second
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
AVCodec ff_binkaudio_dct_decoder
main external API structure.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse)
Set up DCT.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
int frame_len
transform size (samples)
int version_b
Bink version 'b'.
common internal api header.
int channels
number of audio channels
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
static const double coeff[2][5]
av_cold void ff_dct_end(DCTContext *s)
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
uint8_t ** extended_data
pointers to the data planes/channels.
#define AV_CH_LAYOUT_MONO
av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans)
Set up a real FFT.
This structure stores compressed data.
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.