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

Go to the source code of this file.

Data Structures

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

Enumerations

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...
 

Enumeration Type Documentation

◆ 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 29 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 183 of file filters.c.

Referenced by check_filter().