Re: [FFmpeg-devel] [PATCH] ffmpeg_opt: Do not overwrite output if there is no input

2015-03-27 Thread Nicolas George
Le septidi 7 germinal, an CCXXIII, Michael Niedermayer a écrit :
> +if (!(oc->oformat->flags & AVFMT_NOSTREAMS) && 
> !input_stream_potentially_available) {
> +av_log(NULL, AV_LOG_ERROR,
> +   "No input streams but output needs an input stream\n");
> +exit_program(1);
> +}

Was this tested with input coming only from a filter graph (ffmpeg -lavfi
testsrc output.nut)?

Regards,

-- 
  Nicolas George
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]Add an ignore_delay option to the gif demuxer

2015-03-27 Thread Carl Eugen Hoyos
Michael Niedermayer  gmx.at> writes:

> On Fri, Mar 27, 2015 at 12:21:00AM +, Carl Eugen Hoyos wrote:
> > Michael Niedermayer  gmx.at> writes:
> > 
> > > iam not sure the default of 6 seconds is safe
> > 
> > What would be a sensible default max_delay?
> 
> for this file simply considering 0x as 0 would work 
> and would so i think only replacing that would be the 
> least change needed

I did not find any specification that suggests to do this 
(but many pages were 0x is explicitely mentioned as 
allowing for maximum delay).

Do you prefer the first patch?

Carl Eugen

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec[/format]/webpenc: use WebPAnimEncoder API to generate animated WebP

2015-03-27 Thread Pascal Massimino
Hi,

$subject

$attached says:

This API is available at head (MUX_ABI_VERSION >= 0x0104), is stable,
 and will be made official in future release.
For compatibility, the previous code is left as fallback.

Dont' forget to use --enable-libwebp as ./configure option.

This new code handles video, so that something like
   ffmpeg -i video.mp4 -y anim.webp
should just work.

-loop option is also supported.


Comments welcome!
skal/
From dcad4a82df4d0e63f187e51c858038ea4508e4b6 Mon Sep 17 00:00:00 2001
From: Urvang Joshi 
Date: Fri, 27 Mar 2015 10:42:57 +0100
Subject: [PATCH] use WebPAnimEncoder API to generate animated WebP

This API is available at head (MUX_ABI_VERSION >= 0x0104), is stable,
 and will be made official in future release.
For compatibility, the previous code is left as fallback.

Dont' forget to use --enable-libwebp as ./configure option.

This new code handles video, so that something like
   ffmpeg -i video.mp4 -y anim.webp
should just work.

-loop option is also supported.
---
 configure   |   4 +-
 libavcodec/libwebpenc.c | 399 +---
 libavformat/webpenc.c   |  41 -
 3 files changed, 281 insertions(+), 163 deletions(-)

diff --git a/configure b/configure
index a96bfb7..4843079 100755
--- a/configure
+++ b/configure
@@ -4985,7 +4985,9 @@ enabled libvpx&& {
 enabled libvpx_vp9_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || disable libvpx_vp9_decoder; }
 enabled libvpx_vp9_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VP9E_SET_AQ_MODE" -lvpx || disable libvpx_vp9_encoder; } }
 enabled libwavpack&& require libwavpack wavpack/wavpack.h WavpackOpenFileOutput  -lwavpack
-enabled libwebp   && require_pkg_config "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
+enabled libwebp   && require_pkg_config "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion &&
+ { use_pkg_config "libwebpmux >= 0.3.0" webp/mux.h WebPGetMuxVersion ||
+   warn "using libwebp without libwebpmux"; }
 enabled libx264   && { use_pkg_config x264 "stdint.h x264.h" x264_encoder_encode ||
{ require libx264 x264.h x264_encoder_encode -lx264 &&
  warn "using libx264 without pkg-config"; } } &&
diff --git a/libavcodec/libwebpenc.c b/libavcodec/libwebpenc.c
index 95d56ac..0726d1f 100644
--- a/libavcodec/libwebpenc.c
+++ b/libavcodec/libwebpenc.c
@@ -26,6 +26,13 @@
 
 #include 
 
+#if (WEBP_ENCODER_ABI_VERSION >= 0x0206)
+#include 
+#if (WEBP_MUX_ABI_VERSION >= 0x0104)
+#define USE_WEBP_ANIMENCODER
+#endif
+#endif
+
 #include "libavutil/common.h"
 #include "libavutil/frame.h"
 #include "libavutil/imgutils.h"
@@ -44,6 +51,11 @@ typedef struct LibWebPContext {
 AVFrame *ref;
 int cr_size;
 int cr_threshold;
+#ifdef USE_WEBP_ANIMENCODER
+WebPAnimEncoder *enc;   // the main AnimEncoder object
+int64_t prev_frame_pts; // pts of the previously encoded frame.
+int done;   // If true, we have assembled the bitstream already
+#endif
 } LibWebPContext;
 
 static int libwebp_error_to_averror(int err)
@@ -96,6 +108,20 @@ static av_cold int libwebp_encode_init(AVCodecContext *avctx)
 return AVERROR(EINVAL);
 }
 
+#ifdef USE_WEBP_ANIMENCODER
+{
+  WebPAnimEncoderOptions enc_options;
+  WebPAnimEncoderOptionsInit(&enc_options);
+  // TODO(urvang): Expose some options on command-line perhaps.
+  s->enc = WebPAnimEncoderNew(avctx->width, avctx->height, &enc_options);
+  if (!s->enc)
+  return AVERROR(EINVAL);
+  // Ensures 'pts - prev_frame_pts' works correctly for first frame, too.
+  s->prev_frame_pts = -1;
+  s->done = 0;
+}
+#endif
+
 av_log(avctx, AV_LOG_DEBUG, "%s - quality=%.1f method=%d\n",
s->lossless ? "Lossless" : "Lossy", s->quality,
avctx->compression_level);
@@ -107,100 +133,114 @@ static int libwebp_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
 const AVFrame *frame, int *got_packet)
 {
 LibWebPContext *s  = avctx->priv_data;
-AVFrame *alt_frame = NULL;
-WebPPicture *pic = NULL;
-WebPMemoryWriter mw = { 0 };
 int ret;
 
-if (avctx->width > WEBP_MAX_DIMENSION || avctx->height > WEBP_MAX_DIMENSION) {
-av_log(avctx, AV_LOG_ERROR, "Picture size is too large. Max is %dx%d.\n",
-   WEBP_MAX_DIMENSION, WEBP_MAX_DIMENSION);
-return AVERROR(EINVAL);
-}
-
-pic = av_malloc(sizeof(*pic));
-if (!pic)
-return AVERROR(ENOMEM);
-
-ret = WebPPictureInit(pic);
-if (!ret) {
-ret = AVERROR_UNKNOWN;
-goto end;
-}
-pic->width  = avctx->width;
-pic->he

Re: [FFmpeg-devel] [PATCH] ffmpeg_opt: Do not overwrite output if there is no input

2015-03-27 Thread Michael Niedermayer
On Fri, Mar 27, 2015 at 08:08:45AM +0100, Nicolas George wrote:
> Le septidi 7 germinal, an CCXXIII, Michael Niedermayer a écrit :
> > +if (!(oc->oformat->flags & AVFMT_NOSTREAMS) && 
> > !input_stream_potentially_available) {
> > +av_log(NULL, AV_LOG_ERROR,
> > +   "No input streams but output needs an input stream\n");
> > +exit_program(1);
> > +}
> 
> Was this tested with input coming only from a filter graph (ffmpeg -lavfi
> testsrc output.nut)?

yes, theres a test that does this in fate

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavfi: add inverse telecine filter

2015-03-27 Thread Michael Niedermayer
On Fri, Mar 27, 2015 at 11:07:18AM +0530, Himangi Saraogi wrote:
> ---
>  Changelog   |   1 +
>  doc/filters.texi|  27 
>  libavfilter/Makefile|   1 +
>  libavfilter/allfilters.c|   1 +
>  libavfilter/vf_detelecine.c | 345 
> 
>  5 files changed, 375 insertions(+)
>  create mode 100644 libavfilter/vf_detelecine.c
> 
> diff --git a/Changelog b/Changelog
> index b0d0414..81c6eab 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -9,6 +9,7 @@ version :
>  - libdcadec wrapper
>  - Drop support for nvenc API before 5.0
>  - nvenc H265 encoder
> +- Detelecine filter
>  
>  
>  version 2.6:
> diff --git a/doc/filters.texi b/doc/filters.texi
> index f2999f2..15f8ed5 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -3728,6 +3728,33 @@ FFmpeg was configured with @code{--enable-opencl}. 
> Default value is 0.
>  
>  @end table
>  
> +@section detelecine
> +
> +Apply an exact inverse of the telecine operation. It requires a predefined
> +pattern specified using the pattern option which must be the same as that 
> passed
> +to the telecine filter.
> +
> +This filter accepts the following options:
> +
> +@table @option
> +@item first_field
> +@table @samp
> +@item top, t
> +top field first
> +@item bottom, b
> +bottom field first
> +The default value is @code{top}.
> +@end table
> +
> +@item pattern
> +A string of numbers representing the pulldown pattern you wish to apply.
> +The default value is @code{23}.
> +
> +@item start_frame
> +A number representing position of the first frame with respect to the 
> telecine
> +pattern. This is to be used if the stream is cut. The default value is 
> @code{0}.
> +@end table
> +
>  @section drawbox
>  
>  Draw a colored box on the input image.
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 2cde029..73e7adf 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -112,6 +112,7 @@ OBJS-$(CONFIG_DECIMATE_FILTER)   += 
> vf_decimate.o
>  OBJS-$(CONFIG_DEJUDDER_FILTER)   += vf_dejudder.o
>  OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
>  OBJS-$(CONFIG_DESHAKE_FILTER)+= vf_deshake.o
> +OBJS-$(CONFIG_DETELECINE_FILTER) += vf_detelecine.o
>  OBJS-$(CONFIG_DRAWBOX_FILTER)+= vf_drawbox.o
>  OBJS-$(CONFIG_DRAWGRID_FILTER)   += vf_drawbox.o
>  OBJS-$(CONFIG_DRAWTEXT_FILTER)   += vf_drawtext.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index 0288082..6bc01c5 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -128,6 +128,7 @@ void avfilter_register_all(void)
>  REGISTER_FILTER(DEJUDDER,   dejudder,   vf);
>  REGISTER_FILTER(DELOGO, delogo, vf);
>  REGISTER_FILTER(DESHAKE,deshake,vf);
> +REGISTER_FILTER(DETELECINE, detelecine, vf);
>  REGISTER_FILTER(DRAWBOX,drawbox,vf);
>  REGISTER_FILTER(DRAWGRID,   drawgrid,   vf);
>  REGISTER_FILTER(DRAWTEXT,   drawtext,   vf);
> diff --git a/libavfilter/vf_detelecine.c b/libavfilter/vf_detelecine.c
> new file mode 100644
> index 000..27463fe
> --- /dev/null
> +++ b/libavfilter/vf_detelecine.c
> @@ -0,0 +1,345 @@
> +/*
> + * Copyright (c) 2015 Himangi Saraogi 
> + *
> + * 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
> + */
> +
> +/**
> + * @file detelecine filter.
> + */
> +
> +
> +#include "libavutil/avstring.h"
> +#include "libavutil/imgutils.h"
> +#include "libavutil/opt.h"
> +#include "libavutil/pixdesc.h"
> +#include "avfilter.h"
> +#include "formats.h"
> +#include "internal.h"
> +#include "video.h"
> +
> +typedef struct {
> +const AVClass *class;
> +int first_field;
> +char *pattern;
> +int start_frame;
> +unsigned int pattern_pos;
> +unsigned int nskip_fields;
> +int64_t start_time;
> +
> +AVRational pts;

> +double ts_unit;

this should be a AVRational or some int64_t / int64_t in case there is
insufficient precission in AVRational.
floating point should be avoided so that the same values are
produced on every platform, which is important for regression testig



[...]
> +

[FFmpeg-devel] [PATCH/TOY] zip files

2015-03-27 Thread Peter Ross
---
this was created to test the idea proposed in 
https://trac.ffmpeg.org/ticket/4374
as result, i think a zip:// protocol has some problems

- strict uri syntax can only open files in current directory
- user shouldn't have to specify the archive format. this should be 
autodetected (zip, rar, ... arj)
- want ability to grab zip files over other protocols 
'vfs:http://subtitles.org/amovie.zip:amovie.srt'
- default action to open the first inner file?

 configure|  4 +++
 libavformat/Makefile |  1 +
 libavformat/allformats.c |  1 +
 libavformat/libzip.c | 91 
 4 files changed, 97 insertions(+)
 create mode 100644 libavformat/libzip.c

diff --git a/configure b/configure
index a96bfb7..102361b 100755
--- a/configure
+++ b/configure
@@ -240,6 +240,7 @@ External library support:
   --enable-libsoxr enable Include libsoxr resampling [no]
   --enable-libspeexenable Speex de/encoding via libspeex [no]
   --enable-libssh  enable SFTP protocol via libssh [no]
+  --enable-libzip  enable zip protocol via libzip [no]
   --enable-libstagefright-h264  enable H.264 decoding via libstagefright [no]
   --enable-libtheora   enable Theora encoding via libtheora [no]
   --enable-libtwolame  enable MP2 encoding via libtwolame [no]
@@ -1404,6 +1405,7 @@ EXTERNAL_LIBRARY_LIST="
 libxcb_shape
 libxcb_xfixes
 libxvid
+libzip
 libzmq
 libzvbi
 lzma
@@ -2561,6 +2563,7 @@ librtmpt_protocol_deps="librtmp"
 librtmpte_protocol_deps="librtmp"
 libsmbclient_protocol_deps="libsmbclient gplv3"
 libssh_protocol_deps="libssh"
+libzip_protocol_deps="libzip"
 mmsh_protocol_select="http_protocol"
 mmst_protocol_select="network"
 rtmp_protocol_deps="!librtmp_protocol"
@@ -4996,6 +4999,7 @@ enabled libx265   && require_pkg_config x265 
x265.h x265_encoder_encode
die "ERROR: libx265 version must be >= 17."; }
 enabled libxavs   && require libxavs xavs.h xavs_encoder_encode -lxavs
 enabled libxvid   && require libxvid xvid.h xvid_global -lxvidcore
+enabled libzip&& require_pkg_config libzip zip.h zip_open
 enabled libzmq&& require_pkg_config libzmq zmq.h zmq_ctx_new
 enabled libzvbi   && require libzvbi libzvbi.h vbi_decoder_new -lzvbi
 enabled nvenc && { check_header nvEncodeAPI.h || die "ERROR: 
nvEncodeAPI.h not found."; } &&
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 2118ff2..325628c 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -485,6 +485,7 @@ OBJS-$(CONFIG_LIBQUVI_DEMUXER)   += libquvi.o
 OBJS-$(CONFIG_LIBRTMP)   += librtmp.o
 OBJS-$(CONFIG_LIBSSH_PROTOCOL)   += libssh.o
 OBJS-$(CONFIG_LIBSMBCLIENT_PROTOCOL) += libsmbclient.o
+OBJS-$(CONFIG_LIBZIP_PROTOCOL)   += libzip.o
 
 # protocols I/O
 OBJS-$(CONFIG_APPLEHTTP_PROTOCOL)+= hlsproto.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 26ccc27..93cd2e8 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -392,4 +392,5 @@ void av_register_all(void)
 REGISTER_PROTOCOL(LIBRTMPTE,librtmpte);
 REGISTER_PROTOCOL(LIBSSH,   libssh);
 REGISTER_PROTOCOL(LIBSMBCLIENT, libsmbclient);
+REGISTER_PROTOCOL(LIBZIP,   libzip);
 }
diff --git a/libavformat/libzip.c b/libavformat/libzip.c
new file mode 100644
index 000..e6cfb50
--- /dev/null
+++ b/libavformat/libzip.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2015 Peter Ross 
+ *
+ * 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 
+#include "avformat.h"
+#include "internal.h"
+#include "url.h"
+
+//FIXME: url syntax cannot distinguish 'real zip file path' from 'virtual file 
path'
+// OK:  zip://tarball.zip/lol.gif
+// BROKEN: zip:///tmp/tarball.zip/lol.gif
+
+typedef struct {
+const AVClass *class;
+struct zip *zip;
+struct zip_file *file;
+} ZipContext;
+
+static av_cold int libzip_open(URLContext *h, const char *url, int flags)
+{
+ZipContext *libzip = h->priv_data;
+char proto[10], password[1024], hostname[1024], path[MAX_URL_SIZE], *p;
+int error;
+
+av_url_split(proto, sizeof(proto),
+  

Re: [FFmpeg-devel] [PATCH] avcodec[/format]/webpenc: use WebPAnimEncoder API to generate animated WebP

2015-03-27 Thread Michael Niedermayer
On Fri, Mar 27, 2015 at 11:02:09AM +0100, Pascal Massimino wrote:
> Hi,
> 
> $subject
> 
> $attached says:
> 
> This API is available at head (MUX_ABI_VERSION >= 0x0104), is stable,
>  and will be made official in future release.
> For compatibility, the previous code is left as fallback.
> 
> Dont' forget to use --enable-libwebp as ./configure option.
> 
> This new code handles video, so that something like
>ffmpeg -i video.mp4 -y anim.webp
> should just work.
> 
> -loop option is also supported.
> 
> 
> Comments welcome!
> skal/

breaks build if libwebp* is unavailable
make
CC  libavformat/webpenc.o
/home/michael/ffmpeg-git/ffmpeg/libavformat/webpenc.c:27:25: fatal error: 
webp/encode.h: No such file or directory


>  configure   |4 
>  libavcodec/libwebpenc.c |  399 
> 
>  libavformat/webpenc.c   |   41 
>  3 files changed, 281 insertions(+), 163 deletions(-)
> 20e2236a5a357c8509446cf3bf79ce22457132e5  
> 0001-use-WebPAnimEncoder-API-to-generate-animated.patch
> From dcad4a82df4d0e63f187e51c858038ea4508e4b6 Mon Sep 17 00:00:00 2001
> From: Urvang Joshi 
> Date: Fri, 27 Mar 2015 10:42:57 +0100
> Subject: [PATCH] use WebPAnimEncoder API to generate animated WebP
> 
> This API is available at head (MUX_ABI_VERSION >= 0x0104), is stable,
>  and will be made official in future release.
> For compatibility, the previous code is left as fallback.
> 
> Dont' forget to use --enable-libwebp as ./configure option.
> 

> This new code handles video, so that something like
>ffmpeg -i video.mp4 -y anim.webp
> should just work.

doesnt that already work before the patch ?

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH/TOY] zip files

2015-03-27 Thread Lukasz Marek

On 27.03.2015 13:07, Peter Ross wrote:

---
this was created to test the idea proposed in 
https://trac.ffmpeg.org/ticket/4374
as result, i think a zip:// protocol has some problems

- strict uri syntax can only open files in current directory
- user shouldn't have to specify the archive format. this should be 
autodetected (zip, rar, ... arj)
- want ability to grab zip files over other protocols 
'vfs:http://subtitles.org/amovie.zip:amovie.srt'
- default action to open the first inner file?


We duplicated out work. I implemented it too, just wanted to add write 
too and have no time recently. I submitted my version in separate thread.


Issue 1 and 4 are supported in my patch.
Issue 2 is not the issue, it just need to be implemented, but in this 
case this "protocol" should be called "archive" or something.
Regarding Issue 3 this is probably not possible with libzip. It allows 
to open archive by descriptor, so it gives possibility to get http's or 
ftp's handle in theory (or ffmpeg could created named pipe and push data 
from remote host into it), but I expect this need to be seekable. I 
haven't tested yet though.


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavf: add zip protocol

2015-03-27 Thread Lukasz Marek
TODO: add doc, update doc/APIChanges, bump minor
---
 configure|   4 ++
 libavformat/Makefile |   2 +
 libavformat/allformats.c |   1 +
 libavformat/zip.c| 176 +++
 4 files changed, 183 insertions(+)
 create mode 100644 libavformat/zip.c

diff --git a/configure b/configure
index a96bfb7..a36c357 100755
--- a/configure
+++ b/configure
@@ -275,6 +275,7 @@ External library support:
   --disable-sdldisable sdl [autodetect]
   --enable-x11grab enable X11 grabbing (legacy) [no]
   --disable-xlib   disable xlib [autodetect]
+  --enable-libzip  enable libzip [no]
   --disable-zlib   disable zlib [autodetect]
 
 Toolchain options:
@@ -1404,6 +1405,7 @@ EXTERNAL_LIBRARY_LIST="
 libxcb_shape
 libxcb_xfixes
 libxvid
+libzip
 libzmq
 libzvbi
 lzma
@@ -2582,6 +2584,7 @@ udp_protocol_select="network"
 udplite_protocol_select="network"
 unix_protocol_deps="sys_un_h"
 unix_protocol_select="network"
+zip_protocol_deps="zlib"
 
 # filters
 amovie_filter_deps="avcodec avformat"
@@ -4963,6 +4966,7 @@ enabled libsmbclient  && { use_pkg_config smbclient 
libsmbclient.h smbc_init
require smbclient libsmbclient.h smbc_init 
-lsmbclient; }
 enabled libsoxr   && require libsoxr soxr.h soxr_create -lsoxr
 enabled libssh&& require_pkg_config libssh libssh/sftp.h sftp_init
+enabled libzip&& require_pkg_config libzip zip.h zip_open
 enabled libspeex  && require_pkg_config speex speex/speex.h 
speex_decoder_init -lspeex
 enabled libstagefright_h264 && require_cpp libstagefright_h264 
"binder/ProcessState.h media/stagefright/MetaData.h
 media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h 
media/stagefright/MediaDefs.h
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 2118ff2..47d3804 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -522,6 +522,8 @@ OBJS-$(CONFIG_TLS_PROTOCOL)  += tls.o
 OBJS-$(CONFIG_UDP_PROTOCOL)  += udp.o
 OBJS-$(CONFIG_UDPLITE_PROTOCOL)  += udp.o
 OBJS-$(CONFIG_UNIX_PROTOCOL) += unix.o
+OBJS-$(CONFIG_ZIP_PROTOCOL)  += zip.o
+
 
 OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o
 
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 26ccc27..96fe484 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -379,6 +379,7 @@ void av_register_all(void)
 REGISTER_PROTOCOL(UDP,  udp);
 REGISTER_PROTOCOL(UDPLITE,  udplite);
 REGISTER_PROTOCOL(UNIX, unix);
+REGISTER_PROTOCOL(ZIP,  zip);
 
 /* external libraries */
 REGISTER_DEMUXER (LIBGME,   libgme);
diff --git a/libavformat/zip.c b/libavformat/zip.c
new file mode 100644
index 000..c9d6679
--- /dev/null
+++ b/libavformat/zip.c
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2015 Lukasz Marek 
+ *
+ * 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 
+#include 
+#include "libavutil/opt.h"
+#include "libavutil/avstring.h"
+#include "avformat.h"
+#include "internal.h"
+#include "url.h"
+
+typedef struct {
+const AVClass *class;
+
+struct zip *z;
+struct zip_file *f;
+
+char *password;
+int file_index;
+int64_t filesize;
+} ZIPContext;
+
+
+static int ffzip_close(URLContext *h)
+{
+ZIPContext *zip = h->priv_data;
+if (zip->f) {
+zip_fclose(zip->f);
+zip->f = NULL;
+}
+if (zip->z) {
+zip_close(zip->z);
+zip->z = NULL;
+}
+return 0;
+}
+
+static int ffzip_split_url(URLContext *h, const char *url, char **file)
+{
+ZIPContext *zip = h->priv_data;
+int ret = 0;
+struct stat st;
+char *filename, *pos;
+
+*file = NULL;
+
+if (strnlen(url, 7) < 7 || !av_strstart(url, "zip://", NULL))
+return AVERROR(EINVAL);
+
+filename = av_strdup(url + 6);
+if (!filename)
+return AVERROR(ENOMEM);
+
+pos = filename;
+while (pos) {
+if (pos != filename)
+*pos = 0;
+if ((stat(filename, &st) == 0) && S_ISREG(st.st_mode)) {
+av_log(h, AV_LOG_DEBUG, "Trying to open file: %s\n", filename);

Re: [FFmpeg-devel] [PATCH/TOY] zip files

2015-03-27 Thread Michael Niedermayer
On Fri, Mar 27, 2015 at 11:07:51PM +1100, Peter Ross wrote:
> ---
> this was created to test the idea proposed in 
> https://trac.ffmpeg.org/ticket/4374
> as result, i think a zip:// protocol has some problems
> 
> - strict uri syntax can only open files in current directory
> - user shouldn't have to specify the archive format. this should be 
> autodetected (zip, rar, ... arj)

> - want ability to grab zip files over other protocols 
> 'vfs:http://subtitles.org/amovie.zip:amovie.srt'

./ffplay 
cache:http://samples.ffmpeg.org/benchmark/testsuite1/matrixbench_mpeg2.mpg
works, the same should be possible for zip

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH/TOY] zip files

2015-03-27 Thread Michael Niedermayer
On Fri, Mar 27, 2015 at 01:51:08PM +0100, Lukasz Marek wrote:
> On 27.03.2015 13:07, Peter Ross wrote:
> >---
> >this was created to test the idea proposed in 
> >https://trac.ffmpeg.org/ticket/4374
> >as result, i think a zip:// protocol has some problems
> >
> >- strict uri syntax can only open files in current directory
> >- user shouldn't have to specify the archive format. this should be 
> >autodetected (zip, rar, ... arj)
> >- want ability to grab zip files over other protocols 
> >'vfs:http://subtitles.org/amovie.zip:amovie.srt'
> >- default action to open the first inner file?
> 
> We duplicated out work. I implemented it too, just wanted to add
> write too and have no time recently. I submitted my version in
> separate thread.
> 
> Issue 1 and 4 are supported in my patch.
> Issue 2 is not the issue, it just need to be implemented, but in
> this case this "protocol" should be called "archive" or something.

> Regarding Issue 3 this is probably not possible with libzip. It
> allows to open archive by descriptor, so it gives possibility to get
> http's or ftp's handle in theory (or ffmpeg could created named pipe
> and push data from remote host into it), but I expect this need to
> be seekable. I haven't tested yet though.

if libzip cant be used, is there something else that can be used ?
or can libzip be extended to not have this limitation ?

[...]
-- 
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 1/4] libavdevice/avfoundation: add framerate and video size options

2015-03-27 Thread Matthieu Bouron
On Sat, Mar 21, 2015 at 4:51 PM, Thilo Borgmann 
wrote:
[...]

> +/*
> + * Configure the video device using a run-time approach to access
> properties
> + * since formats, activeFormat are available since  iOS >= 7.0 or OSX >=
> 10.7
> + * and activeVideoMaxFrameDuration is available since i0S >= 7.0 and OSX
> >= 10.9
> + *
> + * The NSUndefinedKeyException must be handled by the caller of this
> function.
> + *
> + */
>
> Please make it a short doxygen comment: /**
>

Updated in attached patch.


>
> +static int configure_video_device(AVFormatContext *s, AVCaptureDevice
> *video_device)
> +{
> +AVFContext *ctx = (AVFContext*)s->priv_data;
> +
> +double framerate = av_q2d(ctx->framerate);
>
> +NSObject *format = nil, *range = nil;
> +NSObject *selected_format = nil, *selected_range = nil;
>
> Nit: Please split these in 4 lines.
>

Updated in attached patch.


>
>
> +for (format in [video_device valueForKey:@"formats"]) {
> +CMFormatDescriptionRef formatDescription;
> +CMVideoDimensions dimensions;
> +
> +formatDescription = (CMFormatDescriptionRef) [format
> performSelector:@selector(formatDescription)];
> +dimensions =
> CMVideoFormatDescriptionGetDimensions(formatDescription);
> +
> +if ((ctx->width == 0 && ctx->height == 0) ||
> +(dimensions.width == ctx->width && dimensions.height ==
> ctx->height)) {
> +
> +selected_format = format;
> +
> +for (range in [format 
> valueForKey:@"videoSupportedFrameRateRanges"])
> {
> +double max_framerate;
> +
> +[[range valueForKey:@"maxFrameRate"]
> getValue:&max_framerate];
> +if (abs (framerate - max_framerate) < 0.1) {
>
> +
>
> Unneeded blank line.
>

Updated in attached patch.


>
> +selected_range = range;
> +break;
> +}
> +}
> +}
> +}
> +
>
> +if (!selected_format) {
> +av_log(s, AV_LOG_ERROR, "Selected video size (%dx%d) is not
> supported
> by the device\n",
> +ctx->width, ctx->height);
> +return AVERROR(EINVAL);
> +}
> +
> +if (!selected_range) {
> +av_log(s, AV_LOG_ERROR, "Selected framerate (%f) is not supported
> by
> the device\n",
> +framerate);
> +return AVERROR(EINVAL);
> +}
>
> In case of an unsupported format/rate, please print a list of supported
> formats,
> like the pixel format test does.
>

Updated in attached patch. I've also replaced the wrong usage of abs with
fabs.


>
>
> +
> +if ([video_device lockForConfiguration:NULL] == YES) {
> +NSValue *min_frame_duration = [selected_range
> valueForKey:@"minFrameDuration"];
> +
>
> +[video_device setValue:selected_format forKey:@"activeFormat"];
> +[video_device setValue:min_frame_duration
> forKey:@"activeVideoMinFrameDuration"];
> +[video_device setValue:min_frame_duration
> forKey:@"activeVideoMaxFrameDuration"];
> ^^^
> Should be max_frame_duration in the third line.
> IIRC there is functionality in the API to check if setting
> min/max_frame_duration is available for the device, isn't it? Please
> check, in
> case there it is not, there is an alternative way to set the framerate
> (IIRC).
>

It is purely intentionnal to use the min_frame_duration for the
activeVideoMaxFrameDuration to acheive a better consistant framerate.
There is no way to check if the range is accepted by the device but as
stated by the documentation, applied range values that does not come from
ranges returned by the API will throw an exception.
There is an alternative way to set the framerate using
AVCaptureConnection.setVideo(Min|Max)FrameDuration but it has been
deprecated in iOS 7 and I do not intend to support it.


>
>
> +} else {
> +av_log(s, AV_LOG_ERROR, "Could not lock device for
> configuration");
> +return AVERROR(EINVAL);
> +}
> +
> +return 0;
> +}
> +
>  static int add_video_device(AVFormatContext *s, AVCaptureDevice
> *video_device)
>  {
>  AVFContext *ctx = (AVFContext*)s->priv_data;
> +int ret;
>  NSError *error  = nil;
>  AVCaptureInput* capture_input = nil;
>  struct AVFPixelFormatSpec pxl_fmt_spec;
> @@ -300,6 +372,18 @@ static int add_video_device(AVFormatContext *s,
> AVCaptureDevice *video_device)
>  return 1;
>  }
>
> +// Configure device framerate and video size
> +@try {
> +if ((ret = configure_video_device(s, video_device)) < 0) {
> +return ret;
> +}
> +} @catch (NSException *exception) {
> +if (![[exception name] isEqualToString:NSUndefinedKeyException]) {
> +  av_log (s, AV_LOG_ERROR, "An error occured: %s",
> [exception.reason
> UTF8String]);
> +  return AVERROR_EXTERNAL;
> +}
> +}
> +
>  // select pixel format
>  pxl_fmt_spec.ff_id = AV_PIX_FMT_NONE;
>
> @@ -549,6 +633,7 @@ static int get_a

Re: [FFmpeg-devel] [PATCH 2/4] libavdevice/avfoundation: add capture_screen_cursor option

2015-03-27 Thread Matthieu Bouron
On Sat, Mar 21, 2015 at 5:35 PM, Thilo Borgmann 
wrote:
[...]

> I suggest to rename the option to "capture_cursor"... _screen_ in it seems
> to be
> redundant.
>

Updated in attached patch.


0002-libavdevice-avfoundation-add-capture_cursor-option.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/4] libavdevice/avfoundation: add capture_screen_mouse_clicks option

2015-03-27 Thread Matthieu Bouron
On Sat, Mar 21, 2015 at 6:47 PM, Thilo Borgmann 
wrote:
[...]

>
> Please rename to "capture_mouse_clicks".
>

Updated in attached patch.


0003-libavdevice-avfoundation-add-capture_mouse_clicks-op.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]Add an ignore_delay option to the gif demuxer

2015-03-27 Thread Michael Niedermayer
On Fri, Mar 27, 2015 at 08:07:23AM +, Carl Eugen Hoyos wrote:
> Michael Niedermayer  gmx.at> writes:
> 
> > On Fri, Mar 27, 2015 at 12:21:00AM +, Carl Eugen Hoyos wrote:
> > > Michael Niedermayer  gmx.at> writes:
> > > 
> > > > iam not sure the default of 6 seconds is safe
> > > 
> > > What would be a sensible default max_delay?
> > 
> > for this file simply considering 0x as 0 would work 
> > and would so i think only replacing that would be the 
> > least change needed
> 
> I did not find any specification that suggests to do this 
> (but many pages were 0x is explicitely mentioned as 
> allowing for maximum delay).

one could add a option like max_delay which is then used in place
of 0x, conforming to the spec if taken litterally

The only reason i can imagine a file would be using the "max delay"
would be to wait for user input before displaying the next frame
i thought thats not the reason for this file though but i might be
wrong

[...]

-- 
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


Re: [FFmpeg-devel] [PATCH/TOY] zip files

2015-03-27 Thread Lukasz Marek

On 27.03.2015 14:16, Michael Niedermayer wrote:

On Fri, Mar 27, 2015 at 01:51:08PM +0100, Lukasz Marek wrote:

On 27.03.2015 13:07, Peter Ross wrote:

---
this was created to test the idea proposed in 
https://trac.ffmpeg.org/ticket/4374
as result, i think a zip:// protocol has some problems

- strict uri syntax can only open files in current directory
- user shouldn't have to specify the archive format. this should be 
autodetected (zip, rar, ... arj)
- want ability to grab zip files over other protocols 
'vfs:http://subtitles.org/amovie.zip:amovie.srt'
- default action to open the first inner file?


We duplicated out work. I implemented it too, just wanted to add
write too and have no time recently. I submitted my version in
separate thread.

Issue 1 and 4 are supported in my patch.
Issue 2 is not the issue, it just need to be implemented, but in
this case this "protocol" should be called "archive" or something.



Regarding Issue 3 this is probably not possible with libzip. It
allows to open archive by descriptor, so it gives possibility to get
http's or ftp's handle in theory (or ffmpeg could created named pipe
and push data from remote host into it), but I expect this need to
be seekable. I haven't tested yet though.


if libzip cant be used, is there something else that can be used ?
or can libzip be extended to not have this limitation ?


Just tested descriptors, I tried to open named pipe, like
mkfifo test.zip
cat data.zip > test.zip
./ffplay zip://test.zip

and libzip seg faulted :)

Reverted order
mkfifo test.zip
./ffplay zip://test.zip
cat data.zip > test.zip

postpones seg fault until cat is executed.

So this will not work.

libzip probably could be extended by open function that calls a callback 
to get data, like:

int(cb*)(size_t offset, void* buff, size_t size),
I haven't checked its sources, but they have similar API for write.
In real life it will take ages that API propagates into linux 
distributions. Someone who really needs this can always build it on its 
own tho.


I haven't researched deeply if there are other libs for handling zips.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avfilter/vf_telecine: Avoid floating point values

2015-03-27 Thread Himangi Saraogi
---
 libavfilter/vf_telecine.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_telecine.c b/libavfilter/vf_telecine.c
index 73447df..93e5aa9 100644
--- a/libavfilter/vf_telecine.c
+++ b/libavfilter/vf_telecine.c
@@ -41,7 +41,7 @@ typedef struct {
 int64_t start_time;
 
 AVRational pts;
-double ts_unit;
+AVRational ts_unit;
 int out_cnt;
 int occupied;
 
@@ -164,7 +164,7 @@ static int config_output(AVFilterLink *outlink)
 av_log(ctx, AV_LOG_VERBOSE, "TB: %d/%d -> %d/%d\n",
inlink->time_base.num, inlink->time_base.den, 
outlink->time_base.num, outlink->time_base.den);
 
-s->ts_unit = av_q2d(av_inv_q(av_mul_q(fps, outlink->time_base)));
+s->ts_unit = av_inv_q(av_mul_q(fps, outlink->time_base));
 
 return 0;
 }
@@ -243,7 +243,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*inpicref)
 
 av_frame_copy_props(frame, inpicref);
 frame->pts = ((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time) +
- outlink->frame_count * s->ts_unit;
+ av_rescale(outlink->frame_count, s->ts_unit.num,
+s->ts_unit.den);
 ret = ff_filter_frame(outlink, frame);
 }
 av_frame_free(&inpicref);
-- 
1.9.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavfi: add inverse telecine filter

2015-03-27 Thread Himangi Saraogi
---
 Changelog   |   1 +
 doc/filters.texi|  27 
 libavfilter/Makefile|   1 +
 libavfilter/allfilters.c|   1 +
 libavfilter/vf_detelecine.c | 346 
 5 files changed, 376 insertions(+)
 create mode 100644 libavfilter/vf_detelecine.c

diff --git a/Changelog b/Changelog
index b0d0414..81c6eab 100644
--- a/Changelog
+++ b/Changelog
@@ -9,6 +9,7 @@ version :
 - libdcadec wrapper
 - Drop support for nvenc API before 5.0
 - nvenc H265 encoder
+- Detelecine filter
 
 
 version 2.6:
diff --git a/doc/filters.texi b/doc/filters.texi
index f2999f2..15f8ed5 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3728,6 +3728,33 @@ FFmpeg was configured with @code{--enable-opencl}. 
Default value is 0.
 
 @end table
 
+@section detelecine
+
+Apply an exact inverse of the telecine operation. It requires a predefined
+pattern specified using the pattern option which must be the same as that 
passed
+to the telecine filter.
+
+This filter accepts the following options:
+
+@table @option
+@item first_field
+@table @samp
+@item top, t
+top field first
+@item bottom, b
+bottom field first
+The default value is @code{top}.
+@end table
+
+@item pattern
+A string of numbers representing the pulldown pattern you wish to apply.
+The default value is @code{23}.
+
+@item start_frame
+A number representing position of the first frame with respect to the telecine
+pattern. This is to be used if the stream is cut. The default value is 
@code{0}.
+@end table
+
 @section drawbox
 
 Draw a colored box on the input image.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 2cde029..73e7adf 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -112,6 +112,7 @@ OBJS-$(CONFIG_DECIMATE_FILTER)   += 
vf_decimate.o
 OBJS-$(CONFIG_DEJUDDER_FILTER)   += vf_dejudder.o
 OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
 OBJS-$(CONFIG_DESHAKE_FILTER)+= vf_deshake.o
+OBJS-$(CONFIG_DETELECINE_FILTER) += vf_detelecine.o
 OBJS-$(CONFIG_DRAWBOX_FILTER)+= vf_drawbox.o
 OBJS-$(CONFIG_DRAWGRID_FILTER)   += vf_drawbox.o
 OBJS-$(CONFIG_DRAWTEXT_FILTER)   += vf_drawtext.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 0288082..6bc01c5 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -128,6 +128,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(DEJUDDER,   dejudder,   vf);
 REGISTER_FILTER(DELOGO, delogo, vf);
 REGISTER_FILTER(DESHAKE,deshake,vf);
+REGISTER_FILTER(DETELECINE, detelecine, vf);
 REGISTER_FILTER(DRAWBOX,drawbox,vf);
 REGISTER_FILTER(DRAWGRID,   drawgrid,   vf);
 REGISTER_FILTER(DRAWTEXT,   drawtext,   vf);
diff --git a/libavfilter/vf_detelecine.c b/libavfilter/vf_detelecine.c
new file mode 100644
index 000..218a8c8
--- /dev/null
+++ b/libavfilter/vf_detelecine.c
@@ -0,0 +1,346 @@
+/*
+ * Copyright (c) 2015 Himangi Saraogi 
+ *
+ * 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
+ */
+
+/**
+ * @file detelecine filter.
+ */
+
+
+#include "libavutil/avstring.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
+
+typedef struct {
+const AVClass *class;
+int first_field;
+char *pattern;
+int start_frame;
+unsigned int pattern_pos;
+unsigned int nskip_fields;
+int64_t start_time;
+
+AVRational pts;
+AVRational ts_unit;
+int occupied;
+
+int nb_planes;
+int planeheight[4];
+int stride[4];
+
+AVFrame *frame;
+AVFrame *temp;
+} DetelecineContext;
+
+#define OFFSET(x) offsetof(DetelecineContext, x)
+#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
+
+static const AVOption detelecine_options[] = {
+{"first_field", "select first field", OFFSET(first_field), 
AV_OPT_TYPE_INT,   {.i64=0}, 0, 1, FLAGS, "field"},
+{"top","select top field first",0, 
AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "field"},
+{"t",  "select top field first", 

Re: [FFmpeg-devel] [PATCH] lavf: add zip protocol

2015-03-27 Thread Nicolas George
Le septidi 7 germinal, an CCXXIII, Lukasz Marek a écrit :
> TODO: add doc, update doc/APIChanges, bump minor

This is interesting, but the use case must be considered very carefully,
there are tons of things that can be done with a zip file, even relevant to
FFmpeg:

- demux a bunch of images as a kind of image2 stream;

- present an archive of font files as attachments (with the patch I have not
  yet pushed to MPlayer, that means you could use them directly);

- read several files in parallel (with split audio and video for example;
  does the zip format allow interleaving);

- etc.

> +{"file_index", "set file index", OFFSET(file_index), AV_OPT_TYPE_INT, 
> {.i64 = 0}, -1, INT_MAX, D|E },

That is not very user-friendly.

Regards,

-- 
  Nicolas George
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] libavformat/mxfenc: add support for muxing mxf opatom audio

2015-03-27 Thread Tomas Härdin
On Wed, 2015-03-25 at 15:43 -0700, Mark Reid wrote:
> On Mar 24, 2015 7:05 AM, "Tomas Härdin"  wrote:
> >
> > On Sat, 2015-03-21 at 16:45 -0700, Mark Reid wrote:
> > > ---
> > >  libavformat/mxfenc.c | 100
> ++-
> > >  1 file changed, 83 insertions(+), 17 deletions(-)
> >
> > Looks fine as far as I can tell. My only nitpick is that it might be
> > better to call "timecode rate" EditRate or "edit rate" instead, since
> > that is MXF parlance. Perhaps a bit bikeshed-y though. Does anyone else
> > have any preference?
> >
> 
> I was going to originally go with audio_edit_rate, I think its in line with
> the mxf terminology too. So I'll submit a new patch changing it.

Ah, alright

> > An aside: would it ever make sense to use EditRate different from fps,
> > to force a certain rate? Something tells me there's a video filter or
> > something to do that already, so perhaps not an issue.
> >
> > /Tomas
> >
> 
> It might, but I'm not sure, I think avid mxf might use 30fps timecode on
> 24fps footage if using pulldown or vice versa. I'll take a look. In which
> case, even this audio case, maybe the edit_rate of the timecode should be
> export as metadata so a decoding application could know what it is?

I think we can save that for when we know it's needed by some
application.

/Tomas

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_telecine: Avoid floating point values

2015-03-27 Thread Michael Niedermayer
On Fri, Mar 27, 2015 at 07:35:12PM +0530, Himangi Saraogi wrote:
> ---
>  libavfilter/vf_telecine.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)

applied

thanks

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

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf: add zip protocol

2015-03-27 Thread Lukasz Marek

On 27.03.2015 15:49, Nicolas George wrote:

Le septidi 7 germinal, an CCXXIII, Lukasz Marek a écrit :

TODO: add doc, update doc/APIChanges, bump minor


This is interesting, but the use case must be considered very carefully,
there are tons of things that can be done with a zip file, even relevant to
FFmpeg:

- demux a bunch of images as a kind of image2 stream;

- present an archive of font files as attachments (with the patch I have not
   yet pushed to MPlayer, that means you could use them directly);

- read several files in parallel (with split audio and video for example;
   does the zip format allow interleaving);

- etc.


Hi Nicolas, I missed you comment my patches :)
But, this time I dont understand you comments, could you elaborate it?
What's wrong, what can I do?




+{"file_index", "set file index", OFFSET(file_index), AV_OPT_TYPE_INT, 
{.i64 = 0}, -1, INT_MAX, D|E },


That is not very user-friendly.


I think you misunderstood this. There is no doc, but reading files by 
index is a fallback when user doesn't specify file explicitly. For example:


./ffplay zip://zipfile.zip/aaa.avi
will provide aaa.avi file from zipfile.zip

./ffplay zip://zipfile.zip
will provide first file (with index 0) in zip file

./ffplay -file_index n zip://zipfile.zip
will provide n + 1 (with index n) file in zip file

this might be helpful when user know there is only one file in zip 
archive. Yes, it must be documented. Probably it can be even better to 
allow provide whitelist/blacklist for filenames.






___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 4/4] lavf/libsmbclient: implement directory listing callbacks

2015-03-27 Thread Lukasz Marek

On 26.03.2015 01:25, Mariusz Szczepańczyk wrote:

---
  libavformat/libsmbclient.c | 93 ++
  1 file changed, 93 insertions(+)


[...]


+switch (dirent->smbc_type) {
+case SMBC_DIR:
+entry->type = AVIO_ENTRY_DIRECTORY;
+break;
+case SMBC_FILE:
+entry->type = AVIO_ENTRY_FILE;
+break;
+default:
+/* TODO: Find out what other types stand for and their correct
+ * mappings. Probably some of them should be skipped. */
+entry->type = AVIO_ENTRY_UNKNOWN;
+break;
+}


Before it is merged it should handle:
SMBC_WORKGROUP, SMBC_SERVER, SMBC_FILE_SHARE

This implicates that AVIODirEntryType has to be extended and 
doc/examples/avio_list_dir.c from second patch as well,


It im not sure how to handle
SMBC_PRINTER_SHARE, SMBC_COMMS_SHARE, SMBC_IPC_SHARE
It can be set as unknown, it can be not listed at all, or also specific 
enums can be added. Printers are not relevant to ffmpeg at all.


Patch itself is ok, but it is not complete.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 4/4] lavf/libsmbclient: implement directory listing callbacks

2015-03-27 Thread Mariusz Szczepańczyk
On Fri, Mar 27, 2015 at 4:33 PM, Lukasz Marek 
wrote:

> On 26.03.2015 01:25, Mariusz Szczepańczyk wrote:
>
>> ---
>>   libavformat/libsmbclient.c | 93 ++
>> 
>>   1 file changed, 93 insertions(+)
>>
>
> [...]
>
>  +switch (dirent->smbc_type) {
>> +case SMBC_DIR:
>> +entry->type = AVIO_ENTRY_DIRECTORY;
>> +break;
>> +case SMBC_FILE:
>> +entry->type = AVIO_ENTRY_FILE;
>> +break;
>> +default:
>> +/* TODO: Find out what other types stand for and their correct
>> + * mappings. Probably some of them should be skipped. */
>> +entry->type = AVIO_ENTRY_UNKNOWN;
>> +break;
>> +}
>>
>
> Before it is merged it should handle:
> SMBC_WORKGROUP, SMBC_SERVER, SMBC_FILE_SHARE
>
> This implicates that AVIODirEntryType has to be extended and
> doc/examples/avio_list_dir.c from second patch as well,
>
> It im not sure how to handle
> SMBC_PRINTER_SHARE, SMBC_COMMS_SHARE, SMBC_IPC_SHARE
> It can be set as unknown, it can be not listed at all, or also specific
> enums can be added. Printers are not relevant to ffmpeg at all.
>
> Patch itself is ok, but it is not complete.
>

Yes, you're completely right. Unfortunately these types are not greatly
documented by libsmbclient and I had a hard time making my samba server
serve some of them for testing so for now I left it as is. I'll fix it
within a next few days.

Regards,
Mariusz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec[/format]/webpenc: use WebPAnimEncoder API to generate animated WebP

2015-03-27 Thread Pascal Massimino
Michael,

On Fri, Mar 27, 2015 at 1:37 PM, Michael Niedermayer 
wrote:

> On Fri, Mar 27, 2015 at 11:02:09AM +0100, Pascal Massimino wrote:
> > Hi,
> >
> > $subject
> >
> > $attached says:
> > 
> > This API is available at head (MUX_ABI_VERSION >= 0x0104), is stable,
> >  and will be made official in future release.
> > For compatibility, the previous code is left as fallback.
> >
> > Dont' forget to use --enable-libwebp as ./configure option.
> >
> > This new code handles video, so that something like
> >ffmpeg -i video.mp4 -y anim.webp
> > should just work.
> >
> > -loop option is also supported.
> > 
> >
> > Comments welcome!
> > skal/
>
> breaks build if libwebp* is unavailable
> make
> CC  libavformat/webpenc.o
> /home/michael/ffmpeg-git/ffmpeg/libavformat/webpenc.c:27:25: fatal error:
> webp/encode.h: No such file or directory
>

oh indeed. What would you recommend as #ifdef protection? Do we need a new
#define?


>
> >  configure   |4
> >  libavcodec/libwebpenc.c |  399
> 
> >  libavformat/webpenc.c   |   41 
> >  3 files changed, 281 insertions(+), 163 deletions(-)
> > 20e2236a5a357c8509446cf3bf79ce22457132e5
> 0001-use-WebPAnimEncoder-API-to-generate-animated.patch
> > From dcad4a82df4d0e63f187e51c858038ea4508e4b6 Mon Sep 17 00:00:00 2001
> > From: Urvang Joshi 
> > Date: Fri, 27 Mar 2015 10:42:57 +0100
> > Subject: [PATCH] use WebPAnimEncoder API to generate animated WebP
> >
> > This API is available at head (MUX_ABI_VERSION >= 0x0104), is stable,
> >  and will be made official in future release.
> > For compatibility, the previous code is left as fallback.
> >
> > Dont' forget to use --enable-libwebp as ./configure option.
> >
>
> > This new code handles video, so that something like
> >ffmpeg -i video.mp4 -y anim.webp
> > should just work.
>
> doesnt that already work before the patch ?
>

indeed, the remark is misleading. I meant: it just work like before
(but it's just that using WebPAnimEncoder alternative offers more
flexibility -now or in the future-).



>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> No human being will ever know the Truth, for even if they happen to say it
> by chance, they would not even known they had done so. -- Xenophanes
>
> ___
> 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] lavfi: add inverse telecine filter

2015-03-27 Thread Paul B Mahol
Dana 27. 3. 2015. 15:07 osoba "Himangi Saraogi" 
napisala je:
>
> ---
>  Changelog   |   1 +
>  doc/filters.texi|  27 
>  libavfilter/Makefile|   1 +
>  libavfilter/allfilters.c|   1 +
>  libavfilter/vf_detelecine.c | 346

>  5 files changed, 376 insertions(+)
>  create mode 100644 libavfilter/vf_detelecine.c
>

This looks like derivate of telecine filter.

> diff --git a/Changelog b/Changelog
> index b0d0414..81c6eab 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -9,6 +9,7 @@ version :
>  - libdcadec wrapper
>  - Drop support for nvenc API before 5.0
>  - nvenc H265 encoder
> +- Detelec
>
>  version 2.6:
> diff --git a/doc/filters.texi b/doc/filters.texi
> index f2999f2..15f8ed5 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -3728,6 +3728,33 @@ FFmpeg was configured with @code{--enable-opencl}.
Default value is 0.
>
>  @end table
>
> +@section detelecine
> +
> +Apply an exact inverse of the telecine operation. It requires a
predefined
> +pattern specified using the pattern option which must be the same as
that passed
> +to the telecine filter.
> +
> +This filter accepts the following options:
> +
> +@table @option
> +@item first_field
> +@table @samp
> +@item top, t
> +top field first
> +@item bottom, b
> +bottom field first
> +The default value is @code{top}.
> +@end table
> +
> +@item pattern
> +A string of numbers representing the pulldown pattern you wish to apply.
> +The default value is @code{23}.
> +
> +@item start_frame
> +A number representing position of the first frame with respect to the
telecine
> +pattern. This is to be used if the stream is cut. The default value is
@code{0}.
> +@end table
> +
>  @section drawbox
>
>  Draw a colored box on the input image.
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 2cde029..73e7adf 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -112,6 +112,7 @@ OBJS-$(CONFIG_DECIMATE_FILTER)   +=
vf_decimate.o
>  OBJS-$(CONFIG_DEJUDDER_FILTER)   += vf_dejudder.o
>  OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
>  OBJS-$(CONFIG_DESHAKE_FILTER)+= vf_deshake.o
> +OBJS-$(CONFIG_DETELECINE_FILTER) += vf_detelecine.o
>  OBJS-$(CONFIG_DRAWBOX_FILTER)+= vf_drawbox.o
>  OBJS-$(CONFIG_DRAWGRID_FILTER)   += vf_drawbox.o
>  OBJS-$(CONFIG_DRAWTEXT_FILTER)   += vf_drawtext.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index 0288082..6bc01c5 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -128,6 +128,7 @@ void avfilter_register_all(void)
>  REGISTER_FILTER(DEJUDDER,   dejudder,   vf);
>  REGISTER_FILTER(DELOGO, delogo, vf);
>  REGISTER_FILTER(DESHAKE,deshake,vf);
> +REGISTER_FILTER(DETELECINE, detelecine, vf);
>  REGISTER_FILTER(DRAWBOX,drawbox,vf);
>  REGISTER_FILTER(DRAWGRID,   drawgrid,   vf);
>  REGISTER_FILTER(DRAWTEXT,   drawtext,   vf);
> diff --git a/libavfilter/vf_detelecine.c b/libavfilter/vf_detelecine.c
> new file mode 100644
> index 000..218a8c8
> --- /dev/null
> +++ b/libavfilter/vf_detelecine.c
> @@ -0,0 +1,346 @@
> +/*
> + * Copyright (c) 2015 Himangi Saraogi 
> + *
> + * 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
> + */
> +
> +/**
> + * @file detelecine filter.
> + */
> +
> +
> +#include "libavutil/avstring.h"
> +#include "libavutil/imgutils.h"
> +#include "libavutil/opt.h"
> +#include "libavutil/pixdesc.h"
> +#include "avfilter.h"
> +#include "formats.h"
> +#include "internal.h"
> +#include "video.h"
> +
> +typedef struct {
> +const AVClass *class;
> +int first_field;
> +char *pattern;
> +int start_frame;
> +unsigned int pattern_pos;
> +unsigned int nskip_fields;
> +int64_t start_time;
> +
> +AVRational pts;
> +AVRational ts_unit;
> +int occupied;
> +
> +int nb_planes;
> +int planeheight[4];
> +int stride[4];
> +
> +AVFrame *frame;
> +AVFrame *temp;
> +} DetelecineContext;
> +
> +#define OFFSET(x) offsetof(DetelecineContext, x)
> +#define FLAGS AV_OPT_FLAG_FI

Re: [FFmpeg-devel] [PATCH] avcodec[/format]/webpenc: use WebPAnimEncoder API to generate animated WebP

2015-03-27 Thread Michael Niedermayer
On Fri, Mar 27, 2015 at 05:01:58PM +0100, Pascal Massimino wrote:
> Michael,
> 
> On Fri, Mar 27, 2015 at 1:37 PM, Michael Niedermayer 
> wrote:
> 
> > On Fri, Mar 27, 2015 at 11:02:09AM +0100, Pascal Massimino wrote:
> > > Hi,
> > >
> > > $subject
> > >
> > > $attached says:
> > > 
> > > This API is available at head (MUX_ABI_VERSION >= 0x0104), is stable,
> > >  and will be made official in future release.
> > > For compatibility, the previous code is left as fallback.
> > >
> > > Dont' forget to use --enable-libwebp as ./configure option.
> > >
> > > This new code handles video, so that something like
> > >ffmpeg -i video.mp4 -y anim.webp
> > > should just work.
> > >
> > > -loop option is also supported.
> > > 
> > >
> > > Comments welcome!
> > > skal/
> >
> > breaks build if libwebp* is unavailable
> > make
> > CC  libavformat/webpenc.o
> > /home/michael/ffmpeg-git/ffmpeg/libavformat/webpenc.c:27:25: fatal error:
> > webp/encode.h: No such file or directory
> >
> 
> oh indeed. What would you recommend as #ifdef protection? Do we need a new
> #define?

yes
see configure HEADERS_LIST and check_header

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

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec[/format]/webpenc: use WebPAnimEncoder API to generate animated WebP

2015-03-27 Thread James Almer
On 27/03/15 1:50 PM, Michael Niedermayer wrote:
> On Fri, Mar 27, 2015 at 05:01:58PM +0100, Pascal Massimino wrote:
>> Michael,
>>
>> On Fri, Mar 27, 2015 at 1:37 PM, Michael Niedermayer 
>> wrote:
>>
>>> On Fri, Mar 27, 2015 at 11:02:09AM +0100, Pascal Massimino wrote:
 Hi,

 $subject

 $attached says:
 
 This API is available at head (MUX_ABI_VERSION >= 0x0104), is stable,
  and will be made official in future release.
 For compatibility, the previous code is left as fallback.

 Dont' forget to use --enable-libwebp as ./configure option.

 This new code handles video, so that something like
ffmpeg -i video.mp4 -y anim.webp
 should just work.

 -loop option is also supported.
 

 Comments welcome!
 skal/
>>>
>>> breaks build if libwebp* is unavailable
>>> make
>>> CC  libavformat/webpenc.o
>>> /home/michael/ffmpeg-git/ffmpeg/libavformat/webpenc.c:27:25: fatal error:
>>> webp/encode.h: No such file or directory
>>>
>>
>> oh indeed. What would you recommend as #ifdef protection? Do we need a new
>> #define?
> 
> yes
> see configure HEADERS_LIST and check_header

CONFIG_LIBWEBP should be enough, it guarantees webp/encode.h exists. No need 
for a new header.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec[/format]/webpenc: use WebPAnimEncoder API to generate animated WebP

