FFmpeg
Loading...
Searching...
No Matches
vf_fspp.c File Reference

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

#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)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define REORDER(a, b, c, d, e, f, g, 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.

Referenced by filter().

◆ MAX_LEVEL

#define MAX_LEVEL   5

Definition at line 53 of file vf_fspp.c.

◆ OFFSET

#define OFFSET ( x)
Value:
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 )
Value:
c, g, a, e, f, d, b, h
#define f(width, name)
Definition cbs_vp8.c:236
int a
#define b
Definition input.c:43
const char * g
Definition vf_curves.c:128
static double c[64]

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.

◆ 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 }
}
#define FLAGS
Definition cmdutils.c:598
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326
#define MAX_LEVEL
Definition rl.h:36

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),
}
#define REORDER(a, b, c, d, e, f, g, h)

Definition at line 91 of file vf_fspp.c.

Referenced by filter_frame().

◆ pix_fmts

enum AVPixelFormat pix_fmts[]
static
Initial value:
= {
}
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition pixfmt.h:106
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition pixfmt.h:77
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition pixfmt.h:81
@ 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
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition pixfmt.h:79
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition pixfmt.h:80
@ 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_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_GBRP
planar GBR 4:4:4 24bpp
Definition pixfmt.h:165
@ 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
@ 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

Definition at line 208 of file vf_fspp.c.

◆ fspp_inputs

const AVFilterPad fspp_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_input,
.filter_frame = filter_frame,
},
}
static int config_input(AVFilterLink *inlink)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition dolby_e.c:1067
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200

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),
}
#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:204
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_PIXFMTS_ARRAY(array)
Definition filters.h:244
static const AVFilterPad fspp_inputs[]
Definition vf_fspp.c:337
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
static enum AVPixelFormat pix_fmts[]
Definition libkvazaar.c:296
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

Definition at line 346 of file vf_fspp.c.