Skip to content

Commit

Permalink
H2645Parser.cpp: remove unnecessary float -> double casts
Browse files Browse the repository at this point in the history
  • Loading branch information
ulmus-scott authored and bennettpeter committed Jul 1, 2022
1 parent c4e0d60 commit 85432af
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mythtv/libs/libmythtv/mpeg/H2645Parser.cpp
Expand Up @@ -14,8 +14,6 @@ extern "C" {
#include <cmath>
#include <strings.h>

static const float eps = 1E-5;

/*
Most of the comments below were cut&paste from ITU-T Rec. H.264
as found here: http://www.itu.int/rec/T-REC-H.264/e
Expand Down Expand Up @@ -478,13 +476,15 @@ uint H2645Parser::aspectRatio(void) const
break;
}

// TODO use an integer-based Rational number instead of floating point
static constexpr double eps = 1E-5;
if (aspect == 0.0)
return 0;
if (fabs(aspect - 1.3333333333333333) < static_cast<double>(eps))
if (fabs(aspect - 1.3333333333333333) < eps)
return 2;
if (fabs(aspect - 1.7777777777777777) < static_cast<double>(eps))
if (fabs(aspect - 1.7777777777777777) < eps)
return 3;
if (fabs(aspect - 2.21) < static_cast<double>(eps))
if (fabs(aspect - 2.21) < eps)
return 4;

return aspect * 1000000;
Expand Down

0 comments on commit 85432af

Please sign in to comment.