[FFmpeg-devel] [PATCH] Refactor repeated HLS option updates

2015-03-16 Thread Micah Galizia
Hi,

Attached patch puts repeated code into a function.

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 38b40bb622693f6b6f579092537aa9b7da28f9e1 Mon Sep 17 00:00:00 2001
From: Micah Galizia 
Date: Mon, 16 Mar 2015 20:26:29 +1100
Subject: [PATCH 2/2] refactor repeated HLS option updates

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


Re: [FFmpeg-devel] [PATCH 4/5] avfilter/formats: proper error handling in ff_set_common_*() functions

2015-03-16 Thread Stefano Sabatini
On date Sunday 2015-03-15 15:15:34 +0100, Clément Bœsch encoded:
> On Sun, Mar 15, 2015 at 03:11:14PM +0100, Clément Bœsch wrote:
> > On Sun, Mar 15, 2015 at 03:07:16PM +0100, Stefano Sabatini wrote:
> > > On date Sunday 2015-03-15 14:24:29 +0100, Clément Bœsch encoded:
> > > > ---
> > > >  libavfilter/formats.c | 45 
> > > > -
> > > >  libavfilter/formats.h | 10 +-
> > > >  2 files changed, 37 insertions(+), 18 deletions(-)
> > > > 
> > > > diff --git a/libavfilter/formats.c b/libavfilter/formats.c
> > > > index 6393416..4f9773b 100644
> > > > --- a/libavfilter/formats.c
> > > > +++ b/libavfilter/formats.c
> > > > @@ -401,7 +401,12 @@ AVFilterChannelLayouts *ff_all_channel_counts(void)
> > > >  }
> > > >  
> > > >  #define FORMATS_REF(f, ref)
> > > >  \
> > > > -void *tmp = av_realloc_array(f->refs, sizeof(*f->refs), 
> > > > f->refcount + 1);   \
> > > > +void *tmp; 
> > > >  \
> > > > +   
> > > >  \
> > > > +if (!ref)  
> > > >  \
> > > > +return AVERROR_BUG;
> > > >  \
> > > 
> > > I'd prefer to crash or assert here, assuming the function doesn't
> > > assume NULL, same below.
> > > 
> > 
> > In the current state, these functions could be called with a NULL
> > parameter. Random examples:
> > 
> > libavfilter/src_movie.c: ff_formats_ref(ff_make_format_list(list), 
> > &outlink->in_formats);
> > libavfilter/src_movie.c: ff_formats_ref(ff_make_format_list(list), 
> > &outlink->in_samplerates);
> > libavfilter/vf_extractplanes.c: 
> > ff_formats_ref(ff_make_format_list(in_pixfmts), 
> > &ctx->inputs[0]->out_formats);
> > libavfilter/vf_extractplanes.c: 
> > ff_formats_ref(ff_make_format_list(out_pixfmts), 
> > &ctx->outputs[i]->in_formats);
> > 
> > So I'd better not do that.
> > 
> > > (Unrelated note: "bug" is a silly term, "defect" is more proper - I'm
> > > with Dijkstra here).
> > > 
> 
> To elaborate on this, the bug here is referring to an allocation check not
> done in the caller (there are many currently since I'm just introducing
> the error handling).

I won't block this patch, but getting a crash in a specified point of
the program is more useful than failing with this:

A bug occurred somewhere
-- 
FFmpeg = Foolish and Frenzy Muttering Perennial Evil Gorilla
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 4/5] avfilter/formats: proper error handling in ff_set_common_*() functions

2015-03-16 Thread Stefano Sabatini
On date Monday 2015-03-16 11:00:12 +0100, Stefano Sabatini encoded:
> On date Sunday 2015-03-15 15:15:34 +0100, Clément Bœsch encoded:
[...]
> > To elaborate on this, the bug here is referring to an allocation check not
> > done in the caller (there are many currently since I'm just introducing
> > the error handling).
> 
> I won't block this patch, but getting a crash in a specified point of
> the program is more useful than failing with this:
> 

> A bug occurred somewhere

Now this is not correct, it should be:
there is a bug somewhere

(since bug don't "occurr" but stay/are). Now that (the presence of a
"bug") is not even a good reason to fail a program, it should had been
named something more meaningful like "unexpected condition" (but again
- for that a crash or an assert is just more useful to the
programmer).
-- 
FFmpeg = Foolish and Foolish Martial Portentous Exuberant Gorilla
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 4/5] avfilter/formats: proper error handling in ff_set_common_*() functions

2015-03-16 Thread Clément Bœsch
On Mon, Mar 16, 2015 at 11:05:12AM +0100, Stefano Sabatini wrote:
> On date Monday 2015-03-16 11:00:12 +0100, Stefano Sabatini encoded:
> > On date Sunday 2015-03-15 15:15:34 +0100, Clément Bœsch encoded:
> [...]
> > > To elaborate on this, the bug here is referring to an allocation check not
> > > done in the caller (there are many currently since I'm just introducing
> > > the error handling).
> > 
> > I won't block this patch, but getting a crash in a specified point of
> > the program is more useful than failing with this:
> > 
> 
> > A bug occurred somewhere
> 
> Now this is not correct, it should be:
> there is a bug somewhere
> 
> (since bug don't "occurr" but stay/are). Now that (the presence of a
> "bug") is not even a good reason to fail a program, it should had been
> named something more meaningful like "unexpected condition" (but again
> - for that a crash or an assert is just more useful to the
> programmer).

We are talking about a crash non programmer would get. If you want, I can
add an av_log message saying that the filter is buggy. I just don't want
to create dozens of potential crashes when we know this can be NULL in the
current state. Asserting on the result of malloc feels just wrong.

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH] Refactor repeated HLS option updates

2015-03-16 Thread Michael Niedermayer
On Mon, Mar 16, 2015 at 08:34:24PM +1100, Micah Galizia wrote:
> Hi,
> 
> Attached patch puts repeated code into a function.
> 
> 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

>  hls.c |   28 
>  1 file changed, 12 insertions(+), 16 deletions(-)
> b169e5c1a49fe7d16e0e44e897fdebe1e62f7d41  
> 0002-refactor-repeated-HLS-option-updates.patch
> From 38b40bb622693f6b6f579092537aa9b7da28f9e1 Mon Sep 17 00:00:00 2001
> From: Micah Galizia 
> Date: Mon, 16 Mar 2015 20:26:29 +1100
> Subject: [PATCH 2/2] refactor repeated HLS option updates

applied

thanks

[...]

-- 
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 5/5] avfilter: handle error in query_formats() of a bunch of random video filters

2015-03-16 Thread Stefano Sabatini
On date Sunday 2015-03-15 14:24:30 +0100, Clément Bœsch encoded:
> ---
>  libavfilter/f_select.c  |  9 -
>  libavfilter/vf_codecview.c  |  6 --
>  libavfilter/vf_colorbalance.c   |  7 ---
>  libavfilter/vf_colormatrix.c|  8 
>  libavfilter/vf_curves.c |  6 --
>  libavfilter/vf_dctdnoiz.c   |  6 --
>  libavfilter/vf_decimate.c   |  6 --
>  libavfilter/vf_delogo.c |  7 ---
>  libavfilter/vf_deshake.c|  8 
>  libavfilter/vf_drawbox.c|  7 ---
>  libavfilter/vf_edgedetect.c | 15 ++-
>  libavfilter/vf_elbg.c   |  8 
>  libavfilter/vf_eq.c |  8 
>  libavfilter/vf_fieldmatch.c |  6 --
>  libavfilter/vf_gradfun.c|  8 
>  libavfilter/vf_histeq.c |  7 ---
>  libavfilter/vf_hqdn3d.c |  8 
>  libavfilter/vf_hqx.c|  6 --
>  libavfilter/vf_hue.c|  8 
>  libavfilter/vf_idet.c   |  8 
>  libavfilter/vf_lenscorrection.c |  7 ---
>  libavfilter/vf_libopencv.c  |  7 ---
>  libavfilter/vf_lut.c|  7 ---
>  libavfilter/vf_lut3d.c  |  6 --
>  libavfilter/vf_mcdeint.c|  8 
>  libavfilter/vf_mpdecimate.c |  8 
>  libavfilter/vf_owdenoise.c  |  6 --
>  27 files changed, 118 insertions(+), 83 deletions(-)

LGTM, thanks.
-- 
FFmpeg = Faithless and Forgiving Mastering Prodigious Evil Game
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 4/5] avfilter/formats: proper error handling in ff_set_common_*() functions

2015-03-16 Thread Stefano Sabatini
On date Monday 2015-03-16 11:11:55 +0100, Clément Bœsch encoded:
> On Mon, Mar 16, 2015 at 11:05:12AM +0100, Stefano Sabatini wrote:
> > On date Monday 2015-03-16 11:00:12 +0100, Stefano Sabatini encoded:
> > > On date Sunday 2015-03-15 15:15:34 +0100, Clément Bœsch encoded:
> > [...]
> > > > To elaborate on this, the bug here is referring to an allocation check 
> > > > not
> > > > done in the caller (there are many currently since I'm just introducing
> > > > the error handling).
> > > 
> > > I won't block this patch, but getting a crash in a specified point of
> > > the program is more useful than failing with this:
> > > 
> > 
> > > A bug occurred somewhere
> > 
> > Now this is not correct, it should be:
> > there is a bug somewhere
> > 
> > (since bug don't "occurr" but stay/are). Now that (the presence of a
> > "bug") is not even a good reason to fail a program, it should had been
> > named something more meaningful like "unexpected condition" (but again
> > - for that a crash or an assert is just more useful to the
> > programmer).
> 
> We are talking about a crash non programmer would get. If you want, I can
> add an av_log message saying that the filter is buggy. I just don't want
> to create dozens of potential crashes when we know this can be NULL in the
> current state. Asserting on the result of malloc feels just wrong.

