Merge remote-tracking branch 'origin/remove-dead-code-polar' into integration_2025_w17 (!3404)
Polar: remove dead code and a wrong comment a file code duplicated and no more used a comment is wrong: uint16_t x = INFINITY; is wrong, the gcc comment is true uint16_t x= INFINITY; sets x=-32768 because it is truncature of 0x7FFFFF add SIMD for the top lines when i run polartest
This commit is contained in:
@@ -627,7 +627,7 @@ static inline void nr_polar_rate_matching_int16(int16_t *input,
|
||||
memset(output, 0, N * sizeof(*output)); // puncturing
|
||||
else { // shortening
|
||||
for (int i = 0; i <= N - 1; i++)
|
||||
output[i] = 32767; // instead of INFINITY, to prevent [-Woverflow]
|
||||
output[i] = INT16_MAX;
|
||||
}
|
||||
|
||||
for (int i = 0; i <= E - 1; i++)
|
||||
|
||||
@@ -306,14 +306,25 @@ static inline void applyGtoright(const t_nrPolar_params *pp, decoder_node_t *nod
|
||||
const int sz = 1 << (node->level - 1);
|
||||
if (node->right->all_frozen == 0) {
|
||||
if (!node->left->betaInit) {
|
||||
for (int i = 0; i < sz; i++) {
|
||||
int temp_alpha_r = alpha_v[i + sz] + alpha_v[i];
|
||||
if (temp_alpha_r > SHRT_MAX) {
|
||||
alpha_r[i] = SHRT_MAX;
|
||||
} else if (temp_alpha_r < -SHRT_MAX) {
|
||||
alpha_r[i] = -SHRT_MAX;
|
||||
} else {
|
||||
alpha_r[i] = temp_alpha_r;
|
||||
int avx2mod = sz & 15;
|
||||
if (avx2mod == 0) {
|
||||
int avx2len = sz / 16;
|
||||
for (int i = 0; i < avx2len; i++) {
|
||||
((simde__m256i *)alpha_r)[i] =
|
||||
simde_mm256_adds_epi16(((simde__m256i *)alpha_v)[i + avx2len], ((simde__m256i *)alpha_v)[i]);
|
||||
}
|
||||
} else if (avx2mod == 8) {
|
||||
((simde__m128i *)alpha_r)[0] = simde_mm_adds_epi16(((simde__m128i *)alpha_v)[1], ((simde__m128i *)alpha_v)[0]);
|
||||
} else {
|
||||
for (int i = 0; i < sz; i++) {
|
||||
int temp_alpha_r = alpha_v[i + sz] + alpha_v[i];
|
||||
if (temp_alpha_r > SHRT_MAX) {
|
||||
alpha_r[i] = SHRT_MAX;
|
||||
} else if (temp_alpha_r < -SHRT_MAX) {
|
||||
alpha_r[i] = -SHRT_MAX;
|
||||
} else {
|
||||
alpha_r[i] = temp_alpha_r;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
|
||||
|
||||
void nr_polar_rate_matching_pattern(uint16_t *rmp, uint16_t *J, const uint8_t *P_i_, uint16_t K, uint16_t N, uint16_t E)
|
||||
{
|
||||
int d[N];
|
||||
int y[N];
|
||||
|
||||
for (int m = 0; m <= N - 1; m++)
|
||||
d[m] = m;
|
||||
|
||||
for (int m = 0; m <= N - 1; m++) {
|
||||
i = floor((32 * m) / N);
|
||||
J[m] = P_i_[i] * (N / 32)) + (m % (N / 32);
|
||||
y[m] = d[J[m]];
|
||||
}
|
||||
|
||||
if (E >= N) { // repetition
|
||||
for (int k = 0; k <= E - 1; k++) {
|
||||
ind = k % N;
|
||||
rmp[k] = y[ind];
|
||||
}
|
||||
} else {
|
||||
if ((K / (double)E) <= (7.0 / 16)) { // puncturing
|
||||
for (int k = 0; k <= E - 1; k++) {
|
||||
rmp[k] = y[k + N - E];
|
||||
}
|
||||
} else { // shortening
|
||||
for (int k = 0; k <= E - 1; k++) {
|
||||
rmp[k] = y[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nr_polar_rate_matching(double *input, double *output, uint16_t *rmp, uint16_t K, uint16_t N, uint16_t E)
|
||||
{
|
||||
if (E >= N) { // repetition
|
||||
for (int i = 0; i <= N - 1; i++)
|
||||
output[i] = 0;
|
||||
for (int i = 0; i <= E - 1; i++) {
|
||||
output[rmp[i]] += input[i];
|
||||
}
|
||||
} else {
|
||||
if ((K / (double)E) <= (7.0 / 16)) { // puncturing
|
||||
for (int i = 0; i <= N - 1; i++)
|
||||
output[i] = 0;
|
||||
} else { // shortening
|
||||
for (int i = 0; i <= N - 1; i++)
|
||||
output[i] = INFINITY;
|
||||
}
|
||||
|
||||
for (int i = 0; i <= E - 1; i++) {
|
||||
output[rmp[i]] = input[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user