2015-03-27 Thread Michael Niedermayer
On Fri, Mar 27, 2015 at 01:54:31PM -0300, James Almer wrote:
> On 27/03/15 1:50 PM, Michael Niedermayer wrote:
> > On Fri, Mar 27, 2015 at 05:01:58PM +0100, Pascal Massimino wrote:
> >> Michael,
> >>
> >> On Fri, Mar 27, 2015 at 1:37 PM, Michael Niedermayer 
> >> wrote:
> >>
> >>> On Fri, Mar 27, 2015 at 11:02:09AM +0100, Pascal Massimino wrote:
>  Hi,
> 
>  $subject
> 
>  $attached says:
>  
>  This API is available at head (MUX_ABI_VERSION >= 0x0104), is stable,
>   and will be made official in future release.
>  For compatibility, the previous code is left as fallback.
> 
>  Dont' forget to use --enable-libwebp as ./configure option.
> 
>  This new code handles video, so that something like
> ffmpeg -i video.mp4 -y anim.webp
>  should just work.
> 
>  -loop option is also supported.
>  
> 
>  Comments welcome!
>  skal/
> >>>
> >>> breaks build if libwebp* is unavailable
> >>> make
> >>> CC  libavformat/webpenc.o
> >>> /home/michael/ffmpeg-git/ffmpeg/libavformat/webpenc.c:27:25: fatal error:
> >>> webp/encode.h: No such file or directory
> >>>
> >>
> >> oh indeed. What would you recommend as #ifdef protection? Do we need a new
> >> #define?
> > 
> > yes
> > see configure HEADERS_LIST and check_header
> 
> CONFIG_LIBWEBP should be enough, it guarantees webp/encode.h exists. No need 
> for a new header.

yes indeed

-- 
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] Fwd: GSoC: APNG

2015-03-27 Thread Paul B Mahol
On 3/24/15, Donny Yang  wrote:
> On 24 March 2015 at 10:45, Michael Niedermayer  wrote:
>
>> the code already buffers the first frame and writes it in the
>> trailer function so by the time the frame is actually written its
>> known if its a single frame or multi frame file and the single frame
>> case could use syntax identical to PNG
>>
> Okay, I've updated the patches to do this
>
>
>> or is there some reason why a single image should be stored as APNG?
>>
> I don't believe so, other than testing an APNG implementation I suppose,
> because the standard allows single frame APNGs
>
>

The style of code inside patch do not match other files in codebase,
look at style of other files inside codebase.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/4] lavf: add directory listing API

2015-03-27 Thread Michael Niedermayer
On Thu, Mar 26, 2015 at 03:31:27PM +0100, Mariusz Szczepańczyk wrote:
> On Thu, Mar 26, 2015 at 2:31 PM, Michael Niedermayer 
> wrote:
> 
> > On Thu, Mar 26, 2015 at 01:25:17AM +0100, Mariusz Szczepańczyk wrote:
> > > From: Lukasz Marek 
> > >
> > > API allows protocol implementations to provide API that
> > > allows to list directory content.
> > > API is similar to POSIX opendir/readdir/closedir.
> > > ---
> > >  libavformat/avio.c | 74 +++
> > >  libavformat/avio.h | 84
> > +-
> > >  libavformat/url.c  | 16 +++
> > >  libavformat/url.h  | 10 +++
> > >  4 files changed, 183 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/libavformat/avio.c b/libavformat/avio.c
> > > index 4896782..51419cc 100644
> > > --- a/libavformat/avio.c
> > > +++ b/libavformat/avio.c
> > > @@ -23,6 +23,7 @@
> > >  #include "libavutil/dict.h"
> > >  #include "libavutil/opt.h"
> > >  #include "libavutil/time.h"
> > > +#include "libavutil/avassert.h"
> > >  #include "os_support.h"
> > >  #include "avformat.h"
> > >  #if CONFIG_NETWORK
> > > @@ -418,6 +419,79 @@ int avio_check(const char *url, int flags)
> > >  return ret;
> > >  }
> > >
> > > +int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary
> > **options)
> > > +{
> > > +URLContext *h = NULL;
> > > +AVIODirContext *ctx = NULL;
> > > +int ret;
> > > +av_assert0(s);
> > > +
> > > +ctx = av_mallocz(sizeof(*ctx));
> > > +if (!ctx) {
> > > +ret = AVERROR(ENOMEM);
> > > +goto fail;
> > > +}
> > > +
> > > +if ((ret = ffurl_alloc(&h, url, AVIO_FLAG_READ, NULL)) < 0)
> > > +goto fail;
> > > +
> > > +if (h->prot->url_open_dir && h->prot->url_read_dir &&
> > h->prot->url_close_dir) {
> > > +if (options && h->prot->priv_data_class &&
> > > +(ret = av_opt_set_dict(h->priv_data, options)) < 0)
> > > +goto fail;
> > > +ret = h->prot->url_open_dir(h);
> > > +} else
> > > +ret = AVERROR(ENOSYS);
> > > +if (ret < 0)
> > > +goto fail;
> > > +
> > > +ctx->url_context = h;
> > > +*s = ctx;
> > > +return 0;
> > > +
> > > +  fail:
> > > +av_free(ctx);
> > > +*s = NULL;
> > > +ffurl_close(h);
> > > +return ret;
> > > +}
> > > +
> >
> > > +int avio_read_dir(AVIODirContext *s, AVIODirEntry **next)
> > > +{
> > > +URLContext *h;
> > > +int ret;
> > > +
> > > +if (!s || !s->url_context)
> > > +return EINVAL;
> >
> > i assume this is intended to be AVERROR(EINVAL)
> >
> 
> Yes, of course! Fixed.
> 
> 
> >
> >
> > > +h = s->url_context;
> > > +if ((ret = h->prot->url_read_dir(h, next)) < 0)
> > > +avio_free_directory_entry(next);
> > > +return ret;
> > > +}
> > > +
> > > +int avio_close_dir(AVIODirContext **s)
> > > +{
> > > +URLContext *h;
> > > +
> > > +av_assert0(s);
> > > +if (!(*s) || !(*s)->url_context)
> > > +return EINVAL;
> >
> > same as previous
> >
> 
> ditto
> 
> 
> >
> > [...]
> >
> 
> 
> Mariusz

>  avio.c |   74 +
>  avio.h |   84 
> -
>  url.c  |   16 
>  url.h  |   10 +++
>  4 files changed, 183 insertions(+), 1 deletion(-)
> 0289391026b4d7c3d698b7b47bd18045e9f14460  
> 0001-lavf-add-directory-listing-API.patch
> From 628fa295d2710da56ba672ac0cb8502cafc27f82 Mon Sep 17 00:00:00 2001
> From: Lukasz Marek 
> Date: Sat, 5 Jul 2014 18:11:59 +0200
> Subject: [PATCH 1/4] lavf: add directory listing API
> 
> API allows protocol implementations to provide API that
> allows to list directory content.
> API is similar to POSIX opendir/readdir/closedir.
> ---
>  libavformat/avio.c | 74 +++
>  libavformat/avio.h | 84 
> +-
>  libavformat/url.c  | 16 +++
>  libavformat/url.h  | 10 +++
>  4 files changed, 183 insertions(+), 1 deletion(-)

theres no update to version.h and APIChanges but i think its
actually good to wait with these a few days so if more comments
come in we could still change the API
but please add a patch that updates them

applied this one

thanks

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

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus


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] doc/examples: add directory listing example

2015-03-27 Thread Michael Niedermayer
On Thu, Mar 26, 2015 at 01:25:18AM +0100, Mariusz Szczepańczyk wrote:
> From: Lukasz Marek 
> 
> ---
>  .gitignore   |   1 +
>  configure|   2 +
>  doc/Makefile |   1 +
>  doc/examples/Makefile|   3 +-
>  doc/examples/avio_list_dir.c | 105 
> +++
>  5 files changed, 111 insertions(+), 1 deletion(-)
>  create mode 100644 doc/examples/avio_list_dir.c
> 
> diff --git a/.gitignore b/.gitignore
> index d2088e5..71d4d64 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -36,6 +36,7 @@
>  /doc/avoptions_codec.texi
>  /doc/avoptions_format.texi
>  /doc/doxy/html/
> +/doc/examples/avio_list_dir
>  /doc/examples/avio_reading
>  /doc/examples/decoding_encoding
>  /doc/examples/demuxing_decoding
> diff --git a/configure b/configure
> index a96bfb7..cd84d2b 100755
> --- a/configure
> +++ b/configure
> @@ -1321,6 +1321,7 @@ COMPONENT_LIST="
>  
>  EXAMPLE_LIST="
>  avio_reading_example
> +avio_list_dir_example
>  decoding_encoding_example
>  demuxing_decoding_example
>  extract_mvs_example
> @@ -2653,6 +2654,7 @@ zoompan_filter_deps="swscale"
>  
>  # examples
>  avio_reading="avformat avcodec avutil"
> +avio_list_dir="avformat avutil"
>  avcodec_example_deps="avcodec avutil"
>  decoding_encoding_example_deps="avcodec avformat avutil"
>  demuxing_decoding_example_deps="avcodec avformat avutil"
> diff --git a/doc/Makefile b/doc/Makefile
> index 697142f..4573531 100644
> --- a/doc/Makefile
> +++ b/doc/Makefile
> @@ -36,6 +36,7 @@ DOCS-$(CONFIG_MANPAGES)  += $(MANPAGES)
>  DOCS-$(CONFIG_TXTPAGES)  += $(TXTPAGES)
>  DOCS = $(DOCS-yes)
>  
> +DOC_EXAMPLES-$(CONFIG_AVIO_LIST_DIR_EXAMPLE) += avio_list_dir
>  DOC_EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE)  += avio_reading
>  DOC_EXAMPLES-$(CONFIG_AVCODEC_EXAMPLE)   += avcodec
>  DOC_EXAMPLES-$(CONFIG_DECODING_ENCODING_EXAMPLE) += decoding_encoding
> diff --git a/doc/examples/Makefile b/doc/examples/Makefile
> index 9f03f04..9699f11 100644
> --- a/doc/examples/Makefile
> +++ b/doc/examples/Makefile
> @@ -11,7 +11,8 @@ CFLAGS += -Wall -g
>  CFLAGS := $(shell pkg-config --cflags $(FFMPEG_LIBS)) $(CFLAGS)
>  LDLIBS := $(shell pkg-config --libs $(FFMPEG_LIBS)) $(LDLIBS)
>  
> -EXAMPLES=   avio_reading   \
> +EXAMPLES=   avio_list_dir  \
> +avio_reading   \
>  decoding_encoding  \
>  demuxing_decoding  \
>  extract_mvs\
> diff --git a/doc/examples/avio_list_dir.c b/doc/examples/avio_list_dir.c
> new file mode 100644
> index 000..d0e8598
> --- /dev/null
> +++ b/doc/examples/avio_list_dir.c
> @@ -0,0 +1,105 @@
> +/*
> + * Copyright (c) 2014 Lukasz Marek
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a 
> copy
> + * of this software and associated documentation files (the "Software"), to 
> deal
> + * in the Software without restriction, including without limitation the 
> rights
> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> + * copies of the Software, and to permit persons to whom the Software is
> + * furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
> FROM,
> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> + * THE SOFTWARE.
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +static const char *type_string(int type)
> +{
> +switch (type) {
> +case AVIO_ENTRY_DIRECTORY:
> +return "";
> +case AVIO_ENTRY_FILE:
> +return "";
> +case AVIO_ENTRY_BLOCK_DEVICE:
> +return "";
> +case AVIO_ENTRY_CHARACTER_DEVICE:
> +return "";
> +case AVIO_ENTRY_NAMED_PIPE:
> +return "";
> +case AVIO_ENTRY_SYMBOLIC_LINK:
> +return "";
> +case AVIO_ENTRY_SOCKET:
> +return "";
> +case AVIO_ENTRY_UNKNOWN:
> +default:
> +break;
> +}
> +return "";
> +}
> +
> +int main(int argc, char *argv[])
> +{
> +const char *input_dir = NULL;
> +AVIODirEntry *entry = NULL;
> +AVIODirContext *ctx = NULL;
> +int ret;
> +char filemode[4];
> +
> +av_log_set_level(AV_LOG_DEBUG);
> +
> +if (argc != 2) {
> +fprintf(stderr, "usage: %s input_dir\n"
> +"API example program to show how to list files in director

Re: [FFmpeg-devel] [PATCH] lavfi: add inverse telecine filter

2015-03-27 Thread Himangi Saraogi
On 27 March 2015 at 22:00, Paul B Mahol  wrote:

> Dana 27. 3. 2015. 15:07 osoba "Himangi Saraogi" 
> napisala je:
> >
> > ---
> >  Changelog   |   1 +
> >  doc/filters.texi|  27 
> >  libavfilter/Makefile|   1 +
> >  libavfilter/allfilters.c|   1 +
> >  libavfilter/vf_detelecine.c | 346
> 
> >  5 files changed, 376 insertions(+)
> >  create mode 100644 libavfilter/vf_detelecine.c
> >
>
> This looks like derivate of telecine filter.
>
>
It performs an exact inverse of the telecine operation.

Thanks,
Himangi


> > diff --git a/Changelog b/Changelog
> > index b0d0414..81c6eab 100644
> > --- a/Changelog
> > +++ b/Changelog
> > @@ -9,6 +9,7 @@ version :
> >  - libdcadec wrapper
> >  - Drop support for nvenc API before 5.0
> >  - nvenc H265 encoder
> > +- Detelec
> >
> >  version 2.6:
> > diff --git a/doc/filters.texi b/doc/filters.texi
> > index f2999f2..15f8ed5 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -3728,6 +3728,33 @@ FFmpeg was configured with @code{--enable-opencl}.
> Default value is 0.
> >
> >  @end table
> >
> > +@section detelecine
> > +
> > +Apply an exact inverse of the telecine operation. It requires a
> predefined
> > +pattern specified using the pattern option which must be the same as
> that passed
> > +to the telecine filter.
> > +
> > +This filter accepts the following options:
> > +
> > +@table @option
> > +@item first_field
> > +@table @samp
> > +@item top, t
> > +top field first
> > +@item bottom, b
> > +bottom field first
> > +The default value is @code{top}.
> > +@end table
> > +
> > +@item pattern
> > +A string of numbers representing the pulldown pattern you wish to apply.
> > +The default value is @code{23}.
> > +
> > +@item start_frame
> > +A number representing position of the first frame with respect to the
> telecine
> > +pattern. This is to be used if the stream is cut. The default value is
> @code{0}.
> > +@end table
> > +
> >  @section drawbox
> >
> >  Draw a colored box on the input image.
> > diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> > index 2cde029..73e7adf 100644
> > --- a/libavfilter/Makefile
> > +++ b/libavfilter/Makefile
> > @@ -112,6 +112,7 @@ OBJS-$(CONFIG_DECIMATE_FILTER)   +=
> vf_decimate.o
> >  OBJS-$(CONFIG_DEJUDDER_FILTER)   += vf_dejudder.o
> >  OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
> >  OBJS-$(CONFIG_DESHAKE_FILTER)+= vf_deshake.o
> > +OBJS-$(CONFIG_DETELECINE_FILTER) += vf_detelecine.o
> >  OBJS-$(CONFIG_DRAWBOX_FILTER)+= vf_drawbox.o
> >  OBJS-$(CONFIG_DRAWGRID_FILTER)   += vf_drawbox.o
> >  OBJS-$(CONFIG_DRAWTEXT_FILTER)   += vf_drawtext.o
> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> > index 0288082..6bc01c5 100644
> > --- a/libavfilter/allfilters.c
> > +++ b/libavfilter/allfilters.c
> > @@ -128,6 +128,7 @@ void avfilter_register_all(void)
> >  REGISTER_FILTER(DEJUDDER,   dejudder,   vf);
> >  REGISTER_FILTER(DELOGO, delogo, vf);
> >  REGISTER_FILTER(DESHAKE,deshake,vf);
> > +REGISTER_FILTER(DETELECINE, detelecine, vf);
> >  REGISTER_FILTER(DRAWBOX,drawbox,vf);
> >  REGISTER_FILTER(DRAWGRID,   drawgrid,   vf);
> >  REGISTER_FILTER(DRAWTEXT,   drawtext,   vf);
> > diff --git a/libavfilter/vf_detelecine.c b/libavfilter/vf_detelecine.c
> > new file mode 100644
> > index 000..218a8c8
> > --- /dev/null
> > +++ b/libavfilter/vf_detelecine.c
> > @@ -0,0 +1,346 @@
> > +/*
> > + * Copyright (c) 2015 Himangi Saraogi 
> > + *
> > + * 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
> > + */
> > +
> > +/**
> > + * @file detelecine filter.
> > + */
> > +
> > +
> > +#include "libavutil/avstring.h"
> > +#include "libavutil/imgutils.h"
> > +#include "libavutil/opt.h"
> > +#include "libavutil/pixdesc.h"
> > +#include "avfilter.h"
> > +#include "formats.h"
> > +#include "internal.h"
> > +#include "video.h"
> > +
> > +typedef struct {
> > +const AVClass *class;
> > +int first_field;
> > +char *pattern;
> > +int start_frame

Re: [FFmpeg-devel] [PATCH] lavfi: add inverse telecine filter

2015-03-27 Thread Michael Niedermayer
On Fri, Mar 27, 2015 at 07:36:05PM +0530, Himangi Saraogi wrote:
> ---
>  Changelog   |   1 +
>  doc/filters.texi|  27 
>  libavfilter/Makefile|   1 +
>  libavfilter/allfilters.c|   1 +
>  libavfilter/vf_detelecine.c | 346 
> 
>  5 files changed, 376 insertions(+)
>  create mode 100644 libavfilter/vf_detelecine.c

approved by paul on IRC

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 1/7] Replaced inline asm for prefetching with prefetch macros

2015-03-27 Thread Tucker DiNapoli
From: Tucker DiNapoli 

This series of patches makes some changes to libpostproc in preperation for 
adding
sse2 and avx2 simd versions of some functions. None of the changes should effect
the library in any major way, but they are necessary for future changes.
I've tested all the patches on my machine and they all apply cleanly,
and the fate-filter-pp tests succeed after each patch. I've also tried my
best to split the patches into small changes. I have some more patches
which add the ability to process multiple blocks in each function, which
will allow the new simd versions to be substitute in without any additional
work.

This just replaces some conditionally compiled inline asm with the
conditionally defined macros from the last commit
---
 libpostproc/postprocess_template.c | 63 +-
 1 file changed, 8 insertions(+), 55 deletions(-)

diff --git a/libpostproc/postprocess_template.c 
b/libpostproc/postprocess_template.c
index 4016b08..48501fe 100644
--- a/libpostproc/postprocess_template.c
+++ b/libpostproc/postprocess_template.c
@@ -3368,34 +3368,10 @@ static void RENAME(postProcess)(const uint8_t src[], 
int srcStride, uint8_t dst[
 // finish 1 block before the next otherwise we might have a problem
 // with the L1 Cache of the P4 ... or only a few blocks at a time or 
something
 for(x=0; x>2)&6) + 5)*srcStride + 32);
