Re: [FFmpeg-devel] [PATCH 3/3] vf_colorspace: Allow overriding input color properties

2016-08-25 Thread Ronald S. Bultje
Hi Vittorio,

On Thu, Aug 25, 2016 at 7:14 PM, Vittorio Giovara <
vittorio.giov...@gmail.com> wrote:

> The filter needs input frames with color properties filled out by
> the decoder. Since this is not always possible, add input options to
> the filter so that user may override color space, color primaries,
> transfer characteristics, and color range.
>
> Signed-off-by: Vittorio Giovara 
> ---
> Please keep me in CC.
> Vittorio
>
[..]

> @@ -1014,6 +1022,9 @@ static const AVOption colorspace_options[] = {
>  { "space",  "Output colorspace",
>OFFSET(user_csp),   AV_OPT_TYPE_INT, { .i64 = AVCOL_SPC_UNSPECIFIED
> },
>AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, "csp" },
> +{ "ispace", "Input colorspace",
> +  OFFSET(user_icsp),  AV_OPT_TYPE_INT, { .i64 = AVCOL_SPC_UNSPECIFIED
> },
> +  AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, "csp" },
>  ENUM("bt709",   AVCOL_SPC_BT709,   "csp"),
>  ENUM("fcc", AVCOL_SPC_FCC, "csp"),
>  ENUM("bt470bg", AVCOL_SPC_BT470BG, "csp"),
> @@ -1024,12 +1035,18 @@ static const AVOption colorspace_options[] = {
>  { "range",  "Output color range",
>OFFSET(user_rng),   AV_OPT_TYPE_INT, { .i64 =
> AVCOL_RANGE_UNSPECIFIED },
>AVCOL_RANGE_UNSPECIFIED, AVCOL_RANGE_NB - 1, FLAGS, "rng" },
> +{ "irange", "Input color range",
> +  OFFSET(user_irng),  AV_OPT_TYPE_INT, { .i64 =
> AVCOL_RANGE_UNSPECIFIED },
> +  AVCOL_RANGE_UNSPECIFIED, AVCOL_RANGE_NB - 1, FLAGS, "rng" },
>  ENUM("mpeg",AVCOL_RANGE_MPEG,  "rng"),
>  ENUM("jpeg",AVCOL_RANGE_JPEG,  "rng"),
>
>  { "primaries",  "Output color primaries",
>OFFSET(user_prm),   AV_OPT_TYPE_INT, { .i64 = AVCOL_PRI_UNSPECIFIED
> },
>AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, "prm" },
> +{ "iprimaries", "Input color primaries",
> +  OFFSET(user_iprm),  AV_OPT_TYPE_INT, { .i64 = AVCOL_PRI_UNSPECIFIED
> },
> +  AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, "prm" },
>  ENUM("bt709",AVCOL_PRI_BT709,  "prm"),
>  ENUM("bt470m",   AVCOL_PRI_BT470M, "prm"),
>  ENUM("bt470bg",  AVCOL_PRI_BT470BG,"prm"),
> @@ -1040,6 +1057,9 @@ static const AVOption colorspace_options[] = {
>  { "trc","Output transfer characteristics",
>OFFSET(user_trc),   AV_OPT_TYPE_INT, { .i64 = AVCOL_TRC_UNSPECIFIED
> },
>AVCOL_TRC_RESERVED0, AVCOL_TRC_NB - 1, FLAGS, "trc" },
> +{ "itrc",   "Input transfer characteristics",
> +  OFFSET(user_itrc),  AV_OPT_TYPE_INT, { .i64 = AVCOL_TRC_UNSPECIFIED
> },
> +  AVCOL_TRC_RESERVED0, AVCOL_TRC_NB - 1, FLAGS, "trc" },
>  ENUM("bt709",AVCOL_TRC_BT709,"trc"),
>  ENUM("gamma22",  AVCOL_TRC_GAMMA22,  "trc"),
>  ENUM("gamma28",  AVCOL_TRC_GAMMA28,  "trc"),


Do you think it makes sense to have a "iall" property, similar to "all"?
iprm/irange/itr/iprimeries would take precedence over iall, but iall could
be used to set all 4 at once in the (common) case where they are consistent.

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


Re: [FFmpeg-devel] [PATCH 2/3] vf_colorspace: Add support for full range yuv

2016-08-25 Thread Ronald S. Bultje
Hi,

On Thu, Aug 25, 2016 at 7:14 PM, Vittorio Giovara <
vittorio.giov...@gmail.com> wrote:

> Whenever a full range video is input, since the YUVJ* formats are not
> listed as supported for this filter, a range reduction takes place
> through the auto-inserted format filter, forcing the conversion to
> operate on a limited range,
>
> However the filter handles full range videos perfectly fine, so adding
> support to YUVJ* formats will allow skipping a conversion step, while
> providing completely identical results.
>
> Signed-off-by: Vittorio Giovara 
> ---
> Please keep me in CC.
> Vittorio
>
>  libavfilter/vf_colorspace.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
> index bf51c83..37e77d1 100644
> --- a/libavfilter/vf_colorspace.c
> +++ b/libavfilter/vf_colorspace.c
> @@ -960,6 +960,7 @@ static int query_formats(AVFilterContext *ctx)
>  AV_PIX_FMT_YUV420P,   AV_PIX_FMT_YUV422P,   AV_PIX_FMT_YUV444P,
>  AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
>  AV_PIX_FMT_YUV420P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444P12,
> +AV_PIX_FMT_YUVJ420P,  AV_PIX_FMT_YUVJ422P,  AV_PIX_FMT_YUVJ444P,
>  AV_PIX_FMT_NONE
>  };
>  int res;
> --
> 2.9.3


I guess this is OK, I thought they were deprecated but I guess there is
natural conversion mechanism in place (passthrough to re-stamp yuvjN as
yuvN,range=full)...

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


Re: [FFmpeg-devel] [PATCH 1/3] vf_colorspace: Check av_frame_copy_props() return value

2016-08-25 Thread Ronald S. Bultje
Hi,

On Thu, Aug 25, 2016 at 7:14 PM, Vittorio Giovara <
vittorio.giov...@gmail.com> wrote:

> This function can potentially allocate memory.
> ---
> Please keep me in CC.
> Vittorio
>
>  libavfilter/vf_colorspace.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
> index 3d39f13..bf51c83 100644
> --- a/libavfilter/vf_colorspace.c
> +++ b/libavfilter/vf_colorspace.c
> @@ -861,7 +861,11 @@ static int filter_frame(AVFilterLink *link, AVFrame
> *in)
>  av_frame_free();
>  return AVERROR(ENOMEM);
>  }
> -av_frame_copy_props(out, in);
> +res = av_frame_copy_props(out, in);
> +if (res < 0) {
> +av_frame_free();
> +return res;
> +}
>
>  out->color_primaries = s->user_prm == AVCOL_PRI_UNSPECIFIED ?
> default_prm[FFMIN(s->user_all, CS_NB)] :
> s->user_prm;
> --
> 2.9.3


OK.

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


[FFmpeg-devel] [PATCH 2/2] tools/crypto_bench: add support for des

2016-08-25 Thread James Almer
Signed-off-by: James Almer 
---
Our DES implementation is awfully slow, for that matter. Almost two times
slower than OpenSSL's and GCrypt's.

lavu   DES  size: 1048576  runs:   1024  time:   73.947 +- 1.139
crypto DES  size: 1048576  runs:   1024  time:   42.895 +- 0.745
gcrypt DES  size: 1048576  runs:   1024  time:   39.753 +- 0.699

 tools/crypto_bench.c | 37 +
 1 file changed, 37 insertions(+)

diff --git a/tools/crypto_bench.c b/tools/crypto_bench.c
index 2535228..aea5ae9 100644
--- a/tools/crypto_bench.c
+++ b/tools/crypto_bench.c
@@ -78,6 +78,7 @@ struct hash_impl {
 #include "libavutil/blowfish.h"
 #include "libavutil/camellia.h"
 #include "libavutil/cast5.h"
+#include "libavutil/des.h"
 #include "libavutil/twofish.h"
 #include "libavutil/rc4.h"
 #include "libavutil/xtea.h"
@@ -148,6 +149,16 @@ static void run_lavu_cast128(uint8_t *output,
 av_cast5_crypt(cast, output, input, size >> 3, 0);
 }
 
+static void run_lavu_des(uint8_t *output,
+  const uint8_t *input, unsigned size)
+{
+static struct AVDES *des;
+if (!des && !(des = av_des_alloc()))
+fatal_error("out of memory");
+av_des_init(des, hardcoded_key, 64, 0);
+av_des_crypt(des, output, input, size >> 3, NULL, 0);
+}
+
 static void run_lavu_twofish(uint8_t *output,
   const uint8_t *input, unsigned size)
 {
@@ -184,6 +195,7 @@ static void run_lavu_xtea(uint8_t *output,
 
 #if (USE_EXT_LIBS) & USE_crypto
 
+#define OPENSSL_DISABLE_OLD_DES_SUPPORT
 #include 
 #include 
 #include 
@@ -191,6 +203,7 @@ static void run_lavu_xtea(uint8_t *output,
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #define DEFINE_CRYPTO_WRAPPER(suffix, function)  \
@@ -252,6 +265,17 @@ static void run_crypto_cast128(uint8_t *output,
 CAST_ecb_encrypt(input + i, output + i, , 1);
 }
 
+static void run_crypto_des(uint8_t *output,
+   const uint8_t *input, unsigned size)
+{
+DES_key_schedule des;
+unsigned i;
+
+DES_set_key(hardcoded_key, );
+for (i = 0; i < size; i += 8)
+DES_ecb_encrypt(input + i, output + i, , 1);
+}
+
 static void run_crypto_rc4(uint8_t *output,
 const uint8_t *input, unsigned size)
 {
@@ -302,6 +326,7 @@ DEFINE_GCRYPT_CYPHER_WRAPPER(aes128, AES128, 16)
 DEFINE_GCRYPT_CYPHER_WRAPPER(blowfish, BLOWFISH, 16)
 DEFINE_GCRYPT_CYPHER_WRAPPER(camellia, CAMELLIA128, 16)
 DEFINE_GCRYPT_CYPHER_WRAPPER(cast128, CAST5, 16)
+DEFINE_GCRYPT_CYPHER_WRAPPER(des, DES, 8)
 DEFINE_GCRYPT_CYPHER_WRAPPER(twofish, TWOFISH128, 16)
 
 #define IMPL_USE_gcrypt(...) IMPL_USE(__VA_ARGS__)
@@ -380,6 +405,17 @@ static void run_tomcrypt_cast128(uint8_t *output,
 cast5_ecb_encrypt(input + i, output + i, );
 }
 
+static void run_tomcrypt_des(uint8_t *output,
+ const uint8_t *input, unsigned size)
+{
+symmetric_key des;
+unsigned i;
+
+des_setup(hardcoded_key, 8, 0, );
+for (i = 0; i < size; i += 8)
+des_ecb_encrypt(input + i, output + i, );
+}
+
 static void run_tomcrypt_twofish(uint8_t *output,
 const uint8_t *input, unsigned size)
 {
@@ -491,6 +527,7 @@ struct hash_impl implementations[] = {
 IMPL_ALL("CAMELLIA",   camellia,  "crc:7abb59a7")
 IMPL_ALL("CAST-128",   cast128,   "crc:456aa584")
 IMPL_ALL("BLOWFISH",   blowfish,  "crc:33e8aa74")
+IMPL_ALL("DES",des,   "crc:31291e0b")
 IMPL(lavu, "TWOFISH", twofish, "crc:9edbd5c1")
 IMPL(gcrypt,   "TWOFISH", twofish, "crc:9edbd5c1")
 IMPL(tomcrypt, "TWOFISH", twofish, "crc:9edbd5c1")
-- 
2.9.1

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


[FFmpeg-devel] [PATCH 1/2] tools/crypto_bench: simply gcrypt functions using a macro

2016-08-25 Thread James Almer
Signed-off-by: James Almer 
---
 tools/crypto_bench.c | 65 +---
 1 file changed, 16 insertions(+), 49 deletions(-)

diff --git a/tools/crypto_bench.c b/tools/crypto_bench.c
index b3b24a6..2535228 100644
--- a/tools/crypto_bench.c
+++ b/tools/crypto_bench.c
@@ -287,55 +287,22 @@ DEFINE_GCRYPT_WRAPPER(sha256,SHA256)
 DEFINE_GCRYPT_WRAPPER(sha512,SHA512)
 DEFINE_GCRYPT_WRAPPER(ripemd160, RMD160)
 
-static void run_gcrypt_aes128(uint8_t *output,
-  const uint8_t *input, unsigned size)
-{
-static gcry_cipher_hd_t aes;
-if (!aes)
-gcry_cipher_open(, GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_ECB, 0);
-gcry_cipher_setkey(aes, hardcoded_key, 16);
-gcry_cipher_encrypt(aes, output, size, input, size);
-}
-
-static void run_gcrypt_blowfish(uint8_t *output,
-const uint8_t *input, unsigned size)
-{
-static gcry_cipher_hd_t blowfish;
-if (!blowfish)
-gcry_cipher_open(, GCRY_CIPHER_BLOWFISH, 
GCRY_CIPHER_MODE_ECB, 0);
-gcry_cipher_setkey(blowfish, hardcoded_key, 16);
-gcry_cipher_encrypt(blowfish, output, size, input, size);
-}
-
-static void run_gcrypt_camellia(uint8_t *output,
-const uint8_t *input, unsigned size)
-{
-static gcry_cipher_hd_t camellia;
-if (!camellia)
-gcry_cipher_open(, GCRY_CIPHER_CAMELLIA128, 
GCRY_CIPHER_MODE_ECB, 0);
-gcry_cipher_setkey(camellia, hardcoded_key, 16);
-gcry_cipher_encrypt(camellia, output, size, input, size);
-}
-
-static void run_gcrypt_cast128(uint8_t *output,
-  const uint8_t *input, unsigned size)
-{
-static gcry_cipher_hd_t cast;
-if (!cast)
-gcry_cipher_open(, GCRY_CIPHER_CAST5, GCRY_CIPHER_MODE_ECB, 0);
-gcry_cipher_setkey(cast, hardcoded_key, 16);
-gcry_cipher_encrypt(cast, output, size, input, size);
-}
-
-static void run_gcrypt_twofish(uint8_t *output,
-const uint8_t *input, unsigned size)
-{
-static gcry_cipher_hd_t twofish;
-if (!twofish)
-gcry_cipher_open(, GCRY_CIPHER_TWOFISH128, 
GCRY_CIPHER_MODE_ECB, 0);
-gcry_cipher_setkey(twofish, hardcoded_key, 16);
-gcry_cipher_encrypt(twofish, output, size, input, size);
-}
+#define DEFINE_GCRYPT_CYPHER_WRAPPER(suffix, cypher, sz)   
 \
+static void run_gcrypt_ ## suffix(uint8_t *output, 
 \
+  const uint8_t *input, unsigned size) 
 \
+{  
 \
+static gcry_cipher_hd_t suffix;
 \
+if (!suffix)   
 \
+gcry_cipher_open(, GCRY_CIPHER_ ## cypher, 
GCRY_CIPHER_MODE_ECB, 0); \
+gcry_cipher_setkey(suffix, hardcoded_key, sz); 
 \
+gcry_cipher_encrypt(suffix, output, size, input, size);
 \
+}
+
+DEFINE_GCRYPT_CYPHER_WRAPPER(aes128, AES128, 16)
+DEFINE_GCRYPT_CYPHER_WRAPPER(blowfish, BLOWFISH, 16)
+DEFINE_GCRYPT_CYPHER_WRAPPER(camellia, CAMELLIA128, 16)
+DEFINE_GCRYPT_CYPHER_WRAPPER(cast128, CAST5, 16)
+DEFINE_GCRYPT_CYPHER_WRAPPER(twofish, TWOFISH128, 16)
 
 #define IMPL_USE_gcrypt(...) IMPL_USE(__VA_ARGS__)
 #else
-- 
2.9.1

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


Re: [FFmpeg-devel] HLS Segmenter and the "hls_time" option

2016-08-25 Thread Ibrahim Tachijian
In my use case scenario I only need it for the very first couple of
segments.
After 5 segments it is not a problem anymore to have 5 second segments
only.



On Fri, Aug 26, 2016 at 4:25 AM Steven Liu  wrote:

> 2016-08-26 10:10 GMT+08:00 Ibrahim Tachijian :
>
> > yes that is correct Steven.
> >
> > On Fri, Aug 26, 2016 at 3:41 AM Steven Liu 
> > wrote:
> >
> > > 2016-08-26 8:17 GMT+08:00 Ibrahim Tachijian :
> > >
> > > > Steven, I am not sure you understood me correctly or perhaps I did
> not
> > > > explain myself optimally.
> > > >
> > > > We still want to split by keyframe in a normal fashion. But, for
> > example,
> > > > would like the first 5 segments to have an "hls_time" of 1s and the
> > rest
> > > of
> > > > the segments after the first 5 to have an "hls_time" of 5s.
> > > >
> > > > An made up option would be (hls_time_initial Seconds,Number)
> > > >
> > > >- "-hls_time_initial 1,5 -hls_time 5"
> > > >
> > > > The output playlist would contain segments (split at keyframes) 5
> > > segments
> > > > of length 1s and then any segment after the initial 5 segment would
> be
> > > 5s.
> > > >
> > > > Is it clear what I am trying to explain?
> > > >
> > > > What do you think? Do you know how this can be achieved?
> > > >
> > > > Thanks,
> > > >
> > > > On Fri, Aug 26, 2016 at 2:06 AM Steven Liu 
> > > > wrote:
> > > >
> > > > > 2016-08-26 7:39 GMT+08:00 Ibrahim Tachijian :
> > > > >
> > > > > > Hello,
> > > > > >
> > > > > > I've been thinking about an option for "hls_time" that is not
> > > currently
> > > > > > supported by FFMpeg and I would like feedback to if some of you
> may
> > > > think
> > > > > > this is useful or utterly unnecessary.
> > > > > >
> > > > > > I find scenarios where we sometimes want to create an HLS output
> > and
> > > > > would
> > > > > > like the *first couple of segments* to be shorter than the *rest
> of
> > > the
> > > > > > segments.*
> > > > > >
> > > > > > For example starting off with 1s segments up to N segments then
> > > switch
> > > > to
> > > > > > 5s segments.
> > > > > >
> > > > > > The reasoning is simply to have the playlist.m3u8 and first
> segment
> > > > > > available *asap.*
> > > > > >
> > > > > > What do you think? Do you know how this can be achieved?
> > > > > >
> > > > > > Thanks,
> > > > > >
> > > > >
> > > > > ffmpeg split segment use hlsenc by keyframe, if you want to split
> > > segment
> > > > > *ASAP*,
> > > > > you can try set your streaming *GOP(Group Of Picture)* shorter,
> > > > > for example: gop_size = 60,  c->time_base = (AVRational){1,60};
> > > > > in command line : -r:v 60 -g 60
> > > > >
> > > > > if can accept split segment at non-keyframe, you can use hls_time
> and
> > > > > hls_flags split_by_time.
> > > > > ___
> > > >
> > > you mean:
> > >
> > > segment-0.ts,segment-1.ts,segment-2.ts,segment-3.ts,segment-4.ts  these
> > 5
> > > segments duration is 1s
> > > and
> > > segment-5.ts,segment-6.ts,segment-7.ts .. these segment duration is
> > 5
> > > or set by hls_time
> > > Is that right i understand?
> >
> >
> OK , Thanks.
> That a good idea, but i have a question:
> when ffmpeg update the segment list after 10 segments, there have a new
> user to play the hls playlist, the m3u8 segments every ts segments'
> duration is the 5s.
> So do you want exec a new ffmpeg when every one play the hls playlist ?
> ___
> 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] HLS Segmenter and the "hls_time" option

2016-08-25 Thread Steven Liu
2016-08-26 10:10 GMT+08:00 Ibrahim Tachijian :

> yes that is correct Steven.
>
> On Fri, Aug 26, 2016 at 3:41 AM Steven Liu 
> wrote:
>
> > 2016-08-26 8:17 GMT+08:00 Ibrahim Tachijian :
> >
> > > Steven, I am not sure you understood me correctly or perhaps I did not
> > > explain myself optimally.
> > >
> > > We still want to split by keyframe in a normal fashion. But, for
> example,
> > > would like the first 5 segments to have an "hls_time" of 1s and the
> rest
> > of
> > > the segments after the first 5 to have an "hls_time" of 5s.
> > >
> > > An made up option would be (hls_time_initial Seconds,Number)
> > >
> > >- "-hls_time_initial 1,5 -hls_time 5"
> > >
> > > The output playlist would contain segments (split at keyframes) 5
> > segments
> > > of length 1s and then any segment after the initial 5 segment would be
> > 5s.
> > >
> > > Is it clear what I am trying to explain?
> > >
> > > What do you think? Do you know how this can be achieved?
> > >
> > > Thanks,
> > >
> > > On Fri, Aug 26, 2016 at 2:06 AM Steven Liu 
> > > wrote:
> > >
> > > > 2016-08-26 7:39 GMT+08:00 Ibrahim Tachijian :
> > > >
> > > > > Hello,
> > > > >
> > > > > I've been thinking about an option for "hls_time" that is not
> > currently
> > > > > supported by FFMpeg and I would like feedback to if some of you may
> > > think
> > > > > this is useful or utterly unnecessary.
> > > > >
> > > > > I find scenarios where we sometimes want to create an HLS output
> and
> > > > would
> > > > > like the *first couple of segments* to be shorter than the *rest of
> > the
> > > > > segments.*
> > > > >
> > > > > For example starting off with 1s segments up to N segments then
> > switch
> > > to
> > > > > 5s segments.
> > > > >
> > > > > The reasoning is simply to have the playlist.m3u8 and first segment
> > > > > available *asap.*
> > > > >
> > > > > What do you think? Do you know how this can be achieved?
> > > > >
> > > > > Thanks,
> > > > >
> > > >
> > > > ffmpeg split segment use hlsenc by keyframe, if you want to split
> > segment
> > > > *ASAP*,
> > > > you can try set your streaming *GOP(Group Of Picture)* shorter,
> > > > for example: gop_size = 60,  c->time_base = (AVRational){1,60};
> > > > in command line : -r:v 60 -g 60
> > > >
> > > > if can accept split segment at non-keyframe, you can use hls_time and
> > > > hls_flags split_by_time.
> > > > ___
> > >
> > you mean:
> >
> > segment-0.ts,segment-1.ts,segment-2.ts,segment-3.ts,segment-4.ts  these
> 5
> > segments duration is 1s
> > and
> > segment-5.ts,segment-6.ts,segment-7.ts .. these segment duration is
> 5
> > or set by hls_time
> > Is that right i understand?
>
>
OK , Thanks.
That a good idea, but i have a question:
when ffmpeg update the segment list after 10 segments, there have a new
user to play the hls playlist, the m3u8 segments every ts segments'
duration is the 5s.
So do you want exec a new ffmpeg when every one play the hls playlist ?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] HLS Segmenter and the "hls_time" option

2016-08-25 Thread Ibrahim Tachijian
yes that is correct Steven.

On Fri, Aug 26, 2016 at 3:41 AM Steven Liu  wrote:

> 2016-08-26 8:17 GMT+08:00 Ibrahim Tachijian :
>
> > Steven, I am not sure you understood me correctly or perhaps I did not
> > explain myself optimally.
> >
> > We still want to split by keyframe in a normal fashion. But, for example,
> > would like the first 5 segments to have an "hls_time" of 1s and the rest
> of
> > the segments after the first 5 to have an "hls_time" of 5s.
> >
> > An made up option would be (hls_time_initial Seconds,Number)
> >
> >- "-hls_time_initial 1,5 -hls_time 5"
> >
> > The output playlist would contain segments (split at keyframes) 5
> segments
> > of length 1s and then any segment after the initial 5 segment would be
> 5s.
> >
> > Is it clear what I am trying to explain?
> >
> > What do you think? Do you know how this can be achieved?
> >
> > Thanks,
> >
> > On Fri, Aug 26, 2016 at 2:06 AM Steven Liu 
> > wrote:
> >
> > > 2016-08-26 7:39 GMT+08:00 Ibrahim Tachijian :
> > >
> > > > Hello,
> > > >
> > > > I've been thinking about an option for "hls_time" that is not
> currently
> > > > supported by FFMpeg and I would like feedback to if some of you may
> > think
> > > > this is useful or utterly unnecessary.
> > > >
> > > > I find scenarios where we sometimes want to create an HLS output and
> > > would
> > > > like the *first couple of segments* to be shorter than the *rest of
> the
> > > > segments.*
> > > >
> > > > For example starting off with 1s segments up to N segments then
> switch
> > to
> > > > 5s segments.
> > > >
> > > > The reasoning is simply to have the playlist.m3u8 and first segment
> > > > available *asap.*
> > > >
> > > > What do you think? Do you know how this can be achieved?
> > > >
> > > > Thanks,
> > > >
> > >
> > > ffmpeg split segment use hlsenc by keyframe, if you want to split
> segment
> > > *ASAP*,
> > > you can try set your streaming *GOP(Group Of Picture)* shorter,
> > > for example: gop_size = 60,  c->time_base = (AVRational){1,60};
> > > in command line : -r:v 60 -g 60
> > >
> > > if can accept split segment at non-keyframe, you can use hls_time and
> > > hls_flags split_by_time.
> > > ___
> >
> you mean:
>
> segment-0.ts,segment-1.ts,segment-2.ts,segment-3.ts,segment-4.ts  these 5
> segments duration is 1s
> and
> segment-5.ts,segment-6.ts,segment-7.ts .. these segment duration is 5
> or set by hls_time
> Is that right i understand?
> ___
> 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] HLS Segmenter and the "hls_time" option

2016-08-25 Thread Steven Liu
2016-08-26 8:17 GMT+08:00 Ibrahim Tachijian :

> Steven, I am not sure you understood me correctly or perhaps I did not
> explain myself optimally.
>
> We still want to split by keyframe in a normal fashion. But, for example,
> would like the first 5 segments to have an "hls_time" of 1s and the rest of
> the segments after the first 5 to have an "hls_time" of 5s.
>
> An made up option would be (hls_time_initial Seconds,Number)
>
>- "-hls_time_initial 1,5 -hls_time 5"
>
> The output playlist would contain segments (split at keyframes) 5 segments
> of length 1s and then any segment after the initial 5 segment would be 5s.
>
> Is it clear what I am trying to explain?
>
> What do you think? Do you know how this can be achieved?
>
> Thanks,
>
> On Fri, Aug 26, 2016 at 2:06 AM Steven Liu 
> wrote:
>
> > 2016-08-26 7:39 GMT+08:00 Ibrahim Tachijian :
> >
> > > Hello,
> > >
> > > I've been thinking about an option for "hls_time" that is not currently
> > > supported by FFMpeg and I would like feedback to if some of you may
> think
> > > this is useful or utterly unnecessary.
> > >
> > > I find scenarios where we sometimes want to create an HLS output and
> > would
> > > like the *first couple of segments* to be shorter than the *rest of the
> > > segments.*
> > >
> > > For example starting off with 1s segments up to N segments then switch
> to
> > > 5s segments.
> > >
> > > The reasoning is simply to have the playlist.m3u8 and first segment
> > > available *asap.*
> > >
> > > What do you think? Do you know how this can be achieved?
> > >
> > > Thanks,
> > >
> >
> > ffmpeg split segment use hlsenc by keyframe, if you want to split segment
> > *ASAP*,
> > you can try set your streaming *GOP(Group Of Picture)* shorter,
> > for example: gop_size = 60,  c->time_base = (AVRational){1,60};
> > in command line : -r:v 60 -g 60
> >
> > if can accept split segment at non-keyframe, you can use hls_time and
> > hls_flags split_by_time.
> > ___
>
you mean:

segment-0.ts,segment-1.ts,segment-2.ts,segment-3.ts,segment-4.ts  these 5
segments duration is 1s
and
segment-5.ts,segment-6.ts,segment-7.ts .. these segment duration is 5
or set by hls_time
Is that right i understand?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] HLS Segmenter and the "hls_time" option

2016-08-25 Thread Ibrahim Tachijian
Steven, I am not sure you understood me correctly or perhaps I did not
explain myself optimally.

We still want to split by keyframe in a normal fashion. But, for example,
would like the first 5 segments to have an "hls_time" of 1s and the rest of
the segments after the first 5 to have an "hls_time" of 5s.

An made up option would be (hls_time_initial Seconds,Number)

   - "-hls_time_initial 1,5 -hls_time 5"

The output playlist would contain segments (split at keyframes) 5 segments
of length 1s and then any segment after the initial 5 segment would be 5s.

Is it clear what I am trying to explain?

What do you think? Do you know how this can be achieved?

Thanks,

On Fri, Aug 26, 2016 at 2:06 AM Steven Liu  wrote:

> 2016-08-26 7:39 GMT+08:00 Ibrahim Tachijian :
>
> > Hello,
> >
> > I've been thinking about an option for "hls_time" that is not currently
> > supported by FFMpeg and I would like feedback to if some of you may think
> > this is useful or utterly unnecessary.
> >
> > I find scenarios where we sometimes want to create an HLS output and
> would
> > like the *first couple of segments* to be shorter than the *rest of the
> > segments.*
> >
> > For example starting off with 1s segments up to N segments then switch to
> > 5s segments.
> >
> > The reasoning is simply to have the playlist.m3u8 and first segment
> > available *asap.*
> >
> > What do you think? Do you know how this can be achieved?
> >
> > Thanks,
> >
>
> ffmpeg split segment use hlsenc by keyframe, if you want to split segment
> *ASAP*,
> you can try set your streaming *GOP(Group Of Picture)* shorter,
> for example: gop_size = 60,  c->time_base = (AVRational){1,60};
> in command line : -r:v 60 -g 60
>
> if can accept split segment at non-keyframe, you can use hls_time and
> hls_flags split_by_time.
> ___
> 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] [GSoC] Motion Interpolation

2016-08-25 Thread Michael Niedermayer
On Thu, Aug 25, 2016 at 08:17:03PM +, Davinder Singh wrote:
> On Thu, Aug 25, 2016 at 8:03 PM Michael Niedermayer 
> wrote:
> 
> > [...]
> >
> > why do these not try predictors like epzs / umh ?
> > i guess some paper doesnt say exlpicitly it should be done
> > but really it should be done for all predictive zonal searches IMO
> >
> 
> this should be in different patch. no?

yes, different patch is probably easier

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle


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


Re: [FFmpeg-devel] [PATCH] libavcodec/bsfs: Fix bsf option setting

2016-08-25 Thread Michael Niedermayer
On Fri, Aug 26, 2016 at 12:47:12AM +0200, sebechlebsky...@gmail.com wrote:
> From: Jan Sebechlebsky 
> 
> AV_OPT_SEARCH_CHILDREN flag must be passed to av_opt_set_dict()
> to set options for private context.
> 
> Signed-off-by: Jan Sebechlebsky 
> ---
>  libavcodec/bsf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied

thx

[...]
-- 
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


Re: [FFmpeg-devel] HLS Segmenter and the "hls_time" option

2016-08-25 Thread Steven Liu
2016-08-26 7:39 GMT+08:00 Ibrahim Tachijian :

> Hello,
>
> I've been thinking about an option for "hls_time" that is not currently
> supported by FFMpeg and I would like feedback to if some of you may think
> this is useful or utterly unnecessary.
>
> I find scenarios where we sometimes want to create an HLS output and would
> like the *first couple of segments* to be shorter than the *rest of the
> segments.*
>
> For example starting off with 1s segments up to N segments then switch to
> 5s segments.
>
> The reasoning is simply to have the playlist.m3u8 and first segment
> available *asap.*
>
> What do you think? Do you know how this can be achieved?
>
> Thanks,
>

ffmpeg split segment use hlsenc by keyframe, if you want to split segment
*ASAP*,
you can try set your streaming *GOP(Group Of Picture)* shorter,
for example: gop_size = 60,  c->time_base = (AVRational){1,60};
in command line : -r:v 60 -g 60

if can accept split segment at non-keyframe, you can use hls_time and
hls_flags split_by_time.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] HLS Segmenter and the "hls_time" option

2016-08-25 Thread Ibrahim Tachijian
Hello,

I've been thinking about an option for "hls_time" that is not currently
supported by FFMpeg and I would like feedback to if some of you may think
this is useful or utterly unnecessary.

I find scenarios where we sometimes want to create an HLS output and would
like the *first couple of segments* to be shorter than the *rest of the
segments.*

For example starting off with 1s segments up to N segments then switch to
5s segments.

The reasoning is simply to have the playlist.m3u8 and first segment
available *asap.*

What do you think? Do you know how this can be achieved?

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


[FFmpeg-devel] [PATCH 1/3] vf_colorspace: Check av_frame_copy_props() return value

2016-08-25 Thread Vittorio Giovara
This function can potentially allocate memory.
---
Please keep me in CC.
Vittorio

 libavfilter/vf_colorspace.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
index 3d39f13..bf51c83 100644
--- a/libavfilter/vf_colorspace.c
+++ b/libavfilter/vf_colorspace.c
@@ -861,7 +861,11 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
 av_frame_free();
 return AVERROR(ENOMEM);
 }
