Aℓex Converse <[email protected]> writes:
> There is most likely a performance hit here but the current code is
> *undefined.*
>
> Haters are welcome to send suggestions on how to do this without an if.
>
> From 554be95192ad9803f51f00fec18bf6db9a562779 Mon Sep 17 00:00:00 2001
> From: Alex Converse <[email protected]>
> Date: Tue, 26 Apr 2011 09:07:43 -0700
> Subject: [PATCH 2/4] aacdec: Guard undefined shifts with an if.
> MIME-Version: 1.0
> Content-Type: multipart/mixed; boundary="------------1"
>
> This is a multi-part message in MIME format.
> --------------1
> Content-Type: text/plain; charset=UTF-8; format=fixed
> Content-Transfer-Encoding: 8bit
>
> ---
> libavcodec/aacdec.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> --------------1
> Content-Type: text/x-patch;
> name="0002-aacdec-Guard-undefined-shifts-with-an-if.patch"
> Content-Transfer-Encoding: 8bit
> Content-Disposition: attachment;
> filename="0002-aacdec-Guard-undefined-shifts-with-an-if.patch"
Please configure your git to not do that.
> diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
> index 0c6312f..c9f2afd 100644
> --- a/libavcodec/aacdec.c
> +++ b/libavcodec/aacdec.c
> @@ -1083,8 +1083,11 @@ static int decode_spectrum_and_dequant(AACContext *ac,
> float coef[1024],
> GET_VLC(code, re, gb, vlc_tab, 8, 2);
> cb_idx = cb_vector_idx[code];
> nnz = cb_idx >> 8 & 15;
> - bits = SHOW_UBITS(re, gb, nnz) << (32-nnz);
> - LAST_SKIP_BITS(re, gb, nnz);
> + if (nnz) {
> + bits = SHOW_UBITS(re, gb, nnz) << (32-nnz);
> + LAST_SKIP_BITS(re, gb, nnz);
> + } else
> + bits = 0;
Does this ever happen?
--
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel