[FFmpeg-devel] [PATCH] Transpose filter

Michael Niedermayer michaelni
Mon Oct 18 22:29:54 CEST 2010


On Mon, Oct 18, 2010 at 05:42:38PM +0200, Stefano Sabatini wrote:
> On date Sunday 2010-10-17 22:05:40 +0200, Michael Niedermayer encoded:
> > On Sun, Oct 17, 2010 at 09:54:53PM +0200, Stefano Sabatini wrote:
> [...]
> > >  doc/filters.texi           |   35 +++++++
> > >  libavfilter/Makefile       |    1 
> > >  libavfilter/allfilters.c   |    1 
> > >  libavfilter/vf_transpose.c |  211 +++++++++++++++++++++++++++++++++++++++++++++
> > >  4 files changed, 248 insertions(+)
> > > 19f52fa952acc7efca50ef7fbc1f3742f3b566eb  0002-Add-transpose-filter.patch
> > > From e04cbff39214bfc1a1641b592e1af51e3111c268 Mon Sep 17 00:00:00 2001
> > > From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> > > Date: Mon, 11 Oct 2010 14:16:35 +0200
> > > Subject: [PATCH 2/4] Add transpose filter.
> > 
> > should be ok if tested and benchmarked against mplayers rotate
> 
> $ gcc --version
> gcc (Debian 4.4.4-8) 4.4.5 20100728 (prerelease)
> Copyright (C) 2010 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> 
> 
> Curious, I tried the code and I got:
> 14515950 dezicycles in fftranspose, 1 runs, 0 skips
> 8731830 dezicycles in fftranspose, 2 runs, 0 skips
> 7977697 dezicycles in fftranspose, 4 runs, 0 skips
> 6721785 dezicycles in fftranspose, 8 runs, 0 skips
> 6964627 dezicycles in fftranspose, 16 runs, 0 skips
> 6305574 dezicycles in fftranspose, 32 runs, 0 skips
> 6071716 dezicycles in fftranspose, 64 runs, 0 skips
> 5950493 dezicycles in fftranspose, 128 runs, 0 skips
> 6108487 dezicycles in fftranspose, 256 runs, 0 skips
> 6190255 dezicycles in fftranspose, 512 runs, 0 skips
> 6182728 dezicycles in fftranspose, 1024 runs, 0 skips
> 
> Changing:
> *(out + x) = *(in + x*inlinesize + y);
> to
> out[x] = in[x*inlinesize + y];
> 
> I got:
> 2796300 dezicycles in fftranspose, 1 runs, 0 skips
> 1741350 dezicycles in fftranspose, 2 runs, 0 skips
> 2488815 dezicycles in fftranspose, 4 runs, 0 skips
> 2041652 dezicycles in fftranspose, 8 runs, 0 skips
> 1914091 dezicycles in fftranspose, 16 runs, 0 skips
> 1881855 dezicycles in fftranspose, 32 runs, 0 skips
> 1696222 dezicycles in fftranspose, 64 runs, 0 skips
> 1603417 dezicycles in fftranspose, 128 runs, 0 skips
> 1545936 dezicycles in fftranspose, 256 runs, 0 skips
> 1566907 dezicycles in fftranspose, 512 runs, 0 skips
> 1611006 dezicycles in fftranspose, 1024 runs, 0 skips
> 1610478 dezicycles in fftranspose, 2048 runs, 0 skips
> 1605196 dezicycles in fftranspose, 4096 runs, 0 skips
> 1612250 dezicycles in fftranspose, 8192 runs, 0 skips
> 
> which are comparable with the same values from mplayer rotate:
> 2222190 dezicycles in mpcrotate, 1 runs, 0 skips
> 1382235 dezicycles in mpcrotate, 2 runs, 0 skips
> 1361745 dezicycles in mpcrotate, 4 runs, 0 skips
> 1385261 dezicycles in mpcrotate, 8 runs, 0 skips
> 1362976 dezicycles in mpcrotate, 16 runs, 0 skips
> 1259585 dezicycles in mpcrotate, 32 runs, 0 skips
> 1340383 dezicycles in mpcrotate, 64 runs, 0 skips
> 1419385 dezicycles in mpcrotate, 128 runs, 0 skips
> 1588434 dezicycles in mpcrotate, 256 runs, 0 skips
> 1604090 dezicycles in mpcrotate, 512 runs, 0 skips
> 1650801 dezicycles in mpcrotate, 1024 runs, 0 skips
> 1692090 dezicycles in mpcrotate, 2046 runs, 2 skips
> 1703945 dezicycles in mpcrotate, 4093 runs, 3 skips
> 1689078 dezicycles in mpcrotate, 8188 runs, 4 skips
> 
> I have no idea why it is so much faster, anyway patch updated.
> -- 
> FFmpeg = Fiendish & Foolish Marvellous Prodigious Elected Geek

>  Changelog                  |    1 
>  doc/filters.texi           |   35 +++++++
>  libavfilter/Makefile       |    1 
>  libavfilter/allfilters.c   |    1 
>  libavfilter/avfilter.h     |    2 
>  libavfilter/vf_transpose.c |  211 +++++++++++++++++++++++++++++++++++++++++++++
>  6 files changed, 250 insertions(+), 1 deletion(-)
> 01f920239453cb099f34affad81be4f8e4bdc20f  0001-Add-transpose-filter.patch
> From 0c759b9e768551e75c747956abc362ee703a5a23 Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> Date: Mon, 11 Oct 2010 14:16:35 +0200
> Subject: [PATCH 1/4] Add transpose filter.
> 
> ---
>  Changelog                  |    1 +
>  doc/filters.texi           |   35 +++++++
>  libavfilter/Makefile       |    1 +
>  libavfilter/allfilters.c   |    1 +
>  libavfilter/avfilter.h     |    2 +-
>  libavfilter/vf_transpose.c |  211 ++++++++++++++++++++++++++++++++++++++++++++
>  6 files changed, 250 insertions(+), 1 deletions(-)
>  create mode 100644 libavfilter/vf_transpose.c
> 
> diff --git a/Changelog b/Changelog
> index 426a92d..45751fc 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -47,6 +47,7 @@ version <next>:
>  - SAP (Session Announcement Protocol, RFC 2974) muxer and demuxer
>  - cropdetect filter
>  - ffmpeg -crop* options removed
> +- transpose filter added
>  
>  
>  version 0.6:
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 66c1606..f6b262b 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -508,6 +508,41 @@ not specified it will use the default value of 16.
>  Adding this in the beginning of filter chains should make filtering
>  faster due to better use of the memory cache.
>  
> + at section transpose
> +
> +Transpose rows with columns in the input video and optionally flip it.
> +
> +It accepts a parameter representing an integer, which can assume the
> +values:
> +
> +0    Rotate by 90 degrees clockwise and vertically flip (default), that is:
> + at example
> +L.R     r.R
> +. . ->  . .
> +l.r     l.L
> + at end example
> +
> +1    Rotate by 90 degrees clockwise, that is:
> + at example
> +L.R     l.L
> +. . ->  . .
> +l.r     r.R
> + at end example
> +
> +2    Rotate by 90 degrees counterclockwise, that is:
> + at example
> +L.R     R.r
> +. . ->  . .
> +l.r     L.l
> + at end example
> +

> +3    Rotate by 90 degrees counterclockwise and vertically flip, that is:
> + at example
> +L.R     L.l
> +. . ->  . .
> +l.r     R.r
> + at end example

this should be default i  think
otherwise ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101018/844d7edd/attachment.pgp>



More information about the ffmpeg-devel mailing list