#define CONVERT_TO_RESIDUE(a, b) \
(((residual)(a)) << (RSIZE_BITS - (b)))
-#define INIT_RESIDUE(N, I, B) \
- residual N = B ? CONVERT_TO_RESIDUE(I, B) : 0; \
- av_unused int32_t N ## _bits = B
+#define INIT_RESIDUE(N) \
+ residual N = 0; \
+ av_unused int32_t N ## _bits = 0
+
+#define SET_RESIDUE(N, I, B) \
+ N = CONVERT_TO_RESIDUE(I, B); \
+ N ## _bits = B
+
+#define APPEND_RESIDUE(N, M) \
+ N |= M >> (N ## _bits); \
+ N ## _bits += (M ## _bits)
int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
int bytes, uint8_t *_dst, int coeffs)
int i, b, c_idx = 0;
int32_t *dst = (int32_t *)_dst;
DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]];
- INIT_RESIDUE(res, 0, 0);
-
-#define APPEND_RESIDUE(N, M) \
- N |= M >> (N ## _bits); \
- N ## _bits += (M ## _bits)
+ INIT_RESIDUE(res);
for (b = 1; b <= bytes; b++) {
future[0] = &lut_ctx[buf[b]];
int i, b, c_idx = 0;
int16_t *dst = (int16_t *)_dst;
DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]];
- INIT_RESIDUE(res, 0, 0);
-
-#define APPEND_RESIDUE(N, M) \
- N |= M >> (N ## _bits); \
- N ## _bits += (M ## _bits)
+ INIT_RESIDUE(res);
for (b = 1; b <= bytes; b++) {
future[0] = &lut_ctx[buf[b]];
uint32_t code;
int i;
- INIT_RESIDUE(res, idx, LUT_BITS);
+ INIT_RESIDUE(res);
+ SET_RESIDUE(res, idx, LUT_BITS);
for (i = 0; i < LUT_BITS; i++) {
const int cond = even ? (i & 1) : !(i & 1);
for (idx = 0; idx < LUT_SIZE; idx++) {
DiracGolombLUT *l = &lut[idx];
- INIT_RESIDUE(res, idx, LUT_BITS);
+ INIT_RESIDUE(res);
+ SET_RESIDUE(res, idx, LUT_BITS);
l->preamble = CONVERT_TO_RESIDUE(res >> (RSIZE_BITS - off), off);
l->preamble_bits = off;