vpBoxFilter(3)

πŸ’– vpBoxFilter β€” the filter weight table glow-up πŸ’–

okay bestie, welcome to vpBoxFilter(3) from the Library Functions Manual. this is the one where you build filter weight tables, and honestly? it's giving math but make it cute. πŸŽ€

she's the whole girl group: vpBoxFilter, vpLinearFilter, vpBicubicFilter, and vpGaussianFilter β€” four functions, one mission: initialize a filter weight table. periodt. ✨


🌸 SYNOPSIS 🌸

#include <volpack.h>

vpResult
vpBoxFilter(num_taps, num_phases, weights, weights_bytes)
    int num_taps, num_phases;
    float *weights;
    int weights_bytes;

vpResult
vpLinearFilter(num_taps, num_phases, weights, weights_bytes)
    int num_taps, num_phases;
    float *weights;
    int weights_bytes;

vpResult
vpBicubicFilter(b_value, c_value, num_taps, num_phases, weights,
        weights_bytes)
    double b_value, c_value;
    int num_taps, num_phases;
    float *weights;
    int weights_bytes;

vpResult
vpGaussianFilter(sigma, num_taps, num_phases, weights, weights_bytes)
    double sigma;
    int num_taps, num_phases;
    float *weights;
    int weights_bytes;

copy that exactly, no cap. 🫢


✨ ARGUMENTS ✨

  • num_taps β€” the number of filter taps, bestie. how many lil sips the filter takes. πŸ“
  • num_phases β€” the number of filter phases. yes it's a whole phase era.
  • weights β€” the array holding the filter weights. this is where the magic gets stored. πŸ’…
  • weights_bytes β€” how big that array is, in bytes. size check, slay.
  • b_value β€” the "B" parameter in the formula for a Mitchell bicubic. iconic letter.
  • c_value β€” the "C" parameter in the formula for a Mitchell bicubic. her sister. πŸ‘‘
  • sigma β€” the standard deviation for a Gaussian. spread it out, babe. 🌈

πŸ’œ DESCRIPTION πŸ’œ

so these routines initialize filter weight tables for use with vpSetFilter and vpResample. if you wanna know what num_taps and num_phases are actually doing, go read the vpSetFilter man page β€” she explains it. iykyk. πŸ“–

🌸 vpBoxFilter

creates a filter table for a box filter β€” that's a zero-order filter, babes. when num_taps equals 1, the filter is a nearest-neighbor filter, which is suitable for low-quality upsampling. (low-quality! she said it, not me. πŸ™ˆ)

and if you wanna create a decimation filter that averages down? the number of taps should equal the decimation factor β€” as nearly as possible. ✨

🌸 vpLinearFilter

creates a filter table for a linear filter β€” that's a first-order filter, aka a tent filter, and yes the tent is camping. β›Ί

with num_taps equal to 2, the filter performs linear interpolation. chef's kiss. πŸ’–

🌸 vpBicubicFilter

creates a filter table for a Mitchell bicubic filter. the first two arguments let you modify the shape of the filter kernel β€” customizing her silhouette, honestly. some standard parameter values, bestie:

  • b_value = 1, c_value = 0 β€” Cubic B-spline.
  • b_value = 0, c_value = 0.5 β€” Catmull-Rom spline.

with four filter taps, the cubic B-spline filter is suitable for upsampling. ✨

and for more details, go read this paper β€” it's real, i'm not making it up:

Mitchell, D.P. and Netravali, A.N., "Reconstruction filters in computer graphics," Proc. SIGGRAPH '88 (Computer Graphics V22 N4), p. 221-8.

academic baddies only. πŸ“šπŸ’…

🌸 vpGaussianFilter

creates a filter table for a gaussian filter. the first argument is the standard deviation of the gaussian. that's it, that's the vibe. 🌸


😭 ERRORS 😭

the normal return value is VP_OK. if you get anything else, something's off and we're gonna talk about it. possible error return values:

  • VPERROR_BAD_SIZE β€” the filter weight table size is invalid. πŸ’€
  • VPERROR_BAD_VALUE β€” the number of phases is not a positive power of two. and no, bestie, that one's non-negotiable. πŸ™ˆ

πŸ¦‹ SEE ALSO πŸ¦‹

go read them, they're all part of the same friend group. 🫢


reminder bestie: this whole page is VolPack's, and it's filed under vpBoxFilter(3). treat her with respect. πŸ’–

and that's the page, queen. you understood it, you ate, no crumbs. slay πŸ’…βœ¨

πŸ“¦ where this page comes from