Re: [FFmpeg-devel] [PATCH] avformat/dashdec: Fix strlen(rep_id_val) with it being NULL

2018-08-17 Thread Steven Liu


> On Aug 18, 2018, at 09:14, Michael Niedermayer  wrote:
> 
> Fixes: dash-crash-da39a3ee5e6b4b0d3255bfef95601890afd80709.xml
> 
> Found-by: Paul Ch 
> Signed-off-by: Michael Niedermayer 
> ---
> libavformat/dashdec.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index f851bbf981..c6dddeb98f 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -857,7 +857,9 @@ static int parse_manifest_representation(AVFormatContext 
> *s, const char *url,
> baseurl_nodes[3] = representation_baseurl_node;
> 
> ret = resolve_content_path(s, url, >max_url_size, baseurl_nodes, 
> 4);
> -c->max_url_size = aligned(c->max_url_size  + strlen(rep_id_val) + 
> strlen(rep_bandwidth_val));
> +c->max_url_size = aligned(c->max_url_size
> +  + (rep_id_val ? strlen(rep_id_val) : 0)
> +  + (rep_bandwidth_val ? 
> strlen(rep_bandwidth_val) : 0));
> if (ret == AVERROR(ENOMEM) || ret == 0) {
> goto end;
> }
> -- 
> 2.18.0
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

LGTM

Thanks
Steven





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


[FFmpeg-devel] [PATCH] avformat/dashdec: Fix strlen(rep_id_val) with it being NULL

2018-08-17 Thread Michael Niedermayer
Fixes: dash-crash-da39a3ee5e6b4b0d3255bfef95601890afd80709.xml

Found-by: Paul Ch 
Signed-off-by: Michael Niedermayer 
---
 libavformat/dashdec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index f851bbf981..c6dddeb98f 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -857,7 +857,9 @@ static int parse_manifest_representation(AVFormatContext 
*s, const char *url,
 baseurl_nodes[3] = representation_baseurl_node;
 
 ret = resolve_content_path(s, url, >max_url_size, baseurl_nodes, 4);
-c->max_url_size = aligned(c->max_url_size  + strlen(rep_id_val) + 
strlen(rep_bandwidth_val));
+c->max_url_size = aligned(c->max_url_size
+  + (rep_id_val ? strlen(rep_id_val) : 0)
+  + (rep_bandwidth_val ? 
strlen(rep_bandwidth_val) : 0));
 if (ret == AVERROR(ENOMEM) || ret == 0) {
 goto end;
 }
-- 
2.18.0

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


Re: [FFmpeg-devel] [PATCH] lavc/hevc_ps: fix crop info for monochrome

2018-08-17 Thread Michael Niedermayer
On Fri, Aug 17, 2018 at 09:52:57AM +0800, Zhao Zhili wrote:
> The values of SubWidthC and SubHeightC are 1 in the ITU-T H.265. The
> current code use the value of 2.
> ---
>  libavcodec/hevc_ps.c | 16 
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
> index fbd9fbf..b56b078 100644
> --- a/libavcodec/hevc_ps.c
> +++ b/libavcodec/hevc_ps.c
> @@ -70,6 +70,14 @@ static const AVRational vui_sar[] = {
>  {  2,   1 },
>  };
>  
> +static const unsigned hevc_sub_width_c[] = {

uint8_t saves a few bytes

more important, the commit message should mention a ticket or test sample
also a fate test with a _small_ testsample would be usefull. Obviously
the existing tests do not cover this

thx

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

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact


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


Re: [FFmpeg-devel] HEVC HDR playback issues #7347

2018-08-17 Thread Michael Niedermayer
On Fri, Aug 17, 2018 at 12:46:23PM +, igor.seliva...@loewe.de wrote:
> Dear developers,
> 
> please find attached patch für Dolby Vision media support (ticket #7347).
> https://trac.ffmpeg.org/ticket/7347
> 
> Thanks in advance
> Freundliche Grüße / Best Regards / 祝好
> 
> Igor Selivanov
> Software Development
> 
> Loewe Technologies GmbH
> Hildesheimer Str. 140
> D-30173 Hannover
> Phone: +49 511 563549 49
> Fax: +49 511 563549 65
> mailto: igor.seliva...@loewe.de
> visit: www.loewe.tv
> 
> 
> 
> Visit our website: https://www.loewe.tv/int
> 
> [Facebook]  [Instagram] 
>    [Pinterest] 
>    [YouTube] 
> 
> 
> Loewe Technologies GmbH, Industriestraße 11, 96317 Kronach
> Tel. +49 9261 99-500 • Fax +49 9261 99-515
> c...@loewe.de • www.loewe.tv
> 
> Executive Management: Mark Hüsges, Hans-Henning Doerr, Peter Nortmann, Dr. 
> Ralf Vogt • Registered Office: Kronach • Commercial Register: Amtsgericht 
> Coburg HRB 5443

>  isom.c |4 
>  1 file changed, 4 insertions(+)
> 33266a8d0534fefd2507d8fa70a55b6949ecc40e  
> 0001-Dolby-Vision-profiles-are-added.patch
> From 2210aed012651f1c2fe9df8eac0e8c31dc66de00 Mon Sep 17 00:00:00 2001
> From: Igor 
> Date: Fri, 17 Aug 2018 14:39:41 +0200


> Subject: [PATCH] Dolby Vision profiles are added


missing avformat/isom prefix and reference to ticket in commit message


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The smallest minority on earth is the individual. Those who deny 
individual rights cannot claim to be defenders of minorities. - Ayn Rand


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


Re: [FFmpeg-devel] HEVC HDR playback issues #7347

2018-08-17 Thread Michael Niedermayer
On Fri, Aug 17, 2018 at 12:46:23PM +, igor.seliva...@loewe.de wrote:
> Dear developers,
> 
> please find attached patch für Dolby Vision media support (ticket #7347).
> https://trac.ffmpeg.org/ticket/7347
> 
> Thanks in advance
> Freundliche Grüße / Best Regards / 祝好
> 
> Igor Selivanov
> Software Development
> 
> Loewe Technologies GmbH
> Hildesheimer Str. 140
> D-30173 Hannover
> Phone: +49 511 563549 49
> Fax: +49 511 563549 65
> mailto: igor.seliva...@loewe.de
> visit: www.loewe.tv
> 
> 
> 
> Visit our website: https://www.loewe.tv/int
> 
> [Facebook]  [Instagram] 
>    [Pinterest] 
>    [YouTube] 
> 
> 
> Loewe Technologies GmbH, Industriestraße 11, 96317 Kronach
> Tel. +49 9261 99-500 • Fax +49 9261 99-515
> c...@loewe.de • www.loewe.tv
> 
> Executive Management: Mark Hüsges, Hans-Henning Doerr, Peter Nortmann, Dr. 
> Ralf Vogt • Registered Office: Kronach • Commercial Register: Amtsgericht 
> Coburg HRB 5443

>  isom.c |4 
>  1 file changed, 4 insertions(+)
> 33266a8d0534fefd2507d8fa70a55b6949ecc40e  
> 0001-Dolby-Vision-profiles-are-added.patch
> From 2210aed012651f1c2fe9df8eac0e8c31dc66de00 Mon Sep 17 00:00:00 2001
> From: Igor 
> Date: Fri, 17 Aug 2018 14:39:41 +0200
> Subject: [PATCH] Dolby Vision profiles are added
> 
> ---
>  libavformat/isom.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavformat/isom.c b/libavformat/isom.c
> index ce66d1bcd4..7993ae1f82 100644
> --- a/libavformat/isom.c
> +++ b/libavformat/isom.c
> @@ -163,6 +163,8 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
>  
>  { AV_CODEC_ID_HEVC, MKTAG('h', 'e', 'v', '1') }, /* HEVC/H.265 which 
> indicates parameter sets may be in ES */
>  { AV_CODEC_ID_HEVC, MKTAG('h', 'v', 'c', '1') }, /* HEVC/H.265 which 
> indicates parameter sets shall not be in ES */
> +{ AV_CODEC_ID_HEVC, MKTAG('d', 'v', 'h', 'e') }, /* HEVC/H.265 Dobly 
> Vision HEV1  */

> +//{ AV_CODEC_ID_HEVC, MKTAG('d', 'v', 'h', '1') }, /* HEVC/H.265 Dolby 
> Vision HVC1, tag is used for AV_CODEC_ID_DVVIDEO  */

please see request_probe, it may help for this


[...]


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


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


Re: [FFmpeg-devel] [PATCH 4/7] Adds gray floating-point pixel formats.

2018-08-17 Thread Michael Niedermayer
On Fri, Aug 17, 2018 at 12:46:52AM -0300, James Almer wrote:
> On 8/14/2018 1:23 PM, Michael Niedermayer wrote:
> > On Mon, Aug 13, 2018 at 04:58:42PM +0300, Sergey Lavrushkin wrote:
> >>>
> >>> Just use av_clipf instead of FFMIN/FFMAX.
> >>
> >>
> >> Changed FFMIN/FFMAX to av_clip_uint16 and av_clip_uint8.
> > 
> > will apply
> > 
> > thanks
> 
> This broke fate on some 32bit hosts. Guess float pixfmts shouldn't be
> tested for bitexact output. The gbrpf32 ones aren't, for example.
> http://fate.ffmpeg.org/report.cgi?time=20180816131312=x86_32-debian-kfreebsd-gcc-4.4-cpuflags-mmx

h
i remember i had tested this locally on 32bit 
can something be slightly adjusted (like an offset or factor) to avoid any
values becoming close to 0.5 and rounding differently on platforms ?
If not the tests should skip float pixel formats or try the nearest neighbor 
scaler

Sergey, can you look into this (its your patch) ? (just asking to make sure
not eevryone thinks someone else will work on this)

thx


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

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


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


Re: [FFmpeg-devel] [GSOC][PATCH 1/3] lavc/cfhd:3d transform decoding for both progressive and interlaced

2018-08-17 Thread Michael Niedermayer
On Fri, Aug 17, 2018 at 11:45:04AM +0530, Gagandeep Singh wrote:
[...]
> 
> > [...]
> > > @@ -726,14 +814,15 @@ static int cfhd_decode(AVCodecContext *avctx, void
> > *data, int *got_frame,
> > >  }
> > >  }
> > >  }
> > > -
> > > -if (!s->a_width || !s->a_height || s->a_format == AV_PIX_FMT_NONE ||
> > > -s->coded_width || s->coded_height || s->coded_format !=
> > AV_PIX_FMT_NONE) {
> >
> > > +//disabled to run mountain sample file
> > > +#if 0
> > > +if ((!s->a_width || !s->a_height || s->a_format == AV_PIX_FMT_NONE
> > ||
> > > +s->coded_width || s->coded_height || s->coded_format !=
> > AV_PIX_FMT_NONE) && s->sample_type != 1) {
> > >  av_log(avctx, AV_LOG_ERROR, "Invalid dimensions\n");
> > >  ret = AVERROR(EINVAL);
> > >  goto end;
> > >  }
> > > -
> > > +#endif
> >
> > please elaborate why this needs to be disabled
> > i presume this code was needed for something
> >
> I didn't need to disable this for any sample except one, where the image
> height and width data wasn't transfered in accordance to how it was in the
> rest of the sample so the flow of code was just causing the decoder to
> crash. I can produce a more robust fix, though again will need to repost
> other patches as well, please comment.
> 
> > also this decoder with the patches should be tested with a fuzzer to
> > reduce
> > the chance of bugs
> >
> > I don't know how to use 'fuzzer', sorry, though i can look into that.

had missed this reply as its not quoted correctly
yes, please look into testing this with a fuzzer, we should make reasonable
sure we dont add anomalies

thx

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

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


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


Re: [FFmpeg-devel] [GSOC][PATCH 1/3] lavc/cfhd:3d transform decoding for both progressive and interlaced

2018-08-17 Thread Michael Niedermayer
On Fri, Aug 17, 2018 at 11:45:04AM +0530, Gagandeep Singh wrote:
> On Wed, Aug 15, 2018 at 3:12 AM Michael Niedermayer 
> wrote:
> 
> > On Tue, Aug 14, 2018 at 01:12:37PM +0530, Gagandeep Singh wrote:
> > > IP sample decoding patch attached herein.
> > >
> > > Gagandeep Singh
> >
> > >  cfhd.c |  511
> > -
> > >  cfhd.h |   13 +
> > >  2 files changed, 454 insertions(+), 70 deletions(-)
> > > a155a004ae249d84063d9c49effb87a8f98b0fe7  patchip.patch
> > > From 6cc5636c48bca4e802ccca5f53560e31360760cb Mon Sep 17 00:00:00 2001
> > > From: Gagandeep Singh 
> > > Date: Tue, 14 Aug 2018 00:07:45 +0530
> > > Subject: [GSOC][FFmpeg-devel][PATCH 1/3] lavc/cfhd:3d transform decoding
> > for both progressive and
> > >  interlaced
> > >
> > [...]
> > > @@ -420,9 +486,15 @@ static int cfhd_decode(AVCodecContext *avctx, void
> > *data, int *got_frame,
> > >  s->prescale_shift[1] = (data >> 3) & 0x7;
> > >  s->prescale_shift[2] = (data >> 6) & 0x7;
> > >  av_log(avctx, AV_LOG_DEBUG, "Prescale shift (VC-5): %x\n",
> > data);
> > > +} else if (tag == EncodingMethod) {
> > > +s->encode_method = data;
> > > +av_log(avctx, AV_LOG_DEBUG, "Encode Method for Subband %d :
> > %x\n",s->subband_num_actual, data);
> >
> > >  } else if (tag == 27) {
> > >  av_log(avctx, AV_LOG_DEBUG, "Lowpass width %"PRIu16"\n",
> > data);
> > > -if (data < 3 || data >
> > s->plane[s->channel_num].band[0][0].a_width) {
> > > +if (s->coded_width == 0){
> > > +s->coded_width = data << 3;
> > > +  }
> > > +if (data < 3) {
> > >  av_log(avctx, AV_LOG_ERROR, "Invalid lowpass width\n");
> > >  ret = AVERROR(EINVAL);
> >
> > any checks should be done before the variable is used.
> > also teh indention looks rather odd here
> >
> >
> > [...]
> > > @@ -664,9 +742,14 @@ static int cfhd_decode(AVCodecContext *avctx, void
> > *data, int *got_frame,
> > >  if (count > expected)
> > >  break;
> > >
> > > -coeff = dequant_and_decompand(level,
> > s->quantisation, 0);
> > > +coeff = dequant_and_decompand(level,
> > s->quantisation, 0, (s->sample_type == 2 || s->sample_type == 3) &&
> > s->pframe && s->subband_num_actual == 7 && s->encode_method == 5);
> > >  for (i = 0; i < run; i++)
> > > -*coeff_data++ = coeff;
> > > +if (tag != 82)
> >
> > what is tag 82 ?
> > i think instead of litteral numbers named identifers should be used
> >
> 
> tag 82 is to tell the decoder to use the next coefficients for the same
> subband, i.e, process the coefficients in the latest subband with the new
> coefficients.
> Yes, you are right, i should have used name instead of number, i can send
> the patch again but i would also have to send the other patches again. Or i
> can send a patch to be applied on top of the 3 patches i sent. Please
> comment.

once there are "enough comments" so most patches need changes or theres a
absence of  further comments repost with all comments taken care of


> 
> >
> >
> 
> > [...]
> > > @@ -726,14 +814,15 @@ static int cfhd_decode(AVCodecContext *avctx, void
> > *data, int *got_frame,
> > >  }
> > >  }
> > >  }
> > > -
> > > -if (!s->a_width || !s->a_height || s->a_format == AV_PIX_FMT_NONE ||
> > > -s->coded_width || s->coded_height || s->coded_format !=
> > AV_PIX_FMT_NONE) {
> >
> > > +//disabled to run mountain sample file
> > > +#if 0
> > > +if ((!s->a_width || !s->a_height || s->a_format == AV_PIX_FMT_NONE
> > ||
> > > +s->coded_width || s->coded_height || s->coded_format !=
> > AV_PIX_FMT_NONE) && s->sample_type != 1) {
> > >  av_log(avctx, AV_LOG_ERROR, "Invalid dimensions\n");
> > >  ret = AVERROR(EINVAL);
> > >  goto end;
> > >  }
> > > -
> > > +#endif
> >
> > please elaborate why this needs to be disabled
> > i presume this code was needed for something
> >
> I didn't need to disable this for any sample except one, where the image
> height and width data wasn't transfered in accordance to how it was in the
> rest of the sample so the flow of code was just causing the decoder to
> crash. I can produce a more robust fix, though again will need to repost
> other patches as well, please comment.

yes, "more robust fix" sounds better than a random check commented out

[...]

thx

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list

Re: [FFmpeg-devel] [PATCH] avformat/avidec: fix demuxing of all keyframes of sample 200707170736151.avi

2018-08-17 Thread Michael Niedermayer
On Thu, Aug 16, 2018 at 12:18:48PM +0200, Paul B Mahol wrote:
> Hi,
> 
> better patch attached.

LGTM

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH 3/3] avformat/rmdec: Fix EOF check in the stream loop in ivr_read_header()

2018-08-17 Thread Michael Niedermayer
On Thu, Aug 16, 2018 at 03:48:24PM +0200, Paul B Mahol wrote:
> On 8/16/18, Michael Niedermayer  wrote:
> > Fixes: long running loop
> > Fixes: ivr-timeout-42468cb797f52f025fb329394702f5d4d64322d6
> >
> > Found-by: Paul Ch 
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavformat/rmdec.c | 2 ++
> >  1 file changed, 2 insertions(+)
> 
> LGTM

will apply

thanks

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

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides


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


Re: [FFmpeg-devel] [PATCH 2/3] avformat/mlvdec: read_string() received unsigned size, make the argument unsigned

2018-08-17 Thread Michael Niedermayer
On Thu, Aug 16, 2018 at 03:47:55PM +0200, Paul B Mahol wrote:
> On 8/16/18, Michael Niedermayer  wrote:
> > Fixes: infinite loop
> > Fixes: mlv-timeout-e3b8cab9835edecad6823baa057e029671329d04
> >
> > Found-by: Paul Ch 
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavformat/mlvdec.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> LGTM

will apply

thanks

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

Dictatorship: All citizens are under surveillance, all their steps and
actions recorded, for the politicians to enforce control.
Democracy: All politicians are under surveillance, all their steps and
actions recorded, for the citizens to enforce control.


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


[FFmpeg-devel] [PATCH] avformat/nsvdec: Do not parse multiple NSVf

2018-08-17 Thread Michael Niedermayer
The specification states "NSV files may contain a single file header. "
Fixes: out of array access
Fixes: nsv-asan-002f473f726a0dcbd3bd53e422c4fc40b3cf3421

Found-by: Paul Ch 
Tested-by: Paul Ch 
Signed-off-by: Michael Niedermayer 
---
 libavformat/nsvdec.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index d8ce656817..92f7d178f6 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -176,6 +176,7 @@ typedef struct NSVContext {
 int16_t avsync;
 AVRational framerate;
 uint32_t *nsvs_timestamps;
+int nsvf;
 } NSVContext;
 
 static const AVCodecTag nsv_codec_video_tags[] = {
@@ -266,6 +267,12 @@ static int nsv_parse_NSVf_header(AVFormatContext *s)
 
 nsv->state = NSV_UNSYNC; /* in case we fail */
 
+if (nsv->nsvf) {
+av_log(s, AV_LOG_TRACE, "Multiple NSVf\n");
+return 0;
+}
+nsv->nsvf = 1;
+
 size = avio_rl32(pb);
 if (size < 28)
 return -1;
-- 
2.18.0

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


Re: [FFmpeg-devel] [PATCH 2/2 v2] avformat/av1: update ff_isom_write_av1c() to the latest revision of the spec

2018-08-17 Thread James Almer
On 8/16/2018 6:50 PM, Thomas Daede wrote:
> On 08/16/2018 02:22 PM, James Almer wrote:
>> This will get ISOBMFF and Matroska up to date with the revised AV1 Codec
>> Configuration Box spec.
>> For now keep propagating raw OBUs as extradata until all libavcodec modules
>> are adapted to handle AV1CodecConfigurationRecordv1 formatted extradata.
>>
>> Signed-off-by: James Almer 
>> ---
>> New in v2:
>> - AV1CodecConfigurationBox is now a Box instead of a FullBox.
>> - Trailing bits are now taken into account when checking that the entire
>>   Sequence Header was parsed.
> 
> Tested this patch series with mp4parse-rust and the resulting mp4s work.

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


[FFmpeg-devel] HEVC HDR playback issues #7347

2018-08-17 Thread Igor.Selivanov
Dear developers,

please find attached patch für Dolby Vision media support (ticket #7347).
https://trac.ffmpeg.org/ticket/7347

Thanks in advance
Freundliche Grüße / Best Regards / 祝好

Igor Selivanov
Software Development

Loewe Technologies GmbH
Hildesheimer Str. 140
D-30173 Hannover
Phone: +49 511 563549 49
Fax: +49 511 563549 65
mailto: igor.seliva...@loewe.de
visit: www.loewe.tv



Visit our website: https://www.loewe.tv/int

[Facebook]  [Instagram] 
   [Pinterest] 
   [YouTube] 


Loewe Technologies GmbH, Industriestraße 11, 96317 Kronach
Tel. +49 9261 99-500 • Fax +49 9261 99-515
c...@loewe.de • www.loewe.tv

Executive Management: Mark Hüsges, Hans-Henning Doerr, Peter Nortmann, Dr. Ralf 
Vogt • Registered Office: Kronach • Commercial Register: Amtsgericht Coburg HRB 
5443
From 2210aed012651f1c2fe9df8eac0e8c31dc66de00 Mon Sep 17 00:00:00 2001
From: Igor 
Date: Fri, 17 Aug 2018 14:39:41 +0200
Subject: [PATCH] Dolby Vision profiles are added

---
 libavformat/isom.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/isom.c b/libavformat/isom.c
index ce66d1bcd4..7993ae1f82 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -163,6 +163,8 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
 
 { AV_CODEC_ID_HEVC, MKTAG('h', 'e', 'v', '1') }, /* HEVC/H.265 which indicates parameter sets may be in ES */
 { AV_CODEC_ID_HEVC, MKTAG('h', 'v', 'c', '1') }, /* HEVC/H.265 which indicates parameter sets shall not be in ES */
+{ AV_CODEC_ID_HEVC, MKTAG('d', 'v', 'h', 'e') }, /* HEVC/H.265 Dobly Vision HEV1  */
+//{ AV_CODEC_ID_HEVC, MKTAG('d', 'v', 'h', '1') }, /* HEVC/H.265 Dolby Vision HVC1, tag is used for AV_CODEC_ID_DVVIDEO  */
 
 { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */
 { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '2') },
@@ -185,6 +187,8 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
 { AV_CODEC_ID_H264, MKTAG('r', 'v', '6', '4') }, /* X-Com Radvision */
 { AV_CODEC_ID_H264, MKTAG('x', 'a', 'l', 'g') }, /* XAVC-L HD422 produced by FCP */
 { AV_CODEC_ID_H264, MKTAG('a', 'v', 'l', 'g') }, /* Panasonic P2 AVC-LongG */
+{ AV_CODEC_ID_H264, MKTAG('d', 'v', 'a', 'v') }, /* HEVC/H.264 Dolby Vision AVC3S  */
+{ AV_CODEC_ID_H264, MKTAG('d', 'v', 'a', '1') }, /* HEVC/H.264 Dolby Vision AVC1  */
 
 { AV_CODEC_ID_VP8,  MKTAG('v', 'p', '0', '8') }, /* VP8 */
 { AV_CODEC_ID_VP9,  MKTAG('v', 'p', '0', '9') }, /* VP9 */
-- 
2.17.0

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


Re: [FFmpeg-devel] [PATCH v3] h264: Support multi-field closed captions by using AVBufferRef and not resetting per field

2018-08-17 Thread Joshua de Kock
On 17 August 2018 at 15:12,   wrote:
> From: Kieran Kunhya 
>
> Signed-off-by: Josh de Kock 
> ---
>  libavcodec/h264_sei.c   | 15 ---
>  libavcodec/h264_sei.h   |  3 +--
>  libavcodec/h264_slice.c | 22 ++
>  libavcodec/h264dec.c|  5 +++--
>  4 files changed, 26 insertions(+), 19 deletions(-)
>
> [...]

Pushed. (OK'd by jamrial on IRC as well)

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


Re: [FFmpeg-devel] [PATCH 2/2] libavfilter: Removes stored DNN models. Adds support for native backend model file format in tf backend.

2018-08-17 Thread Sergey Lavrushkin
2018-08-17 17:46 GMT+03:00 Pedro Arthur :

> Hi,
>
> You did not provided any pre trained model files, so anyone trying to
> test it has to perform the whole training!
> I'm attaching the models I generated, if anyone is interested in testing
> it.
>
> When applying the filter with tf backend there are artifacts in the
> borders, for both srcnn and espcn (out_[srcnn|espcn]_tf.jpg).
> It seems that a few lines in the top row of the image are repeated for
> espcn using native backend (out_srcnn_nt.jpg).
>

I guess, it is because I didn't add any padding to the image and tf fills
borders with 0 for 'SAME' padding in convolutions. I'll add required padding
size calculation and insert padding operation to the graph.


> The model/model_filename options are not coherent, the model type
> should be defined in the file anyway therefore there is no need for
> both options.
> It is also buggy, if you specify the model_filename but not the model
> type it will default to srcnn even if the model file is for espcn, no
> error is generated and the output ofc is buggy.
>

I think, I can remove model type and check if model changes input size.
I think all my switches for model type actually depend on this condition.

If I remove conversions inside the filter and make it to work only for
one plane, it basically will become a filter that executes neural network
for one channel input. But there is a problem with float format - it brokes
fate on some 32 bit hosts, as James stated, and I need first to fix this
issue, or, otherwise, revert to doing conversions in the filter.


> I personally would prefer to use only model=file as it is shorter than
> model_filename=file.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/5] Renamed reinterlace to tinterlace

2018-08-17 Thread Thomas Mundt
Hi,

2018-08-16 13:56 GMT+02:00 Vasile Toncu :

> Hi,
>
> Thank you for the additional testing effort.
> Fixed the issue.
>
>
thanks, the patch looks good to me as far as I can judge.
It´s up to more experienced developers now to permit the license change.
Can anybody please have a look at this.

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


Re: [FFmpeg-devel] Resending Patch for hlsenc.c fixes for https://trac.ffmpeg.org/ticket/7281

2018-08-17 Thread Steven Liu


> On Aug 17, 2018, at 21:01, Ronak  wrote:
> 
> From 99e28c807a49cecf6ceb47ee44a85a3fdf78af64 Mon Sep 17 00:00:00 2001
> From: "Ronak Patel" 
> Date: Thu, 2 Aug 2018 09:25:12 -0400
> Subject: [PATCH v3] libavformat/hlsenc: Fix HLS Manifest Generation from an
> N^2 algorithm to N.
> 
> This fixes the creation of the hls manifest in hlsenc.c by writing the entire 
> manifest at the end for VOD playlists. Live & Event Playlists are unaffected.
> This also fixes the behavior with HLS_TEMP_FILE to work correctly when 
> -hlsflags temp_file is specified, instead of always relying on use_rename, 
> which caused these problems.
> 
> Files that would previously take over a week to fragment now take 1 minute on 
> the same hardware. This was a 153 hour audio file (2.2GB of audio).
> 
> Signed-off-by: Ronak Patel 
> ---
> libavformat/hlsenc.c | 51 ---
> 1 file changed, 36 insertions(+), 15 deletions(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index b5644f0..55983a1 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -1168,7 +1168,6 @@ static int hls_rename_temp_file(AVFormatContext *s, 
> AVFormatContext *oc)
> return AVERROR(ENOMEM);
> final_filename[len-4] = '\0';
> ret = ff_rename(oc->url, final_filename, s);
> -oc->url[len-4] = '\0';
> av_freep(_filename);
> return ret;
> }
> @@ -1374,7 +1373,7 @@ static int hls_window(AVFormatContext *s, int last, 
> VariantStream *vs)
> char temp_filename[1024];
> int64_t sequence = FFMAX(hls->start_sequence, vs->sequence - 
> vs->nb_entries);
> const char *proto = avio_find_protocol_name(s->url);
> -int use_rename = proto && !strcmp(proto, "file");
> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
> HLS_TEMP_FILE);
> static unsigned warned_non_file;
> char *key_uri = NULL;
> char *iv_string = NULL;
> @@ -1397,11 +1396,11 @@ static int hls_window(AVFormatContext *s, int last, 
> VariantStream *vs)
> hls->version = 7;
> }
> 
> -if (!use_rename && !warned_non_file++)
> +if (!use_temp_file && !warned_non_file++)
> av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this 
> may lead to races and temporary partial files\n");
> 
> set_http_options(s, , hls);
> -snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : 
> "%s", vs->m3u8_name);
> +snprintf(temp_filename, sizeof(temp_filename), use_temp_file ? "%s.tmp" 
> : "%s", vs->m3u8_name);
> if ((ret = hlsenc_io_open(s, >m3u8_out, temp_filename, )) < 
> 0)
> goto fail;
> 
> @@ -1472,8 +1471,8 @@ fail:
> av_dict_free();
> hlsenc_io_close(s, >m3u8_out, temp_filename);
> hlsenc_io_close(s, >sub_m3u8_out, vs->vtt_m3u8_name);
> -if (ret >= 0 && use_rename)
> -ff_rename(temp_filename, vs->m3u8_name, s);
> +if (use_temp_file)
> +ff_rename(temp_filename, vs->m3u8_name, s);
> 
> if (ret >= 0 && hls->master_pl_name)
> if (create_master_playlist(s, vs) < 0)
> @@ -1488,6 +1487,8 @@ static int hls_start(AVFormatContext *s, VariantStream 
> *vs)
> AVFormatContext *oc = vs->avf;
> AVFormatContext *vtt_oc = vs->vtt_avf;
> AVDictionary *options = NULL;
> +const char *proto = avio_find_protocol_name(s->url);
> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
> HLS_TEMP_FILE);
> char *filename, iv_string[KEYSIZE*2 + 1];
> int err = 0;
> 
> @@ -1583,7 +1584,7 @@ static int hls_start(AVFormatContext *s, VariantStream 
> *vs)
> 
> set_http_options(s, , c);
> 
> -if (c->flags & HLS_TEMP_FILE) {
> +if (use_temp_file) {
> char *new_name = av_asprintf("%s.tmp", oc->url);
> if (!new_name)
> return AVERROR(ENOMEM);
> @@ -2145,6 +2146,8 @@ static int hls_write_packet(AVFormatContext *s, 
> AVPacket *pkt)
> int ret = 0, can_split = 1, i, j;
> int stream_index = 0;
> int range_length = 0;
> +const char *proto = avio_find_protocol_name(s->url);
> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
> HLS_TEMP_FILE);
> uint8_t *buffer = NULL;
> VariantStream *vs = NULL;
> AVDictionary *options = NULL;
> @@ -2214,10 +2217,10 @@ static int hls_write_packet(AVFormatContext *s, 
> AVPacket *pkt)
> 
> }
> 
> +char *old_filename = NULL;
> if (vs->packets_written && can_split && av_compare_ts(pkt->pts - 
> vs->start_pts, st->time_base,
>   end_pts, 
> AV_TIME_BASE_Q) >= 0) {
> int64_t new_start_pos;
> -char *old_filename = NULL;
> int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || 
> (hls->max_seg_size > 0);
> 
> av_write_frame(vs->avf, NULL); /* Flush any buffered data */
> @@ -2253,11 +2256,13 @@ static int hls_write_packet(AVFormatContext *s, 
> AVPacket *pkt)
> hlsenc_io_close(s, >vtt_avf->pb, vs->vtt_avf->url);
> 

[FFmpeg-devel] [PATCH v3] h264: Support multi-field closed captions by using AVBufferRef and not resetting per field

2018-08-17 Thread joshdk
From: Kieran Kunhya 

Signed-off-by: Josh de Kock 
---
 libavcodec/h264_sei.c   | 15 ---
 libavcodec/h264_sei.h   |  3 +--
 libavcodec/h264_slice.c | 22 ++
 libavcodec/h264dec.c|  5 +++--
 4 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 6499086210..43593d34d2 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -51,8 +51,7 @@ void ff_h264_sei_uninit(H264SEIContext *h)
 h->display_orientation.present = 0;
 h->afd.present =  0;
 
-h->a53_caption.a53_caption_size = 0;
-av_freep(>a53_caption.a53_caption);
+av_buffer_unref(>a53_caption.buf_ref);
 }
 
 static int decode_picture_timing(H264SEIPictureTiming *h, GetBitContext *gb,
@@ -169,7 +168,8 @@ static int 
decode_registered_user_data_closed_caption(H264SEIA53Caption *h,
 size -= 2;
 
 if (cc_count && size >= cc_count * 3) {
-const uint64_t new_size = (h->a53_caption_size + cc_count
+int old_size = h->buf_ref ? h->buf_ref->size : 0;
+const uint64_t new_size = (old_size + cc_count
* UINT64_C(3));
 int i, ret;
 
@@ -177,14 +177,15 @@ static int 
decode_registered_user_data_closed_caption(H264SEIA53Caption *h,
 return AVERROR(EINVAL);
 
 /* Allow merging of the cc data from two fields. */
-ret = av_reallocp(>a53_caption, new_size);
+ret = av_buffer_realloc(>buf_ref, new_size);
 if (ret < 0)
 return ret;
 
+/* Use of av_buffer_realloc assumes buffer is writeable */
 for (i = 0; i < cc_count; i++) {
-h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
-h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
-h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
+h->buf_ref->data[old_size++] = get_bits(gb, 8);
+h->buf_ref->data[old_size++] = get_bits(gb, 8);
+h->buf_ref->data[old_size++] = get_bits(gb, 8);
 }
 
 skip_bits(gb, 8);   // marker_bits
diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h
index a169a10e49..5b7c8ef9d8 100644
--- a/libavcodec/h264_sei.h
+++ b/libavcodec/h264_sei.h
@@ -95,8 +95,7 @@ typedef struct H264SEIAFD {
 } H264SEIAFD;
 
 typedef struct H264SEIA53Caption {
-int a53_caption_size;
-uint8_t *a53_caption;
+AVBufferRef *buf_ref;
 } H264SEIA53Caption;
 
 typedef struct H264SEIUnregistered {
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index ede9a1a6ea..58e1aaf02f 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -430,6 +430,13 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
 
 h->frame_recovered   = h1->frame_recovered;
 
+av_buffer_unref(>sei.a53_caption.buf_ref);
+if (h1->sei.a53_caption.buf_ref) {
+h->sei.a53_caption.buf_ref = 
av_buffer_ref(h1->sei.a53_caption.buf_ref);
+if (!h->sei.a53_caption.buf_ref)
+return AVERROR(ENOMEM);
+}
+
 if (!h->cur_pic_ptr)
 return 0;
 
@@ -1269,15 +1276,14 @@ static int h264_export_frame_props(H264Context *h)
 }
 }
 
-if (h->sei.a53_caption.a53_caption) {
+if (h->sei.a53_caption.buf_ref) {
 H264SEIA53Caption *a53 = >sei.a53_caption;
-AVFrameSideData *sd = av_frame_new_side_data(cur->f,
- AV_FRAME_DATA_A53_CC,
- a53->a53_caption_size);
-if (sd)
-memcpy(sd->data, a53->a53_caption, a53->a53_caption_size);
-av_freep(>a53_caption);
-a53->a53_caption_size = 0;
+
+AVFrameSideData *sd = av_frame_new_side_data_from_buf(cur->f, 
AV_FRAME_DATA_A53_CC, a53->buf_ref);
+if (!sd)
+av_buffer_unref(>buf_ref);
+a53->buf_ref = NULL;
+
 h->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
 }
 
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 7494c7a8f2..8d115fa040 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -609,9 +609,10 @@ static int decode_nal_units(H264Context *h, const uint8_t 
*buf, int buf_size)
 
 if (!(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)) {
 h->current_slice = 0;
-if (!h->first_field)
+if (!h->first_field) {
 h->cur_pic_ptr = NULL;
-ff_h264_sei_uninit(>sei);
+ff_h264_sei_uninit(>sei);
+}
 }
 
 if (h->nal_length_size == 4) {
-- 
2.17.1

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


Re: [FFmpeg-devel] [PATCH v2] h264: Support multi-field closed captions by using AVBufferRef and not resetting per field

2018-08-17 Thread James Almer
On 8/17/2018 7:41 AM, jos...@ob-encoder.com wrote:
> From: Kieran Kunhya 
> 
> Signed-off-by: Josh de Kock 
> ---
>  libavcodec/h264_sei.c   | 15 ---
>  libavcodec/h264_sei.h   |  3 +--
>  libavcodec/h264_slice.c | 26 ++
>  libavcodec/h264dec.c|  5 +++--
>  4 files changed, 30 insertions(+), 19 deletions(-)
> 
> diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
> index 6499086210..43593d34d2 100644
> --- a/libavcodec/h264_sei.c
> +++ b/libavcodec/h264_sei.c
> @@ -51,8 +51,7 @@ void ff_h264_sei_uninit(H264SEIContext *h)
>  h->display_orientation.present = 0;
>  h->afd.present =  0;
>  
> -h->a53_caption.a53_caption_size = 0;
> -av_freep(>a53_caption.a53_caption);
> +av_buffer_unref(>a53_caption.buf_ref);
>  }
>  
>  static int decode_picture_timing(H264SEIPictureTiming *h, GetBitContext *gb,
> @@ -169,7 +168,8 @@ static int 
> decode_registered_user_data_closed_caption(H264SEIA53Caption *h,
>  size -= 2;
>  
>  if (cc_count && size >= cc_count * 3) {
> -const uint64_t new_size = (h->a53_caption_size + cc_count
> +int old_size = h->buf_ref ? h->buf_ref->size : 0;
> +const uint64_t new_size = (old_size + cc_count
> * UINT64_C(3));
>  int i, ret;
>  
> @@ -177,14 +177,15 @@ static int 
> decode_registered_user_data_closed_caption(H264SEIA53Caption *h,
>  return AVERROR(EINVAL);
>  
>  /* Allow merging of the cc data from two fields. */
> -ret = av_reallocp(>a53_caption, new_size);
> +ret = av_buffer_realloc(>buf_ref, new_size);
>  if (ret < 0)
>  return ret;
>  
> +/* Use of av_buffer_realloc assumes buffer is writeable */
>  for (i = 0; i < cc_count; i++) {
> -h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
> -h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
> -h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
> +h->buf_ref->data[old_size++] = get_bits(gb, 8);
> +h->buf_ref->data[old_size++] = get_bits(gb, 8);
> +h->buf_ref->data[old_size++] = get_bits(gb, 8);
>  }
>  
>  skip_bits(gb, 8);   // marker_bits
> diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h
> index a169a10e49..5b7c8ef9d8 100644
> --- a/libavcodec/h264_sei.h
> +++ b/libavcodec/h264_sei.h
> @@ -95,8 +95,7 @@ typedef struct H264SEIAFD {
>  } H264SEIAFD;
>  
>  typedef struct H264SEIA53Caption {
> -int a53_caption_size;
> -uint8_t *a53_caption;
> +AVBufferRef *buf_ref;
>  } H264SEIA53Caption;
>  
>  typedef struct H264SEIUnregistered {
> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
> index ede9a1a6ea..f31c9a2579 100644
> --- a/libavcodec/h264_slice.c
> +++ b/libavcodec/h264_slice.c
> @@ -430,6 +430,15 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
>  
>  h->frame_recovered   = h1->frame_recovered;
>  
> +av_buffer_unref(>sei.a53_caption.buf_ref);
> +h->sei.a53_caption.buf_ref = NULL;

Unneeded, av_buffer_unref() already would have set the pointer to NULL.

> +
> +if (h1->sei.a53_caption.buf_ref) {
> +h->sei.a53_caption.buf_ref = 
> av_buffer_ref(h1->sei.a53_caption.buf_ref);
> +if (!h->sei.a53_caption.buf_ref)
> +return AVERROR(ENOMEM);
> +}
> +
>  if (!h->cur_pic_ptr)
>  return 0;
>  
> @@ -1269,15 +1278,16 @@ static int h264_export_frame_props(H264Context *h)
>  }
>  }
>  
> -if (h->sei.a53_caption.a53_caption) {
> +if (h->sei.a53_caption.buf_ref) {
>  H264SEIA53Caption *a53 = >sei.a53_caption;
> -AVFrameSideData *sd = av_frame_new_side_data(cur->f,
> - AV_FRAME_DATA_A53_CC,
> - a53->a53_caption_size);
> -if (sd)
> -memcpy(sd->data, a53->a53_caption, a53->a53_caption_size);
> -av_freep(>a53_caption);
> -a53->a53_caption_size = 0;
> +
> +AVFrameSideData *sd = av_frame_new_side_data_from_buf(cur->f, 
> AV_FRAME_DATA_A53_CC, av_buffer_ref(a53->buf_ref));
> +if (sd) {
> +av_buffer_unref(>buf_ref);

The doxy for av_frame_new_side_data_from_buf() states that on success it
takes ownership of the passed reference, but on failure said reference
remains owned by the caller. So what you're doing here is creating and
passing a reference that, if av_frame_new_side_data_from_buf() fails,
will leak.
What you need to do is directly pass a53->buf_ref to it, and then only
unref it if !sd.

I agree the semantics of av_frame_new_side_data_from_buf() are kinda
ugly and unlike other AVBufferRef functions, but it's too late to change

Re: [FFmpeg-devel] [PATCH] lavfi/vf_libvmaf: update to use libvmaf v1.3.9

2018-08-17 Thread Gyan Doshi



On 17-08-2018 06:12 PM, Carl Eugen Hoyos wrote:

2018-08-14 9:57 GMT+02:00, Gyan Doshi :




filter_threads applies to all simple filtergraphs. The private option
is specifically targeted. Isn't that better?


I believe the opposite is true.


Which - preference for private option or application of filter_threads?



Isn't it a bug that -filter_threads does not apply for -filter_complex?


We have -filter_complex_threads for that, so no.

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


Re: [FFmpeg-devel] Resending Patch for hlsenc.c fixes for https://trac.ffmpeg.org/ticket/7281

2018-08-17 Thread Ronak
> On Aug 16, 2018, at 7:47 PM, Steven Liu  wrote:
> 
> 
> 
>> On Aug 16, 2018, at 22:31, Ronak  wrote:
>> 
>> From: "Ronak Patel" 
>> 
>> This fixes the creation of the hls manifest in hlsenc.c by writing the 
>> entire manifest at the end for VOD playlists. Live & Event Playlists are 
>> unaffected.
>> This also fixes the behavior with HLS_TEMP_FILE to work correctly when 
>> -hlsflags temp_file is specified, instead of always relying on use_rename, 
>> which caused these problems.
>> 
>> Files that would previously take over a week to fragment now take 1 minute 
>> on the same hardware. This was a 153 hour audio file (2.2GB of audio).
>> 
>> Signed-off-by: Ronak Patel 
>> ---
>> libavformat/hlsenc.c | 51 ---
>> 1 file changed, 36 insertions(+), 15 deletions(-)
>> 
>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>> index b5644f0..55983a1 100644
>> --- a/libavformat/hlsenc.c
>> +++ b/libavformat/hlsenc.c
>> @@ -1168,7 +1168,6 @@ static int hls_rename_temp_file(AVFormatContext *s, 
>> AVFormatContext *oc)
>>return AVERROR(ENOMEM);
>>final_filename[len-4] = '\0';
>>ret = ff_rename(oc->url, final_filename, s);
>> -oc->url[len-4] = '\0';
>>av_freep(_filename);
>>return ret;
>> }
>> @@ -1374,7 +1373,7 @@ static int hls_window(AVFormatContext *s, int last, 
>> VariantStream *vs)
>>char temp_filename[1024];
>>int64_t sequence = FFMAX(hls->start_sequence, vs->sequence - 
>> vs->nb_entries);
>>const char *proto = avio_find_protocol_name(s->url);
>> -int use_rename = proto && !strcmp(proto, "file");
>> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
>> HLS_TEMP_FILE);
>>static unsigned warned_non_file;
>>char *key_uri = NULL;
>>char *iv_string = NULL;
>> @@ -1397,11 +1396,11 @@ static int hls_window(AVFormatContext *s, int last, 
>> VariantStream *vs)
>>hls->version = 7;
>>}
>> -if (!use_rename && !warned_non_file++)
>> +if (!use_temp_file && !warned_non_file++)
>>av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this 
>> may lead to races and temporary partial files\n");
>>set_http_options(s, , hls);
>> -snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : 
>> "%s", vs->m3u8_name);
>> +snprintf(temp_filename, sizeof(temp_filename), use_temp_file ? "%s.tmp" 
>> : "%s", vs->m3u8_name);
>>if ((ret = hlsenc_io_open(s, >m3u8_out, temp_filename, )) < 
>> 0)
>>goto fail;
>> @@ -1472,8 +1471,8 @@ fail:
>>av_dict_free();
>>hlsenc_io_close(s, >m3u8_out, temp_filename);
>>hlsenc_io_close(s, >sub_m3u8_out, vs->vtt_m3u8_name);
>> -if (ret >= 0 && use_rename)
>> -ff_rename(temp_filename, vs->m3u8_name, s);
>> +if (use_temp_file)
>> +ff_rename(temp_filename, vs->m3u8_name, s);
>>if (ret >= 0 && hls->master_pl_name)
>>if (create_master_playlist(s, vs) < 0)
>> @@ -1488,6 +1487,8 @@ static int hls_start(AVFormatContext *s, VariantStream 
>> *vs)
>>AVFormatContext *oc = vs->avf;
>>AVFormatContext *vtt_oc = vs->vtt_avf;
>>AVDictionary *options = NULL;
>> +const char *proto = avio_find_protocol_name(s->url);
>> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
>> HLS_TEMP_FILE);
>>char *filename, iv_string[KEYSIZE*2 + 1];
>>int err = 0;
>> @@ -1583,7 +1584,7 @@ static int hls_start(AVFormatContext *s, VariantStream 
>> *vs)
>>set_http_options(s, , c);
>> -if (c->flags & HLS_TEMP_FILE) {
>> +if (use_temp_file) {
>>char *new_name = av_asprintf("%s.tmp", oc->url);
>>if (!new_name)
>>return AVERROR(ENOMEM);
>> @@ -2145,6 +2146,8 @@ static int hls_write_packet(AVFormatContext *s, 
>> AVPacket *pkt)
>>int ret = 0, can_split = 1, i, j;
>>int stream_index = 0;
>>int range_length = 0;
>> +const char *proto = avio_find_protocol_name(s->url);
>> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
>> HLS_TEMP_FILE);
>>uint8_t *buffer = NULL;
>>VariantStream *vs = NULL;
>>AVDictionary *options = NULL;
>> @@ -2214,10 +2217,10 @@ static int hls_write_packet(AVFormatContext *s, 
>> AVPacket *pkt)
>>}
>> +char *old_filename = NULL;
>>if (vs->packets_written && can_split && av_compare_ts(pkt->pts - 
>> vs->start_pts, st->time_base,
>>  end_pts, 
>> AV_TIME_BASE_Q) >= 0) {
>>int64_t new_start_pos;
>> -char *old_filename = NULL;
>>int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || 
>> (hls->max_seg_size > 0);
>>av_write_frame(vs->avf, NULL); /* Flush any buffered data */
>> @@ -2253,11 +2256,13 @@ static int hls_write_packet(AVFormatContext *s, 
>> AVPacket *pkt)
>>hlsenc_io_close(s, >vtt_avf->pb, vs->vtt_avf->url);
>>}
>>}
>> -if ((hls->flags & HLS_TEMP_FILE) && oc->url[0]) {
>> +
>> +// look 

[FFmpeg-devel] Resending Patch for hlsenc.c fixes for https://trac.ffmpeg.org/ticket/7281

2018-08-17 Thread Ronak
From 99e28c807a49cecf6ceb47ee44a85a3fdf78af64 Mon Sep 17 00:00:00 2001
From: "Ronak Patel" 
Date: Thu, 2 Aug 2018 09:25:12 -0400
Subject: [PATCH v3] libavformat/hlsenc: Fix HLS Manifest Generation from an
 N^2 algorithm to N.

This fixes the creation of the hls manifest in hlsenc.c by writing the entire 
manifest at the end for VOD playlists. Live & Event Playlists are unaffected.
This also fixes the behavior with HLS_TEMP_FILE to work correctly when 
-hlsflags temp_file is specified, instead of always relying on use_rename, 
which caused these problems.

Files that would previously take over a week to fragment now take 1 minute on 
the same hardware. This was a 153 hour audio file (2.2GB of audio).

Signed-off-by: Ronak Patel 
---
 libavformat/hlsenc.c | 51 ---
 1 file changed, 36 insertions(+), 15 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index b5644f0..55983a1 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1168,7 +1168,6 @@ static int hls_rename_temp_file(AVFormatContext *s, 
AVFormatContext *oc)
 return AVERROR(ENOMEM);
 final_filename[len-4] = '\0';
 ret = ff_rename(oc->url, final_filename, s);
-oc->url[len-4] = '\0';
 av_freep(_filename);
 return ret;
 }
@@ -1374,7 +1373,7 @@ static int hls_window(AVFormatContext *s, int last, 
VariantStream *vs)
 char temp_filename[1024];
 int64_t sequence = FFMAX(hls->start_sequence, vs->sequence - 
vs->nb_entries);
 const char *proto = avio_find_protocol_name(s->url);
-int use_rename = proto && !strcmp(proto, "file");
+int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
HLS_TEMP_FILE);
 static unsigned warned_non_file;
 char *key_uri = NULL;
 char *iv_string = NULL;
@@ -1397,11 +1396,11 @@ static int hls_window(AVFormatContext *s, int last, 
VariantStream *vs)
 hls->version = 7;
 }
 
-if (!use_rename && !warned_non_file++)
+if (!use_temp_file && !warned_non_file++)
 av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this 
may lead to races and temporary partial files\n");
 
 set_http_options(s, , hls);
-snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : 
"%s", vs->m3u8_name);
+snprintf(temp_filename, sizeof(temp_filename), use_temp_file ? "%s.tmp" : 
"%s", vs->m3u8_name);
 if ((ret = hlsenc_io_open(s, >m3u8_out, temp_filename, )) < 0)
 goto fail;
 
@@ -1472,8 +1471,8 @@ fail:
 av_dict_free();
 hlsenc_io_close(s, >m3u8_out, temp_filename);
 hlsenc_io_close(s, >sub_m3u8_out, vs->vtt_m3u8_name);
-if (ret >= 0 && use_rename)
-ff_rename(temp_filename, vs->m3u8_name, s);
+if (use_temp_file)
+ff_rename(temp_filename, vs->m3u8_name, s);
 
 if (ret >= 0 && hls->master_pl_name)
 if (create_master_playlist(s, vs) < 0)
@@ -1488,6 +1487,8 @@ static int hls_start(AVFormatContext *s, VariantStream 
*vs)
 AVFormatContext *oc = vs->avf;
 AVFormatContext *vtt_oc = vs->vtt_avf;
 AVDictionary *options = NULL;
+const char *proto = avio_find_protocol_name(s->url);
+int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
HLS_TEMP_FILE);
 char *filename, iv_string[KEYSIZE*2 + 1];
 int err = 0;
 
@@ -1583,7 +1584,7 @@ static int hls_start(AVFormatContext *s, VariantStream 
*vs)
 
 set_http_options(s, , c);
 
-if (c->flags & HLS_TEMP_FILE) {
+if (use_temp_file) {
 char *new_name = av_asprintf("%s.tmp", oc->url);
 if (!new_name)
 return AVERROR(ENOMEM);
@@ -2145,6 +2146,8 @@ static int hls_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 int ret = 0, can_split = 1, i, j;
 int stream_index = 0;
 int range_length = 0;
+const char *proto = avio_find_protocol_name(s->url);
+int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
HLS_TEMP_FILE);
 uint8_t *buffer = NULL;
 VariantStream *vs = NULL;
 AVDictionary *options = NULL;
@@ -2214,10 +2217,10 @@ static int hls_write_packet(AVFormatContext *s, 
AVPacket *pkt)
 
 }
 
+char *old_filename = NULL;
 if (vs->packets_written && can_split && av_compare_ts(pkt->pts - 
vs->start_pts, st->time_base,
   end_pts, 
AV_TIME_BASE_Q) >= 0) {
 int64_t new_start_pos;
-char *old_filename = NULL;
 int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || 
(hls->max_seg_size > 0);
 
 av_write_frame(vs->avf, NULL); /* Flush any buffered data */
@@ -2253,11 +2256,13 @@ static int hls_write_packet(AVFormatContext *s, 
AVPacket *pkt)
 hlsenc_io_close(s, >vtt_avf->pb, vs->vtt_avf->url);
 }
 }
-if ((hls->flags & HLS_TEMP_FILE) && oc->url[0]) {
+
+// look to rename the asset name
+if (use_temp_file && oc->url[0]) {
 if (!(hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size <= 0))
- 

Re: [FFmpeg-devel] [PATCH 4/7] Adds gray floating-point pixel formats.

2018-08-17 Thread Carl Eugen Hoyos
2018-08-17 14:21 GMT+02:00, Sergey Lavrushkin :
> пт, 17 авг. 2018 г., 6:47 James Almer :
>
>> On 8/14/2018 1:23 PM, Michael Niedermayer wrote:
>> > On Mon, Aug 13, 2018 at 04:58:42PM +0300, Sergey Lavrushkin wrote:
>> >>>
>> >>> Just use av_clipf instead of FFMIN/FFMAX.
>> >>
>> >>
>> >> Changed FFMIN/FFMAX to av_clip_uint16 and av_clip_uint8.
>> >
>> > will apply
>> >
>> > thanks
>>
>> This broke fate on some 32bit hosts. Guess float pixfmts shouldn't be
>> tested for bitexact output. The gbrpf32 ones aren't, for example.
>>
>> http://fate.ffmpeg.org/report.cgi?time=20180816131312=x86_32-debian-kfreebsd-gcc-4.4-cpuflags-mmx
>
>
> If I am not mistaken, gbrpf32 formats are not supported in libswscale
> [because of that]

I sincerely hope that this is not true...

> and not tested because of that.
>
>>
>> Was a float gray pixfmt needed for this filter? Gray16 was not an option?
>>
>
> All calculations in neural network are done using floats.
>
> What can I do to fix this issue?

Reverting to doing the conversion in the filter comes to mind...

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


Re: [FFmpeg-devel] [PATCH] avformat/tls_schannel: Fix use of uninitialized variable

2018-08-17 Thread Carl Eugen Hoyos
2018-08-17 14:36 GMT+02:00, Hendrik Leppkes :
> On Fri, Aug 17, 2018 at 12:05 PM Paweł Wegner 
> wrote:
>>
>> Yes, it will work.
>>
>> Fixes: runtime error: passing uninitialized value to FreeContextBuffer
>> causes a crash
>>
>> Signed-off-by: Paweł Wegner 
>> ---
>>  libavformat/tls_schannel.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavformat/tls_schannel.c b/libavformat/tls_schannel.c
>> index f41b007773..4f0badcb8d 100644
>> --- a/libavformat/tls_schannel.c
>> +++ b/libavformat/tls_schannel.c
>> @@ -148,7 +148,7 @@ static int tls_client_handshake_loop(URLContext *h,
>> int initial)
>>  TLSContext *c = h->priv_data;
>>  TLSShared *s = >tls_shared;
>>  SECURITY_STATUS sspi_ret;
>> -SecBuffer outbuf[3];
>> +SecBuffer outbuf[3] = { 0 };
>>  SecBufferDesc outbuf_desc;
>>  SecBuffer inbuf[2];
>>  SecBufferDesc inbuf_desc;
>> --
>> 2.17.1
>>
>
> LGTM.

Then please commit.

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


Re: [FFmpeg-devel] [PATCH] avformat/tls_schannel: Fix use of uninitialized variable

2018-08-17 Thread Hendrik Leppkes
On Fri, Aug 17, 2018 at 12:05 PM Paweł Wegner  wrote:
>
> Yes, it will work.
>
> Fixes: runtime error: passing uninitialized value to FreeContextBuffer
> causes a crash
>
> Signed-off-by: Paweł Wegner 
> ---
>  libavformat/tls_schannel.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/tls_schannel.c b/libavformat/tls_schannel.c
> index f41b007773..4f0badcb8d 100644
> --- a/libavformat/tls_schannel.c
> +++ b/libavformat/tls_schannel.c
> @@ -148,7 +148,7 @@ static int tls_client_handshake_loop(URLContext *h, int 
> initial)
>  TLSContext *c = h->priv_data;
>  TLSShared *s = >tls_shared;
>  SECURITY_STATUS sspi_ret;
> -SecBuffer outbuf[3];
> +SecBuffer outbuf[3] = { 0 };
>  SecBufferDesc outbuf_desc;
>  SecBuffer inbuf[2];
>  SecBufferDesc inbuf_desc;
> --
> 2.17.1
>

LGTM.

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


Re: [FFmpeg-devel] [PATCH] lavfi/vf_libvmaf: update to use libvmaf v1.3.9

2018-08-17 Thread Carl Eugen Hoyos
2018-08-14 9:57 GMT+02:00, Gyan Doshi :
>
>
> On 14-08-2018 01:20 PM, Paul B Mahol wrote:
>> On 8/14/18, Gyan Doshi  wrote:
>>>
>>>
>>> On 14-08-2018 03:24 AM, Carl Eugen Hoyos wrote:
>>>
>>
>> Why does this not use -filter_threads?
>
>
> Didn't know it was an option.

> I can certainly change the code to use it.

 Please do it if it works.
>>>
>>> filter_threads applies to all simple filtergraphs. The private option
>>> is specifically targeted. Isn't that better?

I believe the opposite is true.

>> filter_threads is used only for internal threading, so using it for
>> something external seems wrong.

Like the libavcodec option -threads?

> I also realized that libvmaf requires two inputs and should/will be used
> within a complex filtergraph so -filter_threads wouldn't apply even if
> wanted.

Isn't it a bug that -filter_threads does not apply for -filter_complex?

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


Re: [FFmpeg-devel] [PATCH] libavcodec/cuviddec A53CC closed captions support added to cuviddec & nvenc

2018-08-17 Thread Carl Eugen Hoyos
2018-05-03 19:42 GMT+02:00, Timo Rothenpieler :
> Slightly refactored nvenc part can be found here:
> https://github.com/BtbN/FFmpeg/commit/e5d85ac3
>
> Will push tomorrow if no issue with it comes up.

Why is there no option to disable Closed Captions encoding?
Especially as all other h264 encoders support such an option.

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


Re: [FFmpeg-devel] [PATCH 4/7] Adds gray floating-point pixel formats.

2018-08-17 Thread Sergey Lavrushkin
пт, 17 авг. 2018 г., 6:47 James Almer :

> On 8/14/2018 1:23 PM, Michael Niedermayer wrote:
> > On Mon, Aug 13, 2018 at 04:58:42PM +0300, Sergey Lavrushkin wrote:
> >>>
> >>> Just use av_clipf instead of FFMIN/FFMAX.
> >>
> >>
> >> Changed FFMIN/FFMAX to av_clip_uint16 and av_clip_uint8.
> >
> > will apply
> >
> > thanks
>
> This broke fate on some 32bit hosts. Guess float pixfmts shouldn't be
> tested for bitexact output. The gbrpf32 ones aren't, for example.
>
> http://fate.ffmpeg.org/report.cgi?time=20180816131312=x86_32-debian-kfreebsd-gcc-4.4-cpuflags-mmx


If I am not mistaken, gbrpf32 formats are not supported in libswscale and
not tested because of that.

>
> Was a float gray pixfmt needed for this filter? Gray16 was not an option?
>

All calculations in neural network are done using floats.

What can I do to fix this issue? Can I get a VM image for this host to test
it?

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


[FFmpeg-devel] [PATCH v2] h264: Support multi-field closed captions by using AVBufferRef and not resetting per field

2018-08-17 Thread joshdk
From: Kieran Kunhya 

Signed-off-by: Josh de Kock 
---
 libavcodec/h264_sei.c   | 15 ---
 libavcodec/h264_sei.h   |  3 +--
 libavcodec/h264_slice.c | 26 ++
 libavcodec/h264dec.c|  5 +++--
 4 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 6499086210..43593d34d2 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -51,8 +51,7 @@ void ff_h264_sei_uninit(H264SEIContext *h)
 h->display_orientation.present = 0;
 h->afd.present =  0;
 
-h->a53_caption.a53_caption_size = 0;
-av_freep(>a53_caption.a53_caption);
+av_buffer_unref(>a53_caption.buf_ref);
 }
 
 static int decode_picture_timing(H264SEIPictureTiming *h, GetBitContext *gb,
@@ -169,7 +168,8 @@ static int 
decode_registered_user_data_closed_caption(H264SEIA53Caption *h,
 size -= 2;
 
 if (cc_count && size >= cc_count * 3) {
-const uint64_t new_size = (h->a53_caption_size + cc_count
+int old_size = h->buf_ref ? h->buf_ref->size : 0;
+const uint64_t new_size = (old_size + cc_count
* UINT64_C(3));
 int i, ret;
 
@@ -177,14 +177,15 @@ static int 
decode_registered_user_data_closed_caption(H264SEIA53Caption *h,
 return AVERROR(EINVAL);
 
 /* Allow merging of the cc data from two fields. */
-ret = av_reallocp(>a53_caption, new_size);
+ret = av_buffer_realloc(>buf_ref, new_size);
 if (ret < 0)
 return ret;
 
+/* Use of av_buffer_realloc assumes buffer is writeable */
 for (i = 0; i < cc_count; i++) {
-h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
-h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
-h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
+h->buf_ref->data[old_size++] = get_bits(gb, 8);
+h->buf_ref->data[old_size++] = get_bits(gb, 8);
+h->buf_ref->data[old_size++] = get_bits(gb, 8);
 }
 
 skip_bits(gb, 8);   // marker_bits
diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h
index a169a10e49..5b7c8ef9d8 100644
--- a/libavcodec/h264_sei.h
+++ b/libavcodec/h264_sei.h
@@ -95,8 +95,7 @@ typedef struct H264SEIAFD {
 } H264SEIAFD;
 
 typedef struct H264SEIA53Caption {
-int a53_caption_size;
-uint8_t *a53_caption;
+AVBufferRef *buf_ref;
 } H264SEIA53Caption;
 
 typedef struct H264SEIUnregistered {
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index ede9a1a6ea..f31c9a2579 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -430,6 +430,15 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
 
 h->frame_recovered   = h1->frame_recovered;
 
+av_buffer_unref(>sei.a53_caption.buf_ref);
+h->sei.a53_caption.buf_ref = NULL;
+
+if (h1->sei.a53_caption.buf_ref) {
+h->sei.a53_caption.buf_ref = 
av_buffer_ref(h1->sei.a53_caption.buf_ref);
+if (!h->sei.a53_caption.buf_ref)
+return AVERROR(ENOMEM);
+}
+
 if (!h->cur_pic_ptr)
 return 0;
 
@@ -1269,15 +1278,16 @@ static int h264_export_frame_props(H264Context *h)
 }
 }
 
-if (h->sei.a53_caption.a53_caption) {
+if (h->sei.a53_caption.buf_ref) {
 H264SEIA53Caption *a53 = >sei.a53_caption;
-AVFrameSideData *sd = av_frame_new_side_data(cur->f,
- AV_FRAME_DATA_A53_CC,
- a53->a53_caption_size);
-if (sd)
-memcpy(sd->data, a53->a53_caption, a53->a53_caption_size);
-av_freep(>a53_caption);
-a53->a53_caption_size = 0;
+
+AVFrameSideData *sd = av_frame_new_side_data_from_buf(cur->f, 
AV_FRAME_DATA_A53_CC, av_buffer_ref(a53->buf_ref));
+if (sd) {
+av_buffer_unref(>buf_ref);
+} else {
+return AVERROR(ENOMEM);
+}
+
 h->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
 }
 
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 7494c7a8f2..8d115fa040 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -609,9 +609,10 @@ static int decode_nal_units(H264Context *h, const uint8_t 
*buf, int buf_size)
 
 if (!(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)) {
 h->current_slice = 0;
-if (!h->first_field)
+if (!h->first_field) {
 h->cur_pic_ptr = NULL;
-ff_h264_sei_uninit(>sei);
+ff_h264_sei_uninit(>sei);
+}
 }
 
 if (h->nal_length_size == 4) {
-- 
2.17.1

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


[FFmpeg-devel] [PATCH] avformat/tls_schannel: Fix use of uninitialized variable

2018-08-17 Thread Paweł Wegner
Yes, it will work.

Fixes: runtime error: passing uninitialized value to FreeContextBuffer
causes a crash

Signed-off-by: Paweł Wegner 
---
 libavformat/tls_schannel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/tls_schannel.c b/libavformat/tls_schannel.c
index f41b007773..4f0badcb8d 100644
--- a/libavformat/tls_schannel.c
+++ b/libavformat/tls_schannel.c
@@ -148,7 +148,7 @@ static int tls_client_handshake_loop(URLContext *h, int 
initial)
 TLSContext *c = h->priv_data;
 TLSShared *s = >tls_shared;
 SECURITY_STATUS sspi_ret;
-SecBuffer outbuf[3];
+SecBuffer outbuf[3] = { 0 };
 SecBufferDesc outbuf_desc;
 SecBuffer inbuf[2];
 SecBufferDesc inbuf_desc;
-- 
2.17.1

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


Re: [FFmpeg-devel] [PATCH] avformat/tls_schannel: Fix use of uninitialized variable

2018-08-17 Thread Paweł Wegner
Yes, this works as well. I attached fixed patch.

On Fri, Aug 17, 2018 at 11:15 AM Carl Eugen Hoyos 
wrote:

> 2018-08-03 20:28 GMT+02:00, Paweł Wegner :
>
> > One could copy the initialization to the top from the while loop:
> >   init_sec_buffer([0], SECBUFFER_TOKEN, NULL, 0);
> >   init_sec_buffer([1], SECBUFFER_ALERT, NULL, 0);
> >   init_sec_buffer([2], SECBUFFER_EMPTY, NULL, 0);
> >   init_sec_buffer_desc(_desc, outbuf, 3);
>
> I was thinking about "SecBuffer outbuf = { 0 };
> Does that work?
>
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
From 496254b96fe889f7a4aa89817c384ee55afc81d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C5=82=20Wegner?= 
Date: Thu, 2 Aug 2018 21:08:12 +0200
Subject: [PATCH] avformat/tls_schannel: Fix use of uninitialized variable
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes: runtime error: passing uninitialized value to FreeContextBuffer
causes a crash

Signed-off-by: Paweł Wegner 
---
 libavformat/tls_schannel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/tls_schannel.c b/libavformat/tls_schannel.c
index f41b007773..4f0badcb8d 100644
--- a/libavformat/tls_schannel.c
+++ b/libavformat/tls_schannel.c
@@ -148,7 +148,7 @@ static int tls_client_handshake_loop(URLContext *h, int initial)
 TLSContext *c = h->priv_data;
 TLSShared *s = >tls_shared;
 SECURITY_STATUS sspi_ret;
-SecBuffer outbuf[3];
+SecBuffer outbuf[3] = { 0 };
 SecBufferDesc outbuf_desc;
 SecBuffer inbuf[2];
 SecBufferDesc inbuf_desc;
-- 
2.17.1

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


Re: [FFmpeg-devel] [PATCH] h264: Support multi-field closed captions by using AVBufferRef and not resetting per field

2018-08-17 Thread Carl Eugen Hoyos
2018-08-16 12:52 GMT+02:00, jos...@ob-encoder.com :

> @@ -429,6 +429,12 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
> MAX_DELAYED_PIC_COUNT + 2, h, h1);
>
>  h->frame_recovered   = h1->frame_recovered;
> +if (h1->sei.a53_caption.buf_ref) {
> +h->sei.a53_caption.buf_ref =
> av_buffer_ref(h1->sei.a53_caption.buf_ref);
> +av_buffer_unref(>sei.a53_caption.buf_ref);
> +}
> +else
> +h->sei.a53_caption.buf_ref = NULL;

Since you have to change the patch, please fix the
code style here.
(Some people prefer to always use two braces around "else",
it makes debugging much easier.)

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


Re: [FFmpeg-devel] [PATCH] avformat/tls_schannel: Fix use of uninitialized variable

2018-08-17 Thread Carl Eugen Hoyos
2018-08-03 20:28 GMT+02:00, Paweł Wegner :

> One could copy the initialization to the top from the while loop:
>   init_sec_buffer([0], SECBUFFER_TOKEN, NULL, 0);
>   init_sec_buffer([1], SECBUFFER_ALERT, NULL, 0);
>   init_sec_buffer([2], SECBUFFER_EMPTY, NULL, 0);
>   init_sec_buffer_desc(_desc, outbuf, 3);

I was thinking about "SecBuffer outbuf = { 0 };
Does that work?

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


Re: [FFmpeg-devel] [FFmpeg-cvslog] avformat/asfdec_o: Check size_bmp more fully

2018-08-17 Thread Carl Eugen Hoyos
2018-08-15 23:49 GMT+02:00, Michael Niedermayer :
> ffmpeg | branch: release/3.2 | Michael Niedermayer 
> | Tue Jul  3 21:01:23 2018 +0200| [67149cb2f68e3e96cd75804d83827ccd03386695]
> | committer: James Almer
>
> avformat/asfdec_o: Check size_bmp more fully

It may be a simpler solution to remove asfdec_o: If it gets
improved, it can still be revived easily.

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


Re: [FFmpeg-devel] [GSOC][PATCH 1/3] lavc/cfhd:3d transform decoding for both progressive and interlaced

2018-08-17 Thread Carl Eugen Hoyos
2018-08-17 8:15 GMT+02:00, Gagandeep Singh :

>> also i saw on the IRC log after you logged off
>>  also how do i send the 3 samples i have

Assuming they are small (look at the existing files in fate),
upload them to your favorite file-hoster (for example dropbox)
and post a link here.

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


Re: [FFmpeg-devel] [GSOC][PATCH 1/3] lavc/cfhd:3d transform decoding for both progressive and interlaced

2018-08-17 Thread Gagandeep Singh
On Wed, Aug 15, 2018 at 3:12 AM Michael Niedermayer 
wrote:

> On Tue, Aug 14, 2018 at 01:12:37PM +0530, Gagandeep Singh wrote:
> > IP sample decoding patch attached herein.
> >
> > Gagandeep Singh
>
> >  cfhd.c |  511
> -
> >  cfhd.h |   13 +
> >  2 files changed, 454 insertions(+), 70 deletions(-)
> > a155a004ae249d84063d9c49effb87a8f98b0fe7  patchip.patch
> > From 6cc5636c48bca4e802ccca5f53560e31360760cb Mon Sep 17 00:00:00 2001
> > From: Gagandeep Singh 
> > Date: Tue, 14 Aug 2018 00:07:45 +0530
> > Subject: [GSOC][FFmpeg-devel][PATCH 1/3] lavc/cfhd:3d transform decoding
> for both progressive and
> >  interlaced
> >
> [...]
> > @@ -420,9 +486,15 @@ static int cfhd_decode(AVCodecContext *avctx, void
> *data, int *got_frame,
> >  s->prescale_shift[1] = (data >> 3) & 0x7;
> >  s->prescale_shift[2] = (data >> 6) & 0x7;
> >  av_log(avctx, AV_LOG_DEBUG, "Prescale shift (VC-5): %x\n",
> data);
> > +} else if (tag == EncodingMethod) {
> > +s->encode_method = data;
> > +av_log(avctx, AV_LOG_DEBUG, "Encode Method for Subband %d :
> %x\n",s->subband_num_actual, data);
>
> >  } else if (tag == 27) {
> >  av_log(avctx, AV_LOG_DEBUG, "Lowpass width %"PRIu16"\n",
> data);
> > -if (data < 3 || data >
> s->plane[s->channel_num].band[0][0].a_width) {
> > +if (s->coded_width == 0){
> > +s->coded_width = data << 3;
> > +  }
> > +if (data < 3) {
> >  av_log(avctx, AV_LOG_ERROR, "Invalid lowpass width\n");
> >  ret = AVERROR(EINVAL);
>
> any checks should be done before the variable is used.
> also teh indention looks rather odd here
>
>
> [...]
> > @@ -664,9 +742,14 @@ static int cfhd_decode(AVCodecContext *avctx, void
> *data, int *got_frame,
> >  if (count > expected)
> >  break;
> >
> > -coeff = dequant_and_decompand(level,
> s->quantisation, 0);
> > +coeff = dequant_and_decompand(level,
> s->quantisation, 0, (s->sample_type == 2 || s->sample_type == 3) &&
> s->pframe && s->subband_num_actual == 7 && s->encode_method == 5);
> >  for (i = 0; i < run; i++)
> > -*coeff_data++ = coeff;
> > +if (tag != 82)
>
> what is tag 82 ?
> i think instead of litteral numbers named identifers should be used
>

tag 82 is to tell the decoder to use the next coefficients for the same
subband, i.e, process the coefficients in the latest subband with the new
coefficients.
Yes, you are right, i should have used name instead of number, i can send
the patch again but i would also have to send the other patches again. Or i
can send a patch to be applied on top of the 3 patches i sent. Please
comment.

>
>

> [...]
> > @@ -726,14 +814,15 @@ static int cfhd_decode(AVCodecContext *avctx, void
> *data, int *got_frame,
> >  }
> >  }
> >  }
> > -
> > -if (!s->a_width || !s->a_height || s->a_format == AV_PIX_FMT_NONE ||
> > -s->coded_width || s->coded_height || s->coded_format !=
> AV_PIX_FMT_NONE) {
>
> > +//disabled to run mountain sample file
> > +#if 0
> > +if ((!s->a_width || !s->a_height || s->a_format == AV_PIX_FMT_NONE
> ||
> > +s->coded_width || s->coded_height || s->coded_format !=
> AV_PIX_FMT_NONE) && s->sample_type != 1) {
> >  av_log(avctx, AV_LOG_ERROR, "Invalid dimensions\n");
> >  ret = AVERROR(EINVAL);
> >  goto end;
> >  }
> > -
> > +#endif
>
> please elaborate why this needs to be disabled
> i presume this code was needed for something
>
I didn't need to disable this for any sample except one, where the image
height and width data wasn't transfered in accordance to how it was in the
rest of the sample so the flow of code was just causing the decoder to
crash. I can produce a more robust fix, though again will need to repost
other patches as well, please comment.

> also this decoder with the patches should be tested with a fuzzer to
> reduce
> the chance of bugs
>
> I don't know how to use 'fuzzer', sorry, though i can look into that.

> also i saw on the IRC log after you logged off
>  also how do i send the 3 samples i have
>  ask michaelni
>  michaelni: can you help gagandeepsingh
>
> i didnt follow the whole discussion but to submit samples, you can upload
> them
> somewhere and post a link. Someone developer will upload them.
> Note, please clearly specify what any samples are for (fatesamples / bug
> reports / other /...)
>
> The samples are proper bitexact IP decoded samples and i believe they
should be added as fate tests

> thanks
>
[...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Whats the most studid thing your enemy could do ? Blow himself up
> Whats the most studid thing you 

Re: [FFmpeg-devel] [GSOC][PATCH 2/3] lavc/cfhd:corrected decompanding for table 9 used in cfhd

2018-08-17 Thread Gagandeep Singh
On Thu, Aug 16, 2018 at 2:37 AM Kieran Kunhya  wrote:

> On Tue, 14 Aug 2018 at 08:43 Gagandeep Singh 
> wrote:
>
> > Second patch for fixing decompanding in table 9.
> >
> > Gagandeep Singh
> >
>
> Seems ok
>
> Kieran
>

Thanks!!

Gagandeep Singh

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