From c81b8e04aa0952a7aec1e08940f29ae501fb6bfd Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Thu, 25 Mar 2021 12:52:56 +0100 Subject: Avoid intermediate bitcount for number of bytes in PutBitContext Signed-off-by: Andreas Rheinhardt --- libavcodec/aacenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libavcodec/aacenc.c') diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 070a2e706a..6dc68eb9b0 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -115,7 +115,7 @@ static int put_audio_specific_config(AVCodecContext *avctx) put_bits(&pb, 5, AOT_SBR); put_bits(&pb, 1, 0); flush_put_bits(&pb); - avctx->extradata_size = put_bits_count(&pb) >> 3; + avctx->extradata_size = put_bytes_output(&pb); return 0; } @@ -881,6 +881,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, flush_put_bits(&s->pb); s->last_frame_pb_count = put_bits_count(&s->pb); + avpkt->size = put_bytes_output(&s->pb); s->lambda_sum += s->lambda; s->lambda_count++; @@ -888,7 +889,6 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts, &avpkt->duration); - avpkt->size = put_bits_count(&s->pb) >> 3; *got_packet_ptr = 1; return 0; } -- cgit v1.2.1