Commit bdc4db0e authored by Arwa Arif's avatar Arwa Arif Committed by Stefano Sabatini

lavfi: port mp=fspp to a native libavfilter filter

Signed-off-by: 's avatarStefano Sabatini <stefasab@gmail.com>
parent ecafde66
......@@ -31,6 +31,7 @@ Specifically, the GPL parts of FFmpeg are:
- vf_cropdetect.c
- vf_decimate.c
- vf_delogo.c
- vf_fspp.c
- vf_geq.c
- vf_histeq.c
- vf_hqdn3d.c
......
......@@ -2582,6 +2582,7 @@ ebur128_filter_deps="gpl"
flite_filter_deps="libflite"
frei0r_filter_deps="frei0r dlopen"
frei0r_src_filter_deps="frei0r dlopen"
fspp_filter_deps="gpl"
geq_filter_deps="gpl"
histeq_filter_deps="gpl"
hqdn3d_filter_deps="gpl"
......
......@@ -5066,6 +5066,37 @@ frei0r=perspective:0.2/0.2|0.8/0.2
For more information, see
@url{http://frei0r.dyne.org}
@section fspp
Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
processing filter, one of them is performed once per block, not per pixel.
This allows for much higher speed.
The filter accepts the following options:
@table @option
@item quality
Set quality. This option defines the number of levels for averaging. It accepts
an integer in the range 4-5. Default value is @code{4}.
@item qp
Force a constant quantization parameter. It accepts an integer in range 0-63.
If not set, the filter will use the QP from the video stream (if available).
@item strength
Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
more details but also more artifacts, while higher values make the image smoother
but also blurrier. Default value is @code{0} − PSNR optimal.
@item use_bframe_qp
Enable the use of the QP from the B-Frames if set to @code{1}. Using this
option may cause flicker since the B-Frames have often larger QP. Default is
@code{0} (not enabled).
@end table
@section geq
The filter accepts the following options:
......@@ -8361,6 +8392,7 @@ stereo3d=abl:sbsr
@end example
@end itemize
@anchor{spp}
@section spp
Apply a simple postprocessing filter that compresses and decompresses the image
......
......@@ -126,6 +126,7 @@ OBJS-$(CONFIG_FRAMESTEP_FILTER) += vf_framestep.o
OBJS-$(CONFIG_FPS_FILTER) += vf_fps.o
OBJS-$(CONFIG_FRAMEPACK_FILTER) += vf_framepack.o
OBJS-$(CONFIG_FREI0R_FILTER) += vf_frei0r.o
OBJS-$(CONFIG_FSPP_FILTER) += vf_fspp.o
OBJS-$(CONFIG_GEQ_FILTER) += vf_geq.o
OBJS-$(CONFIG_GRADFUN_FILTER) += vf_gradfun.o
OBJS-$(CONFIG_HALDCLUT_FILTER) += vf_lut3d.o dualinput.o framesync.o
......
......@@ -142,6 +142,7 @@ void avfilter_register_all(void)
REGISTER_FILTER(FRAMEPACK, framepack, vf);
REGISTER_FILTER(FRAMESTEP, framestep, vf);
REGISTER_FILTER(FREI0R, frei0r, vf);
REGISTER_FILTER(FSPP, fspp, vf);
REGISTER_FILTER(GEQ, geq, vf);
REGISTER_FILTER(GRADFUN, gradfun, vf);
REGISTER_FILTER(HALDCLUT, haldclut, vf);
......
......@@ -710,8 +710,8 @@ const vf_info_t ff_vf_info_fspp = {
#if HAVE_MMX_INLINE
DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_382683433)=FIX64(0.382683433, 14);
DECLARE_ALIGNED(8, uint64_t, ff_MM_FIX_0_541196100)=FIX64(0.541196100, 14);
DECLARE_ALIGNED(8, uint64_t, ff_MM_FIX_0_707106781)=FIX64(0.707106781, 14);
extern uint64_t ff_MM_FIX_0_707106781;
extern uint64_t ff_MM_FIX_0_541196100;
DECLARE_ASM_CONST(8, uint64_t, MM_FIX_1_306562965)=FIX64(1.306562965, 14);
DECLARE_ASM_CONST(8, uint64_t, MM_FIX_1_414213562_A)=FIX64(1.414213562, 14);
......
......@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 5
#define LIBAVFILTER_VERSION_MINOR 4
#define LIBAVFILTER_VERSION_MINOR 5
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
......
This diff is collapsed.
/*
* Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
* Copyright (C) 2005 Nikolaj Poroshin <porosh3@psu.ru>
* Copyright (c) 2014 Arwa Arif <arwaarif1994@gmail.com>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with FFmpeg; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef AVFILTER_FSPP_H
#define AVFILTER_FSPP_H
#include "avfilter.h"
#define BLOCKSZ 12
#define MAX_LEVEL 5
#define DCTSIZE 8
#define DCTSIZE_S "8"
#define FIX(x,s) ((int) ((x) * (1 << s) + 0.5) & 0xffff)
#define C64(x) ((uint64_t)((x) | (x) << 16)) <<32 | (uint64_t)(x) | (uint64_t)(x) << 16
#define FIX64(x,s) C64(FIX(x,s))
#define MULTIPLY16H(x,k) (((x) * (k)) >> 16)
#define THRESHOLD(r,x,t) \
if(((unsigned)((x) + t)) > t * 2) r = (x); \
else r = 0;
#define DESCALE(x,n) (((x) + (1 << ((n) - 1))) >> n)
typedef int32_t int_simd16_t;
static const int16_t FIX_0_382683433 = FIX(0.382683433, 14);
static const int16_t FIX_0_541196100 = FIX(0.541196100, 14);
static const int16_t FIX_0_707106781 = FIX(0.707106781, 14);
static const int16_t FIX_1_306562965 = FIX(1.306562965, 14);
static const int16_t FIX_1_414213562_A = FIX(1.414213562, 14);
static const int16_t FIX_1_847759065 = FIX(1.847759065, 13);
static const int16_t FIX_2_613125930 = FIX(-2.613125930, 13);
static const int16_t FIX_1_414213562 = FIX(1.414213562, 13);
static const int16_t FIX_1_082392200 = FIX(1.082392200, 13);
typedef struct FSPPContext {
AVClass *class;
uint64_t threshold_mtx_noq[8 * 2];
uint64_t threshold_mtx[8 * 2]; //used in both C & MMX (& later SSE2) versions
int log2_count;
int strength;
int hsub;
int vsub;
int temp_stride;
int qp;
int qscale_type;
int prev_q;
uint8_t *src;
int16_t *temp;
uint8_t *non_b_qp_table;
int non_b_qp_alloc_size;
int use_bframe_qp;
void (*store_slice)(uint8_t *dst, int16_t *src,
ptrdiff_t dst_stride, ptrdiff_t src_stride,
ptrdiff_t width, ptrdiff_t height, ptrdiff_t log2_scale);
void (*store_slice2)(uint8_t *dst, int16_t *src,
ptrdiff_t dst_stride, ptrdiff_t src_stride,
ptrdiff_t width, ptrdiff_t height, ptrdiff_t log2_scale);
void (*mul_thrmat)(struct FSPPContext *fspp, int q);
void (*column_fidct)(int16_t *thr_adr, int16_t *data,
int16_t *output, int cnt);
void (*row_idct)(int16_t *workspace, int16_t *output_adr,
int output_stride, int cnt);
void (*row_fdct)(int16_t *data, const uint8_t *pixels,
int line_size, int cnt);
} FSPPContext;
void ff_fspp_init_x86(FSPPContext *fspp);
#endif /* AVFILTER_FSPP_H */
OBJS-$(CONFIG_FSPP_FILTER) += x86/vf_fspp.o
OBJS-$(CONFIG_GRADFUN_FILTER) += x86/vf_gradfun_init.o
OBJS-$(CONFIG_HQDN3D_FILTER) += x86/vf_hqdn3d_init.o
OBJS-$(CONFIG_IDET_FILTER) += x86/vf_idet_init.o
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment