Justin Ruggles <[email protected]> writes:

> On 04/16/2011 09:24 AM, Justin Ruggles wrote:
>
>> 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.
>
> Also, if an application sends incorrectly-scaled floating point samples,
> the encoder will silently generate bad output unless the asserts are
> turned on.

I don't really care if invalid input causes bad output.

>> 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.

OK, then the patch looks good.  I'll have to fix the neon code of course.

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to