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: 2025-12-21 13:07:08 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           29 : REGISTER_AVXPROCESSOR_CREATOR("AVXThresholdProcessor", AVXThresholdProcessor)
      14              : 
      15           15 : void AVXThresholdProcessor::configure(const nlohmann::json& config, const int16_t* plane_numbers) {
      16           15 :   int16_t thresholds[16];
      17           15 :   int16_t config_thresholds[3] = {config["plane0"], config["plane1"], config["plane2"]};
      18              : 
      19              :   // Messy. Assumes plane numbers are in {0, 1, 2}.
      20          255 :   for (int i = 0; i < 16; i++) {
      21          240 :     thresholds[i] = config_thresholds[plane_numbers[i]];
      22              :   }
      23              : 
      24           15 :   m_threshold = _mm256_lddqu_si256(reinterpret_cast<__m256i*>(thresholds));
      25           15 : }
      26              : 
      27          787 : __m256i AVXThresholdProcessor::process(const __m256i& signal) {
      28          787 :   __m256i mask = _mm256_cmpgt_epi16(signal, m_threshold);
      29              : 
      30              :   // Essentially: mask[i] ? signal[i] : 0.
      31          787 :   __m256i above_threshold = _mm256_blendv_epi8(_mm256_setzero_si256(), signal, mask);
      32          787 :   return AVXProcessor::process(above_threshold);
      33              : }
      34              : 
      35              : } // namespace tpglibs
        

Generated by: LCOV version 2.0-1