Re: [FFmpeg-devel] [PATCH] ffmpeg: check fclose return values

2016-01-07 Thread Ganesh Ajjanagadde
On Thu, Jan 7, 2016 at 3:57 PM, Ganesh Ajjanagadde  wrote:
> On Thu, Jan 7, 2016 at 2:18 PM, Michael Niedermayer
>  wrote:
>> On Thu, Jan 07, 2016 at 11:16:27PM +0100, Michael Niedermayer wrote:
>>> On Thu, Jan 07, 2016 at 10:00:47AM -0800, Ganesh Ajjanagadde wrote:
>>> > On Thu, Jan 7, 2016 at 9:27 AM, Michael Niedermayer
>>> >  wrote:
>>> > > On Wed, Jan 06, 2016 at 09:00:46PM -0800, Ganesh Ajjanagadde wrote:
>>> > >> In the spirit of commit a956840cbc. Simple method to reproduce:
>>> > >> pass -vstats_file /dev/full to ffmpeg.
>>> > >>
>>> > >> All raw fclose usages in ffmpeg.c taken care of here.
>>> > >>
>>> > >> Signed-off-by: Ganesh Ajjanagadde 
>>> > >> ---
>>> > >>  ffmpeg.c | 13 ++---
>>> > >>  1 file changed, 10 insertions(+), 3 deletions(-)
>>> > >
>>> > > LGTM
>>> > >
>>> > > thanks
>>> >
>>> > So there is actually a problem with the diagnostic obtained, a more
>>> > accurate diagnostic is via errno, say strerror(errno) instead of
>>> > av_err2str(ret).
>>> > Comparison:
>>> > Error closing vstats file, loss of information possible: Operation not 
>>> > permitted
>>> > vs
>>> > Error closing vstats file, loss of information possible: No space left on 
>>> > device
>>> > for the provided /dev/full example.
>>> >
>>> > So there are a number of possiblities:
>>> > 1. Have 2 separate av_log lines, one for each of these.
>>> > 2. A single av_log line, using strerror(errno).
>>> > 3. Leave as is.
>>> >
>>> > I prefer 2. Let me know your preference, and I will push later.
>>>
>>> yes agree, 2.
>>
>> probably should use av_err2str() instead of strerror() though
>
> I thought strerror was C89? Your idea unfortunately causes problems
> (suspect it is because appropriate error tag is missing):
> Error closing vstats file, loss of information possible: Error number
> 28 occurred.

Did some digging, using strerror should be fine, see 984-989 of
cmdutils.c for very similar usage.

>
>>
>> [...]
>>
>> --
>> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>>
>> What does censorship reveal? It reveals fear. -- Julian Assange
>>
>> ___
>> 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] ffmpeg: check fclose return values

2016-01-07 Thread Michael Niedermayer
On Thu, Jan 07, 2016 at 04:01:14PM -0800, Ganesh Ajjanagadde wrote:
> On Thu, Jan 7, 2016 at 3:57 PM, Ganesh Ajjanagadde  wrote:
> > On Thu, Jan 7, 2016 at 2:18 PM, Michael Niedermayer
> >  wrote:
> >> On Thu, Jan 07, 2016 at 11:16:27PM +0100, Michael Niedermayer wrote:
> >>> On Thu, Jan 07, 2016 at 10:00:47AM -0800, Ganesh Ajjanagadde wrote:
> >>> > On Thu, Jan 7, 2016 at 9:27 AM, Michael Niedermayer
> >>> >  wrote:
> >>> > > On Wed, Jan 06, 2016 at 09:00:46PM -0800, Ganesh Ajjanagadde wrote:
> >>> > >> In the spirit of commit a956840cbc. Simple method to reproduce:
> >>> > >> pass -vstats_file /dev/full to ffmpeg.
> >>> > >>
> >>> > >> All raw fclose usages in ffmpeg.c taken care of here.
> >>> > >>
> >>> > >> Signed-off-by: Ganesh Ajjanagadde 
> >>> > >> ---
> >>> > >>  ffmpeg.c | 13 ++---
> >>> > >>  1 file changed, 10 insertions(+), 3 deletions(-)
> >>> > >
> >>> > > LGTM
> >>> > >
> >>> > > thanks
> >>> >
> >>> > So there is actually a problem with the diagnostic obtained, a more
> >>> > accurate diagnostic is via errno, say strerror(errno) instead of
> >>> > av_err2str(ret).
> >>> > Comparison:
> >>> > Error closing vstats file, loss of information possible: Operation not 
> >>> > permitted
> >>> > vs
> >>> > Error closing vstats file, loss of information possible: No space left 
> >>> > on device
> >>> > for the provided /dev/full example.
> >>> >
> >>> > So there are a number of possiblities:
> >>> > 1. Have 2 separate av_log lines, one for each of these.
> >>> > 2. A single av_log line, using strerror(errno).
> >>> > 3. Leave as is.
> >>> >
> >>> > I prefer 2. Let me know your preference, and I will push later.
> >>>
> >>> yes agree, 2.
> >>
> >> probably should use av_err2str() instead of strerror() though
> >
> > I thought strerror was C89? Your idea unfortunately causes problems
> > (suspect it is because appropriate error tag is missing):
> > Error closing vstats file, loss of information possible: Error number
> > 28 occurred.
> 
> Did some digging, using strerror should be fine, see 984-989 of
> cmdutils.c for very similar usage.

probably but why does av_err2str not work ? did you use
AVERROR(errno) ?

[...]
-- 
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 3/3] lavf/mov: reindent

