vpBoxFilter(3)

πŸ“¦ version 1.0c7, in fedora 43, fedora 44

πŸ’– vpBoxFilter(3) β€” library functions manual, bestie edition πŸ’–

okay so. gather round. this is the vpBoxFilter(3) page from the VolPack library functions manual, and we're gonna build filter weight tables together. it's giving math but make it cute. no cap. πŸŽ€


✨ NAME ✨

vpBoxFilter, vpLinearFilter, vpBicubicFilter, vpGaussianFilter β€” initialize a filter weight table 🫢


🌈 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;

πŸŽ€ ARGUMENTS πŸŽ€

  • num_taps β€” how many filter taps. that's the count, bestie.
  • num_phases β€” how many filter phases.
  • weights β€” the array holding the filter weights.
  • weights_bytes β€” the size, in bytes, of that weights array. bytes, not vibes.
  • b_value β€” the "B" parameter in the formula for a Mitchell bicubic.
  • c_value β€” the "C" parameter in the formula for a Mitchell bicubic. yes they're a matching set, we love that for them.
  • sigma β€” the standard deviation for a Gaussian. πŸ’œ

πŸ¦‹ DESCRIPTION πŸ¦‹

so these routines initialize filter weight tables for use with vpSetFilter and vpResample. if you wanna know the tea on the num_taps and num_phases arguments, that's all in the vpSetFilter man page. go read it. i'll wait. πŸ’…

vpBoxFilter creates a filter table for a box filter β€” that's a zero-order filter. when num_taps equals 1, the filter is a nearest-neighbor filter, which is literally perfect for low-quality upsampling. and if you wanna build a decimation filter that averages down? then the number of taps should equal the decimation factor, as nearly as possible. periodt.

vpLinearFilter creates a filter table for a linear filter β€” a first-order filter, aka the tent filter. with num_taps equal to 2, the filter performs linear interpolation. iconic behavior honestly.

vpBicubicFilter creates a filter table for a Mitchell bicubic filter. the first two arguments let you modify the shape of the filter kernel. some standard parameter values, for the girlies who like a preset:

  • 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 if you want more details, go read this paper, it's the source of all of this: Mitchell, D.P. and Netravali, A.N., "Reconstruction filters in computer graphics," Proc. SIGGRAPH '88 (Computer Graphics V22 N4), p. 221-8. academic queen behavior. πŸ‘‘

vpGaussianFilter creates a filter table for a gaussian filter. the first argument is the standard deviation of the gaussian. simple as that. ✨


πŸ’€ ERRORS πŸ’€

the normal return value is VP_OK. but sometimes the universe says no, and you might get one of these:

  • VPERROR_BAD_SIZE β€” the filter weight table size is invalid.
  • VPERROR_BAD_VALUE β€” the number of phases is not a positive power of two.
not me getting VPERROR_BAD_VALUE because i forgot powers of two exist 😭 two, four, eight, sixteen bestie. that's the assignment.

🌟 SEE ALSO 🌟


and that's the whole page, you're so welcome. this came to you from the VolPack library, and yes, we're still on vpBoxFilter(3) β€” go forth and filter responsibly. mwah. πŸ’–πŸ§šπŸ’…

πŸ“¦ where this page comes from