FFmpeg
Data Structures | Macros | Functions | Variables
vf_super2xsai.c File Reference
#include "libavutil/pixdesc.h"
#include "libavutil/intreadwrite.h"
#include "avfilter.h"
#include "filters.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  Super2xSaIContext
 
struct  ThreadData
 Used for passing data between threads. More...
 

Macros

#define GET_RESULT(A, B, C, D)   ((A != C || A != D) - (B != C || B != D))
 
#define INTERPOLATE(A, B)   (((A & hi_pixel_mask) >> 1) + ((B & hi_pixel_mask) >> 1) + (A & B & lo_pixel_mask))
 
#define Q_INTERPOLATE(A, B, C, D)
 
#define READ_COLOR4(dst, src_line, off)   dst = *((const uint32_t *)src_line + off)
 
#define READ_COLOR3(dst, src_line, off)   dst = AV_RL24 (src_line + 3*off)
 
#define READ_COLOR2(dst, src_line, off)   dst = s->is_be ? AV_RB16(src_line + 2 * off) : AV_RL16(src_line + 2 * off)
 

Functions

static int super2xsai (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int config_input (AVFilterLink *inlink)
 
static int config_output (AVFilterLink *outlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 

Variables

static enum AVPixelFormat pix_fmts []
 
static const AVFilterPad super2xsai_inputs []
 
static const AVFilterPad super2xsai_outputs []
 
const AVFilter ff_vf_super2xsai
 

Detailed Description

Super 2xSaI video filter Ported from MPlayer libmpcodecs/vf_2xsai.c.

Definition in file vf_super2xsai.c.

Macro Definition Documentation

◆ GET_RESULT

#define GET_RESULT (   A,
  B,
  C,
  D 
)    ((A != C || A != D) - (B != C || B != D))

Definition at line 52 of file vf_super2xsai.c.

◆ INTERPOLATE

#define INTERPOLATE (   A,
  B 
)    (((A & hi_pixel_mask) >> 1) + ((B & hi_pixel_mask) >> 1) + (A & B & lo_pixel_mask))

Definition at line 54 of file vf_super2xsai.c.

◆ Q_INTERPOLATE

#define Q_INTERPOLATE (   A,
  B,
  C,
  D 
)
Value:
((A & q_hi_pixel_mask) >> 2) + ((B & q_hi_pixel_mask) >> 2) + ((C & q_hi_pixel_mask) >> 2) + ((D & q_hi_pixel_mask) >> 2) \
+ ((((A & q_lo_pixel_mask) + (B & q_lo_pixel_mask) + (C & q_lo_pixel_mask) + (D & q_lo_pixel_mask)) >> 2) & q_lo_pixel_mask)

Definition at line 56 of file vf_super2xsai.c.

◆ READ_COLOR4

#define READ_COLOR4 (   dst,
  src_line,
  off 
)    dst = *((const uint32_t *)src_line + off)

◆ READ_COLOR3

#define READ_COLOR3 (   dst,
  src_line,
  off 
)    dst = AV_RL24 (src_line + 3*off)

◆ READ_COLOR2

#define READ_COLOR2 (   dst,
  src_line,
  off 
)    dst = s->is_be ? AV_RB16(src_line + 2 * off) : AV_RL16(src_line + 2 * off)

Function Documentation

◆ super2xsai()

static int super2xsai ( AVFilterContext ctx,
void *  arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 59 of file vf_super2xsai.c.

Referenced by filter_frame().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 255 of file vf_super2xsai.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 299 of file vf_super2xsai.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 313 of file vf_super2xsai.c.

Variable Documentation

◆ pix_fmts

enum AVPixelFormat pix_fmts[]
static

◆ super2xsai_inputs

const AVFilterPad super2xsai_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_input,
.filter_frame = filter_frame,
},
}

Definition at line 335 of file vf_super2xsai.c.

◆ super2xsai_outputs

const AVFilterPad super2xsai_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
},
}

Definition at line 344 of file vf_super2xsai.c.

◆ ff_vf_super2xsai

const AVFilter ff_vf_super2xsai
Initial value:
= {
.name = "super2xsai",
.description = NULL_IF_CONFIG_SMALL("Scale the input by 2x using the Super2xSaI pixel art algorithm."),
.priv_size = sizeof(Super2xSaIContext),
}

Definition at line 352 of file vf_super2xsai.c.

A
#define A(x)
Definition: vpx_arith.h:28
super2xsai_outputs
static const AVFilterPad super2xsai_outputs[]
Definition: vf_super2xsai.c:344
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: filters.h:242
Super2xSaIContext
Definition: vf_super2xsai.c:35
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_super2xsai.c:255
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:76
AV_PIX_FMT_BGRA
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:102
super2xsai_inputs
static const AVFilterPad super2xsai_inputs[]
Definition: vf_super2xsai.c:335
AV_PIX_FMT_RGB555BE
@ AV_PIX_FMT_RGB555BE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
Definition: pixfmt.h:114
D
D(D(float, sse)
Definition: rematrix_init.c:30
C
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s your new playground is ready Some little details about what s going which in turn will define variables for the build system and the C
Definition: writing_filters.txt:58
B
#define B
Definition: huffyuv.h:42
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
AV_PIX_FMT_RGBA
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:100
AV_PIX_FMT_RGB565LE
@ AV_PIX_FMT_RGB565LE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
Definition: pixfmt.h:113
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_super2xsai.c:313
AV_PIX_FMT_BGR565LE
@ AV_PIX_FMT_BGR565LE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
Definition: pixfmt.h:118
AV_PIX_FMT_BGR555BE
@ AV_PIX_FMT_BGR555BE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
Definition: pixfmt.h:119
AV_PIX_FMT_ABGR
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:101
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_super2xsai.c:299
AV_PIX_FMT_RGB24
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:75
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
AV_PIX_FMT_BGR565BE
@ AV_PIX_FMT_BGR565BE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
Definition: pixfmt.h:117
AV_PIX_FMT_ARGB
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:99
AV_PIX_FMT_RGB555LE
@ AV_PIX_FMT_RGB555LE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
Definition: pixfmt.h:115
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_super2xsai.c:247
AV_PIX_FMT_RGB565BE
@ AV_PIX_FMT_RGB565BE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
Definition: pixfmt.h:112
AVFILTER_FLAG_SLICE_THREADS
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:152
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_BGR555LE
@ AV_PIX_FMT_BGR555LE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined
Definition: pixfmt.h:120