Re: [FFmpeg-devel] Ffmpeg, UDP input source from satellite audio sync issues

2018-06-21 Thread Ibrahim Tachijian
Hello Devin,

Thank you for all your input. I understand the A/V sync issues is a hard
task and we need to save the original video to catch where the issue
happened.

You may be well served to simultaneously write out a copy of the
> original TS to disk prior to transcoding.  This will allow you to
> debug cases where A/V sync was lost and reproduce the issue.  Also,
> it's much easier to be able to hand a sample to the developers and say
> "Try this 100MB sample and you can see for yourself" as opposed to not
> being able to provide any detail as to specifically what the source of
> the A/V sync issue was.
>

I will do my best to save the source and transcoded output to file to see
where the A/V sync started so that it can be easily reproduced.


> Also, bear in mind that the issue could be on the transcoding or the
> resulting decoder you are using to view the stream, and restarting the
> transcoder may cause the issue to "go away" in the decoder just
> because the stream is reset.  When dealing with A/V sync issues I
> commonly find two classes of issues:


Isn't the decoder considered "reset" everytime I re-launch VLC (if I see
sync issues in VLC) ? If yes then I can mostly rule out decoder issues.


I have another question for anyone who can answer it. I currently today do
a "ffprobe -i /tmp/hls/playlist.m3u8 -show_streams" and look at the audio
and videos "start_time" and I look at the difference.

I am currently considering a stream to be "out of sync" when the difference
is above 1.

What does difference of 1 in start_pts actually mean? Is it wrong or
correct to consider A/V out of sync when there is a difference in start_pts
?


-- 
*Ibrahim Tachijian*

CEO Net Sat AB
Mobile: +46723321377
bar...@netsat.se

_


*Net Sat ABC/O Jayway AB*Klara Östra Kyrkogata 2B, 1TR, 111 52 Stockholm,
Sweden
Office: +46 (0)8 408 394 53
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] rpza: fix the bounds check

2018-06-21 Thread Carl Eugen Hoyos
2018-06-21 5:46 GMT+02:00, Xiao Yang :
> Fixes invalid writes when there are more blocks in a run
> than total remaining blocks

Please provide a test-case that allows to reproduce the
issue your patch fixes.

> (see CVE-2014-8548)
> ---
>  libavcodec/rpza.c |5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/libavcodec/rpza.c b/libavcodec/rpza.c
> index b71ebd1..7cb6b89 100644
> --- a/libavcodec/rpza.c
> +++ b/libavcodec/rpza.c
> @@ -68,6 +68,11 @@ typedef struct RpzaContext {
>  row_ptr  += stride * 4; \
>  }   \
>  total_blocks--; \
> +if (total_blocks < !!n_blocks) \
> +{ \
> +av_log(s->avctx, AV_LOG_INFO, "warning: block
> counter just went negative (this should not happen)\n"); \

> +return; \

This produces several warnings at compile time, please fix them.

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


Re: [FFmpeg-devel] ffmpeg patch for nonmonolithic increase dts error in subtitle

2018-06-21 Thread Carl Eugen Hoyos
2018-06-21 7:40 GMT+02:00, Markus Kohm :
> Am Mittwoch, 20. Juni 2018, 22:54:34 CEST schrieb Michael Niedermayer:
>> Please post a git compatible patch
>
> see attachtment

This is exactly the same attachment as in your original mail...

Who wrote the patch / where did you find it?

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


Re: [FFmpeg-devel] [PATCH] libavformat/yuv4mpeg: Add color range support for Y4M Add color_range support in Y4M. Also set pixel format and color_range for YUVJ pixel formats.

2018-06-21 Thread Carl Eugen Hoyos
2018-06-20 11:42 GMT+02:00, Wang Cao :
> It's in the yuv4mpegenc.c. I added a support for color range
> by specifying metadata in the Y4M header.

Yes, I understand.

My question was which authority defined this metadata for
y4m? Or which (non-FFmpeg-based) other software
understands the metadata your patch adds to the files.

Please do not top-post here, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH]lavc/libopenjpeg: Support GRAY10, GRAY12 and GRAY14

2018-06-21 Thread Carl Eugen Hoyos
Hi!

Attached patch allows to create (and read) gray1x samples with libopenjpeg.

Please comment, Carl Eugen
From 25c4a1ea0afae9fb3561fd928552133ddcf70d05 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Thu, 21 Jun 2018 12:05:40 +0200
Subject: [PATCH] lavc/libopenjpeg: Support GRAY10, GRAY12 and GRAY14.

---
 libavcodec/libopenjpegdec.c |1 +
 libavcodec/libopenjpegenc.c |7 +++
 2 files changed, 8 insertions(+)

diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c
index 5e66cd9..344c5ba 100644
--- a/libavcodec/libopenjpegdec.c
+++ b/libavcodec/libopenjpegdec.c
@@ -45,6 +45,7 @@
AV_PIX_FMT_RGB48, AV_PIX_FMT_RGBA64
 
 #define GRAY_PIXEL_FORMATS AV_PIX_FMT_GRAY8, AV_PIX_FMT_YA8,  \
+   AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14, \
AV_PIX_FMT_GRAY16, AV_PIX_FMT_YA16
 
 #define YUV_PIXEL_FORMATS  AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUVA420P, \
diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c
index 7c7d0aa..8627d02 100644
--- a/libavcodec/libopenjpegenc.c
+++ b/libavcodec/libopenjpegenc.c
@@ -191,6 +191,9 @@ static opj_image_t *mj2_create_image(AVCodecContext *avctx, opj_cparameters_t *p
 case AV_PIX_FMT_YA8:
 case AV_PIX_FMT_GRAY16:
 case AV_PIX_FMT_YA16:
+case AV_PIX_FMT_GRAY10:
+case AV_PIX_FMT_GRAY12:
+case AV_PIX_FMT_GRAY14:
 color_space = OPJ_CLRSPC_GRAY;
 break;
 case AV_PIX_FMT_RGB24:
@@ -613,6 +616,9 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
 cpyresult = libopenjpeg_copy_unpacked8(avctx, frame, image);
 break;
 case AV_PIX_FMT_GRAY16:
+case AV_PIX_FMT_GRAY14:
+case AV_PIX_FMT_GRAY12:
+case AV_PIX_FMT_GRAY10:
 case AV_PIX_FMT_YUV420P9:
 case AV_PIX_FMT_YUV422P9:
 case AV_PIX_FMT_YUV444P9:
@@ -763,6 +769,7 @@ AVCodec ff_libopenjpeg_encoder = {
 AV_PIX_FMT_RGBA64, AV_PIX_FMT_GBR24P,
 AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16,
 AV_PIX_FMT_GRAY8, AV_PIX_FMT_YA8, AV_PIX_FMT_GRAY16, AV_PIX_FMT_YA16,
+AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14,
 AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA420P,
 AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA422P,
 AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUVA444P,
-- 
1.7.10.4

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


[FFmpeg-devel] [PATCH] lavc/cfhd: added correct decompanding to codebook0

2018-06-21 Thread Gagandeep Singh
output of samples using codebook 0 improved
---
 libavcodec/cfhd.c | 25 -
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index bf80cb9c07..226b135c07 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -115,7 +115,30 @@ static inline int dequant_and_decompand(int level, int 
quantisation, int codeboo
 {
 if (lossless)
 return level;
-if (codebook == 0 || codebook == 1) {
+if (codebook == 0) {
+if (level >= 40 && level < 264) {
+if (level >= 54) {
+level  -= 54;
+level <<= 2;
+level  += 54;
+}
+level  -= 40;
+level <<= 2;
+level  += 40;
+} else if (level <= -40) {
+level = -level;
+if (level >= 54) {
+level  -= 54;
+level <<= 2;
+level  += 54;
+}
+level  -= 40;
+level <<= 2;
+level  += 40;
+level   = -level;
+}
+return level * quantisation;
+} else if (codebook == 1) {
 int64_t abslevel = abs(level);
 if (level < 264)
 return (abslevel + ((768 * abslevel * abslevel * abslevel) / (255 
* 255 * 255))) *
-- 
2.14.1

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


[FFmpeg-devel] [PATCH v2 1/4] configure: fix check for opencl_vaapi_intel_media.

2018-06-21 Thread Jun Zhao
opencl_vaapi_intel_media doesn't depend on libmfx, OpenCL™ Drivers
and Runtimes for Intel® Architectureis is a standalone release, more
information can be found in the link:
https://software.intel.com/en-us/articles/opencl-drivers.

Signed-off-by: Jun Zhao 
---
 configure| 6 ++
 libavutil/hwcontext_opencl.c | 7 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 6ad5ce8..717b2f1 100755
--- a/configure
+++ b/configure
@@ -6336,10 +6336,8 @@ fi
 
 if enabled_all opencl vaapi ; then
 enabled opencl_drm_beignet && enable opencl_vaapi_beignet
-if enabled libmfx ; then
-check_type "CL/cl.h CL/va_ext.h" 
"clCreateFromVA_APIMediaSurfaceINTEL_fn" &&
-enable opencl_vaapi_intel_media
-fi
+check_type "CL/cl.h CL/va_ext.h" "clCreateFromVA_APIMediaSurfaceINTEL_fn" 
&&
+enable opencl_vaapi_intel_media
 fi
 
 if enabled_all opencl dxva2 ; then
diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index 07458c2..f6cceef 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -46,7 +46,9 @@
 #endif
 
 #if HAVE_OPENCL_VAAPI_INTEL_MEDIA
+#if CONFIG_LIBMFX
 #include 
+#endif
 #include 
 #include 
 #include "hwcontext_vaapi.h"
@@ -2249,10 +2251,13 @@ static int opencl_map_from_qsv(AVHWFramesContext 
*dst_fc, AVFrame *dst,
 cl_int cle;
 int err, p;
 
+#if CONFIG_LIBMFX
 if (src->format == AV_PIX_FMT_QSV) {
 mfxFrameSurface1 *mfx_surface = (mfxFrameSurface1*)src->data[3];
 va_surface = *(VASurfaceID*)mfx_surface->Data.MemId;
-} else if (src->format == AV_PIX_FMT_VAAPI) {
+} else
+#endif
+if (src->format == AV_PIX_FMT_VAAPI) {
 va_surface = (VASurfaceID)(uintptr_t)src->data[3];
 } else {
 return AVERROR(ENOSYS);
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v2 2/4] hwcontext_opencl: dump the device name when can't match device type.

2018-06-21 Thread Jun Zhao
afther the change, we can get more detail debug message like:
"Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz" does not match device type "gpu".

Signed-off-by: Jun Zhao 
---
 libavutil/hwcontext_opencl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index f6cceef..9e96e96 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -430,7 +430,8 @@ static int opencl_filter_device(AVHWDeviceContext *hwdev,
 }
 
 if (!(device_type & match_type)) {
-av_log(hwdev, AV_LOG_DEBUG, "device_type does not match.\n");
+av_log(hwdev, AV_LOG_DEBUG, "\"%s\" does not match device type 
\"%s\".\n",
+   device_name, param->value);
 return 1;
 }
 }
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v2 3/4] hwcontext_opencl: Remove the opencl_device_init in opencl_device_derive

2018-06-21 Thread Jun Zhao
In opencl device derived case, don't need to call opencl_device_init.

Signed-off-by: Jun Zhao 
---
 libavutil/hwcontext_opencl.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index 9e96e96..295d6be 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -1196,7 +1196,7 @@ static int opencl_device_derive(AVHWDeviceContext *hwdev,
 AVHWDeviceContext *src_ctx,
 int flags)
 {
-int err;
+int err = 0;
 switch (src_ctx->type) {
 
 #if HAVE_OPENCL_DRM_BEIGNET
@@ -1362,10 +1362,7 @@ static int opencl_device_derive(AVHWDeviceContext *hwdev,
 break;
 }
 
-if (err < 0)
-return err;
-
-return opencl_device_init(hwdev);
+return err;
 }
 
 static int opencl_get_plane_format(enum AVPixelFormat pixfmt,
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v2 4/4] hwcontext_opencl: remove an unused variable

2018-06-21 Thread Jun Zhao
remove an unused variable

Signed-off-by: Jun Zhao 
---
 libavutil/hwcontext_opencl.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index 295d6be..4718a86 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -929,7 +929,6 @@ static int 
opencl_enumerate_intel_media_vaapi_devices(AVHWDeviceContext *hwdev,
 clGetDeviceIDsFromVA_APIMediaAdapterINTEL_fn
 clGetDeviceIDsFromVA_APIMediaAdapterINTEL;
 cl_int cle;
-int err;
 
 clGetDeviceIDsFromVA_APIMediaAdapterINTEL =
 clGetExtensionFunctionAddressForPlatform(platform_id,
-- 
2.7.4

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


Re: [FFmpeg-devel] [PATCH v2 3/4] hwcontext_opencl: Remove the opencl_device_init in opencl_device_derive

2018-06-21 Thread Carl Eugen Hoyos
2018-06-21 13:45 GMT+02:00, Jun Zhao :
> In opencl device derived case, don't need to call opencl_device_init.
>
> Signed-off-by: Jun Zhao 
> ---
>  libavutil/hwcontext_opencl.c | 7 ++-
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
> index 9e96e96..295d6be 100644
> --- a/libavutil/hwcontext_opencl.c
> +++ b/libavutil/hwcontext_opencl.c
> @@ -1196,7 +1196,7 @@ static int opencl_device_derive(AVHWDeviceContext
> *hwdev,
>  AVHWDeviceContext *src_ctx,
>  int flags)
>  {
> -int err;
> +int err = 0;

Why is this necessary?
And if it is necessary, why is it part of this patch?

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


Re: [FFmpeg-devel] ffmpeg patch for nonmonolithic increase dts error in subtitle

2018-06-21 Thread Moritz Barsnick
On Thu, Jun 21, 2018 at 10:51:33 +0200, Carl Eugen Hoyos wrote:
> This is exactly the same attachment as in your original mail...

Not quite, it was a git diff this time, but obviously still not
sufficient.

> Who wrote the patch / where did you find it?

The ticket he mentioned was #4450, the patch is here:
https://trac.ffmpeg.org/ticket/4450#comment:6

(Just because I had aleady checked that out and still had that tab
open. ;-))

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


Re: [FFmpeg-devel] ffmpeg patch for nonmonolithic increase dts error in subtitle

2018-06-21 Thread Carl Eugen Hoyos
2018-06-21 13:55 GMT+02:00, Moritz Barsnick :
> On Thu, Jun 21, 2018 at 10:51:33 +0200, Carl Eugen Hoyos wrote:

>> Who wrote the patch / where did you find it?
>
> The ticket he mentioned was #4450, the patch is here:
> https://trac.ffmpeg.org/ticket/4450#comment:6

Patch attached (untested).

Thank you, Carl Eugen
From 6ff1a1c662211548ae3c8c01ddfc2775e03b2497 Mon Sep 17 00:00:00 2001
From: Hans Carlson 
Date: Thu, 21 Jun 2018 14:24:36 +0200
Subject: [PATCH] ffmpeg: Treat subtitles like audio and video for
 non-monotonic dts.

Fixes ticket #4450.
Fixes ticket #6248.
---
 fftools/ffmpeg.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 6dfab64..8d311a9 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -772,7 +772,7 @@ static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int u
  - FFMIN3(pkt->pts, pkt->dts, ost->last_mux_dts + 1)
  - FFMAX3(pkt->pts, pkt->dts, ost->last_mux_dts + 1);
 }
-if ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) &&
+if ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO || st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) &&
 pkt->dts != AV_NOPTS_VALUE &&
 !(st->codecpar->codec_id == AV_CODEC_ID_VP9 && ost->stream_copy) &&
 ost->last_mux_dts != AV_NOPTS_VALUE) {
-- 
1.7.10.4

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


Re: [FFmpeg-devel] ffmpeg patch for nonmonolithic increase dts error in subtitle

2018-06-21 Thread Markus Kohm
Am Donnerstag, 21. Juni 2018, 14:27:29 CEST schrieb Carl Eugen Hoyos:
> Patch attached (untested).

As already mentioned in my first mail I've tested the patch and it works as 
expected.

Markus

PS: Now, I know why others have warned me, that it could become very, very 
hard to send a feature request like this to ffmpeg-devel …

signature.asc
Description: This is a digitally signed message part.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 1/8] hwcontext_internal: add ff_hwframe_map_replace

2018-06-21 Thread Rostislav Pehlivanov
On 22 April 2018 at 17:47, Rostislav Pehlivanov  wrote:

> Used to fix unmapping when no direct interop exists between APIs.
>
> Signed-off-by: Rostislav Pehlivanov 
> ---
>  libavutil/hwcontext.c  | 7 +++
>  libavutil/hwcontext_internal.h | 5 +
>  2 files changed, 12 insertions(+)
>
> diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
> index 70c556ecac..f9ce2f5b13 100644
> --- a/libavutil/hwcontext.c
> +++ b/libavutil/hwcontext.c
> @@ -871,3 +871,10 @@ fail:
>  av_buffer_unref(&dst_ref);
>  return ret;
>  }
> +
> +int ff_hwframe_map_replace(AVFrame *dst, const AVFrame *src)
> +{
> +HWMapDescriptor *hwmap = (HWMapDescriptor*)dst->buf[0]->data;
> +av_frame_unref(hwmap->source);
> +return av_frame_ref(hwmap->source, src);
> +}
> diff --git a/libavutil/hwcontext_internal.h b/libavutil/hwcontext_
> internal.h
> index 332062ddaa..77dc47ddd6 100644
> --- a/libavutil/hwcontext_internal.h
> +++ b/libavutil/hwcontext_internal.h
> @@ -156,6 +156,11 @@ int ff_hwframe_map_create(AVBufferRef *hwframe_ref,
>  HWMapDescriptor *hwmap),
>void *priv);
>
> +/**
> + * Replace the current hwmap of dst with the one from src, used for
> indirect
> + * mappings like VAAPI->(DRM)->OpenCL/Vulkan where a direct interop is
> missing
> + */
> +int ff_hwframe_map_replace(AVFrame *dst, const AVFrame *src);
>
>  extern const HWContextType ff_hwcontext_type_cuda;
>  extern const HWContextType ff_hwcontext_type_d3d11va;
> --
> 2.17.0
>
>
Pushed
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] ffmpeg patch for nonmonolithic increase dts error in subtitle

2018-06-21 Thread Carl Eugen Hoyos
2018-06-21 16:20 GMT+02:00, Markus Kohm :
> Am Donnerstag, 21. Juni 2018, 14:27:29 CEST schrieb Carl Eugen Hoyos:
>> Patch attached (untested).
>
> As already mentioned in my first mail I've tested the patch and it works as
> expected.
>
> Markus
>
> PS: Now, I know why others have warned me, that it could become very, very
> hard to send a feature request like this to ffmpeg-devel …

As in "copyright should be ignored by FFmpeg developers" or do
I misunderstand your comment?

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


Re: [FFmpeg-devel] ffmpeg patch for nonmonolithic increase dts error in subtitle

2018-06-21 Thread Markus Kohm
Am Donnerstag, 21. Juni 2018, 17:36:02 CEST schrieb Carl Eugen Hoyos:
> As in "copyright should be ignored by FFmpeg developers" or do
> I misunderstand your comment?

I do not understand the relation of copyright and my patch or any of my 
comments. So I cannot answer this question.

If you have a problem with the patch, it's OK. I've solved my problem. I only 
thought, that you are interested in adding this improvement to ffmpeg master. 
I always tell my users, that they should send me a message if they find a bug 
or have a feature request or an improving patch, because without such a 
message others cannot benefit from the corresponding improvement and that 
would be a shame. So I've tried to do the same as a user of ffmpeg. Seems I 
was completely wrong. My fault.

Just relax and have a nice day.

signature.asc
Description: This is a digitally signed message part.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] ffmpeg.c: allow ffmpeg to output stats for each video stream

2018-06-21 Thread Michael Niedermayer
On Fri, Jun 15, 2018 at 01:37:31PM +0800, Wang Cao wrote:
> Make ffmpeg to output stats for each video/audio streams and each ouptut file 
> ffmpeg output log in print_report. The report of video/audio sizes is clear 
> now as previously all output video/audio sizes were combined to report and it 
> is unclear such stats is for one output files or aggregates for all output 
> files.
> 
> Signed-off-by: Wang Cao 
> ---
>  fftools/ffmpeg.c | 45 +++--
>  1 file changed, 31 insertions(+), 14 deletions(-)
> 
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index d4ac6903cc..1eaf344552 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -1530,17 +1530,27 @@ static int reap_filters(int flush)
>  return 0;
>  }
>  
> -static void print_final_stats(int64_t total_size)
> +static void print_final_stats()
>  {

there are some new warnings:

fftools/ffmpeg.c:1533:13: warning: function declaration isn’t a prototype 
[-Wstrict-prototypes]
 static void print_final_stats()
 ^
fftools/ffmpeg.c: In function ‘print_report’:
fftools/ffmpeg.c:1672:22: warning: unused variable ‘oc’ [-Wunused-variable]
 AVFormatContext *oc;
  ^
[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Does the universe only have a finite lifespan? No, its going to go on
forever, its just that you wont like living in it. -- Hiranya Peiri


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


Re: [FFmpeg-devel] (no subject)

2018-06-21 Thread Michael Niedermayer
On Wed, Jun 20, 2018 at 05:25:32PM +0800, Wang Cao wrote:
> For example: with (-psnr)
> frame=  450 fps=315 q=0.0 LPSNR=Y:44.15 U:43.21 V:42.36 *:43.64 size= 
> 385kB time=00:00:15.01 bitrate= 210.0kbits/s speed=10.5x (video stats)
> size= 107kB time=00:00:15.13 bitrate=  58.0kbits/s speed=10.6x (audio 
> stats)
> 
> frame=  450 fps=112 q=0.0 LPSNR=Y:44.15 U:43.21 V:42.36 *:43.64 size= 
> 385kB time=00:00:15.01 bitrate= 210.0kbits/s speed=3.74x
> size= 107kB time=00:00:15.13 bitrate=  58.0kbits/s speed=3.77x
> q=0.0 frame=  450 fps=112 q=0.0 LPSNR=Y:44.15 U:43.21 V:42.36 *:43.64 size=   
>   385kB time=00:00:15.13 bitrate= 208.4kbits/s speed=3.77x
> size= 107kB time=00:00:15.13 bitrate=  58.0kbits/s speed=3.77x
> q=0.0 frame=  450 fps=112 q=0.0 LPSNR=Y:44.15 U:43.21 V:42.36 *:43.64 size=   
>   385kB time=00:00:15.13 bitrate= 208.4kbits/s speed=3.77x
> size= 107kB time=00:00:15.13 bitrate=  58.0kbits/s speed=3.77x
> video:385kB audio:107kB subtitle:0kB other streams:0kB global headers:0kB 
> muxing overhead: 1.880871%
> video:385kB audio:107kB subtitle:0kB other streams:0kB global headers:0kB 
> muxing overhead: 1.880871%
> video:385kB audio:107kB subtitle:0kB other streams:0kB global headers:0kB 
> muxing overhead: 1.880871%

how does the user know which is which output ?

also some users may want just one line summarizing all

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] (no subject)

2018-06-21 Thread Gyan Doshi



On 21-06-2018 09:40 PM, Michael Niedermayer wrote:


how does the user know which is which output ?

also some users may want just one line summarizing all


Agreed. Better if each line is identified.

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


Re: [FFmpeg-devel] libavutil/encryption_info: Allow multiple init info.

2018-06-21 Thread Michael Niedermayer
On Thu, Jun 07, 2018 at 11:51:30AM -0700, Jacob Trimble wrote:
> On Thu, May 31, 2018 at 5:50 PM Jacob Trimble  wrote:
> >
> > On Thu, May 31, 2018 at 9:40 AM Jacob Trimble  wrote:
> > >
> > > On Fri, May 25, 2018 at 6:13 PM Michael Niedermayer
> > >  wrote:
> > > >
> > > > [...]
> > > >
> > > > > Added fix for issue found by Chrome's ClusterFuzz 
> > > > > (http://crbug.com/846662).
> > > >
> > > > this belongs in a seperate patch unless its a bug specific to the code 
> > > > added
> > > > with this patch
> > > >
> > >
> > > Ok.  Now this patch depends on
> > > http://ffmpeg.org/pipermail/ffmpeg-devel/2018-May/230782.html.
> > >
> >
> > Noticed some bugs when integrating it.
> >
> > > > [...]
> > > >
> > > > --
> > > > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> > > >
> > > > I have often repented speaking, but never of holding my tongue.
> > > > -- Xenocrates
> > > > ___
> > > > ffmpeg-devel mailing list
> > > > ffmpeg-devel@ffmpeg.org
> > > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> Removed controversial NULL checks.  This patch no longer depends on anything.

>  encryption_info.c |  140 
> --
>  encryption_info.h |5 +
>  2 files changed, 100 insertions(+), 45 deletions(-)
> cc25918cb63c4ac75f0b693472b51590c1a74052  
> 0001-libavutil-encryption_info-Allow-multiple-init-info-v7.patch
> From 0c4c33f26ba4204a775709cdd6367dd1ea4bd024 Mon Sep 17 00:00:00 2001
> From: Jacob Trimble 
> Date: Mon, 23 Apr 2018 10:33:58 -0700
> Subject: [PATCH] libavutil/encryption_info: Allow multiple init info.
> 
> It is possible for there to be multiple encryption init info structure.
> For example, to support multiple key systems or in key rotation.  This
> changes the AVEncryptionInitInfo struct to be a linked list so there
> can be multiple structs without breaking ABI.
> 
> Signed-off-by: Jacob Trimble 
> ---
>  libavutil/encryption_info.c | 140 
>  libavutil/encryption_info.h |   5 ++
>  2 files changed, 100 insertions(+), 45 deletions(-)
> 
> diff --git a/libavutil/encryption_info.c b/libavutil/encryption_info.c
> index 20a752d6b4..1072d2795b 100644
> --- a/libavutil/encryption_info.c
> +++ b/libavutil/encryption_info.c
> @@ -160,13 +160,16 @@ uint8_t *av_encryption_info_add_side_data(const 
> AVEncryptionInfo *info, size_t *
>  }
>  
>  // The format of the AVEncryptionInitInfo side data:
> -// u32be system_id_size
> -// u32be num_key_ids
> -// u32be key_id_size
> -// u32be data_size
> -// u8[system_id_size] system_id
> -// u8[key_id_size][num_key_id] key_ids
> -// u8[data_size] data
> +// u32be init_info_count
> +// {
> +//   u32be system_id_size
> +//   u32be num_key_ids
> +//   u32be key_id_size
> +//   u32be data_size
> +//   u8[system_id_size] system_id
> +//   u8[key_id_size][num_key_id] key_ids
> +//   u8[data_size] data
> +// }[init_info_count]
>  
>  #define FF_ENCRYPTION_INIT_INFO_EXTRA 16
>  
> @@ -215,6 +218,7 @@ void av_encryption_init_info_free(AVEncryptionInitInfo 
> *info)
>  for (i = 0; i < info->num_key_ids; i++) {
>  av_free(info->key_ids[i]);
>  }
> +av_encryption_init_info_free(info->next);
>  av_free(info->system_id);
>  av_free(info->key_ids);
>  av_free(info->data);
> @@ -225,71 +229,117 @@ void av_encryption_init_info_free(AVEncryptionInitInfo 
> *info)
>  AVEncryptionInitInfo *av_encryption_init_info_get_side_data(
>  const uint8_t *side_data, size_t side_data_size)
>  {
> -AVEncryptionInitInfo *info;
> -uint64_t system_id_size, num_key_ids, key_id_size, data_size, i;
> +// |ret| tracks the front of the list, |info| tracks the back.
> +AVEncryptionInitInfo *ret = NULL, *info, *temp_info;
> +uint64_t system_id_size, num_key_ids, key_id_size, data_size, i, j;
> +uint64_t init_info_count;
>  
> -if (!side_data || side_data_size < FF_ENCRYPTION_INIT_INFO_EXTRA)
> +if (!side_data || side_data_size < 4)
>  return NULL;
>  
> -system_id_size = AV_RB32(side_data);
> -num_key_ids = AV_RB32(side_data + 4);
> -key_id_size = AV_RB32(side_data + 8);
> -data_size = AV_RB32(side_data + 12);
> +init_info_count = AV_RB32(side_data);
> +side_data += 4;
> +side_data_size -= 4;
> +for (i = 0; i < init_info_count; i++) {
> +if (side_data_size < FF_ENCRYPTION_INIT_INFO_EXTRA) {
> +av_encryption_init_info_free(ret);
> +return NULL;
> +}
>  
> -// UINT32_MAX + UINT32_MAX + UINT32_MAX * UINT32_MAX == UINT64_MAX
> -if (side_data_size - FF_ENCRYPTION_INIT_INFO_EXTRA < system_id_size + 
> data_size + num_key_ids * key_id_size)
> -return NULL;
> +system_id_size = AV_RB32(side_data);
> +num_key_ids = AV_RB32(side_data + 4);
> +key_id_size = AV_RB32(side_data + 8);
> +data_size = AV_RB32(side_data + 12);
>  
> -info = av_enc

[FFmpeg-devel] [PATCH 4/6] lavfi: add a Vulkan chromatic aberration filter

2018-06-21 Thread Rostislav Pehlivanov
It tries to do something similar to it with YUV images, but RGB images
are done properly.

Signed-off-by: Rostislav Pehlivanov 
---
 configure   |   1 +
 libavfilter/Makefile|   1 +
 libavfilter/allfilters.c|   1 +
 libavfilter/vf_chromaticaberration_vulkan.c | 342 
 4 files changed, 345 insertions(+)
 create mode 100644 libavfilter/vf_chromaticaberration_vulkan.c

diff --git a/configure b/configure
index eab7c5b630..cd5229ef2d 100755
--- a/configure
+++ b/configure
@@ -3318,6 +3318,7 @@ azmq_filter_deps="libzmq"
 blackframe_filter_deps="gpl"
 boxblur_filter_deps="gpl"
 bs2b_filter_deps="libbs2b"
+chromaticaberration_vulkan_filter_deps="vulkan libshaderc"
 colormatrix_filter_deps="gpl"
 convolution_opencl_filter_deps="opencl"
 convolve_filter_deps="avcodec"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index d1cab35e2e..dbb7a859dd 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -160,6 +160,7 @@ OBJS-$(CONFIG_BLEND_FILTER)  += vf_blend.o 
framesync.o
 OBJS-$(CONFIG_BOXBLUR_FILTER)+= vf_boxblur.o
 OBJS-$(CONFIG_BWDIF_FILTER)  += vf_bwdif.o
 OBJS-$(CONFIG_CHROMAKEY_FILTER)  += vf_chromakey.o
+OBJS-$(CONFIG_CHROMATICABERRATION_VULKAN_FILTER) += 
vf_chromaticaberration_vulkan.o vulkan.o
 OBJS-$(CONFIG_CIESCOPE_FILTER)   += vf_ciescope.o
 OBJS-$(CONFIG_CODECVIEW_FILTER)  += vf_codecview.o
 OBJS-$(CONFIG_COLORBALANCE_FILTER)   += vf_colorbalance.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index a05616f728..5848ad9b4f 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -151,6 +151,7 @@ extern AVFilter ff_vf_blend;
 extern AVFilter ff_vf_boxblur;
 extern AVFilter ff_vf_bwdif;
 extern AVFilter ff_vf_chromakey;
+extern AVFilter ff_vf_chromaticaberration_vulkan;
 extern AVFilter ff_vf_ciescope;
 extern AVFilter ff_vf_codecview;
 extern AVFilter ff_vf_colorbalance;
diff --git a/libavfilter/vf_chromaticaberration_vulkan.c 
b/libavfilter/vf_chromaticaberration_vulkan.c
new file mode 100644
index 00..1d1aeb95a0
--- /dev/null
+++ b/libavfilter/vf_chromaticaberration_vulkan.c
@@ -0,0 +1,342 @@
+/*
+ * 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/opt.h"
+#include "vulkan.h"
+#include "internal.h"
+
+typedef struct ChromaticAberrationVulkanContext {
+VulkanFilterContext vkctx;
+
+int initialized;
+FFVkExecContext exec;
+
+/* Shader updators, must be in the main filter struct */
+VkDescriptorImageInfo input_images[3];
+VkDescriptorImageInfo output_images[3];
+
+float dist_x;
+float dist_y;
+} ChromaticAberrationVulkanContext;
+
+static const char distort_chroma_kernel[] = {
+C(0, void distort_rgb(ivec2 size, ivec2 pos)   
)
+C(0, { 
)
+C(1, const vec2 p = ((vec2(pos)/vec2(size)) - 0.5f)*2.0f;  
)
+C(1, const vec2 o = p * (FILTER_DIST - 1.0f);  
)
+C(0,   
)
+C(1, vec4 res; 
)
+C(1, res.r = texture(input_img[0], ((p - o)/2.0f) + 0.5f).r;   
)
+C(1, res.g = texture(input_img[0], ((p)/2.0f) + 0.5f).g;   
)
+C(1, res.b = texture(input_img[0], ((p + o)/2.0f) + 0.5f).b;   
)
+C(1, res.a = texture(input_img[0], ((p)/2.0f) + 0.5f).a;   
)
+C(1, imageStore(output_img[0], pos, res);  
)
+C(0, } 
)
+C(0,   
)
+C(0, void distort_chroma(int idx, ivec2 size, ivec2 pos)   
)
+C(0, { 
)
+C(1, vec2 p = ((vec2(pos)/vec2(size)) - 0.5f)*2.0f;
)
+C(1, float d = sqrt(p.x*p.x + p.y*p.y);
)
+C(1, p *= d / (d*FILTER_DIST);   

[FFmpeg-devel] [PATCH 1/6] lavu: add a Vulkan hwcontext

2018-06-21 Thread Rostislav Pehlivanov
This commit adds a Vulkan hwcontext, currently capable of mapping DRM and
VAAPI frames but additional functionality can be added later to support
importing of D3D11 surfaces as well as exporting to various other APIs.

This context requires the newest stable version of the Vulkan API.

It makes use of every part of the Vulkan spec in order to ensure fastest
possible uploading, downloading and mapping of frames.

To be useful for non-RGB images an implementation with the YUV images
extension is needed. All current implementations support that with the
exception of AMD, though support is coming soon for Mesa.

Signed-off-by: Rostislav Pehlivanov 
---
 configure  |   10 +
 doc/APIchanges |4 +
 libavutil/Makefile |3 +
 libavutil/hwcontext.c  |4 +
 libavutil/hwcontext.h  |1 +
 libavutil/hwcontext_internal.h |1 +
 libavutil/hwcontext_vulkan.c   | 2225 
 libavutil/hwcontext_vulkan.h   |  133 ++
 libavutil/pixdesc.c|4 +
 libavutil/pixfmt.h |4 +
 libavutil/version.h|4 +-
 11 files changed, 2391 insertions(+), 2 deletions(-)
 create mode 100644 libavutil/hwcontext_vulkan.c
 create mode 100644 libavutil/hwcontext_vulkan.h

diff --git a/configure b/configure
index 473be31d7f..7623a1205a 100755
--- a/configure
+++ b/configure
@@ -302,6 +302,7 @@ External library support:
   --enable-opengl  enable OpenGL rendering [no]
   --enable-openssl enable openssl, needed for https support
if gnutls, libtls or mbedtls is not used [no]
+  --enable-vulkan  enable Vulkan code [no]
   --disable-sndio  disable sndio support [autodetect]
   --disable-schannel   disable SChannel SSP, needed for TLS support on
Windows if openssl and gnutls are not used 
[autodetect]
@@ -1770,6 +1771,7 @@ HWACCEL_LIBRARY_LIST="
 mmal
 omx
 opencl
+vulkan
 "
 
 DOCUMENT_LIST="
@@ -2226,6 +2228,7 @@ HAVE_LIST="
 opencl_dxva2
 opencl_vaapi_beignet
 opencl_vaapi_intel_media
+vulkan_drm_mod
 perl
 pod2man
 texi2html
@@ -6357,6 +6360,13 @@ enabled vdpau &&
 
 enabled crystalhd && check_lib crystalhd "stdint.h 
libcrystalhd/libcrystalhd_if.h" DtsCrystalHDVersion -lcrystalhd
 
+enabled vulkan &&
+require_pkg_config vulkan "vulkan >= 1.1.73" "vulkan/vulkan.h" 
vkCreateInstance
+
+if enabled_all vulkan libdrm ; then
+check_cpp_condition vulkan_drm_mod vulkan/vulkan.h "defined 
VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME"
+fi
+
 if enabled x86; then
 case $target_os in
 mingw32*|mingw64*|win32|win64|linux|cygwin*)
diff --git a/doc/APIchanges b/doc/APIchanges
index efe15ba4e0..b2684eb442 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
+2018-04-xx - xx - lavu 56.19.100 - hwcontext.h
+  Add AV_PIX_FMT_VULKAN
+  Add AV_HWDEVICE_TYPE_VULKAN and implementation.
+
 2018-05-xx - xx - lavf 58.15.100 - avformat.h
   Add pmt_version field to AVProgram
 
diff --git a/libavutil/Makefile b/libavutil/Makefile
index d0632f16a6..9fb32bc5e2 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -42,6 +42,7 @@ HEADERS = adler32.h   
  \
   hwcontext_vaapi.h \
   hwcontext_videotoolbox.h  \
   hwcontext_vdpau.h \
+  hwcontext_vulkan.h\
   imgutils.h\
   intfloat.h\
   intreadwrite.h\
@@ -168,6 +169,7 @@ OBJS-$(CONFIG_QSV)  += hwcontext_qsv.o
 OBJS-$(CONFIG_VAAPI)+= hwcontext_vaapi.o
 OBJS-$(CONFIG_VIDEOTOOLBOX) += hwcontext_videotoolbox.o
 OBJS-$(CONFIG_VDPAU)+= hwcontext_vdpau.o
+OBJS-$(CONFIG_VULKAN)   += hwcontext_vulkan.o
 
 OBJS += $(COMPAT_OBJS:%=../compat/%)
 
@@ -183,6 +185,7 @@ SKIPHEADERS-$(CONFIG_OPENCL)   += hwcontext_opencl.h
 SKIPHEADERS-$(CONFIG_VAAPI)+= hwcontext_vaapi.h
 SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += hwcontext_videotoolbox.h
 SKIPHEADERS-$(CONFIG_VDPAU)+= hwcontext_vdpau.h
+SKIPHEADERS-$(CONFIG_VULKAN)   += hwcontext_vulkan.h
 
 TESTPROGS = adler32 \
 aes \
diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index f1e404ab20..ee2216c7c1 100644
--- a/libavutil/hwcontext.c
+++ b/libavutil/hwcontext.c
@@ -58,6 +58,9 @@ static const HWContextType * const hw_table[] = {
 #endi

[FFmpeg-devel] [PATCH 6/6] lavfi: add a Vulkan overlay filter

2018-06-21 Thread Rostislav Pehlivanov
Could be done in-plane with the main image but framesync segfaults.

Signed-off-by: Rostislav Pehlivanov 
---
 configure   |   1 +
 libavfilter/Makefile|   1 +
 libavfilter/allfilters.c|   1 +
 libavfilter/vf_overlay_vulkan.c | 461 
 4 files changed, 464 insertions(+)
 create mode 100644 libavfilter/vf_overlay_vulkan.c

diff --git a/configure b/configure
index d1ceb9e38d..2edd4e36aa 100755
--- a/configure
+++ b/configure
@@ -3370,6 +3370,7 @@ ocr_filter_deps="libtesseract"
 ocv_filter_deps="libopencv"
 openclsrc_filter_deps="opencl"
 overlay_opencl_filter_deps="opencl"
+overlay_vulkan_filter_deps="vulkan libshaderc"
 overlay_qsv_filter_deps="libmfx"
 overlay_qsv_filter_select="qsvvpp"
 owdenoise_filter_deps="gpl"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 6e2d3681ec..c51add5cb4 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -280,6 +280,7 @@ OBJS-$(CONFIG_OSCILLOSCOPE_FILTER)   += 
vf_datascope.o
 OBJS-$(CONFIG_OVERLAY_FILTER)+= vf_overlay.o framesync.o
 OBJS-$(CONFIG_OVERLAY_OPENCL_FILTER) += vf_overlay_opencl.o opencl.o \
 opencl/overlay.o framesync.o
+OBJS-$(CONFIG_OVERLAY_VULKAN_FILTER) += vf_overlay_vulkan.o
 OBJS-$(CONFIG_OVERLAY_QSV_FILTER)+= vf_overlay_qsv.o framesync.o
 OBJS-$(CONFIG_OWDENOISE_FILTER)  += vf_owdenoise.o
 OBJS-$(CONFIG_PAD_FILTER)+= vf_pad.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index ee58cc9eee..7c9ff0ab41 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -269,6 +269,7 @@ extern AVFilter ff_vf_ocv;
 extern AVFilter ff_vf_oscilloscope;
 extern AVFilter ff_vf_overlay;
 extern AVFilter ff_vf_overlay_opencl;
+extern AVFilter ff_vf_overlay_vulkan;
 extern AVFilter ff_vf_overlay_qsv;
 extern AVFilter ff_vf_owdenoise;
 extern AVFilter ff_vf_pad;
diff --git a/libavfilter/vf_overlay_vulkan.c b/libavfilter/vf_overlay_vulkan.c
new file mode 100644
index 00..a7d8cc3cf2
--- /dev/null
+++ b/libavfilter/vf_overlay_vulkan.c
@@ -0,0 +1,461 @@
+/*
+ * 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/opt.h"
+#include "vulkan.h"
+#include "internal.h"
+#include "framesync.h"
+
+typedef struct OverlayVulkanContext {
+VulkanFilterContext vkctx;
+
+int initialized;
+FFVkExecContext exec;
+FFFrameSync fs;
+FFVkBuffer params_buf;
+
+/* Shader updators, must be in the main filter struct */
+VkDescriptorImageInfo main_images[3];
+VkDescriptorImageInfo overlay_images[3];
+VkDescriptorImageInfo output_images[3];
+VkDescriptorBufferInfo params_desc;
+
+int overlay_x;
+int overlay_y;
+} OverlayVulkanContext;
+
+static const char overlay_noalpha[] = {
+C(0, void overlay_noalpha(int i, ivec2 pos)
)
+C(0, { 
)
+C(1, ivec2 overlay_size = imageSize(overlay_img[i]);   
)
+C(1, if ((o_offset[i].x <= pos.x) && (o_offset[i].y <= pos.y) &&
+ (pos.x < (o_offset[i].x + overlay_size.x)) &&
+ (pos.y < (o_offset[i].y + overlay_size.y))) { 
)
+C(2, vec4 res = imageLoad(overlay_img[i], pos - o_offset[i]);  
)
+C(2, imageStore(output_img[i], pos, res);  
)
+C(1, } else {  
)
+C(2, vec4 res = imageLoad(main_img[i], pos);   
)
+C(2, imageStore(output_img[i], pos, res);  
)
+C(1, } 
)
+C(0, } 
)
+};
+
+static av_cold int init_filter(AVFilterContext *ctx)
+{
+int err;
+OverlayVulkanContext *s = ctx->priv;
+
+{ /* Create the shader */
+const int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
+
+SPIRVShader *shd = ff_vk_init_shader(ctx, "overlay_compute",
+ VK_SHADER_STAGE_COMP

[FFmpeg-devel] [PATCH v3 3/3] aadec: fix seeking in mp3 content

2018-06-21 Thread Karsten Otto
MP3 frames may not be aligned to aa chunk boundaries. After seeking,
scan for the next valid frame header. Then truncate the packet, and
also adjust timestamp information accordingly.
---
 libavformat/aadec.c | 33 -
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/libavformat/aadec.c b/libavformat/aadec.c
index b009c9deca..3bb8cd0768 100644
--- a/libavformat/aadec.c
+++ b/libavformat/aadec.c
@@ -50,6 +50,7 @@ typedef struct AADemuxContext {
 int64_t current_chapter_size;
 int64_t content_start;
 int64_t content_end;
+int did_seek;
 } AADemuxContext;
 
 static int get_second_size(char *codec_name)
@@ -205,6 +206,7 @@ static int aa_read_header(AVFormatContext *s)
 }
 start = TOC[largest_idx].offset;
 avio_seek(pb, start, SEEK_SET);
+c->did_seek = 0;
 
 // extract chapter positions. since all formats have constant bit rate, 
use it
 // as time base in bytes/s, for easy stream position <-> timestamp 
conversion
@@ -242,7 +244,7 @@ static int aa_read_packet(AVFormatContext *s, AVPacket *pkt)
 int trailing_bytes;
 int blocks;
 uint8_t buf[MAX_CODEC_SECOND_SIZE * 2];
-int written = 0;
+int written = 0, offset = 0;
 int ret;
 AADemuxContext *c = s->priv_data;
 uint64_t pos = avio_tell(s->pb);
@@ -295,10 +297,32 @@ static int aa_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 if (c->current_chapter_size <= 0)
 c->current_chapter_size = 0;
 
-ret = av_new_packet(pkt, written);
+// re-init timestamps after seeking
+if (c->did_seek) {
+c->did_seek = 0;
+
+if (s->streams[0]->codecpar->codec_id == AV_CODEC_ID_MP3) {
+for (; offset < written - 2; ++offset) {
+// find mp3 header: sync, v2, layer3, 32kbps, non-reserved 
sample rate
+if ((buf[offset + 0] & 0xff) == 0xff &&
+(buf[offset + 1] & 0xfe) == 0xf2 &&
+(buf[offset + 2] & 0xf0) == 0x40 &&
+(buf[offset + 2] & 0x0c) != 0x0c)
+break;
+}
+if (offset == written - 2)
+offset = 0; // not found, e.g. chapter end chunk; just use as 
is
+}
+ff_update_cur_dts(s, s->streams[0],
+(pos + offset - c->content_start - CHAPTER_HEADER_SIZE * 
(c->chapter_idx - 1))
+* TIMEPREC);
+}
+
+// create packet
+ret = av_new_packet(pkt, written - offset);
 if (ret < 0)
 return ret;
-memcpy(pkt->data, buf, written);
+memcpy(pkt->data, buf + offset, written - offset);
 pkt->pos = pos;
 
 return 0;
@@ -343,8 +367,7 @@ static int aa_read_seek(AVFormatContext *s,
 c->current_codec_second_size = c->codec_second_size;
 c->current_chapter_size = chapter_size - chapter_pos;
 c->chapter_idx = 1 + chapter_idx;
-
-ff_update_cur_dts(s, s->streams[0], ch->start + chapter_pos * TIMEPREC);
+c->did_seek = 1;
 
 return 1;
 }
-- 
2.14.3 (Apple Git-98)

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


[FFmpeg-devel] [PATCH v3 0/3] libavformat/aadec: seek support

2018-06-21 Thread Karsten Otto
A patch series adding seek support to libavformat/aadec.

This third version of the series addresses all the earlier comments from the
mailing list (thanks again!). It also introduces much better timestamps with
sub-second precision.

The new patch 3/3 improves handling of mp3 content in the aa container: After
a seek operation, it skips to the next valid frame header, which prevents
audible glitches from partial frame playback.

Karsten Otto (3):
  aadec: improve eof detection
  aadec: add chapters and seeking
  aadec: fix seeking in mp3 content

 libavformat/aadec.c | 129 
 1 file changed, 121 insertions(+), 8 deletions(-)

-- 
2.14.3 (Apple Git-98)

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


[FFmpeg-devel] [PATCH v3 2/3] aadec: add chapters and seeking

2018-06-21 Thread Karsten Otto
read_packet reads content in chunks. Thus seek must be clamped to valid
chunk positions in the file, which in turn are relative to chapter start
positions.

So in read_header, scan for chapter headers once by skipping through the
content. Set stream time_base to bitrate in bytes/s, for easy timestamp to
position conversion.

Then in read_seek, find the chapter containing the seek position, calculate
the nearest chunk position, and reinit the read_seek state accordingly.
---
 libavformat/aadec.c | 87 ++---
 1 file changed, 83 insertions(+), 4 deletions(-)

diff --git a/libavformat/aadec.c b/libavformat/aadec.c
index 4db71b1939..b009c9deca 100644
--- a/libavformat/aadec.c
+++ b/libavformat/aadec.c
@@ -35,6 +35,8 @@
 #define MAX_TOC_ENTRIES 16
 #define MAX_DICTIONARY_ENTRIES 128
 #define TEA_BLOCK_SIZE 8
+#define CHAPTER_HEADER_SIZE 8
+#define TIMEPREC 1000
 
 typedef struct AADemuxContext {
 AVClass *class;
@@ -46,6 +48,7 @@ typedef struct AADemuxContext {
 struct AVTEA *tea_ctx;
 uint8_t file_key[16];
 int64_t current_chapter_size;
+int64_t content_start;
 int64_t content_end;
 } AADemuxContext;
 
@@ -70,7 +73,7 @@ static int aa_read_header(AVFormatContext *s)
 uint32_t nkey, nval, toc_size, npairs, header_seed = 0, start;
 char key[128], val[128], codec_name[64] = {0};
 uint8_t output[24], dst[8], src[8];
-int64_t largest_size = -1, current_size = -1;
+int64_t largest_size = -1, current_size = -1, chapter_pos;
 struct toc_entry {
 uint32_t offset;
 uint32_t size;
@@ -172,19 +175,23 @@ static int aa_read_header(AVFormatContext *s)
 if (!strcmp(codec_name, "mp332")) {
 st->codecpar->codec_id = AV_CODEC_ID_MP3;
 st->codecpar->sample_rate = 22050;
+st->time_base = av_make_q(8, 32000 * TIMEPREC);
 st->need_parsing = AVSTREAM_PARSE_FULL_RAW;
-st->start_time = 0;
 } else if (!strcmp(codec_name, "acelp85")) {
 st->codecpar->codec_id = AV_CODEC_ID_SIPR;
 st->codecpar->block_align = 19;
 st->codecpar->channels = 1;
 st->codecpar->sample_rate = 8500;
+st->codecpar->bit_rate = 8500;
+st->time_base = av_make_q(8, 8500 * TIMEPREC);
 st->need_parsing = AVSTREAM_PARSE_FULL_RAW;
 } else if (!strcmp(codec_name, "acelp16")) {
 st->codecpar->codec_id = AV_CODEC_ID_SIPR;
 st->codecpar->block_align = 20;
 st->codecpar->channels = 1;
 st->codecpar->sample_rate = 16000;
+st->codecpar->bit_rate = 16000;
+st->time_base = av_make_q(8, 16000 * TIMEPREC);
 st->need_parsing = AVSTREAM_PARSE_FULL_RAW;
 }
 
@@ -198,7 +205,30 @@ static int aa_read_header(AVFormatContext *s)
 }
 start = TOC[largest_idx].offset;
 avio_seek(pb, start, SEEK_SET);
+
+// extract chapter positions. since all formats have constant bit rate, 
use it
+// as time base in bytes/s, for easy stream position <-> timestamp 
conversion
+st->start_time = 0;
+c->content_start = start;
 c->content_end = start + largest_size;
+
+while ((chapter_pos = avio_tell(pb)) >= 0 && chapter_pos < c->content_end) 
{
+int chapter_idx, chapter_size;
+chapter_idx = s->nb_chapters;
+chapter_pos -= start + CHAPTER_HEADER_SIZE * chapter_idx;
+chapter_size = avio_rb32(pb);
+if (chapter_size == 0) break;
+avio_skip(pb, 4);
+avio_skip(pb, chapter_size);
+if (!avpriv_new_chapter(s, chapter_idx, st->time_base,
+chapter_pos * TIMEPREC, (chapter_pos + chapter_size) * TIMEPREC, 
NULL))
+return AVERROR(ENOMEM);
+}
+
+st->duration = (largest_size - CHAPTER_HEADER_SIZE * s->nb_chapters) * 
TIMEPREC;
+
+ff_update_cur_dts(s, st, 0);
+avio_seek(pb, start, SEEK_SET);
 c->current_chapter_size = 0;
 
 return 0;
@@ -215,9 +245,10 @@ static int aa_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 int written = 0;
 int ret;
 AADemuxContext *c = s->priv_data;
+uint64_t pos = avio_tell(s->pb);
 
 // are we at the end of the audio content?
-if (avio_tell(s->pb) >= c->content_end) {
+if (pos >= c->content_end) {
 return AVERROR_EOF;
 }
 
@@ -230,6 +261,7 @@ static int aa_read_packet(AVFormatContext *s, AVPacket *pkt)
 av_log(s, AV_LOG_DEBUG, "Chapter %d (%" PRId64 " bytes)\n", 
c->chapter_idx, c->current_chapter_size);
 c->chapter_idx = c->chapter_idx + 1;
 avio_skip(s->pb, 4); // data start offset
+pos += 8;
 c->current_codec_second_size = c->codec_second_size;
 }
 
@@ -267,10 +299,56 @@ static int aa_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 if (ret < 0)
 return ret;
 memcpy(pkt->data, buf, written);
+pkt->pos = pos;
 
 return 0;
 }
 
+static int aa_read_seek(AVFormatContext *s,
+int stream_index, int64_t timestamp, int flags)
+{
+AADemuxContext *c = 

[FFmpeg-devel] [PATCH v3 1/3] aadec: improve eof detection

2018-06-21 Thread Karsten Otto
Remember the end position of audio content in the file and check it during
read_packet. There always seems to be other data beyond it, which could be
misinterpreted as more audio. Also add some extra avio_read error checks,
to bail early in case of a broken/truncated file.
---
 libavformat/aadec.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/libavformat/aadec.c b/libavformat/aadec.c
index 8d39b1d9ba..4db71b1939 100644
--- a/libavformat/aadec.c
+++ b/libavformat/aadec.c
@@ -46,6 +46,7 @@ typedef struct AADemuxContext {
 struct AVTEA *tea_ctx;
 uint8_t file_key[16];
 int64_t current_chapter_size;
+int64_t content_end;
 } AADemuxContext;
 
 static int get_second_size(char *codec_name)
@@ -197,6 +198,7 @@ static int aa_read_header(AVFormatContext *s)
 }
 start = TOC[largest_idx].offset;
 avio_seek(pb, start, SEEK_SET);
+c->content_end = start + largest_size;
 c->current_chapter_size = 0;
 
 return 0;
@@ -214,6 +216,11 @@ static int aa_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 int ret;
 AADemuxContext *c = s->priv_data;
 
+// are we at the end of the audio content?
+if (avio_tell(s->pb) >= c->content_end) {
+return AVERROR_EOF;
+}
+
 // are we at the start of a chapter?
 if (c->current_chapter_size == 0) {
 c->current_chapter_size = avio_rb32(s->pb);
@@ -234,7 +241,9 @@ static int aa_read_packet(AVFormatContext *s, AVPacket *pkt)
 // decrypt c->current_codec_second_size bytes
 blocks = c->current_codec_second_size / TEA_BLOCK_SIZE;
 for (i = 0; i < blocks; i++) {
-avio_read(s->pb, src, TEA_BLOCK_SIZE);
+ret = avio_read(s->pb, src, TEA_BLOCK_SIZE);
+if (ret != TEA_BLOCK_SIZE)
+return (ret < 0) ? ret : AVERROR_EOF;
 av_tea_init(c->tea_ctx, c->file_key, 16);
 av_tea_crypt(c->tea_ctx, dst, src, 1, NULL, 1);
 memcpy(buf + written, dst, TEA_BLOCK_SIZE);
@@ -242,7 +251,9 @@ static int aa_read_packet(AVFormatContext *s, AVPacket *pkt)
 }
 trailing_bytes = c->current_codec_second_size % TEA_BLOCK_SIZE;
 if (trailing_bytes != 0) { // trailing bytes are left unencrypted!
-avio_read(s->pb, src, trailing_bytes);
+ret = avio_read(s->pb, src, trailing_bytes);
+if (ret != trailing_bytes)
+return (ret < 0) ? ret : AVERROR_EOF;
 memcpy(buf + written, src, trailing_bytes);
 written = written + trailing_bytes;
 }
-- 
2.14.3 (Apple Git-98)

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


[FFmpeg-devel] [PATCH 0/6] Vulkan hwcontext and filtering

2018-06-21 Thread Rostislav Pehlivanov
Fixed bugs, added Vaapi back and forth mapping, dropped host memory mapping
until it gets fixed.

Rostislav Pehlivanov (6):
  lavu: add a Vulkan hwcontext
  lavfi: add common Vulkan filtering code
  lavfi: add a Vulkan avgblur filter
  lavfi: add a Vulkan chromatic aberration filter
  lavfi: add a Vulkan scale filter
  lavfi: add a Vulkan overlay filter

 configure   |   26 +-
 doc/APIchanges  |4 +
 libavfilter/Makefile|4 +
 libavfilter/allfilters.c|4 +
 libavfilter/vf_avgblur_vulkan.c |  343 +++
 libavfilter/vf_chromaticaberration_vulkan.c |  342 +++
 libavfilter/vf_overlay_vulkan.c |  461 
 libavfilter/vf_scale_vulkan.c   |  395 
 libavfilter/vulkan.c| 1192 ++
 libavfilter/vulkan.h|  223 ++
 libavutil/Makefile  |3 +
 libavutil/hwcontext.c   |4 +
 libavutil/hwcontext.h   |1 +
 libavutil/hwcontext_internal.h  |1 +
 libavutil/hwcontext_vulkan.c| 2225 +++
 libavutil/hwcontext_vulkan.h|  133 ++
 libavutil/pixdesc.c |4 +
 libavutil/pixfmt.h  |4 +
 libavutil/version.h |4 +-
 19 files changed, 5369 insertions(+), 4 deletions(-)
 create mode 100644 libavfilter/vf_avgblur_vulkan.c
 create mode 100644 libavfilter/vf_chromaticaberration_vulkan.c
 create mode 100644 libavfilter/vf_overlay_vulkan.c
 create mode 100644 libavfilter/vf_scale_vulkan.c
 create mode 100644 libavfilter/vulkan.c
 create mode 100644 libavfilter/vulkan.h
 create mode 100644 libavutil/hwcontext_vulkan.c
 create mode 100644 libavutil/hwcontext_vulkan.h

-- 
2.18.0.rc2.346.g013aa6912e

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


[FFmpeg-devel] [PATCH 2/6] lavfi: add common Vulkan filtering code

2018-06-21 Thread Rostislav Pehlivanov
This commit adds a common code for use in Vulkan filters. It attempts
to ease the burden of writing Vulkan image filtering to a minimum,
which is pretty much a requirement considering how verbose the API is.

It supports both compute and graphic pipelines and manages to abstract
the API to such a level there's no need to call any Vulkan functions
inside the init path of the code. Handling shader descriptors is probably
the bulk of the code, and despite the abstraction, it loses none of the
features for describing shader IO.

In order to produce linkable shaders, it depends on the libshaderc
library (and depends on the latest stable version of it). This allows
for greater performance and flexibility than static built-in shaders
and also eliminates the cumbersome process of interfacing with glslang
to compile GLSL to SPIR-V.

It's based off of the common opencl and provides similar interfaces for
filter pad init and config, with the addition that it also supports
in-place filtering.

Signed-off-by: Rostislav Pehlivanov 
---
 configure|   12 +-
 libavfilter/vulkan.c | 1192 ++
 libavfilter/vulkan.h |  223 
 3 files changed, 1425 insertions(+), 2 deletions(-)
 create mode 100644 libavfilter/vulkan.c
 create mode 100644 libavfilter/vulkan.h

diff --git a/configure b/configure
index 7623a1205a..97bd4225dc 100755
--- a/configure
+++ b/configure
@@ -252,6 +252,7 @@ External library support:
   --enable-librsvg enable SVG rasterization via librsvg [no]
   --enable-librubberband   enable rubberband needed for rubberband filter [no]
   --enable-librtmp enable RTMP[E] support via librtmp [no]
+  --enable-libshaderc  enable GLSL->SPIRV compilation via libshaderc [no]
   --enable-libshineenable fixed-point MP3 encoding via libshine [no]
   --enable-libsmbclientenable Samba protocol via libsmbclient [no]
   --enable-libsnappy   enable Snappy compression, needed for hap encoding 
[no]
@@ -1709,6 +1710,7 @@ EXTERNAL_LIBRARY_LIST="
 libpulse
 librsvg
 librtmp
+libshaderc
 libshine
 libsmbclient
 libsnappy
@@ -2228,6 +2230,7 @@ HAVE_LIST="
 opencl_dxva2
 opencl_vaapi_beignet
 opencl_vaapi_intel_media
+shaderc_opt_perf
 vulkan_drm_mod
 perl
 pod2man
@@ -3462,12 +3465,12 @@ avcodec_select="null_bsf"
 avdevice_deps="avformat avcodec avutil"
 avdevice_suggest="libm"
 avfilter_deps="avutil"
-avfilter_suggest="libm"
+avfilter_suggest="libm libshaderc"
 avformat_deps="avcodec avutil"
 avformat_suggest="libm network zlib"
 avresample_deps="avutil"
 avresample_suggest="libm"
-avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl user32 vaapi 
videotoolbox corefoundation corevideo coremedia bcrypt"
+avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl vulkan 
user32 vaapi videotoolbox corefoundation corevideo coremedia bcrypt"
 postproc_deps="avutil gpl"
 postproc_suggest="libm"
 swresample_deps="avutil"
@@ -6056,6 +6059,7 @@ enabled libpulse  && require_pkg_config libpulse 
libpulse pulse/pulseaud
 enabled librsvg   && require_pkg_config librsvg librsvg-2.0 
librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
 enabled librtmp   && require_pkg_config librtmp librtmp librtmp/rtmp.h 
RTMP_Socket
 enabled librubberband && require_pkg_config librubberband "rubberband >= 
1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append 
librubberband_extralibs "-lstdc++"
+enabled libshaderc&& require libshaderc shaderc/shaderc.h 
shaderc_compiler_initialize -lshaderc_shared
 enabled libshine  && require_pkg_config libshine shine shine/layer3.h 
shine_encode_buffer
 enabled libsmbclient  && { check_pkg_config libsmbclient smbclient 
libsmbclient.h smbc_init ||
require libsmbclient libsmbclient.h smbc_init 
-lsmbclient; }
@@ -6363,6 +6367,10 @@ enabled crystalhd && check_lib crystalhd "stdint.h 
libcrystalhd/libcrystalhd_if.
 enabled vulkan &&
 require_pkg_config vulkan "vulkan >= 1.1.73" "vulkan/vulkan.h" 
vkCreateInstance
 
+if enabled_all vulkan libshaderc ; then
+check_cc shaderc_opt_perf shaderc/shaderc.h "int t = 
shaderc_optimization_level_performance"
+fi
+
 if enabled_all vulkan libdrm ; then
 check_cpp_condition vulkan_drm_mod vulkan/vulkan.h "defined 
VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME"
 fi
diff --git a/libavfilter/vulkan.c b/libavfilter/vulkan.c
new file mode 100644
index 00..976e846fa3
--- /dev/null
+++ b/libavfilter/vulkan.c
@@ -0,0 +1,1192 @@
+/*
+ * Vulkan utilities
+ * Copyright (c) 2018 Rostislav Pehlivanov 
+ *
+ * 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

[FFmpeg-devel] [PATCH 5/6] lavfi: add a Vulkan scale filter

2018-06-21 Thread Rostislav Pehlivanov
Can convert to RGB using very fast fixed-function conversions.

Signed-off-by: Rostislav Pehlivanov 
---
 configure |   1 +
 libavfilter/Makefile  |   1 +
 libavfilter/allfilters.c  |   1 +
 libavfilter/vf_scale_vulkan.c | 395 ++
 4 files changed, 398 insertions(+)
 create mode 100644 libavfilter/vf_scale_vulkan.c

diff --git a/configure b/configure
index cd5229ef2d..d1ceb9e38d 100755
--- a/configure
+++ b/configure
@@ -3428,6 +3428,7 @@ zmq_filter_deps="libzmq"
 zoompan_filter_deps="swscale"
 zscale_filter_deps="libzimg const_nan"
 scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
+scale_vulkan_filter_deps="vulkan libshaderc"
 vpp_qsv_filter_deps="libmfx"
 vpp_qsv_filter_select="qsvvpp"
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index dbb7a859dd..6e2d3681ec 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -317,6 +317,7 @@ OBJS-$(CONFIG_SCALE_CUDA_FILTER) += 
vf_scale_cuda.o vf_scale_cuda.pt
 OBJS-$(CONFIG_SCALE_NPP_FILTER)  += vf_scale_npp.o scale.o
 OBJS-$(CONFIG_SCALE_QSV_FILTER)  += vf_scale_qsv.o
 OBJS-$(CONFIG_SCALE_VAAPI_FILTER)+= vf_scale_vaapi.o scale.o 
vaapi_vpp.o
+OBJS-$(CONFIG_SCALE_VULKAN_FILTER)   += vf_scale_vulkan.o scale.o 
vulkan.o
 OBJS-$(CONFIG_SCALE2REF_FILTER)  += vf_scale.o scale.o
 OBJS-$(CONFIG_SELECT_FILTER) += f_select.o
 OBJS-$(CONFIG_SELECTIVECOLOR_FILTER) += vf_selectivecolor.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 5848ad9b4f..ee58cc9eee 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -306,6 +306,7 @@ extern AVFilter ff_vf_scale_cuda;
 extern AVFilter ff_vf_scale_npp;
 extern AVFilter ff_vf_scale_qsv;
 extern AVFilter ff_vf_scale_vaapi;
+extern AVFilter ff_vf_scale_vulkan;
 extern AVFilter ff_vf_scale2ref;
 extern AVFilter ff_vf_select;
 extern AVFilter ff_vf_selectivecolor;
diff --git a/libavfilter/vf_scale_vulkan.c b/libavfilter/vf_scale_vulkan.c
new file mode 100644
index 00..4a5647072d
--- /dev/null
+++ b/libavfilter/vf_scale_vulkan.c
@@ -0,0 +1,395 @@
+/*
+ * 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/opt.h"
+#include "vulkan.h"
+#include "scale.h"
+#include "internal.h"
+
+enum ScalerFunc {
+F_BILINEAR = 0,
+F_NEAREST,
+
+F_NB,
+};
+
+typedef struct ScaleVulkanContext {
+VulkanFilterContext vkctx;
+
+int conv;
+int initialized;
+FFVkExecContext exec;
+const VulkanSampler *sampler;
+
+/* Shader updators, must be in the main filter struct */
+VkDescriptorImageInfo input_images[3];
+VkDescriptorImageInfo output_images[3];
+
+enum ScalerFunc scaler;
+char *output_format_string;
+char *w_expr;
+char *h_expr;
+} ScaleVulkanContext;
+
+static const char scale_bilinear[] = {
+C(0, void scale_bilinear(int idx, ivec2 pos)   
)
+C(0, { 
)
+C(1, const vec2 npos = (vec2(pos) + 0.5f) / 
imageSize(output_img[idx]);)
+C(1, imageStore(output_img[idx], pos, texture(input_img[idx], npos));  
)
+C(0, } 
)
+};
+
+static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in)
+{
+int err;
+VkFilter sampler_mode;
+ScaleVulkanContext *s = ctx->priv;
+
+switch (s->scaler) {
+case F_NEAREST:
+sampler_mode = VK_FILTER_NEAREST;
+break;
+case F_BILINEAR:
+sampler_mode = VK_FILTER_LINEAR;
+break;
+};
+
+/* Create a sampler */
+s->sampler = ff_vk_init_sampler(ctx, s->conv ? in : NULL, 0, sampler_mode);
+if (!s->sampler)
+return AVERROR_EXTERNAL;
+
+{ /* Create the shader */
+SPIRVShader *shd = ff_vk_init_shader(ctx, "scale_compute",
+ VK_SHADER_STAGE_COMPUTE_BIT);
+ff_vk_set_compute_shader_sizes(ctx, shd, (int [3]){ 16, 16, 1 });
+
+VulkanDescriptorSetBinding desc_i[2] = {
+{
+.name   = "input_img",
+.type   = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
+

[FFmpeg-devel] [PATCH 3/6] lavfi: add a Vulkan avgblur filter

2018-06-21 Thread Rostislav Pehlivanov
Signed-off-by: Rostislav Pehlivanov 
---
 configure   |   1 +
 libavfilter/Makefile|   1 +
 libavfilter/allfilters.c|   1 +
 libavfilter/vf_avgblur_vulkan.c | 343 
 4 files changed, 346 insertions(+)
 create mode 100644 libavfilter/vf_avgblur_vulkan.c

diff --git a/configure b/configure
index 97bd4225dc..eab7c5b630 100755
--- a/configure
+++ b/configure
@@ -3313,6 +3313,7 @@ ass_filter_deps="libass"
 atempo_filter_deps="avcodec"
 atempo_filter_select="rdft"
 avgblur_opencl_filter_deps="opencl"
+avgblur_vulkan_filter_deps="vulkan libshaderc"
 azmq_filter_deps="libzmq"
 blackframe_filter_deps="gpl"
 boxblur_filter_deps="gpl"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 5b4be4966c..d1cab35e2e 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -150,6 +150,7 @@ OBJS-$(CONFIG_ATADENOISE_FILTER) += 
vf_atadenoise.o
 OBJS-$(CONFIG_AVGBLUR_FILTER)+= vf_avgblur.o
 OBJS-$(CONFIG_AVGBLUR_OPENCL_FILTER) += vf_avgblur_opencl.o opencl.o \
 opencl/avgblur.o
+OBJS-$(CONFIG_AVGBLUR_VULKAN_FILTER) += vf_avgblur_vulkan.o vulkan.o
 OBJS-$(CONFIG_BBOX_FILTER)   += bbox.o vf_bbox.o
 OBJS-$(CONFIG_BENCH_FILTER)  += f_bench.o
 OBJS-$(CONFIG_BITPLANENOISE_FILTER)  += vf_bitplanenoise.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index f2d27d2424..a05616f728 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -141,6 +141,7 @@ extern AVFilter ff_vf_ass;
 extern AVFilter ff_vf_atadenoise;
 extern AVFilter ff_vf_avgblur;
 extern AVFilter ff_vf_avgblur_opencl;
+extern AVFilter ff_vf_avgblur_vulkan;
 extern AVFilter ff_vf_bbox;
 extern AVFilter ff_vf_bench;
 extern AVFilter ff_vf_bitplanenoise;
diff --git a/libavfilter/vf_avgblur_vulkan.c b/libavfilter/vf_avgblur_vulkan.c
new file mode 100644
index 00..5b89ae0718
--- /dev/null
+++ b/libavfilter/vf_avgblur_vulkan.c
@@ -0,0 +1,343 @@
+/*
+ * 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/opt.h"
+#include "vulkan.h"
+#include "internal.h"
+
+typedef struct AvgBlurVulkanContext {
+VulkanFilterContext vkctx;
+
+int initialized;
+FFVkExecContext exec;
+
+/* Shader updators, must be in the main filter struct */
+VkDescriptorImageInfo input_images[3];
+VkDescriptorImageInfo output_images[3];
+
+int size_x;
+int size_y;
+int planes;
+} AvgBlurVulkanContext;
+
+static const char blur_kernel[] = {
+C(0, #define CACHE_SIZE (ivec2(gl_WorkGroupSize) + FILTER_RADIUS*2)
)
+C(0, shared vec4 cache[AREA(CACHE_SIZE)];  
)
+C(0,   
)
+C(0, void blur_kernel(int idx, ivec2 pos)  
)
+C(0, { 
)
+C(1, ivec2 d;  
)
+C(1, const ivec2 s = CACHE_SIZE;   
)
+C(1, const ivec2 w = ivec2(gl_WorkGroupSize);  
)
+C(1, const ivec2 l = ivec2(gl_LocalInvocationID.xy);   
)
+C(1,   
)
+C(1, for (d.y = l.y; d.y < s.y; d.y += w.y) {  
)
+C(2, for (d.x = l.x; d.x < s.x; d.x += w.x) {  
)
+C(3, const ivec2 np = pos + d - l - FILTER_RADIUS; 
)
+C(3, cache[d.y*s.x + d.x] = imageLoad(input_img[idx], np); 
)
+C(2, } 
)
+C(1, } 
)
+C(0,   
)
+C(1, barrier();
)
+C(0,   
)
+C(1, vec4 avg = vec4(0.0f);
)
+C(1, ivec2 start 

Re: [FFmpeg-devel] [PATCH v2 16/36] vaapi_encode: Clean up rate control configuration

2018-06-21 Thread Michael Niedermayer
On Thu, Jun 21, 2018 at 12:10:04AM +0100, Mark Thompson wrote:
> On 20/06/18 10:44, Li, Zhong wrote:
> >> -Original Message-
> >> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> >> Of Mark Thompson
> >> Sent: Sunday, June 17, 2018 9:51 PM
> >> To: ffmpeg-devel@ffmpeg.org
> >> Subject: Re: [FFmpeg-devel] [PATCH v2 16/36] vaapi_encode: Clean up rate
> >> control configuration
> >>
> >> On 14/06/18 08:22, Li, Zhong wrote:
>  -Original Message-
>  From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> >> Behalf
>  Of Xiang, Haihao
>  Sent: Thursday, June 14, 2018 2:08 PM
>  To: ffmpeg-devel@ffmpeg.org
>  Subject: Re: [FFmpeg-devel] [PATCH v2 16/36] vaapi_encode: Clean up
>  rate control configuration
> 
>  On Wed, 2018-06-13 at 23:42 +0100, Mark Thompson wrote:
> > On 13/06/18 08:03, Xiang, Haihao wrote:
> >> On Fri, 2018-06-08 at 00:43 +0100, Mark Thompson wrote:
> >>> Query which modes are supported and select between VBR and CBR
> >>> based on that - this removes all of the codec-specific rate
> >>> control mode selection code.
> >>> ---
> >>>  doc/encoders.texi   |   2 -
> >>>  libavcodec/vaapi_encode.c   | 173
>  ---
> >>> 
> >>> -
> >>>  libavcodec/vaapi_encode.h   |   6 +-
> >>>  libavcodec/vaapi_encode_h264.c  |  18 +
> >>> libavcodec/vaapi_encode_h265.c  |  14 +---
> >>>  libavcodec/vaapi_encode_mjpeg.c |   3 +-
> >>>  libavcodec/vaapi_encode_mpeg2.c |   9 +--
> >>>  libavcodec/vaapi_encode_vp8.c   |  13 +--
> >>>  libavcodec/vaapi_encode_vp9.c   |  13 +--
> >>>  9 files changed, 137 insertions(+), 114 deletions(-)
> >>>
> >>> ...
> >>> diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
> >>> index f4c063734c..5de5483454 100644
> >>> --- a/libavcodec/vaapi_encode.c
> >>> +++ b/libavcodec/vaapi_encode.c
> >>> ...
> >>> +if (avctx->flags & AV_CODEC_FLAG_QSCALE ||
> >>> +avctx->bit_rate <= 0) {
> >>
> >> This condition ^
> >>
> >>> +if (rc_attr.value & VA_RC_CQP) {
> >>> +av_log(avctx, AV_LOG_VERBOSE, "Using
>  constant-quality
> >>> mode.\n");
> >>> +ctx->va_rc_mode = VA_RC_CQP;
> >>> +return 0;
> >>> +} else {
> >>> +av_log(avctx, AV_LOG_ERROR, "Driver does not
>  support "
> >>> +   "constant-quality mode (%#x).\n",
>  rc_attr.value);
> >>> +return AVERROR(EINVAL);
> >>> +}
> >>> +}
> >>> ...
> >>> +} else if (avctx->rc_max_rate == avctx->bit_rate) {
> >>> +if (!(rc_attr.value & VA_RC_CBR)) {
> >>> +av_log(avctx, AV_LOG_WARNING, "Driver does not
>  support "
> >>> +   "CBR mode (%#x), using VBR mode
>  instead.\n",
> >>> +   rc_attr.value);
> >>> +ctx->va_rc_mode = VA_RC_VBR;
> >>> +} else {
> >>> +ctx->va_rc_mode = VA_RC_CBR;
> >>> +}
> >>>
> >>> -if (ctx->va_rc_mode == VA_RC_CBR) {
> >>>  rc_bits_per_second   = avctx->bit_rate;
> >>>  rc_target_percentage = 100;
> >>> -rc_window_size   = 1000;
> >>> +
> >>>  } else {
> >>> -if (avctx->rc_max_rate < avctx->bit_rate) {
> >>> -// Max rate is unset or invalid, just use the normal
>  bitrate.
> >>> +if (rc_attr.value & VA_RC_VBR) {
> >>> +ctx->va_rc_mode = VA_RC_VBR;
> >>
> >> Is it better to take it as CBR when avctx->rc_max_rate is 0 and CBR
> >> is supported by driver?
> >
> > I don't think so?  VBR with the specified target is probably what
> > you want in most cases, and I think anyone with specific constraints
> > that want constant bitrate should expect to set maxrate to achieve that.
> >
> 
>  I agree VBR is probably what an user wants in most case, however
>  target percent set to 50% is not suitable for most case. To get a
>  specific target percent, user should set both target bitrate and max
>  bitrate, so it is reasonable to ask user must set both target bitrate
>  and max bitrate for VBR cases, and for CBR user may set target bitrate
> >> only.
> >>>
> >>> How about set the max_rate to be a very larger number such as INT_MAX
> >> if user hasn't set it?
> >>> User may don't set max_rate on purpose, expecting better quality with
> >> unlimited bitrate fluctuation (common requirement for local video files).
> >>> Double of target_bit_rate is too strict IMHO. And I haven't such a
> >> limitation in x264 ABR mode.
> >>
> >> This unconstrained setup you describe was my intent (as you say, it's 
> >> usually
> >> what you want for local files), but unfortunately the API doesn't really 
> >> l

Re: [FFmpeg-devel] [PATCH] lavc/cfhd: added correct decompanding to codebook0

2018-06-21 Thread Michael Niedermayer
On Thu, Jun 21, 2018 at 04:03:10PM +0530, Gagandeep Singh wrote:
> output of samples using codebook 0 improved
> ---
>  libavcodec/cfhd.c | 25 -
>  1 file changed, 24 insertions(+), 1 deletion(-)

this depends on your previous patch, you should mention this, because
people will not know how to apply this otherwise (it doesnt apply to
master without the previous patch)

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

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 


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


Re: [FFmpeg-devel] [PATCH 3/6] lavfi: add a Vulkan avgblur filter

2018-06-21 Thread Michael Niedermayer
On Thu, Jun 21, 2018 at 05:55:40PM +0100, Rostislav Pehlivanov wrote:
> Signed-off-by: Rostislav Pehlivanov 
> ---
>  configure   |   1 +
>  libavfilter/Makefile|   1 +
>  libavfilter/allfilters.c|   1 +
>  libavfilter/vf_avgblur_vulkan.c | 343 
>  4 files changed, 346 insertions(+)
>  create mode 100644 libavfilter/vf_avgblur_vulkan.c

seems not to apply automatically (with the 2 previous patches)

Applying: lavfi: add a Vulkan avgblur filter
error: sha1 information is lacking or useless (configure).
error: could not build fake ancestor
Patch failed at 0001 lavfi: add a Vulkan avgblur filter
Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

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


Re: [FFmpeg-devel] [PATCH]lavc/dpx: Support 12-bit packing method b (msbpad)

2018-06-21 Thread Carl Eugen Hoyos
2018-06-16 22:54 GMT+02:00, Carl Eugen Hoyos :
> 2018-06-16 17:18 GMT+02:00, Carl Eugen Hoyos :
>
>> Attached patch allows to decode files that can be created with
>> GraphicsMagick:
>> $ gm convert input -depth 12 -define dpx:packing-method=b out.dpx
>
> Updated patch attached, hoping I understood Jerome's comment correctly.

Patch applied.

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


Re: [FFmpeg-devel] [PATCH]lavc/dpx: Support 10-bit packing method b (msbpad)

2018-06-21 Thread Carl Eugen Hoyos
2018-06-16 23:03 GMT+02:00, Carl Eugen Hoyos :
> 2018-06-16 21:32 GMT+02:00, Jerome Martinez :
>> On 16/06/2018 17:49, Carl Eugen Hoyos wrote:
>
>>> +*lbuf = (*lbuf << 10) | (*lbuf >> shift);
>>
>> Padding bits are 0 in all DPX files I have seen up to now
>> but in theory padding bits are not defined
>
> Of course not, new patch attached.

Patch applied.

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


Re: [FFmpeg-devel] [FFmpeg-cvslog] lavfi: add opencl tonemap filter

2018-06-21 Thread Michael Niedermayer
On Thu, Jun 21, 2018 at 12:23:26AM +, Ruiling Song wrote:
> ffmpeg | branch: master | Ruiling Song  | Tue Jun 19 
> 09:57:31 2018 +0800| [8b8b0e2cd26cf1f522c630859fcbcc62b6493fb9] | committer: 
> Mark Thompson
> 
> lavfi: add opencl tonemap filter
> 
> This filter does HDR(HDR10/HLG) to SDR conversion with tone-mapping.
> 
> An example command to use this filter with vaapi codecs:
> FFMPEG -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device \
> opencl=ocl@va -hwaccel vaapi -hwaccel_device va -hwaccel_output_format \
> vaapi -i INPUT -filter_hw_device ocl -filter_complex \
> '[0:v]hwmap,tonemap_opencl=t=bt2020:tonemap=linear:format=p010[x1]; \
> [x1]hwmap=derive_device=vaapi:reverse=1' -c:v hevc_vaapi -profile 2 OUTPUT
> 
> Signed-off-by: Ruiling Song 
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b8b0e2cd26cf1f522c630859fcbcc62b6493fb9
> ---
> 
>  configure   |   1 +
>  libavfilter/Makefile|   2 +
>  libavfilter/allfilters.c|   1 +
>  libavfilter/colorspace.c|  90 +
>  libavfilter/colorspace.h|  41 +++
>  libavfilter/opencl/colorspace_common.cl | 220 +++
>  libavfilter/opencl/tonemap.cl   | 272 ++
>  libavfilter/opencl_source.h |   2 +
>  libavfilter/vf_tonemap_opencl.c | 624 
> 
>  9 files changed, 1253 insertions(+)
> 
> diff --git a/configure b/configure
> index 8ca258691d..6ad5ce8eaf 100755
> --- a/configure
> +++ b/configure
> @@ -3412,6 +3412,7 @@ tinterlace_filter_deps="gpl"
>  tinterlace_merge_test_deps="tinterlace_filter"
>  tinterlace_pad_test_deps="tinterlace_filter"
>  tonemap_filter_deps="const_nan"
> +tonemap_opencl_filter_deps="opencl const_nan"
>  unsharp_opencl_filter_deps="opencl"
>  uspp_filter_deps="gpl avcodec"
>  vaguedenoiser_filter_deps="gpl"
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 552499558d..589682f353 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -358,6 +358,8 @@ OBJS-$(CONFIG_TINTERLACE_FILTER) += 
> vf_tinterlace.o
>  OBJS-$(CONFIG_TLUT2_FILTER)  += vf_lut2.o framesync.o
>  OBJS-$(CONFIG_TMIX_FILTER)   += vf_mix.o framesync.o
>  OBJS-$(CONFIG_TONEMAP_FILTER)+= vf_tonemap.o
> +OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) += vf_tonemap_opencl.o 
> colorspace.o opencl.o \
> +opencl/tonemap.o 
> opencl/colorspace_common.o
>  OBJS-$(CONFIG_TRANSPOSE_FILTER)  += vf_transpose.o
>  OBJS-$(CONFIG_TRIM_FILTER)   += trim.o
>  OBJS-$(CONFIG_UNPREMULTIPLY_FILTER)  += vf_premultiply.o framesync.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index 2b44626028..e07fe67ec5 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -346,6 +346,7 @@ extern AVFilter ff_vf_tinterlace;
>  extern AVFilter ff_vf_tlut2;
>  extern AVFilter ff_vf_tmix;
>  extern AVFilter ff_vf_tonemap;
> +extern AVFilter ff_vf_tonemap_opencl;
>  extern AVFilter ff_vf_transpose;
>  extern AVFilter ff_vf_trim;
>  extern AVFilter ff_vf_unpremultiply;
> diff --git a/libavfilter/colorspace.c b/libavfilter/colorspace.c
> new file mode 100644
> index 00..7fd7bdf0d9
> --- /dev/null
> +++ b/libavfilter/colorspace.c
> @@ -0,0 +1,90 @@
> +/*
> + * Copyright (c) 2016 Ronald S. Bultje 
> + * 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 "colorspace.h"
> +
> +
> +void invert_matrix3x3(const double in[3][3], double out[3][3])

this (and others) need some (ff_) prefix to not pollute namespace

[...]
> +/*
> + * see e.g. http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
> + */
> +void fill_rgb2xyz_table(const struct PrimaryCoefficients *coeffs,
> +const struct WhitepointCoefficients *wp,
> +double rgb2xyz[3][3])
> +{
> +double i[3][3], sr, sg, sb, zw;
> +
> +rgb2xyz[0][0] = coeffs->xr / coeffs->yr;
> +rgb2xyz[0][1] = coeffs->xg / coeffs->yg;
> +rgb2xyz[0][2] = coeffs->xb / coeffs->yb;
> +rgb2xyz[1][0] = rgb2xyz[1][1] = rgb2xyz[1][2] = 1.0;
> +

Re: [FFmpeg-devel] libavutil/encryption_info: Allow multiple init info.

2018-06-21 Thread Jacob Trimble
On Thu, Jun 21, 2018 at 9:48 AM Michael Niedermayer
 wrote:
>
> > +if (UINT32_MAX == init_info_count ||
> > +UINT32_MAX - *side_data_size < FF_ENCRYPTION_INIT_INFO_EXTRA ||
> > +UINT32_MAX - *side_data_size - FF_ENCRYPTION_INIT_INFO_EXTRA < 
> > info->system_id_size ||
> > +UINT32_MAX - *side_data_size - FF_ENCRYPTION_INIT_INFO_EXTRA - 
> > info->system_id_size < info->data_size) {
> >  return NULL;
> > +}
>
> you can simplify this with (u)int64_t
>

Done
From f440fe2be172672c439fa8b216b08a8d0895f76f Mon Sep 17 00:00:00 2001
From: Jacob Trimble 
Date: Mon, 23 Apr 2018 10:33:58 -0700
Subject: [PATCH] libavutil/encryption_info: Allow multiple init info.

It is possible for there to be multiple encryption init info structure.
For example, to support multiple key systems or in key rotation.  This
changes the AVEncryptionInitInfo struct to be a linked list so there
can be multiple structs without breaking ABI.

Signed-off-by: Jacob Trimble 
---
 libavutil/encryption_info.c | 146 +++-
 libavutil/encryption_info.h |   5 ++
 2 files changed, 100 insertions(+), 51 deletions(-)

diff --git a/libavutil/encryption_info.c b/libavutil/encryption_info.c
index 20a752d6b4..3b7e16cd0c 100644
--- a/libavutil/encryption_info.c
+++ b/libavutil/encryption_info.c
@@ -160,13 +160,16 @@ uint8_t *av_encryption_info_add_side_data(const AVEncryptionInfo *info, size_t *
 }
 
 // The format of the AVEncryptionInitInfo side data:
-// u32be system_id_size
-// u32be num_key_ids
-// u32be key_id_size
-// u32be data_size
-// u8[system_id_size] system_id
-// u8[key_id_size][num_key_id] key_ids
-// u8[data_size] data
+// u32be init_info_count
+// {
+//   u32be system_id_size
+//   u32be num_key_ids
+//   u32be key_id_size
+//   u32be data_size
+//   u8[system_id_size] system_id
+//   u8[key_id_size][num_key_id] key_ids
+//   u8[data_size] data
+// }[init_info_count]
 
 #define FF_ENCRYPTION_INIT_INFO_EXTRA 16
 
@@ -215,6 +218,7 @@ void av_encryption_init_info_free(AVEncryptionInitInfo *info)
 for (i = 0; i < info->num_key_ids; i++) {
 av_free(info->key_ids[i]);
 }
+av_encryption_init_info_free(info->next);
 av_free(info->system_id);
 av_free(info->key_ids);
 av_free(info->data);
@@ -225,71 +229,111 @@ void av_encryption_init_info_free(AVEncryptionInitInfo *info)
 AVEncryptionInitInfo *av_encryption_init_info_get_side_data(
 const uint8_t *side_data, size_t side_data_size)
 {
-AVEncryptionInitInfo *info;
-uint64_t system_id_size, num_key_ids, key_id_size, data_size, i;
+// |ret| tracks the front of the list, |info| tracks the back.
+AVEncryptionInitInfo *ret = NULL, *info, *temp_info;
+uint64_t system_id_size, num_key_ids, key_id_size, data_size, i, j;
+uint64_t init_info_count;
 
-if (!side_data || side_data_size < FF_ENCRYPTION_INIT_INFO_EXTRA)
+if (!side_data || side_data_size < 4)
 return NULL;
 
-system_id_size = AV_RB32(side_data);
-num_key_ids = AV_RB32(side_data + 4);
-key_id_size = AV_RB32(side_data + 8);
-data_size = AV_RB32(side_data + 12);
+init_info_count = AV_RB32(side_data);
+side_data += 4;
+side_data_size -= 4;
+for (i = 0; i < init_info_count; i++) {
+if (side_data_size < FF_ENCRYPTION_INIT_INFO_EXTRA) {
+av_encryption_init_info_free(ret);
+return NULL;
+}
 
-// UINT32_MAX + UINT32_MAX + UINT32_MAX * UINT32_MAX == UINT64_MAX
-if (side_data_size - FF_ENCRYPTION_INIT_INFO_EXTRA < system_id_size + data_size + num_key_ids * key_id_size)
-return NULL;
+system_id_size = AV_RB32(side_data);
+num_key_ids = AV_RB32(side_data + 4);
+key_id_size = AV_RB32(side_data + 8);
+data_size = AV_RB32(side_data + 12);
 
-info = av_encryption_init_info_alloc(system_id_size, num_key_ids, key_id_size, data_size);
-if (!info)
-return NULL;
+// UINT32_MAX + UINT32_MAX + UINT32_MAX * UINT32_MAX == UINT64_MAX
+if (side_data_size - FF_ENCRYPTION_INIT_INFO_EXTRA < system_id_size + data_size + num_key_ids * key_id_size) {
+av_encryption_init_info_free(ret);
+return NULL;
+}
+side_data += FF_ENCRYPTION_INIT_INFO_EXTRA;
+side_data_size -= FF_ENCRYPTION_INIT_INFO_EXTRA;
+
+temp_info = av_encryption_init_info_alloc(system_id_size, num_key_ids, key_id_size, data_size);
+if (!temp_info) {
+av_encryption_init_info_free(ret);
+return NULL;
+}
+if (i == 0) {
+info = ret = temp_info;
+} else {
+info->next = temp_info;
+info = temp_info;
+}
 
-memcpy(info->system_id, side_data + 16, system_id_size);
-side_data += system_id_size + 16;
-for (i = 0; i < num_key_ids; i++) {
-  memcpy(info->key_ids[i], side_data, key_id_size);
-  side_data += key_id_size

Re: [FFmpeg-devel] ffmpeg patch for nonmonolithic increase dts error in subtitle

2018-06-21 Thread Michael Niedermayer
On Thu, Jun 21, 2018 at 02:27:29PM +0200, Carl Eugen Hoyos wrote:
> 2018-06-21 13:55 GMT+02:00, Moritz Barsnick :
> > On Thu, Jun 21, 2018 at 10:51:33 +0200, Carl Eugen Hoyos wrote:
> 
> >> Who wrote the patch / where did you find it?
> >
> > The ticket he mentioned was #4450, the patch is here:
> > https://trac.ffmpeg.org/ticket/4450#comment:6
> 
> Patch attached (untested).
> 
> Thank you, Carl Eugen

>  ffmpeg.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 1b6b6990b1e8bf9885dd55431ccbe64da8553504  
> 0001-ffmpeg-Treat-subtitles-like-audio-and-video-for-non-.patch
> From 6ff1a1c662211548ae3c8c01ddfc2775e03b2497 Mon Sep 17 00:00:00 2001
> From: Hans Carlson 
> Date: Thu, 21 Jun 2018 14:24:36 +0200
> Subject: [PATCH] ffmpeg: Treat subtitles like audio and video for
>  non-monotonic dts.
> 
> Fixes ticket #4450.
> Fixes ticket #6248.
> ---
>  fftools/ffmpeg.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index 6dfab64..8d311a9 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -772,7 +772,7 @@ static void write_packet(OutputFile *of, AVPacket *pkt, 
> OutputStream *ost, int u
>   - FFMIN3(pkt->pts, pkt->dts, ost->last_mux_dts + 1)
>   - FFMAX3(pkt->pts, pkt->dts, ost->last_mux_dts + 1);
>  }
> -if ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || 
> st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) &&
> +if ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || 
> st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO || st->codecpar->codec_type == 
> AVMEDIA_TYPE_SUBTITLE) &&
>  pkt->dts != AV_NOPTS_VALUE &&
>  !(st->codecpar->codec_id == AV_CODEC_ID_VP9 && ost->stream_copy) 
> &&
>  ost->last_mux_dts != AV_NOPTS_VALUE) {

probably ok, but please wait a day or 2 so others can comment too

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire


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


[FFmpeg-devel] Looking for a consultant

2018-06-21 Thread Ariel Frailich
We are a small film distribution company in the process of setting
up our own video streaming site. We moved from using an encoding 
service provider to running ffmpeg in-house. Now we want to set up 
a dedicated machine to speed up the process, but we need guidance
for this.

THE PROCESS

Input: mostly ProRes (10-20Gb), HD to 4K res, 90 mins average length.

Output: a set of .mp4 files at 5 different resolutions, up to 1080. 
These are further processed (primarily bento4) to create multiple/
variable bitrate HLS and DASH streams, with encryption and DRM.

On our office machine (iMac, 3.2 GHz Intel Core i5, 8Gb, macOS 
Sierra), encoding typically takes 6-7 hours per film. Ideally, we 
would like to cut this down to 1-2 hours.

WHAT WE NEED TO KNOW

1. Hardware: what's a good hardware configuration for our needs?

CPUs, cores, RAM, RAM disk, graphics cards, etc. Also, which
version of Linux is recommended (or which to avoid).

2. ffmpeg setup: how should ffmpeg be compiled to best take 
advantage of the particular hardware configuration?

3. Video processing: how should ffmpeg be run to maximize speed
and efficiency, and to produce the most suitable files for our 
needs?

I wrote a script to create the ffmpeg command line, based on bits
and pieces found in various places on the web. No doubt it's far 
from optimal.

CAN YOU HELP?

If you can answer the questions above, we would like to hear from you. 
Please contact me at ariel at websiteatelier dot com.

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


Re: [FFmpeg-devel] Looking for a consultant

2018-06-21 Thread Carl Eugen Hoyos
2018-06-20 16:50 GMT+02:00, Ariel Frailich :

> Input: mostly ProRes (10-20Gb), HD to 4K res, 90 mins average length.
>
> Output: a set of .mp4 files at 5 different resolutions, up to 1080.
> These are further processed (primarily bento4) to create multiple/
> variable bitrate HLS and DASH streams, with encryption and DRM.

(The most important information would be the target codec.)

> On our office machine (iMac, 3.2 GHz Intel Core i5, 8Gb, macOS
> Sierra), encoding typically takes 6-7 hours per film. Ideally, we
> would like to cut this down to 1-2 hours.
>
> WHAT WE NEED TO KNOW
>
> 1. Hardware: what's a good hardware configuration for our needs?

That depends on the question if you want hardware or software
encoding (that nobody here can answer, only you).

> CPUs, cores, RAM, RAM disk, graphics cards, etc.

The more cpu cores the faster software encoding is, you
will find information online about the performance of
graphic cards for hardware encoding.

> Also, which version of Linux is recommended (or which to avoid).

No limitations known.
(musl 32bit is unsupported which we are not allowed to
document but this will not hit you.)

> 2. ffmpeg setup: how should ffmpeg be compiled to best take
> advantage of the particular hardware configuration?

$ ./configure --enable-gpl && make for hardware encoding,
$ ./configure --enable-gpl --enable-libx264 && make for
software encoding.

> 3. Video processing: how should ffmpeg be run to maximize
> speed and efficiency, and to produce the most suitable files
> for our needs?

I may misunderstand (and this is possibly not an FFmpeg-
related question) but for software encoding, remember that
threads do not scale well, single-threaded encoding (of
multiple files at the same time) is always most efficient.

Carl Eugen

PS: In case you don't know: Hardware encoding is potentially
faster than software encoding but provides worse quality for
a given bitrate or larger files for a given quality.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/5] libavcodec/ffv1enc: minor cosmetic fix

2018-06-21 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavcodec/ffv1enc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index e6f4422fa1..f5eb0feb4e 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -123,7 +123,7 @@ static const uint8_t ver2_state[256] = {
  40,  40,  41,  79,  43,  44,  45,  45, 48,   48,  64,  50,  51,  52,  88, 
 52,
  53,  74,  55,  57,  58,  58,  74,  60, 101,  61,  62,  84,  66,  66,  68, 
 69,
  87,  82,  71,  97,  73,  73,  82,  75, 111,  77,  94,  78,  87,  81,  83, 
 97,
- 85,  83,  94,  86,  99,  89,  90,  99, 111,  92,  93,  134, 95,  98,  
105, 98,
+ 85,  83,  94,  86,  99,  89,  90,  99, 111,  92,  93,  134, 95,  98, 105, 
 98,
 105, 110, 102, 108, 102, 118, 103, 106, 106, 113, 109, 112, 114, 112, 116, 
125,
 115, 116, 117, 117, 126, 119, 125, 121, 121, 123, 145, 124, 126, 131, 127, 
129,
 165, 130, 132, 138, 133, 135, 145, 136, 137, 139, 146, 141, 143, 142, 144, 
148,
-- 
2.17.1

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


[FFmpeg-devel] [PATCH 3/5] avcodec/mjpegdec: Check for end of bitstream in ljpeg_decode_rgb_scan()

2018-06-21 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
8648/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-5108395525799936

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/mjpegdec.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index d1dca84d36..00cfdd7151 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1055,6 +1055,11 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, 
int nb_components, int p
 for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
 int modified_predictor = predictor;
 
+if (get_bits_left(&s->gb) < 1) {
+av_log(s->avctx, AV_LOG_ERROR, "bitstream end in rgb_scan\n");
+return AVERROR_INVALIDDATA;
+}
+
 if (s->restart_interval && !s->restart_count){
 s->restart_count = s->restart_interval;
 resync_mb_x = mb_x;
-- 
2.17.1

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


[FFmpeg-devel] [PATCH 5/5] avcodec/dvbsubdec: Compute scoretab without iterating over pixels multiple times in compute_default_clut()

2018-06-21 Thread Michael Niedermayer
Improves speed 102->2 sec
Testcase: 
8655/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DVBSUB_fuzzer-6277869285146624
Fixes: Timeout

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/dvbsubdec.c | 44 --
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index a657b1d3d0..b59e836657 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -127,6 +127,7 @@ typedef struct DVBSubContext {
 int compute_edt; /**< if 1 end display time calculated using pts
   if 0 (Default) calculated using time out */
 int compute_clut;
+int clut_count2[257][256];
 int substream;
 int64_t prev_start;
 DVBSubRegion *region_list;
@@ -650,13 +651,17 @@ static int dvbsub_read_8bit_string(AVCodecContext *avctx,
 return pixels_read;
 }
 
-static void compute_default_clut(uint8_t *clut, AVSubtitleRect *rect, int w, 
int h)
+static void compute_default_clut(DVBSubContext *ctx, uint8_t *clut, 
AVSubtitleRect *rect, int w, int h)
 {
 uint8_t list[256] = {0};
 uint8_t list_inv[256];
 int counttab[256] = {0};
+int (*counttab2)[256] = ctx->clut_count2;
 int count, i, x, y;
 ptrdiff_t stride = rect->linesize[0];
+
+memset(ctx->clut_count2, 0 , sizeof(ctx->clut_count2));
+
 #define V(x,y) rect->data[0][(x) + (y)*stride]
 for (y = 0; ydata[0][x + y*stride];
-int v = *d;
-int l_m = list[v];
-int l_l = x ? L(-1, 0) : 1;
-int l_r = x+1 bestscore) {
 bestscore = score;
 bestv = x;
@@ -819,7 +825,7 @@ static int save_subtitle_set(AVCodecContext *avctx, 
AVSubtitle *sub, int *got_ou
 
 if ((clut == &default_clut && ctx->compute_clut == -1) || 
ctx->compute_clut == 1) {
 if (!region->has_computed_clut) {
-compute_default_clut(region->computed_clut, rect, rect->w, 
rect->h);
+compute_default_clut(ctx, region->computed_clut, rect, 
rect->w, rect->h);
 region->has_computed_clut = 1;
 }
 
-- 
2.17.1

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


[FFmpeg-devel] [PATCH 4/5] avcodec/ra144: Fix integer overflow in ff_eval_refl()

2018-06-21 Thread Michael Niedermayer
Fixes: signed integer overflow: -4096 * -524288 cannot be represented in type 
'int'
Fixes: 
8650/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RA_144_fuzzer-5734816036159488

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/ra144.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/ra144.c b/libavcodec/ra144.c
index c077b7b327..cf8127c236 100644
--- a/libavcodec/ra144.c
+++ b/libavcodec/ra144.c
@@ -1569,11 +1569,11 @@ int ff_eval_refl(int *refl, const int16_t *coefs, 
AVCodecContext *avctx)
 b = 0x100 / b;
 for (j=0; j <= i; j++) {
 #if CONFIG_FTRAPV
-int a = bp2[j] - ((refl[i+1] * bp2[i-j]) >> 12);
+int a = bp2[j] - ((int)(refl[i+1] * (unsigned)bp2[i-j]) >> 12);
 if((int)(a*(unsigned)b) != a*(int64_t)b)
 return 1;
 #endif
-bp1[j] = (int)((bp2[j] - ((refl[i+1] * bp2[i-j]) >> 12)) * 
(unsigned)b) >> 12;
+bp1[j] = (int)((bp2[j] - ((int)(refl[i+1] * (unsigned)bp2[i-j]) >> 
12)) * (unsigned)b) >> 12;
 }
 
 if ((unsigned) bp1[i] + 0x1000 > 0x1fff)
-- 
2.17.1

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


[FFmpeg-devel] [PATCH 2/5] avcodec/ffv1dec: Check state transition table

2018-06-21 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
8646/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-5649968353247232

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/ffv1dec.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 7658a51685..261e0cf70c 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -546,8 +546,14 @@ static int read_header(FFV1Context *f)
 f->ac = get_symbol(c, state, 0);
 
 if (f->ac == AC_RANGE_CUSTOM_TAB) {
-for (i = 1; i < 256; i++)
-f->state_transition[i] = get_symbol(c, state, 1) + 
c->one_state[i];
+for (i = 1; i < 256; i++) {
+int st = get_symbol(c, state, 1) + c->one_state[i];
+if (st < 1 || st > 255) {
+av_log(f->avctx, AV_LOG_ERROR, "invalid state transition 
%d\n", st);
+return AVERROR_INVALIDDATA;
+}
+f->state_transition[i] = st;
+}
 }
 
 colorspace  = get_symbol(c, state, 0); //YUV cs type
-- 
2.17.1

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


[FFmpeg-devel] [PATCH] avcodec/cscd: Check output buffer size for lzo.

2018-06-21 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
8665/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CSCD_fuzzer-5768442610188288

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
---
 libavcodec/cscd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/cscd.c b/libavcodec/cscd.c
index 35c4ee08c3..5eb511a565 100644
--- a/libavcodec/cscd.c
+++ b/libavcodec/cscd.c
@@ -81,7 +81,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 switch ((buf[0] >> 1) & 7) {
 case 0: { // lzo compression
 int outlen = c->decomp_size, inlen = buf_size - 2;
-if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen)) {
+if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen) || 
outlen) {
 av_log(avctx, AV_LOG_ERROR, "error during lzo 
decompression\n");
 return AVERROR_INVALIDDATA;
 }
-- 
2.17.1

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


Re: [FFmpeg-devel] Looking for a consultant

2018-06-21 Thread Gyan Doshi



On 22-06-2018 03:29 AM, Carl Eugen Hoyos wrote:


(musl 32bit is unsupported which we are not allowed to
document


Why is this?

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


Re: [FFmpeg-devel] Looking for a consultant

2018-06-21 Thread Jorge Ramirez-Ortiz

On 06/21/2018 11:59 PM, Carl Eugen Hoyos wrote:

2018-06-20 16:50 GMT+02:00, Ariel Frailich :


Input: mostly ProRes (10-20Gb), HD to 4K res, 90 mins average length.

Output: a set of .mp4 files at 5 different resolutions, up to 1080.
These are further processed (primarily bento4) to create multiple/
variable bitrate HLS and DASH streams, with encryption and DRM.

(The most important information would be the target codec.)


On our office machine (iMac, 3.2 GHz Intel Core i5, 8Gb, macOS
Sierra), encoding typically takes 6-7 hours per film. Ideally, we
would like to cut this down to 1-2 hours.

WHAT WE NEED TO KNOW

1. Hardware: what's a good hardware configuration for our needs?

That depends on the question if you want hardware or software
encoding (that nobody here can answer, only you).


CPUs, cores, RAM, RAM disk, graphics cards, etc.

The more cpu cores the faster software encoding is, you
will find information online about the performance of
graphic cards for hardware encoding.


just for completeness Carl - although I doubt it applies to these high 
performance/quality requirements- ffmpeg can deliver hardware encoding 
support if the system on chip has a hardware encoder, runs Linux and 
there is a v4l2 m2m kernel driver for it (this would bypass the need for 
a graphic card). An example of a board that would meet these usability 
requirements https://developer.qualcomm.com/hardware/dragonboard-820c. 
performance and quality will vary from SoC to Soc.






Also, which version of Linux is recommended (or which to avoid).

No limitations known.
(musl 32bit is unsupported which we are not allowed to
document but this will not hit you.)


2. ffmpeg setup: how should ffmpeg be compiled to best take
advantage of the particular hardware configuration?

$ ./configure --enable-gpl && make for hardware encoding,
$ ./configure --enable-gpl --enable-libx264 && make for
software encoding.


3. Video processing: how should ffmpeg be run to maximize
speed and efficiency, and to produce the most suitable files
for our needs?

I may misunderstand (and this is possibly not an FFmpeg-
related question) but for software encoding, remember that
threads do not scale well, single-threaded encoding (of
multiple files at the same time) is always most efficient.

Carl Eugen

PS: In case you don't know: Hardware encoding is potentially
faster than software encoding but provides worse quality for
a given bitrate or larger files for a given quality.
___
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