FFmpeg
Macros | Typedefs | Functions | Variables
postprocess.c File Reference
#include "config.h"
#include "libavutil/avutil.h"
#include "libavutil/avassert.h"
#include "libavutil/cpu.h"
#include "libavutil/intreadwrite.h"
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "postprocess.h"
#include "postprocess_internal.h"
#include "libavutil/avstring.h"
#include "libavutil/ppc/util_altivec.h"
#include "libavutil/ffversion.h"
#include "postprocess_template.c"

Go to the source code of this file.

Macros

#define LICENSE_PREFIX   "libpostproc license: "
 
#define GET_MODE_BUFFER_SIZE   500
 
#define OPTIONS_ARRAY_SIZE   10
 
#define BLOCK_SIZE   8
 
#define TEMP_STRIDE   8
 
#define TEMPLATE_PP_C   1
 

Typedefs

typedef void(* pp_fn) (const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height, const int8_t QPs[], int QPStride, int isColor, PPContext *c2)
 

Functions

unsigned postproc_version (void)
 Return the LIBPOSTPROC_VERSION_INT constant. More...
 
const char * postproc_configuration (void)
 Return the libpostproc build-time configuration. More...
 
const char * postproc_license (void)
 Return the libpostproc license. More...
 
 DECLARE_ASM_CONST (8, int, deringThreshold)
 
static int isHorizDC_C (const uint8_t src[], int stride, const PPContext *c)
 Check if the given 8x8 Block is mostly "flat". More...
 
static int isVertDC_C (const uint8_t src[], int stride, const PPContext *c)
 Check if the middle 8x8 Block in the given 8x16 block is flat. More...
 
static int isHorizMinMaxOk_C (const uint8_t src[], int stride, int QP)
 
static int isVertMinMaxOk_C (const uint8_t src[], int stride, int QP)
 
static int horizClassify_C (const uint8_t src[], int stride, const PPContext *c)
 
static int vertClassify_C (const uint8_t src[], int stride, const PPContext *c)
 
static void doHorizDefFilter_C (uint8_t dst[], int stride, const PPContext *c)
 
static void doHorizLowPass_C (uint8_t dst[], int stride, const PPContext *c)
 Do a horizontal low pass filter on the 10x8 block (dst points to middle 8x8 Block) using the 9-Tap Filter (1,1,2,2,4,2,2,1,1)/16 (C version) More...
 
static void horizX1Filter (uint8_t *src, int stride, int QP)
 Experimental Filter 1 (Horizontal) will not damage linear gradients Flat blocks should look like they were passed through the (1,1,2,2,4,2,2,1,1) 9-Tap filter can only smooth blocks at the expected locations (it cannot smooth them if they did move) MMX2 version does correct clipping C version does not not identical with the vertical one. More...
 
static av_always_inline void do_a_deblock_C (uint8_t *src, int step, int stride, const PPContext *c, int mode)
 accurate deblock filter More...
 
static void postProcess (const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height, const int8_t QPs[], int QPStride, int isColor, pp_mode *vm, pp_context *vc)
 
pp_modepp_get_mode_by_name_and_quality (const char *name, int quality)
 Return a pp_mode or NULL if an error occurred. More...
 
void pp_free_mode (pp_mode *mode)
 
static void reallocAlign (void **p, int size)
 
static void reallocBuffers (PPContext *c, int width, int height, int stride, int qpStride)
 
static const char * context_to_name (void *ptr)
 
av_cold pp_contextpp_get_context (int width, int height, int cpuCaps)
 
av_cold void pp_free_context (void *vc)
 
void pp_postprocess (const uint8_t *src[3], const int srcStride[3], uint8_t *dst[3], const int dstStride[3], int width, int height, const int8_t *QP_store, int QPStride, pp_mode *vm, void *vc, int pict_type)
 

Variables

const char postproc_ffversion [] = "FFmpeg version " FFMPEG_VERSION
 
static const struct PPFilter filters []
 
static const char *const replaceTable []
 
const char pp_help []
 a simple help text More...
 
static const AVClass av_codec_context_class = { "Postproc", context_to_name, NULL }
 

Detailed Description

postprocessing.

Definition in file postprocess.c.

Macro Definition Documentation

◆ LICENSE_PREFIX

#define LICENSE_PREFIX   "libpostproc license: "

◆ GET_MODE_BUFFER_SIZE

#define GET_MODE_BUFFER_SIZE   500

Definition at line 115 of file postprocess.c.

◆ OPTIONS_ARRAY_SIZE

#define OPTIONS_ARRAY_SIZE   10

Definition at line 116 of file postprocess.c.