What about asserting in the callee if the argument is NULL?
-- 
FFmpeg = Furious and Freak Monstrous Pure Erroneous God
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]Fix changed channel layout log info

2015-03-16 Thread Nicolas George
Le sextidi 26 ventôse, an CCXXIII, Carl Eugen Hoyos a écrit :
> It seems to me that the line that is shown when the channel 
> layout changes uses an incorrect new layout.
> The current output can be (line breaks for readability):
> 
> Input stream #0:1 frame changed from 
> rate:48000 fmt:fltp ch:8 chl:7.1 to 
> rate:48000 fmt:fltp ch:8 chl:7.1
> 
> if the channel layout changes to "8 channels).

I do not experience the problem. Can you share the sample?

> diff --git a/ffmpeg.c b/ffmpeg.c
> index 0f67b11..4e6e471 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -1870,13 +1870,13 @@ static int decode_audio(InputStream *ist, AVPacket 
> *pkt, int *got_output)
> ist->st->index);
>  exit_program(1);
>  }
> -decoded_frame->channel_layout = avctx->channel_layout;
> -
>  av_get_channel_layout_string(layout1, sizeof(layout1), 
> ist->resample_channels,
>   ist->resample_channel_layout);
>  av_get_channel_layout_string(layout2, sizeof(layout2), 
> avctx->channels,
>   decoded_frame->channel_layout);
>  
> +decoded_frame->channel_layout = avctx->channel_layout;
> +
>  av_log(NULL, AV_LOG_INFO,
> "Input stream #%d:%d frame changed from rate:%d fmt:%s ch:%d 
> chl:%s to rate:%d fmt:%s ch:%d chl:%s\n",
> ist->file_index, ist->st->index,

The line you change seems completely wrong by itself. IMHO, it should read
something like "av_assert0(decoded_frame->channel_layout ==
avctx->channel_layout);", to allow finding the places where lavc returns
inconsistent layouts. Or maybe I am missing something.

Regards,

-- 
  Nicolas George


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


[FFmpeg-devel] [PATCH] configure: Silence warnings about constant unsigned overflows in MSVC

2015-03-16 Thread Michael Niedermayer
unsigned overflows are well defined in C and used for example in crypto
and various other places.
None of the affected warnings currently shown points to an actual defect

untested

Signed-off-by: Michael Niedermayer 
---
 configure |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 7ade46d..e7dce10 100755
--- a/configure
+++ b/configure
@@ -3258,6 +3258,7 @@ msvc_flags(){
-wd4146 -wd4057 -wd4204 -wd4706 -wd4305 
\
-wd4152 -wd4324 -we4013 -wd4100 -wd4214 
\
-wd4554 \
+   -wd4307 \
-wd4273 -wd4701 ;;
 esac
 done
-- 
1.7.9.5

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


[FFmpeg-devel] [PATCH] configure: Silence EMMS warnings in ICC

2015-03-16 Thread Michael Niedermayer
Real world MMX code does not put EMMS at the start and end of every function,
it would be incredibly inefficient to do that
thus do not warn about that

untested

Signed-off-by: Michael Niedermayer 
---
 configure |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index e7dce10..dcc48ff 100755
--- a/configure
+++ b/configure
@@ -5300,7 +5300,9 @@ if enabled icc; then
 # 10006: ignoring unknown option -fno-signed-zeros
 # 10148: ignoring unknown option -Wno-parentheses
 # 10156: ignoring option '-W'; no argument required
-check_cflags -wd144,167,188,556,1292,1419,10006,10148,10156
+# 13200: No EMMS instruction before call to function
+# 13203: No EMMS instruction before return from function
+check_cflags -wd144,167,188,556,1292,1419,10006,10148,10156,13200,13203
 # 11030: Warning unknown option --as-needed
 # 10156: ignoring option '-export'; no argument required
 check_ldflags -wd10156,11030
-- 
1.7.9.5

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


Re: [FFmpeg-devel] [PATCH]Add one CRLF to http headers if necessary

2015-03-16 Thread Nicolas George
Le primidi 21 ventôse, an CCXXIII, Michael Niedermayer a écrit :
> If the user passes just one header "line" then either he adds
> CRLF at the end or he doesnt. These 2 cases can be easily distnguished
> and teh code can add CRLF if its missing
> this is basically carls patch and i think its good and simplifies
> useage,

For the case of a single line, I do not disagree. OTOH, I would prefer to
see it implemented that way:

if (need_extra_crlf)
len += av_strlcpy(headers + len, "\r\n", sizeof(headers) - len);

In other words: add the missing CRLF on the fly when using the s->headers
option.

> The case of multiple header lines is trickier, http uses CRLF as

Let us focus on that one please.

> seperator IIRC. My idea was to be a bit more flexible here and allow
> any line ending character and normalize these to CRLF before sending
> them. This is your first patch i belive.

True, that was my first patch.

> This would allow users to just use a quote and the enter key after each
> header i assume on the command line. While in a textfield of a GUI
> it can be entered easily 1 line per header.
> Maybe iam missing something here but it seems convenient to allow
> this than to strictly require CRLF

In short: this is an API and an API must be strict. This is not just a
hollow principle that I want to apply blindly. Once we document this is
accepted, people will start to use it, and we will be stuck with it, we must
maintain it and keep compatibility until at least two major bumps. This is
the same reason for writing ">= for success" even if the function returns
only 0: MAYBE sometime later we will want to expand, and in that case it
will be an advantage to us.

Of course, it has to be balanced with the benefits for the users.

First, I would like to emphasize that the HTTP headers option would have the
AV_OPT_EXPERT flag if it existed in lavu and not only in cmdutils.

Now, let us see the various uses of the option and the corresponding
benefits.

For an application that builds the HTTP headers string from various sources:
benefit: 0. A delimiter string is a delimiter string, whether it is "\n",
"\r\n", five exclamation marks or an ASCII-art tortoise.

For the GUI application that you suggested earlier, and similar
applications: First, I consider them rather unlikely: exporting an expert
option in a GUI with a simple text entry is way too fragile. Still, let us
admit it exists. It must do a special case for HTTP headers, since it is a
multi-line field. In that case, doing a special case for sanitizing the
string is not too much to ask. Of course, lavu can help: I would have no
objection to some kind of "av_string_normalize_line_breaks(&str)" to do the
actual work.

For command-line applications accepting the options directly from the user:
For Unix shells: benefit: the user can hit return without hitting Ctrl-V
Ctrl-M before, two extra keys. Not much.
For the windows shell: benefit: 0. I suspect hitting return with unclosed
quotes will not have the desired effect. And CRLF is the native windows line
ending anyway.

The global benefit, as I see it, is rather feeble.

I can propose a middle ground:

Normalize line endings, but still print a warning.

That way, lazy users can spare the few keys, but we are free to break it if
we need/want.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] avfilter/showwaves: add single_pic option

2015-03-16 Thread Stefano Sabatini
On date Sunday 2014-12-28 12:48:19 +0100, Clément Bœsch encoded:
> On Fri, Dec 26, 2014 at 01:16:07AM +0100, Stefano Sabatini wrote:
> > On date Friday 2014-12-26 00:17:53 +0100, Clément Bœsch encoded:
[...]
> The first case has its use cases. Random example:
> https://soundcloud.com/explore
> 
> > 
> > The two approaches are not mutually exclusive, but the latter is
> > probably more flexible.
> > 
> 
> In the second case, you'll probably need successive scaling before you
> reach the targeted size. It's probably a bit more complex than the current
> patch, but might do the trick.
> 
> Note that, while I don't think it will matter, the beginning of the track
> will probably suffer from accuracy given how many time it will be
> averaged/scaled.
> 

> > I'll prepare a patch to cover case 2. About case 1, I wonder if having
> > a dedicated filter (sharing part of the code of showwaves) wouldn't be
> > a better approach, but I'm not sure it will.
> 
> I'm a bit lazy to do that, feel free to take over this patch.

What do you think of a separate filter to cover single_pic? See
attached patch.
-- 
FFmpeg = Fiendish and Frenzy Monstrous Puritan Extravagant Guru
>From 5ecb0190806d39bdd869de951634000b1d1e1c0f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= 
Date: Wed, 24 Dec 2014 15:03:26 +0100
Subject: [PATCH] lavfi: add showwavespic filter
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This is a variant of showaves. It is implemented as a different filter so
that the user is not allowed to use meaningless options which belong to
showaves (such as rate).

Major edits done by Stefano Sabatini, from a patch by ubitux.

See thread:
From: Clément Bœsch 
To: ffmpeg-devel@ffmpeg.org
Date: Wed, 24 Dec 2014 15:03:26 +0100
Subject: [FFmpeg-devel] [PATCH] avfilter/showwaves: add single_pic option

TODO: bump minor
---
 doc/filters.texi|  27 +
 libavfilter/Makefile|   1 +
 libavfilter/allfilters.c|   1 +
 libavfilter/avf_showwaves.c | 274 ++--
 4 files changed, 268 insertions(+), 35 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index dbcd391..3acd3e8 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -11741,6 +11741,33 @@ aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=
 @end example
 @end itemize
 
+@section showwavespic
+
+Convert input audio to a single video frame, representing the samples waves.
+
+The filter accepts the following options:
+
+@table @option
+@item size, s
+Specify the video size for the output. For the syntax of this option, check the
+@ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
+Default value is @code{600x240}.
+
+@item split_channels
+Set if channels should be drawn separately or overlap. Default value is 0.
+@end table
+
+@subsection Examples
+
+@itemize
+@item
+Extract a channel split representation of the wave form of a whole audio track
+in a 1024x800 picture using @command{ffmpeg}:
+@example
+ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
+@end example
+@end itemize
+
 @section split, asplit
 
 Split input into several identical outputs.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index b184f07..2cde029 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -236,6 +236,7 @@ OBJS-$(CONFIG_CONCAT_FILTER) += avf_concat.o
 OBJS-$(CONFIG_SHOWCQT_FILTER)+= avf_showcqt.o
 OBJS-$(CONFIG_SHOWSPECTRUM_FILTER)   += avf_showspectrum.o
 OBJS-$(CONFIG_SHOWWAVES_FILTER)  += avf_showwaves.o
+OBJS-$(CONFIG_SHOWWAVESPIC_FILTER)   += avf_showwaves.o
 
 # multimedia sources
 OBJS-$(CONFIG_AMOVIE_FILTER) += src_movie.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 043ac56..0288082 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -251,6 +251,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(SHOWCQT,showcqt,avf);
 REGISTER_FILTER(SHOWSPECTRUM,   showspectrum,   avf);
 REGISTER_FILTER(SHOWWAVES,  showwaves,  avf);
+REGISTER_FILTER(SHOWWAVESPIC,   showwavespic,   avf);
 
 /* multimedia sources */
 REGISTER_FILTER(AMOVIE, amovie, avsrc);
diff --git a/libavfilter/avf_showwaves.c b/libavfilter/avf_showwaves.c
index 9cddc51..57a6b2e 100644
--- a/libavfilter/avf_showwaves.c
+++ b/libavfilter/avf_showwaves.c
@@ -23,6 +23,7 @@
  * audio to video multimedia filter
  */
 
+#include "libavutil/avassert.h"
 #include "libavutil/channel_layout.h"
 #include "libavutil/opt.h"
 #include "libavutil/parseutils.h"
@@ -40,6 +41,11 @@ enum ShowWavesMode {
 MODE_NB,
 };
 
+struct frame_node {
+AVFrame *frame;
+struct frame_node *next;
+};
+
 typedef struct {
 const AVClass *class;
 int w, h;
@@ -54,6 +60,13 @@ typedef struct {
 int split_channels;

Re: [FFmpeg-devel] [PATCH] avformat/cavsvideodec: use avpriv_find_start_code in cavsvideo_probe()

2015-03-16 Thread Michael Niedermayer
On Sun, Mar 15, 2015 at 04:56:04PM +0800, zhaoxiu.zeng wrote:
> From 9a97b5559a8c4ea9a03560d59e1725b6c99d0960 Mon Sep 17 00:00:00 2001
> From: Zeng Zhaoxiu 
> Date: Sun, 15 Mar 2015 11:58:12 +0800
> Subject: [PATCH 3/7] avformat/cavsvideodec: use avpriv_find_start_code in
>  cavsvideo_probe()
> 
> Signed-off-by: Zeng Zhaoxiu 

applied

thanks

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

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


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


Re: [FFmpeg-devel] [PATCH] avformat/m4vdec: use avpriv_find_start_code in mpeg4video_probe()

2015-03-16 Thread Michael Niedermayer
On Sun, Mar 15, 2015 at 04:58:52PM +0800, zhaoxiu.zeng wrote:
> From 7d57cb0e822ac755ba7e3d9c09d90bf62c7da24d Mon Sep 17 00:00:00 2001
> From: Zeng Zhaoxiu 
> Date: Sun, 15 Mar 2015 11:59:27 +0800
> Subject: [PATCH 4/7] avformat/m4vdec: use avpriv_find_start_code in
>  mpeg4video_probe()
> 
> Signed-off-by: Zeng Zhaoxiu 
> ---
>  libavformat/m4vdec.c | 17 -
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/libavformat/m4vdec.c b/libavformat/m4vdec.c
> index d8ee530..aa0ee36 100644
> --- a/libavformat/m4vdec.c
> +++ b/libavformat/m4vdec.c
> @@ -21,6 +21,7 @@
>  
>  #include "avformat.h"
>  #include "rawdec.h"
> +#include "libavcodec/internal.h"
>  
>  #define VISUAL_OBJECT_START_CODE   0x01b5
>  #define VOP_START_CODE 0x01b6
> @@ -29,22 +30,20 @@ static int mpeg4video_probe(AVProbeData *probe_packet)
>  {
>  uint32_t temp_buffer = -1;
>  int VO = 0, VOL = 0, VOP = 0, VISO = 0, res = 0;
> -int i;
> +const uint8_t *ptr = probe_packet->buf, *end = ptr + 
> probe_packet->buf_size;
>  
> -for (i = 0; i < probe_packet->buf_size; i++) {
> -temp_buffer = (temp_buffer << 8) + probe_packet->buf[i];
> -if (temp_buffer & 0xfe00)
> -continue;
> -if (temp_buffer < 2)
> -continue;
> +while (ptr < end) {
> +ptr = avpriv_find_start_code(ptr, end, &temp_buffer);
> +if ((temp_buffer & 0xff00) != 0x100)
> +break;
>  
>  if (temp_buffer == VOP_START_CODE)
>  VOP++;
>  else if (temp_buffer == VISUAL_OBJECT_START_CODE)
>  VISO++;
> -else if (temp_buffer >= 0x100 && temp_buffer < 0x120)
> +else if (temp_buffer < 0x120)
>  VO++;
> -else if (temp_buffer >= 0x120 && temp_buffer < 0x130)
> +else if (temp_buffer < 0x130)
>  VOL++;
>  else if (!(0x1AF < temp_buffer && temp_buffer < 0x1B7) &&
>   !(0x1B9 < temp_buffer && temp_buffer < 0x1C4))

this is not doing the same, the old code considers 00XX the new
does only consider 01XX

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

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates


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


[FFmpeg-devel] [PATCH] mov: Add option to keep packet order after seeking

2015-03-16 Thread Derek Buitenhuis
The current behavior may produce packets in a different order
after seeking, compared to demuxing linearly from the beginning.
This is because the MOV demuxer seeks in each stream based on
timestamp, which may not necessarily match the original packet
order.

This makes implementing certain operations, such as segmenting,
quite hard, and slower than need be.

Therefore, add an option which retains the same packet order
after seeking, as when a file is demuxed linearly. This is
accomplished by seeking in the other streams, based on file
position, rather than timestamp.

The positional search in the index entries is implemented as
a linear search since, in MOV, the index entries may be out of
order in terms of file position, in particularily insane files.

Signed-off-by: Derek Buitenhuis 
---
 libavformat/isom.h|  1 +
 libavformat/mov.c | 71 ---
 libavformat/version.h |  4 +--
 3 files changed, 59 insertions(+), 17 deletions(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index d233839..1ab085e 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -186,6 +186,7 @@ typedef struct MOVContext {
 int chapter_track;
 int use_absolute_path;
 int ignore_editlist;
+int seek_keep_order;
 int64_t next_root_atom; ///< offset of the next root atom
 int export_all;
 int export_xmp;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index de4004f..e674113 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4291,13 +4291,35 @@ static int mov_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 return 0;
 }
 
-static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t 
timestamp, int flags)
+static int mov_search_sample_pos(AVStream *st, int64_t pos)
+{
+int i;
+
+/* This is linear search because entries may be out of order pos-wise. */
+for (i = 0; i < st->nb_index_entries; i++)
+if (st->index_entries[i].pos >= pos)
+return i;
+
+return -1;
+}
+
+static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t val, int 
flags, int pos)
 {
 MOVStreamContext *sc = st->priv_data;
+int64_t timestamp;
 int sample, time_sample;
 int i;
 
-sample = av_index_search_timestamp(st, timestamp, flags);
+if (!pos) {
+sample= av_index_search_timestamp(st, val, flags);
+timestamp = val;
+} else {
+sample = mov_search_sample_pos(st, val);
+if (sample < 0)
+return AVERROR_INVALIDDATA;
+
+timestamp = st->index_entries[sample].timestamp;
+}
 av_dlog(s, "stream %d, timestamp %"PRId64", sample %d\n", st->index, 
timestamp, sample);
 if (sample < 0 && st->nb_index_entries && timestamp < 
st->index_entries[0].timestamp)
 sample = 0;
@@ -4323,32 +4345,47 @@ static int mov_seek_stream(AVFormatContext *s, AVStream 
*st, int64_t timestamp,
 
 static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t 
sample_time, int flags)
 {
+MOVContext *mc = s->priv_data;
 AVStream *st;
-int64_t seek_timestamp, timestamp;
+int64_t timestamp;
 int sample;
-int i;
 
 if (stream_index >= s->nb_streams)
 return AVERROR_INVALIDDATA;
 
 st = s->streams[stream_index];
-sample = mov_seek_stream(s, st, sample_time, flags);
+sample = mov_seek_stream(s, st, sample_time, flags, 0);
 if (sample < 0)
 return sample;
 
-/* adjust seek timestamp to found sample timestamp */
-seek_timestamp = st->index_entries[sample].timestamp;
+if (!mc->seek_keep_order) {
+/* adjust seek timestamp to found sample timestamp */
+int64_t seek_timestamp = st->index_entries[sample].timestamp;
+int i;
 
-for (i = 0; i < s->nb_streams; i++) {
-MOVStreamContext *sc = s->streams[i]->priv_data;
-st = s->streams[i];
-st->skip_samples = (sample_time <= 0) ? sc->start_pad : 0;
+for (i = 0; i < s->nb_streams; i++) {
+MOVStreamContext *sc = s->streams[i]->priv_data;
+st = s->streams[i];
+st->skip_samples = (sample_time <= 0) ? sc->start_pad : 0;
 
-if (stream_index == i)
-continue;
+if (stream_index == i)
+continue;
 
-timestamp = av_rescale_q(seek_timestamp, 
s->streams[stream_index]->time_base, st->time_base);
-mov_seek_stream(s, st, timestamp, flags);
+timestamp = av_rescale_q(seek_timestamp, 
s->streams[stream_index]->time_base, st->time_base);
+mov_seek_stream(s, st, timestamp, flags, 0);
+}
+} else {
+int64_t seek_pos = st->index_entries[sample].pos;
+int i;
+
+for (i = 0; i < s->nb_streams; i++) {
+st = s->streams[i];
+
+if (stream_index == i)
+continue;
+
+mov_seek_stream(s, st, seek_pos, flags, 1);
+}
 }
 return 0;
 }
@@ -4362,6 +4399,10 @@ static const AVOption mov_options[] = {

Re: [FFmpeg-devel] ffmpeg issues

2015-03-16 Thread Michael Niedermayer
On Sun, Mar 15, 2015 at 10:46:22PM -0600, Dazzle Software wrote:
> Tested this with different both ​1.7 and 2.0 release but the same issue
> still applies I have also tried static and shared but same issue always
> seems to come up it either shows
> 
> the following when it does compile
> 
> /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../libflite_cmu_us_awb.so:
> undefined reference to `flite_feat_set_int'
> /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../libflite_cmu_us_awb.so:
> undefined reference to `cg_db_val'
> /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../libflite_cmu_us_awb.so:
> undefined reference to `flite_feat_set'
> /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../libflite_cmu_us_awb.so:
> undefined reference to `cg_synth'
> /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../libflite_cmu_us_awb.so:
> undefined reference to `flite_feat_set_string'
> 
> 
> but other times it just says
> 
> ERROR: libflite not found
> 
> but even it exists and have it installed to /usr/lib

please see http://ffmpeg.org/bugreports.html

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable


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


Re: [FFmpeg-devel] [PATCH] Add ability to pause transcoding via keyboard interaction

2015-03-16 Thread Jeremy Luce
Here is the updated patch with documentation and proper line breaks.
Jeremy


On Fri, Mar 13, 2015 at 1:02 PM, Michael Niedermayer  wrote:
> On Wed, Mar 11, 2015 at 08:34:39AM -0500, Jeremy Luce wrote:
>> Resubmitting with [PATCH] tag and unified diff.
>>
>> Adds functionality to pause transcoding with 'p' key and upause with 'u'
>> key over stdin. Pauses in the main transcode loop as well as the
>> input_thread loop.
> [...]
>
>> @@ -3346,7 +3371,9 @@ static int check_keyboard_interaction(int64_t cur_time)
>>  "C  Send/Que command to all matching filters\n"
>>  "D  cycle through available debug modes\n"
>>  "h  dump packets/hex press to cycle
>> through the 3 states\n"
>> +"p  pause transcoding\n"
>
> this looks like the diff has been corrupted with line breaks
>
> also this is missing documentation in doc/*
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> I am the wisest man alive, for I know one thing, and that is that I know
> nothing. -- Socrates
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
From 8d7f26a99ea0f189968c483b0d5f0cc09a98b5d6 Mon Sep 17 00:00:00 2001
From: jluce50 
Date: Fri, 6 Mar 2015 17:13:40 -0600
Subject: [PATCH] Add pause/resume via keyboard interaction. Docs updated to
 include keyboard interaction (incl. new pause commands)

---
 doc/ffmpeg.texi | 38 ++
 ffmpeg.c| 51 ++-
 2 files changed, 84 insertions(+), 5 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 6772f2f..0001144 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1276,6 +1276,44 @@ search for the file @file{libvpx-1080p.avpreset}.
 If no such file is found, then ffmpeg will search for a file named
 @var{arg}.avpreset in the same directories.
 
+@section While transcoding
+
+@table @key
+@item ?
+show help
+
+@item +
+increase verbosity
+
+@item -
+decrease verbosity
+
+@item d
+send command to first matching filter supporting it
+
+@item C
+send/queue command to all matching filters
+
+@item D
+cycle through available debug modes
+
+@item h
+packets/hex press to cycle through the 3 states
+
+@item p
+pause transcoding
+
+@item q
+quit
+
+@item u
+unpause transcoding
+
+@item s
+Show QP histogram
+
+@end table
+
 @c man end OPTIONS
 
 @chapter Tips
diff --git a/ffmpeg.c b/ffmpeg.c
index 6604ff0..37b351a 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -120,6 +120,9 @@ const char *const forced_keyframes_const_names[] = {
 static void do_video_stats(OutputStream *ost, int frame_size);
 static int64_t getutime(void);
 static int64_t getmaxrss(void);
+static int64_t gettime_relative_minus_pause(void);
+static void pause_transcoding(void);
+static void unpause_transcoding(void);
 
 static int run_as_daemon  = 0;
 static int nb_frames_dup = 0;
@@ -146,6 +149,9 @@ int nb_output_files   = 0;
 FilterGraph **filtergraphs;
 intnb_filtergraphs;
 
+int64_t paused_start = 0;
+int64_t paused_time = 0;
+
 #if HAVE_TERMIOS_H
 
 /* init terminal so that we can grab keys */
@@ -1447,7 +1453,6 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
 last_time = cur_time;
 }
 
-
 oc = output_files[0]->ctx;
 
 total_size = avio_size(oc->pb);
@@ -3256,18 +3261,38 @@ static OutputStream *choose_output(void)
 return ost_min;
 }
 
+static void pause_transcoding(void)
+{
+if (!paused_start)
+paused_start = av_gettime_relative();
+}
+
+static void unpause_transcoding(void)
+{
+if (paused_start) {
+paused_time += av_gettime_relative() - paused_start;
+paused_start = 0;
+}
+}
+
 static int check_keyboard_interaction(int64_t cur_time)
 {
 int i, ret, key;
 static int64_t last_time;
-if (received_nb_signals)
+if (received_nb_signals) {
+unpause_transcoding();
 return AVERROR_EXIT;
+}
 /* read_key() returns 0 on EOF */
 if(cur_time - last_time >= 10 && !run_as_daemon){
 key =  read_key();
 last_time = cur_time;
 }else
 key = -1;
+// Reserve 'u' for unpausing a paused transcode, but allow any key to
+// unpause for backward compatibility
+if (key == 'u' || key != -1) unpause_transcoding();
+if (key == 'p') pause_transcoding();
 if (key == 'q')
 return AVERROR_EXIT;
 if (key == '+') av_log_set_level(av_log_get_level()+10);
@@ -3346,7 +3371,9 @@ static int check_keyboard_interaction(int64_t cur_time)
 "C  Send/Que command to all matching filters\n"
 "D  cycle through available debug modes\n"
 "h  dump packets/hex press to cycle through the 3 states\n"
+"p  pause transcoding\n

Re: [FFmpeg-devel] [PATCH]Add one CRLF to http headers if necessary

2015-03-16 Thread Michael Niedermayer
On Mon, Mar 16, 2015 at 04:04:16PM +0100, Nicolas George wrote:
> Le primidi 21 ventôse, an CCXXIII, Michael Niedermayer a écrit :
[...]
> "\r\n", five exclamation marks or an ASCII-art tortoise.




> 
> For the GUI application that you suggested earlier, and similar
> applications: First, I consider them rather unlikely: exporting an expert
> option in a GUI with a simple text entry is way too fragile. Still, let us
> admit it exists. It must do a special case for HTTP headers, since it is a
> multi-line field. In that case, doing a special case for sanitizing the
> string is not too much to ask. Of course, lavu can help: I would have no
> objection to some kind of "av_string_normalize_line_breaks(&str)" to do the
> actual work.
> 
> For command-line applications accepting the options directly from the user:
> For Unix shells: benefit: the user can hit return without hitting Ctrl-V
> Ctrl-M before, two extra keys. Not much.
> For the windows shell: benefit: 0. I suspect hitting return with unclosed
> quotes will not have the desired effect. And CRLF is the native windows line
> ending anyway.
> 
> The global benefit, as I see it, is rather feeble.
> 

> I can propose a middle ground:
> 
> Normalize line endings, but still print a warning.
> 
> That way, lazy users can spare the few keys, but we are free to break it if
> we need/want.

ok, that sounds very acceptable to me

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- 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] Add ability to pause transcoding via keyboard interaction

2015-03-16 Thread Michael Niedermayer
On Mon, Mar 16, 2015 at 11:23:33AM -0500, Jeremy Luce wrote:
> Here is the updated patch with documentation and proper line breaks.
> Jeremy
> 
> 
> On Fri, Mar 13, 2015 at 1:02 PM, Michael Niedermayer  wrote:
> > On Wed, Mar 11, 2015 at 08:34:39AM -0500, Jeremy Luce wrote:
> >> Resubmitting with [PATCH] tag and unified diff.
> >>
> >> Adds functionality to pause transcoding with 'p' key and upause with 'u'
> >> key over stdin. Pauses in the main transcode loop as well as the
> >> input_thread loop.
> > [...]
> >
> >> @@ -3346,7 +3371,9 @@ static int check_keyboard_interaction(int64_t 
> >> cur_time)
> >>  "C  Send/Que command to all matching 
> >> filters\n"
> >>  "D  cycle through available debug modes\n"
> >>  "h  dump packets/hex press to cycle
> >> through the 3 states\n"
> >> +"p  pause transcoding\n"
> >
> > this looks like the diff has been corrupted with line breaks
> >
> > also this is missing documentation in doc/*
> >
> > [...]
> > --
> > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >
> > I am the wisest man alive, for I know one thing, and that is that I know
> > nothing. -- Socrates
> >
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >

>  doc/ffmpeg.texi |   38 ++
>  ffmpeg.c|   51 ++-
>  2 files changed, 84 insertions(+), 5 deletions(-)
> f4321165de7a06c32e23b05989016f5e9d5158e0  
> 0001-Add-pause-resume-via-keyboard-interaction.patch
> From 8d7f26a99ea0f189968c483b0d5f0cc09a98b5d6 Mon Sep 17 00:00:00 2001
> From: jluce50 
> Date: Fri, 6 Mar 2015 17:13:40 -0600
> Subject: [PATCH] Add pause/resume via keyboard interaction. Docs updated to
>  include keyboard interaction (incl. new pause commands)




> 
> ---
>  doc/ffmpeg.texi | 38 ++
>  ffmpeg.c| 51 ++-
>  2 files changed, 84 insertions(+), 5 deletions(-)
> 
> diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
> index 6772f2f..0001144 100644
> --- a/doc/ffmpeg.texi
> +++ b/doc/ffmpeg.texi
> @@ -1276,6 +1276,44 @@ search for the file @file{libvpx-1080p.avpreset}.
>  If no such file is found, then ffmpeg will search for a file named
>  @var{arg}.avpreset in the same directories.
>  
> +@section While transcoding
> +
> +@table @key
> +@item ?
> +show help
> +
> +@item +
> +increase verbosity
> +
> +@item -
> +decrease verbosity
> +
> +@item d
> +send command to first matching filter supporting it
> +
> +@item C
> +send/queue command to all matching filters
> +
> +@item D
> +cycle through available debug modes
> +
> +@item h
> +packets/hex press to cycle through the 3 states
> +
> +@item p
> +pause transcoding
> +
> +@item q
> +quit
> +

> +@item u
> +unpause transcoding

it seems any key unpauses transcoding

also theres no vissual feedback that ffmpeg is paused or how the
user can unpause it
this is bad in case the user pressed p by mistake

also the c and C keys already effectivly pause ffmpeg
p should not be implemented entirely differently than how they work.
If c/C have problems these problems should be fixed

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.


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


Re: [FFmpeg-devel] [PATCH]Fix changed channel layout log info

2015-03-16 Thread Carl Eugen Hoyos
Nicolas George  nsup.org> writes:

> The line you change seems completely wrong by itself. 
> IMHO, it should read something like 
> "av_assert0(decoded_frame->channel_layout ==
> avctx->channel_layout);", to allow finding the places 
> where lavc returns inconsistent layouts.

That happens for dca lossless.

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH]Fix changed channel layout log info

2015-03-16 Thread Michael Niedermayer
On Mon, Mar 16, 2015 at 05:34:59PM +, Carl Eugen Hoyos wrote:
> Nicolas George  nsup.org> writes:
> 
> > The line you change seems completely wrong by itself. 
> > IMHO, it should read something like 
> > "av_assert0(decoded_frame->channel_layout ==
> > avctx->channel_layout);", to allow finding the places 
> > where lavc returns inconsistent layouts.
> 
> That happens for dca lossless.

its probably because the code in dca sets a wrong channel layout
than theres a hack in the new dca code that notices its wrong and
clears it.
that repeated set wrong + clear might be responsible but it also
might be something else


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

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle


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


Re: [FFmpeg-devel] [PATCH] is_compiled flag not being cleared in av_opencl_uninit

2015-03-16 Thread Srikanth G
Attaching the patch file per Wei's request

-Srikanth

On Mon, Mar 9, 2015 at 5:45 PM, Srikanth G  wrote:

> Hi Michael,
>
> I did the fix and verified compilation and run.
> Confirmed it works.
>
> Here is the patch
>
>
> ---
>  libavutil/opencl.c | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/libavutil/opencl.c b/libavutil/opencl.c
> index 36cb6fe..2df5653 100644
> --- a/libavutil/opencl.c
> +++ b/libavutil/opencl.c
> @@ -588,6 +588,7 @@ end:
>
>  void av_opencl_uninit(void)
>  {
> +int i;
>  cl_int status;
>  LOCK_OPENCL;
>  opencl_ctx.init_count--;
> @@ -611,6 +612,9 @@ void av_opencl_uninit(void)
>  }
>  opencl_ctx.context = NULL;
>  }
> +for (i = 0; i < opencl_ctx.kernel_code_count; i++) {
> +opencl_ctx.kernel_code[i].is_compiled = 0;
> +}
>  free_device_list(&opencl_ctx.device_list);
>  end:
>  if (opencl_ctx.init_count <= 0)
> --
> 1.9.0.msysgit.0
>
>
> Thanks,
> Srikanth
>
> On Sat, Mar 7, 2015 at 12:14 PM, Michael Niedermayer 
> wrote:
>
>> On Sat, Mar 07, 2015 at 10:53:05AM -0600, Srikanth G wrote:
>> > Hi Michael,
>> >
>> > Can you let me know the compilation errors?
>> > I tried with this fix and things were working for me.
>> >
>> > I will try again though.
>>
>> you can checkout a fresh ffmpeg and apply the patch
>> "i" is not declared in that function so it will not build
>> the fix is trivial but i expect code to be tested, which this
>> obviously has not been and would not magically be if i add int i
>>
>> [...]
>> --
>> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>>
>> Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker.
>> User
>> questions about the command line tools should be sent to the ffmpeg-user
>> ML.
>> And questions about how to use libav* should be sent to the libav-user ML.
>>
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>>
>


0001-OpenCL-uninit-bug-fix-clear-is_compiled-flag.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2015-03-16 Thread Himangi Saraogi
On 14 March 2015 at 09:42, Michael Niedermayer  wrote:

> On Wed, Mar 11, 2015 at 03:20:47AM +0530, Himangi Saraogi wrote:
> > This is an exact inverse of the telecine filter unlike previously
> existing
> > pullup and fieldmatch ones.
> >
> > The algorithm was briefly discussed with Carl. The algorithm is not
> completely
> > tested, though I do have a some sample suggestions and will be testing on
> > them soon. Documentation is yet to be added.
> > ---
> >  Changelog   |   1 +
> >  libavfilter/Makefile|   1 +
> >  libavfilter/allfilters.c|   1 +
> >  libavfilter/vf_detelecine.c | 323
> 
> >  4 files changed, 326 insertions(+)
> >  create mode 100644 libavfilter/vf_detelecine.c
>
>
>
> >
> > diff --git a/Changelog b/Changelog
> > index e88359d..341faca 100644
> > --- a/Changelog
> > +++ b/Changelog
> > @@ -3,6 +3,7 @@ releases are sorted from youngest to oldest.
> >
> >  version :
> >  - FFT video filter
> > +- Detelecine filter
> >
> >
> >  version 2.6:
> > diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> > index b184f07..399072c 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 043ac56..2e4e2f6 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..ce9ba74
> > --- /dev/null
> > +++ b/libavfilter/vf_detelecine.c
> > @@ -0,0 +1,323 @@
> > +/*
> > + * 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;
> > +unsigned int pattern_pos;
> > +unsigned int nskip_fields;
> > +
> > +AVRational pts;
> > +double 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",0,
> AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "field"},
> > +{"bottom", "select bottom field first", 0,
> AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "field"},
> > +{"b",  "select bottom field first", 0,
> AV_OPT_T

Re: [FFmpeg-devel] [PATCH 1/2] hevc: avoid unnecessary calls to?get_format

2015-03-16 Thread Michael Niedermayer
On Thu, Mar 12, 2015 at 01:12:47PM +, Rainer Hochecker wrote:
> Rainer Hochecker  online.de> writes:
> 
> hevc_decode_flush(AVCodecContext *avctx)
> >  {
> >  HEVCContext *s = avctx->priv_data;
> >  ff_hevc_flush_dpb(s);
> > +hevc_decode_free(avctx);
> > +s->context_initialized = 0;
> >  s->max_ra = INT_MAX;
> >  }
> > 
> 
> this is a left over from debugging. does not belong to the patch

removed
applied

thanks

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

I have often repented speaking, but never of holding my tongue.
-- Xenocrates


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


Re: [FFmpeg-devel] [PATCH] mov: Add option to keep packet order after seeking

2015-03-16 Thread Michael Niedermayer
On Mon, Mar 16, 2015 at 04:07:07PM +, Derek Buitenhuis wrote:
> The current behavior may produce packets in a different order
> after seeking, compared to demuxing linearly from the beginning.
> This is because the MOV demuxer seeks in each stream based on
> timestamp, which may not necessarily match the original packet
> order.
> 
> This makes implementing certain operations, such as segmenting,
> quite hard, and slower than need be.
> 
> Therefore, add an option which retains the same packet order
> after seeking, as when a file is demuxed linearly. This is
> accomplished by seeking in the other streams, based on file
> position, rather than timestamp.
> 
> The positional search in the index entries is implemented as
> a linear search since, in MOV, the index entries may be out of
> order in terms of file position, in particularily insane files.
> 
> Signed-off-by: Derek Buitenhuis 
> ---
>  libavformat/isom.h|  1 +
>  libavformat/mov.c | 71 
> ---
>  libavformat/version.h |  4 +--
>  3 files changed, 59 insertions(+), 17 deletions(-)

LGTM

thanks

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

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.


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


Re: [FFmpeg-devel] [PATCH] Refactor repeated HLS option updates

2015-03-16 Thread Micah Galizia
Excellent. Thank you!

On Mon, Mar 16, 2015 at 11:02 PM, Michael Niedermayer  wrote:
> On Mon, Mar 16, 2015 at 08:34:24PM +1100, Micah Galizia wrote:
>> Hi,
>>
>> Attached patch puts repeated code into a function.
>>
>> 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
>
>>  hls.c |   28 
>>  1 file changed, 12 insertions(+), 16 deletions(-)
>> b169e5c1a49fe7d16e0e44e897fdebe1e62f7d41  
>> 0002-refactor-repeated-HLS-option-updates.patch
>> From 38b40bb622693f6b6f579092537aa9b7da28f9e1 Mon Sep 17 00:00:00 2001
>> From: Micah Galizia 
>> Date: Mon, 16 Mar 2015 20:26:29 +1100
>> Subject: [PATCH 2/2] refactor repeated HLS option updates
>
> applied
>
> thanks
>
> [...]
>
> --
> 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
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>



-- 
"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
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] configure: Silence EMMS warnings in ICC

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

> -check_cflags -wd144,167,188,556,1292,1419,10006,10148,10156
> +# 13200: No EMMS instruction before call to function
> +# 13203: No EMMS instruction before return from function
> +check_cflags 
> -wd144,167,188,556,1292,1419,10006,10148,10156,13200,13203

Works fine here.

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH] mov: Add option to keep packet order after seeking

2015-03-16 Thread Derek Buitenhuis
On 3/16/2015 8:17 PM, Michael Niedermayer wrote:
> LGTM

Martin had a few suggestions, and I will send a v2 in a bit.

- Derek

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


Re: [FFmpeg-devel] [PATCH] configure: Silence EMMS warnings in ICC

2015-03-16 Thread Michael Niedermayer
On Mon, Mar 16, 2015 at 08:42:43PM +, Carl Eugen Hoyos wrote:
> Michael Niedermayer  gmx.at> writes:
> 
> > -check_cflags -wd144,167,188,556,1292,1419,10006,10148,10156
> > +# 13200: No EMMS instruction before call to function
> > +# 13203: No EMMS instruction before return from function
> > +check_cflags 
> > -wd144,167,188,556,1292,1419,10006,10148,10156,13200,13203
> 
> Works fine here.

applied

thanks

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

The real ebay dictionary, page 1
"Used only once"- "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."


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


Re: [FFmpeg-devel] [RFC]Ignore ff_isom_write_hvcc() return value writing mkv like the mov muxer does

2015-03-16 Thread Carl Eugen Hoyos
Carl Eugen Hoyos  ag.or.at> writes:

> Attached poc fixes remuxing hevc from mpegts to mkv.
> The mov muxer writes an empty hvcC atom in this case.
> 
> What has to be done?

Ping.

Or would the output file be invalid?
In this case, an error should be printed imo.

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH] is_compiled flag not being cleared in av_opencl_uninit

2015-03-16 Thread Michael Niedermayer
On Mon, Mar 16, 2015 at 01:20:25PM -0500, Srikanth G wrote:
> Attaching the patch file per Wei's request

applied

thanks

[..,]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.


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


Re: [FFmpeg-devel] [RFC]Ignore ff_isom_write_hvcc() return value writing mkv like the mov muxer does

2015-03-16 Thread Michael Niedermayer
On Mon, Mar 16, 2015 at 09:56:43PM +, Carl Eugen Hoyos wrote:
> Carl Eugen Hoyos  ag.or.at> writes:
> 
> > Attached poc fixes remuxing hevc from mpegts to mkv.
> > The mov muxer writes an empty hvcC atom in this case.
> > 
> > What has to be done?
> 
> Ping.
> 
> Or would the output file be invalid?
> In this case, an error should be printed imo.

i suspect noone knows and its not documented

thus i would suggest to wait 3 days and then commit if noone replied
with a reference to documentation by then, assuming these files do
playback correctly



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

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway


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


Re: [FFmpeg-devel] [PATCH 4/5] avfilter/formats: proper error handling in ff_set_common_*() functions

2015-03-16 Thread Clément Bœsch
On Mon, Mar 16, 2015 at 01:26:04PM +0100, Stefano Sabatini wrote:
> On date Monday 2015-03-16 11:11:55 +0100, Clément Bœsch encoded:
> > On Mon, Mar 16, 2015 at 11:05:12AM +0100, Stefano Sabatini wrote:
> > > On date Monday 2015-03-16 11:00:12 +0100, Stefano Sabatini encoded:
> > > > On date Sunday 2015-03-15 15:15:34 +0100, Clément Bœsch encoded:
> > > [...]
> > > > > To elaborate on this, the bug here is referring to an allocation 
> > > > > check not
> > > > > done in the caller (there are many currently since I'm just 
> > > > > introducing
> > > > > the error handling).
> > > > 
> > > > I won't block this patch, but getting a crash in a specified point of
> > > > the program is more useful than failing with this:
> > > > 
> > > 
> > > > A bug occurred somewhere
> > > 
> > > Now this is not correct, it should be:
> > > there is a bug somewhere
> > > 
> > > (since bug don't "occurr" but stay/are). Now that (the presence of a
> > > "bug") is not even a good reason to fail a program, it should had been
> > > named something more meaningful like "unexpected condition" (but again
> > > - for that a crash or an assert is just more useful to the
> > > programmer).
> > 
> > We are talking about a crash non programmer would get. If you want, I can
> > add an av_log message saying that the filter is buggy. I just don't want
> > to create dozens of potential crashes when we know this can be NULL in the
> > current state. Asserting on the result of malloc feels just wrong.
> 
> What about asserting in the callee if the argument is NULL?

Well that's what you are proposing since the beginning. I'm not sure I get
your point (nor you getting mine...)

Anyway, patch applied. I can add still add the av_log() if you want to.

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH 1/5] avfilter/formats: remove unused COPY_INT_LIST() macro

2015-03-16 Thread Clément Bœsch
On Sun, Mar 15, 2015 at 03:00:26PM +0100, Stefano Sabatini wrote:
> On date Sunday 2015-03-15 14:24:26 +0100, Clément Bœsch encoded:
> > This macro is unused since 247fa6c27c4589d0f7a427c520d782edbb6de060.
> > ---
> >  libavfilter/formats.c | 12 
> >  1 file changed, 12 deletions(-)
> > 
> > diff --git a/libavfilter/formats.c b/libavfilter/formats.c
> > index f25328c..1fc7fa6 100644
> > --- a/libavfilter/formats.c
> > +++ b/libavfilter/formats.c
> > @@ -262,18 +262,6 @@ int ff_fmt_is_in(int fmt, const int *fmts)
> >  return 0;
> >  }
> >  
> > -#define COPY_INT_LIST(list_copy, list, type) {  \
> > -int count = 0;  \
> > -if (list)   \
> > -for (count = 0; list[count] != -1; count++) \
> > -;   \
> > -list_copy = av_calloc(count+1, sizeof(type));   \
> > -if (list_copy) {\
> > -memcpy(list_copy, list, sizeof(type) * count);  \
> > -list_copy[count] = -1;  \
> > -}   \
> > -}
> > -
> 
> LGTM.

Applied, thanks.

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH 5/5] avfilter: handle error in query_formats() of a bunch of random video filters

2015-03-16 Thread Clément Bœsch
On Mon, Mar 16, 2015 at 01:25:11PM +0100, Stefano Sabatini wrote:
> On date Sunday 2015-03-15 14:24:30 +0100, Clément Bœsch encoded:
> > ---
> >  libavfilter/f_select.c  |  9 -
> >  libavfilter/vf_codecview.c  |  6 --
> >  libavfilter/vf_colorbalance.c   |  7 ---
> >  libavfilter/vf_colormatrix.c|  8 
> >  libavfilter/vf_curves.c |  6 --
> >  libavfilter/vf_dctdnoiz.c   |  6 --
> >  libavfilter/vf_decimate.c   |  6 --
> >  libavfilter/vf_delogo.c |  7 ---
> >  libavfilter/vf_deshake.c|  8 
> >  libavfilter/vf_drawbox.c|  7 ---
> >  libavfilter/vf_edgedetect.c | 15 ++-
> >  libavfilter/vf_elbg.c   |  8 
> >  libavfilter/vf_eq.c |  8 
> >  libavfilter/vf_fieldmatch.c |  6 --
> >  libavfilter/vf_gradfun.c|  8 
> >  libavfilter/vf_histeq.c |  7 ---
> >  libavfilter/vf_hqdn3d.c |  8 
> >  libavfilter/vf_hqx.c|  6 --
> >  libavfilter/vf_hue.c|  8 
> >  libavfilter/vf_idet.c   |  8 
> >  libavfilter/vf_lenscorrection.c |  7 ---
> >  libavfilter/vf_libopencv.c  |  7 ---
> >  libavfilter/vf_lut.c|  7 ---
> >  libavfilter/vf_lut3d.c  |  6 --
> >  libavfilter/vf_mcdeint.c|  8 
> >  libavfilter/vf_mpdecimate.c |  8 
> >  libavfilter/vf_owdenoise.c  |  6 --
> >  27 files changed, 118 insertions(+), 83 deletions(-)
> 
> LGTM, thanks.

Pushed.

Many other filters need the same adjustment, maintainers are welcome in
patching their filters.

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH 2/5] avfilter/formats: use av_realloc_array in ADD_FORMAT()

2015-03-16 Thread Clément Bœsch
On Sun, Mar 15, 2015 at 03:01:55PM +0100, Stefano Sabatini wrote:
> On date Sunday 2015-03-15 14:24:27 +0100, Clément Bœsch encoded:
> > ---
> >  libavfilter/formats.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavfilter/formats.c b/libavfilter/formats.c
> > index 1fc7fa6..896ceeb 100644
> > --- a/libavfilter/formats.c
> > +++ b/libavfilter/formats.c
> > @@ -308,8 +308,8 @@ do {
> > \
> >  if (!(*f) && !(*f = av_mallocz(sizeof(**f   \
> >  return AVERROR(ENOMEM); \
> >  \
> > -fmts = av_realloc((*f)->list,   \
> > -  sizeof(*(*f)->list) * ((*f)->nb + 1));\
> > +fmts = av_realloc_array((*f)->list, (*f)->nb + 1,   \
> > +sizeof(*(*f)->list));   \
> >  if (!fmts) {\
> >  if (!oldf)  \
> >  av_freep(f);\
> 
> LGTM.

Pushed, thanks

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH 3/5] avfilter/formats: proper error handling in ff_channel_layouts_ref() and ff_formats_ref()

2015-03-16 Thread Clément Bœsch
On Sun, Mar 15, 2015 at 03:03:43PM +0100, Stefano Sabatini wrote:
> On date Sunday 2015-03-15 14:24:28 +0100, Clément Bœsch encoded:
> > Also make sure the allocation and its check are properly done.
> > ---
> >  libavfilter/formats.c | 22 +++---
> >  libavfilter/formats.h |  6 +++---
> >  2 files changed, 14 insertions(+), 14 deletions(-)
> 
> LGTM, thanks.

Upstreamed, thanks

-- 
Clément B.


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


[FFmpeg-devel] [PATCH] web/index: News about 2.6.1

2015-03-16 Thread Michael Niedermayer
---
 src/index |   12 
 1 file changed, 12 insertions(+)

diff --git a/src/index b/src/index
index 22dd574..787f78c 100644
--- a/src/index
+++ b/src/index
@@ -36,6 +36,18 @@
 News
   
 
+  March 16, 2015, FFmpeg 2.6.1
+  
+We have made a new major release (2.6)
+and now one week afterward 2.6.1. It contains all features and bugfixes of 
the git master branch from the 6th March.
+Please see the http://git.videolan.org/?p=ffmpeg.git;a=blob;f=Changelog;hb=release/2.6";>Changelog
 for a
+list of note-worthy changes.
+  
+  
+We recommend users, distributors and system integrators to upgrade unless 
they use
+current git master.
+  
+
   March 4, 2015, Google Summer of Code
   
 FFmpeg has been accepted as a http://www.google-melange.com/gsoc/homepage/google/gsoc2015";>Google 
Summer of Code Project. If you wish to
-- 
1.7.9.5

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


Re: [FFmpeg-devel] [PATCH] web/index: News about 2.6.1

2015-03-16 Thread Clément Bœsch
On Mon, Mar 16, 2015 at 11:47:10PM +0100, Michael Niedermayer wrote:
> ---
>  src/index |   12 
>  1 file changed, 12 insertions(+)
> 
> diff --git a/src/index b/src/index
> index 22dd574..787f78c 100644
> --- a/src/index
> +++ b/src/index
> @@ -36,6 +36,18 @@
>  News
>
>  
> +  March 16, 2015, FFmpeg 2.6.1
> +  
> +We have made a new major release ( href="download.html#release_2.6">2.6)
> +and now one week afterward 2.6.1. It contains all features and bugfixes 
> of the git master branch from the 6th March.
> +Please see the  href="http://git.videolan.org/?p=ffmpeg.git;a=blob;f=Changelog;hb=release/2.6";>Changelog
>  for a
> +list of note-worthy changes.

Don't want to link to the release notes instead/too? :(

> +  
> +  
> +We recommend users, distributors and system integrators to upgrade 
> unless they use
> +current git master.
> +  
> +

LGTM otherwise, thank you

[...]

-- 
Clément B.


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


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

2015-03-16 Thread Michael Niedermayer
On Tue, Mar 17, 2015 at 12:44:07AM +0530, Himangi Saraogi wrote:
> On 14 March 2015 at 09:42, Michael Niedermayer  wrote:
> 
> > On Wed, Mar 11, 2015 at 03:20:47AM +0530, Himangi Saraogi wrote:
> > > This is an exact inverse of the telecine filter unlike previously
> > existing
> > > pullup and fieldmatch ones.
> > >
> > > The algorithm was briefly discussed with Carl. The algorithm is not
> > completely
> > > tested, though I do have a some sample suggestions and will be testing on
> > > them soon. Documentation is yet to be added.
> > > ---
> > >  Changelog   |   1 +
> > >  libavfilter/Makefile|   1 +
> > >  libavfilter/allfilters.c|   1 +
> > >  libavfilter/vf_detelecine.c | 323
> > 
> > >  4 files changed, 326 insertions(+)
> > >  create mode 100644 libavfilter/vf_detelecine.c
> >
> >
> >
> > >
> > > diff --git a/Changelog b/Changelog
> > > index e88359d..341faca 100644
> > > --- a/Changelog
> > > +++ b/Changelog
> > > @@ -3,6 +3,7 @@ releases are sorted from youngest to oldest.
> > >
> > >  version :
> > >  - FFT video filter
> > > +- Detelecine filter
> > >
> > >
> > >  version 2.6:
> > > diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> > > index b184f07..399072c 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 043ac56..2e4e2f6 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..ce9ba74
> > > --- /dev/null
> > > +++ b/libavfilter/vf_detelecine.c
> > > @@ -0,0 +1,323 @@
> > > +/*
> > > + * 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;
> > > +unsigned int pattern_pos;
> > > +unsigned int nskip_fields;
> > > +
> > > +AVRational pts;
> > > +double 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, "

Re: [FFmpeg-devel] [PATCH] web/index: News about 2.6.1

2015-03-16 Thread Michael Niedermayer
On Mon, Mar 16, 2015 at 11:52:19PM +0100, Clément Bœsch wrote:
> On Mon, Mar 16, 2015 at 11:47:10PM +0100, Michael Niedermayer wrote:
> > ---
> >  src/index |   12 
> >  1 file changed, 12 insertions(+)
> > 
> > diff --git a/src/index b/src/index
> > index 22dd574..787f78c 100644
> > --- a/src/index
> > +++ b/src/index
> > @@ -36,6 +36,18 @@
> >  News
> >
> >  
> > +  March 16, 2015, FFmpeg 2.6.1
> > +  
> > +We have made a new major release ( > href="download.html#release_2.6">2.6)
> > +and now one week afterward 2.6.1. It contains all features and 
> > bugfixes of the git master branch from the 6th March.
> > +Please see the  > href="http://git.videolan.org/?p=ffmpeg.git;a=blob;f=Changelog;hb=release/2.6";>Changelog
> >  for a
> > +list of note-worthy changes.
> 
> Don't want to link to the release notes instead/too? :(

ill link to the release notes instead unless someone objects

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates


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


Re: [FFmpeg-devel] [PATCH] web/index: News about 2.6.1

2015-03-16 Thread Michael Niedermayer
On Tue, Mar 17, 2015 at 12:21:18AM +0100, Michael Niedermayer wrote:
> On Mon, Mar 16, 2015 at 11:52:19PM +0100, Clément Bœsch wrote:
> > On Mon, Mar 16, 2015 at 11:47:10PM +0100, Michael Niedermayer wrote:
> > > ---
> > >  src/index |   12 
> > >  1 file changed, 12 insertions(+)
> > > 
> > > diff --git a/src/index b/src/index
> > > index 22dd574..787f78c 100644
> > > --- a/src/index
> > > +++ b/src/index
> > > @@ -36,6 +36,18 @@
> > >  News
> > >
> > >  
> > > +  March 16, 2015, FFmpeg 2.6.1
> > > +  
> > > +We have made a new major release ( > > href="download.html#release_2.6">2.6)
> > > +and now one week afterward 2.6.1. It contains all features and 
> > > bugfixes of the git master branch from the 6th March.
> > > +Please see the  > > href="http://git.videolan.org/?p=ffmpeg.git;a=blob;f=Changelog;hb=release/2.6";>Changelog
> > >  for a
> > > +list of note-worthy changes.
> > 
> > Don't want to link to the release notes instead/too? :(
> 
> ill link to the release notes instead unless someone objects

changed, applied so it doesnt become olds

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates


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


[FFmpeg-devel] [PATCH 2/2] libavutil: add bmi2 optimized av_zhb

2015-03-16 Thread James Almer
Signed-off-by: James Almer 
---
GCC apparently can't generate a bzhi instruction on its own from the c version, 
so 
here's a custom implementation.

Before:

gcc -O3
:
   0:   89 f1   movecx,esi
   2:   ba 01 00 00 00  movedx,0x1
   7:   d3 e2   shledx,cl
   9:   83 ea 01subedx,0x1
   c:   89 d0   moveax,edx
   e:   21 f8   andeax,edi
  10:   c3  ret

gcc -mbmi2 -O3
:
   0:   ba 01 00 00 00  movedx,0x1
   5:   c4 e2 49 f7 d2  shlx   edx,edx,esi
   a:   8d 42 ffleaeax,[rdx-0x1]
   d:   21 f8   andeax,edi
   f:   c3  ret

After:

gcc -mbmi2 -O3
:
   0:   c4 e2 48 f5 c7  bzhi   eax,edi,esi
   5:   c3  ret

The non-bmi2 example is a bit bloated with movs to have values in ecx (needed 
for 
shl) and eax (ret value) since, unlike the actual function, it was not inlined.
Still, best case scenario is mov + shl + sub/dec/lea + and versus a single bzhi 
when p is not a constant.

 libavutil/x86/intmath.h | 25 +++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h
index 7aa6bc4..f19ef64 100644
--- a/libavutil/x86/intmath.h
+++ b/libavutil/x86/intmath.h
@@ -24,15 +24,36 @@
 #include 
 #include "config.h"
 
+#if defined(__GNUC__)
+
 /* Our generic version of av_popcount is faster than GCC's built-in on
  * CPUs that don't support the popcnt instruction.
  */
-#if defined(__GNUC__) && defined(__POPCNT__)
+#if defined(__POPCNT__)
+
 #define av_popcount   __builtin_popcount
 #if ARCH_X86_64
 #define av_popcount64 __builtin_popcountll
 #endif
 
-#endif /* defined(__GNUC__) && defined(__POPCNT__) */
+#endif /* __POPCNT__ */
+
+#if defined(__BMI2__)
+
+#define av_zhb av_zhb_bmi2
+static av_always_inline av_const unsigned av_zhb_bmi2(unsigned a, unsigned p)
+{
+if (av_builtin_constant_p(p))
+return a & ((1 << p) - 1);
+else {
+unsigned x;
+__asm__ ("bzhi %2, %1, %0 \n\t" : "=r"(x) : "rm"(a), "r"(p));
+return x;
+}
+}
+
+#endif /* __BMI2__ */
+
+#endif /* __GNUC__ */
 
 #endif /* AVUTIL_X86_INTMATH_H */
-- 
2.3.2

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


[FFmpeg-devel] [PATCH 1/2] libavutil: add av_zhb

2015-03-16 Thread James Almer
Signed-off-by: James Almer 
---
Better name (av_zero_high_bits?) and doxygen welcome.

 libavutil/common.h | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/libavutil/common.h b/libavutil/common.h
index 852c1de..2ee5a98 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -301,6 +301,17 @@ static av_always_inline av_const int 
av_popcount64_c(uint64_t x)
 return av_popcount((uint32_t)x) + av_popcount((uint32_t)(x >> 32));
 }
 
+/**
+ * Zero high bits from a starting from bit position p
+ * @param  a value to clip
+ * @param  p bit position to clip at
+ * @return clipped value
+ */
+static av_always_inline av_const unsigned av_zhb_c(unsigned a, unsigned p)
+{
+return a & ((1 << p) - 1);
+}
+
 #define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
 #define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 
24))
 
@@ -484,3 +495,6 @@ static av_always_inline av_const int 
av_popcount64_c(uint64_t x)
 #ifndef av_popcount64
 #   define av_popcount64av_popcount64_c
 #endif
+#ifndef av_zhb
+#   define av_zhb   av_zhb_c
+#endif
-- 
2.3.2

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


[FFmpeg-devel] GSoc Qualification Task - Implementing Compression technique B44 as a part of exr format (libavcodec/exr.c)

2015-03-16 Thread greeshma
Hello ,

I have implemented B44 lossy compression technique.The first patch is
hereby attached.Please have a look.
The diff file is also attached.

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 6251fb7..e540d4c 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -45,6 +45,10 @@
 #include "mathops.h"
 #include "thread.h"

+typedef int bool;
+#define true 1
+#define false 0
+
 enum ExrCompr {
 EXR_RAW,
 EXR_RLE,
@@ -69,6 +73,19 @@ typedef struct EXRChannel {
 enum ExrPixelType pixel_type;
 } EXRChannel;

+
+typedef struct EXRChannelData
+{
+unsigned short *start;
+unsigned short *end;
+int nx;
+int ny;
+int ys;
+enum ExrPixelType type;
+bool pLinear;
+int size;
+}EXRChannelData;
+
 typedef struct EXRThreadData {
 uint8_t *uncompressed_data;
 int uncompressed_size;

@@ -105,6 +122,8 @@ typedef struct EXRContext {

 EXRChannel *channels;
 int nb_channels;
+
+EXRChannelData *channel_data;
 EXRThreadData *thread_data;

@@ -770,6 +789,259 @@ static int piz_uncompress(EXRContext *s, const
uint8_t *src, int ssize,
 return 0;
 }

+
+/*
+implemetation of B44_uncompress method which is a lossy compression method
which the following features
+
+compression rate 32/14
+works only on channels of HALF .It'll not work on FLOAT and UINT
+the compression method is as follows: It interprets 32byte input data as
16 - 16 bit integers
+It divides it into blocks of 4 by 4 pixels.Itt compresses 16 into 14 bytes.
+
+//-
+//
+//
+//
+//  This compressor is lossy for HALF channels; the compression rate
+//  is fixed at 32/14 (approximately 2.28).  FLOAT and UINT channels
+//  are not compressed; their data are preserved exactly.
+//
+//  Each HALF channel is split into blocks of 4 by 4 pixels.  An
+//  uncompressed block occupies 32 bytes, which are re-interpreted
+//  as sixteen 16-bit unsigned integers, t[0] ... t[15].  Compression
+//  shrinks the block to 14 bytes.  The compressed 14-byte block
+//  contains
+//
+//   - t[0]
+//
+//   - a 6-bit shift value
+//
+//   - 15 densely packed 6-bit values, r[0] ... r[14], which are
+// computed by subtracting adjacent pixel values and right-
+// shifting the differences according to the stored shift value.
+//
+// Differences between adjacent pixels are computed according
+// to the following diagram:
+//
+//   0 >  1 >  2 >  3
+//   | 37   11
+//   |
+//   | 0
+//   |
+//   v
+//   4 >  5 >  6 >  7
+//   | 48   12
+//   |
+//   | 1
+//   |
+//   v
+//   8 >  9 > 10 > 11
+//   | 59   13
+//   |
+//   | 2
+//   |
+//   v
+//  12 > 13 > 14 > 15
+// 6   10   14
+//
+//  Here
+//
+//   5 -> 6
+// 8
+//
+//  means that r[8] is the difference between t[5] and t[6].
+//
+//   - optionally, a 4-by-4 pixel block where all pixels have the
+// same value can be treated as a special case, where the
+// compressed block contains only 3 instead of 14 bytes:
+// t[0], followed by an "impossible" 6-bit shift value and
+// two padding bits.
+//
+//  This compressor can handle positive and negative pixel values.
+//  NaNs and infinities are replaced with zeroes before compression.
+//
+//--
+*/
+
+static
+void unpack14 (const unsigned char b[14], unsigned short s[16])
+{
+//
+// Unpack a 14-byte block into 4 by 4 16-bit pixels.
+//
+unsigned short shift,bias;
+#if defined (DEBUG)
+assert (b[2] != 0xfc);
+#endif
+s[ 0] = (b[0] << 8) | b[1];
+shift = (b[ 2] >> 2);
+bias = (0x20 << shift);
+s[ 4] = s[ 0] + b[ 2] << 4) | (b[ 3] >> 4)) & 0x3f) << shift) -
bias;
+s[ 8] = s[ 4] + b[ 3] << 2) | (b[ 4] >> 6)) & 0x3f) << shift) -
bias;
+s[12] = s[ 8] +   ((b[ 4]   & 0x3f) << shift) -
bias;
+s[ 1] = s[ 0] +   ((b[ 5] >> 2) << shift) -
bias;
+s[ 5] = s[ 4] + b[ 5] << 4) | (b[ 6] >> 4)) & 0x3f) << shift) -
bias;
+s[ 9] = s[ 8] + b[ 6] << 2) | (b[ 7] >> 6)) & 0x3f) << shift) -
bias;
+s[13] = s[12] +   ((b[ 7]   & 0x3f) << shift) -
bias;
+s[ 2] = s[ 1] +   ((b[ 8] >> 2) << shift) -
bias;
+s[ 6] = s[ 5] + b[ 8] << 4) | (b[ 9] >> 4)) & 0x3f) << shift) -
bias;
+s[10] = s[ 9] + b[ 9] << 2) | (b[10] >> 6)) & 0x3f) << shift) -
bias;
+s[14] = s[13] +   ((b[10]   & 0x3f) << sh