Go to the documentation of this file.
24 #define BITSTREAM_READER_LE
32 static const int8_t
map_3bit[] = { -4, -3, -2, -1, +1, +2, +3, +4 };
61 for (
int x3 = 0; x3 < 3; x3++)
62 for (
int x2 = 0; x2 < 3; x2++)
63 for (
int x1 = 0; x1 < 3; x1++)
64 mul_3x3[x1 + x2 * 3 + x3 * 3 * 3] = x1 + (x2 << 4) + (x3 << 8);
65 for (
int x3 = 0; x3 < 5; x3++)
66 for (
int x2 = 0; x2 < 5; x2++)
67 for (
int x1 = 0; x1 < 5; x1++)
68 mul_3x5[x1 + x2 * 5 + x3 * 5 * 5] = x1 + (x2 << 4) + (x3 << 8);
69 for (
int x2 = 0; x2 < 11; x2++)
70 for (
int x1 = 0; x1 < 11; x1++)
71 mul_2x11[x1 + x2 * 11] = x1 + (x2 << 4);
88 if (
s->max_samples == 0)
89 s->max_samples = UINT64_MAX;
92 s->cols = 1 <<
s->level;
93 s->wrapbuf_len = 2 *
s->cols - 2;
94 s->block_len =
s->rows *
s->cols;
95 s->max_framesize =
s->block_len;
98 s->wrapbuf =
av_calloc(
s->wrapbuf_len,
sizeof(
int));
101 if (!
s->block || !
s->wrapbuf || !
s->ampbuf || !
s->bitstream)
104 s->midbuf =
s->ampbuf + 0x8000;
112 #define set_pos(s, r, c, idx) do { \
113 unsigned pos = ((r) << s->level) + (c); \
114 s->block[pos] = s->midbuf[(idx)]; \
121 for (
i = 0;
i <
s->rows;
i++)
135 int b, middle = 1 << (ind - 1);
137 for (
i = 0;
i <
s->rows;
i++) {
149 for (
i = 0;
i <
s->rows;
i++) {
174 for (
i = 0;
i <
s->rows;
i++) {
192 for (
i = 0;
i <
s->rows;
i++) {
196 if (
i >=
s->rows)
break;
218 for (
i = 0;
i <
s->rows;
i++) {
236 for (
i = 0;
i <
s->rows;
i++) {
270 for (
i = 0;
i <
s->rows;
i++) {
295 for (
i = 0;
i <
s->rows;
i++) {
322 for (
i = 0;
i <
s->rows;
i++) {
341 for (
i = 0;
i <
s->rows;
i++) {
350 n2 = ((
mul_3x3[
b] >> 4) & 0x0F) - 1;
351 n3 = ((
mul_3x3[
b] >> 8) & 0x0F) - 1;
370 for (
i = 0;
i <
s->rows;
i++) {
379 n2 = ((
mul_3x5[
b] >> 4) & 0x0F) - 2;
380 n3 = ((
mul_3x5[
b] >> 8) & 0x0F) - 2;
398 for (
i = 0;
i <
s->rows;
i++) {
436 for (
i = 0;
i <
s->cols;
i++) {
445 static void juggle(
int *wrap_p,
int *block_p,
unsigned sub_len,
unsigned sub_count)
449 unsigned int r0, r1, r2, r3;
451 for (
i = 0;
i < sub_len;
i++) {
455 for (j = 0; j < sub_count/2; j++) {
457 *p = r1 * 2 + (r0 + r2);
460 *p = r2 * 2 - (r1 + r3);
474 unsigned sub_count, sub_len, todo_count, step_subcount,
i;
475 int *wrap_p, *block_p, *p;
485 step_subcount = (2048 >>
s->level) - 2;
491 todo_count =
s->rows;
495 sub_count = step_subcount;
496 if (sub_count > todo_count)
497 sub_count = todo_count;
499 sub_len =
s->cols / 2;
502 juggle(wrap_p, block_p, sub_len, sub_count);
503 wrap_p += sub_len * 2;
505 for (
i = 0, p = block_p;
i < sub_count;
i++) {
510 while (sub_len > 1) {
513 juggle(wrap_p, block_p, sub_len, sub_count);
514 wrap_p += sub_len * 2;
517 if (todo_count <= step_subcount)
520 todo_count -= step_subcount;
521 block_p += step_subcount <<
s->level;
528 int pwr, count,
val,
i, x,
ret;
535 for (
i = 0, x = 0;
i < count;
i++) {
540 for (
i = 1, x = -
val;
i <= count;
i++) {
562 int ret, n, buf_size, input_buf_size;
564 if (!
pkt->
size && !
s->bitstream_size) {
569 buf_size =
FFMIN(
pkt->
size,
s->max_framesize -
s->bitstream_size);
570 input_buf_size = buf_size;
571 if (
s->bitstream_index +
s->bitstream_size + buf_size >
s->max_framesize) {
572 memmove(
s->bitstream, &
s->bitstream[
s->bitstream_index],
s->bitstream_size);
573 s->bitstream_index = 0;
576 memcpy(&
s->bitstream[
s->bitstream_index +
s->bitstream_size],
pkt->
data, buf_size);
577 buf = &
s->bitstream[
s->bitstream_index];
578 buf_size +=
s->bitstream_size;
579 s->bitstream_size = buf_size;
580 if (buf_size < s->max_framesize &&
pkt->
data) {
582 return input_buf_size;
589 s->max_samples -=
FFMIN(
frame->nb_samples,
s->max_samples);
600 int val =
s->block[n] >>
s->level;
608 if (n > buf_size &&
pkt->
data) {
609 s->bitstream_size = 0;
610 s->bitstream_index = 0;
614 if (
s->bitstream_size > 0) {
615 s->bitstream_index += n;
616 s->bitstream_size -=
FFMIN(
s->bitstream_size, n);
617 return input_buf_size;
630 s->bitstream_size = 0;
636 .
name =
"interplayacm",
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
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
static av_cold void decode_init_static(void)
static int k45(InterplayACMContext *s, unsigned ind, unsigned col)
@ AV_CODEC_ID_INTERPLAY_ACM
static int get_bits_count(const GetBitContext *s)
This structure describes decoded (raw) audio or video data.
static int decode_block(InterplayACMContext *s)
static const int8_t map_2bit_near[]
static int linear(InterplayACMContext *s, unsigned ind, unsigned col)
const AVCodec ff_interplay_acm_decoder
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static const int8_t map_2bit_far[]
static double val(void *priv, double ch)
static int mul_3x5[5 *5 *5]
#define set_pos(s, r, c, idx)
static int ff_thread_once(char *control, void(*routine)(void))
#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 int k44(InterplayACMContext *s, unsigned ind, unsigned col)
static int t15(InterplayACMContext *s, unsigned ind, unsigned col)
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *pkt)
static int k35(InterplayACMContext *s, unsigned ind, unsigned col)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
static int k34(InterplayACMContext *s, unsigned ind, unsigned col)
static av_cold int decode_init(AVCodecContext *avctx)
static int mul_2x11[11 *11]
static int k12(InterplayACMContext *s, unsigned ind, unsigned col)
static av_cold int decode_close(AVCodecContext *avctx)
static unsigned int get_bits1(GetBitContext *s)
static void juggle_block(InterplayACMContext *s)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#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.
static void juggle(int *wrap_p, int *block_p, unsigned sub_len, unsigned sub_count)
enum AVSampleFormat sample_fmt
audio sample format
static const filler filler_list[]
static int t27(InterplayACMContext *s, unsigned ind, unsigned col)
static int zero(InterplayACMContext *s, unsigned ind, unsigned col)
int channels
number of audio channels
#define i(width, name, range_min, range_max)
static int k23(InterplayACMContext *s, unsigned ind, unsigned col)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static const int8_t map_1bit[]
@ AV_SAMPLE_FMT_S16
signed 16 bits
const char * name
Name of the codec implementation.
void * av_calloc(size_t nmemb, size_t size)
static int fill_block(InterplayACMContext *s)
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
#define AV_INPUT_BUFFER_PADDING_SIZE
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
static int t37(InterplayACMContext *s, unsigned ind, unsigned col)
main external API structure.
static int k13(InterplayACMContext *s, unsigned ind, unsigned col)
int(* filler)(InterplayACMContext *s, unsigned ind, unsigned col)
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
static int mul_3x3[3 *3 *3]
Filter the word “frame” indicates either a video frame or a group of audio samples
static int bad(InterplayACMContext *s, unsigned ind, unsigned col)
This structure stores compressed data.
static const int8_t map_3bit[]
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int k24(InterplayACMContext *s, unsigned ind, unsigned col)