2#include "SinglePingIsoSurfacesTasks.h"
3#include "DepthResampleTask.h"
4#include "Platform/Instrumentation.h"
10using namespace Cogs::Core::EchoSounder;
13DepthResampleTask::DepthResampleTask(
float* valuesOut,
14 const float depthStepOut,
15 const int sampleCountOut,
16 const float* valuesIn,
17 const float depthStepIn,
18 const int sampleCountIn,
23 depthStepOut(depthStepOut),
24 sampleCountOut(sampleCountOut),
26 depthStepIn(depthStepIn),
27 sampleCountIn(sampleCountIn),
33void DepthResampleTask::operator()()
35 CpuInstrumentationScope(SCOPE_ECHOSOUNDER,
"DepthResample");
42 const auto inStepOut = depthStepOut / depthStepIn;
44 const auto Q = std::max(1, sampleCountIn) - 1;
45 for (
int b = beamBegin; b < beamEnd; b++) {
46 const auto * currIn = valuesIn + b*sampleCountIn;
47 auto * currOut = valuesOut + b*sampleCountOut;
49 float j1f = inStepOut;
50 float val0 = currIn[0];
51 for (
int i = 0; i < sampleCountOut; i++, j1f += inStepOut) {
52 int j1 = min(Q,
static_cast<int>(floor(j1f)));
54 for (
int k = j0 + 1; k + 1 < j1; k++) {
61 auto res = acc / (max(1, j1 - j0) + 1.f);