]> git.sesse.net Git - qscale/blobdiff - qscale.c
Make everything compile with -std=c89.
[qscale] / qscale.c
index 5c5ee09448e6cff919825d2ab7f2972a3015cf4c..ee70208c28e5307511324c73f6a3800084cb6ad8 100644 (file)
--- 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;