Re: [FFmpeg-devel] [PATCH] avfilter: add normalize filter

2017-11-19 Thread Richard Ling
OK, trying again. I've worked out how to send to myself without corruption
(I think).

From 590b3bc8e2675c75c2ff7e75f7fc1fbb1e1a8f71 Mon Sep 17 00:00:00 2001
From: Richard Ling 
Date: Thu, 16 Nov 2017 23:00:01 +1100
Subject: [PATCH] avfilter: add normalize filter

---
 doc/filters.texi   |  80 ++
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/vf_normalize.c | 387
+
 4 files changed, 469 insertions(+)
 create mode 100644 libavfilter/vf_normalize.c

diff --git a/doc/filters.texi b/doc/filters.texi
index 4a35c44..4cfa031 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10815,6 +10815,86 @@ Add temporal and uniform noise to input video:
 noise=alls=20:allf=t+u
 @end example

+@section normalize
+
+Normalize RGB video (aka histogram stretching, contrast stretching).
+See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
+
+For each channel of each frame, the filter computes the input range and
maps
+it linearly to the user-specified output range. The output range defaults
+to the full dynamic range from pure black to pure white.
+
+Temporal smoothing can be used on the input range to reduce flickering
(rapid
+changes in brightness) caused when small dark or bright objects enter or
leave
+the scene. This is similar to the auto-exposure (automatic gain control)
on a
+video camera, and, like a video camera, it may cause a period of over- or
+under-exposure of the video.
+
+The R,G,B channels can be normalized independently, which may cause some
+color shifting, or linked together as a single channel, which prevents
+color shifting. Linked normalization preserves hue. Independent
normalization
+does not, so it can be used to remove some color casts. Independent and
linked
+normalization can be combined in any ratio.
+
+The normalize filter accepts the following options:
+
+@table @option
+@item blackpt
+@item whitept
+Colors which define the output range. The minimum input value is mapped to
+the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
+The defaults are black and white respectively. Specifying white for
+@var{blackpt} and black for @var{whitept} will give color-inverted,
+normalized video. Shades of grey can be used to reduce the dynamic range
+(contrast). Specifying saturated colors here can create some interesting
+effects.
+
+@item smoothing
+The number of previous frames to use for temporal smoothing. The input
range
+of each channel is smoothed using a rolling average over the current frame
+and the @var{smoothing} previous frames. The default is 0 (no temporal
+smoothing).
+
+@item independence
+Controls the ratio of independent (color shifting) channel normalization to
+linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
+independent. Defaults to 1.0 (fully independent).
+
+@item strength
+Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
+expensive no-op. Defaults to 1.0 (full strength).
+
+@end table
+
+@subsection Examples
+
+Stretch video contrast to use the full dynamic range, with no temporal
+smoothing; may flicker depending on the source content:
+@example
+normalize=blackpt=black:whitept=white:smoothing=0
+@end example
+
+As above, but with 2 seconds of temporal smoothing; flicker should be
+reduced, depending on the source content:
+@example
+normalize=blackpt=black:whitept=white:smoothing=2
+@end example
+
+As above, but with hue-preserving linked channel normalization:
+@example
+normalize=blackpt=black:whitept=white:smoothing=2:independence=1
+@end example
+
+As above, but with half strength:
+@example
+normalize=blackpt=black:whitept=white:smoothing=2:independence=1:strength=0.5
+@end example
+
+Map the darkest input color to red, the brightest input color to cyan:
+@example
+normalize=blackpt=red:whitept=cyan
+@end example
+
 @section null

 Pass the video source unchanged to the output.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index b7ddcd2..7843ad8 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -245,6 +245,7 @@ OBJS-$(CONFIG_NLMEANS_FILTER)+=
vf_nlmeans.o
 OBJS-$(CONFIG_NNEDI_FILTER)  += vf_nnedi.o
 OBJS-$(CONFIG_NOFORMAT_FILTER)   += vf_format.o
 OBJS-$(CONFIG_NOISE_FILTER)  += vf_noise.o
+OBJS-$(CONFIG_NORMALIZE_FILTER)  += vf_normalize.o
 OBJS-$(CONFIG_NULL_FILTER)   += vf_null.o
 OBJS-$(CONFIG_OCR_FILTER)+= vf_ocr.o
 OBJS-$(CONFIG_OCV_FILTER)+= vf_libopencv.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 3647a11..36e3edb 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -255,6 +255,7 @@ static void register_all(void)
 REGISTER_FILTER(NNEDI,  nnedi,  vf);
 REGISTER_FILTER(NOFORMAT,   noformat,   vf);
 REGISTER_FILTER(NOISE,  noise,  vf);
+

Re: [FFmpeg-devel] [PATCH 3/4] avformat/movenc: force colr atom for uncompressed yuv in mov

2017-11-19 Thread Reto Kromer
Dave Rice wrote:

>As required by Apple’s TN2162.
>---
> libavformat/movenc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

LGTM

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


[FFmpeg-devel] [DEVEL][PATCH 2/2] ffmpeg: fix ticket 6706

2017-11-19 Thread pkv.stream



From f94f2e8c8878d6dbda540b19d90c2b8f1ba00850 Mon Sep 17 00:00:00 2001
From: pkviet 
Date: Sat, 18 Nov 2017 00:26:50 +0100
Subject: [PATCH 2/2] ffmpeg: fix ticket 6706

Fix regression with channel_layout option which is not passed
correctly from output streams to filters when the channel layout is not
a default one.

Signed-off-by: pkviet 
---
 fftools/ffmpeg.h |  3 +++
 fftools/ffmpeg_opt.c | 35 +++
 2 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index e0977e1..5c45df4 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -121,6 +121,8 @@ typedef struct OptionsContext {
 intnb_frame_sizes;
 SpecifierOpt *frame_pix_fmts;
 intnb_frame_pix_fmts;
+SpecifierOpt *channel_layouts;
+intnb_channel_layouts;
 
 /* input options */
 int64_t input_ts_offset;
@@ -624,6 +626,7 @@ extern int vstats_version;
 extern const AVIOInterruptCB int_cb;
 
 extern const OptionDef options[];
+extern const OptionDef channel_layout_option[];
 extern const HWAccel hwaccels[];
 extern AVBufferRef *hw_device_ctx;
 #if CONFIG_QSV
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 47d3841..7b2c18c 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1803,6 +1803,7 @@ static OutputStream *new_audio_stream(OptionsContext *o, 
AVFormatContext *oc, in
 char *sample_fmt = NULL;
 
 MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st);
+MATCH_PER_STREAM_OPT(channel_layouts, ui64, audio_enc->channel_layout, 
oc, st);
 
 MATCH_PER_STREAM_OPT(sample_fmts, str, sample_fmt, oc, st);
 if (sample_fmt &&
@@ -2527,7 +2528,11 @@ loop_end:
(count + 1) * sizeof(*f->sample_rates));
 }
 if (ost->enc_ctx->channels) {
-f->channel_layout = 
av_get_default_channel_layout(ost->enc_ctx->channels);
+if (ost->enc_ctx->channel_layout) {
+f->channel_layout = ost->enc_ctx->channel_layout;
+} else {
+f->channel_layout = 
av_get_default_channel_layout(ost->enc_ctx->channels);
+}
 } else if (ost->enc->channel_layouts) {
 count = 0;
 while (ost->enc->channel_layouts[count])
@@ -3104,7 +3109,7 @@ static int opt_channel_layout(void *optctx, const char 
*opt, const char *arg)
 char layout_str[32];
 char *stream_str;
 char *ac_str;
-int ret, channels, ac_str_size;
+int ret, channels, ac_str_size, stream_str_size;
 uint64_t layout;
 
 layout = av_get_channel_layout(arg);
@@ -3116,12 +3121,30 @@ static int opt_channel_layout(void *optctx, const char 
*opt, const char *arg)
 ret = opt_default_new(o, opt, layout_str);
 if (ret < 0)
 return ret;
+stream_str = strchr(opt, ':');
+stream_str_size = (stream_str ? strlen(stream_str) : 0);
+/* set 'channel_layout_uint64' option which stores channel_layout (as 
uint64 channel mask)
+ * in SpecifierOpt, enabling access to channel layout through 
MATCH_PER_STREAM_OPT
+ */
+ac_str_size = 22 + stream_str_size;
+ac_str = av_mallocz(ac_str_size);
+if (!ac_str) {
+return AVERROR(ENOMEM);
+}
+av_strlcpy(ac_str, "channel_layout_uint64", 22);
+if (stream_str) {
+av_strlcat(ac_str, stream_str, ac_str_size);
+}
+ret = parse_option(o, ac_str, layout_str, options);
+av_free(ac_str);
+if (ret < 0) {
+return ret;
+}
 
 /* set 'ac' option based on channel layout */
 channels = av_get_channel_layout_nb_channels(layout);
 snprintf(layout_str, sizeof(layout_str), "%d", channels);
-stream_str = strchr(opt, ':');
-ac_str_size = 3 + (stream_str ? strlen(stream_str) : 0);
+ac_str_size = 3 + stream_str_size;
 ac_str = av_mallocz(ac_str_size);
 if (!ac_str)
 return AVERROR(ENOMEM);
@@ -3674,6 +3697,10 @@ const OptionDef options[] = {
 { "channel_layout", OPT_AUDIO | HAS_ARG  | OPT_EXPERT | OPT_PERFILE |
 OPT_INPUT | OPT_OUTPUT,
{ .func_arg = opt_channel_layout },
 "set channel layout", "layout" },
+{ "channel_layout_uint64", OPT_AUDIO | HAS_ARG | OPT_INT64 | OPT_SPEC |
+   OPT_INPUT | OPT_OUTPUT, 
{ .off = OFFSET(channel_layouts) },
+"set channel layout with uint64"
+"(for more syntax choices use instead the channel_layout option)", 
"layout_uint64" }, // allows storing of option in SpecifierOpt
 { "af", OPT_AUDIO | HAS_ARG  | OPT_PERFILE | OPT_OUTPUT,   
{ .func_arg = opt_audio_filters },
 "set audio filters", "filter_graph" },
 { "guess_layout_max", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC | 
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(guess_layout_max) },

[FFmpeg-devel] [DEVEL][PATCH 1/2] ffmpeg: add ui64 type to SpecifierOpt

2017-11-19 Thread pkv.stream

Hi Michael


Tell me the best course; or if you see a way to make my
MATCH_PER_STREAM_OPT() code less hacky.

iam sure theres a way to do this less hacky
why do you need a 2nd table ? or rather why does it not work if you
put the entry in the main table ? (so there are 2 entries one for
OPT_SPEC and one for teh callback, will it not send the data to both
matching entries ?




Regards


[...]


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


  cmdutils.h   |1 +
  ffmpeg.h |3 +++
  ffmpeg_opt.c |   41 +
  3 files changed, 41 insertions(+), 4 deletions(-)
7c1249f0cb4daa1aebbf94b0e785e644997f754a  0001-ffmpeg-fix-ticket-6706.patch
 From 00c3c724544b16c19282b39644e2584f9c4a4181 Mon Sep 17 00:00:00 2001
From: pkviet 
Date: Sat, 18 Nov 2017 00:26:50 +0100
Subject: [PATCH] ffmpeg: fix ticket 6706

Fix regression with channel_layout option which is not passed
correctly from output streams to filters when the channel layout is not
a default one.
---
  fftools/cmdutils.h   |  1 +
  fftools/ffmpeg.h |  3 +++
  fftools/ffmpeg_opt.c | 41 +
  3 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
index 2997ee3..fa2b255 100644
--- a/fftools/cmdutils.h
+++ b/fftools/cmdutils.h
@@ -155,6 +155,7 @@ typedef struct SpecifierOpt {
  uint8_t *str;
  inti;
  int64_t  i64;
+uint64_t ui64;
  float  f;
  double   dbl;
  } u;

please split this in a seperate patch




done.
I've split previous patch for channel_layout bug as requested and put 
the new OPT_SPEC channel layout option in main OptionDef.
patch 1/2 : adds a uint64_t type to SpecifierOpt ; useful for next patch 
of the series (this is not absolutely necessary but avoids memcpy back 
and forth between int64 and uint64, and reads cleaner)
patch 2/2: fixes ticket 6706 (channel_layout option not passed correctly 
from output stream to filters for non-default layouts)


Regards

From 550c6410e06f36f8d1dce68c11cc53ebd58f3568 Mon Sep 17 00:00:00 2001
From: pkviet 
Date: Sat, 18 Nov 2017 22:19:46 +0100
Subject: [PATCH 1/2] ffmpeg: add ui64 type to SpecifierOpt

 Adds ui64 (uint64_t) as a possible type for SpecifierOpt. This enables
 use of uint64_t options with SpecifierOpt such as channel_layout
 when expressed as a 64 bit channel mask.

Signed-off-by: pkviet 
---
 fftools/cmdutils.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
index 2997ee3..fa2b255 100644
--- a/fftools/cmdutils.h
+++ b/fftools/cmdutils.h
@@ -155,6 +155,7 @@ typedef struct SpecifierOpt {
 uint8_t *str;
 inti;
 int64_t  i64;
+uint64_t ui64;
 float  f;
 double   dbl;
 } u;
-- 
2.10.1.windows.1

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


Re: [FFmpeg-devel] Source for http://ffmpeg.org/contact.html and documentation.html ?

2017-11-19 Thread Jim DeLaHunt

On 2017-11-18 14:53, Mark Thompson wrote:

On 18/11/17 22:32, Jim DeLaHunt wrote:

Hello, all:

 From what sources are the web pages http://ffmpeg.org/contact.html and 
https://ffmpeg.org/documentation.html generated?

Sister web pages, like https://ffmpeg.org/ffmpeg.html and 
http://ffmpeg.org/developer.html, are generated from .texi files in the FFmpeg 
repository. Are contact.html and documentation.html different?

And, are these top-level website pages open to patches from ordinary FFmpeg 
contributors?

Yes.  The repo can be found at .

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


Thank you, that worked well for me.
 —Jim DeLaHunt

--
--Jim DeLaHunt, j...@jdlh.com http://blog.jdlh.com/ 
(http://jdlh.com/)

  multilingual websites consultant

  355-1027 Davie St, Vancouver BC V6E 4L2, Canada
 Canada mobile +1-604-376-8953
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] Subscribe to ffmpeg-cvslog for patch discussion? Really?

2017-11-19 Thread Jim DeLaHunt

Hello, all:

Continuing my reading of the FFmpeg developer instructions, I find this 
at , 
*Developer Guide*, /1.4.3 Documentation/Other/ :


   *Subscribe to the ffmpeg-cvslog mailing list.*

   It is important to do this as the diffs of all commits are sent
   there and reviewed by all the other developers. Bugs and possible
   improvements or general questions regarding commits are discussed
   there. We expect you to react if problems with your code are uncovered.

Most of the instructions here appear to be describing current use of the 
*ffmpeg-devel* list rather than ffmpeg-cvslog. Looking in the 
ffmpeg-cvslog archives , 
it's clear that diffs of many, possibly all, commits are sent there. But 
I see no evidence there of discussion since 2011 (though I might have 
missed something).


Is it really accurate that every contributor is expected to subscribe to 
the ffmpeg-cvslog list?  That "Bugs and possible improvements or general 
questions regarding commits are discussed there"?


Or, would it be more accurate to change the title of this section to 
read "ffmpeg-devel"?  And, to reword the "diffs of all commits are sent 
there" text to better describe ffmpeg-devel?


Thanks in advance for helping me understand,
  —Jim DeLaHunt

--
--Jim DeLaHunt, j...@jdlh.com http://blog.jdlh.com/ (http://jdlh.com/)
  multilingual websites consultant

  355-1027 Davie St, Vancouver BC V6E 4L2, Canada
 Canada mobile +1-604-376-8953

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


Re: [FFmpeg-devel] Subscribe to ffmpeg-cvslog for patch discussion? Really?

2017-11-19 Thread Timo Rothenpieler
Usually if a discussion comes up the mail from cvslog is replied to on 
this list, so no actual discussion happens on the automatic cvslog list.




smime.p7s
Description: S/MIME Cryptographic Signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] avcodec/qsvenc Question for Intel QSV low latency

2017-11-19 Thread Natsuki Kai
I sent it as another thread, but yes it's ok.
Please check the attachment patch file.
Thank you.


On Wed, Nov 15, 2017 at 7:55 AM, Carl Eugen Hoyos  wrote:
> 2017-11-14 17:02 GMT+01:00 Natsuki Kai :
>> Hi Moritz,
>>
>> Thank you for explaining in details. It really helped me.
>> It seems gmail or other mail tool shouldn't be used, but only "git
>> send-email" is accepted.
>
> Just send your patch - made with git format-patch - as
> attachment. This should work with all mail clients.
>
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


0001-Question-for-Intel-QSV-low-latency.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add normalize filter

2017-11-19 Thread Paul B Mahol
On 11/19/17, Richard Ling  wrote:
> OK, trying again. I've worked out how to send to myself without corruption
> (I think).

Still broken.
Post patch as attachment.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] libavformat/id3v2: add some ID3v2.3 tags convertion

2017-11-19 Thread tiejun.peng
Signed-off-by: tiejun.peng 
---
 libavformat/id3v2.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 6c216ba..1cf759b 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -56,6 +56,11 @@ const AVMetadataConv ff_id3v2_34_metadata_conv[] = {
 { "TRCK", "track"},
 { "TSSE", "encoder"  },
 { "USLT", "lyrics"   },
+{ "TYER", "year" },
+{ "TDAT", "date" },
+{ "TMED", "media-type"   },
+{ "TOLY", "author"   },
+{ "TBPM", "BPM"  },
 { 0 }
 };
 
-- 
2.7.4



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


Re: [FFmpeg-devel] [PATCH 2/4] libvpx: remove pre-1.4.0 checks

2017-11-19 Thread James Almer
On 11/17/2017 10:50 PM, James Zern wrote:
> Signed-off-by: James Zern 
> ---
>  libavcodec/libvpx.c | 12 +---
>  1 file changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/libavcodec/libvpx.c b/libavcodec/libvpx.c
> index 1eca97a081..36f915a8e5 100644
> --- a/libavcodec/libvpx.c
> +++ b/libavcodec/libvpx.c
> @@ -40,9 +40,7 @@ static const enum AVPixelFormat vp9_pix_fmts_highcol[] = {
>  AV_PIX_FMT_YUV422P,
>  AV_PIX_FMT_YUV440P,
>  AV_PIX_FMT_YUV444P,
> -#if VPX_IMAGE_ABI_VERSION >= 3
>  AV_PIX_FMT_GBRP,
> -#endif
>  AV_PIX_FMT_NONE
>  };
>  
> @@ -60,30 +58,22 @@ static const enum AVPixelFormat vp9_pix_fmts_highbd[] = {
>  AV_PIX_FMT_YUV422P12,
>  AV_PIX_FMT_YUV440P12,
>  AV_PIX_FMT_YUV444P12,
> -#if VPX_IMAGE_ABI_VERSION >= 3
>  AV_PIX_FMT_GBRP,
>  AV_PIX_FMT_GBRP10,
>  AV_PIX_FMT_GBRP12,
> -#endif
>  AV_PIX_FMT_NONE
>  };
>  #endif
>  
>  av_cold void ff_vp9_init_static(AVCodec *codec)
>  {
> -if (vpx_codec_version_major() < 1
> -|| (vpx_codec_version_major() == 1 && vpx_codec_version_minor() < 3))
> -codec->capabilities |= AV_CODEC_CAP_EXPERIMENTAL;
>  codec->pix_fmts = vp9_pix_fmts_def;

Does this limited list of pixfmts make sense now that the
vpx_codec_version_* check below is gone?

>  #if CONFIG_LIBVPX_VP9_ENCODER
> -if (vpx_codec_version_major() > 1
> -|| (vpx_codec_version_major() == 1 && vpx_codec_version_minor() >= 
> 4)) {
> -#ifdef VPX_CODEC_CAP_HIGHBITDEPTH
> +{
>  vpx_codec_caps_t codec_caps = vpx_codec_get_caps(vpx_codec_vp9_cx());
>  if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH)
>  codec->pix_fmts = vp9_pix_fmts_highbd;
>  else
> -#endif
>  codec->pix_fmts = vp9_pix_fmts_highcol;
>  }
>  #endif
> 

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


[FFmpeg-devel] [PATCH] libavformat/mov:the "stco" box parse no need return eof.

2017-11-19 Thread tiejun.peng
if return eof, will cause to play the whole mp4 file fail.
For example, currently the whole file will play fail
when a few bytes missed in the "stco" box
and the "stco" box is the last box of MP4 file,
Actually the almost media frames can play success at most time.
A few words missed in "stco" box and the other box data is full
will not cause the whole mp4 file fail.

Signed-off-by: tiejun.peng 
---
 libavformat/mov.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 5c9f926..78b7bf7 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1989,9 +1989,6 @@ static int mov_read_stco(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 
 sc->chunk_count = i;
 
-if (pb->eof_reached)
-return AVERROR_EOF;
-
 return 0;
 }
 
-- 
2.7.4




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


Re: [FFmpeg-devel] [PATCH 1/4] configure: require libvpx-1.4.0 for vp[89] support

2017-11-19 Thread James Almer
On 11/17/2017 10:50 PM, James Zern wrote:
> this will simplify libvpxenc/dec.c and ensure more stable versions of
> the codecs are present.
> 
> Signed-off-by: James Zern 
> ---
>  configure | 20 ++--
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/configure b/configure
> index c8e2e35192..bfb1d9ab3a 100755
> --- a/configure
> +++ b/configure
> @@ -5895,22 +5895,22 @@ enabled libvorbis && require_pkg_config 
> libvorbis vorbis vorbis/codec.h
>  
>  enabled libvpx&& {
>  enabled libvpx_vp8_decoder && {
> -check_pkg_config libvpx_vp8_decoder "vpx >= 0.9.1" 
> "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
> -check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" 
> vpx_codec_dec_init_ver -lvpx ||
> -die "ERROR: libvpx decoder version must be >=0.9.1";
> +check_pkg_config libvpx_vp8_decoder "vpx >= 1.4.0" 
> "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
> +check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" 
> "vpx_codec_dec_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -lvpx ||

VPX_CODEC_CAP_HIGHBITDEPTH seems to be defined in vpx_encoder.h
Is that included in vp8dx.h?

> +die "ERROR: libvpx decoder version must be >=1.4.0";
>  }
>  enabled libvpx_vp8_encoder && {
> -check_pkg_config libvpx_vp8_encoder "vpx >= 0.9.7" 
> "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
> -check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" 
> "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx ||
> -die "ERROR: libvpx encoder version must be >=0.9.7";
> +check_pkg_config libvpx_vp8_encoder "vpx >= 1.4.0" 
> "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
> +check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" 
> "vpx_codec_enc_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -lvpx ||
> +die "ERROR: libvpx encoder version must be >=1.4.0";
>  }
>  enabled libvpx_vp9_decoder && {
> -check_pkg_config libvpx_vp9_decoder "vpx >= 1.3.0" 
> "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
> -check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" 
> "vpx_codec_vp9_dx" -lvpx
> +check_pkg_config libvpx_vp9_decoder "vpx >= 1.4.0" 
> "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
> +check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" 
> "vpx_codec_vp9_dx VPX_IMG_FMT_HIGHBITDEPTH" -lvpx
>  }
>  enabled libvpx_vp9_encoder && {
> -check_pkg_config libvpx_vp9_encoder "vpx >= 1.3.0" 
> "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
> -check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" 
> "vpx_codec_vp9_cx VP9E_SET_AQ_MODE" -lvpx
> +check_pkg_config libvpx_vp9_encoder "vpx >= 1.4.0" 
> "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
> +check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" 
> "vpx_codec_vp9_cx VPX_IMG_FMT_HIGHBITDEPTH" -lvpx
>  }
>  if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder 
> libvpx_vp9_encoder; then
>  die "libvpx enabled but no supported decoders found"
> 

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


Re: [FFmpeg-devel] [Patch] Fix for ticket 6658 (Dash demuxer segfault)

2017-11-19 Thread Moritz Barsnick
On Sat, Nov 18, 2017 at 00:16:33 +, Colin NG wrote:
> Cleaned the code up.

Please do read the ffmpeg style guide.

> +static char * ishttp(char *url) {

Asterisk attaches to the right hand side.

> -ret = s->io_open(s, pb, url, AVIO_FLAG_READ, &tmp);
> +av_freep(pb);
> +ret = avio_open2(pb, url, AVIO_FLAG_READ, c->interrupt_callback, &tmp);
> +
>  if (ret >= 0) {

No reason to introduce an exta empty line.

> +static int resolve_content_path(AVFormatContext *s, const char *url,  
> xmlNodePtr *baseurl_nodes,  int n_baseurl_nodes) {

Opening curly bracket for functions goes on a new line.

> +av_strlcpy(tmp_str, url, strlen(url)+1);

Operators get spaces around them.

> +char *mpdName = strtok (tmp_str," /");

Space after comma.

> +while ((mpdName =strtok (NULL, "/"))) {

Operators get spaces around them.

> +av_strlcpy (path, url, strlen(url)-nameSize+1);

No space before opening bracket (except for if, while, ...).
Operators get spaces around them.

> +xmlNodePtr  *node = NULL;

Too much whitespace.

> +for (rootId = n_baseurl_nodes-1; rootId >0; rootId--) {

Operators get spaces around them.

> +if (!(node = baseurl_nodes[rootId])) continue;

Newline. Preferably with {}.

> +char *root_url = (!av_strcasecmp(baseurl, ""))? path: baseurl;

Operators get spaces around them.

> +char *isRootHttp= ishttp(root_url);

Operators get spaces around them.

> +char token ='/';

Operators get spaces around them.

> +if (strncmp(&root_url[size-1],&token, 1) != 0) {

Operators get spaces around them.
Spaces after commas.

> +size+=2;

Operators get spaces around them.

> +for (i = 0; i < n_baseurl_nodes; ++i) {

i++

> +if (i==rootId) continue;

Newline. Preferably with {}.

> +av_strlcpy(tmp_str, root_url, size+1);

Operators get spaces around them.

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


[FFmpeg-devel] [PATCH] configure: add audio_frame_queue dependency for aptx codec

2017-11-19 Thread James Darnley
---
 configure | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configure b/configure
index 8b7b7e164b..48761934be 100755
--- a/configure
+++ b/configure
@@ -2439,6 +2439,8 @@ amv_encoder_select="aandcttables jpegtables mpegvideoenc"
 ape_decoder_select="bswapdsp llauddsp"
 apng_decoder_select="zlib"
 apng_encoder_select="llvidencdsp zlib"
+aptx_decoder_select="audio_frame_queue"
+aptx_encoder_select="audio_frame_queue"
 asv1_decoder_select="blockdsp bswapdsp idctdsp"
 asv1_encoder_select="bswapdsp fdctdsp pixblockdsp"
 asv2_decoder_select="blockdsp bswapdsp idctdsp"
-- 
2.15.0

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


Re: [FFmpeg-devel] [PATCH] configure: add audio_frame_queue dependency for aptx codec

2017-11-19 Thread Jan Ekstrom
On Sun, Nov 19, 2017 at 4:01 PM, James Darnley  wrote:
> ---
>  configure | 2 ++
>  1 file changed, 2 insertions(+)
>

LGTM, fixes shared linkage reported on IRC.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] order T-shirts

2017-11-19 Thread Thilo Borgmann
Hi,

>> My suggestion would be, that we could order Thomas' design for all
>> the developers and requests I've recieved by now and that we take
>> Lou's for our stock for give-aways during conferences. Just my
>> thinking...
> 
> no further comments so I did order alike. Should recieve them next week and 
> the first of you will have their shirts soon thereafter.

today, all shirts are ready for shipping. I'll send them away early next week.

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


[FFmpeg-devel] [PATCH] avfilter/avfiltergraph: pass correct audio/video flags

2017-11-19 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/avfiltergraph.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index a009e0a760..a959a9ef3f 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -43,17 +43,19 @@
 #include "thread.h"
 
 #define OFFSET(x) offsetof(AVFilterGraph, x)
-#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
+#define F AV_OPT_FLAG_FILTERING_PARAM
+#define V AV_OPT_FLAG_VIDEO_PARAM
+#define A AV_OPT_FLAG_AUDIO_PARAM
 static const AVOption filtergraph_options[] = {
 { "thread_type", "Allowed thread types", OFFSET(thread_type), 
AV_OPT_TYPE_FLAGS,
-{ .i64 = AVFILTER_THREAD_SLICE }, 0, INT_MAX, FLAGS, "thread_type" },
-{ "slice", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVFILTER_THREAD_SLICE 
}, .flags = FLAGS, .unit = "thread_type" },
+{ .i64 = AVFILTER_THREAD_SLICE }, 0, INT_MAX, F|V|A, "thread_type" },
+{ "slice", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVFILTER_THREAD_SLICE 
}, .flags = F|V|A, .unit = "thread_type" },
 { "threads", "Maximum number of threads", OFFSET(nb_threads),
-AV_OPT_TYPE_INT,   { .i64 = 0 }, 0, INT_MAX, FLAGS },
+AV_OPT_TYPE_INT,   { .i64 = 0 }, 0, INT_MAX, F|V|A },
 {"scale_sws_opts"   , "default scale filter options", 
OFFSET(scale_sws_opts),
-AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
+AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, F|V },
 {"aresample_swr_opts"   , "default aresample filter options", 
OFFSET(aresample_swr_opts),
-AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
+AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, F|A },
 { NULL },
 };
 
-- 
2.11.0

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


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

2017-11-19 Thread Rafal Dabrowa

On 11/18/2017 07:41 PM, James Almer wrote:

On 11/18/2017 3:31 PM, Rostislav Pehlivanov wrote:



On 18 November 2017 at 17:35, Rafal Dabrowa  wrote:

This is a proposal of performance optimizations for 8-bit
hevc video decoding on aarch64 platform with neon (simd) extension.

I'm testing my optimizations on NanoPi M3 device. I'm using
mainly "Big Buck Bunny" video file in format 1280x720 for testing.
The video file was pulled from libde265.org page, see
http://www.libde265.org/hevc-bitstreams/bbb-1280x720-cfg06.mkv
The movie duration is 00:10:34.53.

Overall performance gain is about 2x. Without optimizations the movie
playback stops in practice after a few seconds. With
optimizations the file is played smoothly 99% of the time.

For performance testing the following command was used:

 time ./ffmpeg -hide_banner -i ~/bbb-1280x720-cfg06.mkv -f yuv4mpegpipe
- >/dev/null

The video file was pre-read before test to minimize disk reads during
testing.
Program execution time without optimization was as follows:

real11m48.576s
user43m8.111s
sys 0m12.469s

Execution time with optimizations:

real6m17.046s
user21m19.792s
sys 0m14.724s


The patch contains optimizations for most heavily used qpel, epel, sao and
idct
functions.  Among the functions provided for optimization there are two
intensively used, but not optimized in this patch:
hevc_v_loop_filter_luma_8
and hevc_h_loop_filter_luma_8. I have no idea how they could be optimized
hence I leaved them without optimizations.



Signed-off-by: Rafal Dabrowa 
---
  libavcodec/aarch64/Makefile   |5 +
  libavcodec/aarch64/hevcdsp_epel_8.S   | 3949 
  libavcodec/aarch64/hevcdsp_idct_8.S   | 1980 ++
  libavcodec/aarch64/hevcdsp_init_aarch64.c |  170 +
  libavcodec/aarch64/hevcdsp_qpel_8.S   | 5666
+
  libavcodec/aarch64/hevcdsp_sao_8.S|  166 +
  libavcodec/hevcdsp.c  |2 +
  libavcodec/hevcdsp.h  |1 +
  8 files changed, 11939 insertions(+)
  create mode 100644 libavcodec/aarch64/hevcdsp_epel_8.S
  create mode 100644 libavcodec/aarch64/hevcdsp_idct_8.S
  create mode 100644 libavcodec/aarch64/hevcdsp_init_aarch64.c
  create mode 100644 libavcodec/aarch64/hevcdsp_qpel_8.S
  create mode 100644 libavcodec/aarch64/hevcdsp_sao_8.S



Very nice.
The way we test SIMD is to put START_TIMER("function_name"); and
STOP_TIMER; (they're located in libavutil/timer.h) around where the
function gets called in the C code, then we do a run with the C code (no
SIMD) and a separate run with whatever SIMD optimizations we're
implementing. We take the last printed value of both runs and that's what's
used to measure speedup.

I don't think there's a need to split the patch into multiple patches for
each idividual version though yet, that's usually only done if some
function's C implementation is faster than the SIMD code.

It would be nice however to at least split it into two patches, one for
MC and one for SAO.

Could you explain whose functions are MC?

I can split patch into a few, but dependency between patches
is unavoidable because the non-optimized function pointers are
replaced with optimized all together, in one function body.
One of the patches must add the function and must add the function call.


Also, no way to use macros in aarch64 asm files? ~11k lines of code is a
lot to add, and I'm sure a sizable portion is duplicated with only some
small differences between functions.

I used macros sparingly because code without macros is
easier to understand and to improve. Sometimes even order
of assembly instructions is important. But, of course, I can reduce
the code size using macros if the patch will be accepted. I didn't know
whether you are interested with the patch at all.


Regarding performance testing. I wrapped every function with another
one, which calls START_TIMER and STOP_TIMER. It looks these macros
aren't reentrant, I needed to force the program to run in single thread.
Without this I had strange results, very differing between runs, for 
example:


22190 UNITS in put_hevc_qpel_uni_h12_8,   16232 runs,    152 skips
1126 UNITS in put_hevc_qpel_uni_h12_8,   12001 runs,   4383 skips

Force to run in single-threaded mode was not easy, the -filter_threads
option didn't help.

Below is the outcome. Meaning of the columns:

FUNCTION - the function to optimize
UNITS_NOOPT - last UNITS result in run without optimization
OPT - last UNITS result in run with optimization
CALLS - sum of runs and skips
NSKIPS - number of skips in non-optimized version
OSKIPS - number of skips in optimized version


FUNCTION UNITS_NOOPT  OPT CALLS   NSKIPS OSKIPS
-
idct_16x16_8  113074    24079   2097152 0    0
idct_32x32_8  587447   100434    524288 0    0
put_hevc_epel_bi_h4_8   7651 36

Re: [FFmpeg-devel] [PATCH] avfilter/avfiltergraph: pass correct audio/video flags

2017-11-19 Thread Nicolas George
Le nonidi 29 brumaire, an CCXXVI, Paul B Mahol a écrit :
> Signed-off-by: Paul B Mahol 
> ---
>  libavfilter/avfiltergraph.c | 14 --
>  1 file changed, 8 insertions(+), 6 deletions(-)

LGTM. Maybe add in the commit message the real reason for the change
(a flag that was previously ignored?).

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-19 Thread Nicolas George
Le septidi 27 brumaire, an CCXXVI, Paul B Mahol a écrit :
> Signed-off-by: Paul B Mahol 
> ---
>  doc/filters.texi  |  4 
>  libavfilter/vf_tile.c | 18 +-
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 5d99437871..7eeeafab8e 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -14461,6 +14461,10 @@ is "black".
>  @item overlap
>  Set the number of frames to overlap when tiling several successive frames 
> together.
>  The value must be between @code{0} and @var{nb_frames - 1}.
> +
> +@item queue
> +Set the number of frames to initially queue when displaying first frame.
> +The value must be between @code{0} and @var{nb_frames}.
>  @end table

Queue where? To do what later, and when?

I cannot determine what this option is supposed to do, even with a quick
glance at the code, so I guess a normal user would be completely
baffled.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH 2/3] avfilter/vf_cropdetect: don't ignore frames, export crop parameters

2017-11-19 Thread Nicolas George
Le septidi 27 brumaire, an CCXXVI, Aman Gupta a écrit :
> From: Aman Gupta 
> 
> ---
>  libavfilter/vf_cropdetect.c | 9 +++--
>  1 file changed, 7 insertions(+), 2 deletions(-)

I think the changes belong in different commits, since they both change
the behaviour of the filter in different ways.

I cannot comment on the frame_nb change.

Regarding the frame crop change, I am quite doubtful: filters currently
do not handle these fields at all, yet they are copied automatically in
many cases. I am rather against adding an isolated change like that,
unless there is a clear and obvious use case.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] fix bug in af_pan channel coefficient parser

2017-11-19 Thread Nicolas George
L'octidi 28 brumaire, an CCXXVI, Michael Roitzsch a écrit :
> Hi FFmpeg team,
> 
> I was using af_pan to subtract one audio file from another. I first used an 
> amerge filter and then configured the pan filter with a channel formula like 
> c0=c0-c2|c1=c1-c3.
> 
> However, this does not work as expected. In debug output, I can see that 
> channel 0 correctly uses gain coefficients 1 and -1 for c0 and c2. But 
> channel 1 incorrectly uses -1 and -1 for c1 and c3.
> 
> I looked into the code and found that the sign handling is currently wrong. 
> When the last contribution of a formula is subtracted, the sign variable will 
> be correctly set to -1 in line 191. But when then leaving the gains loop in 
> line 189, because we reached the end of the formula for an output channel, 
> sign is not reset. We therefore re-enter the gains loop for the next output 
> channel with sign still -1. The first gain in this new formula will therefore 
> be negated.
> 
> The attached patch fixes the problem for me.

Thanks, applied.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-19 Thread Paul B Mahol
On 11/19/17, Nicolas George  wrote:
> Le septidi 27 brumaire, an CCXXVI, Paul B Mahol a ecrit :
>> Signed-off-by: Paul B Mahol 
>> ---
>>  doc/filters.texi  |  4 
>>  libavfilter/vf_tile.c | 18 +-
>>  2 files changed, 21 insertions(+), 1 deletion(-)
>>
>> diff --git a/doc/filters.texi b/doc/filters.texi
>> index 5d99437871..7eeeafab8e 100644
>> --- a/doc/filters.texi
>> +++ b/doc/filters.texi
>> @@ -14461,6 +14461,10 @@ is "black".
>>  @item overlap
>>  Set the number of frames to overlap when tiling several successive frames
>> together.
>>  The value must be between @code{0} and @var{nb_frames - 1}.
>> +
>> +@item queue
>> +Set the number of frames to initially queue when displaying first frame.
>> +The value must be between @code{0} and @var{nb_frames}.
>>  @end table
>
> Queue where? To do what later, and when?
>
> I cannot determine what this option is supposed to do, even with a quick
> glance at the code, so I guess a normal user would be completely
> baffled.

It allows user to start outputing video frames immediately with first
input frame.
Instead of after nb_frames.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-19 Thread Nicolas George
Le nonidi 29 brumaire, an CCXXVI, Paul B Mahol a écrit :
> It allows user to start outputing video frames immediately with first
> input frame.
> Instead of after nb_frames.

I think I understand what it means, but only because I have read the
code, and even like that I am not entirely sure. This needs to be made
clearer, enough for somebody who does not know the code, and go to the
documentation part of the patch.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] avformat/subfile: allow to extract till EOF

2017-11-19 Thread Nicolas George
Le quintidi 25 brumaire, an CCXXVI, Gyan Doshi a écrit :
> Disregard patch in first message. Didn't remove residue of aborted doc
> change earlier.

Patch applied. Thanks.

Regards,

-- 
  Nicolas George


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


[FFmpeg-devel] [PATCH] configure: fix module dependencies on zlib

2017-11-19 Thread James Almer
select should not be used with external libraries. It's mean to soft
enable internal modules/features.

Signed-off-by: James Almer 
---
 configure | 48 ++--
 1 file changed, 26 insertions(+), 22 deletions(-)

diff --git a/configure b/configure
index 8b7b7e164b..87a40e740b 100755
--- a/configure
+++ b/configure
@@ -2437,8 +2437,9 @@ amrwb_decoder_select="lsp"
 amv_decoder_select="sp5x_decoder exif"
 amv_encoder_select="aandcttables jpegtables mpegvideoenc"
 ape_decoder_select="bswapdsp llauddsp"
-apng_decoder_select="zlib"
-apng_encoder_select="llvidencdsp zlib"
+apng_decoder_deps="zlib"
+apng_encoder_deps="zlib"
+apng_encoder_select="llvidencdsp"
 asv1_decoder_select="blockdsp bswapdsp idctdsp"
 asv1_encoder_select="bswapdsp fdctdsp pixblockdsp"
 asv2_decoder_select="blockdsp bswapdsp idctdsp"
@@ -2465,14 +2466,14 @@ dnxhd_encoder_select="aandcttables blockdsp fdctdsp 
idctdsp mpegvideoenc pixbloc
 dolby_e_decoder_select="mdct"
 dvvideo_decoder_select="dvprofile idctdsp"
 dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
-dxa_decoder_select="zlib"
+dxa_decoder_deps="zlib"
 dxv_decoder_select="lzf texturedsp"
 eac3_decoder_select="ac3_decoder"
 eac3_encoder_select="ac3_encoder"
 eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo"
 eatgq_decoder_select="aandcttables"
 eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
-exr_decoder_select="zlib"
+exr_decoder_deps="zlib"
 ffv1_decoder_select="rangecoder"
 ffv1_encoder_select="rangecoder"
 ffvhuff_decoder_select="huffyuv_decoder"
@@ -2480,15 +2481,16 @@ ffvhuff_encoder_select="huffyuv_encoder"
 fic_decoder_select="golomb"
 flac_decoder_select="flacdsp"
 flac_encoder_select="bswapdsp flacdsp lpc"
-flashsv2_decoder_select="zlib"
-flashsv2_encoder_select="zlib"
-flashsv_decoder_select="zlib"
-flashsv_encoder_select="zlib"
+flashsv2_decoder_deps="zlib"
+flashsv2_encoder_deps="zlib"
+flashsv_decoder_deps="zlib"
+flashsv_encoder_deps="zlib"
 flv_decoder_select="h263_decoder"
 flv_encoder_select="h263_encoder"
 fourxm_decoder_select="blockdsp bswapdsp"
 fraps_decoder_select="bswapdsp huffman"
-g2m_decoder_select="blockdsp idctdsp jpegtables zlib"
+g2m_decoder_deps="zlib"
+g2m_decoder_select="blockdsp idctdsp jpegtables"
 g729_decoder_select="audiodsp"
 h261_decoder_select="mpegvideo"
 h261_encoder_select="aandcttables mpegvideoenc"
@@ -2546,7 +2548,7 @@ mpeg2video_encoder_select="aandcttables mpegvideoenc 
h263dsp"
 mpeg4_decoder_select="h263_decoder mpeg4video_parser"
 mpeg4_encoder_select="h263_encoder"
 msa1_decoder_select="mss34dsp"
-mscc_decoder_select="zlib"
+mscc_decoder_deps="zlib"
 msmpeg4v1_decoder_select="h263_decoder"
 msmpeg4v2_decoder_select="h263_decoder"
 msmpeg4v2_encoder_select="h263_encoder"
@@ -2562,8 +2564,9 @@ on2avc_decoder_select="mdct"
 opus_decoder_deps="swresample"
 opus_decoder_select="mdct15"
 opus_encoder_select="audio_frame_queue mdct15"
-png_decoder_select="zlib"
-png_encoder_select="llvidencdsp zlib"
+png_decoder_deps="zlib"
+png_encoder_deps="zlib"
+png_encoder_select="llvidencdsp"
 prores_decoder_select="blockdsp idctdsp"
 prores_encoder_select="fdctdsp"
 qcelp_decoder_select="lsp"
@@ -2572,7 +2575,7 @@ ra_144_decoder_select="audiodsp"
 ra_144_encoder_select="audio_frame_queue lpc audiodsp"
 ralf_decoder_select="golomb"
 rawvideo_decoder_select="bswapdsp"
-rscc_decoder_select="zlib"
+rscc_decoder_deps="zlib"
 rtjpeg_decoder_select="me_cmp"
 rv10_decoder_select="h263_decoder"
 rv10_encoder_select="h263_encoder"
@@ -2580,7 +2583,7 @@ rv20_decoder_select="h263_decoder"
 rv20_encoder_select="h263_encoder"
 rv30_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
 rv40_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
-screenpresso_decoder_select="zlib"
+screenpresso_decoder_deps="zlib"
 shorten_decoder_select="bswapdsp"
 sipr_decoder_select="lsp"
 snow_decoder_select="dwt h264qpel hpeldsp me_cmp rangecoder videodsp"
@@ -2589,13 +2592,14 @@ sonic_decoder_select="golomb rangecoder"
 sonic_encoder_select="golomb rangecoder"
 sonic_ls_encoder_select="golomb rangecoder"
 sp5x_decoder_select="mjpeg_decoder"
-srgc_decoder_select="zlib"
+srgc_decoder_deps="zlib"
 svq1_decoder_select="hpeldsp"
 svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc"
 svq3_decoder_select="golomb h264dsp h264parse h264pred hpeldsp tpeldsp 
videodsp"
 svq3_decoder_suggest="zlib"
 tak_decoder_select="audiodsp"
-tdsc_decoder_select="zlib mjpeg_decoder"
+tdsc_decoder_deps="zlib"
+tdsc_decoder_select="mjpeg_decoder"
 theora_decoder_select="vp3_decoder"
 thp_decoder_select="mjpeg_decoder"
 tiff_decoder_suggest="zlib lzma"
@@ -2604,7 +2608,7 @@ truehd_decoder_select="mlp_parser"
 truehd_encoder_select="lpc"
 truemotion2_decoder_select="bswapdsp"
 truespeech_decoder_select="bswapdsp"
-tscc_decoder_select="zlib"
+tscc_decoder_deps="zlib"
 twinvq_decoder_select="mdct lsp sinewin"
 txd_decoder_select="texturedsp"
 utvideo_decoder_select="bswapdsp llviddsp"
@@ -2638,

Re: [FFmpeg-devel] [PATCH 1/1] avdevice/decklink_dec: Autodetect the video input format

2017-11-19 Thread Marton Balint


On Thu, 16 Nov 2017, Jeyapal, Karthick wrote:


On 11/16/17, 1:11 AM, "Marton Balint"  wrote:


Thanks for the reply.


For the first patch, I think you forgot to call ff_decklink_set_configs in
decklink_enc.

ff_decklink_set_configs is not doing anything related to decklink_enc
In any case I have added the same and have attached the new patch


For the second patch here are some comments:

I have done all suggested modifications and the new patch is attached.


Thanks, there is one more thing I still don't get:

[...]


-static HRESULT decklink_start_input(AVFormatContext *avctx)
-{
-struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
+static int decklink_autodetect(struct decklink_cctx *cctx) {
 struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
+DECKLINK_BOOL autodetect_supported = false;
+int i;
+
+if (ctx->attr->GetFlag(BMDDeckLinkSupportsInputFormatDetection, 
&autodetect_supported) != S_OK)
+return -1;
+if (autodetect_supported == false)
+return -1;
+
+ctx->autodetect = 1;
+ctx->bmd_mode  = bmdModeUnknown;
+if (ctx->dli->EnableVideoInput(AUTODETECT_DEFAULT_MODE,
+   bmdFormat8BitYUV,
+   bmdVideoInputEnableFormatDetection) != 
S_OK) {
+return -1;
+}
+
+if (ctx->dli->StartStreams() != S_OK) {
+return -1;
+}
+
+// 1 second timeout
+for (i = 0; i < 10; i++) {
+av_usleep(10);
+// Sometimes VideoInputFrameArrived is called before 
VideoInputFormatChanged
+// So don't break for bmd_mode == AUTODETECT_DEFAULT_MODE


Even if you get a frame for the default mode, and 
VideoInputFrameArrived is called early, the bmdFrameHasNoInputSource 
flag should be set, so ctx->bmd_mode remains unknown, therefore you don't 
have to handle it specially.


Are you saying that the Decklink drivers are buggy, and there are cases 
where you get a frame without the bmdFrameHasNoInputSource flag, and then 
a VideoInputFormatChanged callback later?



+if (ctx->bmd_mode != bmdModeUnknown &&
+ctx->bmd_mode != AUTODETECT_DEFAULT_MODE)
+break;
+}
+


[...]

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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-19 Thread Paul B Mahol
On 11/19/17, Nicolas George  wrote:
> Le nonidi 29 brumaire, an CCXXVI, Paul B Mahol a ecrit :
>> It allows user to start outputing video frames immediately with first
>> input frame.
>> Instead of after nb_frames.
>
> I think I understand what it means, but only because I have read the
> code, and even like that I am not entirely sure. This needs to be made
> clearer, enough for somebody who does not know the code, and go to the
> documentation part of the patch.

So what you propose?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-19 Thread Nicolas George
Paul B Mahol (2017-11-19):
> So what you propose?

I do not know. It is your patch, and I am not even sure I understood
your explanation correctly.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [DEVEL][PATCH 1/2] ffmpeg: add ui64 type to SpecifierOpt

2017-11-19 Thread Michael Niedermayer
On Sun, Nov 19, 2017 at 11:01:33AM +0100, pkv.stream wrote:
> Hi Michael
> 
> >>Tell me the best course; or if you see a way to make my
> >>MATCH_PER_STREAM_OPT() code less hacky.
> >iam sure theres a way to do this less hacky
> >why do you need a 2nd table ? or rather why does it not work if you
> >put the entry in the main table ? (so there are 2 entries one for
> >OPT_SPEC and one for teh callback, will it not send the data to both
> >matching entries ?
> >
> >
> >
> >>Regards
> >>
> >>>[...]
> >>>
> >>>
> >>>___
> >>>ffmpeg-devel mailing list
> >>>ffmpeg-devel@ffmpeg.org
> >>>http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >>
> >>  cmdutils.h   |1 +
> >>  ffmpeg.h |3 +++
> >>  ffmpeg_opt.c |   41 +
> >>  3 files changed, 41 insertions(+), 4 deletions(-)
> >>7c1249f0cb4daa1aebbf94b0e785e644997f754a  0001-ffmpeg-fix-ticket-6706.patch
> >> From 00c3c724544b16c19282b39644e2584f9c4a4181 Mon Sep 17 00:00:00 2001
> >>From: pkviet 
> >>Date: Sat, 18 Nov 2017 00:26:50 +0100
> >>Subject: [PATCH] ffmpeg: fix ticket 6706
> >>
> >>Fix regression with channel_layout option which is not passed
> >>correctly from output streams to filters when the channel layout is not
> >>a default one.
> >>---
> >>  fftools/cmdutils.h   |  1 +
> >>  fftools/ffmpeg.h |  3 +++
> >>  fftools/ffmpeg_opt.c | 41 +
> >>  3 files changed, 41 insertions(+), 4 deletions(-)
> >>
> >>diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
> >>index 2997ee3..fa2b255 100644
> >>--- a/fftools/cmdutils.h
> >>+++ b/fftools/cmdutils.h
> >>@@ -155,6 +155,7 @@ typedef struct SpecifierOpt {
> >>  uint8_t *str;
> >>  inti;
> >>  int64_t  i64;
> >>+uint64_t ui64;
> >>  float  f;
> >>  double   dbl;
> >>  } u;
> >please split this in a seperate patch
> >
> >
> 
> done.
> I've split previous patch for channel_layout bug as requested and
> put the new OPT_SPEC channel layout option in main OptionDef.
> patch 1/2 : adds a uint64_t type to SpecifierOpt ; useful for next
> patch of the series (this is not absolutely necessary but avoids
> memcpy back and forth between int64 and uint64, and reads cleaner)
> patch 2/2: fixes ticket 6706 (channel_layout option not passed
> correctly from output stream to filters for non-default layouts)
> 
> Regards
> 

>  cmdutils.h |1 +
>  1 file changed, 1 insertion(+)
> ed22171a08ed07b1aafd50d887eecfd70360751c  
> 0001-ffmpeg-add-ui64-type-to-SpecifierOpt.patch
> From 550c6410e06f36f8d1dce68c11cc53ebd58f3568 Mon Sep 17 00:00:00 2001
> From: pkviet 
> Date: Sat, 18 Nov 2017 22:19:46 +0100
> Subject: [PATCH 1/2] ffmpeg: add ui64 type to SpecifierOpt
> 
>  Adds ui64 (uint64_t) as a possible type for SpecifierOpt. This enables
>  use of uint64_t options with SpecifierOpt such as channel_layout
>  when expressed as a 64 bit channel mask.
> 
> Signed-off-by: pkviet 
> ---
>  fftools/cmdutils.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
> index 2997ee3..fa2b255 100644
> --- a/fftools/cmdutils.h
> +++ b/fftools/cmdutils.h
> @@ -155,6 +155,7 @@ typedef struct SpecifierOpt {
>  uint8_t *str;
>  inti;
>  int64_t  i64;
> +uint64_t ui64;
>  float  f;
>  double   dbl;
>  } u;

will apply

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [DEVEL][PATCH 2/2] ffmpeg: fix ticket 6706

2017-11-19 Thread Michael Niedermayer
On Sun, Nov 19, 2017 at 11:01:37AM +0100, pkv.stream wrote:
[...]

> @@ -3674,6 +3697,10 @@ const OptionDef options[] = {
>  { "channel_layout", OPT_AUDIO | HAS_ARG  | OPT_EXPERT | OPT_PERFILE |
>  OPT_INPUT | OPT_OUTPUT,  
>   { .func_arg = opt_channel_layout },
>  "set channel layout", "layout" },
> +{ "channel_layout_uint64", OPT_AUDIO | HAS_ARG | OPT_INT64 | OPT_SPEC |

i mean as "channel_layout"
does it work with both using the same name so the option is routed
to both the field and callback or am i missing something why this is
not intended?

[...]

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


[FFmpeg-devel] [PATCH 1/3] avcodec: Refactor common nvdec hwaccel logic

2017-11-19 Thread Philip Langdale
The 'simple' hwaccels (not h.264 and hevc) all use the same bitstream
management and reference lookup logic so let's refactor all that into
common functions.

I verified that casting a signed int -1 to unsigned char produces 255
according to the C language specification.

Signed-off-by: Philip Langdale 
---
 libavcodec/nvdec.c| 46 +++
 libavcodec/nvdec.h|  4 
 libavcodec/nvdec_mpeg12.c | 53 -
 libavcodec/nvdec_vc1.c| 55 ++-
 libavcodec/nvdec_vp9.c| 53 +
 5 files changed, 65 insertions(+), 146 deletions(-)

diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
index 3d62840e9f..97ff605f0f 100644
--- a/libavcodec/nvdec.c
+++ b/libavcodec/nvdec.c
@@ -475,6 +475,36 @@ finish:
 return ret;
 }
 
+int ff_nvdec_simple_end_frame(AVCodecContext *avctx)
+{
+NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
+int ret = ff_nvdec_end_frame(avctx);
+ctx->bitstream = NULL;
+return ret;
+}
+
+int ff_nvdec_simple_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
+ uint32_t size)
+{
+NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
+void *tmp;
+
+tmp = av_fast_realloc(ctx->slice_offsets, &ctx->slice_offsets_allocated,
+  (ctx->nb_slices + 1) * sizeof(*ctx->slice_offsets));
+if (!tmp)
+return AVERROR(ENOMEM);
+ctx->slice_offsets = tmp;
+
+if (!ctx->bitstream)
+ctx->bitstream = (uint8_t*)buffer;
+
+ctx->slice_offsets[ctx->nb_slices] = buffer - ctx->bitstream;
+ctx->bitstream_len += size;
+ctx->nb_slices++;
+
+return 0;
+}
+
 int ff_nvdec_frame_params(AVCodecContext *avctx,
   AVBufferRef *hw_frames_ctx,
   int dpb_size)
@@ -520,3 +550,19 @@ int ff_nvdec_frame_params(AVCodecContext *avctx,
 
 return 0;
 }
+
+int ff_nvdec_get_ref_idx(AVFrame *frame)
+{
+FrameDecodeData *fdd;
+NVDECFrame *cf;
+
+if (!frame || !frame->private_ref)
+return -1;
+
+fdd = (FrameDecodeData*)frame->private_ref->data;
+cf  = (NVDECFrame*)fdd->hwaccel_priv;
+if (!cf)
+return -1;
+
+return cf->idx;
+}
diff --git a/libavcodec/nvdec.h b/libavcodec/nvdec.h
index 14d29ee94b..90578d5a1c 100644
--- a/libavcodec/nvdec.h
+++ b/libavcodec/nvdec.h
@@ -58,8 +58,12 @@ int ff_nvdec_decode_init(AVCodecContext *avctx);
 int ff_nvdec_decode_uninit(AVCodecContext *avctx);
 int ff_nvdec_start_frame(AVCodecContext *avctx, AVFrame *frame);
 int ff_nvdec_end_frame(AVCodecContext *avctx);
+int ff_nvdec_simple_end_frame(AVCodecContext *avctx);
+int ff_nvdec_simple_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
+ uint32_t size);
 int ff_nvdec_frame_params(AVCodecContext *avctx,
   AVBufferRef *hw_frames_ctx,
   int dpb_size);
+int ff_nvdec_get_ref_idx(AVFrame *frame);
 
 #endif /* AVCODEC_NVDEC_H */
diff --git a/libavcodec/nvdec_mpeg12.c b/libavcodec/nvdec_mpeg12.c
index 127e843d85..db9cebeddd 100644
--- a/libavcodec/nvdec_mpeg12.c
+++ b/libavcodec/nvdec_mpeg12.c
@@ -25,22 +25,6 @@
 #include "nvdec.h"
 #include "decode.h"
 
-static int get_ref_idx(AVFrame *frame)
-{
-FrameDecodeData *fdd;
-NVDECFrame *cf;
-
-if (!frame || !frame->private_ref)
-return -1;
-
-fdd = (FrameDecodeData*)frame->private_ref->data;
-cf  = (NVDECFrame*)fdd->hwaccel_priv;
-if (!cf)
-return -1;
-
-return cf->idx;
-}
-
 static int nvdec_mpeg12_start_frame(AVCodecContext *avctx, const uint8_t 
*buffer, uint32_t size)
 {
 MpegEncContext *s = avctx->priv_data;
@@ -71,8 +55,8 @@ static int nvdec_mpeg12_start_frame(AVCodecContext *avctx, 
const uint8_t *buffer
  s->pict_type == AV_PICTURE_TYPE_P,
 
 .CodecSpecific.mpeg2 = {
-.ForwardRefIdx = get_ref_idx(s->last_picture.f),
-.BackwardRefIdx= get_ref_idx(s->next_picture.f),
+.ForwardRefIdx = ff_nvdec_get_ref_idx(s->last_picture.f),
+.BackwardRefIdx= ff_nvdec_get_ref_idx(s->next_picture.f),
 
 .picture_coding_type= s->pict_type,
 .full_pel_forward_vector= s->full_pel[0],
@@ -99,35 +83,6 @@ static int nvdec_mpeg12_start_frame(AVCodecContext *avctx, 
const uint8_t *buffer
 return 0;
 }
 
-static int nvdec_mpeg12_end_frame(AVCodecContext *avctx)
-{
-NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
-int ret = ff_nvdec_end_frame(avctx);
-ctx->bitstream = NULL;
-return ret;
-}
-
-static int nvdec_mpeg12_decode_slice(AVCodecContext *avctx, const uint8_t 
*buffer, uint32_t size)
-{
-NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
-void *tmp;
-
-tmp = av_fast_realloc(ctx->slice_offsets, &ctx->slice_offsets_allocated,
- 

[FFmpeg-devel] [PATCH 0/3] nvdec hwaccels for mpeg1 and mpeg4

2017-11-19 Thread Philip Langdale
Consolidating the existing outstanding patches along with a new mpeg4 patch.

I have working vp8 and mjpeg implementations waiting in the hwaccel hooks
getting merged.

Philip Langdale (3):
  avcodec: Refactor common nvdec hwaccel logic
  avcodec: Implement mpeg1 nvdec hwaccel
  avcodec: Implement mpeg4 nvdec hwaccel

 Changelog |   2 +-
 configure |   4 ++
 libavcodec/Makefile   |   2 +
 libavcodec/allcodecs.c|   2 +
 libavcodec/h263dec.c  |   3 ++
 libavcodec/mpeg12dec.c|   3 ++
 libavcodec/nvdec.c|  48 ++
 libavcodec/nvdec.h|   4 ++
 libavcodec/nvdec_mpeg12.c |  71 ---
 libavcodec/nvdec_mpeg4.c  | 121 ++
 libavcodec/nvdec_vc1.c|  55 +++--
 libavcodec/nvdec_vp9.c|  53 ++--
 libavcodec/version.h  |   2 +-
 13 files changed, 221 insertions(+), 149 deletions(-)
 create mode 100644 libavcodec/nvdec_mpeg4.c

-- 
2.14.1

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


[FFmpeg-devel] [PATCH 2/3] avcodec: Implement mpeg1 nvdec hwaccel

2017-11-19 Thread Philip Langdale
Once I remembered that there's a separate decoder type for mpeg1,
even though params struct is shared with mpeg2, everything worked.

Signed-off-by: Philip Langdale 
---
 Changelog |  2 +-
 configure |  2 ++
 libavcodec/Makefile   |  1 +
 libavcodec/allcodecs.c|  1 +
 libavcodec/mpeg12dec.c|  3 +++
 libavcodec/nvdec.c|  1 +
 libavcodec/nvdec_mpeg12.c | 18 +-
 libavcodec/version.h  |  2 +-
 8 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/Changelog b/Changelog
index e1f8a648b0..5a9d183aed 100644
--- a/Changelog
+++ b/Changelog
@@ -13,7 +13,7 @@ version :
 - PCE support for extended channel layouts in the AAC encoder
 - native aptX encoder and decoder
 - Raw aptX muxer and demuxer
-- NVIDIA NVDEC-accelerated H.264, HEVC, MPEG-2, VC1 and VP9 hwaccel decoding
+- NVIDIA NVDEC-accelerated H.264, HEVC, MPEG-1/2, VC1 and VP9 hwaccel decoding
 - Intel QSV-accelerated overlay filter
 - mcompand audio filter
 - acontrast audio filter
diff --git a/configure b/configure
index 48761934be..35713805fa 100755
--- a/configure
+++ b/configure
@@ -2700,6 +2700,8 @@ mjpeg_cuvid_hwaccel_select="mjpeg_cuvid_decoder"
 mpeg_xvmc_hwaccel_deps="xvmc"
 mpeg_xvmc_hwaccel_select="mpeg2video_decoder"
 mpeg1_cuvid_hwaccel_select="mpeg1_cuvid_decoder"
+mpeg1_nvdec_hwaccel_deps="nvdec"
+mpeg1_nvdec_hwaccel_select="mpeg1video_decoder"
 mpeg1_vdpau_hwaccel_deps="vdpau"
 mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
 mpeg1_videotoolbox_hwaccel_deps="videotoolbox"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 494c76da76..0573454c7b 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -849,6 +849,7 @@ OBJS-$(CONFIG_HEVC_NVDEC_HWACCEL) += nvdec_hevc.o
 OBJS-$(CONFIG_HEVC_QSV_HWACCEL)   += qsvdec_h2645.o
 OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += vaapi_hevc.o
 OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) += vdpau_hevc.o
+OBJS-$(CONFIG_MPEG1_NVDEC_HWACCEL)+= nvdec_mpeg12.o
 OBJS-$(CONFIG_MPEG1_VDPAU_HWACCEL)+= vdpau_mpeg12.o
 OBJS-$(CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
 OBJS-$(CONFIG_MPEG1_XVMC_HWACCEL) += mpegvideo_xvmc.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index e0adb71951..e9df7049de 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -87,6 +87,7 @@ static void register_all(void)
 REGISTER_HWACCEL(HEVC_VIDEOTOOLBOX, hevc_videotoolbox);
 REGISTER_HWACCEL(MJPEG_CUVID,   mjpeg_cuvid);
 REGISTER_HWACCEL(MPEG1_CUVID,   mpeg1_cuvid);
+REGISTER_HWACCEL(MPEG1_NVDEC,   mpeg1_nvdec);
 REGISTER_HWACCEL(MPEG1_XVMC,mpeg1_xvmc);
 REGISTER_HWACCEL(MPEG1_VDPAU,   mpeg1_vdpau);
 REGISTER_HWACCEL(MPEG1_VIDEOTOOLBOX, mpeg1_videotoolbox);
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 2b213eebcd..5a51d09bb0 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1130,6 +1130,9 @@ static void quant_matrix_rebuild(uint16_t *matrix, const 
uint8_t *old_perm,
 }
 
 static const enum AVPixelFormat mpeg1_hwaccel_pixfmt_list_420[] = {
+#if CONFIG_MPEG1_NVDEC_HWACCEL
+AV_PIX_FMT_CUDA,
+#endif
 #if CONFIG_MPEG1_XVMC_HWACCEL
 AV_PIX_FMT_XVMC,
 #endif
diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
index 97ff605f0f..d5cf1058cb 100644
--- a/libavcodec/nvdec.c
+++ b/libavcodec/nvdec.c
@@ -54,6 +54,7 @@ static int map_avcodec_id(enum AVCodecID id)
 switch (id) {
 case AV_CODEC_ID_H264:   return cudaVideoCodec_H264;
 case AV_CODEC_ID_HEVC:   return cudaVideoCodec_HEVC;
+case AV_CODEC_ID_MPEG1VIDEO: return cudaVideoCodec_MPEG1;
 case AV_CODEC_ID_MPEG2VIDEO: return cudaVideoCodec_MPEG2;
 case AV_CODEC_ID_VC1:return cudaVideoCodec_VC1;
 case AV_CODEC_ID_VP9:return cudaVideoCodec_VP9;
diff --git a/libavcodec/nvdec_mpeg12.c b/libavcodec/nvdec_mpeg12.c
index db9cebeddd..e29d085a79 100644
--- a/libavcodec/nvdec_mpeg12.c
+++ b/libavcodec/nvdec_mpeg12.c
@@ -1,5 +1,5 @@
 /*
- * MPEG-2 HW decode acceleration through NVDEC
+ * MPEG-1/2 HW decode acceleration through NVDEC
  *
  * Copyright (c) 2017 Philip Langdale
  *
@@ -105,3 +105,19 @@ AVHWAccel ff_mpeg2_nvdec_hwaccel = {
 .priv_data_size   = sizeof(NVDECContext),
 };
 #endif
+
+#if CONFIG_MPEG1_NVDEC_HWACCEL
+AVHWAccel ff_mpeg1_nvdec_hwaccel = {
+.name = "mpeg1_nvdec",
+.type = AVMEDIA_TYPE_VIDEO,
+.id   = AV_CODEC_ID_MPEG1VIDEO,
+.pix_fmt  = AV_PIX_FMT_CUDA,
+.start_frame  = nvdec_mpeg12_start_frame,
+.end_frame= ff_nvdec_simple_end_frame,
+.decode_slice = ff_nvdec_simple_decode_slice,
+.frame_params = nvdec_mpeg12_frame_params,
+.init = ff_nvdec_decode_init,
+.uninit   = ff_nvdec_decode_uninit,
+.priv_data_size   = sizeof(NVDECContext),
+};
+#endif
diff --git a/libavcodec/version.h b/libavcodec/version.h

[FFmpeg-devel] [PATCH 3/3] avcodec: Implement mpeg4 nvdec hwaccel

2017-11-19 Thread Philip Langdale
This was predictably nightmarish, given how ridiculous mpeg4 is.
I had to stare at the cuvid parser output for a long time to work
out what each field was supposed to be, and even then, I still don't
fully understand some of them, particularly:

vop_coded: I think this means whether the vop has a picture shape,
   and therefore a picture type. I have no samples where
   this is not the case.
divx_flags: There's obviously no documentation on what the possible
flags are. I simply observed that this is '0' for a
normal bitstream and '5' for packed b-frames.
gmc_enabled: This seems to map to mc_sel being non-zero, but I also
 have no samples where that is true.

Also note that as with the vdpau hwaccel, the decoder needs to
consume the entire frame and not the slice.

Signed-off-by: Philip Langdale 
---
 Changelog|   2 +-
 configure|   2 +
 libavcodec/Makefile  |   1 +
 libavcodec/allcodecs.c   |   1 +
 libavcodec/h263dec.c |   3 ++
 libavcodec/nvdec.c   |   1 +
 libavcodec/nvdec_mpeg4.c | 121 +++
 libavcodec/version.h |   2 +-
 8 files changed, 131 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/nvdec_mpeg4.c

diff --git a/Changelog b/Changelog
index 5a9d183aed..74ed35cfe6 100644
--- a/Changelog
+++ b/Changelog
@@ -13,7 +13,7 @@ version :
 - PCE support for extended channel layouts in the AAC encoder
 - native aptX encoder and decoder
 - Raw aptX muxer and demuxer
-- NVIDIA NVDEC-accelerated H.264, HEVC, MPEG-1/2, VC1 and VP9 hwaccel decoding
+- NVIDIA NVDEC-accelerated H.264, HEVC, MPEG-1/2/4, VC1 and VP9 hwaccel 
decoding
 - Intel QSV-accelerated overlay filter
 - mcompand audio filter
 - acontrast audio filter
diff --git a/configure b/configure
index 35713805fa..36ccf767dd 100755
--- a/configure
+++ b/configure
@@ -2731,6 +2731,8 @@ mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
 mpeg4_cuvid_hwaccel_select="mpeg4_cuvid_decoder"
 mpeg4_mediacodec_hwaccel_deps="mediacodec"
 mpeg4_mmal_hwaccel_deps="mmal"
+mpeg4_nvdec_hwaccel_deps="nvdec"
+mpeg4_nvdec_hwaccel_select="mpeg4_decoder"
 mpeg4_vaapi_hwaccel_deps="vaapi"
 mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
 mpeg4_vdpau_hwaccel_deps="vdpau"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 0573454c7b..2af957ab72 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -861,6 +861,7 @@ OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL)+= vaapi_mpeg2.o
 OBJS-$(CONFIG_MPEG2_VDPAU_HWACCEL)+= vdpau_mpeg12.o
 OBJS-$(CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
 OBJS-$(CONFIG_MPEG2_XVMC_HWACCEL) += mpegvideo_xvmc.o
+OBJS-$(CONFIG_MPEG4_NVDEC_HWACCEL)+= nvdec_mpeg4.o
 OBJS-$(CONFIG_MPEG4_VAAPI_HWACCEL)+= vaapi_mpeg4.o
 OBJS-$(CONFIG_MPEG4_VDPAU_HWACCEL)+= vdpau_mpeg4.o
 OBJS-$(CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index e9df7049de..85c38c83aa 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -106,6 +106,7 @@ static void register_all(void)
 REGISTER_HWACCEL(MPEG4_CUVID,   mpeg4_cuvid);
 REGISTER_HWACCEL(MPEG4_MEDIACODEC,  mpeg4_mediacodec);
 REGISTER_HWACCEL(MPEG4_MMAL,mpeg4_mmal);
+REGISTER_HWACCEL(MPEG4_NVDEC,   mpeg4_nvdec);
 REGISTER_HWACCEL(MPEG4_VAAPI,   mpeg4_vaapi);
 REGISTER_HWACCEL(MPEG4_VDPAU,   mpeg4_vdpau);
 REGISTER_HWACCEL(MPEG4_VIDEOTOOLBOX, mpeg4_videotoolbox);
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index c7cf4bc0c2..b222de793b 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -714,6 +714,9 @@ const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[] 
= {
 #if CONFIG_H263_VAAPI_HWACCEL || CONFIG_MPEG4_VAAPI_HWACCEL
 AV_PIX_FMT_VAAPI,
 #endif
+#if CONFIG_MPEG4_NVDEC_HWACCEL
+AV_PIX_FMT_CUDA,
+#endif
 #if CONFIG_MPEG4_VDPAU_HWACCEL
 AV_PIX_FMT_VDPAU,
 #endif
diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
index d5cf1058cb..efcd47a7f7 100644
--- a/libavcodec/nvdec.c
+++ b/libavcodec/nvdec.c
@@ -56,6 +56,7 @@ static int map_avcodec_id(enum AVCodecID id)
 case AV_CODEC_ID_HEVC:   return cudaVideoCodec_HEVC;
 case AV_CODEC_ID_MPEG1VIDEO: return cudaVideoCodec_MPEG1;
 case AV_CODEC_ID_MPEG2VIDEO: return cudaVideoCodec_MPEG2;
+case AV_CODEC_ID_MPEG4:  return cudaVideoCodec_MPEG4;
 case AV_CODEC_ID_VC1:return cudaVideoCodec_VC1;
 case AV_CODEC_ID_VP9:return cudaVideoCodec_VP9;
 case AV_CODEC_ID_WMV3:   return cudaVideoCodec_VC1;
diff --git a/libavcodec/nvdec_mpeg4.c b/libavcodec/nvdec_mpeg4.c
new file mode 100644
index 00..be81bd958b
--- /dev/null
+++ b/libavcodec/nvdec_mpeg4.c
@@ -0,0 +1,121 @@
+/*
+ * MPEG-4 Part 2 HW decode acceleration through NVDEC
+ *
+ * Copyright (c) 2017 Philip Langdale
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or

Re: [FFmpeg-devel] [DEVEL][PATCH 2/2] ffmpeg: fix ticket 6706

2017-11-19 Thread pkv.stream

Le 19/11/2017 à 8:28 PM, Michael Niedermayer a écrit :

On Sun, Nov 19, 2017 at 11:01:37AM +0100, pkv.stream wrote:
[...]


@@ -3674,6 +3697,10 @@ const OptionDef options[] = {
  { "channel_layout", OPT_AUDIO | HAS_ARG  | OPT_EXPERT | OPT_PERFILE |
  OPT_INPUT | OPT_OUTPUT,   
 { .func_arg = opt_channel_layout },
  "set channel layout", "layout" },
+{ "channel_layout_uint64", OPT_AUDIO | HAS_ARG | OPT_INT64 | OPT_SPEC |

i mean as "channel_layout"
does it work with both using the same name so the option is routed
to both the field and callback or am i missing something why this is
not intended?
I assumed options in the same OptionDef should have unique names (seems 
to be the case at the moment).
I've just tried what you suggest but there are  errors parsing and 
writing the option when the channel layout is specified as a string 
(quad, octagonal, hexadecagonal ...)
In opt_channel_layout, the function parse_option assumes the first 
channel_layout option (non Spec), while we need the second one. So this 
generates errors.
If the order of the options is reversed, the string is not recognized 
any more.
Maybe it can be done with some more work. I don't really know. Tell me 
if you want me to investigate this some more.

Thanks.



[...]



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



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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-19 Thread Dave Rice


> On Nov 19, 2017, at 2:19 PM, Nicolas George  wrote:
> 
> Paul B Mahol (2017-11-19):
>> So what you propose?
> 
> I do not know. It is your patch, and I am not even sure I understood
> your explanation correctly.

IMHO, ‘queue' is a good name for what it does. Perhaps an additional example 
would help demonstrate the option better. For example `ffplay -f lavfi -i 
testsrc=r=1 -vf tile=1x8:overlap=7:queue=1` will display 8 adjoining frames of 
the testsrc. Without `queue=1` in this example, the output will be stalled for 
8 seconds before displaying, whereas with `queue=1` there will be an output 
frame for each input frame (the first frame of the output simply showing the 
first frame of the input plus seven empty spaces).

Suggestion:

@item
Produce a filmstrip animation from frame @code{n-7} to @code{n}:
@example
ffmpeg -i file.avi -vf 'tile=1x8:overlap=7:queue=1' filmstrip.mkv
@end example

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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-19 Thread Nicolas George
Dave Rice (2017-11-19):
> IMHO, ‘queue' is a good name for what it does.

Based on your explanation, I would say not at all. It rather seems to
say the opposite. I would suggest something like "init_padding".

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] configure: fix module dependencies on zlib

2017-11-19 Thread Michael Niedermayer
On Sun, Nov 19, 2017 at 04:00:11PM -0300, James Almer wrote:
> select should not be used with external libraries. It's mean to soft
> enable internal modules/features.
> 
> Signed-off-by: James Almer 
> ---
>  configure | 48 ++--
>  1 file changed, 26 insertions(+), 22 deletions(-)

didnt test this but LGTM

thx

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

"Nothing to hide" only works if the folks in power share the values of
you and everyone you know entirely and always will -- Tom Scott



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


[FFmpeg-devel] mp4 sdtp (sample dependency) box

2017-11-19 Thread John Stebbins
Patch 4 & 5 should be squashed before commit.  Patch 4 "works" on it's
own, but doesn't account for edit list fix-ups. I seperated them to
make reviewing easier.  Patch 5 merges ctts_data into the new
mov_index_entries struct I created, so it touches quite a lot, but
results in a fair amount of code simplification.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 3/6] lavc/libx265: mark disposable frames

2017-11-19 Thread John Stebbins
Used by movenc to fill sdtp box
---
 libavcodec/libx265.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 4456e300f2..8279a99ddd 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -329,6 +329,10 @@ FF_DISABLE_DEPRECATION_WARNINGS
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 
+if (x265pic_out.sliceType == X265_TYPE_B &&
+x265pic_out.frameData.sliceType == 'b')
+pkt->flags |= AV_PKT_FLAG_DISPOSABLE;
+
 *got_packet = 1;
 return 0;
 }
-- 
2.13.6

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


[FFmpeg-devel] [PATCH 1/6] lavf/movenc: add sdtp (sample dependency) box

2017-11-19 Thread John Stebbins
The sdtp is required by the AppleTV 4K in order to play 2160p60 video.
---
 libavcodec/avcodec.h |  6 ++
 libavformat/isom.h   |  5 +
 libavformat/movenc.c | 30 ++
 libavformat/movenc.h |  2 ++
 4 files changed, 43 insertions(+)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 442b558d4b..4f4bebc586 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1443,6 +1443,12 @@ typedef struct AVPacket {
  * outside the packet may be followed.
  */
 #define AV_PKT_FLAG_TRUSTED   0x0008
+/**
+ * Flag is used to indicate packets that contain frames that can
+ * be discarded by the decoder.  I.e. Non-reference frames.
+ */
+#define AV_PKT_FLAG_DISPOSABLE 0x0010
+
 
 enum AVSideDataParamChangeFlags {
 AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT  = 0x0001,
diff --git a/libavformat/isom.h b/libavformat/isom.h
index ff08f5d090..65676fb0f5 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -318,6 +318,11 @@ void ff_mp4_parse_es_descr(AVIOContext *pb, int *es_id);
 #define MOV_TKHD_FLAG_IN_PREVIEW0x0004
 #define MOV_TKHD_FLAG_IN_POSTER 0x0008
 
+#define MOV_SAMPLE_DEPENDENCY_UNKNOWN 0x0
+#define MOV_SAMPLE_DEPENDENCY_YES 0x1
+#define MOV_SAMPLE_DEPENDENCY_NO  0x2
+
+
 #define TAG_IS_AVCI(tag)\
 ((tag) == MKTAG('a', 'i', '5', 'p') ||  \
  (tag) == MKTAG('a', 'i', '5', 'q') ||  \
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 01ae467fa1..c9ff65d43d 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -252,6 +252,30 @@ static int mov_write_stss_tag(AVIOContext *pb, MOVTrack 
*track, uint32_t flag)
 return update_size(pb, pos);
 }
 
+/* Sample dependency atom */
+static int mov_write_sdtp_tag(AVIOContext *pb, MOVTrack *track)
+{
+int i;
+uint8_t leading, dependent, reference, redundancy;
+int64_t pos = avio_tell(pb);
+avio_wb32(pb, 0); // size
+ffio_wfourcc(pb, "sdtp");
+avio_wb32(pb, 0); // version & flags
+for (i = 0; i < track->entry; i++) {
+dependent = MOV_SAMPLE_DEPENDENCY_YES;
+leading = reference = redundancy = MOV_SAMPLE_DEPENDENCY_UNKNOWN;
+if (track->cluster[i].flags & MOV_DISPOSABLE_SAMPLE) {
+reference = MOV_SAMPLE_DEPENDENCY_NO;
+}
+if (track->cluster[i].flags & MOV_SYNC_SAMPLE) {
+dependent = MOV_SAMPLE_DEPENDENCY_NO;
+}
+avio_w8(pb, (leading << 6)   | (dependent << 4) |
+(reference << 2) | redundancy);
+}
+return update_size(pb, pos);
+}
+
 static int mov_write_amr_tag(AVIOContext *pb, MOVTrack *track)
 {
 avio_wb32(pb, 0x11); /* size */
@@ -2320,6 +2344,8 @@ static int mov_write_stbl_tag(AVFormatContext *s, 
AVIOContext *pb, MOVMuxContext
  track->par->codec_tag == MKTAG('r','t','p',' ')) &&
 track->has_keyframes && track->has_keyframes < track->entry)
 mov_write_stss_tag(pb, track, MOV_SYNC_SAMPLE);
+if (track->par->codec_type == AVMEDIA_TYPE_VIDEO && track->has_disposable)
+mov_write_sdtp_tag(pb, track);
 if (track->mode == MODE_MOV && track->flags & MOV_TRACK_STPS)
 mov_write_stss_tag(pb, track, MOV_PARTIAL_SYNC_SAMPLE);
 if (track->par->codec_type == AVMEDIA_TYPE_VIDEO &&
@@ -5283,6 +5309,10 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 if (trk->cluster[trk->entry].flags & MOV_SYNC_SAMPLE)
 trk->has_keyframes++;
 }
+if (pkt->flags & AV_PKT_FLAG_DISPOSABLE) {
+trk->cluster[trk->entry].flags |= MOV_DISPOSABLE_SAMPLE;
+trk->has_disposable++;
+}
 trk->entry++;
 trk->sample_count += samples_in_chunk;
 mov->mdat_size+= size;
diff --git a/libavformat/movenc.h b/libavformat/movenc.h
index cc2a155d79..c4e966b7fb 100644
--- a/libavformat/movenc.h
+++ b/libavformat/movenc.h
@@ -53,6 +53,7 @@ typedef struct MOVIentry {
 int  cts;
 #define MOV_SYNC_SAMPLE 0x0001
 #define MOV_PARTIAL_SYNC_SAMPLE 0x0002
+#define MOV_DISPOSABLE_SAMPLE   0x0004
 uint32_t flags;
 } MOVIentry;
 
@@ -89,6 +90,7 @@ typedef struct MOVTrack {
 longsample_size;
 longchunkCount;
 int has_keyframes;
+int has_disposable;
 #define MOV_TRACK_CTTS 0x0001
 #define MOV_TRACK_STPS 0x0002
 #define MOV_TRACK_ENABLED  0x0004
-- 
2.13.6

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


[FFmpeg-devel] [PATCH 2/6] lavc/libx264: mark disposable frames

2017-11-19 Thread John Stebbins
Used by movenc to fill sdtp box
---
 libavcodec/libx264.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 9c67c91f33..1831f9b30e 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -116,6 +116,7 @@ static int encode_nals(AVCodecContext *ctx, AVPacket *pkt,
 X264Context *x4 = ctx->priv_data;
 uint8_t *p;
 int i, size = x4->sei_size, ret;
+int disposable;
 
 if (!nnal)
 return 0;
@@ -140,10 +141,14 @@ static int encode_nals(AVCodecContext *ctx, AVPacket *pkt,
 av_freep(&x4->sei);
 }
 
+disposable = AV_PKT_FLAG_DISPOSABLE;
 for (i = 0; i < nnal; i++){
 memcpy(p, nals[i].p_payload, nals[i].i_payload);
 p += nals[i].i_payload;
+if (nals[i].i_ref_idc != NAL_PRIORITY_DISPOSABLE)
+disposable = 0;
 }
+pkt->flags |= disposable;
 
 return 1;
 }
-- 
2.13.6

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


Re: [FFmpeg-devel] RPM library deployments

2017-11-19 Thread Moritz Barsnick
On Sat, Nov 18, 2017 at 10:45:44 -0900, Lou Logan wrote:
> On Fri, Nov 17, 2017, at 01:10 PM, Gardner, Greg - 0995 - MITLL wrote:
> > Hey folks,
> > 
> > Could someone put me in touch with whoever builds the ffmpeg-libs RPM?
> 
> It's not from us, a third-party makes that, but I'm not sure who. FFmpeg
> only provides source code.

Indeed, you really have to find out which distribution/repository
you're getting those packages from, and check for their packages.
(Under Fedora, that's mostly either rpmfusion or the fedora-multimedia
repo from negativo17.org.)

> > I noticed that it does not follow the common convention of
> > symlinking its *.so static object the appropriate version. Instead,
> > it simply deploys them with their full version numbers, which
> > messes with our builds (which look for just the *.so file, not
> > *.so.1.1 and so on)

No, that's quite correct. That's the way packaging works. The *.so
files (or rather symlinks) are in the -devel package.

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


[FFmpeg-devel] [PATCH 4/6] lavf/mov: set AV_PKT_FLAG_DISPOSABLE from sdtp box

2017-11-19 Thread John Stebbins
---
 libavformat/isom.h  | 10 ++
 libavformat/mov.c   | 92 ++---
 libavformat/utils.c |  3 +-
 3 files changed, 99 insertions(+), 6 deletions(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index 65676fb0f5..646b31ccc7 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -137,11 +137,19 @@ typedef struct MOVIndexRange {
 int64_t end;
 } MOVIndexRange;
 
+typedef struct MOVIndexEntry {
+#define MOVINDEX_DISPOSABLE 0x01
+int8_t  flags;
+} MOVIndexEntry;
+
 typedef struct MOVStreamContext {
 AVIOContext *pb;
 int pb_is_copied;
 int ffindex;  ///< AVStream index
 int next_chunk;
+MOVIndexEntry * mov_index_entries;
+int nb_mov_index_entries;
+unsigned int mov_index_allocated_size;
 unsigned int chunk_count;
 int64_t *chunk_offsets;
 unsigned int stts_count;
@@ -166,6 +174,8 @@ typedef struct MOVStreamContext {
 int keyframe_absent;
 unsigned int keyframe_count;
 int *keyframes;
+unsigned int frame_deps_count;
+int *frame_deps;
 int time_scale;
 int64_t time_offset;  ///< time offset of the edit list entries
 int current_sample;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 5c9f926bce..b064708ced 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2680,6 +2680,43 @@ static int mov_read_stps(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 return 0;
 }
 
+static int mov_read_sdtp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+AVStream *st;
+MOVStreamContext *sc;
+unsigned int i, entries;
+
+if (c->fc->nb_streams < 1)
+return 0;
+st = c->fc->streams[c->fc->nb_streams-1];
+sc = st->priv_data;
+
+if (atom.size < 8)
+return 0;
+
+avio_r8(pb); /* version */
+avio_rb24(pb); /* flags */
+
+entries = atom.size - 4;
+sc->frame_deps_count = 0;
+sc->frame_deps = av_malloc_array(entries, sizeof(*sc->frame_deps));
+
+if (!sc->frame_deps)
+return AVERROR(ENOMEM);
+
+for (i = 0; i < entries && !pb->eof_reached; i++) {
+sc->frame_deps[i] = avio_r8(pb);
+}
+
+sc->frame_deps_count = i;
+
+if (pb->eof_reached)
+return AVERROR_EOF;
+
+
+return 0;
+}
+
 static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
 AVStream *st;
@@ -3635,15 +3672,40 @@ static void mov_build_index(MOVContext *mov, AVStream 
*st)
 
 if (!sc->sample_count || st->nb_index_entries)
 return;
-if (sc->sample_count >= UINT_MAX / sizeof(*st->index_entries) - 
st->nb_index_entries)
+if (sc->sample_count >= UINT_MAX / sizeof(*st->index_entries))
 return;
-if (av_reallocp_array(&st->index_entries,
-  st->nb_index_entries + sc->sample_count,
+if (av_reallocp_array(&st->index_entries, sc->sample_count,
   sizeof(*st->index_entries)) < 0) {
 st->nb_index_entries = 0;
 return;
 }
-st->index_entries_allocated_size = (st->nb_index_entries + 
sc->sample_count) * sizeof(*st->index_entries);
+st->index_entries_allocated_size = sc->sample_count *
+   sizeof(*st->index_entries);
+
+// realloc mov_index_entries if needed for frame dependencies
+// or if it already exists for ctts
+if (sc->frame_deps || sc->mov_index_entries) {
+// make mov_index_entries the same number of entries as
+// index_entries
+if (av_reallocp_array(&sc->mov_index_entries,
+  sc->sample_count,
+  sizeof(*sc->mov_index_entries)) < 0) {
+sc->nb_mov_index_entries = 0;
+return;
+}
+sc->mov_index_allocated_size = sc->sample_count *
+   sizeof(*sc->mov_index_entries);
+
+if (sc->sample_count > sc->nb_mov_index_entries)
+// In case there were samples without ctts entries, ensure they
+// get zero valued entries. This ensures clips which mix boxes
+// with and without ctts entries don't pickup uninitialized
+// data.
+memset(sc->mov_index_entries + sc->nb_mov_index_entries, 0,
+   (sc->sample_count - sc->nb_mov_index_entries) *
+   sizeof(*sc->mov_index_entries));
+sc->nb_mov_index_entries = sc->sample_count;
+}
 
 for (i = 0; i < sc->chunk_count; i++) {
 int64_t next_offset = i+1 < sc->chunk_count ? 
sc->chunk_offsets[i+1] : INT64_MAX;
@@ -3664,10 +3726,14 @@ static void mov_build_index(MOVContext *mov, AVStream 
*st)
 
 for (j = 0; j < sc->stsc_data[stsc_index].count; j++) {
 int keyframe = 0;
+int disposable = 0;
 if (current_sample >= sc->sample_count) {

Re: [FFmpeg-devel] [PATCH 4/4] fate: add v210 mov test

2017-11-19 Thread Michael Niedermayer
On Sat, Nov 18, 2017 at 09:19:29PM -0500, Dave Rice wrote:
> From fe9e3aa13ecf3b4cb81f279696bcc21602662e7a Mon Sep 17 00:00:00 2001
> From: Dave Rice 
> Date: Sat, 18 Nov 2017 20:32:33 -0500
> Subject: [PATCH 4/4] fate: add v210 mov test
> 
> ---
>  tests/fate/vcodec.mak | 4 
>  tests/ref/vsynth/vsynth1-mov-v210 | 4 
>  2 files changed, 8 insertions(+)
>  create mode 100644 tests/ref/vsynth/vsynth1-mov-v210
> 
> diff --git a/tests/fate/vcodec.mak b/tests/fate/vcodec.mak
> index bbcf25d72a..0206312a53 100644
> --- a/tests/fate/vcodec.mak
> +++ b/tests/fate/vcodec.mak
> @@ -360,6 +360,10 @@ fate-vsynth%-mov-bpp16:  CODEC   = rawvideo
>  fate-vsynth%-mov-bpp16:  ENCOPTS = -pix_fmt rgb565le
>  fate-vsynth%-mov-bpp16:  FMT  = mov
>  
> +FATE_VCODEC-$(call ENCDEC, V210, MOV) += mov-v210
> +fate-vsynth%-mov-v210:  CODEC = v210
> +fate-vsynth%-mov-v210:  FMT   = mov
> +
>  FATE_VCODEC-$(call ENCDEC, ROQ, ROQ)+= roqvideo
>  fate-vsynth%-roqvideo:   CODEC   = roqvideo
>  fate-vsynth%-roqvideo:   ENCOPTS = -frames 5
> diff --git a/tests/ref/vsynth/vsynth1-mov-v210 
> b/tests/ref/vsynth/vsynth1-mov-v210
> new file mode 100644
> index 00..035f8df6ff
> --- /dev/null
> +++ b/tests/ref/vsynth/vsynth1-mov-v210
> @@ -0,0 +1,4 @@
> +a96ffa7a9ccb8242cb462dd698b3e222 *tests/data/fate/vsynth1-mov-v210.mov
> +14746427 tests/data/fate/vsynth1-mov-v210.mov
> +2ba7f4ca302f3c4147860b9dfb12b6e4 
> *tests/data/fate/vsynth1-mov-v210.out.rawvideo
> +stddev:1.84 PSNR: 42.81 MAXDIFF:   29 bytes:  7603200/  7603200

missing some files:

reference file './tests/ref/vsynth/vsynth2-mov-v210' not found
reference file './tests/ref/vsynth/vsynth3-mov-v210' not found
reference file './tests/ref/vsynth/vsynth_lena-mov-v210' not found

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


[FFmpeg-devel] [PATCH 5/6] lavf/mov: fix disposable flags in mov_fix_index

2017-11-19 Thread John Stebbins
Merges ctts_data into mov_index_entries.  This allows a considerable
amount of code simplification.
---
 libavformat/isom.h |   1 +
 libavformat/mov.c  | 254 +++--
 2 files changed, 93 insertions(+), 162 deletions(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index 646b31ccc7..8fee8f4f53 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -138,6 +138,7 @@ typedef struct MOVIndexRange {
 } MOVIndexRange;
 
 typedef struct MOVIndexEntry {
+int ctts;
 #define MOVINDEX_DISPOSABLE 0x01
 int8_t  flags;
 } MOVIndexEntry;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index b064708ced..d1284a2d43 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -74,8 +74,7 @@ typedef struct MOVParseTableEntry {
 
 static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom);
 static int mov_read_mfra(MOVContext *c, AVIOContext *f);
-static int64_t add_ctts_entry(MOVStts** ctts_data, unsigned int* ctts_count, 
unsigned int* allocated_size,
-  int count, int duration);
+static int64_t add_ctts_entry(MOVStreamContext *sc, int ctts, uint8_t flags);
 
 static int mov_metadata_track_or_disc_number(MOVContext *c, AVIOContext *pb,
  unsigned len, const char *key)
@@ -2930,7 +2929,7 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 {
 AVStream *st;
 MOVStreamContext *sc;
-unsigned int i, j, entries, ctts_count = 0;
+unsigned int i, j, entries;
 
 if (c->fc->nb_streams < 1)
 return 0;
@@ -2945,11 +2944,12 @@ static int mov_read_ctts(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 
 if (!entries)
 return 0;
-if (entries >= UINT_MAX / sizeof(*sc->ctts_data))
+if (entries >= UINT_MAX / sizeof(*sc->mov_index_entries))
 return AVERROR_INVALIDDATA;
-av_freep(&sc->ctts_data);
-sc->ctts_data = av_fast_realloc(NULL, &sc->ctts_allocated_size, entries * 
sizeof(*sc->ctts_data));
-if (!sc->ctts_data)
+av_freep(&sc->mov_index_entries);
+sc->mov_index_entries = av_fast_realloc(NULL, 
&sc->mov_index_allocated_size,
+entries * 
sizeof(*sc->mov_index_entries));
+if (!sc->mov_index_entries)
 return AVERROR(ENOMEM);
 
 for (i = 0; i < entries && !pb->eof_reached; i++) {
@@ -2965,15 +2965,15 @@ static int mov_read_ctts(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 
 /* Expand entries such that we have a 1-1 mapping with samples. */
 for (j = 0; j < count; j++)
-add_ctts_entry(&sc->ctts_data, &ctts_count, 
&sc->ctts_allocated_size, 1, duration);
+add_ctts_entry(sc, duration, 0);
 
 av_log(c->fc, AV_LOG_TRACE, "count=%d, duration=%d\n",
 count, duration);
 
 if (FFNABS(duration) < -(1<<28) && i+2fc, AV_LOG_WARNING, "CTTS invalid\n");
-av_freep(&sc->ctts_data);
-sc->ctts_count = 0;
+av_freep(&sc->mov_index_entries);
+sc->nb_mov_index_entries = 0;
 return 0;
 }
 
@@ -2981,8 +2981,6 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 mov_update_dts_shift(sc, duration);
 }
 
-sc->ctts_count = ctts_count;
-
 if (pb->eof_reached)
 return AVERROR_EOF;
 
@@ -3063,9 +3061,9 @@ static int get_edit_list_entry(MOVContext *mov,
  * Find the closest previous frame to the timestamp_pts, in e_old index
  * entries. Searching for just any frame / just key frames can be controlled by
  * last argument 'flag'.
- * Note that if ctts_data is not NULL, we will always search for a key frame
- * irrespective of the value of 'flag'. If we don't find any keyframe, we will
- * return the first frame of the video.
+ * Note that if mov_index_entries is not NULL, we will always search for a
+ * key frame irrespective of the value of 'flag'. If we don't find any
+ * keyframe, we will return the first frame of the video.
  *
  * Here the timestamp_pts is considered to be a presentation timestamp and
  * the timestamp of index entries are considered to be decoding timestamps.
@@ -3073,27 +3071,23 @@ static int get_edit_list_entry(MOVContext *mov,
  * Returns 0 if successful in finding a frame, else returns -1.
  * Places the found index corresponding output arg.
  *
- * If ctts_old is not NULL, then refines the searched entry by searching
- * backwards from the found timestamp, to find the frame with correct PTS.
- *
- * Places the found ctts_index and ctts_sample in corresponding output args.
+ * If mov_index_entries is not NULL, then refines the searched entry by
+ * searching backwards from the found timestamp, to find the frame with
+ * correct PTS.
  */
 static int find_prev_closest_index(AVStream *st,
AVIndexEntry *e_old,
int nb_old,
-   MOVStts* ctts_data,
- 

[FFmpeg-devel] [PATCH 6/6] ffplay: use AV_PKT_FLAG_DISPOSABLE in frame drop logic

2017-11-19 Thread John Stebbins
---
 fftools/ffplay.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 10a917194d..97555d5047 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -257,6 +257,7 @@ typedef struct VideoState {
 struct SwrContext *swr_ctx;
 int frame_drops_early;
 int frame_drops_late;
+int drop_disposable;
 
 enum ShowMode {
 SHOW_MODE_NONE = -1, SHOW_MODE_VIDEO = 0, SHOW_MODE_WAVES, 
SHOW_MODE_RDFT, SHOW_MODE_NB
@@ -1619,9 +1620,11 @@ retry:
 duration = vp_duration(is, vp, nextvp);
 if(!is->step && (framedrop>0 || (framedrop && 
get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) && time > is->frame_timer + 
duration){
 is->frame_drops_late++;
+is->drop_disposable = 1;
 frame_queue_next(&is->pictq);
 goto retry;
 }
+is->drop_disposable = 0;
 }
 
 if (is->subtitle_st) {
@@ -2900,6 +2903,7 @@ static int read_thread(void *arg)
 infinite_buffer = 1;
 
 for (;;) {
+AVStream * st;
 if (is->abort_request)
 break;
 if (is->paused != is->last_paused) {
@@ -3008,6 +3012,12 @@ static int read_thread(void *arg)
 } else {
 is->eof = 0;
 }
+st = ic->streams[pkt->stream_index];
+if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
+is->drop_disposable && pkt->flags & AV_PKT_FLAG_DISPOSABLE) {
+av_packet_unref(pkt);
+continue;
+}
 /* check if packet is in play range specified by user, then queue, 
otherwise discard */
 stream_start_time = ic->streams[pkt->stream_index]->start_time;
 pkt_ts = pkt->pts == AV_NOPTS_VALUE ? pkt->dts : pkt->pts;
-- 
2.13.6

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


[FFmpeg-devel] [PATCH 6/6] ffplay: use AV_PKT_FLAG_DISPOSABLE in frame drop logic

2017-11-19 Thread John Stebbins
---
 fftools/ffplay.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 10a917194d..97555d5047 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -257,6 +257,7 @@ typedef struct VideoState {
 struct SwrContext *swr_ctx;
 int frame_drops_early;
 int frame_drops_late;
+int drop_disposable;
 
 enum ShowMode {
 SHOW_MODE_NONE = -1, SHOW_MODE_VIDEO = 0, SHOW_MODE_WAVES, 
SHOW_MODE_RDFT, SHOW_MODE_NB
@@ -1619,9 +1620,11 @@ retry:
 duration = vp_duration(is, vp, nextvp);
 if(!is->step && (framedrop>0 || (framedrop && 
get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) && time > is->frame_timer + 
duration){
 is->frame_drops_late++;
+is->drop_disposable = 1;
 frame_queue_next(&is->pictq);
 goto retry;
 }
+is->drop_disposable = 0;
 }
 
 if (is->subtitle_st) {
@@ -2900,6 +2903,7 @@ static int read_thread(void *arg)
 infinite_buffer = 1;
 
 for (;;) {
+AVStream * st;
 if (is->abort_request)
 break;
 if (is->paused != is->last_paused) {
@@ -3008,6 +3012,12 @@ static int read_thread(void *arg)
 } else {
 is->eof = 0;
 }
+st = ic->streams[pkt->stream_index];
+if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
+is->drop_disposable && pkt->flags & AV_PKT_FLAG_DISPOSABLE) {
+av_packet_unref(pkt);
+continue;
+}
 /* check if packet is in play range specified by user, then queue, 
otherwise discard */
 stream_start_time = ic->streams[pkt->stream_index]->start_time;
 pkt_ts = pkt->pts == AV_NOPTS_VALUE ? pkt->dts : pkt->pts;
-- 
2.13.6

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


[FFmpeg-devel] [PATCH 5/6] lavf/mov: fix disposable flags in mov_fix_index

2017-11-19 Thread John Stebbins
Merges ctts_data into mov_index_entries.  This allows a considerable
amount of code simplification.
---
 libavformat/isom.h |   1 +
 libavformat/mov.c  | 254 +++--
 2 files changed, 93 insertions(+), 162 deletions(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index 646b31ccc7..8fee8f4f53 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -138,6 +138,7 @@ typedef struct MOVIndexRange {
 } MOVIndexRange;
 
 typedef struct MOVIndexEntry {
+int ctts;
 #define MOVINDEX_DISPOSABLE 0x01
 int8_t  flags;
 } MOVIndexEntry;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index b064708ced..d1284a2d43 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -74,8 +74,7 @@ typedef struct MOVParseTableEntry {
 
 static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom);
 static int mov_read_mfra(MOVContext *c, AVIOContext *f);
-static int64_t add_ctts_entry(MOVStts** ctts_data, unsigned int* ctts_count, 
unsigned int* allocated_size,
-  int count, int duration);
+static int64_t add_ctts_entry(MOVStreamContext *sc, int ctts, uint8_t flags);
 
 static int mov_metadata_track_or_disc_number(MOVContext *c, AVIOContext *pb,
  unsigned len, const char *key)
@@ -2930,7 +2929,7 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 {
 AVStream *st;
 MOVStreamContext *sc;
-unsigned int i, j, entries, ctts_count = 0;
+unsigned int i, j, entries;
 
 if (c->fc->nb_streams < 1)
 return 0;
@@ -2945,11 +2944,12 @@ static int mov_read_ctts(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 
 if (!entries)
 return 0;
-if (entries >= UINT_MAX / sizeof(*sc->ctts_data))
+if (entries >= UINT_MAX / sizeof(*sc->mov_index_entries))
 return AVERROR_INVALIDDATA;
-av_freep(&sc->ctts_data);
-sc->ctts_data = av_fast_realloc(NULL, &sc->ctts_allocated_size, entries * 
sizeof(*sc->ctts_data));
-if (!sc->ctts_data)
+av_freep(&sc->mov_index_entries);
+sc->mov_index_entries = av_fast_realloc(NULL, 
&sc->mov_index_allocated_size,
+entries * 
sizeof(*sc->mov_index_entries));
+if (!sc->mov_index_entries)
 return AVERROR(ENOMEM);
 
 for (i = 0; i < entries && !pb->eof_reached; i++) {
@@ -2965,15 +2965,15 @@ static int mov_read_ctts(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 
 /* Expand entries such that we have a 1-1 mapping with samples. */
 for (j = 0; j < count; j++)
-add_ctts_entry(&sc->ctts_data, &ctts_count, 
&sc->ctts_allocated_size, 1, duration);
+add_ctts_entry(sc, duration, 0);
 
 av_log(c->fc, AV_LOG_TRACE, "count=%d, duration=%d\n",
 count, duration);
 
 if (FFNABS(duration) < -(1<<28) && i+2fc, AV_LOG_WARNING, "CTTS invalid\n");
-av_freep(&sc->ctts_data);
-sc->ctts_count = 0;
+av_freep(&sc->mov_index_entries);
+sc->nb_mov_index_entries = 0;
 return 0;
 }
 
@@ -2981,8 +2981,6 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 mov_update_dts_shift(sc, duration);
 }
 
-sc->ctts_count = ctts_count;
-
 if (pb->eof_reached)
 return AVERROR_EOF;
 
@@ -3063,9 +3061,9 @@ static int get_edit_list_entry(MOVContext *mov,
  * Find the closest previous frame to the timestamp_pts, in e_old index
  * entries. Searching for just any frame / just key frames can be controlled by
  * last argument 'flag'.
- * Note that if ctts_data is not NULL, we will always search for a key frame
- * irrespective of the value of 'flag'. If we don't find any keyframe, we will
- * return the first frame of the video.
+ * Note that if mov_index_entries is not NULL, we will always search for a
+ * key frame irrespective of the value of 'flag'. If we don't find any
+ * keyframe, we will return the first frame of the video.
  *
  * Here the timestamp_pts is considered to be a presentation timestamp and
  * the timestamp of index entries are considered to be decoding timestamps.
@@ -3073,27 +3071,23 @@ static int get_edit_list_entry(MOVContext *mov,
  * Returns 0 if successful in finding a frame, else returns -1.
  * Places the found index corresponding output arg.
  *
- * If ctts_old is not NULL, then refines the searched entry by searching
- * backwards from the found timestamp, to find the frame with correct PTS.
- *
- * Places the found ctts_index and ctts_sample in corresponding output args.
+ * If mov_index_entries is not NULL, then refines the searched entry by
+ * searching backwards from the found timestamp, to find the frame with
+ * correct PTS.
  */
 static int find_prev_closest_index(AVStream *st,
AVIndexEntry *e_old,
int nb_old,
-   MOVStts* ctts_data,
- 

Re: [FFmpeg-devel] [PATCH] configure: fix module dependencies on zlib

2017-11-19 Thread James Almer
On 11/19/2017 5:33 PM, Michael Niedermayer wrote:
> On Sun, Nov 19, 2017 at 04:00:11PM -0300, James Almer wrote:
>> select should not be used with external libraries. It's mean to soft
>> enable internal modules/features.
>>
>> Signed-off-by: James Almer 
>> ---
>>  configure | 48 ++--
>>  1 file changed, 26 insertions(+), 22 deletions(-)
> 
> didnt test this but LGTM
> 
> thx

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


Re: [FFmpeg-devel] [PATCH 6/6] ffplay: use AV_PKT_FLAG_DISPOSABLE in frame drop logic

2017-11-19 Thread Marton Balint


On Sun, 19 Nov 2017, John Stebbins wrote:


---
fftools/ffplay.c | 10 ++
1 file changed, 10 insertions(+)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 10a917194d..97555d5047 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -257,6 +257,7 @@ typedef struct VideoState {
struct SwrContext *swr_ctx;
int frame_drops_early;
int frame_drops_late;
+int drop_disposable;

enum ShowMode {
SHOW_MODE_NONE = -1, SHOW_MODE_VIDEO = 0, SHOW_MODE_WAVES, 
SHOW_MODE_RDFT, SHOW_MODE_NB
@@ -1619,9 +1620,11 @@ retry:
duration = vp_duration(is, vp, nextvp);
if(!is->step && (framedrop>0 || (framedrop && get_master_sync_type(is) != 
AV_SYNC_VIDEO_MASTER)) && time > is->frame_timer + duration){
is->frame_drops_late++;
+is->drop_disposable = 1;
frame_queue_next(&is->pictq);
goto retry;
}
+is->drop_disposable = 0;
}

if (is->subtitle_st) {
@@ -2900,6 +2903,7 @@ static int read_thread(void *arg)
infinite_buffer = 1;

for (;;) {
+AVStream * st;
if (is->abort_request)
break;
if (is->paused != is->last_paused) {
@@ -3008,6 +3012,12 @@ static int read_thread(void *arg)
} else {
is->eof = 0;
}
+st = ic->streams[pkt->stream_index];
+if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
+is->drop_disposable && pkt->flags & AV_PKT_FLAG_DISPOSABLE) {
+av_packet_unref(pkt);
+continue;
+}
/* check if packet is in play range specified by user, then queue, 
otherwise discard */
stream_start_time = ic->streams[pkt->stream_index]->start_time;
pkt_ts = pkt->pts == AV_NOPTS_VALUE ? pkt->dts : pkt->pts;


I am not a fan of enabling this by default. Unknown number of packets 
accumulate in the packet queue, unknown number of packets are processed by 
the decoder, so we might drop packets referring to frames 1 second from 
now... If you really want to dynamically drop packets, then at least drop 
them right before feeding them to the decoder to get rid of the packet 
queue latency.


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


Re: [FFmpeg-devel] [PATCH] avformat/avio: remove must_flush from AVIOContext

2017-11-19 Thread Marton Balint



On Wed, 15 Nov 2017, Marton Balint wrote:



On Wed, 15 Nov 2017, Nicolas George wrote:


Le quintidi 25 brumaire, an CCXXVI, Marton Balint a écrit :

It is unused.

Signed-off-by: Marton Balint 
---
 libavformat/avio.h | 1 -
 1 file changed, 1 deletion(-)


Breaks ABI by moving all the fields below.


We are still in unstable ABI period AFAIK.


Will apply soon.

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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-19 Thread Thilo Borgmann


> Am 19.11.2017 um 21:22 schrieb Nicolas George :
> 
> Dave Rice (2017-11-19):
>> IMHO, ‘queue' is a good name for what it does.
> 
> Based on your explanation, I would say not at all. It rather seems to
> say the opposite. I would suggest something like "init_padding".

Based on Dave's example I'd say the queue parameter defines the minimum of 
available tiles before output is generated. 

'queue' -> 'min'
'queue' -> 'min_tiles'
'queue' -> 'min_available'

I'd suggest something like that. 

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


Re: [FFmpeg-devel] [PATCH 1/6] lavf/movenc: add sdtp (sample dependency) box

2017-11-19 Thread Carl Eugen Hoyos
2017-11-19 21:46 GMT+01:00 John Stebbins :
> The sdtp is required by the AppleTV 4K in order to play 2160p60 video.

> +/**
> + * Flag is used to indicate packets that contain frames that can
> + * be discarded by the decoder.  I.e. Non-reference frames.
> + */
> +#define AV_PKT_FLAG_DISPOSABLE 0x0010

What sets this flag?

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


Re: [FFmpeg-devel] [PATCH 6/6] ffplay: use AV_PKT_FLAG_DISPOSABLE in frame drop logic

2017-11-19 Thread John Stebbins
On 11/19/2017 01:28 PM, Marton Balint wrote:
> On Sun, 19 Nov 2017, John Stebbins wrote:
>
>> ---
>> fftools/ffplay.c | 10 ++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/fftools/ffplay.c b/fftools/ffplay.c
>> index 10a917194d..97555d5047 100644
>> --- a/fftools/ffplay.c
>> +++ b/fftools/ffplay.c
>> @@ -257,6 +257,7 @@ typedef struct VideoState {
>> struct SwrContext *swr_ctx;
>> int frame_drops_early;
>> int frame_drops_late;
>> +int drop_disposable;
>>
>> enum ShowMode {
>> SHOW_MODE_NONE = -1, SHOW_MODE_VIDEO = 0, SHOW_MODE_WAVES, 
>> SHOW_MODE_RDFT, SHOW_MODE_NB
>> @@ -1619,9 +1620,11 @@ retry:
>> duration = vp_duration(is, vp, nextvp);
>> if(!is->step && (framedrop>0 || (framedrop && 
>> get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) && time > is->frame_timer 
>> + duration){
>> is->frame_drops_late++;
>> +is->drop_disposable = 1;
>> frame_queue_next(&is->pictq);
>> goto retry;
>> }
>> +is->drop_disposable = 0;
>> }
>>
>> if (is->subtitle_st) {
>> @@ -2900,6 +2903,7 @@ static int read_thread(void *arg)
>> infinite_buffer = 1;
>>
>> for (;;) {
>> +AVStream * st;
>> if (is->abort_request)
>> break;
>> if (is->paused != is->last_paused) {
>> @@ -3008,6 +3012,12 @@ static int read_thread(void *arg)
>> } else {
>> is->eof = 0;
>> }
>> +st = ic->streams[pkt->stream_index];
>> +if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
>> +is->drop_disposable && pkt->flags & AV_PKT_FLAG_DISPOSABLE) {
>> +av_packet_unref(pkt);
>> +continue;
>> +}
>> /* check if packet is in play range specified by user, then queue, 
>> otherwise discard */
>> stream_start_time = ic->streams[pkt->stream_index]->start_time;
>> pkt_ts = pkt->pts == AV_NOPTS_VALUE ? pkt->dts : pkt->pts;
> I am not a fan of enabling this by default. Unknown number of packets 
> accumulate in the packet queue, unknown number of packets are processed by 
> the decoder, so we might drop packets referring to frames 1 second from 
> now... If you really want to dynamically drop packets, then at least drop 
> them right before feeding them to the decoder to get rid of the packet 
> queue latency.
>
>

The way it's coded, it can be disabled with -noframedrop.  But that would 
disable all frame dropping.  I can add a
separate option for this if you prefer.  And I'll move it to where packets are 
sent to the decoder to minimize buffering
effects.  This patch was primarily created as a means of testing that the 
correct frames were being marked as
disposable.  My feelings wouldn't be hurt if you asked to drop this entirely ;)

-- 
John  GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01  83F0 49F1 D7B2 60D4 D0F7




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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-19 Thread Nicolas George
Thilo Borgmann (2017-11-19):
> Based on Dave's example I'd say the queue parameter defines the
> minimum of available tiles before output is generated. 
> 
> 'queue' -> 'min'
> 'queue' -> 'min_tiles'
> 'queue' -> 'min_available'
> 
> I'd suggest something like that. 

"min" would imply a global minimum, the names you suggest do not contain
anything that suggests it applies only at the beginning, and neither
does "queue". I stick with "init_padding".

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH 1/6] lavf/movenc: add sdtp (sample dependency) box

2017-11-19 Thread John Stebbins
On 11/19/2017 02:12 PM, Carl Eugen Hoyos wrote:
> 2017-11-19 21:46 GMT+01:00 John Stebbins :
>> The sdtp is required by the AppleTV 4K in order to play 2160p60 video.
>> +/**
>> + * Flag is used to indicate packets that contain frames that can
>> + * be discarded by the decoder.  I.e. Non-reference frames.
>> + */
>> +#define AV_PKT_FLAG_DISPOSABLE 0x0010
> What sets this flag?
>
>

Encoders when encoding, demuxer when remuxing.  The subsequent patches set this 
flag for x264, x265, and mp4 demux.

-- 
John  GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01  83F0 49F1 D7B2 60D4 D0F7




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


Re: [FFmpeg-devel] [PATCH 1/6] lavf/movenc: add sdtp (sample dependency) box

2017-11-19 Thread Carl Eugen Hoyos
2017-11-19 23:25 GMT+01:00 John Stebbins :
> On 11/19/2017 02:12 PM, Carl Eugen Hoyos wrote:
>> 2017-11-19 21:46 GMT+01:00 John Stebbins :
>>> The sdtp is required by the AppleTV 4K in order to play 2160p60 video.
>>> +/**
>>> + * Flag is used to indicate packets that contain frames that can
>>> + * be discarded by the decoder.  I.e. Non-reference frames.
>>> + */
>>> +#define AV_PKT_FLAG_DISPOSABLE 0x0010
>> What sets this flag?
>
> Encoders when encoding, demuxer when remuxing.

> The subsequent patches set this flag for x264, x265, and mp4 demux.

So does this patch alone work wrt the description: Does AppleTV play
4k with this patch alone?

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


Re: [FFmpeg-devel] [PATCH 3/3] avcodec: Implement mpeg4 nvdec hwaccel

2017-11-19 Thread Carl Eugen Hoyos
2017-11-19 20:52 GMT+01:00 Philip Langdale :

> gmc_enabled: This seems to map to mc_sel being non-zero, but I also
>  have no samples where that is true.

Iirc, global motion compensation is not supported by hardware decoders.

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


Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec: Use atomic addition for value updated in multiple threads.

2017-11-19 Thread Nick Lewycky
Sorry-- what should I do now? Wait for another patch to go in first then
rebase on top of it? Attempt to migrate error_count to C11 atomics myself?
If I'm migrating, is there a primer on how ffmpeg uses C11 atomics? For
instance, given an atomic_int, should I assign to it with equality,
atomic_store, or atomic_store_explicit and if picking atomic_store_explicit
how clever should I be when picking memory orderings?

Also, ERContext also has a non-volatile non-atomic int error_occurred.
Sometimes we update the error_count without adjusting error_occurred. Is
the idea that error_count is shared across threads and error_count is
checked at the end? Given that error_count could wrap around and equal
zero, should I make it atomic too, and set it to 1 every time we set
error_count to non-zero?

I've attached a patch with my initial attempt to use C11 atomics.

Nick

On 17 November 2017 at 12:49, Michael Niedermayer 
wrote:

> On Fri, Nov 17, 2017 at 05:10:17PM -0300, James Almer wrote:
> > On 11/17/2017 4:20 PM, James Almer wrote:
> > > On 11/17/2017 4:16 PM, Michael Niedermayer wrote:
> > >> On Thu, Nov 16, 2017 at 03:07:54PM -0800, Nick Lewycky wrote:
> > >>> Sorry! Let's try an attachment then.
> > >>>
> > >>> On 16 November 2017 at 14:36, Michael Niedermayer
> > >>>  wrote:
> >  On Thu, Nov 16, 2017 at 12:41:32PM -0800, Nick Lewycky wrote:
> > > I initially discovered a signed integer overflow on this line.
> Since
> > > this value is updated in multiple threads, I use an atomic update
> and
> > > as it happens atomic addition is defined to wrap around. However,
> > > there's still a potential bug in that the error_count may wrap
> around
> > > and equal zero again causing problems down the line.
> > >
> > > ---
> > >  libavcodec/mpeg12dec.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> > > index d5bc5f21b2..b7c3b5106e 100644
> > > --- a/libavcodec/mpeg12dec.c
> > > +++ b/libavcodec/mpeg12dec.c
> > > @@ -28,6 +28,7 @@
> > >  #define UNCHECKED_BITSTREAM_READER 1
> > >  #include 
> > >
> > > +#include "libavutil/atomic.h"
> > >  #include "libavutil/attributes.h"
> > >  #include "libavutil/imgutils.h"
> > >  #include "libavutil/internal.h"
> > > @@ -2476,7 +2477,7 @@ static int decode_chunks(AVCodecContext
> *avctx,
> > > AVFrame *picture,
> > > &s2->thread_context[0], NULL,
> > > s->slice_count, sizeof(void
> *));
> > >  for (i = 0; i < s->slice_count; i++)
> > > -s2->er.error_count +=
> > > s2->thread_context[i]->er.error_count;
> > > +
> > > avpriv_atomic_int_add_and_fetch(&s2->er.error_count,
> > > s2->thread_context[i]->er.error_count);
> > >  }
> > 
> >  This patch is corrupted by newlines
> > 
> >  [...]
> > 
> >  --
> >  Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC7
> 87040B0FAB
> > 
> >  Dictatorship naturally arises out of democracy, and the most
> aggravated
> >  form of tyranny and slavery out of the most extreme liberty. --
> Plato
> > 
> >  ___
> >  ffmpeg-devel mailing list
> >  ffmpeg-devel@ffmpeg.org
> >  http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > 
> > >>
> > >>>  mpeg12dec.c |3 ++-
> > >>>  1 file changed, 2 insertions(+), 1 deletion(-)
> > >>> eed6baa2f9ae5b6fcd227e4b7fa0e87e9ca55b64
> 0001-libavcodec-mpeg12dec-Use-atomic-addition-for-value-u.patch
> > >>> From cd8ed0ee35853ae089df3d904846879ce4f00c4a Mon Sep 17 00:00:00
> 2001
> > >>> From: Nick Lewycky 
> > >>> Date: Thu, 16 Nov 2017 11:50:38 -0800
> > >>> Subject: [PATCH] libavcodec/mpeg12dec: Use atomic addition for value
> updated
> > >>>  in multiple threads.
> > >>
> > >> LGTM, unless theres a new API for doing this, in which case the new
> > >> style should be used.
> > >
> > > Yes, he should use C11 atomics. It's been mentioned to everyone that
> > > submitted code using the old lavu wrappers, including you some days
> ago.
> >
> > To expand on this, I'm aware that the entire error resilience feature
> > needs to be ported to C11 atomics. My point is that, much like i said to
> > you in that patch some days ago, it should be ported before adding new
> > code that will ultimately make the port harder.
>
> Yes, i did not yet had time to update the patch
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Does the universe only have a finite lifespan? No, its going to go on
> forever, its just that you wont like living in it. -- Hiranya Peiri
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>


0001-liba

Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-19 Thread Thilo Borgmann


> Am 19.11.2017 um 23:25 schrieb Nicolas George :
> 
> Thilo Borgmann (2017-11-19):
>> Based on Dave's example I'd say the queue parameter defines the
>> minimum of available tiles before output is generated. 
>> 
>> 'queue' -> 'min'
>> 'queue' -> 'min_tiles'
>> 'queue' -> 'min_available'
>> 
>> I'd suggest something like that. 
> 
> "min" would imply a global minimum, the names you suggest do not contain
> anything that suggests it applies only at the beginning, and neither
> does "queue". I stick with "init_padding".

min_start
n_begin

My 2 cents. Not going to fight this, I find both 'queue' and 'init_padding' all 
but intuitive from the users pov. 

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


Re: [FFmpeg-devel] [PATCH 3/3] avcodec: Implement mpeg4 nvdec hwaccel

2017-11-19 Thread Philip Langdale
On Sun, 19 Nov 2017 23:35:24 +0100
Carl Eugen Hoyos  wrote:

> 2017-11-19 20:52 GMT+01:00 Philip Langdale :
> 
> > gmc_enabled: This seems to map to mc_sel being non-zero, but I also
> >  have no samples where that is true.  
> 
> Iirc, global motion compensation is not supported by hardware
> decoders.
> 

It's obviously hard to tell when you have no samples and no
documentation, but it would be weird if this flag existed only for the
hardware to give up if gmc was used. Still, it's all academic given the
complete lack of real world usage of gmc.

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


Re: [FFmpeg-devel] [PATCH 3/3] avcodec: Implement mpeg4 nvdec hwaccel

2017-11-19 Thread Philip Langdale
On Sun, 19 Nov 2017 11:52:28 -0800
Philip Langdale  wrote:

> This was predictably nightmarish, given how ridiculous mpeg4 is.
> I had to stare at the cuvid parser output for a long time to work
> out what each field was supposed to be, and even then, I still don't
> fully understand some of them, particularly:
> 
> vop_coded: I think this means whether the vop has a picture shape,
>and therefore a picture type. I have no samples where
>this is not the case.
> divx_flags: There's obviously no documentation on what the possible
> flags are. I simply observed that this is '0' for a
> normal bitstream and '5' for packed b-frames.
> gmc_enabled: This seems to map to mc_sel being non-zero, but I also
>  have no samples where that is true.
> 
> Also note that as with the vdpau hwaccel, the decoder needs to
> consume the entire frame and not the slice.
> 
> Signed-off-by: Philip Langdale 
> ---
>  Changelog|   2 +-
>  configure|   2 +
>  libavcodec/Makefile  |   1 +
>  libavcodec/allcodecs.c   |   1 +
>  libavcodec/h263dec.c |   3 ++
>  libavcodec/nvdec.c   |   1 +
>  libavcodec/nvdec_mpeg4.c | 121
> +++
> libavcodec/version.h |   2 +- 8 files changed, 131 insertions(+),
> 2 deletions(-) create mode 100644 libavcodec/nvdec_mpeg4.c
> 
> diff --git a/Changelog b/Changelog
> index 5a9d183aed..74ed35cfe6 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -13,7 +13,7 @@ version :
>  - PCE support for extended channel layouts in the AAC encoder
>  - native aptX encoder and decoder
>  - Raw aptX muxer and demuxer
> -- NVIDIA NVDEC-accelerated H.264, HEVC, MPEG-1/2, VC1 and VP9
> hwaccel decoding +- NVIDIA NVDEC-accelerated H.264, HEVC, MPEG-1/2/4,
> VC1 and VP9 hwaccel decoding
>  - Intel QSV-accelerated overlay filter
>  - mcompand audio filter
>  - acontrast audio filter
> diff --git a/configure b/configure
> index 35713805fa..36ccf767dd 100755
> --- a/configure
> +++ b/configure
> @@ -2731,6 +2731,8 @@ mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
>  mpeg4_cuvid_hwaccel_select="mpeg4_cuvid_decoder"
>  mpeg4_mediacodec_hwaccel_deps="mediacodec"
>  mpeg4_mmal_hwaccel_deps="mmal"
> +mpeg4_nvdec_hwaccel_deps="nvdec"
> +mpeg4_nvdec_hwaccel_select="mpeg4_decoder"
>  mpeg4_vaapi_hwaccel_deps="vaapi"
>  mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
>  mpeg4_vdpau_hwaccel_deps="vdpau"
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 0573454c7b..2af957ab72 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -861,6 +861,7 @@ OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL)+=
> vaapi_mpeg2.o OBJS-$(CONFIG_MPEG2_VDPAU_HWACCEL)+=
> vdpau_mpeg12.o OBJS-$(CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL) +=
> videotoolbox.o OBJS-$(CONFIG_MPEG2_XVMC_HWACCEL) +=
> mpegvideo_xvmc.o +OBJS-$(CONFIG_MPEG4_NVDEC_HWACCEL)+=
> nvdec_mpeg4.o OBJS-$(CONFIG_MPEG4_VAAPI_HWACCEL)+=
> vaapi_mpeg4.o OBJS-$(CONFIG_MPEG4_VDPAU_HWACCEL)+=
> vdpau_mpeg4.o OBJS-$(CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL) +=
> videotoolbox.o diff --git a/libavcodec/allcodecs.c
> b/libavcodec/allcodecs.c index e9df7049de..85c38c83aa 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -106,6 +106,7 @@ static void register_all(void)
>  REGISTER_HWACCEL(MPEG4_CUVID,   mpeg4_cuvid);
>  REGISTER_HWACCEL(MPEG4_MEDIACODEC,  mpeg4_mediacodec);
>  REGISTER_HWACCEL(MPEG4_MMAL,mpeg4_mmal);
> +REGISTER_HWACCEL(MPEG4_NVDEC,   mpeg4_nvdec);
>  REGISTER_HWACCEL(MPEG4_VAAPI,   mpeg4_vaapi);
>  REGISTER_HWACCEL(MPEG4_VDPAU,   mpeg4_vdpau);
>  REGISTER_HWACCEL(MPEG4_VIDEOTOOLBOX, mpeg4_videotoolbox);
> diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
> index c7cf4bc0c2..b222de793b 100644
> --- a/libavcodec/h263dec.c
> +++ b/libavcodec/h263dec.c
> @@ -714,6 +714,9 @@ const enum AVPixelFormat
> ff_h263_hwaccel_pixfmt_list_420[] = { #if CONFIG_H263_VAAPI_HWACCEL
> || CONFIG_MPEG4_VAAPI_HWACCEL AV_PIX_FMT_VAAPI,
>  #endif
> +#if CONFIG_MPEG4_NVDEC_HWACCEL
> +AV_PIX_FMT_CUDA,
> +#endif
>  #if CONFIG_MPEG4_VDPAU_HWACCEL
>  AV_PIX_FMT_VDPAU,
>  #endif
> diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
> index d5cf1058cb..efcd47a7f7 100644
> --- a/libavcodec/nvdec.c
> +++ b/libavcodec/nvdec.c
> @@ -56,6 +56,7 @@ static int map_avcodec_id(enum AVCodecID id)
>  case AV_CODEC_ID_HEVC:   return cudaVideoCodec_HEVC;
>  case AV_CODEC_ID_MPEG1VIDEO: return cudaVideoCodec_MPEG1;
>  case AV_CODEC_ID_MPEG2VIDEO: return cudaVideoCodec_MPEG2;
> +case AV_CODEC_ID_MPEG4:  return cudaVideoCodec_MPEG4;
>  case AV_CODEC_ID_VC1:return cudaVideoCodec_VC1;
>  case AV_CODEC_ID_VP9:return cudaVideoCodec_VP9;
>  case AV_CODEC_ID_WMV3:   return cudaVideoCodec_VC1;
> diff --git a/libavcodec/nvdec_mpeg4.c b/libavcodec/nvdec_mpeg4.c
> new file mode 100644
> index 00..be81bd958b
> -

Re: [FFmpeg-devel] [PATCH 3/3] avcodec: Implement mpeg4 nvdec hwaccel

2017-11-19 Thread Carl Eugen Hoyos
2017-11-19 23:35 GMT+01:00 Carl Eugen Hoyos :
> 2017-11-19 20:52 GMT+01:00 Philip Langdale :
>
>> gmc_enabled: This seems to map to mc_sel being non-zero, but I also
>>  have no samples where that is true.
>
> Iirc, global motion compensation is not supported by hardware decoders.

Or maybe it only works if there is no more than one warppoint.

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


[FFmpeg-devel] [PATCH 2/2] hwcontext_vaapi: add the fourcc of I420 format map.

2017-11-19 Thread Jun Zhao

From f31e492201b7a8c59bdf7c266c2df016057897c4 Mon Sep 17 00:00:00 2001
From: Jun Zhao 
Date: Sat, 18 Nov 2017 11:57:41 +0800
Subject: [PATCH 2/2] hwcontext_vaapi: add the fourcc of I420 format map.

VA-API 2.0 have enable the I420, so enable this map.

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

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index f246639021..d536bc93a1 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -101,7 +101,9 @@ static const struct {
 MAP(NV12, YUV420,  NV12),
 MAP(YV12, YUV420,  YUV420P), // With U/V planes swapped.
 MAP(IYUV, YUV420,  YUV420P),
-  //MAP(I420, YUV420,  YUV420P), // Not in libva but used by Intel driver.
+#ifdef VA_FOURCC_I420
+MAP(I420, YUV420,  YUV420P),
+#endif
 #ifdef VA_FOURCC_YV16
 MAP(YV16, YUV422,  YUV422P), // With U/V planes swapped.
 #endif
-- 
2.14.1

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


[FFmpeg-devel] [PATCH 1/2] hwcontext_vaapi: add support when driver return unimplemented.

2017-11-19 Thread Jun Zhao

From 5cbcd032de46e6a3f9563d1781776ea26728079d Mon Sep 17 00:00:00 2001
From: Jun Zhao 
Date: Sat, 18 Nov 2017 10:44:44 +0800
Subject: [PATCH 1/2] hwcontext_vaapi: add support when driver return
 unimplemented.

iHD driver sometime return unimplemented when query surface attributes,
we just ignore and give a warning in this case.

Signed-off-by: Jun Zhao 
---
 libavutil/hwcontext_vaapi.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 0382eb06f2..f246639021 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -169,7 +169,10 @@ static int vaapi_frames_get_constraints(AVHWDeviceContext 
*hwdev,
 attr_count = 0;
 vas = vaQuerySurfaceAttributes(hwctx->display, config->config_id,
0, &attr_count);
-if (vas != VA_STATUS_SUCCESS) {
+// Sometime driver return unimplemeted - ignore and warning.
+if (vas == VA_STATUS_ERROR_UNIMPLEMENTED) {
+av_log(hwdev, AV_LOG_WARNING, "Query surface attributes not 
implemented.\n");
+} else if (vas != VA_STATUS_SUCCESS) {
 av_log(hwdev, AV_LOG_ERROR, "Failed to query surface attributes: "
"%d (%s).\n", vas, vaErrorStr(vas));
 err = AVERROR(ENOSYS);
@@ -177,14 +180,17 @@ static int vaapi_frames_get_constraints(AVHWDeviceContext 
*hwdev,
 }
 
 attr_list = av_malloc(attr_count * sizeof(*attr_list));
-if (!attr_list) {
+if (attr_count != 0 && !attr_list) {
 err = AVERROR(ENOMEM);
 goto fail;
 }
 
 vas = vaQuerySurfaceAttributes(hwctx->display, config->config_id,
attr_list, &attr_count);
-if (vas != VA_STATUS_SUCCESS) {
+// Sometime driver return unimplemeted - ignore and warning.
+if (vas == VA_STATUS_ERROR_UNIMPLEMENTED) {
+av_log(hwdev, AV_LOG_WARNING, "Query surface attributes not 
implemented.\n");
+} else if (vas != VA_STATUS_SUCCESS) {
 av_log(hwdev, AV_LOG_ERROR, "Failed to query surface attributes: "
"%d (%s).\n", vas, vaErrorStr(vas));
 err = AVERROR(ENOSYS);
-- 
2.14.1

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


[FFmpeg-devel] [PATCH] ffmpeg: add return value check to suppress the build warning.

2017-11-19 Thread Jun Zhao

From 01a66eb4559fb3fec0765ee03417a65ef5e06fe1 Mon Sep 17 00:00:00 2001
From: Jun Zhao 
Date: Sat, 18 Nov 2017 13:24:24 +0800
Subject: [PATCH] ffmpeg: add return value check to supress the build warning.

add return value check to supress the build warning message like
"warning: ignoring return value" when use attribute -Wunused-result.

Signed-off-by: Jun Zhao 
---
 fftools/ffmpeg.c | 28 +++-
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index babd85f7bc..0c16e75ab0 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -220,13 +220,18 @@ static void sub2video_push_ref(InputStream *ist, int64_t 
pts)
 {
 AVFrame *frame = ist->sub2video.frame;
 int i;
+int ret;
 
 av_assert1(frame->data[0]);
 ist->sub2video.last_pts = frame->pts = pts;
-for (i = 0; i < ist->nb_filters; i++)
-av_buffersrc_add_frame_flags(ist->filters[i]->filter, frame,
- AV_BUFFERSRC_FLAG_KEEP_REF |
- AV_BUFFERSRC_FLAG_PUSH);
+for (i = 0; i < ist->nb_filters; i++) {
+ret = av_buffersrc_add_frame_flags(ist->filters[i]->filter, frame,
+   AV_BUFFERSRC_FLAG_KEEP_REF |
+   AV_BUFFERSRC_FLAG_PUSH);
+if (ret != AVERROR_EOF && ret < 0)
+av_log(NULL, AV_LOG_WARNING, "Error while add the frame to buffer 
source(%s).\n",
+   av_err2str(ret));
+}
 }
 
 void sub2video_update(InputStream *ist, AVSubtitle *sub)
@@ -295,11 +300,15 @@ static void sub2video_heartbeat(InputStream *ist, int64_t 
pts)
 static void sub2video_flush(InputStream *ist)
 {
 int i;
+int ret;
 
 if (ist->sub2video.end_pts < INT64_MAX)
 sub2video_update(ist, NULL);
-for (i = 0; i < ist->nb_filters; i++)
-av_buffersrc_add_frame(ist->filters[i]->filter, NULL);
+for (i = 0; i < ist->nb_filters; i++) {
+ret = av_buffersrc_add_frame(ist->filters[i]->filter, NULL);
+if (ret != AVERROR_EOF && ret < 0)
+av_log(NULL, AV_LOG_WARNING, "Flush the frame error.\n");
+}
 }
 
 /* end of sub2video hack */
@@ -327,13 +336,14 @@ static int main_return_code = 0;
 static void
 sigterm_handler(int sig)
 {
+int ret;
 received_sigterm = sig;
 received_nb_signals++;
 term_exit_sigsafe();
 if(received_nb_signals > 3) {
-write(2/*STDERR_FILENO*/, "Received > 3 system signals, hard 
exiting\n",
-   strlen("Received > 3 system signals, hard 
exiting\n"));
-
+ret = write(2/*STDERR_FILENO*/, "Received > 3 system signals, hard 
exiting\n",
+strlen("Received > 3 system signals, hard exiting\n"));
+if (ret < 0) { /* Do nothing */ };
 exit(123);
 }
 }
-- 
2.14.1

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


Re: [FFmpeg-devel] [PATCH 2/3] checkasm/jpeg2000dsp: add test for ict_float

2017-11-19 Thread Michael Niedermayer
On Sun, Nov 19, 2017 at 12:39:36AM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  tests/checkasm/jpeg2000dsp.c | 33 +
>  1 file changed, 33 insertions(+)

LGTM

thx

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

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety -- Benjamin Franklin


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


Re: [FFmpeg-devel] [PATCH 1/4] avformat/movenc: correct ImageDescription for uncompressed ycbcr

2017-11-19 Thread Michael Niedermayer
On Sat, Nov 18, 2017 at 09:19:17PM -0500, Dave Rice wrote:
> This patch set updates movenc to write uncompressed ycbcr in mov following 
> requirements in Apple’s TN2162, 
> https://developer.apple.com/library/content/technotes/tn2162/_index.html. 
> Thanks to Carl and Michael for comments on an earlier version of this 
> patchset.
> 
> 
> From 26d9ca470f104d8448000b13c2cc97b8fc5c15ba Mon Sep 17 00:00:00 2001
> From: Dave Rice 
> Date: Thu, 16 Nov 2017 11:53:32 -0500
> Subject: [PATCH 1/4] avformat/movenc: correct ImageDescription for
>  uncompressed ycbcr
> 
> Per
> https://developer.apple.com/library/content/technotes/tn2162/_index.html

will apply

thx

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

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin


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


Re: [FFmpeg-devel] [PATCH 3/4] avformat/movenc: force colr atom for uncompressed yuv in mov

2017-11-19 Thread Michael Niedermayer
On Sun, Nov 19, 2017 at 10:05:56AM +0100, Reto Kromer wrote:
> Dave Rice wrote:
> 
> >As required by Apple’s TN2162.
> >---
> > libavformat/movenc.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> LGTM

will apply

thanks

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

Never trust a computer, one day, it may think you are the virus. -- Compn


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


Re: [FFmpeg-devel] [PATCH 2/4] avformat/movenc: write clap atom for uncompressed yuv in mov

2017-11-19 Thread Michael Niedermayer
On Sat, Nov 18, 2017 at 09:19:23PM -0500, Dave Rice wrote:
> From e9079167c199791e652fe9cd3550333b819a8a9a Mon Sep 17 00:00:00 2001
> From: Dave Rice 
> Date: Thu, 16 Nov 2017 11:29:06 -0500
> Subject: [PATCH 2/4] avformat/movenc: write clap atom for uncompressed yuv in
>  mov
> 
> fixes 6145
> ---
>  libavformat/movenc.c | 19 +++
>  1 file changed, 19 insertions(+)

will apply

thanks


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

"Nothing to hide" only works if the folks in power share the values of
you and everyone you know entirely and always will -- Tom Scott



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


Re: [FFmpeg-devel] [PATCH] libavformat/mov:the "stco" box parse no need return eof.

2017-11-19 Thread Michael Niedermayer
On Sun, Nov 19, 2017 at 10:00:29PM +0800, tiejun.peng wrote:
> if return eof, will cause to play the whole mp4 file fail.
> For example, currently the whole file will play fail
> when a few bytes missed in the "stco" box
> and the "stco" box is the last box of MP4 file,
> Actually the almost media frames can play success at most time.
> A few words missed in "stco" box and the other box data is full
> will not cause the whole mp4 file fail.
> 
> Signed-off-by: tiejun.peng 
> ---
>  libavformat/mov.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 5c9f926..78b7bf7 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -1989,9 +1989,6 @@ static int mov_read_stco(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>  
>  sc->chunk_count = i;
>  
> -if (pb->eof_reached)
> -return AVERROR_EOF;

The code should not silently accept a truncated stco as undamaged.
That way the user would have no way to know that the file is truncated

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

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf


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


Re: [FFmpeg-devel] [PATCH 3/4] avformat/movenc: force colr atom for uncompressed yuv in mov

2017-11-19 Thread James Almer
On 11/18/2017 11:19 PM, Dave Rice wrote:
> From 41da5e48f8788b85dd7a382030bb2866c506cc03 Mon Sep 17 00:00:00 2001
> From: Dave Rice 
> Date: Sat, 18 Nov 2017 20:31:27 -0500
> Subject: [PATCH 3/4] avformat/movenc: force colr atom for uncompressed yuv in
>  mov
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> As required by Apple’s TN2162.
> ---
>  libavformat/movenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index aaa1dedfd7..86960b19c1 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -1978,7 +1978,7 @@ static int mov_write_video_tag(AVIOContext *pb, 
> MOVMuxContext *mov, MOVTrack *tr
>  else
>  av_log(mov->fc, AV_LOG_WARNING, "Not writing 'gama' atom. Format 
> is not MOV.\n");
>  }
> -if (mov->flags & FF_MOV_FLAG_WRITE_COLR) {
> +if (mov->flags & FF_MOV_FLAG_WRITE_COLR || uncompressed_ycbcr) {
>  if (track->mode == MODE_MOV || track->mode == MODE_MP4)
>  mov_write_colr_tag(pb, track);
>  else
> 

The write_colr option says "Write colr atom (Experimental, may be
renamed or changed, do not use from scripts)". Does that still apply? Is
the feature/spec still experimental?

If not, then the option and flag could be removed as well as part of
this patch.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH V3] examples/vaapi_encode: Add a VA-API encode example.

2017-11-19 Thread Jun Zhao
V3: Use av_hwframe_transfer_date load YUV to HW surface
From c0edef97f4f123e74e62396b45db01236ae6477d Mon Sep 17 00:00:00 2001
From: Jun Zhao 
Date: Mon, 6 Nov 2017 14:45:27 +0800
Subject: [PATCH V3] examples/vaapi_encode: Add a VA-API encode example.

add a VA-API encode example, only support NV12 input, usage like:
./vaapi_encode 1920 1080 test.yuv test.h264

Signed-off-by: Jun Zhao 
Signed-off-by: Liu, Kaixuan 
---
 configure   |   2 +
 doc/examples/Makefile   |   1 +
 doc/examples/vaapi_encode.c | 225 
 3 files changed, 228 insertions(+)
 create mode 100644 doc/examples/vaapi_encode.c

diff --git a/configure b/configure
index 8262358138..ea029750c7 100755
--- a/configure
+++ b/configure
@@ -1521,6 +1521,7 @@ EXAMPLE_LIST="
 scaling_video_example
 transcode_aac_example
 transcoding_example
+vaapi_encode_example
 "
 
 EXTERNAL_AUTODETECT_LIBRARY_LIST="
@@ -3308,6 +3309,7 @@ resampling_audio_example_deps="avutil swresample"
 scaling_video_example_deps="avutil swscale"
 transcode_aac_example_deps="avcodec avformat swresample"
 transcoding_example_deps="avfilter avcodec avformat avutil"
+vaapi_encode_example_deps="avfilter avcodec avformat avutil"
 
 # EXTRALIBS_LIST
 cpu_init_extralibs="pthreads_extralibs"
diff --git a/doc/examples/Makefile b/doc/examples/Makefile
index 58afd71b85..da5af36532 100644
--- a/doc/examples/Makefile
+++ b/doc/examples/Makefile
@@ -19,6 +19,7 @@ EXAMPLES-$(CONFIG_RESAMPLING_AUDIO_EXAMPLE)  += 
resampling_audio
 EXAMPLES-$(CONFIG_SCALING_VIDEO_EXAMPLE) += scaling_video
 EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE) += transcode_aac
 EXAMPLES-$(CONFIG_TRANSCODING_EXAMPLE)   += transcoding
+EXAMPLES-$(CONFIG_VAAPI_ENCODE_EXAMPLE)  += vaapi_encode
 
 EXAMPLES   := $(EXAMPLES-yes:%=doc/examples/%$(PROGSSUF)$(EXESUF))
 EXAMPLES_G := $(EXAMPLES-yes:%=doc/examples/%$(PROGSSUF)_g$(EXESUF))
diff --git a/doc/examples/vaapi_encode.c b/doc/examples/vaapi_encode.c
new file mode 100644
index 00..c4b763773d
--- /dev/null
+++ b/doc/examples/vaapi_encode.c
@@ -0,0 +1,225 @@
+/*
+ * Video Acceleration API (video encoding) encode sample
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * Intel VAAPI-accelerated encoding example.
+ *
+ * @example vaapi_encode.c
+ * This example shows how to do VAAPI-accelerated encoding. now only support 
NV12
+ * raw file, usage like: vaapi_encode 1920 1080 input.yuv output.h264
+ *
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+static int width, height;
+static AVBufferRef *hw_device_ctx = NULL;
+
+static int set_hwframe_ctx(AVCodecContext *ctx, AVBufferRef *hw_device_ctx)
+{
+AVBufferRef *hw_frames_ref;
+AVHWFramesContext *frames_ctx = NULL;
+int err = 0;
+
+if (!(hw_frames_ref = av_hwframe_ctx_alloc(hw_device_ctx))) {
+fprintf(stderr, "Failed to create VAAPI frame context.\n");
+return -1;
+}
+frames_ctx = (AVHWFramesContext *)(hw_frames_ref->data);
+frames_ctx->format= AV_PIX_FMT_VAAPI;
+frames_ctx->sw_format = AV_PIX_FMT_NV12;
+frames_ctx->width = width;
+frames_ctx->height= height;
+frames_ctx->initial_pool_size = 20;
+if ((err = av_hwframe_ctx_init(hw_frames_ref)) < 0) {
+fprintf(stderr, "Failed to initialize VAAPI frame context."
+"Error code: %s\n",av_err2str(err));
+return err;
+}
+ctx->hw_frames_ctx = av_buffer_ref(hw_frames_ref);
+if (!ctx->hw_frames_ctx)
+err = AVERROR(ENOMEM);
+
+av_buffer_unref(&hw_frames_ref);
+return err;
+}
+
+static int encode_write(AVCodecContext *avctx, AVFrame *frame, FILE *fout)
+{
+int ret = 0;
+AVPacket enc_pkt;
+
+av_init_packet(&enc_pkt);
+enc_pkt.data = NULL;
+enc_pkt.size = 0;
+
+if ((ret = avcodec_send_frame(avctx, frame)) < 0) {
+fprintf(stderr, "Error code: %s\n", av_err2str(ret));
+goto end;
+}
+while (1) {
+ret = avcodec_receive_packet(avctx, &enc_pkt);
+if (ret)
+break;
+
+enc_pkt.stream_index = 0;
+ret = fwrite(enc_pkt.data, enc_pkt.size, 1, fout);
+av_packet_unref(&enc_pkt);
+}
+
+end:
+ret = 

Re: [FFmpeg-devel] [PATCH 3/4] avformat/movenc: force colr atom for uncompressed yuv in mov

2017-11-19 Thread Michael Niedermayer
On Sun, Nov 19, 2017 at 10:24:41PM -0300, James Almer wrote:
> On 11/18/2017 11:19 PM, Dave Rice wrote:
> > From 41da5e48f8788b85dd7a382030bb2866c506cc03 Mon Sep 17 00:00:00 2001
> > From: Dave Rice 
> > Date: Sat, 18 Nov 2017 20:31:27 -0500
> > Subject: [PATCH 3/4] avformat/movenc: force colr atom for uncompressed yuv 
> > in
> >  mov
> > MIME-Version: 1.0
> > Content-Type: text/plain; charset=UTF-8
> > Content-Transfer-Encoding: 8bit
> > 
> > As required by Apple’s TN2162.
> > ---
> >  libavformat/movenc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> > index aaa1dedfd7..86960b19c1 100644
> > --- a/libavformat/movenc.c
> > +++ b/libavformat/movenc.c
> > @@ -1978,7 +1978,7 @@ static int mov_write_video_tag(AVIOContext *pb, 
> > MOVMuxContext *mov, MOVTrack *tr
> >  else
> >  av_log(mov->fc, AV_LOG_WARNING, "Not writing 'gama' atom. 
> > Format is not MOV.\n");
> >  }
> > -if (mov->flags & FF_MOV_FLAG_WRITE_COLR) {
> > +if (mov->flags & FF_MOV_FLAG_WRITE_COLR || uncompressed_ycbcr) {
> >  if (track->mode == MODE_MOV || track->mode == MODE_MP4)
> >  mov_write_colr_tag(pb, track);
> >  else
> > 
> 
> The write_colr option says "Write colr atom (Experimental, may be
> renamed or changed, do not use from scripts)". Does that still apply? Is
> the feature/spec still experimental?
> 
> If not, then the option and flag could be removed as well as part of
> this patch.

hmm, ill wait with applying this patch until this is decided

thanks

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

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.


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


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: creation of hls variant streams with master playlist in a single hlsenc instance

2017-11-19 Thread 刘歧

> 在 2017年11月16日,17:01,Dixit, Vishwanath  写道:
> 
> 
> 
>> On 11/16/17, 12:09 PM, "刘歧"  wrote:
>> 
>>   FATE test passed:  Ubuntu, OS X, qemu+MIPS Linux,  wine MingW, qemu+ARM 
>> Linux, Thanks.
>> 
>> +if (p) {
>>   +strcpy(extension, p);
>>   What about use av_strlcpy ?
>> 
>> +while (q < varstr + strlen(varstr)) {
>>  +if (!strncmp(q, "a:", 2) || !strncmp(q, "v:", 2) ||
>>  +!strncmp(q, "s:", 2))
>>  What about use av_strcasecmp ?
>> 
>> +} else {
>>   +av_log(s, AV_LOG_ERROR, "Invalid keyval %s\n", keyval);
>>   +return -1;
>>   What about use return AVERROR(EINVAL)?
>> 
>> +} else {
>>  +av_log(s, AV_LOG_ERROR, "Unable to map stream at %s\n", 
>> keyval);
>>  +return -1;
>>  same as above.
>> 
>> +strrchr(master_url, '\\');
>>   +if (p) {
>>   +base_len = abs(p - master_url);
>>   use FFABS
>> 
>>  +if (strncmp(master_url, media_url, base_len)) {
>>  use av_strcasecmp
> 
> I have made updates for all the review comments. Please find the updated 
> patch set in the attachment.
> 
> 
> <0001-avformat-hlsenc-creation-of-hls-variant-streams-in-a.patch><0002-avformat-hlsenc-creation-of-hls-master-playlist-file.patch><0003-tests-fate-addition-of-test-case-for-hls-variant-str.patch>___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

pushed!




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


Re: [FFmpeg-devel] [PATCH 07/11] avformat/mxf: use FFABS to instead of abs

2017-11-19 Thread Steven Liu
2017-11-16 22:59 GMT+08:00 Michael Niedermayer :
> On Wed, Nov 15, 2017 at 03:44:39PM +0800, Steven Liu wrote:
>> Signed-off-by: Steven Liu 
>> ---
>>  libavformat/mxf.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> LGTM
>
Pushed

Thx
> thx
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> In a rich man's house there is no place to spit but his face.
> -- Diogenes of Sinope
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 05/11] avformat/mp3dec: use FFABS to instead of abs

2017-11-19 Thread Steven Liu
2017-11-16 22:58 GMT+08:00 Michael Niedermayer :
> On Wed, Nov 15, 2017 at 03:44:17PM +0800, Steven Liu wrote:
>> Signed-off-by: Steven Liu 
>> ---
>>  libavformat/mp3dec.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> LGTM
>
Pushed

Thx
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
> questions about the command line tools should be sent to the ffmpeg-user ML.
> And questions about how to use libav* should be sent to the libav-user ML.
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 09/11] avformat/swfenc: use FFABS to instead of abs

2017-11-19 Thread Steven Liu
2017-11-16 23:00 GMT+08:00 Michael Niedermayer :
> On Wed, Nov 15, 2017 at 03:45:03PM +0800, Steven Liu wrote:
>> Signed-off-by: Steven Liu 
>> ---
>>  libavformat/swfenc.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> LGTM
>

Pushed

Thx
> thx
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Its not that you shouldnt use gotos but rather that you should write
> readable code and code with gotos often but not always is less readable
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: creation of hls variant streams with master playlist in a single hlsenc instance

2017-11-19 Thread Dixit, Vishwanath


>On 11/20/17, 7:38 AM, "刘歧"  wrote:
>pushed!

Thank you!! (

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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add queue option

2017-11-19 Thread Gyan Doshi


On 11/20/2017 5:04 AM, Thilo Borgmann wrote:


min_start
n_begin


start_delay ?

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


Re: [FFmpeg-devel] [PATCH 1/1] avformat/dashenc: Added configuration to override HTTP User-Agent

2017-11-19 Thread Jeyapal, Karthick
Looks like nobody has any objection for the below patch. Can somebody please 
push this.

Regards,
Karthick

On 11/8/17, 2:53 PM, "Karthick J"  wrote:

---
 doc/muxers.texi   |  2 ++
 libavformat/dashenc.c | 22 +++---
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 91bbe67..412fede 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -247,6 +247,8 @@ DASH-templated name to used for the initialization segment. 
Default is "init-str
 DASH-templated name to used for the media segments. Default is 
"chunk-stream$RepresentationID$-$Number%05d$.m4s"
 @item -utc_timing_url @var{utc_url}
 URL of the page that will return the UTC timestamp in ISO format. Example: 
"https://time.akamai.com/?iso";
+@item -http_user_agent @var{user_agent}
+Override User-Agent field in HTTP header. Applicable only for HTTP output.
 @item -adaptation_sets @var{adaptation_sets}
 Assign streams to AdaptationSets. Syntax is "id=x,streams=a,b,c 
id=y,streams=d,e" with x and y being the IDs
 of the adaptation sets and a,b,c,d and e are the indices of the mapped streams.
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 7813f44..a68f7fb 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -100,6 +100,7 @@ typedef struct DASHContext {
 const char *init_seg_name;
 const char *media_seg_name;
 const char *utc_timing_url;
+const char *user_agent;
 } DASHContext;
 
 static struct codec_string {
@@ -210,6 +211,12 @@ static int flush_dynbuf(OutputStream *os, int 
*range_length)
 return avio_open_dyn_buf(&os->ctx->pb);
 }
 
+static void set_http_options(AVDictionary **options, DASHContext *c)
+{
+if (c->user_agent)
+av_dict_set(options, "user_agent", c->user_agent, 0);
+}
+
 static int flush_init_segment(AVFormatContext *s, OutputStream *os)
 {
 DASHContext *c = s->priv_data;
@@ -575,16 +582,19 @@ static int write_manifest(AVFormatContext *s, int final)
 int use_rename = proto && !strcmp(proto, "file");
 static unsigned int warned_non_file = 0;
 AVDictionaryEntry *title = av_dict_get(s->metadata, "title", NULL, 0);
+AVDictionary *opts = NULL;
 
 if (!use_rename && !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");
 
 snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : 
"%s", s->filename);
-ret = s->io_open(s, &out, temp_filename, AVIO_FLAG_WRITE, NULL);
+set_http_options(&opts, c);
+ret = s->io_open(s, &out, temp_filename, AVIO_FLAG_WRITE, &opts);
 if (ret < 0) {
 av_log(s, AV_LOG_ERROR, "Unable to open %s for writing\n", 
temp_filename);
 return ret;
 }
+av_dict_free(&opts);
 avio_printf(out, "\n");
 avio_printf(out, "http://www.w3.org/2001/XMLSchema-instance\"\n";
 "\txmlns=\"urn:mpeg:dash:schema:mpd:2011\"\n"
@@ -768,9 +778,11 @@ static int dash_init(AVFormatContext *s)
 ff_dash_fill_tmpl_params(os->initfile, sizeof(os->initfile), 
c->init_seg_name, i, 0, os->bit_rate, 0);
 }
 snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile);
-ret = s->io_open(s, &os->out, filename, AVIO_FLAG_WRITE, NULL);
+set_http_options(&opts, c);
+ret = s->io_open(s, &os->out, filename, AVIO_FLAG_WRITE, &opts);
 if (ret < 0)
 return ret;
+av_dict_free(&opts);
 os->init_start_pos = 0;
 
 if (!strcmp(os->format_name, "mp4")) {
@@ -974,12 +986,15 @@ static int dash_flush(AVFormatContext *s, int final, int 
stream)
 }
 
 if (!c->single_file) {
+AVDictionary *opts = NULL;
 ff_dash_fill_tmpl_params(filename, sizeof(filename), 
c->media_seg_name, i, os->segment_index, os->bit_rate, os->start_pts);
 snprintf(full_path, sizeof(full_path), "%s%s", c->dirname, 
filename);
 snprintf(temp_path, sizeof(temp_path), use_rename ? "%s.tmp" : 
"%s", full_path);
-ret = s->io_open(s, &os->out, temp_path, AVIO_FLAG_WRITE, NULL);
+set_http_options(&opts, c);
+ret = s->io_open(s, &os->out, temp_path, AVIO_FLAG_WRITE, &opts);
 if (ret < 0)
 break;
+av_dict_free(&opts);
 if (!strcmp(os->format_name, "mp4"))
 write_styp(os->ctx->pb);
 } else {
@@ -1188,6 +1203,7 @@ static const AVOption options[] = {
 { "init_seg_name", "DASH-templated name to used for the initialization 
segment", OFFSET(init_seg_name), AV_OPT_TYPE_STRING, {.str = 
"init-stream$RepresentationID$.m4s"}, 0, 0, E },
 { "media_seg_name", "DASH-templated name to used for the media segments", 
OFFSET(media_seg_name), AV_OPT_TYPE_STRING, {.str = 
"chunk-stream$RepresentationID$-$Number%05d$.m4s"}, 0, 0, E },
 { "utc_timing_url", "URL of the page that will return the UTC timestamp in 
ISO format", OF

Re: [FFmpeg-devel] [PATCH 3/3] avformat/opensrt: add Haivision Open SRT protocol

2017-11-19 Thread nablet developer

> 
> Thanks for explaining. I think it is not the best decision.
> 
> The reason the socket API resembles TCP is because all the sockets API
> resemble each other, since they are based on the old BSD socket API. And
> the protocol handlers of libavformat too.
> 
> Therefore, I think all the trampoline code to allow TCP to call back
> another protocol plus all the boilerplate code that you need to make
> opensrc callable from TCP amounts to worse than implementing a protocol
> directly.
> 
> Furthermore, TCP is the most important network protocol for now, while
> opensrt is still rather obscure, so tying one with the other is not a
> good idea.
> 
> Also, implementing a real protocol from scratch would possibly allow you
> to make use of extra features of the opensrt API: maybe they have a
> read-with-timeout function, for example, or something like that.
> 
> 

thanks for the feedback.
regarding relying on TCP protocol code it's clear - I will implement protocol 
from scratch next time.
regarding re-using functions from network.c (like ff_network_wait_fd, 
ff_accept, etc)
is suggested approach acceptable? is it okay to define such socket_api 
structure and pass to
network.c calls?

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


[FFmpeg-devel] [PATCH] avformat/avio: check input URLContext value NULL

2017-11-19 Thread Steven Liu
fix ticket id: #6846

Signed-off-by: Steven Liu 
---
 libavformat/avio.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index 4dc468350c..e719326660 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -625,6 +625,8 @@ int64_t ffurl_size(URLContext *h)
 
 int ffurl_get_file_handle(URLContext *h)
 {
+if (!h)
+return AVERROR(EINVAL);
 if (!h->prot->url_get_file_handle)
 return -1;
 return h->prot->url_get_file_handle(h);
@@ -632,6 +634,8 @@ int ffurl_get_file_handle(URLContext *h)
 
 int ffurl_get_multi_file_handle(URLContext *h, int **handles, int *numhandles)
 {
+if (!h)
+return AVERROR(EINVAL);
 if (!h->prot->url_get_multi_file_handle) {
 if (!h->prot->url_get_file_handle)
 return AVERROR(ENOSYS);
@@ -647,6 +651,8 @@ int ffurl_get_multi_file_handle(URLContext *h, int 
**handles, int *numhandles)
 
 int ffurl_get_short_seek(URLContext *h)
 {
+if (!h)
+return AVERROR(EINVAL);
 if (!h->prot->url_get_short_seek)
 return AVERROR(ENOSYS);
 return h->prot->url_get_short_seek(h);
@@ -654,6 +660,8 @@ int ffurl_get_short_seek(URLContext *h)
 
 int ffurl_shutdown(URLContext *h, int flags)
 {
+if (!h)
+return AVERROR(EINVAL);
 if (!h->prot->url_shutdown)
 return AVERROR(EINVAL);
 return h->prot->url_shutdown(h, flags);
-- 
2.13.6 (Apple Git-96)



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


Re: [FFmpeg-devel] [PATCH] avformat/avio: check input URLContext value NULL

2017-11-19 Thread Jun Zhao


On 2017/11/20 14:45, Steven Liu wrote:
> fix ticket id: #6846
>
> Signed-off-by: Steven Liu 
> ---
>  libavformat/avio.c | 8 
>  1 file changed, 8 insertions(+)
>
> diff --git a/libavformat/avio.c b/libavformat/avio.c
> index 4dc468350c..e719326660 100644
> --- a/libavformat/avio.c
> +++ b/libavformat/avio.c
> @@ -625,6 +625,8 @@ int64_t ffurl_size(URLContext *h)
>  
>  int ffurl_get_file_handle(URLContext *h)
>  {
> +if (!h)
> +return AVERROR(EINVAL);
>  if (!h->prot->url_get_file_handle)
I think (!h && !h->prot && !h->prot->url_get_file_handle) more better
than this

>  return -1;
>  return h->prot->url_get_file_handle(h);
> @@ -632,6 +634,8 @@ int ffurl_get_file_handle(URLContext *h)
>  
>  int ffurl_get_multi_file_handle(URLContext *h, int **handles, int 
> *numhandles)
>  {
> +if (!h)
> +return AVERROR(EINVAL);
>  if (!h->prot->url_get_multi_file_handle) {
>  if (!h->prot->url_get_file_handle)
>  return AVERROR(ENOSYS);
> @@ -647,6 +651,8 @@ int ffurl_get_multi_file_handle(URLContext *h, int 
> **handles, int *numhandles)
>  
>  int ffurl_get_short_seek(URLContext *h)
>  {
> +if (!h)
> +return AVERROR(EINVAL);
>  if (!h->prot->url_get_short_seek)
>  return AVERROR(ENOSYS);
>  return h->prot->url_get_short_seek(h);
> @@ -654,6 +660,8 @@ int ffurl_get_short_seek(URLContext *h)
>  
>  int ffurl_shutdown(URLContext *h, int flags)
>  {
> +if (!h)
> +return AVERROR(EINVAL);
>  if (!h->prot->url_shutdown)
>  return AVERROR(EINVAL);
>  return h->prot->url_shutdown(h, flags);

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


Re: [FFmpeg-devel] [PATCH 1/1] avformat/dashenc: Added configuration to override HTTP User-Agent

2017-11-19 Thread 刘歧

> 在 2017年11月8日,17:22,Karthick J  写道:
> 
> ---
> doc/muxers.texi   |  2 ++
> libavformat/dashenc.c | 22 +++---
> 2 files changed, 21 insertions(+), 3 deletions(-)
> 
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index 91bbe67..412fede 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -247,6 +247,8 @@ DASH-templated name to used for the initialization 
> segment. Default is "init-str
> DASH-templated name to used for the media segments. Default is 
> "chunk-stream$RepresentationID$-$Number%05d$.m4s"
> @item -utc_timing_url @var{utc_url}
> URL of the page that will return the UTC timestamp in ISO format. Example: 
> "https://time.akamai.com/?iso";
> +@item -http_user_agent @var{user_agent}
> +Override User-Agent field in HTTP header. Applicable only for HTTP output.
> @item -adaptation_sets @var{adaptation_sets}
> Assign streams to AdaptationSets. Syntax is "id=x,streams=a,b,c 
> id=y,streams=d,e" with x and y being the IDs
> of the adaptation sets and a,b,c,d and e are the indices of the mapped 
> streams.
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index 7813f44..a68f7fb 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -100,6 +100,7 @@ typedef struct DASHContext {
> const char *init_seg_name;
> const char *media_seg_name;
> const char *utc_timing_url;
> +const char *user_agent;
> } DASHContext;
> 
> static struct codec_string {
> @@ -210,6 +211,12 @@ static int flush_dynbuf(OutputStream *os, int 
> *range_length)
> return avio_open_dyn_buf(&os->ctx->pb);
> }
> 
> +static void set_http_options(AVDictionary **options, DASHContext *c)
> +{
> +if (c->user_agent)
> +av_dict_set(options, "user_agent", c->user_agent, 0);
> +}
> +
> static int flush_init_segment(AVFormatContext *s, OutputStream *os)
> {
> DASHContext *c = s->priv_data;
> @@ -575,16 +582,19 @@ static int write_manifest(AVFormatContext *s, int final)
> int use_rename = proto && !strcmp(proto, "file");
> static unsigned int warned_non_file = 0;
> AVDictionaryEntry *title = av_dict_get(s->metadata, "title", NULL, 0);
> +AVDictionary *opts = NULL;
> 
> if (!use_rename && !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");
> 
> snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : 
> "%s", s->filename);
> -ret = s->io_open(s, &out, temp_filename, AVIO_FLAG_WRITE, NULL);
> +set_http_options(&opts, c);
> +ret = s->io_open(s, &out, temp_filename, AVIO_FLAG_WRITE, &opts);
> if (ret < 0) {
> av_log(s, AV_LOG_ERROR, "Unable to open %s for writing\n", 
> temp_filename);
> return ret;
> }
> +av_dict_free(&opts);
> avio_printf(out, "\n");
> avio_printf(out, " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
> "\txmlns=\"urn:mpeg:dash:schema:mpd:2011\"\n"
> @@ -768,9 +778,11 @@ static int dash_init(AVFormatContext *s)
> ff_dash_fill_tmpl_params(os->initfile, sizeof(os->initfile), 
> c->init_seg_name, i, 0, os->bit_rate, 0);
> }
> snprintf(filename, sizeof(filename), "%s%s", c->dirname, 
> os->initfile);
> -ret = s->io_open(s, &os->out, filename, AVIO_FLAG_WRITE, NULL);
> +set_http_options(&opts, c);
> +ret = s->io_open(s, &os->out, filename, AVIO_FLAG_WRITE, &opts);
> if (ret < 0)
> return ret;
> +av_dict_free(&opts);
> os->init_start_pos = 0;
> 
> if (!strcmp(os->format_name, "mp4")) {
> @@ -974,12 +986,15 @@ static int dash_flush(AVFormatContext *s, int final, 
> int stream)
> }
> 
> if (!c->single_file) {
> +AVDictionary *opts = NULL;
> ff_dash_fill_tmpl_params(filename, sizeof(filename), 
> c->media_seg_name, i, os->segment_index, os->bit_rate, os->start_pts);
> snprintf(full_path, sizeof(full_path), "%s%s", c->dirname, 
> filename);
> snprintf(temp_path, sizeof(temp_path), use_rename ? "%s.tmp" : 
> "%s", full_path);
> -ret = s->io_open(s, &os->out, temp_path, AVIO_FLAG_WRITE, NULL);
> +set_http_options(&opts, c);
> +ret = s->io_open(s, &os->out, temp_path, AVIO_FLAG_WRITE, &opts);
> if (ret < 0)
> break;
> +av_dict_free(&opts);
> if (!strcmp(os->format_name, "mp4"))
> write_styp(os->ctx->pb);
> } else {
> @@ -1188,6 +1203,7 @@ static const AVOption options[] = {
> { "init_seg_name", "DASH-templated name to used for the initialization 
> segment", OFFSET(init_seg_name), AV_OPT_TYPE_STRING, {.str = 
> "init-stream$RepresentationID$.m4s"}, 0, 0, E },
> { "media_seg_name", "DASH-templated name to used for the media segments", 
> OFFSET(media_seg_name), AV_OPT_TYPE_STRING, {.str = 
> "chunk-stream$RepresentationID$-$Number%05d$.m4s"}, 0, 0, E },
> { "utc_timi

Re: [FFmpeg-devel] [PATCH] avformat/avio: check input URLContext value NULL

2017-11-19 Thread 刘歧


> 在 2017年11月20日,15:23,Jun Zhao  写道:
> 
> 
> 
> On 2017/11/20 14:45, Steven Liu wrote:
>> fix ticket id: #6846
>> 
>> Signed-off-by: Steven Liu 
>> ---
>> libavformat/avio.c | 8 
>> 1 file changed, 8 insertions(+)
>> 
>> diff --git a/libavformat/avio.c b/libavformat/avio.c
>> index 4dc468350c..e719326660 100644
>> --- a/libavformat/avio.c
>> +++ b/libavformat/avio.c
>> @@ -625,6 +625,8 @@ int64_t ffurl_size(URLContext *h)
>> 
>> int ffurl_get_file_handle(URLContext *h)
>> {
>> +if (!h)
>> +return AVERROR(EINVAL);
>> if (!h->prot->url_get_file_handle)
> I think (!h && !h->prot && !h->prot->url_get_file_handle) more better
> than this
maybe you mean (!h || !h->port || !h->prot->url_get_file_handle) , is it?
> 
>> return -1;
>> return h->prot->url_get_file_handle(h);
>> @@ -632,6 +634,8 @@ int ffurl_get_file_handle(URLContext *h)
>> 
>> int ffurl_get_multi_file_handle(URLContext *h, int **handles, int 
>> *numhandles)
>> {
>> +if (!h)
>> +return AVERROR(EINVAL);
>> if (!h->prot->url_get_multi_file_handle) {
>> if (!h->prot->url_get_file_handle)
>> return AVERROR(ENOSYS);
>> @@ -647,6 +651,8 @@ int ffurl_get_multi_file_handle(URLContext *h, int 
>> **handles, int *numhandles)
>> 
>> int ffurl_get_short_seek(URLContext *h)
>> {
>> +if (!h)
>> +return AVERROR(EINVAL);
>> if (!h->prot->url_get_short_seek)
>> return AVERROR(ENOSYS);
>> return h->prot->url_get_short_seek(h);
>> @@ -654,6 +660,8 @@ int ffurl_get_short_seek(URLContext *h)
>> 
>> int ffurl_shutdown(URLContext *h, int flags)
>> {
>> +if (!h)
>> +return AVERROR(EINVAL);
>> if (!h->prot->url_shutdown)
>> return AVERROR(EINVAL);
>> return h->prot->url_shutdown(h, flags);



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


Re: [FFmpeg-devel] [PATCH] avformat/avio: check input URLContext value NULL

2017-11-19 Thread Jun Zhao


On 2017/11/20 15:35, 刘歧 wrote:
>
>> 在 2017年11月20日,15:23,Jun Zhao  写道:
>>
>>
>>
>> On 2017/11/20 14:45, Steven Liu wrote:
>>> fix ticket id: #6846
>>>
>>> Signed-off-by: Steven Liu 
>>> ---
>>> libavformat/avio.c | 8 
>>> 1 file changed, 8 insertions(+)
>>>
>>> diff --git a/libavformat/avio.c b/libavformat/avio.c
>>> index 4dc468350c..e719326660 100644
>>> --- a/libavformat/avio.c
>>> +++ b/libavformat/avio.c
>>> @@ -625,6 +625,8 @@ int64_t ffurl_size(URLContext *h)
>>>
>>> int ffurl_get_file_handle(URLContext *h)
>>> {
>>> +if (!h)
>>> +return AVERROR(EINVAL);
>>> if (!h->prot->url_get_file_handle)
>> I think (!h && !h->prot && !h->prot->url_get_file_handle) more better
>> than this
> maybe you mean (!h || !h->port || !h->prot->url_get_file_handle) , is it?
No, I means
if (!h && !h->prot && !h->prot->url_get_file_handle)
 Do somthing
else
    return error;

>>> return -1;
>>> return h->prot->url_get_file_handle(h);
>>> @@ -632,6 +634,8 @@ int ffurl_get_file_handle(URLContext *h)
>>>
>>> int ffurl_get_multi_file_handle(URLContext *h, int **handles, int 
>>> *numhandles)
>>> {
>>> +if (!h)
>>> +return AVERROR(EINVAL);
>>> if (!h->prot->url_get_multi_file_handle) {
>>> if (!h->prot->url_get_file_handle)
>>> return AVERROR(ENOSYS);
>>> @@ -647,6 +651,8 @@ int ffurl_get_multi_file_handle(URLContext *h, int 
>>> **handles, int *numhandles)
>>>
>>> int ffurl_get_short_seek(URLContext *h)
>>> {
>>> +if (!h)
>>> +return AVERROR(EINVAL);
>>> if (!h->prot->url_get_short_seek)
>>> return AVERROR(ENOSYS);
>>> return h->prot->url_get_short_seek(h);
>>> @@ -654,6 +660,8 @@ int ffurl_get_short_seek(URLContext *h)
>>>
>>> int ffurl_shutdown(URLContext *h, int flags)
>>> {
>>> +if (!h)
>>> +return AVERROR(EINVAL);
>>> if (!h->prot->url_shutdown)
>>> return AVERROR(EINVAL);
>>> return h->prot->url_shutdown(h, flags);

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


Re: [FFmpeg-devel] [PATCH] fix bug in af_pan channel coefficient parser

2017-11-19 Thread Tobias Rapp

On 19.11.2017 17:39, Nicolas George wrote:

L'octidi 28 brumaire, an CCXXVI, Michael Roitzsch a écrit :

Hi FFmpeg team,

I was using af_pan to subtract one audio file from another. I first used an 
amerge filter and then configured the pan filter with a channel formula like 
c0=c0-c2|c1=c1-c3.

However, this does not work as expected. In debug output, I can see that 
channel 0 correctly uses gain coefficients 1 and -1 for c0 and c2. But channel 
1 incorrectly uses -1 and -1 for c1 and c3.

I looked into the code and found that the sign handling is currently wrong. 
When the last contribution of a formula is subtracted, the sign variable will 
be correctly set to -1 in line 191. But when then leaving the gains loop in 
line 189, because we reached the end of the formula for an output channel, sign 
is not reset. We therefore re-enter the gains loop for the next output channel 
with sign still -1. The first gain in this new formula will therefore be 
negated.

The attached patch fixes the problem for me.


Thanks, applied.


Would it be OK to backport the fix into release/3.4? I can do the 
cherry-picking but am unsure about the policies and what other older 
releases should possibly be adapted, too.


Regards,
Tobias

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


Re: [FFmpeg-devel] [PATCH] avformat/avio: check input URLContext value NULL

2017-11-19 Thread 刘歧


> 在 2017年11月20日,15:43,Jun Zhao  写道:
> 
> 
> 
> On 2017/11/20 15:35, 刘歧 wrote:
>> 
>>> 在 2017年11月20日,15:23,Jun Zhao  写道:
>>> 
>>> 
>>> 
>>> On 2017/11/20 14:45, Steven Liu wrote:
 fix ticket id: #6846
 
 Signed-off-by: Steven Liu 
 ---
 libavformat/avio.c | 8 
 1 file changed, 8 insertions(+)
 
 diff --git a/libavformat/avio.c b/libavformat/avio.c
 index 4dc468350c..e719326660 100644
 --- a/libavformat/avio.c
 +++ b/libavformat/avio.c
 @@ -625,6 +625,8 @@ int64_t ffurl_size(URLContext *h)
 
 int ffurl_get_file_handle(URLContext *h)
 {
 +if (!h)
 +return AVERROR(EINVAL);
if (!h->prot->url_get_file_handle)
>>> I think (!h && !h->prot && !h->prot->url_get_file_handle) more better
>>> than this
>> maybe you mean (!h || !h->port || !h->prot->url_get_file_handle) , is it?
> No, I means
> if (!h && !h->prot && !h->prot->url_get_file_handle)
>  Do somthing
will segmentation failed if !h is true, that is when h = NULL, and then get 
h->prot or h->prot->url_get_file_handle will in EXC_BAD_ACCESS.
So i this the better is (!h || !h->port || !h->prot->url_get_file_handle) 
return error.
> else
> return error;
> 
return -1;
return h->prot->url_get_file_handle(h);
 @@ -632,6 +634,8 @@ int ffurl_get_file_handle(URLContext *h)
 
 int ffurl_get_multi_file_handle(URLContext *h, int **handles, int 
 *numhandles)
 {
 +if (!h)
 +return AVERROR(EINVAL);
if (!h->prot->url_get_multi_file_handle) {
if (!h->prot->url_get_file_handle)
return AVERROR(ENOSYS);
 @@ -647,6 +651,8 @@ int ffurl_get_multi_file_handle(URLContext *h, int 
 **handles, int *numhandles)
 
 int ffurl_get_short_seek(URLContext *h)
 {
 +if (!h)
 +return AVERROR(EINVAL);
if (!h->prot->url_get_short_seek)
return AVERROR(ENOSYS);
return h->prot->url_get_short_seek(h);
 @@ -654,6 +660,8 @@ int ffurl_get_short_seek(URLContext *h)
 
 int ffurl_shutdown(URLContext *h, int flags)
 {
 +if (!h)
 +return AVERROR(EINVAL);
if (!h->prot->url_shutdown)
return AVERROR(EINVAL);
return h->prot->url_shutdown(h, flags);
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



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


Re: [FFmpeg-devel] [PATCH] avformat/avio: check input URLContext value NULL

2017-11-19 Thread Jun Zhao


On 2017/11/20 15:43, Jun Zhao wrote:
>
> On 2017/11/20 15:35, 刘歧 wrote:
>>> 在 2017年11月20日,15:23,Jun Zhao  写道:
>>>
>>>
>>>
>>> On 2017/11/20 14:45, Steven Liu wrote:
 fix ticket id: #6846

 Signed-off-by: Steven Liu 
 ---
 libavformat/avio.c | 8 
 1 file changed, 8 insertions(+)

 diff --git a/libavformat/avio.c b/libavformat/avio.c
 index 4dc468350c..e719326660 100644
 --- a/libavformat/avio.c
 +++ b/libavformat/avio.c
 @@ -625,6 +625,8 @@ int64_t ffurl_size(URLContext *h)

 int ffurl_get_file_handle(URLContext *h)
 {
 +if (!h)
 +return AVERROR(EINVAL);
 if (!h->prot->url_get_file_handle)
>>> I think (!h && !h->prot && !h->prot->url_get_file_handle) more better
>>> than this
>> maybe you mean (!h || !h->port || !h->prot->url_get_file_handle) , is it?
> No, I means
> if (!h && !h->prot && !h->prot->url_get_file_handle)
>  Do somthing
> else
>     return error;
Made a mistake in the comments, shame :(

you are right.

 return -1;
 return h->prot->url_get_file_handle(h);
 @@ -632,6 +634,8 @@ int ffurl_get_file_handle(URLContext *h)

 int ffurl_get_multi_file_handle(URLContext *h, int **handles, int 
 *numhandles)
 {
 +if (!h)
 +return AVERROR(EINVAL);
 if (!h->prot->url_get_multi_file_handle) {
 if (!h->prot->url_get_file_handle)
 return AVERROR(ENOSYS);
 @@ -647,6 +651,8 @@ int ffurl_get_multi_file_handle(URLContext *h, int 
 **handles, int *numhandles)

 int ffurl_get_short_seek(URLContext *h)
 {
 +if (!h)
 +return AVERROR(EINVAL);
 if (!h->prot->url_get_short_seek)
 return AVERROR(ENOSYS);
 return h->prot->url_get_short_seek(h);
 @@ -654,6 +660,8 @@ int ffurl_get_short_seek(URLContext *h)

 int ffurl_shutdown(URLContext *h, int flags)
 {
 +if (!h)
 +return AVERROR(EINVAL);
 if (!h->prot->url_shutdown)
 return AVERROR(EINVAL);
 return h->prot->url_shutdown(h, flags);

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