Re: [FFmpeg-devel] [PATCH] 8-bit hevc decoding optimization on aarch64 with neon

2018-04-08 Thread Yingming Fan
Hi Rafal,

It’s very nice to see your work on hevc arm64 neon optimization.

You should test if your codes can pass FATE firstly. The main purpose is to 
test if your codes can pass all hevc-conformance bitstream. About fate please 
refer to https://www.ffmpeg.org/fate.html 

You can also use checkasm to benchmark your arm64 neon codes. For example 
‘checkasm —test=hevc_sao —bench’ to test sao function performance.

You should also split your pathch into smaller one. For example patch about sao 
mc and idct. Every patch should tell us speed-up ratio by using checkasm.

Yingming Fan

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


Re: [FFmpeg-devel] [PATCH v2 1/2] lavf: make overlay_qsv work based on framesync

2018-04-08 Thread Song, Ruiling

> -Original Message-
> From: Song, Ruiling
> Sent: Tuesday, April 3, 2018 9:50 AM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Song, Ruiling 
> Subject: [PATCH v2 1/2] lavf: make overlay_qsv work based on framesync
> 
> The existing version which was cherry-picked from Libav does not work
> with FFmpeg framework, because ff_request_frame() was totally
> different between Libav (recursive) and FFmpeg (non-recursive).
> The existing overlay_qsv implementation depends on the recursive version
> of ff_request_frame to trigger immediate call to request_frame() on input pad.
> But this has been removed in FFmpeg since "lavfi: make request_frame() non-
> recursive."
> Now that we have handy framesync support in FFmpeg, so I make it work
> based on framesync. Some other fixing which is also needed to make
> overlay_qsv work are put in a separate patch.
> 
> v2:
> add .preinit field to initilize framesync options.
> export more options like vf_overlay.c
> 
> Signed-off-by: Ruiling Song 
> ---
>  libavfilter/Makefile |   2 +-
>  libavfilter/vf_overlay_qsv.c | 213 
> ---
>  2 files changed, 78 insertions(+), 137 deletions(-)

Ping?

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


[FFmpeg-devel] GSOC 2018 qualification task.

2018-04-08 Thread ANURAG SINGH IIT BHU
This mail is regarding the qualification task assigned to me for the
GSOC project
in FFmpeg for automatic real-time subtitle generation using speech to text
translation ML model. My assigned task by Michael sir was writing a
ffmpeg-libavfilter filter which outputs a "Hello World minute: sec"
subtitle each second.

I have built a libavfilter filter named "hellosubs" using the existing
subtitle filter. hellosubs filter accepts a video file as input, along with
any subtitle file of any supported subtitle format of FFmpeg with any
number of enteries(>0), any entries i.e any random subtitle file, as an
argument and writes "Hello World minute: sec" subtitle each second on the
video.

>From 38fcf8c80f71a4186f03f33c9272b707390add67 Mon Sep 17 00:00:00 2001
From: ddosvulnerability 
Date: Fri, 6 Apr 2018 11:30:17 +0530
Subject: [PATCH] avfilter: add hellosub filter.

---

 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/vf_hellosubs.c | 463
+
 3 files changed, 465 insertions(+)
 create mode 100644 libavfilter/vf_hellosubs.c


diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index a90ca30..770b1b5 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -331,6 +331,7 @@ OBJS-$(CONFIG_SSIM_FILTER)   +=
vf_ssim.o framesync.o
 OBJS-$(CONFIG_STEREO3D_FILTER)   += vf_stereo3d.o
 OBJS-$(CONFIG_STREAMSELECT_FILTER)   += f_streamselect.o
framesync.o
 OBJS-$(CONFIG_SUBTITLES_FILTER)  += vf_subtitles.o
+OBJS-$(CONFIG_HELLOSUBS_FILTER)  += vf_hellosubs.o
 OBJS-$(CONFIG_SUPER2XSAI_FILTER) += vf_super2xsai.o
 OBJS-$(CONFIG_SWAPRECT_FILTER)   += vf_swaprect.o
 OBJS-$(CONFIG_SWAPUV_FILTER) += vf_swapuv.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 6eac828..a008908 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -322,6 +322,7 @@ extern AVFilter ff_vf_ssim;
 extern AVFilter ff_vf_stereo3d;
 extern AVFilter ff_vf_streamselect;
 extern AVFilter ff_vf_subtitles;
+extern AVFilter ff_vf_hellosubs;
 extern AVFilter ff_vf_super2xsai;
 extern AVFilter ff_vf_swaprect;
 extern AVFilter ff_vf_swapuv;
diff --git a/libavfilter/vf_hellosubs.c b/libavfilter/vf_hellosubs.c
new file mode 100644
index 000..7ba3a0e
--- /dev/null
+++ b/libavfilter/vf_hellosubs.c
@@ -0,0 +1,463 @@
+/*
+ * Copyright (c) 2011 Baptiste Coudurier
+ * Copyright (c) 2011 Stefano Sabatini
+ * Copyright (c) 2012 Clément Bœsch
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
+ */
+
+/**
+ * @file
+ * Libass hellosubs burning filter.
+ *
+ * @see{http://www.matroska.org/technical/specs/hellosubs/ssa.html}
+ */
+
+#include 
+
+#include "config.h"
+#if CONFIG_SUBTITLES_FILTER
+# include "libavcodec/avcodec.h"
+# include "libavformat/avformat.h"
+#endif
+#include "libavutil/avstring.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/opt.h"
+#include "libavutil/parseutils.h"
+#include "drawutils.h"
+#include "avfilter.h"
+#include "internal.h"
+#include "formats.h"
+#include "video.h"
+#include 
+
+typedef struct AssContext {
+const AVClass *class;
+ASS_Library  *library;
+ASS_Renderer *renderer;
+ASS_Track*track;
+char *filename;
+char *fontsdir;
+char *charenc;
+char *force_style;
+int stream_index;
+int alpha;
+uint8_t rgba_map[4];
+int pix_step[4];   ///< steps per pixel for each plane of the
main output
+int original_w, original_h;
+int shaping;
+FFDrawContext draw;
+} AssContext;
+
+#define OFFSET(x) offsetof(AssContext, x)
+#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
+
+#define COMMON_OPTIONS \
+{"filename",   "set the filename of file to
read", OFFSET(filename),   AV_OPT_TYPE_STRING,
{.str = NULL},  CHAR_MIN, CHAR_MAX, FLAGS }, \
+{"f",  "set the filename of file to
read", OFFSET(filename),   AV_OPT_TYPE_STRING,
{.str = NULL},  CHAR_MIN, CHAR_MAX, FLAGS }, \
+{"original_size",  "set the size of the original video (used to scale
fonts)", OFFSET(original_w), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL},
CHAR_MIN, CHAR_MAX, 

Re: [FFmpeg-devel] [PATCH v5] avfilter: add OpenCL scale filter

2018-04-08 Thread Song, Ruiling
> --- /dev/null
> +++ b/libavfilter/opencl/scale.cl
> @@ -0,0 +1,67 @@
> +/*
> + * Copyright (c) 2018 Gabriel Machado
> + *
> + * 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
> + */
> +
> +__kernel void neighbor(__write_only image2d_t dst,
> +   __read_only  image2d_t src)
> +{
> +const sampler_t sampler = (CLK_NORMALIZED_COORDS_TRUE |
> +   CLK_ADDRESS_CLAMP_TO_EDGE |
> +   CLK_FILTER_NEAREST);
> +
> +int2 dst_pos = {get_global_id(0), get_global_id(1)};
> +float2 dst_size = {get_global_size(0), get_global_size(1)};
> +
> +float2 src_coord = (convert_float2(dst_pos) + 0.5) / dst_size;
For the floating point constant, it is better to add suffix 'f' to the number 
to tell the compiler that this is a single floating point value (like 0.5f).
The reason is if no suffix provided, floating point constants will be treated 
as double precision float number.
OpenCL C language derive this feature from C language. And most GPUs are 
performance sensitive to single floating point/ double floating point 
operations.
If you intentionally need double precision, it is ok to leave it as it is.
There are also some other places like this in the OpenCL file.

Thanks!
Ruiling
> +
> +float4 c = read_imagef(src, sampler, src_coord);
> +write_imagef(dst, dst_pos, c);
> +}
> +
> +__kernel void scale(__write_only image2d_t dst,
> +__read_only  image2d_t src,
> +__constant   float*cx,
> +__constant   float*cy,
> + int2  flt_size)
> +{
> +const sampler_t s_img = (CLK_NORMALIZED_COORDS_FALSE |
> + CLK_ADDRESS_CLAMP_TO_EDGE |
> + CLK_FILTER_NEAREST);
> +
> +int2 dst_pos = {get_global_id(0), get_global_id(1)};
> +
> +float2 dst_size = {get_global_size(0), get_global_size(1)};
> +float2 src_size = convert_float2(get_image_dim(src));
> +
> +float2 src_coord = (convert_float2(dst_pos) + 0.5) * src_size / dst_size;
> +
> +int2 src_pos = convert_int2(floor(src_coord - 0.5));
> +
> +float4 col = 0;
> +for (int i = 0; i < flt_size.y; ++i) {
> +float4 s = 0;
> +for (int j = 0; j < flt_size.x; ++j) {
> +float4 c = read_imagef(src, s_img, src_pos + (int2){flt_size.x/2 
> - j,
> flt_size.y/2 - i});
> +s += c * cx[dst_pos.x * flt_size.x + j];
> +}
> +col += s * cy[dst_pos.y * flt_size.y + i];
> +}
> +
> +write_imagef(dst, dst_pos, col);
> +}

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


[FFmpeg-devel] [PATCH] checkasm/hevc_mc : add hevc_mc for checkasm

2018-04-08 Thread Yingming Fan
From: Yingming Fan 

---
 Hi, there.
 I plane to submit our arm32 neon codes for qpel and epel.
 While before this i will submit hevc_mc checkasm codes.
 This hevc_mc checkasm codes check every qpel and epel function, including 8 10 
and 12 bit.
 Passed test by using 'checkasm --test=hevc_mc' under Linux x86_64 MacOS x86_64 
and Linux arm64 platform.
 Also passed FATE test. 

 tests/checkasm/Makefile   |   2 +-
 tests/checkasm/checkasm.c |   1 +
 tests/checkasm/checkasm.h |   1 +
 tests/checkasm/hevc_mc.c  | 547 ++
 tests/fate/checkasm.mak   |   1 +
 5 files changed, 551 insertions(+), 1 deletion(-)
 create mode 100644 tests/checkasm/hevc_mc.c

diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index 0233d2f989..e6c94cd676 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -23,7 +23,7 @@ AVCODECOBJS-$(CONFIG_EXR_DECODER)   += exrdsp.o
 AVCODECOBJS-$(CONFIG_HUFFYUV_DECODER)   += huffyuvdsp.o
 AVCODECOBJS-$(CONFIG_JPEG2000_DECODER)  += jpeg2000dsp.o
 AVCODECOBJS-$(CONFIG_PIXBLOCKDSP)   += pixblockdsp.o
-AVCODECOBJS-$(CONFIG_HEVC_DECODER)  += hevc_add_res.o hevc_idct.o 
hevc_sao.o
+AVCODECOBJS-$(CONFIG_HEVC_DECODER)  += hevc_add_res.o hevc_idct.o 
hevc_sao.o hevc_mc.o
 AVCODECOBJS-$(CONFIG_UTVIDEO_DECODER)   += utvideodsp.o
 AVCODECOBJS-$(CONFIG_V210_ENCODER)  += v210enc.o
 AVCODECOBJS-$(CONFIG_VP9_DECODER)   += vp9dsp.o
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 20ce56932f..b95efc674d 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -117,6 +117,7 @@ static const struct {
 { "hevc_add_res", checkasm_check_hevc_add_res },
 { "hevc_idct", checkasm_check_hevc_idct },
 { "hevc_sao", checkasm_check_hevc_sao },
+{ "hevc_mc", checkasm_check_hevc_mc },
 #endif
 #if CONFIG_HUFFYUV_DECODER
 { "huffyuvdsp", checkasm_check_huffyuvdsp },
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index dcab74de06..5a4a612da7 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -58,6 +58,7 @@ void checkasm_check_h264qpel(void);
 void checkasm_check_hevc_add_res(void);
 void checkasm_check_hevc_idct(void);
 void checkasm_check_hevc_sao(void);
+void checkasm_check_hevc_mc(void);
 void checkasm_check_huffyuvdsp(void);
 void checkasm_check_jpeg2000dsp(void);
 void checkasm_check_llviddsp(void);
diff --git a/tests/checkasm/hevc_mc.c b/tests/checkasm/hevc_mc.c
new file mode 100644
index 00..018f322c11
--- /dev/null
+++ b/tests/checkasm/hevc_mc.c
@@ -0,0 +1,547 @@
+/*
+ * Copyright (c) 2018 Yingming Fan 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include 
+
+#include "libavutil/intreadwrite.h"
+
+#include "libavcodec/avcodec.h"
+
+#include "libavcodec/hevcdsp.h"
+
+#include "checkasm.h"
+
+static const uint32_t pixel_mask[3] = { 0x, 0x03ff03ff, 0x0fff0fff };
+static const uint32_t idx_width_map[8][2] = {{1, 4}, {3, 8}, {4, 12}, {5, 16}, 
{6, 24}, {7, 32}, {8, 48}, {9, 64}};
+#define SIZEOF_PIXEL ((bit_depth + 7) / 8)
+#define PIXEL_STRIDE (AV_INPUT_BUFFER_PADDING_SIZE + MAX_PB_SIZE + 
AV_INPUT_BUFFER_PADDING_SIZE)
+#define BUF_SIZE ((MAX_PB_SIZE+4+4) * PIXEL_STRIDE * 2)
+
+#define randomize_buffers(buf0, buf1, size) \
+do {\
+uint32_t mask = pixel_mask[(bit_depth - 8) >> 1];   \
+int k;  \
+for (k = 0; k < size; k += 4) { \
+uint32_t r = rnd() & mask;  \
+AV_WN32A(buf0 + k, r);  \
+AV_WN32A(buf1 + k, r);  \
+}   \
+} while (0)
+
+#define randomize_buffers2(buf0, buf1, size)\
+do {\
+uint32_t mask = 0x1fff1fff; \
+int k;  \
+for (k = 0; k < size; k += 4) { \
+uint32_t r = rnd() & mask;  \
+

Re: [FFmpeg-devel] [PATCH v3] avcodec/arm/hevcdsp_sao : add NEON optimization for sao

2018-04-08 Thread Michael Niedermayer
On Sun, Apr 08, 2018 at 08:41:28PM +0800, Shengbin Meng wrote:
> LGTM.

will apply

thanks

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

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


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


[FFmpeg-devel] [PATCH 0/1] re: Sega FILM: set dts and duration when demuxing

2018-04-08 Thread misty
From: Misty De Meo 

I've updated this so it applies on master.

This patch is still necessary; the wrong duration is most obvious when
remuxing Cinepak from FILM files without reencoding. For example, one
sample video I have has a timebase of 30, and most frames last for two
ticks. When remuxing in a format which uses the duration, this can leave
gaps in the time codes. Here's an example from an original video and one
remuxed using FFmpeg. The first number is the absolute timestamp, and the
second number is the duration value. In the first set, from the original
video, you can see that the timestamps increase by 2 each tick and the
time between frames also increases by 2 each tick.
In the second set, produced by FFmpeg, the timestamps still increase by
2 but the time between frames is now marked as 1. This is fixed by this
patch.

8002 0002
8004 0002

8002 0001
8004 0001

Misty De Meo (1):
  Sega FILM: set dts and duration when demuxing

 libavformat/segafilm.c | 19 +++
 1 file changed, 19 insertions(+)

-- 
2.17.0

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


[FFmpeg-devel] [PATCH 1/1] Sega FILM: set dts and duration when demuxing

2018-04-08 Thread misty
From: Misty De Meo 

---
 libavformat/segafilm.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index 4c0cca0140..e72c26b144 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -270,6 +270,8 @@ static int film_read_packet(AVFormatContext *s,
 FilmDemuxContext *film = s->priv_data;
 AVIOContext *pb = s->pb;
 film_sample *sample;
+film_sample *next_sample = NULL;
+int next_sample_id;
 int ret = 0;
 
 if (film->current_sample >= film->sample_count)
@@ -277,6 +279,20 @@ static int film_read_packet(AVFormatContext *s,
 
 sample = >sample_table[film->current_sample];
 
+/* Find the next sample from the same stream, assuming there is one;
+ * this is used to calculate the duration below */
+next_sample_id = film->current_sample + 1;
+while (next_sample == NULL) {
+if (next_sample_id >= film->sample_count)
+break;
+
+next_sample = >sample_table[next_sample_id];
+if (next_sample->stream != sample->stream) {
+next_sample = NULL;
+next_sample_id++;
+}
+}
+
 /* position the stream (will probably be there anyway) */
 avio_seek(pb, sample->sample_offset, SEEK_SET);
 
@@ -285,8 +301,11 @@ static int film_read_packet(AVFormatContext *s,
 ret = AVERROR(EIO);
 
 pkt->stream_index = sample->stream;
+pkt->dts = sample->pts;
 pkt->pts = sample->pts;
 pkt->flags |= sample->keyframe ? AV_PKT_FLAG_KEY : 0;
+if (next_sample != NULL)
+pkt->duration = next_sample->pts - sample->pts;
 
 film->current_sample++;
 
-- 
2.17.0

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


Re: [FFmpeg-devel] swscale/unscaled : Remove MMXext version of shufflebyte2103 and uyvyto422

2018-04-08 Thread Michael Niedermayer
On Mon, Apr 09, 2018 at 03:00:17AM +0200, Michael Niedermayer wrote:
> On Sun, Apr 08, 2018 at 03:33:17PM +0200, Martin Vignali wrote:
> > Hello,
> > 
> > Patchs in attach remove mmxext version of shufflebytes2103 and uyvyto422
> > 
> > Checkasm test show that mmxext version is slower than MMX version
> > 
> > Also disable MMXext for "internal" func : extract_even2
> > (only use by uyvyto422)
> 
> are you testing these functions with real image data in a real image
> processing pipeline ?
> 
> synthetic tests would likely not give correct results with non temporal
> stores.
> in a real processing pipeline the output image will generally not fit in
> the L1 cache and will generally not be reused before other things overwrote
> the cache. So it should be better not to waste cache for it in the first
> place.
> But a synthetic test which just repeatly filters a short line will
> behave very differently.
> Its thus expected that mmx2 performs poorly here in such a synthetic test
> but that doesnt say anything about how it performs in a real use case

also IIRC all the really old SIMD code has been benchmarked when it was
written in real use cases, so if a function that is favoured is slower thats
"strange". And the question should be asked "why" its slower now

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] swscale/unscaled : Remove MMXext version of shufflebyte2103 and uyvyto422

2018-04-08 Thread Michael Niedermayer
On Sun, Apr 08, 2018 at 03:33:17PM +0200, Martin Vignali wrote:
> Hello,
> 
> Patchs in attach remove mmxext version of shufflebytes2103 and uyvyto422
> 
> Checkasm test show that mmxext version is slower than MMX version
> 
> Also disable MMXext for "internal" func : extract_even2
> (only use by uyvyto422)

are you testing these functions with real image data in a real image
processing pipeline ?

synthetic tests would likely not give correct results with non temporal
stores.
in a real processing pipeline the output image will generally not fit in
the L1 cache and will generally not be reused before other things overwrote
the cache. So it should be better not to waste cache for it in the first
place.
But a synthetic test which just repeatly filters a short line will
behave very differently.
Its thus expected that mmx2 performs poorly here in such a synthetic test
but that doesnt say anything about how it performs in a real use case



[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch


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


Re: [FFmpeg-devel] [PATCH] MAINTAINERS: add myself to the general developers list

2018-04-08 Thread Jun Zhao


On 2018/4/3 11:29, Steven Liu wrote:
>
>> On 3 Apr 2018, at 07:24, Jun Zhao  wrote:
>>
>> Want to close work with this community, so I request as
>> a general developer.
>> <0001-MAINTAINERS-add-myself-to-the-general-developers-lis.patch>___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> LGTM
Ping , any other comments?  Thanks
>
> Thanks
> Steven
>
>
>
>
>
> ___
> 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] avcodec/movtextdec: Check style_start/end

2018-04-08 Thread Michael Niedermayer
On Sat, Apr 07, 2018 at 08:33:11PM -0700, Philip Langdale wrote:
> On Sun,  8 Apr 2018 03:29:44 +0200
> Michael Niedermayer  wrote:
> 
> > Limits based on 3GPP TS 26.245 V14.0.0
> > Fixes: Timeout
> > Fixes:
> > 6377/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOVTEXT_fuzzer-5175929115508736
> > 
> > Found-by: continuous fuzzing process
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer  ---
> >  libavcodec/movtextdec.c | 8 
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
> > index 89ac791602..c38c5edce6 100644
> > --- a/libavcodec/movtextdec.c
> > +++ b/libavcodec/movtextdec.c
> > @@ -299,6 +299,14 @@ static int decode_styl(const uint8_t *tsmb,
> > MovTextContext *m, AVPacket *avpkt) m->s_temp->style_start =
> > AV_RB16(tsmb); tsmb += 2;
> >  m->s_temp->style_end = AV_RB16(tsmb);
> > +
> > +if (   m->s_temp->style_end < m->s_temp->style_start
> > +|| (m->count_s && m->s_temp->style_start <
> > m->s[m->count_s - 1]->style_end)) {
> > +av_freep(>s_temp);
> > +mov_text_cleanup(m);
> > +return AVERROR(ENOMEM);
> > +}
> > +
> >  tsmb += 2;
> >  m->s_temp->style_fontID = AV_RB16(tsmb);
> >  tsmb += 2;
> 
> LGTM.

will apply

thx

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

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


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


Re: [FFmpeg-devel] [PATCH] [RFC]doc/examples: alternative input handler

2018-04-08 Thread Michael Niedermayer
On Sun, Apr 08, 2018 at 05:27:56PM +0200, Bodecs Bela wrote:
> 
> 
> 2018.04.06. 0:39 keltezéssel, Michael Niedermayer írta:
> >On Fri, Mar 30, 2018 at 02:47:25PM +0200, Bodecs Bela wrote:
> >>Hi All,
> >>
> >>regularly, on different forums and mailing lists a requirement popups for a
> >>feature to automatically failover switching between main input and a
> >>secondary input in case of main input unavailability.
> >>
> >>The base motivation: let's say you have a unreliable live stream source and
> >>you
> >>want to transcode its video and audio streams in realtime but you
> >>want to survive the ocasions when the source is unavailable. So use a
> >>secondary live source but the transition should occur seamlessly without
> >>breaking/re-starting the transcoding processs.
> >>
> >>Some days ago there was a discussion on devel-irc about this topic and we
> >>concluded that this feature is not feasible inside ffmpeg without "hacking",
> >>but a separate client app could do this.
> >>
> >>So I created this example app to handle two separate input sources and
> >>switching realtime between them. I am not sure wheter it should be inside
> >>the tools subdir.
> >>
> >>The detailed description is available in the header section of the source
> >>file.
> >>
> >>I will appretiate your suggestions about it.
> >>
> >>Thank you in advance.
> >>
> >>best,
> >>
> >>Bela Bodecs
> >>
> >>
> >>  configure|2
> >>  doc/examples/Makefile|1
> >>  doc/examples/Makefile.example|1
> >>  doc/examples/alternative_input.c | 1233 
> >> +++
> >You may want to add yourself to MAINTAINERS, so it is not unmaintained
> ok
> >I think this is complex enough that it needs a maintainer
> >
> 
> May I take your response as you agree to inlcude this as an example app?

iam fine with either


> 
> 
> 
> >[...]
> >
> >>+static int open_single_input(int input_index)
> >>+{
> >>+int ret, i;
> >>+AVInputFormat *input_format = NULL;
> >>+AVDictionary * input_options = NULL;
> >>+AVFormatContext * input_fmt_ctx = NULL;
> >>+
> >>+if (app_ctx.input_format_names[input_index]) {
> >>+if (!(input_format = 
> >>av_find_input_format(app_ctx.input_format_names[input_index]))) {
> >>+timed_log(AV_LOG_ERROR, "Input #%d Unknown input format: 
> >>'%s'\n", input_index,
> >>+  app_ctx.input_format_names[input_index]);
> >>+return EINVAL;
> >>+}
> >>+}
> >>+
> >>+av_dict_set(_options, "rw_timeout", "200", 0);
> >>+av_dict_set(_options, "timeout", "2000", 0);
> >>+if ((app_ctx.input_fmt_ctx[input_index] = avformat_alloc_context()) < 
> >>0)
> >>+return AVERROR(ENOMEM);
> >i guess this was intended to be "!= NULL"
> yes, I will fix it

> >
> >also you are mixing EINVAL with AVERROR(ENOMEM) these arent compatible.
> >Either all should be AVERROR or none
> ok, should I will modify EIVAL all of them to AVERROR(EINVAL)?

yes

thx

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

"I am not trying to be anyone's saviour, I'm trying to think about the
 future and not be sad" - Elon Musk



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


Re: [FFmpeg-devel] swscale/swscale_unscaled : add X86_64 (SSE2, AVX) for uyvyto422

2018-04-08 Thread Martin Vignali
Hello,

New patch in attach,
Remove the C part of the sse/avx func, and integrate all the process in the
ASM func

A little bit faster, and avoid the macro in x86/rgb2rgb.c.

Checkasm result :
uyvytoyuv422_c: 15045.4
uyvytoyuv422_mmx: 14092.4
uyvytoyuv422_mmxext: 21630.2
uyvytoyuv422_sse2: 4452.2
uyvytoyuv422_avx: 4217.9


Martin


0001-swscale-swscale_unscaled-add-X86_64-SSE2-and-AVX-for.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/amfenc: Retain a reference to D3D frames used as input during the encoding process

2018-04-08 Thread Mark Thompson
On 08/04/18 20:13, Alexander Kravchenko wrote:
> 
> 
>> -Original Message-
>> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
>> Of Mark Thompson
>> Sent: Sunday, April 8, 2018 8:25 PM
>> To: ffmpeg-devel@ffmpeg.org
>> Subject: Re: [FFmpeg-devel] [PATCH] lavc/amfenc: Retain a reference to D3D
>> frames used as input during the encoding process
>>
>> On 06/04/18 11:25, Alexander Kravchenko wrote:

 This breaks the testcase described in
 https://trac.ffmpeg.org/ticket/6990 which is basically the same as
 the one you described in this patch.

 I get the following spammed repeatedly:

 [AVHWFramesContext @ 0502d340] Static surface pool size
>> exceeded.
 [mpeg2video @ 02f8d400] get_buffer() failed [mpeg2video @
 02f8d400] thread_get_buffer() failed [mpeg2video @
 02f8d400] get_buffer() failed (-12 ) Error
 while decoding stream #0:1: Operation not permitted
>>>
>>> Hi, could you please review the following updated patch I added queue
>>> limit according initial pool size of incoming frame context.
>>> This solves the problem running this pipeline without -extra_hw_frames 16
>> option, but -extra_hw_frames option can be used to have bigger queue for
>> encoder.
>>
>> I think you've misunderstood /why/ the decoder has the pool size allocation
>> that it does.  The decoder expects to use all of the surfaces it has 
>> allocated in
>> the worst case - the difference between MPEG-2 and H.264 is that MPEG-2
>> can store at most two reference frames (the forward and backward
>> references for B-frames), while H.264 can store up to sixteen.  Most H.264
>> streams don't use all sixteen references, but in theory they could (excepting
>> level restrictions, but they are generally quite iffy) so the decoder 
>> allocates
>> space for all of those references even if they aren't used.
>>
>> I can believe that this patch happens to work if you have a simple stream
>> with limited references (streams rarely use more than two or three), but it
>> will certainly fail exactly as before for complex streams.
>>
>> If you want to hold onto more than one frame in the encoder then currently
>> you need to use the -extra_hw_frames option on the source (whether
>> decoder or filter) - that is exactly what it's there for.  Some sort of 
>> automatic
>> negotiation is suggested (there was some discussion on libav-devel a while
>> ago), but the requirement that it works through libavfilter is a difficult 
>> one
>> with the current structure so nothing concrete is yet proposed.  (That was
>> mostly considering libmfx, where it's even more of a problem because the
>> lookahead options can make the encoder queue over a hundred frames
>> internally.)
>>
>>> ---
>>>  libavcodec/amfenc.c | 97
>>> -
>>>  libavcodec/amfenc.h |  3 ++
>>>  2 files changed, 99 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c index
>>> 89a10ff253..eb7b20c252 100644
>>> --- a/libavcodec/amfenc.c
>>> +++ b/libavcodec/amfenc.c
>>> @@ -157,6 +157,9 @@ static int amf_init_context(AVCodecContext *avctx)
>>>  AmfContext *ctx = avctx->priv_data;
>>>  AMF_RESULT  res = AMF_OK;
>>>
>>> +ctx->hwsurfaces_in_queue = 0;
>>> +ctx->hwsurfaces_in_queue_max = 16;
>>> +
>>>  // configure AMF logger
>>>  // the return of these functions indicates old state and do not affect
>> behaviour
>>>  ctx->trace->pVtbl->EnableWriter(ctx->trace,
>>> AMF_TRACE_WRITER_DEBUG_OUTPUT, ctx->log_to_dbg != 0 ); @@ -187,6
>> +190,7 @@ static int amf_init_context(AVCodecContext *avctx)
>>>  if (!ctx->hw_frames_ctx) {
>>>  return AVERROR(ENOMEM);
>>>  }
>>> +ctx->hwsurfaces_in_queue_max =
>>> + device_ctx->initial_pool_size - 1;
>>>  } else {
>>>  if(res == AMF_NOT_SUPPORTED)
>>>  av_log(avctx, AV_LOG_INFO,
>>> "avctx->hw_frames_ctx has D3D11 device which doesn't have D3D11VA
>> interface, switching to default\n"); @@ -443,6 +447,73 @@ int
>> ff_amf_encode_init(AVCodecContext *avctx)
>>>  return ret;
>>>  }
>>>
>>> +#define AMF_AV_QUERY_INTERFACE(res, from, InterfaceTypeTo, to) \
>>> +{ \
>>> +AMFGuid guid_##InterfaceTypeTo = IID_##InterfaceTypeTo(); \
>>> +res = from->pVtbl->QueryInterface(from, _##InterfaceTypeTo,
>> (void**)); \
>>> +}
>>> +
>>> +#define AMF_AV_ASSIGN_PROPERTY_INTERFACE(res, pThis, name, val) \
>>> +{ \
>>> +AMFInterface *amf_interface; \
>>> +AMFVariantStruct var; \
>>> +res = AMFVariantInit(); \
>>> +if (res == AMF_OK) { \
>>> +AMF_AV_QUERY_INTERFACE(res, val, AMFInterface,
>> amf_interface)\
>>> +if (res == AMF_OK) { \
>>> +res = 

Re: [FFmpeg-devel] [PATCH] lavc/amfenc: Retain a reference to D3D frames used as input during the encoding process

2018-04-08 Thread Alexander Kravchenko


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Mark Thompson
> Sent: Sunday, April 8, 2018 8:25 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH] lavc/amfenc: Retain a reference to D3D
> frames used as input during the encoding process
> 
> On 06/04/18 11:25, Alexander Kravchenko wrote:
> >>
> >> This breaks the testcase described in
> >> https://trac.ffmpeg.org/ticket/6990 which is basically the same as
> >> the one you described in this patch.
> >>
> >> I get the following spammed repeatedly:
> >>
> >> [AVHWFramesContext @ 0502d340] Static surface pool size
> exceeded.
> >> [mpeg2video @ 02f8d400] get_buffer() failed [mpeg2video @
> >> 02f8d400] thread_get_buffer() failed [mpeg2video @
> >> 02f8d400] get_buffer() failed (-12 ) Error
> >> while decoding stream #0:1: Operation not permitted
> >
> > Hi, could you please review the following updated patch I added queue
> > limit according initial pool size of incoming frame context.
> > This solves the problem running this pipeline without -extra_hw_frames 16
> option, but -extra_hw_frames option can be used to have bigger queue for
> encoder.
> 
> I think you've misunderstood /why/ the decoder has the pool size allocation
> that it does.  The decoder expects to use all of the surfaces it has 
> allocated in
> the worst case - the difference between MPEG-2 and H.264 is that MPEG-2
> can store at most two reference frames (the forward and backward
> references for B-frames), while H.264 can store up to sixteen.  Most H.264
> streams don't use all sixteen references, but in theory they could (excepting
> level restrictions, but they are generally quite iffy) so the decoder 
> allocates
> space for all of those references even if they aren't used.
> 
> I can believe that this patch happens to work if you have a simple stream
> with limited references (streams rarely use more than two or three), but it
> will certainly fail exactly as before for complex streams.
> 
> If you want to hold onto more than one frame in the encoder then currently
> you need to use the -extra_hw_frames option on the source (whether
> decoder or filter) - that is exactly what it's there for.  Some sort of 
> automatic
> negotiation is suggested (there was some discussion on libav-devel a while
> ago), but the requirement that it works through libavfilter is a difficult one
> with the current structure so nothing concrete is yet proposed.  (That was
> mostly considering libmfx, where it's even more of a problem because the
> lookahead options can make the encoder queue over a hundred frames
> internally.)
> 
> > ---
> >  libavcodec/amfenc.c | 97
> > -
> >  libavcodec/amfenc.h |  3 ++
> >  2 files changed, 99 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c index
> > 89a10ff253..eb7b20c252 100644
> > --- a/libavcodec/amfenc.c
> > +++ b/libavcodec/amfenc.c
> > @@ -157,6 +157,9 @@ static int amf_init_context(AVCodecContext *avctx)
> >  AmfContext *ctx = avctx->priv_data;
> >  AMF_RESULT  res = AMF_OK;
> >
> > +ctx->hwsurfaces_in_queue = 0;
> > +ctx->hwsurfaces_in_queue_max = 16;
> > +
> >  // configure AMF logger
> >  // the return of these functions indicates old state and do not affect
> behaviour
> >  ctx->trace->pVtbl->EnableWriter(ctx->trace,
> > AMF_TRACE_WRITER_DEBUG_OUTPUT, ctx->log_to_dbg != 0 ); @@ -187,6
> +190,7 @@ static int amf_init_context(AVCodecContext *avctx)
> >  if (!ctx->hw_frames_ctx) {
> >  return AVERROR(ENOMEM);
> >  }
> > +ctx->hwsurfaces_in_queue_max =
> > + device_ctx->initial_pool_size - 1;
> >  } else {
> >  if(res == AMF_NOT_SUPPORTED)
> >  av_log(avctx, AV_LOG_INFO,
> > "avctx->hw_frames_ctx has D3D11 device which doesn't have D3D11VA
> interface, switching to default\n"); @@ -443,6 +447,73 @@ int
> ff_amf_encode_init(AVCodecContext *avctx)
> >  return ret;
> >  }
> >
> > +#define AMF_AV_QUERY_INTERFACE(res, from, InterfaceTypeTo, to) \
> > +{ \
> > +AMFGuid guid_##InterfaceTypeTo = IID_##InterfaceTypeTo(); \
> > +res = from->pVtbl->QueryInterface(from, _##InterfaceTypeTo,
> (void**)); \
> > +}
> > +
> > +#define AMF_AV_ASSIGN_PROPERTY_INTERFACE(res, pThis, name, val) \
> > +{ \
> > +AMFInterface *amf_interface; \
> > +AMFVariantStruct var; \
> > +res = AMFVariantInit(); \
> > +if (res == AMF_OK) { \
> > +AMF_AV_QUERY_INTERFACE(res, val, AMFInterface,
> amf_interface)\
> > +if (res == AMF_OK) { \
> > +res = AMFVariantAssignInterface(, amf_interface); \
> > +amf_interface->pVtbl->Release(amf_interface); \
> > 

[FFmpeg-devel] [PATCH 1/3] lavc: Add coded bitstream read/write support for VP9

2018-04-08 Thread Mark Thompson
---
 configure|   2 +
 libavcodec/Makefile  |   1 +
 libavcodec/cbs.c |   6 +
 libavcodec/cbs_internal.h|   1 +
 libavcodec/cbs_vp9.c | 666 +++
 libavcodec/cbs_vp9.h | 171 +
 libavcodec/cbs_vp9_syntax_template.c | 388 
 7 files changed, 1235 insertions(+)
 create mode 100644 libavcodec/cbs_vp9.c
 create mode 100644 libavcodec/cbs_vp9.h
 create mode 100644 libavcodec/cbs_vp9_syntax_template.c

diff --git a/configure b/configure
index 08d6fc5983..890de64ab4 100755
--- a/configure
+++ b/configure
@@ -2235,6 +2235,7 @@ CONFIG_EXTRA="
 cbs_h264
 cbs_h265
 cbs_mpeg2
+cbs_vp9
 dirac_parse
 dvprofile
 exif
@@ -2494,6 +2495,7 @@ threads_if_any="$THREADS_LIST"
 cbs_h264_select="cbs golomb"
 cbs_h265_select="cbs golomb"
 cbs_mpeg2_select="cbs"
+cbs_vp9_select="cbs"
 dct_select="rdft"
 dirac_parse_select="golomb"
 error_resilience_select="me_cmp"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 4b8ad121db..6ee16d855b 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -65,6 +65,7 @@ OBJS-$(CONFIG_CBS) += cbs.o
 OBJS-$(CONFIG_CBS_H264)+= cbs_h2645.o h2645_parse.o
 OBJS-$(CONFIG_CBS_H265)+= cbs_h2645.o h2645_parse.o
 OBJS-$(CONFIG_CBS_MPEG2)   += cbs_mpeg2.o
+OBJS-$(CONFIG_CBS_VP9) += cbs_vp9.o
 OBJS-$(CONFIG_CRYSTALHD)   += crystalhd.o
 OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o
 OBJS-$(CONFIG_ERROR_RESILIENCE)+= error_resilience.o
diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
index 897e0bb28e..740a51e3d4 100644
--- a/libavcodec/cbs.c
+++ b/libavcodec/cbs.c
@@ -38,6 +38,9 @@ static const CodedBitstreamType *cbs_type_table[] = {
 #if CONFIG_CBS_MPEG2
 _cbs_type_mpeg2,
 #endif
+#if CONFIG_CBS_VP9
+_cbs_type_vp9,
+#endif
 };
 
 const enum AVCodecID ff_cbs_all_codec_ids[] = {
@@ -49,6 +52,9 @@ const enum AVCodecID ff_cbs_all_codec_ids[] = {
 #endif
 #if CONFIG_CBS_MPEG2
 AV_CODEC_ID_MPEG2VIDEO,
+#endif
+#if CONFIG_CBS_VP9
+AV_CODEC_ID_VP9,
 #endif
 AV_CODEC_ID_NONE
 };
diff --git a/libavcodec/cbs_internal.h b/libavcodec/cbs_internal.h
index be540e2a44..0207e2aaa2 100644
--- a/libavcodec/cbs_internal.h
+++ b/libavcodec/cbs_internal.h
@@ -87,6 +87,7 @@ int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, 
PutBitContext *pbc,
 extern const CodedBitstreamType ff_cbs_type_h264;
 extern const CodedBitstreamType ff_cbs_type_h265;
 extern const CodedBitstreamType ff_cbs_type_mpeg2;
+extern const CodedBitstreamType ff_cbs_type_vp9;
 
 
 #endif /* AVCODEC_CBS_INTERNAL_H */
diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c
new file mode 100644
index 00..135dfea05f
--- /dev/null
+++ b/libavcodec/cbs_vp9.c
@@ -0,0 +1,666 @@
+/*
+ * 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/avassert.h"
+
+#include "cbs.h"
+#include "cbs_internal.h"
+#include "cbs_vp9.h"
+#include "internal.h"
+
+
+static int cbs_vp9_read_s(CodedBitstreamContext *ctx, GetBitContext *gbc,
+  int width, const char *name, int32_t *write_to)
+{
+uint32_t magnitude;
+int position, sign;
+int32_t result;
+
+if (ctx->trace_enable)
+position = get_bits_count(gbc);
+
+if (get_bits_left(gbc) < width + 1) {
+av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid signed value at "
+   "%s: bitstream ended.\n", name);
+return AVERROR_INVALIDDATA;
+}
+
+magnitude = get_bits(gbc, width);
+sign  = get_bits1(gbc);
+result= sign ? -(int32_t)magnitude : magnitude;
+
+if (ctx->trace_enable) {
+char bits[33];
+int i;
+for (i = 0; i < width; i++)
+bits[i] = magnitude >> (width - i - 1) & 1 ? '1' : '0';
+bits[i] = sign ? '1' : '0';
+bits[i + 1] = 0;
+
+ff_cbs_trace_syntax_element(ctx, position, name, bits, result);
+}
+
+*write_to = result;
+return 0;
+}
+
+static int cbs_vp9_write_s(CodedBitstreamContext *ctx, PutBitContext *pbc,
+   int width, const char *name, int32_t value)
+{
+ 

[FFmpeg-devel] [PATCH 3/3] lavc/cbs: Add tests for VP9

2018-04-08 Thread Mark Thompson
Uses the same mechanism as other codecs - conformance test files are
passed through the metadata filter (which, with no options, reads the
input and writes it back) and the output verified to match the input.
---
 tests/fate/cbs.mak | 34 ++
 tests/ref/fate/cbs-vp9-vp90-2-03-deltaq|  1 +
 tests/ref/fate/cbs-vp9-vp90-2-05-resize|  1 +
 tests/ref/fate/cbs-vp9-vp90-2-06-bilinear  |  1 +
 tests/ref/fate/cbs-vp9-vp90-2-09-lf_deltas |  1 +
 .../ref/fate/cbs-vp9-vp90-2-10-show-existing-frame |  1 +
 .../fate/cbs-vp9-vp90-2-10-show-existing-frame2|  1 +
 .../ref/fate/cbs-vp9-vp90-2-segmentation-aq-akiyo  |  1 +
 .../ref/fate/cbs-vp9-vp90-2-segmentation-sf-akiyo  |  1 +
 tests/ref/fate/cbs-vp9-vp90-2-tiling-pedestrian|  1 +
 tests/ref/fate/cbs-vp9-vp91-2-04-yuv422|  1 +
 tests/ref/fate/cbs-vp9-vp91-2-04-yuv444|  1 +
 tests/ref/fate/cbs-vp9-vp92-2-20-10bit-yuv420  |  1 +
 tests/ref/fate/cbs-vp9-vp93-2-20-10bit-yuv422  |  1 +
 tests/ref/fate/cbs-vp9-vp93-2-20-12bit-yuv444  |  1 +
 15 files changed, 43 insertions(+), 5 deletions(-)
 create mode 100644 tests/ref/fate/cbs-vp9-vp90-2-03-deltaq
 create mode 100644 tests/ref/fate/cbs-vp9-vp90-2-05-resize
 create mode 100644 tests/ref/fate/cbs-vp9-vp90-2-06-bilinear
 create mode 100644 tests/ref/fate/cbs-vp9-vp90-2-09-lf_deltas
 create mode 100644 tests/ref/fate/cbs-vp9-vp90-2-10-show-existing-frame
 create mode 100644 tests/ref/fate/cbs-vp9-vp90-2-10-show-existing-frame2
 create mode 100644 tests/ref/fate/cbs-vp9-vp90-2-segmentation-aq-akiyo
 create mode 100644 tests/ref/fate/cbs-vp9-vp90-2-segmentation-sf-akiyo
 create mode 100644 tests/ref/fate/cbs-vp9-vp90-2-tiling-pedestrian
 create mode 100644 tests/ref/fate/cbs-vp9-vp91-2-04-yuv422
 create mode 100644 tests/ref/fate/cbs-vp9-vp91-2-04-yuv444
 create mode 100644 tests/ref/fate/cbs-vp9-vp92-2-20-10bit-yuv420
 create mode 100644 tests/ref/fate/cbs-vp9-vp93-2-20-10bit-yuv422
 create mode 100644 tests/ref/fate/cbs-vp9-vp93-2-20-12bit-yuv444

diff --git a/tests/fate/cbs.mak b/tests/fate/cbs.mak
index fc5967e6f3..d4658fae81 100644
--- a/tests/fate/cbs.mak
+++ b/tests/fate/cbs.mak
@@ -2,9 +2,9 @@
 # arguments, it decomposes the stream fully and then recomposes it
 # without making any changes.
 
-fate-cbs: fate-cbs-h264 fate-cbs-hevc fate-cbs-mpeg2
+fate-cbs: fate-cbs-h264 fate-cbs-hevc fate-cbs-mpeg2 fate-cbs-vp9
 
-FATE_CBS_DEPS = $(call ALLYES, $(1)_DEMUXER $(1)_PARSER $(2)_METADATA_BSF 
$(3)_DECODER $(3)_MUXER)
+FATE_CBS_DEPS = $(call ALLYES, $(1)_DEMUXER $(2)_PARSER $(3)_METADATA_BSF 
$(4)_DECODER $(5)_MUXER)
 
 define FATE_CBS_TEST
 # (codec, test_name, sample_file, output_format)
@@ -32,7 +32,7 @@ FATE_CBS_H264_SAMPLES =   \
 
 $(foreach N,$(FATE_CBS_H264_SAMPLES),$(eval $(call 
FATE_CBS_TEST,h264,$(basename $(N)),h264-conformance/$(N),h264)))
 
-FATE_CBS_H264-$(call FATE_CBS_DEPS, H264, H264, H264) = $(FATE_CBS_h264)
+FATE_CBS_H264-$(call FATE_CBS_DEPS, H264, H264, H264, H264, H264) = 
$(FATE_CBS_h264)
 FATE_SAMPLES_AVCONV += $(FATE_CBS_H264-yes)
 fate-cbs-h264: $(FATE_CBS_H264-yes)
 
@@ -61,7 +61,7 @@ FATE_CBS_HEVC_SAMPLES =   \
 
 $(foreach N,$(FATE_CBS_HEVC_SAMPLES),$(eval $(call 
FATE_CBS_TEST,hevc,$(basename $(N)),hevc-conformance/$(N),hevc)))
 
-FATE_CBS_HEVC-$(call FATE_CBS_DEPS, HEVC, HEVC, HEVC) = $(FATE_CBS_hevc)
+FATE_CBS_HEVC-$(call FATE_CBS_DEPS, HEVC, HEVC, HEVC, HEVC, HEVC) = 
$(FATE_CBS_hevc)
 FATE_SAMPLES_AVCONV += $(FATE_CBS_HEVC-yes)
 fate-cbs-hevc: $(FATE_CBS_HEVC-yes)
 
@@ -74,6 +74,30 @@ FATE_CBS_MPEG2_SAMPLES = \
 
 $(foreach N,$(FATE_CBS_MPEG2_SAMPLES),$(eval $(call 
FATE_CBS_TEST,mpeg2,$(basename $(N)),mpeg2/$(N),mpeg2video)))
 
-FATE_CBS_MPEG2-$(call FATE_CBS_DEPS, MPEGVIDEO, MPEG2, MPEG2VIDEO) = 
$(FATE_CBS_mpeg2)
+FATE_CBS_MPEG2-$(call FATE_CBS_DEPS, MPEGVIDEO, MPEGVIDEO, MPEG2, MPEG2VIDEO, 
MPEG2VIDEO) = $(FATE_CBS_mpeg2)
 FATE_SAMPLES_AVCONV += $(FATE_CBS_MPEG2-yes)
 fate-cbs-mpeg2: $(FATE_CBS_MPEG2-yes)
+
+# VP9 read/write
+
+FATE_CBS_VP9_SAMPLES =  \
+vp90-2-03-deltaq.webm   \
+vp90-2-05-resize.ivf\
+vp90-2-06-bilinear.webm \
+vp90-2-09-lf_deltas.webm\
+vp90-2-10-show-existing-frame.webm  \
+vp90-2-10-show-existing-frame2.webm \
+vp90-2-segmentation-aq-akiyo.webm   \
+vp90-2-segmentation-sf-akiyo.webm   \
+vp90-2-tiling-pedestrian.webm   \
+vp91-2-04-yuv422.webm   \
+vp91-2-04-yuv444.webm   \
+vp92-2-20-10bit-yuv420.webm \
+vp93-2-20-10bit-yuv422.webm \
+vp93-2-20-12bit-yuv444.webm
+
+$(foreach N,$(FATE_CBS_VP9_SAMPLES),$(eval $(call FATE_CBS_TEST,vp9,$(basename 
$(N)),vp9-test-vectors/$(N),ivf)))
+
+FATE_CBS_VP9-$(call FATE_CBS_DEPS, IVF, VP9, VP9, VP9, IVF) = $(FATE_CBS_vp9)
+FATE_SAMPLES_AVCONV += $(FATE_CBS_VP9-yes)
+fate-cbs-vp9: $(FATE_CBS_VP9-yes)
diff --git 

[FFmpeg-devel] [PATCH 2/3] lavc: Add VP9 metadata bitstream filter

2018-04-08 Thread Mark Thompson
Can adjust the colour information.
---
 configure  |   1 +
 libavcodec/Makefile|   1 +
 libavcodec/bitstream_filters.c |   1 +
 libavcodec/vp9_metadata_bsf.c  | 162 +
 4 files changed, 165 insertions(+)
 create mode 100644 libavcodec/vp9_metadata_bsf.c

diff --git a/configure b/configure
index 890de64ab4..28970cbdf8 100755
--- a/configure
+++ b/configure
@@ -2986,6 +2986,7 @@ hevc_metadata_bsf_select="cbs_h265"
 mjpeg2jpeg_bsf_select="jpegtables"
 mpeg2_metadata_bsf_select="cbs_mpeg2"
 trace_headers_bsf_select="cbs"
+vp9_metadata_bsf_select="cbs_vp9"
 
 # external libraries
 aac_at_decoder_deps="audiotoolbox"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 6ee16d855b..1a172f5597 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1067,6 +1067,7 @@ OBJS-$(CONFIG_NULL_BSF)   += null_bsf.o
 OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF)   += remove_extradata_bsf.o
 OBJS-$(CONFIG_TEXT2MOVSUB_BSF)+= movsub_bsf.o
 OBJS-$(CONFIG_TRACE_HEADERS_BSF)  += trace_headers_bsf.o
+OBJS-$(CONFIG_VP9_METADATA_BSF)   += vp9_metadata_bsf.o
 OBJS-$(CONFIG_VP9_RAW_REORDER_BSF)+= vp9_raw_reorder_bsf.o
 OBJS-$(CONFIG_VP9_SUPERFRAME_BSF) += vp9_superframe_bsf.o
 OBJS-$(CONFIG_VP9_SUPERFRAME_SPLIT_BSF)   += vp9_superframe_split_bsf.o
diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c
index 18b698a85f..c21373621c 100644
--- a/libavcodec/bitstream_filters.c
+++ b/libavcodec/bitstream_filters.c
@@ -49,6 +49,7 @@ extern const AVBitStreamFilter ff_null_bsf;
 extern const AVBitStreamFilter ff_remove_extradata_bsf;
 extern const AVBitStreamFilter ff_text2movsub_bsf;
 extern const AVBitStreamFilter ff_trace_headers_bsf;
+extern const AVBitStreamFilter ff_vp9_metadata_bsf;
 extern const AVBitStreamFilter ff_vp9_raw_reorder_bsf;
 extern const AVBitStreamFilter ff_vp9_superframe_bsf;
 extern const AVBitStreamFilter ff_vp9_superframe_split_bsf;
diff --git a/libavcodec/vp9_metadata_bsf.c b/libavcodec/vp9_metadata_bsf.c
new file mode 100644
index 00..be010edc3f
--- /dev/null
+++ b/libavcodec/vp9_metadata_bsf.c
@@ -0,0 +1,162 @@
+/*
+ * 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/avstring.h"
+#include "libavutil/common.h"
+#include "libavutil/opt.h"
+
+#include "bsf.h"
+#include "cbs.h"
+#include "cbs_vp9.h"
+
+typedef struct VP9MetadataContext {
+const AVClass *class;
+
+CodedBitstreamContext *cbc;
+CodedBitstreamFragment fragment;
+
+int color_space;
+int color_range;
+
+int color_range_rgb_warned;
+} VP9MetadataContext;
+
+
+static int vp9_metadata_filter(AVBSFContext *bsf, AVPacket *out)
+{
+VP9MetadataContext *ctx = bsf->priv_data;
+AVPacket *in = NULL;
+CodedBitstreamFragment *frag = >fragment;
+int err, i;
+
+err = ff_bsf_get_packet(bsf, );
+if (err < 0)
+return err;
+
+err = ff_cbs_read_packet(ctx->cbc, frag, in);
+if (err < 0) {
+av_log(bsf, AV_LOG_ERROR, "Failed to read packet.\n");
+goto fail;
+}
+
+for (i = 0; i < frag->nb_units; i++) {
+VP9RawFrame *frame = frag->units[i].content;
+VP9RawFrameHeader *header = >header;
+
+if (ctx->color_space >= 0) {
+header->color_space = ctx->color_space;
+}
+if (ctx->color_range >= 0) {
+if (ctx->color_range == 0 &&
+header->color_space == VP9_CS_RGB &&
+!ctx->color_range_rgb_warned) {
+av_log(bsf, AV_LOG_WARNING, "Warning: color_range cannot "
+   "be set to limited in RGB streams.\n");
+ctx->color_range_rgb_warned = 1;
+} else {
+header->color_range = ctx->color_range;
+}
+}
+}
+
+err = ff_cbs_write_packet(ctx->cbc, out, frag);
+if (err < 0) {
+av_log(bsf, AV_LOG_ERROR, "Failed to write packet.\n");
+goto fail;
+}
+
+err = av_packet_copy_props(out, in);
+if (err < 0)
+goto fail;
+
+err = 0;
+fail:
+ff_cbs_fragment_uninit(ctx->cbc, frag);
+
+if (err < 0)
+av_packet_unref(out);
+av_packet_free();
+
+return err;
+}
+
+static int 

Re: [FFmpeg-devel] [PATCH] lavc/amfenc: Retain a reference to D3D frames used as input during the encoding process

2018-04-08 Thread Mark Thompson
On 06/04/18 11:25, Alexander Kravchenko wrote:
>>
>> This breaks the testcase described in
>> https://trac.ffmpeg.org/ticket/6990 which is basically the same as the
>> one you described in this patch.
>>
>> I get the following spammed repeatedly:
>>
>> [AVHWFramesContext @ 0502d340] Static surface pool size exceeded.
>> [mpeg2video @ 02f8d400] get_buffer() failed
>> [mpeg2video @ 02f8d400] thread_get_buffer() failed
>> [mpeg2video @ 02f8d400] get_buffer() failed (-12 )
>> Error while decoding stream #0:1: Operation not permitted
> 
> Hi, could you please review the following updated patch
> I added queue limit according initial pool size of incoming frame context.
> This solves the problem running this pipeline without -extra_hw_frames 16 
> option, but -extra_hw_frames option can be used to have bigger queue for 
> encoder.

I think you've misunderstood /why/ the decoder has the pool size allocation 
that it does.  The decoder expects to use all of the surfaces it has allocated 
in the worst case - the difference between MPEG-2 and H.264 is that MPEG-2 can 
store at most two reference frames (the forward and backward references for 
B-frames), while H.264 can store up to sixteen.  Most H.264 streams don't use 
all sixteen references, but in theory they could (excepting level restrictions, 
but they are generally quite iffy) so the decoder allocates space for all of 
those references even if they aren't used.

I can believe that this patch happens to work if you have a simple stream with 
limited references (streams rarely use more than two or three), but it will 
certainly fail exactly as before for complex streams.

If you want to hold onto more than one frame in the encoder then currently you 
need to use the -extra_hw_frames option on the source (whether decoder or 
filter) - that is exactly what it's there for.  Some sort of automatic 
negotiation is suggested (there was some discussion on libav-devel a while 
ago), but the requirement that it works through libavfilter is a difficult one 
with the current structure so nothing concrete is yet proposed.  (That was 
mostly considering libmfx, where it's even more of a problem because the 
lookahead options can make the encoder queue over a hundred frames internally.)

> ---
>  libavcodec/amfenc.c | 97 
> -
>  libavcodec/amfenc.h |  3 ++
>  2 files changed, 99 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c
> index 89a10ff253..eb7b20c252 100644
> --- a/libavcodec/amfenc.c
> +++ b/libavcodec/amfenc.c
> @@ -157,6 +157,9 @@ static int amf_init_context(AVCodecContext *avctx)
>  AmfContext *ctx = avctx->priv_data;
>  AMF_RESULT  res = AMF_OK;
>  
> +ctx->hwsurfaces_in_queue = 0;
> +ctx->hwsurfaces_in_queue_max = 16;
> +
>  // configure AMF logger
>  // the return of these functions indicates old state and do not affect 
> behaviour
>  ctx->trace->pVtbl->EnableWriter(ctx->trace, 
> AMF_TRACE_WRITER_DEBUG_OUTPUT, ctx->log_to_dbg != 0 );
> @@ -187,6 +190,7 @@ static int amf_init_context(AVCodecContext *avctx)
>  if (!ctx->hw_frames_ctx) {
>  return AVERROR(ENOMEM);
>  }
> +ctx->hwsurfaces_in_queue_max = 
> device_ctx->initial_pool_size - 1;
>  } else {
>  if(res == AMF_NOT_SUPPORTED)
>  av_log(avctx, AV_LOG_INFO, "avctx->hw_frames_ctx 
> has D3D11 device which doesn't have D3D11VA interface, switching to 
> default\n");
> @@ -443,6 +447,73 @@ int ff_amf_encode_init(AVCodecContext *avctx)
>  return ret;
>  }
>  
> +#define AMF_AV_QUERY_INTERFACE(res, from, InterfaceTypeTo, to) \
> +{ \
> +AMFGuid guid_##InterfaceTypeTo = IID_##InterfaceTypeTo(); \
> +res = from->pVtbl->QueryInterface(from, _##InterfaceTypeTo, 
> (void**)); \
> +}
> +
> +#define AMF_AV_ASSIGN_PROPERTY_INTERFACE(res, pThis, name, val) \
> +{ \
> +AMFInterface *amf_interface; \
> +AMFVariantStruct var; \
> +res = AMFVariantInit(); \
> +if (res == AMF_OK) { \
> +AMF_AV_QUERY_INTERFACE(res, val, AMFInterface, amf_interface)\
> +if (res == AMF_OK) { \
> +res = AMFVariantAssignInterface(, amf_interface); \
> +amf_interface->pVtbl->Release(amf_interface); \
> +} \
> +if (res == AMF_OK) { \
> +res = pThis->pVtbl->SetProperty(pThis, name, var); \
> +} \
> +AMFVariantClear(); \
> +}\
> +}
> +
> +#define AMF_AV_GET_PROPERTY_INTERFACE(res, pThis, name, TargetType, val) \
> +{ \
> +AMFVariantStruct var; \
> +res = AMFVariantInit(); \
> +if (res == AMF_OK) { \
> +res = pThis->pVtbl->GetProperty(pThis, name, ); \
> +if 

Re: [FFmpeg-devel] Add IRC nicknames to MAINTAINERS?

2018-04-08 Thread Lou Logan
On Sun, Apr 8, 2018, at 3:05 AM, Tomas Härdin wrote:
>
> Good suggestion
> 
> /Tomas

Patch LGTM with the suggestion from James. Although I'm not on IRC very often 
lately you can add mine too if you feel like it: llogan.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] configure: check for INIT_ONCE before enabling w32threads

2018-04-08 Thread James Almer
Should fix compilation wiht some old mingw-w64 builds that
don't seem to define it.

Signed-off-by: James Almer 
---
 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 08d6fc5983..3bae584ab0 100755
--- a/configure
+++ b/configure
@@ -5883,6 +5883,7 @@ check_cpp_condition winrt windows.h 
"!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_D
 if ! disabled w32threads && ! enabled pthreads; then
 check_func_headers "windows.h process.h" _beginthreadex &&
 check_type "windows.h" CONDITION_VARIABLE &&
+check_type "windows.h" INIT_ONCE &&
 enable w32threads || disable w32threads
 if ! enabled w32threads && enabled winrt; then
 check_func_headers "windows.h" CreateThread &&
-- 
2.16.2

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


[FFmpeg-devel] [PATCH] configure: check that the required header for Linux Perf is available

2018-04-08 Thread James Almer
Should fix compilation on targets like some old Android NDK versions.

Signed-off-by: James Almer 
---
 configure | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure b/configure
index 08d6fc5983..4ea30762f4 100755
--- a/configure
+++ b/configure
@@ -2016,6 +2016,7 @@ HEADERS_LIST="
 ES2_gl_h
 gsm_h
 io_h
+linux_perf_event_h
 machine_ioctl_bt848_h
 machine_ioctl_meteor_h
 malloc_h
@@ -2478,6 +2479,7 @@ simd_align_32_if_any="avx"
 simd_align_64_if_any="avx512"
 
 # system capabilities
+linux_perf_deps="linux_perf_event_h"
 symver_if_any="symver_asm_label symver_gnu_asm"
 valgrind_backtrace_conflict="optimizations"
 valgrind_backtrace_deps="valgrind_valgrind_h"
@@ -5800,6 +5802,7 @@ check_header dxgidebug.h
 check_header dxva.h
 check_header dxva2api.h -D_WIN32_WINNT=0x0600
 check_header io.h
+check_header linux/perf_event.h
 check_header libcrystalhd/libcrystalhd_if.h
 check_header malloc.h
 check_header net/udplite.h
-- 
2.16.2

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


[FFmpeg-devel] avdevice/sdl output : fix window_size and add new option (WIP)

2018-04-08 Thread Martin Vignali
Hello,

In attach patchs to improve SDL Output device
(Missing doc update)

- 001 : Fix -window_size option
Before this patch, window_size is always set to the source size
In other word, -window_size option have no effect.

To test :
./ffmpeg -f lavfi -i smptehdbars=hd1080 -c:v rawvideo -pix_fmt yuv420p
-window_size 1024x576 -f sdl "SDL output with Custom Size"

- 002 : Add option to set the position of the window
the default behaviour doesn't change (set the position to undefined)

To test :
./ffmpeg -f lavfi -i smptehdbars=hd1080 -c:v rawvideo -pix_fmt yuv420p
-window_size 1024x576 -window_pos_x 30 -window_pos_y 100 -f sdl "SDL output
With Custom size pos"

- 003 : Add option to disable quit action
Without this patch, the window can be close by the user
if this new option is set, the window can't be close (by "close" window
btn, escape, or "q")
The default behaviour doesn't change

To test :
./ffmpeg -re -f lavfi -i smptehdbars=hd1080:duration=10 -c:v rawvideo
-pix_fmt yuv420p -window_enable_quit 0 -f sdl "SDL output Without Quit"


Comments Welcome

Martin


0001-avdevice-sdl2output-fix-setting-window_size.patch
Description: Binary data


0002-avdevice-sdl2-add-option-for-setting-window-position.patch
Description: Binary data


0003-avdevice-sdl2-add-option-to-define-if-the-window-qui.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] [RFC]doc/examples: alternative input handler

2018-04-08 Thread Bodecs Bela



2018.04.06. 0:39 keltezéssel, Michael Niedermayer írta:

On Fri, Mar 30, 2018 at 02:47:25PM +0200, Bodecs Bela wrote:

Hi All,

regularly, on different forums and mailing lists a requirement popups for a
feature to automatically failover switching between main input and a
secondary input in case of main input unavailability.

The base motivation: let's say you have a unreliable live stream source and
you
want to transcode its video and audio streams in realtime but you
want to survive the ocasions when the source is unavailable. So use a
secondary live source but the transition should occur seamlessly without
breaking/re-starting the transcoding processs.

Some days ago there was a discussion on devel-irc about this topic and we
concluded that this feature is not feasible inside ffmpeg without "hacking",
but a separate client app could do this.

So I created this example app to handle two separate input sources and
switching realtime between them. I am not sure wheter it should be inside
the tools subdir.

The detailed description is available in the header section of the source
file.

I will appretiate your suggestions about it.

Thank you in advance.

best,

Bela Bodecs


  configure|2
  doc/examples/Makefile|1
  doc/examples/Makefile.example|1
  doc/examples/alternative_input.c | 1233 
+++

You may want to add yourself to MAINTAINERS, so it is not unmaintained

ok

I think this is complex enough that it needs a maintainer



May I take your response as you agree to inlcude this as an example app?




[...]


+static int open_single_input(int input_index)
+{
+int ret, i;
+AVInputFormat *input_format = NULL;
+AVDictionary * input_options = NULL;
+AVFormatContext * input_fmt_ctx = NULL;
+
+if (app_ctx.input_format_names[input_index]) {
+if (!(input_format = 
av_find_input_format(app_ctx.input_format_names[input_index]))) {
+timed_log(AV_LOG_ERROR, "Input #%d Unknown input format: '%s'\n", 
input_index,
+  app_ctx.input_format_names[input_index]);
+return EINVAL;
+}
+}
+
+av_dict_set(_options, "rw_timeout", "200", 0);
+av_dict_set(_options, "timeout", "2000", 0);
+if ((app_ctx.input_fmt_ctx[input_index] = avformat_alloc_context()) < 0)
+return AVERROR(ENOMEM);

i guess this was intended to be "!= NULL"

yes, I will fix it


also you are mixing EINVAL with AVERROR(ENOMEM) these arent compatible.
Either all should be AVERROR or none

ok, should I will modify EIVAL all of them to AVERROR(EINVAL)?



thx

[...]



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

thank you,

bb

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


[FFmpeg-devel] swscale/unscaled : Remove MMXext version of shufflebyte2103 and uyvyto422

2018-04-08 Thread Martin Vignali
Hello,

Patchs in attach remove mmxext version of shufflebytes2103 and uyvyto422

Checkasm test show that mmxext version is slower than MMX version

Also disable MMXext for "internal" func : extract_even2
(only use by uyvyto422)


Martin


0002-swscale-swscale_unscaled-remove-mmext-version-of-shu.patch
Description: Binary data


0003-swscale-swscale_unscaled-remove-mmext-version-of.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3] avcodec/arm/hevcdsp_sao : add NEON optimization for sao

2018-04-08 Thread Shengbin Meng
LGTM.

Regards,
Shengbin Meng

> On 27 Mar 2018, at 20:43, Yingming Fan  wrote:
> 
> From: Meng Wang 
> 
> Signed-off-by: Meng Wang 
> ---
> This v3 patch removed unused codes 'stride_dst /= sizeof(uint8_t);' compared 
> to v1. V1 have this codes because we referred to hevc dsp template codes.
> Also removed type cast like 'uint8_t *dst = (uint8_t *)_dst;' compared to v2.
> 
> As FFmpeg hevc decoder have no SAO neon optimization, we add sao_band and 
> sao_edge neon codes in this patch.
> I have already submit a patch called 'checkasm/hevc_sao : add hevc_sao for 
> checkasm' several days ago.
> Results below was printed by hevc_sao checkasm on an armv7 device Nexus 5. 
> From the results we can see: hevc_sao_band speed up ~2x, hevc_sao_edge speed 
> up ~4x. 
> Also passed FATE under armv7 linux and x86_64 linux MacOS.
> 
> hevc_sao_band_8x8_8_c: 804.9
> hevc_sao_band_8x8_8_neon: 452.4
> hevc_sao_band_16x16_8_c: 2638.1
> hevc_sao_band_16x16_8_neon: 1169.9
> hevc_sao_band_32x32_8_c: 9259.9
> hevc_sao_band_32x32_8_neon: 3956.1
> hevc_sao_band_48x48_8_c: 20344.6
> hevc_sao_band_48x48_8_neon: 8649.6
> hevc_sao_band_64x64_8_c: 35684.6
> hevc_sao_band_64x64_8_neon: 15213.1
> hevc_sao_edge_8x8_8_c: 1761.6
> hevc_sao_edge_8x8_8_neon: 414.6
> hevc_sao_edge_16x16_8_c: 6844.4
> hevc_sao_edge_16x16_8_neon: 1589.9
> hevc_sao_edge_32x32_8_c: 27156.4
> hevc_sao_edge_32x32_8_neon: 6116.6
> hevc_sao_edge_48x48_8_c: 60004.6
> hevc_sao_edge_48x48_8_neon: 13686.4
> hevc_sao_edge_64x64_8_c: 106708.1
> hevc_sao_edge_64x64_8_neon: 24240.1
> 
> libavcodec/arm/Makefile|   3 +-
> libavcodec/arm/hevcdsp_init_neon.c |  59 
> libavcodec/arm/hevcdsp_sao_neon.S  | 181 +
> 3 files changed, 242 insertions(+), 1 deletion(-)
> create mode 100644 libavcodec/arm/hevcdsp_sao_neon.S
> 
> diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
> index 1eeac5449e..9c164f82ae 100644
> --- a/libavcodec/arm/Makefile
> +++ b/libavcodec/arm/Makefile
> @@ -136,7 +136,8 @@ NEON-OBJS-$(CONFIG_DCA_DECODER)+= 
> arm/synth_filter_neon.o
> NEON-OBJS-$(CONFIG_HEVC_DECODER)   += arm/hevcdsp_init_neon.o   \
>   arm/hevcdsp_deblock_neon.o\
>   arm/hevcdsp_idct_neon.o   \
> -  arm/hevcdsp_qpel_neon.o
> +  arm/hevcdsp_qpel_neon.o   \
> +  arm/hevcdsp_sao_neon.o
> NEON-OBJS-$(CONFIG_RV30_DECODER)   += arm/rv34dsp_neon.o
> NEON-OBJS-$(CONFIG_RV40_DECODER)   += arm/rv34dsp_neon.o\
>   arm/rv40dsp_neon.o
> diff --git a/libavcodec/arm/hevcdsp_init_neon.c 
> b/libavcodec/arm/hevcdsp_init_neon.c
> index a4628d2a93..201a088dac 100644
> --- a/libavcodec/arm/hevcdsp_init_neon.c
> +++ b/libavcodec/arm/hevcdsp_init_neon.c
> @@ -21,8 +21,16 @@
> #include "libavutil/attributes.h"
> #include "libavutil/arm/cpu.h"
> #include "libavcodec/hevcdsp.h"
> +#include "libavcodec/avcodec.h"
> #include "hevcdsp_arm.h"
> 
> +void ff_hevc_sao_band_filter_neon_8_wrapper(uint8_t *_dst, uint8_t *_src,
> +  ptrdiff_t stride_dst, ptrdiff_t stride_src,
> +  int16_t *sao_offset_val, int 
> sao_left_class,
> +  int width, int height);
> +void ff_hevc_sao_edge_filter_neon_8_wrapper(uint8_t *_dst, uint8_t *_src, 
> ptrdiff_t stride_dst, int16_t *sao_offset_val,
> +  int eo, int width, int height);
> +
> void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int 
> _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
> void ff_hevc_h_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int 
> _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
> void ff_hevc_v_loop_filter_chroma_neon(uint8_t *_pix, ptrdiff_t _stride, int 
> *_tc, uint8_t *_no_p, uint8_t *_no_q);
> @@ -142,6 +150,47 @@ QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v2_neon_8);
> QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v3_neon_8);
> #undef QPEL_FUNC_UW
> 
> +void ff_hevc_sao_band_filter_neon_8(uint8_t *dst, uint8_t *src, ptrdiff_t 
> stride_dst, ptrdiff_t stride_src, int width, int height, int16_t 
> *offset_table);
> +
> +void ff_hevc_sao_band_filter_neon_8_wrapper(uint8_t *_dst, uint8_t *_src,
> +  ptrdiff_t stride_dst, ptrdiff_t stride_src,
> +  int16_t *sao_offset_val, int 
> sao_left_class,
> +  int width, int height) {
> +uint8_t *dst = _dst;
> +uint8_t *src = _src;
> +int16_t offset_table[32] = {0};
> +int k;
> +
> +for (k = 0; k < 4; k++) {
> +offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1];
> +}
> +
> +

Re: [FFmpeg-devel] Add IRC nicknames to MAINTAINERS?

2018-04-08 Thread Tomas Härdin
lör 2018-04-07 klockan 10:00 -0300 skrev James Almer:
> On 4/7/2018 9:08 AM, Tomas Härdin wrote:
> > Hi
> > 
> > It's come up a couple of times that IRC nicknames would be useful. I at
> > least tend to answer IRC much more quickly than email. Something like
> > patch attached maybe?
> > 
> > /Tomas
> > 
> > 
> > 0001-Add-IRC-nicknames.patch
> > 
> > 
> > From 03225dda47c73c3323c3276353d0ac896123cd3f Mon Sep 17 00:00:00 2001
> > > > From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= 
> > Date: Sat, 7 Apr 2018 12:18:00 +0200
> > Subject: [PATCH] Add IRC nicknames
> > 
> > ---
> >  MAINTAINERS | 8 +---
> >  1 file changed, 5 insertions(+), 3 deletions(-)
> > 
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 3c54ad6781..e94e07641f 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -574,8 +574,10 @@ Releases
> >  If you want to maintain an older release, please contact us
> >  
> >  
> > -GnuPG Fingerprints of maintainers and contributors
> > -==
> > +GnuPG Fingerprints and IRC nicknames of maintainers and contributors
> > +
> > +
> > +Nicknames apply to #ffmpeg and #ffmpeg-devel @ irc.freenode.net
> >  
> >  Alexander Strasser1C96 78B7 83CB 8AA7 9AF5 D1EB A7D8 A57B A876 
> > E58F
> >  Anssi Hannula 1A92 FF42 2DD9 8D2E 8AF7 65A9 4278 C520 513D 
> > F3CB
> > @@ -610,5 +612,5 @@ Steinar H. Gunderson  C2E9 004F F028 C18E 4EAD 
> > DB83 7F61 7561 7797 8F76
> >  Stephan Hilb  4F38 0B3A 5F39 B99B F505 E562 8D5C 5554 4E17 
> > 8863
> >  Tiancheng "Timothy" Gu9456 AFC0 814A 8139 E994 8351 7FE6 B095 B582 
> > B0D4
> >  Tim Nicholson 38CF DB09 3ED0 F607 8B67 6CED 0C0B FC44 8B0B 
> > FC83
> > -Tomas Härdin  A79D 4E3D F38F 763F 91F5 8B33 A01E 8AE0 41BB 
> > 2551
> > +Tomas Härdin  A79D 4E3D F38F 763F 91F5 8B33 A01E 8AE0 41BB 
> > 2551 thardin
> 
>    Real Name (nick)  FINGERPRINT
> 
> Would look better, IMO.

Good suggestion

/Tomas



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


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: fix handling of delete_segments when %v is present

2018-04-08 Thread Steven Liu


> On 6 Apr 2018, at 18:27, Bodecs Bela  wrote:
> 
> Dear All,
> 
> when var_stream_map option is used, %v must appear either in segment name 
> template or in the directory path. This latter case currently is not handled 
> and using delete_segments flag of hls_flags is broken now. This patch fixes 
> this issue.
> The root cause of the bug was that HLSSegment struct only stores the final 
> filename part, but not the final directory path. Most of the cases, final 
> path info is unneded, It only necessary when you want to delete old segments 
> (e.g in case of live streaming).
> Without variant streams it was unnecessary to store the final directory path, 
> because all segment were stored into the same directory. But introducing %v 
> in directory names either require to store the final directory path into 
> HLSSegment or associate segments with their variant streams to be able 
> deleting them later. I have choosen the second solution and introduced a 
> variant index data member into the segment struct.
> 
> please review this patch.
> 
> thank you in advance,
> 
> Bela Bodecs
> 
> 
> <0001-avformat-hlsenc-fix-handling-of-delete_segments-when.patch>___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

LGTM
Thanks
Steven





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


Re: [FFmpeg-devel] [PATCH v2] lavc/hevc: Don't parse NAL unit for a dummy buffer

2018-04-08 Thread Steven Liu


> On 8 Apr 2018, at 12:53, Xiang, Haihao  wrote:
> 
> 
> 
> Hi Steven,
> 
> Are there more comments on this patch? 
> 
> Thanks
> Haihao
> 
> 
>> hevc parser mistakenly reports the following message if a dummy buffer
>> is padded for EOF
>> 
>>   [hevc @ 0x559b63848610] missing picture in access unit
>> 
>> v2: use the preferred code style and rebase the patch
>> 
>> Signed-off-by: Haihao Xiang 
>> ---
>> libavcodec/hevc_parser.c | 7 ++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>> 
>> diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
>> index a468682ed3..01418b276d 100644
>> --- a/libavcodec/hevc_parser.c
>> +++ b/libavcodec/hevc_parser.c
>> @@ -294,6 +294,8 @@ static int hevc_parse(AVCodecParserContext *s,
>> AVCodecContext *avctx,
>> int next;
>> HEVCParserContext *ctx = s->priv_data;
>> ParseContext *pc = >pc;
>> +int is_dummy_buf = !buf_size;
>> +const uint8_t *dummy_buf = buf;
>> 
>> if (avctx->extradata && !ctx->parsed_extradata) {
>> ff_hevc_decode_extradata(avctx->extradata, avctx->extradata_size,
>> >ps, >sei,
>> @@ -313,7 +315,10 @@ static int hevc_parse(AVCodecParserContext *s,
>> AVCodecContext *avctx,
>> }
>> }
>> 
>> -parse_nal_units(s, buf, buf_size, avctx);
>> +is_dummy_buf = (is_dummy_buf && (dummy_buf == buf));
>> +
>> +if (!is_dummy_buf)
>> +parse_nal_units(s, buf, buf_size, avctx);
>> 
>> *poutbuf  = buf;
>> *poutbuf_size = buf_size;

LGTM

Thanks
Steven





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