Leptonica  1.83.1
Image processing and image analysis suite
scale1.c File Reference
#include <string.h>
#include "allheaders.h"

Go to the source code of this file.

Macros

#define DEBUG_OVERFLOW   0
 
#define DEBUG_UNROLLING   0
 

Functions

static void scaleColorLILow (l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 wpls)
 
static void scaleGrayLILow (l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 wpls)
 
static void scaleColor2xLILow (l_uint32 *datad, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 wpls)
 
static void scaleColor2xLILineLow (l_uint32 *lined, l_int32 wpld, l_uint32 *lines, l_int32 ws, l_int32 wpls, l_int32 lastlineflag)
 
static void scaleGray2xLILow (l_uint32 *datad, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 wpls)
 
static void scaleGray2xLILineLow (l_uint32 *lined, l_int32 wpld, l_uint32 *lines, l_int32 ws, l_int32 wpls, l_int32 lastlineflag)
 
static void scaleGray4xLILow (l_uint32 *datad, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 wpls)
 
static void scaleGray4xLILineLow (l_uint32 *lined, l_int32 wpld, l_uint32 *lines, l_int32 ws, l_int32 wpls, l_int32 lastlineflag)
 
static l_int32 scaleBySamplingLow (l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 d, l_int32 wpls)
 
static l_int32 scaleSmoothLow (l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 d, l_int32 wpls, l_int32 size)
 
static void scaleRGBToGray2Low (l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_float32 rwt, l_float32 gwt, l_float32 bwt)
 
static void scaleColorAreaMapLow (l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 wpls)
 
static void scaleGrayAreaMapLow (l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 wpls)
 
static void scaleAreaMapLow2 (l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 d, l_int32 wpls)
 
static l_int32 scaleBinaryLow (l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 wpls)
 
PIXpixScale (PIX *pixs, l_float32 scalex, l_float32 scaley)
 
PIXpixScaleToSizeRel (PIX *pixs, l_int32 delw, l_int32 delh)
 
PIXpixScaleToSize (PIX *pixs, l_int32 wd, l_int32 hd)
 
PIXpixScaleToResolution (PIX *pixs, l_float32 target, l_float32 assumed, l_float32 *pscalefact)
 
PIXpixScaleGeneral (PIX *pixs, l_float32 scalex, l_float32 scaley, l_float32 sharpfract, l_int32 sharpwidth)
 
PIXpixScaleLI (PIX *pixs, l_float32 scalex, l_float32 scaley)
 
PIXpixScaleColorLI (PIX *pixs, l_float32 scalex, l_float32 scaley)
 
PIXpixScaleColor2xLI (PIX *pixs)
 
PIXpixScaleColor4xLI (PIX *pixs)
 
PIXpixScaleGrayLI (PIX *pixs, l_float32 scalex, l_float32 scaley)
 
PIXpixScaleGray2xLI (PIX *pixs)
 
PIXpixScaleGray4xLI (PIX *pixs)
 
PIXpixScaleGray2xLIThresh (PIX *pixs, l_int32 thresh)
 
PIXpixScaleGray2xLIDither (PIX *pixs)
 
PIXpixScaleGray4xLIThresh (PIX *pixs, l_int32 thresh)
 
PIXpixScaleGray4xLIDither (PIX *pixs)
 
PIXpixScaleBySampling (PIX *pixs, l_float32 scalex, l_float32 scaley)
 
PIXpixScaleBySamplingToSize (PIX *pixs, l_int32 wd, l_int32 hd)
 
PIXpixScaleByIntSampling (PIX *pixs, l_int32 factor)
 
PIXpixScaleRGBToGrayFast (PIX *pixs, l_int32 factor, l_int32 color)
 
PIXpixScaleRGBToBinaryFast (PIX *pixs, l_int32 factor, l_int32 thresh)
 
PIXpixScaleGrayToBinaryFast (PIX *pixs, l_int32 factor, l_int32 thresh)
 
PIXpixScaleSmooth (PIX *pix, l_float32 scalex, l_float32 scaley)
 
PIXpixScaleSmoothToSize (PIX *pixs, l_int32 wd, l_int32 hd)
 
PIXpixScaleRGBToGray2 (PIX *pixs, l_float32 rwt, l_float32 gwt, l_float32 bwt)
 
PIXpixScaleAreaMap (PIX *pix, l_float32 scalex, l_float32 scaley)
 
PIXpixScaleAreaMap2 (PIX *pix)
 
PIXpixScaleAreaMapToSize (PIX *pixs, l_int32 wd, l_int32 hd)
 
PIXpixScaleBinary (PIX *pixs, l_float32 scalex, l_float32 scaley)
 

Detailed Description

        Top-level scaling
              PIX      *pixScale()
              PIX      *pixScaleToSizeRel()
              PIX      *pixScaleToSize()
              PIX      *pixScaleToResolution()
              PIX      *pixScaleGeneral()

        Linearly interpreted (usually up-) scaling
              PIX      *pixScaleLI()
              PIX      *pixScaleColorLI()
              PIX      *pixScaleColor2xLI()
              PIX      *pixScaleColor4xLI()
              PIX      *pixScaleGrayLI()
              PIX      *pixScaleGray2xLI()
              PIX      *pixScaleGray4xLI()

        Upscale 2x followed by binarization
              PIX      *pixScaleGray2xLIThresh()
              PIX      *pixScaleGray2xLIDither()

        Upscale 4x followed by binarization
              PIX      *pixScaleGray4xLIThresh()
              PIX      *pixScaleGray4xLIDither()

        Scaling by closest pixel sampling
              PIX      *pixScaleBySampling()
              PIX      *pixScaleBySamplingToSize()
              PIX      *pixScaleByIntSampling()

        Fast integer factor subsampling RGB to gray and to binary
              PIX      *pixScaleRGBToGrayFast()
              PIX      *pixScaleRGBToBinaryFast()
              PIX      *pixScaleGrayToBinaryFast()

        Downscaling with (antialias) smoothing
              PIX      *pixScaleSmooth()
              PIX      *pixScaleSmoothToSize()
              PIX      *pixScaleRGBToGray2()   [special 2x reduction to gray]

        Downscaling with (antialias) area mapping
              PIX      *pixScaleAreaMap()
              PIX      *pixScaleAreaMap2()
              PIX      *pixScaleAreaMapToSize()

        Binary scaling by closest pixel sampling
              PIX      *pixScaleBinary()

    Low-level static functions:

        Color (interpolated) scaling: general case
              static void       scaleColorLILow()

        Grayscale (interpolated) scaling: general case
              static void       scaleGrayLILow()

        Color (interpolated) scaling: 2x upscaling
              static void       scaleColor2xLILow()
              static void       scaleColor2xLILineLow()

        Grayscale (interpolated) scaling: 2x upscaling
              static void       scaleGray2xLILow()
              static void       scaleGray2xLILineLow()

        Grayscale (interpolated) scaling: 4x upscaling
              static void       scaleGray4xLILow()
              static void       scaleGray4xLILineLow()

        Grayscale and color scaling by closest pixel sampling
              static l_int32    scaleBySamplingLow()

        Color and grayscale downsampling with (antialias) lowpass filter
              static l_int32    scaleSmoothLow()
              static void       scaleRGBToGray2Low()

        Color and grayscale downsampling with (antialias) area mapping
              static l_int32    scaleColorAreaMapLow()
              static l_int32    scaleGrayAreaMapLow()
              static l_int32    scaleAreaMapLow2()

        Binary scaling by closest pixel sampling
              static l_int32    scaleBinaryLow()

