Framer
- class gpype.backend.flow.framer.Framer[source]
Bases:
IONodeFrame aggregation node for combining single samples into frames.
Collects individual samples (frame size = 1) and aggregates them into larger frames of a specified size. Maintains an internal buffer that accumulates samples until a complete frame is assembled, then outputs the entire frame. Useful for converting sample-by-sample streams into frame-based processing.
- __init__(frame_size=None, **kwargs)[source]
Initialize the Framer node.
- Parameters:
frame_size (
int) – Size of output frames to generate. Must be a positive integer. Defaults to 1 if None.**kwargs – Additional configuration parameters passed to IONode.
- Raises:
ValueError – If frame_size is not an integer or is less than 1.
- setup(data, port_context_in)[source]
Set up the Framer node and allocate the internal buffer.
Validates input port configuration and initializes the internal buffer based on output frame size and channel count. Input must have frame_size = 1 for proper single-sample aggregation.
- Parameters:
- Return type:
- Returns:
Output port context with updated frame size information.
- Raises:
ValueError – If input frame size is not 1.
- step(data)[source]
Process one sample and add it to the internal frame buffer.
Takes a single sample from input and stores it in the buffer. When a complete frame has been assembled (every frame_size samples), outputs the complete frame.