2016-01-07 Thread Rodger Combs
---
 libavformat/mov.c | 156 +++---
 1 file changed, 78 insertions(+), 78 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index cde4140..a3ca394 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4421,94 +4421,94 @@ static void mov_read_chapters(AVFormatContext *s)
 int chapter_track;
 
 for (j = 0; j < mov->nb_chapter_tracks; j++) {
-chapter_track = mov->chapter_tracks[j];
-st = NULL;
-for (i = 0; i < s->nb_streams; i++)
-if (s->streams[i]->id == chapter_track) {
-st = s->streams[i];
-break;
+chapter_track = mov->chapter_tracks[j];
+st = NULL;
+for (i = 0; i < s->nb_streams; i++)
+if (s->streams[i]->id == chapter_track) {
+st = s->streams[i];
+break;
+}
+if (!st) {
+av_log(s, AV_LOG_ERROR, "Referenced QT chapter track not found\n");
+continue;
 }
-if (!st) {
-av_log(s, AV_LOG_ERROR, "Referenced QT chapter track not found\n");
-continue;
-}
 
-sc = st->priv_data;
-cur_pos = avio_tell(sc->pb);
+sc = st->priv_data;
+cur_pos = avio_tell(sc->pb);
+
+if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
+st->disposition |= AV_DISPOSITION_ATTACHED_PIC | 
AV_DISPOSITION_TIMED_THUMBNAILS;
+if (st->nb_index_entries) {
+// Retrieve the first frame, if possible
+AVPacket pkt;
+AVIndexEntry *sample = >index_entries[0];
+if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
+av_log(s, AV_LOG_ERROR, "Failed to retrieve first 
frame\n");
+goto finish;
+}
 
-if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-st->disposition |= AV_DISPOSITION_ATTACHED_PIC | 
AV_DISPOSITION_TIMED_THUMBNAILS;
-if (st->nb_index_entries) {
-// Retrieve the first frame, if possible
-AVPacket pkt;
-AVIndexEntry *sample = >index_entries[0];
-if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
-av_log(s, AV_LOG_ERROR, "Failed to retrieve first frame\n");
-goto finish;
-}
+if (av_get_packet(sc->pb, , sample->size) < 0)
+goto finish;
 
-if (av_get_packet(sc->pb, , sample->size) < 0)
-goto finish;
+st->attached_pic  = pkt;
+st->attached_pic.stream_index = st->index;
+st->attached_pic.flags   |= AV_PKT_FLAG_KEY;
+}
+} else {
+st->codec->codec_type = AVMEDIA_TYPE_DATA;
+st->codec->codec_id = AV_CODEC_ID_BIN_DATA;
+st->discard = AVDISCARD_ALL;
+for (i = 0; i < st->nb_index_entries; i++) {
+AVIndexEntry *sample = >index_entries[i];
+int64_t end = i+1 < st->nb_index_entries ? 
st->index_entries[i+1].timestamp : st->duration;
+uint8_t *title;
+uint16_t ch;
+int len, title_len;
+
+if (end < sample->timestamp) {
+av_log(s, AV_LOG_WARNING, "ignoring stream duration which 
is shorter than chapters\n");
+end = AV_NOPTS_VALUE;
+}
 
-st->attached_pic  = pkt;
-st->attached_pic.stream_index = st->index;
-st->attached_pic.flags   |= AV_PKT_FLAG_KEY;
-}
-} else {
-st->codec->codec_type = AVMEDIA_TYPE_DATA;
-st->codec->codec_id = AV_CODEC_ID_BIN_DATA;
-st->discard = AVDISCARD_ALL;
-for (i = 0; i < st->nb_index_entries; i++) {
-AVIndexEntry *sample = >index_entries[i];
-int64_t end = i+1 < st->nb_index_entries ? 
st->index_entries[i+1].timestamp : st->duration;
-uint8_t *title;
-uint16_t ch;
-int len, title_len;
-
-if (end < sample->timestamp) {
-av_log(s, AV_LOG_WARNING, "ignoring stream duration which is 
shorter than chapters\n");
-end = AV_NOPTS_VALUE;
-}
+if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
+av_log(s, AV_LOG_ERROR, "Chapter %d not found in file\n", 
i);
+goto finish;
+}
 
-if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
-av_log(s, AV_LOG_ERROR, "Chapter %d not found in file\n", i);
-goto finish;
-}
+// the first two bytes are the length of the title
+len = avio_rb16(sc->pb);
+if (len > sample->size-2)
+continue;
+title_len = 2*len + 1;
+if (!(title = av_mallocz(title_len)))
+goto finish;
+
+// The samples could 

[FFmpeg-devel] [PATCH 1/3] lavf: add AV_DISPOSITION_TIMED_THUMBNAILS

2016-01-07 Thread Rodger Combs
---
 ffprobe.c  |  1 +
 libavformat/avformat.h | 12 +---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ffprobe.c b/ffprobe.c
index c352b44..20af969 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -2326,6 +2326,7 @@ static int show_stream(WriterContext *w, AVFormatContext 
*fmt_ctx, int stream_id
 PRINT_DISPOSITION(VISUAL_IMPAIRED,  "visual_impaired");
 PRINT_DISPOSITION(CLEAN_EFFECTS,"clean_effects");
 PRINT_DISPOSITION(ATTACHED_PIC, "attached_pic");
+PRINT_DISPOSITION(TIMED_THUMBNAILS, "timed_thumbnails");
 writer_print_section_footer(w);
 }
 
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 95a645b..eaf6270 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -824,11 +824,17 @@ typedef struct AVIndexEntry {
 #define AV_DISPOSITION_CLEAN_EFFECTS 0x0200  /**< stream without voice */
 /**
  * The stream is stored in the file as an attached picture/"cover art" (e.g.
- * APIC frame in ID3v2). The single packet associated with it will be returned
- * among the first few packets read from the file unless seeking takes place.
- * It can also be accessed at any time in AVStream.attached_pic.
+ * APIC frame in ID3v2). The first (usually only) packet associated with it
+ * will be returned among the first few packets read from the file unless
+ * seeking takes place. It can also be accessed at any time in
+ * AVStream.attached_pic.
  */
 #define AV_DISPOSITION_ATTACHED_PIC  0x0400
+/**
+ * The stream is sparse, and contains thumbnail images, often corresponding
+ * to chapter markers. Only ever used with AV_DISPOSITION_ATTACHED_PIC.
+ */
+#define AV_DISPOSITION_TIMED_THUMBNAILS  0x0800
 
 typedef struct AVStreamInternal AVStreamInternal;
 
-- 
2.6.4

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


Re: [FFmpeg-devel] [PATCH] rtp: Fix play multiple multicast streams with the same port

2016-01-07 Thread Zhao Zhili
Sorry, I work hard to cross the Great Fire Wall to send this patch and
cannot send it as plaintext.
Now send it as attachment.

On Fri, Jan 8, 2016 at 1:52 AM, Michael Niedermayer 
wrote:

> On Thu, Jan 07, 2016 at 06:58:49PM +0800, Zhao Zhili wrote:
> > I made a mistake that rtp and rtcp cannot be the same port. A new patch
> is
> > appended.
> >
> > From: Zhao Zhili 
> > Date: Thu, 7 Jan 2016 18:55:50 +0800
> > Subject: [PATCH] rtp: Fix play multiple multicast streams with the same
> port
> >
> > We cannot play multiple multicast streams with the same port at the
> > same time. This is because both rtp and rtcp port are opened in
> > read-write mode, so they will not bind to the multicast address. Try
> > to make rtp port as read-only by default to solve this bug.
> >
> > Signed-off-by: Zhao Zhili 
> > ---
> >  libavformat/rtpproto.c | 6 --
> >  libavformat/rtsp.c | 2 +-
> >  2 files changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
> > index e0aa23e..04a40ea 100644
> > --- a/libavformat/rtpproto.c
> > +++ b/libavformat/rtpproto.c
> > @@ -323,6 +323,7 @@ static int rtp_open(URLContext *h, const char *uri,
> int
> > flags)
> >  char path[1024];
> >  const char *p;
> >  int i, max_retry_count = 3;
> > +int rtcpflags;
> >
> >  av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname),
> _port,
> >   path, sizeof(path), uri);
> > @@ -387,12 +388,13 @@ static int rtp_open(URLContext *h, const char *uri,
> > int flags)
> >  s->local_rtpport = -1;
> >  continue;
> >  }
> > +rtcpflags = flags | AVIO_FLAG_WRITE;
> >  if (s->local_rtcpport < 0) {
> >  s->local_rtcpport = s->local_rtpport + 1;
> >  build_udp_url(s, buf, sizeof(buf),
> >hostname, s->rtcp_port, s->local_rtcpport,
> >sources, block);
> > -if (ffurl_open(>rtcp_hd, buf, flags,
> > >interrupt_callback, NULL) < 0) {
> > +if (ffurl_open(>rtcp_hd, buf, rtcpflags,
> > >interrupt_callback, NULL) < 0) {
>
> the patch is corrupted by linebreaks
>
> attaching it usually fixes that
>
> [...]
> --
> 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.
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
From 600d1509678dcb464de1008d27a3bf2b2a32cde1 Mon Sep 17 00:00:00 2001
From: Zhao Zhili 
Date: Thu, 7 Jan 2016 18:55:50 +0800
Subject: [PATCH] rtp: Fix play multiple multicast streams with the same port

We cannot play multiple multicast streams with the same port at the
same time. This is because both rtp and rtcp port are opened in
read-write mode, so they will not bind to the multicast address. Try
to make rtp port as read-only by default to solve this bug.

Signed-off-by: Zhao Zhili 
---
 libavformat/rtpproto.c | 6 --
 libavformat/rtsp.c | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index e0aa23e..04a40ea 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -323,6 +323,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
 char path[1024];
 const char *p;
 int i, max_retry_count = 3;
+int rtcpflags;
 
 av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), _port,
  path, sizeof(path), uri);
@@ -387,12 +388,13 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
 s->local_rtpport = -1;
 continue;
 }
+rtcpflags = flags | AVIO_FLAG_WRITE;
 if (s->local_rtcpport < 0) {
 s->local_rtcpport = s->local_rtpport + 1;
 build_udp_url(s, buf, sizeof(buf),
   hostname, s->rtcp_port, s->local_rtcpport,
   sources, block);
-if (ffurl_open(>rtcp_hd, buf, flags, >interrupt_callback, NULL) < 0) {
+if (ffurl_open(>rtcp_hd, buf, rtcpflags, >interrupt_callback, NULL) < 0) {
 s->local_rtpport = s->local_rtcpport = -1;
 continue;
 }
@@ -401,7 +403,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
 build_udp_url(s, buf, sizeof(buf),
   hostname, s->rtcp_port, s->local_rtcpport,
   sources, block);
-if (ffurl_open(>rtcp_hd, buf, flags, >interrupt_callback, NULL) < 0)
+if (ffurl_open(>rtcp_hd, buf, rtcpflags, 

Re: [FFmpeg-devel] [PATCHv2] lavc/cbrt_tablegen: speed up tablegen

2016-01-07 Thread Ganesh Ajjanagadde
On Thu, Jan 7, 2016 at 4:48 PM, Michael Niedermayer
 wrote:
> On Mon, Jan 04, 2016 at 06:33:59PM -0800, Ganesh Ajjanagadde wrote:
>> This exploits an approach based on the sieve of Eratosthenes, a popular
>> method for generating prime numbers.
>>
>> Tables are identical to previous ones.
>>
>> Tested with FATE with/without --enable-hardcoded-tables.
>>
>> Sample benchmark (Haswell, GNU/Linux+gcc):
>> prev:
>> 7860100 decicycles in cbrt_tableinit,   1 runs,  0 skips
>> 490 decicycles in cbrt_tableinit,   2 runs,  0 skips
>> [...]
>> 7582339 decicycles in cbrt_tableinit, 256 runs,  0 skips
>> 7563556 decicycles in cbrt_tableinit, 512 runs,  0 skips
>>
>> new:
>> 2099480 decicycles in cbrt_tableinit,   1 runs,  0 skips
>> 2044470 decicycles in cbrt_tableinit,   2 runs,  0 skips
>> [...]
>> 1796544 decicycles in cbrt_tableinit, 256 runs,  0 skips
>> 1791631 decicycles in cbrt_tableinit, 512 runs,  0 skips
>>
>> Both small and large run count given as this is called once so small run
>> count may give a better picture, small numbers are fairly consistent,
>> and there is a consistent downward trend from small to large runs,
>> at which point it stabilizes to a new value.
>>
>> Signed-off-by: Ganesh Ajjanagadde 
>> ---
>>  libavcodec/aacdec_fixed.c   |  4 +--
>>  libavcodec/aacdec_template.c|  2 +-
>>  libavcodec/cbrt_tablegen.h  | 53 
>> ++---
>>  libavcodec/cbrt_tablegen_template.c | 12 -
>>  4 files changed, 51 insertions(+), 20 deletions(-)
>>
>> diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c
>> index 396a874..f7b882b 100644
>> --- a/libavcodec/aacdec_fixed.c
>> +++ b/libavcodec/aacdec_fixed.c
>> @@ -155,9 +155,9 @@ static void vector_pow43(int *coefs, int len)
>>  for (i=0; i>  coef = coefs[i];
>>  if (coef < 0)
>> -coef = -(int)cbrt_tab[-coef];
>> +coef = -(int)cbrt_tab[-coef].i;
>>  else
>> -coef = (int)cbrt_tab[coef];
>> +coef = (int)cbrt_tab[coef].i;
>>  coefs[i] = coef;
>>  }
>>  }
>> diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
>> index d819958..1380510 100644
>> --- a/libavcodec/aacdec_template.c
>> +++ b/libavcodec/aacdec_template.c
>> @@ -1791,7 +1791,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, 
>> INTFLOAT coef[1024],
>>  v = -v;
>>  *icf++ = v;
>>  #else
>> -*icf++ = cbrt_tab[n] | (bits & 1U<<31);
>> +*icf++ = cbrt_tab[n].i | (bits & 
>> 1U<<31);
>>  #endif /* USE_FIXED */
>>  bits <<= 1;
>>  } else {
>> diff --git a/libavcodec/cbrt_tablegen.h b/libavcodec/cbrt_tablegen.h
>> index 59b5a1d..e3d6634 100644
>> --- a/libavcodec/cbrt_tablegen.h
>> +++ b/libavcodec/cbrt_tablegen.h
>> @@ -26,14 +26,13 @@
>>  #include 
>>  #include 
>>  #include "libavutil/attributes.h"
>> +#include "libavutil/intfloat.h"
>>  #include "libavcodec/aac_defines.h"
>>
>> -#if USE_FIXED
>> -#define CBRT(x) lrint((x).f * 8192)
>> -#else
>> -#define CBRT(x) x.i
>> -#endif
>> -
>
>> +union ff_int32float64 {
>> +uint32_t i;
>> +double   f;
>> +};
>>  #if CONFIG_HARDCODED_TABLES
>>  #if USE_FIXED
>>  #define cbrt_tableinit_fixed()
>> @@ -43,20 +42,42 @@
>>  #include "libavcodec/cbrt_tables.h"
>>  #endif
>>  #else
>> -static uint32_t cbrt_tab[1 << 13];
>> +static union ff_int32float64 cbrt_tab[1 << 13];
>
> this doubles the size of the cpu cache needed at runtime to store
> the same number of elements

Yes, it does, and it was a tradeoff I made that I forgot to list. One
can of course use floats; but this loses accuracy at significant
levels.

So one could malloc and free a double precision array (for temporary
storage) at costs of some code complexity, possible heap
fragmentation, and the problem of possible failure (may be ok since
anyway aac_decode_init is not guaranteed to succeed; it allocates
memory for the dsp context). Malloc/free is AFAIK ~ 100's of cycles,
dwarfed by the table generation cost.

The problem is that it is impossible to give an answer as to precisely
what impact that will have on decoding/encoding performance, and
results of course vary based on hardware. This is the same problem
that plagues static/dynamic table performance analysis.

I don't have a measurable performance regression on my machine for aac
decoding because of this. But then, my Haswell setup is not exactly
representative.

>
> [...]
> --
> 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
>
> 

[FFmpeg-devel] [PATCH] lavf/mov: export chapter streams as private data

2016-01-07 Thread Rodger Combs
This prevents consumers from showing chapters as if they were regular subtitle
streams.
---
 libavformat/mov.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 78081ce..77a4a71 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4418,6 +4418,9 @@ static void mov_read_chapters(AVFormatContext *s)
 return;
 }
 
+// Reset the stream type to private data
+st->codec->codec_type = AVMEDIA_TYPE_DATA;
+st->codec->codec_id = AV_CODEC_ID_BIN_DATA;
 st->discard = AVDISCARD_ALL;
 sc = st->priv_data;
 cur_pos = avio_tell(sc->pb);
-- 
2.6.4

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


Re: [FFmpeg-devel] [PATCH] ffmpeg: check fclose return values

2016-01-07 Thread Ganesh Ajjanagadde
On Thu, Jan 7, 2016 at 2:18 PM, Michael Niedermayer
 wrote:
> On Thu, Jan 07, 2016 at 11:16:27PM +0100, Michael Niedermayer wrote:
>> On Thu, Jan 07, 2016 at 10:00:47AM -0800, Ganesh Ajjanagadde wrote:
>> > On Thu, Jan 7, 2016 at 9:27 AM, Michael Niedermayer
>> >  wrote:
>> > > On Wed, Jan 06, 2016 at 09:00:46PM -0800, Ganesh Ajjanagadde wrote:
>> > >> In the spirit of commit a956840cbc. Simple method to reproduce:
>> > >> pass -vstats_file /dev/full to ffmpeg.
>> > >>
>> > >> All raw fclose usages in ffmpeg.c taken care of here.
>> > >>
>> > >> Signed-off-by: Ganesh Ajjanagadde 
>> > >> ---
>> > >>  ffmpeg.c | 13 ++---
>> > >>  1 file changed, 10 insertions(+), 3 deletions(-)
>> > >
>> > > LGTM
>> > >
>> > > thanks
>> >
>> > So there is actually a problem with the diagnostic obtained, a more
>> > accurate diagnostic is via errno, say strerror(errno) instead of
>> > av_err2str(ret).
>> > Comparison:
>> > Error closing vstats file, loss of information possible: Operation not 
>> > permitted
>> > vs
>> > Error closing vstats file, loss of information possible: No space left on 
>> > device
>> > for the provided /dev/full example.
>> >
>> > So there are a number of possiblities:
>> > 1. Have 2 separate av_log lines, one for each of these.
>> > 2. A single av_log line, using strerror(errno).
>> > 3. Leave as is.
>> >
>> > I prefer 2. Let me know your preference, and I will push later.
>>
>> yes agree, 2.
>
> probably should use av_err2str() instead of strerror() though

I thought strerror was C89? Your idea unfortunately causes problems
(suspect it is because appropriate error tag is missing):
Error closing vstats file, loss of information possible: Error number
28 occurred.

>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> What does censorship reveal? It reveals fear. -- Julian Assange
>
> ___
> 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] ffmpeg: check fclose return values

2016-01-07 Thread Ganesh Ajjanagadde
On Thu, Jan 7, 2016 at 4:34 PM, Michael Niedermayer
 wrote:
> On Thu, Jan 07, 2016 at 04:01:14PM -0800, Ganesh Ajjanagadde wrote:
>> On Thu, Jan 7, 2016 at 3:57 PM, Ganesh Ajjanagadde  wrote:
>> > On Thu, Jan 7, 2016 at 2:18 PM, Michael Niedermayer
>> >  wrote:
>> >> On Thu, Jan 07, 2016 at 11:16:27PM +0100, Michael Niedermayer wrote:
>> >>> On Thu, Jan 07, 2016 at 10:00:47AM -0800, Ganesh Ajjanagadde wrote:
>> >>> > On Thu, Jan 7, 2016 at 9:27 AM, Michael Niedermayer
>> >>> >  wrote:
>> >>> > > On Wed, Jan 06, 2016 at 09:00:46PM -0800, Ganesh Ajjanagadde wrote:
>> >>> > >> In the spirit of commit a956840cbc. Simple method to reproduce:
>> >>> > >> pass -vstats_file /dev/full to ffmpeg.
>> >>> > >>
>> >>> > >> All raw fclose usages in ffmpeg.c taken care of here.
>> >>> > >>
>> >>> > >> Signed-off-by: Ganesh Ajjanagadde 
>> >>> > >> ---
>> >>> > >>  ffmpeg.c | 13 ++---
>> >>> > >>  1 file changed, 10 insertions(+), 3 deletions(-)
>> >>> > >
>> >>> > > LGTM
>> >>> > >
>> >>> > > thanks
>> >>> >
>> >>> > So there is actually a problem with the diagnostic obtained, a more
>> >>> > accurate diagnostic is via errno, say strerror(errno) instead of
>> >>> > av_err2str(ret).
>> >>> > Comparison:
>> >>> > Error closing vstats file, loss of information possible: Operation not 
>> >>> > permitted
>> >>> > vs
>> >>> > Error closing vstats file, loss of information possible: No space left 
>> >>> > on device
>> >>> > for the provided /dev/full example.
>> >>> >
>> >>> > So there are a number of possiblities:
>> >>> > 1. Have 2 separate av_log lines, one for each of these.
>> >>> > 2. A single av_log line, using strerror(errno).
>> >>> > 3. Leave as is.
>> >>> >
>> >>> > I prefer 2. Let me know your preference, and I will push later.
>> >>>
>> >>> yes agree, 2.
>> >>
>> >> probably should use av_err2str() instead of strerror() though
>> >
>> > I thought strerror was C89? Your idea unfortunately causes problems
>> > (suspect it is because appropriate error tag is missing):
>> > Error closing vstats file, loss of information possible: Error number
>> > 28 occurred.
>>
>> Did some digging, using strerror should be fine, see 984-989 of
>> cmdutils.c for very similar usage.
>
> probably but why does av_err2str not work ? did you use
> AVERROR(errno) ?

Oops, passed it directly without going through AVERROR. Fixed, pushed.
Thanks for your patience and review.

>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
>
> ___
> 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/avf_showspectrum: replace pow(x, 0.25) by sqrt(sqrt(x))

2016-01-07 Thread Ganesh Ajjanagadde
On Thu, Jan 7, 2016 at 2:25 PM, Michael Niedermayer
 wrote:
> On Wed, Jan 06, 2016 at 08:26:43PM -0800, Ganesh Ajjanagadde wrote:
>> On Mon, Jan 4, 2016 at 6:38 PM, Ganesh Ajjanagadde
>>  wrote:
>> > This is faster; precision assured as result is a float.
>> >
>> > Signed-off-by: Ganesh Ajjanagadde 
>> > ---
>> >  libavfilter/avf_showspectrum.c | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/libavfilter/avf_showspectrum.c 
>> > b/libavfilter/avf_showspectrum.c
>> > index accd8c7..cff98ff 100644
>> > --- a/libavfilter/avf_showspectrum.c
>> > +++ b/libavfilter/avf_showspectrum.c
>> > @@ -578,7 +578,7 @@ static int plot_spectrum_column(AVFilterLink *inlink, 
>> > AVFrame *insamples)
>> >  a = cbrt(a);
>> >  break;
>> >  case FOURTHRT:
>> > -a = pow(a, 0.25);
>> > +a = sqrt(sqrt(a));
>> >  break;
>> >  case FIFTHRT:
>> >  a = pow(a, 0.20);
>> > --
>> > 2.6.4
>> >
>>
>> ping
>
> should be ok but iam not maintainer of this

pushed, thanks

>
> [...]
>
> thx
>
> --
> 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
>
> ___
> 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] [PATCHv2] lavc/cbrt_tablegen: speed up tablegen

2016-01-07 Thread Michael Niedermayer
On Mon, Jan 04, 2016 at 06:33:59PM -0800, Ganesh Ajjanagadde wrote:
> This exploits an approach based on the sieve of Eratosthenes, a popular
> method for generating prime numbers.
> 
> Tables are identical to previous ones.
> 
> Tested with FATE with/without --enable-hardcoded-tables.
> 
> Sample benchmark (Haswell, GNU/Linux+gcc):
> prev:
> 7860100 decicycles in cbrt_tableinit,   1 runs,  0 skips
> 490 decicycles in cbrt_tableinit,   2 runs,  0 skips
> [...]
> 7582339 decicycles in cbrt_tableinit, 256 runs,  0 skips
> 7563556 decicycles in cbrt_tableinit, 512 runs,  0 skips
> 
> new:
> 2099480 decicycles in cbrt_tableinit,   1 runs,  0 skips
> 2044470 decicycles in cbrt_tableinit,   2 runs,  0 skips
> [...]
> 1796544 decicycles in cbrt_tableinit, 256 runs,  0 skips
> 1791631 decicycles in cbrt_tableinit, 512 runs,  0 skips
> 
> Both small and large run count given as this is called once so small run
> count may give a better picture, small numbers are fairly consistent,
> and there is a consistent downward trend from small to large runs,
> at which point it stabilizes to a new value.
> 
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libavcodec/aacdec_fixed.c   |  4 +--
>  libavcodec/aacdec_template.c|  2 +-
>  libavcodec/cbrt_tablegen.h  | 53 
> ++---
>  libavcodec/cbrt_tablegen_template.c | 12 -
>  4 files changed, 51 insertions(+), 20 deletions(-)
> 
> diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c
> index 396a874..f7b882b 100644
> --- a/libavcodec/aacdec_fixed.c
> +++ b/libavcodec/aacdec_fixed.c
> @@ -155,9 +155,9 @@ static void vector_pow43(int *coefs, int len)
>  for (i=0; i  coef = coefs[i];
>  if (coef < 0)
> -coef = -(int)cbrt_tab[-coef];
> +coef = -(int)cbrt_tab[-coef].i;
>  else
> -coef = (int)cbrt_tab[coef];
> +coef = (int)cbrt_tab[coef].i;
>  coefs[i] = coef;
>  }
>  }
> diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
> index d819958..1380510 100644
> --- a/libavcodec/aacdec_template.c
> +++ b/libavcodec/aacdec_template.c
> @@ -1791,7 +1791,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, 
> INTFLOAT coef[1024],
>  v = -v;
>  *icf++ = v;
>  #else
> -*icf++ = cbrt_tab[n] | (bits & 1U<<31);
> +*icf++ = cbrt_tab[n].i | (bits & 1U<<31);
>  #endif /* USE_FIXED */
>  bits <<= 1;
>  } else {
> diff --git a/libavcodec/cbrt_tablegen.h b/libavcodec/cbrt_tablegen.h
> index 59b5a1d..e3d6634 100644
> --- a/libavcodec/cbrt_tablegen.h
> +++ b/libavcodec/cbrt_tablegen.h
> @@ -26,14 +26,13 @@
>  #include 
>  #include 
>  #include "libavutil/attributes.h"
> +#include "libavutil/intfloat.h"
>  #include "libavcodec/aac_defines.h"
>  
> -#if USE_FIXED
> -#define CBRT(x) lrint((x).f * 8192)
> -#else
> -#define CBRT(x) x.i
> -#endif
> -

> +union ff_int32float64 {
> +uint32_t i;
> +double   f;
> +};
>  #if CONFIG_HARDCODED_TABLES
>  #if USE_FIXED
>  #define cbrt_tableinit_fixed()
> @@ -43,20 +42,42 @@
>  #include "libavcodec/cbrt_tables.h"
>  #endif
>  #else
> -static uint32_t cbrt_tab[1 << 13];
> +static union ff_int32float64 cbrt_tab[1 << 13];

this doubles the size of the cpu cache needed at runtime to store
the same number of elements

[...]
-- 
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


[FFmpeg-devel] [PATCH 2/3] lavf/mov: improve `tref/chap` chapter handling

2016-01-07 Thread Rodger Combs
3 parts:
- Supports multiple chapter streams
- Exports regular text chapter streams as opaque data. This prevents consumers
  from showing chapters as if they were regular subtitle streams.
- Exports video chapter streams as thumbnails, and provides the first one as
  an attached_pic.
---
 libavformat/isom.h |  3 ++-
 libavformat/mov.c  | 52 +---
 2 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index e07dc0e9..31f270e 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -200,7 +200,8 @@ typedef struct MOVContext {
 unsigned trex_count;
 int itunes_metadata;  ///< metadata are itunes style
 int handbrake_version;
-int chapter_track;
+int *chapter_tracks;
+unsigned int nb_chapter_tracks;
 int use_absolute_path;
 int ignore_editlist;
 int ignore_chapters;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 78081ce..cde4140 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3454,7 +3454,18 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 
 static int mov_read_chap(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
-c->chapter_track = avio_rb32(pb);
+unsigned i, num;
+av_free(c->chapter_tracks);
+
+num = atom.size / 4;
+if (!(c->chapter_tracks = av_malloc(num * 4)))
+return AVERROR(ENOMEM);
+
+c->nb_chapter_tracks = num;
+
+for (i = 0; i < num; i++)
+c->chapter_tracks[i] = avio_rb32(pb);
+
 return 0;
 }
 
@@ -4403,25 +4414,50 @@ static int mov_probe(AVProbeData *p)
 static void mov_read_chapters(AVFormatContext *s)
 {
 MOVContext *mov = s->priv_data;
-AVStream *st = NULL;
+AVStream *st;
 MOVStreamContext *sc;
 int64_t cur_pos;
-int i;
+int i, j;
+int chapter_track;
 
+for (j = 0; j < mov->nb_chapter_tracks; j++) {
+chapter_track = mov->chapter_tracks[j];
+st = NULL;
 for (i = 0; i < s->nb_streams; i++)
-if (s->streams[i]->id == mov->chapter_track) {
+if (s->streams[i]->id == chapter_track) {
 st = s->streams[i];
 break;
 }
 if (!st) {
 av_log(s, AV_LOG_ERROR, "Referenced QT chapter track not found\n");
-return;
+continue;
 }
 
-st->discard = AVDISCARD_ALL;
 sc = st->priv_data;
 cur_pos = avio_tell(sc->pb);
 
+if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
+st->disposition |= AV_DISPOSITION_ATTACHED_PIC | 
AV_DISPOSITION_TIMED_THUMBNAILS;
+if (st->nb_index_entries) {
+// Retrieve the first frame, if possible
+AVPacket pkt;
+AVIndexEntry *sample = >index_entries[0];
+if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
+av_log(s, AV_LOG_ERROR, "Failed to retrieve first frame\n");
+goto finish;
+}
+
+if (av_get_packet(sc->pb, , sample->size) < 0)
+goto finish;
+
+st->attached_pic  = pkt;
+st->attached_pic.stream_index = st->index;
+st->attached_pic.flags   |= AV_PKT_FLAG_KEY;
+}
+} else {
+st->codec->codec_type = AVMEDIA_TYPE_DATA;
+st->codec->codec_id = AV_CODEC_ID_BIN_DATA;
+st->discard = AVDISCARD_ALL;
 for (i = 0; i < st->nb_index_entries; i++) {
 AVIndexEntry *sample = >index_entries[i];
 int64_t end = i+1 < st->nb_index_entries ? 
st->index_entries[i+1].timestamp : st->duration;
@@ -4470,8 +4506,10 @@ static void mov_read_chapters(AVFormatContext *s)
 avpriv_new_chapter(s, i, st->time_base, sample->timestamp, end, title);
 av_freep();
 }
+}
 finish:
 avio_seek(sc->pb, cur_pos, SEEK_SET);
+}
 }
 
 static int parse_timecode_in_framenum_format(AVFormatContext *s, AVStream *st,
@@ -4763,7 +4801,7 @@ static int mov_read_header(AVFormatContext *s)
 av_log(mov->fc, AV_LOG_TRACE, "on_parse_exit_offset=%"PRId64"\n", 
avio_tell(pb));
 
 if (pb->seekable) {
-if (mov->chapter_track > 0 && !mov->ignore_chapters)
+if (mov->nb_chapter_tracks > 0 && !mov->ignore_chapters)
 mov_read_chapters(s);
 for (i = 0; i < s->nb_streams; i++)
 if (s->streams[i]->codec->codec_tag == AV_RL32("tmcd"))
-- 
2.6.4

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


[FFmpeg-devel] [PATCH] rtp: Fix play multiple multicast streams with the same port

2016-01-07 Thread Zhao Zhili
We cannot play multiple multicast streams with the same port at the
same time. This is because both rtp and rtcp ports are opened in
read-write mode, so they will not bind to the multicast address. Try
to make rtp port as read-only by default to solve this bug.

Signed-off-by: Zhao Zhili 
---
 libavformat/rtpproto.c | 12 +---
 libavformat/rtsp.c |  2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index e0aa23e..f334055 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -323,6 +323,7 @@ static int rtp_open(URLContext *h, const char *uri, int
flags)
 char path[1024];
 const char *p;
 int i, max_retry_count = 3;
+int tmpflags;

 av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), _port,
  path, sizeof(path), uri);
@@ -380,19 +381,24 @@ static int rtp_open(URLContext *h, const char *uri,
int flags)
 build_udp_url(s, buf, sizeof(buf),
   hostname, rtp_port, s->local_rtpport,
   sources, block);
-if (ffurl_open(>rtp_hd, buf, flags, >interrupt_callback,
NULL) < 0)
+if (s->local_rtpport > 0 && s->local_rtpport == s->local_rtcpport)
+tmpflags = flags | AVIO_FLAG_WRITE;
+else
+tmpflags = flags;
+if (ffurl_open(>rtp_hd, buf, tmpflags, >interrupt_callback,
NULL) < 0)
 goto fail;
 s->local_rtpport = ff_udp_get_local_port(s->rtp_hd);
 if(s->local_rtpport == 65535) {
 s->local_rtpport = -1;
 continue;
 }
+tmpflags = flags | AVIO_FLAG_WRITE;
 if (s->local_rtcpport < 0) {
 s->local_rtcpport = s->local_rtpport + 1;
 build_udp_url(s, buf, sizeof(buf),
   hostname, s->rtcp_port, s->local_rtcpport,
   sources, block);
-if (ffurl_open(>rtcp_hd, buf, flags,
>interrupt_callback, NULL) < 0) {
+if (ffurl_open(>rtcp_hd, buf, tmpflags,
>interrupt_callback, NULL) < 0) {
 s->local_rtpport = s->local_rtcpport = -1;
 continue;
 }
@@ -401,7 +407,7 @@ static int rtp_open(URLContext *h, const char *uri, int
flags)
 build_udp_url(s, buf, sizeof(buf),
   hostname, s->rtcp_port, s->local_rtcpport,
   sources, block);
-if (ffurl_open(>rtcp_hd, buf, flags, >interrupt_callback,
NULL) < 0)
+if (ffurl_open(>rtcp_hd, buf, tmpflags, >interrupt_callback,
NULL) < 0)
 goto fail;
 break;
 }
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 39539e9..8cae376 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -2316,7 +2316,7 @@ static int sdp_read_header(AVFormatContext *s)
 append_source_addrs(url, sizeof(url), "block",
 rtsp_st->nb_exclude_source_addrs,
 rtsp_st->exclude_source_addrs);
-err = ffurl_open(_st->rtp_handle, url,
AVIO_FLAG_READ_WRITE,
+err = ffurl_open(_st->rtp_handle, url, AVIO_FLAG_READ,
>interrupt_callback, );

 av_dict_free();
-- 
1.9.1
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] Question regarding seemingly superfluous fourcc checks

2016-01-07 Thread Mats Peterson
Are the following kludges for A_QUICKTIME and V_QUICKTIME ways to 
accommodate old broken Matroska files that FFmpeg wrote in the past? I'm 
asking because in normal cases, the fourcc in A_QUICKTIME and 
V_QUICKTIME always starts at offset 4, without exception.


A_QUICKTIME:

if (ff_codec_get_id(ff_codec_movaudio_tags, 
AV_RL32(track->codec_priv.data))) {

fourcc = AV_RL32(track->codec_priv.data);
codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc);
}

V_QUICKTIME:

if (ff_codec_get_id(ff_codec_movvideo_tags, 
AV_RL32(track->codec_priv.data))) {

fourcc = AV_RL32(track->codec_priv.data);
codec_id = ff_codec_get_id(ff_codec_movvideo_tags, fourcc);
}

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


Re: [FFmpeg-devel] Question regarding seemingly superfluous fourcc checks

2016-01-07 Thread Mats Peterson

On 01/07/2016 11:47 AM, Carl Eugen Hoyos wrote:

There is a small chance for false positives, but it's
probably negligible.


Feel free to fix it.

The non-FFmpeg sample is:
http://samples.ffmpeg.org/Matroska/switzler084d_dl.mkv

Carl Eugen


Thanks, Carl. Interesting, this file seems to be muxed with mkvmerge 
2.0.2. Old one, but still... no we'll keep it as it is, I guess. I have 
no better solution to offer than the current one.


Mats

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


Re: [FFmpeg-devel] [RFC] avcodec: Add native DCA decoder based on libdcadec.

2016-01-07 Thread foo86
On Wed, Jan 06, 2016 at 02:53:32PM -0300, James Almer wrote:
> On 1/6/2016 2:32 PM, foo86 wrote:
> > OK, I'll start changing the patch.
> > 
> > Some questions so far:
> > 
> > 1. Should I remove old decoder files in separate commit first or should
> > I simply proceed with replacing entire content of certain files (e.g.,
> > dcadec.c, dca_exss.c, dca_xll.c)?
> 
> Yeah, send it as separate patches to make reviewing easier. Whoever commits it
> can then squash it into a single patch (Like it was done in commit b08569a2) 
> if
> necessary.
> 
> Also, while at it, try to split the main header into separate headers for some
> of the modules (xll, exss, dsp which already exists for the old decoder, etc).

OK.

> > 2. Is it OK to leave arch-specific dca code as well as dcadsp.c
> > untouched for now? I'd really like to postpone dealing with that until
> > I'm done with generic code, especially since the new decoder is not
> > slower already. This means some assembly functions (ff_dca_lfe_fir32_*,
> > ff_dca_qmf_32_subbands_*) will still be compiled in but unused.
> > libavcodec/dcadsp.c will be still around but not compiled.
> 
> Try to disable or remove code that will not be used. Git will easily let you
> recover any of it in the future if needed.
> Better than keeping dead code in the tree, IMO, but do what you think will 
> make
> your work easier.

Yeah, I'll probably remove it for now and recover any needed parts
later.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [RFC] avcodec: Add native DCA decoder based on libdcadec.

2016-01-07 Thread Christophe Gisquet
Hi,

2016-01-07 12:48 GMT+01:00 foo86 :
> bench dca pcm_f32le
> bench dca2 pcm_f32le
> bench libdcadec pcm_s32le

OK, that was mostly out of curiosity, as "dca2" has benefits
surpassing such issues anyway. And the improvement is 10% for where it
matters (raspberry).

> synth_filter integrates just nicely without any changes, there is no need for
> rewrite. There is 64 subband version of it needed though, as well as fixed
> point versions for 32 and 64 subbands.

In my recollection, the code was weirdly shaped, so I could have
imagined needs for change (e.g., your libdcadec may not be able to
reuse it).

> Other parts can't be directly reused unfortunately. They need to be converted
> to operate on integer input and process entire frame at once (not just one
> subsubframe).

The gap between dca and dca2 will probably increase, as these
"constrains" should actually help make the operation faster.

> Temporary converting the input to floating point before calling them (what
> current dca code does) seems to negate any performance gain from using these
> assembly optimized routines in the first place...

I think it is ok to change the code and remove the arch-specific dsp
implementations. Whether to put that specific removal in a separate
patch is up to you.

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


Re: [FFmpeg-devel] [PATCH 2/2] swscale: add P010 input support

2016-01-07 Thread Hendrik Leppkes
On Thu, Jan 7, 2016 at 12:44 PM, Christophe Gisquet
 wrote:
> Hi,
>
> 2016-01-07 12:11 GMT+01:00 Hendrik Leppkes :
>> +static void p010LEToY_c(uint8_t *dst, const uint8_t *src, const uint8_t 
>> *unused1,
>> +const uint8_t *unused2, int width, uint32_t *unused)
>> +{
>> +int i;
>> +for (i = 0; i < width; i++) {
>> +AV_WN16(dst + i * 2, AV_RL16(src + i * 2) >> 6);
>> +}
>> +}
>
> Seeing log2_chroma_[wh], this is 4:2:0, so the above loop could be
> unrolled, as it specifically refers to P010 and width should be even.
> But maybe it has to handle those weird cases where it is odd, I don't
> know.

This is the dumb C fallback, I prefer to err on the side of caution here.

>
> +static void p010LEToUV_c(uint8_t *dstU, uint8_t *dstV,
> +   const uint8_t *unused0, const uint8_t *src1,
> const uint8_t *src2,
> +   int width, uint32_t *unused)
> +{
> +int i;
> +for (i = 0; i < width; i++) {
> +AV_WN16(dstU + i * 2, AV_RL16(src1 + i * 4 + 0) >> 6);
> +AV_WN16(dstV + i * 2, AV_RL16(src1 + i * 4 + 2) >> 6);
>
> I could see an AV_RL32 being used here, but it's probably not worth your time.
>
> Also, all those conversion functions are very easily SIMD-able for
> those that want to try their hand.

Indeed, its probably pretty simple, and I might try my hand at it
later, but so far I didn't have the motivation yet.

>
> Last thing unrelated to the code: do you have any idea why that shift?
> An obvious reason would be no-op conversion to P016, but extra work
> for a lot of other stuff.
>

Microsoft specifically described the format to alias to P016 with less
precision for simplicity, however I opted to convert to "true" 10-bit
in sws by shifting so format selection algorithms don't get confused
later, and actually treat it like 10-bit and not 16-bit.

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


Re: [FFmpeg-devel] Question regarding seemingly superfluous fourcc checks

2016-01-07 Thread Carl Eugen Hoyos
Mats Peterson  ffmpeg.org> writes:

> Are the following kludges for A_QUICKTIME and 
> V_QUICKTIME ways to accommodate old broken Matroska 
> files that FFmpeg wrote in the past?

It dates back to f009e36f75bc137167a26356305d2c3eb83cac68
It is possible that very old matroska files exist 
that needed this, but since above commit also introduced 
writing such files, your explanation is valid.

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH] x86/vf_w3fdif: 32-bit compatibility for w3fdif_simple_high

2016-01-07 Thread Hendrik Leppkes
On Thu, Jan 7, 2016 at 4:18 AM, James Almer  wrote:
> On 1/6/2016 11:54 PM, Hendrik Leppkes wrote:
>> ---
>> Based on an idea from Ronald mentioend in an earlier thread about this 
>> function.
>>
>> It works and passes FATE, however I'm sure some aspects can be done easier 
>> or cleaner, so please let me know.
>>
>>
>>  libavfilter/x86/vf_w3fdif.asm| 37 ++---
>>  libavfilter/x86/vf_w3fdif_init.c |  2 +-
>>  2 files changed, 35 insertions(+), 4 deletions(-)
>>
>> diff --git a/libavfilter/x86/vf_w3fdif.asm b/libavfilter/x86/vf_w3fdif.asm
>> index c3c73ea..35768c3 100644
>> --- a/libavfilter/x86/vf_w3fdif.asm
>> +++ b/libavfilter/x86/vf_w3fdif.asm
>> @@ -102,14 +102,22 @@ cglobal w3fdif_complex_low, 4, 7, 8, 0, work_line, 
>> in_lines_cur0, coef, linesize
>>  REP_RET
>>
>>  %if ARCH_X86_64
>> -
>>  cglobal w3fdif_simple_high, 5, 9, 8, 0, work_line, in_lines_cur0, 
>> in_lines_adj0, coef, linesize
>> +%else
>> +cglobal w3fdif_simple_high, 4, 7, 8, 0, work_line, in_lines_cur0, 
>> in_lines_adj0, coef, linesize
>> +%endif
>>  movq  m2, [coefq]
>> -DEFINE_ARGSwork_line, in_lines_cur0, in_lines_adj0, in_lines_cur1, 
>> linesize, offset, in_lines_cur2, in_lines_adj1, in_lines_adj2
>> +%if ARCH_X86_64
>> +DEFINE_ARGSwork_line, in_lines_cur0, in_lines_adj0, linesize, 
>> offset, in_lines_cur1, in_lines_cur2, in_lines_adj1, in_lines_adj2
>
> This broke x86_64. Leave it as it was above.

The change wasn't intentional, I mangled that when moving things
around apparently.

>
>> +mov  offsetq, 0
>
> Since you're moving this take the chance to replace it with a xor.

Done

>
>> +%else
>> +DEFINE_ARGSwork_line, in_lines_cur0, in_lines_adj0, in_lines_cur1, 
>> in_lines_cur2, in_lines_adj1, in_lines_adj2
>> +%define linesized dword r4m
>
> Nit: r4mp instead of dword r4m

I stole dword r4m from audio_convert.asm, but apparently r4mp aliases
to dword r4m, so changed anyway.
>
>> +%endif
>> +
>>  pshufdm0, m2, q
>>  SPLATWm2, m2, 2
>>  pxor  m7, m7
>> -mov  offsetq, 0
>>  mov   in_lines_cur2q, [in_lines_cur0q+gprsize*2]
>>  mov   in_lines_cur1q, [in_lines_cur0q+gprsize]
>>  mov   in_lines_cur0q, [in_lines_cur0q]
>> @@ -117,8 +125,21 @@ cglobal w3fdif_simple_high, 5, 9, 8, 0, work_line, 
>> in_lines_cur0, in_lines_adj0,
>>  mov   in_lines_adj1q, [in_lines_adj0q+gprsize]
>>  mov   in_lines_adj0q, [in_lines_adj0q]
>>
>> +%if ARCH_X86_32
>> +sub in_lines_cur1q, in_lines_cur0q
>> +sub in_lines_cur2q, in_lines_cur0q
>> +sub in_lines_adj0q, in_lines_cur0q
>> +sub in_lines_adj1q, in_lines_cur0q
>> +sub in_lines_adj2q, in_lines_cur0q
>> +%define offsetq in_lines_cur0q
>> +%endif
>> +
>>  .loop:
>> +%if ARCH_X86_64
>>  movh   m3, [in_lines_cur0q+offsetq]
>> +%else
>> +movh   m3, [in_lines_cur0q]
>> +%endif
>>  movh   m4, [in_lines_cur1q+offsetq]
>>  punpcklbw  m3, m7
>>  punpcklbw  m4, m7
>> @@ -143,15 +164,25 @@ cglobal w3fdif_simple_high, 5, 9, 8, 0, work_line, 
>> in_lines_cur0, in_lines_adj0,
>>  pmaddwdm6, m2
>>  paddd  m3, m5
>>  paddd  m4, m6
>> +%if ARCH_X86_64
>>  paddd  m3, [work_lineq+offsetq*4]
>>  paddd  m4, [work_lineq+offsetq*4+mmsize]
>>  mova   [work_lineq+offsetq*4], m3
>>  mova[work_lineq+offsetq*4+mmsize], m4
>> +%else
>> +paddd  m3, [work_lineq]
>> +paddd  m4, [work_lineq+mmsize]
>> +mova [work_lineq], m3
>> +mova  [work_lineq+mmsize], m4
>> +addwork_lineq, mmsize*2
>> +%endif
>>  add   offsetq, mmsize/2
>>  sub linesized, mmsize/2
>>  jg .loop
>>  REP_RET
>>
>> +%if ARCH_X86_64
>> +
>>  cglobal w3fdif_complex_high, 5, 13, 10, 0, work_line, in_lines_cur0, 
>> in_lines_adj0, coef, linesize
>>  movq  m0, [coefq+0]
>>  movd  m4, [coefq+8]
>> diff --git a/libavfilter/x86/vf_w3fdif_init.c 
>> b/libavfilter/x86/vf_w3fdif_init.c
>> index 72ea657..9bf06e8 100644
>> --- a/libavfilter/x86/vf_w3fdif_init.c
>> +++ b/libavfilter/x86/vf_w3fdif_init.c
>> @@ -51,12 +51,12 @@ av_cold void ff_w3fdif_init_x86(W3FDIFDSPContext *dsp)
>>
>>  if (EXTERNAL_SSE2(cpu_flags)) {
>>  dsp->filter_simple_low   = ff_w3fdif_simple_low_sse2;
>> +dsp->filter_simple_high  = ff_w3fdif_simple_high_sse2;
>>  dsp->filter_complex_low  = 

Re: [FFmpeg-devel] [PATCH 2/2] swscale: add P010 input support

2016-01-07 Thread Christophe Gisquet
Hi,

2016-01-07 12:11 GMT+01:00 Hendrik Leppkes :
> +static void p010LEToY_c(uint8_t *dst, const uint8_t *src, const uint8_t 
> *unused1,
> +const uint8_t *unused2, int width, uint32_t *unused)
> +{
> +int i;
> +for (i = 0; i < width; i++) {
> +AV_WN16(dst + i * 2, AV_RL16(src + i * 2) >> 6);
> +}
> +}

Seeing log2_chroma_[wh], this is 4:2:0, so the above loop could be
unrolled, as it specifically refers to P010 and width should be even.
But maybe it has to handle those weird cases where it is odd, I don't
know.

+static void p010LEToUV_c(uint8_t *dstU, uint8_t *dstV,
+   const uint8_t *unused0, const uint8_t *src1,
const uint8_t *src2,
+   int width, uint32_t *unused)
+{
+int i;
+for (i = 0; i < width; i++) {
+AV_WN16(dstU + i * 2, AV_RL16(src1 + i * 4 + 0) >> 6);
+AV_WN16(dstV + i * 2, AV_RL16(src1 + i * 4 + 2) >> 6);

I could see an AV_RL32 being used here, but it's probably not worth your time.

Also, all those conversion functions are very easily SIMD-able for
those that want to try their hand.

Last thing unrelated to the code: do you have any idea why that shift?
An obvious reason would be no-op conversion to P016, but extra work
for a lot of other stuff.

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


Re: [FFmpeg-devel] Question regarding seemingly superfluous fourcc checks

2016-01-07 Thread Mats Peterson

On 01/07/2016 11:22 AM, Mats Peterson wrote:

So we'd better keep them, I guess.



There is a small chance for false positives, but it's probably negligible.

Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/2] avutil: add P010 pixel format

2016-01-07 Thread Hendrik Leppkes
P010 is the 10-bit variant of NV12 (planar luma, packed chroma), using two
bytes per component to store 10-bit data plus 6-bit zeroes in the LSBs.
---
 libavutil/pixdesc.c | 24 
 libavutil/pixfmt.h  |  4 
 2 files changed, 28 insertions(+)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 72d0470..58833cf 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2004,6 +2004,30 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 },
 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
 },
+[AV_PIX_FMT_P010LE] = {
+.name = "p010le",
+.nb_components = 3,
+.log2_chroma_w = 1,
+.log2_chroma_h = 1,
+.comp = {
+{ 0, 2, 0, 6, 10, 1, 9, 1 },/* Y */
+{ 1, 4, 0, 6, 10, 3, 9, 1 },/* U */
+{ 1, 4, 2, 6, 10, 3, 9, 3 },/* V */
+},
+.flags = AV_PIX_FMT_FLAG_PLANAR,
+},
+[AV_PIX_FMT_P010BE] = {
+.name = "p010be",
+.nb_components = 3,
+.log2_chroma_w = 1,
+.log2_chroma_h = 1,
+.comp = {
+{ 0, 2, 0, 6, 10, 1, 9, 1 },/* Y */
+{ 1, 4, 0, 6, 10, 3, 9, 1 },/* U */
+{ 1, 4, 2, 6, 10, 3, 9, 3 },/* V */
+},
+.flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
+},
 };
 #if FF_API_PLUS1_MINUS1
 FF_ENABLE_DEPRECATION_WARNINGS
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 32044f0..c01c057 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -289,6 +289,9 @@ enum AVPixelFormat {
 
 AV_PIX_FMT_VIDEOTOOLBOX, ///< hardware decoding through Videotoolbox
 
+AV_PIX_FMT_P010LE, ///< like NV12, with 10bpp per component, data in the 
high bits, zeros in the low bits, little-endian
+AV_PIX_FMT_P010BE, ///< like NV12, with 10bpp per component, data in the 
high bits, zeros in the low bits, big-endian
+
 AV_PIX_FMT_NB,///< number of pixel formats, DO NOT USE THIS if you 
want to link with shared libav* because the number of formats might differ 
between versions
 };
 
@@ -365,6 +368,7 @@ enum AVPixelFormat {
 #define AV_PIX_FMT_XYZ12  AV_PIX_FMT_NE(XYZ12BE, XYZ12LE)
 #define AV_PIX_FMT_NV20   AV_PIX_FMT_NE(NV20BE,  NV20LE)
 #define AV_PIX_FMT_AYUV64 AV_PIX_FMT_NE(AYUV64BE, AYUV64LE)
+#define AV_PIX_FMT_P010   AV_PIX_FMT_NE(P010BE,  P010LE)
 
 /**
   * Chromaticity coordinates of the source primaries.
-- 
2.6.2.windows.1

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


Re: [FFmpeg-devel] [PATCH 2/2] swscale: add P010 input support

2016-01-07 Thread wm4
On Thu, 7 Jan 2016 13:38:13 +0100
Hendrik Leppkes  wrote:

> On Thu, Jan 7, 2016 at 1:31 PM, Carl Eugen Hoyos  wrote:
> > Hendrik Leppkes  gmail.com> writes:
> >  
> >> Because that doesn't work. bits per raw sample is not
> >> taken into account when pixel formats are negotiated  
> >
> > But that is a missing feature that is needed independently
> > of your patch so imo this patch shouldn't add more
> > unneeded colour spaces (except if this is needed for
> > encoding).  
> 
> This pixel format directly corresponds to the pixel layout of hardware
> surfaces from the GPU, heck the GPU even calls it P010 as well,
> therefor it is needed to represent this exactly.
> I have no intention of providing a half-broken format because of some
> future feature that requires massive changes to all areas of FFmpeg,
> and won't arrive in the next couple years.

Last time we discussed this ("pixformaton"), we discarded the idea
because of its complexity.

Anyway, this format is certainly more important than the other weird
permutations (like AV_PIX_FMT_YUV440P12BE), or the BAYER formats.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] x86/vf_w3fdif: 32-bit compatibility for w3fdif_simple_high

2016-01-07 Thread Hendrik Leppkes
---
 libavfilter/x86/vf_w3fdif.asm| 35 +--
 libavfilter/x86/vf_w3fdif_init.c |  2 +-
 2 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/libavfilter/x86/vf_w3fdif.asm b/libavfilter/x86/vf_w3fdif.asm
index c3c73ea..52628c3 100644
--- a/libavfilter/x86/vf_w3fdif.asm
+++ b/libavfilter/x86/vf_w3fdif.asm
@@ -102,14 +102,22 @@ cglobal w3fdif_complex_low, 4, 7, 8, 0, work_line, 
in_lines_cur0, coef, linesize
 REP_RET
 
 %if ARCH_X86_64
-
 cglobal w3fdif_simple_high, 5, 9, 8, 0, work_line, in_lines_cur0, 
in_lines_adj0, coef, linesize
+%else
+cglobal w3fdif_simple_high, 4, 7, 8, 0, work_line, in_lines_cur0, 
in_lines_adj0, coef, linesize
+%endif
 movq  m2, [coefq]
+%if ARCH_X86_64
 DEFINE_ARGSwork_line, in_lines_cur0, in_lines_adj0, in_lines_cur1, 
linesize, offset, in_lines_cur2, in_lines_adj1, in_lines_adj2
+xor  offsetq, offsetq
+%else
+DEFINE_ARGSwork_line, in_lines_cur0, in_lines_adj0, in_lines_cur1, 
in_lines_cur2, in_lines_adj1, in_lines_adj2
+%define linesized r4mp
+%endif
+
 pshufdm0, m2, q
 SPLATWm2, m2, 2
 pxor  m7, m7
-mov  offsetq, 0
 mov   in_lines_cur2q, [in_lines_cur0q+gprsize*2]
 mov   in_lines_cur1q, [in_lines_cur0q+gprsize]
 mov   in_lines_cur0q, [in_lines_cur0q]
@@ -117,8 +125,21 @@ cglobal w3fdif_simple_high, 5, 9, 8, 0, work_line, 
in_lines_cur0, in_lines_adj0,
 mov   in_lines_adj1q, [in_lines_adj0q+gprsize]
 mov   in_lines_adj0q, [in_lines_adj0q]
 
+%if ARCH_X86_32
+sub in_lines_cur1q, in_lines_cur0q
+sub in_lines_cur2q, in_lines_cur0q
+sub in_lines_adj0q, in_lines_cur0q
+sub in_lines_adj1q, in_lines_cur0q
+sub in_lines_adj2q, in_lines_cur0q
+%define offsetq in_lines_cur0q
+%endif
+
 .loop:
+%if ARCH_X86_64
 movh   m3, [in_lines_cur0q+offsetq]
+%else
+movh   m3, [in_lines_cur0q]
+%endif
 movh   m4, [in_lines_cur1q+offsetq]
 punpcklbw  m3, m7
 punpcklbw  m4, m7
@@ -143,15 +164,25 @@ cglobal w3fdif_simple_high, 5, 9, 8, 0, work_line, 
in_lines_cur0, in_lines_adj0,
 pmaddwdm6, m2
 paddd  m3, m5
 paddd  m4, m6
+%if ARCH_X86_64
 paddd  m3, [work_lineq+offsetq*4]
 paddd  m4, [work_lineq+offsetq*4+mmsize]
 mova   [work_lineq+offsetq*4], m3
 mova[work_lineq+offsetq*4+mmsize], m4
+%else
+paddd  m3, [work_lineq]
+paddd  m4, [work_lineq+mmsize]
+mova [work_lineq], m3
+mova  [work_lineq+mmsize], m4
+addwork_lineq, mmsize*2
+%endif
 add   offsetq, mmsize/2
 sub linesized, mmsize/2
 jg .loop
 REP_RET
 
+%if ARCH_X86_64
+
 cglobal w3fdif_complex_high, 5, 13, 10, 0, work_line, in_lines_cur0, 
in_lines_adj0, coef, linesize
 movq  m0, [coefq+0]
 movd  m4, [coefq+8]
diff --git a/libavfilter/x86/vf_w3fdif_init.c b/libavfilter/x86/vf_w3fdif_init.c
index 72ea657..9bf06e8 100644
--- a/libavfilter/x86/vf_w3fdif_init.c
+++ b/libavfilter/x86/vf_w3fdif_init.c
@@ -51,12 +51,12 @@ av_cold void ff_w3fdif_init_x86(W3FDIFDSPContext *dsp)
 
 if (EXTERNAL_SSE2(cpu_flags)) {
 dsp->filter_simple_low   = ff_w3fdif_simple_low_sse2;
+dsp->filter_simple_high  = ff_w3fdif_simple_high_sse2;
 dsp->filter_complex_low  = ff_w3fdif_complex_low_sse2;
 dsp->filter_scale= ff_w3fdif_scale_sse2;
 }
 
 if (ARCH_X86_64 && EXTERNAL_SSE2(cpu_flags)) {
-dsp->filter_simple_high  = ff_w3fdif_simple_high_sse2;
 dsp->filter_complex_high = ff_w3fdif_complex_high_sse2;
 }
 }
-- 
2.6.2.windows.1

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


Re: [FFmpeg-devel] [PATCH 2/2] swscale: add P010 input support

2016-01-07 Thread Hendrik Leppkes
On Thu, Jan 7, 2016 at 1:11 PM, Carl Eugen Hoyos  wrote:
> Hendrik Leppkes  gmail.com> writes:
>
>> Microsoft specifically described the format to alias
>> to P016 with less precision for simplicity, however I
>> opted to convert to "true" 10-bit in sws by shifting
>> so format selection algorithms don't get confused
>> later, and actually treat it like 10-bit and not
>> 16-bit.
>
> Why don't you add P016 now and set bits_per_sample
> in the decoder?
> Especially since your conversion routine is missing
> | AV_RL16(src + i * 2) >> 10
>

Because that doesn't work. bits per raw sample is not taken into
account when pixel formats are negotiated, why do you think we have
yuv420p9,p10,p12,p14,p16?
Also, the conversion works fine, why would it be missing anything? It
just shifts away the 6 zero bits.

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


Re: [FFmpeg-devel] [PATCH 1/2] avutil: add P010 pixel format

2016-01-07 Thread wm4
On Thu,  7 Jan 2016 12:11:21 +0100
Hendrik Leppkes  wrote:

> P010 is the 10-bit variant of NV12 (planar luma, packed chroma), using two
> bytes per component to store 10-bit data plus 6-bit zeroes in the LSBs.
> ---
>  libavutil/pixdesc.c | 24 
>  libavutil/pixfmt.h  |  4 
>  2 files changed, 28 insertions(+)
> 
> diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> index 72d0470..58833cf 100644
> --- a/libavutil/pixdesc.c
> +++ b/libavutil/pixdesc.c
> @@ -2004,6 +2004,30 @@ static const AVPixFmtDescriptor 
> av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
>  },
>  .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
>  },
> +[AV_PIX_FMT_P010LE] = {
> +.name = "p010le",
> +.nb_components = 3,
> +.log2_chroma_w = 1,
> +.log2_chroma_h = 1,
> +.comp = {
> +{ 0, 2, 0, 6, 10, 1, 9, 1 },/* Y */
> +{ 1, 4, 0, 6, 10, 3, 9, 1 },/* U */
> +{ 1, 4, 2, 6, 10, 3, 9, 3 },/* V */

So just to clarify: each component is represented like with other 10
bit pixel formats (say, AV_PIX_FMT_YUV444P10LE), except the data is
already shifted left by 6?

If so, then this makes sense to me.

> +},
> +.flags = AV_PIX_FMT_FLAG_PLANAR,
> +},
> +[AV_PIX_FMT_P010BE] = {
> +.name = "p010be",
> +.nb_components = 3,
> +.log2_chroma_w = 1,
> +.log2_chroma_h = 1,
> +.comp = {
> +{ 0, 2, 0, 6, 10, 1, 9, 1 },/* Y */
> +{ 1, 4, 0, 6, 10, 3, 9, 1 },/* U */
> +{ 1, 4, 2, 6, 10, 3, 9, 3 },/* V */
> +},
> +.flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
> +},
>  };
>  #if FF_API_PLUS1_MINUS1
>  FF_ENABLE_DEPRECATION_WARNINGS
> diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
> index 32044f0..c01c057 100644
> --- a/libavutil/pixfmt.h
> +++ b/libavutil/pixfmt.h
> @@ -289,6 +289,9 @@ enum AVPixelFormat {
>  
>  AV_PIX_FMT_VIDEOTOOLBOX, ///< hardware decoding through Videotoolbox
>  
> +AV_PIX_FMT_P010LE, ///< like NV12, with 10bpp per component, data in the 
> high bits, zeros in the low bits, little-endian
> +AV_PIX_FMT_P010BE, ///< like NV12, with 10bpp per component, data in the 
> high bits, zeros in the low bits, big-endian
> +
>  AV_PIX_FMT_NB,///< number of pixel formats, DO NOT USE THIS if 
> you want to link with shared libav* because the number of formats might 
> differ between versions
>  };
>  
> @@ -365,6 +368,7 @@ enum AVPixelFormat {
>  #define AV_PIX_FMT_XYZ12  AV_PIX_FMT_NE(XYZ12BE, XYZ12LE)
>  #define AV_PIX_FMT_NV20   AV_PIX_FMT_NE(NV20BE,  NV20LE)
>  #define AV_PIX_FMT_AYUV64 AV_PIX_FMT_NE(AYUV64BE, AYUV64LE)
> +#define AV_PIX_FMT_P010   AV_PIX_FMT_NE(P010BE,  P010LE)
>  
>  /**
>* Chromaticity coordinates of the source primaries.

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


Re: [FFmpeg-devel] FFMPEG Ubuntu Compilation Wiki

2016-01-07 Thread Ganesh Ajjanagadde
On Wed, Jan 6, 2016 at 7:27 AM, Olalekan Ogunmolu  wrote:
> Hi there,
>
> Thank you for the amazing work that you all do.

Glad that you find FFmpeg useful.

>
> I thought to let you know I made your wiki page into a shell script
> available for download via my github page for your users.
>
>  https://github.com/lakehanne/Shells/blob/master/ffmpeg.sh

Thanks for posting the link here.

It may be reasonable to link this in our wiki, but these kinds of
"automation" scripts tend to be very brittle, and I would recommend
keeping the wiki up to date instead of a script. For example, what
does one do if a particular package in the repo is too out of date? I
ran into this myself on Arch; for a couple of weeks the x265 package
was too old for configure/FFmpeg. There is no error handling in the
script you sent, so it will be hard to figure out.

Left to others maintaining the wiki to decide.

>
> Feel free to use as you wish.
>
> Thank you!
>
>
> Sincerely,
>
> Olalekan
>
> ecs.utdallas.edu/~olalekan.ogunmolu
> lakehanne.github.io
>
> "...you never understand things. You just get used to them"
>-- John Von Neumann
> ___
> 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] lavf/mov: export chapter streams as private data

2016-01-07 Thread Michael Niedermayer
On Thu, Jan 07, 2016 at 05:14:26PM -0600, Rodger Combs wrote:
> This prevents consumers from showing chapters as if they were regular subtitle
> streams.
> ---
>  libavformat/mov.c | 3 +++
>  1 file changed, 3 insertions(+)

iam not sure this is optimal in the sense of being a final solution
but its better than it was based on your description so
LGTM

thx

[...]
-- 
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] libvpx: Support setting color range for vp9.

2016-01-07 Thread James Zern
Hi,

On Mon, Jan 4, 2016 at 12:26 PM, James Almer  wrote:
> On 1/4/2016 5:01 PM, Sasi Inguva wrote:
>> Would it be a lot easier and correct if I just update the IMAGE_ABI_VERSION 
>> to 4 in libvpx HEAD and check here in the decoder IMAGE_ABI_VERSION > 3  ?
>
> Yes, bumping any of the defines would probably be best. It will not apply
> to libvpxdec 1.5.0, though, but i guess it's better than bloating configure
> with checks for specific struct members.
>

I agree, though for this if you wanted compatibility, since the values
are defined by the bitstream, using 0/1 would be enough; the enum is
merely cosmetic.

>>
>> On Mon, Jan 4, 2016 at 11:03 AM, Ronald S. Bultje > > wrote:
>>
>> Hi,
>>
>> On Mon, Jan 4, 2016 at 1:48 PM, Sasi Inguva > > wrote:
>>
>> > Ping! I could not find any other fields for version other than the
>> > IMAGE_ABI_VERSION , CODEC_ABI_VERSION, DECODER_ABI_VERSION which remain
>> > unchanged .
>>
>>
>> So, add a version check? Or check for the existence of the appropriate
>> color range field in this struct in our configure script.
>>
>> Ronald
>> ___
>> 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
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCHv2] lavc/cbrt_tablegen: speed up tablegen

2016-01-07 Thread Ganesh Ajjanagadde
On Thu, Jan 7, 2016 at 5:20 PM, Ganesh Ajjanagadde  wrote:
> On Thu, Jan 7, 2016 at 4:48 PM, Michael Niedermayer
>  wrote:
>> On Mon, Jan 04, 2016 at 06:33:59PM -0800, Ganesh Ajjanagadde wrote:
>>> This exploits an approach based on the sieve of Eratosthenes, a popular
>>> method for generating prime numbers.
>>>
>>> Tables are identical to previous ones.
>>>
>>> Tested with FATE with/without --enable-hardcoded-tables.
>>>
>>> Sample benchmark (Haswell, GNU/Linux+gcc):
>>> prev:
>>> 7860100 decicycles in cbrt_tableinit,   1 runs,  0 skips
>>> 490 decicycles in cbrt_tableinit,   2 runs,  0 skips
>>> [...]
>>> 7582339 decicycles in cbrt_tableinit, 256 runs,  0 skips
>>> 7563556 decicycles in cbrt_tableinit, 512 runs,  0 skips
>>>
>>> new:
>>> 2099480 decicycles in cbrt_tableinit,   1 runs,  0 skips
>>> 2044470 decicycles in cbrt_tableinit,   2 runs,  0 skips
>>> [...]
>>> 1796544 decicycles in cbrt_tableinit, 256 runs,  0 skips
>>> 1791631 decicycles in cbrt_tableinit, 512 runs,  0 skips
>>>
>>> Both small and large run count given as this is called once so small run
>>> count may give a better picture, small numbers are fairly consistent,
>>> and there is a consistent downward trend from small to large runs,
>>> at which point it stabilizes to a new value.
>>>
>>> Signed-off-by: Ganesh Ajjanagadde 
>>> ---
>>>  libavcodec/aacdec_fixed.c   |  4 +--
>>>  libavcodec/aacdec_template.c|  2 +-
>>>  libavcodec/cbrt_tablegen.h  | 53 
>>> ++---
>>>  libavcodec/cbrt_tablegen_template.c | 12 -
>>>  4 files changed, 51 insertions(+), 20 deletions(-)
>>>
>>> diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c
>>> index 396a874..f7b882b 100644
>>> --- a/libavcodec/aacdec_fixed.c
>>> +++ b/libavcodec/aacdec_fixed.c
>>> @@ -155,9 +155,9 @@ static void vector_pow43(int *coefs, int len)
>>>  for (i=0; i>>  coef = coefs[i];
>>>  if (coef < 0)
>>> -coef = -(int)cbrt_tab[-coef];
>>> +coef = -(int)cbrt_tab[-coef].i;
>>>  else
>>> -coef = (int)cbrt_tab[coef];
>>> +coef = (int)cbrt_tab[coef].i;
>>>  coefs[i] = coef;
>>>  }
>>>  }
>>> diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
>>> index d819958..1380510 100644
>>> --- a/libavcodec/aacdec_template.c
>>> +++ b/libavcodec/aacdec_template.c
>>> @@ -1791,7 +1791,7 @@ static int decode_spectrum_and_dequant(AACContext 
>>> *ac, INTFLOAT coef[1024],
>>>  v = -v;
>>>  *icf++ = v;
>>>  #else
>>> -*icf++ = cbrt_tab[n] | (bits & 1U<<31);
>>> +*icf++ = cbrt_tab[n].i | (bits & 
>>> 1U<<31);
>>>  #endif /* USE_FIXED */
>>>  bits <<= 1;
>>>  } else {
>>> diff --git a/libavcodec/cbrt_tablegen.h b/libavcodec/cbrt_tablegen.h
>>> index 59b5a1d..e3d6634 100644
>>> --- a/libavcodec/cbrt_tablegen.h
>>> +++ b/libavcodec/cbrt_tablegen.h
>>> @@ -26,14 +26,13 @@
>>>  #include 
>>>  #include 
>>>  #include "libavutil/attributes.h"
>>> +#include "libavutil/intfloat.h"
>>>  #include "libavcodec/aac_defines.h"
>>>
>>> -#if USE_FIXED
>>> -#define CBRT(x) lrint((x).f * 8192)
>>> -#else
>>> -#define CBRT(x) x.i
>>> -#endif
>>> -
>>
>>> +union ff_int32float64 {
>>> +uint32_t i;
>>> +double   f;
>>> +};
>>>  #if CONFIG_HARDCODED_TABLES
>>>  #if USE_FIXED
>>>  #define cbrt_tableinit_fixed()
>>> @@ -43,20 +42,42 @@
>>>  #include "libavcodec/cbrt_tables.h"
>>>  #endif
>>>  #else
>>> -static uint32_t cbrt_tab[1 << 13];
>>> +static union ff_int32float64 cbrt_tab[1 << 13];
>>
>> this doubles the size of the cpu cache needed at runtime to store
>> the same number of elements
>
> Yes, it does, and it was a tradeoff I made that I forgot to list. One
> can of course use floats; but this loses accuracy at significant
> levels.
>
> So one could malloc and free a double precision array (for temporary
> storage) at costs of some code complexity, possible heap
> fragmentation, and the problem of possible failure (may be ok since
> anyway aac_decode_init is not guaranteed to succeed; it allocates
> memory for the dsp context). Malloc/free is AFAIK ~ 100's of cycles,
> dwarfed by the table generation cost.

or local static array, once init'ed, this will be handled in a natural
way. Superior to the malloc solution, and IMHO is fine.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] lavf: add AV_DISPOSITION_TIMED_THUMBNAILS