◆ BLOCK_SIZE

#define BLOCK_SIZE   8

Definition at line 117 of file postprocess.c.

◆ TEMP_STRIDE

#define TEMP_STRIDE   8

Definition at line 118 of file postprocess.c.

◆ TEMPLATE_PP_C

#define TEMPLATE_PP_C   1

Definition at line 520 of file postprocess.c.

Typedef Documentation

◆ pp_fn

typedef void(* pp_fn) (const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height, const int8_t QPs[], int QPStride, int isColor, PPContext *c2)

Definition at line 556 of file postprocess.c.

Function Documentation

◆ DECLARE_ASM_CONST()

DECLARE_ASM_CONST ( ,
int  ,
deringThreshold   
)

◆ isHorizDC_C()

static int isHorizDC_C ( const uint8_t  src[],
int  stride,
const PPContext c 
)
inlinestatic

Check if the given 8x8 Block is mostly "flat".

Definition at line 176 of file postprocess.c.

Referenced by horizClassify_C().

◆ isVertDC_C()

static int isVertDC_C ( const uint8_t  src[],
int  stride,
const PPContext c 
)
inlinestatic

Check if the middle 8x8 Block in the given 8x16 block is flat.

Definition at line 199 of file postprocess.c.

Referenced by vertClassify_C().

◆ isHorizMinMaxOk_C()

static int isHorizMinMaxOk_C ( const uint8_t  src[],
int  stride,
int  QP 
)
inlinestatic

Definition at line 221 of file postprocess.c.

Referenced by horizClassify_C().

◆ isVertMinMaxOk_C()

static int isVertMinMaxOk_C ( const uint8_t  src[],
int  stride,
int  QP 
)
inlinestatic

Definition at line 237 of file postprocess.c.

Referenced by vertClassify_C().

◆ horizClassify_C()

static int horizClassify_C ( const uint8_t  src[],
int  stride,
const PPContext c 
)
inlinestatic

Definition at line 250 of file postprocess.c.

◆ vertClassify_C()

static int vertClassify_C ( const uint8_t  src[],
int  stride,
const PPContext c 
)
inlinestatic

Definition at line 259 of file postprocess.c.

◆ doHorizDefFilter_C()

static void doHorizDefFilter_C ( uint8_t  dst[],
int  stride,
const PPContext c 
)
inlinestatic

Definition at line 268 of file postprocess.c.

◆ doHorizLowPass_C()

static void doHorizLowPass_C ( uint8_t  dst[],
int  stride,
const PPContext c 
)
inlinestatic

Do a horizontal low pass filter on the 10x8 block (dst points to middle 8x8 Block) using the 9-Tap Filter (1,1,2,2,4,2,2,1,1)/16 (C version)

Definition at line 307 of file postprocess.c.

◆ horizX1Filter()

static void horizX1Filter ( uint8_t *  src,
int  stride,
int  QP 
)
inlinestatic

Experimental Filter 1 (Horizontal) will not damage linear gradients Flat blocks should look like they were passed through the (1,1,2,2,4,2,2,1,1) 9-Tap filter can only smooth blocks at the expected locations (it cannot smooth them if they did move) MMX2 version does correct clipping C version does not not identical with the vertical one.

Definition at line 347 of file postprocess.c.

Referenced by postProcess_TMPL().

◆ do_a_deblock_C()

static av_always_inline void do_a_deblock_C ( uint8_t *  src,
int  step,
int  stride,
const PPContext c,
int  mode 
)
static

accurate deblock filter

Definition at line 404 of file postprocess.c.

◆ postProcess()

static void postProcess ( const uint8_t  src[],
int  srcStride,
uint8_t  dst[],
int  dstStride,
int  width,
int  height,
const int8_t  QPs[],
int  QPStride,
int  isColor,
pp_mode vm,
pp_context vc 
)
inlinestatic

Definition at line 559 of file postprocess.c.

Referenced by pp_postprocess().

◆ reallocAlign()

static void reallocAlign ( void **  p,
int  size 
)
static

Definition at line 842 of file postprocess.c.

Referenced by reallocBuffers().

◆ reallocBuffers()

static void reallocBuffers ( PPContext c,
int  width,
int  height,
int  stride,
int  qpStride 
)
static

Definition at line 847 of file postprocess.c.

Referenced by pp_get_context(), and pp_postprocess().

◆ context_to_name()

static const char* context_to_name ( void *  ptr)
static

Definition at line 874 of file postprocess.c.

Variable Documentation

◆ postproc_ffversion

const char postproc_ffversion[] = "FFmpeg version " FFMPEG_VERSION

