Simple Graphics Library 1.0.0.0
Runtime-independent image processing primitives
Loading...
Searching...
No Matches
Resize

Nearest-neighbor, bilinear, and bicubic packed-image resize. More...

Functions

sgl_nearest_neighbor_lookup_t * sgl_generic_create_nearest_neighbor_lut (sgl_int32_t d_width, sgl_int32_t d_height, sgl_int32_t s_width, sgl_int32_t s_height)
 Creates a nearest-neighbor lookup table for one resize geometry.
 
sgl_bilinear_lookup_t * sgl_generic_create_bilinear_lut (sgl_int32_t d_width, sgl_int32_t d_height, sgl_int32_t s_width, sgl_int32_t s_height)
 Creates a bilinear lookup table.
 
sgl_bicubic_lookup_t * sgl_generic_create_bicubic_lut (sgl_int32_t d_width, sgl_int32_t d_height, sgl_int32_t s_width, sgl_int32_t s_height)
 Creates a bicubic lookup table.
 
void sgl_generic_destroy_nearest_neighbor_lut (sgl_nearest_neighbor_lookup_t *lut)
 Destroys a nearest-neighbor LUT.
 
void sgl_generic_destroy_bilinear_lut (sgl_bilinear_lookup_t *lut)
 Destroys a bilinear LUT.
 
void sgl_generic_destroy_bicubic_lut (sgl_bicubic_lookup_t *lut)
 Destroys a bicubic LUT.
 
sgl_result_t sgl_generic_resize_nearest (sgl_threadpool_t *pool, sgl_nearest_neighbor_lookup_t *ext_lut, sgl_uint8_t *dst, sgl_int32_t d_width, sgl_int32_t d_height, sgl_uint8_t *src, sgl_int32_t s_width, sgl_int32_t s_height, sgl_int32_t bpp)
 Resizes a packed image using nearest-neighbor sampling.
 
sgl_result_t sgl_generic_resize_bilinear (sgl_threadpool_t *pool, sgl_bilinear_lookup_t *ext_lut, sgl_uint8_t *dst, sgl_int32_t d_width, sgl_int32_t d_height, sgl_uint8_t *src, sgl_int32_t s_width, sgl_int32_t s_height, sgl_int32_t bpp)
 Resizes a packed image using bilinear interpolation.
 
sgl_result_t sgl_generic_resize_bicubic (sgl_threadpool_t *pool, sgl_bicubic_lookup_t *ext_lut, sgl_uint8_t *dst, sgl_int32_t d_width, sgl_int32_t d_height, sgl_uint8_t *src, sgl_int32_t s_width, sgl_int32_t s_height, sgl_int32_t bpp)
 Resizes a packed image using bicubic interpolation.
 
sgl_result_t sgl_simd_resize_nearest (sgl_threadpool_t *pool, sgl_nearest_neighbor_lookup_t *ext_lut, sgl_uint8_t *dst, sgl_int32_t d_width, sgl_int32_t d_height, sgl_uint8_t *src, sgl_int32_t s_width, sgl_int32_t s_height, sgl_int32_t bpp)
 SIMD nearest-neighbor resize.
 
sgl_result_t sgl_simd_resize_bilinear (sgl_threadpool_t *pool, sgl_bilinear_lookup_t *ext_lut, sgl_uint8_t *dst, sgl_int32_t d_width, sgl_int32_t d_height, sgl_uint8_t *src, sgl_int32_t s_width, sgl_int32_t s_height, sgl_int32_t bpp)
 SIMD bilinear resize.
 
sgl_result_t sgl_simd_resize_bicubic (sgl_threadpool_t *pool, sgl_bicubic_lookup_t *ext_lut, sgl_uint8_t *dst, sgl_int32_t d_width, sgl_int32_t d_height, sgl_uint8_t *src, sgl_int32_t s_width, sgl_int32_t s_height, sgl_int32_t bpp)
 SIMD bicubic resize.
 

Detailed Description

