37 for (
int n = 0; n < numVals; ++n)
39 checkSum += std::abs(inVec1[n] - inVec2[n]);
52 template int checkData(int8_t*, int8_t*,
int);
53 template int checkData(int16_t*, int16_t*,
int);
58 for (
int n = 0; n < numVals; ++n)
60 if (std::abs(inVec1[n] & 0xFF00) - std::abs(inVec2[n] & 0xFF00)){;
61 printf(
"%d %d\n", inVec1[n] & 0xFF00, inVec2[n] & 0xFF00);
82 init_test(
"bfp_functional");
94 init_test(
"bfp_performace");
114 init_test(
"bfp_performace_ex");
118 int16_t iqWidth = get_input_parameter<int16_t>(
"iqWidth");
119 int16_t
numRBs = get_input_parameter<int16_t>(
"nRBsize");
121 std::random_device rd;
122 std::mt19937 gen(rd());
123 std::uniform_int_distribution<int16_t> randInt16(-32768, 32767);
124 std::uniform_int_distribution<int> randExpShift(0, 4);
133 for (
int m = 0; m < 18*BlockFloatCompander::k_numRB; ++m) {
134 auto shiftVal = randExpShift(gen);
135 for (
int n = 0; n < BlockFloatCompander::k_numREReal; ++n) {
136 expandedData.
dataExpanded[m*BlockFloatCompander::k_numREReal+n] = int16_t(randInt16(gen) >> shiftVal);
152 bfp_com_req.
numRBs = numRBs;
153 bfp_com_req.
len = numRBs*12*2*2;
162 bfp_decom_req.
len = ((3 * iqWidth) + 1) *
numRBs;
164 bfp_decom_req.
iqWidth = iqWidth;
167 bfp_decom_rsp.
len = 0;
181 std::random_device rd;
182 std::mt19937 gen(rd());
183 std::uniform_int_distribution<int16_t> randInt16(-32768, 32767);
184 std::uniform_int_distribution<int> randExpShift(0, 4);
189 for (
int m = 0; m < BlockFloatCompander::k_numRB; ++m)
191 auto shiftVal = randExpShift(gen);
192 for (
int n = 0; n < BlockFloatCompander::k_numREReal; ++n)
194 expandedDataInput.
dataExpanded[m*BlockFloatCompander::k_numREReal+n] = int16_t(randInt16(gen) >> shiftVal);
208 expandedDataInput.
iqWidth = 12;
216 auto totNumBytes = ((3 * compressedDataRef.
iqWidth) + 1) * BlockFloatCompander::k_numRB;
222 ASSERT_EQ(0, resSum);
230 std::random_device rd;
231 std::mt19937 gen(rd());
232 std::uniform_int_distribution<int16_t> randInt16(-32768, 32767);
233 std::uniform_int_distribution<int> randExpShift(0, 4);
238 for (
int m = 0; m < BlockFloatCompander::k_numRB; ++m)
240 auto shiftVal = randExpShift(gen);
241 for (
int n = 0; n < BlockFloatCompander::k_numREReal; ++n)
243 expandedDataInput.
dataExpanded[m*BlockFloatCompander::k_numREReal+n] = int16_t(randInt16(gen) >> shiftVal);
257 expandedDataInput.
iqWidth = 10;
265 auto totNumBytes = ((3 * compressedDataRef.
iqWidth) + 1) * BlockFloatCompander::k_numRB;
271 ASSERT_EQ(0, resSum);
281 std::random_device rd;
282 std::mt19937 gen(rd());
283 std::uniform_int_distribution<int16_t> randInt16(-32768, 32767);
284 std::uniform_int_distribution<int> randExpShift(0, 4);
289 for (
int m = 0; m < BlockFloatCompander::k_numRB; ++m)
291 auto shiftVal = randExpShift(gen);
292 for (
int n = 0; n < BlockFloatCompander::k_numREReal; ++n)
294 expandedDataInput.
dataExpanded[m*BlockFloatCompander::k_numREReal+n] = int16_t(randInt16(gen) >> shiftVal);
316 auto totNumBytes = ((3 * compressedDataRef.
iqWidth) + 1) * BlockFloatCompander::k_numRB;
322 ASSERT_EQ(0, resSum);
331 std::random_device rd;
332 std::mt19937 gen(rd());
333 std::uniform_int_distribution<int16_t> randInt16(-32768, 32767);
334 std::uniform_int_distribution<int> randExpShift(0, 4);
339 for (
int m = 0; m < BlockFloatCompander::k_numRB; ++m)
341 auto shiftVal = randExpShift(gen);
342 for (
int n = 0; n < BlockFloatCompander::k_numREReal; ++n)
344 expandedDataInput.
dataExpanded[m*BlockFloatCompander::k_numREReal+n] = int16_t(randInt16(gen) >> shiftVal);
366 auto totNumBytes = ((3 * compressedDataRef.
iqWidth) + 1) * BlockFloatCompander::k_numRB;
372 ASSERT_EQ(0, resSum);
380 std::random_device rd;
381 std::mt19937 gen(rd());
382 std::uniform_int_distribution<int16_t> randInt16(-32768, 32767);
383 std::uniform_int_distribution<int> randExpShift(0, 4);
388 for (
int m = 0; m < BlockFloatCompander::k_numRB; ++m)
390 auto shiftVal = randExpShift(gen);
391 for (
int n = 0; n < BlockFloatCompander::k_numREReal; ++n)
393 expandedDataInput.
dataExpanded[m*BlockFloatCompander::k_numREReal+n] = int16_t(randInt16(gen) >> shiftVal);
415 auto totNumBytes = ((3 * compressedDataRef.
iqWidth) + 1) * BlockFloatCompander::k_numRB;
421 ASSERT_EQ(0, resSum);
431 std::random_device rd;
432 std::mt19937 gen(rd());
433 std::uniform_int_distribution<int16_t> randInt16(-32768, 32767);
434 std::uniform_int_distribution<int> randExpShift(0, 4);
439 for (
int m = 0; m < BlockFloatCompander::k_numRB; ++m)
441 auto shiftVal = randExpShift(gen);
442 for (
int n = 0; n < BlockFloatCompander::k_numREReal; ++n)
444 expandedDataInput.
dataExpanded[m*BlockFloatCompander::k_numREReal+n] = int16_t(randInt16(gen) >> shiftVal);
466 auto totNumBytes = ((3 * compressedDataRef.
iqWidth) + 1) * BlockFloatCompander::k_numRB;
472 ASSERT_EQ(0, resSum);
484 std::random_device rd;
485 std::mt19937 gen(rd());
486 std::uniform_int_distribution<int16_t> randInt16(-32768, 32767);
487 std::uniform_int_distribution<int> randExpShift(0, 4);
492 for (
int m = 0; m < BlockFloatCompander::k_numRB; ++m)
494 auto shiftVal = randExpShift(gen);
495 for (
int n = 0; n < BlockFloatCompander::k_numREReal; ++n)
497 expandedDataInput.
dataExpanded[m*BlockFloatCompander::k_numREReal+n] = int16_t(randInt16(gen) >> shiftVal);
519 auto totNumBytes = ((3 * compressedDataRef.
iqWidth) + 1) * BlockFloatCompander::k_numRB;
525 ASSERT_EQ(0, resSum);
536 std::random_device rd;
537 std::mt19937 gen(rd());
538 std::uniform_int_distribution<int16_t> randInt16(-32768, 32767);
539 std::uniform_int_distribution<int> randExpShift(0, 4);
544 for (
int m = 0; m < BlockFloatCompander::k_numRB; ++m)
546 auto shiftVal = randExpShift(gen);
547 for (
int n = 0; n < BlockFloatCompander::k_numREReal; ++n)
549 expandedDataInput.
dataExpanded[m*BlockFloatCompander::k_numREReal+n] = int16_t(randInt16(gen) >> shiftVal);
571 auto totNumBytes = ((3 * compressedDataRef.
iqWidth) + 1) * BlockFloatCompander::k_numRB;
577 ASSERT_EQ(0, resSum);
588 std::random_device rd;
589 std::mt19937 gen(rd());
590 std::uniform_int_distribution<int16_t> randInt16(-32768, 32767);
591 std::uniform_int_distribution<int> randExpShift(0, 4);
596 for (
int m = 0; m < BlockFloatCompander::k_numRB; ++m)
598 auto shiftVal = randExpShift(gen);
599 for (
int n = 0; n < BlockFloatCompander::k_numREReal; ++n)
601 expandedDataInput.
dataExpanded[m*BlockFloatCompander::k_numREReal+n] = int16_t(randInt16(gen) >> shiftVal);
615 expandedDataInput.
iqWidth = 10;
623 auto totNumBytes = ((3 * compressedDataRef.
iqWidth) + 1) * BlockFloatCompander::k_numRB;
629 ASSERT_EQ(0, resSum);
639 std::random_device rd;
640 std::mt19937 gen(rd());
641 std::uniform_int_distribution<int16_t> randInt16(-32768, 32767);
642 std::uniform_int_distribution<int> randExpShift(0, 4);
647 for (
int m = 0; m < BlockFloatCompander::k_numRB; ++m)
649 auto shiftVal = randExpShift(gen);
650 for (
int n = 0; n < BlockFloatCompander::k_numREReal; ++n)
652 expandedDataInput.
dataExpanded[m*BlockFloatCompander::k_numREReal+n] = int16_t(randInt16(gen) >> shiftVal);
666 expandedDataInput.
iqWidth = 10;
674 auto totNumBytes = ((3 * compressedDataRef.
iqWidth) + 1) * BlockFloatCompander::k_numRB;
680 ASSERT_EQ(0, resSum);
690 std::random_device rd;
691 std::mt19937 gen(rd());
692 std::uniform_int_distribution<int16_t> randInt16(-32768, 32767);
693 std::uniform_int_distribution<int> randExpShift(0, 4);
698 for (
int m = 0; m < BlockFloatCompander::k_numRB; ++m)
700 auto shiftVal = randExpShift(gen);
701 for (
int n = 0; n < BlockFloatCompander::k_numREReal; ++n)
703 expandedDataInput.
dataExpanded[m*BlockFloatCompander::k_numREReal+n] = int16_t(randInt16(gen) >> shiftVal);
717 expandedDataInput.
iqWidth = 12;
725 auto totNumBytes = ((3 * compressedDataRef.
iqWidth) + 1) * BlockFloatCompander::k_numRB;
731 ASSERT_EQ(0, resSum);
742 std::random_device rd;
743 std::mt19937 gen(rd());
744 std::uniform_int_distribution<int16_t> randInt16(-32768, 32767);
745 std::uniform_int_distribution<int> randExpShift(0, 4);
750 for (
int m = 0; m < BlockFloatCompander::k_numRB; ++m)
752 auto shiftVal = randExpShift(gen);
753 for (
int n = 0; n < BlockFloatCompander::k_numREReal; ++n)
755 expandedDataInput.
dataExpanded[m*BlockFloatCompander::k_numREReal+n] = int16_t(randInt16(gen) >> shiftVal);
769 expandedDataInput.
iqWidth = 12;
777 auto totNumBytes = ((3 * compressedDataRef.
iqWidth) + 1) * BlockFloatCompander::k_numRB;
783 ASSERT_EQ(0, resSum);
794 int16_t iqWidth[] = {8, 9, 10, 12};
796 int16_t
numRBs[] = {16, 18, 32, 36, 48, 70, 113, 273};
804 std::random_device rd;
805 std::mt19937 gen(rd());
806 std::uniform_int_distribution<int16_t> randInt16(-32768, 32767);
807 std::uniform_int_distribution<int> randExpShift(0, 4);
813 for (
int iq_w_id = 0; iq_w_id <
sizeof(iqWidth)/
sizeof(iqWidth[0]); iq_w_id ++){
814 for (
int tc = 0; tc <
sizeof(
numRBs)/
sizeof(numRBs[0]); tc ++){
819 for (
int m = 0; m < 18*BlockFloatCompander::k_numRB; ++m) {
820 auto shiftVal = randExpShift(gen);
821 for (
int n = 0; n < BlockFloatCompander::k_numREReal; ++n) {
822 expandedData.
dataExpanded[m*BlockFloatCompander::k_numREReal+n] = int16_t(randInt16(gen) >> shiftVal);
838 bfp_com_req.
numRBs = numRBs[tc];
839 bfp_com_req.
len = numRBs[tc]*12*2*2;
841 bfp_com_req.
iqWidth = iqWidth[iq_w_id];
849 bfp_decom_req.
numRBs = numRBs[tc];
850 bfp_decom_req.
len = bfp_com_rsp.
len;
852 bfp_decom_req.
iqWidth = iqWidth[iq_w_id];
855 bfp_decom_rsp.
len = 0;
861 ASSERT_EQ(numRBs[tc]*12*2*2, bfp_decom_rsp.
len);
862 ASSERT_EQ(0, resSum);
CACHE_ALIGNED uint8_t dataCompressedDataOut[k_numSampsCompressed]
Compressed data.
CACHE_ALIGNED uint8_t loc_dataCompressedDataOut[2 *288 *BlockFloatCompander::k_numREReal]
void BlockFloatCompress_12b_AVX512(const ExpandedData &dataIn, CompressedData *dataOut)
12 bit compression
const std::string module_name
int iqWidth
Size of mantissa including sign bit.
static unsigned get_number_of_cases(const std::string &type)
int checkData(T *inVec1, T *inVec2, int numVals)
CACHE_ALIGNED int16_t loc_dataExpandedIn[288 *BlockFloatCompander::k_numREReal]
int xranlib_decompress_avx512(const struct xranlib_decompress_request *request, struct xranlib_decompress_response *response)
Request structure containing pointer to data and its length.
External API for compading with the use BFP algorithm.
int iqWidth
Size of mantissa including sign bit.
CACHE_ALIGNED int16_t loc_dataExpandedRes[288 *BlockFloatCompander::k_numREReal]
void BlockFloatCompress_9b_AVX512(const ExpandedData &dataIn, CompressedData *dataOut)
9 bit compression
void BlockFloatCompress_10b_AVX512(const ExpandedData &dataIn, CompressedData *dataOut)
10 bit compression
void BlockFloatExpand_8b_AVX512(const CompressedData &dataIn, ExpandedData *dataOut)
8 bit expansion
INSTANTIATE_TEST_CASE_P(UnitTest, BfpCheck, testing::ValuesIn(get_sequence(BfpCheck::get_number_of_cases("bfp_functional"))))
Request structure containing pointer to data and its length.
int xranlib_compress_avx512(const struct xranlib_compress_request *request, struct xranlib_compress_response *response)
TEST_P(BfpCheck, AVX512_12bit)
void BlockFloatExpand_9b_AVX512(const CompressedData &dataIn, ExpandedData *dataOut)
9 bit expansion
Response structure containing pointer to data and its length.
This file provides public interface to xRAN Front Haul layer implementation as defined in the ORAN-WG...
int checkDataApprox(int16_t *inVec1, int16_t *inVec2, int numVals)
void BlockFloatExpand_12b_AVX512(const CompressedData &dataIn, ExpandedData *dataOut)
12 bit expansion
CACHE_ALIGNED uint8_t * dataCompressed
void BlockFloatExpand_10b_AVX512(const CompressedData &dataIn, ExpandedData *dataOut)
10 bit expansion
void BlockFloatCompress_8b_AVX512(const ExpandedData &dataIn, CompressedData *dataOut)
8 bit compression
CACHE_ALIGNED int16_t dataExpandedIn[k_numSampsExpanded]
Expanded data or input data to compressor.
CACHE_ALIGNED int16_t * dataExpanded
std::vector< unsigned > get_sequence(const unsigned number)
For a given number return sequence of number from 0 to number - 1.
void BlockFloatCompress_Basic(const ExpandedData &dataIn, CompressedData *dataOut)
Reference compression.
Response structure containing pointer to data and its length.
void BlockFloatExpand_Basic(const CompressedData &dataIn, ExpandedData *dataOut)
Reference expansion.