On 04/16/2011 08:59 AM, Måns Rullgård wrote:

> Justin Ruggles <[email protected]> writes:
> 
>> ---
>> This patch will also need a change to ff_ac3_extract_exponents_neon(). Mans,
>> could you help me out with that?
>>
>> -Justin
>>
>>  libavcodec/ac3dsp.c |    4 +++-
>>  1 files changed, 3 insertions(+), 1 deletions(-)
>>
>>
>> diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c
>> index dccad3b..e3ca37e 100644
>> --- a/libavcodec/ac3dsp.c
>> +++ b/libavcodec/ac3dsp.c
>> @@ -164,8 +164,10 @@ static void ac3_extract_exponents_c(uint8_t *exp, 
>> int32_t *coef, int nb_coefs)
>>              if (e >= 24) {
>>                  e = 24;
>>                  coef[i] = 0;
>> +            } else if (e < 0) {
>> +                e = 0;
>> +                coef[i] = av_clip(coef[i], -16777215, 16777215);
>>              }
>> -            av_assert2(e >= 0);
>>          }
>>          exp[i] = e;
>>      }
> 
> Does some other change you have planned make this condition possible?  I
> assume from the assert() that it was impossible before.


Well, I don't think it is impossible currently. If either the input
samples or the MDCT coefficients are outside of [-1.0,1.0] the scaling
will put it out of the exponent range. Even if the scaled coefficients
are 25-bit signed, the low value will generate an exponent of -1.

This function will also be used for coupling coordinates, and in that
case they can definitely be out-of-range unless they're clipped prior to
this. The coordinates are a ratio of 1 channel to the sum of multiple
channels, divided by 8.  So if the ratio is >8 (rare but definitely
possible) the coordinate will need to be clipped to the valid range at
some point.

-Justin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to