30#define BITSTREAM_READER_LE
70 s->bitstream_size = 0;
79 s->bitstream_size = 0;
116 case 24:
s->factor = 256;
132 sizeof(*
s->decode_buffer[ch]));
133 if (!
s->decode_buffer[ch])
144 memset(
cb->history, 0,
sizeof(
cb->history));
145 cb->pos =
cb->count =
cb->sum = 0;
172 double f =
floor(sum / 1.4426952 + 0.5);
175 }
else if (
f >= 31) {
210 if (
cb->prediction >= 15)
212 if (
cb->coding_mode > 0 &&
cb->coding_mode < 3) {
214 if (!
cb->residue_parameter ||
cb->residue_parameter >= 31)
216 if (
cb->coding_mode == 2)
218 }
else if (
cb->coding_mode == 3) {
220 if (!
cb->residue_bits ||
cb->residue_bits >= 31)
222 }
else if (
cb->coding_mode) {
226 if (
cb->coding_mode == 2)
237#define P2 (((unsigned)dst[A] + dst[A]) - dst[B])
238#define P3 (((unsigned)dst[A] - dst[B]) * 3 + dst[C])
244 const int nb_samples =
frame->nb_samples;
247 for (
int n = 0; n < nb_samples; n++) {
248 for (
int ch = 0; ch < nb_channels; ch++) {
253 if (nb_channels == 2 && ch == 1 &&
decorrelate !=
s->decorrelate) {
268 if (!
cb->coding_mode) {
270 }
else if (
cb->coding_mode == 3) {
284 switch (
cb->prediction) {
291 dst[n] += (unsigned)
dst[
A] + p;
306 dst[n] += (int)(
P2 +
P3) / 2 + (unsigned)p;
312 dst[n] += (int)(
P2 * 2 +
P3) / 3 + (unsigned)p;
315 dst[n] += (int)(
P2 +
P3 * 2) / 3 + (unsigned)p;
327 dst[n] += (int)((
unsigned)
P2 +
dst[
A]) / 2 + (unsigned)p;
344 if (
cb->coding_mode == 2) {
349 if (nb_channels == 2 && ch == 1) {
351 dst[n] += (unsigned)
s->decode_buffer[0][
OFFSET+n];
365 const int nb_samples =
frame->nb_samples;
367 const unsigned factor =
s->factor;
375 for (
int ch = 0; ch < nb_channels; ch++) {
389 for (
int ch = 0; ch < nb_channels; ch++) {
390 uint8_t *
dst = (uint8_t *)
frame->extended_data[ch];
393 for (
int n = 0; n < nb_samples; n++)
398 for (
int ch = 0; ch < nb_channels; ch++) {
399 int16_t *
dst = (int16_t *)
frame->extended_data[ch];
402 for (
int n = 0; n < nb_samples; n++)
407 for (
int ch = 0; ch < nb_channels; ch++) {
411 for (
int n = 0; n < nb_samples; n++)
428 while (
s->bitstream_size <
s->max_framesize) {
441 size =
FFMIN(
s->pkt->size -
s->pkt_offset,
s->max_framesize -
s->bitstream_size);
442 memcpy(
s->bitstream +
s->bitstream_size,
s->pkt->data +
s->pkt_offset,
size);
443 s->bitstream_size +=
size;
444 s->pkt_offset +=
size;
446 if (
s->pkt_offset ==
s->pkt->size) {
452 frame->nb_samples =
FFMIN(
s->frame_samples,
s->nb_samples);
453 if (
frame->nb_samples <= 0)
465 s->nb_samples -=
frame->nb_samples;
468 if (n >
s->bitstream_size) {
473 memmove(
s->bitstream, &
s->bitstream[n],
s->bitstream_size - n);
474 s->bitstream_size -= n;
479 s->bitstream_size = 0;
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static double val(void *priv, double ch)
const FFCodec ff_osq_decoder
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
Libavcodec external API header.
#define FF_CODEC_RECEIVE_FRAME_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static __device__ float floor(float a)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt)
Called by decoders to get the next packet for decoding.
int(* init)(AVBSFContext *ctx)
bitstream reader API header.
static int get_sbits_long(GetBitContext *s, int n)
Read 0-32 bits as a signed integer.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static int get_bits_left(GetBitContext *gb)
static unsigned int get_bits1(GetBitContext *s)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static const uint8_t * align_get_bits(GetBitContext *s)
static int get_bits_count(const GetBitContext *s)
static void skip_bits1(GetBitContext *s)
#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_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AVERROR_EOF
End of file.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
common internal api header.
static int osq_decode_block(AVCodecContext *avctx, AVFrame *frame)
static uint32_t get_urice(GetBitContext *gb, int k)
static av_cold int osq_close(AVCodecContext *avctx)
static int osq_channel_parameters(AVCodecContext *avctx, int ch)
static void reset_stats(OSQChannel *cb)
static void update_stats(OSQChannel *cb, int val)
static av_cold void osq_flush(AVCodecContext *avctx)
static int update_residue_parameter(OSQChannel *cb)
static int32_t get_srice(GetBitContext *gb, int x)
static av_cold int osq_init(AVCodecContext *avctx)
static int do_decode(AVCodecContext *avctx, AVFrame *frame, int decorrelate, int downsample)
static int osq_receive_frame(AVCodecContext *avctx, AVFrame *frame)
static const int factor[16]
Macro definitions for various function/variable attributes.
common internal API header
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
#define FF_ARRAY_ELEMS(a)
static void decorrelate(SnowContext *s, SubBand *b, IDWTELEM *src, int stride, int inverse, int use_median)
enum AVChannelOrder order
Channel order used in this layout.
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
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
int sample_rate
samples per second
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
struct AVCodecInternal * internal
Private context used for internal data.
AVPacket * in_pkt
This packet is used to hold the packet given to decoders implementing the .decode API; it is unused b...
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
unsigned residue_parameter
int32_t * decode_buffer[2]
#define avpriv_request_sample(...)
static int get_unary(GetBitContext *gb, int stop, int len)
Get unary code of limited length.
static double cb(void *priv, double x, double y)