40 if (c->
high >= 0x8000) {
41 if (c->
low < 0x8000) {
42 if (c->
low >= 0x4000 && c->
high < 0xC000) {
67 int range = c->high - c->low + 1;
68 int val = (((c->value - c->low + 1) << bits) - 1) / range;
69 int prob = range *
val;
71 c->high = ((prob + range) >> bits) + c->low - 1;
72 c->low += prob >> bits;
81 int range = c->
high - c->
low + 1;
82 int val = ((c->
value - c->
low + 1) * mod_val - 1) / range;
83 int prob = range *
val;
85 c->
high = (prob + range) / mod_val + c->
low - 1;
86 c->
low += prob / mod_val;
95 int range = c->
high - c->
low + 1;
96 int val = ((c->
value - c->
low + 1) * probs[0] - 1) / range;
99 while (probs[sym] > val)
102 c->
high = range * probs[sym - 1] / probs[0] + c->
low - 1;
103 c->
low += range * probs[sym] / probs[0];
116 c->get_model_sym = arith_get_model_sym;
122 int i, ncol,
r,
g,
b;
129 for (i = 0; i < ncol; i++) {
133 *pal++ = (0xFF
U << 24) | (r << 16) | (g << 8) | b;
159 c->
keyframe = !arith_get_bit(&acoder);
static int decode_pal(MSS12Context *ctx, ArithCoder *acoder)
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
av_cold int ff_mss12_decode_init(MSS12Context *c, int version, SliceContext *sc1, SliceContext *sc2)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static av_cold int init(AVCodecContext *avctx)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static av_cold int mss1_decode_end(AVCodecContext *avctx)
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
int ff_mss12_decode_rect(SliceContext *sc, ArithCoder *acoder, int x, int y, int width, int height)
int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame)
Identical in function to av_frame_make_writable(), except it uses ff_get_buffer() to allocate the buf...
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
8 bits with AV_PIX_FMT_RGB32 palette
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
static int arith_get_bits(ArithCoder *c, int bits)
static void arith_normalise(ArithCoder *c)
static int arith_get_prob(ArithCoder *c, int16_t *probs)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define ARITH_GET_MODEL_SYM(prefix)
const char * name
Name of the codec implementation.
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
av_cold int ff_mss12_decode_end(MSS12Context *c)
Libavcodec external API header.
union ArithCoder::@96 gbc
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
main external API structure.
static int mss1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static unsigned int get_bits1(GetBitContext *s)
int palette_has_changed
Tell user application that palette has changed from previous frame.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
void ff_mss12_slicecontext_reset(SliceContext *sc)
static int arith_get_number(ArithCoder *c, int mod_val)
static av_cold int mss1_decode_init(AVCodecContext *avctx)
int key_frame
1 -> keyframe, 0-> not
#define ARITH_GET_BIT(prefix)
This structure stores compressed data.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Common header for Microsoft Screen 1 and 2.
static void arith_init(ArithCoder *c, GetBitContext *gb)