41 if (
c->high >= 0x8000) {
42 if (
c->low < 0x8000) {
43 if (
c->low >= 0x4000 &&
c->high < 0xC000) {
70 int range =
c->high -
c->low + 1;
84 int range =
c->high -
c->low + 1;
85 int val = ((
c->value -
c->low + 1) * mod_val - 1) /
range;
89 c->low +=
prob / mod_val;
98 int range =
c->high -
c->low + 1;
99 int val = ((
c->value -
c->low + 1) * probs[0] - 1) /
range;
102 while (probs[sym] >
val)
105 c->high =
range * probs[sym - 1] / probs[0] +
c->low - 1;
106 c->low +=
range * probs[sym] / probs[0];
120 c->get_model_sym = arith_get_model_sym;
126 int i, ncol,
r,
g,
b;
127 uint32_t *pal =
ctx->pal + 256 -
ctx->free_colours;
129 if (!
ctx->free_colours)
133 for (
i = 0;
i < ncol;
i++) {
137 *pal++ = (0xFFU << 24) | (
r << 16) | (
g << 8) |
b;
158 c->pal_pic =
ctx->pic->data[0] +
ctx->pic->linesize[0] * (avctx->
height - 1);
159 c->pal_stride = -
ctx->pic->linesize[0];
160 c->keyframe = !arith_get_bit(&acoder);
193 c->ctx.avctx = avctx;
static double val(void *priv, double ch)
const FFCodec ff_mss1_decoder
static AVFormatContext * ctx
static av_cold void close(AVCodecParserContext *s)
Libavcodec external API header.
#define i(width, name, range_min, range_max)
#define prob(name, subs,...)
#define FF_CODEC_DECODE_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...
int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Identical in function to ff_get_buffer(), except it reuses the existing buffer if available.
int(* init)(AVBSFContext *ctx)
static const uint8_t bits[8]
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 unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
@ AV_PICTURE_TYPE_I
Intra.
@ AV_PICTURE_TYPE_P
Predicted.
int ff_mss12_decode_rect(SliceContext *sc, ArithCoder *acoder, int x, int y, int width, int height)
av_cold int ff_mss12_decode_end(MSS12Context *c)
av_cold int ff_mss12_decode_init(MSS12Context *c, int version, SliceContext *sc1, SliceContext *sc2)
void ff_mss12_slicecontext_reset(SliceContext *sc)
Common header for Microsoft Screen 1 and 2.
#define ARITH_GET_MODEL_SYM(prefix)
#define ARITH_GET_BIT(prefix)
static void decode_pal(MSS12Context *ctx, ArithCoder *acoder)
static int arith_get_prob(ArithCoder *c, int16_t *probs)
static void arith_init(ArithCoder *c, GetBitContext *gb)
static void arith_normalise(ArithCoder *c)
static av_cold int mss1_decode_init(AVCodecContext *avctx)
static int mss1_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, AVPacket *avpkt)
static av_cold int mss1_decode_end(AVCodecContext *avctx)
static int arith_get_bits(ArithCoder *c, int bits)
static int arith_get_number(ArithCoder *c, int mod_val)
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.