FFmpeg
Data Structures | Macros | Enumerations | Functions
filters.h File Reference
#include <libavutil/refstruct.h>

Go to the source code of this file.

Data Structures

struct  SwsFilterParams
 
struct  SwsFilterWeights
 Represents a computed filter kernel. More...
 

Macros

#define SWS_NUM_SCALER_PARAMS   2
 
#define SWS_MAX_REDUCE_CUTOFF   0.002
 
#define SWS_PARAM_DEFAULT   123456
 

Enumerations

enum  SwsScaler {
  SWS_SCALE_AUTO = 0, SWS_SCALE_BILINEAR, SWS_SCALE_BICUBIC, SWS_SCALE_POINT,
  SWS_SCALE_AREA, SWS_SCALE_GAUSSIAN, SWS_SCALE_SINC, SWS_SCALE_LANCZOS,
  SWS_SCALE_SPLINE, SWS_SCALE_NB, SWS_SCALE_MAX_ENUM = 0x7FFFFFFF
}
 
enum  { SWS_FILTER_SCALE = (1 << 14), SWS_FILTER_SIZE_MAX = 256 }
 

Functions

int ff_sws_filter_generate (void *log_ctx, const SwsFilterParams *params, SwsFilterWeights **out)
 Generate a filter kernel for the given parameters. More...
 

Macro Definition Documentation

◆ SWS_NUM_SCALER_PARAMS

#define SWS_NUM_SCALER_PARAMS   2

Definition at line 40 of file filters.h.

◆ SWS_MAX_REDUCE_CUTOFF

#define SWS_MAX_REDUCE_CUTOFF   0.002

Definition at line 41 of file filters.h.

◆ SWS_PARAM_DEFAULT

#define SWS_PARAM_DEFAULT   123456

Definition at line 42 of file filters.h.

Enumeration Type Documentation

◆ SwsScaler

enum SwsScaler
Enumerator
SWS_SCALE_AUTO 
SWS_SCALE_BILINEAR 

bilinear filtering

SWS_SCALE_BICUBIC 

2-tap cubic BC-spline

SWS_SCALE_POINT 

nearest neighbor (point sampling)

SWS_SCALE_AREA 

area averaging

SWS_SCALE_GAUSSIAN 

2-tap gaussian approximation

SWS_SCALE_SINC 

unwindowed sinc

SWS_SCALE_LANCZOS 

3-tap sinc/sinc

SWS_SCALE_SPLINE 

unwindowned natural cubic spline

SWS_SCALE_NB 

not part of the ABI

SWS_SCALE_MAX_ENUM 

force size to 32 bits, not a valid filter type

Definition at line 26 of file filters.h.

◆ anonymous enum

anonymous enum
Enumerator
SWS_FILTER_SCALE 

14-bit coefficients are picked to fit comfortably within int16_t for efficient SIMD processing (e.g.

pmaddwd on x86). Conversely, this limits the maximum filter size to 256, to avoid excessive precision loss. (Consider that 14 - 8 = 6 bit effective weight resolution)

Note that this limitation would not apply to floating-point filters, and in a future update to this code, we could gain the ability to generate unbounded floating point filters directly.

SWS_FILTER_SIZE_MAX 

Definition at line 45 of file filters.h.

Function Documentation

◆ ff_sws_filter_generate()

int ff_sws_filter_generate ( void *  log_ctx,
const SwsFilterParams params,
SwsFilterWeights **  out 
)

Generate a filter kernel for the given parameters.

The generated filter is allocated as a refstruct and must be unref'd by the caller.

Returns 0 or a negative error code. In particular, this may return:

SWS_SCALE_AREA is a pseudo-filter that is equivalent to bilinear filtering for upscaling (since bilinear just evenly mixes samples according to the relative distance), and equivalent to (anti-aliased) point sampling for downscaling.

Definition at line 185 of file filters.c.

Referenced by cudascale_filter_init().