LCOV - code coverage report
Current view: top level - tpglibs/src - AVXThresholdProcessor.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 100.0 % 12 12
Test Date: 2026-10-11 15:05:20 Functions: 100.0 % 4 4

            Line data    Source code
       1              : /**
       2              :  * @file AVXThresholdProcessor.hpp
       3              :  *
       4              :  * @copyright This is part of the DUNE DAQ Software Suite, copyright 2020.
       5              :  * Licensing/copyright details are in the COPYING file that you should have
       6              :  * received with this code.
       7              :  */
       8              : 
       9              : #include "tpglibs/AVXThresholdProcessor.hpp"
      10              : 
      11              : namespace tpglibs {
      12              : 
      13           27 : REGISTER_AVXPROCESSOR_CREATOR("AVXThresholdProcessor", AVXThresholdProcessor)
      14              : 
      15              : void
      16           15 : AVXThresholdProcessor::configure(const nlohmann::json& config, const int16_t* plane_numbers)
      17              : {
      18           15 :   int16_t thresholds[16];
      19           15 :   int16_t config_thresholds[3] = { config["plane0"], config["plane1"], config["plane2"] };
      20              : 
      21              :   // Messy. Assumes plane numbers are in {0, 1, 2}.
      22          255 :   for (int i = 0; i < 16; i++) {
      23          240 :     thresholds[i] = config_thresholds[plane_numbers[i]];
      24              :   }
      25              : 
      26           15 :   m_threshold = _mm256_lddqu_si256(reinterpret_cast<__m256i*>(thresholds));
      27           15 : }
      28              : 
      29              : __m256i
      30          787 : AVXThresholdProcessor::process(const __m256i& signal)
      31              : {
      32          787 :   __m256i mask = _mm256_cmpgt_epi16(signal, m_threshold);
      33              : 
      34              :   // Essentially: mask[i] ? signal[i] : 0.
      35          787 :   __m256i above_threshold = _mm256_blendv_epi8(_mm256_setzero_si256(), signal, mask);
      36          787 :   return AVXProcessor::process(above_threshold);
      37              : }
      38              : 
      39              : } // namespace tpglibs
        

Generated by: LCOV version 2.0-1