[FFmpeg-devel] [PATCH 02/10] ffplay: use hypot()
Ganesh Ajjanagadde
gajjanag at mit.edu
Sun Dec 6 14:23:37 CET 2015
On Sun, Dec 6, 2015 at 7:07 AM, Marton Balint <cus at passwd.hu> wrote:
>
> On Sat, 5 Dec 2015, Ganesh Ajjanagadde wrote:
>
>> On Sun, Nov 22, 2015 at 12:05 PM, Ganesh Ajjanagadde
>> <gajjanagadde at gmail.com> wrote:
>>>
>>> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>>> ---
>>> ffplay.c | 6 +++---
>>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/ffplay.c b/ffplay.c
>>> index 2c1817e..36da8a5 100644
>>> --- a/ffplay.c
>>> +++ b/ffplay.c
>>> @@ -1115,9 +1115,9 @@ static void video_audio_display(VideoState *s)
>>> * directly access it but it is more than fast enough. */
>>> for (y = 0; y < s->height; y++) {
>>> double w = 1 / sqrt(nb_freq);
>>> - int a = sqrt(w * sqrt(data[0][2 * y + 0] * data[0][2 * y
>>> + 0] + data[0][2 * y + 1] * data[0][2 * y + 1]));
>>> - int b = (nb_display_channels == 2 ) ? sqrt(w *
>>> sqrt(data[1][2 * y + 0] * data[1][2 * y + 0]
>>> - + data[1][2 * y + 1] * data[1][2 * y + 1])) : a;
>>> + int a = sqrt(w * hypot(data[0][2 * y + 0], data[0][2 * y
>>> + 1]));
>>> + int b = (nb_display_channels == 2 ) ? sqrt(w *
>>> hypot(data[1][2 * y + 0], data[1][2 * y + 1]))
>>> + : a;
>>> a = FFMIN(a, 255);
>>> b = FFMIN(b, 255);
>>> fgcolor = SDL_MapRGB(screen->format, a, b, (a + b) / 2);
>>> --
>>> 2.6.2
>>>
>>
>> @Marton: are you fine with this? I think it improves readability;
>> accuracy benefits are likely irrelevant here.
>
>
> Yes, sure, LGTM.
>
> Sorry for forgetting this.
No problem. Pushed, thanks.
>
> Regards,
> Marton
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
More information about the ffmpeg-devel
mailing list