Linear Methods for Image Interpolation
Data Structures | Defines | Typedefs | Functions | Variables
conv.h File Reference

Convolution functions. More...

#include "basic.h"
Include dependency graph for conv.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  filter
 struct representing a 1D FIR filter More...

Defines

#define FreeFilter(Filter)   (Free((Filter).Coeff))
 Free a filter.
#define Conv1D(Dest, DestStride, Src, SrcStride, Filter, Boundary, N)
 1D FIR convolution with constant boundary extension

Typedefs

typedef float(* boundaryext )(const float *, int, int, int)
 typedef representing a boundary extension function

Functions

void SampledConv1D (float *Dest, int DestStride, const float *Src, int SrcStride, filter Filter, boundaryext Boundary, int N, int nStart, int nStep, int nEnd)
 (Sub)sampled 1D FIR convolution
void SeparableConv2D (float *Dest, float *Buffer, const float *Src, filter FilterX, filter FilterY, boundaryext Boundary, int Width, int Height, int NumChannels)
 Separable 2D FIR convolution with constant boundary extension.
filter MakeFilter (float *Coeff, int Delay, int Length)
 Make a filter.
filter AllocFilter (int Delay, int Length)
 Allocate memory for a 1D FIR filter with length Length.
int IsNullFilter (filter Filter)
 Tests whether a filter is NULL.
filter GaussianFilter (double Sigma, int R)
 Construct an FIR approximation of a Gaussian filter.
boundaryext GetBoundaryExt (const char *Boundary)
 Get function pointer to boundary extension function.

Variables

const filter NullFilter
 NULL filter object.

Detailed Description

Convolution functions.

Author:
Pascal Getreuer <getreuer@gmail.com>

Copyright (c) 2010-2011, Pascal Getreuer All rights reserved.

This program is free software: you can use, modify and/or redistribute it under the terms of the simplified BSD License. You should have received a copy of this license along this program. If not, see <http://www.opensource.org/licenses/bsd-license.html>.

Definition in file conv.h.


Define Documentation

#define Conv1D (   Dest,
  DestStride,
  Src,
  SrcStride,
  Filter,
  Boundary,
 
)
Value:
(SampledConv1D(Dest, DestStride, Src, SrcStride, Filter, Boundary, N, \
    0, 1, N - 1))

1D FIR convolution with constant boundary extension

Parameters:
Destpointer to memory to hold the result
DestStridestep between successive output samples
Srcpointer to the input data
SrcStridestep between successive input samples
Filterthe filter
Boundaryboundary extension
Nthe length of the convolution

Definition at line 72 of file conv.h.

#define FreeFilter (   Filter)    (Free((Filter).Coeff))

Free a filter.

Definition at line 59 of file conv.h.


Typedef Documentation

typedef float(* boundaryext)(const float *, int, int, int)

typedef representing a boundary extension function

Definition at line 34 of file conv.h.


Function Documentation

filter AllocFilter ( int  Delay,
int  Length 
)

Allocate memory for a 1D FIR filter with length Length.

Definition at line 161 of file conv.c.

Here is the call graph for this function:

Here is the caller graph for this function:

filter GaussianFilter ( double  Sigma,
int  R 
)

Construct an FIR approximation of a Gaussian filter.

Parameters:
Sigmastandard deviation of the Gaussian filter
Rsupport radius

This function returns an FIR filter approximating a Gaussian with standard deviation Sigma. It is the responsibility of the caller to call FreeFilter to free the filter coefficients memory when done.

The support radius of the filter is R, and the filter length is 2*R + 1. A reasonable choice for R is R = (int)ceil(4*Sigma). The coefficients are normalized to have unit sum. If Sigma is zero, then the unit impulse filter is returned.

Definition at line 193 of file conv.c.

Here is the call graph for this function:

Here is the caller graph for this function:

boundaryext GetBoundaryExt ( const char *  Boundary)

Get function pointer to boundary extension function.

Parameters:
Boundarystring naming the boundary extension
Returns:
function pointer on success, NULL on failure

Choices for Boundary are

  • "zpd": zero-padded extension
  • "sp0" or "const": constant extension
  • "sp1" or "linear": linear extension
  • "per": periodic extension
  • "sym" or "symh": half-sample symmetric extension
  • "symw": whole-sample symmetric extension
  • "asym" or "asymh": half-sample antisymmetric extension
  • "asymw": whole-sample antisymmetric extension

Definition at line 421 of file conv.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int IsNullFilter ( filter  Filter)

Tests whether a filter is NULL.

Definition at line 173 of file conv.c.

Here is the caller graph for this function:

filter MakeFilter ( float *  Coeff,
int  Delay,
int  Length 
)

Make a filter.

Definition at line 149 of file conv.c.

Here is the caller graph for this function:

void SampledConv1D ( float *  Dest,
int  DestStride,
const float *  Src,
int  SrcStride,
filter  Filter,
boundaryext  Boundary,
int  N,
int  nStart,
int  nStep,
int  nEnd 
)

(Sub)sampled 1D FIR convolution

Parameters:
Destpointer to memory to hold the result
DestStridestep between successive output samples
Srcpointer to the input data
SrcStridestep between successive input samples
Filterthe filter
Boundaryboundary extension
Nthe length of the convolution
nStart,nStep,nEndsample the convolution at nStart:nStep:nEnd

Definition at line 40 of file conv.c.

void SeparableConv2D ( float *  Dest,
float *  Buffer,
const float *  Src,
filter  FilterX,
filter  FilterY,
boundaryext  Boundary,
int  Width,
int  Height,
int  NumChannels 
)

Separable 2D FIR convolution with constant boundary extension.

Parameters:
Destpointer to memory to hold the result
Bufferworkspace buffer of size Width*Height
Srcpointer to the input image in row-major planar order
FilterXthe horizontal filter
FilterYthe vertical filter
Boundaryboundary extension
Widthimage width
Heightimage height
NumChannelsnumber of image channels

Definition at line 123 of file conv.c.

Here is the caller graph for this function:


Variable Documentation

NULL filter object.

Definition at line 25 of file conv.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines