diff options
author | Steve Lhomme <robux4@ycbcr.xyz> | 2018-09-28 14:13:44 +0300 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2018-09-28 14:13:44 +0300 |
commit | 449a81e7ba8a9622f4d928a10f1b39d5efd37f2a (patch) | |
tree | 77a4f691b4e569de892730c218a7e1ef72768757 | |
parent | 58261250109337fc1f4cb2a9330fe3aa868e9d3f (diff) |
Don't use hardcoded __attribute__((noinline))
-rw-r--r-- | include/common/attributes.h | 11 | ||||
-rw-r--r-- | src/ipred.c | 27 | ||||
-rw-r--r-- | src/itx.c | 3 | ||||
-rw-r--r-- | src/itx_1d.c | 28 | ||||
-rw-r--r-- | src/loopfilter.c | 3 | ||||
-rw-r--r-- | src/mc.c | 9 |
6 files changed, 49 insertions, 32 deletions
diff --git a/include/common/attributes.h b/include/common/attributes.h index a5347d2..78ee474 100644 --- 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> diff --git a/src/ipred.c b/src/ipred.c index c4aad35..6367797 100644 --- 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, 16) \ 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 @@ dc_lfn(width, height, 128, const unsigned dc = (1 << BITDEPTH) >> 1) 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 @@ static void v_##width##x##height##_##c(pixel *dst, const ptrdiff_t stride, \ 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 @@ static void h_##width##x##height##_c(pixel *dst, const ptrdiff_t stride, \ 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 @@ static const uint8_t sm_weight_arrays[] = { 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 @@ static void smooth_##width##x##height##_c(pixel *dst, const ptrdiff_t stride, \ 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 @@ static void smooth_v_##width##x##height##_c(pixel *dst, const ptrdiff_t stride, 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 @@ static void upsample_edge(pixel *const out, const int hsz, 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 @@ static void z1_##width##x##height##_c(pixel *dst, const ptrdiff_t stride, \ 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 @@ static void z2_##width##x##height##_c(pixel *dst, const ptrdiff_t stride, \ 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 const int8_t av1_filter_intra_taps[5][8][8] = { }, }; -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( 8, 32) 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, 8, 32, 8, 0, 0, 8) 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) @@ -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, diff --git a/src/itx_1d.c b/src/itx_1d.c index ad61cb3..c8709ef 100644 --- 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 @@ inv_dct4_1d(const coef *const in, const ptrdiff_t in_s, 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 @@ inv_dct8_1d(const coef *const in, const ptrdiff_t in_s, 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 @@ inv_dct16_1d(const coef *const in, const ptrdiff_t in_s, 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 @@ inv_dct32_1d(const coef *const in, const ptrdiff_t in_s, 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 @@ inv_dct64_1d(const coef *const in, const ptrdiff_t in_s, 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 @@ inv_adst4_1d(const coef *const in, const ptrdiff_t in_s, 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 @@ inv_adst8_1d(const coef *const in, const ptrdiff_t in_s, 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 @@ flip_inv_adst(16) #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 @@ inv_identity4_1d(const coef *const in, const ptrdiff_t in_s, 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 @@ inv_identity8_1d(const coef *const in, const ptrdiff_t in_s, 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 @@ inv_identity16_1d(const coef *const in, const ptrdiff_t in_s, 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 @@ inv_identity32_1d(const coef *const in, const ptrdiff_t in_s, 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) diff --git a/src/loopfilter.c b/src/loopfilter.c index 5574bc6..ec48c17 100644 --- 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) { @@ -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 @@ put_c(pixel *dst, const ptrdiff_t dst_stride, } 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 @@ prep_c(coef *tmp, const pixel *src, const ptrdiff_t src_stride, 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_8tap_c(pixel *dst, ptrdiff_t dst_stride, 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) |