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

lavfi: port mp=pp7 to libavfilter

The only difference with mp=pp7 is that default mode is "medium", as stated
in the MPlayer docs, rather than "hard".
Signed-off-by: 's avatarStefano Sabatini <stefasab@gmail.com>
parent b1d22330
......@@ -43,6 +43,7 @@ Specifically, the GPL parts of FFmpeg are:
- vf_perspective.c
- vf_phase.c
- vf_pp.c
- vf_pp7.c
- vf_pullup.c
- vf_sab.c
- vf_smartblur.c
......
......@@ -2600,6 +2600,7 @@ mpdecimate_filter_select="pixelutils"
mptestsrc_filter_deps="gpl"
negate_filter_deps="lut_filter"
perspective_filter_deps="gpl"
pp7_filter_deps="gpl"
ocv_filter_deps="libopencv"
owdenoise_filter_deps="gpl"
pan_filter_deps="swresample"
......
......@@ -7193,6 +7193,32 @@ pp=hb|y/vb|a
@end example
@end itemize
@section pp7
Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
similar to spp = 6 with 7 point DCT, where only the center sample is
used after IDCT.
The filter accepts the following options:
@table @option
@item qp
Force a constant quantization parameter. It accepts an integer in range
0 to 63. If not set, the filter will use the QP from the video stream
(if available).
@item mode
Set thresholding mode. Available modes are:
@table @samp
@item hard
Set hard thresholding.
@item soft
Set soft thresholding (better de-ringing effect, but likely blurrier).
@item medium
Set medium thresholding (good results, default).
@end table
@end table
@section psnr
Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
......
......@@ -164,6 +164,7 @@ OBJS-$(CONFIG_PERSPECTIVE_FILTER) += vf_perspective.o
OBJS-$(CONFIG_PHASE_FILTER) += vf_phase.o
OBJS-$(CONFIG_PIXDESCTEST_FILTER) += vf_pixdesctest.o
OBJS-$(CONFIG_PP_FILTER) += vf_pp.o
OBJS-$(CONFIG_PP7_FILTER) += vf_pp7.o
OBJS-$(CONFIG_PSNR_FILTER) += vf_psnr.o dualinput.o framesync.o
OBJS-$(CONFIG_PULLUP_FILTER) += vf_pullup.o
OBJS-$(CONFIG_REMOVELOGO_FILTER) += bbox.o lswsutils.o lavfutils.o vf_removelogo.o
......
......@@ -179,6 +179,7 @@ void avfilter_register_all(void)
REGISTER_FILTER(PHASE, phase, vf);
REGISTER_FILTER(PIXDESCTEST, pixdesctest, vf);
REGISTER_FILTER(PP, pp, vf);
REGISTER_FILTER(PP7, pp7, vf);
REGISTER_FILTER(PSNR, psnr, vf);
REGISTER_FILTER(PULLUP, pullup, vf);
REGISTER_FILTER(REMOVELOGO, removelogo, vf);
......
......@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 5
#define LIBAVFILTER_VERSION_MINOR 6
#define LIBAVFILTER_VERSION_MINOR 7
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
......
This diff is collapsed.
/*
* Copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at>
* 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_PP7_H
#define AVFILTER_PP7_H
#include "avfilter.h"
typedef struct PP7Context {
AVClass *class;
int thres2[99][16];
int qp;
int mode;
int qscale_type;
int hsub;
int vsub;
int temp_stride;
uint8_t *src;
int (*requantize)(struct PP7Context *p, int16_t *src, int qp);
void (*dctB)(int16_t *dst, int16_t *src);
} PP7Context;
void ff_pp7_init_x86(PP7Context *pp7);
#endif /* AVFILTER_PP7_H */
......@@ -4,6 +4,7 @@ OBJS-$(CONFIG_HQDN3D_FILTER) += x86/vf_hqdn3d_init.o
OBJS-$(CONFIG_IDET_FILTER) += x86/vf_idet_init.o
OBJS-$(CONFIG_INTERLACE_FILTER) += x86/vf_interlace_init.o
OBJS-$(CONFIG_NOISE_FILTER) += x86/vf_noise.o
OBJS-$(CONFIG_PP7_FILTER) += x86/vf_pp7.o
OBJS-$(CONFIG_PULLUP_FILTER) += x86/vf_pullup_init.o
OBJS-$(CONFIG_SPP_FILTER) += x86/vf_spp.o
OBJS-$(CONFIG_TINTERLACE_FILTER) += x86/vf_tinterlace_init.o
......
/*
* Copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at>
*
* 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.
*/
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
#include "libavutil/mem.h"
#include "libavutil/x86/asm.h"
#include "libavfilter/vf_pp7.h"
static void dctB_mmx(int16_t *dst, int16_t *src)
{
#if HAVE_MMX_INLINE
__asm__ volatile (
"movq (%0), %%mm0 \n\t"
"movq 1*4*2(%0), %%mm1 \n\t"
"paddw 6*4*2(%0), %%mm0 \n\t"
"paddw 5*4*2(%0), %%mm1 \n\t"
"movq 2*4*2(%0), %%mm2 \n\t"
"movq 3*4*2(%0), %%mm3 \n\t"
"paddw 4*4*2(%0), %%mm2 \n\t"
"paddw %%mm3, %%mm3 \n\t" //s
"movq %%mm3, %%mm4 \n\t" //s
"psubw %%mm0, %%mm3 \n\t" //s-s0
"paddw %%mm0, %%mm4 \n\t" //s+s0
"movq %%mm2, %%mm0 \n\t" //s2
"psubw %%mm1, %%mm2 \n\t" //s2-s1
"paddw %%mm1, %%mm0 \n\t" //s2+s1
"movq %%mm4, %%mm1 \n\t" //s0'
"psubw %%mm0, %%mm4 \n\t" //s0'-s'
"paddw %%mm0, %%mm1 \n\t" //s0'+s'
"movq %%mm3, %%mm0 \n\t" //s3'
"psubw %%mm2, %%mm3 \n\t"
"psubw %%mm2, %%mm3 \n\t"
"paddw %%mm0, %%mm2 \n\t"
"paddw %%mm0, %%mm2 \n\t"
"movq %%mm1, (%1) \n\t"
"movq %%mm4, 2*4*2(%1) \n\t"
"movq %%mm2, 1*4*2(%1) \n\t"
"movq %%mm3, 3*4*2(%1) \n\t"
:: "r" (src), "r"(dst)
);
#endif
}
av_cold void ff_pp7_init_x86(PP7Context *p)
{
int cpu_flags = av_get_cpu_flags();
if (HAVE_MMX_INLINE && cpu_flags & AV_CPU_FLAG_MMX)
p->dctB = dctB_mmx;
}
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