-av_frame_copy_props(out, in);
+res = av_frame_copy_props(out, in);
+if (res < 0) {
+av_frame_free();
+return res;
+}
 
 out->color_primaries = s->user_prm == AVCOL_PRI_UNSPECIFIED ?
default_prm[FFMIN(s->user_all, CS_NB)] : 
s->user_prm;
-- 
2.9.3

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


[FFmpeg-devel] [PATCH 2/3] vf_colorspace: Add support for full range yuv

2016-08-25 Thread Vittorio Giovara
Whenever a full range video is input, since the YUVJ* formats are not
listed as supported for this filter, a range reduction takes place
through the auto-inserted format filter, forcing the conversion to
operate on a limited range,

However the filter handles full range videos perfectly fine, so adding
support to YUVJ* formats will allow skipping a conversion step, while
providing completely identical results.

Signed-off-by: Vittorio Giovara 
---
Please keep me in CC.
Vittorio

 libavfilter/vf_colorspace.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
index bf51c83..37e77d1 100644
--- a/libavfilter/vf_colorspace.c
+++ b/libavfilter/vf_colorspace.c
@@ -960,6 +960,7 @@ static int query_formats(AVFilterContext *ctx)
 AV_PIX_FMT_YUV420P,   AV_PIX_FMT_YUV422P,   AV_PIX_FMT_YUV444P,
 AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
 AV_PIX_FMT_YUV420P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444P12,
+AV_PIX_FMT_YUVJ420P,  AV_PIX_FMT_YUVJ422P,  AV_PIX_FMT_YUVJ444P,
 AV_PIX_FMT_NONE
 };
 int res;
-- 
2.9.3

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


[FFmpeg-devel] [PATCH 3/3] vf_colorspace: Allow overriding input color properties

2016-08-25 Thread Vittorio Giovara
The filter needs input frames with color properties filled out by
the decoder. Since this is not always possible, add input options to
the filter so that user may override color space, color primaries,
transfer characteristics, and color range.

