Skip to content

Commit

Permalink
Suppress compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
osamu620 committed May 27, 2022
1 parent 358a931 commit d1cd229
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 150 deletions.
2 changes: 1 addition & 1 deletion source/core/common/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static inline size_t popcount32(uintmax_t num) {
#if defined(_MSC_VER)
precision = __popcnt(static_cast<uint32_t>(num));
#elif defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86)
precision = _popcnt32(num);
precision = static_cast<size_t>(_popcnt32(num));
#elif defined(OPENHTJ2K_ENABLE_ARM_NEON)
uint32x2_t val = vld1_dup_u32(&num);
uint8_t a = vaddv_u8(vcnt_u8(vreinterpret_u8_u32(val)));
Expand Down
31 changes: 16 additions & 15 deletions source/core/transform/color_avx2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ void cvt_rgb_to_ycbcr_rev_avx2(int32_t *sp0, int32_t *sp1, int32_t *sp2, uint32_
}

void cvt_rgb_to_ycbcr_irrev_avx2(int32_t *sp0, int32_t *sp1, int32_t *sp2, uint32_t num_tc_samples) {
__m256 mALPHA_R = _mm256_set1_ps(ALPHA_R);
__m256 mALPHA_G = _mm256_set1_ps(ALPHA_G);
__m256 mALPHA_B = _mm256_set1_ps(ALPHA_B);
__m256 mCB_FACT = _mm256_set1_ps(1.0 / CB_FACT_B);
__m256 mCR_FACT = _mm256_set1_ps(1.0 / CR_FACT_R);
__m256 mALPHA_R = _mm256_set1_ps(static_cast<float>(ALPHA_R));
__m256 mALPHA_G = _mm256_set1_ps(static_cast<float>(ALPHA_G));
__m256 mALPHA_B = _mm256_set1_ps(static_cast<float>(ALPHA_B));
__m256 mCB_FACT = _mm256_set1_ps(static_cast<float>(1.0 / CB_FACT_B));
__m256 mCR_FACT = _mm256_set1_ps(static_cast<float>(1.0 / CR_FACT_R));
for (uint32_t n = 0; n < round_down(num_tc_samples, NUM_I32_VECTOR_AVX2); n += NUM_I32_VECTOR_AVX2) {
// lossy:ICT
__m256 mR = _mm256_cvtepi32_ps(*((__m256i *)(sp0 + n)));
Expand Down Expand Up @@ -120,10 +120,10 @@ void cvt_ycbcr_to_rgb_rev_avx2(int32_t *sp0, int32_t *sp1, int32_t *sp2, uint32_
}

void cvt_ycbcr_to_rgb_irrev_avx2(int32_t *sp0, int32_t *sp1, int32_t *sp2, uint32_t num_tc_samples) {
__m256 mCR_FACT_R = _mm256_set1_ps(CR_FACT_R);
__m256 mCR_FACT_G = _mm256_set1_ps(CR_FACT_G);
__m256 mCB_FACT_B = _mm256_set1_ps(CB_FACT_B);
__m256 mCB_FACT_G = _mm256_set1_ps(CB_FACT_G);
__m256 mCR_FACT_R = _mm256_set1_ps(static_cast<float>(CR_FACT_R));
__m256 mCR_FACT_G = _mm256_set1_ps(static_cast<float>(CR_FACT_G));
__m256 mCB_FACT_B = _mm256_set1_ps(static_cast<float>(CB_FACT_B));
__m256 mCB_FACT_G = _mm256_set1_ps(static_cast<float>(CB_FACT_G));
for (uint32_t n = 0; n < round_down(num_tc_samples, NUM_I32_VECTOR_AVX2); n += NUM_I32_VECTOR_AVX2) {
__m256 mY = _mm256_cvtepi32_ps(*((__m256i *)(sp0 + n)));
__m256 mCb = _mm256_cvtepi32_ps(*((__m256i *)(sp1 + n)));
Expand All @@ -138,12 +138,13 @@ void cvt_ycbcr_to_rgb_irrev_avx2(int32_t *sp0, int32_t *sp1, int32_t *sp2, uint3
int32_t R, G, B;
double fY, fCb, fCr;
for (uint32_t n = round_down(num_tc_samples, NUM_I32_VECTOR_AVX2); n < num_tc_samples; n++) {
fY = static_cast<double>(sp0[n]);
fCb = static_cast<double>(sp1[n]);
fCr = static_cast<double>(sp2[n]);
R = static_cast<int32_t>(round_d(fY + CR_FACT_R * fCr));
B = static_cast<int32_t>(round_d(fY + CB_FACT_B * fCb));
G = static_cast<int32_t>(round_d(fY - CR_FACT_G * fCr - CB_FACT_G * fCb));
fY = static_cast<double>(sp0[n]);
fCb = static_cast<double>(sp1[n]);
fCr = static_cast<double>(sp2[n]);
R = static_cast<int32_t>(round_d(fY + static_cast<float>(CR_FACT_R) * fCr));
B = static_cast<int32_t>(round_d(fY + static_cast<float>(CB_FACT_B) * fCb));
G = static_cast<int32_t>(
round_d(fY - static_cast<float>(CR_FACT_G) * fCr - static_cast<float>(CB_FACT_G) * fCb));
sp0[n] = R;
sp1[n] = G;
sp2[n] = B;
Expand Down
26 changes: 13 additions & 13 deletions source/core/transform/dwt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,16 @@ void fdwt_rev_ver_sr_fixed_neon(sprec_t *in, int32_t u0, int32_t u1, int32_t v0,
static fdwt_ver_filtr_func_fixed fdwt_ver_sr_fixed[2] = {fdwt_irrev_ver_sr_fixed_neon,
fdwt_rev_ver_sr_fixed_neon};
#elif defined(OPENHTJ2K_TRY_AVX2) && defined(__AVX2__)
void fdwt_1d_filtr_irrev97_fixed_avx2(sprec_t *X, const int32_t left, const int32_t right,
const uint32_t u_i0, const uint32_t u_i1);
void fdwt_1d_filtr_rev53_fixed_avx2(sprec_t *X, const int32_t left, const int32_t right,
const uint32_t u_i0, const uint32_t u_i1);
void fdwt_1d_filtr_irrev97_fixed_avx2(sprec_t *X, const int32_t left,
const int32_t u_i0, const int32_t u_i1);
void fdwt_1d_filtr_rev53_fixed_avx2(sprec_t *X, const int32_t left,
const int32_t u_i0, const int32_t u_i1);
static fdwt_1d_filtr_func_fixed fdwt_1d_filtr_fixed[2] = {fdwt_1d_filtr_irrev97_fixed_avx2,
fdwt_1d_filtr_rev53_fixed_avx2};
void fdwt_irrev_ver_sr_fixed_avx2(sprec_t *in, const uint32_t u0, const uint32_t u1, const uint32_t v0,
const uint32_t v1);
void fdwt_rev_ver_sr_fixed_avx2(sprec_t *in, const uint32_t u0, const uint32_t u1, const uint32_t v0,
const uint32_t v1);
void fdwt_irrev_ver_sr_fixed_avx2(sprec_t *in, const int32_t u0, const int32_t u1, const int32_t v0,
const int32_t v1);
void fdwt_rev_ver_sr_fixed_avx2(sprec_t *in, const int32_t u0, const int32_t u1, const int32_t v0,
const int32_t v1);
static fdwt_ver_filtr_func_fixed fdwt_ver_sr_fixed[2] = {fdwt_irrev_ver_sr_fixed_avx2,
fdwt_rev_ver_sr_fixed_avx2};
#else
Expand All @@ -131,13 +131,13 @@ void idwt_rev_ver_sr_fixed_neon(sprec_t *in, int32_t u0, int32_t u1, int32_t v0,
static idwt_ver_filtd_func_fixed idwt_ver_sr_fixed[2] = {idwt_irrev_ver_sr_fixed_neon,
idwt_rev_ver_sr_fixed_neon};
#elif defined(OPENHTJ2K_TRY_AVX2) && defined(__AVX2__)
void idwt_1d_filtr_rev53_fixed_avx2(sprec_t *X, int32_t left, int32_t right, uint32_t u_i0, uint32_t u_i1);
void idwt_1d_filtr_irrev97_fixed_avx2(sprec_t *X, int32_t left, int32_t right, uint32_t u_i0,
uint32_t u_i1);
void idwt_1d_filtr_rev53_fixed_avx2(sprec_t *X, int32_t left, int32_t u_i0, int32_t u_i1);
void idwt_1d_filtr_irrev97_fixed_avx2(sprec_t *X, int32_t left, int32_t u_i0,
int32_t u_i1);
static idwt_1d_filtd_func_fixed idwt_1d_filtr_fixed[2] = {idwt_1d_filtr_irrev97_fixed_avx2,
idwt_1d_filtr_rev53_fixed_avx2};
void idwt_irrev_ver_sr_fixed_avx2(sprec_t *in, uint32_t u0, uint32_t u1, uint32_t v0, uint32_t v1);
void idwt_rev_ver_sr_fixed_avx2(sprec_t *in, uint32_t u0, uint32_t u1, uint32_t v0, uint32_t v1);
void idwt_irrev_ver_sr_fixed_avx2(sprec_t *in, int32_t u0, int32_t u1, int32_t v0, int32_t v1);
void idwt_rev_ver_sr_fixed_avx2(sprec_t *in, int32_t u0, int32_t u1, int32_t v0, int32_t v1);
static idwt_ver_filtd_func_fixed idwt_ver_sr_fixed[2] = {idwt_irrev_ver_sr_fixed_avx2,
idwt_rev_ver_sr_fixed_avx2};
#else
Expand Down

0 comments on commit d1cd229

Please sign in to comment.