2016-01-07 Thread Michael Niedermayer
On Thu, Jan 07, 2016 at 07:07:40PM -0600, Rodger Combs wrote:
> ---
>  ffprobe.c  |  1 +
>  libavformat/avformat.h | 12 +---
>  2 files changed, 10 insertions(+), 3 deletions(-)

breaks fate

 utvideoenc_yuv422_none
TESTffprobe_compact
--- ./tests/ref/fate/ffprobe_compact2016-01-07 02:02:09.760758306 +0100
+++ tests/data/fate/ffprobe_compact 2016-01-08 03:52:08.342717531 +0100
@@ -26,7 +26,7 @@
 
frame|media_type=video|stream_index=1|key_frame=1|pkt_pts=6144|pkt_pts_time=0.12|pkt_dts=6144|pkt_dts_time=0.12|best_effort_timestamp=6144|best_effort_timestamp_time=0.12|pkt_duration=2048|pkt_duration_time=0.04|pkt_pos=794377|pkt_size=230400|width=320|height=240|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0
 
packet|codec_type=video|stream_index=2|pts=6144|pts_time=0.12|dts=6144|dts_time=0.12|duration=2048|duration_time=0.04|convergence_duration=N/A|convergence_duration_time=N/A|size=3|pos=1024801|flags=K
 
frame|media_type=video|stream_index=2|key_frame=1|pkt_pts=6144|pkt_pts_time=0.12|pkt_dts=6144|pkt_dts_time=0.12|best_effort_timestamp=6144|best_effort_timestamp_time=0.12|pkt_duration=2048|pkt_duration_time=0.04|pkt_pos=1024801|pkt_size=3|width=100|height=100|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0
-stream|index=0|codec_name=pcm_s16le|profile=unknown|codec_type=audio|codec_time_base=1/44100|codec_tag_string=PSD[16]|codec_tag=0x10445350|sample_fmt=s16|sample_rate=44100|channels=1|channel_layout=unknown|bits_per_sample=16|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/44100|start_pts=0|start_time=0.00|duration_ts=N/A|duration=N/A|bit_rate=705600|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=6|nb_read_packets=6|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|tag:E=mc²|tag:encoder=Lavc
 pcm_s16le
-stream|index=1|codec_name=rawvideo|profile=unknown|codec_type=video|codec_time_base=1/51200|codec_tag_string=RGB[24]|codec_tag=0x18424752|width=320|height=240|coded_width=320|coded_height=240|has_b_frames=0|sample_aspect_ratio=1:1|display_aspect_ratio=4:3|pix_fmt=rgb24|level=-99|color_range=N/A|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=unspecified|timecode=N/A|refs=1|id=N/A|r_frame_rate=25/1|avg_frame_rate=25/1|time_base=1/51200|start_pts=0|start_time=0.00|duration_ts=N/A|duration=N/A|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=4|nb_read_packets=4|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|tag:title=foobar|tag:duration_ts=field-and-tags-conflict-attempt|tag:encoder=Lavc
 rawvideo
-stream|index=2|codec_name=rawvideo|profile=unknown|codec_type=video|codec_time_base=1/51200|codec_tag_string=RGB[24]|codec_tag=0x18424752|width=100|height=100|coded_width=100|coded_height=100|has_b_frames=0|sample_aspect_ratio=1:1|display_aspect_ratio=1:1|pix_fmt=rgb24|level=-99|color_range=N/A|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=unspecified|timecode=N/A|refs=1|id=N/A|r_frame_rate=25/1|avg_frame_rate=25/1|time_base=1/51200|start_pts=0|start_time=0.00|duration_ts=N/A|duration=N/A|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=4|nb_read_packets=4|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|tag:encoder=Lavc
 rawvideo
+stream|index=0|codec_name=pcm_s16le|profile=unknown|codec_type=audio|codec_time_base=1/44100|codec_tag_string=PSD[16]|codec_tag=0x10445350|sample_fmt=s16|sample_rate=44100|channels=1|channel_layout=unknown|bits_per_sample=16|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/44100|start_pts=0|start_time=0.00|duration_ts=N/A|duration=N/A|bit_rate=705600|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=6|nb_read_packets=6|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|tag:E=mc²|tag:encoder=Lavc
 pcm_s16le

[FFmpeg-devel] FFMPEG Ubuntu Compilation Wiki

