FFmpeg
Data Structures | Macros | Functions | Variables
vf_fspp.c File Reference
#include "libavutil/emms.h"
#include "libavutil/imgutils.h"
#include "libavutil/mem.h"
#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/video_enc_params.h"
#include "avfilter.h"
#include "filters.h"
#include "qp_table.h"
#include "vf_fsppdsp.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  FSPPContext
 

Macros

#define BLOCKSZ   12
 
#define MAX_LEVEL   5
 
#define OFFSET(x)   offsetof(FSPPContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define REORDER(a, b, c, d, e, f, g, h)   c, g, a, e, f, d, b, h
 

Functions

 AVFILTER_DEFINE_CLASS (fspp)
 
static void filter (FSPPContext *p, uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, int width, int height, uint8_t *qp_store, int qp_stride, int is_luma)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption fspp_options []
 
static const short custom_threshold [64]
 
static enum AVPixelFormat pix_fmts []
 
static const AVFilterPad fspp_inputs []
 
const FFFilter ff_vf_fspp
 

Detailed Description

Fast Simple Post-processing filter This implementation is based on an algorithm described in "Aria Nosratinia Embedded Post-Processing for Enhancement of Compressed Images (1999)" (http://www.utdallas.edu/~aria/papers/vlsisp99.pdf) Further, with splitting (I)DCT into horizontal/vertical passes, one of them can be performed once per block, not per pixel. This allows for much higher speed.

Originally written by Michael Niedermayer and Nikolaj for the MPlayer project, and ported by Arwa Arif for FFmpeg.

Definition in file vf_fspp.c.

Macro Definition Documentation

◆ BLOCKSZ

#define BLOCKSZ   12

Definition at line 52 of file vf_fspp.c.

◆ MAX_LEVEL

#define MAX_LEVEL   5

Definition at line 53 of file vf_fspp.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(FSPPContext, x)

Definition at line 79 of file vf_fspp.c.

◆ FLAGS

Definition at line 80 of file vf_fspp.c.

◆ REORDER

#define REORDER (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)    c, g, a, e, f, d, b, h

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( fspp  )

◆ filter()

static void filter ( FSPPContext p,
uint8_t *  dst,
uint8_t *  src,
int  dst_stride,
int  src_stride,
int  width,
int  height,
uint8_t *  qp_store,
int  qp_stride,
int  is_luma 
)
static

Definition at line 107 of file vf_fspp.c.

Referenced by filter_frame().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 218 of file vf_fspp.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 240 of file vf_fspp.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 329 of file vf_fspp.c.

Variable Documentation

◆ fspp_options

const AVOption fspp_options[]
static
Initial value:
= {
{ "quality", "set quality", OFFSET(log2_count), AV_OPT_TYPE_INT, {.i64 = 4}, 4, MAX_LEVEL, FLAGS },
{ "qp", "force a constant quantizer parameter", OFFSET(qp), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 64, FLAGS },
{ "strength", "set filter strength", OFFSET(strength), AV_OPT_TYPE_INT, {.i64 = 0}, -15, 32, FLAGS },
{ "use_bframe_qp", "use B-frames' QP", OFFSET(use_bframe_qp), AV_OPT_TYPE_BOOL,{.i64 = 0}, 0, 1, FLAGS },
{ NULL }
}

Definition at line 81 of file vf_fspp.c.

◆ custom_threshold

const short custom_threshold[64]
static
Initial value:
= {
#define REORDER(a,b,c,d,e,f,g,h)
REORDER( 71, 296, 295, 237, 71, 40, 38, 19),
REORDER(245, 193, 185, 121, 102, 73, 53, 27),
REORDER(158, 129, 141, 107, 97, 73, 50, 26),
REORDER(102, 116, 109, 98, 82, 66, 45, 23),
REORDER( 71, 94, 95, 81, 70, 56, 38, 20),
REORDER( 56, 77, 74, 66, 56, 44, 30, 15),
REORDER( 38, 53, 50, 45, 38, 30, 21, 11),
}

Definition at line 91 of file vf_fspp.c.

Referenced by filter_frame().

◆ pix_fmts

enum AVPixelFormat pix_fmts[]
static

◆ fspp_inputs

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

Definition at line 337 of file vf_fspp.c.

◆ ff_vf_fspp

const FFFilter ff_vf_fspp
Initial value:
= {
.p.name = "fspp",
.p.description = NULL_IF_CONFIG_SMALL("Apply Fast Simple Post-processing filter."),
.p.priv_class = &fspp_class,
.priv_size = sizeof(FSPPContext),
}

Definition at line 346 of file vf_fspp.c.

FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: filters.h:243
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_fspp.c:218
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:263
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:106
OFFSET
#define OFFSET(x)
Definition: vf_fspp.c:79
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_fspp.c:329
ff_video_default_filterpad
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition: video.c:37
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:86
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:264
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:87
NULL
#define NULL
Definition: coverity.c:32
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:85
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_fspp.c:208
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
fspp_inputs
static const AVFilterPad fspp_inputs[]
Definition: vf_fspp.c:337
MAX_LEVEL
#define MAX_LEVEL
Definition: vf_fspp.c:53
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_fspp.c:240
AV_PIX_FMT_YUVJ440P
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
Definition: pixfmt.h:107
FSPPContext
Definition: vf_fspp.c:55
FLAGS
#define FLAGS
Definition: vf_fspp.c:80
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
REORDER
#define REORDER(a, b, c, d, e, f, g, h)
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:165
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:200
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:80
AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
Definition: avfilter.h:205
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:79