[FFmpeg-devel,04/11] avformat/mov: use FFABS to instead of fabs

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

Details

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

Commit Message

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

Comments

Michael Niedermayer Nov. 16, 2017, 2:58 p.m.
On Wed, Nov 15, 2017 at 03:44:11PM +0800, Steven Liu wrote:
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>  libavformat/mov.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Iam not sure FFABS should be used with floats
the multiple evaluation in it can lead to interresting results
like FFABS() being slightly negative

[...]

Patch hide | download patch | download mbox

diff --git a/libavformat/mov.c b/libavformat/mov.c
index fd170baa57..e1a3e21e8d 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4332,7 +4332,7 @@  static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
         if (disp_transform[0] > 0       && disp_transform[1] > 0 &&
             disp_transform[0] < (1<<24) && disp_transform[1] < (1<<24) &&
-            fabs((disp_transform[0] / disp_transform[1]) - 1.0) > 0.01)
+            FFABS((disp_transform[0] / disp_transform[1]) - 1.0) > 0.01)
             st->sample_aspect_ratio = av_d2q(
                 disp_transform[0] / disp_transform[1],
                 INT_MAX);