Re: [FFmpeg-devel] [PATCH] avfilter/avf_showfreqs: free input frame after using it

2019-10-26 Thread Paul B Mahol
LGTM

On 10/26/19, James Almer  wrote:
> Fixes ticket #8336.
>
> Signed-off-by: James Almer 
> ---
>  libavfilter/avf_showfreqs.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libavfilter/avf_showfreqs.c b/libavfilter/avf_showfreqs.c
> index c44ac564ac..645754ded3 100644
> --- a/libavfilter/avf_showfreqs.c
> +++ b/libavfilter/avf_showfreqs.c
> @@ -475,6 +475,7 @@ static int activate(AVFilterContext *ctx)
>  av_audio_fifo_write(s->fifo, (void **)in->extended_data,
> in->nb_samples);
>  if (s->pts == AV_NOPTS_VALUE)
>  s->pts = in->pts;
> +av_frame_free(&in);
>  }
>
>  if (av_audio_fifo_size(s->fifo) >= s->win_size) {
> --
> 2.23.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v1] avfilter/asrc_anoisesrc: change type to TYPE_INT64 for color is int64_t

2019-10-26 Thread Paul B Mahol
Not OK, variable should be int and not int64_t.

On 10/26/19, lance.lmw...@gmail.com  wrote:
> From: Limin Wang 
>
> Or it'll cause invalid color and s->filter is NULL.
> Please reproduce it with below command on big endian system:
> $ ./ffmpeg -f lavfi -i "anoisesrc=d=60:c=1:r=48000" -f s16le -c:a pcm_s16le
> -f null  -
> Segmentation fault (core dumped)
>
> Signed-off-by: Limin Wang 
> ---
>  libavfilter/asrc_anoisesrc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libavfilter/asrc_anoisesrc.c b/libavfilter/asrc_anoisesrc.c
> index 78f0af4fde..8a6ef89dd1 100644
> --- a/libavfilter/asrc_anoisesrc.c
> +++ b/libavfilter/asrc_anoisesrc.c
> @@ -60,9 +60,9 @@ static const AVOption anoisesrc_options[] = {
>  { "a","set amplitude",OFFSET(amplitude),
> AV_OPT_TYPE_DOUBLE,{.dbl = 1.},0.,  1., FLAGS },
>  { "duration", "set duration", OFFSET(duration),
> AV_OPT_TYPE_DURATION,  {.i64 =  0}, 0,  INT64_MAX,  FLAGS },
>  { "d","set duration", OFFSET(duration),
> AV_OPT_TYPE_DURATION,  {.i64 =  0}, 0,  INT64_MAX,  FLAGS },
> -{ "color","set noise color",  OFFSET(color),
> AV_OPT_TYPE_INT,   {.i64 =  0}, 0,  NM_NB - 1,  FLAGS, "color"
> },
> -{ "colour",   "set noise color",  OFFSET(color),
> AV_OPT_TYPE_INT,   {.i64 =  0}, 0,  NM_NB - 1,  FLAGS, "color"
> },
> -{ "c","set noise color",  OFFSET(color),
> AV_OPT_TYPE_INT,   {.i64 =  0}, 0,  NM_NB - 1,  FLAGS, "color"
> },
> +{ "color","set noise color",  OFFSET(color),
> AV_OPT_TYPE_INT64, {.i64 =  0}, 0,  NM_NB - 1,  FLAGS, "color"
> },
> +{ "colour",   "set noise color",  OFFSET(color),
> AV_OPT_TYPE_INT64, {.i64 =  0}, 0,  NM_NB - 1,  FLAGS, "color"
> },
> +{ "c","set noise color",  OFFSET(color),
> AV_OPT_TYPE_INT64, {.i64 =  0}, 0,  NM_NB - 1,  FLAGS, "color"
> },
>  { "white",0,  0,
> AV_OPT_TYPE_CONST, {.i64 = NM_WHITE},   0,  0,  FLAGS, "color"
> },
>  { "pink", 0,  0,
> AV_OPT_TYPE_CONST, {.i64 = NM_PINK},0,  0,  FLAGS, "color"
> },
>  { "brown",0,  0,
> AV_OPT_TYPE_CONST, {.i64 = NM_BROWN},   0,  0,  FLAGS, "color"
> },
> --
> 2.21.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] add phqm filter and img_hash

2019-10-26 Thread Carl Eugen Hoyos
Am Sa., 26. Okt. 2019 um 06:45 Uhr schrieb :

> +// convert from avframe to iplimage format
> +static int fill_iplimage_from_frame(IplImage *img, const AVFrame *frame, 
> enum AVPixelFormat pixfmt)
> +{
> +IplImage *tmpimg;
> +int depth = IPL_DEPTH_8U, channels_nb;
> +
> +switch (pixfmt) {
> +case AV_PIX_FMT_GRAY8:  channels_nb = 1; break;
> +case AV_PIX_FMT_BGRA:   channels_nb = 4; break;
> +case AV_PIX_FMT_BGR24:  channels_nb = 3; break;
> +case AV_PIX_FMT_YUV420P:channels_nb = 3; break;
> +default: return -1;
> +}
> +
> +tmpimg = cvCreateImageHeader((CvSize){frame->width, frame->height}, 
> depth, channels_nb);

Let me rephrase:
Assuming the layouts of BGR24 and YUV420P are not identical (they are not), how
is cvCreateImageHeader() or the following functions supposed to know
that they are
not the same?

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] libavcodec/h261dec: Fix keyframe markup and frame skipping.

2019-10-26 Thread Andrey Semashev
The decoder never marks pictures as I-frames, which results in no
keyframe indication and incorrect frame skipping, in cases when
keyframes should be decoded.

This commit works around this decoder limitation and marks I-frames
and keyframes based on "freeze picture release" bit in h261 picture
header. This reflects h261enc behavior.
---
 libavcodec/h261.h|  1 +
 libavcodec/h261dec.c | 27 ++-
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/libavcodec/h261.h b/libavcodec/h261.h
index 399a404b2b..6662d38d6d 100644
--- a/libavcodec/h261.h
+++ b/libavcodec/h261.h
@@ -37,6 +37,7 @@
 typedef struct H261Context {
 MpegEncContext s;
 
+int freeze_picture_release; // 1 if freeze picture release bit is set in 
the picture header
 int current_mba;
 int mba_diff;
 int mtype;
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 14a874c45d..3b1711a21d 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -502,9 +502,9 @@ static int h261_decode_picture_header(H261Context *h)
 s->avctx->framerate = (AVRational) { 3, 1001 };
 
 /* PTYPE starts here */
-skip_bits1(&s->gb); /* split screen off */
-skip_bits1(&s->gb); /* camera  off */
-skip_bits1(&s->gb); /* freeze picture release off */
+skip_bits1(&s->gb); /* split screen indicator */
+skip_bits1(&s->gb); /* document camera indicator */
+h->freeze_picture_release = get_bits1(&s->gb); /* freeze picture release */
 
 format = get_bits1(&s->gb);
 
@@ -532,7 +532,8 @@ static int h261_decode_picture_header(H261Context *h)
 
 /* H.261 has no I-frames, but if we pass AV_PICTURE_TYPE_I for the first
  * frame, the codec crashes if it does not contain all I-blocks
- * (e.g. when a packet is lost). */
+ * (e.g. when a packet is lost). We will fix the picture type in the
+ * output frame based on h->freeze_picture_release later. */
 s->pict_type = AV_PICTURE_TYPE_P;
 
 h->gob_number = 0;
@@ -590,6 +591,7 @@ static int h261_decode_frame(AVCodecContext *avctx, void 
*data,
 H261Context *h = avctx->priv_data;
 MpegEncContext *s  = &h->s;
 int ret;
+enum AVPictureType pict_type;
 AVFrame *pict = data;
 
 ff_dlog(avctx, "*frame %d size=%d\n", avctx->frame_number, buf_size);
@@ -630,15 +632,17 @@ retry:
 goto retry;
 }
 
-// for skipping the frame
-s->current_picture.f->pict_type = s->pict_type;
-s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;
+// for skipping the frame and keyframe markup
+pict_type = h->freeze_picture_release ? AV_PICTURE_TYPE_I : s->pict_type;
 
-if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == 
AV_PICTURE_TYPE_B) ||
-(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != 
AV_PICTURE_TYPE_I) ||
+if ((avctx->skip_frame >= AVDISCARD_NONREF && pict_type == 
AV_PICTURE_TYPE_B) ||
+(avctx->skip_frame >= AVDISCARD_NONKEY && pict_type != 
AV_PICTURE_TYPE_I) ||
  avctx->skip_frame >= AVDISCARD_ALL)
 return get_consumed_bytes(s, buf_size);
 
+s->current_picture.f->pict_type = s->pict_type;
+s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;
+
 if (ff_mpv_frame_start(s, avctx) < 0)
 return -1;
 
@@ -660,6 +664,11 @@ retry:
 
 if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0)
 return ret;
+
+// fix picture type and correctly mark keyframes
+pict->pict_type = pict_type;
+pict->key_frame = pict_type == AV_PICTURE_TYPE_I;
+
 ff_print_debug_info(s, s->current_picture_ptr, pict);
 
 *got_frame = 1;
-- 
2.20.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] add phqm filter and img_hash

2019-10-26 Thread Chris Kennedy
On Sat, Oct 26, 2019 at 4:15 AM Carl Eugen Hoyos  wrote:
>
> Am Sa., 26. Okt. 2019 um 06:45 Uhr schrieb :
>
> > +// convert from avframe to iplimage format
> > +static int fill_iplimage_from_frame(IplImage *img, const AVFrame *frame, 
> > enum AVPixelFormat pixfmt)
> > +{
> > +IplImage *tmpimg;
> > +int depth = IPL_DEPTH_8U, channels_nb;
> > +
> > +switch (pixfmt) {
> > +case AV_PIX_FMT_GRAY8:  channels_nb = 1; break;
> > +case AV_PIX_FMT_BGRA:   channels_nb = 4; break;
> > +case AV_PIX_FMT_BGR24:  channels_nb = 3; break;
> > +case AV_PIX_FMT_YUV420P:channels_nb = 3; break;
> > +default: return -1;
> > +}
> > +
> > +tmpimg = cvCreateImageHeader((CvSize){frame->width, frame->height}, 
> > depth, channels_nb);
>
> Let me rephrase:
> Assuming the layouts of BGR24 and YUV420P are not identical (they are not), 
> how
> is cvCreateImageHeader() or the following functions supposed to know
> that they are
> not the same?

Oops sorry, I meant to remove YUV420P and will submit a new patch.
Thank you for helping me understand this part more clearly. I think I
get it and removing YUV420P should make this clear for the code
too.



>
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".



-- 
---
Christopher Kennedy
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] add phqm filter and img_hash

2019-10-26 Thread ckennedy
From: Christopher Kennedy 

this adds a phqm filter and OpenCV img_hash based resource usable
by the phqm and future filters using image hash functionality
from OpenCV.

C++ to C handling so that full OpenCV functionality and API can
be used instead of the C versions (which are incomplete and
don't always exist).

Example command line:

ffmpeg -i encode.mp4 -i reference.mp4 \
   -filter_complex "[0:v][1:v]phqm=stats_file=out.log" \
   -y -f null /dev/null

Signed-off-by: Christopher Kennedy 
---
 Changelog|   1 +
 configure|   2 +
 libavfilter/Makefile |   2 +
 libavfilter/allfilters.c |   1 +
 libavfilter/img_hash.cpp |  98 
 libavfilter/img_hash.h   |  46 ++
 libavfilter/vf_phqm.c| 334 +++
 7 files changed, 484 insertions(+)
 create mode 100644 libavfilter/img_hash.cpp
 create mode 100644 libavfilter/img_hash.h
 create mode 100644 libavfilter/vf_phqm.c

diff --git a/Changelog b/Changelog
index 316589e336..4a22f77d37 100644
--- a/Changelog
+++ b/Changelog
@@ -17,6 +17,7 @@ version :
 - anlms filter
 - arnndn filter
 - bilateral filter
+- phqm perceptual hash filter using OpenCV img_lib
 
 
 version 4.2:
diff --git a/configure b/configure
index 8413826f9e..e231d359bb 100755
--- a/configure
+++ b/configure
@@ -3497,6 +3497,8 @@ nlmeans_opencl_filter_deps="opencl"
 nnedi_filter_deps="gpl"
 ocr_filter_deps="libtesseract"
 ocv_filter_deps="libopencv"
+phqm_filter_deps="libopencv"
+phqm_filter_extralibs="-lstdc++ -lopencv_img_hash"
 openclsrc_filter_deps="opencl"
 overlay_opencl_filter_deps="opencl"
 overlay_qsv_filter_deps="libmfx"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 63d2fba861..645e232b3e 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -325,6 +325,7 @@ OBJS-$(CONFIG_PERMS_FILTER)  += f_perms.o
 OBJS-$(CONFIG_PERSPECTIVE_FILTER)+= vf_perspective.o
 OBJS-$(CONFIG_PHASE_FILTER)  += vf_phase.o
 OBJS-$(CONFIG_PHOTOSENSITIVITY_FILTER)   += vf_photosensitivity.o
+OBJS-$(CONFIG_PHQM_FILTER)   += vf_phqm.o img_hash.o
 OBJS-$(CONFIG_PIXDESCTEST_FILTER)+= vf_pixdesctest.o
 OBJS-$(CONFIG_PIXSCOPE_FILTER)   += vf_datascope.o
 OBJS-$(CONFIG_PP_FILTER) += vf_pp.o
@@ -498,6 +499,7 @@ OBJS-$(CONFIG_SHARED)+= log2_tab.o
 SKIPHEADERS-$(CONFIG_QSVVPP) += qsvvpp.h
 SKIPHEADERS-$(CONFIG_OPENCL) += opencl.h
 SKIPHEADERS-$(CONFIG_VAAPI)  += vaapi_vpp.h
+SKIPHEADERS-$(CONFIG_LIBOPENCV)  += img_hash.h
 
 TOOLS = graph2dot
 TESTPROGS = drawutils filtfmts formats integral
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index e4186f93db..f0fcaad235 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -309,6 +309,7 @@ extern AVFilter ff_vf_perms;
 extern AVFilter ff_vf_perspective;
 extern AVFilter ff_vf_phase;
 extern AVFilter ff_vf_photosensitivity;
+extern AVFilter ff_vf_phqm;
 extern AVFilter ff_vf_pixdesctest;
 extern AVFilter ff_vf_pixscope;
 extern AVFilter ff_vf_pp;
diff --git a/libavfilter/img_hash.cpp b/libavfilter/img_hash.cpp
new file mode 100644
index 00..4d5843da22
--- /dev/null
+++ b/libavfilter/img_hash.cpp
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2019 Christopher Kennedy
+ *
+ * OpenCV img_hash
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "img_hash.h"
+#include "libavutil/pixdesc.h"
+extern "C" {
+#include "avfilter.h"
+}
+
+// convert from avframe to iplimage format
+static int fill_iplimage_from_frame(IplImage *img, const AVFrame *frame, enum 
AVPixelFormat pixfmt)
+{
+IplImage *tmpimg;
+int depth = IPL_DEPTH_8U, channels_nb;
+
+switch (pixfmt) {
+case AV_PIX_FMT_GRAY8:  channels_nb = 1; break;
+case AV_PIX_FMT_BGRA:   channels_nb = 4; break;
+case AV_PIX_FMT_BGR24:  channels_nb = 3; break;
+default: return -1;
+}
+
+tmpimg = cvCreateImageHeader((CvSize){frame->width, frame->height}, depth, 
channels_nb);
+*img = *tmpimg;
+img->imageData = img->imageDataOrigin = (cha

Re: [FFmpeg-devel] [PATCH] add phqm filter and img_hash

2019-10-26 Thread Paul B Mahol
Why is this not generic filter like already existing opencv filter?

On 10/26/19, ckenn...@ellation.com  wrote:
> From: Christopher Kennedy 
>
> this adds a phqm filter and OpenCV img_hash based resource usable
> by the phqm and future filters using image hash functionality
> from OpenCV.
>
> C++ to C handling so that full OpenCV functionality and API can
> be used instead of the C versions (which are incomplete and
> don't always exist).
>
> Example command line:
>
> ffmpeg -i encode.mp4 -i reference.mp4 \
>-filter_complex "[0:v][1:v]phqm=stats_file=out.log" \
>-y -f null /dev/null
>
> Signed-off-by: Christopher Kennedy 
> ---
>  Changelog|   1 +
>  configure|   2 +
>  libavfilter/Makefile |   2 +
>  libavfilter/allfilters.c |   1 +
>  libavfilter/img_hash.cpp |  98 
>  libavfilter/img_hash.h   |  46 ++
>  libavfilter/vf_phqm.c| 334 +++
>  7 files changed, 484 insertions(+)
>  create mode 100644 libavfilter/img_hash.cpp
>  create mode 100644 libavfilter/img_hash.h
>  create mode 100644 libavfilter/vf_phqm.c
>
> diff --git a/Changelog b/Changelog
> index 316589e336..4a22f77d37 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -17,6 +17,7 @@ version :
>  - anlms filter
>  - arnndn filter
>  - bilateral filter
> +- phqm perceptual hash filter using OpenCV img_lib
>
>
>  version 4.2:
> diff --git a/configure b/configure
> index 8413826f9e..e231d359bb 100755
> --- a/configure
> +++ b/configure
> @@ -3497,6 +3497,8 @@ nlmeans_opencl_filter_deps="opencl"
>  nnedi_filter_deps="gpl"
>  ocr_filter_deps="libtesseract"
>  ocv_filter_deps="libopencv"
> +phqm_filter_deps="libopencv"
> +phqm_filter_extralibs="-lstdc++ -lopencv_img_hash"
>  openclsrc_filter_deps="opencl"
>  overlay_opencl_filter_deps="opencl"
>  overlay_qsv_filter_deps="libmfx"
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 63d2fba861..645e232b3e 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -325,6 +325,7 @@ OBJS-$(CONFIG_PERMS_FILTER)  +=
> f_perms.o
>  OBJS-$(CONFIG_PERSPECTIVE_FILTER)+= vf_perspective.o
>  OBJS-$(CONFIG_PHASE_FILTER)  += vf_phase.o
>  OBJS-$(CONFIG_PHOTOSENSITIVITY_FILTER)   += vf_photosensitivity.o
> +OBJS-$(CONFIG_PHQM_FILTER)   += vf_phqm.o img_hash.o
>  OBJS-$(CONFIG_PIXDESCTEST_FILTER)+= vf_pixdesctest.o
>  OBJS-$(CONFIG_PIXSCOPE_FILTER)   += vf_datascope.o
>  OBJS-$(CONFIG_PP_FILTER) += vf_pp.o
> @@ -498,6 +499,7 @@ OBJS-$(CONFIG_SHARED)+=
> log2_tab.o
>  SKIPHEADERS-$(CONFIG_QSVVPP) += qsvvpp.h
>  SKIPHEADERS-$(CONFIG_OPENCL) += opencl.h
>  SKIPHEADERS-$(CONFIG_VAAPI)  += vaapi_vpp.h
> +SKIPHEADERS-$(CONFIG_LIBOPENCV)  += img_hash.h
>
>  TOOLS = graph2dot
>  TESTPROGS = drawutils filtfmts formats integral
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index e4186f93db..f0fcaad235 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -309,6 +309,7 @@ extern AVFilter ff_vf_perms;
>  extern AVFilter ff_vf_perspective;
>  extern AVFilter ff_vf_phase;
>  extern AVFilter ff_vf_photosensitivity;
> +extern AVFilter ff_vf_phqm;
>  extern AVFilter ff_vf_pixdesctest;
>  extern AVFilter ff_vf_pixscope;
>  extern AVFilter ff_vf_pp;
> diff --git a/libavfilter/img_hash.cpp b/libavfilter/img_hash.cpp
> new file mode 100644
> index 00..4d5843da22
> --- /dev/null
> +++ b/libavfilter/img_hash.cpp
> @@ -0,0 +1,98 @@
> +/*
> + * Copyright (c) 2019 Christopher Kennedy
> + *
> + * OpenCV img_hash
> + *
> + * 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 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#include "img_hash.h"
> +#include "libavutil/pixdesc.h"
> +extern "C" {
> +#include "avfilter.h"
> +}
> +
> +// convert from avframe to iplimage format
> +static int fill_iplimage_from_frame(IplImage *img, const AVFrame *frame,
> enum AVPixelFormat pixfmt)
> +{
> +IplImage *tmpimg;
> +int depth = IPL_DEPTH_8U, channels_nb;
> +
> +switch (pixfmt) {
> +

Re: [FFmpeg-devel] [PATCH] add phqm filter and img_hash

2019-10-26 Thread Carl Eugen Hoyos
Am Sa., 26. Okt. 2019 um 14:00 Uhr schrieb :
>
> From: Christopher Kennedy 
>
> this adds a phqm filter and OpenCV img_hash based resource usable
> by the phqm and future filters using image hash functionality
> from OpenCV.

> C++ to C handling so that full OpenCV functionality and API can
> be used instead of the C versions (which are incomplete and
> don't always exist).

This may not be acceptable, I just wanted to point out an obvious
issue.

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] libavcodec/h261dec: Fix keyframe markup and frame skipping.

2019-10-26 Thread Carl Eugen Hoyos
Am Sa., 26. Okt. 2019 um 13:12 Uhr schrieb Andrey Semashev
:
>
> The decoder never marks pictures as I-frames, which results in no
> keyframe indication and incorrect frame skipping, in cases when
> keyframes should be decoded.
>
> This commit works around this decoder limitation and marks I-frames
> and keyframes based on "freeze picture release" bit in h261 picture
> header. This reflects h261enc behavior.

> diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
> index 14a874c45d..3b1711a21d 100644
> --- a/libavcodec/h261dec.c
> +++ b/libavcodec/h261dec.c
> @@ -502,9 +502,9 @@ static int h261_decode_picture_header(H261Context *h)
>  s->avctx->framerate = (AVRational) { 3, 1001 };
>
>  /* PTYPE starts here */
> -skip_bits1(&s->gb); /* split screen off */
> -skip_bits1(&s->gb); /* camera  off */
> -skip_bits1(&s->gb); /* freeze picture release off */
> +skip_bits1(&s->gb); /* split screen indicator */
> +skip_bits1(&s->gb); /* document camera indicator */
> +h->freeze_picture_release = get_bits1(&s->gb); /* freeze picture release 
> */
>
>  format = get_bits1(&s->gb);
>
> @@ -532,7 +532,8 @@ static int h261_decode_picture_header(H261Context *h)
>
>  /* H.261 has no I-frames, but if we pass AV_PICTURE_TYPE_I for the first
>   * frame, the codec crashes if it does not contain all I-blocks
> - * (e.g. when a packet is lost). */
> + * (e.g. when a packet is lost). We will fix the picture type in the
> + * output frame based on h->freeze_picture_release later. */
>  s->pict_type = AV_PICTURE_TYPE_P;

Why can't you use freeze_picture_release here?

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] add phqm filter and img_hash

2019-10-26 Thread Christopher Kennedy
This is a reference/encode comparison filter with two files input like
the psnr or vmaf filter.
So it is completely different and uses the C++ OpenCV API since this
img_hash library is not in the C API.
It's unique to what the OCV filter does, and has more research
implications from my talk at Demuxed 2019.

Christopher

On Sat, Oct 26, 2019 at 7:38 AM Paul B Mahol  wrote:
>
> Why is this not generic filter like already existing opencv filter?
>
> On 10/26/19, ckenn...@ellation.com  wrote:
> > From: Christopher Kennedy 
> >
> > this adds a phqm filter and OpenCV img_hash based resource usable
> > by the phqm and future filters using image hash functionality
> > from OpenCV.
> >
> > C++ to C handling so that full OpenCV functionality and API can
> > be used instead of the C versions (which are incomplete and
> > don't always exist).
> >
> > Example command line:
> >
> > ffmpeg -i encode.mp4 -i reference.mp4 \
> >-filter_complex "[0:v][1:v]phqm=stats_file=out.log" \
> >-y -f null /dev/null
> >
> > Signed-off-by: Christopher Kennedy 
> > ---
> >  Changelog|   1 +
> >  configure|   2 +
> >  libavfilter/Makefile |   2 +
> >  libavfilter/allfilters.c |   1 +
> >  libavfilter/img_hash.cpp |  98 
> >  libavfilter/img_hash.h   |  46 ++
> >  libavfilter/vf_phqm.c| 334 +++
> >  7 files changed, 484 insertions(+)
> >  create mode 100644 libavfilter/img_hash.cpp
> >  create mode 100644 libavfilter/img_hash.h
> >  create mode 100644 libavfilter/vf_phqm.c
> >
> > diff --git a/Changelog b/Changelog
> > index 316589e336..4a22f77d37 100644
> > --- a/Changelog
> > +++ b/Changelog
> > @@ -17,6 +17,7 @@ version :
> >  - anlms filter
> >  - arnndn filter
> >  - bilateral filter
> > +- phqm perceptual hash filter using OpenCV img_lib
> >
> >
> >  version 4.2:
> > diff --git a/configure b/configure
> > index 8413826f9e..e231d359bb 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3497,6 +3497,8 @@ nlmeans_opencl_filter_deps="opencl"
> >  nnedi_filter_deps="gpl"
> >  ocr_filter_deps="libtesseract"
> >  ocv_filter_deps="libopencv"
> > +phqm_filter_deps="libopencv"
> > +phqm_filter_extralibs="-lstdc++ -lopencv_img_hash"
> >  openclsrc_filter_deps="opencl"
> >  overlay_opencl_filter_deps="opencl"
> >  overlay_qsv_filter_deps="libmfx"
> > diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> > index 63d2fba861..645e232b3e 100644
> > --- a/libavfilter/Makefile
> > +++ b/libavfilter/Makefile
> > @@ -325,6 +325,7 @@ OBJS-$(CONFIG_PERMS_FILTER)  +=
> > f_perms.o
> >  OBJS-$(CONFIG_PERSPECTIVE_FILTER)+= vf_perspective.o
> >  OBJS-$(CONFIG_PHASE_FILTER)  += vf_phase.o
> >  OBJS-$(CONFIG_PHOTOSENSITIVITY_FILTER)   += vf_photosensitivity.o
> > +OBJS-$(CONFIG_PHQM_FILTER)   += vf_phqm.o img_hash.o
> >  OBJS-$(CONFIG_PIXDESCTEST_FILTER)+= vf_pixdesctest.o
> >  OBJS-$(CONFIG_PIXSCOPE_FILTER)   += vf_datascope.o
> >  OBJS-$(CONFIG_PP_FILTER) += vf_pp.o
> > @@ -498,6 +499,7 @@ OBJS-$(CONFIG_SHARED)+=
> > log2_tab.o
> >  SKIPHEADERS-$(CONFIG_QSVVPP) += qsvvpp.h
> >  SKIPHEADERS-$(CONFIG_OPENCL) += opencl.h
> >  SKIPHEADERS-$(CONFIG_VAAPI)  += vaapi_vpp.h
> > +SKIPHEADERS-$(CONFIG_LIBOPENCV)  += img_hash.h
> >
> >  TOOLS = graph2dot
> >  TESTPROGS = drawutils filtfmts formats integral
> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> > index e4186f93db..f0fcaad235 100644
> > --- a/libavfilter/allfilters.c
> > +++ b/libavfilter/allfilters.c
> > @@ -309,6 +309,7 @@ extern AVFilter ff_vf_perms;
> >  extern AVFilter ff_vf_perspective;
> >  extern AVFilter ff_vf_phase;
> >  extern AVFilter ff_vf_photosensitivity;
> > +extern AVFilter ff_vf_phqm;
> >  extern AVFilter ff_vf_pixdesctest;
> >  extern AVFilter ff_vf_pixscope;
> >  extern AVFilter ff_vf_pp;
> > diff --git a/libavfilter/img_hash.cpp b/libavfilter/img_hash.cpp
> > new file mode 100644
> > index 00..4d5843da22
> > --- /dev/null
> > +++ b/libavfilter/img_hash.cpp
> > @@ -0,0 +1,98 @@
> > +/*
> > + * Copyright (c) 2019 Christopher Kennedy
> > + *
> > + * OpenCV img_hash
> > + *
> > + * 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
> > + * Licen

Re: [FFmpeg-devel] [PATCH] libavcodec/h261dec: Fix keyframe markup and frame skipping.

2019-10-26 Thread Andrey Semashev

On 2019-10-26 15:49, Carl Eugen Hoyos wrote:

Am Sa., 26. Okt. 2019 um 13:12 Uhr schrieb Andrey Semashev
:


The decoder never marks pictures as I-frames, which results in no
keyframe indication and incorrect frame skipping, in cases when
keyframes should be decoded.

This commit works around this decoder limitation and marks I-frames
and keyframes based on "freeze picture release" bit in h261 picture
header. This reflects h261enc behavior.



diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 14a874c45d..3b1711a21d 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -502,9 +502,9 @@ static int h261_decode_picture_header(H261Context *h)
  s->avctx->framerate = (AVRational) { 3, 1001 };

  /* PTYPE starts here */
-skip_bits1(&s->gb); /* split screen off */
-skip_bits1(&s->gb); /* camera  off */
-skip_bits1(&s->gb); /* freeze picture release off */
+skip_bits1(&s->gb); /* split screen indicator */
+skip_bits1(&s->gb); /* document camera indicator */
+h->freeze_picture_release = get_bits1(&s->gb); /* freeze picture release */

  format = get_bits1(&s->gb);

@@ -532,7 +532,8 @@ static int h261_decode_picture_header(H261Context *h)

  /* H.261 has no I-frames, but if we pass AV_PICTURE_TYPE_I for the first
   * frame, the codec crashes if it does not contain all I-blocks
- * (e.g. when a packet is lost). */
+ * (e.g. when a packet is lost). We will fix the picture type in the
+ * output frame based on h->freeze_picture_release later. */
  s->pict_type = AV_PICTURE_TYPE_P;


Why can't you use freeze_picture_release here?


The comment says the decoder may crash on some input. I don't know if 
this is true and I don't have any test files not produced by ffmpeg 
itself to test.

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] add phqm filter and img_hash

2019-10-26 Thread Christopher Kennedy
On Sat, Oct 26, 2019 at 7:39 AM Carl Eugen Hoyos  wrote:
>
> Am Sa., 26. Okt. 2019 um 14:00 Uhr schrieb :
> >
> > From: Christopher Kennedy 
> >
> > this adds a phqm filter and OpenCV img_hash based resource usable
> > by the phqm and future filters using image hash functionality
> > from OpenCV.
>
> > C++ to C handling so that full OpenCV functionality and API can
> > be used instead of the C versions (which are incomplete and
> > don't always exist).
>
> This may not be acceptable, I just wanted to point out an obvious
> issue.

I will do whatever is necessary, unless completely impossible to
accept the use of
OpenCV directly and the img_hash C++ lib that isn't available any
other way. It is
better to be in FFmpeg main in mine and others' opinions. So any help
in understanding
how to get it right is greatly appreciated.

Thanks,
Christopher

>
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] add phqm filter and img_hash

2019-10-26 Thread Paul B Mahol
On 10/26/19, Christopher Kennedy  wrote:
> This is a reference/encode comparison filter with two files input like
> the psnr or vmaf filter.
> So it is completely different and uses the C++ OpenCV API since this
> img_hash library is not in the C API.
> It's unique to what the OCV filter does, and has more research
> implications from my talk at Demuxed 2019.

I do not see how that is relevant.

There should be generic opencv filter which could do this above in
generic way, and not by adding yet another filter that uses only some
part of opencv.

>
> Christopher
>
> On Sat, Oct 26, 2019 at 7:38 AM Paul B Mahol  wrote:
>>
>> Why is this not generic filter like already existing opencv filter?
>>
>> On 10/26/19, ckenn...@ellation.com  wrote:
>> > From: Christopher Kennedy 
>> >
>> > this adds a phqm filter and OpenCV img_hash based resource usable
>> > by the phqm and future filters using image hash functionality
>> > from OpenCV.
>> >
>> > C++ to C handling so that full OpenCV functionality and API can
>> > be used instead of the C versions (which are incomplete and
>> > don't always exist).
>> >
>> > Example command line:
>> >
>> > ffmpeg -i encode.mp4 -i reference.mp4 \
>> >-filter_complex "[0:v][1:v]phqm=stats_file=out.log" \
>> >-y -f null /dev/null
>> >
>> > Signed-off-by: Christopher Kennedy 
>> > ---
>> >  Changelog|   1 +
>> >  configure|   2 +
>> >  libavfilter/Makefile |   2 +
>> >  libavfilter/allfilters.c |   1 +
>> >  libavfilter/img_hash.cpp |  98 
>> >  libavfilter/img_hash.h   |  46 ++
>> >  libavfilter/vf_phqm.c| 334 +++
>> >  7 files changed, 484 insertions(+)
>> >  create mode 100644 libavfilter/img_hash.cpp
>> >  create mode 100644 libavfilter/img_hash.h
>> >  create mode 100644 libavfilter/vf_phqm.c
>> >
>> > diff --git a/Changelog b/Changelog
>> > index 316589e336..4a22f77d37 100644
>> > --- a/Changelog
>> > +++ b/Changelog
>> > @@ -17,6 +17,7 @@ version :
>> >  - anlms filter
>> >  - arnndn filter
>> >  - bilateral filter
>> > +- phqm perceptual hash filter using OpenCV img_lib
>> >
>> >
>> >  version 4.2:
>> > diff --git a/configure b/configure
>> > index 8413826f9e..e231d359bb 100755
>> > --- a/configure
>> > +++ b/configure
>> > @@ -3497,6 +3497,8 @@ nlmeans_opencl_filter_deps="opencl"
>> >  nnedi_filter_deps="gpl"
>> >  ocr_filter_deps="libtesseract"
>> >  ocv_filter_deps="libopencv"
>> > +phqm_filter_deps="libopencv"
>> > +phqm_filter_extralibs="-lstdc++ -lopencv_img_hash"
>> >  openclsrc_filter_deps="opencl"
>> >  overlay_opencl_filter_deps="opencl"
>> >  overlay_qsv_filter_deps="libmfx"
>> > diff --git a/libavfilter/Makefile b/libavfilter/Makefile
>> > index 63d2fba861..645e232b3e 100644
>> > --- a/libavfilter/Makefile
>> > +++ b/libavfilter/Makefile
>> > @@ -325,6 +325,7 @@ OBJS-$(CONFIG_PERMS_FILTER)  +=
>> > f_perms.o
>> >  OBJS-$(CONFIG_PERSPECTIVE_FILTER)+= vf_perspective.o
>> >  OBJS-$(CONFIG_PHASE_FILTER)  += vf_phase.o
>> >  OBJS-$(CONFIG_PHOTOSENSITIVITY_FILTER)   += vf_photosensitivity.o
>> > +OBJS-$(CONFIG_PHQM_FILTER)   += vf_phqm.o img_hash.o
>> >  OBJS-$(CONFIG_PIXDESCTEST_FILTER)+= vf_pixdesctest.o
>> >  OBJS-$(CONFIG_PIXSCOPE_FILTER)   += vf_datascope.o
>> >  OBJS-$(CONFIG_PP_FILTER) += vf_pp.o
>> > @@ -498,6 +499,7 @@ OBJS-$(CONFIG_SHARED)+=
>> > log2_tab.o
>> >  SKIPHEADERS-$(CONFIG_QSVVPP) += qsvvpp.h
>> >  SKIPHEADERS-$(CONFIG_OPENCL) += opencl.h
>> >  SKIPHEADERS-$(CONFIG_VAAPI)  += vaapi_vpp.h
>> > +SKIPHEADERS-$(CONFIG_LIBOPENCV)  += img_hash.h
>> >
>> >  TOOLS = graph2dot
>> >  TESTPROGS = drawutils filtfmts formats integral
>> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
>> > index e4186f93db..f0fcaad235 100644
>> > --- a/libavfilter/allfilters.c
>> > +++ b/libavfilter/allfilters.c
>> > @@ -309,6 +309,7 @@ extern AVFilter ff_vf_perms;
>> >  extern AVFilter ff_vf_perspective;
>> >  extern AVFilter ff_vf_phase;
>> >  extern AVFilter ff_vf_photosensitivity;
>> > +extern AVFilter ff_vf_phqm;
>> >  extern AVFilter ff_vf_pixdesctest;
>> >  extern AVFilter ff_vf_pixscope;
>> >  extern AVFilter ff_vf_pp;
>> > diff --git a/libavfilter/img_hash.cpp b/libavfilter/img_hash.cpp
>> > new file mode 100644
>> > index 00..4d5843da22
>> > --- /dev/null
>> > +++ b/libavfilter/img_hash.cpp
>> > @@ -0,0 +1,98 @@
>> > +/*
>> > + * Copyright (c) 2019 Christopher Kennedy
>> > + *
>> > + * OpenCV img_hash
>> > + *
>> > + * 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-devel] [PATCH v2] avfilter/asrc_anoisesrc: change color variable to int

2019-10-26 Thread lance . lmwang
From: Limin Wang 

Or it'll cause invalid color and s->filter is NULL.
Please reproduce it with below command on big endian system:
$ ./ffmpeg -f lavfi -i "anoisesrc=d=60:c=1:r=48000" -f s16le -c:a pcm_s16le  -f
null  -
Segmentation fault (core dumped)

Signed-off-by: Limin Wang 
---
 libavfilter/asrc_anoisesrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/asrc_anoisesrc.c b/libavfilter/asrc_anoisesrc.c
index 78f0af4..cedadde 100644
--- a/libavfilter/asrc_anoisesrc.c
+++ b/libavfilter/asrc_anoisesrc.c
@@ -30,7 +30,7 @@ typedef struct ANoiseSrcContext {
 int sample_rate;
 double amplitude;
 int64_t duration;
-int64_t color;
+int color;
 int64_t seed;
 int nb_samples;
 
-- 
2.6.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avfilter/avf_showfreqs: free input frame after using it

2019-10-26 Thread James Almer
On 10/26/2019 4:31 AM, Paul B Mahol wrote:
> LGTM
> 
> On 10/26/19, James Almer  wrote:
>> Fixes ticket #8336.
>>
>> Signed-off-by: James Almer 
>> ---
>>  libavfilter/avf_showfreqs.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/libavfilter/avf_showfreqs.c b/libavfilter/avf_showfreqs.c
>> index c44ac564ac..645754ded3 100644
>> --- a/libavfilter/avf_showfreqs.c
>> +++ b/libavfilter/avf_showfreqs.c
>> @@ -475,6 +475,7 @@ static int activate(AVFilterContext *ctx)
>>  av_audio_fifo_write(s->fifo, (void **)in->extended_data,
>> in->nb_samples);
>>  if (s->pts == AV_NOPTS_VALUE)
>>  s->pts = in->pts;
>> +av_frame_free(&in);
>>  }
>>
>>  if (av_audio_fifo_size(s->fifo) >= s->win_size) {
>> --
>> 2.23.0

Applied, thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] add phqm filter and img_hash

2019-10-26 Thread Christopher Kennedy
On Sat, Oct 26, 2019 at 8:22 AM Paul B Mahol  wrote:
>
> On 10/26/19, Christopher Kennedy  wrote:
> > This is a reference/encode comparison filter with two files input like
> > the psnr or vmaf filter.
> > So it is completely different and uses the C++ OpenCV API since this
> > img_hash library is not in the C API.
> > It's unique to what the OCV filter does, and has more research
> > implications from my talk at Demuxed 2019.
>
> I do not see how that is relevant.
>
> There should be generic opencv filter which could do this above in
> generic way, and not by adding yet another filter that uses only some
> part of opencv.

Is it really possible to do framesync() operations like dual input filters
like psnr/vmaf and also handle input/output rendering of the frames too?
This sounds odd to me but I would love to understand how this is possible.

The C OpenCV API is not recommended so this does the OpenCV part
in C++ which allows it to be fully utilized and supported. So that seems
better to me than using the API OpenCV won't really support and doesn't
allow usage of img_hash (it is NOT in the C API of OpenCV, impossible to use).

The OpenCV C++ img_hash library is the fastest implementation and does
work best in OpenCV. So implementing this in C directly isn't a task I believe
is good to do.

So should the current OpenCV stuff be merged into this filter, is that possible?
If so, then your saying the PSNR filter could also alter frames and output them
too from the reference/encode or one or the other? I need to understand this
better, I want to make it right so am listening.

Thanks
Christopher

>
> >
> > Christopher
> >
> > On Sat, Oct 26, 2019 at 7:38 AM Paul B Mahol  wrote:
> >>
> >> Why is this not generic filter like already existing opencv filter?
> >>
> >> On 10/26/19, ckenn...@ellation.com  wrote:
> >> > From: Christopher Kennedy 
> >> >
> >> > this adds a phqm filter and OpenCV img_hash based resource usable
> >> > by the phqm and future filters using image hash functionality
> >> > from OpenCV.
> >> >
> >> > C++ to C handling so that full OpenCV functionality and API can
> >> > be used instead of the C versions (which are incomplete and
> >> > don't always exist).
> >> >
> >> > Example command line:
> >> >
> >> > ffmpeg -i encode.mp4 -i reference.mp4 \
> >> >-filter_complex "[0:v][1:v]phqm=stats_file=out.log" \
> >> >-y -f null /dev/null
> >> >
> >> > Signed-off-by: Christopher Kennedy 
> >> >
> >> > ___
> >> > ffmpeg-devel mailing list
> >> > ffmpeg-devel@ffmpeg.org
> >> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >> >
> >> > To unsubscribe, visit link above, or email
> >> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> >
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2] avfilter/asrc_anoisesrc: change color variable to int

2019-10-26 Thread Paul B Mahol
OK

On 10/26/19, lance.lmw...@gmail.com  wrote:
> From: Limin Wang 
>
> Or it'll cause invalid color and s->filter is NULL.
> Please reproduce it with below command on big endian system:
> $ ./ffmpeg -f lavfi -i "anoisesrc=d=60:c=1:r=48000" -f s16le -c:a pcm_s16le
> -f
> null  -
> Segmentation fault (core dumped)
>
> Signed-off-by: Limin Wang 
> ---
>  libavfilter/asrc_anoisesrc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavfilter/asrc_anoisesrc.c b/libavfilter/asrc_anoisesrc.c
> index 78f0af4..cedadde 100644
> --- a/libavfilter/asrc_anoisesrc.c
> +++ b/libavfilter/asrc_anoisesrc.c
> @@ -30,7 +30,7 @@ typedef struct ANoiseSrcContext {
>  int sample_rate;
>  double amplitude;
>  int64_t duration;
> -int64_t color;
> +int color;
>  int64_t seed;
>  int nb_samples;
>
> --
> 2.6.4
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/2] lavc/qsvenc: enable vp9 encoder

2019-10-26 Thread zhongli_dev
From: Zhong Li 

1. must enable low_power mode since just VDENC can be supported by iHD
driver right now
2. Coding option1 and extra_data are not supported by MSDK
3. IVF header will be inserted in MSDK by default, but it is not needed
for FFmpeg, so disable it.

Signed-off-by: Zhong Li 
---
 Changelog  |  1 +
 configure  |  6 
 libavcodec/Makefile|  1 +
 libavcodec/allcodecs.c |  1 +
 libavcodec/qsvenc.c| 62 +-
 libavcodec/qsvenc.h|  6 
 6 files changed, 76 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index f49c4d351d..4ccd6373a4 100644
--- a/Changelog
+++ b/Changelog
@@ -18,6 +18,7 @@ version :
 - arnndn filter
 - bilateral filter
 - maskedmin and maskedmax filters
+- Intel QSV-accelerated VP9 encoding
 
 
 version 4.2:
diff --git a/configure b/configure
index 8413826f9e..7af7569092 100755
--- a/configure
+++ b/configure
@@ -3088,6 +3088,8 @@ vp9_qsv_decoder_select="qsvdec"
 vp9_rkmpp_decoder_deps="rkmpp"
 vp9_vaapi_encoder_deps="VAEncPictureParameterBufferVP9"
 vp9_vaapi_encoder_select="vaapi_encode"
+vp9_qsv_encoder_deps="libmfx MFX_CODEC_VP9"
+vp9_qsv_encoder_select="qsvenc"
 vp9_v4l2m2m_decoder_deps="v4l2_m2m vp9_v4l2_m2m"
 wmv3_crystalhd_decoder_select="crystalhd"
 
@@ -6239,6 +6241,10 @@ enabled liblensfun&& require_pkg_config 
liblensfun lensfun lensfun.h lf_
 # can find the libraries and headers through other means.
 enabled libmfx&& { check_pkg_config libmfx libmfx "mfx/mfxvideo.h" 
MFXInit ||
{ require libmfx "mfx/mfxvideo.h" MFXInit 
"-llibmfx $advapi32_extralibs" && warn "using libmfx without pkg-config"; } }
+if enabled libmfx; then
+   check_cc MFX_CODEC_VP9 "mfx/mfxvp9.h mfx/mfxstructures.h" "MFX_CODEC_VP9"
+fi
+
 enabled libmodplug&& require_pkg_config libmodplug libmodplug 
libmodplug/modplug.h ModPlug_Load
 enabled libmp3lame&& require "libmp3lame >= 3.98.3" lame/lame.h 
lame_set_VBR_quality -lmp3lame $libm_extralibs
 enabled libmysofa && { check_pkg_config libmysofa libmysofa mysofa.h 
mysofa_neighborhood_init_withstepdefine ||
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 37a84a6bb4..25e16f9de4 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -685,6 +685,7 @@ OBJS-$(CONFIG_VP9_CUVID_DECODER)   += cuviddec.o
 OBJS-$(CONFIG_VP9_MEDIACODEC_DECODER)  += mediacodecdec.o
 OBJS-$(CONFIG_VP9_RKMPP_DECODER)   += rkmppdec.o
 OBJS-$(CONFIG_VP9_VAAPI_ENCODER)   += vaapi_encode_vp9.o
+OBJS-$(CONFIG_VP9_QSV_ENCODER) += qsvenc_vp9.o
 OBJS-$(CONFIG_VPLAYER_DECODER) += textdec.o ass.o
 OBJS-$(CONFIG_VP9_V4L2M2M_DECODER) += v4l2_m2m_dec.o
 OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 41f680101f..23a778e041 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -784,6 +784,7 @@ extern AVCodec ff_vp9_cuvid_decoder;
 extern AVCodec ff_vp9_mediacodec_decoder;
 extern AVCodec ff_vp9_qsv_decoder;
 extern AVCodec ff_vp9_vaapi_encoder;
+extern AVCodec ff_vp9_qsv_encoder;
 
 // The iterate API is not usable with ossfuzz due to the excessive size of 
binaries created
 #if CONFIG_OSSFUZZ
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index ba85d645ca..b8eabd78da 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -637,7 +637,8 @@ static int init_video_param(AVCodecContext *avctx, 
QSVEncContext *q)
 // The HEVC encoder plugin currently fails with some old libmfx version if 
coding options
 // are provided. Can't find the extract libmfx version which fixed it, 
just enable it from
 // V1.28 in order to keep compatibility security.
-if ((avctx->codec_id != AV_CODEC_ID_HEVC) || 
QSV_RUNTIME_VERSION_ATLEAST(q->ver, 1, 28)) {
+if (((avctx->codec_id != AV_CODEC_ID_HEVC) || 
QSV_RUNTIME_VERSION_ATLEAST(q->ver, 1, 28))
+&& (avctx->codec_id != AV_CODEC_ID_VP9)) {
 q->extco.Header.BufferId  = MFX_EXTBUFF_CODING_OPTION;
 q->extco.Header.BufferSz  = sizeof(q->extco);
 
@@ -761,6 +762,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 }
 
+#if QSV_HAVE_EXT_VP9_PARAM
+if (avctx->codec_id == AV_CODEC_ID_VP9) {
+   q->extvp9param.Header.BufferId = MFX_EXTBUFF_VP9_PARAM;
+   q->extvp9param.Header.BufferSz = sizeof(q->extvp9param);
+   q->extvp9param.WriteIVFHeaders = MFX_CODINGOPTION_OFF;
+   q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer 
*)&q->extvp9param;
+}
+#endif
+
 if (!check_enc_param(avctx,q)) {
 av_log(avctx, AV_LOG_ERROR,
"some encoding parameters are not supported by the QSV "
@@ -789,6 +799,53 @@ static int qsv_retrieve_enc_jpeg_params(AVCodecContext 
*avctx, QSVEncContext *q)
 return 0;
 }
 
+static int qsv_retrieve_enc_vp9_params(AVCodecContext *avctx, QSVEncContext *q)
+{
+int ret = 0;
+#if QSV_HAVE_EXT_VP9_PARAM
+mfxExtVP9Param vp9_extend_buf =

[FFmpeg-devel] [PATCH 2/2] tools/probetest: replace the deprecated API

2019-10-26 Thread zhongli_dev
From: Zhong Li 

Signed-off-by: Zhong Li 
---
 tools/probetest.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/probetest.c b/tools/probetest.c
index 2c6c1de246..75ed42d480 100644
--- a/tools/probetest.c
+++ b/tools/probetest.c
@@ -39,8 +39,9 @@ static void probe(AVProbeData *pd, int type, int p, int size)
 {
 int i = 0;
 AVInputFormat *fmt = NULL;
+void *fmt_opaque = NULL;
 
-while ((fmt = av_iformat_next(fmt))) {
+while ((fmt = av_demuxer_iterate(&fmt_opaque))) {
 if (fmt->flags & AVFMT_NOFILE)
 continue;
 if (fmt->read_probe &&
@@ -66,8 +67,9 @@ static void print_times(void)
 {
 int i = 0;
 AVInputFormat *fmt = NULL;
+void *fmt_opaque = NULL;
 
-while ((fmt = av_iformat_next(fmt))) {
+while ((fmt = av_demuxer_iterate(&fmt_opaque))) {
 if (fmt->flags & AVFMT_NOFILE)
 continue;
 if (time_array[i] > 100) {
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] avcodec/tiff: check the black level denominator

2019-10-26 Thread James Almer
Fixes ticket #8327.

Signed-off-by: James Almer 
---
 libavcodec/tiff.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index f537e99b5a..c34e97cd6d 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1413,6 +1413,10 @@ static int tiff_decode_tag(TiffContext *s, AVFrame 
*frame)
 if (type == TIFF_RATIONAL) {
 value  = ff_tget(&s->gb, TIFF_LONG, s->le);
 value2 = ff_tget(&s->gb, TIFF_LONG, s->le);
+if (!value2) {
+av_log(s->avctx, AV_LOG_ERROR, "Invalid black level 
denominator\n");
+return AVERROR_INVALIDDATA;
+}
 
 s->black_level = value / value2;
 } else
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] add phqm filter and img_hash

2019-10-26 Thread Jan Ekström
Hi,

On Sat, Oct 26, 2019 at 4:35 PM Christopher Kennedy
 wrote:
> The C OpenCV API is not recommended so this does the OpenCV part
> in C++ which allows it to be fully utilized and supported. So that seems
> better to me than using the API OpenCV won't really support and doesn't
> allow usage of img_hash (it is NOT in the C API of OpenCV, impossible to use).

Just noting my two cents about the OpenCV C API as I've noticed
regarding people trying to utilize the opencv capabilities already in
FFmpeg on the user IRC channel:

It seems like upstream OpenCV actively has broken it quite a long time
ago, and the earlier code we have utilizing OpenCV doesn't even
compile with current OpenCV versions.
https://github.com/opencv/opencv/issues/8438#issuecomment-288638915

Thus, unless the OpenCV project's view on C APIs changes, I don't see
it being worthwhile adding any new code utilizing the C APIs that only
work with old versions of OpenCV. One way of possibly changing this is
to advocate for C interfaces at OpenCV, but for that the actual
advocates/users of OpenCV usage should raise on the walls regarding
that.

So while we heavily dislike having C++ APIs as dependencies, I think
if we want to have (current) OpenCV usage around, then modules
utilizing C++ should be permitted (pretty sure we already have some of
those in the code base for other libraries that have been deemed
important enough by someone).

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] add phqm filter and img_hash

2019-10-26 Thread Paul B Mahol
On 10/26/19, Christopher Kennedy  wrote:
> On Sat, Oct 26, 2019 at 8:22 AM Paul B Mahol  wrote:
>>
>> On 10/26/19, Christopher Kennedy  wrote:
>> > This is a reference/encode comparison filter with two files input like
>> > the psnr or vmaf filter.
>> > So it is completely different and uses the C++ OpenCV API since this
>> > img_hash library is not in the C API.
>> > It's unique to what the OCV filter does, and has more research
>> > implications from my talk at Demuxed 2019.
>>
>> I do not see how that is relevant.
>>
>> There should be generic opencv filter which could do this above in
>> generic way, and not by adding yet another filter that uses only some
>> part of opencv.
>
> Is it really possible to do framesync() operations like dual input filters
> like psnr/vmaf and also handle input/output rendering of the frames too?
> This sounds odd to me but I would love to understand how this is possible.

framesync is nothing special, its just used a lot, there are video
filters that do not use it and still operate on multiple inputs.

>
> The C OpenCV API is not recommended so this does the OpenCV part
> in C++ which allows it to be fully utilized and supported. So that seems
> better to me than using the API OpenCV won't really support and doesn't
> allow usage of img_hash (it is NOT in the C API of OpenCV, impossible to
> use).
>
> The OpenCV C++ img_hash library is the fastest implementation and does
> work best in OpenCV. So implementing this in C directly isn't a task I
> believe
> is good to do.

I do not care how generic opencv filter is done, it can be C++ just fine.

>
> So should the current OpenCV stuff be merged into this filter, is that
> possible?

Current opencv stuff in libavfilter is pretty dead and not maintained at all.
So I'm not really fond of adding yet another opencv filter that not
gonna be maintained.

> If so, then your saying the PSNR filter could also alter frames and output
> them
> too from the reference/encode or one or the other? I need to understand
> this
> better, I want to make it right so am listening.

I'm not sure what you really want. Native psnr filter does not alter video,
it just takes two inputs and output first one unmodified and reports
via log and metadata psnr values it measured.

Also, I'm of opinion that hashing images is so trivial operation that
could be done native to libavfilter.

>
> Thanks
> Christopher
>
>>
>> >
>> > Christopher
>> >
>> > On Sat, Oct 26, 2019 at 7:38 AM Paul B Mahol  wrote:
>> >>
>> >> Why is this not generic filter like already existing opencv filter?
>> >>
>> >> On 10/26/19, ckenn...@ellation.com  wrote:
>> >> > From: Christopher Kennedy 
>> >> >
>> >> > this adds a phqm filter and OpenCV img_hash based resource usable
>> >> > by the phqm and future filters using image hash functionality
>> >> > from OpenCV.
>> >> >
>> >> > C++ to C handling so that full OpenCV functionality and API can
>> >> > be used instead of the C versions (which are incomplete and
>> >> > don't always exist).
>> >> >
>> >> > Example command line:
>> >> >
>> >> > ffmpeg -i encode.mp4 -i reference.mp4 \
>> >> >-filter_complex "[0:v][1:v]phqm=stats_file=out.log" \
>> >> >-y -f null /dev/null
>> >> >
>> >> > Signed-off-by: Christopher Kennedy 
>> >> >
>> >> > ___
>> >> > ffmpeg-devel mailing list
>> >> > ffmpeg-devel@ffmpeg.org
>> >> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> >> >
>> >> > To unsubscribe, visit link above, or email
>> >> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>> >
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2] Add support for VP9 VDPAU hwaccel decode

2019-10-26 Thread Philip Langdale
On Fri, 25 Oct 2019 11:00:13 +0530
ManojGuptaBonda  wrote:

> Support for VDPAU accelerated VP9 decoding was added with
> libvdpau-1.3. Support for the same in ffmpeg is added with this
> patch. Profiles related to VDPAU VP9 can be found in latest vdpau.h
> present in libvdpau-1.3. DRC clips are not supported yet due to
> http://trac.ffmpeg.org/ticket/8068
> 
> Add VP9 VDPAU to list of hwaccels and supported formats
> Added file vdpau_vp9.c and Modified configure to add VDPAU VP9
> support. Mapped VP9 profiles to VDPAU VP9 profiles. Populated the
> codec specific params that need to be passed to VDPAU.
> ---

> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 2e047a6f51..2764690dee 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -28,7 +28,7 @@
>  #include "libavutil/version.h"
>  
>  #define LIBAVCODEC_VERSION_MAJOR  58
> -#define LIBAVCODEC_VERSION_MINOR  59
> +#define LIBAVCODEC_VERSION_MINOR  60
>  #define LIBAVCODEC_VERSION_MICRO 102
>  
>  #define LIBAVCODEC_VERSION_INT
> AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ diff --git

Pushed with a tiny fix to reset the MICRO version.

Thanks!

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/4] avformat/flvenc: Forward errors from allocating keyframe index

2019-10-26 Thread Michael Niedermayer
On Sat, Oct 26, 2019 at 04:55:35AM +0200, Andreas Rheinhardt wrote:
> On Fri, Oct 25, 2019 at 11:12 PM Michael Niedermayer 
> wrote:
> 
> > On Fri, Oct 25, 2019 at 10:52:19AM +0200, Andreas Rheinhardt wrote:
> > > While the function adding a new element to the keyframe index checked
> > > the allocation, the caller didn't check the return value. This has been
> > > changed. To do so, the return value has been changed to an ordinary ret
> > > instead of pb->error. This doesn't pose a problem, as write_packet() in
> > > mux.c already checks for write errors (since 9ad1e0c1).
> > >
> > > Signed-off-by: Andreas Rheinhardt 
> > > ---
> > >  libavformat/flvenc.c | 16 +---
> > >  1 file changed, 9 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> > > index fb1dede7ae..e327545dcf 100644
> > > --- a/libavformat/flvenc.c
> > > +++ b/libavformat/flvenc.c
> > > @@ -887,7 +887,7 @@ static int flv_write_packet(AVFormatContext *s,
> > AVPacket *pkt)
> > >  unsigned ts;
> > >  int size = pkt->size;
> > >  uint8_t *data = NULL;
> > > -int flags = -1, flags_size, ret;
> > > +int flags = -1, flags_size, ret = 0;
> > >  int64_t cur_offset = avio_tell(pb);
> > >
> > >  if (par->codec_type == AVMEDIA_TYPE_AUDIO && !pkt->size) {
> > > @@ -1055,15 +1055,17 @@ static int flv_write_packet(AVFormatContext *s,
> > AVPacket *pkt)
> > >  case AVMEDIA_TYPE_VIDEO:
> > >  flv->videosize += (avio_tell(pb) - cur_offset);
> > >  flv->lasttimestamp = flv->acurframeindex /
> > flv->framerate;
> > > +flv->acurframeindex++;
> > >  if (pkt->flags & AV_PKT_FLAG_KEY) {
> > > -double ts = flv->acurframeindex / flv->framerate;
> > > +double ts = flv->lasttimestamp;
> > >  int64_t pos = cur_offset;
> > >
> > > -flv->lastkeyframetimestamp = flv->acurframeindex /
> > flv->framerate;
> > > +flv->lastkeyframetimestamp = ts;
> > >  flv->lastkeyframelocation = pos;
> > > -flv_append_keyframe_info(s, flv, ts, pos);
> > > +ret = flv_append_keyframe_info(s, flv, ts, pos);
> > > +if (ret < 0)
> > > +goto fail;
> > >  }
> > > -flv->acurframeindex++;
> > >  break;
> >
> > Some of these changes look like unrelated simplifications
> > that makes it a hair harder to see the actual change
> >
> 
> The earlier code incremented flv->acurframeindex even when the index
> allocation failed.
> I wanted to keep it that way and the easiest way to do so is to move the
> code incrementing
> it before flv_append_keyframe_info(). But this would change the values of
> ts and
> flv->lastkeyframetimestamp, so one has to change how they are derived, too.

i think
you could do these changes before the flv_append_keyframe_info ret change

that would make both clearer i think

thx
[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] libavcodec/h261dec: Fix keyframe markup and frame skipping.

2019-10-26 Thread Michael Niedermayer
On Sat, Oct 26, 2019 at 02:05:27PM +0300, Andrey Semashev wrote:
> The decoder never marks pictures as I-frames, which results in no
> keyframe indication and incorrect frame skipping, in cases when
> keyframes should be decoded.
> 
> This commit works around this decoder limitation and marks I-frames
> and keyframes based on "freeze picture release" bit in h261 picture
> header. This reflects h261enc behavior.
> ---
>  libavcodec/h261.h|  1 +
>  libavcodec/h261dec.c | 27 ++-
>  2 files changed, 19 insertions(+), 9 deletions(-)

If the goal is correctly recognizing I frames then checking if all
blocks are intra should be the most reliable
that wont work for skiping though as it requires decoding

[...]
-- 
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
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] libavcodec/h261dec: Fix keyframe markup and frame skipping.

2019-10-26 Thread Andrey Semashev

On 2019-10-26 21:15, Michael Niedermayer wrote:

On Sat, Oct 26, 2019 at 02:05:27PM +0300, Andrey Semashev wrote:

The decoder never marks pictures as I-frames, which results in no
keyframe indication and incorrect frame skipping, in cases when
keyframes should be decoded.

This commit works around this decoder limitation and marks I-frames
and keyframes based on "freeze picture release" bit in h261 picture
header. This reflects h261enc behavior.
---
  libavcodec/h261.h|  1 +
  libavcodec/h261dec.c | 27 ++-
  2 files changed, 19 insertions(+), 9 deletions(-)


If the goal is correctly recognizing I frames then checking if all
blocks are intra should be the most reliable


In my case, the goal is to know when a keyframe is received, i.e. when 
the receiver can be reasonably sure it can start displaying/processing 
received frames. Including after some frames lost in transmission.


According to H.261 spec, "freeze picture release" bit is what is 
intended to mark keyframes. To quote section 4.3.3:



A signal from an encoder which has responded to a fast update request 
and allows a decoder to exit from its freeze picture mode and display 
decoded pictures in the normal manner.



I'll reiterate that h261enc marks keyframes with this bit.


that wont work for skiping though as it requires decoding


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] add phqm filter and img_hash

2019-10-26 Thread Christopher Kennedy
On Sat, Oct 26, 2019 at 11:15 AM Paul B Mahol  wrote:
>
> On 10/26/19, Christopher Kennedy  wrote:
> > On Sat, Oct 26, 2019 at 8:22 AM Paul B Mahol  wrote:
> >>
> >> On 10/26/19, Christopher Kennedy  wrote:
> >> > This is a reference/encode comparison filter with two files input like
> >> > the psnr or vmaf filter.
> >> > So it is completely different and uses the C++ OpenCV API since this
> >> > img_hash library is not in the C API.
> >> > It's unique to what the OCV filter does, and has more research
> >> > implications from my talk at Demuxed 2019.
> >>
> >> I do not see how that is relevant.
> >>
> >> There should be generic opencv filter which could do this above in
> >> generic way, and not by adding yet another filter that uses only some
> >> part of opencv.
> >
> > Is it really possible to do framesync() operations like dual input filters
> > like psnr/vmaf and also handle input/output rendering of the frames too?
> > This sounds odd to me but I would love to understand how this is possible.
>
> framesync is nothing special, its just used a lot, there are video
> filters that do not use it and still operate on multiple inputs.
>
> >
> > The C OpenCV API is not recommended so this does the OpenCV part
> > in C++ which allows it to be fully utilized and supported. So that seems
> > better to me than using the API OpenCV won't really support and doesn't
> > allow usage of img_hash (it is NOT in the C API of OpenCV, impossible to
> > use).
> >
> > The OpenCV C++ img_hash library is the fastest implementation and does
> > work best in OpenCV. So implementing this in C directly isn't a task I
> > believe
> > is good to do.
>
> I do not care how generic opencv filter is done, it can be C++ just fine.
>
> >
> > So should the current OpenCV stuff be merged into this filter, is that
> > possible?
>
> Current opencv stuff in libavfilter is pretty dead and not maintained at all.
> So I'm not really fond of adding yet another opencv filter that not
> gonna be maintained.
>
> > If so, then your saying the PSNR filter could also alter frames and output
> > them
> > too from the reference/encode or one or the other? I need to understand
> > this
> > better, I want to make it right so am listening.
>
> I'm not sure what you really want. Native psnr filter does not alter video,
> it just takes two inputs and output first one unmodified and reports
> via log and metadata psnr values it measured.
>
> Also, I'm of opinion that hashing images is so trivial operation that
> could be done native to libavfilter.

Well one option is for me to port the other ocv filters few capabilities
into this one that uses the recommended maintained API. Otherwise
this feature isn't available in the other. Yeah I would love to have a
C version of it to plop in. I don't think C++ linking like this can be kept
out of individual parts of FFmpeg that aren't affecting the other parts
forever. I don't like C++ but I do like all the other possible options in
OpenCV this filter will open up for others to add into FFmpeg filters
in the future. I do think there is great value and not enough people
to rewrite OpenCV into C and maintain that.

Thanks,
Christopher

>
> >
> > Thanks
> > Christopher
> >
> >>
> >> >
> >> > Christopher
> >> >
> >> > On Sat, Oct 26, 2019 at 7:38 AM Paul B Mahol  wrote:
> >> >>
> >> >> Why is this not generic filter like already existing opencv filter?
> >> >>
> >> >> On 10/26/19, ckenn...@ellation.com  wrote:
> >> >> > From: Christopher Kennedy 
> >> >> >
> >> >> > this adds a phqm filter and OpenCV img_hash based resource usable
> >> >> > by the phqm and future filters using image hash functionality
> >> >> > from OpenCV.
> >> >> >
> >> >> > C++ to C handling so that full OpenCV functionality and API can
> >> >> > be used instead of the C versions (which are incomplete and
> >> >> > don't always exist).
> >> >> >
> >> >> > Example command line:
> >> >> >
> >> >> > ffmpeg -i encode.mp4 -i reference.mp4 \
> >> >> >-filter_complex "[0:v][1:v]phqm=stats_file=out.log" \
> >> >> >-y -f null /dev/null
> >> >> >
> >> >> > Signed-off-by: Christopher Kennedy 
> >> >> >
> >> >> > ___
> >> >> > ffmpeg-devel mailing list
> >> >> > ffmpeg-devel@ffmpeg.org
> >> >> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >> >> >
> >> >> > To unsubscribe, visit link above, or email
> >> >> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> >> >
> >
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] add phqm filter and img_hash

2019-10-26 Thread Chris Kennedy
On Sat, Oct 26, 2019 at 8:50 AM Jan Ekström  wrote:

> Hi,
>
> On Sat, Oct 26, 2019 at 4:35 PM Christopher Kennedy
>  wrote:
> > The C OpenCV API is not recommended so this does the OpenCV part
> > in C++ which allows it to be fully utilized and supported. So that seems
> > better to me than using the API OpenCV won't really support and doesn't
> > allow usage of img_hash (it is NOT in the C API of OpenCV, impossible to
> use).
>
> Just noting my two cents about the OpenCV C API as I've noticed
> regarding people trying to utilize the opencv capabilities already in
> FFmpeg on the user IRC channel:
>
> It seems like upstream OpenCV actively has broken it quite a long time
> ago, and the earlier code we have utilizing OpenCV doesn't even
> compile with current OpenCV versions.
> https://github.com/opencv/opencv/issues/8438#issuecomment-288638915
>
> Thus, unless the OpenCV project's view on C APIs changes, I don't see
> it being worthwhile adding any new code utilizing the C APIs that only
> work with old versions of OpenCV. One way of possibly changing this is
> to advocate for C interfaces at OpenCV, but for that the actual
> advocates/users of OpenCV usage should raise on the walls regarding
> that.
>
> So while we heavily dislike having C++ APIs as dependencies, I think
> if we want to have (current) OpenCV usage around, then modules
> utilizing C++ should be permitted (pretty sure we already have some of
> those in the code base for other libraries that have been deemed
> important enough by someone).
>


Yes the decklink stuff uses .cpp files too. Which is another good case where
it is either have or don't have support over C++.



>
> Jan
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".



-- 
---
Christopher Kennedy
Ellation Video Infrastructure - Staff Engineer
ckenn...@crunchyroll.com
747-666-7123
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] avfilter: add median filter

2019-10-26 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 doc/filters.texi  |  15 ++
 libavfilter/Makefile  |   1 +
 libavfilter/allfilters.c  |   1 +
 libavfilter/median.h  |  50 +++
 libavfilter/median_template.c | 162 +
 libavfilter/vf_median.c   | 267 ++
 6 files changed, 496 insertions(+)
 create mode 100644 libavfilter/median.h
 create mode 100644 libavfilter/median_template.c
 create mode 100644 libavfilter/vf_median.c

diff --git a/doc/filters.texi b/doc/filters.texi
index 5b8062d806..c4477e6677 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -12805,6 +12805,21 @@ Higher values should result in a smoother motion 
vector field but less
 optimal individual vectors. Default value is 1.
 @end table
 
+@section median
+
+Pick median pixel from certain rectangle defined by radius.
+
+This filter accepts the following options:
+
+@table @option
+@item radius
+Set horizontal and vertical radius size. Default value is @code{1}.
+Allowed range is integer from 1 to 127.
+
+@item planes
+Set which planes to process. Default is @code{15}, which is all available 
planes.
+@end table
+
 @section mergeplanes
 
 Merge color channel components from several video streams.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index bae566d433..2080eed559 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -297,6 +297,7 @@ OBJS-$(CONFIG_MASKEDMERGE_FILTER)+= 
vf_maskedmerge.o framesync.o
 OBJS-$(CONFIG_MASKEDMIN_FILTER)  += vf_maskedminmax.o framesync.o
 OBJS-$(CONFIG_MASKFUN_FILTER)+= vf_maskfun.o
 OBJS-$(CONFIG_MCDEINT_FILTER)+= vf_mcdeint.o
+OBJS-$(CONFIG_MEDIAN_FILTER) += vf_median.o
 OBJS-$(CONFIG_MERGEPLANES_FILTER)+= vf_mergeplanes.o framesync.o
 OBJS-$(CONFIG_MESTIMATE_FILTER)  += vf_mestimate.o 
motion_estimation.o
 OBJS-$(CONFIG_METADATA_FILTER)   += f_metadata.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index d136734338..cb609067b6 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -282,6 +282,7 @@ extern AVFilter ff_vf_maskedmerge;
 extern AVFilter ff_vf_maskedmin;
 extern AVFilter ff_vf_maskfun;
 extern AVFilter ff_vf_mcdeint;
+extern AVFilter ff_vf_median;
 extern AVFilter ff_vf_mergeplanes;
 extern AVFilter ff_vf_mestimate;
 extern AVFilter ff_vf_metadata;
diff --git a/libavfilter/median.h b/libavfilter/median.h
new file mode 100644
index 00..5aef7e76f2
--- /dev/null
+++ b/libavfilter/median.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2019 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Redistribution and use in source and binary forms, with or without 
modification,
+ * are permitted provided that the following conditions are met:
+ */
+
+#ifndef AVFILTER_MEDIAN_H
+#define AVFILTER_MEDIAN_H
+
+#include "avfilter.h"
+
+typedef struct MedianContext {
+const AVClass *class;
+
+int planes;
+int radius;
+
+int planewidth[4];
+int planeheight[4];
+int depth;
+int nb_planes;
+int nb_threads;
+
+uint16_t **coarse, **fine;
+int coarse_size, fine_size;
+int bins;
+int t;
+
+void (*filter_plane)(AVFilterContext *ctx, const uint8_t *ssrc, int 
src_linesize,
+ uint8_t *ddst, int dst_linesize, int width, int 
height,
+ int slice_h_start, int slice_h_end, int jobnr);
+} MedianContext;
+
+#endif
diff --git a/libavfilter/median_template.c b/libavfilter/median_template.c
new file mode 100644
index 00..466e05fd40
--- /dev/null
+++ b/libavfilter/median_template.c
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2019 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public Licen

Re: [FFmpeg-devel] ffmpeg-qsv: Is opaque memory allocation path used in ffmpeg-qsv?

2019-10-26 Thread Max Dmitrichenko
usage as
format= AV_PIX_FMT_QSV;
frame_type  = MFX_MEMTYPE_OPAQUE_FRAME;
enforces usage of opaque memory from any 3rd_party application.

you can offer patch to remove opaque implementation
where it will be not reasonable to apply it unless deprecated and dropped
from MediaSDK definition
https://github.com/Intel-Media-SDK/MediaSDK/blob/518334ea3cd34764ff2c941d32591c8eb1cadee5/api/include/mfxstructures.h#L383


> it might not be actually functional
help in validation and fixes are welcome

regards
Max


On Sat, Oct 26, 2019 at 12:13 AM Rogozhkin, Dmitry V <
dmitry.v.rogozh...@intel.com> wrote:

> On Fri, 2019-10-25 at 02:17 +, Fu, Linjie wrote:
> > > -Original Message-
> > > From: ffmpeg-devel  On Behalf Of
> > > Rogozhkin, Dmitry V
> > > Sent: Friday, October 25, 2019 05:17
> > > To: ffmpeg-devel@ffmpeg.org
> > > Subject: Re: [FFmpeg-devel] ffmpeg-qsv: Is opaque memory allocation
> > > path
> > > used in ffmpeg-qsv?
> > >
> > > On Thu, 2019-10-24 at 17:12 +0200, Max Dmitrichenko wrote:
> > > > Hi,
> > > >
> > > > Just have a look at any usage as: ffmpeg -hwaccel qsv ...
> > >
> > > I looked into these 3 command lines on Linux:
> > >
> > > ffmpeg -hwaccel qsv -c:v h264_qsv -i AUD_MW_E.264  \
> > >-vf hwdownload,format=nv12 -pix_fmt yuv420p \
> > >AUD_MW.yuv
> > >
> > > ffmpeg -hwaccel qsv -c:v h264_qsv -i AUD_MW_E.264 \
> > >-c:v hevc_qsv -b:v 5M AUD_MW_E.hevc
> > >
> > > ffmpeg -init_hw_device qsv=hw \
> > >-filter_hw_device hw -f rawvideo -pix_fmt  \
> > >yuv420p -s:v 176x144 -i AUD_MW.yuv -vf \
> > >hwupload=extra_hw_frames=64,format=qsv \
> > >-c:v h264_qsv -b:v 5M -frames:v 10 \
> > >-y ./AUD_MW_E.h264
> > >
> > > For what I see, none of the them is using QSV opaque memory. For
> > > the
> > > first 2 command lines ffmpeg explicitly prints (w/ -loglevel
> > > debug):
> > >
> > > [h264_qsv @ 0x34f6980] Decoder: output is video memory surface
> > >
> > > Besides, I checked w/ manual printfs from the code - opaque is not
> > > used.
> > >
> > > Hence, this question: is actually qsv opaque memory path used
> > > anywhere
> > > in ffmpeg.exe sample or in other libavcodec/libavfilter based
> > > applications? Is there Linux/Windows difference which I don't
> > > notice in
> > > code review?
> > >
> >
> > I didn't see MFX_MEMTYPE_OPAQUE_FRAME set for frames_hwctx-
> > >frame_type
> > in mainline ffmpeg application.
>
> Right. I also don't see it. I think that none of upstream ffmpeg
> applications actually exercise this path. This raises a concern why we
> have this in sources and complicate them if we don't use them? I guess
> most testing is done via mainline ffmpeg.exe and opaque path test
> coverage is likely missing meaning it might not be actually functional.
>
> If we will look from the end-user perspective, there is also
> opportunity to write their own applications using libavcodec/etc.
> libraries. In this case he will work with these 2 header files exposing
> QSV capabilities:
>
> ./libavcodec/qsv.h
> ./libavutil/hwcontext_qsv.h
>
> On this path he will be able to use the following:
> AVQSVFramesContext::frame_type
> AVQSVContext::opaque_alloc
> to configure QSV.
>
> Questions:
> 1. Is opaque memory usage limited to internal ffmpeg component
> connections? or it is possible to have external non-ffmpeg component
> connected to ffmpeg one via qsv opaque memory?
> 2. Does anyone actually uses the above to configure qsv opaque memory?
> 3. Regardless of the above: is that possible to deprecate and drop QSV
> opaque memory support in ffmpeg-qsv path?
>
> >
> > BTW, in the frame_allocator used for
> > MFXVideoCORE_SetFrameAllocator(),
> >
> https://github.com/FFmpeg/FFmpeg/blob/6f2a3958cfac135c60b509a61a4fd39432d8f9a9/libavcodec/qsv.c#L562
> >
> > only MFX_MEMTYPE_INTERNAL_FRAME and MFX_MEMTYPE_EXTERNAL_FRAME is
> > supported as an allocation request since commit:
> > 4ab61cd983b539749bd621ea271624ddb5196a8e
> >
> > (For VPP,  MFX_MEMTYPE_FROM_VPPIN is supported)
> > - linjie
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] avformat/ftp: add AVOptions for authentication

2019-10-26 Thread Nicolas Frattaroli
This introduces two new AVOption options for the FTP protocol,
one named ftp-user to supply the username to be used for auth,
one named ftp-password to supply the password to be used for auth.

These are useful for when an API user does not wish to deal with
URL manipulation and percent encoding.

Setting them while also having credentials in the URL will use the
credentials from the URL. The rationale for this is that credentials
embedded in the URL are probably more specific to what the user is
trying to do than anything set by some API user.

Signed-off-by: Nicolas Frattaroli 
---
 doc/protocols.texi |  8 
 libavformat/ftp.c  | 21 -
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index b03432e3e5..0e18a49dda 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -228,6 +228,14 @@ Set timeout in microseconds of socket I/O operations used 
by the underlying low
 operation. By default it is set to -1, which means that the timeout is
 not specified.
 
+@item ftp-user
+Set a user to be used for authenticating to the FTP server. This is overridden 
by the
+user in the FTP URL.
+
+@item ftp-password
+Set a password to be used for authenticating to the FTP server. This is 
overridden by
+the password in the FTP URL, or by @option{ftp-anonymous-password} if no user 
is set.
+
 @item ftp-anonymous-password
 Password used when login as anonymous user. Typically an e-mail address
 should be used.
diff --git a/libavformat/ftp.c b/libavformat/ftp.c
index 3adc04ee1f..e3cbe5f8f0 100644
--- a/libavformat/ftp.c
+++ b/libavformat/ftp.c
@@ -69,6 +69,8 @@ typedef struct {
 size_t dir_buffer_size;
 size_t dir_buffer_offset;
 int utf8;
+const char *option_user;/**< User to be used if none 
given in the URL */
+const char *option_password;/**< Password to be used if 
none given in the URL */
 } FTPContext;
 
 #define OFFSET(x) offsetof(FTPContext, x)
@@ -78,6 +80,8 @@ static const AVOption options[] = {
 {"timeout", "set timeout of socket I/O operations", OFFSET(rw_timeout), 
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, D|E },
 {"ftp-write-seekable", "control seekability of connection during 
encoding", OFFSET(write_seekable), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, E },
 {"ftp-anonymous-password", "password for anonymous login. E-mail address 
should be used.", OFFSET(anonymous_password), AV_OPT_TYPE_STRING, { 0 }, 0, 0, 
D|E },
+{"ftp-user", "user for FTP login. Overridden by whatever is in the URL.", 
OFFSET(option_user), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D|E },
+{"ftp-password", "password for FTP login. Overridden by whatever is in the 
URL.", OFFSET(option_password), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D|E },
 {NULL}
 };
 
@@ -652,7 +656,7 @@ static int ftp_abort(URLContext *h)
 
 static int ftp_connect(URLContext *h, const char *url)
 {
-char proto[10], path[MAX_URL_SIZE], credencials[MAX_URL_SIZE], 
hostname[MAX_URL_SIZE];
+char proto[10], path[MAX_URL_SIZE], credentials[MAX_URL_SIZE], 
hostname[MAX_URL_SIZE];
 const char *tok_user = NULL, *tok_pass = NULL;
 char *end = NULL, *newpath = NULL;
 int err;
@@ -665,17 +669,24 @@ static int ftp_connect(URLContext *h, const char *url)
 s->features = NULL;
 
 av_url_split(proto, sizeof(proto),
- credencials, sizeof(credencials),
+ credentials, sizeof(credentials),
  hostname, sizeof(hostname),
  &s->server_control_port,
  path, sizeof(path),
  url);
 
-tok_user = av_strtok(credencials, ":", &end);
+tok_user = av_strtok(credentials, ":", &end);
 tok_pass = av_strtok(end, ":", &end);
 if (!tok_user) {
-tok_user = "anonymous";
-tok_pass = av_x_if_null(s->anonymous_password, "nopassword");
+if (!s->option_user) {
+tok_user = "anonymous";
+tok_pass = av_x_if_null(s->anonymous_password, "nopassword");
+} else {
+tok_user = s->option_user;
+}
+}
+if (!tok_pass) {
+tok_pass = s->option_password;
 }
 s->user = av_strdup(tok_user);
 s->password = av_strdup(tok_pass);
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 4/4] avcodec/libvorbisdec: Fix insufficient input checks leading to out of array reads

2019-10-26 Thread Michael Niedermayer
Fixes: 
16144/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBVORBIS_fuzzer-5638618940440576
Fixes: out of array read

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

diff --git a/libavcodec/libvorbisdec.c b/libavcodec/libvorbisdec.c
index 89cbbb41b6..3c53b8fdaf 100644
--- a/libavcodec/libvorbisdec.c
+++ b/libavcodec/libvorbisdec.c
@@ -64,22 +64,25 @@ static int oggvorbis_decode_init(AVCodecContext 
*avccontext) {
 }
 } else if(*p == 2) {
 unsigned int offset = 1;
+unsigned int sizesum = 1;
 p++;
 for(i=0; i<2; i++) {
 hsizes[i] = 0;
-while((*p == 0xFF) && (offset < avccontext->extradata_size)) {
+while((*p == 0xFF) && (sizesum < avccontext->extradata_size)) {
 hsizes[i] += 0xFF;
 offset++;
+sizesum += 1 + 0xFF;
 p++;
 }
-if(offset >= avccontext->extradata_size - 1) {
+hsizes[i] += *p;
+offset++;
+sizesum += 1 + *p;
+if(sizesum > avccontext->extradata_size) {
 av_log(avccontext, AV_LOG_ERROR,
"vorbis header sizes damaged\n");
 ret = AVERROR_INVALIDDATA;
 goto error;
 }
-hsizes[i] += *p;
-offset++;
 p++;
 }
 hsizes[2] = avccontext->extradata_size - hsizes[0]-hsizes[1]-offset;
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 3/4] avcodec/g723_1dec: fix invalid shift with negative sid_gain

2019-10-26 Thread Michael Niedermayer
Fixes: left shift of negative value -1
Fixes: 
18395/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G723_1_fuzzer-5710313034350592

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

diff --git a/libavcodec/g723_1dec.c b/libavcodec/g723_1dec.c
index a7bf528470..f601d31d00 100644
--- a/libavcodec/g723_1dec.c
+++ b/libavcodec/g723_1dec.c
@@ -677,7 +677,7 @@ static int estimate_sid_gain(G723_1_ChannelContext *p)
 if (p->sid_gain < 0) t = INT32_MIN;
 else t = INT32_MAX;
 } else
-t = p->sid_gain << shift;
+t = p->sid_gain * (1 << shift);
 } else if(shift < -31) {
 t = (p->sid_gain < 0) ? -1 : 0;
 }else
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/4] avcodec/truemotion2: Fix several integer overflows with *Yo, *Uo, *Vo

2019-10-26 Thread Michael Niedermayer
Fixes: signed integer overflow: 538976288 - -2080374792 cannot be represented 
in type 'int'
Fixes: 
16196/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5144044274974720

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

diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
index 800cae0a40..c736320cb6 100644
--- a/libavcodec/truemotion2.c
+++ b/libavcodec/truemotion2.c
@@ -443,7 +443,7 @@ static inline int GET_TOK(TM2Context *ctx,int type)
 clast = ctx->clast + bx * 4;
 
 #define TM2_INIT_POINTERS_2() \
-int *Yo, *Uo, *Vo;\
+unsigned *Yo, *Uo, *Vo;\
 int oYstride, oUstride, oVstride;\
 \
 TM2_INIT_POINTERS();\
@@ -616,7 +616,7 @@ static inline void tm2_null_res_block(TM2Context *ctx, 
AVFrame *pic, int bx, int
 for (i = 0; i < 16; i++)
 deltas[i] = 0;
 
-ct = ctx->D[0] + ctx->D[1] + ctx->D[2] + ctx->D[3];
+ct = (unsigned)ctx->D[0] + ctx->D[1] + ctx->D[2] + ctx->D[3];
 
 if (bx > 0)
 left = last[-1] - (unsigned)ct;
@@ -687,8 +687,8 @@ static inline void tm2_update_block(TM2Context *ctx, 
AVFrame *pic, int bx, int b
 /* update chroma */
 for (j = 0; j < 2; j++) {
 for (i = 0; i < 2; i++) {
-U[i] = Uo[i] + (unsigned)GET_TOK(ctx, TM2_UPD);
-V[i] = Vo[i] + (unsigned)GET_TOK(ctx, TM2_UPD);
+U[i] = Uo[i] + GET_TOK(ctx, TM2_UPD);
+V[i] = Vo[i] + GET_TOK(ctx, TM2_UPD);
 }
 U  += Ustride;
 V  += Vstride;
@@ -701,10 +701,10 @@ static inline void tm2_update_block(TM2Context *ctx, 
AVFrame *pic, int bx, int b
 TM2_RECALC_BLOCK(V, Vstride, (clast + 2), (ctx->CD + 2));
 
 /* update deltas */
-ctx->D[0] = (unsigned)Yo[3] - last[3];
-ctx->D[1] = (unsigned)Yo[3 + oYstride] - Yo[3];
-ctx->D[2] = (unsigned)Yo[3 + oYstride * 2] - Yo[3 + oYstride];
-ctx->D[3] = (unsigned)Yo[3 + oYstride * 3] - Yo[3 + oYstride * 2];
+ctx->D[0] = Yo[3] - last[3];
+ctx->D[1] = Yo[3 + oYstride] - Yo[3];
+ctx->D[2] = Yo[3 + oYstride * 2] - Yo[3 + oYstride];
+ctx->D[3] = Yo[3 + oYstride * 3] - Yo[3 + oYstride * 2];
 
 for (j = 0; j < 4; j++) {
 d = last[3];
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/4] avcodec/truemotion2: Fix several integer overflows in tm2_low_res_block()

2019-10-26 Thread Michael Niedermayer
Fixes: signed integer overflow: 1077952576 + 1355863565 cannot be represented 
in type 'int'
Fixes: 
16196/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5679842317565952

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

diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
index c736320cb6..fbdb657363 100644
--- a/libavcodec/truemotion2.c
+++ b/libavcodec/truemotion2.c
@@ -581,10 +581,10 @@ static inline void tm2_low_res_block(TM2Context *ctx, 
AVFrame *pic, int bx, int
 deltas[10] = GET_TOK(ctx, TM2_L_LO);
 
 if (bx > 0)
-last[0] = (last[-1] - ctx->D[0] - ctx->D[1] - ctx->D[2] - ctx->D[3] + 
last[1]) >> 1;
+last[0] = (int)((unsigned)last[-1] - ctx->D[0] - ctx->D[1] - ctx->D[2] 
- ctx->D[3] + last[1]) >> 1;
 else
-last[0] = (last[1]  - ctx->D[0] - ctx->D[1] - ctx->D[2] - ctx->D[3])>> 
1;
-last[2] = (last[1] + last[3]) >> 1;
+last[0] = (int)((unsigned)last[1]  - ctx->D[0] - ctx->D[1] - ctx->D[2] 
- ctx->D[3])>> 1;
+last[2] = (int)((unsigned)last[1] + last[3]) >> 1;
 
 t1 = ctx->D[0] + ctx->D[1];
 ctx->D[0] = t1 >> 1;
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: multiple reference frames

2019-10-26 Thread hydra3333
On 14.10.2019 18:56 Timo Rothenpieler wrote:
> On 14.10.2019 17:43, Hendrik Leppkes wrote:
> > Since some users seem to have blindly passed -refs to their
> > commandline which now fails without really telling them why, any
> > thoughts on moving the capability check error messages onto a high log
> > level so that they are shown by default, since they are the source of
> > a failure to encode?
> > 
> > -  Hendrik
> 
> Maybe all errors in nvenc_check_capabilities should be warnings instead 
> of verbose even?

Warning: newbie user-submitted patch attached for your consideration.

Context: https://trac.ffmpeg.org/ticket/8254 
The option -refs works OK on newest models of nvidia graphics cards
however fails with a slightly obscure (to a user) error message on 
common but lesser models of nvidia graphics cards (eg 1050Ti).

The attached patch seeks to slightly modify relevant error messages
and change error messages in nvenc_check_capabilities to be issued
as warnings instead of verbose.

Thank you for considering the patch.

 

<>___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: multiple reference frames

2019-10-26 Thread hydra3333
> On 14.10.2019 18:56 Timo Rothenpieler wrote:
> > On 14.10.2019 17:43, Hendrik Leppkes wrote:
> > > Since some users seem to have blindly passed -refs to their
> > > commandline which now fails without really telling them why, any
> > > thoughts on moving the capability check error messages onto a high log
> > > level so that they are shown by default, since they are the source of
> > > a failure to encode?
> > > 
> > > -  Hendrik
> > 
> > Maybe all errors in nvenc_check_capabilities should be warnings instead 
> > of verbose even?
>
> Warning: newbie user-submitted patch attached for your consideration.
>
> Context: https://trac.ffmpeg.org/ticket/8254 
> The option -refs works OK on newest models of nvidia graphics cards
> however fails with a slightly obscure (to a user) error message on 
> common but lesser models of nvidia graphics cards (eg 1050Ti).
>
> The attached patch seeks to slightly modify relevant error messages
> and change error messages in nvenc_check_capabilities to be issued
> as warnings instead of verbose.
>
> Thank you for considering the patch.
>
>  << File: ffmpeg_ncenc_messages_patch_20191027.patch >> 
> -- next part --
> A non-text attachment was scrubbed...
> Name: winmail.dat
> Type: application/ms-tnef
> Size: 20154 bytes
> Desc: not available
> URL:


I see the attachment (attached by outlook) was scrubbed. 
Sorry, I'd hoped it would work.
So, patch just pasted below to see if that works.

--- a/libavcodec/nvenc.c2019-10-26 16:18:38.688412000 -0700
+++ b/libavcodec/nvenc.c2019-10-26 16:34:12.825972419 -0700
@@ -321,39 +321,39 @@
 
 ret = nvenc_check_codec_support(avctx);
 if (ret < 0) {
-av_log(avctx, AV_LOG_VERBOSE, "Codec not supported\n");
+av_log(avctx, AV_LOG_WARNING, "Codec not supported\n");
 return ret;
 }
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_YUV444_ENCODE);
 if (IS_YUV444(ctx->data_pix_fmt) && ret <= 0) {
-av_log(avctx, AV_LOG_VERBOSE, "YUV444P not supported\n");
+av_log(avctx, AV_LOG_WARNING, "YUV444P not supported\n");
 return AVERROR(ENOSYS);
 }
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_LOSSLESS_ENCODE);
 if (ctx->preset >= PRESET_LOSSLESS_DEFAULT && ret <= 0) {
-av_log(avctx, AV_LOG_VERBOSE, "Lossless encoding not supported\n");
+av_log(avctx, AV_LOG_WARNING, "Lossless encoding not supported\n");
 return AVERROR(ENOSYS);
 }
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_WIDTH_MAX);
 if (ret < avctx->width) {
-av_log(avctx, AV_LOG_VERBOSE, "Width %d exceeds %d\n",
+av_log(avctx, AV_LOG_WARNING, "Width %d exceeds %d\n",
avctx->width, ret);
 return AVERROR(ENOSYS);
 }
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_HEIGHT_MAX);
 if (ret < avctx->height) {
-av_log(avctx, AV_LOG_VERBOSE, "Height %d exceeds %d\n",
+av_log(avctx, AV_LOG_WARNING, "Height %d exceeds %d\n",
avctx->height, ret);
 return AVERROR(ENOSYS);
 }
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_NUM_MAX_BFRAMES);
 if (ret < avctx->max_b_frames) {
-av_log(avctx, AV_LOG_VERBOSE, "Max B-frames %d exceed %d\n",
+av_log(avctx, AV_LOG_WARNING, "Max B-frames %d exceed %d\n",
avctx->max_b_frames, ret);
 
 return AVERROR(ENOSYS);
@@ -361,7 +361,7 @@
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_FIELD_ENCODING);
 if (ret < 1 && avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) {
-av_log(avctx, AV_LOG_VERBOSE,
+av_log(avctx, AV_LOG_WARNING,
"Interlaced encoding is not supported. Supported level:
%d\n",
ret);
 return AVERROR(ENOSYS);
@@ -369,46 +369,46 @@
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_10BIT_ENCODE);
 if (IS_10BIT(ctx->data_pix_fmt) && ret <= 0) {
-av_log(avctx, AV_LOG_VERBOSE, "10 bit encode not supported\n");
+av_log(avctx, AV_LOG_WARNING, "10 bit encode not supported\n");
 return AVERROR(ENOSYS);
 }
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_LOOKAHEAD);
 if (ctx->rc_lookahead > 0 && ret <= 0) {
-av_log(avctx, AV_LOG_VERBOSE, "RC lookahead not supported\n");
+av_log(avctx, AV_LOG_WARNING, "RC lookahead not supported\n");
 return AVERROR(ENOSYS);
 }
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_TEMPORAL_AQ);
 if (ctx->temporal_aq > 0 && ret <= 0) {
-av_log(avctx, AV_LOG_VERBOSE, "Temporal AQ not supported\n");
+av_log(avctx, AV_LOG_WARNING, "Temporal AQ not supported\n");
 return AVERROR(ENOSYS);
 }
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_WEIGHTED_PREDICTION);
 if (ctx->weighted_pred > 0 && ret <= 0) {
-av_log (avctx, AV_LOG_VERBOSE, "Weighted Prediction not
supported\n");
+av

Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: multiple reference frames

2019-10-26 Thread Nicolas Frattaroli
On 27.10.19 02:14, hydra3...@gmail.com wrote:
> I see the attachment (attached by outlook) was scrubbed. 
> Sorry, I'd hoped it would work.
> So, patch just pasted below to see if that works.
> 

Please use git send-email. It's the easiest way to properly send patches to the 
list.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/1] Slightly update nvenc error messages and warnings

2019-10-26 Thread hydra3333
---
 libavcodec/nvenc.c | 40 +---
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index bbb43ddad8..a18eb1df89 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -321,39 +321,39 @@ static int nvenc_check_capabilities(AVCodecContext *avctx)
 
 ret = nvenc_check_codec_support(avctx);
 if (ret < 0) {
-av_log(avctx, AV_LOG_VERBOSE, "Codec not supported\n");
+av_log(avctx, AV_LOG_WARNING, "Codec not supported\n");
 return ret;
 }
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_YUV444_ENCODE);
 if (IS_YUV444(ctx->data_pix_fmt) && ret <= 0) {
-av_log(avctx, AV_LOG_VERBOSE, "YUV444P not supported\n");
+av_log(avctx, AV_LOG_WARNING, "YUV444P not supported\n");
 return AVERROR(ENOSYS);
 }
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_LOSSLESS_ENCODE);
 if (ctx->preset >= PRESET_LOSSLESS_DEFAULT && ret <= 0) {
-av_log(avctx, AV_LOG_VERBOSE, "Lossless encoding not supported\n");
+av_log(avctx, AV_LOG_WARNING, "Lossless encoding not supported\n");
 return AVERROR(ENOSYS);
 }
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_WIDTH_MAX);
 if (ret < avctx->width) {
-av_log(avctx, AV_LOG_VERBOSE, "Width %d exceeds %d\n",
+av_log(avctx, AV_LOG_WARNING, "Width %d exceeds %d\n",
avctx->width, ret);
 return AVERROR(ENOSYS);
 }
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_HEIGHT_MAX);
 if (ret < avctx->height) {
-av_log(avctx, AV_LOG_VERBOSE, "Height %d exceeds %d\n",
+av_log(avctx, AV_LOG_WARNING, "Height %d exceeds %d\n",
avctx->height, ret);
 return AVERROR(ENOSYS);
 }
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_NUM_MAX_BFRAMES);
 if (ret < avctx->max_b_frames) {
-av_log(avctx, AV_LOG_VERBOSE, "Max B-frames %d exceed %d\n",
+av_log(avctx, AV_LOG_WARNING, "Max B-frames %d exceed %d\n",
avctx->max_b_frames, ret);
 
 return AVERROR(ENOSYS);
@@ -361,7 +361,7 @@ static int nvenc_check_capabilities(AVCodecContext *avctx)
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_FIELD_ENCODING);
 if (ret < 1 && avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) {
-av_log(avctx, AV_LOG_VERBOSE,
+av_log(avctx, AV_LOG_WARNING,
"Interlaced encoding is not supported. Supported level: %d\n",
ret);
 return AVERROR(ENOSYS);
@@ -369,46 +369,46 @@ static int nvenc_check_capabilities(AVCodecContext *avctx)
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_10BIT_ENCODE);
 if (IS_10BIT(ctx->data_pix_fmt) && ret <= 0) {
-av_log(avctx, AV_LOG_VERBOSE, "10 bit encode not supported\n");
+av_log(avctx, AV_LOG_WARNING, "10 bit encode not supported\n");
 return AVERROR(ENOSYS);
 }
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_LOOKAHEAD);
 if (ctx->rc_lookahead > 0 && ret <= 0) {
-av_log(avctx, AV_LOG_VERBOSE, "RC lookahead not supported\n");
+av_log(avctx, AV_LOG_WARNING, "RC lookahead not supported\n");
 return AVERROR(ENOSYS);
 }
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_TEMPORAL_AQ);
 if (ctx->temporal_aq > 0 && ret <= 0) {
-av_log(avctx, AV_LOG_VERBOSE, "Temporal AQ not supported\n");
+av_log(avctx, AV_LOG_WARNING, "Temporal AQ not supported\n");
 return AVERROR(ENOSYS);
 }
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_WEIGHTED_PREDICTION);
 if (ctx->weighted_pred > 0 && ret <= 0) {
-av_log (avctx, AV_LOG_VERBOSE, "Weighted Prediction not supported\n");
+av_log (avctx, AV_LOG_WARNING, "Weighted Prediction not supported\n");
 return AVERROR(ENOSYS);
 }
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_CABAC);
 if (ctx->coder == NV_ENC_H264_ENTROPY_CODING_MODE_CABAC && ret <= 0) {
-av_log(avctx, AV_LOG_VERBOSE, "CABAC entropy coding not supported\n");
+av_log(avctx, AV_LOG_WARNING, "CABAC entropy coding not supported\n");
 return AVERROR(ENOSYS);
 }
 
 #ifdef NVENC_HAVE_BFRAME_REF_MODE
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE);
 if (ctx->b_ref_mode == NV_ENC_BFRAME_REF_MODE_EACH && ret != 1) {
-av_log(avctx, AV_LOG_VERBOSE, "Each B frame as reference is not 
supported\n");
+av_log(avctx, AV_LOG_WARNING, "Each B frame as reference is not 
supported\n");
 return AVERROR(ENOSYS);
 } else if (ctx->b_ref_mode != NV_ENC_BFRAME_REF_MODE_DISABLED && ret == 0) 
{
-av_log(avctx, AV_LOG_VERBOSE, "B frames as references are not 
supported\n");
+av_log(avctx, AV_LOG_WARNING, "B frames as references are not 
supported\n");
 return AVERROR(ENOSYS);
 }
 #else
 if (ctx->b_ref_mode != 0) {
-av_log(avctx, AV_LOG_VERBOSE, "B frames as references need SDK 8.1 

[FFmpeg-devel] [PATCH 0/1] Slightly update nvenc error messages and warnings

2019-10-26 Thread hydra3333
On 14.10.2019 18:56 Timo Rothenpieler wrote in 
http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/251611.html :
> On 14.10.2019 17:43, Hendrik Leppkes wrote:
> > Since some users seem to have blindly passed -refs to their
> > commandline which now fails without really telling them why, any
> > thoughts on moving the capability check error messages onto a high log
> > level so that they are shown by default, since they are the source of
> > a failure to encode?
> > 
> > -  Hendrik
> 
> Maybe all errors in nvenc_check_capabilities should be warnings instead 
> of verbose even?

Warning: newbie user-submitted patch attached for your consideration.
Attempting to use git send-email as requested.  

Reference Thread: 
"avcodec/nvenc: multiple reference frames support"
http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/251611.html

Context: https://trac.ffmpeg.org/ticket/8254 
The option -refs works OK on newest models of nvidia graphics cards
however fails with a slightly obscure (to a user) error message on 
common but lesser models of nvidia graphics cards (eg 1050Ti).

The attached patch seeks to slightly modify relevant error messages
and change error messages in nvenc_check_capabilities to be issued
as warnings instead of verbose.

Thank you for considering the patch.

hydra (1):
  Slightly update nvenc error messages and warnings

 libavcodec/nvenc.c | 40 +---
 1 file changed, 21 insertions(+), 19 deletions(-)

-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: multiple reference frames

2019-10-26 Thread hydra3333
On 27.10.19 02:14, hydra at gmail.com wrote:
> > I see the attachment (attached by outlook) was scrubbed. 
> > Sorry, I'd hoped it would work.
> > So, patch just pasted below to see if that works.
> > 

> Please use git send-email. It's the easiest way to properly send patches
to the list

OK, thank you.

Tried git send-email to send the patch in:
http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252181.html
Original thread:
http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/251611.html


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/2] avcodec/v4l2_buffers: Fix infinite loop

2019-10-26 Thread Andriy Gelman
From: Andriy Gelman 

This part of the code counts the number of planes returned by the v4l2
device for each queried capture/output buffer.
When testing the GPU h264 encoder on Nvidia's Jetson Nano, this caused an
infinite loop because avbuf->buf.length included some empty buffers (i.e.
where avbuf->buf.m.planes[i].length = 0), meaning that the counter was
never incremented and break was never reached.
This is fixed in the commit by using a well defined iteration range.
---
 libavcodec/v4l2_buffers.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
index e301dcd6bd..dc1b9eaf24 100644
--- a/libavcodec/v4l2_buffers.c
+++ b/libavcodec/v4l2_buffers.c
@@ -511,11 +511,9 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index)
 
 if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) {
 avbuf->num_planes = 0;
-for (;;) {
-/* in MP, the V4L2 API states that buf.length means num_planes */
-if (avbuf->num_planes >= avbuf->buf.length)
-break;
-if (avbuf->buf.m.planes[avbuf->num_planes].length)
+/* in MP, the V4L2 API states that buf.length means num_planes */
+for (i = 0; i < avbuf->buf.length; i++) {
+if (avbuf->buf.m.planes[i].length)
 avbuf->num_planes++;
 }
 } else
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/2] avcodec/v4l2_m2m: Fix indentation

2019-10-26 Thread Andriy Gelman
From: Andriy Gelman 

---
 libavcodec/v4l2_m2m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c
index 358f587797..1112d71ead 100644
--- a/libavcodec/v4l2_m2m.c
+++ b/libavcodec/v4l2_m2m.c
@@ -377,7 +377,7 @@ int ff_v4l2_m2m_codec_init(V4L2m2mPriv *priv)
 strncpy(s->devname, node, strlen(node) + 1);
 ret = v4l2_probe_driver(s);
 if (!ret)
-break;
+break;
 }
 
 closedir(dirp);
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2] Add support for VP9 VDPAU hwaccel decode

2019-10-26 Thread Manoj Bonda
Thanks Philip.

> -Original Message-
> From: ffmpeg-devel  On Behalf Of Philip
> Langdale
> Sent: Saturday, October 26, 2019 10:35 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v2] Add support for VP9 VDPAU hwaccel
> decode
> 
> On Fri, 25 Oct 2019 11:00:13 +0530
> ManojGuptaBonda  wrote:
> 
> > Support for VDPAU accelerated VP9 decoding was added with
> > libvdpau-1.3. Support for the same in ffmpeg is added with this patch.
> > Profiles related to VDPAU VP9 can be found in latest vdpau.h present
> > in libvdpau-1.3. DRC clips are not supported yet due to
> > http://trac.ffmpeg.org/ticket/8068
> >
> > Add VP9 VDPAU to list of hwaccels and supported formats Added file
> > vdpau_vp9.c and Modified configure to add VDPAU VP9 support. Mapped
> > VP9 profiles to VDPAU VP9 profiles. Populated the codec specific
> > params that need to be passed to VDPAU.
> > ---
> 
> > diff --git a/libavcodec/version.h b/libavcodec/version.h index
> > 2e047a6f51..2764690dee 100644
> > --- a/libavcodec/version.h
> > +++ b/libavcodec/version.h
> > @@ -28,7 +28,7 @@
> >  #include "libavutil/version.h"
> >
> >  #define LIBAVCODEC_VERSION_MAJOR  58
> > -#define LIBAVCODEC_VERSION_MINOR  59
> > +#define LIBAVCODEC_VERSION_MINOR  60
> >  #define LIBAVCODEC_VERSION_MICRO 102
> >
> >  #define LIBAVCODEC_VERSION_INT
> > AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ diff --git
> 
> Pushed with a tiny fix to reset the MICRO version.
> 
> Thanks!
> 
> --phil
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org
> with subject "unsubscribe".

---
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
---
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".