26 #ifndef AVCODEC_MSS12_H 27 #define AVCODEC_MSS12_H 34 #define MODEL_MIN_SYMS 2 35 #define MODEL_MAX_SYMS 256 36 #define THRESH_ADAPTIVE -1 38 #define THRESH_HIGH 50 51 #define MAX_OVERREAD 16 104 #define ARITH_GET_BIT(prefix) \ 105 static int prefix ## _get_bit(ArithCoder *c) \ 107 int range = c->high - c->low + 1; \ 108 int bit = 2 * c->value - c->low >= c->high; \ 111 c->low += range >> 1; \ 113 c->high = c->low + (range >> 1) - 1; \ 115 prefix ## _normalise(c); \ 120 #define ARITH_GET_MODEL_SYM(prefix) \ 121 static int prefix ## _get_model_sym(ArithCoder *c, Model *m) \ 125 idx = prefix ## _get_prob(c, m->cum_prob); \ 127 val = m->idx2sym[idx]; \ 128 ff_mss12_model_update(m, idx); \ 130 prefix ## _normalise(c); \
int16_t weights[MODEL_MAX_SYMS+1]
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
bitstream reader API header.
static int get_number(void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum, int search_flags)
int ff_mss12_decode_end(MSS12Context *ctx)
Libavcodec external API header.
int ff_mss12_decode_rect(SliceContext *ctx, ArithCoder *acoder, int x, int y, int width, int height)
main external API structure.
int ff_mss12_decode_init(MSS12Context *c, int version, SliceContext *sc1, SliceContext *sc2)
uint8_t idx2sym[MODEL_MAX_SYMS+1]
int special_initial_cache
void ff_mss12_slicecontext_reset(SliceContext *sc)
static double val(void *priv, double ch)
void ff_mss12_model_update(Model *m, int val)
int16_t cum_prob[MODEL_MAX_SYMS+1]