30static const int16_t
steps[16] = {
31 4084, 18, 41, 64, 112, 198, 355, 1122,
32 1122, 355, 198, 112, 64, 41, 18, 4084,
35static const int16_t
diffs[16] = {
36 2048, 4, 135, 213, 273, 323, 373, 425,
37 425, 373, 323, 273, 213, 135, 4, 2048,
91 for (
int i = 0;
i < 6;
i++) {
92 const int sign =
FFSIGN(
c->diffs_tab[
i]);
93 c->weights_tab[
i] = (
c->weights_tab[
i] * 255LL) / 256;
94 c->weights_tab[
i] += (1LL << (
WEIGHTSBITS + 1)) * sign * isign;
97 memmove(&
c->diffs_tab[1], &
c->diffs_tab[0], 5 *
sizeof(
int32_t));
100 c->pred =
c->new_pred;
103 for (
int i = 0;
i < 6;
i++)
108 c->pred =
c->pred * 9 / 10;
116 uint32_t step, newstep;
119 diff_sign = nibble >> 3;
121 step =
diff + (
c->last_step >> 2);
122 newstep = step & 0xfff;
123 if (newstep >> 11 == 0)
124 adiff = (((step & 0x7f) + 0x80) * 128) >>
125 (14 - (newstep >> 7));
126 delta = diff_sign ? -adiff : adiff;
129 nibble =
steps[nibble];
130 newstep = nibble * 32 -
c->last_step & 0x1ffff;
131 newstep = ((newstep >> 5) + (newstep & 0x10000 ? 0x1000 : 0) +
c->last_step) & 0x1fff;
132 c->last_step =
av_clip(newstep, 544, 5120);
151 hdr = bytestream2_peek_be32(gb);
152 if (hdr ==
s->marker) {
154 }
else if ((hdr >> 16) ==
s->marker) {
159 int16_t *samples = (int16_t *)
frame->data[0];
163 for (n = 0; n < 29; n++) {
164 int nibble = bytestream2_get_byte(gb);
165 samples[2*n+0] =
decode(&
s->ch[0 ], nibble >> 4);
166 samples[2*n+1] =
decode(&
s->ch[st], nibble & 15);
171 if (n == 29 && bytestream2_get_byte(gb) != 0x55)
const FFCodec ff_misc4_decoder
Libavcodec external API header.
static av_always_inline int bytestream2_get_bytes_left(const GetByteContext *g)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
static av_always_inline int bytestream2_tell(const GetByteContext *g)
#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)
#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 AVERROR_INVALIDDATA
Invalid data found when processing input.
@ AV_SAMPLE_FMT_S16
signed 16 bits
common internal API header
#define FFDIFFSIGN(x, y)
Comparator.
static const int16_t diffs[16]
static int misc4_decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *pkt)
static int16_t decode(ChannelContext *c, unsigned nibble)
static int64_t prediction(int delta, ChannelContext *c)
static av_cold int misc4_init(AVCodecContext *avctx)
static const int16_t steps[16]
static const float pred[4]
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 sample_rate
samples per second
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)