Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for unnecessary sample division by 10 #173

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions include/fdreadoutlibs/wibeth/tpg/ProcessStandardRSAVX2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,17 @@ process_window_standard_rs_avx2(ProcessingInfo<NREGISTERS>& info)


//--------------------------------------------------------------
// Absolute Running Sum
// Standard Running Sum
//--------------------------------------------------------------

// Naive: RS = (R_factor * RS) + std::abs(filt)/scale;
// Naive: RS = (R_factor * RS) + sample;

// Instead of using floats in the calcualation of the RS we multiply by 10 and
// do operations on the integers. In the end we divide by 10.

__m256i first_part = _mm256_mullo_epi16(RS, R_factor);
//__m256i first_part_div = _mm256_div_epi16(RS, 10);
__m256i first_part = swtpg_wibeth::_mm256_div_epi16(_mm256_mullo_epi16(RS, R_factor), 10);

//__m256i second_part = s;
//__m256i second_part_div = _mm256_div_epi16(_mm256_abs_epi16(s), 10);

//RS = _mm256_div_epi16(_mm256_add_epi16(first_part, second_part), 10);
RS = swtpg_wibeth::_mm256_div_epi16(_mm256_add_epi16(first_part, s), 10);
RS = _mm256_add_epi16(first_part, s);

//printf("first_part:\t\t\t\t"); print256_as16_dec(first_part); printf("\n");
//printf("second_part:\t\t\t\t"); print256_as16_dec(second_part); printf("\n");
Expand Down