From de28e73cce03b1de8b63683b70e4d0241161cca1 Mon Sep 17 00:00:00 2001 From: foo86 Date: Wed, 27 Apr 2016 10:19:54 -0700 Subject: [PATCH] avcodec/dcaenc: reuse shared quant levels table Signed-off-by: James Almer --- libavcodec/dcaenc.c | 8 ++++---- libavcodec/dcaenc.h | 7 ------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c index ab40e37b32..d562a27596 100644 --- a/libavcodec/dcaenc.c +++ b/libavcodec/dcaenc.c @@ -683,7 +683,7 @@ static int calc_one_scale(int32_t peak_cb, int abits, softfloat *quant) continue; our_quant.m = mul32(scalefactor_inv[our_nscale - try_remove].m, stepsize_inv[abits].m); our_quant.e = scalefactor_inv[our_nscale - try_remove].e + stepsize_inv[abits].e - 17; - if ((quant_levels[abits] - 1) / 2 < quantize_value(peak, our_quant)) + if ((ff_dca_quant_levels[abits] - 1) / 2 < quantize_value(peak, our_quant)) continue; our_nscale -= try_remove; } @@ -693,7 +693,7 @@ static int calc_one_scale(int32_t peak_cb, int abits, softfloat *quant) quant->m = mul32(scalefactor_inv[our_nscale].m, stepsize_inv[abits].m); quant->e = scalefactor_inv[our_nscale].e + stepsize_inv[abits].e - 17; - av_assert0((quant_levels[abits] - 1) / 2 >= quantize_value(peak, *quant)); + av_assert0((ff_dca_quant_levels[abits] - 1) / 2 >= quantize_value(peak, *quant)); return our_nscale; } @@ -858,9 +858,9 @@ static void put_subframe_samples(DCAEncContext *c, int ss, int band, int ch) for (i = 0; i < 8; i += 4) { sum = 0; for (j = 3; j >= 0; j--) { - sum *= quant_levels[c->abits[band][ch]]; + sum *= ff_dca_quant_levels[c->abits[band][ch]]; sum += c->quantized[ss * 8 + i + j][band][ch]; - sum += (quant_levels[c->abits[band][ch]] - 1) / 2; + sum += (ff_dca_quant_levels[c->abits[band][ch]] - 1) / 2; } put_bits(&c->pb, bit_consumption[c->abits[band][ch]] / 4, sum); } diff --git a/libavcodec/dcaenc.h b/libavcodec/dcaenc.h index 0443ca6511..bafc3c00d2 100644 --- a/libavcodec/dcaenc.h +++ b/libavcodec/dcaenc.h @@ -103,11 +103,4 @@ static const int bit_consumption[27] = { 272, 288, 304, 320, 336, 352, 368, }; -/* Table B.5: Selection of quantization levels and codebooks */ -static const int quant_levels[27] = { - 1, 3, 5, 7, 9, 13, 17, 25, 32, 64, - 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, - 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, -}; - #endif /* AVCODEC_DCAENC_H */