Definition in file scale1.c.

Function Documentation

◆ pixScale()

PIX* pixScale ( PIX pixs,
l_float32  scalex,
l_float32  scaley 
)

pixScale()

Parameters
[in]pixs1, 2, 4, 8, 16 and 32 bpp
[in]scalex,scaley
Returns
pixd, or NULL on error

This function scales 32 bpp RGB; 2, 4 or 8 bpp palette color; 2, 4, 8 or 16 bpp gray; and binary images.

When the input has palette color, the colormap is removed and the result is either 8 bpp gray or 32 bpp RGB, depending on whether the colormap has color entries. Images with 2, 4 or 16 bpp are converted to 8 bpp.

Because pixScale is meant to be a very simple interface to a number of scaling functions, including the use of unsharp masking, the type of scaling and the sharpening parameters are chosen by default. Grayscale and color images are scaled using one of five methods, depending on the scale factors:

  1. antialiased subsampling (lowpass filtering followed by subsampling, implemented by convolution, for tiny scale factors: min(scalex, scaley) < 0.02.
  2. antialiased subsampling (implemented by area mapping, for small scale factors: max(scalex, scaley) < 0.2 and min(scalex, scaley) >= 0.02.
  3. antialiased subsampling with sharpening, for scale factors between 0.2 and 0.7
  4. linear interpolation with sharpening, for scale factors between 0.7 and 1.4
  5. linear interpolation without sharpening, for scale factors >= 1.4.

One could use subsampling for scale factors very close to 1.0, because it preserves sharp edges. Linear interpolation blurs edges because the dest pixels will typically straddle two src edge pixels. Subsmpling removes entire columns and rows, so the edge is not blurred. However, there are two reasons for not doing this. First, it moves edges, so that a straight line at a large angle to both horizontal and vertical will have noticeable kinks where horizontal and vertical rasters are removed. Second, although it is very fast, you get good results on sharp edges by applying a sharpening filter.

For images with sharp edges, sharpening substantially improves the image quality for scale factors between about 0.2 and about 2.0. pixScale uses a small amount of sharpening by default because it strengthens edge pixels that are weak due to anti-aliasing. The default sharpening factors are:

  • for scaling factors < 0.7: sharpfract = 0.2 sharpwidth = 1
  • for scaling factors >= 0.7: sharpfract = 0.4 sharpwidth = 2 The cases where the sharpening halfwidth is 1 or 2 have special implementations and are about twice as fast as the general case.

However, sharpening is computationally expensive, and one needs to consider the speed-quality tradeoff:

  • For upscaling of RGB images, linear interpolation plus default sharpening is about 5 times slower than upscaling alone.
  • For downscaling, area mapping plus default sharpening is about 10 times slower than downscaling alone. When the scale factor is larger than 1.4, the cost of sharpening, which is proportional to image area, is very large compared to the incremental quality improvement, so we cut off the default use of sharpening at 1.4. Thus, for scale factors greater than 1.4, pixScale only does linear interpolation.

In many situations you will get a satisfactory result by scaling without sharpening: call pixScaleGeneral with sharpfract = 0.0. Alternatively, if you wish to sharpen but not use the default value, first call pixScaleGeneral with sharpfract = 0.0, and then sharpen explicitly using pixUnsharpMasking.

Binary images are scaled to binary by sampling the closest pixel, without any low-pass filtering averaging of neighboring pixels. This will introduce aliasing for reductions. Aliasing can be prevented by using pixScaleToGray instead.

Definition at line 250 of file scale1.c.

References pixScaleGeneral().

Referenced by pixaConvertToPdfData(), pixaDisplayPairTiledInColumns(), pixaDisplayTiledAndScaled(), pixaDisplayTiledInColumns(), pixaDisplayTiledInRows(), pixAffineSequential(), pixaScale(), pixaSplitIntoFiles(), pixDecideIfTable(), pixScaleToSize(), recogShowPath(), and saConvertFilesToPdfData().

◆ pixScaleAreaMap()

PIX* pixScaleAreaMap ( PIX pix,
l_float32  scalex,
l_float32  scaley 
)

pixScaleAreaMap()

Parameters
[in]pix2, 4, 8 or 32 bpp; and 2, 4, 8 bpp with colormap
[in]scalexmust be < 0.7; minimum is 0.02
[in]scaleymust be < 0.7; minimum is 0.02
Returns
pixd, or NULL on error
Notes:
     (1) This is a low-pass filter that averages over fractional pixels.
         It should only be used when the scale factors are less than 0.7.
         If either scale factor is greater than or equal to 0.7, we
         issue a warning and call pixScaleGeneral(), which will invoke
         linear interpolation without sharpening.
     (2) The minimum scale factor allowed for area mapping reduction
         is 0.02.  Various overflows will occur when scale factors are
         less than about 1/256.  If a scale factor smaller than 0.02
         is given, we use pixScaleSmooth(), which is a low-pass filter
         that averages over entire pixels.
     (3) This works only on 2, 4, 8 and 32 bpp images.  If there is
         a colormap, it is removed by converting to RGB.  In other
         cases, we issue a warning and call pixScaleGeneral().
     (4) This is faster than pixScale() because it does not do sharpening.
     (5) It does a relatively expensive area mapping computation, to
         avoid antialiasing.  It is about 2x slower than pixScaleSmooth(),
         but the results are much better on fine text.
     (6) pixScaleAreaMap2() is typically about 7x faster for the special
         case of 2x reduction for color images, and about 9x faster
         for grayscale images.  Surprisingly, the improvement in speed
         when using a cascade of 2x reductions for small scale factors is
         less than one might expect, and in most situations gives
         poorer image quality.  But see (6).
     (7) For reductions between 0.35 and 0.5, a 2x area map reduction
         followed by using pixScaleGeneral() on a 2x larger scalefactor
         (which further reduces the image size using bilinear interpolation)
         would give a significant speed increase, with little loss of
         quality, but this is not enabled as it would break too many tests.
         For scaling factors below 0.35, scaling atomically is nearly
         as fast as using a cascade of 2x scalings, and gives
         better results.

Definition at line 1864 of file scale1.c.

Referenced by pixScaleAreaMapToSize().

◆ pixScaleAreaMap2()

PIX* pixScaleAreaMap2 ( PIX pix)

pixScaleAreaMap2()

Parameters
[in]pix2, 4, 8 or 32 bpp; and 2, 4, 8 bpp with colormap
Returns
pixd, or NULL on error
Notes:
     (1) This function does an area mapping (average) for 2x
         reduction.
     (2) This works only on 2, 4, 8 and 32 bpp images.  If there is
         a colormap, it is removed by converting to RGB.
     (3) Compared to the general pixScaleAreaMap(), for this function
         gray processing is about 14x faster and color processing
         is about 4x faster.  Consequently, pixScaleAreaMap2() is
         incorporated into the general area map scaling function,
         for the special cases of 2x, 4x, 8x and 16x reduction.

Definition at line 1995 of file scale1.c.

Referenced by bilateralCreate().

◆ pixScaleAreaMapToSize()

PIX* pixScaleAreaMapToSize ( PIX pixs,
l_int32  wd,
l_int32  hd 
)

pixScaleAreaMapToSize()

Parameters
[in]pixs2, 4, 8 or 32 bpp; and 2, 4, 8 bpp with colormap
[in]wdtarget width; use 0 if using height as target
[in]hdtarget height; use 0 if using width as target
Returns
pixd, or NULL on error
Notes:
     (1) See notes in pixScaleAreaMap().
     (2) The output scaled image has the dimension(s) you specify:
  • To specify the width with isotropic scaling, set hd = 0.
  • To specify the height with isotropic scaling, set wd = 0.
  • If both wd and hd are specified, the image is scaled (in general, anisotropically) to that size.
  • It is an error to set both wd and hd to 0.

Definition at line 2058 of file scale1.c.

References pixGetDimensions(), and pixScaleAreaMap().

◆ pixScaleBinary()

PIX* pixScaleBinary ( PIX pixs,
l_float32  scalex,
l_float32  scaley 
)

pixScaleBinary()

Parameters
[in]pixs1 bpp
[in]scalexmust be > 0.0
[in]scaleymust be > 0.0
Returns
pixd, or NULL on error
Notes:
     (1) This function samples from the source without
         filtering.  As a result, aliasing will occur for
         subsampling (scalex and scaley < 1.0).

Definition at line 2105 of file scale1.c.

◆ pixScaleByIntSampling()

PIX* pixScaleByIntSampling ( PIX pixs,
l_int32  factor 
)

pixScaleByIntSampling()

Parameters
[in]pixs1, 2, 4, 8, 16, 32 bpp (all depths)
[in]factorinteger subsampling; >= 1
Returns
pixd, or NULL on error
Notes:
     (1) Simple interface to pixScaleBySampling(), for isotropic
         integer reduction.  If factor == 1, returns a copy.

Definition at line 1408 of file scale1.c.

References pixCopy(), and pixScaleBySampling().

Referenced by pixaAddPixWithText().

◆ pixScaleBySampling()

PIX* pixScaleBySampling ( PIX pixs,
l_float32  scalex,
l_float32  scaley 
)

pixScaleBySampling()

Parameters
[in]pixs1, 2, 4, 8, 16, 32 bpp
[in]scalexmust be > 0.0
[in]scaleymust be > 0.0
Returns
pixd, or NULL on error
Notes:
     (1) This function samples from the source without
         filtering.  As a result, aliasing will occur for
         subsampling (scalex and/or scaley < 1.0).
     (2) If scalex == 1.0 and scaley == 1.0, returns a copy.
     (3) For upscaling by an integer, use pixExpandReplicate().

Definition at line 1306 of file scale1.c.

References pixCopy().

Referenced by dewarpaShowArrays(), pixaScaleBySampling(), pixConvertTo1BySampling(), pixConvertTo32BySampling(), pixConvertTo8BySampling(), pixScaleByIntSampling(), pixScaleBySamplingToSize(), selaAddCrossJunctions(), and selaAddTJunctions().

◆ pixScaleBySamplingToSize()

PIX* pixScaleBySamplingToSize ( PIX pixs,
l_int32  wd,
l_int32  hd 
)

pixScaleBySamplingToSize()

Parameters
[in]pixs1, 2, 4, 8, 16 and 32 bpp
[in]wdtarget width; use 0 if using height as target
[in]hdtarget height; use 0 if using width as target
Returns
pixd, or NULL on error
Notes:
     (1) This guarantees that the output scaled image has the
         dimension(s) you specify.
         ~ To specify the width with isotropic scaling, set hd = 0.
         ~ To specify the height with isotropic scaling, set wd = 0.
         ~ If both wd and hd are specified, the image is scaled
           (in general, anisotropically) to that size.
         ~ It is an error to set both wd and hd to 0.

Definition at line 1366 of file scale1.c.

References pixGetDimensions(), and pixScaleBySampling().

◆ pixScaleColor2xLI()

PIX* pixScaleColor2xLI ( PIX pixs)

pixScaleColor2xLI()

Parameters
[in]pixs32 bpp, representing rgb
Returns
pixd, or NULL on error
Notes:
     (1) This is a special case of linear interpolated scaling,
         for 2x upscaling.  It is about 8x faster than using
         the generic pixScaleColorLI(), and about 4x faster than
         using the special 2x scale function pixScaleGray2xLI()
         on each of the three components separately.

Definition at line 625 of file scale1.c.

◆ pixScaleColor4xLI()

PIX* pixScaleColor4xLI ( PIX pixs)

pixScaleColor4xLI()

Parameters
[in]pixs32 bpp, representing rgb
Returns
pixd, or NULL on error
Notes:
     (1) This is a special case of color linear interpolated scaling,
         for 4x upscaling.  It is about 3x faster than using
         the generic pixScaleColorLI().
     (2) This scales each component separately, using pixScaleGray4xLI().
         It would be about 4x faster to inline the color code properly,
         in analogy to scaleColor4xLILow(), and I leave this as
         an exercise for someone who really needs it.

Definition at line 670 of file scale1.c.

◆ pixScaleColorLI()

PIX* pixScaleColorLI ( PIX pixs,
l_float32  scalex,
l_float32  scaley 
)

pixScaleColorLI()

Parameters
[in]pixs32 bpp, representing rgb
[in]scalexmust be >= 0.7
[in]scaleymust be >= 0.7
Returns
pixd, or NULL on error
Notes:
     (1) If both scale factors are smaller than 0.7, we issue a warning
         and call pixScaleGeneral(), which will invoke area mapping
         without sharpening.  This is particularly important for
         document images with sharp edges.
     (2) For the general case, it's about 4x faster to manipulate
         the color pixels directly, rather than to make images
         out of each of the 3 components, scale each component
         using the pixScaleGrayLI(), and combine the results back
         into an rgb image.

Definition at line 563 of file scale1.c.

◆ pixScaleGeneral()

PIX* pixScaleGeneral ( PIX pixs,
l_float32  scalex,
l_float32  scaley,
l_float32  sharpfract,
l_int32  sharpwidth 
)

pixScaleGeneral()

Parameters
[in]pixs1, 2, 4, 8, 16 and 32 bpp
[in]scalexmust be > 0.0
[in]scaleymust be > 0.0
[in]sharpfractuse 0.0 to skip sharpening
[in]sharpwidthhalfwidth of low-pass filter; typ. 1 or 2
Returns
pixd, or NULL on error
Notes:
     (1) See pixScale() for usage.
     (2) This interface may change in the future, as other special
         cases are added.
     (3) For tiny scaling factors
           minscale < 0.02:        use a simple lowpass filter
     (4) The actual sharpening factors used depend on the maximum
         of the two scale factors (maxscale):
           maxscale <= 0.2:        no sharpening
           0.2 < maxscale < 1.4:   uses the input parameters
           maxscale >= 1.4:        no sharpening
     (5) To avoid sharpening for grayscale and color images with
         scaling factors between 0.2 and 1.4, call this function
         with sharpfract == 0.0.
     (6) To use arbitrary sharpening in conjunction with scaling,
         call this function with sharpfract = 0.0, and follow this
         with a call to pixUnsharpMasking() with your chosen parameters.

Definition at line 415 of file scale1.c.

Referenced by pixScale(), and pixScaleSmooth().

◆ pixScaleGray2xLI()

PIX* pixScaleGray2xLI ( PIX pixs)

pixScaleGray2xLI()

Parameters
[in]pixs8 bpp grayscale, not cmapped
Returns
pixd, or NULL on error
Notes:
     (1) This is a special case of gray linear interpolated scaling,
         for 2x upscaling.  It is about 6x faster than using
         the generic pixScaleGrayLI().

Definition at line 821 of file scale1.c.

◆ pixScaleGray2xLIDither()

PIX* pixScaleGray2xLIDither ( PIX pixs)

pixScaleGray2xLIDither()

Parameters
[in]pixs8 bpp, not cmapped
Returns
pixd 1 bpp, or NULL on error
Notes:
     (1) This does 2x upscale on pixs, using linear interpolation,
         followed by Floyd-Steinberg dithering to binary.
     (2) Buffers are used to avoid making a large grayscale image.
         ~ Two line buffers are used for the src, required for the 2x
           LI upscale.
         ~ Three line buffers are used for the intermediate image.
           Two are filled with each 2xLI row operation; the third is
           needed because the upscale and dithering ops are out of sync.

Definition at line 980 of file scale1.c.

◆ pixScaleGray2xLIThresh()

PIX* pixScaleGray2xLIThresh ( PIX pixs,
l_int32  thresh 
)

pixScaleGray2xLIThresh()

Parameters
[in]pixs8 bpp, not cmapped
[in]threshbetween 0 and 256
Returns
pixd 1 bpp, or NULL on error
Notes:
     (1) This does 2x upscale on pixs, using linear interpolation,
         followed by thresholding to binary.
     (2) Buffers are used to avoid making a large grayscale image.

Definition at line 903 of file scale1.c.

◆ pixScaleGray4xLI()

PIX* pixScaleGray4xLI ( PIX pixs)

pixScaleGray4xLI()

Parameters
[in]pixs8 bpp grayscale, not cmapped
Returns
pixd, or NULL on error
Notes:
     (1) This is a special case of gray linear interpolated scaling,
         for 4x upscaling.  It is about 12x faster than using
         the generic pixScaleGrayLI().

Definition at line 860 of file scale1.c.

◆ pixScaleGray4xLIDither()

PIX* pixScaleGray4xLIDither ( PIX pixs)

pixScaleGray4xLIDither()

Parameters
[in]pixs8 bpp, not cmapped
Returns
pixd 1 bpp, or NULL on error
Notes:
     (1) This does 4x upscale on pixs, using linear interpolation,
         followed by Floyd-Steinberg dithering to binary.
     (2) Buffers are used to avoid making a large grayscale image.
         ~ Two line buffers are used for the src, required for the
           4xLI upscale.
         ~ Five line buffers are used for the intermediate image.
           Four are filled with each 4xLI row operation; the fifth
           is needed because the upscale and dithering ops are
           out of sync.
     (3) If a full 4x expanded grayscale image can be kept in memory,
         this function is only about 5% faster than separately doing
         a linear interpolation to a large grayscale image, followed
         by error-diffusion dithering to binary.

Definition at line 1183 of file scale1.c.

◆ pixScaleGray4xLIThresh()

PIX* pixScaleGray4xLIThresh ( PIX pixs,
l_int32  thresh 
)

pixScaleGray4xLIThresh()

Parameters
[in]pixs8 bpp
[in]threshbetween 0 and 256
Returns
pixd 1 bpp, or NULL on error
Notes:
     (1) This does 4x upscale on pixs, using linear interpolation,
         followed by thresholding to binary.
     (2) Buffers are used to avoid making a large grayscale image.
     (3) If a full 4x expanded grayscale image can be kept in memory,
         this function is only about 10% faster than separately doing
         a linear interpolation to a large grayscale image, followed
         by thresholding to binary.

Definition at line 1097 of file scale1.c.

◆ pixScaleGrayLI()

PIX* pixScaleGrayLI ( PIX pixs,
l_float32  scalex,
l_float32  scaley 
)

pixScaleGrayLI()

Parameters
[in]pixs8 bpp grayscale, no cmap
[in]scalexmust be >= 0.7
[in]scaleymust be >= 0.7
Returns
pixd, or NULL on error
Notes:
     (1) This function is appropriate for upscaling magnification, where the
         scale factor is > 1, as well as for a small amount of downscaling
         reduction, with scale factor >= 0.7.  If the scale factor is < 0.7,
         the best result is obtained by area mapping.
     (2) Here are some details:
  • For each pixel in the dest, this does a linear interpolation of 4 neighboring pixels in the src. Specifically, consider the UL corner of src and dest pixels. The UL corner of the dest falls within a src pixel, whose four corners are the UL corners of 4 adjacent src pixels. The value of the dest is taken by linear interpolation using the values of the four src pixels and the distance of the UL corner of the dest from each corner.
  • If the image is expanded so that the dest pixel is smaller than the src pixel, such interpolation is a reasonable approach. This interpolation is also good for a small image reduction factor that is not more than a 2x reduction.
  • The linear interpolation algorithm for scaling is identical in form to the area-mapping algorithm for grayscale rotation. The latter corresponds to a translation of each pixel without scaling.
  • This function is NOT optimal if the scaling involves a large reduction. If the image is significantly reduced, so that the dest pixel is much larger than the src pixels, this interpolation, which is over src pixels only near the UL corner of the dest pixel, is not going to give a good area-mapping average. Because area mapping for image scaling is considerably more computationally intensive than linear interpolation, we choose not to use it. For large image reduction, linear interpolation over adjacent src pixels degenerates asymptotically to subsampling. But subsampling without a low-pass pre-filter causes aliasing by the nyquist theorem. To avoid aliasing, a low-pass filter e.g., an averaging filter of size roughly equal to the dest pixel i.e., the reduction factor should be applied to the src before subsampling.
  • As an alternative to low-pass filtering and subsampling for large reduction factors, linear interpolation can also be done between the widely separated src pixels in which the corners of the dest pixel lie. This also is not optimal, as it samples src pixels only near the corners of the dest pixel, and it is not implemented.

Definition at line 762 of file scale1.c.

◆ pixScaleGrayToBinaryFast()

PIX* pixScaleGrayToBinaryFast ( PIX pixs,
l_int32  factor,
l_int32  thresh 
)

pixScaleGrayToBinaryFast()

Parameters
[in]pixs8 bpp grayscale
[in]factorinteger reduction factor >= 1
[in]threshbinarization threshold
Returns
pixd 1 bpp, or NULL on error
Notes:
     (1) This does simultaneous subsampling by an integer factor and
         thresholding from gray to binary.
     (2) It is designed for maximum speed, and is used for quickly
         generating a downsized binary image from a higher resolution
         gray image.  This would typically be used for image analysis.

Definition at line 1585 of file scale1.c.

◆ pixScaleLI()

PIX* pixScaleLI ( PIX pixs,
l_float32  scalex,
l_float32  scaley 
)

pixScaleLI()

Parameters
[in]pixs2, 4, 8 or 32 bpp; with or without colormap
[in]scalexmust be >= 0.7
[in]scaleymust be >= 0.7
Returns
pixd, or NULL on error
Notes:
     (1) This function should only be used when the scale factors are
         greater than or equal to 0.7, and typically greater than 1.
         If both scale factors are smaller than 0.7, we issue a warning
         and call pixScaleGeneral(), which will invoke area mapping
         without sharpening.
     (2) This works on 2, 4, 8, 16 and 32 bpp images, as well as on
         2, 4 and 8 bpp images that have a colormap.  If there is a
         colormap, it is removed to either gray or RGB, depending
         on the colormap.
     (3) This does a linear interpolation on the src image.
     (4) It dispatches to much faster implementations for
         the special cases of 2x and 4x expansion.

Definition at line 506 of file scale1.c.

◆ pixScaleRGBToBinaryFast()

PIX* pixScaleRGBToBinaryFast ( PIX pixs,
l_int32  factor,
l_int32  thresh 
)

pixScaleRGBToBinaryFast()

Parameters
[in]pixs32 bpp RGB
[in]factorinteger reduction factor >= 1
[in]threshbinarization threshold
Returns
pixd 1 bpp, or NULL on error
Notes:
     (1) This does simultaneous subsampling by an integer factor and
         conversion from RGB to gray to binary.
     (2) It is designed for maximum speed, and is used for quickly
         generating a downsized binary image from a higher resolution
         RGB image.  This would typically be used for image analysis.
     (3) It uses the green channel to represent the RGB pixel intensity.

Definition at line 1521 of file scale1.c.

◆ pixScaleRGBToGray2()

PIX* pixScaleRGBToGray2 ( PIX pixs,
l_float32  rwt,
l_float32  gwt,
l_float32  bwt 
)

pixScaleRGBToGray2()

Parameters
[in]pixs32 bpp rgb
[in]rwt,gwt,bwtmust sum to 1.0
Returns
pixd, 8 bpp, 2x reduced, or NULL on error

Definition at line 1785 of file scale1.c.

◆ pixScaleRGBToGrayFast()

PIX* pixScaleRGBToGrayFast ( PIX pixs,
l_int32  factor,
l_int32  color 
)

pixScaleRGBToGrayFast()

Parameters
[in]pixs32 bpp rgb
[in]factorinteger reduction factor >= 1
[in]colorone of COLOR_RED, COLOR_GREEN, COLOR_BLUE
Returns
pixd 8 bpp, or NULL on error
Notes:
     (1) This does simultaneous subsampling by an integer factor and
         extraction of the color from the RGB pix.
     (2) It is designed for maximum speed, and is used for quickly
         generating a downsized grayscale image from a higher resolution
         RGB image.  This would typically be used for image analysis.
     (3) The standard color byte order (RGBA) is assumed.

Definition at line 1448 of file scale1.c.

◆ pixScaleSmooth()

PIX* pixScaleSmooth ( PIX pix,
l_float32  scalex,
l_float32  scaley 
)

pixScaleSmooth()

Parameters
[in]pix2, 4, 8 or 32 bpp; and 2, 4, 8 bpp with colormap
[in]scalexmust be < 0.7
[in]scaleymust be < 0.7
Returns
pixd, or NULL on error
Notes:
     (1) This function should only be used when the scale factors are less
         than 0.7.  If either scale factor is >= 0.7, issue a warning
         and call pixScaleGeneral(), which will invoke linear interpolation
         without sharpening.
     (2) This works only on 2, 4, 8 and 32 bpp images, and if there is
         a colormap, it is removed by converting to RGB.
     (3) It does simple (flat filter) convolution, with a filter size
         commensurate with the amount of reduction, to avoid antialiasing.
     (4) It does simple subsampling after smoothing, which is appropriate
         for this range of scaling.  Linear interpolation gives essentially
         the same result with more computation for these scale factors,
         so we don't use it.
     (5) The result is the same as doing a full block convolution followed by
         subsampling, but this is faster because the results of the block
         convolution are only computed at the subsampling locations.
         In fact, the computation time is approximately independent of
         the scale factor, because the convolution kernel is adjusted
         so that each source pixel is summed approximately once.

Definition at line 1665 of file scale1.c.

References pixScaleGeneral().

Referenced by pixScaleSmoothToSize().

◆ pixScaleSmoothToSize()

PIX* pixScaleSmoothToSize ( PIX pixs,
l_int32  wd,
l_int32  hd 
)

pixScaleSmoothToSize()

Parameters
[in]pixs2, 4, 8 or 32 bpp; and 2, 4, 8 bpp with colormap
[in]wdtarget width; use 0 if using height as target
[in]hdtarget height; use 0 if using width as target
Returns
pixd, or NULL on error
Notes:
     (1) See notes in pixScaleSmooth().
     (2) The output scaled image has the dimension(s) you specify:
  • To specify the width with isotropic scaling, set hd = 0.
  • To specify the height with isotropic scaling, set wd = 0.
  • If both wd and hd are specified, the image is scaled (in general, anisotropically) to that size.
  • It is an error to set both wd and hd to 0.

Definition at line 1749 of file scale1.c.

References pixGetDimensions(), and pixScaleSmooth().

◆ pixScaleToResolution()

PIX* pixScaleToResolution ( PIX pixs,
l_float32  target,
l_float32  assumed,
l_float32 *  pscalefact 
)

pixScaleToResolution()

Parameters
[in]pixs
[in]targetdesired resolution
[in]assumedassumed resolution if not defined; typ. 300.
[out]pscalefact[optional] actual scaling factor used
Returns
pixd, or NULL on error

Definition at line 357 of file scale1.c.

◆ pixScaleToSize()

PIX* pixScaleToSize ( PIX pixs,
l_int32  wd,
l_int32  hd 
)

pixScaleToSize()

Parameters
[in]pixs1, 2, 4, 8, 16 and 32 bpp
[in]wdtarget width; use 0 if using height as target
[in]hdtarget height; use 0 if using width as target
Returns
pixd, or NULL on error
Notes:
     (1) The output scaled image has the dimension(s) you specify:
         * To specify the width with isotropic scaling, set hd = 0.
         * To specify the height with isotropic scaling, set wd = 0.
         * If both wd and hd are specified, the image is scaled
            (in general, anisotropically) to that size.
         * It is an error to set both wd and hd to 0.

Definition at line 319 of file scale1.c.

References pixGetDimensions(), and pixScale().

Referenced by pixaConvertToNUpPixa(), pixaDisplayTiledByIndex(), pixaScaleToSize(), pixCompareGrayByHisto(), pixScaleToSizeRel(), recogModifyTemplate(), and recogTrainFromBoot().

◆ pixScaleToSizeRel()

PIX* pixScaleToSizeRel ( PIX pixs,
l_int32  delw,
l_int32  delh 
)

pixScaleToSizeRel()

Parameters
[in]pixs
[in]delwchange in width, in pixels; 0 means no change
[in]delhchange in height, in pixels; 0 means no change
Returns
pixd, or NULL on error

Definition at line 278 of file scale1.c.

References pixCopy(), pixGetDimensions(), and pixScaleToSize().

Referenced by pixaScaleToSizeRel().

◆ scaleAreaMapLow2()

static void scaleAreaMapLow2 ( l_uint32 *  datad,
l_int32  wd,
l_int32  hd,
l_int32  wpld,
l_uint32 *  datas,
l_int32  d,
l_int32  wpls 
)
static

scaleAreaMapLow2()

Notes:
     (1) This function is called with either 8 bpp gray or 32 bpp RGB.
         The result is a 2x reduced dest.

Definition at line 3566 of file scale1.c.

References GET_DATA_BYTE, and SET_DATA_BYTE.

◆ scaleBySamplingLow()

static l_int32 scaleBySamplingLow ( l_uint32 *  datad,
l_int32  wd,
l_int32  hd,
l_int32  wpld,
l_uint32 *  datas,
l_int32  ws,
l_int32  hs,
l_int32  d,
l_int32  wpls 
)
static

scaleBySamplingLow()

Notes:
     (1) The dest must be cleared prior to this operation,
         and we clear it here in the low-level code.
     (2) We reuse dest pixels and dest pixel rows whenever
         possible.  This speeds the upscaling; downscaling
         is done by strict subsampling and is unaffected.
     (3) Because we are sampling and not interpolating, this
         routine works directly, without conversion to full
         RGB color, for 2, 4 or 8 bpp palette color images.

Definition at line 3006 of file scale1.c.

References GET_DATA_BYTE, GET_DATA_DIBIT, GET_DATA_QBIT, GET_DATA_TWO_BYTES, SET_DATA_BYTE, SET_DATA_DIBIT, SET_DATA_QBIT, and SET_DATA_TWO_BYTES.

◆ scaleColor2xLILineLow()

static void scaleColor2xLILineLow ( l_uint32 *  lined,
l_int32  wpld,
l_uint32 *  lines,
l_int32  ws,
l_int32  wpls,
l_int32  lastlineflag 
)
static

scaleColor2xLILineLow()

Parameters
[in]linedptr to top destline, to be made from current src line
[in]wpld
[in]linesptr to current src line
[in]ws
[in]wpls
[in]lastlineflag1 if last src line; 0 otherwise
Returns
void

Definition at line 2431 of file scale1.c.

Referenced by scaleColor2xLILow().

◆ scaleColor2xLILow()

static void scaleColor2xLILow ( l_uint32 *  datad,
l_int32  wpld,
l_uint32 *  datas,
l_int32  ws,
l_int32  hs,
l_int32  wpls 
)
static

scaleColor2xLILow()

Notes:
     (1) This is a special case of 2x expansion by linear
         interpolation.  Each src pixel contains 4 dest pixels.
         The 4 dest pixels in src pixel 1 are numbered at
         their UL corners.  The 4 dest pixels in src pixel 1
         are related to that src pixel and its 3 neighboring
         src pixels as follows:

            1-----2-----|-----|-----|
            |     |     |     |     |
            |     |     |     |     |
 src 1 -->  3-----4-----|     |     |  <-- src 2
            |     |     |     |     |
            |     |     |     |     |
            |-----|-----|-----|-----|
            |     |     |     |     |
            |     |     |     |     |
 src 3 -->  |     |     |     |     |  <-- src 4
            |     |     |     |     |
            |     |     |     |     |
            |-----|-----|-----|-----|

          dest      src
          ----      ---
          dp1    =  sp1
          dp2    =  (sp1 + sp2) / 2
          dp3    =  (sp1 + sp3) / 2
          dp4    =  (sp1 + sp2 + sp3 + sp4) / 4

     (2) We iterate over the src pixels, and unroll the calculation
         for each set of 4 dest pixels corresponding to that src
         pixel, caching pixels for the next src pixel whenever possible.
         The method is exactly analogous to the one we use for
         scaleGray2xLILow() and its line version.

Definition at line 2383 of file scale1.c.

References scaleColor2xLILineLow().

◆ scaleColorAreaMapLow()

static void scaleColorAreaMapLow ( l_uint32 *  datad,
l_int32  wd,
l_int32  hd,
l_int32  wpld,
l_uint32 *  datas,
l_int32  ws,
l_int32  hs,
l_int32  wpls 
)
static

scaleColorAreaMapLow()

Notes:
     (1) This should only be used for downscaling.
         We choose to divide each pixel into 16 x 16 sub-pixels.
         This is much slower than scaleSmoothLow(), but it gives a
         better representation, esp. for downscaling factors between
         1.5 and 5.  All src pixels are subdivided into 256 sub-pixels,
         and are weighted by the number of sub-pixels covered by
         the dest pixel.  This is about 2x slower than scaleSmoothLow(),
         but the results are significantly better on small text.

Definition at line 3301 of file scale1.c.

◆ scaleColorLILow()

static void scaleColorLILow ( l_uint32 *  datad,
l_int32  wd,
l_int32  hd,
l_int32  wpld,
l_uint32 *  datas,
l_int32  ws,
l_int32  hs,
l_int32  wpls 
)
static

scaleColorLILow()

Notes:
     (1) We choose to divide each pixel into 16 x 16 sub-pixels.
         Linear interpolation is equivalent to finding the
         fractional area (i.e., number of sub-pixels divided
         by 256) associated with each of the four nearest src pixels,
         and weighting each pixel value by this fractional area.

Definition at line 2161 of file scale1.c.

◆ scaleGray2xLILineLow()

static void scaleGray2xLILineLow ( l_uint32 *  lined,
l_int32  wpld,
l_uint32 *  lines,
l_int32  ws,
l_int32  wpls,
l_int32  lastlineflag 
)
static

scaleGray2xLILineLow()

Parameters
[in]linedptr to top destline, to be made from current src line
[in]wpld
[in]linesptr to current src line
[in]ws
[in]wpls
[in]lastlineflag1 if last src line; 0 otherwise
Returns
void

Definition at line 2633 of file scale1.c.

References GET_DATA_BYTE, and SET_DATA_BYTE.

Referenced by scaleGray2xLILow().

◆ scaleGray2xLILow()

static void scaleGray2xLILow ( l_uint32 *  datad,
l_int32  wpld,
l_uint32 *  datas,
l_int32  ws,
l_int32  hs,
l_int32  wpls 
)
static

scaleGray2xLILow()

Notes:
     (1) This is a special case of 2x expansion by linear
         interpolation.  Each src pixel contains 4 dest pixels.
         The 4 dest pixels in src pixel 1 are numbered at
         their UL corners.  The 4 dest pixels in src pixel 1
         are related to that src pixel and its 3 neighboring
         src pixels as follows:

            1-----2-----|-----|-----|
            |     |     |     |     |
            |     |     |     |     |
 src 1 -->  3-----4-----|     |     |  <-- src 2
            |     |     |     |     |
            |     |     |     |     |
            |-----|-----|-----|-----|
            |     |     |     |     |
            |     |     |     |     |
 src 3 -->  |     |     |     |     |  <-- src 4
            |     |     |     |     |
            |     |     |     |     |
            |-----|-----|-----|-----|

          dest      src
          ----      ---
          dp1    =  sp1
          dp2    =  (sp1 + sp2) / 2
          dp3    =  (sp1 + sp3) / 2
          dp4    =  (sp1 + sp2 + sp3 + sp4) / 4

     (2) We iterate over the src pixels, and unroll the calculation
         for each set of 4 dest pixels corresponding to that src
         pixel, caching pixels for the next src pixel whenever possible.

Definition at line 2585 of file scale1.c.

References scaleGray2xLILineLow().

◆ scaleGray4xLILineLow()

static void scaleGray4xLILineLow ( l_uint32 *  lined,
l_int32  wpld,
l_uint32 *  lines,
l_int32  ws,
l_int32  wpls,
l_int32  lastlineflag 
)
static

scaleGray4xLILineLow()

Parameters
[in]linedptr to top destline, to be made from current src line
[in]wpld
[in]linesptr to current src line
[in]ws
[in]wpls
[in]lastlineflag1 if last src line; 0 otherwise
Returns
void

Definition at line 2872 of file scale1.c.

References GET_DATA_BYTE, and SET_DATA_BYTE.

Referenced by scaleGray4xLILow().

◆ scaleGray4xLILow()

static void scaleGray4xLILow ( l_uint32 *  datad,
l_int32  wpld,
l_uint32 *  datas,
l_int32  ws,
l_int32  hs,
l_int32  wpls 
)
static

scaleGray4xLILow()

Notes:
     (1) This is a special case of 4x expansion by linear
         interpolation.  Each src pixel contains 16 dest pixels.
         The 16 dest pixels in src pixel 1 are numbered at
         their UL corners.  The 16 dest pixels in src pixel 1
         are related to that src pixel and its 3 neighboring
         src pixels as follows:

            1---2---3---4---|---|---|---|---|
            |   |   |   |   |   |   |   |   |
            5---6---7---8---|---|---|---|---|
            |   |   |   |   |   |   |   |   |
 src 1 -->  9---a---b---c---|---|---|---|---|  <-- src 2
            |   |   |   |   |   |   |   |   |
            d---e---f---g---|---|---|---|---|
            |   |   |   |   |   |   |   |   |
            |===|===|===|===|===|===|===|===|
            |   |   |   |   |   |   |   |   |
            |---|---|---|---|---|---|---|---|
            |   |   |   |   |   |   |   |   |
 src 3 -->  |---|---|---|---|---|---|---|---|  <-- src 4
            |   |   |   |   |   |   |   |   |
            |---|---|---|---|---|---|---|---|
            |   |   |   |   |   |   |   |   |
            |---|---|---|---|---|---|---|---|

          dest      src
          ----      ---
          dp1    =  sp1
          dp2    =  (3 * sp1 + sp2) / 4
          dp3    =  (sp1 + sp2) / 2
          dp4    =  (sp1 + 3 * sp2) / 4
          dp5    =  (3 * sp1 + sp3) / 4
          dp6    =  (9 * sp1 + 3 * sp2 + 3 * sp3 + sp4) / 16
          dp7    =  (3 * sp1 + 3 * sp2 + sp3 + sp4) / 8
          dp8    =  (3 * sp1 + 9 * sp2 + 1 * sp3 + 3 * sp4) / 16
          dp9    =  (sp1 + sp3) / 2
          dp10   =  (3 * sp1 + sp2 + 3 * sp3 + sp4) / 8
          dp11   =  (sp1 + sp2 + sp3 + sp4) / 4
          dp12   =  (sp1 + 3 * sp2 + sp3 + 3 * sp4) / 8
          dp13   =  (sp1 + 3 * sp3) / 4
          dp14   =  (3 * sp1 + sp2 + 9 * sp3 + 3 * sp4) / 16
          dp15   =  (sp1 + sp2 + 3 * sp3 + 3 * sp4) / 8
          dp16   =  (sp1 + 3 * sp2 + 3 * sp3 + 9 * sp4) / 16

     (2) We iterate over the src pixels, and unroll the calculation
         for each set of 16 dest pixels corresponding to that src
         pixel, caching pixels for the next src pixel whenever possible.

Definition at line 2826 of file scale1.c.

References scaleGray4xLILineLow().

◆ scaleGrayAreaMapLow()

static void scaleGrayAreaMapLow ( l_uint32 *  datad,
l_int32  wd,
l_int32  hd,
l_int32  wpld,
l_uint32 *  datas,
l_int32  ws,
l_int32  hs,
l_int32  wpls 
)
static

scaleGrayAreaMapLow()

Notes:
     (1) This should only be used for downscaling.
         We choose to divide each pixel into 16 x 16 sub-pixels.
         This is about 2x slower than scaleSmoothLow(), but the results
         are significantly better on small text, esp. for downscaling
         factors between 1.5 and 5.  All src pixels are subdivided
         into 256 sub-pixels, and are weighted by the number of
         sub-pixels covered by the dest pixel.

Definition at line 3459 of file scale1.c.

References GET_DATA_BYTE, lept_stderr(), and SET_DATA_BYTE.

◆ scaleGrayLILow()

static void scaleGrayLILow ( l_uint32 *  datad,
l_int32  wd,
l_int32  hd,
l_int32  wpld,
l_uint32 *  datas,
l_int32  ws,
l_int32  hs,
l_int32  wpls 
)
static

scaleGrayLILow()

Notes:
     (1) We choose to divide each pixel into 16 x 16 sub-pixels.
         Linear interpolation is equivalent to finding the
         fractional area (i.e., number of sub-pixels divided
         by 256) associated with each of the four nearest src pixels,
         and weighting each pixel value by this fractional area.

Definition at line 2266 of file scale1.c.

References GET_DATA_BYTE, and SET_DATA_BYTE.

◆ scaleRGBToGray2Low()

static void scaleRGBToGray2Low ( l_uint32 *  datad,
l_int32  wd,
l_int32  hd,
l_int32  wpld,
l_uint32 *  datas,
l_int32  wpls,
l_float32  rwt,
l_float32  gwt,
l_float32  bwt 
)
static

scaleRGBToGray2Low()

Notes:
     (1) This function is called with 32 bpp RGB src and 8 bpp,
         half-resolution dest.  The weights should add to 1.0.

Definition at line 3236 of file scale1.c.

◆ scaleSmoothLow()

static l_int32 scaleSmoothLow ( l_uint32 *  datad,
l_int32  wd,
l_int32  hd,
l_int32  wpld,
l_uint32 *  datas,
l_int32  ws,
l_int32  hs,
l_int32  d,
l_int32  wpls,
l_int32  size 
)
static

scaleSmoothLow()

Notes:
     (1) This function is called on 8 or 32 bpp src and dest images.
     (2) size is the full width of the lowpass smoothing filter.
         It is correlated with the reduction ratio, being the
         nearest integer such that size is approximately equal to hs / hd.

Definition at line 3137 of file scale1.c.

References GET_DATA_BYTE, and SET_DATA_BYTE.