summaryrefslogtreecommitdiff
path: root/libavcodec/aacenc_pred.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-08-01 11:54:25 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-08-05 03:28:45 +0200
commit57d305207a30131172e1c07c99e2cba833c1add1 (patch)
tree8eaefcb072537115a8878e426d87666e67a32ba0 /libavcodec/aacenc_pred.c
parente081358e8d838b9d83c75fe58780b66cbbf3153d (diff)
avcodec/aacenc_quantization: Deduplicate quantization functions
Up until now, there were four copies of quantize_and_encode_band_cost_(ZERO|[SU]QUAD|[SU]PAIR|ESC|NONE|NOISE|STEREO) (namely in aaccoder.o, aacenc_is.o, aacenc_ltp.o, aacenc_pred.o). As 43b378a0d321e3d01f196cec95e13acfac80d464 says, this is meant to enable more optimizations. Yet neither GCC nor Clang performed such optimizations: The functions in the aforementioned files are not optimized according to the specifics of the calls in the respective file. Therefore duplicating them is a waste of space; this commit therefore stops doing so. The remaining copy is placed into aaccoder.c (which is the only place where the "round to zero" variant of quantize_and_encode_band() is used, so that this can be completely internal to aaccoder.c). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/aacenc_pred.c')
-rw-r--r--libavcodec/aacenc_pred.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libavcodec/aacenc_pred.c b/libavcodec/aacenc_pred.c
index d111192f06..447444cb82 100644
--- a/libavcodec/aacenc_pred.c
+++ b/libavcodec/aacenc_pred.c
@@ -271,9 +271,9 @@ void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce)
/* Normal coefficients */
s->abs_pow34(O34, &sce->coeffs[start_coef], num_coeffs);
- dist1 = quantize_and_encode_band_cost(s, NULL, &sce->coeffs[start_coef], NULL,
- O34, num_coeffs, sce->sf_idx[sfb],
- cb_n, s->lambda / band->threshold, INFINITY, &cost1, NULL, 0);
+ dist1 = ff_quantize_and_encode_band_cost(s, NULL, &sce->coeffs[start_coef], NULL,
+ O34, num_coeffs, sce->sf_idx[sfb],
+ cb_n, s->lambda / band->threshold, INFINITY, &cost1, NULL);
cost_coeffs += cost1;
/* Encoded coefficients - needed for #bits, band type and quant. error */
@@ -284,9 +284,9 @@ void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce)
cb_p = av_clip(find_min_book(find_max_val(1, num_coeffs, S34), sce->sf_idx[sfb]), cb_min, cb_max);
else
cb_p = cb_n;
- quantize_and_encode_band_cost(s, NULL, SENT, QERR, S34, num_coeffs,
- sce->sf_idx[sfb], cb_p, s->lambda / band->threshold, INFINITY,
- &cost2, NULL, 0);
+ ff_quantize_and_encode_band_cost(s, NULL, SENT, QERR, S34, num_coeffs,
+ sce->sf_idx[sfb], cb_p, s->lambda / band->threshold, INFINITY,
+ &cost2, NULL);
/* Reconstructed coefficients - needed for distortion measurements */
for (i = 0; i < num_coeffs; i++)
@@ -296,9 +296,9 @@ void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce)
cb_p = av_clip(find_min_book(find_max_val(1, num_coeffs, P34), sce->sf_idx[sfb]), cb_min, cb_max);
else
cb_p = cb_n;
- dist2 = quantize_and_encode_band_cost(s, NULL, &sce->prcoeffs[start_coef], NULL,
- P34, num_coeffs, sce->sf_idx[sfb],
- cb_p, s->lambda / band->threshold, INFINITY, NULL, NULL, 0);
+ dist2 = ff_quantize_and_encode_band_cost(s, NULL, &sce->prcoeffs[start_coef], NULL,
+ P34, num_coeffs, sce->sf_idx[sfb],
+ cb_p, s->lambda / band->threshold, INFINITY, NULL, NULL);
for (i = 0; i < num_coeffs; i++)
dist_spec_err += (O34[i] - P34[i])*(O34[i] - P34[i]);
dist_spec_err *= s->lambda / band->threshold;