2016-01-07 Thread Olalekan Ogunmolu
Hi there,

Thank you for the amazing work that you all do.

I thought to let you know I made your wiki page into a shell script
available for download via my github page for your users.

 https://github.com/lakehanne/Shells/blob/master/ffmpeg.sh

Feel free to use as you wish.

Thank you!


Sincerely,

Olalekan

ecs.utdallas.edu/~olalekan.ogunmolu
lakehanne.github.io

"...you never understand things. You just get used to them"
   -- John Von Neumann
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] -cmdline_from_file new paramter

2016-01-07 Thread Procontrol Robert Kovacs
---
 cmdutils.c   | 186 +++
 doc/fftools-common-opts.texi |  41 ++
 2 files changed, 227 insertions(+)

diff --git a/cmdutils.c b/cmdutils.c
index e0d2807..5441485 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -732,6 +732,189 @@ void uninit_parse_context(OptionParseContext *octx)
 uninit_opts();
 }
 
+/*
+ * read file contents into a string (copy from ffmpeg.c, because I don't how 
call original function from here) 
+ */
+static uint8_t *read_file(const char *filename)
+{
+AVIOContext *pb  = NULL;
+AVIOContext *dyn_buf = NULL;
+int ret = avio_open(, filename, AVIO_FLAG_READ);
+uint8_t buf[1024], *str;
+
+if (ret < 0) {
+av_log(NULL, AV_LOG_ERROR, "Error opening file %s.\n", filename);
+return NULL;
+}
+
+ret = avio_open_dyn_buf(_buf);
+if (ret < 0) {
+avio_closep();
+return NULL;
+}
+while ((ret = avio_read(pb, buf, sizeof(buf))) > 0)
+avio_write(dyn_buf, buf, ret);
+avio_w8(dyn_buf, 0);
+avio_closep();
+
+ret = avio_close_dyn_buf(dyn_buf, );
+if (ret < 0)
+return NULL;
+return str;
+}
+
+/*
+ * Replace original program command line args, if use -cmdline_from_file 
parameter.
+ * @param argc Original main argc replaced to new from script
+ * @param argv Original main argv replaced to new from script
+ */
+static int parse_commandline_script_from_file(int *argc, char ***argv)
+{
+
+int arguments_number=1;
+int argument_max_size=500;
+int argument_max_num=200;
+int textindicator=0;
+char ** buf;
+int block_comment_active=0;
+int last_block_comment_active=0; 
+int inline_comment_active=0;
+int count=0;
+int script_argc = 0;
+uint8_t *controlfile_str;
+
+/* Check -cmdline_from_file parameter */
+for (count = 0; count < *argc; count++)
+{
+if (!strcmp( (*argv)[count], "-cmdline_from_file"))
+{
+script_argc=count;
+}
+}
+
+/* if not have this parameter, return to original split_commandline 
function, without modification. */
+if (script_argc == 0)
+{
+return 0;
+}
+
+av_log(NULL, AV_LOG_INFO, "Have -cmdline_from_file paramter on %i 
position. Fully replace program parameters now!\n", script_argc);
+
+controlfile_str = read_file( (*argv)[ script_argc+1 ] );
+if (!controlfile_str)
+{
+return AVERROR(EINVAL);
+} else
+{
+int i=0;
+int character_index=0;
+char actualcharacter;
+char lastcharacter='q';
+
+buf= (char**) malloc(sizeof(char*)*(argument_max_num));
+buf[arguments_number]=(char*) malloc(argument_max_size* sizeof(char));
+
+while((actualcharacter=controlfile_str[i])!='\0')
+{
+i++;
+/* watch comment block end */
+if ((actualcharacter=='*')&&(lastcharacter=='/'))
+{
+   block_comment_active=1;
+   continue;
+}
+
+/* watch comment block start */
+if ((actualcharacter=='/')&&(lastcharacter=='*'))
+{
+block_comment_active=0;
+character_index--;
+}
+
+/* watch inline comment */
+if ((actualcharacter=='/')&&(lastcharacter=='/'))
+{
+  inline_comment_active=1;
+  character_index--;
+  continue;
+}
+
+/* watch inline comment end (newline) */
+if ((inline_comment_active)&&((actualcharacter=='\n'))) //'\0x1D' 
chr(13)
+{
+inline_comment_active=0;
+}
+
+/* store characters, if not block comment active */
+if 
((!block_comment_active)&&(!last_block_comment_active)&&(!inline_comment_active))
+{
+/* Check string bracketed block start or stop */
+if (actualcharacter=='"')
+{
+textindicator++;
+textindicator=textindicator%2;
+}
+/* New parameter, not in bracket */
+if (((actualcharacter==' 
')&&(textindicator==0))||((actualcharacter=='\n')&&(textindicator==0)&&(lastcharacter!='\n')))
+{
+/* New parameter parsed. Close argument last character 
position with 0x00. Close arg, and prepare next. */
+if (character_index!=0)
+{
+buf[arguments_number][character_index]='\0';
+character_index=0;
+arguments_number++;
+}
+}
+/* New character. */
+if ( !((actualcharacter=='\n') || (actualcharacter=='"') || 
((actualcharacter==' ') && (textindicator==0))) )
+{
+/* 

Re: [FFmpeg-devel] [PATCH 2/3] libavcodec/ccaption_dec: clean up and standardize white space

2016-01-07 Thread Anshul Maheshwari
On Tue, Jan 5, 2016 at 8:58 AM, Aman Gupta  wrote:

> From: Aman Gupta 
>
> ---
>  libavcodec/ccaption_dec.c | 98
> ++-
>  1 file changed, 45 insertions(+), 53 deletions(-)
>
> diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
> index 4e478e0..96f0ccf 100644
> --- a/libavcodec/ccaption_dec.c
> +++ b/libavcodec/ccaption_dec.c
> @@ -145,10 +145,9 @@ struct Screen {
>   * for setting row 1  use row | (1 << 0)
>   * for setting row 15 use row | (1 << 14)
>   */
> -int16_t  row_used;
> +int16_t row_used;
>  };
>
> -
>  typedef struct CCaptionSubContext {
>  AVClass *class;
>  struct Screen screen[2];
> @@ -168,7 +167,7 @@ typedef struct CCaptionSubContext {
>  char prev_cmd[2];
>  /* buffer to store pkt data */
>  AVBufferRef *pktbuf;
> -}CCaptionSubContext;
> +} CCaptionSubContext;
>
>
>  static av_cold int init_decoder(AVCodecContext *avctx)
> @@ -181,12 +180,12 @@ static av_cold int init_decoder(AVCodecContext
> *avctx)
>  ctx->mode = CCMODE_ROLLUP_2;
>  ctx->rollup = 2;
>  ret = ff_ass_subtitle_header_default(avctx);
> -if(ret < 0) {
> +if (ret < 0) {
>  return ret;
>  }
>  /* allocate pkt buffer */
>  ctx->pktbuf = av_buffer_alloc(128);
> -if( !ctx->pktbuf) {
> +if (!ctx->pktbuf) {
>  ret = AVERROR(ENOMEM);
>  }
>  return ret;
> @@ -195,7 +194,7 @@ static av_cold int init_decoder(AVCodecContext *avctx)
>  static av_cold int close_decoder(AVCodecContext *avctx)
>  {
>  CCaptionSubContext *ctx = avctx->priv_data;
> -av_bprint_finalize( >buffer, NULL);
> +av_bprint_finalize(>buffer, NULL);
>  av_buffer_unref(>pktbuf);
>  return 0;
>  }
> @@ -203,14 +202,14 @@ static av_cold int close_decoder(AVCodecContext
> *avctx)
>  /**
>   * @param ctx closed caption context just to print log
>   */
> -static int write_char (CCaptionSubContext *ctx, char *row,uint8_t col,
> char ch)
> +static int write_char(CCaptionSubContext *ctx, char *row, uint8_t col,
> char ch)
>  {
> -if(col < SCREEN_COLUMNS) {
> +if (col < SCREEN_COLUMNS) {
>  row[col] = ch;
>  return 0;
>  }
>  /* We have extra space at end only for null character */
> -else if ( col == SCREEN_COLUMNS && ch == 0) {
> +else if (col == SCREEN_COLUMNS && ch == 0) {
>  row[col] = ch;
>  return 0;
>  }
> @@ -227,7 +226,7 @@ static int write_char (CCaptionSubContext *ctx, char
> *row,uint8_t col, char ch)
>   * If the second byte doesn't pass parity, it returns INVALIDDATA
>   * user can ignore the whole pair and pass the other pair.
>   */
> -static int validate_cc_data_pair (uint8_t *cc_data_pair)
> +static int validate_cc_data_pair(uint8_t *cc_data_pair)
>  {
>  uint8_t cc_valid = (*cc_data_pair & 4) >>2;
>  uint8_t cc_type = *cc_data_pair & 3;
> @@ -246,21 +245,19 @@ static int validate_cc_data_pair (uint8_t
> *cc_data_pair)
>  }
>
>  //Skip non-data
> -if( (cc_data_pair[0] == 0xFA || cc_data_pair[0] == 0xFC ||
> cc_data_pair[0] == 0xFD )
> +if ((cc_data_pair[0] == 0xFA || cc_data_pair[0] == 0xFC ||
> cc_data_pair[0] == 0xFD)
>   && (cc_data_pair[1] & 0x7F) == 0 && (cc_data_pair[2] & 0x7F) ==
> 0)
>  return AVERROR_PATCHWELCOME;
>
>  //skip 708 data
> -if(cc_type == 3 || cc_type == 2 )
> +if (cc_type == 3 || cc_type == 2)
>  return AVERROR_PATCHWELCOME;
>
>  /* remove parity bit */
>  cc_data_pair[1] &= 0x7F;
>  cc_data_pair[2] &= 0x7F;
>
> -
>  return 0;
> -
>  }
>
>  static struct Screen *get_writing_screen(CCaptionSubContext *ctx)
> @@ -286,7 +283,7 @@ static void roll_up(CCaptionSubContext *ctx)
>  struct Screen *screen;
>  int i, keep_lines;
>
> -if(ctx->mode == CCMODE_TEXT)
> +if (ctx->mode == CCMODE_TEXT)
>  return;
>
>  screen = get_writing_screen(ctx);
> @@ -296,22 +293,21 @@ static void roll_up(CCaptionSubContext *ctx)
>   */
>  keep_lines = FFMIN(ctx->cursor_row + 1, ctx->rollup);
>
> -for( i = 0; i < ctx->cursor_row - keep_lines; i++ )
> +for (i = 0; i < ctx->cursor_row - keep_lines; i++)
>  UNSET_FLAG(screen->row_used, i);
>
>
> -for( i = 0; i < keep_lines && screen->row_used; i++ ) {
> +for (i = 0; i < keep_lines && screen->row_used; i++) {
>  const int i_row = ctx->cursor_row - keep_lines + i + 1;
>
> -memcpy( screen->characters[i_row], screen->characters[i_row+1],
> SCREEN_COLUMNS );
> -memcpy( screen->colors[i_row], screen->colors[i_row+1],
> SCREEN_COLUMNS);
> -memcpy( screen->fonts[i_row], screen->fonts[i_row+1],
> SCREEN_COLUMNS);
> -if(CHECK_FLAG(screen->row_used, i_row + 1))
> +memcpy(screen->characters[i_row], screen->characters[i_row+1],
> SCREEN_COLUMNS);
> +memcpy(screen->colors[i_row], screen->colors[i_row+1],
> SCREEN_COLUMNS);
> +memcpy(screen->fonts[i_row], 

Re: [FFmpeg-devel] [PATCH 04/10] libavcodec/ccaption_dec: reap_screen after flipping on EOC

2016-01-07 Thread Aman Gupta
Probably should have written a longer commit message here. The EOC command
stands for "end of caption" aka "display buffer". It's used with POPON
mode, where characters are written to an off-screen buffer and EOC flips
the buffers to display what has been written so far. Thus, it makes sense
to reap the screen *after* flipping the active screen, not *before*.

The previous behavior was simply wrong, but masked by other bugs also fixed
in this patchset.

Aman

On Tue, Jan 5, 2016 at 11:41 PM, Aman Gupta  wrote:

> From: Aman Gupta 
>
> ---
>  libavcodec/ccaption_dec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
> index 9f17e77..5d4c568 100644
> --- a/libavcodec/ccaption_dec.c
> +++ b/libavcodec/ccaption_dec.c
> @@ -399,9 +399,9 @@ static void handle_erase(CCaptionSubContext *ctx, int
> n_screen)
>
>  static void handle_eoc(CCaptionSubContext *ctx)
>  {
> -reap_screen(ctx);
>  ctx->active_screen = !ctx->active_screen;
>  ctx->cursor_column = 0;
> +reap_screen(ctx);
>  }
>
>  static void handle_delete_end_of_row(CCaptionSubContext *ctx, char hi,
> char lo)
> --
> 2.5.3
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] libavcodec/ccaption_dec: remove unnecessary include

2016-01-07 Thread Anshul Maheshwari
On Tue, Jan 5, 2016 at 8:58 AM, Aman Gupta  wrote:

> From: Aman Gupta 
>
> ---
>  libavcodec/ccaption_dec.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
> index 9f67caa..4e478e0 100644
> --- a/libavcodec/ccaption_dec.c
> +++ b/libavcodec/ccaption_dec.c
> @@ -21,7 +21,6 @@
>
>  #include "avcodec.h"
>  #include "ass.h"
> -#include "libavutil/internal.h"
>  #include "libavutil/opt.h"
>
>  #define SCREEN_ROWS 15
> --
> 2.5.3
>
>
LGTM

-- 
with regards
Anshul
:)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] Discussion related to the use of a global thread pool rather than the current threading model

2016-01-07 Thread Jean-Yves Avenard
Hi

This is a discussion you guys may already have discussed about this, I
apologise in advance if that is the case (and thank you for pointing
me to it if that's the case).

I work for Mozilla, in the media playback team of gecko.
In Firefox, we've finally moved to use ffvp9 and ffvp8 in place of
libvpx for video decoding. Should be available in Nightly shortly
(ffmpeg was already used if available in 43 and later on Linux). So we
now ship ffvp9 and ffvp8 in our code tree. Likely make us the biggest
user of ffvp9 at once ! :)

One of the issues we've faced was with our reftest tests , with pages
creating hundreds of small video elements (the test change
orientation, sizes, transparency and the like and check that there's
no regression on how things are displayed).

We originally had configured AVCodecContext::thread_count to 0, which
on the machines running the tests would end up creating 8 threads per
decoder.
On windows 32 bits, that would amount in thousand of threads being
created for that particular test which would typically fail with OOM
(Windows XP would fail to create more than 1380 threads).

We've worked around the problem by limiting the number of threads per
decoder (the amount varies according to the video resolution)

However the issue remains, in that the current way threads are used,
it won't scale well.

We've seen more and more web page, replacing all their tiny flash
video elements with HTML5 webm or mp4 ; so the more time goes, the
more it will become a problem.

Rather than setting the number of threads per decoder, independently
of any other decoders created ; what about using a global thread pool
with task queues instead ?

The thread pool could be created with a set amount of working threads,
something global.

When a decoder is created, rather than using N threads, it uses N task
queues (all task queues sharing the same thread pool). When it needs
to perform a particular operation, it would dispatch a task (of course
it can dispatch multiple task at once)

This would solve the problem of scalability, having hundreds of
decoders live wouldn't put the system to its knee like it does now.

Would this be something any of you guys would be interested in tackling ?

If not and I was to work on something bringing this functionality,
would it have a chance to be integrated?

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


Re: [FFmpeg-devel] [PATCH] avfilter: add SOFAlizer audio filter

2016-01-07 Thread Paul B Mahol
On 1/7/16, Paul B Mahol  wrote:
> On 1/7/16, Roger Pack  wrote:
>> On 12/10/15, Paul B Mahol  wrote:
>>> Signed-off-by: Paul B Mahol 
>>> ---
>>> Lite version of one sent to VLC mailing list with only slow but high
>>> quality
>>> mode present.
>>> To use you need recent netCDF library, SOFA file(s), multichannel audio
>>> and
>>> headphones.
>>
>> Could you post an example or step by step instructions of using this,
>> for followers? A specific SOFA file, for instance, etc.
>
> Download some sofa files from here
> http://www.sofaconventions.org/mediawiki/index.php/Files
>
> and try each one and pick one sounding best.
>
> The final sounding result also depends on your headphone frequency
> response.
>

First: download one of 7.1 testing samples which test single speaker at time.
Then make sure that virtual speaker position is correct.

Second: increase/decrease gain option so overal volume match original input.

Third: test if no unusal equalization happened, eg. significant loss
of lows, mids or highs.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add SOFAlizer audio filter

2016-01-07 Thread Paul B Mahol
On 1/7/16, Paul B Mahol  wrote:
> On 1/7/16, Paul B Mahol  wrote:
>> On 1/7/16, Roger Pack  wrote:
>>> On 12/10/15, Paul B Mahol  wrote:
 Signed-off-by: Paul B Mahol 
 ---
 Lite version of one sent to VLC mailing list with only slow but high
 quality
 mode present.
 To use you need recent netCDF library, SOFA file(s), multichannel audio
 and
 headphones.
>>>
>>> Could you post an example or step by step instructions of using this,
>>> for followers? A specific SOFA file, for instance, etc.
>>
>> Download some sofa files from here
>> http://www.sofaconventions.org/mediawiki/index.php/Files
>>
>> and try each one and pick one sounding best.
>>
>> The final sounding result also depends on your headphone frequency
>> response.
>>
>
> First: download one of 7.1 testing samples which test single speaker at
> time.
> Then make sure that virtual speaker position is correct.
>
> Second: increase/decrease gain option so overal volume match original
> input.
>
> Third: test if no unusal equalization happened, eg. significant loss
> of lows, mids or highs.
>

For SOFA files, try this one for start:

http://sofacoustics.org/data/database/fhk/HRIR_FULL2DEG.sofa
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] ffmpeg: check fclose return values

2016-01-07 Thread Ganesh Ajjanagadde
On Thu, Jan 7, 2016 at 9:27 AM, Michael Niedermayer
 wrote:
> On Wed, Jan 06, 2016 at 09:00:46PM -0800, Ganesh Ajjanagadde wrote:
>> In the spirit of commit a956840cbc. Simple method to reproduce:
>> pass -vstats_file /dev/full to ffmpeg.
>>
>> All raw fclose usages in ffmpeg.c taken care of here.
>>
>> Signed-off-by: Ganesh Ajjanagadde 
>> ---
>>  ffmpeg.c | 13 ++---
>>  1 file changed, 10 insertions(+), 3 deletions(-)
>
> LGTM
>
> thanks

So there is actually a problem with the diagnostic obtained, a more
accurate diagnostic is via errno, say strerror(errno) instead of
av_err2str(ret).
Comparison:
Error closing vstats file, loss of information possible: Operation not permitted
vs
Error closing vstats file, loss of information possible: No space left on device
for the provided /dev/full example.

So there are a number of possiblities:
1. Have 2 separate av_log lines, one for each of these.
2. A single av_log line, using strerror(errno).
3. Leave as is.

I prefer 2. Let me know your preference, and I will push later.

>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Many that live deserve death. And some that die deserve life. Can you give
> it to them? Then do not be too eager to deal out death in judgement. For
> even the very wise cannot see all ends. -- Gandalf
>
> ___
> 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] [RFC] avcodec: Add native DCA decoder based on libdcadec.

2016-01-07 Thread Andreas Cadhalpun
On 07.01.2016 20:20, Hendrik Leppkes wrote:
> On Thu, Jan 7, 2016 at 8:17 PM, Andreas Cadhalpun
>  wrote:
>>
>> I'd be glad to increase fuzz-testing coverage further, but I'm lacking
>> input examples. It would be great if you could share some (tiny) samples
>> triggering the HEADER_XCH/HEADER_XXCH cases and/or *_down_mix functions.
>>
> 
> These samples should cover nearly all features in the decoder:
> https://github.com/foo86/dcadec-samples

Thanks, I'll try fuzzing with these.

> Once its commited, we should make them FATE tests as well.

Yes, that would be good.

Best regards,
Andreas
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add SOFAlizer audio filter

2016-01-07 Thread Roger Pack
On 12/10/15, Paul B Mahol  wrote:
> Signed-off-by: Paul B Mahol 
> ---
> Lite version of one sent to VLC mailing list with only slow but high quality
> mode present.
> To use you need recent netCDF library, SOFA file(s), multichannel audio and
> headphones.

Could you post an example or step by step instructions of using this,
for followers? A specific SOFA file, for instance, etc.
Cheers!
-roger-
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [RFC] avcodec: Add native DCA decoder based on libdcadec.

2016-01-07 Thread Andreas Cadhalpun
On 06.01.2016 23:17, Andreas Cadhalpun wrote:
> On 06.01.2016 18:32, foo86 wrote:
>> Otherwise testing coverage will be decreased somewhat. The easiest way to do
>> this is to modify ff_dca2_check_crc() to always return 0.
> 
> I tried this (comment out everything in ff_dca2_check_crc except 'return 0')
> and there doesn't seem to be much difference.

The reason why this didn't make any difference is that this function wasn't
executed at all for my fuzzed samples. :-/
I fixed that and coverage is now much better. Hence I also have a few more
(minor) comments:

On 03.01.2016 18:49, foo86 wrote:
> +for (i = 0; i < spkr_remap_nsets; i++) {
> +// Number of channels to be decoded for speaker remapping
> +int nch_for_remaps = get_bits(>gb, 5) + 1;
> +
> +for (j = 0; j < nspeakers[i]; j++) {
> +// Decoded channels to output speaker mapping mask
> +int remap_ch_mask = get_bits(>gb, nch_for_remaps);

Here nch_for_remaps can be up to 32, so this has to use get_bits_long, as
get_bits only supports reading 1-25 bits.

> +for (i = 0; i < s->nmixoutconfigs; i++) {
> +for (j = 0; j < nchannels_dmix; j++) {
> +// Mix output mask
> +int mix_map_mask = get_bits(>gb, s->nmixoutchs[i]);

Here s->nmixoutchs[i] can be zero. If that should not happen, there needs
to be an error check and otherwise it should use get_bitsz, because
get_bits doesn't support reading 0 bits.

Anyway, I still think the code is pretty robust. :-)

I'd be glad to increase fuzz-testing coverage further, but I'm lacking
input examples. It would be great if you could share some (tiny) samples
triggering the HEADER_XCH/HEADER_XXCH cases and/or *_down_mix functions.

Best regards,
Andreas
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add SOFAlizer audio filter

2016-01-07 Thread Paul B Mahol
On 1/7/16, Roger Pack  wrote:
> On 12/10/15, Paul B Mahol  wrote:
>> Signed-off-by: Paul B Mahol 
>> ---
>> Lite version of one sent to VLC mailing list with only slow but high
>> quality
>> mode present.
>> To use you need recent netCDF library, SOFA file(s), multichannel audio
>> and
>> headphones.
>
> Could you post an example or step by step instructions of using this,
> for followers? A specific SOFA file, for instance, etc.

Download some sofa files from here
http://www.sofaconventions.org/mediawiki/index.php/Files

and try each one and pick one sounding best.

The final sounding result also depends on your headphone frequency response.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/ccaption_dec: fix always true condition

2016-01-07 Thread Clément Bœsch
On Wed, Jan 06, 2016 at 01:39:30AM +0100, Michael Niedermayer wrote:
> On Tue, Jan 05, 2016 at 09:54:54PM +0100, Clément Bœsch wrote:
> > No idea why this wasn't ever detected by a static analyzer.
> > ---
> >  libavcodec/ccaption_dec.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
> > index 4e478e0..94771d5 100644
> > --- a/libavcodec/ccaption_dec.c
> > +++ b/libavcodec/ccaption_dec.c
> > @@ -462,7 +462,7 @@ static int process_cc608(CCaptionSubContext *ctx, 
> > int64_t pts, uint8_t hi, uint8
> >  #define COR3(var, with1, with2, with3)  ( (var) == (with1) ||  (var) == 
> > (with2) || (var) == (with3) )
> >  if ( hi == ctx->prev_cmd[0] && lo == ctx->prev_cmd[1]) {
> >  /* ignore redundant command */
> > -} else if ( (hi == 0x10 && (lo >= 0x40 || lo <= 0x5f)) ||
> > +} else if ( (hi == 0x10 && (lo >= 0x40 && lo <= 0x5f)) ||
> 
> without checking any specs, the code looks better after the patch
> than before
> 

thx, applied

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH 2/3] lavc/ccaption_dec: use ff_parity()

2016-01-07 Thread Clément Bœsch
On Sun, Jan 03, 2016 at 11:11:03PM +0100, Michael Niedermayer wrote:
> On Sun, Jan 03, 2016 at 08:21:01PM +0100, Clément Bœsch wrote:
> > ---
> >  libavcodec/ccaption_dec.c | 38 ++
> >  1 file changed, 2 insertions(+), 36 deletions(-)
> 
> should be ok
> 
> thx
> 

pushed

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH 3/3] lavc/g729dec: use ff_parity()

2016-01-07 Thread Clément Bœsch
On Sun, Jan 03, 2016 at 11:09:01PM +0100, Michael Niedermayer wrote:
> On Sun, Jan 03, 2016 at 08:21:02PM +0100, Clément Bœsch wrote:
> > ---
> >  libavcodec/g729dec.c | 10 +-
> >  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> LGTM
> thx
> 

pushed

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH 1/3] common: add ff_parity()

2016-01-07 Thread Clément Bœsch
On Sun, Jan 03, 2016 at 08:25:38PM +0100, Clément Bœsch wrote:
> On Sun, Jan 03, 2016 at 08:21:00PM +0100, Clément Bœsch wrote:
> > ---
> >  configure   | 2 ++
> >  libavutil/x86/intmath.h | 9 +
> >  2 files changed, 11 insertions(+)
> > 
> > diff --git a/configure b/configure
> > index 6710f85..610be92 100755
> > --- a/configure
> > +++ b/configure
> > @@ -1738,6 +1738,7 @@ BUILTIN_LIST="
> >  machine_rw_barrier
> >  MemoryBarrier
> >  mm_empty
> > +parity
> >  rdtsc
> >  sarestart
> >  sync_val_compare_and_swap
> > @@ -5242,6 +5243,7 @@ check_builtin sarestart signal.h "SA_RESTART"
> >  check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; 
> > __sync_val_compare_and_swap(ptr, oldval, newval)"
> >  check_builtin gmtime_r time.h "time_t *time; struct tm *tm; gmtime_r(time, 
> > tm)"
> >  check_builtin localtime_r time.h "time_t *time; struct tm *tm; 
> > localtime_r(time, tm)"
> > +check_builtin parity "" "__builtin_parity(123)"
> >  
> >  case "$custom_allocator" in
> >  jemalloc)
> > diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h
> > index 611ef88..9c36bf2 100644
> > --- a/libavutil/x86/intmath.h
> > +++ b/libavutil/x86/intmath.h
> 
> ... moved locally to libavutil/intmath.h under proper ff_parity_c
> ifdefery, sorry for the noise.
> 

applied with these changes

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH 2/2] swscale: add P010 input support

2016-01-07 Thread Michael Niedermayer
On Thu, Jan 07, 2016 at 12:11:22PM +0100, Hendrik Leppkes wrote:
> ---
>  libswscale/input.c| 53 
> +++
>  libswscale/swscale_unscaled.c |  4 +++-
>  libswscale/utils.c|  2 ++
>  3 files changed, 58 insertions(+), 1 deletion(-)

LGTM if tested

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Observe your enemies, for they first find out your faults. -- Antisthenes


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: check fclose return values

2016-01-07 Thread Michael Niedermayer
On Thu, Jan 07, 2016 at 10:00:47AM -0800, Ganesh Ajjanagadde wrote:
> On Thu, Jan 7, 2016 at 9:27 AM, Michael Niedermayer
>  wrote:
> > On Wed, Jan 06, 2016 at 09:00:46PM -0800, Ganesh Ajjanagadde wrote:
> >> In the spirit of commit a956840cbc. Simple method to reproduce:
> >> pass -vstats_file /dev/full to ffmpeg.
> >>
> >> All raw fclose usages in ffmpeg.c taken care of here.
> >>
> >> Signed-off-by: Ganesh Ajjanagadde 
> >> ---
> >>  ffmpeg.c | 13 ++---
> >>  1 file changed, 10 insertions(+), 3 deletions(-)
> >
> > LGTM
> >
> > thanks
> 
> So there is actually a problem with the diagnostic obtained, a more
> accurate diagnostic is via errno, say strerror(errno) instead of
> av_err2str(ret).
> Comparison:
> Error closing vstats file, loss of information possible: Operation not 
> permitted
> vs
> Error closing vstats file, loss of information possible: No space left on 
> device
> for the provided /dev/full example.
> 
> So there are a number of possiblities:
> 1. Have 2 separate av_log lines, one for each of these.
> 2. A single av_log line, using strerror(errno).
> 3. Leave as is.
> 
> I prefer 2. Let me know your preference, and I will push later.

yes agree, 2.

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

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin


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: check fclose return values

2016-01-07 Thread Michael Niedermayer
On Thu, Jan 07, 2016 at 11:16:27PM +0100, Michael Niedermayer wrote:
> On Thu, Jan 07, 2016 at 10:00:47AM -0800, Ganesh Ajjanagadde wrote:
> > On Thu, Jan 7, 2016 at 9:27 AM, Michael Niedermayer
> >  wrote:
> > > On Wed, Jan 06, 2016 at 09:00:46PM -0800, Ganesh Ajjanagadde wrote:
> > >> In the spirit of commit a956840cbc. Simple method to reproduce:
> > >> pass -vstats_file /dev/full to ffmpeg.
> > >>
> > >> All raw fclose usages in ffmpeg.c taken care of here.
> > >>
> > >> Signed-off-by: Ganesh Ajjanagadde 
> > >> ---
> > >>  ffmpeg.c | 13 ++---
> > >>  1 file changed, 10 insertions(+), 3 deletions(-)
> > >
> > > LGTM
> > >
> > > thanks
> > 
> > So there is actually a problem with the diagnostic obtained, a more
> > accurate diagnostic is via errno, say strerror(errno) instead of
> > av_err2str(ret).
> > Comparison:
> > Error closing vstats file, loss of information possible: Operation not 
> > permitted
> > vs
> > Error closing vstats file, loss of information possible: No space left on 
> > device
> > for the provided /dev/full example.
> > 
> > So there are a number of possiblities:
> > 1. Have 2 separate av_log lines, one for each of these.
> > 2. A single av_log line, using strerror(errno).
> > 3. Leave as is.
> > 
> > I prefer 2. Let me know your preference, and I will push later.
> 
> yes agree, 2.

probably should use av_err2str() instead of strerror() though

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

What does censorship reveal? It reveals fear. -- Julian Assange


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/avf_showspectrum: replace pow(x, 0.25) by sqrt(sqrt(x))

2016-01-07 Thread Michael Niedermayer
On Wed, Jan 06, 2016 at 08:26:43PM -0800, Ganesh Ajjanagadde wrote:
> On Mon, Jan 4, 2016 at 6:38 PM, Ganesh Ajjanagadde
>  wrote:
> > This is faster; precision assured as result is a float.
> >
> > Signed-off-by: Ganesh Ajjanagadde 
> > ---
> >  libavfilter/avf_showspectrum.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
> > index accd8c7..cff98ff 100644
> > --- a/libavfilter/avf_showspectrum.c
> > +++ b/libavfilter/avf_showspectrum.c
> > @@ -578,7 +578,7 @@ static int plot_spectrum_column(AVFilterLink *inlink, 
> > AVFrame *insamples)
> >  a = cbrt(a);
> >  break;
> >  case FOURTHRT:
> > -a = pow(a, 0.25);
> > +a = sqrt(sqrt(a));
> >  break;
> >  case FIFTHRT:
> >  a = pow(a, 0.20);
> > --
> > 2.6.4
> >
> 
> ping

should be ok but iam not maintainer of this

[...]

thx

-- 
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] [PATCHv2] avformat/mp3dec, rmdec: check return value of ffio_ensure_seekback

2016-01-07 Thread Michael Niedermayer
On Wed, Jan 06, 2016 at 08:31:38PM -0800, Ganesh Ajjanagadde wrote:
> On Wed, Jan 6, 2016 at 1:25 PM, Michael Niedermayer
>  wrote:
> > On Tue, Jan 05, 2016 at 09:51:15PM -0800, Ganesh Ajjanagadde wrote:
> >> On Tue, Jan 5, 2016 at 4:57 PM, Michael Niedermayer
> >>  wrote:
> >> > On Tue, Jan 05, 2016 at 01:57:09PM -0800, Ganesh Ajjanagadde wrote:
> >> >> On Tue, Jan 5, 2016 at 11:01 AM, wm4  wrote:
> >> >> > On Tue, 5 Jan 2016 08:32:02 -0800
> >> >> > Ganesh Ajjanagadde  wrote:
> >> >> >
> >> >> >> On Tue, Jan 5, 2016 at 5:29 AM, wm4  wrote:
> >> >> >> > On Mon,  4 Jan 2016 17:50:01 -0800
> >> >> >> > Ganesh Ajjanagadde  wrote:
> >> >> >> >
> >> >> >> >> ffio_ensure_seekback can fail due to e.g ENOMEM. This return 
> >> >> >> >> value is
> >> >> >> >> checked here and a diagnostic is logged.
> >> >> >> >>
> >> >> >> >> All usage of ffio_ensure_seekback in the codebase now has the 
> >> >> >> >> return value checked.
> >> >> >> >>
> >> >> >> >> Reviewed-by: wm4 
> >> >> >> >> Reviewed-by: Ronald S. Bultje 
> >> >> >> >> Reviewed-by: Michael Niedermayer 
> >> >> >> >> Signed-off-by: Ganesh Ajjanagadde 
> >> >> >> >> ---
> >> >> >> >>  libavformat/mp3dec.c | 13 +++--
> >> >> >> >>  libavformat/rmdec.c  |  3 ++-
> >> >> >> >>  2 files changed, 13 insertions(+), 3 deletions(-)
> >> >> >> >>
> >> >> >> >> diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
> >> >> >> >> index c76b21e..57ebcc8 100644
> >> >> >> >> --- a/libavformat/mp3dec.c
> >> >> >> >> +++ b/libavformat/mp3dec.c
> >> >> >> >> @@ -372,11 +372,19 @@ static int mp3_read_header(AVFormatContext 
> >> >> >> >> *s)
> >> >> >> >>  uint32_t header, header2;
> >> >> >> >>  int frame_size;
> >> >> >> >>  if (!(i&1023))
> >> >> >> >> -ffio_ensure_seekback(s->pb, i + 1024 + 4);
> >> >> >> >> +if ((ret = ffio_ensure_seekback(s->pb, i + 1024 + 
> >> >> >> >> 4)) < 0) {
> >> >> >> >> +av_log(s, AV_LOG_WARNING,
> >> >> >> >> +   "initial junk detection and skipping 
> >> >> >> >> impossible due to: %s\n", av_err2str(ret));
> >> >> >> >> +goto skip_fail;
> >> >> >> >> +}
> >> >> >> >>  frame_size = check(s->pb, off + i, );
> >> >> >> >>  if (frame_size > 0) {
> >> >> >> >>  avio_seek(s->pb, off, SEEK_SET);
> >> >> >> >> -ffio_ensure_seekback(s->pb, i + 1024 + frame_size + 
> >> >> >> >> 4);
> >> >> >> >> +if ((ret = ffio_ensure_seekback(s->pb, i + 1024 + 
> >> >> >> >> frame_size + 4)) < 0) {
> >> >> >> >> +av_log(s, AV_LOG_WARNING,
> >> >> >> >> +   "initial junk detection and skipping 
> >> >> >> >> impossible due to: %s\n", av_err2str(ret));
> >> >> >> >> +goto skip_fail;
> >> >> >> >> +}
> >> >> >> >>  if (check(s->pb, off + i + frame_size, ) >= 
> >> >> >> >> 0 &&
> >> >> >> >>  (header & SAME_HEADER_MASK) == (header2 & 
> >> >> >> >> SAME_HEADER_MASK))
> >> >> >> >>  {
> >> >> >> >> @@ -387,6 +395,7 @@ static int mp3_read_header(AVFormatContext *s)
> >> >> >> >>  }
> >> >> >> >>  avio_seek(s->pb, off, SEEK_SET);
> >> >> >> >>  }
> >> >> >> >> +skip_fail:
> >> >> >> >>
> >> >> >> >>  // the seek index is relative to the end of the xing vbr 
> >> >> >> >> headers
> >> >> >> >>  for (i = 0; i < st->nb_index_entries; i++)
> >> >> >> >> diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
> >> >> >> >> index 4e46a3d..470e227 100644
> >> >> >> >> --- a/libavformat/rmdec.c
> >> >> >> >> +++ b/libavformat/rmdec.c
> >> >> >> >> @@ -618,7 +618,8 @@ static int rm_read_header(AVFormatContext *s)
> >> >> >> >>  size = avio_rb32(pb);
> >> >> >> >>  codec_pos = avio_tell(pb);
> >> >> >> >>
> >> >> >> >> -ffio_ensure_seekback(pb, 4);
> >> >> >> >> +if ((ret = ffio_ensure_seekback(pb, 4)) < 0)
> >> >> >> >> +av_log(s, AV_LOG_WARNING, "seeking back 
> >> >> >> >> impossible due to: %s\n", av_err2str(ret));
> >> >> >> >>  v = avio_rb32(pb);
> >> >> >> >>  if (v == MKBETAG('M', 'L', 'T', 'I')) {
> >> >> >> >>  ret = rm_read_multi(s, s->pb, st, mime);
> >> >> >> >
> >> >> >> > I maintain that this should not be done, because it makes the code
> >> >> >> > verbose for no reason.
> >> >> >>
> >> >> >> Michael has pointed out that when seekback fails, one should really
> >> >> >> break out of the junk detection loop in mp3dec. Your idea fails to
> >> >> >> achieve it.
> >> >> >
> >> >> > Why? It's not really harmful. You could even argue that this will make
> >> >> > the common case (skipping jumk and finding a valid frame in a seekable
> >> >> >