1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:37:34 +00:00

Everywhere: Use AK/Math.h if applicable

AK's version should see better inlining behaviors, than the LibM one.
We avoid mixed usage for now though.

Also clean up some stale math includes and improper floatingpoint usage.
This commit is contained in:
Hendiadyoin1 2021-07-17 18:29:28 +02:00 committed by Ali Mohammad Pur
parent c5f6ba6e71
commit ed46d52252
40 changed files with 116 additions and 156 deletions

View file

@ -10,12 +10,12 @@
#include <AK/HashMap.h>
#include <AK/LexicalPath.h>
#include <AK/MappedFile.h>
#include <AK/Math.h>
#include <AK/MemoryStream.h>
#include <AK/String.h>
#include <AK/Vector.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/JPGLoader.h>
#include <math.h>
#define JPG_INVALID 0X0000
@ -864,20 +864,20 @@ static void dequantize(JPGLoadingContext& context, Vector<Macroblock>& macrobloc
static void inverse_dct(const JPGLoadingContext& context, Vector<Macroblock>& macroblocks)
{
static const float m0 = 2.0 * cos(1.0 / 16.0 * 2.0 * M_PI);
static const float m1 = 2.0 * cos(2.0 / 16.0 * 2.0 * M_PI);
static const float m3 = 2.0 * cos(2.0 / 16.0 * 2.0 * M_PI);
static const float m5 = 2.0 * cos(3.0 / 16.0 * 2.0 * M_PI);
static const float m0 = 2.0 * AK::cos(1.0 / 16.0 * 2.0 * AK::Pi<double>);
static const float m1 = 2.0 * AK::cos(2.0 / 16.0 * 2.0 * AK::Pi<double>);
static const float m3 = 2.0 * AK::cos(2.0 / 16.0 * 2.0 * AK::Pi<double>);
static const float m5 = 2.0 * AK::cos(3.0 / 16.0 * 2.0 * AK::Pi<double>);
static const float m2 = m0 - m5;
static const float m4 = m0 + m5;
static const float s0 = cos(0.0 / 16.0 * M_PI) / sqrt(8);
static const float s1 = cos(1.0 / 16.0 * M_PI) / 2.0;
static const float s2 = cos(2.0 / 16.0 * M_PI) / 2.0;
static const float s3 = cos(3.0 / 16.0 * M_PI) / 2.0;
static const float s4 = cos(4.0 / 16.0 * M_PI) / 2.0;
static const float s5 = cos(5.0 / 16.0 * M_PI) / 2.0;
static const float s6 = cos(6.0 / 16.0 * M_PI) / 2.0;
static const float s7 = cos(7.0 / 16.0 * M_PI) / 2.0;
static const float s0 = AK::cos(0.0 / 16.0 * AK::Pi<double>) / sqrt(8);
static const float s1 = AK::cos(1.0 / 16.0 * AK::Pi<double>) / 2.0;
static const float s2 = AK::cos(2.0 / 16.0 * AK::Pi<double>) / 2.0;
static const float s3 = AK::cos(3.0 / 16.0 * AK::Pi<double>) / 2.0;
static const float s4 = AK::cos(4.0 / 16.0 * AK::Pi<double>) / 2.0;
static const float s5 = AK::cos(5.0 / 16.0 * AK::Pi<double>) / 2.0;
static const float s6 = AK::cos(6.0 / 16.0 * AK::Pi<double>) / 2.0;
static const float s7 = AK::cos(7.0 / 16.0 * AK::Pi<double>) / 2.0;
for (u32 vcursor = 0; vcursor < context.mblock_meta.vcount; vcursor += context.vsample_factor) {
for (u32 hcursor = 0; hcursor < context.mblock_meta.hcount; hcursor += context.hsample_factor) {