summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
authorJerome Jiang <jianj@google.com>2019-03-19 17:16:41 -0700
committerJerome Jiang <jianj@google.com>2019-03-19 17:49:41 -0700
commitaa04b6f9a7475e9d9457dfc5bf441faf15efc466 (patch)
tree10bb2ce356e613e4ba8c10c862c29a79323a5e58 /vp9
parent60f76593e344dcef468752b49cf79be19b5adb0d (diff)
downloadlibvpx-aa04b6f9a7475e9d9457dfc5bf441faf15efc466.tar
libvpx-aa04b6f9a7475e9d9457dfc5bf441faf15efc466.tar.gz
libvpx-aa04b6f9a7475e9d9457dfc5bf441faf15efc466.tar.bz2
libvpx-aa04b6f9a7475e9d9457dfc5bf441faf15efc466.zip
Wrap macro definition in do-while(0)
Change-Id: Id654a48d2fa40355552d7267e58461e6cc1c6998
Diffstat (limited to 'vp9')
-rw-r--r--vp9/common/vp9_common.h8
-rw-r--r--vp9/encoder/mips/msa/vp9_fdct_msa.h8
-rw-r--r--vp9/encoder/vp9_mcomp.c44
3 files changed, 30 insertions, 30 deletions
diff --git a/vp9/common/vp9_common.h b/vp9/common/vp9_common.h
index e3c5535dd..9048b515b 100644
--- a/vp9/common/vp9_common.h
+++ b/vp9/common/vp9_common.h
@@ -27,17 +27,17 @@ extern "C" {
// Only need this for fixed-size arrays, for structs just assign.
#define vp9_copy(dest, src) \
- { \
+ do { \
assert(sizeof(dest) == sizeof(src)); \
memcpy(dest, src, sizeof(src)); \
- }
+ } while (0)
// Use this for variably-sized arrays.
#define vp9_copy_array(dest, src, n) \
- { \
+ do { \
assert(sizeof(*(dest)) == sizeof(*(src))); \
memcpy(dest, src, (n) * sizeof(*(src))); \
- }
+ } while (0)
#define vp9_zero(dest) memset(&(dest), 0, sizeof(dest))
#define vp9_zero_array(dest, n) memset(dest, 0, (n) * sizeof(*(dest)))
diff --git a/vp9/encoder/mips/msa/vp9_fdct_msa.h b/vp9/encoder/mips/msa/vp9_fdct_msa.h
index fa1af2fc5..564c879fb 100644
--- a/vp9/encoder/mips/msa/vp9_fdct_msa.h
+++ b/vp9/encoder/mips/msa/vp9_fdct_msa.h
@@ -17,7 +17,7 @@
#define VP9_ADST8(in0, in1, in2, in3, in4, in5, in6, in7, out0, out1, out2, \
out3, out4, out5, out6, out7) \
- { \
+ do { \
v8i16 cnst0_m, cnst1_m, cnst2_m, cnst3_m, cnst4_m; \
v8i16 vec0_m, vec1_m, vec2_m, vec3_m, s0_m, s1_m; \
v8i16 coeff0_m = { cospi_2_64, cospi_6_64, cospi_10_64, cospi_14_64, \
@@ -77,10 +77,10 @@
out1 = -out1; \
out3 = -out3; \
out5 = -out5; \
- }
+ } while (0)
#define VP9_FADST4(in0, in1, in2, in3, out0, out1, out2, out3) \
- { \
+ do { \
v4i32 s0_m, s1_m, s2_m, s3_m, constant_m; \
v4i32 in0_r_m, in1_r_m, in2_r_m, in3_r_m; \
\
@@ -112,5 +112,5 @@
SRARI_W4_SW(in0_r_m, in1_r_m, s2_m, s3_m, DCT_CONST_BITS); \
PCKEV_H4_SH(in0_r_m, in0_r_m, in1_r_m, in1_r_m, s2_m, s2_m, s3_m, s3_m, \
out0, out1, out2, out3); \
- }
+ } while (0)
#endif // VPX_VP9_ENCODER_MIPS_MSA_VP9_FDCT_MSA_H_
diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c
index b82cbcdaa..09c5532b3 100644
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -211,7 +211,7 @@ static INLINE const uint8_t *pre(const uint8_t *buf, int stride, int r, int c) {
#endif
#define FIRST_LEVEL_CHECKS \
- { \
+ do { \
unsigned int left, right, up, down, diag; \
CHECK_BETTER(left, tr, tc - hstep); \
CHECK_BETTER(right, tr, tc + hstep); \
@@ -224,10 +224,10 @@ static INLINE const uint8_t *pre(const uint8_t *buf, int stride, int r, int c) {
case 2: CHECK_BETTER(diag, tr + hstep, tc - hstep); break; \
case 3: CHECK_BETTER(diag, tr + hstep, tc + hstep); break; \
} \
- }
+ } while (0)
#define SECOND_LEVEL_CHECKS \
- { \
+ do { \
int kr, kc; \
unsigned int second; \
if (tr != br && tc != bc) { \
@@ -256,7 +256,7 @@ static INLINE const uint8_t *pre(const uint8_t *buf, int stride, int r, int c) {
case 3: CHECK_BETTER(second, tr + kr, tc - hstep); break; \
} \
} \
- }
+ } while (0)
#define SETUP_SUBPEL_SEARCH \
const uint8_t *const z = x->plane[0].src.buf; \
@@ -946,7 +946,7 @@ static INLINE int is_mv_in(const MvLimits *mv_limits, const MV *mv) {
}
#define CHECK_BETTER \
- { \
+ do { \
if (thissad < bestsad) { \
if (use_mvcost) \
thissad += mvsad_err_cost(x, &this_mv, &fcenter_mv, sad_per_bit); \
@@ -955,7 +955,7 @@ static INLINE int is_mv_in(const MvLimits *mv_limits, const MV *mv) {
best_site = i; \
} \
} \
- }
+ } while (0)
#define MAX_PATTERN_SCALES 11
#define MAX_PATTERN_CANDIDATES 8 // max number of canddiates per scale
@@ -1056,7 +1056,7 @@ static int vp9_pattern_search(
thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
- CHECK_BETTER
+ CHECK_BETTER;
}
} else {
for (i = 0; i < num_candidates[t]; i++) {
@@ -1066,7 +1066,7 @@ static int vp9_pattern_search(
thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
- CHECK_BETTER
+ CHECK_BETTER;
}
}
if (best_site == -1) {
@@ -1098,7 +1098,7 @@ static int vp9_pattern_search(
thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
- CHECK_BETTER
+ CHECK_BETTER;
}
} else {
for (i = 0; i < num_candidates[s]; i++) {
@@ -1108,7 +1108,7 @@ static int vp9_pattern_search(
thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
- CHECK_BETTER
+ CHECK_BETTER;
}
}
@@ -1137,7 +1137,7 @@ static int vp9_pattern_search(
thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
- CHECK_BETTER
+ CHECK_BETTER;
}
} else {
for (i = 0; i < PATTERN_CANDIDATES_REF; i++) {
@@ -1149,7 +1149,7 @@ static int vp9_pattern_search(
thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
- CHECK_BETTER
+ CHECK_BETTER;
}
}
@@ -1230,7 +1230,7 @@ static int vp9_pattern_search_sad(
thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
- CHECK_BETTER
+ CHECK_BETTER;
}
} else {
for (i = 0; i < num_candidates[t]; i++) {
@@ -1240,7 +1240,7 @@ static int vp9_pattern_search_sad(
thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
- CHECK_BETTER
+ CHECK_BETTER;
}
}
if (best_site == -1) {
@@ -1272,7 +1272,7 @@ static int vp9_pattern_search_sad(
thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
- CHECK_BETTER
+ CHECK_BETTER;
}
} else {
for (i = 0; i < num_candidates[s]; i++) {
@@ -1282,7 +1282,7 @@ static int vp9_pattern_search_sad(
thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
- CHECK_BETTER
+ CHECK_BETTER;
}
}
@@ -1311,7 +1311,7 @@ static int vp9_pattern_search_sad(
thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
- CHECK_BETTER
+ CHECK_BETTER;
}
} else {
for (i = 0; i < PATTERN_CANDIDATES_REF; i++) {
@@ -1323,7 +1323,7 @@ static int vp9_pattern_search_sad(
thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
- CHECK_BETTER
+ CHECK_BETTER;
}
}
@@ -1346,7 +1346,7 @@ static int vp9_pattern_search_sad(
cost_list[i + 1] = thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
- CHECK_BETTER
+ CHECK_BETTER;
}
} else {
for (i = 0; i < num_candidates[s]; i++) {
@@ -1356,7 +1356,7 @@ static int vp9_pattern_search_sad(
cost_list[i + 1] = thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
- CHECK_BETTER
+ CHECK_BETTER;
}
}
@@ -1385,7 +1385,7 @@ static int vp9_pattern_search_sad(
cost_list[next_chkpts_indices[i] + 1] = thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
- CHECK_BETTER
+ CHECK_BETTER;
}
} else {
for (i = 0; i < PATTERN_CANDIDATES_REF; i++) {
@@ -1400,7 +1400,7 @@ static int vp9_pattern_search_sad(
cost_list[next_chkpts_indices[i] + 1] = thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
- CHECK_BETTER
+ CHECK_BETTER;
}
}