On 04/16/2011 11:52 AM, Justin Ruggles wrote:

> On 04/16/2011 09:52 AM, Måns Rullgård wrote:
> 
>> 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.
> 
> 
> Should I go ahead and apply it or wait for the neon code?
> 
> I have the channel coupling patch ready to send, pending approval of all
> the patches I sent yesterday.  It will definitely require that this
> clipping functionality be in place for all platforms before committing.


Well, I guess I'll push it now. But like I said, neon will need to be
fixed before channel coupling is added or it will produce bad output.

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

Reply via email to