shithub: dav1d

Download patch

ref: 449a81e7ba8a9622f4d928a10f1b39d5efd37f2a
parent: 58261250109337fc1f4cb2a9330fe3aa868e9d3f
author: Steve Lhomme <robux4@ycbcr.xyz>
date: Fri Sep 28 09:13:44 EDT 2018

Don't use hardcoded __attribute__((noinline))

--- a/include/common/attributes.h
+++ b/include/common/attributes.h
@@ -51,6 +51,17 @@
 #define ALIGN_STK_16(type, var, sz1d, sznd) \
     ALIGN(type var[sz1d]sznd, 16)
 
+/*
+ * Forbid inlining of a function:
+ * static NOINLINE void func() {}
+ */
+#ifdef _MSC_VER
+#define NOINLINE __declspec(noinline)
+#else /* !_MSC_VER */
+#define NOINLINE __attribute__((noinline))
+#endif /* !_MSC_VER */
+
+
  #ifdef _MSC_VER
  #include <intrin.h>
 
--- a/src/ipred.c
+++ b/src/ipred.c
@@ -31,6 +31,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "common/attributes.h"
 #include "common/intops.h"
 
 #include "src/ipred.h"
@@ -56,7 +57,7 @@
 l_fn(64, 32) \
 l_fn(64, 64)
 