Definition at line 96 of file postprocess.c.

◆ filters

const struct PPFilter filters[]
static
Initial value:
=
{
{"hb", "hdeblock", 1, 1, 3, H_DEBLOCK},
{"vb", "vdeblock", 1, 2, 4, V_DEBLOCK},
{"h1", "x1hdeblock", 1, 1, 3, H_X1_FILTER},
{"v1", "x1vdeblock", 1, 2, 4, V_X1_FILTER},
{"ha", "ahdeblock", 1, 1, 3, H_A_DEBLOCK},
{"va", "avdeblock", 1, 2, 4, V_A_DEBLOCK},
{"dr", "dering", 1, 5, 6, DERING},
{"al", "autolevels", 0, 1, 2, LEVEL_FIX},
{"lb", "linblenddeint", 1, 1, 4, LINEAR_BLEND_DEINT_FILTER},
{"li", "linipoldeint", 1, 1, 4, LINEAR_IPOL_DEINT_FILTER},
{"ci", "cubicipoldeint", 1, 1, 4, CUBIC_IPOL_DEINT_FILTER},
{"md", "mediandeint", 1, 1, 4, MEDIAN_DEINT_FILTER},
{"fd", "ffmpegdeint", 1, 1, 4, FFMPEG_DEINT_FILTER},
{"l5", "lowpass5", 1, 1, 4, LOWPASS5_DEINT_FILTER},
{"tn", "tmpnoise", 1, 7, 8, TEMP_NOISE_FILTER},
{"fq", "forcequant", 1, 0, 0, FORCE_QUANT},
{"be", "bitexact", 1, 0, 0, BITEXACT},
{"vi", "visualize", 1, 0, 0, VISUALIZE},
{NULL, NULL,0,0,0,0}
}

Definition at line 135 of file postprocess.c.

Referenced by pp_get_mode_by_name_and_quality().

◆ replaceTable

const char* const replaceTable[]
static
Initial value:
=
{
"default", "hb:a,vb:a,dr:a",
"de", "hb:a,vb:a,dr:a",
"fast", "h1:a,v1:a,dr:a",
"fa", "h1:a,v1:a,dr:a",
"ac", "ha:a:128:7,va:a,dr:a",
}

Definition at line 160 of file postprocess.c.

Referenced by pp_get_mode_by_name_and_quality().

◆ av_codec_context_class

const AVClass av_codec_context_class = { "Postproc", context_to_name, NULL }
static

Definition at line 878 of file postprocess.c.

Referenced by pp_get_context().

FFMPEG_DEINT_FILTER
#define FFMPEG_DEINT_FILTER
Definition: postprocess_internal.h:67
FORCE_QUANT
#define FORCE_QUANT
Definition: postprocess_internal.h:71
LOWPASS5_DEINT_FILTER
#define LOWPASS5_DEINT_FILTER
Definition: postprocess_internal.h:68
H_A_DEBLOCK
#define H_A_DEBLOCK
Definition: postprocess_internal.h:56
V_A_DEBLOCK
#define V_A_DEBLOCK
Definition: postprocess_internal.h:52
V_DEBLOCK
#define V_DEBLOCK
Definition: postprocess_internal.h:36
TEMP_NOISE_FILTER
#define TEMP_NOISE_FILTER
Definition: postprocess_internal.h:70
NULL
#define NULL
Definition: coverity.c:32
MEDIAN_DEINT_FILTER
#define MEDIAN_DEINT_FILTER
Definition: postprocess_internal.h:66
V_X1_FILTER
#define V_X1_FILTER
Definition: postprocess_internal.h:51
BITEXACT
#define BITEXACT
Definition: postprocess_internal.h:72
H_DEBLOCK
#define H_DEBLOCK
Definition: postprocess_internal.h:37
DERING
#define DERING
Definition: postprocess_internal.h:38
VISUALIZE
#define VISUALIZE
Definition: postprocess_internal.h:73
CUBIC_IPOL_DEINT_FILTER
#define CUBIC_IPOL_DEINT_FILTER
Definition: postprocess_internal.h:65
LINEAR_BLEND_DEINT_FILTER
#define LINEAR_BLEND_DEINT_FILTER
Definition: postprocess_internal.h:63
LINEAR_IPOL_DEINT_FILTER
#define LINEAR_IPOL_DEINT_FILTER
Definition: postprocess_internal.h:62
H_X1_FILTER
#define H_X1_FILTER
Definition: postprocess_internal.h:55
LEVEL_FIX
#define LEVEL_FIX
Brightness & Contrast.
Definition: postprocess_internal.h:39