[FFmpeg-devel] [PATCH] aacenc: Fix issues with huge values of bit_rate.

Michael Niedermayer michaelni at gmx.at
Sat Apr 7 00:34:24 CEST 2012


On Fri, Apr 06, 2012 at 03:58:19PM +0200, Reimar Döffinger wrote:
> Do not pointlessly call ff_alloc_packet2 multiple times,
> and fix an infinite loop by clamping the maximum
> number of bits to target in the algorithm that does
> not use lambda.
> 
> Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
> ---
>  libavcodec/aaccoder.c       |    3 +++
>  libavcodec/aacenc.c         |    4 ++--
>  tests/ref/acodec/aac        |    4 ++++
>  tests/ref/acodec/dca        |    4 ++++
>  tests/ref/acodec/nellymoser |    4 ++++
>  tests/ref/acodec/ra144      |    4 ++++
>  6 files changed, 21 insertions(+), 2 deletions(-)
>  create mode 100644 tests/ref/acodec/aac
>  create mode 100644 tests/ref/acodec/dca
>  create mode 100644 tests/ref/acodec/nellymoser
>  create mode 100644 tests/ref/acodec/ra144
> 
> diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
> index 25187b7..b6fefd3 100644
> --- a/libavcodec/aaccoder.c
> +++ b/libavcodec/aaccoder.c
> @@ -721,6 +721,9 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
>      int allz = 0;
>      float minthr = INFINITY;
>  
> +    // for values above this the decoder might end up in an endless loop
> +    // due to always having more bits than what can be encoded.
> +    destbits = FFMIN(destbits, 5800);
>      //XXX: some heuristic to determine initial quantizers will reduce search time
>      //determine zero bands and upper limits
>      for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {

not really pretty but should be ok if the value is sufficient
aacenc chaneg ok too

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120407/e8d660b9/attachment.asc>


More information about the ffmpeg-devel mailing list