23 #define BITSTREAM_READER_LE
30 static const int8_t
map_3bit[] = { -4, -3, -2, -1, +1, +2, +3, +4 };
81 for (x3 = 0; x3 < 3; x3++)
82 for (x2 = 0; x2 < 3; x2++)
83 for (x1 = 0; x1 < 3; x1++)
84 mul_3x3[x1 + x2 * 3 + x3* 3 * 3] = x1 + (x2 << 4) + (x3 << 8);
85 for (x3 = 0; x3 < 5; x3++)
86 for (x2 = 0; x2 < 5; x2++)
87 for (x1 = 0; x1 < 5; x1++)
88 mul_3x5[x1 + x2 * 5 + x3 * 5 * 5] = x1 + (x2 << 4) + (x3 << 8);
89 for (x2 = 0; x2 < 11; x2++)
90 for (x1 = 0; x1 < 11; x1++)
91 mul_2x11[x1 + x2 * 11] = x1 + (x2 << 4);
96 #define set_pos(s, r, c, idx) do { \
97 unsigned pos = ((r) << s->level) + (c); \
98 s->block[pos] = s->midbuf[(idx)]; \
105 for (i = 0; i < s->
rows; i++)
119 int b, middle = 1 << (ind - 1);
121 for (i = 0; i < s->
rows; i++) {
123 set_pos(s, i, col, b - middle);
133 for (i = 0; i < s->
rows; i++) {
158 for (i = 0; i < s->
rows; i++) {
176 for (i = 0; i < s->
rows; i++) {
180 if (i >= s->
rows)
break;
202 for (i = 0; i < s->
rows; i++) {
220 for (i = 0; i < s->
rows; i++) {
254 for (i = 0; i < s->
rows; i++) {
279 for (i = 0; i < s->
rows; i++) {
306 for (i = 0; i < s->
rows; i++) {
325 for (i = 0; i < s->
rows; i++) {
330 n2 = ((
mul_3x3[
b] >> 4) & 0x0F) - 1;
331 n3 = ((
mul_3x3[
b] >> 8) & 0x0F) - 1;
350 for (i = 0; i < s->
rows; i++) {
355 n2 = ((
mul_3x5[
b] >> 4) & 0x0F) - 2;
356 n3 = ((
mul_3x5[
b] >> 8) & 0x0F) - 2;
374 for (i = 0; i < s->
rows; i++) {
408 for (i = 0; i < s->
cols; i++) {
417 static void juggle(
int *wrap_p,
int *block_p,
unsigned sub_len,
unsigned sub_count)
420 int *p, r0, r1, r2, r3;
422 for (i = 0; i < sub_len; i++) {
426 for (j = 0; j < sub_count/2; j++) {
428 *p = r1 * 2 + (r0 + r2);
431 *p = r2 * 2 - (r1 + r3);
445 unsigned sub_count, sub_len, todo_count, step_subcount, i;
446 int *wrap_p, *block_p, *p;
456 step_subcount = (2048 >> s->
level) - 2;
462 todo_count = s->
rows;
466 sub_count = step_subcount;
467 if (sub_count > todo_count)
468 sub_count = todo_count;
470 sub_len = s->
cols / 2;
473 juggle(wrap_p, block_p, sub_len, sub_count);
474 wrap_p += sub_len * 2;
476 for (i = 0, p = block_p; i < sub_count; i++) {
481 while (sub_len > 1) {
484 juggle(wrap_p, block_p, sub_len, sub_count);
485 wrap_p += sub_len * 2;
488 if (todo_count <= step_subcount)
491 todo_count -= step_subcount;
492 block_p += step_subcount << s->
level;
506 for (i = 0, x = 0; i <
count; i++) {
511 for (i = 1, x = -val; i <=
count; i++) {
533 int ret,
n, buf_size, input_buf_size;
541 input_buf_size = buf_size;
551 if (buf_size < s->max_framesize && pkt->
data) {
553 return input_buf_size;
568 samples = (int16_t *)frame->
data[0];
578 if (n > buf_size && pkt->
data) {
587 return input_buf_size;
606 .
name =
"interplayacm",
const char const char void * val
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
static const int8_t map_2bit_far[]
static int linear(InterplayACMContext *s, unsigned ind, unsigned col)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static int k24(InterplayACMContext *s, unsigned ind, unsigned col)
static int mul_3x5[5 *5 *5]
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *pkt)
static int decode_block(InterplayACMContext *s)
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
enum AVSampleFormat sample_fmt
audio sample format
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static int k35(InterplayACMContext *s, unsigned ind, unsigned col)
static int get_bits_count(const GetBitContext *s)
static const int8_t map_2bit_near[]
bitstream reader API header.
static int mul_2x11[11 *11]
AVCodec ff_interplay_acm_decoder
static int t15(InterplayACMContext *s, unsigned ind, unsigned col)
static int k44(InterplayACMContext *s, unsigned ind, unsigned col)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static av_cold int decode_close(AVCodecContext *avctx)
static int t27(InterplayACMContext *s, unsigned ind, unsigned col)
const char * name
Name of the codec implementation.
#define set_pos(s, r, c, idx)
static int k34(InterplayACMContext *s, unsigned ind, unsigned col)
int(* filler)(InterplayACMContext *s, unsigned ind, unsigned col)
static int zero(InterplayACMContext *s, unsigned ind, unsigned col)
static int fill_block(InterplayACMContext *s)
static void juggle_block(InterplayACMContext *s)
static av_cold int decode_init(AVCodecContext *avctx)
static int k12(InterplayACMContext *s, unsigned ind, unsigned col)
Libavcodec external API header.
static int k13(InterplayACMContext *s, unsigned ind, unsigned col)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static const filler filler_list[]
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
static int t37(InterplayACMContext *s, unsigned ind, unsigned col)
static void juggle(int *wrap_p, int *block_p, unsigned sub_len, unsigned sub_count)
static const int8_t map_3bit[]
void * av_calloc(size_t nmemb, size_t size)
Allocate a block of nmemb * size bytes with alignment suitable for all memory accesses (including vec...
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static int mul_3x3[3 *3 *3]
common internal api header.
static int k23(InterplayACMContext *s, unsigned ind, unsigned col)
static const int8_t map_1bit[]
int channels
number of audio channels
static int bad(InterplayACMContext *s, unsigned ind, unsigned col)
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.
static int k45(InterplayACMContext *s, unsigned ind, unsigned col)