Go to the documentation of this file.
28 #ifndef AVCODEC_DIRAC_ARITH_H
29 #define AVCODEC_DIRAC_ARITH_H
69 #define CTX_SB_F1 CTX_ZP_F5
71 #define CTX_PMODE_REF1 0
72 #define CTX_PMODE_REF2 1
73 #define CTX_GLOBAL_BLOCK 2
74 #define CTX_MV_F1 CTX_ZP_F2
76 #define CTX_DC_F1 CTX_ZP_F5
104 while (
c->range <= 0x4000) {
114 int counter =
c->counter;
117 int new = bytestream_get_be16(&
c->bytestream);
120 if (
c->bytestream >
c->bytestream_end) {
122 if (
c->bytestream >
c->bytestream_end+1)
125 c->bytestream =
c->bytestream_end;
131 c->low +=
new << counter;
134 c->counter = counter;
139 int prob_zero =
c->contexts[
ctx];
140 int range_times_prob,
bit;
141 unsigned low =
c->low;
144 range_times_prob = (
c->range * prob_zero) >> 16;
146 #if ARCH_X86 && HAVE_FAST_CMOV && HAVE_INLINE_ASM && HAVE_6REGS
147 low -= range_times_prob << 16;
148 range -= range_times_prob;
156 :
"r"(
c->low),
"r"(
c->low>>16),
157 "r"(range_times_prob)
160 bit = (low >> 16) >= range_times_prob;
162 low -= range_times_prob << 16;
163 range -= range_times_prob;
165 range = range_times_prob;
182 if (
ret >= 0x40000000) {
int av_log2_16bit(unsigned v)
static int dirac_get_arith_int(DiracArith *c, int follow_ctx, int data_ctx)
#define bit(string, value)
void ff_dirac_init_arith_decoder(DiracArith *c, GetBitContext *gb, int length)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const uint8_t * bytestream
static int dirac_get_arith_bit(DiracArith *c, int ctx)
int16_t ff_dirac_prob_branchless[256][2]
static int dirac_get_arith_uint(DiracArith *c, int follow_ctx, int data_ctx)
void ff_dirac_init_arith_tables(void)
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
static void renorm(DiracArith *c)
static int shift(int a, int b)
static void refill(DiracArith *c)
const uint8_t * bytestream_end
__asm__(".macro parse_r var r\n\t" "\\var = -1\n\t" _IFC_REG(0) _IFC_REG(1) _IFC_REG(2) _IFC_REG(3) _IFC_REG(4) _IFC_REG(5) _IFC_REG(6) _IFC_REG(7) _IFC_REG(8) _IFC_REG(9) _IFC_REG(10) _IFC_REG(11) _IFC_REG(12) _IFC_REG(13) _IFC_REG(14) _IFC_REG(15) _IFC_REG(16) _IFC_REG(17) _IFC_REG(18) _IFC_REG(19) _IFC_REG(20) _IFC_REG(21) _IFC_REG(22) _IFC_REG(23) _IFC_REG(24) _IFC_REG(25) _IFC_REG(26) _IFC_REG(27) _IFC_REG(28) _IFC_REG(29) _IFC_REG(30) _IFC_REG(31) ".iflt \\var\n\t" ".error \"Unable to parse register name \\r\"\n\t" ".endif\n\t" ".endm")
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
const uint8_t ff_dirac_next_ctx[DIRAC_CTX_COUNT]