Nearest-neighbor, bilinear, and bicubic packed-image resize.

Buffers use tightly packed rows of width * bpp bytes. A SGL_NULL pool selects synchronous single-thread execution. A reusable LUT avoids geometry allocation on repeated calls with identical dimensions; a SGL_NULL or dimension-mismatched LUT causes the operation to allocate a temporary LUT.

Function Documentation

◆ sgl_generic_create_bicubic_lut()

sgl_bicubic_lookup_t * sgl_generic_create_bicubic_lut ( sgl_int32_t  d_width,
sgl_int32_t  d_height,
sgl_int32_t  s_width,
sgl_int32_t  s_height 
)

Creates a bicubic lookup table.

Parameters
[in]d_widthDestination width; must be at least 2.
[in]d_heightDestination height; must be at least 2.
[in]s_widthSource width; must be at least 2.
[in]s_heightSource height; must be at least 2.
Returns
New lookup table, or SGL_NULL when allocation fails.

◆ sgl_generic_create_bilinear_lut()

sgl_bilinear_lookup_t * sgl_generic_create_bilinear_lut ( sgl_int32_t  d_width,
sgl_int32_t  d_height,
sgl_int32_t  s_width,
sgl_int32_t  s_height 
)

Creates a bilinear lookup table.

Parameters
[in]d_widthDestination width; must be at least 2.
[in]d_heightDestination height; must be at least 2.
[in]s_widthSource width; must be at least 2.
[in]s_heightSource height; must be at least 2.
Returns
New lookup table, or SGL_NULL when allocation fails.

◆ sgl_generic_create_nearest_neighbor_lut()

sgl_nearest_neighbor_lookup_t * sgl_generic_create_nearest_neighbor_lut ( sgl_int32_t  d_width,
sgl_int32_t  d_height,
sgl_int32_t  s_width,
sgl_int32_t  s_height 
)

Creates a nearest-neighbor lookup table for one resize geometry.

Parameters
[in]d_widthDestination width; must be at least 2.
[in]d_heightDestination height; must be at least 2.
[in]s_widthSource width; must be at least 2.
[in]s_heightSource height; must be at least 2.
Returns
New lookup table, or SGL_NULL when allocation fails.

◆ sgl_generic_destroy_bicubic_lut()

void sgl_generic_destroy_bicubic_lut ( sgl_bicubic_lookup_t *  lut)

Destroys a bicubic LUT.

Parameters
[in]lutLUT or SGL_NULL.

◆ sgl_generic_destroy_bilinear_lut()

void sgl_generic_destroy_bilinear_lut ( sgl_bilinear_lookup_t *  lut)

Destroys a bilinear LUT.

Parameters
[in]lutLUT or SGL_NULL.

◆ sgl_generic_destroy_nearest_neighbor_lut()

void sgl_generic_destroy_nearest_neighbor_lut ( sgl_nearest_neighbor_lookup_t *  lut)

Destroys a nearest-neighbor LUT.

Parameters
[in]lutLUT or SGL_NULL.

◆ sgl_generic_resize_bicubic()

sgl_result_t sgl_generic_resize_bicubic ( sgl_threadpool_t *  pool,
sgl_bicubic_lookup_t *  ext_lut,
sgl_uint8_t *  dst,
sgl_int32_t  d_width,
sgl_int32_t  d_height,
sgl_uint8_t *  src,
sgl_int32_t  s_width,
sgl_int32_t  s_height,
sgl_int32_t  bpp 
)

Resizes a packed image using bicubic interpolation.

Parameters
[in]poolWorker pool, or SGL_NULL for single-thread execution.
[in]ext_lutReusable LUT for these dimensions, or SGL_NULL.
[out]dstBuffer of at least d_width * d_height * bpp bytes.
[in]d_widthDestination width in pixels.
[in]d_heightDestination height in pixels.
[in]srcBuffer of at least s_width * s_height * bpp bytes.
[in]s_widthSource width in pixels.
[in]s_heightSource height in pixels.
[in]bppPositive number of bytes per packed pixel.
Return values
SGL_SUCCESSResize completed.
SGL_ERROR_INVALID_ARGUMENTSA pointer, dimension, or bpp is invalid.
SGL_ERROR_MEMORY_ALLOCATIONTemporary work storage was unavailable.
SGL_ERROR_NOT_SUPPORTEDA non-NULL pool was supplied to a build without thread support.
Precondition
Source and destination buffers do not overlap. Dimensions are at least 2 when source and destination sizes differ.

◆ sgl_generic_resize_bilinear()

sgl_result_t sgl_generic_resize_bilinear ( sgl_threadpool_t *  pool,
sgl_bilinear_lookup_t *  ext_lut,
sgl_uint8_t *  dst,
sgl_int32_t  d_width,
sgl_int32_t  d_height,
sgl_uint8_t *  src,
sgl_int32_t  s_width,
sgl_int32_t  s_height,
sgl_int32_t  bpp 
)

Resizes a packed image using bilinear interpolation.

Parameters
[in]poolWorker pool, or SGL_NULL for single-thread execution.
[in]ext_lutReusable LUT for these dimensions, or SGL_NULL.
[out]dstBuffer of at least d_width * d_height * bpp bytes.
[in]d_widthDestination width in pixels.
[in]d_heightDestination height in pixels.
[in]srcBuffer of at least s_width * s_height * bpp bytes.
[in]s_widthSource width in pixels.
[in]s_heightSource height in pixels.
[in]bppPositive number of bytes per packed pixel.
Return values
SGL_SUCCESSResize completed.
SGL_ERROR_INVALID_ARGUMENTSA pointer, dimension, or bpp is invalid.
SGL_ERROR_MEMORY_ALLOCATIONTemporary work storage was unavailable.
SGL_ERROR_NOT_SUPPORTEDA non-NULL pool was supplied to a build without thread support.
Precondition
Source and destination buffers do not overlap. Dimensions are at least 2 when source and destination sizes differ.

◆ sgl_generic_resize_nearest()

sgl_result_t sgl_generic_resize_nearest ( sgl_threadpool_t *  pool,
sgl_nearest_neighbor_lookup_t *  ext_lut,
sgl_uint8_t *  dst,
sgl_int32_t  d_width,
sgl_int32_t  d_height,
sgl_uint8_t *  src,
sgl_int32_t  s_width,
sgl_int32_t  s_height,
sgl_int32_t  bpp 
)

Resizes a packed image using nearest-neighbor sampling.

Parameters
[in]poolWorker pool, or SGL_NULL for single-thread execution.
[in]ext_lutReusable LUT for these dimensions, or SGL_NULL.
[out]dstBuffer of at least d_width * d_height * bpp bytes.
[in]d_widthDestination width in pixels.
[in]d_heightDestination height in pixels.
[in]srcBuffer of at least s_width * s_height * bpp bytes.
[in]s_widthSource width in pixels.
[in]s_heightSource height in pixels.
[in]bppPositive number of bytes per packed pixel.
Return values
SGL_SUCCESSResize completed.
SGL_ERROR_INVALID_ARGUMENTSA pointer, dimension, or bpp is invalid.
SGL_ERROR_MEMORY_ALLOCATIONTemporary work storage was unavailable.
SGL_ERROR_NOT_SUPPORTEDA non-NULL pool was supplied to a build without thread support.
Precondition
Source and destination buffers do not overlap. Dimensions are at least 2 when source and destination sizes differ.

◆ sgl_simd_resize_bicubic()

sgl_result_t sgl_simd_resize_bicubic ( sgl_threadpool_t *  pool,
sgl_bicubic_lookup_t *  ext_lut,
sgl_uint8_t *  dst,
sgl_int32_t  d_width,
sgl_int32_t  d_height,
sgl_uint8_t *  src,
sgl_int32_t  s_width,
sgl_int32_t  s_height,
sgl_int32_t  bpp 
)

