Skip to content

Commit 695271a

Browse files
committed
Add 'inline' to FORCE_INLINE for non-MSVC
Under MSVC, '__forceinline' implies 'inline', yielding some warnings when they are used together. In several other codebases I happened to have lying around, a macro similar to FORCE_INLINE always includes the 'inline' keyword, probably for the same reason.
1 parent 6e25790 commit 695271a

File tree

7 files changed

+24
-24
lines changed

7 files changed

+24
-24
lines changed

libvmaf/src/feature/adm_tools.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ static const float dwt_7_9_basis_function_amplitudes[6][4] = {
329329
* lambda = 0 (finest scale), 1, 2, 3 (coarsest scale);
330330
* theta = 0 (ll), 1 (lh - vertical), 2 (hh - diagonal), 3(hl - horizontal).
331331
*/
332-
static FORCE_INLINE inline float dwt_quant_step(const struct dwt_model_params *params,
332+
static FORCE_INLINE float dwt_quant_step(const struct dwt_model_params *params,
333333
int lambda, int theta, double adm_norm_view_dist, int adm_ref_display_height)
334334
{
335335
// Formula (1), page 1165 - display visual resolution (DVR), in pixels/degree of visual angle. This should be 56.55

libvmaf/src/feature/arm64/vif_neon.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
99
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
1010

11-
static FORCE_INLINE inline void
11+
static FORCE_INLINE void
1212
pad_top_and_bottom(VifBuffer buf, unsigned h, int fwidth)
1313
{
1414
const unsigned fwidth_half = fwidth / 2;
@@ -27,7 +27,7 @@ pad_top_and_bottom(VifBuffer buf, unsigned h, int fwidth)
2727
}
2828
}
2929

30-
static FORCE_INLINE inline void
30+
static FORCE_INLINE void
3131
decimate_and_pad(VifBuffer buf, unsigned w, unsigned h, int scale)
3232
{
3333
uint16_t *ref = buf.ref;

libvmaf/src/feature/cambi.c

+13-13
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ enum CambiTVIBisectFlag {
227227
CAMBI_TVI_BISECT_TOO_BIG
228228
};
229229

230-
static FORCE_INLINE inline int clip(int value, int low, int high) {
230+
static FORCE_INLINE int clip(int value, int low, int high) {
231231
return value < low ? low : (value > high ? high : value);
232232
}
233233

@@ -282,7 +282,7 @@ static int get_tvi_for_diff(int diff, double tvi_threshold, int bitdepth, VmafLu
282282
}
283283
}
284284

285-
static FORCE_INLINE inline void adjust_window_size(uint16_t *window_size,
285+
static FORCE_INLINE void adjust_window_size(uint16_t *window_size,
286286
unsigned input_width,
287287
unsigned input_height)
288288
{
@@ -725,7 +725,7 @@ static void filter_mode(const VmafPicture *image, int width, int height, uint16_
725725
}
726726
}
727727

728-
static FORCE_INLINE inline uint16_t ceil_log2(uint32_t num) {
728+
static FORCE_INLINE uint16_t ceil_log2(uint32_t num) {
729729
if (num==0)
730730
return 0;
731731

@@ -738,7 +738,7 @@ static FORCE_INLINE inline uint16_t ceil_log2(uint32_t num) {
738738
return shift;
739739
}
740740

741-
static FORCE_INLINE inline uint16_t get_mask_index(unsigned input_width, unsigned input_height,
741+
static FORCE_INLINE uint16_t get_mask_index(unsigned input_width, unsigned input_height,
742742
uint16_t filter_size) {
743743
uint32_t shifted_wh = (input_width >> 6) * (input_height >> 6);
744744
return (filter_size * filter_size + 3 * (ceil_log2(shifted_wh) - 11) - 1)>>1;
@@ -853,7 +853,7 @@ static float c_value_pixel(const uint16_t *histograms, uint16_t value, const int
853853
return c_value;
854854
}
855855

856-
static FORCE_INLINE inline void update_histogram_subtract_edge(uint16_t *histograms, uint16_t *image, uint16_t *mask,
856+
static FORCE_INLINE void update_histogram_subtract_edge(uint16_t *histograms, uint16_t *image, uint16_t *mask,
857857
int i, int j, int width, ptrdiff_t stride, uint16_t pad_size,
858858
const uint16_t num_diffs, VmafRangeUpdater dec_range_callback) {
859859
uint16_t mask_val = mask[(i - pad_size - 1) * stride + j];
@@ -863,7 +863,7 @@ static FORCE_INLINE inline void update_histogram_subtract_edge(uint16_t *histogr
863863
}
864864
}
865865

866-
static FORCE_INLINE inline void update_histogram_subtract(uint16_t *histograms, uint16_t *image, uint16_t *mask,
866+
static FORCE_INLINE void update_histogram_subtract(uint16_t *histograms, uint16_t *image, uint16_t *mask,
867867
int i, int j, int width, ptrdiff_t stride, uint16_t pad_size,
868868
const uint16_t num_diffs, VmafRangeUpdater dec_range_callback) {
869869
uint16_t mask_val = mask[(i - pad_size - 1) * stride + j];
@@ -873,7 +873,7 @@ static FORCE_INLINE inline void update_histogram_subtract(uint16_t *histograms,
873873
}
874874
}
875875

876-
static FORCE_INLINE inline void update_histogram_add_edge(uint16_t *histograms, uint16_t *image, uint16_t *mask,
876+
static FORCE_INLINE void update_histogram_add_edge(uint16_t *histograms, uint16_t *image, uint16_t *mask,
877877
int i, int j, int width, ptrdiff_t stride, uint16_t pad_size,
878878
const uint16_t num_diffs, VmafRangeUpdater inc_range_callback) {
879879
uint16_t mask_val = mask[(i + pad_size) * stride + j];
@@ -883,7 +883,7 @@ static FORCE_INLINE inline void update_histogram_add_edge(uint16_t *histograms,
883883
}
884884
}
885885

886-
static FORCE_INLINE inline void update_histogram_add(uint16_t *histograms, uint16_t *image, uint16_t *mask,
886+
static FORCE_INLINE void update_histogram_add(uint16_t *histograms, uint16_t *image, uint16_t *mask,
887887
int i, int j, int width, ptrdiff_t stride, uint16_t pad_size,
888888
const uint16_t num_diffs, VmafRangeUpdater inc_range_callback) {
889889
uint16_t mask_val = mask[(i + pad_size) * stride + j];
@@ -893,7 +893,7 @@ static FORCE_INLINE inline void update_histogram_add(uint16_t *histograms, uint1
893893
}
894894
}
895895

896-
static FORCE_INLINE inline void update_histogram_add_edge_first_pass(uint16_t *histograms, uint16_t *image, uint16_t *mask,
896+
static FORCE_INLINE void update_histogram_add_edge_first_pass(uint16_t *histograms, uint16_t *image, uint16_t *mask,
897897
int i, int j, int width, ptrdiff_t stride, uint16_t pad_size,
898898
const uint16_t num_diffs, VmafRangeUpdater inc_range_callback) {
899899
uint16_t mask_val = mask[i * stride + j];
@@ -903,7 +903,7 @@ static FORCE_INLINE inline void update_histogram_add_edge_first_pass(uint16_t *h
903903
}
904904
}
905905

906-
static FORCE_INLINE inline void update_histogram_add_first_pass(uint16_t *histograms, uint16_t *image, uint16_t *mask,
906+
static FORCE_INLINE void update_histogram_add_first_pass(uint16_t *histograms, uint16_t *image, uint16_t *mask,
907907
int i, int j, int width, ptrdiff_t stride, uint16_t pad_size,
908908
const uint16_t num_diffs, VmafRangeUpdater inc_range_callback) {
909909
uint16_t mask_val = mask[i * stride + j];
@@ -913,7 +913,7 @@ static FORCE_INLINE inline void update_histogram_add_first_pass(uint16_t *histog
913913
}
914914
}
915915

916-
static FORCE_INLINE inline void calculate_c_values_row(float *c_values, uint16_t *histograms, uint16_t *image,
916+
static FORCE_INLINE void calculate_c_values_row(float *c_values, uint16_t *histograms, uint16_t *image,
917917
uint16_t *mask, int row, int width, ptrdiff_t stride,
918918
const uint16_t num_diffs, const uint16_t *tvi_for_diff,
919919
const int *diff_weights, const int *all_diffs) {
@@ -1050,13 +1050,13 @@ static double spatial_pooling(float *c_values, double topk, unsigned width, unsi
10501050
return average_topk_elements(c_values, topk_num_elements);
10511051
}
10521052

1053-
static FORCE_INLINE inline uint16_t get_pixels_in_window(uint16_t window_length) {
1053+
static FORCE_INLINE uint16_t get_pixels_in_window(uint16_t window_length) {
10541054
uint16_t odd_length = 2 * (window_length >> 1) + 1;
10551055
return odd_length * odd_length;
10561056
}
10571057

10581058
// Inner product weighting scores for each scale
1059-
static FORCE_INLINE inline double weight_scores_per_scale(double *scores_per_scale, uint16_t normalization) {
1059+
static FORCE_INLINE double weight_scores_per_scale(double *scores_per_scale, uint16_t normalization) {
10601060
double score = 0.0;
10611061
for (unsigned scale = 0; scale < NUM_SCALES; scale++)
10621062
score += (scores_per_scale[scale] * g_scale_weights[scale]);

libvmaf/src/feature/common/convolution_internal.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "macros.h"
2525
#include <stdbool.h>
2626

27-
FORCE_INLINE inline float convolution_edge_s(bool horizontal, const float *filter, int filter_width, const float *src, int width, int height, int stride, int i, int j)
27+
FORCE_INLINE float convolution_edge_s(bool horizontal, const float *filter, int filter_width, const float *src, int width, int height, int stride, int i, int j)
2828
{
2929
int radius = filter_width / 2;
3030

@@ -51,7 +51,7 @@ FORCE_INLINE inline float convolution_edge_s(bool horizontal, const float *filte
5151
return accum;
5252
}
5353

54-
FORCE_INLINE inline float convolution_edge_sq_s(bool horizontal, const float *filter, int filter_width, const float *src, int width, int height, int stride, int i, int j)
54+
FORCE_INLINE float convolution_edge_sq_s(bool horizontal, const float *filter, int filter_width, const float *src, int width, int height, int stride, int i, int j)
5555
{
5656
int radius = filter_width / 2;
5757

@@ -80,7 +80,7 @@ FORCE_INLINE inline float convolution_edge_sq_s(bool horizontal, const float *fi
8080
return accum;
8181
}
8282

83-
FORCE_INLINE inline float convolution_edge_xy_s(bool horizontal, const float *filter, int filter_width, const float *src1, const float *src2, int width, int height, int stride1, int stride2, int i, int j)
83+
FORCE_INLINE float convolution_edge_xy_s(bool horizontal, const float *filter, int filter_width, const float *src1, const float *src2, int width, int height, int stride1, int stride2, int i, int j)
8484
{
8585
int radius = filter_width / 2;
8686

libvmaf/src/feature/common/macros.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#define FORCE_INLINE __forceinline
2424
#define UNUSED_FUNCTION /**/
2525
#else
26-
#define FORCE_INLINE __attribute__((always_inline))
26+
#define FORCE_INLINE __attribute__((always_inline)) inline
2727
#define UNUSED_FUNCTION __attribute__((unused))
2828
#endif
2929
#define RESTRICT __restrict

libvmaf/src/feature/integer_vif.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static const VmafOption options[] = {
7474
{ 0 }
7575
};
7676

77-
static FORCE_INLINE inline void
77+
static FORCE_INLINE void
7878
pad_top_and_bottom(VifBuffer buf, unsigned h, int fwidth)
7979
{
8080
const unsigned fwidth_half = fwidth / 2;
@@ -93,7 +93,7 @@ pad_top_and_bottom(VifBuffer buf, unsigned h, int fwidth)
9393
}
9494
}
9595

96-
static FORCE_INLINE inline void
96+
static FORCE_INLINE void
9797
decimate_and_pad(VifBuffer buf, unsigned w, unsigned h, int scale)
9898
{
9999
uint16_t *ref = buf.ref;

libvmaf/src/feature/x86/vif_avx2.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#endif
3838

3939

40-
static FORCE_INLINE inline void
40+
static FORCE_INLINE void
4141
pad_top_and_bottom(VifBuffer buf, unsigned h, int fwidth)
4242
{
4343
const unsigned fwidth_half = fwidth / 2;
@@ -56,7 +56,7 @@ pad_top_and_bottom(VifBuffer buf, unsigned h, int fwidth)
5656
}
5757
}
5858

59-
static FORCE_INLINE inline void
59+
static FORCE_INLINE void
6060
copy_and_pad(VifBuffer buf, unsigned w, unsigned h, int scale)
6161
{
6262
uint16_t *ref = buf.ref;

0 commit comments

Comments
 (0)