<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">ср, 14 мая 2025 г., 03:55 Andrew Randrianasulu <<a href="mailto:randrianasulu@gmail.com" target="_blank" rel="noreferrer">randrianasulu@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">вт, 6 мая 2025 г., 02:27 Michael Niedermayer <<a href="mailto:michael@niedermayer.cc" rel="noreferrer noreferrer" target="_blank">michael@niedermayer.cc</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This will be available in <a href="https://github.com/michaelni/libpostproc" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://github.com/michaelni/libpostproc</a><br>
either as a separate library or a ffmpeg source plugin whatever turns<br>
out more convenient to maintain<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">Congratulations, you broke building cinelerra-gg with ffmpeg.git despite our best efforts :/</div><div dir="auto"><br></div><div dir="auto">Why all this code movement?!</div><div dir="auto"><br></div><div dir="auto">For whom it "simple"?</div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">For some reason this mail not arrived into my inbox (spam filter ate it?)</div><div dir="auto"><br></div><div dir="auto"><a href="https://ffmpeg.org/pipermail/ffmpeg-devel/2025-May/343192.html" target="_blank" rel="noreferrer">https://ffmpeg.org/pipermail/ffmpeg-devel/2025-May/343192.html</a></div><div dir="auto"><br></div><div dir="auto">=====</div><div dir="auto"><br></div><div dir="auto"><pre>The idea of course here is to expand this to filters and other
things. Which again is trivial, nothing really is needed except
people simply following this style of a source plugin</pre></div><div dir="auto"><br></div><div dir="auto">=====</div><div dir="auto"><br></div><div dir="auto">I found this concerning. Because does this mean ffmpeg will be fragmented like Python or Rust into million pieces users supposed to held together?</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Sponsored-by: Sovereign Tech Fund<br>
Signed-off-by: Michael Niedermayer <<a href="mailto:michael@niedermayer.cc" rel="noreferrer noreferrer noreferrer" target="_blank">michael@niedermayer.cc</a>><br>
---<br>
LICENSE.md | 2 -<br>
MAINTAINERS | 2 -<br>
configure | 13 +-<br>
doc/filters.texi | 175 --<br>
fftools/ffprobe.c | 3 -<br>
fftools/opt_common.c | 3 -<br>
libavfilter/Makefile | 1 -<br>
libavfilter/allfilters.c | 1 -<br>
libavfilter/vf_pp.c | 191 --<br>
libavutil/avutil.h | 1 -<br>
libpostproc/Makefile | 23 -<br>
libpostproc/libpostproc.v | 7 -<br>
libpostproc/postprocess.c | 992 ------<br>
libpostproc/postprocess.h | 109 -<br>
libpostproc/postprocess_altivec_template.c | 1214 --------<br>
libpostproc/postprocess_internal.h | 185 --<br>
libpostproc/postprocess_template.c | 3293 --------------------<br>
libpostproc/postprocres.rc | 55 -<br>
libpostproc/tests/.gitignore | 3 -<br>
libpostproc/tests/blocktest.c | 113 -<br>
libpostproc/tests/stripetest.c | 115 -<br>
libpostproc/tests/temptest.c | 106 -<br>
libpostproc/tests/test_utils.c | 38 -<br>
libpostproc/tests/test_utils.h | 27 -<br>
libpostproc/version.c | 45 -<br>
libpostproc/version.h | 48 -<br>
libpostproc/version_major.h | 33 -<br>
tests/Makefile | 1 -<br>
tests/fate/filter-video.mak | 16 -<br>
tests/fate/libpostproc.mak | 14 -<br>
tests/ref/fate/blocktest | 1800 -----------<br>
tests/ref/fate/filter-pp | 10 -<br>
tests/ref/fate/filter-pp1 | 1 -<br>
tests/ref/fate/filter-pp2 | 1 -<br>
tests/ref/fate/filter-pp3 | 1 -<br>
tests/ref/fate/filter-pp4 | 1 -<br>
tests/ref/fate/filter-pp5 | 1 -<br>
tests/ref/fate/filter-pp6 | 1 -<br>
tests/ref/fate/filter-qp | 1 -<br>
tests/ref/fate/stripetest | 360 ---<br>
tests/ref/fate/temptest | 336 --<br>
tools/gen-rc | 1 -<br>
42 files changed, 1 insertion(+), 9342 deletions(-)<br>
delete mode 100644 libavfilter/vf_pp.c<br>
delete mode 100644 libpostproc/Makefile<br>
delete mode 100644 libpostproc/libpostproc.v<br>
delete mode 100644 libpostproc/postprocess.c<br>
delete mode 100644 libpostproc/postprocess.h<br>
delete mode 100644 libpostproc/postprocess_altivec_template.c<br>
delete mode 100644 libpostproc/postprocess_internal.h<br>
delete mode 100644 libpostproc/postprocess_template.c<br>
delete mode 100644 libpostproc/postprocres.rc<br>
delete mode 100644 libpostproc/tests/.gitignore<br>
delete mode 100644 libpostproc/tests/blocktest.c<br>
delete mode 100644 libpostproc/tests/stripetest.c<br>
delete mode 100644 libpostproc/tests/temptest.c<br>
delete mode 100644 libpostproc/tests/test_utils.c<br>
delete mode 100644 libpostproc/tests/test_utils.h<br>
delete mode 100644 libpostproc/version.c<br>
delete mode 100644 libpostproc/version.h<br>
delete mode 100644 libpostproc/version_major.h<br>
delete mode 100644 tests/fate/libpostproc.mak<br>
delete mode 100644 tests/ref/fate/blocktest<br>
delete mode 100644 tests/ref/fate/filter-pp<br>
delete mode 100644 tests/ref/fate/filter-pp1<br>
delete mode 100644 tests/ref/fate/filter-pp2<br>
delete mode 100644 tests/ref/fate/filter-pp3<br>
delete mode 100644 tests/ref/fate/filter-pp4<br>
delete mode 100644 tests/ref/fate/filter-pp5<br>
delete mode 100644 tests/ref/fate/filter-pp6<br>
delete mode 100644 tests/ref/fate/filter-qp<br>
delete mode 100644 tests/ref/fate/stripetest<br>
delete mode 100644 tests/ref/fate/temptest<br>
<br>
diff --git a/LICENSE.md b/LICENSE.md<br>
index 613070e1b63..371b0913ce7 100644<br>
--- a/LICENSE.md<br>
+++ b/LICENSE.md<br>
@@ -12,7 +12,6 @@ configure to activate them. In this case, FFmpeg's license changes to GPL v2+.<br>
<br>
Specifically, the GPL parts of FFmpeg are:<br>
<br>
-- libpostproc<br>
- optional x86 optimization in the files<br>
- `libavcodec/x86/flac_dsp_gpl.asm`<br>
- `libavcodec/x86/idct_mmx.c`<br>
@@ -45,7 +44,6 @@ Specifically, the GPL parts of FFmpeg are:<br>
- `vf_owdenoise.c`<br>
- `vf_perspective.c`<br>
- `vf_phase.c`<br>
- - `vf_pp.c`<br>
- `vf_pp7.c`<br>
- `vf_pullup.c`<br>
- `vf_repeatfields.c`<br>
diff --git a/MAINTAINERS b/MAINTAINERS<br>
index f58936db619..7f7faa05959 100644<br>
--- a/MAINTAINERS<br>
+++ b/MAINTAINERS<br>
@@ -134,8 +134,6 @@ Generic Parts:<br>
ratecontrol.c [2] Michael Niedermayer<br>
simple IDCT:<br>
simple_idct.c, simple_idct.h [2] Michael Niedermayer<br>
- postprocessing:<br>
- libpostproc/* [2] Michael Niedermayer<br>
table generation:<br>
tableprint.c, tableprint.h Reimar Doeffinger<br>
fixed point FFT:<br>
diff --git a/configure b/configure<br>
index 6c23a38be1f..2e69b3c56c3 100755<br>
--- a/configure<br>
+++ b/configure<br>
@@ -130,7 +130,6 @@ Component options:<br>
--disable-avformat disable libavformat build<br>
--disable-swresample disable libswresample build<br>
--disable-swscale disable libswscale build<br>
- --disable-postproc disable libpostproc build<br>
--disable-avfilter disable libavfilter build<br>
--disable-pthreads disable pthreads [autodetect]<br>
--disable-w32threads disable Win32 threads [autodetect]<br>
@@ -2072,7 +2071,6 @@ LIBRARY_LIST="<br>
avdevice<br>
avfilter<br>
swscale<br>
- postproc<br>
avformat<br>
avcodec<br>
swresample<br>
@@ -3969,7 +3967,6 @@ pan_filter_deps="swresample"<br>
perspective_filter_deps="gpl"<br>
phase_filter_deps="gpl"<br>
pp7_filter_deps="gpl"<br>
-pp_filter_deps="gpl postproc"<br>
prewitt_opencl_filter_deps="opencl"<br>
procamp_vaapi_filter_deps="vaapi"<br>
program_opencl_filter_deps="opencl"<br>
@@ -4086,8 +4083,6 @@ avfilter_suggest="libm stdatomic spirv_compiler"<br>
avformat_deps="avcodec avutil"<br>
avformat_suggest="libm network zlib stdatomic"<br>
avutil_suggest="clock_gettime ffnvcodec gcrypt libm libdrm libmfx opencl openssl user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia bcrypt stdatomic"<br>
-postproc_deps="avutil gpl"<br>
-postproc_suggest="libm stdatomic"<br>
swresample_deps="avutil"<br>
swresample_suggest="libm libsoxr stdatomic"<br>
swscale_deps="avutil"<br>
@@ -7533,7 +7528,7 @@ void (^block)(void);<br>
EOF<br>
<br>
# add some linker flags<br>
-check_ldflags -Wl,-rpath-link=:libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil<br>
+check_ldflags -Wl,-rpath-link=:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil<br>
enabled rpath && add_ldexeflags -Wl,-rpath,$libdir && add_ldsoflags -Wl,-rpath,$libdir<br>
test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic<br>
<br>
@@ -7898,7 +7893,6 @@ enabled fsync_filter && prepend avfilter_deps "avformat"<br>
enabled mcdeint_filter && prepend avfilter_deps "avcodec"<br>
enabled movie_filter && prepend avfilter_deps "avformat avcodec"<br>
enabled pan_filter && prepend avfilter_deps "swresample"<br>
-enabled pp_filter && prepend avfilter_deps "postproc"<br>
enabled qrencode_filter && prepend avfilter_deps "swscale"<br>
enabled qrencodesrc_filter && prepend avfilter_deps "swscale"<br>
enabled removelogo_filter && prepend avfilter_deps "avformat avcodec swscale"<br>
@@ -7950,9 +7944,6 @@ expand_deps(){<br>
reorder_by ${1}_deps LIBRARY_LIST # linking order is expected later<br>
}<br>
<br>
-#we have to remove gpl from the deps here as some code assumes all lib deps are libs<br>
-postproc_deps="$(filter_out 'gpl' $postproc_deps)"<br>
-<br>
map 'expand_deps $v' $LIBRARY_LIST<br>
<br>
if test "$quiet" != "yes"; then<br>
@@ -8043,7 +8034,6 @@ echo "optimize for size ${small-no}"<br>
echo "optimizations ${optimizations-no}"<br>
echo "static ${static-no}"<br>
echo "shared ${shared-no}"<br>
-echo "postprocessing support ${postproc-no}"<br>
echo "network support ${network-no}"<br>
echo "threading support ${thread_type-no}"<br>
echo "safe bitstream reader ${safe_bitstream_reader-no}"<br>
@@ -8420,7 +8410,6 @@ extralibs_avcodec="$avcodec_extralibs"<br>
extralibs_avformat="$avformat_extralibs"<br>
extralibs_avdevice="$avdevice_extralibs"<br>
extralibs_avfilter="$avfilter_extralibs"<br>
-extralibs_postproc="$postproc_extralibs"<br>
extralibs_swscale="$swscale_extralibs"<br>
extralibs_swresample="$swresample_extralibs"<br>
EOF<br>
diff --git a/doc/filters.texi b/doc/filters.texi<br>
index a9ec077ef04..679b71f2906 100644<br>
--- a/doc/filters.texi<br>
+++ b/doc/filters.texi<br>
@@ -19387,181 +19387,6 @@ Set window Y position, relative offset on Y axis.<br>
<br>
This filter supports same @ref{commands} as options.<br>
<br>
-@section pp<br>
-<br>
-Enable the specified chain of postprocessing subfilters using libpostproc. This<br>
-library should be automatically selected with a GPL build (@code{--enable-gpl}).<br>
-Subfilters must be separated by '/' and can be disabled by prepending a '-'.<br>
-Each subfilter and some options have a short and a long name that can be used<br>
-interchangeably, i.e. dr/dering are the same.<br>
-<br>
-The filters accept the following options:<br>
-<br>
-@table @option<br>
-@item subfilters<br>
-Set postprocessing subfilters string.<br>
-@end table<br>
-<br>
-All subfilters share common options to determine their scope:<br>
-<br>
-@table @option<br>
-@item a/autoq<br>
-Honor the quality commands for this subfilter.<br>
-<br>
-@item c/chrom<br>
-Do chrominance filtering, too (default).<br>
-<br>
-@item y/nochrom<br>
-Do luma filtering only (no chrominance).<br>
-<br>
-@item n/noluma<br>
-Do chrominance filtering only (no luma).<br>
-@end table<br>
-<br>
-These options can be appended after the subfilter name, separated by a '|'.<br>
-<br>
-Available subfilters are:<br>
-<br>
-@table @option<br>
-@item hb/hdeblock[|difference[|flatness]]<br>
-Horizontal deblocking filter<br>
-@table @option<br>
-@item difference<br>
-Difference factor where higher values mean more deblocking (default: @code{32}).<br>
-@item flatness<br>
-Flatness threshold where lower values mean more deblocking (default: @code{39}).<br>
-@end table<br>
-<br>
-@item vb/vdeblock[|difference[|flatness]]<br>
-Vertical deblocking filter<br>
-@table @option<br>
-@item difference<br>
-Difference factor where higher values mean more deblocking (default: @code{32}).<br>
-@item flatness<br>
-Flatness threshold where lower values mean more deblocking (default: @code{39}).<br>
-@end table<br>
-<br>
-@item ha/hadeblock[|difference[|flatness]]<br>
-Accurate horizontal deblocking filter<br>
-@table @option<br>
-@item difference<br>
-Difference factor where higher values mean more deblocking (default: @code{32}).<br>
-@item flatness<br>
-Flatness threshold where lower values mean more deblocking (default: @code{39}).<br>
-@end table<br>
-<br>
-@item va/vadeblock[|difference[|flatness]]<br>
-Accurate vertical deblocking filter<br>
-@table @option<br>
-@item difference<br>
-Difference factor where higher values mean more deblocking (default: @code{32}).<br>
-@item flatness<br>
-Flatness threshold where lower values mean more deblocking (default: @code{39}).<br>
-@end table<br>
-@end table<br>
-<br>
-The horizontal and vertical deblocking filters share the difference and<br>
-flatness values so you cannot set different horizontal and vertical<br>
-thresholds.<br>
-<br>
-@table @option<br>
-@item h1/x1hdeblock<br>
-Experimental horizontal deblocking filter<br>
-<br>
-@item v1/x1vdeblock<br>
-Experimental vertical deblocking filter<br>
-<br>
-@item dr/dering<br>
-Deringing filter<br>
-<br>
-@item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer<br>
-@table @option<br>
-@item threshold1<br>
-larger -> stronger filtering<br>
-@item threshold2<br>
-larger -> stronger filtering<br>
-@item threshold3<br>
-larger -> stronger filtering<br>
-@end table<br>
-<br>
-@item al/autolevels[:f/fullyrange], automatic brightness / contrast correction<br>
-@table @option<br>
-@item f/fullyrange<br>
-Stretch luma to @code{0-255}.<br>
-@end table<br>
-<br>
-@item lb/linblenddeint<br>
-Linear blend deinterlacing filter that deinterlaces the given block by<br>
-filtering all lines with a @code{(1 2 1)} filter.<br>
-<br>
-@item li/linipoldeint<br>
-Linear interpolating deinterlacing filter that deinterlaces the given block by<br>
-linearly interpolating every second line.<br>
-<br>
-@item ci/cubicipoldeint<br>
-Cubic interpolating deinterlacing filter deinterlaces the given block by<br>
-cubically interpolating every second line.<br>
-<br>
-@item md/mediandeint<br>
-Median deinterlacing filter that deinterlaces the given block by applying a<br>
-median filter to every second line.<br>
-<br>
-@item fd/ffmpegdeint<br>
-FFmpeg deinterlacing filter that deinterlaces the given block by filtering every<br>
-second line with a @code{(-1 4 2 4 -1)} filter.<br>
-<br>
-@item l5/lowpass5<br>
-Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given<br>
-block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.<br>
-<br>
-@item fq/forceQuant[|quantizer]<br>
-Overrides the quantizer table from the input with the constant quantizer you<br>
-specify.<br>
-@table @option<br>
-@item quantizer<br>
-Quantizer to use<br>
-@end table<br>
-<br>
-@item de/default<br>
-Default pp filter combination (@code{hb|a,vb|a,dr|a})<br>
-<br>
-@item fa/fast<br>
-Fast pp filter combination (@code{h1|a,v1|a,dr|a})<br>
-<br>
-@item ac<br>
-High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})<br>
-@end table<br>
-<br>
-@subsection Examples<br>
-<br>
-@itemize<br>
-@item<br>
-Apply horizontal and vertical deblocking, deringing and automatic<br>
-brightness/contrast:<br>
-@example<br>
-pp=hb/vb/dr/al<br>
-@end example<br>
-<br>
-@item<br>
-Apply default filters without brightness/contrast correction:<br>
-@example<br>
-pp=de/-al<br>
-@end example<br>
-<br>
-@item<br>
-Apply default filters and temporal denoiser:<br>
-@example<br>
-pp=default/tmpnoise|1|2|3<br>
-@end example<br>
-<br>
-@item<br>
-Apply deblocking on luma only, and switch vertical deblocking on or off<br>
-automatically depending on available CPU time:<br>
-@example<br>
-pp=hb|y/vb|a<br>
-@end example<br>
-@end itemize<br>
-<br>
@section pp7<br>
Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,<br>
similar to spp = 6 with 7 point DCT, where only the center sample is<br>
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c<br>
index d980d4e64fe..f33531fd84c 100644<br>
--- a/fftools/ffprobe.c<br>
+++ b/fftools/ffprobe.c<br>
@@ -62,8 +62,6 @@<br>
#include "libswscale/version.h"<br>
#include "libswresample/swresample.h"<br>
#include "libswresample/version.h"<br>
-#include "libpostproc/postprocess.h"<br>
-#include "libpostproc/version.h"<br>
#include "libavfilter/version.h"<br>
#include "textformat/avtextformat.h"<br>
#include "cmdutils.h"<br>
@@ -2573,7 +2571,6 @@ static void ffprobe_show_library_versions(AVTextFormatContext *tfc)<br>
SHOW_LIB_VERSION(avfilter, AVFILTER);<br>
SHOW_LIB_VERSION(swscale, SWSCALE);<br>
SHOW_LIB_VERSION(swresample, SWRESAMPLE);<br>
- SHOW_LIB_VERSION(postproc, POSTPROC);<br>
avtext_print_section_footer(tfc);<br>
}<br>
<br>
diff --git a/fftools/opt_common.c b/fftools/opt_common.c<br>
index 2ac3fd4fb36..c2f6b9de2a7 100644<br>
--- a/fftools/opt_common.c<br>
+++ b/fftools/opt_common.c<br>
@@ -60,8 +60,6 @@<br>
#include "libswresample/swresample.h"<br>
#include "libswresample/version.h"<br>
<br>
-#include "libpostproc/postprocess.h"<br>
-#include "libpostproc/version.h"<br>
<br>
enum show_muxdemuxers {<br>
SHOW_DEFAULT,<br>
@@ -191,7 +189,6 @@ static void print_all_libs_info(int flags, int level)<br>
PRINT_LIB_INFO(avfilter, AVFILTER, flags, level);<br>
PRINT_LIB_INFO(swscale, SWSCALE, flags, level);<br>
PRINT_LIB_INFO(swresample, SWRESAMPLE, flags, level);<br>
- PRINT_LIB_INFO(postproc, POSTPROC, flags, level);<br>
}<br>
<br>
static void print_program_info(int flags, int level)<br>
diff --git a/libavfilter/Makefile b/libavfilter/Makefile<br>
index 7c0d879ec9c..0effe4127ff 100644<br>
--- a/libavfilter/Makefile<br>
+++ b/libavfilter/Makefile<br>
@@ -431,7 +431,6 @@ OBJS-$(CONFIG_PHOTOSENSITIVITY_FILTER) += vf_photosensitivity.o<br>
OBJS-$(CONFIG_PIXDESCTEST_FILTER) += vf_pixdesctest.o<br>
OBJS-$(CONFIG_PIXELIZE_FILTER) += vf_pixelize.o<br>
OBJS-$(CONFIG_PIXSCOPE_FILTER) += vf_datascope.o<br>
-OBJS-$(CONFIG_PP_FILTER) += vf_pp.o qp_table.o<br>
OBJS-$(CONFIG_PP7_FILTER) += vf_pp7.o qp_table.o<br>
OBJS-$(CONFIG_PREMULTIPLY_FILTER) += vf_premultiply.o framesync.o<br>
OBJS-$(CONFIG_PREWITT_FILTER) += vf_convolution.o<br>
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c<br>
index 740d9ab265c..5ea33cdf01b 100644<br>
--- a/libavfilter/allfilters.c<br>
+++ b/libavfilter/allfilters.c<br>
@@ -404,7 +404,6 @@ extern const FFFilter ff_vf_photosensitivity;<br>
extern const FFFilter ff_vf_pixdesctest;<br>
extern const FFFilter ff_vf_pixelize;<br>
extern const FFFilter ff_vf_pixscope;<br>
-extern const FFFilter ff_vf_pp;<br>
extern const FFFilter ff_vf_pp7;<br>
extern const FFFilter ff_vf_premultiply;<br>
extern const FFFilter ff_vf_prewitt;<br>
diff --git a/libavfilter/vf_pp.c b/libavfilter/vf_pp.c<br>
deleted file mode 100644<br>
index 9e9903eb974..00000000000<br>
--- a/libavfilter/vf_pp.c<br>
+++ /dev/null<br>
@@ -1,191 +0,0 @@<br>
-/*<br>
- * Copyright (c) 2002 A'rpi<br>
- * Copyright (C) 2012 Clément Bœsch<br>
- *<br>
- * This file is part of FFmpeg.<br>
- *<br>
- * FFmpeg is free software; you can redistribute it and/or modify<br>
- * it under the terms of the GNU General Public License as published by<br>
- * the Free Software Foundation; either version 2 of the License, or<br>
- * (at your option) any later version.<br>
- *<br>
- * FFmpeg is distributed in the hope that it will be useful,<br>
- * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
- * GNU General Public License for more details.<br>
- *<br>
- * You should have received a copy of the GNU General Public License along<br>
- * with FFmpeg; if not, write to the Free Software Foundation, Inc.,<br>
- * <a href="https://www.google.com/maps/search/51+Franklin+Street?entry=gmail&source=g" rel="noreferrer noreferrer" target="_blank">51 Franklin Street</a>, Fifth Floor, Boston, MA 02110-1301 USA.<br>
- */<br>
-<br>
-/**<br>
- * @file<br>
- * libpostproc filter, ported from MPlayer.<br>
- */<br>
-<br>
-#include "libavutil/avassert.h"<br>
-#include "libavutil/mem.h"<br>
-#include "libavutil/opt.h"<br>
-<br>
-#include "filters.h"<br>
-#include "qp_table.h"<br>
-#include "video.h"<br>
-<br>
-#include "libpostproc/postprocess.h"<br>
-<br>
-typedef struct PPFilterContext {<br>
- const AVClass *class;<br>
- char *subfilters;<br>
- int mode_id;<br>
- pp_mode *modes[PP_QUALITY_MAX + 1];<br>
- void *pp_ctx;<br>
-} PPFilterContext;<br>
-<br>
-#define OFFSET(x) offsetof(PPFilterContext, x)<br>
-#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM<br>
-static const AVOption pp_options[] = {<br>
- { "subfilters", "set postprocess subfilters", OFFSET(subfilters), AV_OPT_TYPE_STRING, {.str="de"}, .flags = FLAGS },<br>
- { NULL }<br>
-};<br>
-<br>
-AVFILTER_DEFINE_CLASS(pp);<br>
-<br>
-static av_cold int pp_init(AVFilterContext *ctx)<br>
-{<br>
- int i;<br>
- PPFilterContext *pp = ctx->priv;<br>
-<br>
- for (i = 0; i <= PP_QUALITY_MAX; i++) {<br>
- pp->modes[i] = pp_get_mode_by_name_and_quality(pp->subfilters, i);<br>
- if (!pp->modes[i])<br>
- return AVERROR_EXTERNAL;<br>
- }<br>
- pp->mode_id = PP_QUALITY_MAX;<br>
- return 0;<br>
-}<br>
-<br>
-static int pp_process_command(AVFilterContext *ctx, const char *cmd, const char *args,<br>
- char *res, int res_len, int flags)<br>
-{<br>
- PPFilterContext *pp = ctx->priv;<br>
-<br>
- if (!strcmp(cmd, "quality")) {<br>
- pp->mode_id = av_clip(strtol(args, NULL, 10), 0, PP_QUALITY_MAX);<br>
- return 0;<br>
- }<br>
- return AVERROR(ENOSYS);<br>
-}<br>
-<br>
-static const enum AVPixelFormat pix_fmts[] = {<br>
- AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVJ420P,<br>
- AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVJ422P,<br>
- AV_PIX_FMT_YUV411P,<br>
- AV_PIX_FMT_GBRP,<br>
- AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVJ444P,<br>
- AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUVJ440P,<br>
- AV_PIX_FMT_GRAY8,<br>
- AV_PIX_FMT_NONE<br>
-};<br>
-<br>
-static int pp_config_props(AVFilterLink *inlink)<br>
-{<br>
- int flags = PP_CPU_CAPS_AUTO;<br>
- PPFilterContext *pp = inlink->dst->priv;<br>
-<br>
- switch (inlink->format) {<br>
- case AV_PIX_FMT_GRAY8:<br>
- case AV_PIX_FMT_YUVJ420P:<br>
- case AV_PIX_FMT_YUV420P: flags |= PP_FORMAT_420; break;<br>
- case AV_PIX_FMT_YUVJ422P:<br>
- case AV_PIX_FMT_YUV422P: flags |= PP_FORMAT_422; break;<br>
- case AV_PIX_FMT_YUV411P: flags |= PP_FORMAT_411; break;<br>
- case AV_PIX_FMT_GBRP:<br>
- case AV_PIX_FMT_YUVJ444P:<br>
- case AV_PIX_FMT_YUV444P: flags |= PP_FORMAT_444; break;<br>
- case AV_PIX_FMT_YUVJ440P:<br>
- case AV_PIX_FMT_YUV440P: flags |= PP_FORMAT_440; break;<br>
- default: av_assert0(0);<br>
- }<br>
-<br>
- pp->pp_ctx = pp_get_context(inlink->w, inlink->h, flags);<br>
- if (!pp->pp_ctx)<br>
- return AVERROR(ENOMEM);<br>
- return 0;<br>
-}<br>
-<br>
-static int pp_filter_frame(AVFilterLink *inlink, AVFrame *inbuf)<br>
-{<br>
- AVFilterContext *ctx = inlink->dst;<br>
- PPFilterContext *pp = ctx->priv;<br>
- AVFilterLink *outlink = ctx->outputs[0];<br>
- const int aligned_w = FFALIGN(outlink->w, 8);<br>
- const int aligned_h = FFALIGN(outlink->h, 8);<br>
- AVFrame *outbuf;<br>
- int qstride = 0;<br>
- int8_t *qp_table = NULL;<br>
- int ret;<br>
-<br>
- outbuf = ff_get_video_buffer(outlink, aligned_w, aligned_h);<br>
- if (!outbuf) {<br>
- av_frame_free(&inbuf);<br>
- return AVERROR(ENOMEM);<br>
- }<br>
- av_frame_copy_props(outbuf, inbuf);<br>
- outbuf->width = inbuf->width;<br>
- outbuf->height = inbuf->height;<br>
-<br>
- ret = ff_qp_table_extract(inbuf, &qp_table, &qstride, NULL, NULL);<br>
- if (ret < 0) {<br>
- av_frame_free(&inbuf);<br>
- av_frame_free(&outbuf);<br>
- return ret;<br>
- }<br>
-<br>
- pp_postprocess((const uint8_t **)inbuf->data, inbuf->linesize,<br>
- outbuf->data, outbuf->linesize,<br>
- aligned_w, outlink->h,<br>
- qp_table,<br>
- qstride,<br>
- pp->modes[pp->mode_id],<br>
- pp->pp_ctx,<br>
- outbuf->pict_type | (qp_table ? PP_PICT_TYPE_QP2 : 0));<br>
-<br>
- av_frame_free(&inbuf);<br>
- av_freep(&qp_table);<br>
- return ff_filter_frame(outlink, outbuf);<br>
-}<br>
-<br>
-static av_cold void pp_uninit(AVFilterContext *ctx)<br>
-{<br>
- int i;<br>
- PPFilterContext *pp = ctx->priv;<br>
-<br>
- for (i = 0; i <= PP_QUALITY_MAX; i++)<br>
- pp_free_mode(pp->modes[i]);<br>
- if (pp->pp_ctx)<br>
- pp_free_context(pp->pp_ctx);<br>
-}<br>
-<br>
-static const AVFilterPad pp_inputs[] = {<br>
- {<br>
- .name = "default",<br>
- .type = AVMEDIA_TYPE_VIDEO,<br>
- .config_props = pp_config_props,<br>
- .filter_frame = pp_filter_frame,<br>
- },<br>
-};<br>
-<br>
-const FFFilter ff_vf_pp = {<br>
- .<a href="http://p.name" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">p.name</a> = "pp",<br>
- .p.description = NULL_IF_CONFIG_SMALL("Filter video using libpostproc."),<br>
- .p.priv_class = &pp_class,<br>
- .p.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,<br>
- .priv_size = sizeof(PPFilterContext),<br>
- .init = pp_init,<br>
- .uninit = pp_uninit,<br>
- FILTER_INPUTS(pp_inputs),<br>
- FILTER_OUTPUTS(ff_video_default_filterpad),<br>
- FILTER_PIXFMTS_ARRAY(pix_fmts),<br>
- .process_command = pp_process_command,<br>
-};<br>
diff --git a/libavutil/avutil.h b/libavutil/avutil.h<br>
index ee709fbb2ab..c8ae114ab6f 100644<br>
--- a/libavutil/avutil.h<br>
+++ b/libavutil/avutil.h<br>
@@ -41,7 +41,6 @@<br>
* @li @ref lavd "libavdevice" special devices muxing/demuxing library<br>
* @li @ref lavu "libavutil" common utility library<br>
* @li @ref lswr "libswresample" audio resampling, format conversion and mixing<br>
- * @li @ref lpp "libpostproc" post processing library<br>
* @li @ref libsws "libswscale" color conversion and scaling library<br>
*<br>
* @section ffmpeg_versioning Versioning and compatibility<br>
diff --git a/libpostproc/Makefile b/libpostproc/Makefile<br>
deleted file mode 100644<br>
index d78fc0277f4..00000000000<br>
--- a/libpostproc/Makefile<br>
+++ /dev/null<br>
@@ -1,23 +0,0 @@<br>
-NAME = postproc<br>
-DESC = FFmpeg postprocessing library<br>
-FFLIBS = avutil<br>
-<br>
-HEADERS = postprocess.h \<br>
- version.h \<br>
- version_major.h \<br>
-<br>
-OBJS = postprocess.o \<br>
- version.o \<br>
-<br>
-TESTOBJS = tests/test_utils.o \<br>
-<br>
-# Windows resource file<br>
-SHLIBOBJS-$(HAVE_GNU_WINDRES) += postprocres.o<br>
-<br>
-TESTPROGS = blocktest \<br>
- stripetest \<br>
- temptest \<br>
-<br>
-$(SUBDIR)tests/blocktest$(EXESUF): $(SUBDIR)tests/test_utils.o<br>
-$(SUBDIR)tests/stripetest$(EXESUF): $(SUBDIR)tests/test_utils.o<br>
-$(SUBDIR)tests/temptest$(EXESUF): $(SUBDIR)tests/test_utils.o<br>
diff --git a/libpostproc/libpostproc.v b/libpostproc/libpostproc.v<br>
deleted file mode 100644<br>
index 27381c6aca3..00000000000<br>
--- a/libpostproc/libpostproc.v<br>
+++ /dev/null<br>
@@ -1,7 +0,0 @@<br>
-LIBPOSTPROC_MAJOR {<br>
- global:<br>
- postproc_*;<br>
- pp_*;<br>
- local:<br>
- *;<br>
-};<br>
diff --git a/libpostproc/postprocess.c b/libpostproc/postprocess.c<br>
deleted file mode 100644<br>
index eab22289192..00000000000<br>
--- a/libpostproc/postprocess.c<br>
+++ /dev/null<br>
@@ -1,992 +0,0 @@<br>
-/*<br>
- * Copyright (C) 2001-2003 Michael Niedermayer (<a href="mailto:michaelni@gmx.at" rel="noreferrer noreferrer noreferrer" target="_blank">michaelni@gmx.at</a>)<br>
- *<br>
- * AltiVec optimizations (C) 2004 Romain Dolbeau <<a href="mailto:romain@dolbeau.org" rel="noreferrer noreferrer noreferrer" target="_blank">romain@dolbeau.org</a>><br>
- *<br>
- * This file is part of FFmpeg.<br>
- *<br>
- * FFmpeg is free software; you can redistribute it and/or modify<br>
- * it under the terms of the GNU General Public License as published by<br>
- * the Free Software Foundation; either version 2 of the License, or<br>
- * (at your option) any later version.<br>
- *<br>
- * FFmpeg is distributed in the hope that it will be useful,<br>
- * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
- * GNU General Public License for more details.<br>
- *<br>
- * You should have received a copy of the GNU General Public License<br>
- * along with FFmpeg; if not, write to the Free Software<br>
- * Foundation, Inc., <a href="https://www.google.com/maps/search/51+Franklin+Street?entry=gmail&source=g" rel="noreferrer noreferrer" target="_blank">51 Franklin Street</a>, Fifth Floor, Boston, MA 02110-1301 USA<br>
- */<br>
-<br>
-/**<br>
- * @file<br>
- * postprocessing.<br>
- */<br>
-<br>
-/*<br>
- C MMX MMX2 AltiVec<br>
-isVertDC Ec Ec Ec<br>
-isVertMinMaxOk Ec Ec Ec<br>
-doVertLowPass E e Ec<br>
-doVertDefFilter Ec Ec e Ec<br>
-isHorizDC Ec Ec Ec<br>
-isHorizMinMaxOk a E Ec<br>
-doHorizLowPass E e Ec<br>
-doHorizDefFilter Ec Ec e Ec<br>
-do_a_deblock Ec E Ec<br>
-deRing E e Ecp<br>
-Vertical RKAlgo1 E a<br>
-Horizontal RKAlgo1 a<br>
-Vertical X1# a E<br>
-Horizontal X1# a E<br>
-LinIpolDeinterlace e E<br>
-CubicIpolDeinterlace a e<br>
-LinBlendDeinterlace e E<br>
-MedianDeinterlace# E Ec Ec<br>
-TempDeNoiser# E e Ec<br>
-<br>
-# more or less selfinvented filters so the exactness is not too meaningful<br>
-E = Exact implementation<br>
-e = almost exact implementation (slightly different rounding,...)<br>
-a = alternative / approximate impl<br>
-c = checked against the other implementations (-vo md5)<br>
-p = partially optimized, still some work to do<br>
-*/<br>
-<br>
-/*<br>
-TODO:<br>
-reduce the time wasted on the mem transfer<br>
-unroll stuff if instructions depend too much on the prior one<br>
-move YScale thing to the end instead of fixing QP<br>
-write a faster and higher quality deblocking filter :)<br>
-make the mainloop more flexible (variable number of blocks at once<br>
- (the if/else stuff per block is slowing things down)<br>
-compare the quality & speed of all filters<br>
-split this huge file<br>
-optimize c versions<br>
-try to unroll inner for(x=0 ... loop to avoid these damn if(x ... checks<br>
-...<br>
-*/<br>
-<br>
-//Changelog: use git log<br>
-<br>
-#include <stddef.h><br>
-#include <stdlib.h><br>
-#include <string.h><br>
-<br>
-#include "config.h"<br>
-#include "libavutil/common.h"<br>
-#include "libavutil/cpu.h"<br>
-#include "libavutil/intreadwrite.h"<br>
-#include "libavutil/mem.h"<br>
-//#undef HAVE_MMXEXT_INLINE<br>
-//#undef HAVE_MMX_INLINE<br>
-//#undef ARCH_X86<br>
-//#define DEBUG_BRIGHTNESS<br>
-#include "postprocess.h"<br>
-#include "postprocess_internal.h"<br>
-#include "libavutil/avstring.h"<br>
-<br>
-#define GET_MODE_BUFFER_SIZE 500<br>
-#define OPTIONS_ARRAY_SIZE 10<br>
-#define BLOCK_SIZE 8<br>
-#define TEMP_STRIDE 8<br>
-//#define NUM_BLOCKS_AT_ONCE 16 //not used yet<br>
-<br>
-#define DERING_THRESHOLD 20<br>
-<br>
-#if ARCH_X86 && HAVE_INLINE_ASM<br>
-DECLARE_ASM_CONST(8, uint64_t, w05)= 0x0005000500050005LL;<br>
-DECLARE_ASM_CONST(8, uint64_t, w04)= 0x0004000400040004LL;<br>
-DECLARE_ASM_CONST(8, uint64_t, w20)= 0x0020002000200020LL;<br>
-DECLARE_ASM_CONST(8, uint64_t, b00)= 0x0000000000000000LL;<br>
-DECLARE_ASM_CONST(8, uint64_t, b01)= 0x0101010101010101LL;<br>
-DECLARE_ASM_CONST(8, uint64_t, b08)= 0x0808080808080808LL;<br>
-DECLARE_ASM_CONST(8, uint64_t, b80)= 0x8080808080808080LL;<br>
-#endif<br>
-<br>
-static const struct PPFilter filters[]=<br>
-{<br>
- {"hb", "hdeblock", 1, 1, 3, H_DEBLOCK},<br>
- {"vb", "vdeblock", 1, 2, 4, V_DEBLOCK},<br>
-/* {"hr", "rkhdeblock", 1, 1, 3, H_RK1_FILTER},<br>
- {"vr", "rkvdeblock", 1, 2, 4, V_RK1_FILTER},*/<br>
- {"h1", "x1hdeblock", 1, 1, 3, H_X1_FILTER},<br>
- {"v1", "x1vdeblock", 1, 2, 4, V_X1_FILTER},<br>
- {"ha", "ahdeblock", 1, 1, 3, H_A_DEBLOCK},<br>
- {"va", "avdeblock", 1, 2, 4, V_A_DEBLOCK},<br>
- {"dr", "dering", 1, 5, 6, DERING},<br>
- {"al", "autolevels", 0, 1, 2, LEVEL_FIX},<br>
- {"lb", "linblenddeint", 1, 1, 4, LINEAR_BLEND_DEINT_FILTER},<br>
- {"li", "linipoldeint", 1, 1, 4, LINEAR_IPOL_DEINT_FILTER},<br>
- {"ci", "cubicipoldeint", 1, 1, 4, CUBIC_IPOL_DEINT_FILTER},<br>
- {"md", "mediandeint", 1, 1, 4, MEDIAN_DEINT_FILTER},<br>
- {"fd", "ffmpegdeint", 1, 1, 4, FFMPEG_DEINT_FILTER},<br>
- {"l5", "lowpass5", 1, 1, 4, LOWPASS5_DEINT_FILTER},<br>
- {"tn", "tmpnoise", 1, 7, 8, TEMP_NOISE_FILTER},<br>
- {"fq", "forcequant", 1, 0, 0, FORCE_QUANT},<br>
- {"be", "bitexact", 1, 0, 0, BITEXACT},<br>
- {"vi", "visualize", 1, 0, 0, VISUALIZE},<br>
- {NULL, NULL,0,0,0,0} //End Marker<br>
-};<br>
-<br>
-static const char * const replaceTable[]=<br>
-{<br>
- "default", "hb:a,vb:a,dr:a",<br>
- "de", "hb:a,vb:a,dr:a",<br>
- "fast", "h1:a,v1:a,dr:a",<br>
- "fa", "h1:a,v1:a,dr:a",<br>
- "ac", "ha:a:128:7,va:a,dr:a",<br>
- NULL //End Marker<br>
-};<br>
-<br>
-/* The horizontal functions exist only in C because the MMX<br>
- * code is faster with vertical filters and transposing. */<br>
-<br>
-/**<br>
- * Check if the given 8x8 Block is mostly "flat"<br>
- */<br>
-static inline int isHorizDC_C(const uint8_t src[], int stride, const PPContext *c)<br>
-{<br>
- int numEq= 0;<br>
- int y;<br>
- const int dcOffset= ((c->nonBQP*c->ppMode.baseDcDiff)>>8) + 1;<br>
- const int dcThreshold= dcOffset*2 + 1;<br>
-<br>
- for(y=0; y<BLOCK_SIZE; y++){<br>
- numEq += ((unsigned)(src[0] - src[1] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[1] - src[2] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[2] - src[3] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[3] - src[4] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[4] - src[5] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[5] - src[6] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[6] - src[7] + dcOffset)) < dcThreshold;<br>
- src+= stride;<br>
- }<br>
- return numEq > c->ppMode.flatnessThreshold;<br>
-}<br>
-<br>
-/**<br>
- * Check if the middle 8x8 Block in the given 8x16 block is flat<br>
- */<br>
-static inline int isVertDC_C(const uint8_t src[], int stride, const PPContext *c)<br>
-{<br>
- int numEq= 0;<br>
- int y;<br>
- const int dcOffset= ((c->nonBQP*c->ppMode.baseDcDiff)>>8) + 1;<br>
- const int dcThreshold= dcOffset*2 + 1;<br>
-<br>
- src+= stride*4; // src points to begin of the 8x8 Block<br>
- for(y=0; y<BLOCK_SIZE-1; y++){<br>
- numEq += ((unsigned)(src[0] - src[0+stride] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[1] - src[1+stride] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[2] - src[2+stride] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[3] - src[3+stride] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[4] - src[4+stride] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[5] - src[5+stride] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[6] - src[6+stride] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[7] - src[7+stride] + dcOffset)) < dcThreshold;<br>
- src+= stride;<br>
- }<br>
- return numEq > c->ppMode.flatnessThreshold;<br>
-}<br>
-<br>
-static inline int isHorizMinMaxOk_C(const uint8_t src[], int stride, int QP)<br>
-{<br>
- int i;<br>
- for(i=0; i<2; i++){<br>
- if((unsigned)(src[0] - src[5] + 2*QP) > 4*QP) return 0;<br>
- src += stride;<br>
- if((unsigned)(src[2] - src[7] + 2*QP) > 4*QP) return 0;<br>
- src += stride;<br>
- if((unsigned)(src[4] - src[1] + 2*QP) > 4*QP) return 0;<br>
- src += stride;<br>
- if((unsigned)(src[6] - src[3] + 2*QP) > 4*QP) return 0;<br>
- src += stride;<br>
- }<br>
- return 1;<br>
-}<br>
-<br>
-static inline int isVertMinMaxOk_C(const uint8_t src[], int stride, int QP)<br>
-{<br>
- int x;<br>
- src+= stride*4;<br>
- for(x=0; x<BLOCK_SIZE; x+=4){<br>
- if((unsigned)(src[ x + 0*stride] - src[ x + 5*stride] + 2*QP) > 4*QP) return 0;<br>
- if((unsigned)(src[1+x + 2*stride] - src[1+x + 7*stride] + 2*QP) > 4*QP) return 0;<br>
- if((unsigned)(src[2+x + 4*stride] - src[2+x + 1*stride] + 2*QP) > 4*QP) return 0;<br>
- if((unsigned)(src[3+x + 6*stride] - src[3+x + 3*stride] + 2*QP) > 4*QP) return 0;<br>
- }<br>
- return 1;<br>
-}<br>
-<br>
-static inline int horizClassify_C(const uint8_t src[], int stride, const PPContext *c)<br>
-{<br>
- if( isHorizDC_C(src, stride, c) ){<br>
- return isHorizMinMaxOk_C(src, stride, c->QP);<br>
- }else{<br>
- return 2;<br>
- }<br>
-}<br>
-<br>
-static inline int vertClassify_C(const uint8_t src[], int stride, const PPContext *c)<br>
-{<br>
- if( isVertDC_C(src, stride, c) ){<br>
- return isVertMinMaxOk_C(src, stride, c->QP);<br>
- }else{<br>
- return 2;<br>
- }<br>
-}<br>
-<br>
-static inline void doHorizDefFilter_C(uint8_t dst[], int stride, const PPContext *c)<br>
-{<br>
- int y;<br>
- for(y=0; y<BLOCK_SIZE; y++){<br>
- const int middleEnergy= 5*(dst[4] - dst[3]) + 2*(dst[2] - dst[5]);<br>
-<br>
- if(FFABS(middleEnergy) < 8*c->QP){<br>
- const int q=(dst[3] - dst[4])/2;<br>
- const int leftEnergy= 5*(dst[2] - dst[1]) + 2*(dst[0] - dst[3]);<br>
- const int rightEnergy= 5*(dst[6] - dst[5]) + 2*(dst[4] - dst[7]);<br>
-<br>
- int d= FFABS(middleEnergy) - FFMIN( FFABS(leftEnergy), FFABS(rightEnergy) );<br>
- d= FFMAX(d, 0);<br>
-<br>
- d= (5*d + 32) >> 6;<br>
- d*= FFSIGN(-middleEnergy);<br>
-<br>
- if(q>0)<br>
- {<br>
- d = FFMAX(d, 0);<br>
- d = FFMIN(d, q);<br>
- }<br>
- else<br>
- {<br>
- d = FFMIN(d, 0);<br>
- d = FFMAX(d, q);<br>
- }<br>
-<br>
- dst[3]-= d;<br>
- dst[4]+= d;<br>
- }<br>
- dst+= stride;<br>
- }<br>
-}<br>
-<br>
-/**<br>
- * Do a horizontal low pass filter on the 10x8 block (dst points to middle 8x8 Block)<br>
- * using the 9-Tap Filter (1,1,2,2,4,2,2,1,1)/16 (C version)<br>
- */<br>
-static inline void doHorizLowPass_C(uint8_t dst[], int stride, const PPContext *c)<br>
-{<br>
- int y;<br>
- for(y=0; y<BLOCK_SIZE; y++){<br>
- const int first= FFABS(dst[-1] - dst[0]) < c->QP ? dst[-1] : dst[0];<br>
- const int last= FFABS(dst[8] - dst[7]) < c->QP ? dst[8] : dst[7];<br>
-<br>
- int sums[10];<br>
- sums[0] = 4*first + dst[0] + dst[1] + dst[2] + 4;<br>
- sums[1] = sums[0] - first + dst[3];<br>
- sums[2] = sums[1] - first + dst[4];<br>
- sums[3] = sums[2] - first + dst[5];<br>
- sums[4] = sums[3] - first + dst[6];<br>
- sums[5] = sums[4] - dst[0] + dst[7];<br>
- sums[6] = sums[5] - dst[1] + last;<br>
- sums[7] = sums[6] - dst[2] + last;<br>
- sums[8] = sums[7] - dst[3] + last;<br>
- sums[9] = sums[8] - dst[4] + last;<br>
-<br>
- dst[0]= (sums[0] + sums[2] + 2*dst[0])>>4;<br>
- dst[1]= (sums[1] + sums[3] + 2*dst[1])>>4;<br>
- dst[2]= (sums[2] + sums[4] + 2*dst[2])>>4;<br>
- dst[3]= (sums[3] + sums[5] + 2*dst[3])>>4;<br>
- dst[4]= (sums[4] + sums[6] + 2*dst[4])>>4;<br>
- dst[5]= (sums[5] + sums[7] + 2*dst[5])>>4;<br>
- dst[6]= (sums[6] + sums[8] + 2*dst[6])>>4;<br>
- dst[7]= (sums[7] + sums[9] + 2*dst[7])>>4;<br>
-<br>
- dst+= stride;<br>
- }<br>
-}<br>
-<br>
-/**<br>
- * Experimental Filter 1 (Horizontal)<br>
- * will not damage linear gradients<br>
- * Flat blocks should look like they were passed through the (1,1,2,2,4,2,2,1,1) 9-Tap filter<br>
- * can only smooth blocks at the expected locations (it cannot smooth them if they did move)<br>
- * MMX2 version does correct clipping C version does not<br>
- * not identical with the vertical one<br>
- */<br>
-static inline void horizX1Filter(uint8_t *src, int stride, int QP)<br>
-{<br>
- int y;<br>
- static uint64_t lut[256];<br>
- if(!lut[255])<br>
- {<br>
- int i;<br>
- for(i=0; i<256; i++)<br>
- {<br>
- int v= i < 128 ? 2*i : 2*(i-256);<br>
-/*<br>
-//Simulate 112242211 9-Tap filter<br>
- uint64_t a= (v/16) & 0xFF;<br>
- uint64_t b= (v/8) & 0xFF;<br>
- uint64_t c= (v/4) & 0xFF;<br>
- uint64_t d= (3*v/8) & 0xFF;<br>
-*/<br>
-//Simulate piecewise linear interpolation<br>
- uint64_t a= (v/16) & 0xFF;<br>
- uint64_t b= (v*3/16) & 0xFF;<br>
- uint64_t c= (v*5/16) & 0xFF;<br>
- uint64_t d= (7*v/16) & 0xFF;<br>
- uint64_t A= (0x100 - a)&0xFF;<br>
- uint64_t B= (0x100 - b)&0xFF;<br>
- uint64_t C= (0x100 - c)&0xFF;<br>
- uint64_t D= (0x100 - c)&0xFF;<br>
-<br>
- lut[i] = (a<<56) | (b<<48) | (c<<40) | (d<<32) |<br>
- (D<<24) | (C<<16) | (B<<8) | (A);<br>
- //lut[i] = (v<<32) | (v<<24);<br>
- }<br>
- }<br>
-<br>
- for(y=0; y<BLOCK_SIZE; y++){<br>
- int a= src[1] - src[2];<br>
- int b= src[3] - src[4];<br>
- int c= src[5] - src[6];<br>
-<br>
- int d= FFMAX(FFABS(b) - (FFABS(a) + FFABS(c))/2, 0);<br>
-<br>
- if(d < QP){<br>
- int v = d * FFSIGN(-b);<br>
-<br>
- src[1] +=v/8;<br>
- src[2] +=v/4;<br>
- src[3] +=3*v/8;<br>
- src[4] -=3*v/8;<br>
- src[5] -=v/4;<br>
- src[6] -=v/8;<br>
- }<br>
- src+=stride;<br>
- }<br>
-}<br>
-<br>
-/**<br>
- * accurate deblock filter<br>
- */<br>
-static av_always_inline void do_a_deblock_C(uint8_t *src, int step,<br>
- int stride, const PPContext *c, int mode)<br>
-{<br>
- int y;<br>
- const int QP= c->QP;<br>
- const int dcOffset= ((c->nonBQP*c->ppMode.baseDcDiff)>>8) + 1;<br>
- const int dcThreshold= dcOffset*2 + 1;<br>
-<br>
- src+= step*4; // src points to begin of the 8x8 Block<br>
- for(y=0; y<8; y++){<br>
- int numEq= 0;<br>
-<br>
- numEq += ((unsigned)(src[-1*step] - src[0*step] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[ 0*step] - src[1*step] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[ 1*step] - src[2*step] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[ 2*step] - src[3*step] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[ 3*step] - src[4*step] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[ 4*step] - src[5*step] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[ 5*step] - src[6*step] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[ 6*step] - src[7*step] + dcOffset)) < dcThreshold;<br>
- numEq += ((unsigned)(src[ 7*step] - src[8*step] + dcOffset)) < dcThreshold;<br>
- if(numEq > c->ppMode.flatnessThreshold){<br>
- int min, max, x;<br>
-<br>
- if(src[0] > src[step]){<br>
- max= src[0];<br>
- min= src[step];<br>
- }else{<br>
- max= src[step];<br>
- min= src[0];<br>
- }<br>
- for(x=2; x<8; x+=2){<br>
- if(src[x*step] > src[(x+1)*step]){<br>
- if(src[x *step] > max) max= src[ x *step];<br>
- if(src[(x+1)*step] < min) min= src[(x+1)*step];<br>
- }else{<br>
- if(src[(x+1)*step] > max) max= src[(x+1)*step];<br>
- if(src[ x *step] < min) min= src[ x *step];<br>
- }<br>
- }<br>
- if(max-min < 2*QP){<br>
- const int first= FFABS(src[-1*step] - src[0]) < QP ? src[-1*step] : src[0];<br>
- const int last= FFABS(src[8*step] - src[7*step]) < QP ? src[8*step] : src[7*step];<br>
-<br>
- int sums[10];<br>
- sums[0] = 4*first + src[0*step] + src[1*step] + src[2*step] + 4;<br>
- sums[1] = sums[0] - first + src[3*step];<br>
- sums[2] = sums[1] - first + src[4*step];<br>
- sums[3] = sums[2] - first + src[5*step];<br>
- sums[4] = sums[3] - first + src[6*step];<br>
- sums[5] = sums[4] - src[0*step] + src[7*step];<br>
- sums[6] = sums[5] - src[1*step] + last;<br>
- sums[7] = sums[6] - src[2*step] + last;<br>
- sums[8] = sums[7] - src[3*step] + last;<br>
- sums[9] = sums[8] - src[4*step] + last;<br>
-<br>
- if (mode & VISUALIZE) {<br>
- src[0*step] =<br>
- src[1*step] =<br>
- src[2*step] =<br>
- src[3*step] =<br>
- src[4*step] =<br>
- src[5*step] =<br>
- src[6*step] =<br>
- src[7*step] = 128;<br>
- }<br>
- src[0*step]= (sums[0] + sums[2] + 2*src[0*step])>>4;<br>
- src[1*step]= (sums[1] + sums[3] + 2*src[1*step])>>4;<br>
- src[2*step]= (sums[2] + sums[4] + 2*src[2*step])>>4;<br>
- src[3*step]= (sums[3] + sums[5] + 2*src[3*step])>>4;<br>
- src[4*step]= (sums[4] + sums[6] + 2*src[4*step])>>4;<br>
- src[5*step]= (sums[5] + sums[7] + 2*src[5*step])>>4;<br>
- src[6*step]= (sums[6] + sums[8] + 2*src[6*step])>>4;<br>
- src[7*step]= (sums[7] + sums[9] + 2*src[7*step])>>4;<br>
- }<br>
- }else{<br>
- const int middleEnergy= 5*(src[4*step] - src[3*step]) + 2*(src[2*step] - src[5*step]);<br>
-<br>
- if(FFABS(middleEnergy) < 8*QP){<br>
- const int q=(src[3*step] - src[4*step])/2;<br>
- const int leftEnergy= 5*(src[2*step] - src[1*step]) + 2*(src[0*step] - src[3*step]);<br>
- const int rightEnergy= 5*(src[6*step] - src[5*step]) + 2*(src[4*step] - src[7*step]);<br>
-<br>
- int d= FFABS(middleEnergy) - FFMIN( FFABS(leftEnergy), FFABS(rightEnergy) );<br>
- d= FFMAX(d, 0);<br>
-<br>
- d= (5*d + 32) >> 6;<br>
- d*= FFSIGN(-middleEnergy);<br>
-<br>
- if(q>0){<br>
- d = FFMAX(d, 0);<br>
- d = FFMIN(d, q);<br>
- }else{<br>
- d = FFMIN(d, 0);<br>
- d = FFMAX(d, q);<br>
- }<br>
-<br>
- if ((mode & VISUALIZE) && d) {<br>
- d= (d < 0) ? 32 : -32;<br>
- src[3*step]= av_clip_uint8(src[3*step] - d);<br>
- src[4*step]= av_clip_uint8(src[4*step] + d);<br>
- d = 0;<br>
- }<br>
-<br>
- src[3*step]-= d;<br>
- src[4*step]+= d;<br>
- }<br>
- }<br>
-<br>
- src += stride;<br>
- }<br>
-}<br>
-<br>
-//Note: we have C and SSE2 version (which uses MMX(EXT) when advantageous)<br>
-//Plain C versions<br>
-//we always compile C for testing which needs bitexactness<br>
-#define TEMPLATE_PP_C 1<br>
-#include "postprocess_template.c"<br>
-<br>
-#if HAVE_ALTIVEC<br>
-#include "libavutil/ppc/util_altivec.h"<br>
-<br>
-# define TEMPLATE_PP_ALTIVEC 1<br>
-# include "postprocess_altivec_template.c"<br>
-# include "postprocess_template.c"<br>
-#endif<br>
-<br>
-#if ARCH_X86 && HAVE_INLINE_ASM<br>
-# if CONFIG_RUNTIME_CPUDETECT<br>
-# define TEMPLATE_PP_SSE2 1<br>
-# include "postprocess_template.c"<br>
-# else<br>
-# if HAVE_SSE2_INLINE<br>
-# define TEMPLATE_PP_SSE2 1<br>
-# include "postprocess_template.c"<br>
-# endif<br>
-# endif<br>
-#endif<br>
-<br>
-typedef void (*pp_fn)(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,<br>
- const int8_t QPs[], int QPStride, int isColor, PPContext *c2);<br>
-<br>
-static inline void postProcess(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,<br>
- const int8_t QPs[], int QPStride, int isColor, pp_mode *vm, pp_context *vc)<br>
-{<br>
- pp_fn pp = postProcess_C;<br>
- PPContext *c= (PPContext *)vc;<br>
- PPMode *ppMode= (PPMode *)vm;<br>
- c->ppMode= *ppMode; //FIXME<br>
-<br>
- if (!(ppMode->lumMode & BITEXACT)) {<br>
-#if CONFIG_RUNTIME_CPUDETECT<br>
-#if ARCH_X86 && HAVE_INLINE_ASM<br>
- // ordered per speed fastest first<br>
- if (c->cpuCaps & AV_CPU_FLAG_SSE2) pp = postProcess_SSE2;<br>
-#elif HAVE_ALTIVEC<br>
- if (c->cpuCaps & AV_CPU_FLAG_ALTIVEC) pp = postProcess_altivec;<br>
-#endif<br>
-#else /* CONFIG_RUNTIME_CPUDETECT */<br>
-#if HAVE_SSE2_INLINE<br>
- pp = postProcess_SSE2;<br>
-#elif HAVE_ALTIVEC<br>
- pp = postProcess_altivec;<br>
-#endif<br>
-#endif /* !CONFIG_RUNTIME_CPUDETECT */<br>
- }<br>
-<br>
- pp(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);<br>
-}<br>
-<br>
-/* -pp Command line Help<br>
-*/<br>
-const char pp_help[] =<br>
-"Available postprocessing filters:\n"<br>
-"Filters Options\n"<br>
-"short long name short long option Description\n"<br>
-"* * a autoq CPU power dependent enabler\n"<br>
-" c chrom chrominance filtering enabled\n"<br>
-" y nochrom chrominance filtering disabled\n"<br>
-" n noluma luma filtering disabled\n"<br>
-"hb hdeblock (2 threshold) horizontal deblocking filter\n"<br>
-" 1. difference factor: default=32, higher -> more deblocking\n"<br>
-" 2. flatness threshold: default=39, lower -> more deblocking\n"<br>
-" the h & v deblocking filters share these\n"<br>
-" so you can't set different thresholds for h / v\n"<br>
-"vb vdeblock (2 threshold) vertical deblocking filter\n"<br>
-"ha hadeblock (2 threshold) horizontal deblocking filter\n"<br>
-"va vadeblock (2 threshold) vertical deblocking filter\n"<br>
-"h1 x1hdeblock experimental h deblock filter 1\n"<br>
-"v1 x1vdeblock experimental v deblock filter 1\n"<br>
-"dr dering deringing filter\n"<br>
-"al autolevels automatic brightness / contrast\n"<br>
-" f fullyrange stretch luminance to (0..255)\n"<br>
-"lb linblenddeint linear blend deinterlacer\n"<br>
-"li linipoldeint linear interpolating deinterlace\n"<br>
-"ci cubicipoldeint cubic interpolating deinterlacer\n"<br>
-"md mediandeint median deinterlacer\n"<br>
-"fd ffmpegdeint ffmpeg deinterlacer\n"<br>
-"l5 lowpass5 FIR lowpass deinterlacer\n"<br>
-"de default hb:a,vb:a,dr:a\n"<br>
-"fa fast h1:a,v1:a,dr:a\n"<br>
-"ac ha:a:128:7,va:a,dr:a\n"<br>
-"tn tmpnoise (3 threshold) temporal noise reducer\n"<br>
-" 1. <= 2. <= 3. larger -> stronger filtering\n"<br>
-"fq forceQuant <quantizer> force quantizer\n"<br>
-"Usage:\n"<br>
-"<filterName>[:<option>[:<option>...]][[,|/][-]<filterName>[:<option>...]]...\n"<br>
-"long form example:\n"<br>
-"vdeblock:autoq/hdeblock:autoq/linblenddeint default,-vdeblock\n"<br>
-"short form example:\n"<br>
-"vb:a/hb:a/lb de,-vb\n"<br>
-"more examples:\n"<br>
-"tn:64:128:256\n"<br>
-"\n"<br>
-;<br>
-<br>
-pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality)<br>
-{<br>
- char temp[GET_MODE_BUFFER_SIZE];<br>
- char *p= temp;<br>
- static const char filterDelimiters[] = ",/";<br>
- static const char optionDelimiters[] = ":|";<br>
- struct PPMode *ppMode;<br>
- char *filterToken;<br>
-<br>
- if (!name) {<br>
- av_log(NULL, AV_LOG_ERROR, "pp: Missing argument\n");<br>
- return NULL;<br>
- }<br>
-<br>
- if (!strcmp(name, "help")) {<br>
- const char *p;<br>
- for (p = pp_help; strchr(p, '\n'); p = strchr(p, '\n') + 1) {<br>
- av_strlcpy(temp, p, FFMIN(sizeof(temp), strchr(p, '\n') - p + 2));<br>
- av_log(NULL, AV_LOG_INFO, "%s", temp);<br>
- }<br>
- return NULL;<br>
- }<br>
-<br>
- ppMode= av_malloc(sizeof(PPMode));<br>
- if (!ppMode)<br>
- return NULL;<br>
-<br>
- ppMode->lumMode= 0;<br>
- ppMode->chromMode= 0;<br>
- ppMode->maxTmpNoise[0]= 700;<br>
- ppMode->maxTmpNoise[1]= 1500;<br>
- ppMode->maxTmpNoise[2]= 3000;<br>
- ppMode->maxAllowedY= 234;<br>
- ppMode->minAllowedY= 16;<br>
- ppMode->baseDcDiff= 256/8;<br>
- ppMode->flatnessThreshold= 56-16-1;<br>
- ppMode->maxClippedThreshold= (AVRational){1,100};<br>
- ppMode->error=0;<br>
-<br>
- memset(temp, 0, GET_MODE_BUFFER_SIZE);<br>
- av_strlcpy(temp, name, GET_MODE_BUFFER_SIZE - 1);<br>
-<br>
- av_log(NULL, AV_LOG_DEBUG, "pp: %s\n", name);<br>
-<br>
- for(;;){<br>
- const char *filterName;<br>
- int q= 1000000; //PP_QUALITY_MAX;<br>
- int chrom=-1;<br>
- int luma=-1;<br>
- const char *option;<br>
- const char *options[OPTIONS_ARRAY_SIZE];<br>
- int i;<br>
- int filterNameOk=0;<br>
- int numOfUnknownOptions=0;<br>
- int enable=1; //does the user want us to enabled or disabled the filter<br>
- char *tokstate;<br>
-<br>
- filterToken= av_strtok(p, filterDelimiters, &tokstate);<br>
- if(!filterToken) break;<br>
- p+= strlen(filterToken) + 1; // p points to next filterToken<br>
- filterName= av_strtok(filterToken, optionDelimiters, &tokstate);<br>
- if (!filterName) {<br>
- ppMode->error++;<br>
- break;<br>
- }<br>
- av_log(NULL, AV_LOG_DEBUG, "pp: %s::%s\n", filterToken, filterName);<br>
-<br>
- if(*filterName == '-'){<br>
- enable=0;<br>
- filterName++;<br>
- }<br>
-<br>
- for(;;){ //for all options<br>
- option= av_strtok(NULL, optionDelimiters, &tokstate);<br>
- if(!option) break;<br>
-<br>
- av_log(NULL, AV_LOG_DEBUG, "pp: option: %s\n", option);<br>
- if(!strcmp("autoq", option) || !strcmp("a", option)) q= quality;<br>
- else if(!strcmp("nochrom", option) || !strcmp("y", option)) chrom=0;<br>
- else if(!strcmp("chrom", option) || !strcmp("c", option)) chrom=1;<br>
- else if(!strcmp("noluma", option) || !strcmp("n", option)) luma=0;<br>
- else{<br>
- options[numOfUnknownOptions] = option;<br>
- numOfUnknownOptions++;<br>
- }<br>
- if(numOfUnknownOptions >= OPTIONS_ARRAY_SIZE-1) break;<br>
- }<br>
- options[numOfUnknownOptions] = NULL;<br>
-<br>
- /* replace stuff from the replace Table */<br>
- for(i=0; replaceTable[2*i]; i++){<br>
- if(!strcmp(replaceTable[2*i], filterName)){<br>
- size_t newlen = strlen(replaceTable[2*i + 1]);<br>
- int plen;<br>
- int spaceLeft;<br>
-<br>
- p--, *p=',';<br>
-<br>
- plen= strlen(p);<br>
- spaceLeft= p - temp + plen;<br>
- if(spaceLeft + newlen >= GET_MODE_BUFFER_SIZE - 1){<br>
- ppMode->error++;<br>
- break;<br>
- }<br>
- memmove(p + newlen, p, plen+1);<br>
- memcpy(p, replaceTable[2*i + 1], newlen);<br>
- filterNameOk=1;<br>
- }<br>
- }<br>
-<br>
- for(i=0; filters[i].shortName; i++){<br>
- if( !strcmp(filters[i].longName, filterName)<br>
- || !strcmp(filters[i].shortName, filterName)){<br>
- ppMode->lumMode &= ~filters[i].mask;<br>
- ppMode->chromMode &= ~filters[i].mask;<br>
-<br>
- filterNameOk=1;<br>
- if(!enable) break; // user wants to disable it<br>
-<br>
- if(q >= filters[i].minLumQuality && luma)<br>
- ppMode->lumMode|= filters[i].mask;<br>
- if(chrom==1 || (chrom==-1 && filters[i].chromDefault))<br>
- if(q >= filters[i].minChromQuality)<br>
- ppMode->chromMode|= filters[i].mask;<br>
-<br>
- if(filters[i].mask == LEVEL_FIX){<br>
- int o;<br>
- ppMode->minAllowedY= 16;<br>
- ppMode->maxAllowedY= 234;<br>
- for(o=0; options[o]; o++){<br>
- if( !strcmp(options[o],"fullyrange")<br>
- ||!strcmp(options[o],"f")){<br>
- ppMode->minAllowedY= 0;<br>
- ppMode->maxAllowedY= 255;<br>
- numOfUnknownOptions--;<br>
- }<br>
- }<br>
- }<br>
- else if(filters[i].mask == TEMP_NOISE_FILTER)<br>
- {<br>
- int o;<br>
- int numOfNoises=0;<br>
-<br>
- for(o=0; options[o]; o++){<br>
- char *tail;<br>
- ppMode->maxTmpNoise[numOfNoises]=<br>
- strtol(options[o], &tail, 0);<br>
- if(tail!=options[o]){<br>
- numOfNoises++;<br>
- numOfUnknownOptions--;<br>
- if(numOfNoises >= 3) break;<br>
- }<br>
- }<br>
- }<br>
- else if(filters[i].mask == V_DEBLOCK || filters[i].mask == H_DEBLOCK<br>
- || filters[i].mask == V_A_DEBLOCK || filters[i].mask == H_A_DEBLOCK){<br>
- int o;<br>
-<br>
- for(o=0; options[o] && o<2; o++){<br>
- char *tail;<br>
- int val= strtol(options[o], &tail, 0);<br>
- if(tail==options[o]) break;<br>
-<br>
- numOfUnknownOptions--;<br>
- if(o==0) ppMode->baseDcDiff= val;<br>
- else ppMode->flatnessThreshold= val;<br>
- }<br>
- }<br>
- else if(filters[i].mask == FORCE_QUANT){<br>
- int o;<br>
- ppMode->forcedQuant= 15;<br>
-<br>
- for(o=0; options[o] && o<1; o++){<br>
- char *tail;<br>
- int val= strtol(options[o], &tail, 0);<br>
- if(tail==options[o]) break;<br>
-<br>
- numOfUnknownOptions--;<br>
- ppMode->forcedQuant= val;<br>
- }<br>
- }<br>
- }<br>
- }<br>
- if(!filterNameOk) ppMode->error++;<br>
- ppMode->error += numOfUnknownOptions;<br>
- }<br>
-<br>
- av_log(NULL, AV_LOG_DEBUG, "pp: lumMode=%X, chromMode=%X\n", ppMode->lumMode, ppMode->chromMode);<br>
- if(ppMode->error){<br>
- av_log(NULL, AV_LOG_ERROR, "%d errors in postprocess string \"%s\"\n", ppMode->error, name);<br>
- av_free(ppMode);<br>
- return NULL;<br>
- }<br>
- return ppMode;<br>
-}<br>
-<br>
-void pp_free_mode(pp_mode *mode){<br>
- av_free(mode);<br>
-}<br>
-<br>
-static void reallocAlign(void **p, int size){<br>
- av_free(*p);<br>
- *p= av_mallocz(size);<br>
-}<br>
-<br>
-static void reallocBuffers(PPContext *c, int width, int height, int stride, int qpStride){<br>
- int mbWidth = (width+15)>>4;<br>
- int mbHeight= (height+15)>>4;<br>
- int i;<br>
-<br>
- c->stride= stride;<br>
- c->qpStride= qpStride;<br>
-<br>
- reallocAlign((void **)&c->tempDst, stride*24+32);<br>
- reallocAlign((void **)&c->tempSrc, stride*24);<br>
- reallocAlign((void **)&c->tempBlocks, 2*16*8);<br>
- reallocAlign((void **)&c->yHistogram, 256*sizeof(uint64_t));<br>
- for(i=0; i<256; i++)<br>
- c->yHistogram[i]= width*height/64*15/256;<br>
-<br>
- for(i=0; i<3; i++){<br>
- //Note: The +17*1024 is just there so I do not have to worry about r/w over the end.<br>
- reallocAlign((void **)&c->tempBlurred[i], stride*mbHeight*16 + 17*1024);<br>
- reallocAlign((void **)&c->tempBlurredPast[i], 256*((height+7)&(~7))/2 + 17*1024);//FIXME size<br>
- }<br>
-<br>
- reallocAlign((void **)&c->deintTemp, 2*width+32);<br>
- reallocAlign((void **)&c->nonBQPTable, qpStride*mbHeight*sizeof(int8_t));<br>
- reallocAlign((void **)&c->stdQPTable, qpStride*mbHeight*sizeof(int8_t));<br>
- reallocAlign((void **)&c->forcedQPTable, mbWidth*sizeof(int8_t));<br>
-}<br>
-<br>
-static const char * context_to_name(void * ptr) {<br>
- return "postproc";<br>
-}<br>
-<br>
-static const AVClass av_codec_context_class = { "Postproc", context_to_name, NULL };<br>
-<br>
-av_cold pp_context *pp_get_context(int width, int height, int cpuCaps){<br>
- PPContext *c= av_mallocz(sizeof(PPContext));<br>
- int stride= FFALIGN(width, 16); //assumed / will realloc if needed<br>
- int qpStride= (width+15)/16 + 2; //assumed / will realloc if needed<br>
-<br>
- if (!c)<br>
- return NULL;<br>
-<br>
- c->av_class = &av_codec_context_class;<br>
- if(cpuCaps&PP_FORMAT){<br>
- c->hChromaSubSample= cpuCaps&0x3;<br>
- c->vChromaSubSample= (cpuCaps>>4)&0x3;<br>
- }else{<br>
- c->hChromaSubSample= 1;<br>
- c->vChromaSubSample= 1;<br>
- }<br>
- if (cpuCaps & PP_CPU_CAPS_AUTO) {<br>
- c->cpuCaps = av_get_cpu_flags();<br>
- } else {<br>
- c->cpuCaps = 0;<br>
- if (cpuCaps & PP_CPU_CAPS_ALTIVEC) c->cpuCaps |= AV_CPU_FLAG_ALTIVEC;<br>
- }<br>
-<br>
- reallocBuffers(c, width, height, stride, qpStride);<br>
-<br>
- c->frameNum=-1;<br>
-<br>
- return c;<br>
-}<br>
-<br>
-av_cold void pp_free_context(void *vc){<br>
- PPContext *c = (PPContext*)vc;<br>
- int i;<br>
-<br>
- for(i=0; i<FF_ARRAY_ELEMS(c->tempBlurred); i++)<br>
- av_free(c->tempBlurred[i]);<br>
- for(i=0; i<FF_ARRAY_ELEMS(c->tempBlurredPast); i++)<br>
- av_free(c->tempBlurredPast[i]);<br>
-<br>
- av_free(c->tempBlocks);<br>
- av_free(c->yHistogram);<br>
- av_free(c->tempDst);<br>
- av_free(c->tempSrc);<br>
- av_free(c->deintTemp);<br>
- av_free(c->stdQPTable);<br>
- av_free(c->nonBQPTable);<br>
- av_free(c->forcedQPTable);<br>
-<br>
- memset(c, 0, sizeof(PPContext));<br>
-<br>
- av_free(c);<br>
-}<br>
-<br>
-void pp_postprocess(const uint8_t * src[3], const int srcStride[3],<br>
- uint8_t * dst[3], const int dstStride[3],<br>
- int width, int height,<br>
- const int8_t *QP_store, int QPStride,<br>
- pp_mode *vm, void *vc, int pict_type)<br>
-{<br>
- int mbWidth = (width+15)>>4;<br>
- int mbHeight= (height+15)>>4;<br>
- PPMode *mode = vm;<br>
- PPContext *c = vc;<br>
- int minStride= FFMAX(FFABS(srcStride[0]), FFABS(dstStride[0]));<br>
- int absQPStride = FFABS(QPStride);<br>
-<br>
- if (width < 16 || height < 16) {<br>
- av_log(c, AV_LOG_ERROR, "Postproc is designed to filter 16x16 macroblock based formats, the minimum size is 1 macroblock\n");<br>
- return;<br>
- }<br>
-<br>
- // c->stride and c->QPStride are always positive<br>
- if(c->stride < minStride || c->qpStride < absQPStride)<br>
- reallocBuffers(c, width, height,<br>
- FFMAX(minStride, c->stride),<br>
- FFMAX(c->qpStride, absQPStride));<br>
-<br>
- if(!QP_store || (mode->lumMode & FORCE_QUANT)){<br>
- int i;<br>
- QP_store= c->forcedQPTable;<br>
- absQPStride = QPStride = 0;<br>
- if(mode->lumMode & FORCE_QUANT)<br>
- for(i=0; i<mbWidth; i++) c->forcedQPTable[i]= mode->forcedQuant;<br>
- else<br>
- for(i=0; i<mbWidth; i++) c->forcedQPTable[i]= 1;<br>
- }<br>
-<br>
- if(pict_type & PP_PICT_TYPE_QP2){<br>
- int i;<br>
- const int count= FFMAX(mbHeight * absQPStride, mbWidth);<br>
- for(i=0; i<(count>>2); i++){<br>
- AV_WN32(c->stdQPTable + (i<<2), AV_RN32(QP_store + (i<<2)) >> 1 & 0x7F7F7F7F);<br>
- }<br>
- for(i<<=2; i<count; i++){<br>
- c->stdQPTable[i] = QP_store[i]>>1;<br>
- }<br>
- QP_store= c->stdQPTable;<br>
- QPStride= absQPStride;<br>
- }<br>
-<br>
- if(0){<br>
- int x,y;<br>
- for(y=0; y<mbHeight; y++){<br>
- for(x=0; x<mbWidth; x++){<br>
- av_log(c, AV_LOG_INFO, "%2d ", QP_store[x + y*QPStride]);<br>
- }<br>
- av_log(c, AV_LOG_INFO, "\n");<br>
- }<br>
- av_log(c, AV_LOG_INFO, "\n");<br>
- }<br>
-<br>
- if((pict_type&7)!=3){<br>
- if (QPStride >= 0){<br>
- int i;<br>
- const int count= FFMAX(mbHeight * QPStride, mbWidth);<br>
- for(i=0; i<(count>>2); i++){<br>
- AV_WN32(c->nonBQPTable + (i<<2), AV_RN32(QP_store + (i<<2)) & 0x3F3F3F3F);<br>
- }<br>
- for(i<<=2; i<count; i++){<br>
- c->nonBQPTable[i] = QP_store[i] & 0x3F;<br>
- }<br>
- } else {<br>
- int i,j;<br>
- for(i=0; i<mbHeight; i++) {<br>
- for(j=0; j<absQPStride; j++) {<br>
- c->nonBQPTable[i*absQPStride+j] = QP_store[i*QPStride+j] & 0x3F;<br>
- }<br>
- }<br>
- }<br>
- }<br>
-<br>
- av_log(c, AV_LOG_DEBUG, "using npp filters 0x%X/0x%X\n",<br>
- mode->lumMode, mode->chromMode);<br>
-<br>
- postProcess(src[0], srcStride[0], dst[0], dstStride[0],<br>
- width, height, QP_store, QPStride, 0, mode, c);<br>
-<br>
- if (!(src[1] && src[2] && dst[1] && dst[2]))<br>
- return;<br>
-<br>
- width = (width )>>c->hChromaSubSample;<br>
- height = (height)>>c->vChromaSubSample;<br>
-<br>
- if(mode->chromMode){<br>
- postProcess(src[1], srcStride[1], dst[1], dstStride[1],<br>
- width, height, QP_store, QPStride, 1, mode, c);<br>
- postProcess(src[2], srcStride[2], dst[2], dstStride[2],<br>
- width, height, QP_store, QPStride, 2, mode, c);<br>
- }<br>
- else if(srcStride[1] == dstStride[1] && srcStride[2] == dstStride[2]){<br>
- linecpy(dst[1], src[1], height, srcStride[1]);<br>
- linecpy(dst[2], src[2], height, srcStride[2]);<br>
- }else{<br>
- int y;<br>
- for(y=0; y<height; y++){<br>
- memcpy(&(dst[1][y*dstStride[1]]), &(src[1][y*srcStride[1]]), width);<br>
- memcpy(&(dst[2][y*dstStride[2]]), &(src[2][y*srcStride[2]]), width);<br>
- }<br>
- }<br>
-}<br>
diff --git a/libpostproc/postprocess.h b/libpostproc/postprocess.h<br>
deleted file mode 100644<br>
index d2adb6ccad7..00000000000<br>
--- a/libpostproc/postprocess.h<br>
+++ /dev/null<br>
@@ -1,109 +0,0 @@<br>
-/*<br>
- * Copyright (C) 2001-2003 Michael Niedermayer (<a href="mailto:michaelni@gmx.at" rel="noreferrer noreferrer noreferrer" target="_blank">michaelni@gmx.at</a>)<br>
- *<br>
- * This file is part of FFmpeg.<br>
- *<br>
- * FFmpeg is free software; you can redistribute it and/or modify<br>
- * it under the terms of the GNU General Public License as published by<br>
- * the Free Software Foundation; either version 2 of the License, or<br>
- * (at your option) any later version.<br>
- *<br>
- * FFmpeg is distributed in the hope that it will be useful,<br>
- * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
- * GNU General Public License for more details.<br>
- *<br>
- * You should have received a copy of the GNU General Public License<br>
- * along with FFmpeg; if not, write to the Free Software<br>
- * Foundation, Inc., <a href="https://www.google.com/maps/search/51+Franklin+Street?entry=gmail&source=g" rel="noreferrer noreferrer" target="_blank">51 Franklin Street</a>, Fifth Floor, Boston, MA 02110-1301 USA<br>
- */<br>
-<br>
-#ifndef POSTPROC_POSTPROCESS_H<br>
-#define POSTPROC_POSTPROCESS_H<br>
-<br>
-/**<br>
- * @file<br>
- * @ingroup lpp<br>
- * external API header<br>
- */<br>
-<br>
-/**<br>
- * @defgroup lpp libpostproc<br>
- * Video postprocessing library.<br>
- *<br>
- * @{<br>
- */<br>
-<br>
-#include "libpostproc/version_major.h"<br>
-#ifndef HAVE_AV_CONFIG_H<br>
-/* When included as part of the ffmpeg build, only include the major version<br>
- * to avoid unnecessary rebuilds. When included externally, keep including<br>
- * the full version information. */<br>
-#include "libpostproc/version.h"<br>
-#endif<br>
-<br>
-/**<br>
- * Return the LIBPOSTPROC_VERSION_INT constant.<br>
- */<br>
-unsigned postproc_version(void);<br>
-<br>
-/**<br>
- * Return the libpostproc build-time configuration.<br>
- */<br>
-const char *postproc_configuration(void);<br>
-<br>
-/**<br>
- * Return the libpostproc license.<br>
- */<br>
-const char *postproc_license(void);<br>
-<br>
-#define PP_QUALITY_MAX 6<br>
-<br>
-#include <inttypes.h><br>
-<br>
-typedef void pp_context;<br>
-typedef void pp_mode;<br>
-<br>
-extern const char pp_help[]; ///< a simple help text<br>
-<br>
-void pp_postprocess(const uint8_t * src[3], const int srcStride[3],<br>
- uint8_t * dst[3], const int dstStride[3],<br>
- int horizontalSize, int verticalSize,<br>
- const int8_t *QP_store, int QP_stride,<br>
- pp_mode *mode, pp_context *ppContext, int pict_type);<br>
-<br>
-<br>
-/**<br>
- * Return a pp_mode or NULL if an error occurred.<br>
- *<br>
- * @param name the string after "-pp" on the command line<br>
- * @param quality a number from 0 to PP_QUALITY_MAX<br>
- */<br>
-pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality);<br>
-void pp_free_mode(pp_mode *mode);<br>
-<br>
-pp_context *pp_get_context(int width, int height, int flags);<br>
-void pp_free_context(pp_context *ppContext);<br>
-<br>
-#define PP_CPU_CAPS_MMX 0x80000000<br>
-#define PP_CPU_CAPS_MMX2 0x20000000<br>
-#if FF_API_PP_AMD_3DNOW<br>
-#define PP_CPU_CAPS_3DNOW 0x40000000<br>
-#endif<br>
-#define PP_CPU_CAPS_ALTIVEC 0x10000000<br>
-#define PP_CPU_CAPS_AUTO 0x00080000<br>
-<br>
-#define PP_FORMAT 0x00000008<br>
-#define PP_FORMAT_420 (0x00000011|PP_FORMAT)<br>
-#define PP_FORMAT_422 (0x00000001|PP_FORMAT)<br>
-#define PP_FORMAT_411 (0x00000002|PP_FORMAT)<br>
-#define PP_FORMAT_444 (0x00000000|PP_FORMAT)<br>
-#define PP_FORMAT_440 (0x00000010|PP_FORMAT)<br>
-<br>
-#define PP_PICT_TYPE_QP2 0x00000010 ///< MPEG2 style QScale<br>
-<br>
-/**<br>
- * @}<br>
- */<br>
-<br>
-#endif /* POSTPROC_POSTPROCESS_H */<br>
diff --git a/libpostproc/postprocess_altivec_template.c b/libpostproc/postprocess_altivec_template.c<br>
deleted file mode 100644<br>
index feddab50356..00000000000<br>
--- a/libpostproc/postprocess_altivec_template.c<br>
+++ /dev/null<br>
@@ -1,1214 +0,0 @@<br>
-/*<br>
- * AltiVec optimizations (C) 2004 Romain Dolbeau <<a href="mailto:romain@dolbeau.org" rel="noreferrer noreferrer noreferrer" target="_blank">romain@dolbeau.org</a>><br>
- *<br>
- * based on code by Copyright (C) 2001-2003 Michael Niedermayer (<a href="mailto:michaelni@gmx.at" rel="noreferrer noreferrer noreferrer" target="_blank">michaelni@gmx.at</a>)<br>
- *<br>
- * This file is part of FFmpeg.<br>
- *<br>
- * FFmpeg is free software; you can redistribute it and/or modify<br>
- * it under the terms of the GNU General Public License as published by<br>
- * the Free Software Foundation; either version 2 of the License, or<br>
- * (at your option) any later version.<br>
- *<br>
- * FFmpeg is distributed in the hope that it will be useful,<br>
- * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
- * GNU General Public License for more details.<br>
- *<br>
- * You should have received a copy of the GNU General Public License<br>
- * along with FFmpeg; if not, write to the Free Software<br>
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA<br>
- */<br>
-<br>
-#include "libavutil/avutil.h"<br>
-#include "libavutil/mem_internal.h"<br>
-<br>
-#define ALTIVEC_TRANSPOSE_8x8_SHORT(src_a,src_b,src_c,src_d,src_e,src_f,src_g,src_h) \<br>
- do { \<br>
- __typeof__(src_a) tempA1, tempB1, tempC1, tempD1; \<br>
- __typeof__(src_a) tempE1, tempF1, tempG1, tempH1; \<br>
- __typeof__(src_a) tempA2, tempB2, tempC2, tempD2; \<br>
- __typeof__(src_a) tempE2, tempF2, tempG2, tempH2; \<br>
- tempA1 = vec_mergeh (src_a, src_e); \<br>
- tempB1 = vec_mergel (src_a, src_e); \<br>
- tempC1 = vec_mergeh (src_b, src_f); \<br>
- tempD1 = vec_mergel (src_b, src_f); \<br>
- tempE1 = vec_mergeh (src_c, src_g); \<br>
- tempF1 = vec_mergel (src_c, src_g); \<br>
- tempG1 = vec_mergeh (src_d, src_h); \<br>
- tempH1 = vec_mergel (src_d, src_h); \<br>
- tempA2 = vec_mergeh (tempA1, tempE1); \<br>
- tempB2 = vec_mergel (tempA1, tempE1); \<br>
- tempC2 = vec_mergeh (tempB1, tempF1); \<br>
- tempD2 = vec_mergel (tempB1, tempF1); \<br>
- tempE2 = vec_mergeh (tempC1, tempG1); \<br>
- tempF2 = vec_mergel (tempC1, tempG1); \<br>
- tempG2 = vec_mergeh (tempD1, tempH1); \<br>
- tempH2 = vec_mergel (tempD1, tempH1); \<br>
- src_a = vec_mergeh (tempA2, tempE2); \<br>
- src_b = vec_mergel (tempA2, tempE2); \<br>
- src_c = vec_mergeh (tempB2, tempF2); \<br>
- src_d = vec_mergel (tempB2, tempF2); \<br>
- src_e = vec_mergeh (tempC2, tempG2); \<br>
- src_f = vec_mergel (tempC2, tempG2); \<br>
- src_g = vec_mergeh (tempD2, tempH2); \<br>
- src_h = vec_mergel (tempD2, tempH2); \<br>
- } while (0)<br>
-<br>
-<br>
-static inline int vertClassify_altivec(uint8_t src[], int stride, PPContext *c) {<br>
- /*<br>
- this code makes no assumption on src or stride.<br>
- One could remove the recomputation of the perm<br>
- vector by assuming (stride % 16) == 0, unfortunately<br>
- this is not always true.<br>
- */<br>
- short data_0 = ((c->nonBQP*c->ppMode.baseDcDiff)>>8) + 1;<br>
- DECLARE_ALIGNED(16, short, data)[8] =<br>
- {<br>
- data_0,<br>
- data_0 * 2 + 1,<br>
- c->QP * 2,<br>
- c->QP * 4<br>
- };<br>
- int numEq;<br>
- uint8_t *src2 = src;<br>
- vector signed short v_dcOffset;<br>
- vector signed short v2QP;<br>
- vector unsigned short v4QP;<br>
- vector unsigned short v_dcThreshold;<br>
- const int properStride = (stride % 16);<br>
- const int srcAlign = ((unsigned long)src2 % 16);<br>
- const int two_vectors = ((srcAlign > 8) || properStride) ? 1 : 0;<br>
- const vector signed int zero = vec_splat_s32(0);<br>
- const vector signed short mask = vec_splat_s16(1);<br>
- vector signed int v_numEq = vec_splat_s32(0);<br>
- vector signed short v_data = vec_ld(0, data);<br>
- vector signed short v_srcAss0, v_srcAss1, v_srcAss2, v_srcAss3,<br>
- v_srcAss4, v_srcAss5, v_srcAss6, v_srcAss7;<br>
-//FIXME avoid this mess if possible<br>
- register int j0 = 0,<br>
- j1 = stride,<br>
- j2 = 2 * stride,<br>
- j3 = 3 * stride,<br>
- j4 = 4 * stride,<br>
- j5 = 5 * stride,<br>
- j6 = 6 * stride,<br>
- j7 = 7 * stride;<br>
- vector unsigned char v_srcA0, v_srcA1, v_srcA2, v_srcA3,<br>
- v_srcA4, v_srcA5, v_srcA6, v_srcA7;<br>
-<br>
- v_dcOffset = vec_splat(v_data, 0);<br>
- v_dcThreshold = (vector unsigned short)vec_splat(v_data, 1);<br>
- v2QP = vec_splat(v_data, 2);<br>
- v4QP = (vector unsigned short)vec_splat(v_data, 3);<br>
-<br>
- src2 += stride * 4;<br>
-<br>
-#define LOAD_LINE(i) \<br>
- { \<br>
- vector unsigned char perm##i = vec_lvsl(j##i, src2); \<br>
- vector unsigned char v_srcA2##i; \<br>
- vector unsigned char v_srcA1##i = vec_ld(j##i, src2); \<br>
- if (two_vectors) \<br>
- v_srcA2##i = vec_ld(j##i + 16, src2); \<br>
- v_srcA##i = \<br>
- vec_perm(v_srcA1##i, v_srcA2##i, perm##i); \<br>
- v_srcAss##i = \<br>
- (vector signed short)vec_mergeh((vector signed char)zero, \<br>
- (vector signed char)v_srcA##i); }<br>
-<br>
-#define LOAD_LINE_ALIGNED(i) \<br>
- v_srcA##i = vec_ld(j##i, src2); \<br>
- v_srcAss##i = \<br>
- (vector signed short)vec_mergeh((vector signed char)zero, \<br>
- (vector signed char)v_srcA##i)<br>
-<br>
- /* Special-casing the aligned case is worthwhile, as all calls from<br>
- * the (transposed) horizontable deblocks will be aligned, in addition<br>
- * to the naturally aligned vertical deblocks. */<br>
- if (properStride && srcAlign) {<br>
- LOAD_LINE_ALIGNED(0);<br>
- LOAD_LINE_ALIGNED(1);<br>
- LOAD_LINE_ALIGNED(2);<br>
- LOAD_LINE_ALIGNED(3);<br>
- LOAD_LINE_ALIGNED(4);<br>
- LOAD_LINE_ALIGNED(5);<br>
- LOAD_LINE_ALIGNED(6);<br>
- LOAD_LINE_ALIGNED(7);<br>
- } else {<br>
- LOAD_LINE(0);<br>
- LOAD_LINE(1);<br>
- LOAD_LINE(2);<br>
- LOAD_LINE(3);<br>
- LOAD_LINE(4);<br>
- LOAD_LINE(5);<br>
- LOAD_LINE(6);<br>
- LOAD_LINE(7);<br>
- }<br>
-#undef LOAD_LINE<br>
-#undef LOAD_LINE_ALIGNED<br>
-<br>
-#define ITER(i, j) \<br>
- const vector signed short v_diff##i = \<br>
- vec_sub(v_srcAss##i, v_srcAss##j); \<br>
- const vector signed short v_sum##i = \<br>
- vec_add(v_diff##i, v_dcOffset); \<br>
- const vector signed short v_comp##i = \<br>
- (vector signed short)vec_cmplt((vector unsigned short)v_sum##i, \<br>
- v_dcThreshold); \<br>
- const vector signed short v_part##i = vec_and(mask, v_comp##i);<br>
-<br>
- {<br>
- ITER(0, 1)<br>
- ITER(1, 2)<br>
- ITER(2, 3)<br>
- ITER(3, 4)<br>
- ITER(4, 5)<br>
- ITER(5, 6)<br>
- ITER(6, 7)<br>
-<br>
- v_numEq = vec_sum4s(v_part0, v_numEq);<br>
- v_numEq = vec_sum4s(v_part1, v_numEq);<br>
- v_numEq = vec_sum4s(v_part2, v_numEq);<br>
- v_numEq = vec_sum4s(v_part3, v_numEq);<br>
- v_numEq = vec_sum4s(v_part4, v_numEq);<br>
- v_numEq = vec_sum4s(v_part5, v_numEq);<br>
- v_numEq = vec_sum4s(v_part6, v_numEq);<br>
- }<br>
-<br>
-#undef ITER<br>
-<br>
- v_numEq = vec_sums(v_numEq, zero);<br>
-<br>
- v_numEq = vec_splat(v_numEq, 3);<br>
- vec_ste(v_numEq, 0, &numEq);<br>
-<br>
- if (numEq > c->ppMode.flatnessThreshold){<br>
- const vector unsigned char mmoP1 = (const vector unsigned char)<br>
- {0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,<br>
- 0x00, 0x01, 0x12, 0x13, 0x08, 0x09, 0x1A, 0x1B};<br>
- const vector unsigned char mmoP2 = (const vector unsigned char)<br>
- {0x04, 0x05, 0x16, 0x17, 0x0C, 0x0D, 0x1E, 0x1F,<br>
- 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f};<br>
- const vector unsigned char mmoP = (const vector unsigned char)<br>
- vec_lvsl(8, (unsigned char*)0);<br>
-<br>
- vector signed short mmoL1 = vec_perm(v_srcAss0, v_srcAss2, mmoP1);<br>
- vector signed short mmoL2 = vec_perm(v_srcAss4, v_srcAss6, mmoP2);<br>
- vector signed short mmoL = vec_perm(mmoL1, mmoL2, mmoP);<br>
- vector signed short mmoR1 = vec_perm(v_srcAss5, v_srcAss7, mmoP1);<br>
- vector signed short mmoR2 = vec_perm(v_srcAss1, v_srcAss3, mmoP2);<br>
- vector signed short mmoR = vec_perm(mmoR1, mmoR2, mmoP);<br>
- vector signed short mmoDiff = vec_sub(mmoL, mmoR);<br>
- vector unsigned short mmoSum = (vector unsigned short)vec_add(mmoDiff, v2QP);<br>
-<br>
- if (vec_any_gt(mmoSum, v4QP))<br>
- return 0;<br>
- else<br>
- return 1;<br>
- }<br>
- else return 2;<br>
-}<br>
-<br>
-static inline void doVertLowPass_altivec(uint8_t *src, int stride, PPContext *c) {<br>
- /*<br>
- this code makes no assumption on src or stride.<br>
- One could remove the recomputation of the perm<br>
- vector by assuming (stride % 16) == 0, unfortunately<br>
- this is not always true. Quite a lot of load/stores<br>
- can be removed by assuming proper alignment of<br>
- src & stride :-(<br>
- */<br>
- uint8_t *src2 = src;<br>
- const vector signed int zero = vec_splat_s32(0);<br>
- const int properStride = (stride % 16);<br>
- const int srcAlign = ((unsigned long)src2 % 16);<br>
- DECLARE_ALIGNED(16, short, qp)[8] = {c->QP};<br>
- vector signed short vqp = vec_ld(0, qp);<br>
- vector signed short vb0, vb1, vb2, vb3, vb4, vb5, vb6, vb7, vb8, vb9;<br>
- vector unsigned char vbA0, av_uninit(vbA1), av_uninit(vbA2), av_uninit(vbA3), av_uninit(vbA4), av_uninit(vbA5), av_uninit(vbA6), av_uninit(vbA7), av_uninit(vbA8), vbA9;<br>
- vector unsigned char vbB0, av_uninit(vbB1), av_uninit(vbB2), av_uninit(vbB3), av_uninit(vbB4), av_uninit(vbB5), av_uninit(vbB6), av_uninit(vbB7), av_uninit(vbB8), vbB9;<br>
- vector unsigned char vbT0, vbT1, vbT2, vbT3, vbT4, vbT5, vbT6, vbT7, vbT8, vbT9;<br>
- vector unsigned char perml0, perml1, perml2, perml3, perml4,<br>
- perml5, perml6, perml7, perml8, perml9;<br>
- register int j0 = 0,<br>
- j1 = stride,<br>
- j2 = 2 * stride,<br>
- j3 = 3 * stride,<br>
- j4 = 4 * stride,<br>
- j5 = 5 * stride,<br>
- j6 = 6 * stride,<br>
- j7 = 7 * stride,<br>
- j8 = 8 * stride,<br>
- j9 = 9 * stride;<br>
-<br>
- vqp = vec_splat(vqp, 0);<br>
-<br>
- src2 += stride*3;<br>
-<br>
-#define LOAD_LINE(i) \<br>
- perml##i = vec_lvsl(i * stride, src2); \<br>
- vbA##i = vec_ld(i * stride, src2); \<br>
- vbB##i = vec_ld(i * stride + 16, src2); \<br>
- vbT##i = vec_perm(vbA##i, vbB##i, perml##i); \<br>
- vb##i = \<br>
- (vector signed short)vec_mergeh((vector unsigned char)zero, \<br>
- (vector unsigned char)vbT##i)<br>
-<br>
-#define LOAD_LINE_ALIGNED(i) \<br>
- vbT##i = vec_ld(j##i, src2); \<br>
- vb##i = \<br>
- (vector signed short)vec_mergeh((vector signed char)zero, \<br>
- (vector signed char)vbT##i)<br>
-<br>
- /* Special-casing the aligned case is worthwhile, as all calls from<br>
- * the (transposed) horizontable deblocks will be aligned, in addition<br>
- * to the naturally aligned vertical deblocks. */<br>
- if (properStride && srcAlign) {<br>
- LOAD_LINE_ALIGNED(0);<br>
- LOAD_LINE_ALIGNED(1);<br>
- LOAD_LINE_ALIGNED(2);<br>
- LOAD_LINE_ALIGNED(3);<br>
- LOAD_LINE_ALIGNED(4);<br>
- LOAD_LINE_ALIGNED(5);<br>
- LOAD_LINE_ALIGNED(6);<br>
- LOAD_LINE_ALIGNED(7);<br>
- LOAD_LINE_ALIGNED(8);<br>
- LOAD_LINE_ALIGNED(9);<br>
- } else {<br>
- LOAD_LINE(0);<br>
- LOAD_LINE(1);<br>
- LOAD_LINE(2);<br>
- LOAD_LINE(3);<br>
- LOAD_LINE(4);<br>
- LOAD_LINE(5);<br>
- LOAD_LINE(6);<br>
- LOAD_LINE(7);<br>
- LOAD_LINE(8);<br>
- LOAD_LINE(9);<br>
- }<br>
-#undef LOAD_LINE<br>
-#undef LOAD_LINE_ALIGNED<br>
- {<br>
- const vector unsigned short v_2 = vec_splat_u16(2);<br>
- const vector unsigned short v_4 = vec_splat_u16(4);<br>
-<br>
- const vector signed short v_diff01 = vec_sub(vb0, vb1);<br>
- const vector unsigned short v_cmp01 =<br>
- (const vector unsigned short) vec_cmplt(vec_abs(v_diff01), vqp);<br>
- const vector signed short v_first = vec_sel(vb1, vb0, v_cmp01);<br>
- const vector signed short v_diff89 = vec_sub(vb8, vb9);<br>
- const vector unsigned short v_cmp89 =<br>
- (const vector unsigned short) vec_cmplt(vec_abs(v_diff89), vqp);<br>
- const vector signed short v_last = vec_sel(vb8, vb9, v_cmp89);<br>
-<br>
- const vector signed short temp01 = vec_mladd(v_first, (vector signed short)v_4, vb1);<br>
- const vector signed short temp02 = vec_add(vb2, vb3);<br>
- const vector signed short temp03 = vec_add(temp01, (vector signed short)v_4);<br>
- const vector signed short v_sumsB0 = vec_add(temp02, temp03);<br>
-<br>
- const vector signed short temp11 = vec_sub(v_sumsB0, v_first);<br>
- const vector signed short v_sumsB1 = vec_add(temp11, vb4);<br>
-<br>
- const vector signed short temp21 = vec_sub(v_sumsB1, v_first);<br>
- const vector signed short v_sumsB2 = vec_add(temp21, vb5);<br>
-<br>
- const vector signed short temp31 = vec_sub(v_sumsB2, v_first);<br>
- const vector signed short v_sumsB3 = vec_add(temp31, vb6);<br>
-<br>
- const vector signed short temp41 = vec_sub(v_sumsB3, v_first);<br>
- const vector signed short v_sumsB4 = vec_add(temp41, vb7);<br>
-<br>
- const vector signed short temp51 = vec_sub(v_sumsB4, vb1);<br>
- const vector signed short v_sumsB5 = vec_add(temp51, vb8);<br>
-<br>
- const vector signed short temp61 = vec_sub(v_sumsB5, vb2);<br>
- const vector signed short v_sumsB6 = vec_add(temp61, v_last);<br>
-<br>
- const vector signed short temp71 = vec_sub(v_sumsB6, vb3);<br>
- const vector signed short v_sumsB7 = vec_add(temp71, v_last);<br>
-<br>
- const vector signed short temp81 = vec_sub(v_sumsB7, vb4);<br>
- const vector signed short v_sumsB8 = vec_add(temp81, v_last);<br>
-<br>
- const vector signed short temp91 = vec_sub(v_sumsB8, vb5);<br>
- const vector signed short v_sumsB9 = vec_add(temp91, v_last);<br>
-<br>
- #define COMPUTE_VR(i, j, k) \<br>
- const vector signed short temps1##i = \<br>
- vec_add(v_sumsB##i, v_sumsB##k); \<br>
- const vector signed short temps2##i = \<br>
- vec_mladd(vb##j, (vector signed short)v_2, temps1##i); \<br>
- const vector signed short vr##j = vec_sra(temps2##i, v_4)<br>
-<br>
- COMPUTE_VR(0, 1, 2);<br>
- COMPUTE_VR(1, 2, 3);<br>
- COMPUTE_VR(2, 3, 4);<br>
- COMPUTE_VR(3, 4, 5);<br>
- COMPUTE_VR(4, 5, 6);<br>
- COMPUTE_VR(5, 6, 7);<br>
- COMPUTE_VR(6, 7, 8);<br>
- COMPUTE_VR(7, 8, 9);<br>
-<br>
- const vector signed char neg1 = vec_splat_s8(-1);<br>
- const vector unsigned char permHH = (const vector unsigned char){0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,<br>
- 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F};<br>
-<br>
-#define PACK_AND_STORE(i) \<br>
-{ const vector unsigned char perms##i = \<br>
- vec_lvsr(i * stride, src2); \<br>
- const vector unsigned char vf##i = \<br>
- vec_packsu(vr##i, (vector signed short)zero); \<br>
- const vector unsigned char vg##i = \<br>
- vec_perm(vf##i, vbT##i, permHH); \<br>
- const vector unsigned char mask##i = \<br>
- vec_perm((vector unsigned char)zero, (vector unsigned char)neg1, perms##i); \<br>
- const vector unsigned char vg2##i = \<br>
- vec_perm(vg##i, vg##i, perms##i); \<br>
- const vector unsigned char svA##i = \<br>
- vec_sel(vbA##i, vg2##i, mask##i); \<br>
- const vector unsigned char svB##i = \<br>
- vec_sel(vg2##i, vbB##i, mask##i); \<br>
- vec_st(svA##i, i * stride, src2); \<br>
- vec_st(svB##i, i * stride + 16, src2);}<br>
-<br>
-#define PACK_AND_STORE_ALIGNED(i) \<br>
-{ const vector unsigned char vf##i = \<br>
- vec_packsu(vr##i, (vector signed short)zero); \<br>
- const vector unsigned char vg##i = \<br>
- vec_perm(vf##i, vbT##i, permHH); \<br>
- vec_st(vg##i, i * stride, src2);}<br>
-<br>
- /* Special-casing the aligned case is worthwhile, as all calls from<br>
- * the (transposed) horizontable deblocks will be aligned, in addition<br>
- * to the naturally aligned vertical deblocks. */<br>
- if (properStride && srcAlign) {<br>
- PACK_AND_STORE_ALIGNED(1)<br>
- PACK_AND_STORE_ALIGNED(2)<br>
- PACK_AND_STORE_ALIGNED(3)<br>
- PACK_AND_STORE_ALIGNED(4)<br>
- PACK_AND_STORE_ALIGNED(5)<br>
- PACK_AND_STORE_ALIGNED(6)<br>
- PACK_AND_STORE_ALIGNED(7)<br>
- PACK_AND_STORE_ALIGNED(8)<br>
- } else {<br>
- PACK_AND_STORE(1)<br>
- PACK_AND_STORE(2)<br>
- PACK_AND_STORE(3)<br>
- PACK_AND_STORE(4)<br>
- PACK_AND_STORE(5)<br>
- PACK_AND_STORE(6)<br>
- PACK_AND_STORE(7)<br>
- PACK_AND_STORE(8)<br>
- }<br>
- #undef PACK_AND_STORE<br>
- #undef PACK_AND_STORE_ALIGNED<br>
- }<br>
-}<br>
-<br>
-<br>
-<br>
-static inline void doVertDefFilter_altivec(uint8_t src[], int stride, PPContext *c) {<br>
- /*<br>
- this code makes no assumption on src or stride.<br>
- One could remove the recomputation of t</blockquote></div></div></div></blockquote></div></div></div>