SIMD bicubic resize.

Parameters
[in]poolWorker pool, or SGL_NULL for single-thread execution.
[in]ext_lutReusable LUT for these dimensions, or SGL_NULL.
[out]dstBuffer of at least d_width * d_height * bpp bytes.
[in]d_widthDestination width in pixels.
[in]d_heightDestination height in pixels.
[in]srcBuffer of at least s_width * s_height * bpp bytes.
[in]s_widthSource width in pixels.
[in]s_heightSource height in pixels.
[in]bppPositive number of bytes per packed pixel.
Return values
SGL_SUCCESSResize completed.
SGL_ERROR_INVALID_ARGUMENTSA pointer, dimension, or bpp is invalid.
SGL_ERROR_MEMORY_ALLOCATIONTemporary work storage was unavailable.
SGL_ERROR_NOT_SUPPORTEDA non-NULL pool was supplied to a build without thread support.
Precondition
Source and destination buffers do not overlap. Dimensions are at least 2 when source and destination sizes differ.

◆ sgl_simd_resize_bilinear()

sgl_result_t sgl_simd_resize_bilinear ( sgl_threadpool_t *  pool,
sgl_bilinear_lookup_t *  ext_lut,
sgl_uint8_t *  dst,
sgl_int32_t  d_width,
sgl_int32_t  d_height,
sgl_uint8_t *  src,
sgl_int32_t  s_width,
sgl_int32_t  s_height,
sgl_int32_t  bpp 
)

SIMD bilinear resize.

Parameters
[in]poolWorker pool, or SGL_NULL for single-thread execution.
[in]ext_lutReusable LUT for these dimensions, or SGL_NULL.
[out]dstBuffer of at least d_width * d_height * bpp bytes.
[in]d_widthDestination width in pixels.
[in]d_heightDestination height in pixels.
[in]srcBuffer of at least s_width * s_height * bpp bytes.
[in]s_widthSource width in pixels.
[in]s_heightSource height in pixels.
[in]bppPositive number of bytes per packed pixel.
Return values
SGL_SUCCESSResize completed.
SGL_ERROR_INVALID_ARGUMENTSA pointer, dimension, or bpp is invalid.
SGL_ERROR_MEMORY_ALLOCATIONTemporary work storage was unavailable.
SGL_ERROR_NOT_SUPPORTEDA non-NULL pool was supplied to a build without thread support.
Precondition
Source and destination buffers do not overlap. Dimensions are at least 2 when source and destination sizes differ.

◆ sgl_simd_resize_nearest()

sgl_result_t sgl_simd_resize_nearest ( sgl_threadpool_t *  pool,
sgl_nearest_neighbor_lookup_t *  ext_lut,
sgl_uint8_t *  dst,
sgl_int32_t  d_width,
sgl_int32_t  d_height,
sgl_uint8_t *  src,
sgl_int32_t  s_width,
sgl_int32_t  s_height,
sgl_int32_t  bpp 
)

SIMD nearest-neighbor resize.

Parameters
[in]poolWorker pool, or SGL_NULL for single-thread execution.
[in]ext_lutReusable LUT for these dimensions, or SGL_NULL.
[out]dstBuffer of at least d_width * d_height * bpp bytes.
[in]d_widthDestination width in pixels.
[in]d_heightDestination height in pixels.
[in]srcBuffer of at least s_width * s_height * bpp bytes.
[in]s_widthSource width in pixels.
[in]s_heightSource height in pixels.
[in]bppPositive number of bytes per packed pixel.
Return values
SGL_SUCCESSResize completed.
SGL_ERROR_INVALID_ARGUMENTSA pointer, dimension, or bpp is invalid.
SGL_ERROR_MEMORY_ALLOCATIONTemporary work storage was unavailable.
SGL_ERROR_NOT_SUPPORTEDA non-NULL pool was supplied to a build without thread support.
Precondition
Source and destination buffers do not overlap. Dimensions are at least 2 when source and destination sizes differ.