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

Go to the source code of this file.

Data Structures

struct  Super2xSaIContext
 

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 void super2xsai (AVFilterContext *ctx, uint8_t *src, int src_linesize, uint8_t *dst, int dst_linesize, int width, int height)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int config_output (AVFilterLink *outlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *inpicref)
 

Variables

static const AVFilterPad super2xsai_inputs []
 
static const AVFilterPad super2xsai_outputs []
 
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 49 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 51 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 53 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 void super2xsai ( AVFilterContext ctx,
uint8_t src,
int  src_linesize,
uint8_t dst,
int  dst_linesize,
int  width,
int  height 
)
static

Definition at line 56 of file vf_super2xsai.c.

Referenced by filter_frame().

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 234 of file vf_super2xsai.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 250 of file vf_super2xsai.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 294 of file vf_super2xsai.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame inpicref 
)
static

Definition at line 308 of file vf_super2xsai.c.

Variable Documentation

◆ super2xsai_inputs

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

Definition at line 328 of file vf_super2xsai.c.

◆ super2xsai_outputs

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

Definition at line 338 of file vf_super2xsai.c.

◆ ff_vf_super2xsai

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 347 of file vf_super2xsai.c.

super2xsai_outputs
static const AVFilterPad super2xsai_outputs[]
Definition: vf_super2xsai.c:338
Super2xSaIContext
Definition: vf_super2xsai.c:36
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_super2xsai.c:250
super2xsai_inputs
static const AVFilterPad super2xsai_inputs[]
Definition: vf_super2xsai.c:328
D
D(D(float, sse)
Definition: rematrix_init.c:28
A
#define A(x)
Definition: vp56_arith.h:28
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
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_super2xsai.c:234
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
Definition: vf_super2xsai.c:308
NULL
#define NULL
Definition: coverity.c:32
inputs
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Definition: filter_design.txt:243
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_super2xsai.c:294
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:188
B
#define B
Definition: huffyuvdsp.h:32
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201