[FFmpeg-devel,11/11] avformat/wavdecuse FFABS to instead of fabs

Submitted by Steven Liu on Nov. 15, 2017, 7:45 a.m.

Details

Message ID 20171115074518.25623-1-lq@chinaffmpeg.org
State New
Headers show

Commit Message

Steven Liu Nov. 15, 2017, 7:45 a.m.
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/wavdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul B Mahol Nov. 20, 2017, 10:07 a.m.
On 11/15/17, Steven Liu <lq@chinaffmpeg.org> wrote:
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>  libavformat/wavdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

NACK

FFABS is slower than fabs.
Gregor Riepl Nov. 20, 2017, 6:53 p.m.
> FFABS is slower than fabs.

Not generally. That is highly dependent on compiler/flags/architecture.

In some cases, FFABS may actually be faster, in others maybe not.

The expected result would be on-par performance.

Patch hide | download patch | download mbox

diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index b016185a1b..9f3e01e5b8 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -531,7 +531,7 @@  break_loop:
         && st->codecpar->sample_rate > 0
         && sample_count > 0 && st->codecpar->channels > 1
         && sample_count % st->codecpar->channels == 0) {
-        if (fabs(8.0 * data_size * st->codecpar->channels * st->codecpar->sample_rate /
+        if (FFABS(8.0 * data_size * st->codecpar->channels * st->codecpar->sample_rate /
             sample_count /st->codecpar->bit_rate - 1.0) < 0.3)
             sample_count /= st->codecpar->channels;
     }