-static __attribute__((noinline)) void
+static NOINLINE void
 splat_dc_c(pixel *dst, const ptrdiff_t stride,
            const int w, const int h, const unsigned dc)
 {
@@ -172,7 +173,7 @@
 
 sz_grid(dc128_lfn)
 
-static __attribute__((noinline)) void
+static NOINLINE void
 v_c(pixel *dst, const ptrdiff_t stride,
     const pixel *const topleft, const int width, const int height)
 {
@@ -191,7 +192,7 @@
 
 sz_grid(v_lfn)
 
-static __attribute__((noinline)) void
+static NOINLINE void
 h_c(pixel *dst, const ptrdiff_t stride,
     const pixel *const topleft, const int width, const int height)
 {
@@ -210,7 +211,7 @@
 
 sz_grid(h_lfn)
 
-static __attribute__((noinline)) void
+static NOINLINE void
 paeth_c(pixel *dst, const ptrdiff_t stride, const pixel *const tl_ptr,
         const int width, const int height)
 {
@@ -262,7 +263,7 @@
     13, 12, 10, 9, 8, 7, 6, 6, 5, 5, 4, 4, 4,
 };
 
-static __attribute__((noinline)) void
+static NOINLINE void
 smooth_c(pixel *dst, const ptrdiff_t stride, const pixel *const topleft,
          const int width, const int height)
 {
@@ -292,7 +293,7 @@
 
 sz_grid(smooth_lfn)
 
-static __attribute__((noinline)) void
+static NOINLINE void
 smooth_v_c(pixel *dst, const ptrdiff_t stride, const pixel *const topleft,
            const int width, const int height)
 {
@@ -319,7 +320,7 @@
 
 sz_grid(smooth_v_lfn)
 
-static __attribute__((noinline)) void
+static NOINLINE void
 smooth_h_c(pixel *dst, const ptrdiff_t stride, const pixel *const topleft,
            const int width, const int height)
 {
@@ -460,7 +461,7 @@
     out[i * 2] = in[iclip(i, from, to - 1)];
 }
 
-static __attribute__((noinline)) void
+static NOINLINE void
 z1_c(pixel *dst, const ptrdiff_t stride, const pixel *const topleft_in,
      int angle, const int width, const int height)
 {
@@ -522,7 +523,7 @@
 
 sz_grid(z1_lfn)
 
-static __attribute__((noinline)) void
+static NOINLINE void
 z2_c(pixel *dst, const ptrdiff_t stride, const pixel *const topleft_in,
      int angle, const int width, const int height)
 {
@@ -603,7 +604,7 @@
 
 sz_grid(z2_lfn)
 
-static __attribute__((noinline)) void
+static NOINLINE void
 z3_c(pixel *dst, const ptrdiff_t stride, const pixel *const topleft_in,
      int angle, const int width, const int height)
 {
@@ -717,7 +718,7 @@
     },
 };
 
-static __attribute__((noinline)) void
+static NOINLINE void
 filter_intra_c(pixel *dst, const ptrdiff_t stride,
                const pixel *const topleft_in,
                int filt_idx, const int width, const int height)
@@ -787,7 +788,7 @@
 filter_lfn(16, 32)
 filter_lfn(32, 32)
 
-static __attribute__((noinline)) void
+static NOINLINE void
 cfl_ac_c(int16_t *ac, const pixel *ypx, const ptrdiff_t stride,
          const int w_pad, const int h_pad, const int width, const int height,
          const int ss_hor, const int ss_ver, const int log2sz)
@@ -878,7 +879,7 @@
 cfl_ac_fn(32, 16, 32, 16, 0, 0, 9)
 cfl_ac_fn(32, 32, 32, 32, 0, 0, 10)
 
-static __attribute__((noinline)) void
+static NOINLINE void
 cfl_pred_c(pixel *dstU, pixel *dstV, const ptrdiff_t stride,
            const int16_t *ac, const pixel *const dc_pred,
            const int8_t *const alphas, const int width, const int height)
--- a/src/itx.c
+++ b/src/itx.c
@@ -32,6 +32,7 @@
 #include <stdint.h>
 #include <string.h>
 
+#include "common/attributes.h"
 #include "common/intops.h"
 
 #include "src/itx.h"
@@ -41,7 +42,7 @@
 typedef void (*itx_1d_fn)(const coef *in, ptrdiff_t in_s,
                           coef *out, ptrdiff_t out_s);
 
-static void __attribute__((noinline))
+static void NOINLINE
 inv_txfm_add_c(pixel *dst, const ptrdiff_t stride,
                coef *const coeff, const int eob,
                const int w, const int h, const int shift1, const int shift2,
--- a/src/itx_1d.c
+++ b/src/itx_1d.c
@@ -30,7 +30,9 @@
 #include <stddef.h>
 #include <stdint.h>
 
-static void __attribute__((noinline))
+#include "common/attributes.h"
+
+static void NOINLINE
 inv_dct4_1d(const coef *const in, const ptrdiff_t in_s,
             coef *const out, const ptrdiff_t out_s)
 {
@@ -48,7 +50,7 @@
     out[3 * out_s] = t0 - t3;
 }
 
-static void __attribute__((noinline))
+static void NOINLINE
 inv_dct8_1d(const coef *const in, const ptrdiff_t in_s,
             coef *const out, const ptrdiff_t out_s)
 {
@@ -82,7 +84,7 @@
     out[7 * out_s] = tmp[0] - t7;
 }
 
-static void __attribute__((noinline))
+static void NOINLINE
 inv_dct16_1d(const coef *const in, const ptrdiff_t in_s,
              coef *const out, const ptrdiff_t out_s)
 {
@@ -150,7 +152,7 @@
     out[15 * out_s] = tmp[0] - t15a;
 }
 
-static void __attribute__((noinline))
+static void NOINLINE
 inv_dct32_1d(const coef *const in, const ptrdiff_t in_s,
              coef *const out, const ptrdiff_t out_s)
 {
@@ -296,7 +298,7 @@
     out[31 * out_s] = tmp[ 0] - t31;
 }
 
-static void __attribute__((noinline))
+static void NOINLINE
 inv_dct64_1d(const coef *const in, const ptrdiff_t in_s,
              coef *const out, const ptrdiff_t out_s)
 {
@@ -620,7 +622,7 @@
     out[63 * out_s] = tmp[ 0] - t63a;
 }
 
-static void __attribute__((noinline))
+static void NOINLINE
 inv_adst4_1d(const coef *const in, const ptrdiff_t in_s,
              coef *const out, const ptrdiff_t out_s)
 {
@@ -638,7 +640,7 @@
     out[3 * out_s] = (t0 + t1 - t3 + 2048) >> 12;
 }
 
-static void __attribute__((noinline))
+static void NOINLINE
 inv_adst8_1d(const coef *const in, const ptrdiff_t in_s,
              coef *const out, const ptrdiff_t out_s)
 {
@@ -686,7 +688,7 @@
     out[5 * out_s] = -(((t6 - t7) * 2896 + 2048) >> 12);
 }
 
-static void __attribute__((noinline))
+static void NOINLINE
 inv_adst16_1d(const coef *const in, const ptrdiff_t in_s,
               coef *const out, const ptrdiff_t out_s)
 {
@@ -808,7 +810,7 @@
 
 #undef flip_inv_adst
 
-static void __attribute__((noinline))
+static void NOINLINE
 inv_identity4_1d(const coef *const in, const ptrdiff_t in_s,
                  coef *const out, const ptrdiff_t out_s)
 {
@@ -816,7 +818,7 @@
         out[out_s * i] = (in[in_s * i] * 5793 + 2048) >> 12;
 }
 
-static void __attribute__((noinline))
+static void NOINLINE
 inv_identity8_1d(const coef *const in, const ptrdiff_t in_s,
                  coef *const out, const ptrdiff_t out_s)
 {
@@ -824,7 +826,7 @@
         out[out_s * i] = in[in_s * i] * 2;
 }
 
-static void __attribute__((noinline))
+static void NOINLINE
 inv_identity16_1d(const coef *const in, const ptrdiff_t in_s,
                   coef *const out, const ptrdiff_t out_s)
 {
@@ -832,7 +834,7 @@
         out[out_s * i] = (in[in_s * i] * 2 * 5793 + 2048) >> 12;
 }
 
-static void __attribute__((noinline))
+static void NOINLINE
 inv_identity32_1d(const coef *const in, const ptrdiff_t in_s,
                   coef *const out, const ptrdiff_t out_s)
 {
@@ -840,7 +842,7 @@
         out[out_s * i] = in[in_s * i] * 4;
 }
 
-static void __attribute__((noinline))
+static void NOINLINE
 inv_wht4_1d(const coef *const in, const ptrdiff_t in_s,
             coef *const out, const ptrdiff_t out_s,
             const int pass)
--- a/src/loopfilter.c
+++ b/src/loopfilter.c
@@ -29,11 +29,12 @@
 
 #include <stdlib.h>
 
+#include "common/attributes.h"
 #include "common/intops.h"
 
 #include "src/loopfilter.h"
 
-static __attribute__((noinline)) void
+static NOINLINE void
 loop_filter(pixel *dst, int E, int I, int H,
             const ptrdiff_t stridea, const ptrdiff_t strideb, const int wd)
 {
--- a/src/mc.c
+++ b/src/mc.c
@@ -30,12 +30,13 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "common/attributes.h"
 #include "common/intops.h"
 
 #include "src/mc.h"
 #include "src/tables.h"
 
-static __attribute__((noinline)) void
+static NOINLINE void
 put_c(pixel *dst, const ptrdiff_t dst_stride,
       const pixel *src, const ptrdiff_t src_stride, const int w, int h)
 {
@@ -47,7 +48,7 @@
     } while (--h);
 }
 
-static __attribute__((noinline)) void
+static NOINLINE void
 prep_c(coef *tmp, const pixel *src, const ptrdiff_t src_stride,
        const int w, int h)
 {
@@ -84,7 +85,7 @@
         dav1d_mc_subpel_filters[filter_type >> 2][my - 1] : \
         dav1d_mc_subpel_filters[3 + ((filter_type >> 2) & 1)][my - 1]; \
 
-static __attribute__((noinline)) void
+static NOINLINE void
 put_8tap_c(pixel *dst, ptrdiff_t dst_stride,
            const pixel *src, ptrdiff_t src_stride,
            const int w, int h, const int mx, const int my,
@@ -139,7 +140,7 @@
         put_c(dst, dst_stride, src, src_stride, w, h);
 }
 
-static __attribute__((noinline)) void
+static NOINLINE void
 prep_8tap_c(coef *tmp, const pixel *src, ptrdiff_t src_stride,
             const int w, int h, const int mx, const int my,
             const int filter_type)