mediaLib Library Functions mlib_ImageFilteredSubsample(3MLIB)
NAME
mlib_ImageFilteredSubsample, mlib_ImageFilteredSubsample_Fp
- antialias filters and subsamples an image
SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ]
#include
mlib_status mlib_ImageFilteredSubsample(mlib_image *dst,
const mlib_image *src, mlib_s32 scaleX, mlib_s32 scaleY,
mlib_s32 transX, mlib_s32 transY,
const mlib_d64 *hKernel, const mlib_d64 *vKernel, mlib_s32 hSize,
mlib_s32 vSize, mlib_s32 hParity, mlib_s32 vParity, mlib_edge edge);
mlib_status mlib_ImageFilteredSubsample_Fp(mlib_image *dst,
const mlib_image *src, mlib_s32 scaleX, mlib_s32 scaleY,
mlib_s32 transX, mlib_s32 transY,
const mlib_d64 *hKernel, const mlib_d64 *vKernel, mlib_s32 hSize,
mlib_s32 vSize, mlib_s32 hParity, mlib_s32 vParity, mlib_edge edge);
DESCRIPTION
Each of the functions antialias filters and subsamples an image. The effect of one of the functions on an image is equivalent to performing convolution (filter) followed by subsampling (zoom out).The functions are similar to the mlib_ImageZoomTranslate()
and mlib_ImageZoomTranslate_Fp() functions. But they have
different definitions on scale factors and translations, hence use different coordinate mapping equations. The scaleXand scaleY used by mlib_ImageFilteredSubsample() and
mlib_ImageFilteredSubsample_Fp() are the reciprocals of the
zoomx and zoomy, respectively, used bymlib_ImageZoomTranslate() and mlib_ImageZoomTranslate_Fp().
The functions use the following equations for coordinate mapping: xS = xD*scaleX + transX yS = yD*scaleY + transY where, a point (xD, yD) in the destination image is backward mapped to a point (xS, yS) in the source image. TheSunOS 5.11 Last change: 2 Mar 2007 1
mediaLib Library Functions mlib_ImageFilteredSubsample(3MLIB)
arguments transX and transY are provided to support tiling.The subsample terms, i.e., the scale factors scaleX and sca-
leY, are restricted to positive integral values. Geometri-
cally, one destination pixel maps to scaleX by scaleY source pixels. With odd scale factors, destination pixel centersmap directly onto source pixel centers. With even scale fac-
tors, destination pixel centers map squarely between sourcepixel centers. Below are examples of even, odd, and combina-
tion cases. s s s s s s s s s s s s d d d s s s s s s s d s s d s s s s s s s s s s s s s d d d s s s s s s s s s s s s s s s s s s s d s s d s d d d s s s s s s s s s s s sEven scaleX/Y factors Odd scaleX/Y factors s s s s s s s s s s s s d d s s s s s s s d s s d s s d s s s s s s s s s s s s s d d s s s s s s s s s s s s s s s s s s s d s s d s s d s d d s s s s s s s s s s s s
Odd/even scaleX/Y factors Even/odd scaleX/Y factors where s = source pixel centers d = destination pixel centers mapped to source The applied filter is quadrant symmetric (typically
antialias + resample). The filter is product-separable, qua-
drant symmetric, and is defined by half of its span. ParitySunOS 5.11 Last change: 2 Mar 2007 2
mediaLib Library Functions mlib_ImageFilteredSubsample(3MLIB)
is used to signify whether the symmetric kernel has a double center (even parity) or a single center value (odd parity). For example, if hParity == 0 (even), the horizontal kernel is defined as:hKernel[hSize-1], ..., hKernel[0], hKernel[0], ...,
hKernel[hSize-1]
Otherwise, if hParity == 1 (odd), the horizontal kernel is defined as:hKernel[hSize-1], ..., hKernel[0], ...,
hKernel[hSize-1]
Horizontal and vertical kernels representing convolvedresample (i.e., the combined separable kernels) can be com-
puted from a convolution filter (with odd parity), a resam-
ple filter, and because the subsample factors affect resam-
ple weights, the subsample scale factors. It is the user's responsibility to provide meaningful combined kernels. To compute the value of a pixel centered at point (xD, yD) in the destination image, apply the combined kernel to the source image by aligning the kernel's geometric center to the backward mapped point (xS, yS) in the source image. In the cases that it can not be exactly on top of point (xS,yS), the kernel's center should be half-pixel right and/or
below that point. When this is done in a separable manner, the centers of horizontal and vertical kernels should align with xS and yS, respectively. The combination of subsampling and filtering has performance benefits over sequential fucntion usage in part due to thesymmetry constraints imposed by only allowing integer param-
eters for scaling and only allowing separable symmetric filters.PARAMETERS
The function takes the following arguments: dst Pointer to destination image. src Pointer to source image.SunOS 5.11 Last change: 2 Mar 2007 3
mediaLib Library Functions mlib_ImageFilteredSubsample(3MLIB)
scaleX The x scale factor of subsampling. scaleY The y scale factor of subsampling. transX The x translation. transY The y translation. hKernel Pointer to the compact form of horizontal kernel. vKernel Pointer to the compact form of vertical kernel. hSize Size of array hKernel. vSize Size of array vKernel. hParity Parity of horizontal kernel (0: even, 1: odd). vParity Parity of vertical kernel (0: even, 1: odd).edge Type of edge condition. It can be one of the fol-
lowing:MLIB_EDGE_DST_NO_WRITE
RETURN VALUES
The function returns MLIB_SUCCESS if successful. Otherwise
it returns MLIB_FAILURE.
ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:SunOS 5.11 Last change: 2 Mar 2007 4
mediaLib Library Functions mlib_ImageFilteredSubsample(3MLIB)
____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| Interface Stability | Committed ||_____________________________|_____________________________|
| MT-Level | MT-Safe |
|_____________________________|_____________________________|
SEE ALSO
mlib_ImageSubsampleAverage(3MLIB),
mlib_ImageZoomTranslate(3MLIB),
mlib_ImageZoomTranslate_Fp(3MLIB), attributes(5)
SunOS 5.11 Last change: 2 Mar 2007 5