28#ifndef AVCODEC_DIRAC_ARITH_H
29#define AVCODEC_DIRAC_ARITH_H
66#define CTX_SB_F1 CTX_ZP_F5
68#define CTX_PMODE_REF1 0
69#define CTX_PMODE_REF2 1
70#define CTX_GLOBAL_BLOCK 2
71#define CTX_MV_F1 CTX_ZP_F2
73#define CTX_DC_F1 CTX_ZP_F5
101 while (
c->range <= 0x4000) {
111 int counter =
c->counter;
114 int new = bytestream_get_be16(&
c->bytestream);
117 if (
c->bytestream >
c->bytestream_end) {
119 if (
c->bytestream >
c->bytestream_end+1)
122 c->bytestream =
c->bytestream_end;
128 c->low +=
new << counter;
131 c->counter = counter;
136 int prob_zero =
c->contexts[
ctx];
137 int range_times_prob,
bit;
138 unsigned low =
c->low;
141 range_times_prob = (
c->range * prob_zero) >> 16;
143#if ARCH_X86 && HAVE_FAST_CMOV && HAVE_INLINE_ASM && HAVE_X86_6REGS
144 low -= range_times_prob << 16;
145 range -= range_times_prob;
153 :
"r"(
c->low),
"r"(
c->low>>16),
154 "r"(range_times_prob)
157 bit = (low >> 16) >= range_times_prob;
159 low -= range_times_prob << 16;
160 range -= range_times_prob;
162 range = range_times_prob;
179 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)
const uint8_t ff_dirac_next_ctx[DIRAC_CTX_COUNT]
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)
static void renorm(DiracArith *c)
void ff_dirac_init_arith_decoder(DiracArith *c, GetBitContext *gb, int length)
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
uint16_t contexts[DIRAC_CTX_COUNT]
const uint8_t * bytestream
static AVFormatContext * ctx