summaryrefslogtreecommitdiff
path: root/libavcodec/aaccoder.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-05-07 07:20:32 +0200
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:39 -0300
commit494760f971a41851630d7940abe914cd1115737e (patch)
tree33e017519b761fc8e6776fdc15b5fca627d02f68 /libavcodec/aaccoder.c
parent2350a50bed6bd71c67947604f117a4dff73ebe35 (diff)
downloadffmpeg-494760f971a41851630d7940abe914cd1115737e.tar.gz
aac: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/aaccoder.c')
-rw-r--r--libavcodec/aaccoder.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 7bbd4d5b2e..f460479498 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -397,7 +397,7 @@ static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s,
const float lambda)
{
int start = 0, i, w, w2, g;
- int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels * (lambda / 120.f);
+ int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->ch_layout.nb_channels * (lambda / 120.f);
float dists[128] = { 0 }, uplims[128] = { 0 };
float maxvals[128];
int fflag, minscaler;
@@ -556,7 +556,7 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne
const float pns_transient_energy_r = FFMIN(0.7f, lambda / 140.f);
int refbits = avctx->bit_rate * 1024.0 / avctx->sample_rate
- / ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->channels)
+ / ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->ch_layout.nb_channels)
* (lambda / 120.f);
/** Keep this in sync with twoloop's cutoff selection */
@@ -564,7 +564,7 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne
int prev = -1000, prev_sf = -1;
int frame_bit_rate = (avctx->flags & AV_CODEC_FLAG_QSCALE)
? (refbits * rate_bandwidth_multiplier * avctx->sample_rate / 1024)
- : (avctx->bit_rate / avctx->channels);
+ : (avctx->bit_rate / avctx->ch_layout.nb_channels);
frame_bit_rate *= 1.15f;
@@ -693,14 +693,14 @@ static void mark_pns(AACEncContext *s, AVCodecContext *avctx, SingleChannelEleme
const float pns_transient_energy_r = FFMIN(0.7f, lambda / 140.f);
int refbits = avctx->bit_rate * 1024.0 / avctx->sample_rate
- / ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->channels)
+ / ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->ch_layout.nb_channels)
* (lambda / 120.f);
/** Keep this in sync with twoloop's cutoff selection */
float rate_bandwidth_multiplier = 1.5f;
int frame_bit_rate = (avctx->flags & AV_CODEC_FLAG_QSCALE)
? (refbits * rate_bandwidth_multiplier * avctx->sample_rate / 1024)
- : (avctx->bit_rate / avctx->channels);
+ : (avctx->bit_rate / avctx->ch_layout.nb_channels);
frame_bit_rate *= 1.15f;