28 #ifndef AVCODEC_DIRAC_ARITH_H
29 #define AVCODEC_DIRAC_ARITH_H
65 #define CTX_SB_F1 CTX_ZP_F5
67 #define CTX_PMODE_REF1 0
68 #define CTX_PMODE_REF2 1
69 #define CTX_GLOBAL_BLOCK 2
70 #define CTX_MV_F1 CTX_ZP_F2
72 #define CTX_DC_F1 CTX_ZP_F5
100 while (
c->range <= 0x4000) {
110 int counter =
c->counter;
113 int new = bytestream_get_be16(&
c->bytestream);
116 if (
c->bytestream >
c->bytestream_end) {
118 if (
c->bytestream >
c->bytestream_end+1)
121 c->bytestream =
c->bytestream_end;
127 c->low +=
new << counter;
130 c->counter = counter;
135 int prob_zero =
c->contexts[
ctx];
136 int range_times_prob,
bit;
137 unsigned low =
c->low;
138 int range =
c->range;
140 range_times_prob = (
c->range * prob_zero) >> 16;
142 #if ARCH_X86 && HAVE_FAST_CMOV && HAVE_INLINE_ASM && HAVE_6REGS
143 low -= range_times_prob << 16;
144 range -= range_times_prob;
151 :
"+q"(
bit),
"+r"(range),
"+r"(low)
152 :
"r"(
c->low),
"r"(
c->low>>16),
153 "r"(range_times_prob)
156 bit = (low >> 16) >= range_times_prob;
158 low -= range_times_prob << 16;
159 range -= range_times_prob;
161 range = range_times_prob;
178 if (ret >= 0x40000000) {
__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 bit(string, value)
static int dirac_get_arith_uint(DiracArith *c, int follow_ctx, int data_ctx)
void ff_dirac_init_arith_tables(void)
static void renorm(DiracArith *c)
void ff_dirac_init_arith_decoder(DiracArith *c, GetBitContext *gb, int length)
const uint8_t ff_dirac_next_ctx[DIRAC_CTX_COUNT]
int16_t ff_dirac_prob_branchless[256][2]
static int dirac_get_arith_bit(DiracArith *c, int ctx)
static void refill(DiracArith *c)
static int dirac_get_arith_int(DiracArith *c, int follow_ctx, int data_ctx)
bitstream reader API header.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int shift(int a, int b)
const uint8_t * bytestream_end
const uint8_t * bytestream