Signed-off-by: Vittorio Giovara 
---
Please keep me in CC.
Vittorio

 libavfilter/vf_colorspace.c | 28 
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
index 37e77d1..8ef362e 100644
--- a/libavfilter/vf_colorspace.c
+++ b/libavfilter/vf_colorspace.c
@@ -129,10 +129,10 @@ typedef struct ColorSpaceContext {
 ColorSpaceDSPContext dsp;
 
 enum Colorspace user_all;
-enum AVColorSpace in_csp, out_csp, user_csp;
-enum AVColorRange in_rng, out_rng, user_rng;
-enum AVColorTransferCharacteristic in_trc, out_trc, user_trc;
-enum AVColorPrimaries in_prm, out_prm, user_prm;
+enum AVColorSpace in_csp, out_csp, user_csp, user_icsp;
+enum AVColorRange in_rng, out_rng, user_rng, user_irng;
+enum AVColorTransferCharacteristic in_trc, out_trc, user_trc, user_itrc;
+enum AVColorPrimaries in_prm, out_prm, user_prm, user_iprm;
 enum AVPixelFormat in_format, user_format;
 int fast_mode;
 enum DitherMode dither;
@@ -581,6 +581,8 @@ static int create_filtergraph(AVFilterContext *ctx,
 
 if (!s->out_primaries || !s->in_primaries) {
 s->in_prm = in->color_primaries;
+if (s->user_iprm != AVCOL_PRI_UNSPECIFIED)
+s->in_prm = s->user_iprm;
 s->in_primaries = get_color_primaries(s->in_prm);
 if (!s->in_primaries) {
 av_log(ctx, AV_LOG_ERROR,
@@ -638,6 +640,8 @@ static int create_filtergraph(AVFilterContext *ctx,
 if (!s->in_txchr) {
 av_freep(>lin_lut);
 s->in_trc = in->color_trc;
+if (s->user_itrc != AVCOL_TRC_UNSPECIFIED)
+s->in_trc = s->user_itrc;
 s->in_txchr = get_transfer_characteristics(s->in_trc);
 if (!s->in_txchr) {
 av_log(ctx, AV_LOG_ERROR,
@@ -680,7 +684,11 @@ static int create_filtergraph(AVFilterContext *ctx,
 
 if (!s->in_lumacoef) {
 s->in_csp = in->colorspace;
+if (s->user_icsp != AVCOL_SPC_UNSPECIFIED)
+s->in_csp = s->user_icsp;
 s->in_rng = in->color_range;
+if (s->user_irng != AVCOL_RANGE_UNSPECIFIED)
+s->in_rng = s->user_irng;
 s->in_lumacoef = get_luma_coefficients(s->in_csp);
 if (!s->in_lumacoef) {
 av_log(ctx, AV_LOG_ERROR,
@@ -1014,6 +1022,9 @@ static const AVOption colorspace_options[] = {
 { "space",  "Output colorspace",
   OFFSET(user_csp),   AV_OPT_TYPE_INT, { .i64 = AVCOL_SPC_UNSPECIFIED },
   AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, "csp" },
+{ "ispace", "Input colorspace",
+  OFFSET(user_icsp),  AV_OPT_TYPE_INT, { .i64 = AVCOL_SPC_UNSPECIFIED },
+  AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, "csp" },
 ENUM("bt709",   AVCOL_SPC_BT709,   "csp"),
 ENUM("fcc", AVCOL_SPC_FCC, "csp"),
 ENUM("bt470bg", AVCOL_SPC_BT470BG, "csp"),
@@ -1024,12 +1035,18 @@ static const AVOption colorspace_options[] = {
 { "range",  "Output color range",
   OFFSET(user_rng),   AV_OPT_TYPE_INT, { .i64 = AVCOL_RANGE_UNSPECIFIED },
   AVCOL_RANGE_UNSPECIFIED, AVCOL_RANGE_NB - 1, FLAGS, "rng" },
+{ "irange", "Input color range",
+  OFFSET(user_irng),  AV_OPT_TYPE_INT, { .i64 = AVCOL_RANGE_UNSPECIFIED },
+  AVCOL_RANGE_UNSPECIFIED, AVCOL_RANGE_NB - 1, FLAGS, "rng" },
 ENUM("mpeg",AVCOL_RANGE_MPEG,  "rng"),
 ENUM("jpeg",AVCOL_RANGE_JPEG,  "rng"),
 
 { "primaries",  "Output color primaries",
   OFFSET(user_prm),   AV_OPT_TYPE_INT, { .i64 = AVCOL_PRI_UNSPECIFIED },
   AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, "prm" },
+{ "iprimaries", "Input color primaries",
+  OFFSET(user_iprm),  AV_OPT_TYPE_INT, { .i64 = AVCOL_PRI_UNSPECIFIED },
+  AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, "prm" },
 ENUM("bt709",AVCOL_PRI_BT709,  "prm"),
 ENUM("bt470m",   AVCOL_PRI_BT470M, "prm"),
 ENUM("bt470bg",  AVCOL_PRI_BT470BG,"prm"),
@@ -1040,6 +1057,9 @@ static const AVOption colorspace_options[] = {
 { "trc","Output transfer characteristics",
   OFFSET(user_trc),   AV_OPT_TYPE_INT, { .i64 = AVCOL_TRC_UNSPECIFIED },
   AVCOL_TRC_RESERVED0, AVCOL_TRC_NB - 1, FLAGS, "trc" },
+{ "itrc",   "Input transfer characteristics",
+  OFFSET(user_itrc),  AV_OPT_TYPE_INT, { .i64 = AVCOL_TRC_UNSPECIFIED },
+  AVCOL_TRC_RESERVED0, AVCOL_TRC_NB - 1, FLAGS, "trc" },
 ENUM("bt709",AVCOL_TRC_BT709,"trc"),
 ENUM("gamma22",  AVCOL_TRC_GAMMA22,  "trc"),
 ENUM("gamma28",  AVCOL_TRC_GAMMA28,  "trc"),
-- 
2.9.3

___

[FFmpeg-devel] [PATCH] libavcodec/bsfs: Fix bsf option setting

2016-08-25 Thread sebechlebskyjan
From: Jan Sebechlebsky 

AV_OPT_SEARCH_CHILDREN flag must be passed to av_opt_set_dict()
to set options for private context.

Signed-off-by: Jan Sebechlebsky 
---
 libavcodec/bsf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
index 2462e62..dfb127e 100644
--- a/libavcodec/bsf.c
+++ b/libavcodec/bsf.c
@@ -432,7 +432,7 @@ int av_bsf_list_append2(AVBSFList *lst, const char 
*bsf_name, AVDictionary ** op
 return ret;
 
 if (options) {
-ret = av_opt_set_dict(bsf, options);
+ret = av_opt_set_dict2(bsf, options, AV_OPT_SEARCH_CHILDREN);
 if (ret < 0)
 goto end;
 }
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH v2 04/11] avformat/muxers: Add non-blocking mode support for av_write_trailer

2016-08-25 Thread Jan Sebechlebsky

On 08/22/2016 04:49 PM, Michael Niedermayer wrote:


On Mon, Aug 22, 2016 at 04:27:16PM +0200, Jan Sebechlebsky wrote:


On 08/22/2016 09:51 AM, Michael Niedermayer wrote:

On Thu, Aug 11, 2016 at 02:38:29PM +0200, sebechlebsky...@gmail.com wrote:

From: Jan Sebechlebsky 

This makes av_write_trailer not to free the resources if write_trailer
call returns AVERROR(EAGAIN) allowing repeated calls of write_trailer of
non-blocking muxer.

Signed-off-by: Jan Sebechlebsky 
---
  Changes since the last version of the patch:
  - Added assert to the part of the code dealing with flushing
interleaved packets which should not be entered if
muxer in non-blocking mode is used.
(also there is assert for the same condition added into
 av_interleaved_write_packet in one of the following
 patches).

  libavformat/avformat.h |  6 +-
  libavformat/mux.c  | 10 --
  2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index d8a6cf3..2cc3156 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2510,8 +2510,12 @@ int av_write_uncoded_frame_query(AVFormatContext *s, int 
stream_index);
   *
   * May only be called after a successful call to avformat_write_header.
   *
+ * If AVFMT_FLAG_NONBLOCK is set, this call may return AVERROR(EAGAIN)
+ * meaning the operation is pending and the call should be repeated.
+ *
   * @param s media file handle
- * @return 0 if OK, AVERROR_xxx on error
+ * @return 0 if OK, AVERROR(EAGAIN) in case call should be repeated,
+ * other AVERROR on error
   */
  int av_write_trailer(AVFormatContext *s);
diff --git a/libavformat/mux.c b/libavformat/mux.c
index e9973ed..3ae924c 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -1204,11 +1204,14 @@ int av_write_trailer(AVFormatContext *s)
  for (;; ) {
  AVPacket pkt;
  ret = interleave_packet(s, , NULL, 1);
-if (ret < 0)
-goto fail;
  if (!ret)
  break;
+av_assert0(!(s->flags & AVFMT_FLAG_NONBLOCK));

this would abort on any error not just EAGAIN

I think it will abort in case interleave_packets does not return 0
from the first call in loop, which means that interleaving was used
(because there are some packets to be flushed) and that situation
cannot happen with AVFMT_FLAG_NONBLOCK set when interleaving is
forbidded. The next patch also adds assert to
av_interleaved_write_packet. But I think the assert here is on the
right place, or have I misunderstood the problem you're pointing
out?

I thought interleave_packet can return AVERROR(ENOMEM)
maybe this is not possible, still it seems non-robust to assert if
it errors out

I think it cannot return AVERROR(ENOMEM) in case interleaving was not 
used. But maybe I can remove assert from this function since there will 
be assert in av_interleaved_write_frame?


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


[FFmpeg-devel] [PATCH v4 5/5] avformat/tee: Use BSF list API

2016-08-25 Thread sebechlebskyjan
From: Jan Sebechlebsky 

Signed-off-by: Jan Sebechlebsky 
---
 I believe I have fixed handling input / output timebase and input parameters
 to bitstream filters list.

 libavformat/tee.c | 131 ++
 1 file changed, 64 insertions(+), 67 deletions(-)

diff --git a/libavformat/tee.c b/libavformat/tee.c
index 5689ca3..ba852c3 100644
--- a/libavformat/tee.c
+++ b/libavformat/tee.c
@@ -37,7 +37,7 @@ typedef enum {
 
 typedef struct {
 AVFormatContext *avf;
-AVBitStreamFilterContext **bsfs; ///< bitstream filters per stream
+AVBSFContext **bsfs; ///< bitstream filters per stream
 
 SlaveFailurePolicy on_fail;
 
@@ -64,46 +64,6 @@ static const AVClass tee_muxer_class = {
 .version= LIBAVUTIL_VERSION_INT,
 };
 
-/**
- * Parse list of bitstream filters and add them to the list of filters
- * pointed to by bsfs.
- *
- * The list must be specified in the form:
- * BSFS ::= BSF[,BSFS]
- */
-static int parse_bsfs(void *log_ctx, const char *bsfs_spec,
-  AVBitStreamFilterContext **bsfs)
-{
-char *bsf_name, *buf, *dup, *saveptr;
-int ret = 0;
-
-if (!(dup = buf = av_strdup(bsfs_spec)))
-return AVERROR(ENOMEM);
-
-while (bsf_name = av_strtok(buf, ",", )) {
-AVBitStreamFilterContext *bsf = av_bitstream_filter_init(bsf_name);
-
-if (!bsf) {
-av_log(log_ctx, AV_LOG_ERROR,
-   "Cannot initialize bitstream filter with name '%s', "
-   "unknown filter or internal error happened\n",
-   bsf_name);
-ret = AVERROR_UNKNOWN;
-goto end;
-}
-
-/* append bsf context to the list of bsf contexts */
-*bsfs = bsf;
-bsfs = >next;
-
-buf = NULL;
-}
-
-end:
-av_free(dup);
-return ret;
-}
-
 static inline int parse_slave_failure_policy_option(const char *opt, TeeSlave 
*tee_slave)
 {
 if (!opt) {
@@ -135,14 +95,8 @@ static int close_slave(TeeSlave *tee_slave)
 ret = av_write_trailer(avf);
 
 if (tee_slave->bsfs) {
-for (i = 0; i < avf->nb_streams; ++i) {
-AVBitStreamFilterContext *bsf_next, *bsf = tee_slave->bsfs[i];
-while (bsf) {
-bsf_next = bsf->next;
-av_bitstream_filter_close(bsf);
-bsf = bsf_next;
-}
-}
+for (i = 0; i < avf->nb_streams; ++i)
+av_bsf_free(_slave->bsfs[i]);
 }
 av_freep(_slave->stream_map);
 av_freep(_slave->bsfs);
@@ -312,7 +266,7 @@ static int open_slave(AVFormatContext *avf, char *slave, 
TeeSlave *tee_slave)
"output '%s', filters will be ignored\n", i, 
filename);
 continue;
 }
-ret = parse_bsfs(avf, entry->value, _slave->bsfs[i]);
+ret = av_bsf_list_parse_str(entry->value, _slave->bsfs[i]);
 if (ret < 0) {
 av_log(avf, AV_LOG_ERROR,
"Error parsing bitstream filter sequence '%s' 
associated to "
@@ -325,6 +279,35 @@ static int open_slave(AVFormatContext *avf, char *slave, 
TeeSlave *tee_slave)
 av_dict_set(, entry->key, NULL, 0);
 }
 
+for (i = 0; i < avf->nb_streams; i++){
+int target_stream = tee_slave->stream_map[i];
+if (target_stream < 0)
+continue;
+
+if (!tee_slave->bsfs[target_stream]) {
+/* Add pass-through bitstream filter */
+ret = av_bsf_get_null_filter(_slave->bsfs[target_stream]);
+if (ret < 0) {
+av_log(avf, AV_LOG_ERROR,
+   "Failed to create pass-through bitstream filter: %s\n",
+   av_err2str(ret));
+goto end;
+}
+}
+
+tee_slave->bsfs[target_stream]->time_base_in = 
avf->streams[i]->time_base;
+ret = avcodec_parameters_copy(tee_slave->bsfs[target_stream]->par_in,
+  avf->streams[i]->codecpar);
+
+ret = av_bsf_init(tee_slave->bsfs[target_stream]);
+if (ret < 0) {
+av_log(avf, AV_LOG_ERROR,
+"Failed to initialize bitstream filter(s): %s\n",
+av_err2str(ret));
+goto end;
+}
+}
+
 if (options) {
 entry = NULL;
 while ((entry = av_dict_get(options, "", entry, 
AV_DICT_IGNORE_SUFFIX)))
@@ -349,20 +332,16 @@ static void log_slave(TeeSlave *slave, void *log_ctx, int 
log_level)
slave->avf->filename, slave->avf->oformat->name);
 for (i = 0; i < slave->avf->nb_streams; i++) {
 AVStream *st = slave->avf->streams[i];
-AVBitStreamFilterContext *bsf = slave->bsfs[i];
+AVBSFContext *bsf = slave->bsfs[i];
+const char * bsf_name;
 
 av_log(log_ctx, log_level, "stream:%d codec:%s type:%s",
i, 

Re: [FFmpeg-devel] [PATCHv2] af_hdcd: for easier maintenance alongside libhdcd

2016-08-25 Thread Burt P.
applied

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


Re: [FFmpeg-devel] [PATCH 3/3] af_hdcd: for easier maintenance alongside libhdcd

2016-08-25 Thread Burt P.
Thanks for looking at it.


On Wed, Aug 24, 2016 at 1:06 PM, Carl Eugen Hoyos  wrote:
> Hi!
>
> 2016-08-24 16:38 GMT+02:00 Burt P. :
>> On Tue, Aug 23, 2016 at 2:29 PM, Carl Eugen Hoyos  wrote:
>>> It seems safer to me to use the actual number of channels than the
>>> channel layout.
>>
>> Alright, new patch version incoming.
>
> No more comments from me.
> (I hope you tested it...)
>
> Thank you, Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



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


Re: [FFmpeg-devel] [PATCH 4/4] lavf/mov: Add support for edit list parsing.

2016-08-25 Thread Michael Niedermayer
On Thu, Aug 25, 2016 at 12:31:19PM -0700, Sasi Inguva wrote:
> oops. thanks for pointing that out. Even in our version of ffmpeg, that
> assert doesn't get compiled so we never catched it. That assert logic is
> not correct anymore. At the end of one edit list there can be frames marked
> as discard, for which we would keep increasing the timestamp even if they
> are marked as discard, so that when the timestamps are rerodered to compute
> PTS B-frames get the correct PTS. But the next edit list should always
> start with the timestamp of the last-non-discarded frame of the previous
> edit list. Hence we will get non-increasing timestamps added as index
> entries.
> 
> The test may have passed for you before, because before that line was
> assert(..) instead of av_assert1(...) so maybe that line wasn't getting
> compiled before. Attaching the 4 patches again.

patchset breaks timestamps for audio:
./ffmpeg -i matrixbench_mpeg2.mpg  -t 0.1  one.mov
./ffprobe  -show_packets -print_format compact one.mov
packet|codec_type=video|stream_index=0|pts=0|pts_time=0.00|dts=-1024|dts_time=-0.08|duration=512|duration_time=0.04|convergence_duration=N/A|convergence_duration_time=N/A|size=9368|pos=36|flags=K
packet|codec_type=video|stream_index=0|pts=1024|pts_time=0.08|dts=-512|dts_time=-0.04|duration=512|duration_time=0.04|convergence_duration=N/A|convergence_duration_time=N/A|size=2190|pos=9404|flags=_
packet|codec_type=audio|stream_index=1|pts=0|pts_time=0.00|dts=0|dts_time=0.00|duration=N/A|duration_time=N/A|convergence_duration=N/A|convergence_duration_time=N/A|size=323|pos=11594|flags=K
packet|codec_type=video|stream_index=0|pts=512|pts_time=0.04|dts=0|dts_time=0.00|duration=512|duration_time=0.04|convergence_duration=N/A|convergence_duration_time=N/A|size=1328|pos=11894|flags=_
packet|codec_type=audio|stream_index=1|pts=0|pts_time=0.00|dts=0|dts_time=0.00|duration=1024|duration_time=0.021333|convergence_duration=N/A|convergence_duration_time=N/A|size=261|pos=13222|flags=K

if you look at the audio stream 2 packets have the same pts, that
looks wrong, previously the first packet had -1024

[...]


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH 4/4] lavf/mov: Add support for edit list parsing.

2016-08-25 Thread Michael Niedermayer
On Thu, Aug 25, 2016 at 12:31:19PM -0700, Sasi Inguva wrote:
> oops. thanks for pointing that out. Even in our version of ffmpeg, that
> assert doesn't get compiled so we never catched it. That assert logic is
> not correct anymore. At the end of one edit list there can be frames marked
> as discard, for which we would keep increasing the timestamp even if they
> are marked as discard, so that when the timestamps are rerodered to compute
> PTS B-frames get the correct PTS. But the next edit list should always
> start with the timestamp of the last-non-discarded frame of the previous
> edit list. Hence we will get non-increasing timestamps added as index
> entries.
> 
> The test may have passed for you before, because before that line was
> assert(..) instead of av_assert1(...) so maybe that line wasn't getting
> compiled before. Attaching the 4 patches again.

(i think 3rd one) breaks
./ffmpeg -i ~/tickets/5528/fire.mp3 test.wav
...
[mp3 @ 0x393b980] invalid new backstep -1
Assertion avctx->internal->skip_samples >= 0 failed at libavcodec/utils.c:2357
Aborted

http://trac.ffmpeg.org/attachment/ticket/5528/fire.mp3

[...]


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [GSoC] Motion Interpolation

2016-08-25 Thread Davinder Singh
On Thu, Aug 25, 2016 at 5:01 AM Andy Furniss  wrote:

>
>
> I am testing with a somewhat artificial sample in that it's a framerate
> de-interlace + scale down of a 1080i master, though it is "real" in the
> sense that I may want to repair similar files where people have produced
> a juddery mess by using yadif=0.
>

thanks for testing.

>
> It's very fast and my old (2010 Panasonic plasma) TV can't interpolate
> it without artifacting in a few places, it can interpolate a field rate
> version flawlessly and both mcfps and minterpolate do a lot better with
> a 50fps master version -> 100fps, though they are still not perfect.
>
> As well as being fast it has overlays of varying opacity and some
> repeating patterns just to make things even harder.
>
> Some observations while trying to get the best result - given the number
> of options only a small subset could be tested:
>
> aobmc vs ombc, vsbmc 0 or 1 = no real difference.
>

now our main focus will be on "better" motion estimation that removes
artifacts in fast motion, rather than little tweaks like these.


> Any me method other than epzs had far too many artifacts to be used.
>
> Raising search_param to 48 or 64 or 128 just causes new artifacts.
>

that hopefully could be fixed. working on it.


>
> Reducing mb_size causes new artifacts.
>

yes for higher resolution. for very smaller, it could be essential.


> bilat vs bidir - similar but bilat has some artifacts on a still shot
> near the end of the defaults sample uploaded. bidir sometimes has green
> near the top of the screen.
>

i see that green line in other samples too. investigating.


>
> There are of course many small artifacts, to be seen by slowmo/framestep
> for both minterpolate and mcfps. Viewing fullspeed mcfps artifacts less
> on the car when it touches the edges than minterpolate. Frame stepping
> shows mcfps doesn't blend/blur as much on really fast moving background
> as minterpolate does.
>
> Included in the link below (which is a tar to stop google drive making
> terrible low quality/fps previews) are the 25fps master file, mcfps
> interpolation to 50fps, minterpolate with default options and
> minterpolate with defaults + bidir.
>
>
> https://drive.google.com/file/d/0BxP5-S1t9VEEM2VrTzlVdGZURVk/view?usp=sharing


thanks :)

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


Re: [FFmpeg-devel] [PATCH] webm_chunk: Set pts precision to milliseconds

2016-08-25 Thread Michael Niedermayer
On Mon, Aug 22, 2016 at 05:13:23PM -0700, Vignesh Venkatasubramanian wrote:
> Milliseconds is the de-factor precision for timestamps in
> Matroska/WebM media.
> 
> Signed-off-by: Vignesh Venkatasubramanian 
> ---
>  libavformat/webm_chunk.c | 5 +
>  1 file changed, 5 insertions(+)

applied

thanks


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

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


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


Re: [FFmpeg-devel] [GSoC] Motion Interpolation

2016-08-25 Thread Davinder Singh
On Thu, Aug 25, 2016 at 8:03 PM Michael Niedermayer 
wrote:

> [...]
>
> why do these not try predictors like epzs / umh ?
> i guess some paper doesnt say exlpicitly it should be done
> but really it should be done for all predictive zonal searches IMO
>

this should be in different patch. no?
yeah, the paper doesn't specify use of predictors. i thought DS and HEX are
just new efficient patterns.


>
> [...]
> AVOption is not compatible with general enums, as C does not gurantee
> them to be stored in an int, it just happens to work on most platforms
>
> [...]
> with this style of smoothness cost you likely want to make an exception
> for the 0,0 vector (giving it the same "penalty" as the median or even
> very slightly less)
> This would normally be implemented by not adding the penalty on
> the 0,0 perdictor check but as its implemented in the compare function
> itself it would need a check
> i think it would slighty improve quality. Of course if it does not then
> ignore this suggestion
>
> also i will apply this patchset once the issues raised here are fixed
> if noone objects, its much easier and more efficient to work in main
> git than on top of a growing patch
>
> Thanks
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Republics decline into democracies and democracies degenerate into
> despotisms. -- Aristotle
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


0001-added-motion-estimation-and-interpolation-filters-v5F.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 filmgrain filter

2016-08-25 Thread James Almer
On 8/25/2016 4:44 PM, Paul B Mahol wrote:
> Hi,
> 
> patch attached.
> 
> 
> 0001-avfilter-add-filmgrain-filter.patch
> 
> 
> From baf7613d08f9de31ff196dfa399b546e466478e8 Mon Sep 17 00:00:00 2001
> From: Paul B Mahol 
> Date: Thu, 25 Aug 2016 20:53:35 +0200
> Subject: [PATCH] avfilter: add filmgrain filter
> 
> ---
>  libavfilter/Makefile   |   1 +
>  libavfilter/allfilters.c   |   1 +
>  libavfilter/vf_filmgrain.c | 905 
> +

Don't forget about doc/filters.texi, Changelog entry and version bump.

>  3 files changed, 907 insertions(+)
>  create mode 100644 libavfilter/vf_filmgrain.c
> 
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 4ec7d8a..31183d8 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -174,6 +174,7 @@ OBJS-$(CONFIG_FIELD_FILTER)  += vf_field.o
>  OBJS-$(CONFIG_FIELDHINT_FILTER)  += vf_fieldhint.o
>  OBJS-$(CONFIG_FIELDMATCH_FILTER) += vf_fieldmatch.o
>  OBJS-$(CONFIG_FIELDORDER_FILTER) += vf_fieldorder.o
> +OBJS-$(CONFIG_FILMGRAIN_FILTER)  += vf_filmgrain.o
>  OBJS-$(CONFIG_FIND_RECT_FILTER)  += vf_find_rect.o lavfutils.o
>  OBJS-$(CONFIG_FORMAT_FILTER) += vf_format.o
>  OBJS-$(CONFIG_FPS_FILTER)+= vf_fps.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index 1ca2679..16fbc4a 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -191,6 +191,7 @@ void avfilter_register_all(void)
>  REGISTER_FILTER(FIELDHINT,  fieldhint,  vf);
>  REGISTER_FILTER(FIELDMATCH, fieldmatch, vf);
>  REGISTER_FILTER(FIELDORDER, fieldorder, vf);
> +REGISTER_FILTER(FILMGRAIN,  filmgrain,  vf);
>  REGISTER_FILTER(FIND_RECT,  find_rect,  vf);
>  REGISTER_FILTER(FORMAT, format, vf);
>  REGISTER_FILTER(FPS,fps,vf);
> diff --git a/libavfilter/vf_filmgrain.c b/libavfilter/vf_filmgrain.c
> new file mode 100644
> index 000..84a1fa7
> --- /dev/null
> +++ b/libavfilter/vf_filmgrain.c
> @@ -0,0 +1,905 @@
> +/*
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +#include 
> +
> +#include "libavutil/opt.h"
> +#include "libavutil/imgutils.h"
> +#include "libavutil/parseutils.h"
> +#include "libavutil/pixdesc.h"
> +#include "avfilter.h"
> +#include "formats.h"
> +#include "internal.h"
> +#include "video.h"
> +
> +struct osn_context {
> +int16_t *perm;
> +int16_t *permGradIndex3D;
> +};
> +
> +typedef struct FilmGrainContext {
> +const AVClass *class;
> +
> +int nb_planes;
> +int bytewidth[4];
> +int height[4];
> +
> +double size;
> +double speed;
> +double strength;
> +int planes;
> +int64_t seed[4];
> +
> +struct osn_context *osn[4];
> +} FilmGrainContext;
> +
> +#define OFFSET(x) offsetof(FilmGrainContext, x)
> +#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
> +
> +static const AVOption filmgrain_options[] = {
> +{ "size", "set pattern size",   OFFSET(size), 
> AV_OPT_TYPE_DOUBLE, {.dbl=.4},  0.1, 1,  FLAGS },
> +{ "speed","set change speed",   OFFSET(speed),
> AV_OPT_TYPE_DOUBLE, {.dbl= 1},  0.1, 10, FLAGS },
> +{ "strength", "set noise strength", OFFSET(strength), 
> AV_OPT_TYPE_DOUBLE, {.dbl=.02}, 0,   1,  FLAGS },
> +{ "planes",   "set planes", OFFSET(planes),   AV_OPT_TYPE_INT,   
>  {.i64=1},   0, 0xF,  FLAGS },
> +{ "seed0","set noise seed #0",  OFFSET(seed[0]),  AV_OPT_TYPE_INT64, 
>  {.i64=42},  INT64_MIN, INT64_MAX,  FLAGS },
> +{ "seed1","set noise seed #1",  OFFSET(seed[1]),  AV_OPT_TYPE_INT64, 
>  {.i64=24},  INT64_MIN, INT64_MAX,  FLAGS },
> +{ "seed2","set noise seed #2",  OFFSET(seed[2]),  AV_OPT_TYPE_INT64, 
>  {.i64=17},  INT64_MIN, INT64_MAX,  FLAGS },
> +{ "seed3","set noise seed #3",  OFFSET(seed[3]),  AV_OPT_TYPE_INT64, 
>  {.i64=11},  INT64_MIN, INT64_MAX,  FLAGS },

Why not use av_get_random_seed when not specified by the user instead?

> +{ NULL }
> +};
> +
> +AVFILTER_DEFINE_CLASS(filmgrain);
> +
> +static int query_formats(AVFilterContext *ctx)

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

2016-08-25 Thread Paul B Mahol
Hi,

patch attached.


0001-avfilter-add-filmgrain-filter.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] webm_chunk: Set pts precision to milliseconds

2016-08-25 Thread Vignesh Venkatasubramanian
On Mon, Aug 22, 2016 at 5:13 PM, Vignesh Venkatasubramanian
 wrote:
> Milliseconds is the de-factor precision for timestamps in
> Matroska/WebM media.
>
> Signed-off-by: Vignesh Venkatasubramanian 
> ---
>  libavformat/webm_chunk.c | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/libavformat/webm_chunk.c b/libavformat/webm_chunk.c
> index 9db4fab..44a1695 100644
> --- a/libavformat/webm_chunk.c
> +++ b/libavformat/webm_chunk.c
> @@ -110,6 +110,7 @@ static int webm_chunk_write_header(AVFormatContext *s)
>  WebMChunkContext *wc = s->priv_data;
>  AVFormatContext *oc = NULL;
>  int ret;
> +int i;
>
>  // DASH Streams can only have either one track per file.
>  if (s->nb_streams != 1) { return AVERROR_INVALIDDATA; }
> @@ -135,6 +136,10 @@ static int webm_chunk_write_header(AVFormatContext *s)
>  if (ret < 0)
>  return ret;
>  ff_format_io_close(s, >pb);
> +for (i = 0; i < s->nb_streams; i++) {
> +// ms precision is the de-facto standard timescale for mkv files.
> +avpriv_set_pts_info(s->streams[i], 64, 1, 1000);
> +}
>  return 0;
>  }
>
> --
> 2.8.0.rc3.226.g39d4020
>

Can somebody take a look at this please? This fixes timestamp writing
issues in the webm chunk muxer. Thanks!

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


Re: [FFmpeg-devel] [PATCH] Nvidia NVENC 10-bit HEVC encoding and rate control lookahead support

2016-08-25 Thread Oliver Collyer
Hi Timo

Thankyou for the clarification.

Attached are what should be the final versions of these patches then, with the 
support for YUV420P10 (and related conversion code) now dropped.

Regards

Oliver



0001-NVENC-added-support-for-10-bit-HEVC-encoding.patch
Description: Binary data


0002-NVENC-added-support-for-rate-control-lookahead.patch
Description: Binary data


> On 25 Aug 2016, at 13:48, Timo Rothenpieler  wrote:
> 
> Am 24.08.2016 um 12:30 schrieb Oliver Collyer:
>> Ok thanks, Timo.
>> 
>> So I’ve split this into two patches and revised as per the discussions and 
>> they are attached here.
>> 
>> The only thing to be decided is whether my conversion code to enable 
>> YUV420P10 support should be included in this or not.
>> 
>> It’s in the attached patch but I’m happy to remove it if necessary.
> 
> I'm not a fan of format-conversion code in nvenc. That's the job of swscale.
> If a needed conversion is missing/performs poorly, it should be fixed in
> sws instead.
> 
>> Regards
>> 
>> Oliver
>> 
> 
> Unfortunately I'm still on my old GTX760, so I can't test all the
> hevc/10bit stuff.
> The patch looks Ok though and should generally be fine to merge minus
> the format-conversion.
> 
> Might have to get myself an intermediary GTX1060 to upgrade my old PC
> once again.
> 
> 
> ___
> 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] mov: Remove ancient heuristic hack

2016-08-25 Thread Paul B Mahol
On 8/25/16, Michael Niedermayer  wrote:
> On Thu, Aug 25, 2016 at 05:46:57PM +0100, Derek Buitenhuis wrote:
>> On 8/25/2016 5:34 PM, James Almer wrote:
>> > On 8/25/2016 12:45 PM, Carl Eugen Hoyos wrote:
>> >> 2016-08-24 16:55 GMT+02:00 Derek Buitenhuis
>> >> :
>> >>> This breaks files with legitimate single-entry edit lists,
>> >>
>> >>> and the hack, introduced in f03a081df09f9c4798a17d7e24446ed47924b11b,
>> >>
>> >> I believe "Hack" is not acceptable on this mailing list anymore,
>> >> please
>> >> remove it from the commit message.
>> >
>> > Care to point where this was discussed or agreed by the bulk of
>> > developers?
>> > I don't recall anything about it.
>> > A quick search for "hack" shows a lot of recent results in both the ML
>> > and
>> > the git repo, so I'm not sure why you assumed it's "not acceptable"
>> > anymore.
>>
>> What's a better word? "incorrect workaround"? Am I not allow to say
>> some code is wrong? Because the code is defacto incorrect.
>
> this is not really my area and i might misguess what was meant so
> i can only speak about what my feeling woudl suggest
>
> "Hack" might suggest the author had knowledge of the code being not
> the correct solution when adding it. Maybe this felt offensive

Come one, I will commit this patch with "hack" word, if nobody beats me.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] mov: Remove ancient heuristic hack

2016-08-25 Thread Michael Niedermayer
On Thu, Aug 25, 2016 at 05:46:57PM +0100, Derek Buitenhuis wrote:
> On 8/25/2016 5:34 PM, James Almer wrote:
> > On 8/25/2016 12:45 PM, Carl Eugen Hoyos wrote:
> >> 2016-08-24 16:55 GMT+02:00 Derek Buitenhuis :
> >>> This breaks files with legitimate single-entry edit lists,
> >>
> >>> and the hack, introduced in f03a081df09f9c4798a17d7e24446ed47924b11b,
> >>
> >> I believe "Hack" is not acceptable on this mailing list anymore, please
> >> remove it from the commit message.
> > 
> > Care to point where this was discussed or agreed by the bulk of developers?
> > I don't recall anything about it.
> > A quick search for "hack" shows a lot of recent results in both the ML and
> > the git repo, so I'm not sure why you assumed it's "not acceptable" anymore.
> 
> What's a better word? "incorrect workaround"? Am I not allow to say
> some code is wrong? Because the code is defacto incorrect.

this is not really my area and i might misguess what was meant so
i can only speak about what my feeling woudl suggest

"Hack" might suggest the author had knowledge of the code being not
the correct solution when adding it. Maybe this felt offensive


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

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope


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/2 v2] mov: Remove ancient heuristic hack

2016-08-25 Thread Derek Buitenhuis
On 8/25/2016 5:49 PM, Derek Buitenhuis wrote:
> However, removing the part about the sample being missing in
> the commit message would be wrong, because it is, in fact, not
> linked in the commit message.

I must step out now, so please push whenever some consensus is
reached. No point in bikeshedding over a commit message, and
whilst I think it'd be silly to remove this bit, I do not feel
strongly about it.

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


Re: [FFmpeg-devel] [PATCH] mov: Remove ancient heuristic hack

2016-08-25 Thread James Almer
On 8/25/2016 1:46 PM, Derek Buitenhuis wrote:
> On 8/25/2016 5:34 PM, James Almer wrote:
>> On 8/25/2016 12:45 PM, Carl Eugen Hoyos wrote:
>>> 2016-08-24 16:55 GMT+02:00 Derek Buitenhuis :
 This breaks files with legitimate single-entry edit lists,
>>>
 and the hack, introduced in f03a081df09f9c4798a17d7e24446ed47924b11b,
>>>
>>> I believe "Hack" is not acceptable on this mailing list anymore, please
>>> remove it from the commit message.
>>
>> Care to point where this was discussed or agreed by the bulk of developers?
>> I don't recall anything about it.
>> A quick search for "hack" shows a lot of recent results in both the ML and
>> the git repo, so I'm not sure why you assumed it's "not acceptable" anymore.
> 
> What's a better word? "incorrect workaround"? Am I not allow to say
> some code is wrong? Because the code is defacto incorrect.

Hack is perfectly fine. But if you want to change it, saying it's a faulty,
wrong or incorrect workaround is also fine.

> 
>>
>>>
 has no link to any known sample in its commit message
>>>
>>> I believe a sample is linked in the original commit message,
>>> please remove the sentence.
> 
> It is not. A filename is not a link. There is no way to locate the
> sample solely from the commit message. The description is accurate.
> 
> - Derek
> ___
> 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 1/2 v2] mov: Remove ancient heuristic hack

2016-08-25 Thread Derek Buitenhuis
On 8/25/2016 5:18 PM, Michael Niedermayer wrote:
> ok if i push with the changes requested in:
> https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2016-August/198303.html
> ? (seems another reply with forgotten CC)

You can change 'hack' to 'incorrect workaround' if you wish.

However, removing the part about the sample being missing in
the commit message would be wrong, because it is, in fact, not
linked in the commit message.

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


Re: [FFmpeg-devel] [PATCH] mov: Remove ancient heuristic hack

2016-08-25 Thread Derek Buitenhuis
On 8/25/2016 5:34 PM, James Almer wrote:
> On 8/25/2016 12:45 PM, Carl Eugen Hoyos wrote:
>> 2016-08-24 16:55 GMT+02:00 Derek Buitenhuis :
>>> This breaks files with legitimate single-entry edit lists,
>>
>>> and the hack, introduced in f03a081df09f9c4798a17d7e24446ed47924b11b,
>>
>> I believe "Hack" is not acceptable on this mailing list anymore, please
>> remove it from the commit message.
> 
> Care to point where this was discussed or agreed by the bulk of developers?
> I don't recall anything about it.
> A quick search for "hack" shows a lot of recent results in both the ML and
> the git repo, so I'm not sure why you assumed it's "not acceptable" anymore.

What's a better word? "incorrect workaround"? Am I not allow to say
some code is wrong? Because the code is defacto incorrect.

> 
>>
>>> has no link to any known sample in its commit message
>>
>> I believe a sample is linked in the original commit message,
>> please remove the sentence.

It is not. A filename is not a link. There is no way to locate the
sample solely from the commit message. The description is accurate.

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


Re: [FFmpeg-devel] [PATCH 2/2] Fix audiomatch complie warning

2016-08-25 Thread Michael Niedermayer
On Thu, Aug 25, 2016 at 09:06:42PM +0800, Steven Liu wrote:
> Making sure bestpos is initialized to zero to prevent gcc from kvetching.
> It's harmless (although it's not obvious that it's harmless)
> from code inspection:
> tests/audiomatch.c: In function ‘main’:
> tests/audiomatch.c:40: warning: ‘bestpos’ may be used uninitialized in this
> function
> 
> Thanks to Moritz Barsnick for first bringing this to the attention.
> 
> Signed-off-by: LiuQi 

applied

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH] mov: Remove ancient heuristic hack

2016-08-25 Thread James Almer
On 8/25/2016 12:45 PM, Carl Eugen Hoyos wrote:
> 2016-08-24 16:55 GMT+02:00 Derek Buitenhuis :
>> This breaks files with legitimate single-entry edit lists,
> 
>> and the hack, introduced in f03a081df09f9c4798a17d7e24446ed47924b11b,
> 
> I believe "Hack" is not acceptable on this mailing list anymore, please
> remove it from the commit message.

Care to point where this was discussed or agreed by the bulk of developers?
I don't recall anything about it.
A quick search for "hack" shows a lot of recent results in both the ML and
the git repo, so I'm not sure why you assumed it's "not acceptable" anymore.

> 
>> has no link to any known sample in its commit message
> 
> I believe a sample is linked in the original commit message,
> please remove the sentence.

Forgot to CC him, so he didn't read your email.

> 
> Thank you, Carl EugenI
> ___
> 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 1/2 v2] mov: Remove ancient heuristic hack

2016-08-25 Thread Michael Niedermayer
On Thu, Aug 25, 2016 at 04:58:14PM +0100, Derek Buitenhuis wrote:
> This breaks files with legitimate single-entry edit lists,
> and the hack, introduced in f03a081df09f9c4798a17d7e24446ed47924b11b,
> has no link to any known sample in its commit message.
> 
> Signed-off-by: Derek Buitenhuis 
> ---
>  libavformat/isom.h | 1 -
>  libavformat/mov.c  | 8 +---
>  2 files changed, 1 insertion(+), 8 deletions(-)

ok if i push with the changes requested in:
https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2016-August/198303.html
? (seems another reply with forgotten CC)

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

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


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


Re: [FFmpeg-devel] [PATCH 1/2] tests/fate:Add FATE for hls_flags append option

2016-08-25 Thread Michael Niedermayer
On Thu, Aug 25, 2016 at 09:04:43PM +0800, Steven Liu wrote:
>  Tested passed at :
> 1. OSX
> 2. Linux
> 3. Windows

> 4. Ubuntu+wine+MinGW

confirmed it works
but
doesnt work on qemu-mips
../configure --target-exec='.../qemu-mips -cpu 74Kf -L /usr/mips-linux-gnu/' \
--samples=... --enable-gpl --cross-prefix=/usr/mips-linux-gnu/bin/ \
--cc='ccache mips-linux-gnu-gcc-4.4' --arch=mips --target-os=linux 
--enable-cross-compile --disable-pthreads --disable-mipsfpu --disable-iconv

make distclean ; ./c-qemu  && make -j12 fate-filter-hls-append
first it fails with
GEN tests/data/hls-list-append.m3u8
make: *** [tests/data/hls-list-append.m3u8] Error 255

reruning make -j12 fate-filter-hls-append
results in:

--- tests/ref/fate/filter-hls-append2016-08-25 17:43:18.565618034 +0200
+++ tests/data/fate/filter-hls-append   2016-08-25 17:47:18.681623092 +0200
@@ -3,1154 +3,770 @@
 #codec_id 0: pcm_s16le
 #sample_rate 0: 44100
 #channel_layout 0: 4
-0,  0,  0, 1152, 2304, 0x593ea430
-0,   1152,   1152, 1152, 2304, 0xde328304
-0,   2304,   2304, 1152, 2304, 0x12f673c9
-0,   3456,   3456, 1152, 2304, 0x4c7672a1
-0,   4608,   4608, 1152, 2304, 0xd38577f4
-0,   5760,   5760, 1152, 2304, 0xc9d677cc
-0,   6912,   6912, 1152, 2304, 0xc97e882a
-0,   8064,   8064, 1152, 2304, 0xaacf67ec
-0,   9216,   9216, 1152, 2304, 0x3a9b7ea5
-0,  10368,  10368, 1152, 2304, 0x30258348
-0,  11520,  11520, 1152, 2304, 0x08da8783
-0,  12672,  12672, 1152, 2304, 0x4830619e
-0,  13824,  13824, 1152, 2304, 0xcf476f69
-0,  14976,  14976, 1152, 2304, 0x377e7ce5
-0,  16128,  16128, 1152, 2304, 0x00a27fad
-0,  17280,  17280, 1152, 2304, 0xe4a46de3
-0,  18432,  18432, 1152, 2304, 0x938c8751
-0,  19584,  19584, 1152, 2304, 0x239982b5
-0,  20736,  20736, 1152, 2304, 0x9a0d7655
-0,  21888,  21888, 1152, 2304, 0x4adf7fbf
-0,  23040,  23040, 1152, 2304, 0xdb8b7b16
-0,  24192,  24192, 1152, 2304, 0x25908560
-0,  25344,  25344, 1152, 2304, 0xb5dd7be7
-0,  26496,  26496, 1152, 2304, 0x4368796d
-0,  27648,  27648, 1152, 2304, 0xba3a7fd0
...
make: *** [fate-filter-hls-append] Error 1

[...]

-- 
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.


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


[FFmpeg-devel] [PATCH 2/2 v2] mov: Remove old b-frame/video delay heuristic

2016-08-25 Thread Derek Buitenhuis
This was added before edts support existed, and is no longer
valid.

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 54c63ad..bc11fb8 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2801,9 +2801,6 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
 empty_duration = av_rescale(empty_duration, sc->time_scale, 
mov->time_scale);
 sc->time_offset = start_time - empty_duration;
 current_dts = -sc->time_offset;
-if (sc->ctts_count>0 && sc->stts_count>0 &&
-sc->ctts_data[0].duration / FFMAX(sc->stts_data[0].duration, 
1) > 16)
-st->codecpar->video_delay = 1;
 }
 
 if (!unsupported && st->codecpar->codec_id == AV_CODEC_ID_AAC && 
start_time > 0)
-- 
1.8.3.1

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


Re: [FFmpeg-devel] [PATCH 07/21] libavcodec/metaenc: added an encoder/decoder for timed metadata

2016-08-25 Thread Erkki Seppälä

On 08/23/2016 05:46 PM, Michael Niedermayer wrote:

this breaks fate
make distclean ; ./configure && make -j12 fate
deadlocks and never finishes


Well that was embarrassing, thanks for pointing it out.

The issue was that I had introduced metacodec_class that was shared 
between ff_meta_encoder and ff_meta_decoder, and due to this sharing 
av_opt_child_class_next was never able to get pass them as it 
automatically returned to the same metacodec_class on every iteration.


As it seems the metacodec_class was useless in the first place, I opted 
to remove it. make fate now doesn't hang, but I discovered uhm issues 
with some of the other patches that will be fixed in v2.


I'll be sure to ensure make fate passes all my next patches. Thanks.

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


[FFmpeg-devel] [PATCH 1/2 v2] mov: Remove ancient heuristic hack

2016-08-25 Thread Derek Buitenhuis
This breaks files with legitimate single-entry edit lists,
and the hack, introduced in f03a081df09f9c4798a17d7e24446ed47924b11b,
has no link to any known sample in its commit message.

Signed-off-by: Derek Buitenhuis 
---
 libavformat/isom.h | 1 -
 libavformat/mov.c  | 8 +---
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index df6c15a..2246fed 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -155,7 +155,6 @@ typedef struct MOVStreamContext {
 MOVDref *drefs;
 int dref_id;
 int timecode_track;
-int wrong_dts;///< dts are wrong due to huge ctts offset (iMovie 
files)
 int width;///< tkhd width
 int height;   ///< tkhd height
 int dts_shift;///< dts shift when ctts is negative
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 1bc3800..54c63ad 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2802,12 +2802,8 @@ static void mov_build_index(MOVContext *mov, AVStream 
*st)
 sc->time_offset = start_time - empty_duration;
 current_dts = -sc->time_offset;
 if (sc->ctts_count>0 && sc->stts_count>0 &&
-sc->ctts_data[0].duration / FFMAX(sc->stts_data[0].duration, 
1) > 16) {
-/* more than 16 frames delay, dts are likely wrong
-   this happens with files created by iMovie */
-sc->wrong_dts = 1;
+sc->ctts_data[0].duration / FFMAX(sc->stts_data[0].duration, 
1) > 16)
 st->codecpar->video_delay = 1;
-}
 }
 
 if (!unsupported && st->codecpar->codec_id == AV_CODEC_ID_AAC && 
start_time > 0)
@@ -5352,8 +5348,6 @@ static int mov_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 sc->ctts_index++;
 sc->ctts_sample = 0;
 }
-if (sc->wrong_dts)
-pkt->dts = AV_NOPTS_VALUE;
 } else {
 int64_t next_dts = (sc->current_sample < st->nb_index_entries) ?
 st->index_entries[sc->current_sample].timestamp : st->duration;
-- 
1.8.3.1

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


Re: [FFmpeg-devel] [PATCH] mov: Remove ancient heuristic hack

2016-08-25 Thread Derek Buitenhuis
On 8/25/2016 4:52 PM, Michael Niedermayer wrote:
>> the patch removes all uses of wrong_dts, the field should be
>> > removed too
> oops i forgot cc-ing you, iam not used to reply-all on the ML

OK. I thought it was used in the FLV demuxer too, but it seems
it has it's own copy inside the FLV context. My bad.

New patches sent.

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


Re: [FFmpeg-devel] [PATCH] mov: Remove ancient heuristic hack

2016-08-25 Thread Michael Niedermayer
On Thu, Aug 25, 2016 at 05:45:03PM +0200, Michael Niedermayer wrote:
> On Thu, Aug 25, 2016 at 03:49:22PM +0100, Derek Buitenhuis wrote:
> > On 8/25/2016 3:40 PM, Michael Niedermayer wrote:
> > > but its probably best to remove in a seperate patch so if it breaks
> > > something bisect would immedeatly point to which of the 2 changes
> > > caused it
> > 
> > Sounds good.
> > 
> > If you think this patch is OK, please push it with this part
> 
> the patch removes all uses of wrong_dts, the field should be
> removed too

oops i forgot cc-ing you, iam not used to reply-all on the ML

[...]


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.


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


Re: [FFmpeg-devel] [PATCH] mov: Remove ancient heuristic hack

2016-08-25 Thread Michael Niedermayer
On Thu, Aug 25, 2016 at 03:49:22PM +0100, Derek Buitenhuis wrote:
> On 8/25/2016 3:40 PM, Michael Niedermayer wrote:
> > but its probably best to remove in a seperate patch so if it breaks
> > something bisect would immedeatly point to which of the 2 changes
> > caused it
> 
> Sounds good.
> 
> If you think this patch is OK, please push it with this part

the patch removes all uses of wrong_dts, the field should be
removed too


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

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued


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


Re: [FFmpeg-devel] [PATCH] mov: Remove ancient heuristic hack

2016-08-25 Thread Carl Eugen Hoyos
2016-08-24 16:55 GMT+02:00 Derek Buitenhuis :
> This breaks files with legitimate single-entry edit lists,

> and the hack, introduced in f03a081df09f9c4798a17d7e24446ed47924b11b,

I believe "Hack" is not acceptable on this mailing list anymore, please
remove it from the commit message.

> has no link to any known sample in its commit message

I believe a sample is linked in the original commit message,
please remove the sentence.

Thank you, Carl EugenI
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] tests/fate:Add FATE for hls_flags append option

2016-08-25 Thread Michael Niedermayer
On Thu, Aug 25, 2016 at 08:01:02PM +0800, Steven Liu wrote:
> 2016-08-25 6:16 GMT+08:00 Michael Niedermayer :
> 
> > On Wed, Aug 24, 2016 at 09:40:55PM +0800, Steven Liu wrote:
> > > 2016-08-24 19:14 GMT+08:00 Steven Liu :
> > >
> > > >
> > > >
> > > > 2016-08-24 18:57 GMT+08:00 Michael Niedermayer  > >:
> > > >
> > > >> On Wed, Aug 24, 2016 at 06:28:08PM +0800, Steven Liu wrote:
> > > >> > 2016-08-24 18:23 GMT+08:00 Michael Niedermayer
> >  > > >> >:
> > > >> >
> > > >> > > On Wed, Aug 24, 2016 at 03:04:59PM +0800, Steven Liu wrote:
> > > >> > > > On OSX test:
> > > >> > > > localhost:ffmpeg liuqi$ uname -a
> > > >> > > > Darwin localhost 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19
> > > >> 18:36:36
> > > >> > > > PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
> > > >> > > > localhost:ffmpeg liuqi$ make fate-filter-hls-append
> > > >> > > > HOSTCC tests/base64.o
> > > >> > > > HOSTLD tests/base64
> > > >> > > > HOSTCC tests/tiny_psnr.o
> > > >> > > > HOSTLD tests/tiny_psnr
> > > >> > > > HOSTCC tests/tiny_ssim.o
> > > >> > > > HOSTLD tests/tiny_ssim
> > > >> > > > HOSTCC tests/audiomatch.o
> > > >> > > > tests/audiomatch.c:102:12: warning: using floating point
> > absolute
> > > >> value
> > > >> > > > function 'fabs' when argument is of integer type
> > [-Wabsolute-value]
> > > >> > > > if(fabs(c) > sigamp * 0.94)
> > > >> > > >^
> > > >> > > > tests/audiomatch.c:102:12: note: use function 'llabs' instead
> > > >> > > > if(fabs(c) > sigamp * 0.94)
> > > >> > > >^~~~
> > > >> > > >llabs
> > > >> > > > tests/audiomatch.c:103:40: warning: using floating point
> > absolute
> > > >> value
> > > >> > > > function 'fabs' when argument is of integer type
> > [-Wabsolute-value]
> > > >> > > > maxshift = FFMIN(maxshift, fabs(pos)+32);
> > > >> > > >^
> > > >> > > > tests/audiomatch.c:103:40: note: use function 'abs' instead
> > > >> > > > maxshift = FFMIN(maxshift, fabs(pos)+32);
> > > >> > > >^~~~
> > > >> > > >abs
> > > >> > > > tests/audiomatch.c:25:28: note: expanded from macro 'FFMIN'
> > > >> > > > #define FFMIN(a,b) ((a) > (b) ? (b) : (a))
> > > >> > > >^
> > > >> > > > tests/audiomatch.c:103:40: warning: using floating point
> > absolute
> > > >> value
> > > >> > > > function 'fabs' when argument is of integer type
> > [-Wabsolute-value]
> > > >> > > > maxshift = FFMIN(maxshift, fabs(pos)+32);
> > > >> > > >^
> > > >> > > > tests/audiomatch.c:103:40: note: use function 'abs' instead
> > > >> > > > maxshift = FFMIN(maxshift, fabs(pos)+32);
> > > >> > > >^~~~
> > > >> > > >abs
> > > >> > > > tests/audiomatch.c:25:34: note: expanded from macro 'FFMIN'
> > > >> > > > #define FFMIN(a,b) ((a) > (b) ? (b) : (a))
> > > >> > > >  ^
> > > >> > > > tests/audiomatch.c:104:12: warning: using floating point
> > absolute
> > > >> value
> > > >> > > > function 'fabs' when argument is of integer type
> > [-Wabsolute-value]
> > > >> > > > if(fabs(c)>fabs(bestc)){
> > > >> > > >^
> > > >> > > > tests/audiomatch.c:104:12: note: use function 'llabs' instead
> > > >> > > > if(fabs(c)>fabs(bestc)){
> > > >> > > >^~~~
> > > >> > > >llabs
> > > >> > > > 4 warnings generated.
> > > >> > > > HOSTLD tests/audiomatch
> > > >> > > > GEN tests/data/hls-list-append.m3u8
> > > >> > > > TESTfilter-hls-append
> > > >> > > >
> > > >> > > >
> > > >> > > >
> > > >> > > >
> > > >> > > > On Linux Test:
> > > >> > > > [root@localhost ffmpeg]# make fate-filter-hls-append
> > > >> > > > HOSTCC tests/base64.o
> > > >> > > > HOSTLD tests/base64
> > > >> > > > HOSTCC tests/tiny_psnr.o
> > > >> > > > HOSTLD tests/tiny_psnr
> > > >> > > > HOSTCC tests/tiny_ssim.o
> > > >> > > > HOSTLD tests/tiny_ssim
> > > >> > > > HOSTCC tests/audiomatch.o
> > > >> > > > tests/audiomatch.c: 在函数‘main’中:
> > > >> > > > tests/audiomatch.c:40: 警告:此函数中的‘bestpos’在使用前可能未初始化
> > > >> > > > HOSTLD tests/audiomatch
> > > >> > > > GEN tests/data/hls-list-append.m3u8
> > > >> > > > TESTfilter-hls-append
> > > >> > > > [root@localhost ffmpeg]# uname -a
> > > >> > > > Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Fri
> > Nov 22
> > > >> > > > 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
> > > >> > >
> > > >> > > fails with mingw
> > > >> > > ../configure  --cc='ccache i686-w64-mingw32-gcc'  --samples=...
> > > >> --arch=x86
> > > >> > > --target-os=mingw32 --cross-prefix=i686-w64-mingw32- --enable-gpl
> > > >> > > --pkg-config=./pig-config --target_exec=wine
> > > >> > >
> > > >> > > ...
> > > >> > > 

Re: [FFmpeg-devel] [PATCH] mov: Remove ancient heuristic hack

2016-08-25 Thread Derek Buitenhuis
On 8/25/2016 3:40 PM, Michael Niedermayer wrote:
> but its probably best to remove in a seperate patch so if it breaks
> something bisect would immedeatly point to which of the 2 changes
> caused it

Sounds good.

If you think this patch is OK, please push it with this part
of the commit message removed, as per Carl's request:

", nor
does it actually fix the problem properly, but instead has
a one-off heuristic to try and "fix" them at the expense
of breaking legitimate files."

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


Re: [FFmpeg-devel] [PATCH] mov: Remove ancient heuristic hack

2016-08-25 Thread Michael Niedermayer
On Thu, Aug 25, 2016 at 03:25:56PM +0100, Derek Buitenhuis wrote:
> On 8/24/2016 10:54 PM, Michael Niedermayer wrote:
> > IIRC the removed code tried to detect a reorder delay that is not
> > possible in a valid file due to the profile constraints. Aka dts and
> > pts are too far appart for the largest amount of buffers allowed in
> > any codec.
> 
> Basing this on timestamps after applying an edit list shift doesn't
> seem right at all. Maybe edts support didn't exist when it was added?

it seems code from around teh time contained only code to skip
over the edit list data and print a warning but didnt use it at all


> 
> > Quite possibly this limit or the check itself have become wrong
> > over time ...
> > Its even possible there has been some misunderstanding in the buffer
> > cts/pts/dts limitations.
> > 
> > patch probably ok
> 
> [...]
> 
> > iam a bit unsure about "st->codecpar->video_delay = 1;" though
> 
> This was added at the same time, yes. It also looks wrong to me,
> but I was not entirely sure. Do you think I should remove it?

i honestly dont know
but its probably best to remove in a seperate patch so if it breaks
something bisect would immedeatly point to which of the 2 changes
caused it

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

You can kill me, but you cannot change the truth.


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


Re: [FFmpeg-devel] [GSoC] Motion Interpolation

2016-08-25 Thread Michael Niedermayer
On Tue, Aug 23, 2016 at 01:17:47PM +, Davinder Singh wrote:
> On Tue, Aug 23, 2016 at 5:38 AM Andy Furniss  wrote:
> 
> > [...]
> >
> > Nice I can see the edges are better than the last version.
> >
> > The doc/filters.texi hunk doesn't apply to git master.
> >
> > I was going to post some comparisons with mcfps tonight, but I'll need
> > to redo them to see what's changed.
> 
> 
> fixed docs conflict.
> 
> thanks for testing!

[...]
> +uint64_t ff_me_search_tss(AVMotionEstContext *me_ctx, int x_mb, int y_mb, 
> int *mv)
> +{
> +int x, y;
> +int x_min = FFMAX(me_ctx->x_min, x_mb - me_ctx->search_param);
> +int y_min = FFMAX(me_ctx->y_min, y_mb - me_ctx->search_param);
> +int x_max = FFMIN(x_mb + me_ctx->search_param, me_ctx->x_max);
> +int y_max = FFMIN(y_mb + me_ctx->search_param, me_ctx->y_max);
> +uint64_t cost, cost_min;
> +int step = ROUNDED_DIV(me_ctx->search_param, 2);
> +int i;
> +

> +int square[8][2] = {{0,-1}, {0,1}, {-1,0}, {1,0}, {-1,-1}, {-1,1}, 
> {1,-1}, {1,1}};

const

> +
> +mv[0] = x_mb;
> +mv[1] = y_mb;
> +
> +if (!(cost_min = me_ctx->get_cost(me_ctx, x_mb, y_mb, x_mb, y_mb)))
> +return cost_min;
> +
> +do {
> +x = mv[0];
> +y = mv[1];
> +
> +for (i = 0; i < 8; i++)
> +COST_P_MV(x + square[i][0] * step, y + square[i][1] * step);
> +

> +step = step / 2;

 >>1 might be faster


> +
> +} while (step > 0);
> +
> +return cost_min;
> +}
> +
> +uint64_t ff_me_search_tdls(AVMotionEstContext *me_ctx, int x_mb, int y_mb, 
> int *mv)
> +{
> +int x, y;
> +int x_min = FFMAX(me_ctx->x_min, x_mb - me_ctx->search_param);
> +int y_min = FFMAX(me_ctx->y_min, y_mb - me_ctx->search_param);
> +int x_max = FFMIN(x_mb + me_ctx->search_param, me_ctx->x_max);
> +int y_max = FFMIN(y_mb + me_ctx->search_param, me_ctx->y_max);
> +uint64_t cost, cost_min;
> +int step = ROUNDED_DIV(me_ctx->search_param, 2);
> +int i;
> +

> +int dia2[4][2] = {{-1, 0}, { 0,-1},
> +  { 1, 0}, { 0, 1}};

const


> +
> +mv[0] = x_mb;
> +mv[1] = y_mb;
> +
> +if (!(cost_min = me_ctx->get_cost(me_ctx, x_mb, y_mb, x_mb, y_mb)))
> +return cost_min;
> +
> +do {
> +x = mv[0];
> +y = mv[1];
> +
> +for (i = 0; i < 4; i++)
> +COST_P_MV(x + dia2[i][0] * step, y + dia2[i][1] * step);
> +
> +if (x == mv[0] && y == mv[1])
> +step = step / 2;
> +
> +} while (step > 0);
> +
> +return cost_min;
> +}
> +
> +uint64_t ff_me_search_ntss(AVMotionEstContext *me_ctx, int x_mb, int y_mb, 
> int *mv)
> +{
> +int x, y;
> +int x_min = FFMAX(me_ctx->x_min, x_mb - me_ctx->search_param);
> +int y_min = FFMAX(me_ctx->y_min, y_mb - me_ctx->search_param);
> +int x_max = FFMIN(x_mb + me_ctx->search_param, me_ctx->x_max);
> +int y_max = FFMIN(y_mb + me_ctx->search_param, me_ctx->y_max);
> +uint64_t cost, cost_min;
> +int step = ROUNDED_DIV(me_ctx->search_param, 2);
> +int first_step = 1;
> +int i;
> +

> +int square[8][2] = {{0,-1}, {0,1}, {-1,0}, {1,0}, {-1,-1}, {-1,1}, 
> {1,-1}, {1,1}};

const

[...]
> +uint64_t ff_me_search_ds(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int 
> *mv)
> +{
> +int x, y;
> +int x_min = FFMAX(me_ctx->x_min, x_mb - me_ctx->search_param);
> +int y_min = FFMAX(me_ctx->y_min, y_mb - me_ctx->search_param);
> +int x_max = FFMIN(x_mb + me_ctx->search_param, me_ctx->x_max);
> +int y_max = FFMIN(y_mb + me_ctx->search_param, me_ctx->y_max);
> +uint64_t cost, cost_min;
> +int i;
> +int dir_x, dir_y;
> +
> +int dia[8][2] = {{-2, 0}, {-1,-1}, { 0,-2}, { 1,-1},
> + { 2, 0}, { 1, 1}, { 0, 2}, {-1, 1}};
> +int dia2[4][2] = {{-1, 0}, { 0,-1},
> +  { 1, 0}, { 0, 1}};
> +
> +if (!(cost_min = me_ctx->get_cost(me_ctx, x_mb, y_mb, x_mb, y_mb)))
> +return cost_min;
> +
> +x = x_mb; y = y_mb;
> +dir_x = dir_y = 0;
> +
> +do {
> +x = mv[0];
> +y = mv[1];
> +
> +#if 1
> +for (i = 0; i < 8; i++)
> +COST_P_MV(x + dia[i][0], y + dia[i][1]);
> +#else
> +/* this version skips previously examined 3 or 5 locations based on 
> prev origin */
> +if (dir_x <= 0)
> +COST_P_MV(x - 2, y);
> +if (dir_x <= 0 && dir_y <= 0)
> +COST_P_MV(x - 1, y - 1);
> +if (dir_y <= 0)
> +COST_P_MV(x, y - 2);
> +if (dir_x >= 0 && dir_y <= 0)
> +COST_P_MV(x + 1, y - 1);
> +if (dir_x >= 0)
> +COST_P_MV(x + 2, y);
> +if (dir_x >= 0 && dir_y >= 0)
> +COST_P_MV(x + 1, y + 1);
> +if (dir_y >= 0)
> +COST_P_MV(x, y + 2);
> +if (dir_x <= 0 && dir_y >= 0)
> +COST_P_MV(x - 1, y + 1);
> +
> +dir_x = mv[0] - x;
> +dir_y = mv[1] - y;
> +#endif
> +
> +} 

Re: [FFmpeg-devel] [PATCH] mov: Remove ancient heuristic hack

2016-08-25 Thread Derek Buitenhuis
On 8/24/2016 10:54 PM, Michael Niedermayer wrote:
> IIRC the removed code tried to detect a reorder delay that is not
> possible in a valid file due to the profile constraints. Aka dts and
> pts are too far appart for the largest amount of buffers allowed in
> any codec.

Basing this on timestamps after applying an edit list shift doesn't
seem right at all. Maybe edts support didn't exist when it was added?

> Quite possibly this limit or the check itself have become wrong
> over time ...
> Its even possible there has been some misunderstanding in the buffer
> cts/pts/dts limitations.
> 
> patch probably ok

[...]

> iam a bit unsure about "st->codecpar->video_delay = 1;" though

This was added at the same time, yes. It also looks wrong to me,
but I was not entirely sure. Do you think I should remove it?

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


[FFmpeg-devel] [PATCH 2/2] Fix audiomatch complie warning

2016-08-25 Thread Steven Liu
Making sure bestpos is initialized to zero to prevent gcc from kvetching.
It's harmless (although it's not obvious that it's harmless)
from code inspection:
tests/audiomatch.c: In function ‘main’:
tests/audiomatch.c:40: warning: ‘bestpos’ may be used uninitialized in this
function

Thanks to Moritz Barsnick for first bringing this to the attention.

Signed-off-by: LiuQi 
---
 tests/audiomatch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/audiomatch.c b/tests/audiomatch.c
index 9752f68..ca56df0 100644
--- a/tests/audiomatch.c
+++ b/tests/audiomatch.c
@@ -37,7 +37,7 @@ int main(int argc, char **argv){
 FILE *f[2];
 int i, pos;
 int siglen, datlen;
-int bestpos;
+int bestpos = 0;
 double bestc=0;
 double sigamp= 0;
 int16_t *signal, *data;
--
2.7.4


0002-Fix-audiomatch-complie-warning.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/2] tests/fate:Add FATE for hls_flags append option

2016-08-25 Thread Steven Liu
 Tested passed at :
1. OSX
2. Linux
3. Windows
4. Ubuntu+wine+MinGW

the message from Ubuntu+wine+MinGW:

liuqi@ubuntu:~/ffmpeg/xxx$ make fate-filter-hls-append
HOSTCC  tests/base64.o
HOSTLD  tests/base64
HOSTCC  tests/tiny_psnr.o
HOSTLD  tests/tiny_psnr
HOSTCC  tests/tiny_ssim.o
HOSTLD  tests/tiny_ssim
HOSTCC  tests/audiomatch.o
HOSTLD  tests/audiomatch
GEN tests/data/hls-list-append.m3u8
TESTfilter-hls-append
liuqi@ubuntu:~/ffmpeg/xxx$ file ffmpeg.
ffmpeg.dffmpeg.exe  ffmpeg.o
liuqi@ubuntu:~/ffmpeg/xxx$ file ffmpeg.exe
ffmpeg.exe: PE32 executable (console) Intel 80386 (stripped to external
PDB), for MS Windows
liuqi@ubuntu:~/ffmpeg/xxx$ uname -a
Linux ubuntu 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016
x86_64 x86_64 x86_64 GNU/Linux


Modify from old patch:
$(TARGET_PATH)/ffmpeg
to
$(TARGET_PATH)/$<


0001-tests-fate-Add-FATE-for-hls_flags-append-option.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/aaccoder: Limit sf_idx difference for all cases

2016-08-25 Thread Michael Niedermayer
On Thu, Aug 25, 2016 at 12:57:17PM +0100, Rostislav Pehlivanov wrote:
> On 23 August 2016 at 11:27, Michael Niedermayer 
> wrote:
> 
> > Fixes: assertion failure
> > Fixes: 86914558f0a471f038ee1102c02eeb45/signal_sigabrt_76ae7c37_3051_
> > 64ed96a710787ba5d0666746a8562e7d.dee
> >
> > Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/aaccoder.c | 8 +++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
> > index 284b401..995724b 100644
> > --- a/libavcodec/aaccoder.c
> > +++ b/libavcodec/aaccoder.c
> > @@ -196,7 +196,7 @@ typedef struct TrellisPath {
> >  static void set_special_band_scalefactors(AACEncContext *s,
> > SingleChannelElement *sce)
> >  {
> >  int w, g;
> > -int prevscaler_n = -255, prevscaler_i = 0;
> > +int prevscaler_n = -255, prevscaler_i = 0, prevscaler_d = -255;
> >  int bands = 0;
> >
> >  for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
> > @@ -211,6 +211,10 @@ static void set_special_band_scalefactors(AACEncContext
> > *s, SingleChannelElement
> >  if (prevscaler_n == -255)
> >  prevscaler_n = sce->sf_idx[w*16+g];
> >  bands++;
> > +} else {
> > +if (prevscaler_d == -255)
> > +prevscaler_d = sce->sf_idx[w*16+g];
> > +bands++;
> >  }
> >  }
> >  }
> > @@ -227,6 +231,8 @@ static void set_special_band_scalefactors(AACEncContext
> > *s, SingleChannelElement
> >  sce->sf_idx[w*16+g] = prevscaler_i =
> > av_clip(sce->sf_idx[w*16+g], prevscaler_i - SCALE_MAX_DIFF, prevscaler_i +
> > SCALE_MAX_DIFF);
> >  } else if (sce->band_type[w*16+g] == NOISE_BT) {
> >  sce->sf_idx[w*16+g] = prevscaler_n =
> > av_clip(sce->sf_idx[w*16+g], prevscaler_n - SCALE_MAX_DIFF, prevscaler_n +
> > SCALE_MAX_DIFF);
> > +} else {
> > +sce->sf_idx[w*16+g] = prevscaler_d =
> > av_clip(sce->sf_idx[w*16+g], prevscaler_d - SCALE_MAX_DIFF, prevscaler_d +
> > SCALE_MAX_DIFF);
> >  }
> >  }
> >  }
> > --
> > 2.9.3
> >
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> 
> 
> That fuzzed sample seems to be causing the algorithm which does SF
> difference normalization between normal and PNS bands to fail. This commit
> masks the problem downstream. IMO that's not the correct way to solve this,
> as there's no guarantee that another sample won't trigger the same assert
> even when limiting all scalefactors. Fixing a single fuzzed sample with a
> hack which doesn't stop other fuzzed samples from triggering the same bug
> isn't justified.

thanks for the analysis, i had already suspected that this is possibly
not the correct fix, which is why i posted this patch ...


> I have the time right now and I'll try to fix this properly, but it might
> take me a day or two. I think the problem is that when the twoloop coder
> does the the normalization it doesn't take into account the fact that IS
> and PNS have their scalefactors modified by set_special_band_scalefactors()
> later on before encoding.

ok, ill wait with 3.1.3

Thanks

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

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle


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


Re: [FFmpeg-devel] [PATCH] tests/fate:Add FATE for hls_flags append option

2016-08-25 Thread Steven Liu
2016-08-25 6:16 GMT+08:00 Michael Niedermayer :

> On Wed, Aug 24, 2016 at 09:40:55PM +0800, Steven Liu wrote:
> > 2016-08-24 19:14 GMT+08:00 Steven Liu :
> >
> > >
> > >
> > > 2016-08-24 18:57 GMT+08:00 Michael Niedermayer  >:
> > >
> > >> On Wed, Aug 24, 2016 at 06:28:08PM +0800, Steven Liu wrote:
> > >> > 2016-08-24 18:23 GMT+08:00 Michael Niedermayer
>  > >> >:
> > >> >
> > >> > > On Wed, Aug 24, 2016 at 03:04:59PM +0800, Steven Liu wrote:
> > >> > > > On OSX test:
> > >> > > > localhost:ffmpeg liuqi$ uname -a
> > >> > > > Darwin localhost 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19
> > >> 18:36:36
> > >> > > > PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
> > >> > > > localhost:ffmpeg liuqi$ make fate-filter-hls-append
> > >> > > > HOSTCC tests/base64.o
> > >> > > > HOSTLD tests/base64
> > >> > > > HOSTCC tests/tiny_psnr.o
> > >> > > > HOSTLD tests/tiny_psnr
> > >> > > > HOSTCC tests/tiny_ssim.o
> > >> > > > HOSTLD tests/tiny_ssim
> > >> > > > HOSTCC tests/audiomatch.o
> > >> > > > tests/audiomatch.c:102:12: warning: using floating point
> absolute
> > >> value
> > >> > > > function 'fabs' when argument is of integer type
> [-Wabsolute-value]
> > >> > > > if(fabs(c) > sigamp * 0.94)
> > >> > > >^
> > >> > > > tests/audiomatch.c:102:12: note: use function 'llabs' instead
> > >> > > > if(fabs(c) > sigamp * 0.94)
> > >> > > >^~~~
> > >> > > >llabs
> > >> > > > tests/audiomatch.c:103:40: warning: using floating point
> absolute
> > >> value
> > >> > > > function 'fabs' when argument is of integer type
> [-Wabsolute-value]
> > >> > > > maxshift = FFMIN(maxshift, fabs(pos)+32);
> > >> > > >^
> > >> > > > tests/audiomatch.c:103:40: note: use function 'abs' instead
> > >> > > > maxshift = FFMIN(maxshift, fabs(pos)+32);
> > >> > > >^~~~
> > >> > > >abs
> > >> > > > tests/audiomatch.c:25:28: note: expanded from macro 'FFMIN'
> > >> > > > #define FFMIN(a,b) ((a) > (b) ? (b) : (a))
> > >> > > >^
> > >> > > > tests/audiomatch.c:103:40: warning: using floating point
> absolute
> > >> value
> > >> > > > function 'fabs' when argument is of integer type
> [-Wabsolute-value]
> > >> > > > maxshift = FFMIN(maxshift, fabs(pos)+32);
> > >> > > >^
> > >> > > > tests/audiomatch.c:103:40: note: use function 'abs' instead
> > >> > > > maxshift = FFMIN(maxshift, fabs(pos)+32);
> > >> > > >^~~~
> > >> > > >abs
> > >> > > > tests/audiomatch.c:25:34: note: expanded from macro 'FFMIN'
> > >> > > > #define FFMIN(a,b) ((a) > (b) ? (b) : (a))
> > >> > > >  ^
> > >> > > > tests/audiomatch.c:104:12: warning: using floating point
> absolute
> > >> value
> > >> > > > function 'fabs' when argument is of integer type
> [-Wabsolute-value]
> > >> > > > if(fabs(c)>fabs(bestc)){
> > >> > > >^
> > >> > > > tests/audiomatch.c:104:12: note: use function 'llabs' instead
> > >> > > > if(fabs(c)>fabs(bestc)){
> > >> > > >^~~~
> > >> > > >llabs
> > >> > > > 4 warnings generated.
> > >> > > > HOSTLD tests/audiomatch
> > >> > > > GEN tests/data/hls-list-append.m3u8
> > >> > > > TESTfilter-hls-append
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > > On Linux Test:
> > >> > > > [root@localhost ffmpeg]# make fate-filter-hls-append
> > >> > > > HOSTCC tests/base64.o
> > >> > > > HOSTLD tests/base64
> > >> > > > HOSTCC tests/tiny_psnr.o
> > >> > > > HOSTLD tests/tiny_psnr
> > >> > > > HOSTCC tests/tiny_ssim.o
> > >> > > > HOSTLD tests/tiny_ssim
> > >> > > > HOSTCC tests/audiomatch.o
> > >> > > > tests/audiomatch.c: 在函数‘main’中:
> > >> > > > tests/audiomatch.c:40: 警告:此函数中的‘bestpos’在使用前可能未初始化
> > >> > > > HOSTLD tests/audiomatch
> > >> > > > GEN tests/data/hls-list-append.m3u8
> > >> > > > TESTfilter-hls-append
> > >> > > > [root@localhost ffmpeg]# uname -a
> > >> > > > Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Fri
> Nov 22
> > >> > > > 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
> > >> > >
> > >> > > fails with mingw
> > >> > > ../configure  --cc='ccache i686-w64-mingw32-gcc'  --samples=...
> > >> --arch=x86
> > >> > > --target-os=mingw32 --cross-prefix=i686-w64-mingw32- --enable-gpl
> > >> > > --pkg-config=./pig-config --target_exec=wine
> > >> > >
> > >> > > ...
> > >> > > +0, 873216, 873216, 1152, 2304, 0x823b822c
> > >> > > +0, 874368, 874368, 1152, 2304, 0xa1658479
> > >> > > +0, 875520, 875520, 1152, 2304, 0xdbe58ff7
> > >> > > +0, 876672, 876672, 1152, 2304, 0x725175e2
> > >> > > +0, 

Re: [FFmpeg-devel] [PATCH] avcodec/aaccoder: Limit sf_idx difference for all cases

2016-08-25 Thread Rostislav Pehlivanov
On 23 August 2016 at 11:27, Michael Niedermayer 
wrote:

> Fixes: assertion failure
> Fixes: 86914558f0a471f038ee1102c02eeb45/signal_sigabrt_76ae7c37_3051_
> 64ed96a710787ba5d0666746a8562e7d.dee
>
> Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/aaccoder.c | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
> index 284b401..995724b 100644
> --- a/libavcodec/aaccoder.c
> +++ b/libavcodec/aaccoder.c
> @@ -196,7 +196,7 @@ typedef struct TrellisPath {
>  static void set_special_band_scalefactors(AACEncContext *s,
> SingleChannelElement *sce)
>  {
>  int w, g;
> -int prevscaler_n = -255, prevscaler_i = 0;
> +int prevscaler_n = -255, prevscaler_i = 0, prevscaler_d = -255;
>  int bands = 0;
>
>  for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
> @@ -211,6 +211,10 @@ static void set_special_band_scalefactors(AACEncContext
> *s, SingleChannelElement
>  if (prevscaler_n == -255)
>  prevscaler_n = sce->sf_idx[w*16+g];
>  bands++;
> +} else {
> +if (prevscaler_d == -255)
> +prevscaler_d = sce->sf_idx[w*16+g];
> +bands++;
>  }
>  }
>  }
> @@ -227,6 +231,8 @@ static void set_special_band_scalefactors(AACEncContext
> *s, SingleChannelElement
>  sce->sf_idx[w*16+g] = prevscaler_i =
> av_clip(sce->sf_idx[w*16+g], prevscaler_i - SCALE_MAX_DIFF, prevscaler_i +
> SCALE_MAX_DIFF);
>  } else if (sce->band_type[w*16+g] == NOISE_BT) {
>  sce->sf_idx[w*16+g] = prevscaler_n =
> av_clip(sce->sf_idx[w*16+g], prevscaler_n - SCALE_MAX_DIFF, prevscaler_n +
> SCALE_MAX_DIFF);
> +} else {
> +sce->sf_idx[w*16+g] = prevscaler_d =
> av_clip(sce->sf_idx[w*16+g], prevscaler_d - SCALE_MAX_DIFF, prevscaler_d +
> SCALE_MAX_DIFF);
>  }
>  }
>  }
> --
> 2.9.3
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


That fuzzed sample seems to be causing the algorithm which does SF
difference normalization between normal and PNS bands to fail. This commit
masks the problem downstream. IMO that's not the correct way to solve this,
as there's no guarantee that another sample won't trigger the same assert
even when limiting all scalefactors. Fixing a single fuzzed sample with a
hack which doesn't stop other fuzzed samples from triggering the same bug
isn't justified.
I have the time right now and I'll try to fix this properly, but it might
take me a day or two. I think the problem is that when the twoloop coder
does the the normalization it doesn't take into account the fact that IS
and PNS have their scalefactors modified by set_special_band_scalefactors()
later on before encoding.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 09/21] libavformat/movenc: support for multiple and client-provided track references

2016-08-25 Thread Erkki Seppälä
..though on more precise look it FFmpeg doesn't in fact implement 
multiple track references at all (MOVTrack has src_track while the patch 
introduces src_tracks). But the patch can be greatly simplified regardless.


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


Re: [FFmpeg-devel] [PATCH 09/21] libavformat/movenc: support for multiple and client-provided track references

2016-08-25 Thread Erkki Seppälä

Hello,

However long this patch is, it is also mostly useless: the standard does 
NOT support multiple distinct tref tags. Instead it supports multiple 
references for one or zero trefs, which is what FFmpeg already supports.


I will introduce a patch that instead just adds the ability to set the 
track reference type and add track references. The side packet API does 
not need to change as far as I can see.


On 08/23/2016 12:03 PM, erkki.seppala@nokia.com wrote:

From: Erkki Seppälä 

Instead of one track reference, allow multiple. In addition, allow
client to explicitly add track references with side packet
AV_PKG_DATA_TRACK_REFERENCES containing AVTrackReferences. MOVTrack's
track references can be manipulated with helper functions
ff_mov_*tref*.

Multiple track references can be useful in particular with timed meta
data tracks, indicating the track is related to multiple other tracks.

This information ends up in ISO media file box 'tref' as specified by
ISO/IEC 14496-12.

Signed-off-by: Erkki Seppälä 
Signed-off-by: OZOPlayer 


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


Re: [FFmpeg-devel] [PATCH] Nvidia NVENC 10-bit HEVC encoding and rate control lookahead support

2016-08-25 Thread Timo Rothenpieler
Am 24.08.2016 um 12:30 schrieb Oliver Collyer:
> Ok thanks, Timo.
> 
> So I’ve split this into two patches and revised as per the discussions and 
> they are attached here.
> 
> The only thing to be decided is whether my conversion code to enable 
> YUV420P10 support should be included in this or not.
> 
> It’s in the attached patch but I’m happy to remove it if necessary.

I'm not a fan of format-conversion code in nvenc. That's the job of swscale.
If a needed conversion is missing/performs poorly, it should be fixed in
sws instead.

> Regards
> 
> Oliver
> 

Unfortunately I'm still on my old GTX760, so I can't test all the
hevc/10bit stuff.
The patch looks Ok though and should generally be fine to merge minus
the format-conversion.

Might have to get myself an intermediary GTX1060 to upgrade my old PC
once again.




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 3/6] lavc/qsv: Enable hwaccel qsv_vidmem.

2016-08-25 Thread Hendrik Leppkes
On Thu, Aug 25, 2016 at 2:07 AM, Nablet Developer  wrote:
> From: ChaoX A Liu 
>
> Signed-off-by: ChaoX A Liu 
> ---
>  ffmpeg.c  |   2 +-
>  ffmpeg.h  |   2 +
>  ffmpeg_opt.c  |   2 +-
>  ffmpeg_qsv.c  | 636 
> +-
>  libavcodec/qsv.h  |   3 +
>  libavcodec/qsv_internal.h |   2 +
>  libavcodec/qsvdec.c   |   5 +-
>  libavcodec/qsvenc.c   |   2 +
>  8 files changed, 649 insertions(+), 5 deletions(-)
>

This is a giant patch that doesnt even begin to describe what it does.
So, whats it good for? We can already do transcoding of video from QSV
decoder to QSV encoder all in GPU memory without 600+ lines of new
code. Admittedly it currently has a few issues, but those could be
fixed, but why do we need 600 new lines of code?

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


Re: [FFmpeg-devel] [PATCH 2/6] lavf/vpp: Enable vpp filter, an Intel GPU accelerated scaler.

2016-08-25 Thread Hendrik Leppkes
On Thu, Aug 25, 2016 at 2:24 AM, Jean-Baptiste Kempf  wrote:
> On 25 Aug, Nablet Developer wrote :
>> -int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs)
>> +int ff_qsv_init_internal_session(void *avctx, QSVSession *qs)
>> -int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs);
>> +int ff_qsv_init_internal_session(void *avctx, QSVSession *qs);
>
> This is very ugly, and I doubt it's a good idea.


More precisely, it wont ever work. You cannot use ff_* functions
outside the library they are defined in.
And before you start renaming them, we really do not want QSV-specific
public API functions of any form. All hardware accelerated API should
go through avutl hwcontext now, and not create new public API.

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


Re: [FFmpeg-devel] Possible long(er?) term support

2016-08-25 Thread Michael Niedermayer
On Wed, Aug 24, 2016 at 12:11:47PM -0600, Orion Poplawski wrote:
> On 08/24/2016 11:54 AM, Carl Eugen Hoyos wrote:
> > Hi!
> > 
> > 2016-08-24 18:51 GMT+02:00 Orion Poplawski :
> >>   Would the ffmpeg developers be willing treat any particular release as a
> >> long-term-support release and try to do security updates for it?
> > 
> > Could you define "long-term"?
> > 
> > Carl Eugen
> 
> Well, EL7 itself will be around for a long time (till 2024), but we don't
> expect any open-source project to have support for that long. But something in
> the 2-3 year range would be very helpful.

Calling one of our releases from time to time LTS certainly makes
sense from a marketing point of view ...
Doing that with a consistent shedule and clearly stated timeframe
also makes sense
Also synchronizing such shedule with distros and user applications
would make sense

To support a release better, longer or with more clearly stated shedule
requires someone with the will and time to stand
behind it though. Is there someone this applies to ?
Do you know someone this applies to ?

Thanks

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

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell


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: add vaguedenoiser filter

2016-08-25 Thread Paul B Mahol
On 8/25/16, Paul B Mahol  wrote:
> Hi,
>
> patch attached.
>

Improved version attached.


0001-avfilter-add-vaguedenoiser-filter.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 lut2 filter

2016-08-25 Thread Paul B Mahol
On 8/24/16, Paul B Mahol  wrote:
> Hi,
>
> patch attached.
>

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


Re: [FFmpeg-devel] [PATCH] avfilter: add yuvtestsrc source filter

2016-08-25 Thread Paul B Mahol
On 8/24/16, Paul B Mahol  wrote:
> Hi,
>
> patch attached.
>

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


Re: [FFmpeg-devel] [PATCH 19/21] doc/examples/extract_timed_metadata: added a bare-bones metadata extractor; find only the frames

2016-08-25 Thread Erkki Seppälä
Thanks for pointing out the use of private API. It seemed that this 
would have needed to add a new function for the API for decoding timed 
metadata frames, but probably a better solution is to use the 
avcodec_receive_packet framework for this as the old API is deprecated 
anyway?


Below is a patch to introduce the functionality (example edited for 
brevity). If this seems like the way to, I'll add this to v2 of the 
patches. (I may squash the first patch with one of the other patches if 
it fits in.)


commit ddfb745109768a169e93c221092161d39c8f8208
Author: Erkki Seppälä 
Date:   Thu Aug 25 10:21:15 2016 +0300

libavcodec/utils: do_decode now supports AVMEDIA_TYPE_DATA

This allows using avcodec_send_packet with data frames (ie. timed 
metadata)


diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 138125a..8b55464 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2737,6 +2737,10 @@ static int do_decode(AVCodecContext *avctx, 
AVPacket *pkt)

 } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
 ret = avcodec_decode_audio4(avctx, avctx->internal->buffer_frame,
 _frame, pkt);
+} else if (avctx->codec_type == AVMEDIA_TYPE_DATA) {
+ret = avctx->codec->decode(avctx, 
avctx->internal->buffer_frame, _frame, pkt);

+if (ret == 0 && got_frame)
+ret = pkt->size;
 } else {
 ret = AVERROR(EINVAL);
 }

commit ebfceb706d8c8d0dbfe64ebe06d218aaa8807e43
Author: Erkki Seppälä 
Date:   Thu Aug 25 10:22:19 2016 +0300

fixup! doc/examples/extract_timed_metadata: added a bare-bones 
metadata extractor; find only the frames


diff --git a/doc/examples/extract_timed_metadata.c 
b/doc/examples/extract_timed_metadata.c

index 48fb877..03da2b7 100644
--- a/doc/examples/extract_timed_metadata.c
+++ b/doc/examples/extract_timed_metadata.c
@@ -184,16 +183,15 @@ int main(int argc, char **argv)

 for (i = 0; metadata_stream_indices[i] >= 0; i++) {
 if (packet.stream_index == metadata_stream_indices[i]) {
-got_frame = 0;
-
-ret = dec_ctx[i]->codec->decode(dec_ctx[i], metadata, 
_frame, );

+ret = avcodec_send_packet(dec_ctx[i], );

+// We always empty decoded frames so we don't handle 
AVERROR(EAGAIN) here

 if (ret < 0) {
 av_log(NULL, AV_LOG_ERROR, "Error decoding meta 
data\n");

 break;
 }

-if (got_frame) {
+while (avcodec_receive_frame(dec_ctx[i], metadata) == 0) {
 int c;
 printf("track #%d at %" PRId64 " %d, ",
packet.stream_index + 1,
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 4/6] lavf/vpp: enable video memory accel for transcoding with vpp. lavc/qsv: export symbols "ff_qsv_*" which will be used by vpp. ffmpeg_qsv: set default hwaccel to qsv.

2016-08-25 Thread Jean-Baptiste Kempf
Idem. Patch does too many things and changes unrelated code.

On 25 Aug, Nablet Developer wrote :
> From: ChaoX A Liu 
> 
> Signed-off-by: ChaoX A Liu 
> ---
>  ffmpeg_qsv.c|  46 ---
>  libavcodec/libavcodec.v |   1 +
>  libavcodec/qsv.h|   2 +
>  libavfilter/vf_qsvvpp.c | 153 
> 
>  4 files changed, 172 insertions(+), 30 deletions(-)
> 
> diff --git a/ffmpeg_qsv.c b/ffmpeg_qsv.c
> index 43402d6..aed9240 100644
> --- a/ffmpeg_qsv.c
> +++ b/ffmpeg_qsv.c
> @@ -386,7 +386,7 @@ static mfxStatus frame_alloc(mfxHDL pthis, 
> mfxFrameAllocRequest *request, mfxFra
>  unsigned int va_fourcc = 0;
>  mfxU32 fourcc = request->Info.FourCC;
>  QSVContext *q = pthis;
> -AVQSVContext *qsv = q->ost->enc_ctx->hwaccel_context;
> +AVQSVContext *qsv = NULL;
>  mfxU16 numAllocated = 0;
>  bool bCreateSrfSucceeded = false;
>  mfxU32 mfx_fourcc;
> @@ -394,17 +394,40 @@ static mfxStatus frame_alloc(mfxHDL pthis, 
> mfxFrameAllocRequest *request, mfxFra
>  int width32;
>  int height32;
>  void *avctx = NULL;
> +FilterGraph *fg = q->ost->filter->graph;
>  
> -av_log(avctx, AV_LOG_INFO, "=vaapi alloc frame==\n");
>  if (!request || !response || !request->NumFrameSuggested)
>  return MFX_ERR_MEMORY_ALLOC;
>  
>  memset(response, 0, sizeof(*response));
>  surface_num = request->NumFrameSuggested;
> -if ((request->Type & MFX_MEMTYPE_EXTERNAL_FRAME) &&
> -(request->Type & MFX_MEMTYPE_FROM_DECODE))
> -surface_num += (qsv->nb_encoder_surfaces + qsv->nb_decoder_surfaces);
> +if (request->Type & MFX_MEMTYPE_FROM_DECODE) {
> +avctx = input_streams[q->ost->source_index]->dec_ctx;
> +if (request->Type & MFX_MEMTYPE_EXTERNAL_FRAME) {
> +AVFilterContext *qsvvpp = avfilter_graph_get_filter(fg->graph, 
> "Parsed_qsvvpp_0");
> +qsv = 
> input_streams[q->ost->source_index]->dec_ctx->hwaccel_context;
> +surface_num += qsv->nb_decoder_surfaces;
> +if (qsvvpp) {
> +qsv = qsvvpp->hw_device_ctx->data;
> +surface_num += qsv->nb_vpp_surfaces;
> +} else {
> +qsv = q->ost->enc_ctx->hwaccel_context;
> +surface_num += qsv->nb_encoder_surfaces;
> +}
> +}
> +} else if (request->Type & MFX_MEMTYPE_FROM_VPPOUT) {
> +AVFilterContext *qsvvpp = avfilter_graph_get_filter(fg->graph, 
> "Parsed_qsvvpp_0");
> +avctx = qsvvpp;
> +if (request->Type & MFX_MEMTYPE_EXTERNAL_FRAME) {
> +qsv = q->ost->enc_ctx->hwaccel_context;
> +surface_num += qsv->nb_encoder_surfaces;
> +}
> +} else if (request->Type & MFX_MEMTYPE_FROM_ENCODE) {
> +avctx = q->ost->enc_ctx;
> +} else
> +av_log(avctx, AV_LOG_WARNING, "FrameAlloc: may get a bug.\n");
>  
> +av_log(avctx, AV_LOG_INFO, "=vaapi alloc frame==\n");
>  av_log(avctx, AV_LOG_INFO, "VAAPI: va_dpy =%p, surface_num=%d, width=%d, 
> height=%d\n",
>  g_session.va_display, surface_num, request->Info.Width, 
> request->Info.Height);
>  av_log(avctx, AV_LOG_INFO, "VAAPI: request->Type=%x\n",request->Type);
> @@ -720,7 +743,7 @@ static int qsv_check_filters(const OutputStream *ost)
>  AVFilterInOut *inputs, *outputs;
>  int ret = 0;
>  int i;
> -const char *filter_list = "buffer|buffersink|null|format|setpts";
> +const char *filter_list = "buffer|buffersink|null|format|setpts|qsvvpp";
>  
>  if (!ost->avfilter)
>  return -1;
> @@ -820,6 +843,7 @@ int qsv_transcode_init_vidmem(OutputStream *ost)
>  
>  QSVContext *qsv = NULL;
>  AVQSVContext *enc_hwctx = NULL;
> +AVQSVContext *vpp_hwctx = NULL;
>  
>  /* check if the encoder supports QSV */
>  if (!ost->enc->pix_fmts)
> @@ -836,6 +860,8 @@ int qsv_transcode_init_vidmem(OutputStream *ost)
>  
>  /* check if the decoder supports QSV and the output only goes to this 
> stream */
>  ist = input_streams[ost->source_index];
> +if (ist->hwaccel_id == HWACCEL_NONE || ist->hwaccel_id == HWACCEL_AUTO)
> +ist->hwaccel_id = HWACCEL_QSV;
>  if (ist->nb_filters || ist->hwaccel_id != HWACCEL_QSV ||
>  !ist->dec || !ist->dec->pix_fmts)
>  return 0;
> @@ -854,7 +880,8 @@ int qsv_transcode_init_vidmem(OutputStream *ost)
>  
>  qsv   = av_mallocz(sizeof(*qsv));
>  enc_hwctx = av_qsv_alloc_context();
> -if (!qsv || !enc_hwctx)
> +vpp_hwctx = av_qsv_alloc_context();
> +if (!qsv || !enc_hwctx || !vpp_hwctx)
>  goto fail;
>  
>  err = ff_qsv_init_internal_session(NULL, _session);
> @@ -891,6 +918,11 @@ int qsv_transcode_init_vidmem(OutputStream *ost)
>  ist->resample_pix_fmt= AV_PIX_FMT_QSV;
>  ist->hwaccel_ctx = qsv;
>  
> +

Re: [FFmpeg-devel] [PATCH 3/6] lavc/qsv: Enable hwaccel qsv_vidmem.

2016-08-25 Thread Jean-Baptiste Kempf
On 25 Aug, Nablet Developer wrote :
> From: ChaoX A Liu 

what is vidmem?

> diff --git a/ffmpeg.c b/ffmpeg.c
> diff --git a/ffmpeg.h b/ffmpeg.h

I doubt this should be in the same commit.

> +INTEL CORPORATION PROPRIETARY INFORMATION
> +This software is supplied under the terms of a license agreement or 
> nondisclosure
> +agreement with Intel Corporation and may not be copied or disclosed except in
> +accordance with the terms of that agreement
> +Copyright(c) 2011-2014 Intel Corporation. All Rights Reserved.

WHAT?

> diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
> index b9de0af..47dd818 100644
> --- a/libavcodec/qsvdec.c
> +++ b/libavcodec/qsvdec.c
> @@ -72,6 +72,7 @@ static int qsv_decode_init(AVCodecContext *avctx, 
> QSVContext *q, AVPacket *avpkt
>  q->iopattern  = qsv->iopattern;
>  q->ext_buffers= qsv->ext_buffers;
>  q->nb_ext_buffers = qsv->nb_ext_buffers;
> +qsv->nb_decoder_surfaces = q->async_depth;
>  }
>  if (!q->session) {
>  if (!q->internal_qs.session) {
> @@ -88,7 +89,7 @@ static int qsv_decode_init(AVCodecContext *avctx, 
> QSVContext *q, AVPacket *avpkt
>  if (ret < 0) {
>  av_log(avctx, AV_LOG_ERROR, "Failed to load plugins %s, ret = 
> %s\n",
>  q->load_plugins, av_err2str(ret));
> -return ff_qsv_error(ret);
> +return ret;
>  }
>  }
>  
> @@ -149,7 +150,7 @@ static int qsv_decode_init(AVCodecContext *avctx, 
> QSVContext *q, AVPacket *avpkt
> So weare  pre-allocating fifo big enough for 17 elements:
>   */
>  if (!q->async_fifo) {
> -q->async_fifo = av_fifo_alloc((1 + 16) *
> +q->async_fifo = av_fifo_alloc((1 + 16 + q->async_depth) *
>(sizeof(mfxSyncPoint) + 
> sizeof(QSVFrame*)));
>  if (!q->async_fifo)
>  return AVERROR(ENOMEM);

I doubt those changes are OK.

> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index 81b8f6f..041f298 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -760,6 +760,8 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext 
> *q)
>  
>  q->param.ExtParam[q->param.NumExtParam++] = 
> q->extparam_internal[i];
>  }
> +
> +qsv->nb_encoder_surfaces = q->req.NumFrameSuggested + q->async_depth;
>  } else {
>  q->param.ExtParam= q->extparam_internal;
>  q->param.NumExtParam = q->nb_extparam_internal;


Patch is way too big, and does too many unrelated things.

With my kindest regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/6] lavf/vpp: Enable vpp filter, an Intel GPU accelerated scaler.

2016-08-25 Thread Jean-Baptiste Kempf
On 25 Aug, Nablet Developer wrote :
> -int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs)
> +int ff_qsv_init_internal_session(void *avctx, QSVSession *qs)
> -int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs);
> +int ff_qsv_init_internal_session(void *avctx, QSVSession *qs);

This is very ugly, and I doubt it's a good idea.

With my kindest regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 6/6] lavc/qsv-lavc/vpp: Promote gpu_copy to be a selectable parameter. GPU-copy is defaultly closed because it seems to be unstable.

2016-08-25 Thread Nablet Developer
From: ChaoX A Liu 

Signed-off-by: ChaoX A Liu 
---
 libavcodec/qsv.c  |  7 ++-
 libavcodec/qsv_internal.h |  1 +
 libavcodec/qsvdec.c   | 22 +-
 libavcodec/qsvdec_h2645.c | 12 
 libavcodec/qsvdec_mpeg2.c |  6 ++
 libavcodec/qsvdec_vc1.c   |  6 ++
 libavcodec/qsvenc.h   |  4 
 libavfilter/vf_qsvvpp.c   |  8 +++-
 8 files changed, 59 insertions(+), 7 deletions(-)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index c180ca8..c61a29c 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -172,11 +172,16 @@ int ff_qsv_init_internal_session(void *avctx, QSVSession 
*qs)
 {
 mfxIMPL impl   = MFX_IMPL_AUTO_ANY;
 mfxVersion ver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } };
+mfxInitParam par;
 
 const char *desc;
 int ret;
 
-ret = MFXInit(impl, , >session);
+memset(, 0, sizeof(par));
+par.Implementation = impl;
+par.Version = ver;
+par.GPUCopy = qs->gpu_copy;
+ret = MFXInitEx(par, >session);
 if (ret < 0) {
 av_log(avctx, AV_LOG_ERROR, "Error initializing an internal MFX 
session\n");
 return ff_qsv_error(ret);
diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index 58589df..39778a9 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -73,6 +73,7 @@ typedef struct QSVSession {
 intfd_display;
 VADisplay  va_display;
 #endif
+intgpu_copy;
 } QSVSession;
 
 /**
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 2075a23..08a5eaa 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -176,13 +176,25 @@ static int alloc_frame(AVCodecContext *avctx, QSVFrame 
*frame)
 {
 int ret;
 
-ret = ff_get_buffer(avctx, frame->frame, AV_GET_BUFFER_FLAG_REF);
-if (ret < 0)
-return ret;
-
-if (frame->frame->format == AV_PIX_FMT_QSV) {
+if (avctx->pix_fmt == AV_PIX_FMT_QSV) {
+ret = ff_get_buffer(avctx, frame->frame, AV_GET_BUFFER_FLAG_REF);
+if (ret < 0)
+return ret;
 frame->surface = (mfxFrameSurface1*)frame->frame->data[3];
 } else {
+/*
+ * Align frame's width x height to 128x64.
+ * It's recommended to do so if GPU_Copy is turned on.
+ */
+frame->frame->format = avctx->pix_fmt;
+frame->frame->width  = FFALIGN(avctx->width, 128);
+frame->frame->height = FFALIGN(avctx->height, 64);
+ret = av_frame_get_buffer(frame->frame, 64);
+if (ret < 0)
+return ret;
+frame->frame->width  = avctx->width;
+frame->frame->height = avctx->height;
+
 frame->surface_internal.Info.BitDepthLuma   = 8;
 frame->surface_internal.Info.BitDepthChroma = 8;
 frame->surface_internal.Info.FourCC = MFX_FOURCC_NV12;
diff --git a/libavcodec/qsvdec_h2645.c b/libavcodec/qsvdec_h2645.c
index 208302b..a4adc10 100755
--- a/libavcodec/qsvdec_h2645.c
+++ b/libavcodec/qsvdec_h2645.c
@@ -248,6 +248,12 @@ static const AVOption hevc_options[] = {
 
 { "load_plugins", "A :-separate list of hexadecimal plugin UIDs to load in 
an internal session",
 OFFSET(qsv.load_plugins), AV_OPT_TYPE_STRING, { .str = "" }, 0, 0, VD 
},
+
+{ "gpu_copy", "Enable gpu copy in sysmem mode [default = off]", 
OFFSET(qsv.internal_qs.gpu_copy), AV_OPT_TYPE_INT, { .i64 = MFX_GPUCOPY_OFF }, 
MFX_GPUCOPY_DEFAULT, MFX_GPUCOPY_OFF, .flags = VD, "gpu_copy" },
+{ "default",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_GPUCOPY_DEFAULT }, 
0, 0, .flags = VD, "gpu_copy" },
+{ "on",   NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_GPUCOPY_ON },  
0, 0, .flags = VD, "gpu_copy" },
+{ "off",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_GPUCOPY_OFF }, 
0, 0, .flags = VD, "gpu_copy" },
+
 { NULL },
 };
 
@@ -286,6 +292,12 @@ AVHWAccel ff_h264_qsv_hwaccel = {
 
 static const AVOption options[] = {
 { "async_depth", "Internal parallelization depth, the higher the value the 
higher the latency.", OFFSET(qsv.async_depth), AV_OPT_TYPE_INT, { .i64 = 
ASYNC_DEPTH_DEFAULT }, 0, INT_MAX, VD },
+
+{ "gpu_copy", "Enable gpu copy in sysmem mode [default = off]", 
OFFSET(qsv.internal_qs.gpu_copy), AV_OPT_TYPE_INT, { .i64 = MFX_GPUCOPY_OFF }, 
MFX_GPUCOPY_DEFAULT, MFX_GPUCOPY_OFF, .flags = VD, "gpu_copy" },
+{ "default",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_GPUCOPY_DEFAULT }, 
0, 0, .flags = VD, "gpu_copy" },
+{ "on",   NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_GPUCOPY_ON },  
0, 0, .flags = VD, "gpu_copy" },
+{ "off",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_GPUCOPY_OFF }, 
0, 0, .flags = VD, "gpu_copy" },
+
 { NULL },
 };
 
diff --git a/libavcodec/qsvdec_mpeg2.c b/libavcodec/qsvdec_mpeg2.c
index 70ccbc5..5e2354a 100644
--- a/libavcodec/qsvdec_mpeg2.c
+++ b/libavcodec/qsvdec_mpeg2.c
@@ -72,6 +72,12 @@ AVHWAccel ff_mpeg2_qsv_hwaccel = {
 #define VD AV_OPT_FLAG_VIDEO_PARAM | 

[FFmpeg-devel] [PATCH 2/6] lavf/vpp: Enable vpp filter, an Intel GPU accelerated scaler.

2016-08-25 Thread Nablet Developer
From: ChaoX A Liu 

Signed-off-by: ChaoX A Liu 
---
 configure |   3 +
 libavcodec/qsv.c  |   2 +-
 libavcodec/qsv_internal.h |   2 +-
 libavfilter/Makefile  |   1 +
 libavfilter/allfilters.c  |   1 +
 libavfilter/vf_qsvvpp.c   | 864 ++
 6 files changed, 871 insertions(+), 2 deletions(-)
 create mode 100644 libavfilter/vf_qsvvpp.c

diff --git a/configure b/configure
index 5b017fd..525efae 100755
--- a/configure
+++ b/configure
@@ -2086,6 +2086,7 @@ CONFIG_EXTRA="
 qsv
 qsvdec
 qsvenc
+qsvvpp
 rangecoder
 riffdec
 riffenc
@@ -3044,6 +3045,8 @@ phase_filter_deps="gpl"
 pp7_filter_deps="gpl"
 pp_filter_deps="gpl postproc"
 pullup_filter_deps="gpl"
+qsvvpp_filter_deps="libmfx"
+qsvvpp_filter_select="qsv"
 removelogo_filter_deps="avcodec avformat swscale"
 repeatfields_filter_deps="gpl"
 resample_filter_deps="avresample"
diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index b505e14..c180ca8 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -168,7 +168,7 @@ static int ff_qsv_set_display_handle(AVCodecContext *avctx, 
QSVSession *qs)
  * @param avctxffmpeg metadata for this codec context
  * @param session  the MSDK session used
  */
-int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs)
+int ff_qsv_init_internal_session(void *avctx, QSVSession *qs)
 {
 mfxIMPL impl   = MFX_IMPL_AUTO_ANY;
 mfxVersion ver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } };
diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index 59d1336..e43728b 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -80,7 +80,7 @@ int ff_qsv_error(int mfx_err);
 
 int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id);
 
-int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs);
+int ff_qsv_init_internal_session(void *avctx, QSVSession *qs);
 
 int ff_qsv_load_plugins(mfxSession session, const char *load_plugins);
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 9dc524f..f53ff7a 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -236,6 +236,7 @@ OBJS-$(CONFIG_PP7_FILTER)+= vf_pp7.o
 OBJS-$(CONFIG_PSNR_FILTER)   += vf_psnr.o dualinput.o 
framesync.o
 OBJS-$(CONFIG_PULLUP_FILTER) += vf_pullup.o
 OBJS-$(CONFIG_QP_FILTER) += vf_qp.o
+OBJS-$(CONFIG_QSVVPP_FILTER) += vf_qsvvpp.o
 OBJS-$(CONFIG_RANDOM_FILTER) += vf_random.o
 OBJS-$(CONFIG_READVITC_FILTER)   += vf_readvitc.o
 OBJS-$(CONFIG_REALTIME_FILTER)   += f_realtime.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 05fa9c4..f7de5a5 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -252,6 +252,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(PSNR,   psnr,   vf);
 REGISTER_FILTER(PULLUP, pullup, vf);
 REGISTER_FILTER(QP, qp, vf);
+REGISTER_FILTER(QSVVPP, qsvvpp, vf);
 REGISTER_FILTER(RANDOM, random, vf);
 REGISTER_FILTER(READVITC,   readvitc,   vf);
 REGISTER_FILTER(REALTIME,   realtime,   vf);
diff --git a/libavfilter/vf_qsvvpp.c b/libavfilter/vf_qsvvpp.c
new file mode 100644
index 000..3a5d4d3
--- /dev/null
+++ b/libavfilter/vf_qsvvpp.c
@@ -0,0 +1,864 @@
+/*
+ * Intel MediaSDK Quick Sync Video VPP filter
+ *
+ * copyright (c) 2015 Sven Dueking
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "internal.h"
+#include 
+#include "libavutil/parseutils.h"
+#include "libavutil/timestamp.h"
+#include "libavcodec/qsv.h"
+
+/**
+ * ToDo :
+ *
+ * - double check surface pointers for different fourccs
+ * - handle empty extbuffers
+ * - cropping
+ * - use AV_PIX_FMT_QSV to pass surfaces to encoder
+ * - deinterlace check settings etc.
+ * - allocate number of surfaces depending modules and number of b frames
+ */
+
+#define VPP_ZERO_MEMORY(VAR){ memset(, 0, sizeof(VAR)); }
+#define VPP_ALIGN16(value)  (((value + 15) >> 4) << 4)  // 
round up to a multiple of 16
+#define VPP_ALIGN32(value)  

[FFmpeg-devel] [PATCH 1/6] lavc/qsv(hevc): Change default plugin from hevc_sw to hevc_default, which will load hevc_hw first, due to newly released MSDK.

2016-08-25 Thread Nablet Developer
From: ChaoX A Liu 

Signed-off-by: ChaoX A Liu 
---
 libavcodec/qsv.c  | 89 ---
 libavcodec/qsv_internal.h |  6 ++--
 libavcodec/qsvdec.c   | 16 ++---
 libavcodec/qsvdec_h2645.c | 17 ++---
 libavcodec/qsvenc.c   | 12 +--
 libavcodec/qsvenc_hevc.c  | 19 +-
 6 files changed, 104 insertions(+), 55 deletions(-)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 11d453d..b505e14 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -168,8 +168,7 @@ static int ff_qsv_set_display_handle(AVCodecContext *avctx, 
QSVSession *qs)
  * @param avctxffmpeg metadata for this codec context
  * @param session  the MSDK session used
  */
-int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs,
- const char *load_plugins)
+int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs)
 {
 mfxIMPL impl   = MFX_IMPL_AUTO_ANY;
 mfxVersion ver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } };
@@ -187,67 +186,87 @@ int ff_qsv_init_internal_session(AVCodecContext *avctx, 
QSVSession *qs,
 if (ret < 0)
 return ret;
 
+MFXQueryIMPL(qs->session, );
+
+switch (MFX_IMPL_BASETYPE(impl)) {
+case MFX_IMPL_SOFTWARE:
+desc = "software";
+break;
+case MFX_IMPL_HARDWARE:
+case MFX_IMPL_HARDWARE2:
+case MFX_IMPL_HARDWARE3:
+case MFX_IMPL_HARDWARE4:
+desc = "hardware accelerated";
+break;
+default:
+desc = "unknown";
+}
+
+av_log(avctx, AV_LOG_VERBOSE,
+   "Initialized an internal MFX session using %s implementation\n",
+   desc);
+
+return 0;
+}
+
+/**
+ * @brief Load plugins for a MSDK session
+ *
+ * Media SDK may need external plugins to decode/encode,
+ * such as hevc_dec and hevc_enc. So it's necessary to load
+ * proper plugins.
+ *
+ * @param session   the MSDK session used
+ * @param load_plugins  the load_plugins to be loaded.
+ */
+int ff_qsv_load_plugins(mfxSession session, const char *load_plugins)
+{
+int err = 0, load_num = 0, i;
+
 if (load_plugins && *load_plugins) {
 while (*load_plugins) {
 mfxPluginUID uid;
-int i, err = 0;
 
 char *plugin = av_get_token(_plugins, ":");
 if (!plugin)
 return AVERROR(ENOMEM);
 if (strlen(plugin) != 2 * sizeof(uid.Data)) {
-av_log(avctx, AV_LOG_ERROR, "Invalid plugin UID length\n");
 err = AVERROR(EINVAL);
 goto load_plugin_fail;
 }
+if (*load_plugins == ':')
+load_plugins ++;
 
 for (i = 0; i < sizeof(uid.Data); i++) {
 err = sscanf(plugin + 2 * i, "%2hhx", uid.Data + i);
 if (err != 1) {
-av_log(avctx, AV_LOG_ERROR, "Invalid plugin UID\n");
 err = AVERROR(EINVAL);
 goto load_plugin_fail;
 }
-
 }
 
-ret = MFXVideoUSER_Load(qs->session, , 1);
-if (ret < 0) {
-av_log(avctx, AV_LOG_ERROR, "Could not load the requested 
plugin: %s\n",
-   plugin);
-err = ff_qsv_error(ret);
+err = MFXVideoUSER_Load(session, , 1);
+if (err < 0) {
+err = ff_qsv_error(err);
 goto load_plugin_fail;
 }
+load_num ++;
 
-if (*load_plugins)
-load_plugins++;
 load_plugin_fail:
 av_freep();
-if (err < 0)
-return err;
+/*
+ * If more plugins are going to be loaded,
+ * ignore current error and continue.
+ */
+if (*load_plugins == ':') {
+load_plugins ++;
+err = 0;
+}
 }
+if (!load_num)
+return err;
 }
 
-MFXQueryIMPL(qs->session, );
-
-switch (MFX_IMPL_BASETYPE(impl)) {
-case MFX_IMPL_SOFTWARE:
-desc = "software";
-break;
-case MFX_IMPL_HARDWARE:
-case MFX_IMPL_HARDWARE2:
-case MFX_IMPL_HARDWARE3:
-case MFX_IMPL_HARDWARE4:
-desc = "hardware accelerated";
-break;
-default:
-desc = "unknown";
-}
-
-av_log(avctx, AV_LOG_VERBOSE,
-   "Initialized an internal MFX session using %s implementation\n",
-   desc);
-
 return 0;
 }
 
diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index f289a2b..59d1336 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -80,8 +80,10 @@ int ff_qsv_error(int mfx_err);
 
 int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id);
 
-int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs,
- const char *load_plugins);
+int 

[FFmpeg-devel] [PATCH 4/6] lavf/vpp: enable video memory accel for transcoding with vpp. lavc/qsv: export symbols "ff_qsv_*" which will be used by vpp. ffmpeg_qsv: set default hwaccel to qsv.

2016-08-25 Thread Nablet Developer
From: ChaoX A Liu 

Signed-off-by: ChaoX A Liu 
---
 ffmpeg_qsv.c|  46 ---
 libavcodec/libavcodec.v |   1 +
 libavcodec/qsv.h|   2 +
 libavfilter/vf_qsvvpp.c | 153 
 4 files changed, 172 insertions(+), 30 deletions(-)

diff --git a/ffmpeg_qsv.c b/ffmpeg_qsv.c
index 43402d6..aed9240 100644
--- a/ffmpeg_qsv.c
+++ b/ffmpeg_qsv.c
@@ -386,7 +386,7 @@ static mfxStatus frame_alloc(mfxHDL pthis, 
mfxFrameAllocRequest *request, mfxFra
 unsigned int va_fourcc = 0;
 mfxU32 fourcc = request->Info.FourCC;
 QSVContext *q = pthis;
-AVQSVContext *qsv = q->ost->enc_ctx->hwaccel_context;
+AVQSVContext *qsv = NULL;
 mfxU16 numAllocated = 0;
 bool bCreateSrfSucceeded = false;
 mfxU32 mfx_fourcc;
@@ -394,17 +394,40 @@ static mfxStatus frame_alloc(mfxHDL pthis, 
mfxFrameAllocRequest *request, mfxFra
 int width32;
 int height32;
 void *avctx = NULL;
+FilterGraph *fg = q->ost->filter->graph;
 
-av_log(avctx, AV_LOG_INFO, "=vaapi alloc frame==\n");
 if (!request || !response || !request->NumFrameSuggested)
 return MFX_ERR_MEMORY_ALLOC;
 
 memset(response, 0, sizeof(*response));
 surface_num = request->NumFrameSuggested;
-if ((request->Type & MFX_MEMTYPE_EXTERNAL_FRAME) &&
-(request->Type & MFX_MEMTYPE_FROM_DECODE))
-surface_num += (qsv->nb_encoder_surfaces + qsv->nb_decoder_surfaces);
+if (request->Type & MFX_MEMTYPE_FROM_DECODE) {
+avctx = input_streams[q->ost->source_index]->dec_ctx;
+if (request->Type & MFX_MEMTYPE_EXTERNAL_FRAME) {
+AVFilterContext *qsvvpp = avfilter_graph_get_filter(fg->graph, 
"Parsed_qsvvpp_0");
+qsv = 
input_streams[q->ost->source_index]->dec_ctx->hwaccel_context;
+surface_num += qsv->nb_decoder_surfaces;
+if (qsvvpp) {
+qsv = qsvvpp->hw_device_ctx->data;
+surface_num += qsv->nb_vpp_surfaces;
+} else {
+qsv = q->ost->enc_ctx->hwaccel_context;
+surface_num += qsv->nb_encoder_surfaces;
+}
+}
+} else if (request->Type & MFX_MEMTYPE_FROM_VPPOUT) {
+AVFilterContext *qsvvpp = avfilter_graph_get_filter(fg->graph, 
"Parsed_qsvvpp_0");
+avctx = qsvvpp;
+if (request->Type & MFX_MEMTYPE_EXTERNAL_FRAME) {
+qsv = q->ost->enc_ctx->hwaccel_context;
+surface_num += qsv->nb_encoder_surfaces;
+}
+} else if (request->Type & MFX_MEMTYPE_FROM_ENCODE) {
+avctx = q->ost->enc_ctx;
+} else
+av_log(avctx, AV_LOG_WARNING, "FrameAlloc: may get a bug.\n");
 
+av_log(avctx, AV_LOG_INFO, "=vaapi alloc frame==\n");
 av_log(avctx, AV_LOG_INFO, "VAAPI: va_dpy =%p, surface_num=%d, width=%d, 
height=%d\n",
 g_session.va_display, surface_num, request->Info.Width, 
request->Info.Height);
 av_log(avctx, AV_LOG_INFO, "VAAPI: request->Type=%x\n",request->Type);
@@ -720,7 +743,7 @@ static int qsv_check_filters(const OutputStream *ost)
 AVFilterInOut *inputs, *outputs;
 int ret = 0;
 int i;
-const char *filter_list = "buffer|buffersink|null|format|setpts";
+const char *filter_list = "buffer|buffersink|null|format|setpts|qsvvpp";
 
 if (!ost->avfilter)
 return -1;
@@ -820,6 +843,7 @@ int qsv_transcode_init_vidmem(OutputStream *ost)
 
 QSVContext *qsv = NULL;
 AVQSVContext *enc_hwctx = NULL;
+AVQSVContext *vpp_hwctx = NULL;
 
 /* check if the encoder supports QSV */
 if (!ost->enc->pix_fmts)
@@ -836,6 +860,8 @@ int qsv_transcode_init_vidmem(OutputStream *ost)
 
 /* check if the decoder supports QSV and the output only goes to this 
stream */
 ist = input_streams[ost->source_index];
+if (ist->hwaccel_id == HWACCEL_NONE || ist->hwaccel_id == HWACCEL_AUTO)
+ist->hwaccel_id = HWACCEL_QSV;
 if (ist->nb_filters || ist->hwaccel_id != HWACCEL_QSV ||
 !ist->dec || !ist->dec->pix_fmts)
 return 0;
@@ -854,7 +880,8 @@ int qsv_transcode_init_vidmem(OutputStream *ost)
 
 qsv   = av_mallocz(sizeof(*qsv));
 enc_hwctx = av_qsv_alloc_context();
-if (!qsv || !enc_hwctx)
+vpp_hwctx = av_qsv_alloc_context();
+if (!qsv || !enc_hwctx || !vpp_hwctx)
 goto fail;
 
 err = ff_qsv_init_internal_session(NULL, _session);
@@ -891,6 +918,11 @@ int qsv_transcode_init_vidmem(OutputStream *ost)
 ist->resample_pix_fmt= AV_PIX_FMT_QSV;
 ist->hwaccel_ctx = qsv;
 
+vpp_hwctx->session   = qsv->session;
+vpp_hwctx->iopattern = MFX_IOPATTERN_IN_VIDEO_MEMORY;
+vpp_hwctx->pFrameAllocator   = >frame_allocator;
+hw_device_ctx = av_buffer_create(vpp_hwctx, sizeof(*vpp_hwctx), 
av_buffer_default_free, NULL, 0);
+
 return 0;
 
 fail:
diff --git a/libavcodec/libavcodec.v 

[FFmpeg-devel] [PATCH 0/6] fixes for HEVC GPU accelerated codec (v2)

2016-08-25 Thread Nablet Developer
From: ChaoX A Liu 

This is updated version of patchset.

Fix for license reference.
Rename vpp filter to qsvvpp



ChaoX A Liu (6):
  lavc/qsv(hevc): Change default plugin from hevc_sw to hevc_default,
which will load hevc_hw first, due to newly released MSDK.
  lavf/vpp: Enable vpp filter, an Intel GPU accelerated scaler.
  lavc/qsv: Enable hwaccel qsv_vidmem.
  lavf/vpp: enable video memory accel for transcoding with vpp. 
lavc/qsv: export symbols "ff_qsv_*" which will be used by vpp.
ffmpeg_qsv: set default hwaccel to qsv.
  lavc/qsvdec: Reset decoder if MFX_ERR_UNDEFINED_BEHAVIOR is caught,
because this error may get decoder stuck.
  lavc/qsv-lavc/vpp: Promote gpu_copy to be a selectable parameter.
GPU-copy is defaultly closed because it seems to be unstable.

 configure |   3 +
 ffmpeg.c  |   2 +-
 ffmpeg.h  |   2 +
 ffmpeg_opt.c  |   2 +-
 ffmpeg_qsv.c  | 668 ++-
 libavcodec/libavcodec.v   |   1 +
 libavcodec/qsv.c  |  96 +++--
 libavcodec/qsv.h  |   5 +
 libavcodec/qsv_internal.h |   9 +-
 libavcodec/qsvdec.c   |  52 ++-
 libavcodec/qsvdec_h2645.c |  29 +-
 libavcodec/qsvdec_mpeg2.c |   6 +
 libavcodec/qsvdec_vc1.c   |   6 +
 libavcodec/qsvenc.c   |  14 +-
 libavcodec/qsvenc.h   |   4 +
 libavcodec/qsvenc_hevc.c  |  19 +-
 libavfilter/Makefile  |   1 +
 libavfilter/allfilters.c  |   1 +
 libavfilter/vf_qsvvpp.c   | 977 ++
 19 files changed, 1829 insertions(+), 68 deletions(-)
 create mode 100644 libavfilter/vf_qsvvpp.c

-- 
2.5.0

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


[FFmpeg-devel] [PATCH 5/6] lavc/qsvdec: Reset decoder if MFX_ERR_UNDEFINED_BEHAVIOR is caught, because this error may get decoder stuck.

2016-08-25 Thread Nablet Developer
From: ChaoX A Liu 

Signed-off-by: ChaoX A Liu 
---
 libavcodec/qsvdec.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 47dd818..2075a23 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -370,13 +370,18 @@ static int do_qsv_decode(AVCodecContext *avctx, 
QSVContext *q,
 av_usleep(500);
 } while (1);
 
-if (MFX_WRN_VIDEO_PARAM_CHANGED==ret) {
+if (MFX_WRN_VIDEO_PARAM_CHANGED == ret) {
 /* TODO: handle here minor sequence header changing */
-} else if (MFX_ERR_INCOMPATIBLE_VIDEO_PARAM==ret) {
+} else if (MFX_ERR_INCOMPATIBLE_VIDEO_PARAM == ret) {
 av_fifo_reset(q->input_fifo);
 flush = q->reinit_pending = 1;
 continue;
-}
+} else if (MFX_ERR_UNDEFINED_BEHAVIOR == ret)
+/*
+ * Decoder may get stuck with this errorcode.
+ * Reset decoder to avoid that.
+ */
+ff_qsv_decode_reset(avctx, q);
 
 if (sync) {
 QSVFrame *out_frame = find_frame(q, outsurf);
-- 
2.5.0

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


[FFmpeg-devel] [PATCH 3/6] lavc/qsv: Enable hwaccel qsv_vidmem.

2016-08-25 Thread Nablet Developer
From: ChaoX A Liu 

Signed-off-by: ChaoX A Liu 
---
 ffmpeg.c  |   2 +-
 ffmpeg.h  |   2 +
 ffmpeg_opt.c  |   2 +-
 ffmpeg_qsv.c  | 636 +-
 libavcodec/qsv.h  |   3 +
 libavcodec/qsv_internal.h |   2 +
 libavcodec/qsvdec.c   |   5 +-
 libavcodec/qsvenc.c   |   2 +
 8 files changed, 649 insertions(+), 5 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index bad311d..0bab9e9 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3050,7 +3050,7 @@ static int transcode_init(void)
 set_encoder_id(output_files[ost->file_index], ost);
 
 #if CONFIG_LIBMFX
-if (qsv_transcode_init(ost))
+if (qsv_transcode_init_vidmem(ost))
 exit_program(1);
 #endif
 
diff --git a/ffmpeg.h b/ffmpeg.h
index 49d65d8..266 100644
--- a/ffmpeg.h
+++ b/ffmpeg.h
@@ -585,6 +585,8 @@ int vda_init(AVCodecContext *s);
 int videotoolbox_init(AVCodecContext *s);
 int qsv_init(AVCodecContext *s);
 int qsv_transcode_init(OutputStream *ost);
+int qsv_init_vidmem(AVCodecContext *s);
+int qsv_transcode_init_vidmem(OutputStream *ost);
 int vaapi_decode_init(AVCodecContext *avctx);
 int vaapi_device_init(const char *device);
 int cuvid_init(AVCodecContext *s);
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 2ea09cf..b5e4483 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -79,7 +79,7 @@ const HWAccel hwaccels[] = {
 { "videotoolbox",   videotoolbox_init,   HWACCEL_VIDEOTOOLBOX,   
AV_PIX_FMT_VIDEOTOOLBOX },
 #endif
 #if CONFIG_LIBMFX
-{ "qsv",   qsv_init,   HWACCEL_QSV,   AV_PIX_FMT_QSV },
+{ "qsv",   qsv_init_vidmem,   HWACCEL_QSV,   AV_PIX_FMT_QSV },
 #endif
 #if CONFIG_VAAPI
 { "vaapi", vaapi_decode_init, HWACCEL_VAAPI, AV_PIX_FMT_VAAPI },
diff --git a/ffmpeg_qsv.c b/ffmpeg_qsv.c
index acc54dd..43402d6 100644
--- a/ffmpeg_qsv.c
+++ b/ffmpeg_qsv.c
@@ -18,11 +18,15 @@
 
 #include 
 #include 
+#include 
+#include 
 
 #include "libavutil/dict.h"
 #include "libavutil/mem.h"
 #include "libavutil/opt.h"
+#include "libavutil/avstring.h"
 #include "libavcodec/qsv.h"
+#include "libavcodec/qsv_internal.h"
 
 #include "ffmpeg.h"
 
@@ -34,6 +38,8 @@ typedef struct QSVContext {
 mfxExtOpaqueSurfaceAlloc opaque_alloc;
 AVBufferRef *opaque_surfaces_buf;
 
+mfxFrameAllocator frame_allocator;
+
 uint8_t   *surface_used;
 mfxFrameSurface1 **surface_ptrs;
 int nb_surfaces;
@@ -60,7 +66,7 @@ static int qsv_get_buffer(AVCodecContext *s, AVFrame *frame, 
int flags)
  buffer_release, 
>surface_used[i], 0);
 if (!frame->buf[0])
 return AVERROR(ENOMEM);
-frame->data[3]   = (uint8_t*)qsv->surface_ptrs[i];
+frame->data[3]   = frame->buf[0]->data;
 qsv->surface_used[i] = 1;
 return 0;
 }
@@ -265,3 +271,631 @@ fail:
 av_freep();
 return AVERROR_UNKNOWN;
 }
+
+enum {
+MFX_FOURCC_VP8_NV12= MFX_MAKEFOURCC('V','P','8','N'),
+MFX_FOURCC_VP8_MBDATA  = MFX_MAKEFOURCC('V','P','8','M'),
+MFX_FOURCC_VP8_SEGMAP  = MFX_MAKEFOURCC('V','P','8','S'),
+};
+
+typedef struct vaapiMemId
+{
+VASurfaceID* m_surface;
+VAImage m_image;
+unsigned int m_fourcc;
+mfxU8* m_sys_buffer;
+mfxU8* m_va_buffer;
+} vaapiMemId;
+
+static QSVSession g_session;
+
+/* 
** 
*\
+
+INTEL CORPORATION PROPRIETARY INFORMATION
+This software is supplied under the terms of a license agreement or 
nondisclosure
+agreement with Intel Corporation and may not be copied or disclosed except in
+accordance with the terms of that agreement
+Copyright(c) 2011-2014 Intel Corporation. All Rights Reserved.
+
+\* 
** 
*/
+static mfxStatus va_to_mfx_status(VAStatus va_res)
+{
+mfxStatus mfxRes = MFX_ERR_NONE;
+
+switch (va_res) {
+case VA_STATUS_SUCCESS:
+mfxRes = MFX_ERR_NONE;
+break;
+case VA_STATUS_ERROR_ALLOCATION_FAILED:
+mfxRes = MFX_ERR_MEMORY_ALLOC;
+break;
+case VA_STATUS_ERROR_ATTR_NOT_SUPPORTED:
+case VA_STATUS_ERROR_UNSUPPORTED_PROFILE:
+case VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT:
+case VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT:
+case VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE:
+case VA_STATUS_ERROR_FLAG_NOT_SUPPORTED:
+case VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED:
+mfxRes = MFX_ERR_UNSUPPORTED;
+break;
+case VA_STATUS_ERROR_INVALID_DISPLAY:
+case VA_STATUS_ERROR_INVALID_CONFIG:
+case VA_STATUS_ERROR_INVALID_CONTEXT:
+case VA_STATUS_ERROR_INVALID_SURFACE:
+case VA_STATUS_ERROR_INVALID_BUFFER:
+case VA_STATUS_ERROR_INVALID_IMAGE:
+case VA_STATUS_ERROR_INVALID_SUBPICTURE:
+