Commit f41e37b8 authored by Rostislav Pehlivanov's avatar Rostislav Pehlivanov

dirac_vlc: prevent shifting a 0 by 64 bits when zeroing residue

Adding a check for bits == 0 would still make Coverity misdetect this,
so just revert to the normal way of setting the residue to 0.
Signed-off-by: 's avatarRostislav Pehlivanov <atomnuker@gmail.com>
parent c4adcff9
...@@ -65,7 +65,7 @@ int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, ...@@ -65,7 +65,7 @@ int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1; coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1;
} }
dst[c_idx++] = l->sign * (coeff - 1); dst[c_idx++] = l->sign * (coeff - 1);
SET_RESIDUE(res, 0, 0); res_bits = res = 0;
} }
memcpy(&dst[c_idx], l->ready, LUT_BITS*sizeof(int32_t)); memcpy(&dst[c_idx], l->ready, LUT_BITS*sizeof(int32_t));
...@@ -104,7 +104,7 @@ int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, ...@@ -104,7 +104,7 @@ int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1; coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1;
} }
dst[c_idx++] = l->sign * (coeff - 1); dst[c_idx++] = l->sign * (coeff - 1);
SET_RESIDUE(res, 0, 0); res_bits = res = 0;
} }
for (i = 0; i < LUT_BITS; i++) for (i = 0; i < LUT_BITS; i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment