Re: [FFmpeg-devel] [PATCH] blockdsp: remove high bit depth parameter

2015-10-01 Thread Christophe Gisquet
2015-09-28 18:51 GMT+02:00 Christophe Gisquet :
[SNIP]

Could someone also apply the cosmetic patch for reindentation?

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


Re: [FFmpeg-devel] [PATCH] blockdsp: remove high bit depth parameter

2015-10-01 Thread Michael Niedermayer
On Thu, Oct 01, 2015 at 09:54:49PM +0200, Christophe Gisquet wrote:
> Hi,
> 
> 2015-10-01 21:35 GMT+02:00 Michael Niedermayer :
> > ffmpeg/libavcodec/arm/blockdsp_arm.h:24:6: note: previous declaration of 
> > ‘ff_blockdsp_init_neon’ was here
> 
> Missed that header... I can only find those using grep...
> 
> Here's an updated patch.
> 
> -- 
> Christophe

>  alpha/blockdsp_alpha.c|4 +---
>  arm/blockdsp_arm.h|2 +-
>  arm/blockdsp_init_arm.c   |4 ++--
>  arm/blockdsp_init_neon.c  |4 +---
>  blockdsp.c|   20 +---
>  blockdsp.h|   10 +-
>  mips/blockdsp_init_mips.c |   12 +---
>  ppc/blockdsp.c|5 +
>  x86/blockdsp_init.c   |4 +---
>  9 files changed, 26 insertions(+), 39 deletions(-)
> 1b51424b24ecc4f5ba2de7b37d0e9c5f27f64c82  
> 0001-blockdsp-remove-high-bitdepth-parameter.patch
> From 8da8a89ecf33e0c550fa61d6423a64650f6fc770 Mon Sep 17 00:00:00 2001
> From: Christophe Gisquet 
> Date: Mon, 28 Sep 2015 13:59:23 +0200
> Subject: [PATCH 01/17] blockdsp: remove high bitdepth parameter

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH] x86/audio_convert: fix clobbering of xmm registers

2015-10-01 Thread James Almer
On 10/1/2015 8:01 AM, Michael Niedermayer wrote:
> On Fri, Sep 25, 2015 at 09:33:04PM -0300, James Almer wrote:
>> Signed-off-by: James Almer 
>> ---
>>  libswresample/x86/audio_convert.asm | 122 
>> ++--
>>  1 file changed, 61 insertions(+), 61 deletions(-)
> 
> LGTM
> 
> thanks

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


Re: [FFmpeg-devel] [PATCH]lavf/rawdec: Add TrueHD autoedetection

2015-10-01 Thread Carl Eugen Hoyos
Michael Niedermayer  gmx.at> writes:

> >  rawdec.c |   19 ---
> >  1 file changed, 16 insertions(+), 3 deletions(-)
> > 5355a7c39fb1a9e536a28cecc86e8501a7986859  patchthdprobe.diff
> 
> should be ok

Patch applied.

Thank you, Carl Eugen

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


[FFmpeg-devel] [PATCH]lavf/rawdec: Simplify mlp/thd probe function

2015-10-01 Thread Carl Eugen Hoyos
Hi!

Attached patch intends to slightly simplify the probe function.

Please review, Carl Eugen
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index ef84d37..7a72b5a 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -209,19 +209,18 @@ FF_DEF_RAWVIDEO_DEMUXER2(mjpeg, "raw MJPEG video", 
mjpeg_probe, "mjpg,mjpeg,mpo"
 #if CONFIG_MLP_DEMUXER || CONFIG_TRUEHD_DEMUXER
 static int av_always_inline mlp_thd_probe(AVProbeData *p, uint32_t sync)
 {
-const uint8_t *buf, *last_buf = p->buf, *end = p->buf + p->buf_size;
-int frames = 0, valid = 0, size = 0;
+const uint8_t *buf, *next_buf = p->buf, *end = p->buf + p->buf_size;
+int frames = 0, valid = 0;
 
 for (buf = p->buf; buf + 8 <= end; buf++) {
 if (AV_RB32(buf + 4) == sync) {
 frames++;
-if (last_buf + size == buf) {
+if (buf == next_buf) {
 valid++;
 }
-last_buf = buf;
-size = (AV_RB16(buf) & 0xfff) * 2;
-} else if (buf - last_buf == size) {
-size += (AV_RB16(buf) & 0xfff) * 2;
+next_buf = buf + (AV_RB16(buf) & 0xfff) * 2;
+} else if (buf == next_buf) {
+next_buf += (AV_RB16(buf) & 0xfff) * 2;
 }
 }
 if (valid >= 100)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf/rawdec: Add TrueHD autoedetection

2015-10-01 Thread Michael Niedermayer
On Thu, Oct 01, 2015 at 10:31:21PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Since I already implemented it: 
> Attached is a patch that implements TrueHD autodetection.
> 
> Please comment, Carl Eugen

>  rawdec.c |   19 ---
>  1 file changed, 16 insertions(+), 3 deletions(-)
> 5355a7c39fb1a9e536a28cecc86e8501a7986859  patchthdprobe.diff

should be ok

[...]

-- 
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] Revert "avformat/flvdec: Check that sizes match and resync if not"

2015-10-01 Thread Michael Niedermayer
On Fri, Oct 02, 2015 at 12:36:24AM +0200, wm4 wrote:
> On Fri, 2 Oct 2015 00:06:24 +0200
> Michael Niedermayer  wrote:
> 
> > On Thu, Oct 01, 2015 at 11:33:27PM +0200, wm4 wrote:
> > > On Thu, 1 Oct 2015 21:08:39 + (UTC)
> > > Carl Eugen Hoyos  wrote:
> > > 
> > > > wm4  googlemail.com> writes:
> > > > 
> > > > > This reverts commit cbbd906be6150be38dfc14b6bc67dcac8da8aea4.
> > > > > 
> > > > > It broke rtmp fatally, at least some cases of it.
> > > > 
> > > > You don't want to share some of them with us?
> > > 
> > > This is a bit hard, because it's some site accessed through youtube-dl
> > > (youtube-dl extracts the current URL, encryption keys etc. - just
> > > handling out an URL won't do). I haven't tested yet if this happens
> > > with all rtmp URLs.
> > 
> > can you provide uncut ffmpeg output from the failure? it should contain
> > information about the resync/mismatches even if the URLs&keys cannot
> > be used.
> 
> I didn't use ffmpeg, and although it would have been possible, it's
> complicated to extract and set all these rtmpe extra parameters.
> 
> > also what generated the rtmp stream that fails?
> 

> I have no idea. But the flv stream is of course produced by
> libavformat. I've dumped part of this stream: https://0x0.st/z0e.flv

do these invalid flv files exist elsewhere or is this the only one?


> 
> (I realize it also might be a problem with how the rtmpe protocol
> generates the flv stream.)

should be fixed


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

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


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


Re: [FFmpeg-devel] [PATCH]lavfi/mandelbrot: Output RGB0 instead of RGBA

2015-10-01 Thread Carl Eugen Hoyos
Michael Niedermayer  gmx.at> writes:

> >  vsrc_mandelbrot.c |3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 8fd1951c453c9a39214bed85821531e70ef7e8e9  patchmandelbrot.diff
> 
> LGTM

Patch applied.

Thank you, Carl Eugen

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


[FFmpeg-devel] [PATCH] libavformat/hlsenc: Use of uninitialized memory unlinking old files

2015-10-01 Thread DeHackEd
From: DHE 

Fixes ticket#4900

Signed-off-by: DHE 
---
 libavformat/hlsenc.c | 29 +
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 473ca3a..8daf53f 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -165,12 +165,6 @@ static int hls_delete_old_segments(HLSContext *hls) {
 ret = AVERROR(ENOMEM);
 goto fail;
 }
-sub_path_size = strlen(dirname) + strlen(segment->sub_filename) + 1;
-sub_path = av_malloc(sub_path_size);
-if (!sub_path) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
 
 av_strlcpy(path, dirname, path_size);
 av_strlcat(path, segment->filename, path_size);
@@ -179,14 +173,23 @@ static int hls_delete_old_segments(HLSContext *hls) {
  path, strerror(errno));
 }
 
-av_strlcpy(sub_path, dirname, sub_path_size);
-av_strlcat(sub_path, segment->sub_filename, sub_path_size);
-if (unlink(sub_path) < 0) {
-av_log(hls, AV_LOG_ERROR, "failed to delete old segment %s: %s\n",
- sub_path, strerror(errno));
+if (segment->sub_filename[0] != '\0') {
+sub_path_size = strlen(dirname) + strlen(segment->sub_filename) + 
1;
+sub_path = av_malloc(sub_path_size);
+if (!sub_path) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+
+av_strlcpy(sub_path, dirname, sub_path_size);
+av_strlcat(sub_path, segment->sub_filename, sub_path_size);
+if (unlink(sub_path) < 0) {
+av_log(hls, AV_LOG_ERROR, "failed to delete old segment %s: 
%s\n",
+ sub_path, strerror(errno));
+}
+av_free(sub_path);
 }
 av_freep(&path);
-av_free(sub_path);
 previous_segment = segment;
 segment = previous_segment->next;
 av_free(previous_segment);
@@ -312,6 +315,8 @@ static int hls_append_segment(HLSContext *hls, double 
duration, int64_t pos,
 
 if(hls->has_subtitle)
 av_strlcpy(en->sub_filename, av_basename(hls->vtt_avf->filename), 
sizeof(en->sub_filename));
+else
+en->sub_filename[0] = '\0';
 
 en->duration = duration;
 en->pos  = pos;
-- 
1.8.4.1

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


Re: [FFmpeg-devel] [PATCH] Revert "avformat/flvdec: Check that sizes match and resync if not"

2015-10-01 Thread wm4
On Fri, 2 Oct 2015 00:06:24 +0200
Michael Niedermayer  wrote:

> On Thu, Oct 01, 2015 at 11:33:27PM +0200, wm4 wrote:
> > On Thu, 1 Oct 2015 21:08:39 + (UTC)
> > Carl Eugen Hoyos  wrote:
> > 
> > > wm4  googlemail.com> writes:
> > > 
> > > > This reverts commit cbbd906be6150be38dfc14b6bc67dcac8da8aea4.
> > > > 
> > > > It broke rtmp fatally, at least some cases of it.
> > > 
> > > You don't want to share some of them with us?
> > 
> > This is a bit hard, because it's some site accessed through youtube-dl
> > (youtube-dl extracts the current URL, encryption keys etc. - just
> > handling out an URL won't do). I haven't tested yet if this happens
> > with all rtmp URLs.
> 
> can you provide uncut ffmpeg output from the failure? it should contain
> information about the resync/mismatches even if the URLs&keys cannot
> be used.

I didn't use ffmpeg, and although it would have been possible, it's
complicated to extract and set all these rtmpe extra parameters.

> also what generated the rtmp stream that fails?

I have no idea. But the flv stream is of course produced by
libavformat. I've dumped part of this stream: https://0x0.st/z0e.flv

(I realize it also might be a problem with how the rtmpe protocol
generates the flv stream.)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Revert "avformat/flvdec: Check that sizes match and resync if not"

2015-10-01 Thread Michael Niedermayer
On Thu, Oct 01, 2015 at 11:33:27PM +0200, wm4 wrote:
> On Thu, 1 Oct 2015 21:08:39 + (UTC)
> Carl Eugen Hoyos  wrote:
> 
> > wm4  googlemail.com> writes:
> > 
> > > This reverts commit cbbd906be6150be38dfc14b6bc67dcac8da8aea4.
> > > 
> > > It broke rtmp fatally, at least some cases of it.
> > 
> > You don't want to share some of them with us?
> 
> This is a bit hard, because it's some site accessed through youtube-dl
> (youtube-dl extracts the current URL, encryption keys etc. - just
> handling out an URL won't do). I haven't tested yet if this happens
> with all rtmp URLs.

can you provide uncut ffmpeg output from the failure? it should contain
information about the resync/mismatches even if the URLs&keys cannot
be used.

also what generated the rtmp stream that fails?

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

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


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


Re: [FFmpeg-devel] [PATCH]lavc/mjpegenc: Add an option to force outputting chroma matrix

2015-10-01 Thread Michael Niedermayer
On Thu, Oct 01, 2015 at 10:03:39PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch adds an option to force writing chroma matrix even if it is 
> identical to luma matrix as suggested by RFC 2435 for mjpeg over rtp.
> 
> Is force_write_chroma_matrix better?
> 
> Please comment, Carl Eugen

>  mjpegenc_common.c |3 +++
>  mpegvideo.h   |2 ++
>  2 files changed, 5 insertions(+)
> 0300a7f875cb444bf6a7cb2dc42a736dede797e2  patchmatrix.diff

should be ok
you might want to wait a bit with applying in case rtp experts have
comments and for suggestions / comments on the option name

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No snowflake in an avalanche ever feels responsible. -- Voltaire


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


Re: [FFmpeg-devel] [PATCH] Revert "avformat/flvdec: Check that sizes match and resync if not"

2015-10-01 Thread wm4
On Thu, 1 Oct 2015 21:08:39 + (UTC)
Carl Eugen Hoyos  wrote:

> wm4  googlemail.com> writes:
> 
> > This reverts commit cbbd906be6150be38dfc14b6bc67dcac8da8aea4.
> > 
> > It broke rtmp fatally, at least some cases of it.
> 
> You don't want to share some of them with us?

This is a bit hard, because it's some site accessed through youtube-dl
(youtube-dl extracts the current URL, encryption keys etc. - just
handling out an URL won't do). I haven't tested yet if this happens
with all rtmp URLs.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] vp9: 10/12bpp SIMD (sse2/ssse3/avx) for directional intra prediction.

2015-10-01 Thread Henrik Gramner
On Wed, Sep 30, 2015 at 9:36 PM, Ronald S. Bultje  wrote:
diff --git a/libavcodec/x86/vp9intrapred_16bpp.asm
b/libavcodec/x86/vp9intrapred_16bpp.asm

+pd_65535: times 8 dd 0x

Duplicate of pd_0f from 264_qpel_10bit.asm

+%if cpuflag(ssse3)
+; FIXME this can be done without three-op-instr by doing pshfhw m1, m0
+; but then interleaving decreases, measure which is faster
+pshufb  m1, m0, [pb_2to15_14_15]; bcdefghh
+%else
+psrldq  m1, m0, 2   ; bcdefgh.
+%endif
+pshufhw m0, m0, q3310   ; abcdefhh
+%if notcpuflag(ssse3)
+pshufhw m1, m1, q2210   ; bcdefghh
+%endif

Move pshufhw into the else part. There's also a typo (pshfhw) in the comment.

+%if cpuflag(ssse3)
+pshufb  m0, m4
+%else
+psrldq  m0, 2   ; CDEFGHh.
+%endif
+pshuflw m1, m1, q3321   ; GHhh
+%if notcpuflag(ssse3)
+pshufhw m0, m0, q2210   ; CDEFGHhh
+%endif

Ditto

+%if cpuflag(ssse3)
+pshufb  m1, m3
+pshufb  m2, m3
+%else
+psrldq  m1, 2
+psrldq  m2, 2
+pshufhw m1, m1, q2210
+pshufhw m2, m2, q2210
+%endif
+mova  [dstq+strideq*2], m1
+mova  [dstq+stride3q ], m2
+lea   dstq, [dstq+strideq*4]
+%if cpuflag(ssse3)
+pshufb  m1, m3
+pshufb  m2, m3
+%else
+psrldq  m1, 2
+psrldq  m2, 2
+pshufhw m1, m1, q2210
+pshufhw m2, m2, q2210
+%endif
+mova  [dstq+strideq*0], m1
+mova  [dstq+strideq*1], m2
+%if cpuflag(ssse3)
+pshufb  m1, m3
+pshufb  m2, m3
+%else
+psrldq  m1, 2
+psrldq  m2, 2
+pshufhw m1, m1, q2210
+pshufhw m2, m2, q2210
+%endif
+mova  [dstq+strideq*2], m1
+mova  [dstq+stride3q ], m2

Possibly some deduplication here. There are a few very similar
segments in more places as well, might be possible to turn them into a
macro.

+%if cpuflag(ssse3)
+pshufb  m2, [pb_4_5_8to13_8x0]
+%else
+pshuflw m2, m2, q
+%endif
+psrldq  m0, 6
+%if notcpuflag(ssse3)
+psrldq  m2, 6
+%endif

Move psrldq into the else part.

It's quite a large patch so I mostly just skimmed through it fairly
quickly, but the rest looks fine to me.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] dnxhddec: initialize with mb-aligned dimensions

2015-10-01 Thread Christophe Gisquet
Hi,

2015-10-01 22:34 GMT+02:00 Hendrik Leppkes :
>> +avctx->coded_width  = FFALIGN(avctx->width, 16);
>> +avctx->coded_height = FFALIGN(avctx->coded_height, 16);
>
> Intentional that this is not ->height, but ->coded_height?

Huh, yes, and the worse is it was intended to fix coded_height.

Here's an updated patch.

-- 
Christophe
From c10e86ce4469b81ac66b7fa2dd233efd191f508c Mon Sep 17 00:00:00 2001
From: Christophe Gisquet 
Date: Wed, 30 Sep 2015 10:14:59 +0200
Subject: [PATCH 1/3] dnxhddec: initialize with mb-aligned dimensions

The coded size is a multiple of the macroblock size, which is 16.
---
 libavcodec/dnxhddec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index e3dec78..755cf9a 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -87,6 +87,9 @@ static av_cold int dnxhd_decode_init(AVCodecContext *avctx)
 ctx->cid = -1;
 avctx->colorspace = AVCOL_SPC_BT709;
 
+avctx->coded_width  = FFALIGN(avctx->width,  16);
+avctx->coded_height = FFALIGN(avctx->height, 16);
+
 ctx->rows = av_mallocz_array(avctx->thread_count, sizeof(RowContext));
 if (!ctx->rows)
 return AVERROR(ENOMEM);
-- 
2.5.2

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


Re: [FFmpeg-devel] [PATCH] Revert "avformat/flvdec: Check that sizes match and resync if not"

2015-10-01 Thread Carl Eugen Hoyos
wm4  googlemail.com> writes:

> This reverts commit cbbd906be6150be38dfc14b6bc67dcac8da8aea4.
> 
> It broke rtmp fatally, at least some cases of it.

You don't want to share some of them with us?

Carl Eugen

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


[FFmpeg-devel] [PATCH] Revert "avformat/flvdec: Check that sizes match and resync if not"

2015-10-01 Thread wm4
This reverts commit cbbd906be6150be38dfc14b6bc67dcac8da8aea4.

It broke rtmp fatally, at least some cases of it.
---
Better fixes welcome, but I'd like if this regression could be fixed
quickly. On the other hand, there's no evidence that the reverted commit
was needed for anything.
---
 libavformat/flvdec.c | 48 +---
 1 file changed, 1 insertion(+), 47 deletions(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index a59c07d..317bfb2 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -39,8 +39,6 @@
 
 #define VALIDATE_INDEX_TS_THRESH 2500
 
-#define RESYNC_BUFFER_SIZE (1<<20)
-
 typedef struct FLVContext {
 const AVClass *class; ///< Class for private options.
 int trust_metadata;   ///< configure streams according onMetaData
@@ -57,8 +55,6 @@ typedef struct FLVContext {
 int validate_count;
 int searched_for_end;
 
-uint8_t resync_buffer[2*RESYNC_BUFFER_SIZE];
-
 int broken_sizes;
 } FLVContext;
 
@@ -805,36 +801,6 @@ skip:
 return ret;
 }
 
-static int resync(AVFormatContext *s)
-{
-FLVContext *flv = s->priv_data;
-int64_t i;
-int64_t pos = avio_tell(s->pb);
-
-for (i=0; !avio_feof(s->pb); i++) {
-int j  = i & (RESYNC_BUFFER_SIZE-1);
-int j1 = j + RESYNC_BUFFER_SIZE;
-flv->resync_buffer[j ] =
-flv->resync_buffer[j1] = avio_r8(s->pb);
-
-if (i > 22) {
-unsigned lsize2 = AV_RB32(flv->resync_buffer + j1 - 4);
-if (lsize2 >= 11 && lsize2 + 8LL < FFMIN(i, RESYNC_BUFFER_SIZE)) {
-unsigned  size2 = AV_RB24(flv->resync_buffer + j1 - lsize2 + 1 
- 4);
-unsigned lsize1 = AV_RB32(flv->resync_buffer + j1 - lsize2 - 
8);
-if (lsize1 >= 11 && lsize1 + 8LL + lsize2 < FFMIN(i, 
RESYNC_BUFFER_SIZE)) {
-unsigned  size1 = AV_RB24(flv->resync_buffer + j1 - lsize1 
+ 1 - lsize2 - 8);
-if (size1 == lsize1 - 11 && size2  == lsize2 - 11) {
-avio_seek(s->pb, pos + i - lsize1 - lsize2 - 8, 
SEEK_SET);
-return 1;
-}
-}
-}
-}
-}
-return AVERROR_EOF;
-}
-
 static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
 FLVContext *flv = s->priv_data;
@@ -847,14 +813,11 @@ static int flv_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 int av_uninit(sample_rate);
 AVStream *st= NULL;
 int last = -1;
-int orig_size;
 
-retry:
 /* pkt size is repeated at end. skip it */
 for (;; last = avio_rb32(s->pb)) {
 pos  = avio_tell(s->pb);
 type = (avio_r8(s->pb) & 0x1F);
-orig_size =
 size = avio_rb24(s->pb);
 dts  = avio_rb24(s->pb);
 dts |= avio_r8(s->pb) << 24;
@@ -1137,16 +1100,7 @@ retry_duration:
 pkt->flags |= AV_PKT_FLAG_KEY;
 
 leave:
-last = avio_rb32(s->pb);
-if (last != orig_size + 11 && !flv->broken_sizes) {
-av_log(s, AV_LOG_ERROR, "Packet mismatch %d %d\n", last, orig_size + 
11);
-avio_seek(s->pb, pos + 1, SEEK_SET);
-ret = resync(s);
-av_free_packet(pkt);
-if (ret >= 0) {
-goto retry;
-}
-}
+avio_skip(s->pb, 4);
 return ret;
 }
 
-- 
2.5.1

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


Re: [FFmpeg-devel] [PATCH]lavfi/mandelbrot: Output RGB0 instead of RGBA

2015-10-01 Thread Michael Niedermayer
On Thu, Oct 01, 2015 at 09:48:10PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch improves the mandelbrot output pix_fmt imo.
> 
> Please comment, Carl Eugen

>  vsrc_mandelbrot.c |3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 8fd1951c453c9a39214bed85821531e70ef7e8e9  patchmandelbrot.diff

LGTM

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH 1/3] dnxhddec: initialize with mb-aligned dimensions

2015-10-01 Thread Hendrik Leppkes
On Thu, Oct 1, 2015 at 10:01 PM, Christophe Gisquet
 wrote:
> The coded size is a multiple of the macroblock size, which is 16.
> ---
>  libavcodec/dnxhddec.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
> index e3dec78..3985318 100644
> --- a/libavcodec/dnxhddec.c
> +++ b/libavcodec/dnxhddec.c
> @@ -87,6 +87,9 @@ static av_cold int dnxhd_decode_init(AVCodecContext *avctx)
>  ctx->cid = -1;
>  avctx->colorspace = AVCOL_SPC_BT709;
>
> +avctx->coded_width  = FFALIGN(avctx->width, 16);
> +avctx->coded_height = FFALIGN(avctx->coded_height, 16);

Intentional that this is not ->height, but ->coded_height?

> +
>  ctx->rows = av_mallocz_array(avctx->thread_count, sizeof(RowContext));
>  if (!ctx->rows)
>  return AVERROR(ENOMEM);
> --
> 2.5.2
>
> ___
> 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] [PATCH]lavf/rawdec: Add TrueHD autoedetection

2015-10-01 Thread Carl Eugen Hoyos
Hi!

Since I already implemented it: 
Attached is a patch that implements TrueHD autodetection.

Please comment, Carl Eugen
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index 56ac199..ef84d37 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -206,14 +206,14 @@ static int mjpeg_probe(AVProbeData *p)
 FF_DEF_RAWVIDEO_DEMUXER2(mjpeg, "raw MJPEG video", mjpeg_probe, 
"mjpg,mjpeg,mpo", AV_CODEC_ID_MJPEG, AVFMT_GENERIC_INDEX|AVFMT_NOTIMESTAMPS)
 #endif
 
-#if CONFIG_MLP_DEMUXER
-static int mlp_probe(AVProbeData *p)
+#if CONFIG_MLP_DEMUXER || CONFIG_TRUEHD_DEMUXER
+static int av_always_inline mlp_thd_probe(AVProbeData *p, uint32_t sync)
 {
 const uint8_t *buf, *last_buf = p->buf, *end = p->buf + p->buf_size;
 int frames = 0, valid = 0, size = 0;
 
 for (buf = p->buf; buf + 8 <= end; buf++) {
-if (AV_RB32(buf + 4) == 0xf8726fbb) {
+if (AV_RB32(buf + 4) == sync) {
 frames++;
 if (last_buf + size == buf) {
 valid++;
@@ -228,6 +228,13 @@ static int mlp_probe(AVProbeData *p)
 return AVPROBE_SCORE_MAX;
 return 0;
 }
+#endif
+
+#if CONFIG_MLP_DEMUXER
+static int mlp_probe(AVProbeData *p)
+{
+return mlp_thd_probe(p, 0xf8726fbb);
+}
 
 AVInputFormat ff_mlp_demuxer = {
 .name   = "mlp",
@@ -242,9 +249,15 @@ AVInputFormat ff_mlp_demuxer = {
 #endif
 
 #if CONFIG_TRUEHD_DEMUXER
+static int thd_probe(AVProbeData *p)
+{
+return mlp_thd_probe(p, 0xf8726fba);
+}
+
 AVInputFormat ff_truehd_demuxer = {
 .name   = "truehd",
 .long_name  = NULL_IF_CONFIG_SMALL("raw TrueHD"),
+.read_probe = thd_probe,
 .read_header= ff_raw_audio_read_header,
 .read_packet= ff_raw_read_partial_packet,
 .flags  = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Issue with native WebP muxer in ffmpeg

2015-10-01 Thread Carl Eugen Hoyos
Urvang Joshi  google.com> writes:

> (ii) inside a VP8L chunk.

Isnt't pix_fmt YUVA420P in that case?

Carl Eugen

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


[FFmpeg-devel] [PATCH 3/3] dnxhddec: init scantable once permutation is set

2015-10-01 Thread Christophe Gisquet
Otherwise, the dsp may change without its permuation being applied.
---
 libavcodec/dnxhddec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 8d9b7f0..18b2d51 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -127,8 +127,6 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid)
  ctx->cid_table->run_bits, 1, 1,
  ctx->cid_table->run_codes, 2, 2, 0);
 
-ff_init_scantable(ctx->idsp.idct_permutation, &ctx->scantable,
-  ff_zigzag_direct);
 ctx->cid = cid;
 }
 return 0;
@@ -211,6 +209,8 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame 
*frame,
 if (ctx->bit_depth != old_bit_depth) {
 ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
 ff_idctdsp_init(&ctx->idsp, ctx->avctx);
+ff_init_scantable(ctx->idsp.idct_permutation, &ctx->scantable,
+  ff_zigzag_direct);
 }
 
 cid = AV_RB32(buf + 0x28);
-- 
2.5.2

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


[FFmpeg-devel] Issue with native WebP muxer in ffmpeg

2015-10-01 Thread Urvang Joshi
Hi ffmpeg folks,
This is based on a report on WebP issue tracker:
https://code.google.com/p/webp/issues/detail?id=266

Looks like ffmpeg's native WebP muxer always sets ALPHA_FLAG to be true in
VP8X chunk:
https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/webpenc.c#L110
(Even for a completely opaque image: e.g. an animated image where none of
the frames have transparency info).

But according to the WebP container spec:
https://developers.google.com/speed/webp/docs/riff_container?hl=en#extended_file_format


Alpha (L): 1 bit
Set if any of the frames of the image contain transparency information
("alpha").



This needs to be corrected. I took a dig at this, but it seemed non-trivial:
ffmpeg needs to find out if there is "at least one frame containing
transparency" -- this could be through (i) an ALPH chunk or (ii) inside a
VP8L chunk. While, detecting case (i) is easy due to the presence of
ALPH_FLAG in VP8X chunk, the same is not true for (ii) as in that case VP8X
chunk may not be present.

Can someone think of a good solution?

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


[FFmpeg-devel] [PATCH]lavc/mjpegenc: Add an option to force outputting chroma matrix

2015-10-01 Thread Carl Eugen Hoyos
Hi!

Attached patch adds an option to force writing chroma matrix even if it is 
identical to luma matrix as suggested by RFC 2435 for mjpeg over rtp.

Is force_write_chroma_matrix better?

Please comment, Carl Eugen
diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c
index d1d4cfb..7dadda8 100644
--- a/libavcodec/mjpegenc_common.c
+++ b/libavcodec/mjpegenc_common.c
@@ -64,11 +64,14 @@ static void jpeg_table_header(AVCodecContext *avctx, 
PutBitContext *p,
 {
 int i, j, size;
 uint8_t *ptr;
+MpegEncContext *s = avctx->priv_data;
 
 if (avctx->codec_id != AV_CODEC_ID_LJPEG) {
 int matrix_count = 1 + !!memcmp(luma_intra_matrix,
 chroma_intra_matrix,
 sizeof(luma_intra_matrix[0]) * 64);
+if (s->force_duplicated_matrix)
+matrix_count = 2;
 /* quant matrixes */
 put_marker(p, DQT);
 put_bits(p, 16, 2 + matrix_count * (1 + 64));
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 750388a..a2cd8e8 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -299,6 +299,7 @@ typedef struct MpegEncContext {
 uint16_t chroma_intra_matrix[64];
 uint16_t inter_matrix[64];
 uint16_t chroma_inter_matrix[64];
+int force_duplicated_matrix; ///< Force duplication of mjpeg matrices, 
useful for rtp streaming
 
 int intra_quant_bias;///< bias for the quantizer
 int inter_quant_bias;///< bias for the quantizer
@@ -596,6 +597,7 @@ typedef struct MpegEncContext {
 { "zero", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_ZERO }, 0, 0, 
FF_MPV_OPT_FLAGS, "motion_est" }, \
 { "epzs", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_EPZS }, 0, 0, 
FF_MPV_OPT_FLAGS, "motion_est" }, \
 { "xone", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_XONE }, 0, 0, 
FF_MPV_OPT_FLAGS, "motion_est" }, \
+{ "force_duplicated_matrix", "Always write luma and chroma matrix for mjpeg, 
useful for rtp streaming.", FF_MPV_OFFSET(force_duplicated_matrix), 
AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, FF_MPV_OPT_FLAGS },   \
 
 extern const AVOption ff_mpv_generic_options[];
 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/3] dnxhddec: use dequantization formula from specs

2015-10-01 Thread Christophe Gisquet
The current one, while correct, does not yield the best possible
results. The specificiations suggest another formula, which results
in quality gains in the decoded output from fate tests. This
justifies changing said formula.
---
 libavcodec/dnxhddec.c | 3 ++-
 tests/ref/vsynth/vsynth1-dnxhd-1080i  | 4 ++--
 tests/ref/vsynth/vsynth1-dnxhd-1080i-colr | 4 ++--
 tests/ref/vsynth/vsynth1-dnxhd-720p   | 4 ++--
 tests/ref/vsynth/vsynth1-dnxhd-720p-10bit | 4 ++--
 tests/ref/vsynth/vsynth1-dnxhd-720p-rd| 4 ++--
 tests/ref/vsynth/vsynth2-dnxhd-1080i  | 4 ++--
 tests/ref/vsynth/vsynth2-dnxhd-1080i-colr | 4 ++--
 tests/ref/vsynth/vsynth2-dnxhd-720p   | 4 ++--
 tests/ref/vsynth/vsynth2-dnxhd-720p-10bit | 4 ++--
 tests/ref/vsynth/vsynth2-dnxhd-720p-rd| 4 ++--
 tests/ref/vsynth/vsynth3-dnxhd-1080i-colr | 2 +-
 tests/ref/vsynth/vsynth_lena-dnxhd-1080i  | 4 ++--
 tests/ref/vsynth/vsynth_lena-dnxhd-1080i-colr | 4 ++--
 tests/ref/vsynth/vsynth_lena-dnxhd-720p   | 4 ++--
 tests/ref/vsynth/vsynth_lena-dnxhd-720p-10bit | 4 ++--
 tests/ref/vsynth/vsynth_lena-dnxhd-720p-rd| 4 ++--
 17 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 3985318..8d9b7f0 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -357,8 +357,9 @@ static av_always_inline int dnxhd_decode_dct_block(const 
DNXHDContext *ctx,
 
 j = ctx->scantable.permutated[i];
 level *= scale[i];
+level += scale[i] >> 1;
 if (level_bias < 32 || weight_matrix[i] != level_bias)
-level += level_bias;
+level += level_bias; // 1<<(level_shift-1)
 level >>= level_shift;
 
 block[j] = (level ^ sign) - sign;
diff --git a/tests/ref/vsynth/vsynth1-dnxhd-1080i 
b/tests/ref/vsynth/vsynth1-dnxhd-1080i
index 28d55b6..02f989f 100644
--- a/tests/ref/vsynth/vsynth1-dnxhd-1080i
+++ b/tests/ref/vsynth/vsynth1-dnxhd-1080i
@@ -1,4 +1,4 @@
 a0234e0a8516d958f423b119aa9e35c4 *tests/data/fate/vsynth1-dnxhd-1080i.mov
 3031911 tests/data/fate/vsynth1-dnxhd-1080i.mov
-a09132c6db44f415e831dcaa630a351b 
*tests/data/fate/vsynth1-dnxhd-1080i.out.rawvideo
-stddev:6.29 PSNR: 32.15 MAXDIFF:   64 bytes:  7603200/   760320
+fed9ed2a5179c9df0ef58772b025e303 
*tests/data/fate/vsynth1-dnxhd-1080i.out.rawvideo
+stddev:6.18 PSNR: 32.31 MAXDIFF:   64 bytes:  7603200/   760320
diff --git a/tests/ref/vsynth/vsynth1-dnxhd-1080i-colr 
b/tests/ref/vsynth/vsynth1-dnxhd-1080i-colr
index 16d8953..ac42966 100644
--- a/tests/ref/vsynth/vsynth1-dnxhd-1080i-colr
+++ b/tests/ref/vsynth/vsynth1-dnxhd-1080i-colr
@@ -1,4 +1,4 @@
 5fccdb16c0f14dea1b6b603bac90b97e *tests/data/fate/vsynth1-dnxhd-1080i-colr.mov
 3031929 tests/data/fate/vsynth1-dnxhd-1080i-colr.mov
-5835dff88cb84e83bbe70b5ed5edd5ab 
*tests/data/fate/vsynth1-dnxhd-1080i-colr.out.rawvideo
-stddev:5.79 PSNR: 32.87 MAXDIFF:   56 bytes:  7603200/   760320
+6f2d5429ffc4529a76acfeb28b560542 
*tests/data/fate/vsynth1-dnxhd-1080i-colr.out.rawvideo
+stddev:5.65 PSNR: 33.09 MAXDIFF:   55 bytes:  7603200/   760320
diff --git a/tests/ref/vsynth/vsynth1-dnxhd-720p 
b/tests/ref/vsynth/vsynth1-dnxhd-720p
index fd77e86..16cf20c 100644
--- a/tests/ref/vsynth/vsynth1-dnxhd-720p
+++ b/tests/ref/vsynth/vsynth1-dnxhd-720p
@@ -1,4 +1,4 @@
 af03d57b8320568027162132643f7814 *tests/data/fate/vsynth1-dnxhd-720p.dnxhd
 2293760 tests/data/fate/vsynth1-dnxhd-720p.dnxhd
-f074f1b5ed394871b3c73184ad55b895 
*tests/data/fate/vsynth1-dnxhd-720p.out.rawvideo
-stddev:6.26 PSNR: 32.19 MAXDIFF:   65 bytes:  7603200/   760320
+5f9fba5bacda81e77a72d8a816612564 
*tests/data/fate/vsynth1-dnxhd-720p.out.rawvideo
+stddev:6.22 PSNR: 32.24 MAXDIFF:   64 bytes:  7603200/   760320
diff --git a/tests/ref/vsynth/vsynth1-dnxhd-720p-10bit 
b/tests/ref/vsynth/vsynth1-dnxhd-720p-10bit
index 8a8f639..ab58807 100644
--- a/tests/ref/vsynth/vsynth1-dnxhd-720p-10bit
+++ b/tests/ref/vsynth/vsynth1-dnxhd-720p-10bit
@@ -1,4 +1,4 @@
 f8c4b7aa165a80df2485d526161290a3 
*tests/data/fate/vsynth1-dnxhd-720p-10bit.dnxhd
 2293760 tests/data/fate/vsynth1-dnxhd-720p-10bit.dnxhd
-ec26a6cbf53e38ffb9d5c51cbfbf4f7c 
*tests/data/fate/vsynth1-dnxhd-720p-10bit.out.rawvideo
-stddev:6.27 PSNR: 32.18 MAXDIFF:   64 bytes:  7603200/   760320
+3cc84f9e8d2e704475b410de27dd9951 
*tests/data/fate/vsynth1-dnxhd-720p-10bit.out.rawvideo
+stddev:6.23 PSNR: 32.23 MAXDIFF:   64 bytes:  7603200/   760320
diff --git a/tests/ref/vsynth/vsynth1-dnxhd-720p-rd 
b/tests/ref/vsynth/vsynth1-dnxhd-720p-rd
index 0422776..f030e92 100644
--- a/tests/ref/vsynth/vsynth1-dnxhd-720p-rd
+++ b/tests/ref/vsynth/vsynth1-dnxhd-720p-rd
@@ -1,4 +1,4 @@
 276e5175376051218b0e3eb36f9e9a63 *tests/data/fate/vsynth1-dnxhd-720p-rd.dnxhd
 2293760 tests/data/fate/vsynth1-dnxhd-720p-rd.dnxhd
-28662df973b289798bf6069fbbee8071 
*tests/data/fate/vsynth1-dnxhd-720p-rd.out.rawvideo
-stddev:6.26 PSNR: 32.19 MAXDIFF

[FFmpeg-devel] [PATCH 1/3] dnxhddec: initialize with mb-aligned dimensions

2015-10-01 Thread Christophe Gisquet
The coded size is a multiple of the macroblock size, which is 16.
---
 libavcodec/dnxhddec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index e3dec78..3985318 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -87,6 +87,9 @@ static av_cold int dnxhd_decode_init(AVCodecContext *avctx)
 ctx->cid = -1;
 avctx->colorspace = AVCOL_SPC_BT709;
 
+avctx->coded_width  = FFALIGN(avctx->width, 16);
+avctx->coded_height = FFALIGN(avctx->coded_height, 16);
+
 ctx->rows = av_mallocz_array(avctx->thread_count, sizeof(RowContext));
 if (!ctx->rows)
 return AVERROR(ENOMEM);
-- 
2.5.2

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


[FFmpeg-devel] [PATCH 0/3] Miscellaneous corrections

2015-10-01 Thread Christophe Gisquet
The last one is needed for dsp implementations. This set
is mostly meant to evacuate the simplest parts before
DNxHR support is added.

Christophe Gisquet (3):
  dnxhddec: initialize with mb-aligned dimensions
  dnxhddec: use dequantization formula from specs
  dnxhddec: init scantable once permutation is set

 libavcodec/dnxhddec.c | 10 +++---
 tests/ref/vsynth/vsynth1-dnxhd-1080i  |  4 ++--
 tests/ref/vsynth/vsynth1-dnxhd-1080i-colr |  4 ++--
 tests/ref/vsynth/vsynth1-dnxhd-720p   |  4 ++--
 tests/ref/vsynth/vsynth1-dnxhd-720p-10bit |  4 ++--
 tests/ref/vsynth/vsynth1-dnxhd-720p-rd|  4 ++--
 tests/ref/vsynth/vsynth2-dnxhd-1080i  |  4 ++--
 tests/ref/vsynth/vsynth2-dnxhd-1080i-colr |  4 ++--
 tests/ref/vsynth/vsynth2-dnxhd-720p   |  4 ++--
 tests/ref/vsynth/vsynth2-dnxhd-720p-10bit |  4 ++--
 tests/ref/vsynth/vsynth2-dnxhd-720p-rd|  4 ++--
 tests/ref/vsynth/vsynth3-dnxhd-1080i-colr |  2 +-
 tests/ref/vsynth/vsynth_lena-dnxhd-1080i  |  4 ++--
 tests/ref/vsynth/vsynth_lena-dnxhd-1080i-colr |  4 ++--
 tests/ref/vsynth/vsynth_lena-dnxhd-720p   |  4 ++--
 tests/ref/vsynth/vsynth_lena-dnxhd-720p-10bit |  4 ++--
 tests/ref/vsynth/vsynth_lena-dnxhd-720p-rd|  4 ++--
 17 files changed, 38 insertions(+), 34 deletions(-)

-- 
2.5.2

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


Re: [FFmpeg-devel] [PATCH] blockdsp: remove high bit depth parameter

2015-10-01 Thread Christophe Gisquet
Hi,

2015-10-01 21:35 GMT+02:00 Michael Niedermayer :
> ffmpeg/libavcodec/arm/blockdsp_arm.h:24:6: note: previous declaration of 
> ‘ff_blockdsp_init_neon’ was here

Missed that header... I can only find those using grep...

Here's an updated patch.

-- 
Christophe
From 8da8a89ecf33e0c550fa61d6423a64650f6fc770 Mon Sep 17 00:00:00 2001
From: Christophe Gisquet 
Date: Mon, 28 Sep 2015 13:59:23 +0200
Subject: [PATCH 01/17] blockdsp: remove high bitdepth parameter

It is only (mis-)used to set the dsp fucntions clear_block(s). But
these functions always work on 16bits-wide elements, which make
the parameter useless and actually harmful, as it causes all content
on more than 8-bits to not use accelerated functions.
---
 libavcodec/alpha/blockdsp_alpha.c|  4 +---
 libavcodec/arm/blockdsp_arm.h|  2 +-
 libavcodec/arm/blockdsp_init_arm.c   |  4 ++--
 libavcodec/arm/blockdsp_init_neon.c  |  4 +---
 libavcodec/blockdsp.c| 20 +---
 libavcodec/blockdsp.h| 10 +-
 libavcodec/mips/blockdsp_init_mips.c | 12 +---
 libavcodec/ppc/blockdsp.c|  5 +
 libavcodec/x86/blockdsp_init.c   |  4 +---
 9 files changed, 26 insertions(+), 39 deletions(-)

diff --git a/libavcodec/alpha/blockdsp_alpha.c b/libavcodec/alpha/blockdsp_alpha.c
index ded439d..d8b6f8a 100644
--- a/libavcodec/alpha/blockdsp_alpha.c
+++ b/libavcodec/alpha/blockdsp_alpha.c
@@ -43,9 +43,7 @@ static void clear_blocks_axp(int16_t *blocks) {
 } while (n);
 }
 
-av_cold void ff_blockdsp_init_alpha(BlockDSPContext *c, unsigned high_bit_depth)
+av_cold void ff_blockdsp_init_alpha(BlockDSPContext *c)
 {
-if (!high_bit_depth) {
 c->clear_blocks = clear_blocks_axp;
-}
 }
diff --git a/libavcodec/arm/blockdsp_arm.h b/libavcodec/arm/blockdsp_arm.h
index 2688d36..59ebeb8 100644
--- a/libavcodec/arm/blockdsp_arm.h
+++ b/libavcodec/arm/blockdsp_arm.h
@@ -21,6 +21,6 @@
 
 #include "libavcodec/blockdsp.h"
 
-void ff_blockdsp_init_neon(BlockDSPContext *c, unsigned high_bit_depth);
+void ff_blockdsp_init_neon(BlockDSPContext *c);
 
 #endif /* AVCODEC_ARM_BLOCKDSP_ARM_H */
diff --git a/libavcodec/arm/blockdsp_init_arm.c b/libavcodec/arm/blockdsp_init_arm.c
index 3b86a71..2080d52 100644
--- a/libavcodec/arm/blockdsp_init_arm.c
+++ b/libavcodec/arm/blockdsp_init_arm.c
@@ -24,10 +24,10 @@
 #include "libavcodec/blockdsp.h"
 #include "blockdsp_arm.h"
 
-av_cold void ff_blockdsp_init_arm(BlockDSPContext *c, unsigned high_bit_depth)
+av_cold void ff_blockdsp_init_arm(BlockDSPContext *c)
 {
 int cpu_flags = av_get_cpu_flags();
 
 if (have_neon(cpu_flags))
-ff_blockdsp_init_neon(c, high_bit_depth);
+ff_blockdsp_init_neon(c);
 }
diff --git a/libavcodec/arm/blockdsp_init_neon.c b/libavcodec/arm/blockdsp_init_neon.c
index 62b51fc..37819c6 100644
--- a/libavcodec/arm/blockdsp_init_neon.c
+++ b/libavcodec/arm/blockdsp_init_neon.c
@@ -28,10 +28,8 @@
 void ff_clear_block_neon(int16_t *block);
 void ff_clear_blocks_neon(int16_t *blocks);
 
-av_cold void ff_blockdsp_init_neon(BlockDSPContext *c, unsigned high_bit_depth)
+av_cold void ff_blockdsp_init_neon(BlockDSPContext *c)
 {
-if (!high_bit_depth) {
 c->clear_block  = ff_clear_block_neon;
 c->clear_blocks = ff_clear_blocks_neon;
-}
 }
diff --git a/libavcodec/blockdsp.c b/libavcodec/blockdsp.c
index 42e177b..a5c527a 100644
--- a/libavcodec/blockdsp.c
+++ b/libavcodec/blockdsp.c
@@ -25,12 +25,12 @@
 #include "blockdsp.h"
 #include "version.h"
 
-static void clear_block_8_c(int16_t *block)
+static void clear_block_c(int16_t *block)
 {
 memset(block, 0, sizeof(int16_t) * 64);
 }
 
-static void clear_blocks_8_c(int16_t *blocks)
+static void clear_blocks_c(int16_t *blocks)
 {
 memset(blocks, 0, sizeof(int16_t) * 6 * 64);
 }
@@ -57,22 +57,20 @@ static void fill_block8_c(uint8_t *block, uint8_t value, int line_size, int h)
 
 av_cold void ff_blockdsp_init(BlockDSPContext *c, AVCodecContext *avctx)
 {
-const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8;
-
-c->clear_block  = clear_block_8_c;
-c->clear_blocks = clear_blocks_8_c;
+c->clear_block  = clear_block_c;
+c->clear_blocks = clear_blocks_c;
 
 c->fill_block_tab[0] = fill_block16_c;
 c->fill_block_tab[1] = fill_block8_c;
 
 if (ARCH_ALPHA)
-ff_blockdsp_init_alpha(c, high_bit_depth);
+ff_blockdsp_init_alpha(c);
 if (ARCH_ARM)
-ff_blockdsp_init_arm(c, high_bit_depth);
+ff_blockdsp_init_arm(c);
 if (ARCH_PPC)
-ff_blockdsp_init_ppc(c, high_bit_depth);
+ff_blockdsp_init_ppc(c);
 if (ARCH_X86)
-ff_blockdsp_init_x86(c, high_bit_depth, avctx);
+ff_blockdsp_init_x86(c, avctx);
 if (ARCH_MIPS)
-ff_blockdsp_init_mips(c, high_bit_depth);
+ff_blockdsp_init_mips(c);
 }
diff --git a/libavcodec/blockdsp.h b/libavcodec/blockdsp.h
index 654ecdc..dddac72 100644
--- a/libavcodec/blockdsp.h
+++ b/libavcodec/blockdsp.h
@@ -

[FFmpeg-devel] [PATCH]lavfi/mandelbrot: Output RGB0 instead of RGBA

2015-10-01 Thread Carl Eugen Hoyos
Hi!

Attached patch improves the mandelbrot output pix_fmt imo.

Please comment, Carl Eugen
diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c
index 56d0503..950c5c8 100644
--- a/libavfilter/vsrc_mandelbrot.c
+++ b/libavfilter/vsrc_mandelbrot.c
@@ -149,7 +149,7 @@ static av_cold void uninit(AVFilterContext *ctx)
 static int query_formats(AVFilterContext *ctx)
 {
 static const enum AVPixelFormat pix_fmts[] = {
-AV_PIX_FMT_BGR32,
+AV_PIX_FMT_0BGR32,
 AV_PIX_FMT_NONE
 };
 
@@ -379,7 +379,6 @@ static void draw_mandelbrot(AVFilterContext *ctx, uint32_t 
*color, int linesize,
 c= lrintf((s->zyklus[closest_index][0]/closest+1)*127+dv) 
+ lrintf((s->zyklus[closest_index][1]/closest+1)*127+dv)*256;
 }
 }
-c |= 0xFF00;
 color[x + y*linesize]= c;
 if(next_cidx < s->cache_allocated){
 s->next_cache[next_cidx  ].p[0]= cr;
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] blockdsp: remove high bit depth parameter

2015-10-01 Thread Michael Niedermayer
On Mon, Sep 28, 2015 at 06:51:07PM +0200, Christophe Gisquet wrote:
> This parameter is intended for pixel data, while the functions are
> actually only called for dct blocks.
> 
> I admit I haven't run this over all of fate, so it would be nice to
> validate nothing actually uses it for pixels (I have see nothing of
> the sort).
> 
> -- 
> Christophe

>  alpha/blockdsp_alpha.c|4 +---
>  arm/blockdsp_init_arm.c   |4 ++--
>  arm/blockdsp_init_neon.c  |4 +---
>  blockdsp.c|   20 +---
>  blockdsp.h|   10 +-
>  mips/blockdsp_init_mips.c |   12 +---
>  ppc/blockdsp.c|5 +
>  x86/blockdsp_init.c   |4 +---
>  8 files changed, 25 insertions(+), 38 deletions(-)
> da6dcd904d1f1a5fb72e829234c2891b740a5c72  
> 0002-blockdsp-remove-high-bitdepth-parameter.patch
> From d89cdcaf4f71bcb910e57184c2024029f09b3903 Mon Sep 17 00:00:00 2001
> From: Christophe Gisquet 
> Date: Mon, 28 Sep 2015 13:59:23 +0200
> Subject: [PATCH 2/7] blockdsp: remove high bitdepth parameter
> 
> It is only (mis-)used to set the dsp fucntions clear_block(s). But
> these functions always work on 16bits-wide elements, which make
> the parameter useless and actually harmful, as it causes all content
> on more than 8-bits to not use accelerated functions.
> ---
>  libavcodec/alpha/blockdsp_alpha.c|  4 +---
>  libavcodec/arm/blockdsp_init_arm.c   |  4 ++--
>  libavcodec/arm/blockdsp_init_neon.c  |  4 +---
>  libavcodec/blockdsp.c| 20 +---
>  libavcodec/blockdsp.h| 10 +-
>  libavcodec/mips/blockdsp_init_mips.c | 12 +---
>  libavcodec/ppc/blockdsp.c|  5 +
>  libavcodec/x86/blockdsp_init.c   |  4 +---
>  8 files changed, 25 insertions(+), 38 deletions(-)

CC  libavcodec/arm/blockdsp_init_arm.o
CC  libavcodec/arm/blockdsp_init_neon.o
ffmpeg/libavcodec/arm/blockdsp_init_neon.c:31:28: error: conflicting types for 
‘ff_blockdsp_init_neon’
ffmpeg/libavcodec/arm/blockdsp_arm.h:24:6: note: previous declaration of 
‘ff_blockdsp_init_neon’ was here
make: *** [libavcodec/arm/blockdsp_init_neon.o] Error 1
ffmpeg/libavcodec/arm/blockdsp_init_arm.c: In function ‘ff_blockdsp_init_arm’:
ffmpeg/libavcodec/arm/blockdsp_init_arm.c:32:9: error: too few arguments to 
function ‘ff_blockdsp_init_neon’
ffmpeg/libavcodec/arm/blockdsp_arm.h:24:6: note: declared here
make: *** [libavcodec/arm/blockdsp_init_arm.o] Error 1
make: Target `all' not remade because of errors.

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle


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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_maskedmerge: add SIMD for maskedmerge with 8 bit depth input

2015-10-01 Thread Paul B Mahol
On 10/1/15, Henrik Gramner  wrote:
> On Thu, Oct 1, 2015 at 8:42 PM, Paul B Mahol  wrote:
>> diff --git a/libavfilter/vf_maskedmerge.c b/libavfilter/vf_maskedmerge.c
>
>>  if (desc->comp[0].depth == 8)
>>  s->maskedmerge = maskedmerge8;
>>  else
>>  s->maskedmerge = maskedmerge16;
>>
>> +if (ARCH_X86)
>> +ff_maskedmerge_init_x86(s);
>> +
>
> Create a new function ff_maskedmerge_init() and move the above code
> there, that will make it easier to add a unit test.

Maybe when me or someone else add test, now I'm just in learning asm stage.

>
>> diff --git a/libavfilter/x86/vf_maskedmerge.asm
>> b/libavfilter/x86/vf_maskedmerge.asm
>
>> +mova m5, [pw_128]
>> +mova m2, [pw_256]
>> +pxor m6, m6
>
> Nit: Reorganize your registers so you get those constants in m4, m5,
> m6. It will make the code easier to follow IMO.

Changed locally.

>
>> +mov r10q, 0
>
> Xor a register with itself instead of using mov to zero a register.
> There's also no need to use the q suffix for plain register names, r10
> is enough.

Changed locally.

>
>> +movh m0, [bsrcq + x]
>> +movh m1, [osrcq + x]
>> +movh m3, [msrcq + x]
> [...]
>> +punpcklbw m0, m6
>> +punpcklbw m1, m6
>> +punpcklbw m3, m6
>
> You could also make an SSE4 version that uses pmovzxbw.
>
>> +paddw m1, m5
>> +psrlw m1, 8
>
> I believe you could also make an SSSE3 version that uses pmulhrsw
> instead of add + shift.
>
>> +add r10q, mmsize / 2
>> +cmp r10q, wq
>> +jl .loop
>
> There's a trick you could do here that might be faster:
> 1) Add w to bsrc, osrc, msrc and dst and then negate w in the
> beginning of the function.
> 2) Initialize r10 to w instead of 0 at the beginning of each .nextrow
> iteration
> 3) You can now drop the cmp, the add will be enough to set the right
> flags for the branch

Will experiment.

>
> I also encourage you to write a checkasm unit test, that will make it
> easier to both benchmark and verify the correctness of your code.

Maybe later.

> ___
> 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] winrt: multithreading support

2015-10-01 Thread Hendrik Leppkes
On Thu, Oct 1, 2015 at 9:05 PM, wm4  wrote:
> On Fri, 2 Oct 2015 02:58:52 +0800
> Wang Bin  wrote:
>
>> From b8b5ad2d6510778111c2a03ae5cfbe727ee6 Mon Sep 17 00:00:00 2001
>> From: wang-bin 
>> Date: Tue, 29 Sep 2015 18:11:03 +0800
>> Subject: [PATCH] winrt: multithreading support
>>
>> _beginthreadex is for desktop only. CreateThread is available for windows 
>> store apps on windows (and phone) 8.1 and later. 
>> http://msdn.microsoft.com/en-us/library/ms682453%28VS.85%29.aspx
>> ---
>>  compat/w32pthreads.h | 14 ++
>>  configure|  4 
>>  libavutil/cpu.c  | 14 +-
>>  3 files changed, 31 insertions(+), 1 deletion(-)
>>
>> diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h
>> index deb1c53..7491cab 100644
>> --- a/compat/w32pthreads.h
>> +++ b/compat/w32pthreads.h
>> @@ -37,7 +37,16 @@
>>
>>  #define WIN32_LEAN_AND_MEAN
>>  #include 
>> +#ifdef WINAPI_FAMILY
>> +#include 
>> +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
>> +#define TARGET_OS_WINRT
>> +#endif
>> +#endif
>> +#ifndef TARGET_OS_WINRT
>>  #include 
>> +#endif
>> +
>>
>>  #include "libavutil/attributes.h"
>>  #include "libavutil/common.h"
>> @@ -82,8 +91,13 @@ static av_unused int pthread_create(pthread_t *thread, 
>> const void *unused_attr,
>>  {
>>  thread->func   = start_routine;
>>  thread->arg= arg;
>> +#ifndef TARGET_OS_WINRT
>>  thread->handle = (void*)_beginthreadex(NULL, 0, win32thread_worker, 
>> thread,
>> 0, NULL);
>> +#else
>> +thread->handle = (void*)CreateThread(NULL, 0, win32thread_worker, 
>> thread,
>> +   0, NULL);
>> +#endif
>
> Why can't it always use CreateThread? This looks very suspicious.

MSDN warns about using CreateThread with C code, something with the
CRT init, and recommend _beginthreadex instead.
Using CreateThread on WinRT seems a bit fishy for the same reason.

>
>>  return !thread->handle;
>>  }
>>
>> diff --git a/configure b/configure
>> index 361c024..08d0d5d 100755
>> --- a/configure
>> +++ b/configure
>> @@ -5189,6 +5189,10 @@ check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
>>  if ! disabled w32threads && ! enabled pthreads; then
>>  check_func_headers "windows.h process.h" _beginthreadex &&
>>  enable w32threads || disable w32threads
>> +if ! enabled w32threads; then
>> +check_func_headers "windows.h" CreateThread &&
>> +enable w32threads || disable w32threads
>> +fi
>>  fi
>>
>>  # check for some common methods of building with pthread support
>> diff --git a/libavutil/cpu.c b/libavutil/cpu.c
>> index 780368d..c562e86 100644
>> --- a/libavutil/cpu.c
>> +++ b/libavutil/cpu.c
>> @@ -30,8 +30,14 @@
>>  #endif
>>  #include 
>>  #endif
>> -#if HAVE_GETPROCESSAFFINITYMASK
>> +#if HAVE_WINDOWS_H
>>  #include 
>> +#ifdef WINAPI_FAMILY
>> +#include 
>> +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
>> +#define TARGET_OS_WINRT
>> +#endif
>> +#endif
>>  #endif
>>  #if HAVE_SYSCTL
>>  #if HAVE_SYS_PARAM_H
>> @@ -253,6 +259,9 @@ int av_cpu_count(void)
>>  static volatile int printed;
>>
>>  int nb_cpus = 1;
>> +#ifdef TARGET_OS_WINRT
>> +SYSTEM_INFO sysinfo;
>> +#endif
>>  #if HAVE_SCHED_GETAFFINITY && defined(CPU_COUNT)
>>  cpu_set_t cpuset;
>>
>> @@ -274,6 +283,9 @@ int av_cpu_count(void)
>>  nb_cpus = sysconf(_SC_NPROC_ONLN);
>>  #elif HAVE_SYSCONF && defined(_SC_NPROCESSORS_ONLN)
>>  nb_cpus = sysconf(_SC_NPROCESSORS_ONLN);
>> +#elif defined(TARGET_OS_WINRT)
>> +GetNativeSystemInfo(&sysinfo);
>> +nb_cpus = sysinfo.dwNumberOfProcessors;
>>  #endif
>
> You could avoid the first ifdef by opening a new scope.
>
> What's the difference to GetProcessAffinityMask() (which is apparently
> not available on WinRT)?

GetProcessAffinityMask takes into account the settings the user makes,
ie. he could tell the process to always run on a particular set of
cores only.

>
>>
>>  if (!printed) {
>
> ___
> 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] avfilter/vf_maskedmerge: add SIMD for maskedmerge with 8 bit depth input

2015-10-01 Thread Henrik Gramner
On Thu, Oct 1, 2015 at 8:42 PM, Paul B Mahol  wrote:
> diff --git a/libavfilter/vf_maskedmerge.c b/libavfilter/vf_maskedmerge.c

>  if (desc->comp[0].depth == 8)
>  s->maskedmerge = maskedmerge8;
>  else
>  s->maskedmerge = maskedmerge16;
>
> +if (ARCH_X86)
> +ff_maskedmerge_init_x86(s);
> +

Create a new function ff_maskedmerge_init() and move the above code
there, that will make it easier to add a unit test.

> diff --git a/libavfilter/x86/vf_maskedmerge.asm 
> b/libavfilter/x86/vf_maskedmerge.asm

> +mova m5, [pw_128]
> +mova m2, [pw_256]
> +pxor m6, m6

Nit: Reorganize your registers so you get those constants in m4, m5,
m6. It will make the code easier to follow IMO.

> +mov r10q, 0

Xor a register with itself instead of using mov to zero a register.
There's also no need to use the q suffix for plain register names, r10
is enough.

> +movh m0, [bsrcq + x]
> +movh m1, [osrcq + x]
> +movh m3, [msrcq + x]
[...]
> +punpcklbw m0, m6
> +punpcklbw m1, m6
> +punpcklbw m3, m6

You could also make an SSE4 version that uses pmovzxbw.

> +paddw m1, m5
> +psrlw m1, 8

I believe you could also make an SSSE3 version that uses pmulhrsw
instead of add + shift.

> +add r10q, mmsize / 2
> +cmp r10q, wq
> +jl .loop

There's a trick you could do here that might be faster:
1) Add w to bsrc, osrc, msrc and dst and then negate w in the
beginning of the function.
2) Initialize r10 to w instead of 0 at the beginning of each .nextrow iteration
3) You can now drop the cmp, the add will be enough to set the right
flags for the branch

I also encourage you to write a checkasm unit test, that will make it
easier to both benchmark and verify the correctness of your code.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] winrt: multithreading support

2015-10-01 Thread wm4
On Fri, 2 Oct 2015 02:58:52 +0800
Wang Bin  wrote:

> From b8b5ad2d6510778111c2a03ae5cfbe727ee6 Mon Sep 17 00:00:00 2001
> From: wang-bin 
> Date: Tue, 29 Sep 2015 18:11:03 +0800
> Subject: [PATCH] winrt: multithreading support
> 
> _beginthreadex is for desktop only. CreateThread is available for windows 
> store apps on windows (and phone) 8.1 and later. 
> http://msdn.microsoft.com/en-us/library/ms682453%28VS.85%29.aspx
> ---
>  compat/w32pthreads.h | 14 ++
>  configure|  4 
>  libavutil/cpu.c  | 14 +-
>  3 files changed, 31 insertions(+), 1 deletion(-)
> 
> diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h
> index deb1c53..7491cab 100644
> --- a/compat/w32pthreads.h
> +++ b/compat/w32pthreads.h
> @@ -37,7 +37,16 @@
>  
>  #define WIN32_LEAN_AND_MEAN
>  #include 
> +#ifdef WINAPI_FAMILY
> +#include 
> +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
> +#define TARGET_OS_WINRT
> +#endif
> +#endif
> +#ifndef TARGET_OS_WINRT
>  #include 
> +#endif
> +
>  
>  #include "libavutil/attributes.h"
>  #include "libavutil/common.h"
> @@ -82,8 +91,13 @@ static av_unused int pthread_create(pthread_t *thread, 
> const void *unused_attr,
>  {
>  thread->func   = start_routine;
>  thread->arg= arg;
> +#ifndef TARGET_OS_WINRT
>  thread->handle = (void*)_beginthreadex(NULL, 0, win32thread_worker, 
> thread,
> 0, NULL);
> +#else
> +thread->handle = (void*)CreateThread(NULL, 0, win32thread_worker, thread,
> +   0, NULL);
> +#endif

Why can't it always use CreateThread? This looks very suspicious.

>  return !thread->handle;
>  }
>  
> diff --git a/configure b/configure
> index 361c024..08d0d5d 100755
> --- a/configure
> +++ b/configure
> @@ -5189,6 +5189,10 @@ check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
>  if ! disabled w32threads && ! enabled pthreads; then
>  check_func_headers "windows.h process.h" _beginthreadex &&
>  enable w32threads || disable w32threads
> +if ! enabled w32threads; then
> +check_func_headers "windows.h" CreateThread &&
> +enable w32threads || disable w32threads
> +fi
>  fi
>  
>  # check for some common methods of building with pthread support
> diff --git a/libavutil/cpu.c b/libavutil/cpu.c
> index 780368d..c562e86 100644
> --- a/libavutil/cpu.c
> +++ b/libavutil/cpu.c
> @@ -30,8 +30,14 @@
>  #endif
>  #include 
>  #endif
> -#if HAVE_GETPROCESSAFFINITYMASK
> +#if HAVE_WINDOWS_H
>  #include 
> +#ifdef WINAPI_FAMILY
> +#include 
> +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
> +#define TARGET_OS_WINRT
> +#endif
> +#endif
>  #endif
>  #if HAVE_SYSCTL
>  #if HAVE_SYS_PARAM_H
> @@ -253,6 +259,9 @@ int av_cpu_count(void)
>  static volatile int printed;
>  
>  int nb_cpus = 1;
> +#ifdef TARGET_OS_WINRT
> +SYSTEM_INFO sysinfo;
> +#endif
>  #if HAVE_SCHED_GETAFFINITY && defined(CPU_COUNT)
>  cpu_set_t cpuset;
>  
> @@ -274,6 +283,9 @@ int av_cpu_count(void)
>  nb_cpus = sysconf(_SC_NPROC_ONLN);
>  #elif HAVE_SYSCONF && defined(_SC_NPROCESSORS_ONLN)
>  nb_cpus = sysconf(_SC_NPROCESSORS_ONLN);
> +#elif defined(TARGET_OS_WINRT)
> +GetNativeSystemInfo(&sysinfo);
> +nb_cpus = sysinfo.dwNumberOfProcessors;
>  #endif

You could avoid the first ifdef by opening a new scope.

What's the difference to GetProcessAffinityMask() (which is apparently
not available on WinRT)?

>  
>  if (!printed) {

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


Re: [FFmpeg-devel] [PATCH] winrt: multithreading support

2015-10-01 Thread Wang Bin
Seems that the function style macro is always evaluated. So gcc gives an
error at WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) if
WINAPI_FAMILY_PARTITION is not defined. Now I copy the macros from
configure.


0001-winrt-multithreading-support.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_maskedmerge: add SIMD for maskedmerge with 8 bit depth input

2015-10-01 Thread Paul B Mahol
On 10/1/15, Paul B Mahol  wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  libavfilter/maskedmerge.h | 40 
>  libavfilter/vf_maskedmerge.c  | 59 --
>  libavfilter/x86/Makefile  |  2 +
>  libavfilter/x86/vf_maskedmerge.asm| 69
> +++
>  libavfilter/x86/vf_maskedmerge_init.c | 40 
>  5 files changed, 175 insertions(+), 35 deletions(-)
>  create mode 100644 libavfilter/maskedmerge.h
>  create mode 100644 libavfilter/x86/vf_maskedmerge.asm
>  create mode 100644 libavfilter/x86/vf_maskedmerge_init.c
>

[...]

> +lea bsrcq, [bsrcq+blinesizeq]
> +lea osrcq, [osrcq+olinesizeq]
> +lea msrcq, [msrcq+mlinesizeq]
> +lea dstq, [dstq+dlinesizeq]

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


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/h264: keep SPS and PPS bitstream data

2015-10-01 Thread wm4
On Thu, 1 Oct 2015 19:56:41 +0200
Michael Niedermayer  wrote:

> On Thu, Oct 01, 2015 at 07:26:47PM +0200, wm4 wrote:
> > On Thu, 1 Oct 2015 19:08:21 +0200
> > Michael Niedermayer  wrote:
> > 
> > > On Thu, Oct 01, 2015 at 06:13:20PM +0200, wm4 wrote:
> > > > Needed for the following VideotoolBox commit.
> > > > ---
> > > >  libavcodec/h264.h|  4 
> > > >  libavcodec/h264_ps.c | 20 
> > > >  2 files changed, 20 insertions(+), 4 deletions(-)
> > > > 
> > > > diff --git a/libavcodec/h264.h b/libavcodec/h264.h
> > > > index 7356288..eeb2aaf 100644
> > > > --- a/libavcodec/h264.h
> > > > +++ b/libavcodec/h264.h
> > > > @@ -229,6 +229,8 @@ typedef struct SPS {
> > > >  int residual_color_transform_flag;///< 
> > > > residual_colour_transform_flag
> > > >  int constraint_set_flags; ///< constraint_set[0-3]_flag
> > > >  int new;  ///< flag to keep track if 
> > > > the decoder context needs re-init due to changed SPS
> > > > +uint8_t data[1 << 16];
> > > > +int data_size;
> > > >  } SPS;
> > > >  
> > > >  /**
> > > > @@ -254,6 +256,8 @@ typedef struct PPS {
> > > >  uint8_t scaling_matrix8[6][64];
> > > >  uint8_t chroma_qp_table[2][QP_MAX_NUM+1];  ///< pre-scaled (with 
> > > > chroma_qp_index_offset) version of qp_table
> > > >  int chroma_qp_diff;
> > > > +uint8_t data[1 << 16];
> > > > +int data_size;
> > > >  } PPS;
> > > >  
> > > >  /**
> > > > diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
> > > > index 52d235c..fd16a95 100644
> > > > --- a/libavcodec/h264_ps.c
> > > > +++ b/libavcodec/h264_ps.c
> > > > @@ -307,6 +307,15 @@ int ff_h264_decode_seq_parameter_set(H264Context 
> > > > *h, int ignore_truncation)
> > > >  int i, log2_max_frame_num_minus4;
> > > >  SPS *sps;
> > > >  
> > > > +sps = av_mallocz(sizeof(SPS));
> > > > +if (!sps)
> > > > +return AVERROR(ENOMEM);
> > > > +
> > > > +sps->data_size = h->gb.buffer_end - h->gb.buffer;
> > > 
> > > the subtraction could overflow the 32bit int range leading to a
> > > truncated or negative data_size
> > > 
> > > [...]
> > > 
> > 
> > This is impossible. The C type used for NALs is int.
> 
> yes as long as all callers of this global function use such int based
> sizes to initialize the pointers
> if a single one is changed or one is added to initialize them from
> a int64_t then this could overflow.

There could be much more wrong wtih this, like e.g. how the GetBits
context is assumed to not have any bits written yet. But ok, I'll fix
it on push by changing the data_size fields to size_t.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avfilter/vf_maskedmerge: add SIMD for maskedmerge with 8 bit depth input

2015-10-01 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/maskedmerge.h | 40 
 libavfilter/vf_maskedmerge.c  | 59 --
 libavfilter/x86/Makefile  |  2 +
 libavfilter/x86/vf_maskedmerge.asm| 69 +++
 libavfilter/x86/vf_maskedmerge_init.c | 40 
 5 files changed, 175 insertions(+), 35 deletions(-)
 create mode 100644 libavfilter/maskedmerge.h
 create mode 100644 libavfilter/x86/vf_maskedmerge.asm
 create mode 100644 libavfilter/x86/vf_maskedmerge_init.c

diff --git a/libavfilter/maskedmerge.h b/libavfilter/maskedmerge.h
new file mode 100644
index 000..b47a816
--- /dev/null
+++ b/libavfilter/maskedmerge.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2015 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "avfilter.h"
+#include "framesync.h"
+
+typedef struct MaskedMergeContext {
+const AVClass *class;
+int width[4], height[4];
+int nb_planes;
+int planes;
+int half, depth;
+FFFrameSync fs;
+
+void (*maskedmerge)(const uint8_t *bsrc, const uint8_t *osrc,
+const uint8_t *msrc, uint8_t *dst,
+ptrdiff_t blinesize, ptrdiff_t olinesize,
+ptrdiff_t mlinesize, ptrdiff_t dlinesize,
+int w, int h,
+int half, int shift);
+} MaskedMergeContext;
+
+void ff_maskedmerge_init_x86(MaskedMergeContext *s);
diff --git a/libavfilter/vf_maskedmerge.c b/libavfilter/vf_maskedmerge.c
index 41bd039..aa11d31 100644
--- a/libavfilter/vf_maskedmerge.c
+++ b/libavfilter/vf_maskedmerge.c
@@ -23,24 +23,9 @@
 #include "libavutil/opt.h"
 #include "avfilter.h"
 #include "formats.h"
-#include "framesync.h"
 #include "internal.h"
 #include "video.h"
-
-typedef struct MaskedMergeContext {
-const AVClass *class;
-int width[4], height[4];
-int nb_planes;
-int planes;
-int max, half, depth;
-FFFrameSync fs;
-
-void (*maskedmerge)(const uint8_t *bsrc, int blinesize,
-const uint8_t *osrc, int olinesize,
-const uint8_t *msrc, int mlinesize,
-uint8_t *dst, int dlinesize, int w, int h,
-int max, int half, int shift);
-} MaskedMergeContext;
+#include "maskedmerge.h"
 
 #define OFFSET(x) offsetof(MaskedMergeContext, x)
 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
@@ -109,12 +94,12 @@ static int process_frame(FFFrameSync *fs)
 continue;
 }
 
-s->maskedmerge(base->data[p], base->linesize[p],
-   overlay->data[p], overlay->linesize[p],
-   mask->data[p], mask->linesize[p],
-   out->data[p], out->linesize[p],
+s->maskedmerge(base->data[p], overlay->data[p],
+   mask->data[p], out->data[p],
+   base->linesize[p], overlay->linesize[p],
+   mask->linesize[p], out->linesize[p],
s->width[p], s->height[p],
-   s->max, s->half, s->depth);
+   s->half, s->depth);
 }
 }
 out->pts = av_rescale_q(base->pts, s->fs.time_base, outlink->time_base);
@@ -122,17 +107,18 @@ static int process_frame(FFFrameSync *fs)
 return ff_filter_frame(outlink, out);
 }
 
-static void maskedmerge8(const uint8_t *bsrc, int blinesize,
- const uint8_t *osrc, int olinesize,
- const uint8_t *msrc, int mlinesize,
- uint8_t *dst, int dlinesize, int w, int h,
- int max, int half, int shift)
+static void maskedmerge8(const uint8_t *bsrc, const uint8_t *osrc,
+ const uint8_t *msrc, uint8_t *dst,
+ ptrdiff_t blinesize, ptrdiff_t olinesize,
+ ptrdiff_t mlinesize, ptrdiff_t dlinesize,
+ int w, int h,
+ int half, int shift)
 {
 int x, y;
 
 for (y = 0; y < h; y++) {
 for (x = 0; x < w; x++) {
-dst[x] = ((256 - msrc[x]) * bsrc[x] + msrc[x

Re: [FFmpeg-devel] [PATCH]lavf/rawdec: Autodetect mlp streams

2015-10-01 Thread Carl Eugen Hoyos
Michael Niedermayer  gmx.at> writes:

> >  rawdec.c |   23 +++
> >  1 file changed, 23 insertions(+)
> > abba9ed11f76154846001b745f4efb00d6b4849e  patchmlpprobe.diff
> 
> should be ok

Patch applied.

Thank you, Carl Eugen

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


Re: [FFmpeg-devel] [PATCH 1/2] checkasm: Fix compilation with --disable-avcodec

2015-10-01 Thread Henrik Gramner
On Thu, Oct 1, 2015 at 7:57 PM, Ronald S. Bultje  wrote:
> Does this mean these macros are defined and 1 when AVCODEC=0?
>
> That seems like a bug?


Yes, they are., but I have no idea what the intended behavior of the
CONFIG_* variables are.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_maskedmerge: add SIMD for maskedmerge with 8 bit depth input

2015-10-01 Thread James Almer
On 10/1/2015 2:25 PM, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  libavfilter/maskedmerge.h | 39 +
>  libavfilter/vf_maskedmerge.c  | 33 ++
>  libavfilter/x86/Makefile  |  2 ++
>  libavfilter/x86/vf_maskedmerge.asm| 66 
> +++
>  libavfilter/x86/vf_maskedmerge_init.c | 39 +
>  5 files changed, 156 insertions(+), 23 deletions(-)
>  create mode 100644 libavfilter/maskedmerge.h
>  create mode 100644 libavfilter/x86/vf_maskedmerge.asm
>  create mode 100644 libavfilter/x86/vf_maskedmerge_init.c
> 
> diff --git a/libavfilter/maskedmerge.h b/libavfilter/maskedmerge.h
> new file mode 100644
> index 000..b198e65
> --- /dev/null
> +++ b/libavfilter/maskedmerge.h
> @@ -0,0 +1,39 @@
> +/*
> + * Copyright (c) 2015 Paul B Mahol
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +#include "avfilter.h"
> +#include "framesync.h"
> +
> +typedef struct MaskedMergeContext {
> +const AVClass *class;
> +int width[4], height[4];
> +int nb_planes;
> +int planes;
> +int half, depth;
> +FFFrameSync fs;
> +
> +void (*maskedmerge)(const uint8_t *bsrc, int blinesize,
> +const uint8_t *osrc, int olinesize,
> +const uint8_t *msrc, int mlinesize,
> +uint8_t *dst, int dlinesize, int w, int h,
> +int half, int shift);

Make the pointers the first four arguments, followed by the linesize
ones, then the rest.
It will allow you to get this working on x86_32 with some changes.

Also, linesize arguments should be ptrdiff_t.

[...]

> diff --git a/libavfilter/x86/vf_maskedmerge.asm 
> b/libavfilter/x86/vf_maskedmerge.asm
> new file mode 100644
> index 000..462674a
> --- /dev/null
> +++ b/libavfilter/x86/vf_maskedmerge.asm
> @@ -0,0 +1,66 @@
> +;*
> +;* x86-optimized functions for maskedmerge filter
> +;*
> +;* Copyright (C) 2015 Paul B Mahol
> +;*
> +;* This file is part of FFmpeg.
> +;*
> +;* FFmpeg is free software; you can redistribute it and/or
> +;* modify it under the terms of the GNU Lesser General Public
> +;* License as published by the Free Software Foundation; either
> +;* version 2.1 of the License, or (at your option) any later version.
> +;*
> +;* FFmpeg is distributed in the hope that it will be useful,
> +;* but WITHOUT ANY WARRANTY; without even the implied warranty of
> +;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +;* Lesser General Public License for more details.
> +;*
> +;* You should have received a copy of the GNU Lesser General Public
> +;* License along with FFmpeg; if not, write to the Free Software
> +;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> +;*
> +
> +%include "libavutil/x86/x86util.asm"

If this is x86_64 only for now, then you need to put everything
under this line inside an "%if ARCH_X86_64" preprocessor check.

> +
> +SECTION_RODATA
> +
> +pw_128: times 8 dw 128
> +pw_256: times 8 dw 256
> +
> +SECTION .text
> +
> +INIT_XMM sse2
> +cglobal maskedmerge8, 10, 11, 3, 0, bsrc, blinesize, osrc, olinesize, msrc, 
> mlinesize, dst, dlinesize, w, h

You can remove the 0 if you're not reserving stack space. It's an
optional parameter.
Also, you're using more than 3 xmm regs.

> +mova m7, [pw_128]
> +pxor m6, m6
> +.nextrow:
> +mov r10q, 0
> +%define x r10q
> +
> +.loop:
> +movh m0, [bsrcq + x]
> +movh m1, [osrcq + x]
> +movh m3, [msrcq + x]
> +mova m4, [pw_256]

You're not using m2, so you can store pw_256 on it outside the loop
like you did for pw_128. Much faster than constantly loading it from
memory.
For that matter m5 is also unused.

> +punpcklbw m0, m6
> +punpcklbw m1, m6
> +punpcklbw m3, m6
> +psubw m4, m3
> +pmullw m4, m0
> +pmullw m1, m3
> +paddw m1, m4
> +paddw m1, m7
> +psrlw m1, 8
> +packuswb m1, m1
> +movh [dstq + x], m1
> +  

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/h264: keep SPS and PPS bitstream data

2015-10-01 Thread Michael Niedermayer
On Thu, Oct 01, 2015 at 07:26:47PM +0200, wm4 wrote:
> On Thu, 1 Oct 2015 19:08:21 +0200
> Michael Niedermayer  wrote:
> 
> > On Thu, Oct 01, 2015 at 06:13:20PM +0200, wm4 wrote:
> > > Needed for the following VideotoolBox commit.
> > > ---
> > >  libavcodec/h264.h|  4 
> > >  libavcodec/h264_ps.c | 20 
> > >  2 files changed, 20 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/libavcodec/h264.h b/libavcodec/h264.h
> > > index 7356288..eeb2aaf 100644
> > > --- a/libavcodec/h264.h
> > > +++ b/libavcodec/h264.h
> > > @@ -229,6 +229,8 @@ typedef struct SPS {
> > >  int residual_color_transform_flag;///< 
> > > residual_colour_transform_flag
> > >  int constraint_set_flags; ///< constraint_set[0-3]_flag
> > >  int new;  ///< flag to keep track if the 
> > > decoder context needs re-init due to changed SPS
> > > +uint8_t data[1 << 16];
> > > +int data_size;
> > >  } SPS;
> > >  
> > >  /**
> > > @@ -254,6 +256,8 @@ typedef struct PPS {
> > >  uint8_t scaling_matrix8[6][64];
> > >  uint8_t chroma_qp_table[2][QP_MAX_NUM+1];  ///< pre-scaled (with 
> > > chroma_qp_index_offset) version of qp_table
> > >  int chroma_qp_diff;
> > > +uint8_t data[1 << 16];
> > > +int data_size;
> > >  } PPS;
> > >  
> > >  /**
> > > diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
> > > index 52d235c..fd16a95 100644
> > > --- a/libavcodec/h264_ps.c
> > > +++ b/libavcodec/h264_ps.c
> > > @@ -307,6 +307,15 @@ int ff_h264_decode_seq_parameter_set(H264Context *h, 
> > > int ignore_truncation)
> > >  int i, log2_max_frame_num_minus4;
> > >  SPS *sps;
> > >  
> > > +sps = av_mallocz(sizeof(SPS));
> > > +if (!sps)
> > > +return AVERROR(ENOMEM);
> > > +
> > > +sps->data_size = h->gb.buffer_end - h->gb.buffer;
> > 
> > the subtraction could overflow the 32bit int range leading to a
> > truncated or negative data_size
> > 
> > [...]
> > 
> 
> This is impossible. The C type used for NALs is int.

yes as long as all callers of this global function use such int based
sizes to initialize the pointers
if a single one is changed or one is added to initialize them from
a int64_t then this could overflow.


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

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.


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


Re: [FFmpeg-devel] [PATCH 1/2] checkasm: Fix compilation with --disable-avcodec

2015-10-01 Thread Ronald S. Bultje
Hi,

On Thu, Oct 1, 2015 at 1:50 PM, Henrik Gramner  wrote:

> ---
>  tests/checkasm/checkasm.c | 42 ++
>  1 file changed, 22 insertions(+), 20 deletions(-)
>
> diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
> index d7c2e8a..264473a 100644
> --- a/tests/checkasm/checkasm.c
> +++ b/tests/checkasm/checkasm.c
> @@ -57,26 +57,28 @@ static const struct {
>  const char *name;
>  void (*func)(void);
>  } tests[] = {
> -#if CONFIG_BSWAPDSP
> -{ "bswapdsp", checkasm_check_bswapdsp },
> -#endif
> -#if CONFIG_FLACDSP
> -{ "flacdsp", checkasm_check_flacdsp },
> -#endif
> -#if CONFIG_H264PRED
> -{ "h264pred", checkasm_check_h264pred },
> -#endif
> -#if CONFIG_H264QPEL
> -{ "h264qpel", checkasm_check_h264qpel },
> -#endif
> -#if CONFIG_JPEG2000_DECODER
> -{ "jpeg2000dsp", checkasm_check_jpeg2000dsp },
> -#endif
> -#if CONFIG_V210_ENCODER
> -{ "v210enc", checkasm_check_v210enc },
> -#endif
> -#if CONFIG_VP9_DECODER
> -{ "vp9dsp", checkasm_check_vp9dsp },
> +#if CONFIG_AVCODEC
> +#if CONFIG_BSWAPDSP
> +{ "bswapdsp", checkasm_check_bswapdsp },
> +#endif
> +#if CONFIG_FLACDSP
> +{ "flacdsp", checkasm_check_flacdsp },
> +#endif
> +#if CONFIG_H264PRED
> +{ "h264pred", checkasm_check_h264pred },
> +#endif
> +#if CONFIG_H264QPEL
> +{ "h264qpel", checkasm_check_h264qpel },
> +#endif
> +#if CONFIG_JPEG2000_DECODER
> +{ "jpeg2000dsp", checkasm_check_jpeg2000dsp },
> +#endif
> +#if CONFIG_V210_ENCODER
> +{ "v210enc", checkasm_check_v210enc },
> +#endif
> +#if CONFIG_VP9_DECODER
> +{ "vp9dsp", checkasm_check_vp9dsp },
> +#endif
>  #endif
>  { NULL }
>  };
> --
> 1.9.1


Does this mean these macros are defined and 1 when AVCODEC=0?

That seems like a bug?

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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_maskedmerge: add SIMD for maskedmerge with 8 bit depth input

2015-10-01 Thread James Darnley
On 2015-10-01 19:25, Paul B Mahol wrote:
> +cglobal maskedmerge8, 10, 11, 3, 0, bsrc, blinesize, osrc, olinesize, msrc, 
> mlinesize, dst, dlinesize, w, h

You need a guard to prevent this being compiled on x86.

> +lea bsrcq, [bsrcq+blinesizeq]
> +lea osrcq, [osrcq+olinesizeq]
> +lea msrcq, [msrcq+mlinesizeq]
> +lea dstq, [dstq+dlinesizeq]

> +void (*maskedmerge)(const uint8_t *bsrc, int blinesize,
> +const uint8_t *osrc, int olinesize,
> +const uint8_t *msrc, int mlinesize,
> +uint8_t *dst, int dlinesize, int w, int h,
> +int half, int shift);

As I said briefly on IRC, you need to sign-extend (movsxd or the macro
movsxdifnidn) these integer linesize arguments before using the quadword
registers they sit in.  An alternative is to define the arguments as
ptrdiff_t types and let the compiler do that in the C code.



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


[FFmpeg-devel] [PATCH 2/2] checkasm: Simplify the list of tests using a macro

2015-10-01 Thread Henrik Gramner
---
 tests/checkasm/checkasm.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 264473a..5626d2c 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -52,6 +52,8 @@
 #define isatty(fd) 1
 #endif
 
+#define ADD_TEST(name) { #name, checkasm_check_##name },
+
 /* List of tests to invoke */
 static const struct {
 const char *name;
@@ -59,25 +61,25 @@ static const struct {
 } tests[] = {
 #if CONFIG_AVCODEC
 #if CONFIG_BSWAPDSP
-{ "bswapdsp", checkasm_check_bswapdsp },
+ADD_TEST(bswapdsp)
 #endif
 #if CONFIG_FLACDSP
-{ "flacdsp", checkasm_check_flacdsp },
+ADD_TEST(flacdsp)
 #endif
 #if CONFIG_H264PRED
-{ "h264pred", checkasm_check_h264pred },
+ADD_TEST(h264pred)
 #endif
 #if CONFIG_H264QPEL
-{ "h264qpel", checkasm_check_h264qpel },
+ADD_TEST(h264qpel)
 #endif
 #if CONFIG_JPEG2000_DECODER
-{ "jpeg2000dsp", checkasm_check_jpeg2000dsp },
+ADD_TEST(jpeg2000dsp)
 #endif
 #if CONFIG_V210_ENCODER
-{ "v210enc", checkasm_check_v210enc },
+ADD_TEST(v210enc)
 #endif
 #if CONFIG_VP9_DECODER
-{ "vp9dsp", checkasm_check_vp9dsp },
+ADD_TEST(vp9dsp)
 #endif
 #endif
 { NULL }
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 1/2] checkasm: Fix compilation with --disable-avcodec

2015-10-01 Thread Henrik Gramner
---
 tests/checkasm/checkasm.c | 42 ++
 1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index d7c2e8a..264473a 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -57,26 +57,28 @@ static const struct {
 const char *name;
 void (*func)(void);
 } tests[] = {
-#if CONFIG_BSWAPDSP
-{ "bswapdsp", checkasm_check_bswapdsp },
-#endif
-#if CONFIG_FLACDSP
-{ "flacdsp", checkasm_check_flacdsp },
-#endif
-#if CONFIG_H264PRED
-{ "h264pred", checkasm_check_h264pred },
-#endif
-#if CONFIG_H264QPEL
-{ "h264qpel", checkasm_check_h264qpel },
-#endif
-#if CONFIG_JPEG2000_DECODER
-{ "jpeg2000dsp", checkasm_check_jpeg2000dsp },
-#endif
-#if CONFIG_V210_ENCODER
-{ "v210enc", checkasm_check_v210enc },
-#endif
-#if CONFIG_VP9_DECODER
-{ "vp9dsp", checkasm_check_vp9dsp },
+#if CONFIG_AVCODEC
+#if CONFIG_BSWAPDSP
+{ "bswapdsp", checkasm_check_bswapdsp },
+#endif
+#if CONFIG_FLACDSP
+{ "flacdsp", checkasm_check_flacdsp },
+#endif
+#if CONFIG_H264PRED
+{ "h264pred", checkasm_check_h264pred },
+#endif
+#if CONFIG_H264QPEL
+{ "h264qpel", checkasm_check_h264qpel },
+#endif
+#if CONFIG_JPEG2000_DECODER
+{ "jpeg2000dsp", checkasm_check_jpeg2000dsp },
+#endif
+#if CONFIG_V210_ENCODER
+{ "v210enc", checkasm_check_v210enc },
+#endif
+#if CONFIG_VP9_DECODER
+{ "vp9dsp", checkasm_check_vp9dsp },
+#endif
 #endif
 { NULL }
 };
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/h264: keep SPS and PPS bitstream data

2015-10-01 Thread wm4
On Thu, 1 Oct 2015 19:08:21 +0200
Michael Niedermayer  wrote:

> On Thu, Oct 01, 2015 at 06:13:20PM +0200, wm4 wrote:
> > Needed for the following VideotoolBox commit.
> > ---
> >  libavcodec/h264.h|  4 
> >  libavcodec/h264_ps.c | 20 
> >  2 files changed, 20 insertions(+), 4 deletions(-)
> > 
> > diff --git a/libavcodec/h264.h b/libavcodec/h264.h
> > index 7356288..eeb2aaf 100644
> > --- a/libavcodec/h264.h
> > +++ b/libavcodec/h264.h
> > @@ -229,6 +229,8 @@ typedef struct SPS {
> >  int residual_color_transform_flag;///< 
> > residual_colour_transform_flag
> >  int constraint_set_flags; ///< constraint_set[0-3]_flag
> >  int new;  ///< flag to keep track if the 
> > decoder context needs re-init due to changed SPS
> > +uint8_t data[1 << 16];
> > +int data_size;
> >  } SPS;
> >  
> >  /**
> > @@ -254,6 +256,8 @@ typedef struct PPS {
> >  uint8_t scaling_matrix8[6][64];
> >  uint8_t chroma_qp_table[2][QP_MAX_NUM+1];  ///< pre-scaled (with 
> > chroma_qp_index_offset) version of qp_table
> >  int chroma_qp_diff;
> > +uint8_t data[1 << 16];
> > +int data_size;
> >  } PPS;
> >  
> >  /**
> > diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
> > index 52d235c..fd16a95 100644
> > --- a/libavcodec/h264_ps.c
> > +++ b/libavcodec/h264_ps.c
> > @@ -307,6 +307,15 @@ int ff_h264_decode_seq_parameter_set(H264Context *h, 
> > int ignore_truncation)
> >  int i, log2_max_frame_num_minus4;
> >  SPS *sps;
> >  
> > +sps = av_mallocz(sizeof(SPS));
> > +if (!sps)
> > +return AVERROR(ENOMEM);
> > +
> > +sps->data_size = h->gb.buffer_end - h->gb.buffer;
> 
> the subtraction could overflow the 32bit int range leading to a
> truncated or negative data_size
> 
> [...]
> 

This is impossible. The C type used for NALs is int.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avfilter/vf_maskedmerge: add SIMD for maskedmerge with 8 bit depth input

2015-10-01 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/maskedmerge.h | 39 +
 libavfilter/vf_maskedmerge.c  | 33 ++
 libavfilter/x86/Makefile  |  2 ++
 libavfilter/x86/vf_maskedmerge.asm| 66 +++
 libavfilter/x86/vf_maskedmerge_init.c | 39 +
 5 files changed, 156 insertions(+), 23 deletions(-)
 create mode 100644 libavfilter/maskedmerge.h
 create mode 100644 libavfilter/x86/vf_maskedmerge.asm
 create mode 100644 libavfilter/x86/vf_maskedmerge_init.c

diff --git a/libavfilter/maskedmerge.h b/libavfilter/maskedmerge.h
new file mode 100644
index 000..b198e65
--- /dev/null
+++ b/libavfilter/maskedmerge.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2015 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "avfilter.h"
+#include "framesync.h"
+
+typedef struct MaskedMergeContext {
+const AVClass *class;
+int width[4], height[4];
+int nb_planes;
+int planes;
+int half, depth;
+FFFrameSync fs;
+
+void (*maskedmerge)(const uint8_t *bsrc, int blinesize,
+const uint8_t *osrc, int olinesize,
+const uint8_t *msrc, int mlinesize,
+uint8_t *dst, int dlinesize, int w, int h,
+int half, int shift);
+} MaskedMergeContext;
+
+void ff_maskedmerge_init_x86(MaskedMergeContext *s);
diff --git a/libavfilter/vf_maskedmerge.c b/libavfilter/vf_maskedmerge.c
index 41bd039..f442bb7 100644
--- a/libavfilter/vf_maskedmerge.c
+++ b/libavfilter/vf_maskedmerge.c
@@ -23,24 +23,9 @@
 #include "libavutil/opt.h"
 #include "avfilter.h"
 #include "formats.h"
-#include "framesync.h"
 #include "internal.h"
 #include "video.h"
-
-typedef struct MaskedMergeContext {
-const AVClass *class;
-int width[4], height[4];
-int nb_planes;
-int planes;
-int max, half, depth;
-FFFrameSync fs;
-
-void (*maskedmerge)(const uint8_t *bsrc, int blinesize,
-const uint8_t *osrc, int olinesize,
-const uint8_t *msrc, int mlinesize,
-uint8_t *dst, int dlinesize, int w, int h,
-int max, int half, int shift);
-} MaskedMergeContext;
+#include "maskedmerge.h"
 
 #define OFFSET(x) offsetof(MaskedMergeContext, x)
 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
@@ -114,7 +99,7 @@ static int process_frame(FFFrameSync *fs)
mask->data[p], mask->linesize[p],
out->data[p], out->linesize[p],
s->width[p], s->height[p],
-   s->max, s->half, s->depth);
+   s->half, s->depth);
 }
 }
 out->pts = av_rescale_q(base->pts, s->fs.time_base, outlink->time_base);
@@ -126,13 +111,13 @@ static void maskedmerge8(const uint8_t *bsrc, int 
blinesize,
  const uint8_t *osrc, int olinesize,
  const uint8_t *msrc, int mlinesize,
  uint8_t *dst, int dlinesize, int w, int h,
- int max, int half, int shift)
+ int half, int shift)
 {
 int x, y;
 
 for (y = 0; y < h; y++) {
 for (x = 0; x < w; x++) {
-dst[x] = ((256 - msrc[x]) * bsrc[x] + msrc[x] * osrc[x] + 128) >> 
8;
+dst[x] = bsrc[x] + ((msrc[x] * (osrc[x] - bsrc[x]) + 128) >> 8);
 }
 
 dst  += dlinesize;
@@ -146,7 +131,7 @@ static void maskedmerge16(const uint8_t *bbsrc, int 
blinesize,
   const uint8_t *oosrc, int olinesize,
   const uint8_t *mmsrc, int mlinesize,
   uint8_t *ddst, int dlinesize, int w, int h,
-  int max, int half, int shift)
+  int half, int shift)
 {
 const uint16_t *bsrc = (const uint16_t *)bbsrc;
 const uint16_t *osrc = (const uint16_t *)oosrc;
@@ -156,7 +141,7 @@ static void maskedmerge16(const uint8_t *bbsrc, int 
blinesize,
 
 for (y = 0; y < h; y++) {
 for (x = 0; x < w; x++) {
-dst[x] = ((max - msrc[x]) * bsrc[x] + msrc[x] * osrc[x] + half) >> 
shift;

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/h264: keep SPS and PPS bitstream data

2015-10-01 Thread Michael Niedermayer
On Thu, Oct 01, 2015 at 06:13:20PM +0200, wm4 wrote:
> Needed for the following VideotoolBox commit.
> ---
>  libavcodec/h264.h|  4 
>  libavcodec/h264_ps.c | 20 
>  2 files changed, 20 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/h264.h b/libavcodec/h264.h
> index 7356288..eeb2aaf 100644
> --- a/libavcodec/h264.h
> +++ b/libavcodec/h264.h
> @@ -229,6 +229,8 @@ typedef struct SPS {
>  int residual_color_transform_flag;///< residual_colour_transform_flag
>  int constraint_set_flags; ///< constraint_set[0-3]_flag
>  int new;  ///< flag to keep track if the 
> decoder context needs re-init due to changed SPS
> +uint8_t data[1 << 16];
> +int data_size;
>  } SPS;
>  
>  /**
> @@ -254,6 +256,8 @@ typedef struct PPS {
>  uint8_t scaling_matrix8[6][64];
>  uint8_t chroma_qp_table[2][QP_MAX_NUM+1];  ///< pre-scaled (with 
> chroma_qp_index_offset) version of qp_table
>  int chroma_qp_diff;
> +uint8_t data[1 << 16];
> +int data_size;
>  } PPS;
>  
>  /**
> diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
> index 52d235c..fd16a95 100644
> --- a/libavcodec/h264_ps.c
> +++ b/libavcodec/h264_ps.c
> @@ -307,6 +307,15 @@ int ff_h264_decode_seq_parameter_set(H264Context *h, int 
> ignore_truncation)
>  int i, log2_max_frame_num_minus4;
>  SPS *sps;
>  
> +sps = av_mallocz(sizeof(SPS));
> +if (!sps)
> +return AVERROR(ENOMEM);
> +
> +sps->data_size = h->gb.buffer_end - h->gb.buffer;

the subtraction could overflow the 32bit int range leading to a
truncated or negative data_size

[...]

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


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


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/videotoolbox: fix decoding of some h264 bitstreams

2015-10-01 Thread wm4
On Thu, 1 Oct 2015 18:45:40 +0200
Hendrik Leppkes  wrote:

> On Thu, Oct 1, 2015 at 6:39 PM, wm4  wrote:
> > On Thu, 1 Oct 2015 18:29:00 +0200
> > Hendrik Leppkes  wrote:
> >
> >> On Thu, Oct 1, 2015 at 6:13 PM, wm4  wrote:
> >> > This affects Annex B streams (such as demuxed from .ts and others). It
> >> > also handles the format change in reinit-large_420_8-to-small_420_8.h264
> >> > correctly.
> >> >
> >> > Instead of passing through the extradata, create it on the fly it from
> >> > the currently active SPS and PPS. Since reconstructing the PPS and SPS
> >> > NALs would be very complicated and verbose, we use the NALs as they
> >> > originally appeared in the bitstream.
> >> >
> >> > The code for writing the extradata is somewhat derived from
> >> > libavformat/avc.c, but it's small and different enough that sharing it
> >> > is not really worth it.
> >> > ---
> >> > Even though it requires changes in the general h264 decoder (previous
> >> > patch), this solution is much cleaner and more robust than my patch
> >> > from yesterday.
> >> > ---
> >> >  libavcodec/videotoolbox.c | 48 
> >> > +--
> >> >  1 file changed, 30 insertions(+), 18 deletions(-)
> >> >
> >> > diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> >> > index 9dec5fc..cc1e592 100644
> >> > --- a/libavcodec/videotoolbox.c
> >> > +++ b/libavcodec/videotoolbox.c
> >> > @@ -77,28 +77,40 @@ int ff_videotoolbox_alloc_frame(AVCodecContext 
> >> > *avctx, AVFrame *frame)
> >> >  return 0;
> >> >  }
> >> >
> >> > +#define AV_W8(p, v) *(p) = (v)
> >> > +
> >> >  CFDataRef ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx)
> >> >  {
> >> > +H264Context *h = avctx->priv_data;
> >> >  CFDataRef data = NULL;
> >> > +uint8_t *p;
> >> > +int vt_extradata_size = 6 + 3 + h->sps.data_size + 4 + 
> >> > h->pps.data_size;
> >> > +uint8_t *vt_extradata = av_malloc(vt_extradata_size);
> >> > +if (!vt_extradata)
> >> > +return NULL;
> >> >
> >> > -/* Each VCL NAL in the bitstream sent to the decoder
> >> > - * is preceded by a 4 bytes length header.
> >> > - * Change the avcC atom header if needed, to signal headers of 4 
> >> > bytes. */
> >> > -if (avctx->extradata_size >= 4 && (avctx->extradata[4] & 0x03) != 
> >> > 0x03) {
> >> > -uint8_t *rw_extradata = av_memdup(avctx->extradata, 
> >> > avctx->extradata_size);
> >> > -
> >> > -if (!rw_extradata)
> >> > -return NULL;
> >> > -
> >> > -rw_extradata[4] |= 0x03;
> >> > -
> >> > -data = CFDataCreate(kCFAllocatorDefault, rw_extradata, 
> >> > avctx->extradata_size);
> >> > -
> >> > -av_freep(&rw_extradata);
> >> > -} else {
> >> > -data = CFDataCreate(kCFAllocatorDefault, avctx->extradata, 
> >> > avctx->extradata_size);
> >> > -}
> >> > -
> >> > +p = vt_extradata;
> >> > +
> >> > +AV_W8(p + 0, 1); /* version */
> >> > +AV_W8(p + 1, h->sps.data[0]); /* profile */
> >> > +AV_W8(p + 2, h->sps.data[1]); /* profile compat */
> >> > +AV_W8(p + 3, h->sps.data[2]); /* level */
> >> > +AV_W8(p + 4, 0xff); /* 6 bits reserved (11) + 2 bits nal size 
> >> > length - 3 (11) */
> >> > +AV_W8(p + 5, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps 
> >> > (1) */
> >> > +AV_WB16(p + 6, h->sps.data_size + 1);
> >> > +AV_W8(p + 8, NAL_SPS | (3 << 5)); // NAL unit header
> >> > +memcpy(p + 9, h->sps.data, h->sps.data_size);
> >> > +p += 9 + h->sps.data_size;
> >> > +AV_W8(p + 0, 1); /* number of pps */
> >> > +AV_WB16(p + 1, h->pps.data_size + 1);
> >> > +AV_W8(p + 3, NAL_PPS | (3 << 5)); // NAL unit header
> >> > +memcpy(p + 4, h->pps.data, h->pps.data_size);
> >> > +
> >> > +p += 4 + h->pps.data_size;
> >> > +av_assert0(p - vt_extradata == vt_extradata_size);
> >> > +
> >> > +data = CFDataCreate(kCFAllocatorDefault, vt_extradata, 
> >> > vt_extradata_size);
> >> > +av_free(vt_extradata);
> >> >  return data;
> >> >  }
> >> >
> >>
> >> This will still fail spectacularly with a SPS/PPS change mid-stream. I
> >> don't suppose it somehow accepts the SPS/PPS data in-band as well?
> >
> > Well, it worked for the resolution change sample. It _should_ be using
> > SPS/PPS NALs that occur mid-stream and in-band. The h264 decoder will
> > reinitialize itself when they change (at least in most cases), and then
> > it will also reinitialize this hwaccel, which means the code above is
> > actually run in this situation. The h->sps and h->pps fields will be
> > set to whatever is actually used by the decoder at this point. So I'm
> > hoping that this change is actually pretty correct.
> 
> Is init re-called on resolution change alone, everything else the same?
> I guess it may actually work. Although there may still be other
> SPS/PPS changes that don't trigger it, so it seems a bit fragile.

The code for this is in ff_h264_decode_slice_header() (look for

Re: [FFmpeg-devel] [PATCH]lavf/rawdec: Autodetect mlp streams

2015-10-01 Thread Michael Niedermayer
On Thu, Oct 01, 2015 at 02:34:38PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch allows auto-detection of mlp, will be useful for ticket #4786.
> 
> Please comment, Carl Eugen

>  rawdec.c |   23 +++
>  1 file changed, 23 insertions(+)
> abba9ed11f76154846001b745f4efb00d6b4849e  patchmlpprobe.diff

should be ok

[...]

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


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


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/videotoolbox: fix decoding of some h264 bitstreams

2015-10-01 Thread Hendrik Leppkes
On Thu, Oct 1, 2015 at 6:39 PM, wm4  wrote:
> On Thu, 1 Oct 2015 18:29:00 +0200
> Hendrik Leppkes  wrote:
>
>> On Thu, Oct 1, 2015 at 6:13 PM, wm4  wrote:
>> > This affects Annex B streams (such as demuxed from .ts and others). It
>> > also handles the format change in reinit-large_420_8-to-small_420_8.h264
>> > correctly.
>> >
>> > Instead of passing through the extradata, create it on the fly it from
>> > the currently active SPS and PPS. Since reconstructing the PPS and SPS
>> > NALs would be very complicated and verbose, we use the NALs as they
>> > originally appeared in the bitstream.
>> >
>> > The code for writing the extradata is somewhat derived from
>> > libavformat/avc.c, but it's small and different enough that sharing it
>> > is not really worth it.
>> > ---
>> > Even though it requires changes in the general h264 decoder (previous
>> > patch), this solution is much cleaner and more robust than my patch
>> > from yesterday.
>> > ---
>> >  libavcodec/videotoolbox.c | 48 
>> > +--
>> >  1 file changed, 30 insertions(+), 18 deletions(-)
>> >
>> > diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
>> > index 9dec5fc..cc1e592 100644
>> > --- a/libavcodec/videotoolbox.c
>> > +++ b/libavcodec/videotoolbox.c
>> > @@ -77,28 +77,40 @@ int ff_videotoolbox_alloc_frame(AVCodecContext *avctx, 
>> > AVFrame *frame)
>> >  return 0;
>> >  }
>> >
>> > +#define AV_W8(p, v) *(p) = (v)
>> > +
>> >  CFDataRef ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx)
>> >  {
>> > +H264Context *h = avctx->priv_data;
>> >  CFDataRef data = NULL;
>> > +uint8_t *p;
>> > +int vt_extradata_size = 6 + 3 + h->sps.data_size + 4 + 
>> > h->pps.data_size;
>> > +uint8_t *vt_extradata = av_malloc(vt_extradata_size);
>> > +if (!vt_extradata)
>> > +return NULL;
>> >
>> > -/* Each VCL NAL in the bitstream sent to the decoder
>> > - * is preceded by a 4 bytes length header.
>> > - * Change the avcC atom header if needed, to signal headers of 4 
>> > bytes. */
>> > -if (avctx->extradata_size >= 4 && (avctx->extradata[4] & 0x03) != 
>> > 0x03) {
>> > -uint8_t *rw_extradata = av_memdup(avctx->extradata, 
>> > avctx->extradata_size);
>> > -
>> > -if (!rw_extradata)
>> > -return NULL;
>> > -
>> > -rw_extradata[4] |= 0x03;
>> > -
>> > -data = CFDataCreate(kCFAllocatorDefault, rw_extradata, 
>> > avctx->extradata_size);
>> > -
>> > -av_freep(&rw_extradata);
>> > -} else {
>> > -data = CFDataCreate(kCFAllocatorDefault, avctx->extradata, 
>> > avctx->extradata_size);
>> > -}
>> > -
>> > +p = vt_extradata;
>> > +
>> > +AV_W8(p + 0, 1); /* version */
>> > +AV_W8(p + 1, h->sps.data[0]); /* profile */
>> > +AV_W8(p + 2, h->sps.data[1]); /* profile compat */
>> > +AV_W8(p + 3, h->sps.data[2]); /* level */
>> > +AV_W8(p + 4, 0xff); /* 6 bits reserved (11) + 2 bits nal size 
>> > length - 3 (11) */
>> > +AV_W8(p + 5, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps 
>> > (1) */
>> > +AV_WB16(p + 6, h->sps.data_size + 1);
>> > +AV_W8(p + 8, NAL_SPS | (3 << 5)); // NAL unit header
>> > +memcpy(p + 9, h->sps.data, h->sps.data_size);
>> > +p += 9 + h->sps.data_size;
>> > +AV_W8(p + 0, 1); /* number of pps */
>> > +AV_WB16(p + 1, h->pps.data_size + 1);
>> > +AV_W8(p + 3, NAL_PPS | (3 << 5)); // NAL unit header
>> > +memcpy(p + 4, h->pps.data, h->pps.data_size);
>> > +
>> > +p += 4 + h->pps.data_size;
>> > +av_assert0(p - vt_extradata == vt_extradata_size);
>> > +
>> > +data = CFDataCreate(kCFAllocatorDefault, vt_extradata, 
>> > vt_extradata_size);
>> > +av_free(vt_extradata);
>> >  return data;
>> >  }
>> >
>>
>> This will still fail spectacularly with a SPS/PPS change mid-stream. I
>> don't suppose it somehow accepts the SPS/PPS data in-band as well?
>
> Well, it worked for the resolution change sample. It _should_ be using
> SPS/PPS NALs that occur mid-stream and in-band. The h264 decoder will
> reinitialize itself when they change (at least in most cases), and then
> it will also reinitialize this hwaccel, which means the code above is
> actually run in this situation. The h->sps and h->pps fields will be
> set to whatever is actually used by the decoder at this point. So I'm
> hoping that this change is actually pretty correct.

Is init re-called on resolution change alone, everything else the same?
I guess it may actually work. Although there may still be other
SPS/PPS changes that don't trigger it, so it seems a bit fragile.

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


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/videotoolbox: fix decoding of some h264 bitstreams

2015-10-01 Thread wm4
On Thu, 1 Oct 2015 18:29:00 +0200
Hendrik Leppkes  wrote:

> On Thu, Oct 1, 2015 at 6:13 PM, wm4  wrote:
> > This affects Annex B streams (such as demuxed from .ts and others). It
> > also handles the format change in reinit-large_420_8-to-small_420_8.h264
> > correctly.
> >
> > Instead of passing through the extradata, create it on the fly it from
> > the currently active SPS and PPS. Since reconstructing the PPS and SPS
> > NALs would be very complicated and verbose, we use the NALs as they
> > originally appeared in the bitstream.
> >
> > The code for writing the extradata is somewhat derived from
> > libavformat/avc.c, but it's small and different enough that sharing it
> > is not really worth it.
> > ---
> > Even though it requires changes in the general h264 decoder (previous
> > patch), this solution is much cleaner and more robust than my patch
> > from yesterday.
> > ---
> >  libavcodec/videotoolbox.c | 48 
> > +--
> >  1 file changed, 30 insertions(+), 18 deletions(-)
> >
> > diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> > index 9dec5fc..cc1e592 100644
> > --- a/libavcodec/videotoolbox.c
> > +++ b/libavcodec/videotoolbox.c
> > @@ -77,28 +77,40 @@ int ff_videotoolbox_alloc_frame(AVCodecContext *avctx, 
> > AVFrame *frame)
> >  return 0;
> >  }
> >
> > +#define AV_W8(p, v) *(p) = (v)
> > +
> >  CFDataRef ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx)
> >  {
> > +H264Context *h = avctx->priv_data;
> >  CFDataRef data = NULL;
> > +uint8_t *p;
> > +int vt_extradata_size = 6 + 3 + h->sps.data_size + 4 + 
> > h->pps.data_size;
> > +uint8_t *vt_extradata = av_malloc(vt_extradata_size);
> > +if (!vt_extradata)
> > +return NULL;
> >
> > -/* Each VCL NAL in the bitstream sent to the decoder
> > - * is preceded by a 4 bytes length header.
> > - * Change the avcC atom header if needed, to signal headers of 4 
> > bytes. */
> > -if (avctx->extradata_size >= 4 && (avctx->extradata[4] & 0x03) != 
> > 0x03) {
> > -uint8_t *rw_extradata = av_memdup(avctx->extradata, 
> > avctx->extradata_size);
> > -
> > -if (!rw_extradata)
> > -return NULL;
> > -
> > -rw_extradata[4] |= 0x03;
> > -
> > -data = CFDataCreate(kCFAllocatorDefault, rw_extradata, 
> > avctx->extradata_size);
> > -
> > -av_freep(&rw_extradata);
> > -} else {
> > -data = CFDataCreate(kCFAllocatorDefault, avctx->extradata, 
> > avctx->extradata_size);
> > -}
> > -
> > +p = vt_extradata;
> > +
> > +AV_W8(p + 0, 1); /* version */
> > +AV_W8(p + 1, h->sps.data[0]); /* profile */
> > +AV_W8(p + 2, h->sps.data[1]); /* profile compat */
> > +AV_W8(p + 3, h->sps.data[2]); /* level */
> > +AV_W8(p + 4, 0xff); /* 6 bits reserved (11) + 2 bits nal size 
> > length - 3 (11) */
> > +AV_W8(p + 5, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps 
> > (1) */
> > +AV_WB16(p + 6, h->sps.data_size + 1);
> > +AV_W8(p + 8, NAL_SPS | (3 << 5)); // NAL unit header
> > +memcpy(p + 9, h->sps.data, h->sps.data_size);
> > +p += 9 + h->sps.data_size;
> > +AV_W8(p + 0, 1); /* number of pps */
> > +AV_WB16(p + 1, h->pps.data_size + 1);
> > +AV_W8(p + 3, NAL_PPS | (3 << 5)); // NAL unit header
> > +memcpy(p + 4, h->pps.data, h->pps.data_size);
> > +
> > +p += 4 + h->pps.data_size;
> > +av_assert0(p - vt_extradata == vt_extradata_size);
> > +
> > +data = CFDataCreate(kCFAllocatorDefault, vt_extradata, 
> > vt_extradata_size);
> > +av_free(vt_extradata);
> >  return data;
> >  }
> >
> 
> This will still fail spectacularly with a SPS/PPS change mid-stream. I
> don't suppose it somehow accepts the SPS/PPS data in-band as well?

Well, it worked for the resolution change sample. It _should_ be using
SPS/PPS NALs that occur mid-stream and in-band. The h264 decoder will
reinitialize itself when they change (at least in most cases), and then
it will also reinitialize this hwaccel, which means the code above is
actually run in this situation. The h->sps and h->pps fields will be
set to whatever is actually used by the decoder at this point. So I'm
hoping that this change is actually pretty correct.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/videotoolbox: fix decoding of some h264 bitstreams

2015-10-01 Thread Hendrik Leppkes
On Thu, Oct 1, 2015 at 6:13 PM, wm4  wrote:
> This affects Annex B streams (such as demuxed from .ts and others). It
> also handles the format change in reinit-large_420_8-to-small_420_8.h264
> correctly.
>
> Instead of passing through the extradata, create it on the fly it from
> the currently active SPS and PPS. Since reconstructing the PPS and SPS
> NALs would be very complicated and verbose, we use the NALs as they
> originally appeared in the bitstream.
>
> The code for writing the extradata is somewhat derived from
> libavformat/avc.c, but it's small and different enough that sharing it
> is not really worth it.
> ---
> Even though it requires changes in the general h264 decoder (previous
> patch), this solution is much cleaner and more robust than my patch
> from yesterday.
> ---
>  libavcodec/videotoolbox.c | 48 
> +--
>  1 file changed, 30 insertions(+), 18 deletions(-)
>
> diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> index 9dec5fc..cc1e592 100644
> --- a/libavcodec/videotoolbox.c
> +++ b/libavcodec/videotoolbox.c
> @@ -77,28 +77,40 @@ int ff_videotoolbox_alloc_frame(AVCodecContext *avctx, 
> AVFrame *frame)
>  return 0;
>  }
>
> +#define AV_W8(p, v) *(p) = (v)
> +
>  CFDataRef ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx)
>  {
> +H264Context *h = avctx->priv_data;
>  CFDataRef data = NULL;
> +uint8_t *p;
> +int vt_extradata_size = 6 + 3 + h->sps.data_size + 4 + h->pps.data_size;
> +uint8_t *vt_extradata = av_malloc(vt_extradata_size);
> +if (!vt_extradata)
> +return NULL;
>
> -/* Each VCL NAL in the bitstream sent to the decoder
> - * is preceded by a 4 bytes length header.
> - * Change the avcC atom header if needed, to signal headers of 4 bytes. 
> */
> -if (avctx->extradata_size >= 4 && (avctx->extradata[4] & 0x03) != 0x03) {
> -uint8_t *rw_extradata = av_memdup(avctx->extradata, 
> avctx->extradata_size);
> -
> -if (!rw_extradata)
> -return NULL;
> -
> -rw_extradata[4] |= 0x03;
> -
> -data = CFDataCreate(kCFAllocatorDefault, rw_extradata, 
> avctx->extradata_size);
> -
> -av_freep(&rw_extradata);
> -} else {
> -data = CFDataCreate(kCFAllocatorDefault, avctx->extradata, 
> avctx->extradata_size);
> -}
> -
> +p = vt_extradata;
> +
> +AV_W8(p + 0, 1); /* version */
> +AV_W8(p + 1, h->sps.data[0]); /* profile */
> +AV_W8(p + 2, h->sps.data[1]); /* profile compat */
> +AV_W8(p + 3, h->sps.data[2]); /* level */
> +AV_W8(p + 4, 0xff); /* 6 bits reserved (11) + 2 bits nal size length 
> - 3 (11) */
> +AV_W8(p + 5, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps 
> (1) */
> +AV_WB16(p + 6, h->sps.data_size + 1);
> +AV_W8(p + 8, NAL_SPS | (3 << 5)); // NAL unit header
> +memcpy(p + 9, h->sps.data, h->sps.data_size);
> +p += 9 + h->sps.data_size;
> +AV_W8(p + 0, 1); /* number of pps */
> +AV_WB16(p + 1, h->pps.data_size + 1);
> +AV_W8(p + 3, NAL_PPS | (3 << 5)); // NAL unit header
> +memcpy(p + 4, h->pps.data, h->pps.data_size);
> +
> +p += 4 + h->pps.data_size;
> +av_assert0(p - vt_extradata == vt_extradata_size);
> +
> +data = CFDataCreate(kCFAllocatorDefault, vt_extradata, 
> vt_extradata_size);
> +av_free(vt_extradata);
>  return data;
>  }
>

This will still fail spectacularly with a SPS/PPS change mid-stream. I
don't suppose it somehow accepts the SPS/PPS data in-band as well?

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


[FFmpeg-devel] [PATCH 2/2] avcodec/videotoolbox: fix decoding of some h264 bitstreams

2015-10-01 Thread wm4
This affects Annex B streams (such as demuxed from .ts and others). It
also handles the format change in reinit-large_420_8-to-small_420_8.h264
correctly.

Instead of passing through the extradata, create it on the fly it from
the currently active SPS and PPS. Since reconstructing the PPS and SPS
NALs would be very complicated and verbose, we use the NALs as they
originally appeared in the bitstream.

The code for writing the extradata is somewhat derived from
libavformat/avc.c, but it's small and different enough that sharing it
is not really worth it.
---
Even though it requires changes in the general h264 decoder (previous
patch), this solution is much cleaner and more robust than my patch
from yesterday.
---
 libavcodec/videotoolbox.c | 48 +--
 1 file changed, 30 insertions(+), 18 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 9dec5fc..cc1e592 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -77,28 +77,40 @@ int ff_videotoolbox_alloc_frame(AVCodecContext *avctx, 
AVFrame *frame)
 return 0;
 }
 
+#define AV_W8(p, v) *(p) = (v)
+
 CFDataRef ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx)
 {
+H264Context *h = avctx->priv_data;
 CFDataRef data = NULL;
+uint8_t *p;
+int vt_extradata_size = 6 + 3 + h->sps.data_size + 4 + h->pps.data_size;
+uint8_t *vt_extradata = av_malloc(vt_extradata_size);
+if (!vt_extradata)
+return NULL;
 
-/* Each VCL NAL in the bitstream sent to the decoder
- * is preceded by a 4 bytes length header.
- * Change the avcC atom header if needed, to signal headers of 4 bytes. */
-if (avctx->extradata_size >= 4 && (avctx->extradata[4] & 0x03) != 0x03) {
-uint8_t *rw_extradata = av_memdup(avctx->extradata, 
avctx->extradata_size);
-
-if (!rw_extradata)
-return NULL;
-
-rw_extradata[4] |= 0x03;
-
-data = CFDataCreate(kCFAllocatorDefault, rw_extradata, 
avctx->extradata_size);
-
-av_freep(&rw_extradata);
-} else {
-data = CFDataCreate(kCFAllocatorDefault, avctx->extradata, 
avctx->extradata_size);
-}
-
+p = vt_extradata;
+
+AV_W8(p + 0, 1); /* version */
+AV_W8(p + 1, h->sps.data[0]); /* profile */
+AV_W8(p + 2, h->sps.data[1]); /* profile compat */
+AV_W8(p + 3, h->sps.data[2]); /* level */
+AV_W8(p + 4, 0xff); /* 6 bits reserved (11) + 2 bits nal size length - 
3 (11) */
+AV_W8(p + 5, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps 
(1) */
+AV_WB16(p + 6, h->sps.data_size + 1);
+AV_W8(p + 8, NAL_SPS | (3 << 5)); // NAL unit header
+memcpy(p + 9, h->sps.data, h->sps.data_size);
+p += 9 + h->sps.data_size;
+AV_W8(p + 0, 1); /* number of pps */
+AV_WB16(p + 1, h->pps.data_size + 1);
+AV_W8(p + 3, NAL_PPS | (3 << 5)); // NAL unit header
+memcpy(p + 4, h->pps.data, h->pps.data_size);
+
+p += 4 + h->pps.data_size;
+av_assert0(p - vt_extradata == vt_extradata_size);
+
+data = CFDataCreate(kCFAllocatorDefault, vt_extradata, vt_extradata_size);
+av_free(vt_extradata);
 return data;
 }
 
-- 
2.5.1

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


[FFmpeg-devel] [PATCH 1/2] avcodec/h264: keep SPS and PPS bitstream data

2015-10-01 Thread wm4
Needed for the following VideotoolBox commit.
---
 libavcodec/h264.h|  4 
 libavcodec/h264_ps.c | 20 
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 7356288..eeb2aaf 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -229,6 +229,8 @@ typedef struct SPS {
 int residual_color_transform_flag;///< residual_colour_transform_flag
 int constraint_set_flags; ///< constraint_set[0-3]_flag
 int new;  ///< flag to keep track if the 
decoder context needs re-init due to changed SPS
+uint8_t data[1 << 16];
+int data_size;
 } SPS;
 
 /**
@@ -254,6 +256,8 @@ typedef struct PPS {
 uint8_t scaling_matrix8[6][64];
 uint8_t chroma_qp_table[2][QP_MAX_NUM+1];  ///< pre-scaled (with 
chroma_qp_index_offset) version of qp_table
 int chroma_qp_diff;
+uint8_t data[1 << 16];
+int data_size;
 } PPS;
 
 /**
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 52d235c..fd16a95 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -307,6 +307,15 @@ int ff_h264_decode_seq_parameter_set(H264Context *h, int 
ignore_truncation)
 int i, log2_max_frame_num_minus4;
 SPS *sps;
 
+sps = av_mallocz(sizeof(SPS));
+if (!sps)
+return AVERROR(ENOMEM);
+
+sps->data_size = h->gb.buffer_end - h->gb.buffer;
+if (sps->data_size > sizeof(sps->data))
+goto fail;
+memcpy(sps->data, h->gb.buffer, sps->data_size);
+
 profile_idc   = get_bits(&h->gb, 8);
 constraint_set_flags |= get_bits1(&h->gb) << 0;   // constraint_set0_flag
 constraint_set_flags |= get_bits1(&h->gb) << 1;   // constraint_set1_flag
@@ -320,11 +329,8 @@ int ff_h264_decode_seq_parameter_set(H264Context *h, int 
ignore_truncation)
 
 if (sps_id >= MAX_SPS_COUNT) {
 av_log(h->avctx, AV_LOG_ERROR, "sps_id %u out of range\n", sps_id);
-return AVERROR_INVALIDDATA;
+goto fail;
 }
-sps = av_mallocz(sizeof(SPS));
-if (!sps)
-return AVERROR(ENOMEM);
 
 sps->sps_id   = sps_id;
 sps->time_offset_length   = 24;
@@ -603,6 +609,12 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, 
int bit_length)
 pps = av_mallocz(sizeof(PPS));
 if (!pps)
 return AVERROR(ENOMEM);
+pps->data_size = h->gb.buffer_end - h->gb.buffer;
+if (pps->data_size > sizeof(pps->data)) {
+ret = AVERROR_INVALIDDATA;
+goto fail;
+}
+memcpy(pps->data, h->gb.buffer, pps->data_size);
 pps->sps_id = get_ue_golomb_31(&h->gb);
 if ((unsigned)pps->sps_id >= MAX_SPS_COUNT ||
 !h->sps_buffers[pps->sps_id]) {
-- 
2.5.1

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


[FFmpeg-devel] [PATCH v2] x86inc: Make cpuflag() and notcpuflag() return 0 or 1

2015-10-01 Thread Henrik Gramner
Makes it possible to use them in arithmetic expressions.
---
v2: Add a comment explaining what cpuflag() does for api doc purposes.
---
 libavutil/x86/x86inc.asm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavutil/x86/x86inc.asm b/libavutil/x86/x86inc.asm
index 6ad9785..afcd6b8 100644
--- a/libavutil/x86/x86inc.asm
+++ b/libavutil/x86/x86inc.asm
@@ -773,8 +773,9 @@ BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg, jge, 
jng, jnge, ja, jae,
 %assign cpuflags_bmi1 (1<<22)|cpuflags_lzcnt
 %assign cpuflags_bmi2 (1<<23)|cpuflags_bmi1
 
-%definecpuflag(x) ((cpuflags & (cpuflags_ %+ x)) == (cpuflags_ %+ x))
-%define notcpuflag(x) ((cpuflags & (cpuflags_ %+ x)) != (cpuflags_ %+ x))
+; Returns a boolean value expressing whether or not the specified cpuflag is 
enabled.
+%definecpuflag(x) (cpuflags & (cpuflags_ %+ x)) ^ (cpuflags_ %+ x)) - 
1) >> 31) & 1)
+%define notcpuflag(x) (cpuflag(x) ^ 1)
 
 ; Takes an arbitrary number of cpuflags from the above list.
 ; All subsequent functions (up to the next INIT_CPUFLAGS) is built for the 
specified cpu.
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH] qsvenc.c: use query function to catch all kind of setting issues

2015-10-01 Thread Michael Niedermayer
On Thu, Oct 01, 2015 at 04:27:00PM +0300, Ivan Uskov wrote:
> Hello Sven,
> 
> >> fatal: corrupt patch at line 10
> 
> SD> Sorry, no idea what went wrong ... anyway - patch attached.
> I have tested this patch, looks good to me.

applied

thanks

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

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


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


Re: [FFmpeg-devel] [PATCH][RFC] avcodec: Don't lock during open if the codec has threadsafe init

2015-10-01 Thread Derek Buitenhuis
On 10/1/2015 3:37 PM, Derek Buitenhuis wrote:
> Signed-off-by: Derek Buitenhuis 
> ---
>  libavcodec/internal.h |  2 +-
>  libavcodec/utils.c| 19 ---
>  2 files changed, 13 insertions(+), 8 deletions(-)

Sorry for the double-email.

Ignore this one.

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


[FFmpeg-devel] [PATCH][RFC] avcodec: Don't lock during open if the codec has threadsafe init

2015-10-01 Thread Derek Buitenhuis
Signed-off-by: Derek Buitenhuis 
---
 libavcodec/internal.h |  2 +-
 libavcodec/utils.c| 19 ---
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 52b8917..324f099 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -182,7 +182,7 @@ void avpriv_color_frame(AVFrame *frame, const int color[4]);
 
 extern volatile int ff_avcodec_locked;
 int ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec);
-int ff_unlock_avcodec(void);
+int ff_unlock_avcodec(const AVCodec *codec);
 
 int avpriv_lock_avformat(void);
 int avpriv_unlock_avformat(void);
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index c2ded45..7bfd760 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1145,7 +1145,7 @@ int attribute_align_arg 
ff_codec_open2_recursive(AVCodecContext *avctx, const AV
 {
 int ret = 0;
 
-ff_unlock_avcodec();
+ff_unlock_avcodec(codec);
 
 ret = avcodec_open2(avctx, codec, options);
 
@@ -1306,7 +1306,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
 av_log(avctx, AV_LOG_WARNING, "Warning: not compiled with thread 
support, using thread emulation\n");
 
 if (CONFIG_FRAME_THREAD_ENCODER) {
-ff_unlock_avcodec(); //we will instanciate a few encoders thus kick 
the counter to prevent false detection of a problem
+ff_unlock_avcodec(codec); //we will instanciate a few encoders thus 
kick the counter to prevent false detection of a problem
 ret = ff_frame_thread_encoder_init(avctx, options ? *options : NULL);
 ff_lock_avcodec(avctx, codec);
 if (ret < 0)
@@ -1553,7 +1553,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 }
 
 end:
-ff_unlock_avcodec();
+ff_unlock_avcodec(codec);
 if (options) {
 av_dict_free(options);
 *options = tmp;
@@ -3266,13 +3266,15 @@ int av_lockmgr_register(int (*cb)(void **mutex, enum 
AVLockOp op))
 
 int ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec)
 {
+if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE)
+return 0;
+
 if (lockmgr_cb) {
 if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN))
 return -1;
 }
 
-if (avpriv_atomic_int_add_and_fetch(&entangled_thread_counter, 1) != 1 &&
-!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE)) {
+if (avpriv_atomic_int_add_and_fetch(&entangled_thread_counter, 1) != 1) {
 av_log(log_ctx, AV_LOG_ERROR,
"Insufficient thread locking. At least %d threads are "
"calling avcodec_open2() at the same time right now.\n",
@@ -3280,7 +3282,7 @@ int ff_lock_avcodec(AVCodecContext *log_ctx, const 
AVCodec *codec)
 if (!lockmgr_cb)
 av_log(log_ctx, AV_LOG_ERROR, "No lock manager is set, please see 
av_lockmgr_register()\n");
 ff_avcodec_locked = 1;
-ff_unlock_avcodec();
+ff_unlock_avcodec(codec);
 return AVERROR(EINVAL);
 }
 av_assert0(!ff_avcodec_locked);
@@ -3288,8 +3290,11 @@ int ff_lock_avcodec(AVCodecContext *log_ctx, const 
AVCodec *codec)
 return 0;
 }
 
-int ff_unlock_avcodec(void)
+int ff_unlock_avcodec(const AVCodec *codec)
 {
+if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE)
+return 0;
+
 av_assert0(ff_avcodec_locked);
 ff_avcodec_locked = 0;
 avpriv_atomic_int_add_and_fetch(&entangled_thread_counter, -1);
-- 
1.8.3.1

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


[FFmpeg-devel] [PATCH][RFC] avcodec: Don't lock during open if the codec has threadsafe init

2015-10-01 Thread Derek Buitenhuis
Signed-off-by: Derek Buitenhuis 
---
 libavcodec/internal.h |  2 +-
 libavcodec/utils.c| 19 ---
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 52b8917..324f099 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -182,7 +182,7 @@ void avpriv_color_frame(AVFrame *frame, const int color[4]);
 
 extern volatile int ff_avcodec_locked;
 int ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec);
-int ff_unlock_avcodec(void);
+int ff_unlock_avcodec(const AVCodec *codec);
 
 int avpriv_lock_avformat(void);
 int avpriv_unlock_avformat(void);
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index c2ded45..7bfd760 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1145,7 +1145,7 @@ int attribute_align_arg 
ff_codec_open2_recursive(AVCodecContext *avctx, const AV
 {
 int ret = 0;
 
-ff_unlock_avcodec();
+ff_unlock_avcodec(codec);
 
 ret = avcodec_open2(avctx, codec, options);
 
@@ -1306,7 +1306,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
 av_log(avctx, AV_LOG_WARNING, "Warning: not compiled with thread 
support, using thread emulation\n");
 
 if (CONFIG_FRAME_THREAD_ENCODER) {
-ff_unlock_avcodec(); //we will instanciate a few encoders thus kick 
the counter to prevent false detection of a problem
+ff_unlock_avcodec(codec); //we will instanciate a few encoders thus 
kick the counter to prevent false detection of a problem
 ret = ff_frame_thread_encoder_init(avctx, options ? *options : NULL);
 ff_lock_avcodec(avctx, codec);
 if (ret < 0)
@@ -1553,7 +1553,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 }
 
 end:
-ff_unlock_avcodec();
+ff_unlock_avcodec(codec);
 if (options) {
 av_dict_free(options);
 *options = tmp;
@@ -3266,13 +3266,15 @@ int av_lockmgr_register(int (*cb)(void **mutex, enum 
AVLockOp op))
 
 int ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec)
 {
+if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE)
+return 0;
+
 if (lockmgr_cb) {
 if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN))
 return -1;
 }
 
-if (avpriv_atomic_int_add_and_fetch(&entangled_thread_counter, 1) != 1 &&
-!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE)) {
+if (avpriv_atomic_int_add_and_fetch(&entangled_thread_counter, 1) != 1) {
 av_log(log_ctx, AV_LOG_ERROR,
"Insufficient thread locking. At least %d threads are "
"calling avcodec_open2() at the same time right now.\n",
@@ -3280,7 +3282,7 @@ int ff_lock_avcodec(AVCodecContext *log_ctx, const 
AVCodec *codec)
 if (!lockmgr_cb)
 av_log(log_ctx, AV_LOG_ERROR, "No lock manager is set, please see 
av_lockmgr_register()\n");
 ff_avcodec_locked = 1;
-ff_unlock_avcodec();
+ff_unlock_avcodec(codec);
 return AVERROR(EINVAL);
 }
 av_assert0(!ff_avcodec_locked);
@@ -3288,8 +3290,11 @@ int ff_lock_avcodec(AVCodecContext *log_ctx, const 
AVCodec *codec)
 return 0;
 }
 
-int ff_unlock_avcodec(void)
+int ff_unlock_avcodec(const AVCodec *codec)
 {
+if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE)
+return 0;
+
 av_assert0(ff_avcodec_locked);
 ff_avcodec_locked = 0;
 avpriv_atomic_int_add_and_fetch(&entangled_thread_counter, -1);
-- 
1.8.3.1

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


Re: [FFmpeg-devel] [PATCH] blockdsp: remove high bit depth parameter

2015-10-01 Thread Ronald S. Bultje
Hi,

On Thu, Oct 1, 2015 at 9:26 AM, Christophe Gisquet <
christophe.gisq...@gmail.com> wrote:

> 2015-10-01 14:40 GMT+02:00 Ronald S. Bultje :
> > bash-3.2$ grep ff_pixblockdsp_init ../libavcodec/*
> > ../libavcodec/asvenc.c:ff_pixblockdsp_init(&a->pdsp, avctx);
> > ../libavcodec/avdct.c:ff_pixblockdsp_init(&pdsp, avctx);
> > ../libavcodec/dnxhdenc.c:ff_pixblockdsp_init(&ctx->m.pdsp, avctx);
> > ../libavcodec/dvenc.c:ff_pixblockdsp_init(&pdsp, avctx);
> > ../libavcodec/mpegvideo_enc.c:ff_pixblockdsp_init(&s->pdsp, avctx);
> >
> > bash-3.2$ grep AV_PIX_FMT ../libavcodec/dvenc.c ../libavcodec/dnxhdenc.c
> > ../libavcodec/mpegvideo_enc.c ../libavcodec/asvenc.c
> > ../libavcodec/dnxhdenc.c:case AV_PIX_FMT_YUV422P10:
> > ../libavcodec/dnxhdenc.c:AV_PIX_FMT_YUV422P10,
> >
> > bash-3.2$ grep clear_block ../libavcodec/dnxhdenc.c
> > ctx->bdsp.clear_block(ctx->blocks[4]);
> > ctx->bdsp.clear_block(ctx->blocks[5]);
> > ctx->bdsp.clear_block(ctx->blocks[6]);
> > ctx->bdsp.clear_block(ctx->blocks[7]);
> >
> > So this may break 10bit dnxhd encoding.
>
> Well, that's part of the routine of what I've been testing since a
> while, and it doesn't seem so. But that's not a very convincing
> argument.
>
> But I'm not sure what you are finding with your greps. That dnxhdenc
> is actually using clear_block depending on the highbitdepth parameter?
> In dnxhdenc, ctx->blocks are still 16bits dct coeffs blocks, as in all
> of those codecs. There's 12 bit content and support incoming, but even
> there, coeffs are 15bits (DC is).


OK, that's basically what I was wondering about. If the dct coef types are
bitdepth independent (as seems to be the case), your patch should be OK.

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


Re: [FFmpeg-devel] [PATCH] qsvenc.c: use query function to catch all kind of setting issues

2015-10-01 Thread Ivan Uskov
Hello Sven,

>> fatal: corrupt patch at line 10

SD> Sorry, no idea what went wrong ... anyway - patch attached.
I have tested this patch, looks good to me.


-- 
Best regards,
 Ivanmailto:ivan.us...@nablet.com

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


Re: [FFmpeg-devel] [PATCH] blockdsp: remove high bit depth parameter

2015-10-01 Thread Christophe Gisquet
2015-10-01 14:40 GMT+02:00 Ronald S. Bultje :
> bash-3.2$ grep ff_pixblockdsp_init ../libavcodec/*
> ../libavcodec/asvenc.c:ff_pixblockdsp_init(&a->pdsp, avctx);
> ../libavcodec/avdct.c:ff_pixblockdsp_init(&pdsp, avctx);
> ../libavcodec/dnxhdenc.c:ff_pixblockdsp_init(&ctx->m.pdsp, avctx);
> ../libavcodec/dvenc.c:ff_pixblockdsp_init(&pdsp, avctx);
> ../libavcodec/mpegvideo_enc.c:ff_pixblockdsp_init(&s->pdsp, avctx);
>
> bash-3.2$ grep AV_PIX_FMT ../libavcodec/dvenc.c ../libavcodec/dnxhdenc.c
> ../libavcodec/mpegvideo_enc.c ../libavcodec/asvenc.c
> ../libavcodec/dnxhdenc.c:case AV_PIX_FMT_YUV422P10:
> ../libavcodec/dnxhdenc.c:AV_PIX_FMT_YUV422P10,
>
> bash-3.2$ grep clear_block ../libavcodec/dnxhdenc.c
> ctx->bdsp.clear_block(ctx->blocks[4]);
> ctx->bdsp.clear_block(ctx->blocks[5]);
> ctx->bdsp.clear_block(ctx->blocks[6]);
> ctx->bdsp.clear_block(ctx->blocks[7]);
>
> So this may break 10bit dnxhd encoding.

Well, that's part of the routine of what I've been testing since a
while, and it doesn't seem so. But that's not a very convincing
argument.

But I'm not sure what you are finding with your greps. That dnxhdenc
is actually using clear_block depending on the highbitdepth parameter?
In dnxhdenc, ctx->blocks are still 16bits dct coeffs blocks, as in all
of those codecs. There's 12 bit content and support incoming, but even
there, coeffs are 15bits (DC is).

Also, from the patch, you can notice that in the old code that:
- clear_block is by default set to clear_block_8_c (and clears 128
bytes of data); equivalent for clear_blocks
- some archs actually don't care about the parameter and always set
clear_block* (MIPS MSA/MMI)

Furthermore:
$ grep -rn 'clear_block *=' ../libavcodec/
../libavcodec/arm/blockdsp_init_neon.c:34:c->clear_block  =
ff_clear_block_neon;
../libavcodec/blockdsp.c:62:c->clear_block  = clear_block_8_c;
../libavcodec/mips/blockdsp_init_mips.c:28:c->clear_block =
ff_clear_block_msa;
../libavcodec/mips/blockdsp_init_mips.c:40:c->clear_block =
ff_clear_block_mmi;
../libavcodec/ppc/blockdsp.c:167:c->clear_block = clear_block_altivec;
../libavcodec/x86/blockdsp_init.c:42:c->clear_block  =
ff_clear_block_mmx;
../libavcodec/x86/blockdsp_init.c:51:c->clear_block  =
ff_clear_block_sse;

I've checked that all these implementations always apply to 64*2
bytes, and there's no clear_block implementation that sets another
amount. Clearly, if code expects clear_block to do that, there'd be
failures.

I don't know when that parameter has become unused, but it really is,
as otherwise there is the array fill_block_tab indexed by pixel
bytewidth for other dsp functions. I don't think anybody uses it for
>16 bits samples.

Erring away from just this, it is even more so incorrect that
clear_block* are located in a "pixelblock" context, while they are
only ever applied to dct blocks.

It belongs more to the idct context, which also use another
highbitdepth parameter solely based on raw bits per sample, which
should be the actual value used:
$ grep -rn bits_per_raw_sample ../libavcodec/ | grep -i idct
../libavcodec/idctdsp.c:243:const unsigned high_bit_depth =
avctx->bits_per_raw_sample > 8;
../libavcodec/idctdsp.c:261:if (avctx->bits_per_raw_sample ==
10 || avctx->bits_per_raw_sample == 9) {
../libavcodec/idctdsp.c:266:} else if
(avctx->bits_per_raw_sample == 12) {
../libavcodec/mips/idctdsp_init_mips.c:29:
(avctx->bits_per_raw_sample != 10) &&
../libavcodec/mips/idctdsp_init_mips.c:30:
(avctx->bits_per_raw_sample != 12) &&
../libavcodec/mips/idctdsp_init_mips.c:49:
(avctx->bits_per_raw_sample != 10) &&
../libavcodec/mips/idctdsp_init_mips.c:50:
(avctx->bits_per_raw_sample != 12) &&
../libavcodec/xvididct.c:335:const unsigned high_bit_depth =
avctx->bits_per_raw_sample > 8;

At the very worst, if something requires more than 16 bits dct coeffs,
then another bitdepth parameter is needed, but that's a different
issue

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


Re: [FFmpeg-devel] [PATCH] qsvenc.c: use query function to catch all kind of setting issues

2015-10-01 Thread Sven Dueking


> -Ursprüngliche Nachricht-
> Von: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] Im Auftrag
> von Michael Niedermayer
> Gesendet: Mittwoch, 30. September 2015 22:47
> An: FFmpeg development discussions and patches
> Betreff: Re: [FFmpeg-devel] [PATCH] qsvenc.c: use query function to
> catch all kind of setting issues
> 
> On Wed, Sep 30, 2015 at 04:19:15PM +0200, Sven Dueking wrote:
> > From 86ddf1095bfd557324f6eeb24d94cbd0a6818c10 Mon Sep 17 00:00:00
> 2001
> > From: Sven Dueking 
> > Date: Wed, 30 Sep 2015 16:06:02 +0200
> > Subject: [FFmpeg-devel] [PATCH] qsvenc.c: use query function to catch
> > all kind of setting issues
> >
> > ---
> >  libavcodec/qsvenc.c | 8 
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index
> > 1013fe1..55140e1 100644
> > --- a/libavcodec/qsvenc.c
> > +++ b/libavcodec/qsvenc.c
> > @@ -264,6 +264,14 @@ int ff_qsv_enc_init(AVCodecContext *avctx,
> > QSVEncContext *q)
> >  if (ret < 0)
> >  return ret;
> >
> > +ret = MFXVideoENCODE_Query(q->session, &q->param,&q->param);
> > +if (MFX_WRN_PARTIAL_ACCELERATION==ret) {
> > +av_log(avctx, AV_LOG_WARNING, "Encoder will work with
> partial
> > + HW
> > acceleration\n");
> > +} else if (ret < 0) {
> 
> Applying: qsvenc.c: use query function to catch all kind of setting
> issues
> fatal: corrupt patch at line 10

Sorry, no idea what went wrong ... anyway - patch attached.

> 
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> When the tyrant has disposed of foreign enemies by conquest or treaty,
> and there is nothing more to fear from them, then he is always stirring
> up some war or other, in order that the people may require a leader. --
> Plato


0001-use-query-to-catch-all-kind-of-setting-issues.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] blockdsp: remove high bit depth parameter

2015-10-01 Thread Ronald S. Bultje
Hi,

On Thu, Oct 1, 2015 at 8:28 AM, Christophe Gisquet <
christophe.gisq...@gmail.com> wrote:

> 2015-09-28 18:51 GMT+02:00 Christophe Gisquet <
> christophe.gisq...@gmail.com>:
> > I admit I haven't run this over all of fate, so it would be nice to
> > validate nothing actually uses it for pixels (I have see nothing of
> > the sort).
>
> Passes fate-video fate-vcodec on Win64.


Hm, let's see:

bash-3.2$ grep ff_pixblockdsp_init ../libavcodec/*
../libavcodec/asvenc.c:ff_pixblockdsp_init(&a->pdsp, avctx);
../libavcodec/avdct.c:ff_pixblockdsp_init(&pdsp, avctx);
../libavcodec/dnxhdenc.c:ff_pixblockdsp_init(&ctx->m.pdsp, avctx);
../libavcodec/dvenc.c:ff_pixblockdsp_init(&pdsp, avctx);
../libavcodec/mpegvideo_enc.c:ff_pixblockdsp_init(&s->pdsp, avctx);

bash-3.2$ grep AV_PIX_FMT ../libavcodec/dvenc.c ../libavcodec/dnxhdenc.c
../libavcodec/mpegvideo_enc.c ../libavcodec/asvenc.c
../libavcodec/dnxhdenc.c:case AV_PIX_FMT_YUV422P10:
../libavcodec/dnxhdenc.c:AV_PIX_FMT_YUV422P10,

bash-3.2$ grep clear_block ../libavcodec/dnxhdenc.c
ctx->bdsp.clear_block(ctx->blocks[4]);
ctx->bdsp.clear_block(ctx->blocks[5]);
ctx->bdsp.clear_block(ctx->blocks[6]);
ctx->bdsp.clear_block(ctx->blocks[7]);

So this may break 10bit dnxhd encoding.

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


[FFmpeg-devel] [PATCH]lavf/rawdec: Autodetect mlp streams

2015-10-01 Thread Carl Eugen Hoyos
Hi!

Attached patch allows auto-detection of mlp, will be useful for ticket #4786.

Please comment, Carl Eugen
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index 7684e1d..56ac199 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -207,9 +207,32 @@ FF_DEF_RAWVIDEO_DEMUXER2(mjpeg, "raw MJPEG video", 
mjpeg_probe, "mjpg,mjpeg,mpo"
 #endif
 
 #if CONFIG_MLP_DEMUXER
+static int mlp_probe(AVProbeData *p)
+{
+const uint8_t *buf, *last_buf = p->buf, *end = p->buf + p->buf_size;
+int frames = 0, valid = 0, size = 0;
+
+for (buf = p->buf; buf + 8 <= end; buf++) {
+if (AV_RB32(buf + 4) == 0xf8726fbb) {
+frames++;
+if (last_buf + size == buf) {
+valid++;
+}
+last_buf = buf;
+size = (AV_RB16(buf) & 0xfff) * 2;
+} else if (buf - last_buf == size) {
+size += (AV_RB16(buf) & 0xfff) * 2;
+}
+}
+if (valid >= 100)
+return AVPROBE_SCORE_MAX;
+return 0;
+}
+
 AVInputFormat ff_mlp_demuxer = {
 .name   = "mlp",
 .long_name  = NULL_IF_CONFIG_SMALL("raw MLP"),
+.read_probe = mlp_probe,
 .read_header= ff_raw_audio_read_header,
 .read_packet= ff_raw_read_partial_packet,
 .flags  = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/flacdec: support fast-seek

2015-10-01 Thread Michael Niedermayer
On Fri, Sep 25, 2015 at 11:58:31AM +0800, Ching-Yi Chan wrote:
> Thanks for checking.
> 
> I also check the AVFMT_FLAG_FAST_SEEK flag with parsing headers,
> to fill the seektable into index entries only if AVFMT_FLAG_FAST_SEEK flag
> is on.
> 
> If the AVFMT_FLAG_FAST_SEEK flag is not enabled, it will seek in original
> way.

i think we misunderstand us somehow

your code does not work for me
seeking to  1.894167 results in a seek to
pts: 0.00 pos:   8256

seeking to  1.470835 results in a seek to
pts: 0.809796 pos:  27366

you notice that moving the target to a later point moves the result
to a earlier one.

please see below for further comments

[...]

> +#define SEEKPOINT_SIZE 18
> +
> +static void ff_reset_index_position(int64_t metadata_head_size, AVStream *st)

the ff_ prefix is for non static functions


[...9

> @@ -249,12 +277,30 @@ static av_unused int64_t 
> flac_read_timestamp(AVFormatContext *s, int stream_inde
>  return pts;
>  }
>  
> +static int flac_seek(AVFormatContext *s, int stream_index, int64_t 
> timestamp, int flags) {
> +if (!(s->flags&AVFMT_FLAG_FAST_SEEK)) {
> +return -1;
> +}
> +
> +int index = av_index_search_timestamp(s->streams[0], timestamp, flags);

libavformat/flacdec.c:285:5: warning: ISO C90 forbids mixed declarations and 
code [-Wdeclaration-after-statement]
libavformat/flacdec.c:289:5: warning: ISO C90 forbids mixed declarations and 
code [-Wdeclaration-after-statement]

please make sure your patch adds no compiler warnings


> +if(index<0 || index >= s->streams[0]->nb_index_entries)
> +return -1;
> +
> +AVIndexEntry e = s->streams[0]->index_entries[index];

> +int ret = avio_seek(s->pb, e.pos, SEEK_SET);

this is wrong and must use int64_t otherwise the following >= 0 check
can be wrong

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator


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


Re: [FFmpeg-devel] [PATCH] blockdsp: remove high bit depth parameter

2015-10-01 Thread Christophe Gisquet
2015-09-28 18:51 GMT+02:00 Christophe Gisquet :
> I admit I haven't run this over all of fate, so it would be nice to
> validate nothing actually uses it for pixels (I have see nothing of
> the sort).

Passes fate-video fate-vcodec on Win64.

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


Re: [FFmpeg-devel] [PATCH] ffplay: more robust mutex, condition variable handling

2015-10-01 Thread Ganesh Ajjanagadde
On Sep 30, 2015 7:50 PM, "Marton Balint"  wrote:
>
>
> On Tue, 29 Sep 2015, Ganesh Ajjanagadde wrote:
>
>> SDL_CreateMutex and SDL_CreateCond can fail:
>> https://wiki.libsdl.org/SDL_CreateMutex.
>> This patch makes handling more robust in one instance.
>>
>> Signed-off-by: Ganesh Ajjanagadde 
>> ---
>> ffplay.c | 17 +
>> 1 file changed, 13 insertions(+), 4 deletions(-)
>>
>> diff --git a/ffplay.c b/ffplay.c
>> index 3c2407f..9466996 100644
>> --- a/ffplay.c
>> +++ b/ffplay.c
>> @@ -451,12 +451,21 @@ static int packet_queue_put_nullpacket(PacketQueue
*q, int stream_index)
>> }
>>
>> /* packet queue handling */
>> -static void packet_queue_init(PacketQueue *q)
>> +static int packet_queue_init(PacketQueue *q)
>> {
>> memset(q, 0, sizeof(PacketQueue));
>> q->mutex = SDL_CreateMutex();
>> +if (!q->mutex) {
>> +av_log(q, AV_LOG_FATAL, "SDL_CreateMutex(): %s\n",
SDL_GetError());
>> +return AVERROR(ENOMEM);
>> +}
>> q->cond = SDL_CreateCond();
>> +if (!q->cond) {
>> +av_log(q, AV_LOG_FATAL, "SDL_CreateCond(): %s\n",
SDL_GetError());
>> +return AVERROR(ENOMEM);
>> +}
>> q->abort_request = 1;
>> +return 0;
>> }
>>
>> static void packet_queue_flush(PacketQueue *q)
>> @@ -3136,9 +3145,9 @@ static VideoState *stream_open(const char
*filename, AVInputFormat *iformat)
>> if (frame_queue_init(&is->sampq, &is->audioq, SAMPLE_QUEUE_SIZE, 1)
< 0)
>> goto fail;
>>
>> -packet_queue_init(&is->videoq);
>> -packet_queue_init(&is->audioq);
>> -packet_queue_init(&is->subtitleq);
>> +if (packet_queue_init(&is->videoq) || packet_queue_init(&is->audioq)
>> +|| packet_queue_init(&is->subtitleq))
>> +goto fail;
>
>
> Only cosmetics, but maybe you could use ffmpeg-api-like less-than-zero
error checking with common indentation:
>
> if (packet_queue_init() < 0 ||
> packet_queue_init() < 0 ||
> packet_queue_init() < 0)

Thanks for the style tip. I am currently away from a machine, will get to
it in a few days.

>
> Regards,
> Marton
> ___
> 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]select attribute of tee pseudo demuxer may contain multiple stream specifiers

2015-10-01 Thread Bodecs Bela
thank you for your feedback, I have altered the patch accordingly. I 
have enclosed the updated patch file.


bb

2015.10.01. 10:44 keltezéssel, Moritz Barsnick írta:

-all the input streams.
+all the input streams. You may use multiple stream specifiers
+separated by commas (,)  eg.: a:0,v

eg. -> e.g. (and you have double spaces there, "  ").

And I prefer "(@code{,})" and "@code{a:0,v}", but perhaps that's a
matter of preference, not sure about this yet.

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


From bcbd5e3e1a850fef1002d3a63c06fc52b2a3d169 Mon Sep 17 00:00:00 2001
From: Bela Bodecs 
Date: Thu, 1 Oct 2015 13:00:50 +0200
Subject: [PATCH 1/1] select attribute of tee pseudo demuxer may contain
 multiple stream specifiers
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="1.8.3.1"

This is a multi-part message in MIME format.
--1.8.3.1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 doc/muxers.texi   |  3 ++-
 libavformat/tee.c | 32 +++-
 2 files changed, 25 insertions(+), 10 deletions(-)


--1.8.3.1
Content-Type: text/x-patch; 
name="0001-select-attribute-of-tee-pseudo-demuxer-may-contain-m.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; 
filename="0001-select-attribute-of-tee-pseudo-demuxer-may-contain-m.patch"

diff --git a/doc/muxers.texi b/doc/muxers.texi
index d75d7de..113b76a 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1224,7 +1224,8 @@ Several bitstream filters can be specified, separated by 
",".
 @item select
 Select the streams that should be mapped to the slave output,
 specified by a stream specifier. If not specified, this defaults to
-all the input streams.
+all the input streams. You may use multiple stream specifiers 
+separated by commas (@code{,}) e.g.: @code{a:0,v}
 @end table
 
 @subsection Examples
diff --git a/libavformat/tee.c b/libavformat/tee.c
index e3d466a..7d67652 100644
--- a/libavformat/tee.c
+++ b/libavformat/tee.c
@@ -47,6 +47,7 @@ static const char *const slave_opt_open  = "[";
 static const char *const slave_opt_close = "]";
 static const char *const slave_opt_delim = ":]"; /* must have the close too */
 static const char *const slave_bsfs_spec_sep = "/";
+static const char *const slave_select_sep = ",";
 
 static const AVClass tee_muxer_class = {
 .class_name = "Tee muxer",
@@ -142,7 +143,9 @@ static int open_slave(AVFormatContext *avf, char *slave, 
TeeSlave *tee_slave)
 AVFormatContext *avf2 = NULL;
 AVStream *st, *st2;
 int stream_count;
-
+int fullret;
+char *subselect = NULL, *next_subselect = NULL, *first_subselect;
+
 if ((ret = parse_slave_options(avf, slave, &options, &filename)) < 0)
 return ret;
 
@@ -172,15 +175,26 @@ static int open_slave(AVFormatContext *avf, char *slave, 
TeeSlave *tee_slave)
 for (i = 0; i < avf->nb_streams; i++) {
 st = avf->streams[i];
 if (select) {
-ret = avformat_match_stream_specifier(avf, avf->streams[i], 
select);
-if (ret < 0) {
-av_log(avf, AV_LOG_ERROR,
-   "Invalid stream specifier '%s' for output '%s'\n",
-   select, slave);
-goto end;
-}
+fullret = 0;
+first_subselect = select;
+next_subselect = NULL;
+while (subselect = av_strtok(first_subselect, slave_select_sep, 
&next_subselect)) {
+first_subselect = NULL;
+
+ret = avformat_match_stream_specifier(avf, avf->streams[i], 
subselect);
+if (ret < 0) {
+av_log(avf, AV_LOG_ERROR,
+"Invalid stream specifier '%s' for output '%s'\n",
+subselect, slave);
+goto end;
+}
+if (ret != 0) {
+fullret = 1; // match
+break;
+}
 
-if (ret == 0) { /* no match */
+}
+if (fullret == 0) { /* no match */
 tee_slave->stream_map[i] = -1;
 continue;
 }

--1.8.3.1--


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


Re: [FFmpeg-devel] [PATCH] x86/audio_convert: fix clobbering of xmm registers

2015-10-01 Thread Michael Niedermayer
On Fri, Sep 25, 2015 at 09:33:04PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libswresample/x86/audio_convert.asm | 122 
> ++--
>  1 file changed, 61 insertions(+), 61 deletions(-)

LGTM

thanks


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

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.


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


[FFmpeg-devel] [PATCH] Add space after commas in HTTP/RTSP auth header

2015-10-01 Thread Andrey Utkin
This fixes access to Grandstream cameras, which return 401 to ffmpeg
otherwise.
VLC sends Authorization: header with spaces between parameters, and it
is known to work with Grandstream devices and broad range of other HTTP
and RTSP servers, so author considers switching to such behaviour safe.
Just for record - RFC 2617 (HTTP Auth) does not specify the need in
spaces, so this is not a bug of FFmpeg.
---
 libavformat/httpauth.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavformat/httpauth.c b/libavformat/httpauth.c
index dbe3eff..18cf36b 100644
--- a/libavformat/httpauth.c
+++ b/libavformat/httpauth.c
@@ -220,21 +220,21 @@ static char *make_digest_auth(HTTPAuthState *state, const 
char *username,
 
 /* TODO: Escape the quoted strings properly. */
 av_strlcatf(authstr, len, "username=\"%s\"",   username);
-av_strlcatf(authstr, len, ",realm=\"%s\"", state->realm);
-av_strlcatf(authstr, len, ",nonce=\"%s\"", digest->nonce);
-av_strlcatf(authstr, len, ",uri=\"%s\"",   uri);
-av_strlcatf(authstr, len, ",response=\"%s\"",  response);
+av_strlcatf(authstr, len, ", realm=\"%s\"", state->realm);
+av_strlcatf(authstr, len, ", nonce=\"%s\"", digest->nonce);
+av_strlcatf(authstr, len, ", uri=\"%s\"",   uri);
+av_strlcatf(authstr, len, ", response=\"%s\"",  response);
 
 // we are violating the RFC and use "" because all others seem to do that 
too.
 if (digest->algorithm[0])
-av_strlcatf(authstr, len, ",algorithm=\"%s\"",  digest->algorithm);
+av_strlcatf(authstr, len, ", algorithm=\"%s\"",  digest->algorithm);
 
 if (digest->opaque[0])
-av_strlcatf(authstr, len, ",opaque=\"%s\"", digest->opaque);
+av_strlcatf(authstr, len, ", opaque=\"%s\"", digest->opaque);
 if (digest->qop[0]) {
-av_strlcatf(authstr, len, ",qop=\"%s\"",digest->qop);
-av_strlcatf(authstr, len, ",cnonce=\"%s\"", cnonce);
-av_strlcatf(authstr, len, ",nc=%s", nc);
+av_strlcatf(authstr, len, ", qop=\"%s\"",digest->qop);
+av_strlcatf(authstr, len, ", cnonce=\"%s\"", cnonce);
+av_strlcatf(authstr, len, ", nc=%s", nc);
 }
 
 av_strlcatf(authstr, len, "\r\n");
-- 
2.5.3

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


Re: [FFmpeg-devel] [PATCH] avfilter/af_rubberband: add process_command()

2015-10-01 Thread Michael Niedermayer
On Thu, Oct 01, 2015 at 09:44:07AM +0200, Nicolas George wrote:
> Le decadi 10 vendémiaire, an CCXXIV, Paul B Mahol a écrit :
> > > "l" is unneeded, %f is for double already
> > Clang complain if I do not give it "l".
> 
> Michael was mistaken. For variadic function calls, floats are upgraded to
> doubles, and therefore %lf is equivalent to %f for printf. But for scanf, a
> pointer to float can not be upgraded, and %f really stands for float.

i meant just the av_logs, i thought putting a empty line between
them and the previous scanf would make it clear my comment was
supposed to apply to them only. 

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH]select attribute of tee pseudo demuxer may contain multiple stream specifiers

2015-10-01 Thread Moritz Barsnick
> -all the input streams.
> +all the input streams. You may use multiple stream specifiers 
> +separated by commas (,)  eg.: a:0,v

eg. -> e.g. (and you have double spaces there, "  ").

And I prefer "(@code{,})" and "@code{a:0,v}", but perhaps that's a
matter of preference, not sure about this yet.

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


Re: [FFmpeg-devel] [PATCH]select attribute of tee pseudo demuxer may contain multiple stream specifiers

2015-10-01 Thread Bodecs Bela

Sorry I have enclosed an earlier patch file in my previous email.
This is the good one.

bb


2015.10.01. 10:22 keltezéssel, Bodecs Bela írta:
I have made it as you wrote. I replaced the strtok_r function with the 
supported one.

I also have included the modified texi file.
I have enclosed the git patch file.

bb

2015.09.30. 15:53 keltezéssel, Nicolas George írta:

Sorry for the delay.

Bodecs Bela:
currently, select option of tee pseudo muxer may contain only one 
stream

specifier. Sometimes I need to use more than one stream specifier.
So I made the following patch. It makes possible to put multiple stream
specifier into select option separated by comma.
eg. select=\'a:0,v\'
(I choose the comma character as separator because it is similar to 
tee's
bsf option separator. bsf option allows multiple value separated by 
comma)

Thanks for the patch, the feature looks useful indeed.

Please consider that put this patch into the official ffmpeg source 
tree.

p.s.:the documentation/web also should alter by this, but I do not know
where to send this:

select

Select the streams that should be mapped to the slave output,
specified by a stream specifier. If not specified, this defaults to
all the input streams.
It would be best to update the documentation in the same patch. The 
current

documentation is in doc/muxers.texi (can be found with
`git grep "Select the streams that should be mapped"`).


Patch description:
Please use git send-email or git format-patch, so that the patch 
includes
author information and commit message. Also, the patch has been 
mangled by

your mail user agent, it can not be applied as is.


  diff -u tee.c.orig tee.c
--- tee.c.orig  2015-07-09 22:22:27.0 +0200
+++ tee.c   2015-09-25 13:15:15.763273903 +0200
@@ -47,6 +47,7 @@
  static const char *const slave_opt_close = "]";
  static const char *const slave_opt_delim = ":]"; /* must have the 
close too

*/
  static const char *const slave_bsfs_spec_sep = "/";
+static const char *const slave_select_sep = ",";

  static const AVClass tee_muxer_class = {
  .class_name = "Tee muxer",
@@ -142,7 +143,9 @@
  AVFormatContext *avf2 = NULL;
  AVStream *st, *st2;
  int stream_count;
-
+int fullret;
+char *subselect = NULL, *next_subselect = NULL, *first_subselect;
+
  if ((ret = parse_slave_options(avf, slave, &options, 
&filename)) < 0)

  return ret;

@@ -172,15 +175,26 @@
  for (i = 0; i < avf->nb_streams; i++) {
  st = avf->streams[i];
  if (select) {
-ret = avformat_match_stream_specifier(avf, 
avf->streams[i],

select);
-if (ret < 0) {
-av_log(avf, AV_LOG_ERROR,
-   "Invalid stream specifier '%s' for output 
'%s'\n",

-   select, slave);
-goto end;
-}
+fullret = 0;
+first_subselect = select;
+next_subselect = NULL;
+while (subselect = strtok_r(first_subselect, 
slave_select_sep, &next_subselect)) {

strtok_r() is not portable enough, but libavutil provides av_strtok().


+first_subselect = NULL;
+
+ret = avformat_match_stream_specifier(avf, 
avf->streams[i],

subselect);
+if (ret < 0) {
+av_log(avf, AV_LOG_ERROR,
+"Invalid stream specifier '%s' for output 
'%s'\n",

+subselect, slave);
+goto end;
+}
+if (ret != 0) {
+fullret = 1; // match
+break;
+}

-if (ret == 0) { /* no match */
+}
+if (fullret == 0) { /* no match */
  tee_slave->stream_map[i] = -1;
  continue;
  }

Regards,



___
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


From 6eb4856f0058838a53170f763f395692088ea121 Mon Sep 17 00:00:00 2001
From: Bela Bodecs 
Date: Thu, 1 Oct 2015 10:31:17 +0200
Subject: [PATCH 1/1] select attribute of tee pseudo demuxer may contain
 multiple stream specifiers
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="1.8.3.1"

This is a multi-part message in MIME format.
--1.8.3.1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 doc/muxers.texi   |  3 ++-
 libavformat/tee.c | 32 +++-
 2 files changed, 25 insertions(+), 10 deletions(-)


--1.8.3.1
Content-Type: text/x-patch; 
name="0001-select-attribute-of-tee-pseudo-demuxer-may-contain-m.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; 
filename="0001-select-attribute-of-tee-pseudo-demuxer-may-

Re: [FFmpeg-devel] [PATCH]select attribute of tee pseudo demuxer may contain multiple stream specifiers

2015-10-01 Thread Bodecs Bela
I have made it as you wrote. I replaced the strtok_r function with the 
supported one.

I also have included the modified texi file.
I have enclosed the git patch file.

bb

2015.09.30. 15:53 keltezéssel, Nicolas George írta:

Sorry for the delay.

Bodecs Bela:

currently, select option of tee pseudo muxer may contain only one stream
specifier. Sometimes I need to use more than one stream specifier.
So I made the following patch. It makes possible to put multiple stream
specifier into select option separated by comma.
eg. select=\'a:0,v\'
(I choose the comma character as separator because it is similar to tee's
bsf option separator. bsf option allows multiple value separated by comma)

Thanks for the patch, the feature looks useful indeed.


Please consider that put this patch into the official ffmpeg source tree.
p.s.:the documentation/web also should alter by this, but I do not know
where to send this:

select

Select the streams that should be mapped to the slave output,
specified by a stream specifier. If not specified, this defaults to
all the input streams.

It would be best to update the documentation in the same patch. The current
documentation is in doc/muxers.texi (can be found with
`git grep "Select the streams that should be mapped"`).


Patch description:

Please use git send-email or git format-patch, so that the patch includes
author information and commit message. Also, the patch has been mangled by
your mail user agent, it can not be applied as is.


  diff -u tee.c.orig tee.c
--- tee.c.orig  2015-07-09 22:22:27.0 +0200
+++ tee.c   2015-09-25 13:15:15.763273903 +0200
@@ -47,6 +47,7 @@
  static const char *const slave_opt_close = "]";
  static const char *const slave_opt_delim = ":]"; /* must have the close too
*/
  static const char *const slave_bsfs_spec_sep = "/";
+static const char *const slave_select_sep = ",";

  static const AVClass tee_muxer_class = {
  .class_name = "Tee muxer",
@@ -142,7 +143,9 @@
  AVFormatContext *avf2 = NULL;
  AVStream *st, *st2;
  int stream_count;
-
+int fullret;
+char *subselect = NULL, *next_subselect = NULL, *first_subselect;
+
  if ((ret = parse_slave_options(avf, slave, &options, &filename)) < 0)
  return ret;

@@ -172,15 +175,26 @@
  for (i = 0; i < avf->nb_streams; i++) {
  st = avf->streams[i];
  if (select) {
-ret = avformat_match_stream_specifier(avf, avf->streams[i],
select);
-if (ret < 0) {
-av_log(avf, AV_LOG_ERROR,
-   "Invalid stream specifier '%s' for output '%s'\n",
-   select, slave);
-goto end;
-}
+fullret = 0;
+first_subselect = select;
+next_subselect = NULL;
+while (subselect = strtok_r(first_subselect, slave_select_sep, 
&next_subselect)) {

strtok_r() is not portable enough, but libavutil provides av_strtok().


+first_subselect = NULL;
+
+ret = avformat_match_stream_specifier(avf, avf->streams[i],
subselect);
+if (ret < 0) {
+av_log(avf, AV_LOG_ERROR,
+"Invalid stream specifier '%s' for output '%s'\n",
+subselect, slave);
+goto end;
+}
+if (ret != 0) {
+fullret = 1; // match
+break;
+}

-if (ret == 0) { /* no match */
+}
+if (fullret == 0) { /* no match */
  tee_slave->stream_map[i] = -1;
  continue;
  }

Regards,



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


From ea29f053a8869373af54952b4935a9e11727d6ed Mon Sep 17 00:00:00 2001
From: Bela Bodecs 
Date: Thu, 1 Oct 2015 10:17:36 +0200
Subject: [PATCH 1/1] select attribute of tee pseudo demuxer may contain
 multiple stream specifiers
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="1.8.3.1"

This is a multi-part message in MIME format.
--1.8.3.1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 doc/muxers.texi   |  3 ++-
 libavformat/tee.c | 32 +++-
 2 files changed, 25 insertions(+), 10 deletions(-)


--1.8.3.1
Content-Type: text/x-patch; 
name="0001-select-attribute-of-tee-pseudo-demuxer-may-contain-m.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; 
filename="0001-select-attribute-of-tee-pseudo-demuxer-may-contain-m.patch"

diff --git a/doc/muxers.texi b/doc/muxers.texi
index d75d7de..e8a2467 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1224,7 +1224,8 @@ Several bitstream filters can be specified, separated by 
",".
 @item select
 Select the streams that should be mapped to the slave output,
 specified b

Re: [FFmpeg-devel] [PATCH] avfilter/af_rubberband: add process_command()

2015-10-01 Thread Moritz Barsnick
On Thu, Oct 01, 2015 at 09:29:10 +0200, Paul B Mahol wrote:
> On 10/1/15, Michael Niedermayer  wrote:
> > also af_rubberband seems to fail to build with 1.3-1.2 from ubuntu

> You sure have latest version of rubberband?

1.3 is certainly not the latest version.

If that's a dependency, you'll have to add a pkgconfig version check,
or a check on RUBBERBAND_API_{MAJOR,MINOR}_VERSION with a fallback.

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


Re: [FFmpeg-devel] [PATCH] [WIP] avcodec/videotoolbox: add Annex B support

2015-10-01 Thread wm4
On Thu, 1 Oct 2015 07:33:40 + (UTC)
Carl Eugen Hoyos  wrote:

> wm4  googlemail.com> writes:
> 
> > a) move ff_isom_write_avcc() to libavcodec, and use it as avpriv_
> >from libavformat
> 
> What's the disadvantage?

avpriv functions should be avoided.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avutil: runtime cpu detection for mips

2015-10-01 Thread Shivraj Patil

On Wed, Sep 30, 2015 at 02:21:18PM +, Shivraj Patil wrote:
> 
> On Wed, Sep 30, 2015 at 07:03:46PM +0530, shivraj.pa...@imgtec.com wrote:
> > From: Shivraj Patil 
> [...]
> 
> > +static int get_cpuinfo(uint32_t *hwcap) {
> > +FILE *f = fopen("/proc/cpuinfo", "r");
> 
> under qemu i get this:
> 
> cpu_flags(raw) = 0x
> cpu_flags_str(raw) =
> cpu_flags(effective) = 0x
> cpu_flags_str(effective) =
> threads = 1 (cpu_count = 12)
> 
> IIUC this disables all cpu extensions
> is that intended ?
> (we currently only have loongson hardware to test so this would mean  
> an end to testing imgtec specific mips optimizations)
> 
> Shivraj:- cpu detection will not work for qemu, however we have tested it on 
> mips hardware at our end.

iam not speaking about just this patch
but we have just qemu to test on imgtec - mips i can apply this patch but it 
means that in the future FFmpeg will then only be tested on loongson because 
you effectively disable our only way to test code on imgtec mips

its very strange that you want this

Shivraj:- I have got the concern with this patch and so request you to please 
discard it for now.
It will make more sense to resubmit (modified) at appropriate time in near 
future when MSA enabled devices are setup for testing.
Till the time requesting to keep the mips testing under QEMU as it is.

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

You can kill me, but you cannot change the truth.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/af_rubberband: add process_command()

2015-10-01 Thread Nicolas George
Le decadi 10 vendémiaire, an CCXXIV, Paul B Mahol a écrit :
> > "l" is unneeded, %f is for double already
> Clang complain if I do not give it "l".

Michael was mistaken. For variadic function calls, floats are upgraded to
doubles, and therefore %lf is equivalent to %f for printf. But for scanf, a
pointer to float can not be upgraded, and %f really stands for float.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] [WIP] avcodec/videotoolbox: add Annex B support

2015-10-01 Thread Carl Eugen Hoyos
wm4  googlemail.com> writes:

> a) move ff_isom_write_avcc() to libavcodec, and use it as avpriv_
>from libavformat

What's the disadvantage?

Carl Eugen

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


[FFmpeg-devel] [PATCH] avfilter/vf_tinterlace: add mergex2 mode

2015-10-01 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 doc/filters.texi| 23 +++
 libavfilter/tinterlace.h|  1 +
 libavfilter/vf_tinterlace.c | 17 -
 3 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index a4d828e..04b2d22 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10774,6 +10774,29 @@ Output:
  1   1   2   2   3   3   4
 @end example
 
+@item mergex2, 7
+Move odd frames into the upper field, even into the lower field,
+generating a double height frame at same frame rate.
+@example
+ --> time
+Input:
+Frame 1 Frame 2 Frame 3 Frame 4
+
+1   2   3   4
+1   2   3   4
+1   2   3   4
+1   2   3   4
+
+Output:
+1   3   3   5
+2   2   4   4
+1   3   3   5
+2   2   4   4
+1   3   3   5
+2   2   4   4
+1   3   3   5
+2   2   4   4
+@end example
 
 @end table
 
diff --git a/libavfilter/tinterlace.h b/libavfilter/tinterlace.h
index d80a6e2..3b703e7 100644
--- a/libavfilter/tinterlace.h
+++ b/libavfilter/tinterlace.h
@@ -38,6 +38,7 @@ enum TInterlaceMode {
 MODE_INTERLEAVE_TOP,
 MODE_INTERLEAVE_BOTTOM,
 MODE_INTERLACEX2,
+MODE_MERGEX2,
 MODE_NB,
 };
 
diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c
index 4bdcd45..3d6140f 100644
--- a/libavfilter/vf_tinterlace.c
+++ b/libavfilter/vf_tinterlace.c
@@ -46,6 +46,7 @@ static const AVOption tinterlace_options[] = {
 {"interleave_top","interleave top and bottom fields", 0, 
AV_OPT_TYPE_CONST, {.i64=MODE_INTERLEAVE_TOP},INT_MIN, INT_MAX, FLAGS, 
"mode"},
 {"interleave_bottom", "interleave bottom and top fields", 0, 
AV_OPT_TYPE_CONST, {.i64=MODE_INTERLEAVE_BOTTOM}, INT_MIN, INT_MAX, FLAGS, 
"mode"},
 {"interlacex2",   "interlace fields from two consecutive frames", 0, 
AV_OPT_TYPE_CONST, {.i64=MODE_INTERLACEX2},   INT_MIN, INT_MAX, FLAGS, 
"mode"},
+{"mergex2",   "merge fields keeping same frame rate", 0, 
AV_OPT_TYPE_CONST, {.i64=MODE_MERGEX2},   INT_MIN, INT_MAX, FLAGS, 
"mode"},
 
 {"flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 
= 0}, 0, INT_MAX, 0, "flags" },
 {"low_pass_filter",   "enable vertical low-pass filter",  0, 
AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_VLPF}, INT_MIN, INT_MAX, FLAGS, 
"flags" },
@@ -118,9 +119,9 @@ static int config_out_props(AVFilterLink *outlink)
 
 tinterlace->vsub = desc->log2_chroma_h;
 outlink->w = inlink->w;
-outlink->h = tinterlace->mode == MODE_MERGE || tinterlace->mode == 
MODE_PAD ?
+outlink->h = tinterlace->mode == MODE_MERGE || tinterlace->mode == 
MODE_PAD || tinterlace->mode == MODE_MERGEX2?
 inlink->h*2 : inlink->h;
-if (tinterlace->mode == MODE_MERGE || tinterlace->mode == MODE_PAD)
+if (tinterlace->mode == MODE_MERGE || tinterlace->mode == MODE_PAD || 
tinterlace->mode == MODE_MERGEX2)
 outlink->sample_aspect_ratio = av_mul_q(inlink->sample_aspect_ratio,
 av_make_q(2, 1));
 
@@ -153,6 +154,9 @@ static int config_out_props(AVFilterLink *outlink)
 tinterlace->preout_time_base.den *= 2;
 outlink->frame_rate = av_mul_q(inlink->frame_rate, (AVRational){2,1});
 outlink->time_base  = av_mul_q(inlink->time_base , (AVRational){1,2});
+} else if (tinterlace->mode == MODE_MERGEX2) {
+outlink->frame_rate = inlink->frame_rate;
+outlink->time_base  = inlink->time_base;
 } else if (tinterlace->mode != MODE_PAD) {
 outlink->frame_rate = av_mul_q(inlink->frame_rate, (AVRational){1,2});
 outlink->time_base  = av_mul_q(inlink->time_base , (AVRational){2,1});
@@ -259,6 +263,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*picref)
 return 0;
 
 switch (tinterlace->mode) {
+case MODE_MERGEX2: /* move the odd frame into the upper field of the new 
image, even into
+* the lower field, generating a double-height video at 
same framerate */
 case MODE_MERGE: /* move the odd frame into the upper field of the new 
image, even into
  * the lower field, generating a double-height video at half 
framerate */
 out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
@@ -274,13 +280,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*picref)
 copy_picture_field(tinterlace, out->data, out->linesize,
(con

Re: [FFmpeg-devel] [PATCH] avfilter/af_rubberband: add process_command()

2015-10-01 Thread Paul B Mahol
On 10/1/15, Michael Niedermayer  wrote:
> On Wed, Sep 30, 2015 at 09:41:35PM +0200, Paul B Mahol wrote:
>> Signed-off-by: Paul B Mahol 
>> ---
>>  libavfilter/af_rubberband.c | 34 ++
>>  1 file changed, 34 insertions(+)
>>
>> diff --git a/libavfilter/af_rubberband.c b/libavfilter/af_rubberband.c
>> index 0a15fdc..b958681 100644
>> --- a/libavfilter/af_rubberband.c
>> +++ b/libavfilter/af_rubberband.c
>> @@ -207,6 +207,39 @@ static int request_frame(AVFilterLink *outlink)
>>  return ret;
>>  }
>>
>> +static int process_command(AVFilterContext *ctx, const char *cmd, const
>> char *args,
>> +   char *res, int res_len, int flags)
>> +{
>> +RubberBandContext *s = ctx->priv;
>> +int ret;
>> +
>> +if (!strcmp(cmd, "tempo")) {
>> +double arg;
>> +
>> +sscanf(args, "%lf", &arg);
>> +if (arg < 0.01 || arg > 100) {
>> +av_log(ctx, AV_LOG_ERROR,
>
>> +   "Tempo scale factor '%lf' out of range\n", arg);
> [...]
>> +   "Pitch scale factor '%lf' out of range\n", arg);
>
> "l" is unneeded, %f is for double already

Clang complain if I do not give it "l".

>
> also af_rubberband seems to fail to build with 1.3-1.2 from ubuntu
>
> libavfilter/af_rubberband.c:53:54: error: `RubberBandOptionDetectorCompound'
> undeclared here (not in a function)
> libavfilter/af_rubberband.c:54:56: error:
> `RubberBandOptionDetectorPercussive' undeclared here (not in a function)
> libavfilter/af_rubberband.c:55:50: error: `RubberBandOptionDetectorSoft'
> undeclared here (not in a function)
> libavfilter/af_rubberband.c:64:49: error: `RubberBandOptionSmoothingOff'
> undeclared here (not in a function)
> libavfilter/af_rubberband.c:65:48: error: `RubberBandOptionSmoothingOn'
> undeclared here (not in a function)
> libavfilter/af_rubberband.c:74:51: error: `RubberBandOptionChannelsApart'
> undeclared here (not in a function)
> libavfilter/af_rubberband.c:75:54: error: `RubberBandOptionChannelsTogether'
> undeclared here (not in a function)
> libavfilter/af_rubberband.c: In function `process_command':
> libavfilter/af_rubberband.c:214:9: warning: unused variable `ret'
> [-Wunused-variable]

You sure have latest version of rubberband?

>
>
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> The greatest way to live with honor in this world is to be what we pretend
> to be. -- Socrates
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tinterlace: add mergex2 mode

2015-10-01 Thread Paul B Mahol
On 10/1/15, tim nicholson  wrote:
> On 30/09/15 14:39, Paul B Mahol wrote:
>> Signed-off-by: Paul B Mahol 
>> ---
>>  doc/filters.texi| 24 
>>  libavfilter/tinterlace.h|  1 +
>>  libavfilter/vf_tinterlace.c | 13 ++---
>>  3 files changed, 35 insertions(+), 3 deletions(-)
>>
>> diff --git a/doc/filters.texi b/doc/filters.texi
>> index a4d828e..0a8588d 100644
>> --- a/doc/filters.texi
>> +++ b/doc/filters.texi
>> @@ -10774,6 +10774,30 @@ Output:
>>   1   1   2   2   3   3   4
>>  @end example
>>
>> +@item mergex2, 7
>> +Move odd frames into the upper field, even into the lower field,
>> +generating a double height frame at same frame rate.
>> +@example
>> + --> time
>> +Input:
>> +Frame 1 Frame 2 Frame 3 Frame 4
>> +
>> +1   2   3   4
>> +1   2   3   4
>> +1   2   3   4
>> +1   2   3   4
>> +
>> +Output:
>> +1   2   3   4
>> +2   3   4   5
>> +1   2   3   4
>> +2   3   4   5
>> +1   2   3   4
>> +2   3   4   5
>> +1   2   3   4
>> +2   3   4   5
>> +@end example
>> +
>>
>
> I can see the usefulness of merging, but making any particular frame
> both the lower field in one merged frame, and upper in the next,  sounds
> like a recipe for eye watering judder on the output.
>
> I think one would need to explain how would one then strip alternate
> frames to get a stream with a consistent field dominance(and how to
> select even or odd frames to get the right one).

You are correct, that was bug.

>
>>  @end table
>>
>> [..]
>
> --
> Tim.
> Key Fingerprint 38CF DB09 3ED0 F607 8B67 6CED 0C0B FC44 8B0B FC83
> ___
> 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