Cosmetic changes of inv_txfm ssse3/avx2
Cosmetic changes of inv_txfm to address comments from
https://aomedia-review.googlesource.com/c/aom/+/50801
and https://aomedia-review.googlesource.com/c/aom/+/51041
Change-Id: Ida607849c6a20150c19f1cd7a1a8e239a0988db0
diff --git a/av1/common/x86/av1_inv_txfm_avx2.c b/av1/common/x86/av1_inv_txfm_avx2.c
index 899d068..5526fc4 100644
--- a/av1/common/x86/av1_inv_txfm_avx2.c
+++ b/av1/common/x86/av1_inv_txfm_avx2.c
@@ -874,7 +874,7 @@
const __m256i scale_rounding = _mm256_unpacklo_epi16(scale, rounding);
if (rect_type != 1 && rect_type != -1) {
for (int i = 0; i < height; ++i) {
- __m256i src = load_32bit_to_16bit_w16_avx2(input_row);
+ const __m256i src = load_32bit_to_16bit_w16_avx2(input_row);
input_row += stride;
__m256i lo = _mm256_unpacklo_epi16(src, one);
__m256i hi = _mm256_unpackhi_epi16(src, one);
@@ -921,7 +921,7 @@
hi = _mm256_add_epi32(hi, shift_rounding);
lo = _mm256_srai_epi32(lo, -shift);
hi = _mm256_srai_epi32(hi, -shift);
- __m256i x = _mm256_packs_epi32(lo, hi);
+ const __m256i x = _mm256_packs_epi32(lo, hi);
write_recon_w16_avx2(x, output);
output += stride;
}
diff --git a/av1/common/x86/av1_inv_txfm_ssse3.c b/av1/common/x86/av1_inv_txfm_ssse3.c
index b007ecc..50e7ed9 100644
--- a/av1/common/x86/av1_inv_txfm_ssse3.c
+++ b/av1/common/x86/av1_inv_txfm_ssse3.c
@@ -15,6 +15,8 @@
#include "av1/common/x86/av1_inv_txfm_ssse3.h"
#include "av1/common/x86/av1_txfm_sse2.h"
+// TODO(binpengsmail@gmail.com): replace some for loop with do {} while
+
DECLARE_ALIGNED(16, static const int16_t, av1_eob_to_eobxy_8x8_default[8]) = {
0x0707, 0x0707, 0x0707, 0x0707, 0x0707, 0x0707, 0x0707, 0x0707,
};
@@ -2429,7 +2431,7 @@
const __m128i scale_rounding = _mm_unpacklo_epi16(scale, rounding);
if (rect_type != 1 && rect_type != -1) {
for (int i = 0; i < height; ++i) {
- __m128i src = load_32bit_to_16bit(input_row);
+ const __m128i src = load_32bit_to_16bit(input_row);
input_row += stride;
__m128i lo = _mm_unpacklo_epi16(src, one);
__m128i hi = _mm_unpackhi_epi16(src, one);
@@ -2481,7 +2483,7 @@
const __m128i pred = _mm_loadl_epi64((__m128i const *)(output));
x = _mm_adds_epi16(x, _mm_unpacklo_epi8(pred, zero));
- __m128i u = _mm_packus_epi16(x, x);
+ const __m128i u = _mm_packus_epi16(x, x);
_mm_storel_epi64((__m128i *)(output), u);
output += stride;
}
@@ -2500,7 +2502,7 @@
const int rect_type = get_rect_tx_log_ratio(txfm_size_col, txfm_size_row);
__m128i buf[32];
- for (int i = 0; i<input_stride>> 3; ++i) {
+ for (int i = 0; i < (input_stride >> 3); ++i) {
iidentity_row_8xn_ssse3(buf, input + 8 * i, input_stride, shift[0], row_max,
txw_idx, rect_type);
iidentity_col_8xn_ssse3(output + 8 * i, stride, buf, shift[1], row_max,
@@ -2678,7 +2680,7 @@
eob -= 1;
const int txfm_size_col = tx_size_wide[tx_size];
const int eobx_max = AOMMIN(32, txfm_size_col) - 1;
- *eobx = eob >= eobx_max ? eobx_max : eob_fill[eob];
+ *eobx = (eob >= eobx_max) ? eobx_max : eob_fill[eob];
const int temp_eoby = eob / (eobx_max + 1);
assert(temp_eoby < 32);
*eoby = eob_fill[temp_eoby];
@@ -2732,8 +2734,8 @@
eob -= 1;
const int txfm_size_row = tx_size_high[tx_size];
const int eoby_max = AOMMIN(32, txfm_size_row) - 1;
- *eobx = (eob) / (eoby_max + 1);
- *eoby = eob >= eoby_max ? eoby_max : eob_fill[eob];
+ *eobx = eob / (eoby_max + 1);
+ *eoby = (eob >= eoby_max) ? eoby_max : eob_fill[eob];
}
static INLINE void lowbd_inv_txfm2d_add_v_identity_ssse3(
diff --git a/av1/common/x86/av1_inv_txfm_ssse3.h b/av1/common/x86/av1_inv_txfm_ssse3.h
index ccdb006..af72ab8 100644
--- a/av1/common/x86/av1_inv_txfm_ssse3.h
+++ b/av1/common/x86/av1_inv_txfm_ssse3.h
@@ -20,6 +20,10 @@
#include "aom_dsp/x86/transpose_sse2.h"
#include "aom_dsp/x86/txfm_common_sse2.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define btf_16_ssse3(w0, w1, in, out0, out1) \
do { \
const __m128i _w0 = _mm_set1_epi16(w0 * 8); \
@@ -53,10 +57,6 @@
out1 = _mm_subs_epi16(_in0, _in1); \
} while (0)
-#ifdef __cplusplus
-extern "C" {
-#endif
-
static INLINE void round_shift_16bit_ssse3(__m128i *in, int size, int bit) {
if (bit < 0) {
const __m128i scale = _mm_set1_epi16(1 << (15 + bit));
@@ -104,7 +104,7 @@
int stride, TX_TYPE tx_type,
TX_SIZE tx_size, int eob);
#ifdef __cplusplus
-}
+} // extern "C"
#endif
#endif // AV1_COMMON_X86_AV1_INV_TXFM_SSSE3_H_