Skip to content

File det_private.h

FileList > detector > det_private.h

Go to the source code of this file

Shared internals for detector_core.c and detector2d_core.c. More...

  • #include <stdint.h>
  • #include <stdlib.h>
  • #include <string.h>

Classes

Type Name
struct det_peak_t

Public Static Functions

Type Name
int det_cmp_f32_asc (const void * a, const void * b)
float det_noise_estimate (const float * mag, size_t lo, size_t hi, float * scratch, det_noise_mode_t mode)
Aggregate |corr| over bins [lo, hi] using the selected mode.
size_t det_peak_list (const float * surf, size_t ny, size_t nx, float gate, size_t excl_rows, size_t excl_cols, uint8_t * mask, det_peak_t * out, size_t max_peaks)
The maximum of a surface, iterated with exclusion zones: every peak above a gate, strongest first, at most max_peaks of them.
size_t det_peak_scan (const float * surf, const uint8_t * mask, size_t k0, size_t k1)
One scan of det_peak_list(): the first maximum of surf over the cells[k0, k1) thatmask leaves as candidates.
void det_peak_zone (uint8_t * mask, size_t ny, size_t nx, size_t r, size_t c, size_t excl_rows, size_t excl_cols)
The exclusion zone of a pick at (r, c) , marked intomask :excl_rows either side along the rows andexcl_cols along the columns, CIRCULAR on both axes (an FFT bin axis by a circular correlation lag axis), each half-width clamped to half the axis.
dp_f32_t * det_ring_create (size_t cap_min)
size_t next_pow2 (size_t n)

Macros

Type Name
define DET_PEAK_T_DEFINED

Detailed Description

Not part of the public API. Include after the module's own header so that det_noise_mode_t is already defined via the DET_NOISE_MODE_T_DEFINED guard in detector_core.h / detector2d_core.h.

Public Static Functions Documentation

function det_cmp_f32_asc

static int det_cmp_f32_asc (
    const void * a,
    const void * b
) 

function det_noise_estimate

Aggregate |corr| over bins [lo, hi] using the selected mode.

static float det_noise_estimate (
    const float * mag,
    size_t lo,
    size_t hi,
    float * scratch,
    det_noise_mode_t mode
) 

Returns 0 if lo > hi (empty range) — the caller maps that to test_stat=0.

Parameters:

  • mag Magnitude vector (length >= hi+1).
  • lo First bin, inclusive.
  • hi Last bin, inclusive.
  • scratch Caller-allocated buffer of length >= (hi-lo+1) floats; used only for DET_NOISE_MEDIAN (avoids a heap alloc per push).
  • mode Aggregation mode.

Returns:

Aggregated noise estimate, or 0 if lo > hi.


function det_peak_list

The maximum of a surface, iterated with exclusion zones: every peak above a gate, strongest first, at most max_peaks of them.

static size_t det_peak_list (
    const float * surf,
    size_t ny,
    size_t nx,
    float gate,
    size_t excl_rows,
    size_t excl_cols,
    uint8_t * mask,
    det_peak_t * out,
    size_t max_peaks
) 

The one argmax under both detectors (docs/design/async-dsss-receiver.md §7.1, §8 (a)). Each pick is the largest unmasked cell; if it is not above gate the list ends there (the gate is eta in the surface's own units, so a second peak is another draw from the same cells against the same union bound the threshold does not change with the list). A pick's zone excl_rows either side along the rows and excl_cols along the columns, CIRCULAR on both axes, since every surface this serves is an FFT bin axis by a circular correlation lag axis is masked so the emitter just reported cannot be reported again from its own shoulders; outside the zone a second emitter has its own maximum. The zone is therefore the detector's resolution, and it is the caller's to size from the code and the dwell (one Doppler bin by one chip: the main lobe's first nulls).

mask is the caller's, ny * nx bytes, initialised by the caller: 0 for a candidate cell, non-zero for one that is never a candidate (a Doppler band the engine does not search). On return every listed peak's zone is marked as well. Nothing here allocates, and the cost is max_peaks scans of the surface plus the zones the duration rule of §5.1.

**mask may be NULL when max_peaks is 1.** The mask exists to carry a pick's zone to the next pick; with one pick there is no next, and every cell is a candidate. The call is then the classic detector's own loop one pass, one compare per cell, nothing written rather than a mask cleared over the surface and read back once per cell for a zone that is never applied. Measured (doppler#1208): the masked form at one peak cost detector2d::push 22-43%. A NULL mask with max_peaks > 1 is a caller error and lists one peak.

Parameters:

  • surf The surface, row-major ny x nx.
  • ny Its geometry.
  • gate A peak must exceed this (strictly) to be listed.
  • excl_rows Zone half-width along rows (0 = the row alone).
  • excl_cols Zone half-width along columns (0 = the column alone).
  • mask ny * nx bytes, 0 = candidate; updated in place.
  • out Receives up to max_peaks peaks, strongest first.
  • max_peaks Capacity of out.

Returns:

Peaks listed (0 when nothing exceeds the gate).


function det_peak_scan

One scan of det_peak_list(): the first maximum of surf over the cells[k0, k1) thatmask leaves as candidates.

static size_t det_peak_scan (
    const float * surf,
    const uint8_t * mask,
    size_t k0,
    size_t k1
) 

Returns the cell, or k1 when no cell in the range is a candidate. The pick is the FIRST maximum (strict >), so a caller that cuts the surface into chunks, scans each, and merges the chunks' picks in order with the same strict > makes exactly the pick one scan over the whole surface makes which is what lets the acquisition engine run the scan per tile on its pool and merge serially, bit-identical at any thread count (doppler#1243). mask may be NULL: every cell is then a candidate, and the loop is the plain argmax on purpose a four-lane unrolled form runs 4x faster in isolation but moves detector2d::push by nothing measurable (doppler#1208), so the simple one stays.


function det_peak_zone

The exclusion zone of a pick at (r, c) , marked intomask :excl_rows either side along the rows andexcl_cols along the columns, CIRCULAR on both axes (an FFT bin axis by a circular correlation lag axis), each half-width clamped to half the axis.

static void det_peak_zone (
    uint8_t * mask,
    size_t ny,
    size_t nx,
    size_t r,
    size_t c,
    size_t excl_rows,
    size_t excl_cols
) 


function det_ring_create

static dp_f32_t * det_ring_create (
    size_t cap_min
) 

function next_pow2

static size_t next_pow2 (
    size_t n
) 

Macro Definition Documentation

define DET_PEAK_T_DEFINED

#define DET_PEAK_T_DEFINED 


The documentation for this class was generated from the following file native/inc/detector/det_private.h