Nearest-neighbor rotation into a caller-owned bounding-box buffer.
More...
|
| sgl_result_t | sgl_get_rotated_dimensions (sgl_int32_t src_width, sgl_int32_t src_height, sgl_float64_t angle, sgl_int32_t *dst_width, sgl_int32_t *dst_height) |
| | Calculates the destination bounding-box dimensions for a rotation.
|
| |
| sgl_int32_t | sgl_get_rotated_size (sgl_int32_t src_width, sgl_int32_t src_height, sgl_int32_t bpp, sgl_float64_t angle) |
| | Calculates the required destination buffer size for a rotation.
|
| |
| sgl_rotate_lookup_t * | sgl_generic_create_rotate_lut (sgl_int32_t src_width, sgl_int32_t src_height, sgl_float64_t angle) |
| | Creates a reusable rotation mapping table.
|
| |
| void | sgl_generic_destroy_rotate_lut (sgl_rotate_lookup_t *lut) |
| | Destroys a rotation LUT.
|
| |
| sgl_result_t | sgl_generic_rotate (sgl_threadpool_t *pool, sgl_rotate_lookup_t *ext_lut, const sgl_uint8_t *src, sgl_int32_t src_width, sgl_int32_t src_height, sgl_uint8_t *dst, sgl_int32_t bpp, sgl_float64_t angle) |
| | Rotates a tightly packed image using nearest-neighbor sampling.
|
| |
| sgl_result_t | sgl_simd_rotate (sgl_threadpool_t *pool, sgl_rotate_lookup_t *ext_lut, const sgl_uint8_t *src, sgl_int32_t src_width, sgl_int32_t src_height, sgl_uint8_t *dst, sgl_int32_t bpp, sgl_float64_t angle) |
| | SIMD rotation implementation.
|
| |
Nearest-neighbor rotation into a caller-owned bounding-box buffer.
Angles are clockwise degrees and are normalized modulo 360. Pixels in the destination bounding box that map outside the source are filled with zero.
◆ sgl_generic_create_rotate_lut()
Creates a reusable rotation mapping table.
- Parameters
-
| [in] | src_width | Positive source width in pixels. |
| [in] | src_height | Positive source height in pixels. |
| [in] | angle | Clockwise rotation angle in degrees. |
- Returns
- New LUT, or SGL_NULL for invalid geometry or allocation failure.
- Note
- A LUT is independent of
bpp and is valid only for the exact source dimensions and normalized angle used during creation.
◆ sgl_generic_destroy_rotate_lut()
Destroys a rotation LUT.
- Parameters
-
◆ sgl_generic_rotate()
Rotates a tightly packed image using nearest-neighbor sampling.
- Parameters
-
| [in] | pool | Worker pool, or SGL_NULL for single-thread execution. |
| [in] | ext_lut | Matching reusable rotation LUT, or SGL_NULL. |
| [in] | src | Buffer of at least src_width * src_height * bpp bytes. |
| [in] | src_width | Positive source width in pixels. |
| [in] | src_height | Positive source height in pixels. |
| [out] | dst | Caller-owned buffer sized by sgl_get_rotated_size(). |
| [in] | bpp | Positive number of bytes per packed pixel. |
| [in] | angle | Clockwise rotation angle in degrees. |
- Return values
-
| SGL_SUCCESS | Rotation completed. |
| SGL_ERROR_INVALID_ARGUMENTS | Invalid input or a LUT created for different geometry. |
| SGL_ERROR_MEMORY_ALLOCATION | Parallel work storage was unavailable. |
- Precondition
- Source and destination buffers do not overlap.
◆ sgl_get_rotated_dimensions()
Calculates the destination bounding-box dimensions for a rotation.
- Parameters
-
| [in] | src_width | Positive source width in pixels. |
| [in] | src_height | Positive source height in pixels. |
| [in] | angle | Clockwise rotation angle in degrees. |
| [out] | dst_width | Calculated destination width. |
| [out] | dst_height | Calculated destination height. |
- Return values
-
| SGL_SUCCESS | Dimensions calculated successfully. |
| SGL_ERROR_INVALID_ARGUMENTS | Invalid dimensions, output pointer, NaN, unsupported angle magnitude, or overflowing result. |
◆ sgl_get_rotated_size()
Calculates the required destination buffer size for a rotation.
- Parameters
-
| [in] | src_width | Positive source width in pixels. |
| [in] | src_height | Positive source height in pixels. |
| [in] | bpp | Positive number of bytes per packed pixel. |
| [in] | angle | Clockwise rotation angle in degrees. |
- Returns
- Required byte count, or 0 for invalid or overflowing input.
◆ sgl_simd_rotate()
SIMD rotation implementation.
- Parameters
-
| [in] | pool | Worker pool, or SGL_NULL for single-thread execution. |
| [in] | ext_lut | Matching reusable rotation LUT, or SGL_NULL. |
| [in] | src | Buffer of at least src_width * src_height * bpp bytes. |
| [in] | src_width | Positive source width in pixels. |
| [in] | src_height | Positive source height in pixels. |
| [out] | dst | Caller-owned buffer sized by sgl_get_rotated_size(). |
| [in] | bpp | Positive number of bytes per packed pixel. |
| [in] | angle | Clockwise rotation angle in degrees. |
- Return values
-
| SGL_SUCCESS | Rotation completed. |
| SGL_ERROR_INVALID_ARGUMENTS | Invalid input or a LUT created for different geometry. |
| SGL_ERROR_MEMORY_ALLOCATION | Parallel work storage was unavailable. |
- Precondition
- Source and destination buffers do not overlap.