diractab: expose the maximum quantization index as a macro

Prevents having to have random magic values in the decoder and a
separate macro in the encoder.

Signed-off-by: Rostislav Pehlivanov <rpehlivanov@obe.tv>
This commit is contained in:
Rostislav Pehlivanov
2016-06-23 18:06:59 +01:00
committed by Rostislav Pehlivanov
parent b9c6c5f453
commit 09d89d9406
3 changed files with 9 additions and 10 deletions

View File

@@ -486,7 +486,7 @@ static inline void codeblock(DiracContext *s, SubBand *b,
b->quant = quant;
}
if (b->quant > 115) {
if (b->quant > DIRAC_MAX_QUANT_INDEX) {
av_log(s->avctx, AV_LOG_ERROR, "Unsupported quant %d\n", b->quant);
b->quant = 0;
return;
@@ -676,12 +676,12 @@ static void decode_subband(DiracContext *s, GetBitContext *gb, int quant,
uint8_t *buf2 = b2 ? b2->ibuf + top * b2->stride: NULL;
int x, y;
if (quant > 115) {
if (quant > DIRAC_MAX_QUANT_INDEX) {
av_log(s->avctx, AV_LOG_ERROR, "Unsupported quant %d\n", quant);
return;
}
qfactor = ff_dirac_qscale_tab[quant & 0x7f];
qoffset = ff_dirac_qoffset_intra_tab[quant & 0x7f] + 2;
qfactor = ff_dirac_qscale_tab[quant];
qoffset = ff_dirac_qoffset_intra_tab[quant] + 2;
/* we have to constantly check for overread since the spec explicitly
requires this, with the meaning that all remaining coeffs are set to 0 */
if (get_bits_count(gb) >= bits_end)