-prefetchnta(srcBlock + (((x>>2)&6) + 6)*srcStride + 32);
-prefetcht0(dstBlock + (((x>>2)&6) + 5)*dstStride + 32);
-prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32);
-*/
-
-__asm__(
-"mov %4, %%"REG_a"  \n\t"
-"shr $2, %%"REG_a"  \n\t"
-"and $6, %%"REG_a"  \n\t"
-"add %5, %%"REG_a"  \n\t"
-"mov %%"REG_a", %%"REG_d"   \n\t"
-"imul %1, %%"REG_a" \n\t"
-"imul %3, %%"REG_d" \n\t"
-"prefetchnta 32(%%"REG_a", %0)  \n\t"
-"prefetcht0 32(%%"REG_d", %2)   \n\t"
-"add %1, %%"REG_a"  \n\t"
-"add %3, %%"REG_d"  \n\t"
-"prefetchnta 32(%%"REG_a", %0)  \n\t"
-"prefetcht0 32(%%"REG_d", %2)   \n\t"
-:: "r" (srcBlock), "r" ((x86_reg)srcStride), "r" (dstBlock), 
"r" ((x86_reg)dstStride),
-"g" ((x86_reg)x), "g" ((x86_reg)copyAhead)
-: "%"REG_a, "%"REG_d
-);
-#endif
+prefetchnta(srcBlock + (((x>>2)&6) + copyAhead)*srcStride + 32);
+prefetchnta(srcBlock + (((x>>2)&6) + copyAhead+1)*srcStride + 32);
+prefetcht0(dstBlock + (((x>>2)&6) + copyAhead)*dstStride + 32);
+prefetcht0(dstBlock + (((x>>2)&6) + copyAhead+1)*dstStride + 32);
 
 RENAME(blockCopy)(dstBlock + dstStride*8, dstStride,
   srcBlock + srcStride*8, srcStride, mode & 
LEVEL_FIX, &c.packedYOffset);
@@ -3474,33 +3450,10 @@ static void RENAME(postProcess)(const uint8_t src[], 
int srcStride, uint8_t dst[
 uint8_t *dstBlockStart = dstBlock;
 const uint8_t *srcBlockStart = srcBlock;
   for(; x < endx; x+=BLOCK_SIZE){
-#if TEMPLATE_PP_MMXEXT && HAVE_6REGS
-/*
-prefetchnta(srcBlock + (((x>>2)&6) + 5)*srcStride + 32);
-prefetchnta(srcBlock + (((x>>2)&6) + 6)*srcStride + 32);
-prefetcht0(dstBlock + (((x>>2)&6) + 5)*dstStride + 32);
-prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32);
-*/
-
-__asm__(
-"mov %4, %%"REG_a"  \n\t"
-"shr $2, %%"REG_a"  \n\t"
-"and $6, %%"REG_a"  \n\t"
-"add %5, %%"REG_a"  \n\t"
-"mov %%"REG_a", %%"REG_d"   \n\t"
-"imul %1, %%"REG_a" \n\t"
-"imul %3, %%"REG_d" \n\t"
-"prefetchnta 32(%%"REG_a", %0)  \n\t"
-"prefetcht0 32(%%"REG_d", %2)   \n\t"
-"add %1, %%"REG_a"  \n\t"
-"add %3, %%"REG_d"  \n\t"
-"prefetchnta 32(%%"REG_a", %0)  \n\t"
-"prefetcht0 32(%%"REG_d", %2)   \n\t"
-:: "r" (srcBlock), "r" ((x86_reg)srcStride), "r" (dstBlock), 
"r" ((x86_reg)dstStride),
-"g" ((x86_reg)x), "g" ((x86_reg)copyAhead)
-: "%"REG_a, "%"REG_d
-);
-#endif
+prefetchnta(srcBlock + (((x>>2)&6) + copyAhead)*srcStride + 32);
+prefetchnta(srcBlock + (((x>>2)&6) + copyAhead+1)*srcStride + 32);
+prefetcht0(dstBlock + (((x>>2)&6) + copyAhead)*dstStride + 32);
+prefetcht0(dstBlock + (((x>>2)&6) + copyAhead+1)*dstStride + 32);
 
 RENAME(blockCopy)(dstBlock + dstStride*copyAhead, dstStride,
 

[FFmpeg-devel] [PATCH 2/7] Removed unecessary if/else branch when getting QP.

2015-03-27 Thread Tucker DiNapoli
From: Tucker DiNapoli 

There's still an if, as QP needs to be modified if isColor=0, but it
still removes a unecessary branch.
---
 libpostproc/postprocess_template.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/libpostproc/postprocess_template.c 
b/libpostproc/postprocess_template.c
index 48501fe..6377ea7 100644
--- a/libpostproc/postprocess_template.c
+++ b/libpostproc/postprocess_template.c
@@ -3482,16 +3482,12 @@ static void RENAME(postProcess)(const uint8_t src[], 
int srcStride, uint8_t dst[
 
   for(x = startx; x < endx; x+=BLOCK_SIZE){
 const int stride= dstStride;
-
-if(isColor){
-QP= QPptr[x>>qpHShift];
-c.nonBQP= nonBQPptr[x>>qpHShift];
-}else{
-QP= QPptr[x>>4];
+QP = QPptr[x>>qpHShift];
+c.nonBQP = nonBQPptr[x>>qpHShift];
+if(!isColor){
 QP= (QP* QPCorrecture + 256*128)>>16;
-c.nonBQP= nonBQPptr[x>>4];
 c.nonBQP= (c.nonBQP* QPCorrecture + 256*128)>>16;
-yHistogram[ srcBlock[srcStride*12 + 4] ]++;
+yHistogram[srcBlock[srcStride*12 + 4]]++;
 }
 c.QP= QP;
 #if TEMPLATE_PP_MMX
-- 
2.3.3

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 4/7] Fixed some indentation in postprocess_template

2015-03-27 Thread Tucker DiNapoli
---
 libpostproc/postprocess_template.c | 189 +++--
 1 file changed, 95 insertions(+), 94 deletions(-)

diff --git a/libpostproc/postprocess_template.c 
b/libpostproc/postprocess_template.c
index 344152e..584cb4c 100644
--- a/libpostproc/postprocess_template.c
+++ b/libpostproc/postprocess_template.c
@@ -3291,14 +3291,14 @@ static void RENAME(postProcess)(const uint8_t src[], 
int srcStride, uint8_t dst[
 
 if(mode & CUBIC_IPOL_DEINT_FILTER) copyAhead=16;
 else if(   (mode & LINEAR_BLEND_DEINT_FILTER)
-|| (mode & FFMPEG_DEINT_FILTER)
-|| (mode & LOWPASS5_DEINT_FILTER)) copyAhead=14;
+   || (mode & FFMPEG_DEINT_FILTER)
+   || (mode & LOWPASS5_DEINT_FILTER)) copyAhead=14;
 else if(   (mode & V_DEBLOCK)
-|| (mode & LINEAR_IPOL_DEINT_FILTER)
-|| (mode & MEDIAN_DEINT_FILTER)
-|| (mode & V_A_DEBLOCK)) copyAhead=13;
+   || (mode & LINEAR_IPOL_DEINT_FILTER)
+   || (mode & MEDIAN_DEINT_FILTER)
+   || (mode & V_A_DEBLOCK)) copyAhead=13;
 else if(mode & V_X1_FILTER) copyAhead=11;
-//else if(mode & V_RK1_FILTER) copyAhead=10;
+//else if(mode & V_RK1_FILTER) copyAhead=10;
 else if(mode & DERING) copyAhead=9;
 else copyAhead=8;
 
@@ -3390,9 +3390,9 @@ static void RENAME(postProcess)(const uint8_t src[], int 
srcStride, uint8_t dst[
 RENAME(deInterlaceFF)(dstBlock, dstStride, c.deintTemp + x);
 else if(mode & LOWPASS5_DEINT_FILTER)
 RENAME(deInterlaceL5)(dstBlock, dstStride, c.deintTemp + x, 
c.deintTemp + width + x);
-/*  else if(mode & CUBIC_BLEND_DEINT_FILTER)
-RENAME(deInterlaceBlendCubic)(dstBlock, dstStride);
-*/
+/*  else if(mode & CUBIC_BLEND_DEINT_FILTER)
+RENAME(deInterlaceBlendCubic)(dstBlock, dstStride);
+*/
 dstBlock+=8;
 srcBlock+=8;
 }
@@ -3428,14 +3428,14 @@ static void RENAME(postProcess)(const uint8_t src[], 
int srcStride, uint8_t dst[
 
 /* duplicate last line of src to fill the void up to line 
(copyAhead+7) */
 for(i=FFMAX(height-y, 8); i= 0){
+/* check if we have a previous block to deblock it with 
dstBlock */
+if(x - 8 >= 0){
 #if TEMPLATE_PP_MMX
-if(mode & H_X1_FILTER)
+if(mode & H_X1_FILTER)
 RENAME(vertX1Filter)(tempBlock1, 16, &c);
-else if(mode & H_DEBLOCK){
-const int t= RENAME(vertClassify)(tempBlock1, 16, &c);
-if(t==1)
-RENAME(doVertLowPass)(tempBlock1, 16, &c);
-else if(t==2)
-RENAME(doVertDefFilter)(tempBlock1, 16, &c);
-}else if(mode & H_A_DEBLOCK){
+else if(mode & H_DEBLOCK){
+const int t= RENAME(vertClassify)(tempBlock1, 16, &c);
+if(t==1)
+RENAME(doVertLowPass)(tempBlock1, 16, &c);
+else if(t==2)
+RENAME(doVertDefFilter)(tempBlock1, 16, &c);
+}else if(mode & H_A_DEBLOCK){
 RENAME(do_a_deblock)(tempBlock1, 16, 1, &c, mode);
-}
+}
 
-RENAME(transpose2)(dstBlock-4, dstStride, tempBlock1 + 4*16);
+RENAME(transpose2)(dstBlock-4, dstStride, tempBlock1 + 
4*16);
 
 #else
-if(mode & H_X1_FILTER)
-horizX1Filter(dstBlock-4, stride, c.QP);
-else if(mode & H_DEBLOCK){
+if(mode & H_X1_FILTER)
+horizX1Filter(dstBlock-4, stride, c.QP);
+else if(mode & H_DEBLOCK){
 #if TEMPLATE_PP_ALTIVEC
-DECLARE_ALIGNED(16, unsigned char, tempBlock)[272];
-int t;
-transpose_16x8_char_toPackedAlign_altivec(tempBlock, 
dstBlock - (4 + 1), stride);
-
-t = vertClassify_altivec(tempBlock-48, 16, &c);
-if(t==1) {
-doVertLowPass_altivec(tempBlock-48, 16, &c);
-transpose_8x16_char_fromPackedAlign_altivec(dstBlock - 
(4 + 1), tempBlock, stride);
-}
-else if(t==2) {
-doVertDefFilter_altivec(tempBlock-48, 16, &c);
-transpose_8x16_char_fromPackedAlign_altivec(dstBlock - 
(4 + 1), tempBlock, stride);
-}
+DECLARE_ALIGNED(16, unsigned char, tempBlock)[272];
+int t;
+transpose_16x8_char_toPackedAlign_altivec(tempBlock, 
dstBlock - (4 + 1), stride);
+
+t = vertClassify_altivec(tempBlock-48, 16, &c);
+  

[FFmpeg-devel] [PATCH 5/7] Merged second and third inner loops

2015-03-27 Thread Tucker DiNapoli
---
 libpostproc/postprocess_template.c | 20 +---
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/libpostproc/postprocess_template.c 
b/libpostproc/postprocess_template.c
index 584cb4c..9096586 100644
--- a/libpostproc/postprocess_template.c
+++ b/libpostproc/postprocess_template.c
@@ -3506,6 +3506,7 @@ static void RENAME(postProcess)(const uint8_t src[], int 
srcStride, uint8_t dst[
 
 for(x = startx; x < endx; x+=BLOCK_SIZE){
 const int stride= dstStride;
+av_unused uint8_t *tmpXchg;
 //temporary while changing QP stuff to make things continue to 
work
 c.QP = c.QP_block[qp_index];
 c.nonBQP = c.nonBQP_block[qp_index];
@@ -3527,25 +3528,6 @@ static void RENAME(postProcess)(const uint8_t src[], int 
srcStride, uint8_t dst[
 RENAME(do_a_deblock)(dstBlock, stride, 1, &c, mode);
 }
 }
-
-dstBlock+=8;
-srcBlock+=8;
-}
-
-
-qp_index = 0;
-dstBlock = dstBlockStart;
-srcBlock = srcBlockStart;
-
-for(x = startx; x < endx; x+=BLOCK_SIZE){
-const int stride= dstStride;
-av_unused uint8_t *tmpXchg;
-
-
-c.QP = c.QP_block[qp_index];
-c.nonBQP = c.nonBQP_block[qp_index];
-c.pQPb = c.pQPb_block[qp_index];
-c.pQPb2 = c.pQPb2_block[qp_index++];
 #if TEMPLATE_PP_MMX
 RENAME(transpose1)(tempBlock1, tempBlock2, dstBlock, 
dstStride);
 #endif
-- 
2.3.3

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 7/7] Moved contitional inline asm into a macro to cleanup code

2015-03-27 Thread Tucker DiNapoli
From: Tucker DiNapoli 

---
 libpostproc/postprocess.c  |  2 +-
 libpostproc/postprocess_template.c | 41 --
 2 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/libpostproc/postprocess.c b/libpostproc/postprocess.c
index 9d89782..b8740db 100644
--- a/libpostproc/postprocess.c
+++ b/libpostproc/postprocess.c
@@ -117,7 +117,7 @@ const char *postproc_license(void)
 #define OPTIONS_ARRAY_SIZE 10
 #define BLOCK_SIZE 8
 #define TEMP_STRIDE 8
-//#define NUM_BLOCKS_AT_ONCE 16 //not used yet
+#define BLOCKS_PER_ITERATION 1 //1 for now to keep old code working
 
 #if ARCH_X86 && HAVE_INLINE_ASM
 DECLARE_ASM_CONST(8, uint64_t, w05)= 0x0005000500050005LL;
diff --git a/libpostproc/postprocess_template.c 
b/libpostproc/postprocess_template.c
index 794ea17..34c1cc1 100644
--- a/libpostproc/postprocess_template.c
+++ b/libpostproc/postprocess_template.c
@@ -1449,7 +1449,11 @@ DERING_CORE((%0, %1, 8),(%%REGd, %1, 
4),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,
  */
 static inline void RENAME(deInterlaceInterpolateLinear)(uint8_t src[], int 
stride)
 {
+int block_index;
+uint8_t *src_base = src;
+for(block_index=0;block_index do not touch the brightness & contrast
@@ -3175,9 +3181,10 @@ SCALED_CPY((%%REGa, %4), (%%REGa, %4, 2), (%%REGd, %5), 
(%%REGd, %5, 2))
 : "%"REG_d
 );
 #else //TEMPLATE_PP_MMX && HAVE_6REGS
-for(i=0; i<8; i++)
+for(i=0; i<8; i++){
 memcpy( &(dst[dstStride*i]),
 &(src[srcStride*i]), BLOCK_SIZE);
+}
 #endif //TEMPLATE_PP_MMX && HAVE_6REGS
 }else{
 #if TEMPLATE_PP_MMX && HAVE_6REGS
@@ -3241,7 +3248,21 @@ static inline void RENAME(duplicate)(uint8_t src[], int 
stride)
 }
 #endif
 }
-
+#undef mmx_pack_qp
+#if TEMPLATE_PP_MMX
+#define mmx_pack_qp(QP, pQP)\
+__asm__ volatile(   \
+"movd %1, %%mm7 \n\t"   \
+"packuswb %%mm7, %%mm7  \n\t" /*0, 0, 0, QP, 0, 0, 0, QP*/  \
+"packuswb %%mm7, %%mm7  \n\t" /* 0,QP, 0, QP, 0,QP, 0, QP*/ \
+"packuswb %%mm7, %%mm7  \n\t" /*QP,..., QP*/\
+"movq %%mm7, %0 \n\t"   \
+: "=m" (pQP)\
+: "r" (QP)  \
+);
+#else
+#define mmx_pack_qp(QP,pQP)
+#endif
 /**
  * Filter array of bytes (Y or U or V values)
  */
@@ -3457,17 +3478,7 @@ static void RENAME(postProcess)(const uint8_t src[], int 
srcStride, uint8_t dst[
 }
 c.QP_block[qp_index]= QP;
 c.nonBQP_block[qp_index]= nonBQP;
-#if TEMPLATE_PP_MMX
-__asm__ volatile(
-"movd %1, %%mm7 \n\t"
-"packuswb %%mm7, %%mm7  \n\t" // 0, 0, 0, QP, 0, 0, 0, QP
-"packuswb %%mm7, %%mm7  \n\t" // 0,QP, 0, QP, 0,QP, 0, QP
-"packuswb %%mm7, %%mm7  \n\t" // QP,..., QP
-"movq %%mm7, %0 \n\t"
-: "=m" (c.pQPb_block[qp_index])
-: "r" (QP)
-);
-#endif
+mmx_pack_qp(QP, c.pQPb_block[qp_index]);
 }
 qp_index = 0;
 for(; x < endx; x+=BLOCK_SIZE){
-- 
2.3.3

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 6/7] Merged first and second inner loop

2015-03-27 Thread Tucker DiNapoli
Now instead of 3 loops of 4 blocks there's only one.
Also removed some variables that became unused because of this
---
 libpostproc/postprocess_template.c | 29 +
 1 file changed, 9 insertions(+), 20 deletions(-)

diff --git a/libpostproc/postprocess_template.c 
b/libpostproc/postprocess_template.c
index 9096586..794ea17 100644
--- a/libpostproc/postprocess_template.c
+++ b/libpostproc/postprocess_template.c
@@ -3445,10 +3445,7 @@ static void RENAME(postProcess)(const uint8_t src[], int 
srcStride, uint8_t dst[
 // finish 1 block before the next otherwise we might have a problem
 // with the L1 Cache of the P4 ... or only a few blocks at a time or 
something
 for(x=0; x>qpHShift];
@@ -3472,7 +3469,16 @@ static void RENAME(postProcess)(const uint8_t src[], int 
srcStride, uint8_t dst[
 );
 #endif
 }
+qp_index = 0;
 for(; x < endx; x+=BLOCK_SIZE){
+const int stride= dstStride;
+av_unused uint8_t *tmpXchg;
+//temporary while changing QP stuff to make things continue to 
work
+c.QP = c.QP_block[qp_index];
+c.nonBQP = c.nonBQP_block[qp_index];
+c.pQPb = c.pQPb_block[qp_index];
+c.pQPb2 = c.pQPb2_block[qp_index++];
+
 prefetchnta(srcBlock + (((x>>2)&6) + copyAhead)*srcStride + 
32);
 prefetchnta(srcBlock + (((x>>2)&6) + copyAhead+1)*srcStride + 
32);
 prefetcht0(dstBlock + (((x>>2)&6) + copyAhead)*dstStride + 32);
@@ -3496,23 +3502,6 @@ static void RENAME(postProcess)(const uint8_t src[], int 
srcStride, uint8_t dst[
 /*  else if(mode & CUBIC_BLEND_DEINT_FILTER)
 RENAME(deInterlaceBlendCubic)(dstBlock, dstStride);
 */
-dstBlock+=8;
-srcBlock+=8;
-}
-
-qp_index = 0;
-dstBlock = dstBlockStart;
-srcBlock = srcBlockStart;
-
-for(x = startx; x < endx; x+=BLOCK_SIZE){
-const int stride= dstStride;
-av_unused uint8_t *tmpXchg;
-//temporary while changing QP stuff to make things continue to 
work
-c.QP = c.QP_block[qp_index];
-c.nonBQP = c.nonBQP_block[qp_index];
-c.pQPb = c.pQPb_block[qp_index];
-c.pQPb2 = c.pQPb2_block[qp_index++];
-
 /* only deblock if we have 2 blocks */
 if(y + 8 < height){
 if(mode & V_X1_FILTER)
-- 
2.3.3

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 3/7] Made QP, nonBQP, and pQPb arrays

2015-03-27 Thread Tucker DiNapoli
From: Tucker DiNapoli 

Also pulled QP initialization out of inner loop.

Added some dummy fields to PPContext to allow current code to work while
changing QP stuff.
---
 libpostproc/postprocess_internal.h |   6 ++
 libpostproc/postprocess_template.c | 138 ++---
 2 files changed, 74 insertions(+), 70 deletions(-)

diff --git a/libpostproc/postprocess_internal.h 
b/libpostproc/postprocess_internal.h
index 1ebd974..ccf862a 100644
--- a/libpostproc/postprocess_internal.h
+++ b/libpostproc/postprocess_internal.h
@@ -143,6 +143,9 @@ typedef struct PPContext{
 DECLARE_ALIGNED(8, uint64_t, pQPb);
 DECLARE_ALIGNED(8, uint64_t, pQPb2);
 
+DECLARE_ALIGNED(8, uint64_t, pQPb_block)[4];
+DECLARE_ALIGNED(8, uint64_t, pQPb2_block)[4];
+
 DECLARE_ALIGNED(8, uint64_t, mmxDcOffset)[64];
 DECLARE_ALIGNED(8, uint64_t, mmxDcThreshold)[64];
 
@@ -153,6 +156,9 @@ typedef struct PPContext{
 int QP;
 int nonBQP;
 
+QP_STORE_T QP_block[4];
+QP_STORE_T nonBQP_block[4];
+
 int frameNum;
 
 int cpuCaps;
diff --git a/libpostproc/postprocess_template.c 
b/libpostproc/postprocess_template.c
index 6377ea7..344152e 100644
--- a/libpostproc/postprocess_template.c
+++ b/libpostproc/postprocess_template.c
@@ -3416,7 +3416,7 @@ static void RENAME(postProcess)(const uint8_t src[], int 
srcStride, uint8_t dst[
 #endif
 const int8_t *QPptr= &QPs[(y>>qpVShift)*QPStride];
 int8_t *nonBQPptr= &c.nonBQPTable[(y>>qpVShift)*FFABS(QPStride)];
-int QP=0;
+int QP=0, nonBQP=0;
 /* can we mess with a 8x16 block from srcBlock/dstBlock downwards and 
1 line upwards
if not than use a temporary buffer */
 if(y+15 >= height){
@@ -3449,58 +3449,69 @@ static void RENAME(postProcess)(const uint8_t src[], 
int srcStride, uint8_t dst[
 int endx = FFMIN(width, x+32);
 uint8_t *dstBlockStart = dstBlock;
 const uint8_t *srcBlockStart = srcBlock;
-  for(; x < endx; x+=BLOCK_SIZE){
-prefetchnta(srcBlock + (((x>>2)&6) + copyAhead)*srcStride + 32);
-prefetchnta(srcBlock + (((x>>2)&6) + copyAhead+1)*srcStride + 32);
-prefetcht0(dstBlock + (((x>>2)&6) + copyAhead)*dstStride + 32);
-prefetcht0(dstBlock + (((x>>2)&6) + copyAhead+1)*dstStride + 32);
-
-RENAME(blockCopy)(dstBlock + dstStride*copyAhead, dstStride,
-  srcBlock + srcStride*copyAhead, srcStride, mode 
& LEVEL_FIX, &c.packedYOffset);
+int qp_index = 0;
+for(qp_index=0; qp_index < 4; qp_index+=1){
+QP = QPptr[(x+qp_index*8)>>qpHShift];
+nonBQP = nonBQPptr[(x+qp_index*8)>>qpHShift];
+if(!isColor){
+QP= (QP* QPCorrecture + 256*128)>>16;
+nonBQP= (nonBQP* QPCorrecture + 256*128)>>16;
+yHistogram[srcBlock[srcStride*12 + 4]]++;
+}
+c.QP_block[qp_index]= QP;
+c.nonBQP_block[qp_index]= nonBQP;
+#if TEMPLATE_PP_MMX
+__asm__ volatile(
+"movd %1, %%mm7 \n\t"
+"packuswb %%mm7, %%mm7  \n\t" // 0, 0, 0, QP, 0, 0, 0, QP
+"packuswb %%mm7, %%mm7  \n\t" // 0,QP, 0, QP, 0,QP, 0, QP
+"packuswb %%mm7, %%mm7  \n\t" // QP,..., QP
+"movq %%mm7, %0 \n\t"
+: "=m" (c.pQPb_block[qp_index])
+: "r" (QP)
+);
+#endif
+}
+for(; x < endx; x+=BLOCK_SIZE){
+prefetchnta(srcBlock + (((x>>2)&6) + copyAhead)*srcStride + 
32);
+prefetchnta(srcBlock + (((x>>2)&6) + copyAhead+1)*srcStride + 
32);
+prefetcht0(dstBlock + (((x>>2)&6) + copyAhead)*dstStride + 32);
+prefetcht0(dstBlock + (((x>>2)&6) + copyAhead+1)*dstStride + 
32);
+
+RENAME(blockCopy)(dstBlock + dstStride*copyAhead, dstStride,
+  srcBlock + srcStride*copyAhead, srcStride, 
mode & LEVEL_FIX, &c.packedYOffset);
+
+if(mode & LINEAR_IPOL_DEINT_FILTER)
+RENAME(deInterlaceInterpolateLinear)(dstBlock, dstStride);
+else if(mode & LINEAR_BLEND_DEINT_FILTER)
+RENAME(deInterlaceBlendLinear)(dstBlock, dstStride, 
c.deintTemp + x);
+else if(mode & MEDIAN_DEINT_FILTER)
+RENAME(deInterlaceMedian)(dstBlock, dstStride);
+else if(mode & CUBIC_IPOL_DEINT_FILTER)
+RENAME(deInterlaceInterpolateCubic)(dstBlock, dstStride);
+else if(mode & FFMPEG_DEINT_FILTER)
+RENAME(deInterlaceFF)(dstBlock, dstStride, c.deintTemp + 
x);
+else if(mode & LOWPASS5_DEINT_FILTER)
+RENAME(deInterlaceL5)(dstBlock, dstStride, c.deintTemp + 
x, c.deintTemp + width + x);

[FFmpeg-devel] [PATCH] libavcodec/exr.c : exr lossy compression B44 based on OpenEXR code

2015-03-27 Thread greeshma
The corrected patch is attached.
PFA

Greeshma
From 9ab93eb32d4ee7a8cacc5ce98239dd12bc75bf42 Mon Sep 17 00:00:00 2001
From: greeshmab 
Date: Tue, 24 Mar 2015 12:36:21 +0530
Subject: [PATCH] exr lossy compression B44(based on OpenEXR code)
 Signed-off-by: Greeshma 

---
 libavcodec/exr.c | 121 +++
 1 file changed, 121 insertions(+)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 6251fb7..d184fb9 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -770,6 +770,124 @@ static int piz_uncompress(EXRContext *s, const uint8_t *src, int ssize,
 return 0;
 }
 
+
+
+static void B44_unpack14 ( GetByteContext *gb, uint16_t out[16]){
+uint16_t shift;
+const uint8_t *r = gb->buffer;
+av_assert0(r[2] != 0xfc);
+out[0] = (r[0] << 8) | r[1];
+shift = (r[2] >> 2);
+out[ 1] = out[ 0] + ((r[ 5] >> 2) << shift);
+out[ 2] = out[ 1] + ((r[ 8] >> 2) << shift);
+out[ 3] = out[ 2] + ((r[11] >> 2) << shift);
+out[ 4] = out[ 0] + (((r[ 2] << 4) | (r[ 3] >> 4)) << shift);
+out[ 5] = out[ 4] + (((r[ 5] << 4) | (r[ 6] >> 4)) << shift);
+out[ 6] = out[ 5] + (((r[ 8] << 4) | (r[ 9] >> 4)) << shift);
+out[ 7] = out[ 6] + (((r[11] << 4) | (r[12] >> 4)) << shift);
+out[ 8] = out[ 4] + (((r[ 3] << 2) | (r[ 4] >> 6)) << shift);
+out[ 9] = out[ 8] + (((r[ 6] << 2) | (r[ 7] >> 6)) << shift);
+out[10] = out[ 9] + (((r[ 9] << 2) | (r[10] >> 6)) << shift);
+out[11] = out[10] + (((r[12] << 2) | (r[13] >> 6)) << shift);
+out[12] = out[ 8] + (r[ 4]  << shift);
+out[13] = out[12] + (r[ 7]  << shift);
+out[14] = out[13] + (r[10]  << shift);
+out[15] = out[14] + (r[13]  << shift);
+for (int i = 0; i < 16; ++i) {  //if any out value exceeds 16bits
+if (out[i] & 0x8000)
+out[i] &= 0x7fff;
+else
+out[i] = ~out[i];
+}
+}
+
+
+static void B44_unpack3 ( GetByteContext *gb, uint16_t out[16]){
+const uint8_t *r = gb->buffer;   //pixels have the same value
+av_assert0(r[2] == 0xfc);
+out[0] = (r[0] << 8) | r[1];
+if (out[0] & 0x8000)
+out[0] &= 0x7fff;
+else
+out[0] = ~out[0];
+for (int i = 1; i < 16; ++i)
+out[i] = out[0];
+}
+
+
+
+static int b44_uncompress(EXRContext *s, const uint8_t *src,int ssize, int dsize, EXRThreadData *td)
+
+{
+GetByteContext gb;
+unsigned long  dest_len = dsize;
+uint8_t *out;
+int i, j;
+uint16_t *tmp = (uint16_t *)td->tmp;
+out = td->uncompressed_data;
+bytestream2_init(&gb, src, ssize);
+if (uncompress(td->tmp, &dest_len, src, ssize) != Z_OK || dest_len != dsize)
+return AVERROR_INVALIDDATA;
+for (i = 0; i < s->nb_channels; i++) {
+EXRChannel *channel = &s->channels[i];
+int size = channel->pixel_type;
+int inSize = ssize;
+if (channel->pixel_type != EXR_HALF) {  // UINT or FLOAT channel.
+int n = s->xdelta * s->ydelta * size * sizeof (*tmp);
+memcpy (tmp, gb.buffer, n);
+gb.buffer += n;
+inSize -= n;
+continue;
+} else {//EXR_HALF Channel
+for (int y=0; y < s->ydelta; y +=4 ) {
+uint16_t *row0 = tmp + y * s->xdelta;
+uint16_t *row1 = row0 + s->xdelta;
+uint16_t *row2 = row1 + s->xdelta;
+uint16_t *row3 = row2 + s->xdelta;
+for (int x = 0; x < s->xdelta; x += 4) {
+uint16_t out[16];
+int num = (x + 3 < s->xdelta)? 4 * sizeof (*out) : (s->xdelta - x) * sizeof (*out);
+if (gb.buffer[2] == 0xfc) {
+B44_unpack3 (&gb, out);
+gb.buffer += 3;
+inSize -= 3;
+} else {
+B44_unpack14 (&gb, out);
+gb.buffer += 14;
+inSize -= 14;
+}
+if (y + 3 < s->ydelta) {
+memcpy (row0, &out[ 0], num);
+memcpy (row1, &out[ 4], num);
+memcpy (row2, &out[ 8], num);
+memcpy (row3, &out[12], num);
+} else {
+memcpy (row0, &out[ 0], num);
+if (y + 1 < s->ydelta)
+memcpy (row1, &out[ 4], num);
+if (y + 2 < s->ydelta)
+memcpy (row2, &out[ 8], num);
+}
+row0 += 4;
+row1 += 4;
+row2 += 4;
+row3 += 4;
+}
+}
+}
+}
+for (i = 0; i < s->ysize; i++) {
+for (j = 0; j < s->nb_channels; j++) {
+uint16_t *in = tmp + j * s->xdelta * s->ysize + i *

Re: [FFmpeg-devel] [PATCH] lavf/avisynth: fix compilation, remove bundled headers

2015-03-27 Thread Stephen Hutchinson
On Thu, Mar 26, 2015 at 2:31 PM, Roger Pack  wrote:
> If I install AviSynth 2.60 32-bit then use 32 bit ffmpeg.exe, I am
> able to consume a file like this:
>
> Version()
> So at least it's not totally broken for me here., I think.
> GL!
> -roger-

I tested yesterday afternoon with 64-bit AviSynth+ r1825,
Zeranoe's then-latest Win64 static build of FFmpeg, and
64-bit Wine 1.7.38.  It worked fine.  So it's clearly not
broken at all.  So my money's on either a faulty AviSynth+
install, or mismatched bittages.

If it's still an issue after attempting to clear anything like
that up, send the discussion to ffmpeg-user or one of the
support fora.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/7] Replaced inline asm for prefetching with prefetch macros

2015-03-27 Thread Michael Niedermayer
On Fri, Mar 27, 2015 at 04:51:42PM -0400, Tucker DiNapoli wrote:
> From: Tucker DiNapoli 
> 
> This series of patches makes some changes to libpostproc in preperation for 
> adding
> sse2 and avx2 simd versions of some functions. None of the changes should 
> effect
> the library in any major way, but they are necessary for future changes.
> I've tested all the patches on my machine and they all apply cleanly,
> and the fate-filter-pp tests succeed after each patch. I've also tried my
> best to split the patches into small changes. I have some more patches
> which add the ability to process multiple blocks in each function, which
> will allow the new simd versions to be substitute in without any additional
> work.
> 
> This just replaces some conditionally compiled inline asm with the
> conditionally defined macros from the last commit
> ---
>  libpostproc/postprocess_template.c | 63 
> +-
>  1 file changed, 8 insertions(+), 55 deletions(-)

breaks build on non x86
./configure --arch=generic --enable-gpl
make -j12
...
CC  libpostproc/postprocess.o
In file included from libpostproc/postprocess.c:558:0:
libpostproc/postprocess_template.c: In function ‘postProcess_C’:
libpostproc/postprocess_template.c:3371:13: error: implicit declaration of 
function ‘prefetchnta’ [-Werror=implicit-function-declaration]
libpostproc/postprocess_template.c:3373:13: error: implicit declaration of 
function ‘prefetcht0’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors

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

There will always be a question for which you do not know the correct answer.


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] doc/examples: add directory listing example

2015-03-27 Thread Mariusz Szczepańczyk
On Fri, Mar 27, 2015 at 7:09 PM, Michael Niedermayer 
wrote:

> On Thu, Mar 26, 2015 at 01:25:18AM +0100, Mariusz Szczepańczyk wrote:
> > From: Lukasz Marek 
> >
> > ---
> >  .gitignore   |   1 +
> >  configure|   2 +
> >  doc/Makefile |   1 +
> >  doc/examples/Makefile|   3 +-
> >  doc/examples/avio_list_dir.c | 105
> +++
> >  5 files changed, 111 insertions(+), 1 deletion(-)
> >  create mode 100644 doc/examples/avio_list_dir.c
> >
> > diff --git a/.gitignore b/.gitignore
> > index d2088e5..71d4d64 100644
> > --- a/.gitignore
> > +++ b/.gitignore
> > @@ -36,6 +36,7 @@
> >  /doc/avoptions_codec.texi
> >  /doc/avoptions_format.texi
> >  /doc/doxy/html/
> > +/doc/examples/avio_list_dir
> >  /doc/examples/avio_reading
> >  /doc/examples/decoding_encoding
> >  /doc/examples/demuxing_decoding
> > diff --git a/configure b/configure
> > index a96bfb7..cd84d2b 100755
> > --- a/configure
> > +++ b/configure
> > @@ -1321,6 +1321,7 @@ COMPONENT_LIST="
> >
> >  EXAMPLE_LIST="
> >  avio_reading_example
> > +avio_list_dir_example
> >  decoding_encoding_example
> >  demuxing_decoding_example
> >  extract_mvs_example
> > @@ -2653,6 +2654,7 @@ zoompan_filter_deps="swscale"
> >
> >  # examples
> >  avio_reading="avformat avcodec avutil"
> > +avio_list_dir="avformat avutil"
> >  avcodec_example_deps="avcodec avutil"
> >  decoding_encoding_example_deps="avcodec avformat avutil"
> >  demuxing_decoding_example_deps="avcodec avformat avutil"
> > diff --git a/doc/Makefile b/doc/Makefile
> > index 697142f..4573531 100644
> > --- a/doc/Makefile
> > +++ b/doc/Makefile
> > @@ -36,6 +36,7 @@ DOCS-$(CONFIG_MANPAGES)  += $(MANPAGES)
> >  DOCS-$(CONFIG_TXTPAGES)  += $(TXTPAGES)
> >  DOCS = $(DOCS-yes)
> >
> > +DOC_EXAMPLES-$(CONFIG_AVIO_LIST_DIR_EXAMPLE) += avio_list_dir
> >  DOC_EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE)  += avio_reading
> >  DOC_EXAMPLES-$(CONFIG_AVCODEC_EXAMPLE)   += avcodec
> >  DOC_EXAMPLES-$(CONFIG_DECODING_ENCODING_EXAMPLE) += decoding_encoding
> > diff --git a/doc/examples/Makefile b/doc/examples/Makefile
> > index 9f03f04..9699f11 100644
> > --- a/doc/examples/Makefile
> > +++ b/doc/examples/Makefile
> > @@ -11,7 +11,8 @@ CFLAGS += -Wall -g
> >  CFLAGS := $(shell pkg-config --cflags $(FFMPEG_LIBS)) $(CFLAGS)
> >  LDLIBS := $(shell pkg-config --libs $(FFMPEG_LIBS)) $(LDLIBS)
> >
> > -EXAMPLES=   avio_reading   \
> > +EXAMPLES=   avio_list_dir  \
> > +avio_reading   \
> >  decoding_encoding  \
> >  demuxing_decoding  \
> >  extract_mvs\
> > diff --git a/doc/examples/avio_list_dir.c b/doc/examples/avio_list_dir.c
> > new file mode 100644
> > index 000..d0e8598
> > --- /dev/null
> > +++ b/doc/examples/avio_list_dir.c
> > @@ -0,0 +1,105 @@
> > +/*
> > + * Copyright (c) 2014 Lukasz Marek
> > + *
> > + * Permission is hereby granted, free of charge, to any person
> obtaining a copy
> > + * of this software and associated documentation files (the
> "Software"), to deal
> > + * in the Software without restriction, including without limitation
> the rights
> > + * to use, copy, modify, merge, publish, distribute, sublicense, and/or
> sell
> > + * copies of the Software, and to permit persons to whom the Software is
> > + * furnished to do so, subject to the following conditions:
> > + *
> > + * The above copyright notice and this permission notice shall be
> included in
> > + * all copies or substantial portions of the Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
> SHALL
> > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> OTHER
> > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> ARISING FROM,
> > + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> DEALINGS IN
> > + * THE SOFTWARE.
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +
> > +static const char *type_string(int type)
> > +{
> > +switch (type) {
> > +case AVIO_ENTRY_DIRECTORY:
> > +return "";
> > +case AVIO_ENTRY_FILE:
> > +return "";
> > +case AVIO_ENTRY_BLOCK_DEVICE:
> > +return "";
> > +case AVIO_ENTRY_CHARACTER_DEVICE:
> > +return "";
> > +case AVIO_ENTRY_NAMED_PIPE:
> > +return "";
> > +case AVIO_ENTRY_SYMBOLIC_LINK:
> > +return "";
> > +case AVIO_ENTRY_SOCKET:
> > +return "";
> > +case AVIO_ENTRY_UNKNOWN:
> > +default:
> > +break;
> > +}
> > +return "";
> > +}
> > +
> > +int main(int argc, char *argv[])
> > +{
> > +const char *input_dir

Re: [FFmpeg-devel] [PATCH/TOY] zip files

2015-03-27 Thread Peter Ross
On Fri, Mar 27, 2015 at 02:55:37PM +0100, Lukasz Marek wrote:
> On 27.03.2015 14:16, Michael Niedermayer wrote:
> >On Fri, Mar 27, 2015 at 01:51:08PM +0100, Lukasz Marek wrote:
> >>On 27.03.2015 13:07, Peter Ross wrote:
> >>>---
> >>>this was created to test the idea proposed in 
> >>>https://trac.ffmpeg.org/ticket/4374
> >>>as result, i think a zip:// protocol has some problems
> >>>
> >>>- strict uri syntax can only open files in current directory
> >>>- user shouldn't have to specify the archive format. this should be 
> >>>autodetected (zip, rar, ... arj)
> >>>- want ability to grab zip files over other protocols 
> >>>'vfs:http://subtitles.org/amovie.zip:amovie.srt'
> >>>- default action to open the first inner file?
> >>
> >>We duplicated out work. I implemented it too, just wanted to add
> >>write too and have no time recently. I submitted my version in
> >>separate thread.
> >>
> >>Issue 1 and 4 are supported in my patch.
> >>Issue 2 is not the issue, it just need to be implemented, but in
> >>this case this "protocol" should be called "archive" or something.

agree.

> >>Regarding Issue 3 this is probably not possible with libzip. It
> >>allows to open archive by descriptor, so it gives possibility to get
> >>http's or ftp's handle in theory (or ffmpeg could created named pipe
> >>and push data from remote host into it), but I expect this need to
> >>be seekable. I haven't tested yet though.

most zip implementations seek to the table located at the end of the file,
although this can be avoided by scanning and jumping over each compressed
block.

The uri syntax needs to support nesting of the protocols.
If ':' were used, the uri parser would need to chomp from the beginning
and end of the uri string. However this could easily be confused

archive:http://subtitles.org:8080/amovie.zip:amovie.srt
>>> [--] << OK

archive:http://subtitles.org:8080/amovie.zip
>>> [--] <<< BAD

> >if libzip cant be used, is there something else that can be used ?
> >or can libzip be extended to not have this limitation ?

[..]

> I haven't researched deeply if there are other libs for handling zips.

Did a cursory search before selecting libzip... had hoped to find a general 
purpose
library for reading popular archive formats. Alas, none seem to exist.

The closest thing is 7-zip, but there is no 'library' interface and it is C++.
Curiously the authors have logically seperated archive file format handling 
from the
stream compression algrorithms (deflate, bzip2, etc), in much the same FFmpeg 
has
seperated avformat from avcodec.

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] af_channelmap: fix number of channels

2015-03-27 Thread Marton Balint
Fixes segfaults with the following command:

ffmpeg -f lavfi -i aevalsrc=0:c=stereo:n=1920 -af 'channelmap=0' test.ac3

Signed-off-by: Marton Balint 
---
 libavfilter/af_channelmap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c
index cc66f04..65a29f6 100644
--- a/libavfilter/af_channelmap.c
+++ b/libavfilter/af_channelmap.c
@@ -348,6 +348,7 @@ static int channelmap_filter_frame(AVFilterLink *inlink, 
AVFrame *buf)
FFMIN(FF_ARRAY_ELEMS(buf->data), nch_out) * sizeof(buf->data[0]));
 
 buf->channel_layout = outlink->channel_layout;
+buf->channels = outlink->channels;
 
 return ff_filter_frame(outlink, buf);
 }
-- 
2.1.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/7] Removed unecessary if/else branch when getting QP.

2015-03-27 Thread Timothy Gu
For all patches in this series, please use the following format as commit
message:

postproc: blah

Remember, FFmpeg has a giant code base and it is often useful to see what
part is being modified in the patch in the first word of the title.

See https://www.ffmpeg.org/developer.html#Development-Policy #3 and #9.

Timothy
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/7] Removed unecessary if/else branch when getting QP.

2015-03-27 Thread Michael Niedermayer
On Sat, Mar 28, 2015 at 12:24:29AM +, Timothy Gu wrote:
> For all patches in this series, please use the following format as commit
> message:
> 
> postproc: blah

added the prefix and applied as its easier than repostng and
reviewing again if theres no other reason to redo things

for future patches, please add the prefix though as Timothy said

thanks

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

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/7] Made QP, nonBQP, and pQPb arrays

2015-03-27 Thread Michael Niedermayer
On Fri, Mar 27, 2015 at 04:51:44PM -0400, Tucker DiNapoli wrote:
> From: Tucker DiNapoli 
> 
> Also pulled QP initialization out of inner loop.
> 
> Added some dummy fields to PPContext to allow current code to work while
> changing QP stuff.
> ---
>  libpostproc/postprocess_internal.h |   6 ++
>  libpostproc/postprocess_template.c | 138 
> ++---
>  2 files changed, 74 insertions(+), 70 deletions(-)

please dont mix indention changes with functional ones
that makes a patch quite hard to read

git show -w
 libpostproc/postprocess_internal.h |6 +++
 libpostproc/postprocess_template.c |   78 ++--
 2 files changed, 44 insertions(+), 40 deletions(-)

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

You can kill me, but you cannot change the truth.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 5/7] Merged second and third inner loops

2015-03-27 Thread Michael Niedermayer
On Fri, Mar 27, 2015 at 04:51:46PM -0400, Tucker DiNapoli wrote:
> ---
>  libpostproc/postprocess_template.c | 20 +---
>  1 file changed, 1 insertion(+), 19 deletions(-)

iam not sure how you plan to optimize the code in SSE2/AVX2
if you merge the loops again into a long chain of operations which
are applied to an area roughly 8x8

before this you have 4 8x8 blocks you can use in AVX2 or SSE2

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] Patch for High color and High bit-depth support

2015-03-27 Thread Debargha Mukherjee
-- 
Debargha Mukherjee, Ph.D.
Staff Software Engineer,
Google, Inc.
Email: debar...@google.com
Phone: 408-234-5956 (cell)
From ea4e6a0718563bc069d42e5604a9971ae71b3853 Mon Sep 17 00:00:00 2001
From: Deb Mukherjee 
Date: Wed, 25 Mar 2015 17:10:16 -0700
Subject: [PATCH] Support for VP9 high-color/high-bit-depth encoding

Note that you will need to configure libvpx with
--enable-vp9-highbitdepth before building and linking
with ffmpeg for 10-/12-bit encoding.

You may use the appropriate profile option on the
command line:
-profile:v 1 for 422/444 8-bit encoding
-profile:v 2 for 420 10-/12- bit encoding
-profile:v 3 for 422/444 10-/12-bit encoding
If you do not use the -profile:v option, it will be deduced
from the source format.
---
 libavcodec/libvpxenc.c | 100 ++---
 1 file changed, 95 insertions(+), 5 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 176c6b6..d747e1d 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -149,12 +149,19 @@ static av_cold void dump_enc_cfg(AVCodecContext *avctx,
 av_log(avctx, level, "vpx_codec_enc_cfg\n");
 av_log(avctx, level, "generic settings\n"
"  %*s%u\n  %*s%u\n  %*s%u\n  %*s%u\n  %*s%u\n"
+#if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_IMG_FMT_HIGHBITDEPTH)
+   "  %*s%u\n  %*s%u\n"
+#endif
"  %*s{%u/%u}\n  %*s%u\n  %*s%d\n  %*s%u\n",
width, "g_usage:",   cfg->g_usage,
width, "g_threads:", cfg->g_threads,
width, "g_profile:", cfg->g_profile,
width, "g_w:",   cfg->g_w,
width, "g_h:",   cfg->g_h,
+#if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_IMG_FMT_HIGHBITDEPTH)
+   width, "g_bit_depth:",   cfg->g_bit_depth,
+   width, "g_input_bit_depth:", cfg->g_input_bit_depth,
+#endif
width, "g_timebase:",cfg->g_timebase.num, cfg->g_timebase.den,
width, "g_error_resilient:", cfg->g_error_resilient,
width, "g_pass:",cfg->g_pass,
@@ -259,6 +266,59 @@ static av_cold int vp8_free(AVCodecContext *avctx)
 return 0;
 }
 
+#if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_IMG_FMT_HIGHBITDEPTH)
+static int set_pix_fmt(AVCodecContext *avctx, struct vpx_codec_enc_cfg *enccfg,
+   vpx_codec_flags_t *flags, vpx_img_fmt_t *img_fmt) {
+if (avctx->codec_id == AV_CODEC_ID_VP8 && avctx->pix_fmt != AV_PIX_FMT_YUV420P) {
+  av_log(avctx, AV_LOG_ERROR, "Can only encode YUV420P format to VP8.\n");
+  return AVERROR_INVALIDDATA;
+}
+  switch (avctx->pix_fmt) {
+case AV_PIX_FMT_YUV420P:
+enccfg->g_bit_depth = enccfg->g_input_bit_depth = 8;
+enccfg->g_profile = 0;
+*img_fmt = VPX_IMG_FMT_I420;
+return 0;
+case AV_PIX_FMT_YUV422P:
+enccfg->g_bit_depth = enccfg->g_input_bit_depth = 8;
+enccfg->g_profile = 1;
+*img_fmt = VPX_IMG_FMT_I422;
+return 0;
+case AV_PIX_FMT_YUV444P:
+enccfg->g_bit_depth = enccfg->g_input_bit_depth = 8;
+enccfg->g_profile = 1;
+*img_fmt = VPX_IMG_FMT_I444;
+return 0;
+case AV_PIX_FMT_YUV420P10LE:
+case AV_PIX_FMT_YUV420P12LE:
+enccfg->g_bit_depth = enccfg->g_input_bit_depth =
+avctx->pix_fmt == AV_PIX_FMT_YUV420P10LE ? 10 : 12;
+enccfg->g_profile = 2;
+*img_fmt = VPX_IMG_FMT_I42016;
+*flags |= VPX_CODEC_USE_HIGHBITDEPTH;
+return 0;
+case AV_PIX_FMT_YUV422P10LE:
+case AV_PIX_FMT_YUV422P12LE:
+enccfg->g_bit_depth = enccfg->g_input_bit_depth =
+avctx->pix_fmt == AV_PIX_FMT_YUV422P10LE ? 10 : 12;
+enccfg->g_profile = 3;
+*img_fmt = VPX_IMG_FMT_I42216;
+*flags |= VPX_CODEC_USE_HIGHBITDEPTH;
+return 0;
+case AV_PIX_FMT_YUV444P10LE:
+case AV_PIX_FMT_YUV444P12LE:
+enccfg->g_bit_depth = enccfg->g_input_bit_depth =
+avctx->pix_fmt == AV_PIX_FMT_YUV444P10LE ? 10 : 12;
+enccfg->g_profile = 3;
+*img_fmt = VPX_IMG_FMT_I44416;
+*flags |= VPX_CODEC_USE_HIGHBITDEPTH;
+return 0;
+default:
+return AVERROR_INVALIDDATA;
+  }
+}
+#endif
+
 static av_cold int vpx_init(AVCodecContext *avctx,
 const struct vpx_codec_iface *iface)
 {
@@ -267,6 +327,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 struct vpx_codec_enc_cfg enccfg_alpha;
 vpx_codec_flags_t flags = (avctx->flags & CODEC_FLAG_PSNR) ? VPX_CODEC_USE_PSNR : 0;
 int res;
+vpx_img_fmt_t img_fmt = VPX_IMG_FMT_I420;
 
 av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str());
 av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config());
@@ -280,6 +341,14 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 return AVERROR(EINVAL);
 }
 
+#if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_IMG_FMT_HIGHBITDEPTH)
+if (avctx->codec_id == AV_CODEC_ID_

Re: [FFmpeg-devel] [PATCH 7/7] Moved contitional inline asm into a macro to cleanup code

2015-03-27 Thread Michael Niedermayer
On Fri, Mar 27, 2015 at 04:51:48PM -0400, Tucker DiNapoli wrote:
> From: Tucker DiNapoli 
> 
> ---
>  libpostproc/postprocess.c  |  2 +-
>  libpostproc/postprocess_template.c | 41 
> --
>  2 files changed, 27 insertions(+), 16 deletions(-)

that inline asm should go away ideally not be moved around


> 
> diff --git a/libpostproc/postprocess.c b/libpostproc/postprocess.c
> index 9d89782..b8740db 100644
> --- a/libpostproc/postprocess.c
> +++ b/libpostproc/postprocess.c
> @@ -117,7 +117,7 @@ const char *postproc_license(void)
>  #define OPTIONS_ARRAY_SIZE 10
>  #define BLOCK_SIZE 8
>  #define TEMP_STRIDE 8
> -//#define NUM_BLOCKS_AT_ONCE 16 //not used yet
> +#define BLOCKS_PER_ITERATION 1 //1 for now to keep old code working
>  
>  #if ARCH_X86 && HAVE_INLINE_ASM
>  DECLARE_ASM_CONST(8, uint64_t, w05)= 0x0005000500050005LL;
> diff --git a/libpostproc/postprocess_template.c 
> b/libpostproc/postprocess_template.c
> index 794ea17..34c1cc1 100644
> --- a/libpostproc/postprocess_template.c
> +++ b/libpostproc/postprocess_template.c
> @@ -1449,7 +1449,11 @@ DERING_CORE((%0, %1, 8),(%%REGd, %1, 
> 4),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,
>   */
>  static inline void RENAME(deInterlaceInterpolateLinear)(uint8_t src[], int 
> stride)
>  {
> +int block_index;
> +uint8_t *src_base = src;
> +for(block_index=0;block_index  #if TEMPLATE_PP_MMXEXT || TEMPLATE_PP_3DNOW
> +src = src_base;
>  src+= 4*stride;
>  __asm__ volatile(
>  "lea (%0, %1), %%"REG_a"\n\t"
> @@ -1476,6 +1480,7 @@ static inline void 
> RENAME(deInterlaceInterpolateLinear)(uint8_t src[], int strid
>  );
>  #else
>  int a, b, x;
> +src = src_base;
>  src+= 4*stride;
>  
>  for(x=0; x<2; x++){
> @@ -1491,6 +1496,8 @@ static inline void 
> RENAME(deInterlaceInterpolateLinear)(uint8_t src[], int strid
>  src += 4;
>  }
>  #endif
> +  src_base += 8;
> +  }
>  }

deinterlace should be applied linewise, not blockwise if you
want to optimize it, its not a block based operation

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

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] ffmpeg_opt: Do not overwrite output if there is no input

2015-03-27 Thread Alexander Strasser
Hi all,
hi Michael!

  I have attached the solution I worked on. It is
probably inferior to yours. I honestly don't know
and didn't think to hard about it. It passes my
basic tests and fate at least.

  Just posting for completeness and maybe I will
learn something new.
 
Thank you,
  Alexander

On 2015-03-27 02:11 +0100, Michael Niedermayer wrote:
> Fixes Ticket4254
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  ffmpeg_opt.c |   15 +++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> index 39c5f49..fb7490a 100644
> --- a/ffmpeg_opt.c
> +++ b/ffmpeg_opt.c
> @@ -110,6 +110,7 @@ static int no_file_overwrite  = 0;
>  static int do_psnr= 0;
>  static int input_sync;
>  static int override_ffserver  = 0;
> +static int input_stream_potentially_available = 0;
>  
>  static void uninit_options(OptionsContext *o)
>  {
> @@ -1008,6 +1009,8 @@ static int open_input_file(OptionsContext *o, const 
> char *filename)
>  av_dict_free(&opts[i]);
>  av_freep(&opts);
>  
> +input_stream_potentially_available = 1;
> +
>  return 0;
>  }
>  
> @@ -2104,6 +2107,12 @@ loop_end:
>  }
>  }
>  
> +if (!(oc->oformat->flags & AVFMT_NOSTREAMS) && 
> !input_stream_potentially_available) {
> +av_log(NULL, AV_LOG_ERROR,
> +   "No input streams but output needs an input stream\n");
> +exit_program(1);
> +}
> +
>  if (!(oc->oformat->flags & AVFMT_NOFILE)) {
>  /* test if it already exists to avoid losing precious files */
>  assert_file_overwrite(filename);
> @@ -2608,6 +2617,9 @@ static int opt_filter_complex(void *optctx, const char 
> *opt, const char *arg)
>  filtergraphs[nb_filtergraphs - 1]->graph_desc = av_strdup(arg);
>  if (!filtergraphs[nb_filtergraphs - 1]->graph_desc)
>  return AVERROR(ENOMEM);
> +
> +input_stream_potentially_available = 1;
> +
>  return 0;
>  }
>  
> @@ -2622,6 +2634,9 @@ static int opt_filter_complex_script(void *optctx, 
> const char *opt, const char *
>  return AVERROR(ENOMEM);
>  filtergraphs[nb_filtergraphs - 1]->index  = nb_filtergraphs - 1;
>  filtergraphs[nb_filtergraphs - 1]->graph_desc = graph_desc;
> +
> +input_stream_potentially_available = 1;
> +
>  return 0;
>  }
>  
> -- 
From dbf318b0068d04fbe5d2890f6a7e376e092a8219 Mon Sep 17 00:00:00 2001
Message-Id: 

From: Alexander Strasser 
Date: Sat, 28 Mar 2015 02:55:59 +0100
Subject: [PATCH] ffmpeg: Don't overwrite output files if no inputs are
 possibly given

Fix ticket #4254

Signed-off-by: Alexander Strasser 
---
 ffmpeg.c | 5 -
 ffmpeg_opt.c | 6 ++
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 67ce1f3..e604de8 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -4027,11 +4027,6 @@ int main(int argc, char **argv)
 exit_program(1);
 }
 
-// if (nb_input_files == 0) {
-// av_log(NULL, AV_LOG_FATAL, "At least one input file must be 
specified\n");
-// exit_program(1);
-// }
-
 current_time = ti = getutime();
 if (transcode() < 0)
 exit_program(1);
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 39c5f49..fa1ffe8 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -2773,6 +2773,12 @@ int ffmpeg_parse_options(int argc, char **argv)
 goto fail;
 }
 
+if (nb_input_files == 0 && nb_filtergraphs == 0) {
+av_log(NULL, AV_LOG_FATAL, "At least one input file (or filter source) 
must be specified: ");
+   ret = AVERROR(EINVAL);
+goto fail;
+}
+
 /* open output files */
 ret = open_files(&octx.groups[GROUP_OUTFILE], "output", open_output_file);
 if (ret < 0) {
-- 


pgp_VORuDMrGO.pgp
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/4] doc/examples: add directory listing example

2015-03-27 Thread Michael Niedermayer
On Sat, Mar 28, 2015 at 12:03:15AM +0100, Mariusz Szczepańczyk wrote:
> On Fri, Mar 27, 2015 at 7:09 PM, Michael Niedermayer 
> wrote:
> 
> > On Thu, Mar 26, 2015 at 01:25:18AM +0100, Mariusz Szczepańczyk wrote:
> > > From: Lukasz Marek 
> > >
> > > ---
> > >  .gitignore   |   1 +
> > >  configure|   2 +
> > >  doc/Makefile |   1 +
> > >  doc/examples/Makefile|   3 +-
> > >  doc/examples/avio_list_dir.c | 105
> > +++
> > >  5 files changed, 111 insertions(+), 1 deletion(-)
> > >  create mode 100644 doc/examples/avio_list_dir.c
> > >
> > > diff --git a/.gitignore b/.gitignore
> > > index d2088e5..71d4d64 100644
> > > --- a/.gitignore
> > > +++ b/.gitignore
> > > @@ -36,6 +36,7 @@
> > >  /doc/avoptions_codec.texi
> > >  /doc/avoptions_format.texi
> > >  /doc/doxy/html/
> > > +/doc/examples/avio_list_dir
> > >  /doc/examples/avio_reading
> > >  /doc/examples/decoding_encoding
> > >  /doc/examples/demuxing_decoding
> > > diff --git a/configure b/configure
> > > index a96bfb7..cd84d2b 100755
> > > --- a/configure
> > > +++ b/configure
> > > @@ -1321,6 +1321,7 @@ COMPONENT_LIST="
> > >
> > >  EXAMPLE_LIST="
> > >  avio_reading_example
> > > +avio_list_dir_example
> > >  decoding_encoding_example
> > >  demuxing_decoding_example
> > >  extract_mvs_example
> > > @@ -2653,6 +2654,7 @@ zoompan_filter_deps="swscale"
> > >
> > >  # examples
> > >  avio_reading="avformat avcodec avutil"
> > > +avio_list_dir="avformat avutil"
> > >  avcodec_example_deps="avcodec avutil"
> > >  decoding_encoding_example_deps="avcodec avformat avutil"
> > >  demuxing_decoding_example_deps="avcodec avformat avutil"
> > > diff --git a/doc/Makefile b/doc/Makefile
> > > index 697142f..4573531 100644
> > > --- a/doc/Makefile
> > > +++ b/doc/Makefile
> > > @@ -36,6 +36,7 @@ DOCS-$(CONFIG_MANPAGES)  += $(MANPAGES)
> > >  DOCS-$(CONFIG_TXTPAGES)  += $(TXTPAGES)
> > >  DOCS = $(DOCS-yes)
> > >
> > > +DOC_EXAMPLES-$(CONFIG_AVIO_LIST_DIR_EXAMPLE) += avio_list_dir
> > >  DOC_EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE)  += avio_reading
> > >  DOC_EXAMPLES-$(CONFIG_AVCODEC_EXAMPLE)   += avcodec
> > >  DOC_EXAMPLES-$(CONFIG_DECODING_ENCODING_EXAMPLE) += decoding_encoding
> > > diff --git a/doc/examples/Makefile b/doc/examples/Makefile
> > > index 9f03f04..9699f11 100644
> > > --- a/doc/examples/Makefile
> > > +++ b/doc/examples/Makefile
> > > @@ -11,7 +11,8 @@ CFLAGS += -Wall -g
> > >  CFLAGS := $(shell pkg-config --cflags $(FFMPEG_LIBS)) $(CFLAGS)
> > >  LDLIBS := $(shell pkg-config --libs $(FFMPEG_LIBS)) $(LDLIBS)
> > >
> > > -EXAMPLES=   avio_reading   \
> > > +EXAMPLES=   avio_list_dir  \
> > > +avio_reading   \
> > >  decoding_encoding  \
> > >  demuxing_decoding  \
> > >  extract_mvs\
> > > diff --git a/doc/examples/avio_list_dir.c b/doc/examples/avio_list_dir.c
> > > new file mode 100644
> > > index 000..d0e8598
> > > --- /dev/null
> > > +++ b/doc/examples/avio_list_dir.c
> > > @@ -0,0 +1,105 @@
> > > +/*
> > > + * Copyright (c) 2014 Lukasz Marek
> > > + *
> > > + * Permission is hereby granted, free of charge, to any person
> > obtaining a copy
> > > + * of this software and associated documentation files (the
> > "Software"), to deal
> > > + * in the Software without restriction, including without limitation
> > the rights
> > > + * to use, copy, modify, merge, publish, distribute, sublicense, and/or
> > sell
> > > + * copies of the Software, and to permit persons to whom the Software is
> > > + * furnished to do so, subject to the following conditions:
> > > + *
> > > + * The above copyright notice and this permission notice shall be
> > included in
> > > + * all copies or substantial portions of the Software.
> > > + *
> > > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> > EXPRESS OR
> > > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> > MERCHANTABILITY,
> > > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
> > SHALL
> > > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> > OTHER
> > > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> > ARISING FROM,
> > > + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> > DEALINGS IN
> > > + * THE SOFTWARE.
> > > + */
> > > +
> > > +#include 
> > > +#include 
> > > +#include 
> > > +
> > > +static const char *type_string(int type)
> > > +{
> > > +switch (type) {
> > > +case AVIO_ENTRY_DIRECTORY:
> > > +return "";
> > > +case AVIO_ENTRY_FILE:
> > > +return "";
> > > +case AVIO_ENTRY_BLOCK_DEVICE:
> > > +return "";
> > > +case AVIO_ENTRY_CHARACTER_DEVICE:
> > > +return "";
> > > +case AVIO_ENTRY_NAMED_PIPE:
> > > + 

Re: [FFmpeg-devel] [PATCH] ffmpeg_opt: Do not overwrite output if there is no input

2015-03-27 Thread Michael Niedermayer
On Sat, Mar 28, 2015 at 03:21:17AM +0100, Alexander Strasser wrote:
> Hi all,
> hi Michael!
> 
>   I have attached the solution I worked on. It is
> probably inferior to yours. I honestly don't know
> and didn't think to hard about it. It passes my
> basic tests and fate at least.
> 
>   Just posting for completeness and maybe I will
> learn something new.

your patch breaks:
./ffmpeg -metadata a=b test.ffmeta

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] af_channelmap: fix number of channels

2015-03-27 Thread Michael Niedermayer
On Sat, Mar 28, 2015 at 01:23:40AM +0100, Marton Balint wrote:
> Fixes segfaults with the following command:
> 
> ffmpeg -f lavfi -i aevalsrc=0:c=stereo:n=1920 -af 'channelmap=0' test.ac3
> 
> Signed-off-by: Marton Balint 
> ---
>  libavfilter/af_channelmap.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c
> index cc66f04..65a29f6 100644
> --- a/libavfilter/af_channelmap.c
> +++ b/libavfilter/af_channelmap.c
> @@ -348,6 +348,7 @@ static int channelmap_filter_frame(AVFilterLink *inlink, 
> AVFrame *buf)
> FFMIN(FF_ARRAY_ELEMS(buf->data), nch_out) * sizeof(buf->data[0]));
>  
>  buf->channel_layout = outlink->channel_layout;
> +buf->channels = outlink->channels;

this should be using av_frame_set_channels()


[...]

-- 
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 for High color and High bit-depth support

2015-03-27 Thread James Zern
On Fri, Mar 27, 2015 at 6:58 PM, Debargha Mukherjee  wrote:
> [...]

> +#if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_IMG_FMT_HIGHBITDEPTH)
> +static int set_pix_fmt(AVCodecContext *avctx, struct vpx_codec_enc_cfg 
> *enccfg,
> +   vpx_codec_flags_t *flags, vpx_img_fmt_t *img_fmt) {
> +if (avctx->codec_id == AV_CODEC_ID_VP8 && avctx->pix_fmt != 
> AV_PIX_FMT_YUV420P) {
>

couldn't you just check a codec capability? what happens when vp9 is configured
with high bitdepth encoding disabled?

> +  av_log(avctx, AV_LOG_ERROR, "Can only encode YUV420P format to 
> VP8.\n");
> +  return AVERROR_INVALIDDATA;
> +}
> +  switch (avctx->pix_fmt) {
> +case AV_PIX_FMT_YUV420P:
>

indent is wrong; 4 spaces in blocks, cases aligned.

> -   if (avctx->profile != FF_PROFILE_UNKNOWN)
> -   enccfg.g_profile = avctx->profile;
> +if (avctx->profile != FF_PROFILE_UNKNOWN) {
> +enccfg.g_profile = avctx->profile;
> +}
> +
>

seems unrelated.

> @@ -709,7 +783,6 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket 
> *pkt,
>  int64_t timestamp = 0;
>  int res, coded_size;
>  vpx_enc_frame_flags_t flags = 0;
> -
>  if (frame) {
>  rawimg  = &ctx->rawimg;
>  rawimg->planes[VPX_PLANE_Y] = frame->data[0];
> @@ -744,6 +817,7 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket 
> *pkt,
>
>  res = vpx_codec_encode(&ctx->encoder, rawimg, timestamp,
> avctx->ticks_per_frame, flags, ctx->deadline);
> +
>  if (res != VPX_CODEC_OK) {
>  log_encoder_error(avctx, "Error encoding frame");
>  return AVERROR_INVALIDDATA;

same.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavcodec/exr.c : exr lossy compression B44 based on OpenEXR code

2015-03-27 Thread Michael Niedermayer
On Sat, Mar 28, 2015 at 02:33:44AM +0530, greeshma wrote:
> The corrected patch is attached.
> PFA
> 
> Greeshma

>  exr.c |  117 
> ++
>  1 file changed, 117 insertions(+)
> d4e16ed891ed0035e8dc552efbd37f5bdcd5bf78  
> 0001-exr-lossy-compression-B44-based-on-OpenEXR-code.patch
> From 9ab93eb32d4ee7a8cacc5ce98239dd12bc75bf42 Mon Sep 17 00:00:00 2001
> From: greeshmab 
> Date: Tue, 24 Mar 2015 12:36:21 +0530
> Subject: [PATCH] exr lossy compression B44(based on OpenEXR code)
>  Signed-off-by: Greeshma 

does not apply:
Applying: exr lossy compression B44(based on OpenEXR code) Signed-off-by: 
Greeshma 
fatal: corrupt patch at line 133
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 exr lossy compression B44(based on OpenEXR code) 
Signed-off-by: Greeshma 
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".

please make sure you attach the git patch without modifications

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec[/format]/webpenc: use WebPAnimEncoder API to generate animated WebP

2015-03-27 Thread James Almer
On 27/03/15 7:02 AM, Pascal Massimino wrote:
> diff --git a/libavformat/webpenc.c b/libavformat/webpenc.c
> index ee110de..d4411a9 100644
> --- a/libavformat/webpenc.c
> +++ b/libavformat/webpenc.c
> @@ -24,10 +24,20 @@
>  #include "avformat.h"
>  #include "internal.h"
>  
> +#include 
> +#if (WEBP_ENCODER_ABI_VERSION >= 0x0206)
> +#include 
> +#if (WEBP_MUX_ABI_VERSION >= 0x0104)
> +#define USE_WEBP_ANIMENCODER
> +#endif
> +#endif

While checking for CONFIG_LIBWEBP would be enough to know if webp/encode.h is 
available 
here as i mentioned in a previous email, it doesn't guarantee that webp/mux.h 
is available 
as well, so you will need to add webp_mux_h to HEADERS_LIST in configure (the 
check for 
libwebpmux you already added will enable it if available) and use the resulting 
define.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Store cookies returned in HLS key (Backport to 2.6)

2015-03-27 Thread Micah Galizia
Hi,

Backport code to store cookies stored by HLS key.

-- 
"The mark of an immature man is that he wants to die nobly for a
cause, while the mark of the mature man is that he wants to live
humbly for one."   --W. Stekel
From faf8f1c6c1efb87caf50fd054809769b1c5040f2 Mon Sep 17 00:00:00 2001
From: Micah Galizia 
Date: Sun, 15 Mar 2015 09:31:59 +1100
Subject: [PATCH 1/3] avformat/hls: store cookies returned in HLS key response

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 7859618affe574c9de7f240d2ddc016f917c37bd)
Signed-off-by: Micah Galizia 
---
 libavformat/hls.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 5e8e1b2..5ed7a24 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -944,6 +944,11 @@ static int open_input(HLSContext *c, struct playlist *pls)
 av_log(NULL, AV_LOG_ERROR, "Unable to read key file %s\n",
seg->key);
 }
+av_freep(&c->cookies);
+av_opt_get(uc->priv_data, "cookies", 0, (uint8_t**)&(c->cookies));
+if (c->cookies && !strlen(c->cookies))
+av_freep(&c->cookies);
+av_dict_set(&opts, "cookies", c->cookies, 0);
 ffurl_close(uc);
 } else {
 av_log(NULL, AV_LOG_ERROR, "Unable to open key file %s\n",
-- 
2.1.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Refactor repeated HLS option updates (Backport to 2.6)

2015-03-27 Thread Micah Galizia
Hi,

Backport code to refactor HLS option updates.

TIA
-- 
"The mark of an immature man is that he wants to die nobly for a
cause, while the mark of the mature man is that he wants to live
humbly for one."   --W. Stekel
From cd2beeadf124c495497e665e6b95265ca9fcb3a8 Mon Sep 17 00:00:00 2001
From: Micah Galizia 
Date: Mon, 16 Mar 2015 20:26:29 +1100
Subject: [PATCH 2/3] avformat/hls: refactor repeated HLS option updates

Signed-off-by: Michael Niedermayer 
(cherry picked from commit fca085187940a169b7a43d096009f7dac315f9ac)
Signed-off-by: Micah Galizia 
---
 libavformat/hls.c | 28 
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 5ed7a24..af890bd 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -903,6 +903,14 @@ static void intercept_id3(struct playlist *pls, uint8_t *buf,
 pls->is_id3_timestamped = (pls->id3_mpegts_timestamp != AV_NOPTS_VALUE);
 }
 
+static void update_options(char **dest, const char *name, void *src)
+{
+av_freep(dest);
+av_opt_get(src, name, 0, (uint8_t**)dest);
+if (*dest && !strlen(*dest))
+av_freep(dest);
+}
+
 static int open_input(HLSContext *c, struct playlist *pls)
 {
 AVDictionary *opts = NULL;
@@ -944,10 +952,7 @@ static int open_input(HLSContext *c, struct playlist *pls)
 av_log(NULL, AV_LOG_ERROR, "Unable to read key file %s\n",
seg->key);
 }
-av_freep(&c->cookies);
-av_opt_get(uc->priv_data, "cookies", 0, (uint8_t**)&(c->cookies));
-if (c->cookies && !strlen(c->cookies))
-av_freep(&c->cookies);
+update_options(&c->cookies, "cookies", uc->priv_data);
 av_dict_set(&opts, "cookies", c->cookies, 0);
 ffurl_close(uc);
 } else {
@@ -1257,22 +1262,13 @@ static int hls_read_header(AVFormatContext *s)
 // if the URL context is good, read important options we must broker later
 if (u && u->prot->priv_data_class) {
 // get the previous user agent & set back to null if string size is zero
-av_freep(&c->user_agent);
-av_opt_get(u->priv_data, "user-agent", 0, (uint8_t**)&(c->user_agent));
-if (c->user_agent && !strlen(c->user_agent))
-av_freep(&c->user_agent);
+update_options(&c->user_agent, "user-agent", u->priv_data);
 
 // get the previous cookies & set back to null if string size is zero
-av_freep(&c->cookies);
-av_opt_get(u->priv_data, "cookies", 0, (uint8_t**)&(c->cookies));
-if (c->cookies && !strlen(c->cookies))
-av_freep(&c->cookies);
+update_options(&c->cookies, "cookies", u->priv_data);
 
 // get the previous headers & set back to null if string size is zero
-av_freep(&c->headers);
-av_opt_get(u->priv_data, "headers", 0, (uint8_t**)&(c->headers));
-if (c->headers && !strlen(c->headers))
-av_freep(&c->headers);
+update_options(&c->headers, "headers", u->priv_data);
 }
 
 if ((ret = parse_playlist(c, s->filename, NULL, s->pb)) < 0)
-- 
2.1.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] replace cookies with updated values instead of appending forever (backport to 2.6)

2015-03-27 Thread Micah Galizia
Hi,

One more -- backport code to replace cookie values instead appending
to the header forever.

-- 
"The mark of an immature man is that he wants to die nobly for a
cause, while the mark of the mature man is that he wants to live
humbly for one."   --W. Stekel
From 629e9028f40cbf6f54c4b481a274aea5219d7c10 Mon Sep 17 00:00:00 2001
From: Micah Galizia 
Date: Tue, 17 Mar 2015 20:22:59 +1100
Subject: [PATCH 3/3] avformat/http: replace cookies with updated values
 instead of appending forever

Signed-off-by: Michael Niedermayer 
(cherry picked from commit c59654d67d1afde3fac24021ef0fd9d18cf38455)
Signed-off-by: Micah Galizia 
---
 libavformat/http.c | 65 +++---
 1 file changed, 52 insertions(+), 13 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 55dcb6e..f4ac90c 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -77,6 +77,8 @@ typedef struct HTTPContext {
 int is_akamai;
 int is_mediagateway;
 char *cookies;  ///< holds newline (\n) delimited Set-Cookie header field values (without the "Set-Cookie: " field name)
+/* A dictionary containing cookies keyed by cookie name */
+AVDictionary *cookie_dict;
 int icy;
 /* how much data was read since the last ICY metadata packet */
 int icy_data_read;
@@ -464,6 +466,43 @@ static int parse_icy(HTTPContext *s, const char *tag, const char *p)
 return 0;
 }
 
+static int parse_cookie(HTTPContext *s, const char *p, AVDictionary **cookies)
+{
+char *eql, *name;
+
+// duplicate the cookie name (dict will dupe the value)
+if (!(eql = strchr(p, '='))) return AVERROR(EINVAL);
+if (!(name = av_strndup(p, eql - p))) return AVERROR(ENOMEM);
+
+// add the cookie to the dictionary
+av_dict_set(cookies, name, eql, AV_DICT_DONT_STRDUP_KEY);
+
+return 0;
+}
+
+static int cookie_string(AVDictionary *dict, char **cookies)
+{
+AVDictionaryEntry *e = NULL;
+int len = 1;
+
+// determine how much memory is needed for the cookies string
+while (e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))
+len += strlen(e->key) + strlen(e->value) + 1;
+
+// reallocate the cookies
+e = NULL;
+if (*cookies) av_free(*cookies);
+*cookies = av_malloc(len);
+if (!cookies) return AVERROR(ENOMEM);
+*cookies[0] = '\0';
+
+// write out the cookies
+while (e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))
+av_strlcatf(*cookies, len, "%s%s\n", e->key, e->value);
+
+return 0;
+}
+
 static int process_line(URLContext *h, char *line, int line_count,
 int *new_location)
 {
@@ -535,19 +574,8 @@ static int process_line(URLContext *h, char *line, int line_count,
 av_free(s->mime_type);
 s->mime_type = av_strdup(p);
 } else if (!av_strcasecmp(tag, "Set-Cookie")) {
-if (!s->cookies) {
-if (!(s->cookies = av_strdup(p)))
-return AVERROR(ENOMEM);
-} else {
-char *tmp = s->cookies;
-size_t str_size = strlen(tmp) + strlen(p) + 2;
-if (!(s->cookies = av_malloc(str_size))) {
-s->cookies = tmp;
-return AVERROR(ENOMEM);
-}
-snprintf(s->cookies, str_size, "%s\n%s", tmp, p);
-av_free(tmp);
-}
+if (parse_cookie(s, p, &s->cookie_dict))
+av_log(h, AV_LOG_WARNING, "Unable to parse '%s'\n", p);
 } else if (!av_strcasecmp(tag, "Icy-MetaInt")) {
 s->icy_metaint = strtoll(p, NULL, 10);
 } else if (!av_strncasecmp(tag, "Icy-", 4)) {
@@ -578,12 +606,19 @@ static int get_cookies(HTTPContext *s, char **cookies, const char *path,
 
 if (!set_cookies) return AVERROR(EINVAL);
 
+// destroy any cookies in the dictionary.
+av_dict_free(&s->cookie_dict);
+
 *cookies = NULL;
 while ((cookie = av_strtok(set_cookies, "\n", &next))) {
 int domain_offset = 0;
 char *param, *next_param, *cdomain = NULL, *cpath = NULL, *cvalue = NULL;
 set_cookies = NULL;
 
+// store the cookie in a dict in case it is updated in the response
+if (parse_cookie(s, cookie, &s->cookie_dict))
+av_log(s, AV_LOG_WARNING, "Unable to parse '%s'\n", cookie);
+
 while ((param = av_strtok(cookie, "; ", &next_param))) {
 if (cookie) {
 // first key-value pair is the actual cookie value
@@ -691,6 +726,10 @@ static int http_read_header(URLContext *h, int *new_location)
 if (s->seekable == -1 && s->is_mediagateway && s->filesize == 20)
 h->is_streamed = 1; /* we can in fact _not_ seek */
 
+// add any new cookies into the existing cookie string
+cookie_string(s->cookie_dict, &s->cookies);
+av_dict_free(&s->cookie_dict);
+
 return err;
 }
 
-- 
2.1.0

___
ffmpeg-devel mail