Re: [FFmpeg-devel] [PATCH 3/4] ffmpeg: use av_buffersrc_close().
On Wed, Jul 30, 2014 at 11:44:48PM +0200, Nicolas George wrote: Signed-off-by: Nicolas George geo...@nsup.org --- ffmpeg.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) LGTM [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Asymptotically faster algorithms should always be preferred if you have asymptotical amounts of data signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/4] lavfi/buffersrc: add add av_buffersrc_close().
On Wed, Jul 30, 2014 at 11:44:47PM +0200, Nicolas George wrote: Also deprecate adding a NULL frame to mark EOF. TODO APIchanges entry, version bump. Signed-off-by: Nicolas George geo...@nsup.org --- libavfilter/buffersrc.c | 40 ++-- libavfilter/buffersrc.h | 15 +++ 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index 27d3db0..6d71587 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -63,6 +63,7 @@ typedef struct BufferSourceContext { char*channel_layout_str; int eof; +int64_t eof_pts; } BufferSourceContext; #define CHECK_VIDEO_PARAM_CHANGE(s, c, width, height, format)\ @@ -77,6 +78,27 @@ typedef struct BufferSourceContext { return AVERROR(EINVAL);\ } +static int push_if_flag(AVFilterContext *ctx, int flags) +{ +return (flags AV_BUFFERSRC_FLAG_PUSH) ? +ctx-output_pads[0].request_frame(ctx-outputs[0]) : 0; +} + +int av_buffersrc_close(AVFilterContext *ctx, int64_t pts, int flags) +{ +BufferSourceContext *s = ctx-priv; + +if (pts == AV_NOPTS_VALUE) { +av_log(ctx, AV_LOG_WARNING, No EOF timestamp\n); +/* FIXME use duration for audio */ +pts = av_rescale_q(ctx-outputs[0]-current_pts, + AV_TIME_BASE_Q, ctx-outputs[0]-time_base) + 1; +} +s-eof_pts = pts; +s-eof = 1; +return push_if_flag(ctx, flags); +} + int attribute_align_arg av_buffersrc_write_frame(AVFilterContext *ctx, const AVFrame *frame) { return av_buffersrc_add_frame_flags(ctx, (AVFrame *)frame, @@ -125,8 +147,7 @@ static int av_buffersrc_add_frame_internal(AVFilterContext *ctx, s-nb_failed_requests = 0; if (!frame) { -s-eof = 1; -return 0; +return av_buffersrc_close(ctx, AV_NOPTS_VALUE, flags); } else if (s-eof) return AVERROR(EINVAL); @@ -177,11 +198,7 @@ static int av_buffersrc_add_frame_internal(AVFilterContext *ctx, return ret; } -if ((flags AV_BUFFERSRC_FLAG_PUSH)) -if ((ret = ctx-output_pads[0].request_frame(ctx-outputs[0])) 0) -return ret; - -return 0; +return push_if_flag(ctx, flags); } some of this patch seems to be factorizing code, other add fuctionality like ff_filter_link_close() all LGTM i think but maybe should be split [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When you are offended at any man's fault, turn to yourself and study your own failings. Then you will forget your anger. -- Epictetus signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] HEVC SIMD Optimization on PowerPC
On Sat, 2 Aug 2014 13:37:10 +0800 Zhenan Lin linzhe...@pku.edu.cn wrote: Hi, all, Our team plans to contribute SIMD optimization on PowerPC for HEVC i thought powerpc was dead? i dont know if anyone is working on it. -compn ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/4] Exploit compile-time constant
On Mon, Jul 28, 2014 at 05:17:24PM +, Christophe Gisquet wrote: MAX_PB_SIZE is used or assumed for various buffer strides. In some cases, it is used as constant parameter(s) to functions. Make use of that knowledge to: - not pass the parameter - avoid extra GPR usage - precompute addresses / offsets Premature optimization and overall not that useful. Before: 46092 decicycles in oma, 1028766 runs, 19810 skips 10174 decicycles in chroma, 2065859 runs, 31293 skips After: 45634 decicycles in luma, 1027414 runs, 21162 skips 9932 decicycles in chroma, 2063780 runs, 33372 skips is this for apply/push or just RFC/WIP ? you say Premature optimization and overall not that useful. i would tend to suggest to apply it as it improves speed ... Christophe Gisquet (4): hevc: move MAX_PB_SIZE declaration hevcdsp: remove compilation-time-fixed parameter hevcdsp: remove more instances of compile-time-fixed parameters x86: hevcdsp: use compilation-time-fixed constant seems to fail with libavcodec/x86/hevc_mc.asm:1258: error: (add:2) cannot reference symbol `MAX_PB_SIZE' in preprocessor [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Republics decline into democracies and democracies degenerate into despotisms. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] HEVC SIMD Optimization on PowerPC
On Sat, Aug 02, 2014 at 07:18:22AM -0400, compn wrote: On Sat, 2 Aug 2014 13:37:10 +0800 Zhenan Lin linzhe...@pku.edu.cn wrote: Hi, all, Our team plans to contribute SIMD optimization on PowerPC for HEVC i thought powerpc was dead? i thought so too, but powerpc optimizations certainly are welcome, if someone wants to write some [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB it is not once nor twice but times without number that the same ideas make their appearance in the world. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] msvc: fix implicitly declared read/close.
On Sat, Aug 02, 2014 at 12:01:37PM +1000, Matt Oliver wrote: MSVC/ICL does not have unistd.h as standard and instead declares read/close functions in io.h. This is currently handled in some files but not in a couple. Adding an include for io.h where needed adds the correct declarations. libavcodec/libxvid.c|4 libavcodec/libxvid_rc.c |4 libavutil/random_seed.c |3 +++ 3 files changed, 11 insertions(+) 9df30ccc9f607fe515c1058f85e6f6bce0e07984 0001-msvc-fix-implicitly-declared-read-close.patch From a9df2f27cf88e5e2e0a518daaba41b1b9ce8bdcb Mon Sep 17 00:00:00 2001 From: Matthew Oliver protogo...@gmail.com Date: Sat, 2 Aug 2014 11:08:29 +1000 Subject: [PATCH] msvc: fix implicitly declared read/close. applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I do not agree with what you have to say, but I'll defend to the death your right to say it. -- Voltaire signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] ffserver: deprecate Port and BindAddress options in favor of HTTPPort and HTTPBindAddress
The new option names are more explicit. --- doc/ffserver.conf | 4 ++-- doc/ffserver.texi | 19 ++- ffserver.c| 10 +++--- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/doc/ffserver.conf b/doc/ffserver.conf index 094c093..b756961 100644 --- a/doc/ffserver.conf +++ b/doc/ffserver.conf @@ -1,11 +1,11 @@ # Port on which the server is listening. You must select a different # port from your standard HTTP web server if it is running on the same # computer. -Port 8090 +HTTPPort 8090 # Address on which the server is bound. Only useful if you have # several network interfaces. -BindAddress 0.0.0.0 +HTTPBindAddress 0.0.0.0 # Number of simultaneous HTTP connections that can be handled. It has # to be defined *before* the MaxClients parameter, since it defines the diff --git a/doc/ffserver.texi b/doc/ffserver.texi index 2bf8152..77273d2 100644 --- a/doc/ffserver.texi +++ b/doc/ffserver.texi @@ -66,7 +66,7 @@ http://@var{ffserver_ip_address}:@var{http_port}/@var{feed_name} where @var{ffserver_ip_address} is the IP address of the machine where @command{ffserver} is installed, @var{http_port} is the port number of -the HTTP server (configured through the @option{Port} option), and +the HTTP server (configured through the @option{HTTPPort} option), and @var{feed_name} is the name of the corresponding feed defined in the configuration file. @@ -101,7 +101,7 @@ http://@var{ffserver_ip_address}:@var{rtsp_port}/@var{stream_name}[@var{options} the configuration file. @var{options} is a list of options specified after the URL which affects how the stream is served by @command{ffserver}. @var{http_port} and @var{rtsp_port} are the HTTP -and RTSP ports configured with the options @var{Port} and +and RTSP ports configured with the options @var{HTTPPort} and @var{RTSPPort} respectively. In case the stream is associated to a feed, the encoding parameters @@ -352,20 +352,29 @@ allow everybody else. @section Global options @table @option +@item HTTPPort @var{port_number} @item Port @var{port_number} @item RTSPPort @var{port_number} -Set TCP port number on which the HTTP/RTSP server is listening. You -must select a different port from your standard HTTP web server if it -is running on the same computer. +@var{HTTPPort} sets the HTTP server listening TCP port number, +@var{RTSPPort} sets the RTSP server listening TCP port number. + +@var{Port} is the equivalent of @var{HTTPPort} and is deprecated. + +You must select a different port from your standard HTTP web server if +it is running on the same computer. If not specified, no corresponding server will be created. +@item HTTPBindAddress @var{ip_address} @item BindAddress @var{ip_address} @item RTSPBindAddress @var{ip_address} Set address on which the HTTP/RTSP server is bound. Only useful if you have several network interfaces. +@var{BindAddress} is the equivalent of @var{HTTPBindAddress} and is +deprecated. + @item MaxHTTPConnections @var{n} Set number of simultaneous HTTP connections that can be handled. It has to be defined @emph{before} the @option{MaxClients} parameter, diff --git a/ffserver.c b/ffserver.c index 00153b4..75049c1 100644 --- a/ffserver.c +++ b/ffserver.c @@ -4079,14 +4079,18 @@ static int parse_ffconfig(const char *filename) get_arg(cmd, sizeof(cmd), p); -if (!av_strcasecmp(cmd, Port)) { +if (!av_strcasecmp(cmd, Port) || !av_strcasecmp(cmd, HTTPPort)) { +if (!av_strcasecmp(cmd, Port)) +WARNING(Port option is deprecated, use HTTPPort instead\n); get_arg(arg, sizeof(arg), p); val = atoi(arg); if (val 1 || val 65536) { -ERROR(Invalid_port: %s\n, arg); +ERROR(Invalid port: %s\n, arg); } my_http_addr.sin_port = htons(val); -} else if (!av_strcasecmp(cmd, BindAddress)) { +} else if (!av_strcasecmp(cmd, HTTPBindAddress) || !av_strcasecmp(cmd, BindAddress)) { +if (!av_strcasecmp(cmd, BindAddress)) +WARNING(BindAddress option is deprecated, use HTTPBindAddress instead\n); get_arg(arg, sizeof(arg), p); if (resolve_host(my_http_addr.sin_addr, arg) != 0) { ERROR(%s:%d: Invalid host/IP address: %s\n, arg); -- 1.8.3.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] doc/ffserver: merge paragraph starting with What happens next? with previous one
The name of the paragraph sounded a bit silly, and its text is small so it's better to merge it with the previous paragraph. --- doc/ffserver.texi | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/doc/ffserver.texi b/doc/ffserver.texi index fb90dd6..2bf8152 100644 --- a/doc/ffserver.texi +++ b/doc/ffserver.texi @@ -203,11 +203,9 @@ WARNING: trying to stream test1.mpg doesn't work with WMP as it tries to transfer the entire file before starting to play. The same is true of AVI files. -@section What happens next? - -You should edit the ffserver.conf file to suit your needs (in terms of -frame rates etc). Then install ffserver and ffmpeg, write a script to start -them up, and off you go. +You should edit the @file{ffserver.conf} file to suit your needs (in +terms of frame rates etc). Then install @command{ffserver} and +@command{ffmpeg}, write a script to start them up, and off you go. @section What else can it do? -- 1.8.3.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] doc/ffserver: merge paragraph starting with What happens next? with previous one
On Aug 2, 2014 7:40 AM, Stefano Sabatini stefa...@gmail.com wrote: The name of the paragraph sounded a bit silly, and its text is small so it's better to merge it with the previous paragraph. --- doc/ffserver.texi | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) OK. [...] Timothy ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffserver: initialize pbuffer in prepare_sdp_description()
On date Saturday 2014-08-02 14:25:21 +0200, Michael Niedermayer encoded: also check pbuffer before use Found-by: CSA Signed-off-by: Michael Niedermayer michae...@gmx.at --- ffserver.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ffserver.c b/ffserver.c index 00153b4..956d9f5 100644 --- a/ffserver.c +++ b/ffserver.c @@ -2977,6 +2977,8 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer, AVDictionaryEntry *entry = av_dict_get(stream-metadata, title, NULL, 0); int i; +*pbuffer = NULL; + avc = avformat_alloc_context(); if (avc == NULL || !rtp_format) { return -1; @@ -3013,7 +3015,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer, av_free(avc); av_free(avs); -return strlen(*pbuffer); +return *pbuffer ? strlen(*pbuffer) : AVERROR(ENOMEM); } static void rtsp_cmd_options(HTTPContext *c, const char *url) LGTM. -- FFmpeg = Faithless Fostering Magnificient Portable Egregious Geek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/4] lavfi: add filter metaframes infrastructure.
On date Wednesday 2014-07-30 23:44:46 +0200, Nicolas George encoded: Metaframes are frames without data, identified by a negative format code, used to carry special conditions. They are sent only to filter that declare supporting them. The only metaframe for now is EOF; this mechanism augments the current mechanism based on request_frame() returning AVERROR_EOF, with the advantage that the EOF metaframe carries a timestamp. The metaframes are a purely internal API and do not leak to the application. Signed-off-by: Nicolas George geo...@nsup.org --- libavfilter/avfilter.c | 73 +- libavfilter/internal.h | 34 +++ 2 files changed, 100 insertions(+), 7 deletions(-) Changed the name to metaframes. Allocate the frame with the classic method. diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 7b11467..7894173 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -346,15 +346,16 @@ int ff_request_frame(AVFilterLink *link) ret = link-srcpad-request_frame(link); else if (link-src-inputs[0]) ret = ff_request_frame(link-src-inputs[0]); -if (ret == AVERROR_EOF link-partial_buf) { -AVFrame *pbuf = link-partial_buf; -link-partial_buf = NULL; -ret = ff_filter_frame_framed(link, pbuf); -} if (ret 0) { +if (!link-frame_requested) { +av_assert0(ret == AVERROR_EOF); +ret = 0; +} link-frame_requested = 0; -if (ret == AVERROR_EOF) -link-closed = 1; +if (ret == AVERROR_EOF) { +ret = ff_filter_link_close(link, AV_NOPTS_VALUE); +return ret 0 ? ret : AVERROR_EOF; +} } else { av_assert0(!link-frame_requested || link-flags FF_LINK_FLAG_REQUEST_LOOP); @@ -1132,10 +1133,52 @@ static int ff_filter_frame_needs_framing(AVFilterLink *link, AVFrame *frame) return ret; } +static int ff_filter_metaframe(AVFilterLink *link, AVFrame *frame) +{ +AVFrame *pbuf = link-partial_buf; +int ret; + +if (pbuf) { +link-partial_buf = NULL; +if ((ret = ff_filter_frame_framed(link, pbuf)) 0) +return ret; +} + +if ((link-dst-filter-flags FF_FILTER_FLAG_SUPPORT_METAFRAMES)) { +ret = link-dstpad-filter_frame ? + link-dstpad-filter_frame(link, frame) : + default_filter_frame(link, frame); +if (ret 0) +return ret; It shall probably execute the remaining part of the function even in case of failure. +} + +switch (frame-format) { + +case FF_METAFRAME_EOF: +link-closed = 1; +break; + +case 0: +case FF_METAFRAME_NOP: +/* Not implemented yet because not used either for now. + Caveat: if the same metaframe is forwarded to the next filter + and the next filter changes the type, the type change must not be + taken into account for the first link. */ I find this a bit confusing. Can you explain why the NOP metaframe is needed? + +default: +av_assert0(!reached); +} + +return ret; +} + int ff_filter_frame(AVFilterLink *link, AVFrame *frame) { FF_TPRINTF_START(NULL, filter_frame); ff_tlog_link(NULL, link, 1); ff_tlog(NULL, ); ff_tlog_ref(NULL, frame, 1); +if (frame-format -1) +return ff_filter_metaframe(link, frame); + /* Consistency checks */ if (link-type == AVMEDIA_TYPE_VIDEO) { if (strcmp(link-dst-filter-name, scale)) { @@ -1162,6 +1205,22 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame) } } +int ff_filter_link_close(AVFilterLink *link, int64_t pts) +{ +AVFrame *frame; +int ret; + +if (link-closed) +return 0; +if (!(frame = av_frame_alloc())) +return AVERROR(ENOMEM); +frame-format = FF_METAFRAME_EOF; +frame-pts = pts; +ret = ff_filter_frame(link, frame); +av_frame_free(frame); +return ret; +} + const AVClass *avfilter_get_class(void) { return avfilter_class; diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 308b115..fbe603a 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -374,4 +374,38 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name); */ void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter); +/** + * The filter can accept metaframes. + * Metaframes are AVFrame structures with a negative format field. + * The framework will take default actions based on the metaframe type. + * The destination filter is allowed to reset the type to inhibit the + * default actions. + */ +#define
Re: [FFmpeg-devel] HEVC SIMD Optimization on PowerPC
On Sat, 2 Aug 2014 14:50:52 +0200 Michael Niedermayer michae...@gmx.at wrote: On Sat, Aug 02, 2014 at 07:18:22AM -0400, compn wrote: On Sat, 2 Aug 2014 13:37:10 +0800 Zhenan Lin linzhe...@pku.edu.cn wrote: Hi, all, Our team plans to contribute SIMD optimization on PowerPC for HEVC i thought powerpc was dead? i thought so too, but powerpc optimizations certainly are welcome, if someone wants to write some ubitux linked me to the latest powerpc https://en.wikipedia.org/wiki/POWER8 so i guess ppc isnt dead yet. -compn ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/5] avutil: add pixelutils API
--- configure | 2 + doc/APIchanges | 3 ++ libavutil/Makefile | 2 + libavutil/pixelutils.c | 85 ++ libavutil/pixelutils.h | 76 +++ libavutil/version.h | 2 +- libavutil/x86/Makefile | 4 ++ libavutil/x86/pixelutils.asm| 111 libavutil/x86/pixelutils.h | 26 ++ libavutil/x86/pixelutils_init.c | 54 +++ 10 files changed, 364 insertions(+), 1 deletion(-) create mode 100644 libavutil/pixelutils.c create mode 100644 libavutil/pixelutils.h create mode 100644 libavutil/x86/pixelutils.asm create mode 100644 libavutil/x86/pixelutils.h create mode 100644 libavutil/x86/pixelutils_init.c diff --git a/configure b/configure index 9c3af50..57edd1d 100755 --- a/configure +++ b/configure @@ -144,6 +144,7 @@ Component options: --disable-mdct disable MDCT code --disable-rdft disable RDFT code --disable-fftdisable FFT code + --disable-pixelutils disable pixel utils in libavutil Hardware accelerators: --disable-dxva2 disable DXVA2 code [autodetect] @@ -1451,6 +1452,7 @@ SUBSYSTEM_LIST= lsp lzo mdct +pixelutils network rdft diff --git a/doc/APIchanges b/doc/APIchanges index abca377..69ca682 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2012-10-22 API changes, most recent first: +2014-08-02 - xxx - lavu 52.95.100 - pixelutils.h + Add pixelutils API with SAD functions + 2014-07-30 - ba3e331 - lavu 52.94.100 - frame.h Add av_frame_side_data_name() diff --git a/libavutil/Makefile b/libavutil/Makefile index 91751dc..6114cc9 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -44,6 +44,7 @@ HEADERS = adler32.h \ opt.h \ parseutils.h \ pixdesc.h \ + pixelutils.h \ pixfmt.h \ random_seed.h \ replaygain.h \ @@ -113,6 +114,7 @@ OBJS = adler32.o \ opt.o\ parseutils.o \ pixdesc.o\ + pixelutils.o \ random_seed.o\ rational.o \ rc4.o\ diff --git a/libavutil/pixelutils.c b/libavutil/pixelutils.c new file mode 100644 index 000..146a882 --- /dev/null +++ b/libavutil/pixelutils.c @@ -0,0 +1,85 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser 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 config.h +#include common.h +#include pixelutils.h + +#if CONFIG_PIXELUTILS + +#include x86/pixelutils.h + +static av_always_inline int sad_wxh(const uint8_t *src1, ptrdiff_t stride1, +const uint8_t *src2, ptrdiff_t stride2, +int w, int h) +{ +int x, y, sum = 0; + +for (y = 0; y h; y++) { +for (x = 0; x w; x++) +sum += abs(src1[x] - src2[x]); +src1 += stride1; +src2 += stride2; +} +return sum; +} + +#define DECLARE_BLOCK_FUNCTIONS(size) \ +static int block_sad_##size##x##size##_c(const uint8_t *src1, ptrdiff_t stride1,\ + const uint8_t *src2, ptrdiff_t stride2)\ +{ \ +return sad_wxh(src1, stride1, src2, stride2, size,
[FFmpeg-devel] [PATCH 4/5] avfilter/mp_decimate: remove avcodec dependency
--- configure | 4 ++-- libavfilter/vf_mpdecimate.c | 44 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/configure b/configure index bc187a5..210cafb 100755 --- a/configure +++ b/configure @@ -2549,8 +2549,8 @@ ladspa_filter_extralibs='$ldl' mcdeint_filter_deps=avcodec gpl movie_filter_deps=avcodec avformat mp_filter_deps=gpl avcodec swscale inline_asm -mpdecimate_filter_deps=gpl avcodec -mpdecimate_filter_select=me_cmp pixblockdsp +mpdecimate_filter_deps=gpl +mpdecimate_filter_select=pixelutils mptestsrc_filter_deps=gpl negate_filter_deps=lut_filter perspective_filter_deps=gpl diff --git a/libavfilter/vf_mpdecimate.c b/libavfilter/vf_mpdecimate.c index c667a9f..76af175 100644 --- a/libavfilter/vf_mpdecimate.c +++ b/libavfilter/vf_mpdecimate.c @@ -26,9 +26,8 @@ #include libavutil/opt.h #include libavutil/pixdesc.h +#include libavutil/pixelutils.h #include libavutil/timestamp.h -#include libavcodec/dsputil.h -#include libavcodec/pixblockdsp.h #include avfilter.h #include internal.h #include formats.h @@ -49,9 +48,7 @@ typedef struct { int hsub, vsub;/// chroma subsampling values AVFrame *ref; /// reference picture -DSPContext dspctx; /// context providing optimized diff routines -PixblockDSPContext pdsp; -AVCodecContext *avctx; /// codec context required for the DSPContext +av_pixelutils_sad_fn sad; /// sum of absolute difference function } DecimateContext; #define OFFSET(x) offsetof(DecimateContext, x) @@ -72,25 +69,21 @@ AVFILTER_DEFINE_CLASS(mpdecimate); * Return 1 if the two planes are different, 0 otherwise. */ static int diff_planes(AVFilterContext *ctx, - uint8_t *cur, uint8_t *ref, int linesize, + uint8_t *cur, int cur_linesize, + uint8_t *ref, int ref_linesize, int w, int h) { DecimateContext *decimate = ctx-priv; -DSPContext *dspctx = decimate-dspctx; -PixblockDSPContext *pdsp = decimate-pdsp; int x, y; int d, c = 0; int t = (w/16)*(h/16)*decimate-frac; -int16_t block[8*8]; /* compute difference for blocks of 8x8 bytes */ for (y = 0; y h-7; y += 4) { for (x = 8; x w-7; x += 4) { -pdsp-diff_pixels(block, -cur+x+y*linesize, -ref+x+y*linesize, linesize); -d = dspctx-sum_abs_dctelem(block); +d = decimate-sad(cur + y*cur_linesize + x, cur_linesize, + ref + y*ref_linesize + x, ref_linesize); if (d decimate-hi) return 1; if (d decimate-lo) { @@ -124,7 +117,8 @@ static int decimate_frame(AVFilterContext *ctx, int vsub = plane == 1 || plane == 2 ? decimate-vsub : 0; int hsub = plane == 1 || plane == 2 ? decimate-hsub : 0; if (diff_planes(ctx, -cur-data[plane], ref-data[plane], ref-linesize[plane], +cur-data[plane], cur-linesize[plane], +ref-data[plane], ref-linesize[plane], FF_CEIL_RSHIFT(ref-width, hsub), FF_CEIL_RSHIFT(ref-height, vsub))) return 0; @@ -135,17 +129,23 @@ static int decimate_frame(AVFilterContext *ctx, static av_cold int init(AVFilterContext *ctx) { +int ret; DecimateContext *decimate = ctx-priv; +AVPixelUtils *pixels = av_pixelutils_alloc(); +if (!pixels) +return AVERROR(ENOMEM); +ret = av_pixelutils_init(pixels, decimate); +if (ret 0) { +av_free(pixels); +return ret; +} +decimate-sad = pixels-sad_u[AV_PIXEL_BLOCKSZ_8x8]; +av_free(pixels); + av_log(ctx, AV_LOG_VERBOSE, max_drop_count:%d hi:%d lo:%d frac:%f\n, decimate-max_drop_count, decimate-hi, decimate-lo, decimate-frac); -decimate-avctx = avcodec_alloc_context3(NULL); -if (!decimate-avctx) -return AVERROR(ENOMEM); -avpriv_dsputil_init(decimate-dspctx, decimate-avctx); -ff_pixblockdsp_init(decimate-pdsp, decimate-avctx); - return 0; } @@ -153,10 +153,6 @@ static av_cold void uninit(AVFilterContext *ctx) { DecimateContext *decimate = ctx-priv; av_frame_free(decimate-ref); -if (decimate-avctx) { -avcodec_close(decimate-avctx); -av_freep(decimate-avctx); -} } static int query_formats(AVFilterContext *ctx) -- 2.0.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/5] avfilter/deshake: remove avcodec dependency
--- configure| 4 +--- libavfilter/deshake.h| 5 ++--- libavfilter/vf_deshake.c | 27 +++ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/configure b/configure index 5159f10..bc187a5 100755 --- a/configure +++ b/configure @@ -2531,8 +2531,7 @@ cropdetect_filter_deps=gpl dctdnoiz_filter_deps=avcodec dctdnoiz_filter_select=dct delogo_filter_deps=gpl -deshake_filter_deps=avcodec -deshake_filter_select=me_cmp +deshake_filter_select=pixelutils drawtext_filter_deps=libfreetype ebur128_filter_deps=gpl flite_filter_deps=libflite @@ -5241,7 +5240,6 @@ enabled amovie_filterprepend avfilter_deps avformat avcodec enabled aresample_filter prepend avfilter_deps swresample enabled asyncts_filter prepend avfilter_deps avresample enabled atempo_filterprepend avfilter_deps avcodec -enabled deshake_filter prepend avfilter_deps avcodec enabled ebur128_filter enabled swresample prepend avfilter_deps swresample enabled elbg_filter prepend avfilter_deps avcodec enabled mcdeint_filter prepend avfilter_deps avcodec diff --git a/libavfilter/deshake.h b/libavfilter/deshake.h index 615953c..f61ed80 100644 --- a/libavfilter/deshake.h +++ b/libavfilter/deshake.h @@ -24,8 +24,8 @@ #include config.h #include avfilter.h -#include libavcodec/dsputil.h #include transform.h +#include libavutil/pixelutils.h #if CONFIG_OPENCL #include libavutil/opencl.h #endif @@ -80,8 +80,7 @@ typedef struct { int blocksize; /// Size of blocks to compare int contrast; /// Contrast threshold int search;/// Motion search method -AVCodecContext *avctx; -DSPContext c; /// Context providing optimized SAD methods +av_pixelutils_sad_fn sad; /// Sum of the absolute difference function Transform last;/// Transform from last frame int refcount; /// Number of reference frames (defines averaging window) FILE *fp; diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c index 50aa451..cd32ecf 100644 --- a/libavfilter/vf_deshake.c +++ b/libavfilter/vf_deshake.c @@ -57,7 +57,6 @@ #include libavutil/mem.h #include libavutil/opt.h #include libavutil/pixdesc.h -#include libavcodec/dsputil.h #include deshake.h #include deshake_opencl.h @@ -132,9 +131,8 @@ static void find_block_motion(DeshakeContext *deshake, uint8_t *src1, int smallest = INT_MAX; int tmp, tmp2; -#define CMP(i, j) deshake-c.sad[0](NULL, src1 + cy * stride + cx, \ -src2 + (j) * stride + (i), stride, \ -deshake-blocksize) +#define CMP(i, j) deshake-sad(src1 + cy * stride + cx, stride,\ + src2 + (j) * stride + (i), stride) if (deshake-search == EXHAUSTIVE) { // Compare every possible position - this is slw! @@ -201,7 +199,7 @@ static int block_contrast(uint8_t *src, int x, int y, int stride, int blocksize) int i, j, pos; for (i = 0; i = blocksize * 2; i++) { -// We use a width of 16 here to match the libavcodec sad functions +// We use a width of 16 here to match the sad function for (j = 0; j = 15; j++) { pos = (y - i) * stride + (x - j); if (src[pos] lowest) @@ -263,7 +261,7 @@ static void find_motion(DeshakeContext *deshake, uint8_t *src1, uint8_t *src2, pos = 0; // Find motion for every block and store the motion vector in the counts for (y = deshake-ry; y height - deshake-ry - (deshake-blocksize * 2); y += deshake-blocksize * 2) { -// We use a width of 16 here to match the libavcodec sad functions +// We use a width of 16 here to match the sad function for (x = deshake-rx; x width - deshake-rx - 16; x += 16) { // If the contrast is too low, just skip this block as it probably // won't be very useful to us. @@ -351,6 +349,17 @@ static av_cold int init(AVFilterContext *ctx) int ret; DeshakeContext *deshake = ctx-priv; +AVPixelUtils *pixels = av_pixelutils_alloc(); +if (!pixels) +return AVERROR(ENOMEM); +ret = av_pixelutils_init(pixels, deshake); +if (ret 0) { +av_free(pixels); +return ret; +} +deshake-sad = pixels-sad_u[AV_PIXEL_BLOCKSZ_16x16]; // XXX: configurable? +av_free(pixels); + deshake-refcount = 20; // XXX: add to options? deshake-blocksize /= 2; deshake-blocksize = av_clip(deshake-blocksize, 4, 128); @@ -413,9 +422,6 @@ static int config_props(AVFilterLink *link) deshake-last.angle = 0; deshake-last.zoom = 0; -deshake-avctx = avcodec_alloc_context3(NULL); -avpriv_dsputil_init(deshake-c, deshake-avctx); - return 0; } @@ -428,9 +434,6 @@ static av_cold void uninit(AVFilterContext *ctx) av_frame_free(deshake-ref); if (deshake-fp)
Re: [FFmpeg-devel] [PATCH 1/5] avutil: add pixelutils API
+static av_always_inline int sad_wxh(const uint8_t *src1, ptrdiff_t stride1, +const uint8_t *src2, ptrdiff_t stride2, +int w, int h) +{ +int x, y, sum = 0; + +for (y = 0; y h; y++) { +for (x = 0; x w; x++) +sum += abs(src1[x] - src2[x]); minor: I came out of nowhere to this patch, but maybe FFABS? :) +src1 += stride1; +src2 += stride2; +} +return sum; +} ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/5] build: remove wrong avcodec dep in decimate
On Sat, Aug 2, 2014 at 8:20 PM, Clément Bœsch u...@pkh.me wrote: This was probably a mistake with mpdecimate. The decimate filter doesn't depend on avcodec. --- configure | 1 - 1 file changed, 1 deletion(-) lgtm ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/5] avutil: add pixelutils API
On Sat, Aug 02, 2014 at 08:20:17PM +0200, Clément Bœsch wrote: --- configure | 2 + doc/APIchanges | 3 ++ libavutil/Makefile | 2 + libavutil/pixelutils.c | 85 ++ libavutil/pixelutils.h | 76 +++ libavutil/version.h | 2 +- libavutil/x86/Makefile | 4 ++ libavutil/x86/pixelutils.asm| 111 libavutil/x86/pixelutils.h | 26 ++ libavutil/x86/pixelutils_init.c | 54 +++ 10 files changed, 364 insertions(+), 1 deletion(-) create mode 100644 libavutil/pixelutils.c create mode 100644 libavutil/pixelutils.h create mode 100644 libavutil/x86/pixelutils.asm create mode 100644 libavutil/x86/pixelutils.h create mode 100644 libavutil/x86/pixelutils_init.c [...] diff --git a/libavutil/pixelutils.h b/libavutil/pixelutils.h new file mode 100644 index 000..862d607 --- /dev/null +++ b/libavutil/pixelutils.h @@ -0,0 +1,76 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser 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 AVUTIL_PIXELUTILS_H +#define AVUTIL_PIXELUTILS_H + +#include stddef.h +#include stdint.h +#include common.h + +enum AVPixelUtilsBlockSize { +// Warning: only add entries at the end for ABI compatibility. +// Ideally, keep only squared dimensions in that enum. +AV_PIXEL_BLOCKSZ_2x2, +AV_PIXEL_BLOCKSZ_4x4, +AV_PIXEL_BLOCKSZ_8x8, +AV_PIXEL_BLOCKSZ_16x16, +AV_PIXEL_BLOCKSZ_NB +}; + +/** + * Sum of abs(src1[x] - src2[x]) + */ +typedef int (*av_pixelutils_sad_fn)(const uint8_t *src1, ptrdiff_t stride1, +const uint8_t *src2, ptrdiff_t stride2); + +typedef struct AVPixelUtils { +/** + * Sum of absolute differences block functions. + * src1 and src2 addresses need to be aligned to the block size. + */ +av_pixelutils_sad_fn sad[AV_PIXEL_BLOCKSZ_NB]; + +/** + * Sum of absolute differences block functions, (half) unaligned version. + * src1 address needs to be aligned to the block size. + * src2 has no alignment requirement; the 'u' refers to this second source. + */ +av_pixelutils_sad_fn sad_u[AV_PIXEL_BLOCKSZ_NB]; the ABI depends on AV_PIXEL_BLOCKSZ_NB with this design as the arrays in the struct depend on its value so no enum values could be added [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Complexity theory is the science of finding the exact solution to an approximation. Benchmarking OTOH is finding an approximation of the exact signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/5] avutil: add pixelutils API
On Sat, Aug 02, 2014 at 08:30:39PM +0200, Lukasz Marek wrote: +static av_always_inline int sad_wxh(const uint8_t *src1, ptrdiff_t stride1, +const uint8_t *src2, ptrdiff_t stride2, +int w, int h) +{ +int x, y, sum = 0; + +for (y = 0; y h; y++) { +for (x = 0; x w; x++) +sum += abs(src1[x] - src2[x]); minor: I came out of nowhere to this patch, but maybe FFABS? :) No difference in generated ASM here -- Clément B. pgpFDI_gArcbX.pgp Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/avdct: Add get_pixels()
TODO: version bump, update libavfilters to use it Suggested-by: ubitux Signed-off-by: Michael Niedermayer michae...@gmx.at --- libavcodec/avdct.c |9 + libavcodec/avdct.h |4 2 files changed, 13 insertions(+) diff --git a/libavcodec/avdct.c b/libavcodec/avdct.c index 58f4974..2521256 100644 --- a/libavcodec/avdct.c +++ b/libavcodec/avdct.c @@ -21,6 +21,7 @@ #include avcodec.h #include idctdsp.h #include fdctdsp.h +#include pixblockdsp.h #include avdct.h #define OFFSET(x) offsetof(AVDCT,x) @@ -117,6 +118,14 @@ int avcodec_dct_init(AVDCT *dsp) } #endif +#if CONFIG_PIXBLOCKDSP +{ +PixblockDSPContext pdsp; +ff_pixblockdsp_init(pdsp, avctx); +COPY(pdsp, get_pixels); +} +#endif + avcodec_close(avctx); av_free(avctx); diff --git a/libavcodec/avdct.h b/libavcodec/avdct.h index 4c9d00f..4190203 100644 --- a/libavcodec/avdct.h +++ b/libavcodec/avdct.h @@ -61,6 +61,10 @@ typedef struct AVDCT { * must use AVOptions to set this field. */ int idct_algo; + +void (*get_pixels)(int16_t *block /* align 16 */, + const uint8_t *pixels /* align 8 */, + int line_size); } AVDCT; /** -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/5] avutil: add pixelutils API
On 02/08/14 3:20 PM, Clément Bœsch wrote: +psrlq m0, m6, 32 +paddw m6, m0 +psrlq m0, m6, 16 +paddw m6, m0 +movdeax, m6 +movzx eax, ax You could use the HADDW macro here. +;--- +; int ff_pixelutils_sad_8x8_mmxext(const uint8_t *src1, ptrdiff_t stride1, +; const uint8_t *src2, ptrdiff_t stride2); +;--- +INIT_MMX mmxext +cglobal pixelutils_sad_8x8, 4,4,0, src1, stride1, src2, stride2 +pxorm2, m2 +%rep 4 +movam0, [src1q] +movam1, [src1q + stride1q] +psadbw m0, [src2q] +psadbw m1, [src2q + stride2q] +paddw m2, m0 +paddw m2, m1 +lea src1q, [src1q + 2*stride1q] +lea src2q, [src2q + 2*stride2q] +%endrep +movdeax, m2 +RET Adding sad16x16 mmxext should be a matter of using add instead of lea, changing the %rep amount, and using 8 instead of stride[12]q for the mova and psadbw. --- /dev/null +++ b/libavutil/x86/pixelutils.h @@ -0,0 +1,26 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser 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 AVUTIL_X86_PIXELUTILS_H +#define AVUTIL_X86_PIXELUTILS_H + +#include libavutil/pixelutils.h + +void ff_pixelutils_init_x86(AVPixelUtils *s); This prototype should be in libavutil/pixelutils.h No need to make a whole new header just for it. Maybe you could add a quick test for these functions? Look at lavc/motion-test.c and lavu/float-dsp.c ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] avcodec/takdec: remove unused variable
Found-by: CSA Signed-off-by: Michael Niedermayer michae...@gmx.at --- libavcodec/takdec.c |1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c index 83abab6..5810a01 100644 --- a/libavcodec/takdec.c +++ b/libavcodec/takdec.c @@ -448,7 +448,6 @@ static int decode_subframe(TAKDecContext *s, int32_t *decoded, x = 1 (32 - (15 - filter_quant)); y = 1 ((15 - filter_quant) - 1); for (i = 0, j = filter_order - 1; i filter_order / 2; i++, j--) { -int tmp = y + tfilter[j]; s-filter[j] = x - ((tfilter[i] + y) (15 - filter_quant)); s-filter[i] = x - ((tfilter[j] + y) (15 - filter_quant)); } -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avformat/tee: flip assigment direction
Found-by: CSA Signed-off-by: Michael Niedermayer michae...@gmx.at --- libavformat/tee.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/tee.c b/libavformat/tee.c index f26e157..681f943 100644 --- a/libavformat/tee.c +++ b/libavformat/tee.c @@ -467,7 +467,7 @@ static int tee_write_packet(AVFormatContext *avf, AVPacket *pkt) if ((ret = av_copy_packet(pkt2, pkt)) 0 || (ret = av_dup_packet(pkt2)) 0) if (!ret_all) { -ret = ret_all; +ret_all = ret; continue; } tb = avf -streams[s ]-time_base; -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/5] avutil: add pixelutils API
On Sat, Aug 02, 2014 at 04:29:39PM -0300, James Almer wrote: On 02/08/14 3:20 PM, Clément Bœsch wrote: +psrlq m0, m6, 32 +paddw m6, m0 +psrlq m0, m6, 16 +paddw m6, m0 +movdeax, m6 +movzx eax, ax You could use the HADDW macro here. error: undefined symbol `pw_1' (first use) sounds somehow constraining. I'll keep my version until you benchmark to prove me HADDW is faster on an old MMX cpu ;) +;--- +; int ff_pixelutils_sad_8x8_mmxext(const uint8_t *src1, ptrdiff_t stride1, +; const uint8_t *src2, ptrdiff_t stride2); +;--- +INIT_MMX mmxext +cglobal pixelutils_sad_8x8, 4,4,0, src1, stride1, src2, stride2 +pxorm2, m2 +%rep 4 +movam0, [src1q] +movam1, [src1q + stride1q] +psadbw m0, [src2q] +psadbw m1, [src2q + stride2q] +paddw m2, m0 +paddw m2, m1 +lea src1q, [src1q + 2*stride1q] +lea src2q, [src2q + 2*stride2q] +%endrep +movdeax, m2 +RET Adding sad16x16 mmxext should be a matter of using add instead of lea, changing the %rep amount, and using 8 instead of stride[12]q for the mova and psadbw. Yeah right, added. Thanks. --- /dev/null +++ b/libavutil/x86/pixelutils.h @@ -0,0 +1,26 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser 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 AVUTIL_X86_PIXELUTILS_H +#define AVUTIL_X86_PIXELUTILS_H + +#include libavutil/pixelutils.h + +void ff_pixelutils_init_x86(AVPixelUtils *s); This prototype should be in libavutil/pixelutils.h No need to make a whole new header just for it. No, libavutil/pixelutils.h is public, I don't want to have private prototypes in it. Maybe you could add a quick test for these functions? Look at lavc/motion-test.c and lavu/float-dsp.c Added. I'll resubmit a patchset in a moment. -- Clément B. pgp450g7nvNHd.pgp Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/5] avutil: add pixelutils API
On 02/08/14 6:13 PM, Clément Bœsch wrote: On Sat, Aug 02, 2014 at 04:29:39PM -0300, James Almer wrote: On 02/08/14 3:20 PM, Clément Bœsch wrote: +psrlq m0, m6, 32 +paddw m6, m0 +psrlq m0, m6, 16 +paddw m6, m0 +movdeax, m6 +movzx eax, ax You could use the HADDW macro here. error: undefined symbol `pw_1' (first use) sounds somehow constraining. I'll keep my version until you benchmark to prove me HADDW is faster on an old MMX cpu ;) I have no idea if it's faster, nor a way to test that for that matter. It's four instructions instead of six, but pmaddwd + memory operand is probably not fast enough on old cpus. +;--- +; int ff_pixelutils_sad_8x8_mmxext(const uint8_t *src1, ptrdiff_t stride1, +; const uint8_t *src2, ptrdiff_t stride2); +;--- +INIT_MMX mmxext +cglobal pixelutils_sad_8x8, 4,4,0, src1, stride1, src2, stride2 +pxorm2, m2 +%rep 4 +movam0, [src1q] +movam1, [src1q + stride1q] +psadbw m0, [src2q] +psadbw m1, [src2q + stride2q] +paddw m2, m0 +paddw m2, m1 +lea src1q, [src1q + 2*stride1q] +lea src2q, [src2q + 2*stride2q] +%endrep +movdeax, m2 +RET Adding sad16x16 mmxext should be a matter of using add instead of lea, changing the %rep amount, and using 8 instead of stride[12]q for the mova and psadbw. Yeah right, added. Thanks. --- /dev/null +++ b/libavutil/x86/pixelutils.h @@ -0,0 +1,26 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser 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 AVUTIL_X86_PIXELUTILS_H +#define AVUTIL_X86_PIXELUTILS_H + +#include libavutil/pixelutils.h + +void ff_pixelutils_init_x86(AVPixelUtils *s); This prototype should be in libavutil/pixelutils.h No need to make a whole new header just for it. No, libavutil/pixelutils.h is public, I don't want to have private prototypes in it. Right, forgot it was public. I had lavc dsp stuff in mind when i said that. Maybe you could add a quick test for these functions? Look at lavc/motion-test.c and lavu/float-dsp.c Added. I'll resubmit a patchset in a moment. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/tee: flip assigment direction
Le quintidi 15 thermidor, an CCXXII, Michael Niedermayer a écrit : Found-by: CSA Signed-off-by: Michael Niedermayer michae...@gmx.at --- libavformat/tee.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) That looks clearly right. Thanks. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/5] build: remove wrong avcodec dep in decimate
This was probably a mistake with mpdecimate. The decimate filter doesn't depend on avcodec. --- configure | 1 - 1 file changed, 1 deletion(-) diff --git a/configure b/configure index 57edd1d..5159f10 100755 --- a/configure +++ b/configure @@ -5241,7 +5241,6 @@ enabled amovie_filterprepend avfilter_deps avformat avcodec enabled aresample_filter prepend avfilter_deps swresample enabled asyncts_filter prepend avfilter_deps avresample enabled atempo_filterprepend avfilter_deps avcodec -enabled decimate_filter prepend avfilter_deps avcodec enabled deshake_filter prepend avfilter_deps avcodec enabled ebur128_filter enabled swresample prepend avfilter_deps swresample enabled elbg_filter prepend avfilter_deps avcodec -- 2.0.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/5] avfilter/deshake: remove avcodec dependency
--- configure| 4 +--- libavfilter/deshake.h| 5 ++--- libavfilter/vf_deshake.c | 20 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/configure b/configure index 5159f10..bc187a5 100755 --- a/configure +++ b/configure @@ -2531,8 +2531,7 @@ cropdetect_filter_deps=gpl dctdnoiz_filter_deps=avcodec dctdnoiz_filter_select=dct delogo_filter_deps=gpl -deshake_filter_deps=avcodec -deshake_filter_select=me_cmp +deshake_filter_select=pixelutils drawtext_filter_deps=libfreetype ebur128_filter_deps=gpl flite_filter_deps=libflite @@ -5241,7 +5240,6 @@ enabled amovie_filterprepend avfilter_deps avformat avcodec enabled aresample_filter prepend avfilter_deps swresample enabled asyncts_filter prepend avfilter_deps avresample enabled atempo_filterprepend avfilter_deps avcodec -enabled deshake_filter prepend avfilter_deps avcodec enabled ebur128_filter enabled swresample prepend avfilter_deps swresample enabled elbg_filter prepend avfilter_deps avcodec enabled mcdeint_filter prepend avfilter_deps avcodec diff --git a/libavfilter/deshake.h b/libavfilter/deshake.h index 615953c..f61ed80 100644 --- a/libavfilter/deshake.h +++ b/libavfilter/deshake.h @@ -24,8 +24,8 @@ #include config.h #include avfilter.h -#include libavcodec/dsputil.h #include transform.h +#include libavutil/pixelutils.h #if CONFIG_OPENCL #include libavutil/opencl.h #endif @@ -80,8 +80,7 @@ typedef struct { int blocksize; /// Size of blocks to compare int contrast; /// Contrast threshold int search;/// Motion search method -AVCodecContext *avctx; -DSPContext c; /// Context providing optimized SAD methods +av_pixelutils_sad_fn sad; /// Sum of the absolute difference function Transform last;/// Transform from last frame int refcount; /// Number of reference frames (defines averaging window) FILE *fp; diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c index 50aa451..95a6c51 100644 --- a/libavfilter/vf_deshake.c +++ b/libavfilter/vf_deshake.c @@ -57,7 +57,6 @@ #include libavutil/mem.h #include libavutil/opt.h #include libavutil/pixdesc.h -#include libavcodec/dsputil.h #include deshake.h #include deshake_opencl.h @@ -132,9 +131,8 @@ static void find_block_motion(DeshakeContext *deshake, uint8_t *src1, int smallest = INT_MAX; int tmp, tmp2; -#define CMP(i, j) deshake-c.sad[0](NULL, src1 + cy * stride + cx, \ -src2 + (j) * stride + (i), stride, \ -deshake-blocksize) +#define CMP(i, j) deshake-sad(src1 + cy * stride + cx, stride,\ + src2 + (j) * stride + (i), stride) if (deshake-search == EXHAUSTIVE) { // Compare every possible position - this is slw! @@ -201,7 +199,7 @@ static int block_contrast(uint8_t *src, int x, int y, int stride, int blocksize) int i, j, pos; for (i = 0; i = blocksize * 2; i++) { -// We use a width of 16 here to match the libavcodec sad functions +// We use a width of 16 here to match the sad function for (j = 0; j = 15; j++) { pos = (y - i) * stride + (x - j); if (src[pos] lowest) @@ -263,7 +261,7 @@ static void find_motion(DeshakeContext *deshake, uint8_t *src1, uint8_t *src2, pos = 0; // Find motion for every block and store the motion vector in the counts for (y = deshake-ry; y height - deshake-ry - (deshake-blocksize * 2); y += deshake-blocksize * 2) { -// We use a width of 16 here to match the libavcodec sad functions +// We use a width of 16 here to match the sad function for (x = deshake-rx; x width - deshake-rx - 16; x += 16) { // If the contrast is too low, just skip this block as it probably // won't be very useful to us. @@ -351,6 +349,10 @@ static av_cold int init(AVFilterContext *ctx) int ret; DeshakeContext *deshake = ctx-priv; +deshake-sad = av_pixelutils_get_sad_fn(4, 4, 1, deshake); // 16x16, 2nd source unaligned +if (!deshake-sad) +return AVERROR(EINVAL); + deshake-refcount = 20; // XXX: add to options? deshake-blocksize /= 2; deshake-blocksize = av_clip(deshake-blocksize, 4, 128); @@ -413,9 +415,6 @@ static int config_props(AVFilterLink *link) deshake-last.angle = 0; deshake-last.zoom = 0; -deshake-avctx = avcodec_alloc_context3(NULL); -avpriv_dsputil_init(deshake-c, deshake-avctx); - return 0; } @@ -428,9 +427,6 @@ static av_cold void uninit(AVFilterContext *ctx) av_frame_free(deshake-ref); if (deshake-fp) fclose(deshake-fp); -if (deshake-avctx) -avcodec_close(deshake-avctx); -av_freep(deshake-avctx); } static int filter_frame(AVFilterLink *link, AVFrame
[FFmpeg-devel] pixelutils API [v2]
Second attempt. Since previously: - much simpler usage (you basically just call av_pixelutils_get_sad_fn() as a user); filters patches updated accordingly. - 16x16 mmxext added (thanks jamrial) - FATE tests Note for the context since I didn't write anything about it in the previous patchset: this is in continuation to avcodec/AVDCT in order to drop dsputils which has been removed from Libav (but kept in FFmpeg for compatibility). After this patchset, libavfilter should be free of dsputils leftovers. BTW, the scope of the pixelutils is to have a bunch of optimized pixel utilities for filters. Currently, we only have SAD utils, more functions are welcome as long as it sticks to this very generic pixels scope: for example, DCT stuff belongs to avcodec/AVDCT (at least for now), and an optimized pixel function that won't be useful for multiple filters belongs in the local context of that filter. A good candidate could be SAD for full-frames, or maybe pixel lines functions for interlaced stuff. pixelutils are optional. It will be enabled in libavutil only on demand (typically if a filter uses it). The default full build will contain it, but if you --disable-filters, libavutil will no longer integrate it. Ah, and before I forget; we are kind of in a hurry since this is meant to avoid some ABI issues in the next release. So if you want to review it, please do it quickly. Thanks, ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 5/5] avfilter/select: remove optional avcodec dependency
--- configure | 1 + libavfilter/f_select.c | 50 -- 2 files changed, 13 insertions(+), 38 deletions(-) diff --git a/configure b/configure index 210cafb..b9b1e3b 100755 --- a/configure +++ b/configure @@ -2564,6 +2564,7 @@ removelogo_filter_deps=avcodec avformat swscale resample_filter_deps=avresample sab_filter_deps=gpl swscale scale_filter_deps=swscale +select_filter_select=pixelutils smartblur_filter_deps=gpl swscale showspectrum_filter_deps=avcodec showspectrum_filter_select=rdft diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c index 8d2c860..d951b0f 100644 --- a/libavfilter/f_select.c +++ b/libavfilter/f_select.c @@ -28,16 +28,13 @@ #include libavutil/fifo.h #include libavutil/internal.h #include libavutil/opt.h +#include libavutil/pixelutils.h #include avfilter.h #include audio.h #include formats.h #include internal.h #include video.h -#if CONFIG_AVCODEC -#include libavcodec/dsputil.h -#endif - static const char *const var_names[] = { TB,/// timebase @@ -144,11 +141,8 @@ typedef struct SelectContext { AVExpr *expr; double var_values[VAR_VARS_NB]; int do_scene_detect;/// 1 if the expression requires scene detection variables, 0 otherwise -#if CONFIG_AVCODEC -AVCodecContext *avctx; /// codec context required for the DSPContext (scene detect only) -DSPContext c; /// context providing optimized SAD methods (scene detect only) +av_pixelutils_sad_fn sad; /// Sum of the absolute difference function (scene detect only) double prev_mafd; /// previous MAFD (scene detect only) -#endif AVFrame *prev_picref; /// previous frame (scene detect only) double select; int select_out; /// mark the selected output pad index @@ -240,18 +234,14 @@ static int config_input(AVFilterLink *inlink) select-var_values[VAR_SAMPLE_RATE] = inlink-type == AVMEDIA_TYPE_AUDIO ? inlink-sample_rate : NAN; -#if CONFIG_AVCODEC if (select-do_scene_detect) { -select-avctx = avcodec_alloc_context3(NULL); -if (!select-avctx) -return AVERROR(ENOMEM); -avpriv_dsputil_init(select-c, select-avctx); +select-sad = av_pixelutils_get_sad_fn(3, 3, 2, select); // 8x8 both sources aligned +if (!select-sad) +return AVERROR(EINVAL); } -#endif return 0; } -#if CONFIG_AVCODEC static double get_scene_score(AVFilterContext *ctx, AVFrame *frame) { double ret = 0; @@ -259,24 +249,23 @@ static double get_scene_score(AVFilterContext *ctx, AVFrame *frame) AVFrame *prev_picref = select-prev_picref; if (prev_picref -frame-height== prev_picref-height -frame-width== prev_picref-width -frame-linesize[0] == prev_picref-linesize[0]) { +frame-height == prev_picref-height +frame-width == prev_picref-width) { int x, y, nb_sad = 0; int64_t sad = 0; double mafd, diff; uint8_t *p1 = frame-data[0]; uint8_t *p2 = prev_picref-data[0]; -const int linesize = frame-linesize[0]; +const int p1_linesize = frame-linesize[0]; +const int p2_linesize = prev_picref-linesize[0]; for (y = 0; y frame-height - 8; y += 8) { for (x = 0; x frame-width*3 - 8; x += 8) { -sad += select-c.sad[1](NULL, p1 + x, p2 + x, -linesize, 8); +sad += select-sad(p1 + x, p1_linesize, p2 + x, p2_linesize); nb_sad += 8 * 8; } -p1 += 8 * linesize; -p2 += 8 * linesize; +p1 += 8 * p1_linesize; +p2 += 8 * p2_linesize; } emms_c(); mafd = nb_sad ? (double)sad / nb_sad : 0; @@ -288,7 +277,6 @@ static double get_scene_score(AVFilterContext *ctx, AVFrame *frame) select-prev_picref = av_frame_clone(frame); return ret; } -#endif #define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d)) #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)) @@ -320,7 +308,6 @@ static void select_frame(AVFilterContext *ctx, AVFrame *frame) !frame-interlaced_frame ? INTERLACE_TYPE_P : frame-top_field_first ? INTERLACE_TYPE_T : INTERLACE_TYPE_B; select-var_values[VAR_PICT_TYPE] = frame-pict_type; -#if CONFIG_AVCODEC if (select-do_scene_detect) { char buf[32]; select-var_values[VAR_SCENE] = get_scene_score(ctx, frame); @@ -328,7 +315,6 @@ static void select_frame(AVFilterContext *ctx, AVFrame *frame) snprintf(buf, sizeof(buf), %f, select-var_values[VAR_SCENE]); av_dict_set(avpriv_frame_get_metadatap(frame), lavfi.scene_score, buf, 0); } -#endif break; } @@ -418,15
[FFmpeg-devel] [PATCH 1/5] avutil: add pixelutils API
--- configure | 2 + doc/APIchanges | 3 + libavutil/Makefile | 3 + libavutil/pixelutils.c | 142 libavutil/pixelutils.h | 52 ++ libavutil/version.h | 2 +- libavutil/x86/Makefile | 4 ++ libavutil/x86/pixelutils.asm| 155 libavutil/x86/pixelutils.h | 26 +++ libavutil/x86/pixelutils_init.c | 58 +++ tests/fate/libavutil.mak| 5 ++ tests/ref/fate/pixelutils | 15 12 files changed, 466 insertions(+), 1 deletion(-) create mode 100644 libavutil/pixelutils.c create mode 100644 libavutil/pixelutils.h create mode 100644 libavutil/x86/pixelutils.asm create mode 100644 libavutil/x86/pixelutils.h create mode 100644 libavutil/x86/pixelutils_init.c create mode 100644 tests/ref/fate/pixelutils diff --git a/configure b/configure index 9c3af50..57edd1d 100755 --- a/configure +++ b/configure @@ -144,6 +144,7 @@ Component options: --disable-mdct disable MDCT code --disable-rdft disable RDFT code --disable-fftdisable FFT code + --disable-pixelutils disable pixel utils in libavutil Hardware accelerators: --disable-dxva2 disable DXVA2 code [autodetect] @@ -1451,6 +1452,7 @@ SUBSYSTEM_LIST= lsp lzo mdct +pixelutils network rdft diff --git a/doc/APIchanges b/doc/APIchanges index abca377..69ca682 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2012-10-22 API changes, most recent first: +2014-08-02 - xxx - lavu 52.95.100 - pixelutils.h + Add pixelutils API with SAD functions + 2014-07-30 - ba3e331 - lavu 52.94.100 - frame.h Add av_frame_side_data_name() diff --git a/libavutil/Makefile b/libavutil/Makefile index 91751dc..d57a741 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -44,6 +44,7 @@ HEADERS = adler32.h \ opt.h \ parseutils.h \ pixdesc.h \ + pixelutils.h \ pixfmt.h \ random_seed.h \ replaygain.h \ @@ -113,6 +114,7 @@ OBJS = adler32.o \ opt.o\ parseutils.o \ pixdesc.o\ + pixelutils.o \ random_seed.o\ rational.o \ rc4.o\ @@ -170,6 +172,7 @@ TESTPROGS = adler32 \ pca \ parseutils \ pixdesc \ +pixelutils \ random_seed \ rational\ ripemd \ diff --git a/libavutil/pixelutils.c b/libavutil/pixelutils.c new file mode 100644 index 000..278aa80 --- /dev/null +++ b/libavutil/pixelutils.c @@ -0,0 +1,142 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser 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 config.h +#include common.h +#include pixelutils.h + +#if CONFIG_PIXELUTILS + +#include x86/pixelutils.h + +static av_always_inline int sad_wxh(const uint8_t *src1, ptrdiff_t stride1, +
[FFmpeg-devel] [PATCH 4/5] avfilter/mp_decimate: remove avcodec dependency
--- configure | 4 ++-- libavfilter/vf_mpdecimate.c | 36 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/configure b/configure index bc187a5..210cafb 100755 --- a/configure +++ b/configure @@ -2549,8 +2549,8 @@ ladspa_filter_extralibs='$ldl' mcdeint_filter_deps=avcodec gpl movie_filter_deps=avcodec avformat mp_filter_deps=gpl avcodec swscale inline_asm -mpdecimate_filter_deps=gpl avcodec -mpdecimate_filter_select=me_cmp pixblockdsp +mpdecimate_filter_deps=gpl +mpdecimate_filter_select=pixelutils mptestsrc_filter_deps=gpl negate_filter_deps=lut_filter perspective_filter_deps=gpl diff --git a/libavfilter/vf_mpdecimate.c b/libavfilter/vf_mpdecimate.c index c667a9f..3ed9602 100644 --- a/libavfilter/vf_mpdecimate.c +++ b/libavfilter/vf_mpdecimate.c @@ -26,9 +26,8 @@ #include libavutil/opt.h #include libavutil/pixdesc.h +#include libavutil/pixelutils.h #include libavutil/timestamp.h -#include libavcodec/dsputil.h -#include libavcodec/pixblockdsp.h #include avfilter.h #include internal.h #include formats.h @@ -49,9 +48,7 @@ typedef struct { int hsub, vsub;/// chroma subsampling values AVFrame *ref; /// reference picture -DSPContext dspctx; /// context providing optimized diff routines -PixblockDSPContext pdsp; -AVCodecContext *avctx; /// codec context required for the DSPContext +av_pixelutils_sad_fn sad; /// sum of absolute difference function } DecimateContext; #define OFFSET(x) offsetof(DecimateContext, x) @@ -72,25 +69,21 @@ AVFILTER_DEFINE_CLASS(mpdecimate); * Return 1 if the two planes are different, 0 otherwise. */ static int diff_planes(AVFilterContext *ctx, - uint8_t *cur, uint8_t *ref, int linesize, + uint8_t *cur, int cur_linesize, + uint8_t *ref, int ref_linesize, int w, int h) { DecimateContext *decimate = ctx-priv; -DSPContext *dspctx = decimate-dspctx; -PixblockDSPContext *pdsp = decimate-pdsp; int x, y; int d, c = 0; int t = (w/16)*(h/16)*decimate-frac; -int16_t block[8*8]; /* compute difference for blocks of 8x8 bytes */ for (y = 0; y h-7; y += 4) { for (x = 8; x w-7; x += 4) { -pdsp-diff_pixels(block, -cur+x+y*linesize, -ref+x+y*linesize, linesize); -d = dspctx-sum_abs_dctelem(block); +d = decimate-sad(cur + y*cur_linesize + x, cur_linesize, + ref + y*ref_linesize + x, ref_linesize); if (d decimate-hi) return 1; if (d decimate-lo) { @@ -124,7 +117,8 @@ static int decimate_frame(AVFilterContext *ctx, int vsub = plane == 1 || plane == 2 ? decimate-vsub : 0; int hsub = plane == 1 || plane == 2 ? decimate-hsub : 0; if (diff_planes(ctx, -cur-data[plane], ref-data[plane], ref-linesize[plane], +cur-data[plane], cur-linesize[plane], +ref-data[plane], ref-linesize[plane], FF_CEIL_RSHIFT(ref-width, hsub), FF_CEIL_RSHIFT(ref-height, vsub))) return 0; @@ -137,15 +131,13 @@ static av_cold int init(AVFilterContext *ctx) { DecimateContext *decimate = ctx-priv; +decimate-sad = av_pixelutils_get_sad_fn(3, 3, 0, decimate); // 8x8, not aligned on blocksize +if (!decimate-sad) +return AVERROR(EINVAL); + av_log(ctx, AV_LOG_VERBOSE, max_drop_count:%d hi:%d lo:%d frac:%f\n, decimate-max_drop_count, decimate-hi, decimate-lo, decimate-frac); -decimate-avctx = avcodec_alloc_context3(NULL); -if (!decimate-avctx) -return AVERROR(ENOMEM); -avpriv_dsputil_init(decimate-dspctx, decimate-avctx); -ff_pixblockdsp_init(decimate-pdsp, decimate-avctx); - return 0; } @@ -153,10 +145,6 @@ static av_cold void uninit(AVFilterContext *ctx) { DecimateContext *decimate = ctx-priv; av_frame_free(decimate-ref); -if (decimate-avctx) { -avcodec_close(decimate-avctx); -av_freep(decimate-avctx); -} } static int query_formats(AVFilterContext *ctx) -- 2.0.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] rectification filter
On Fri, Aug 01, 2014 at 06:47:38PM +0200, Daniel Oberhoff wrote: [...] Did you already explain if / how this filter is different from / better than the vignette filter? Its completely differen. Vignette modulates brightness, this one geometry, but I will mention it. So this is a lens correction filter? Maybe rename rectification into lens or something (the name is kind of really generic). -- Clément B. pgpV_Vn3ol9A8.pgp Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] rectification filter
On Fri, Aug 01, 2014 at 01:08:58PM +0200, Daniel Oberhoff wrote: Am 01.08.2014 um 13:07 schrieb Carl Eugen Hoyos ceho...@ag.or.at: Daniel Oberhoff danieloberhoff at gmail.com writes: all work now, except vuy444p It's yuv444p oops :). And how about that test/data/fate/filter-pixfmts-rectification.rep file? Should I commit that? This is your run results; the references should be in tests/ref/fate. -- Clément B. pgp6w7gRPN_7z.pgp Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/5] avfilter/deshake: remove avcodec dependency
On Sat, Aug 02, 2014 at 11:34:09PM +0200, Clément Bœsch wrote: --- configure| 4 +--- libavfilter/deshake.h| 5 ++--- libavfilter/vf_deshake.c | 20 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/configure b/configure index 5159f10..bc187a5 100755 LGTM [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many things microsoft did are stupid, but not doing something just because microsoft did it is even more stupid. If everything ms did were stupid they would be bankrupt already. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] rectification filter
Am 03.08.2014 um 00:12 schrieb Clément Bœsch u...@pkh.me: On Fri, Aug 01, 2014 at 12:56:42PM +0200, Daniel Oberhoff wrote: Am 01.08.2014 um 12:22 schrieb Clément Bœsch u...@pkh.me: On Fri, Aug 01, 2014 at 12:13:22PM +0200, Daniel Oberhoff wrote: Am 29.07.2014 um 09:54 schrieb Carl Eugen Hoyos ceho...@ag.or.at: Daniel Oberhoff danieloberhoff at gmail.com writes: OBJS-$(CONFIG_ZOOMPAN_FILTER)+= vf_zoompan.o +OBJS-$(CONFIG_RECTIFICATION_FILTER) += vf_rectification.o REGISTER_FILTER(ZOOMPAN,zoompan,vf); +REGISTER_FILTER(RECTIFICATION, rectification, vf); Keep the alphabetic ordering please. Ok +AV_PIX_FMT_YUV410P, +AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVJ444P, +AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVJ420P, +AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA420P, +AV_PIX_FMT_NONE I have no idea what this filter does and since the most important format (yuv420p) is supported, this doesn't really matter but yuv410p and yuva444p are quite exotic formats, I would at least have expected yuv422p, yuva420p and yuv444p in the list. Did you test all above formats (at least the left row)? Added the one from your list that was missing. Can you suggest an easy way of testing all these formats? add a format filter before yours in the filtergraph (-vf format=yuv410p,rectification …) Ok, borders can be a bitt different, but otherwise all work now, except vuy444p, which ffmpeg reports as invalid. btw, how can I get the components of a given color in the colorspace? If you want to add a FATE test (which would be really awesome), you can grep for video_filter in tests/fate/filter-video.mak (to test all pixel formats the filter supports), or just make a standard test with framecrc. [...] I did that by adding this: FATE_FILTER_PIXFMTS-$(CONFIG_RECTIFICATION_FILTER) += fate-filter-pixfmts-rectification fate-filter-pixfmts-rectification: CMD = pixfmts 0.6:0.4:0.65:0.4 then I ran make fate-filter-pixfmts-rectification GEN=1 which made a file test/data/fate/filter-pixfmts-rectification.rep This is the result of a normal run to be compared by with the reference which should have also been generated with the help of GEN=1 for your first run. The file(s) generated by GEN=1 need to be tracked. do I check this in or not? Of course you are supposed to check if the results make sense. Use make fate-filter-pixfmts-rectifications V=1 to see what's going on. running make fate-filter-pixfmts-rectification GEN=1 runs fine… Of course, it doesn't do the comparison, it generates the reference. Best Daniel -- Clément B. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel Alright, will get that cleaned up. Since I seem to have all consent I need to also change the license I will see that I get a new patch ready soon. Best and thanks for feedback! Daniel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] x86/hevc_deblock: improve 8bit transpose store macros
On Sat, Aug 02, 2014 at 11:21:31PM -0300, James Almer wrote: Up to four instructions less depending on function and instruction set. Signed-off-by: James Almer jamr...@gmail.com --- libavcodec/x86/hevc_deblock.asm | 70 + libavutil/x86/x86util.asm | 9 ++ 2 files changed, 31 insertions(+), 48 deletions(-) applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel