FFmpeg
Data Structures | Macros | Functions | Variables
vf_uspp.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/video_enc_params.h"
#include "libavcodec/avcodec.h"
#include "internal.h"
#include "qp_table.h"
#include "avfilter.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  USPPContext
 

Macros

#define MAX_LEVEL   8 /* quality levels */
 
#define BLOCK   16
 
#define OFFSET(x)   offsetof(USPPContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define STORE(pos)
 

Functions

 AVFILTER_DEFINE_CLASS (uspp)
 
static void store_slice_c (uint8_t *dst, const uint16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale)
 
static int filter_1phase (AVFilterContext *ctx, void *arg, int i, int nb_jobs)
 
static void filter (AVFilterContext *ctx, uint8_t *dst[3], uint8_t *src[3], int dst_stride[3], int src_stride[3], int width, int height, uint8_t *qp_store, int qp_stride)
 
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 uspp_options []
 
static const uint8_t dither [8][8]
 
static const uint8_t offset [511][2]
 
static enum AVPixelFormat pix_fmts []
 
static const AVFilterPad uspp_inputs []
 
const AVFilter ff_vf_uspp
 

Detailed Description

Ultra Slow/Simple Post-processing filter.

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

Definition in file vf_uspp.c.

Macro Definition Documentation

◆ MAX_LEVEL

#define MAX_LEVEL   8 /* quality levels */

Definition at line 42 of file vf_uspp.c.

◆ BLOCK

#define BLOCK   16

Definition at line 43 of file vf_uspp.c.

◆ OFFSET

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

Definition at line 69 of file vf_uspp.c.

◆ FLAGS

Definition at line 70 of file vf_uspp.c.

◆ STORE

#define STORE (   pos)
Value:
do { \
temp = ((src[x + y * src_stride + pos] << log2_scale) + d[pos]) >> 8; \
if (temp & 0x100) temp = ~(temp >> 31); \
dst[x + y * dst_stride + pos] = temp; \
} while (0)

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( uspp  )

◆ store_slice_c()

static void store_slice_c ( uint8_t *  dst,
const uint16_t *  src,
int  dst_stride,
int  src_stride,
int  width,
int  height,
int  log2_scale 
)
static

Definition at line 166 of file vf_uspp.c.

Referenced by filter().

◆ filter_1phase()

static int filter_1phase ( AVFilterContext ctx,
void *  arg,
int  i,
int  nb_jobs 
)
static

Definition at line 194 of file vf_uspp.c.

Referenced by filter().

◆ filter()

static void filter ( AVFilterContext ctx,
uint8_t *  dst[3],
uint8_t *  src[3],
int  dst_stride[3],
int  src_stride[3],
int  width,
int  height,
uint8_t *  qp_store,
int  qp_stride 
)
static

Definition at line 278 of file vf_uspp.c.

Referenced by filter_frame().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 348 of file vf_uspp.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 446 of file vf_uspp.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 519 of file vf_uspp.c.

Variable Documentation

◆ uspp_options

const AVOption uspp_options[]
static
Initial value:
= {
{ "quality", "set quality", OFFSET(log2_count), AV_OPT_TYPE_INT, {.i64 = 3}, 0, MAX_LEVEL, FLAGS },
{ "qp", "force a constant quantizer parameter", OFFSET(qp), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 63, FLAGS },
{ "use_bframe_qp", "use B-frames' QP", OFFSET(use_bframe_qp), AV_OPT_TYPE_BOOL,{.i64 = 0}, 0, 1, FLAGS },
{ "codec", "Codec name", OFFSET(codec_name), AV_OPT_TYPE_STRING, {.str = "snow"}, 0, 0, FLAGS },
{ NULL }
}

Definition at line 71 of file vf_uspp.c.

◆ dither

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

Definition at line 81 of file vf_uspp.c.

Referenced by store_slice_c().

◆ offset

const uint8_t offset[511][2]
static

Definition at line 92 of file vf_uspp.c.

Referenced by filter_1phase().

◆ pix_fmts

enum AVPixelFormat pix_fmts[]
static

◆ uspp_inputs

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

Definition at line 541 of file vf_uspp.c.

◆ ff_vf_uspp

const AVFilter ff_vf_uspp
Initial value:
= {
.name = "uspp",
.description = NULL_IF_CONFIG_SMALL("Apply Ultra Simple / Slow Post-processing filter."),
.priv_size = sizeof(USPPContext),
.priv_class = &uspp_class,
}

Definition at line 550 of file vf_uspp.c.

uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_uspp.c:519
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_uspp.c:446
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:162
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_uspp.c:348
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_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
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
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:106
MAX_LEVEL
#define MAX_LEVEL
Definition: vf_uspp.c:42
USPPContext
Definition: vf_uspp.c:45
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_uspp.c:338
pos
unsigned int pos
Definition: spdifenc.c:413
uspp_inputs
static const AVFilterPad uspp_inputs[]
Definition: vf_uspp.c:541
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
temp
else temp
Definition: vf_mcdeint.c:263
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
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:117
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FLAGS
#define FLAGS
Definition: vf_uspp.c:70
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:251
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
d
d
Definition: ffmpeg_filter.c:409
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:155
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
OFFSET
#define OFFSET(x)
Definition: vf_uspp.c:69
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:239