FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
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/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "internal.h"
#include "vf_fspp.h"

Go to the source code of this file.

Macros

#define OFFSET(x)   offsetof(FSPPContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define STORE(pos)
 
#define STORE2(pos)
 

Functions

 AVFILTER_DEFINE_CLASS (fspp)
 
static void store_slice_c (uint8_t *dst, int16_t *src, ptrdiff_t dst_stride, ptrdiff_t src_stride, ptrdiff_t width, ptrdiff_t height, ptrdiff_t log2_scale)
 
static void store_slice2_c (uint8_t *dst, int16_t *src, ptrdiff_t dst_stride, ptrdiff_t src_stride, ptrdiff_t width, ptrdiff_t height, ptrdiff_t log2_scale)
 
static void mul_thrmat_c (int16_t *thr_adr_noq, int16_t *thr_adr, int q)
 
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 void column_fidct_c (int16_t *thr_adr, int16_t *data, int16_t *output, int cnt)
 
static void row_idct_c (int16_t *workspace, int16_t *output_adr, ptrdiff_t output_stride, int cnt)
 
static void row_fdct_c (int16_t *data, const uint8_t *pixels, ptrdiff_t line_size, int cnt)
 
static int query_formats (AVFilterContext *ctx)
 
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 uint8_t dither [8][8]
 
static const short custom_threshold [64]
 
static const AVFilterPad fspp_inputs []
 
static const AVFilterPad fspp_outputs []
 
AVFilter 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

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

Definition at line 45 of file vf_fspp.c.

Definition at line 46 of file vf_fspp.c.

#define STORE (   pos)
Value:
temp = (src[x + pos] + (d[pos] >> log2_scale)) >> (6 - log2_scale); \
src[x + pos] = src[x + pos - 8 * src_stride] = 0; \
if (temp & 0x100) temp = ~(temp >> 31); \
dst[x + pos] = temp;
else temp
Definition: vf_mcdeint.c:256
#define src
Definition: vp8dsp.c:254
if(ret< 0)
Definition: vf_mcdeint.c:279

Referenced by store_slice_c().

#define STORE2 (   pos)
Value:
temp = (src[x + pos] + src[x + pos + 16 * src_stride] + (d[pos] >> log2_scale)) >> (6 - log2_scale); \
src[x + pos + 16 * src_stride] = 0; \
if (temp & 0x100) temp = ~(temp >> 31); \
dst[x + pos] = temp;
else temp
Definition: vf_mcdeint.c:256
#define src
Definition: vp8dsp.c:254
if(ret< 0)
Definition: vf_mcdeint.c:279

Referenced by store_slice2_c().

Function Documentation

AVFILTER_DEFINE_CLASS ( fspp  )
static void store_slice_c ( uint8_t dst,
int16_t *  src,
ptrdiff_t  dst_stride,
ptrdiff_t  src_stride,
ptrdiff_t  width,
ptrdiff_t  height,
ptrdiff_t  log2_scale 
)
static

Definition at line 83 of file vf_fspp.c.

Referenced by config_input().

static void store_slice2_c ( uint8_t dst,
int16_t *  src,
ptrdiff_t  dst_stride,
ptrdiff_t  src_stride,
ptrdiff_t  width,
ptrdiff_t  height,
ptrdiff_t  log2_scale 
)
static

Definition at line 113 of file vf_fspp.c.

Referenced by config_input().

static void mul_thrmat_c ( int16_t *  thr_adr_noq,
int16_t *  thr_adr,
int  q 
)
static

Definition at line 142 of file vf_fspp.c.

Referenced by config_input().

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 149 of file vf_fspp.c.

Referenced by filter_frame().

static void column_fidct_c ( int16_t *  thr_adr,
int16_t *  data,
int16_t *  output,
int  cnt 
)
static

Definition at line 247 of file vf_fspp.c.

Referenced by config_input().

static void row_idct_c ( int16_t *  workspace,
int16_t *  output_adr,
ptrdiff_t  output_stride,
int  cnt 
)
static

Definition at line 370 of file vf_fspp.c.

Referenced by config_input().

static void row_fdct_c ( int16_t *  data,
const uint8_t pixels,
ptrdiff_t  line_size,
int  cnt 
)
static

Definition at line 432 of file vf_fspp.c.

Referenced by config_input().

static int query_formats ( AVFilterContext ctx)
static

Definition at line 493 of file vf_fspp.c.

static int config_input ( AVFilterLink inlink)
static

Definition at line 511 of file vf_fspp.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 548 of file vf_fspp.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 657 of file vf_fspp.c.

Variable Documentation

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 NULL
Definition: coverity.c:32
#define MAX_LEVEL
Definition: rl.h:36
#define FLAGS
Definition: vf_fspp.c:46
#define OFFSET(x)
Definition: vf_fspp.c:45

Definition at line 47 of file vf_fspp.c.

const uint8_t dither[8][8]
static
Initial value:
= {
{ 0, 48, 12, 60, 3, 51, 15, 63, },
{ 32, 16, 44, 28, 35, 19, 47, 31, },
{ 8, 56, 4, 52, 11, 59, 7, 55, },
{ 40, 24, 36, 20, 43, 27, 39, 23, },
{ 2, 50, 14, 62, 1, 49, 13, 61, },
{ 34, 18, 46, 30, 33, 17, 45, 29, },
{ 10, 58, 6, 54, 9, 57, 5, 53, },
{ 42, 26, 38, 22, 41, 25, 37, 21, },
}

Definition at line 57 of file vf_fspp.c.

Referenced by ac3_decode_transform_coeffs_ch(), encode_frame(), quantize_triangular_ns(), render_charset(), rv40_loop_filter(), store_slice2_c(), store_slice_c(), and yuv2yuvX_TMPL().

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

Definition at line 68 of file vf_fspp.c.

Referenced by filter_frame().

const AVFilterPad fspp_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_input,
.filter_frame = filter_frame,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int config_input(AVFilterLink *inlink)
Definition: vf_fspp.c:511
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_fspp.c:548

Definition at line 665 of file vf_fspp.c.

const AVFilterPad fspp_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
#define NULL
Definition: coverity.c:32

Definition at line 675 of file vf_fspp.c.

AVFilter ff_vf_fspp
Initial value:
= {
.name = "fspp",
.description = NULL_IF_CONFIG_SMALL("Apply Fast Simple Post-processing filter."),
.priv_size = sizeof(FSPPContext),
.priv_class = &fspp_class,
}
static const AVFilterPad fspp_inputs[]
Definition: vf_fspp.c:665
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static const AVFilterPad inputs[]
Definition: af_acontrast.c:193
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_fspp.c:657
static int query_formats(AVFilterContext *ctx)
Definition: vf_fspp.c:493
#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:133
#define flags(name, subs,...)
Definition: cbs_av1.c:596
static const AVFilterPad fspp_outputs[]
Definition: vf_fspp.c:675

Definition at line 683 of file vf_fspp.c.