(8.D.2.7) BlockMedian
Overview
N-Channel Block median
Discussion
Computes the median ("middle value") for each block of data. The median computation is computed on a channel by channel basis. The module supports an arbitrary block size and number of channels. The output has a block size of 1 and the number of channels matches the number of channels of the input.
Internally, the module uses a scratch buffer and sorts each block of data. It then picks the "middle" value as the median. Let N represent the block size of the input pin. If N is odd, then the median is the sample at index [(N - 1) / 2] (assuming zero indexing). If N is even, then the median is at sample index [N/2 - 1].
Type Definition
typedef struct _ModuleBlockMedian
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
} ModuleBlockMedianClass;
Pins
Input Pins
Name: in
Description: Input signal
Data type: float
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: Output signal
Data type: float
Scratch Pins
Channel count: 1
Block size: 32
Sample rate: 48000
MATLAB Usage
File Name: block_median_module.m
M = block_median_module(NAME)
Computes the median value of a block of data. Can be configured for
block mode or streaming mode. Arguments:
NAME - name of the module.
Â