From 079f270e1fd5c82ecafb0c473d4196af21a24111 Mon Sep 17 00:00:00 2001 From: "sgunderson@bigfoot.com" <> Date: Sun, 3 Feb 2008 20:41:38 +0100 Subject: [PATCH] Make everything compile with -std=c89. --- qscale.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/qscale.c b/qscale.c index 5c5ee09..ee70208 100644 --- a/qscale.c +++ b/qscale.c @@ -7,12 +7,16 @@ #define CACHE_LINE_FACTOR 16 +#ifndef M_PI +#define M_PI 3.14159265358979323846264 +#endif + double sinc(double x) { - static const double cutoff = 1.220703668e-4; // sqrt(sqrt(eps)) + static const double cutoff = 1.220703668e-4; /* sqrt(sqrt(eps)) */ if (abs(x) < cutoff) { - // For small |x|, use Taylor series instead + /* For small |x|, use Taylor series instead */ const double x2 = x * x; const double x4 = x2 * x2; @@ -62,10 +66,10 @@ void hscale(float *pix, unsigned char *npix, unsigned w, unsigned h, unsigned nw end = w - 1; } - // round up so we get a multiple of four for the SSE code + /* round up so we get a multiple of four for the SSE code */ int num = (end - start + 1); if (num % 4 != 0) { - // prefer aligning it if possible + /* prefer aligning it if possible */ if (start % 4 != 0 && start % 4 <= num % 4) { num += start % 4; start -= start % 4; @@ -105,7 +109,7 @@ void hscale(float *pix, unsigned char *npix, unsigned w, unsigned h, unsigned nw float acc; long tmp; static const float low = 0.0, high = 255.0; - asm ( + __asm__ ( "pxor %1, %1 \n" "xor %2, %2 \n" "0: \n" @@ -223,7 +227,7 @@ void vscale(unsigned char *pix, float *npix, unsigned w, unsigned h, unsigned nh * xmm4: current filter coefficient * xmm5, xmm6, xmm7: scratchpad */ - asm ( + __asm__ ( /* clear */ "pxor %%xmm0, %%xmm0 \n" "pxor %%xmm1, %%xmm1 \n" @@ -453,7 +457,7 @@ int main(int argc, char **argv) int i; for (i = 0; i < max_lines; ++i) { - // simple edge extension + /* simple edge extension */ int yline = i + blocks*DCTSIZE*cinfo.comp_info[0].v_samp_factor; if (yline > nh0 - 1) yline = nh0 - 1; -- 2.39.2