Expand description
§Scaling, Rotation, and Mirroring (SRM)
§Overview
The SRM engine scales, rotates, mirrors, and converts images using the pixel processing accelerator (PPA) and 2D-DMA.
§Configuration
Config selects the transformation. Input and Output describe the images.
Image buffers must meet the following requirements:
- Each buffer must contain at least
width * height * format.bytes_per_pixel()bytes for its image size. - Buffers must be entirely within internal RAM or initialized PSRAM.
- PSRAM destination addresses and buffer lengths must be multiples of 64 bytes.
PSRAM encryption and ECC configurations requiring strictly aligned memory transactions are not supported.
§Examples
§Rotating an RGB565 image
use esp_hal::ppa::srm::{Config, Input, Offset, Output, PixelFormat, Rotation, Size, Srm};
let source = [0; 17 * 4 * 2];
let mut destination = [0; 17 * 4 * 2];
let size = Size {
width: 17,
height: 4,
};
let config = Config::default().with_rotation(Rotation::Degrees90);
let mut srm = Srm::new(peripherals.PPA, peripherals.DMA2D);
srm.run(
Input {
data: &source,
size,
format: PixelFormat::Rgb565,
},
Output {
data: &mut destination,
size: config.output_size(size)?,
format: PixelFormat::Rgb565,
offset: Offset::default(),
},
config,
)?;Structs§
- Config
unstable - Configuration for a PPA SRM operation.
- Input
unstable - Source image for an SRM operation.
- Offset
unstable - Position within a destination image, in pixels.
- Output
unstable - Destination image for an SRM operation.
- Size
unstable - Image dimensions in pixels.
- Srm
unstable - PPA SRM driver.
Enums§
- Error
unstable - Errors returned by the PPA SRM operation.
- Pixel
Format unstable - Pixel formats supported by the PPA SRM operation.
- Rotation
unstable - Counterclockwise image rotation.