Re: [FFmpeg-devel] [PATCH] lavfi: Port fspp to FFmpeg

2014-12-18 Thread arwa arif
>
>
> > --- a/libavfilter/allfilters.c
> > +++ b/libavfilter/allfilters.c
> > @@ -141,6 +141,7 @@ void avfilter_register_all(void)
> >  REGISTER_FILTER(FRAMEPACK,  framepack,  vf);
> >  REGISTER_FILTER(FRAMESTEP,  framestep,  vf);
> >  REGISTER_FILTER(FREI0R, frei0r, vf);
> > +REGISTER_FILTER(FSPP,   fspp,   vf);
> >  REGISTER_FILTER(GEQ,geq,vf);
> >  REGISTER_FILTER(GRADFUN,gradfun,vf);
> >  REGISTER_FILTER(HALDCLUT,   haldclut,   vf);
> > diff --git a/libavfilter/libmpcodecs/vf_fspp.c
> b/libavfilter/libmpcodecs/vf_fspp.c
> > index d457859..3a80dc2 100644
> > --- a/libavfilter/libmpcodecs/vf_fspp.c
> > +++ b/libavfilter/libmpcodecs/vf_fspp.c
> > @@ -710,8 +710,8 @@ const vf_info_t ff_vf_info_fspp = {
> >  #if HAVE_MMX_INLINE
> >
> >  DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_382683433)=FIX64(0.382683433,
> 14);
> > -DECLARE_ALIGNED(8, uint64_t, ff_MM_FIX_0_541196100)=FIX64(0.541196100,
> 14);
> > -DECLARE_ALIGNED(8, uint64_t, ff_MM_FIX_0_707106781)=FIX64(0.707106781,
> 14);
> > +extern uint64_t ff_MM_FIX_0_707106781;
> > +extern uint64_t ff_MM_FIX_0_541196100;
>
> still looks weird
>

Carl Eugen Hoyos has commented on it in previous mails.

> +
> > +typedef int32_t int_simd16_t;
> > +static const int16_t FIX_0_382683433   = FIX(0.382683433, 14);
> > +static const int16_t FIX_0_541196100   = FIX(0.541196100, 14);
> > +static const int16_t FIX_0_707106781   = FIX(0.707106781, 14);
> > +static const int16_t FIX_1_306562965   = FIX(1.306562965, 14);
> > +static const int16_t FIX_1_414213562_A = FIX(1.414213562, 14);
> > +static const int16_t FIX_1_847759065   = FIX(1.847759065, 13);
> > +static const int16_t FIX_2_613125930   = FIX(-2.613125930, 13);
> > +static const int16_t FIX_1_414213562   = FIX(1.414213562, 13);
> > +static const int16_t FIX_1_082392200   = FIX(1.082392200, 13);
> > +
>
> > +typedef struct fsppContext {
>
> typedef struct {
>
> should be enough


The mul_thrmat function uses a pointer to this struct, so can't remove
that.
From 3da2573bb66205999cf170997a8d088ccb61c350 Mon Sep 17 00:00:00 2001
From: Arwa Arif 
Date: Sun, 14 Dec 2014 12:03:31 +0530
Subject: [PATCH] lavfi: port mp=uspp to a native libavfilter filter

---
 LICENSE.md|1 +
 configure |1 +
 doc/filters.texi  |   30 +
 libavfilter/Makefile  |1 +
 libavfilter/allfilters.c  |1 +
 libavfilter/libmpcodecs/vf_fspp.c |4 +-
 libavfilter/version.h |4 +-
 libavfilter/vf_fspp.c |  672 ++
 libavfilter/vf_fspp.h |   96 +++
 libavfilter/x86/Makefile  |1 +
 libavfilter/x86/vf_fspp.c | 1405 +
 11 files changed, 2212 insertions(+), 4 deletions(-)
 create mode 100644 libavfilter/vf_fspp.c
 create mode 100644 libavfilter/vf_fspp.h
 create mode 100644 libavfilter/x86/vf_fspp.c

diff --git a/LICENSE.md b/LICENSE.md
index cf9955f..188d060 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -31,6 +31,7 @@ Specifically, the GPL parts of FFmpeg are:
 - vf_cropdetect.c
 - vf_decimate.c
 - vf_delogo.c
+- vf_fspp.c
 - vf_geq.c
 - vf_histeq.c
 - vf_hqdn3d.c
diff --git a/configure b/configure
index e37285a..29f5534 100755
--- a/configure
+++ b/configure
@@ -2575,6 +2575,7 @@ ebur128_filter_deps="gpl"
 flite_filter_deps="libflite"
 frei0r_filter_deps="frei0r dlopen"
 frei0r_src_filter_deps="frei0r dlopen"
+fspp_filter_deps="gpl"
 geq_filter_deps="gpl"
 histeq_filter_deps="gpl"
 hqdn3d_filter_deps="gpl"
diff --git a/doc/filters.texi b/doc/filters.texi
index 882caa0..8d2069e 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -4997,6 +4997,35 @@ frei0r=perspective:0.2/0.2|0.8/0.2
 For more information, see
 @url{http://frei0r.dyne.org}
 
+@section fspp
+
+Apply fast and simple postprocessing. It is a faster version of the simple
+postprocessing filter - @ref{spp}.
+
+It splits (I)DCT into horizontal/vertical passes. Unlike Simple postprocessing
+filter, one of them is performed once per block, not per pixel. This allows for
+much better speed.
+
+The filter accepts the following options:
+
+@table @option
+@item quality
+Set quality. This option defines the number of levels for averaging. It accepts
+an integer in the range 0-5. If set to @code{0}, the filter will have no
+effect. A value of @code{5} means the higher quality. For each increment of
+that value the speed drops by a factor of approximately 2.  Default value is
+@code{4}.
+
+@item qp
+Force a constant quantization parameter. It accepts an integer in range 0-63.
+If not set, the filter will use the QP from the video stream (if available).
+
+@item use_bframe_qp
+Enable the use of the QP from the B-Frames if set to @code{1}. Using this
+option may cause flicker since the B-Frames have often larger QP. Default is
+@code{0} (not enabled).
+@end t

Re: [FFmpeg-devel] libavutil: Added cbc mode to cast5.c

2014-12-18 Thread Giorgio Vazzana
Hello,

2014-12-17 19:53 GMT+01:00 supraja reddy :
> I hope this fixes all the issues .

> From 16c8db86ebf92f68a8a750dcbe5e3598a8bd69b5 Mon Sep 17 00:00:00 2001
> From: Supraja Meedinti 
> Date: Thu, 18 Dec 2014 00:17:45 +0530
> Subject: [PATCH] libavutil: Added cbc mode to cast128
>
> Signed-off-by: Supraja Meedinti 
> ---
>  libavutil/cast5.c | 40 ++--
>  libavutil/cast5.h | 14 +-
>  2 files changed, 51 insertions(+), 3 deletions(-)
>
> diff --git a/libavutil/cast5.c b/libavutil/cast5.c
> index 14dd701..dba5b6a 100644
> --- a/libavutil/cast5.c
> +++ b/libavutil/cast5.c
> @@ -416,7 +416,7 @@ static void encipher(AVCAST5* cs, uint8_t* dst, const 
> uint8_t* src)
>  AV_WB32(dst + 4, l);
>  }
>
> -static void decipher(AVCAST5* cs, uint8_t* dst, const uint8_t* src)
> +static void decipher(AVCAST5* cs, uint8_t* dst, const uint8_t* src, uint8_t 
> *iv)
>  {
>  uint32_t f, I, r, l;
>  l = AV_RB32(src);
> @@ -439,6 +439,11 @@ static void decipher(AVCAST5* cs, uint8_t* dst, const 
> uint8_t* src)
>  F3(r, l, 3);
>  F2(l, r, 2);
>  F1(r, l, 1);
> +if (iv) {
> +r ^= AV_RB32(iv);
> +l ^= AV_RB32(iv + 4);
> +memcpy(iv, src, 8);

Indentation is off.

> +}
>  AV_WB32(dst, r);
>  AV_WB32(dst + 4, l);
>  }
> @@ -468,11 +473,30 @@ av_cold int av_cast5_init(AVCAST5* cs, const uint8_t 
> *key, int key_bits)
>  return 0;
>  }
>
> +void av_cast5_crypt2(AVCAST5* cs, uint8_t* dst, const uint8_t* src, int 
> count, uint8_t *iv, int decrypt)
> +{
> +int i;
> +while (count--) {
> +if (decrypt){

Missing space between ) and {.

> +decipher(cs, dst, src, iv);
> +} else {

The indentation of this else branch is wrong.

> +if (iv) {
> +for (i = 0; i < 8; i++)
> +dst[i] = src[i] ^ iv[i];
> +encipher(cs, dst, dst);

Again, you are not saving the IV for the next block here.

> +} else {
> +encipher(cs, dst, src);
> +}
> +}
> +src = src + 8;
> +dst = dst + 8;
> +}
> +}
>  void av_cast5_crypt(AVCAST5* cs, uint8_t* dst, const uint8_t* src, int 
> count, int decrypt)
>  {
>  while (count--) {
>  if (decrypt){
> -decipher(cs, dst, src);
> +decipher(cs, dst, src, NULL);
>  } else {
>  encipher(cs, dst, src);
>  }
> @@ -504,6 +528,7 @@ int main(int argc, char** argv)
>  {0xee, 0xa9, 0xd0, 0xa2, 0x49, 0xfd, 0x3b, 0xa6, 0xb3, 0x43, 0x6f, 
> 0xb8, 0x9d, 0x6d, 0xca, 0x92},
>  {0xb2, 0xc9, 0x5e, 0xb0, 0x0c, 0x31, 0xad, 0x71, 0x80, 0xac, 0x05, 
> 0xb8, 0xe8, 0x3d, 0x69, 0x6e}
>  };
> +uint8_t iv[8] = {0xee, 0xa9, 0xd0, 0xa2, 0x49, 0xfd, 0x3b, 0xa6};
>  static uint8_t rpt2[2][16];
>  int i, j, err = 0;
>  static int key_bits[3] = {128, 80, 40};
> @@ -547,6 +572,17 @@ int main(int argc, char** argv)
>  }
>  }
>  }
> +for (j = 0; j < 3; j++) {
> +av_cast5_init(cs, Key[j], key_bits[j]);
> +av_cast5_crypt2(cs, temp, rpt, 1, iv, 0);
> +av_cast5_crypt2(cs, temp, temp, 1, iv, 1);
> +for (i =0; i < 8; i++) {

Missing space after =.

> +if (rpt[i] != temp[i]) {
> +av_log(NULL, AV_LOG_ERROR, "%d %02x %02x\n", i, rpt[i], 
> temp[i]);
> +err = 1;
> +}
> +}
> +}

I see at least 2 problems with this for loop:

1) you need to use the same IV to encrypt and decrypt the block. It
seems to work here because you forgot to propagate the IV correctly in
av_cast5_crypt2, otherwise after the encryption the IV would change,
and so you would be using a different IV for the decryption.
2) to correctly test CBC mode we need to work on 2 blocks at least.

>  av_free(cs);
>  return err;
>  }
> diff --git a/libavutil/cast5.h b/libavutil/cast5.h
> index 913d048..4a86743 100644
> --- a/libavutil/cast5.h
> +++ b/libavutil/cast5.h
> @@ -52,7 +52,7 @@ struct AVCAST5 *av_cast5_alloc(void);
>  int av_cast5_init(struct AVCAST5 *ctx, const uint8_t *key, int key_bits);
>
>  /**
> -  * Encrypt or decrypt a buffer using a previously initialized context
> +  * Encrypt or decrypt a buffer using a previously initialized context, ECB 
> mode only
>*
>* @param ctx an AVCAST5 context
>* @param dst destination array, can be equal to src
> @@ -61,6 +61,18 @@ int av_cast5_init(struct AVCAST5 *ctx, const uint8_t *key, 
> int key_bits);
>* @param decrypt 0 for encryption, 1 for decryption
>   */
>  void av_cast5_crypt(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, 
> int count, int decrypt);
> +
> +/**
> +  * Encrypt or decrypt a buffer using a previously initialized context
> +  *
> +  * @param ctx an AVCAST5 context
> +  * @param dst destination array, can be equal to src
> +  * @param src source array, can be equal to dst
> +  * @param count number of 8 byte blocks
> +  * @param iv initialization vector for cbc mo

Re: [FFmpeg-devel] [PATCH] cmdutils: dont call read_header before listing devices

2014-12-18 Thread Michael Niedermayer
On Thu, Dec 18, 2014 at 01:29:39AM +0100, Lukasz Marek wrote:
> On 18.12.2014 01:09, Michael Niedermayer wrote:
> >On Wed, Dec 17, 2014 at 10:59:37PM +0100, Lukasz Marek wrote:
> >>On 15.12.2014 14:18, Michael Niedermayer wrote:
>   cmdutils.c |8 ++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 8d012a5193b0440717f89d920661913ef160e674  
> 0001-cmdutils-dont-call-read_header-before-listing-device.patch
>  From 332bb7456c498518ea72dfdaa0e8c3e76d383f21 Mon Sep 17 00:00:00 2001
> From: Lukasz Marek 
> Date: Mon, 15 Dec 2014 00:31:42 +0100
> Subject: [PATCH] cmdutils: dont call read_header before listing devices
> 
> List device callback must be able to return valid list without opening 
> device.
> This callback should return input values for open function, not 
> vice-versa.
> Read header funtion is very likey to fail without proper configuration 
> provided.
> >>>
> >>>should be ok
> >>
> >>I changed a patch. I wanted to avoid situation where .read_close is
> >>called without .read_header being called before.
> >>
> >
> >>  cmdutils.c |   41 +++--
> >>  1 file changed, 35 insertions(+), 6 deletions(-)
> >>9a93c401d795bae3545a6c6112e71abd98ac22ca  
> >>0001-cmdutils-dont-call-read_header-before-listing-device.patch
> >> From 58fe020b8f1c0e809362e152febe3ad715b1c8fc Mon Sep 17 00:00:00 2001
> >>From: Lukasz Marek 
> >>Date: Mon, 15 Dec 2014 00:31:42 +0100
> >>Subject: [PATCH] cmdutils: dont call read_header before listing devices
> >>
> >>List device callback must be able to return valid list without opening 
> >>device.
> >>This callback should return input values for open function, not vice-versa.
> >>Read header funtion is very likey to fail without proper configuration 
> >>provided.
> >>
> >>Signed-off-by: Lukasz Marek 
> >>---
> >>  cmdutils.c | 41 +++--
> >>  1 file changed, 35 insertions(+), 6 deletions(-)
> >>
> >>diff --git a/cmdutils.c b/cmdutils.c
> >>index 4e0a406..23a5f77 100644
> >>--- a/cmdutils.c
> >>+++ b/cmdutils.c
> >>@@ -2052,7 +2052,37 @@ void *grow_array(void *array, int elem_size, int 
> >>*size, int new_size)
> >>  }
> >>
> >>  #if CONFIG_AVDEVICE
> >>-static int print_device_sources(AVInputFormat *fmt, AVDictionary *opts)
> >>+static int alloc_input_context(AVFormatContext **avctx, AVInputFormat 
> >>*iformat)
> >>+{
> >>+AVFormatContext *s = avformat_alloc_context();
> >>+int ret = 0;
> >>+
> >>+*avctx = NULL;
> >>+if (!s)
> >>+return AVERROR(ENOMEM);
> >>+
> >>+s->iformat = iformat;
> >>+if (s->iformat->priv_data_size > 0) {
> >>+s->priv_data = av_mallocz(s->iformat->priv_data_size);
> >>+if (!s->priv_data) {
> >>+ret = AVERROR(ENOMEM);
> >>+goto error;
> >>+}
> >>+if (s->iformat->priv_class) {
> >>+*(const AVClass**)s->priv_data= s->iformat->priv_class;
> >>+av_opt_set_defaults(s->priv_data);
> >>+}
> >>+} else
> >>+s->priv_data = NULL;
> >>+
> >>+*avctx = s;
> >>+return 0;
> >>+  error:
> >>+avformat_free_context(s);
> >>+return ret;
> >>+}
> >>+
> >
> >>+static int print_device_sources(void *pfmt, AVDictionary *opts)
> >>  {
> >>  int ret, i;
> >>  AVFormatContext *dev = NULL;
> >>@@ -2069,13 +2099,12 @@ static int print_device_sources(AVInputFormat *fmt, 
> >>AVDictionary *opts)
> >>  goto fail;
> >>  }
> >>
> >>-/* TODO: avformat_open_input calls read_header callback which is not 
> >>necessary.
> >>- Function like avformat_alloc_output_context2 for input could 
> >>be helpful here. */
> >>-av_dict_copy(&tmp_opts, opts, 0);
> >>-if ((ret = avformat_open_input(&dev, NULL, fmt, &tmp_opts)) < 0) {
> >>+if ((ret = alloc_input_context(&dev, fmt)) < 0) {
> >
> >this fails building due to lack of a fmt variable
> 
> I failed at cherry-pick conflict, thanks.
> Updated patch is attached.
> 

>  cmdutils.c |   39 ++-
>  1 file changed, 34 insertions(+), 5 deletions(-)
> 688f0a3fc7e3a81743bc4ce3cc858b880c648595  
> 0001-cmdutils-dont-call-read_header-before-listing-device.patch
> From 2b9a20f97687f11eb5d1fd72db3b25e3f2703b73 Mon Sep 17 00:00:00 2001
> From: Lukasz Marek 
> Date: Mon, 15 Dec 2014 00:31:42 +0100
> Subject: [PATCH] cmdutils: dont call read_header before listing devices
> 
> List device callback must be able to return valid list without opening device.
> This callback should return input values for open function, not vice-versa.
> Read header funtion is very likey to fail without proper configuration 
> provided.
> 
> Signed-off-by: Lukasz Marek 
> ---
>  cmdutils.c | 39 ++-
>  1 file changed, 34 insertions(+), 5 deletions(-)

should be ok, though its a bit complex if user apps need to do this
to get the device list

[...]

-- 
Michael GnuPG fingerprint: 9FF2128

[FFmpeg-devel] [PATCH]Accept 0x000001 as startcode for hevc in mpegts

2014-12-18 Thread Carl Eugen Hoyos
Hi!

Attached patch fixes ticket #4194 for me, I did not look into 
any specification.

Please review, Carl Eugen
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index a32c6d6..ff15d16 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1207,7 +1207,7 @@ int ff_check_h264_startcode(AVFormatContext *s, const 
AVStream *st, const AVPack
 
 static int check_hevc_startcode(AVFormatContext *s, const AVStream *st, const 
AVPacket *pkt)
 {
-if (pkt->size < 5 || AV_RB32(pkt->data) != 0x001) {
+if (pkt->size < 5 || (AV_RB32(pkt->data) != 0x001 && 
AV_RB24(pkt->data) != 0x01)) {
 if (!st->nb_frames) {
 av_log(s, AV_LOG_ERROR, "HEVC bitstream malformed, no startcode 
found\n");
 return AVERROR_PATCHWELCOME;
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] libavutil: Added cbc mode to cast5.c

2014-12-18 Thread supraja reddy
Sorry for the mistake . I seem to have got cbc completely wrong.
I have made the changes . Please let me know if there is anything missing.

Supraja

On Thu, Dec 18, 2014 at 2:57 PM, Giorgio Vazzana  wrote:
>
> Hello,
>
> 2014-12-17 19:53 GMT+01:00 supraja reddy :
> > I hope this fixes all the issues .
>
> > From 16c8db86ebf92f68a8a750dcbe5e3598a8bd69b5 Mon Sep 17 00:00:00 2001
> > From: Supraja Meedinti 
> > Date: Thu, 18 Dec 2014 00:17:45 +0530
> > Subject: [PATCH] libavutil: Added cbc mode to cast128
> >
> > Signed-off-by: Supraja Meedinti 
> > ---
> >  libavutil/cast5.c | 40 ++--
> >  libavutil/cast5.h | 14 +-
> >  2 files changed, 51 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavutil/cast5.c b/libavutil/cast5.c
> > index 14dd701..dba5b6a 100644
> > --- a/libavutil/cast5.c
> > +++ b/libavutil/cast5.c
> > @@ -416,7 +416,7 @@ static void encipher(AVCAST5* cs, uint8_t* dst,
> const uint8_t* src)
> >  AV_WB32(dst + 4, l);
> >  }
> >
> > -static void decipher(AVCAST5* cs, uint8_t* dst, const uint8_t* src)
> > +static void decipher(AVCAST5* cs, uint8_t* dst, const uint8_t* src,
> uint8_t *iv)
> >  {
> >  uint32_t f, I, r, l;
> >  l = AV_RB32(src);
> > @@ -439,6 +439,11 @@ static void decipher(AVCAST5* cs, uint8_t* dst,
> const uint8_t* src)
> >  F3(r, l, 3);
> >  F2(l, r, 2);
> >  F1(r, l, 1);
> > +if (iv) {
> > +r ^= AV_RB32(iv);
> > +l ^= AV_RB32(iv + 4);
> > +memcpy(iv, src, 8);
>
> Indentation is off.
>
> > +}
> >  AV_WB32(dst, r);
> >  AV_WB32(dst + 4, l);
> >  }
> > @@ -468,11 +473,30 @@ av_cold int av_cast5_init(AVCAST5* cs, const
> uint8_t *key, int key_bits)
> >  return 0;
> >  }
> >
> > +void av_cast5_crypt2(AVCAST5* cs, uint8_t* dst, const uint8_t* src, int
> count, uint8_t *iv, int decrypt)
> > +{
> > +int i;
> > +while (count--) {
> > +if (decrypt){
>
> Missing space between ) and {.
>
> > +decipher(cs, dst, src, iv);
> > +} else {
>
> The indentation of this else branch is wrong.
>
> > +if (iv) {
> > +for (i = 0; i < 8; i++)
> > +dst[i] = src[i] ^ iv[i];
> > +encipher(cs, dst, dst);
>
> Again, you are not saving the IV for the next block here.
>
> > +} else {
> > +encipher(cs, dst, src);
> > +}
> > +}
> > +src = src + 8;
> > +dst = dst + 8;
> > +}
> > +}
> >  void av_cast5_crypt(AVCAST5* cs, uint8_t* dst, const uint8_t* src, int
> count, int decrypt)
> >  {
> >  while (count--) {
> >  if (decrypt){
> > -decipher(cs, dst, src);
> > +decipher(cs, dst, src, NULL);
> >  } else {
> >  encipher(cs, dst, src);
> >  }
> > @@ -504,6 +528,7 @@ int main(int argc, char** argv)
> >  {0xee, 0xa9, 0xd0, 0xa2, 0x49, 0xfd, 0x3b, 0xa6, 0xb3, 0x43,
> 0x6f, 0xb8, 0x9d, 0x6d, 0xca, 0x92},
> >  {0xb2, 0xc9, 0x5e, 0xb0, 0x0c, 0x31, 0xad, 0x71, 0x80, 0xac,
> 0x05, 0xb8, 0xe8, 0x3d, 0x69, 0x6e}
> >  };
> > +uint8_t iv[8] = {0xee, 0xa9, 0xd0, 0xa2, 0x49, 0xfd, 0x3b, 0xa6};
> >  static uint8_t rpt2[2][16];
> >  int i, j, err = 0;
> >  static int key_bits[3] = {128, 80, 40};
> > @@ -547,6 +572,17 @@ int main(int argc, char** argv)
> >  }
> >  }
> >  }
> > +for (j = 0; j < 3; j++) {
> > +av_cast5_init(cs, Key[j], key_bits[j]);
> > +av_cast5_crypt2(cs, temp, rpt, 1, iv, 0);
> > +av_cast5_crypt2(cs, temp, temp, 1, iv, 1);
> > +for (i =0; i < 8; i++) {
>
> Missing space after =.
>
> > +if (rpt[i] != temp[i]) {
> > +av_log(NULL, AV_LOG_ERROR, "%d %02x %02x\n", i, rpt[i],
> temp[i]);
> > +err = 1;
> > +}
> > +}
> > +}
>
> I see at least 2 problems with this for loop:
>
> 1) you need to use the same IV to encrypt and decrypt the block. It
> seems to work here because you forgot to propagate the IV correctly in
> av_cast5_crypt2, otherwise after the encryption the IV would change,
> and so you would be using a different IV for the decryption.
> 2) to correctly test CBC mode we need to work on 2 blocks at least.
>
> >  av_free(cs);
> >  return err;
> >  }
> > diff --git a/libavutil/cast5.h b/libavutil/cast5.h
> > index 913d048..4a86743 100644
> > --- a/libavutil/cast5.h
> > +++ b/libavutil/cast5.h
> > @@ -52,7 +52,7 @@ struct AVCAST5 *av_cast5_alloc(void);
> >  int av_cast5_init(struct AVCAST5 *ctx, const uint8_t *key, int
> key_bits);
> >
> >  /**
> > -  * Encrypt or decrypt a buffer using a previously initialized context
> > +  * Encrypt or decrypt a buffer using a previously initialized context,
> ECB mode only
> >*
> >* @param ctx an AVCAST5 context
> >* @param dst destination array, can be equal to src
> > @@ -61,6 +61,18 @@ int av_cast5_init(struct AVCAST5 *ctx, const uint8_t
> *key, int key_bits);
> >* @param decrypt 0 for encryption, 

Re: [FFmpeg-devel] SCTE-35 development

2014-12-18 Thread Michael Niedermayer
On Wed, Dec 17, 2014 at 11:53:10PM +0530, Anshul wrote:
> Hi
> 
> I was doing development of scte-35  message cue in ffmpeg.
> 
> I have attached a draft patch.
> 
> I would like to have some comments of this community.
> -Anshul

>  libavcodec/Makefile |2 ++
>  libavcodec/allcodecs.c  |2 ++
>  libavcodec/avcodec.h|1 +
>  libavcodec/codec_desc.c |6 ++
>  libavformat/mpegts.c|   40 +---
>  5 files changed, 44 insertions(+), 7 deletions(-)
> 4b584484a54a78c130c4bbaa48c38551b3ca75fb  
> 0001-trying-muxing-demuxing-of-scte_35-message-cue.patch
> From 2ff4edfdeae131df72ea19005eb6ad85d5332f7c Mon Sep 17 00:00:00 2001
> From: Anshul Maheshwari 
> Date: Wed, 17 Dec 2014 22:13:10 +0530
> Subject: [PATCH] trying muxing demuxing of scte_35 message cue
> 
> ---
>  libavcodec/Makefile |  2 ++
>  libavcodec/allcodecs.c  |  2 ++
>  libavcodec/avcodec.h|  1 +
>  libavcodec/codec_desc.c |  6 ++
>  libavformat/mpegts.c| 40 +---
>  5 files changed, 44 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index b35a796..9d2a49f 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -408,6 +408,7 @@ OBJS-$(CONFIG_SAMI_DECODER)+= samidec.o ass.o
>  OBJS-$(CONFIG_S302M_DECODER)   += s302m.o
>  OBJS-$(CONFIG_S302M_ENCODER)   += s302menc.o
>  OBJS-$(CONFIG_SANM_DECODER)+= sanm.o
> +OBJS-$(CONFIG_SCTE_35_DECODER) += scte_35.o

this patch doesnt contain a scte_35.c
did you forget git add ?

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- 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] libavfilter: unsharpen opencl filter optimizations

2014-12-18 Thread Michael Niedermayer
On Thu, Dec 18, 2014 at 12:14:52AM +, Titov, Alexey wrote:
> Hi, here is a patch for optimized OpenCL implementation for 
> libavfilter/unsharpen filter.
> This implementation leverages hardware acceleration where possible.

patch corrupted

try attaching the patch if you dont know what caused this

Applying: libavfilter: unsharpen opencl filter optimizations
fatal: corrupt patch at line 29
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 libavfilter: unsharpen opencl filter optimizations

[...]

-- 
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] ffmpeg nvenc

2014-12-18 Thread Michael Niedermayer
On Thu, Dec 18, 2014 at 01:35:05PM +0800, ahu wrote:
[...]
>  configure|   11 
>  doc/examples/Makefile|1 
>  doc/examples/libnvenc.c  |  198 +
>  ffmpeg.c |2 
>  libavcodec/Makefile  |1 
>  libavcodec/allcodecs.c   |1 
>  libavcodec/libnvenc.c|  413 
>  libavcodec/libnvenc.h|  142 +++
>  libavcodec/nvencoder.c   |  864 
> +++
>  libavcodec/nvencoder.h   |   98 
>  libavcodec/nvencoder_utils.c |  345 +
>  libavcodec/nvencoder_utils.h |   30 +
>  libavformat/matroskaenc.c|2 
>  libavformat/movenc.c |6 
>  14 files changed, 2109 insertions(+), 5 deletions(-)
> 02de15b36b3a5f675e720ebac609d82831ef2d58  0001-add-libnvenc-support.patch
> From 98dbd7bd1894dc438b8fe909373d6ec2f4ddb6f3 Mon Sep 17 00:00:00 2001
> From: agathah 
> Date: Thu, 18 Dec 2014 12:01:15 +0800
> Subject: [PATCH] add libnvenc support
> 
> ---
>  configure|  11 +
>  doc/examples/Makefile|   1 +
>  doc/examples/libnvenc.c  | 198 ++
>  ffmpeg.c |   2 +-
>  libavcodec/Makefile  |   1 +
>  libavcodec/allcodecs.c   |   1 +
>  libavcodec/libnvenc.c| 413 +
>  libavcodec/libnvenc.h| 142 +++
>  libavcodec/nvencoder.c   | 864 
> +++
>  libavcodec/nvencoder.h   |  98 +
>  libavcodec/nvencoder_utils.c | 345 +
>  libavcodec/nvencoder_utils.h |  30 ++
>  libavformat/matroskaenc.c|   2 +-
>  libavformat/movenc.c |   6 +-
>  14 files changed, 2109 insertions(+), 5 deletions(-)
>  create mode 100644 doc/examples/libnvenc.c
>  create mode 100644 libavcodec/libnvenc.c
>  create mode 100644 libavcodec/libnvenc.h
>  create mode 100644 libavcodec/nvencoder.c
>  create mode 100644 libavcodec/nvencoder.h
>  create mode 100644 libavcodec/nvencoder_utils.c
>  create mode 100644 libavcodec/nvencoder_utils.h
> 
> diff --git a/configure b/configure
> index 3328026..798db4c 100644
> --- a/configure
> +++ b/configure
> @@ -264,6 +264,7 @@ External library support:
>--disable-lzma   disable lzma [autodetect]
>--enable-decklinkenable Blackmagick DeckLink I/O support [no]
>--enable-nvenc   enable NVIDIA NVENC support [no]
> +  --enable-libnvenc enable NVIDIA NVENC support [no]

tabs are forbidden in ffmpeg git except makefiles


[...]
> +int main(int argc, char* argv[])
> +{
> +char* inputfile   = NULL;
> +char* preset  = "default";
> +bool  zerolatency = false;
> +

> +for(int i = 1; i < argc; i++) {

the int i should be outside the for() for slightly improved
compiler compatibility


[...]
> +enc_ctx->time_base.den = dec_ctx->time_base.den/2;   
> +enc_ctx->bit_rate   = bitrate;
> +enc_ctx->flags|= (oc->oformat->flags & AVFMT_GLOBALHEADER) ? 
> CODEC_FLAG_GLOBAL_HEADER : 0;
> +av_opt_set(enc_ctx->priv_data, "preset", preset, 0);  // "fast" = HP, 
> "slow" = HQ, default = LOW_LATENCY_DEFAULT
> +if(zerolatency) {
> +//use LOW_LATENCY preset
> +av_opt_set(enc_ctx->priv_data, "tune", "zerolatency", 0);
> +}
> +
> +ret = avcodec_open2(enc_ctx, enc, NULL);
> +if (ret < 0) {
> +printf("could not open codec\n");
> +return -1;
> +}
> +ret = avformat_write_header(oc, NULL);
> +
> +AVPacket dec_pkt;
> +av_init_packet(&dec_pkt);

> +dec_pkt.data = NULL;
> +dec_pkt.size = 0;
> +
> +AVFrame *frame = avcodec_alloc_frame();
> +int got_frame = 0;

mixed declarations and statements


> +while(av_read_frame(fmt_ctx, &dec_pkt) >= 0) {  
> +if(dec_pkt.stream_index == video_stream_idx) {
> +if(avcodec_decode_video2(dec_ctx, frame, &got_frame, &dec_pkt) < 
> 0) {
> +printf("Error decoding frames!\n");
> +return -1;
> +}
> +if(got_frame) {
> +AVPacket enc_pkt;
> +int got_pkt = 0;
> +av_init_packet(&enc_pkt);
> +enc_pkt.data = NULL;
> +enc_pkt.size = 0;   
> +if(avcodec_encode_video2(vst_enc->codec, &enc_pkt, frame, 
> &got_pkt) < 0) {
> +printf("Error encoding frames!\n");
> +return -1;
> +}
> +
> +if(got_pkt) {
> +av_write_frame(oc, &enc_pkt);
> +}
> +
> +av_free_packet(&enc_pkt);  
> +}
> +}
> +av_free_packet(&dec_pkt); 
> +}
> +avcodec_free_frame(&frame);
> +av_write_trailer(oc);
> +
> +avcodec_close(dec_ctx);
> +avcodec_close(enc_ctx);
> +avformat_close_input(&fmt_ctx);
> +
> +return 0;

> +}
> \ No newline at end of file

git sa

Re: [FFmpeg-devel] [PATCH] libavfilter: unsharpen opencl filter optimizations

2014-12-18 Thread Wei Gao
2014-12-18 8:14 GMT+08:00 Titov, Alexey :
>
> Hi, here is a patch for optimized OpenCL implementation for
> libavfilter/unsharpen filter.
> This implementation leverages hardware acceleration where possible.
>
> Regards,
> Alexey
>
> ---
> libavfilter/unsharp.h   |   4 ++
> libavfilter/unsharp_opencl.c|  76 +++---
> libavfilter/unsharp_opencl_kernel.h | 122
> ++--
> libavutil/opencl.c  |  19 +-
> 4 files changed, 165 insertions(+), 56 deletions(-)
>
> diff --git a/libavfilter/unsharp.h b/libavfilter/unsharp.h
> index c2aed64..fc651c0 100644
> --- a/libavfilter/unsharp.h
> +++ b/libavfilter/unsharp.h
> @@ -41,6 +41,10 @@ typedef struct {
>  cl_kernel kernel_chroma;
>  cl_mem cl_luma_mask;
>  cl_mem cl_chroma_mask;
> +cl_mem cl_luma_mask_x;
> +cl_mem cl_chroma_mask_x;
> +cl_mem cl_luma_mask_y;
> +cl_mem cl_chroma_mask_y;
>  int in_plane_size[8];
>  int out_plane_size[8];
>  int plane_num;
> diff --git a/libavfilter/unsharp_opencl.c b/libavfilter/unsharp_opencl.c
> index 5c6b5ef..a99fc5b 100644
> --- a/libavfilter/unsharp_opencl.c
> +++ b/libavfilter/unsharp_opencl.c
> @@ -87,42 +87,36 @@ end:
>  return ret;
> }
> -static int compute_mask_matrix(cl_mem cl_mask_matrix, int step_x, int
> step_y)
> +static int copy_separable_masks(cl_mem cl_mask_x, cl_mem cl_mask_y, int
> step_x, int step_y)
> {
> -int i, j, ret = 0;
> -uint32_t *mask_matrix, *mask_x, *mask_y;
> -size_t size_matrix = sizeof(uint32_t) * (2 * step_x + 1) * (2 *
> step_y + 1);
> -mask_x = av_mallocz_array(2 * step_x + 1, sizeof(uint32_t));
> +int ret = 0;
> +uint32_t *mask_x, *mask_y;
> +size_t size_mask_x = sizeof(uint32_t) * (2 * step_x + 1);
> +size_t size_mask_y = sizeof(uint32_t) * (2 * step_y + 1);
> +mask_x = av_mallocz_array(size_mask_x);
>  if (!mask_x) {
>  ret = AVERROR(ENOMEM);
>  goto end;
>  }
> -mask_y = av_mallocz_array(2 * step_y + 1, sizeof(uint32_t));
> +mask_y = av_mallocz_array(size_mask_y);
>  if (!mask_y) {
>  ret = AVERROR(ENOMEM);
>  goto end;
>  }
> -mask_matrix = av_mallocz(size_matrix);
> -if (!mask_matrix) {
> -ret = AVERROR(ENOMEM);
> -goto end;
> -}
> +
>  ret = compute_mask(step_x, mask_x);
>  if (ret < 0)
>  goto end;
>  ret = compute_mask(step_y, mask_y);
>  if (ret < 0)
>  goto end;
> -for (j = 0; j < 2 * step_y + 1; j++) {
> -for (i = 0; i < 2 * step_x + 1; i++) {
> -mask_matrix[i + j * (2 * step_x + 1)] = mask_y[j] * mask_x[i];
> -}
> -}
> -ret = av_opencl_buffer_write(cl_mask_matrix, (uint8_t *)mask_matrix,
> size_matrix);
> +
> +ret = av_opencl_buffer_write(cl_mask_x, (uint8_t *)mask_x,
> size_mask_x);
> +ret = av_opencl_buffer_write(cl_mask_y, (uint8_t *)mask_y,
> size_mask_y);
> end:
>  av_freep(&mask_x);
>  av_freep(&mask_y);
> -av_freep(&mask_matrix);
> +
>  return ret;
> }
> @@ -133,6 +127,11 @@ static int generate_mask(AVFilterContext *ctx)
>  cl_mem mask_matrix[2];
>  mask_matrix[0] = unsharp->opencl_ctx.cl_luma_mask;
>  mask_matrix[1] = unsharp->opencl_ctx.cl_chroma_mask;
> +cl_mem masks[4];
> +masks[0] = unsharp->opencl_ctx.cl_luma_mask_x;
> +masks[1] = unsharp->opencl_ctx.cl_luma_mask_y;
> +masks[2] = unsharp->opencl_ctx.cl_chroma_mask_x;
> +masks[3] = unsharp->opencl_ctx.cl_chroma_mask_y;
>  step_x[0] = unsharp->luma.steps_x;
>  step_x[1] = unsharp->chroma.steps_x;
>  step_y[0] = unsharp->luma.steps_y;
> @@ -144,12 +143,16 @@ static int generate_mask(AVFilterContext *ctx)
>  else
> unsharp->opencl_ctx.use_fast_kernels = 1;
> +if (!masks[0] || !masks[1] || !masks[2] || !masks[3]) {
> +av_log(ctx, AV_LOG_ERROR, "Luma mask and chroma mask should not
> be NULL\n");
> +return AVERROR(EINVAL);
> +}
>  if (!mask_matrix[0] || !mask_matrix[1]) {
>  av_log(ctx, AV_LOG_ERROR, "Luma mask and chroma mask should not
> be NULL\n");
>  return AVERROR(EINVAL);
>  }
>  for (i = 0; i < 2; i++) {
> -ret = compute_mask_matrix(mask_matrix[i], step_x[i], step_y[i]);
> +ret = copy_separable_masks(masks[2*i], masks[2*i+1], step_x[i],
> step_y[i]);
>  if (ret < 0)
>  return ret;
>  }
> @@ -184,7 +187,8 @@ int ff_opencl_apply_unsharp(AVFilterContext *ctx,
> AVFrame *in, AVFrame *out)
>  ret = avpriv_opencl_set_parameter(&kernel1,
>
>  FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_inbuf),
>
>  FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_outbuf),
> -
> FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_luma_mask),
> +
> FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_luma_mask_x),
> +
> FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_luma_mask_y),
>
>  FF_OPENCL_PARAM_INFO(unsharp->luma.amount),
>
>  FF_OPENCL_PARAM_INFO(unsharp->luma.scalebits),
>
>

[FFmpeg-devel] [PATCH] wavdec: refactor wav_read_header() to make it more readable and display an error message in case an invalid header is detected (the current version just returns AVERROR_INVALIDD

2014-12-18 Thread Thomas Volkert
From: Thomas Volkert 

---
 libavformat/wavdec.c | 32 ++--
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 8a7f84b..8651372 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -248,7 +248,7 @@ static int wav_read_header(AVFormatContext *s)
 {
 int64_t size, av_uninit(data_size);
 int64_t sample_count = 0;
-int rf64;
+int rf64 = 0;
 uint32_t tag;
 AVIOContext *pb  = s->pb;
 AVStream *st = NULL;
@@ -260,17 +260,29 @@ static int wav_read_header(AVFormatContext *s)
 
 wav->smv_data_ofs = -1;
 
-/* check RIFF header */
-tag = avio_rl32(pb);
-
-rf64 = tag == MKTAG('R', 'F', '6', '4');
-wav->rifx = tag == MKTAG('R', 'I', 'F', 'X');
-if (!rf64 && !wav->rifx && tag != MKTAG('R', 'I', 'F', 'F'))
+/* read chunk ID */
+switch (avio_rl32(pb)) {
+case MKTAG('R', 'I', 'F', 'F'):
+break;
+case MKTAG('R', 'I', 'F', 'X'):
+wav->rifx = 1;
+break;
+case MKTAG('R', 'F', '6', '4'):
+rf64 = 1;
+break;
+default:
+av_log(s, AV_LOG_ERROR, "invalid start code in RIFF header\n");
 return AVERROR_INVALIDDATA;
-avio_rl32(pb); /* file size */
-tag = avio_rl32(pb);
-if (tag != MKTAG('W', 'A', 'V', 'E'))
+}
+
+/* read chunk size */
+avio_rl32(pb);
+
+/* read format */
+if (avio_rl32(pb) != MKTAG('W', 'A', 'V', 'E')) {
+av_log(s, AV_LOG_ERROR, "invalid format in RIFF header\n");
 return AVERROR_INVALIDDATA;
+}
 
 if (rf64) {
 if (avio_rl32(pb) != MKTAG('d', 's', '6', '4'))
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH] libavfilter: unsharpen opencl filter optimizations

2014-12-18 Thread Wei Gao
2014-12-18 8:14 GMT+08:00 Titov, Alexey :
>
> Hi, here is a patch for optimized OpenCL implementation for
> libavfilter/unsharpen filter.
> This implementation leverages hardware acceleration where possible.
>
> Regards,
> Alexey
>
> ---
> libavfilter/unsharp.h   |   4 ++
> libavfilter/unsharp_opencl.c|  76 +++---
> libavfilter/unsharp_opencl_kernel.h | 122
> ++--
> libavutil/opencl.c  |  19 +-
> 4 files changed, 165 insertions(+), 56 deletions(-)
>
> diff --git a/libavfilter/unsharp.h b/libavfilter/unsharp.h
> index c2aed64..fc651c0 100644
> --- a/libavfilter/unsharp.h
> +++ b/libavfilter/unsharp.h
> @@ -41,6 +41,10 @@ typedef struct {
>  cl_kernel kernel_chroma;
>  cl_mem cl_luma_mask;
>  cl_mem cl_chroma_mask;
> +cl_mem cl_luma_mask_x;
> +cl_mem cl_chroma_mask_x;
> +cl_mem cl_luma_mask_y;
> +cl_mem cl_chroma_mask_y;
>  int in_plane_size[8];
>  int out_plane_size[8];
>  int plane_num;
> diff --git a/libavfilter/unsharp_opencl.c b/libavfilter/unsharp_opencl.c
> index 5c6b5ef..a99fc5b 100644
> --- a/libavfilter/unsharp_opencl.c
> +++ b/libavfilter/unsharp_opencl.c
> @@ -87,42 +87,36 @@ end:
>  return ret;
> }
> -static int compute_mask_matrix(cl_mem cl_mask_matrix, int step_x, int
> step_y)
> +static int copy_separable_masks(cl_mem cl_mask_x, cl_mem cl_mask_y, int
> step_x, int step_y)
> {
> -int i, j, ret = 0;
> -uint32_t *mask_matrix, *mask_x, *mask_y;
> -size_t size_matrix = sizeof(uint32_t) * (2 * step_x + 1) * (2 *
> step_y + 1);
> -mask_x = av_mallocz_array(2 * step_x + 1, sizeof(uint32_t));
> +int ret = 0;
> +uint32_t *mask_x, *mask_y;
> +size_t size_mask_x = sizeof(uint32_t) * (2 * step_x + 1);
> +size_t size_mask_y = sizeof(uint32_t) * (2 * step_y + 1);
> +mask_x = av_mallocz_array(size_mask_x);
>  if (!mask_x) {
>  ret = AVERROR(ENOMEM);
>  goto end;
>  }
> -mask_y = av_mallocz_array(2 * step_y + 1, sizeof(uint32_t));
> +mask_y = av_mallocz_array(size_mask_y);
>  if (!mask_y) {
>  ret = AVERROR(ENOMEM);
>  goto end;
>  }
> -mask_matrix = av_mallocz(size_matrix);
> -if (!mask_matrix) {
> -ret = AVERROR(ENOMEM);
> -goto end;
> -}
> +
>  ret = compute_mask(step_x, mask_x);
>  if (ret < 0)
>  goto end;
>  ret = compute_mask(step_y, mask_y);
>  if (ret < 0)
>  goto end;
> -for (j = 0; j < 2 * step_y + 1; j++) {
> -for (i = 0; i < 2 * step_x + 1; i++) {
> -mask_matrix[i + j * (2 * step_x + 1)] = mask_y[j] * mask_x[i];
> -}
> -}
> -ret = av_opencl_buffer_write(cl_mask_matrix, (uint8_t *)mask_matrix,
> size_matrix);
> +
> +ret = av_opencl_buffer_write(cl_mask_x, (uint8_t *)mask_x,
> size_mask_x);
> +ret = av_opencl_buffer_write(cl_mask_y, (uint8_t *)mask_y,
> size_mask_y);
> end:
>  av_freep(&mask_x);
>  av_freep(&mask_y);
> -av_freep(&mask_matrix);
> +
>  return ret;
> }
> @@ -133,6 +127,11 @@ static int generate_mask(AVFilterContext *ctx)
>  cl_mem mask_matrix[2];
>  mask_matrix[0] = unsharp->opencl_ctx.cl_luma_mask;
>  mask_matrix[1] = unsharp->opencl_ctx.cl_chroma_mask;
> +cl_mem masks[4];
> +masks[0] = unsharp->opencl_ctx.cl_luma_mask_x;
> +masks[1] = unsharp->opencl_ctx.cl_luma_mask_y;
> +masks[2] = unsharp->opencl_ctx.cl_chroma_mask_x;
> +masks[3] = unsharp->opencl_ctx.cl_chroma_mask_y;
>  step_x[0] = unsharp->luma.steps_x;
>  step_x[1] = unsharp->chroma.steps_x;
>  step_y[0] = unsharp->luma.steps_y;
> @@ -144,12 +143,16 @@ static int generate_mask(AVFilterContext *ctx)
>  else
> unsharp->opencl_ctx.use_fast_kernels = 1;
> +if (!masks[0] || !masks[1] || !masks[2] || !masks[3]) {
> +av_log(ctx, AV_LOG_ERROR, "Luma mask and chroma mask should not
> be NULL\n");
> +return AVERROR(EINVAL);
> +}
>  if (!mask_matrix[0] || !mask_matrix[1]) {
>  av_log(ctx, AV_LOG_ERROR, "Luma mask and chroma mask should not
> be NULL\n");
>  return AVERROR(EINVAL);
>  }
>  for (i = 0; i < 2; i++) {
> -ret = compute_mask_matrix(mask_matrix[i], step_x[i], step_y[i]);
> +ret = copy_separable_masks(masks[2*i], masks[2*i+1], step_x[i],
> step_y[i]);
>  if (ret < 0)
>  return ret;
>  }
> @@ -184,7 +187,8 @@ int ff_opencl_apply_unsharp(AVFilterContext *ctx,
> AVFrame *in, AVFrame *out)
>  ret = avpriv_opencl_set_parameter(&kernel1,
>
>  FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_inbuf),
>
>  FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_outbuf),
> -
> FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_luma_mask),
> +
> FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_luma_mask_x),
> +
> FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_luma_mask_y),
>
>  FF_OPENCL_PARAM_INFO(unsharp->luma.amount),
>
>  FF_OPENCL_PARAM_INFO(unsharp->luma.scalebits),
>
>

Re: [FFmpeg-devel] [PATCH] wavdec: refactor wav_read_header() to make it more readable and display an error message in case an invalid header is detected (the current version just returns AVERROR_INVA

2014-12-18 Thread wm4
On Thu, 18 Dec 2014 12:50:25 +0100
Thomas Volkert  wrote:

> From: Thomas Volkert 
> 

The commit message subject line should be at most 72 (or was it 60?)
characters long. The rest should go into the body of the commit message
(in raw git, the first line of the commit message is the subject, then
comes an empty line, and the rest is the body of the commit message).
Makes it more readable in "git log" and other tools.

> ---
>  libavformat/wavdec.c | 32 ++--
>  1 file changed, 22 insertions(+), 10 deletions(-)
> 
> diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
> index 8a7f84b..8651372 100644
> --- a/libavformat/wavdec.c
> +++ b/libavformat/wavdec.c
> @@ -248,7 +248,7 @@ static int wav_read_header(AVFormatContext *s)
>  {
>  int64_t size, av_uninit(data_size);
>  int64_t sample_count = 0;
> -int rf64;
> +int rf64 = 0;
>  uint32_t tag;
>  AVIOContext *pb  = s->pb;
>  AVStream *st = NULL;
> @@ -260,17 +260,29 @@ static int wav_read_header(AVFormatContext *s)
>  
>  wav->smv_data_ofs = -1;
>  
> -/* check RIFF header */
> -tag = avio_rl32(pb);
> -
> -rf64 = tag == MKTAG('R', 'F', '6', '4');
> -wav->rifx = tag == MKTAG('R', 'I', 'F', 'X');
> -if (!rf64 && !wav->rifx && tag != MKTAG('R', 'I', 'F', 'F'))
> +/* read chunk ID */
> +switch (avio_rl32(pb)) {
> +case MKTAG('R', 'I', 'F', 'F'):
> +break;
> +case MKTAG('R', 'I', 'F', 'X'):
> +wav->rifx = 1;
> +break;
> +case MKTAG('R', 'F', '6', '4'):
> +rf64 = 1;
> +break;
> +default:
> +av_log(s, AV_LOG_ERROR, "invalid start code in RIFF header\n");
>  return AVERROR_INVALIDDATA;

Seems like a good idea... could it print the chunk ID too, or would
that not be interesting?

> -avio_rl32(pb); /* file size */
> -tag = avio_rl32(pb);
> -if (tag != MKTAG('W', 'A', 'V', 'E'))
> +}
> +
> +/* read chunk size */
> +avio_rl32(pb);
> +
> +/* read format */
> +if (avio_rl32(pb) != MKTAG('W', 'A', 'V', 'E')) {
> +av_log(s, AV_LOG_ERROR, "invalid format in RIFF header\n");
>  return AVERROR_INVALIDDATA;
> +}
>  
>  if (rf64) {
>  if (avio_rl32(pb) != MKTAG('d', 's', '6', '4'))

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


Re: [FFmpeg-devel] [PATCH] wavdec: refactor wav_read_header() to make it more readable and display an error message in case an invalid header is detected (the current version just returns AVERROR_INVA

2014-12-18 Thread Thomas Volkert

On 18.12.2014 14:17, wm4 wrote:


The commit message subject line should be at most 72 (or was it 60?)
characters long. The rest should go into the body of the commit message
(in raw git, the first line of the commit message is the subject, then
comes an empty line, and the rest is the body of the commit message).
Makes it more readable in "git log" and other tools.


Yes, I have seen this after the mail was already sent.
It's updated locally.



-
-rf64 = tag == MKTAG('R', 'F', '6', '4');
-wav->rifx = tag == MKTAG('R', 'I', 'F', 'X');
-if (!rf64 && !wav->rifx && tag != MKTAG('R', 'I', 'F', 'F'))
+/* read chunk ID */
+switch (avio_rl32(pb)) {
+case MKTAG('R', 'I', 'F', 'F'):
+break;
+case MKTAG('R', 'I', 'F', 'X'):
+wav->rifx = 1;
+break;
+case MKTAG('R', 'F', '6', '4'):
+rf64 = 1;
+break;
+default:
+av_log(s, AV_LOG_ERROR, "invalid start code in RIFF header\n");
  return AVERROR_INVALIDDATA;
Seems like a good idea... could it print the chunk ID too, or would
that not be interesting?


We could print these 4 bytes as string to give a hint which format the 
given input file has!?


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


Re: [FFmpeg-devel] [PATCH] cmdutils: dont call read_header before listing devices

2014-12-18 Thread Lukasz Marek
On 18 December 2014 at 10:41, Michael Niedermayer  wrote:
>
> On Thu, Dec 18, 2014 at 01:29:39AM +0100, Lukasz Marek wrote:
> > On 18.12.2014 01:09, Michael Niedermayer wrote:
> > >On Wed, Dec 17, 2014 at 10:59:37PM +0100, Lukasz Marek wrote:
> > >>On 15.12.2014 14:18, Michael Niedermayer wrote:
> >   cmdutils.c |8 ++--
> >   1 file changed, 6 insertions(+), 2 deletions(-)
> > 8d012a5193b0440717f89d920661913ef160e674
> 0001-cmdutils-dont-call-read_header-before-listing-device.patch
> >  From 332bb7456c498518ea72dfdaa0e8c3e76d383f21 Mon Sep 17 00:00:00
> 2001
> > From: Lukasz Marek 
> > Date: Mon, 15 Dec 2014 00:31:42 +0100
> > Subject: [PATCH] cmdutils: dont call read_header before listing
> devices
> > 
> > List device callback must be able to return valid list without
> opening device.
> > This callback should return input values for open function, not
> vice-versa.
> > Read header funtion is very likey to fail without proper
> configuration provided.
> > >>>
> > >>>should be ok
> > >>
> > >>I changed a patch. I wanted to avoid situation where .read_close is
> > >>called without .read_header being called before.
> > >>
> > >
> > >>  cmdutils.c |   41 +++--
> > >>  1 file changed, 35 insertions(+), 6 deletions(-)
> > >>9a93c401d795bae3545a6c6112e71abd98ac22ca
> 0001-cmdutils-dont-call-read_header-before-listing-device.patch
> > >> From 58fe020b8f1c0e809362e152febe3ad715b1c8fc Mon Sep 17 00:00:00 2001
> > >>From: Lukasz Marek 
> > >>Date: Mon, 15 Dec 2014 00:31:42 +0100
> > >>Subject: [PATCH] cmdutils: dont call read_header before listing devices
> > >>
> > >>List device callback must be able to return valid list without opening
> device.
> > >>This callback should return input values for open function, not
> vice-versa.
> > >>Read header funtion is very likey to fail without proper configuration
> provided.
> > >>
> > >>Signed-off-by: Lukasz Marek 
> > >>---
> > >>  cmdutils.c | 41 +++--
> > >>  1 file changed, 35 insertions(+), 6 deletions(-)
> > >>
> > >>diff --git a/cmdutils.c b/cmdutils.c
> > >>index 4e0a406..23a5f77 100644
> > >>--- a/cmdutils.c
> > >>+++ b/cmdutils.c
> > >>@@ -2052,7 +2052,37 @@ void *grow_array(void *array, int elem_size,
> int *size, int new_size)
> > >>  }
> > >>
> > >>  #if CONFIG_AVDEVICE
> > >>-static int print_device_sources(AVInputFormat *fmt, AVDictionary
> *opts)
> > >>+static int alloc_input_context(AVFormatContext **avctx, AVInputFormat
> *iformat)
> > >>+{
> > >>+AVFormatContext *s = avformat_alloc_context();
> > >>+int ret = 0;
> > >>+
> > >>+*avctx = NULL;
> > >>+if (!s)
> > >>+return AVERROR(ENOMEM);
> > >>+
> > >>+s->iformat = iformat;
> > >>+if (s->iformat->priv_data_size > 0) {
> > >>+s->priv_data = av_mallocz(s->iformat->priv_data_size);
> > >>+if (!s->priv_data) {
> > >>+ret = AVERROR(ENOMEM);
> > >>+goto error;
> > >>+}
> > >>+if (s->iformat->priv_class) {
> > >>+*(const AVClass**)s->priv_data= s->iformat->priv_class;
> > >>+av_opt_set_defaults(s->priv_data);
> > >>+}
> > >>+} else
> > >>+s->priv_data = NULL;
> > >>+
> > >>+*avctx = s;
> > >>+return 0;
> > >>+  error:
> > >>+avformat_free_context(s);
> > >>+return ret;
> > >>+}
> > >>+
> > >
> > >>+static int print_device_sources(void *pfmt, AVDictionary *opts)
> > >>  {
> > >>  int ret, i;
> > >>  AVFormatContext *dev = NULL;
> > >>@@ -2069,13 +2099,12 @@ static int print_device_sources(AVInputFormat
> *fmt, AVDictionary *opts)
> > >>  goto fail;
> > >>  }
> > >>
> > >>-/* TODO: avformat_open_input calls read_header callback which is
> not necessary.
> > >>- Function like avformat_alloc_output_context2 for input
> could be helpful here. */
> > >>-av_dict_copy(&tmp_opts, opts, 0);
> > >>-if ((ret = avformat_open_input(&dev, NULL, fmt, &tmp_opts)) < 0) {
> > >>+if ((ret = alloc_input_context(&dev, fmt)) < 0) {
> > >
> > >this fails building due to lack of a fmt variable
> >
> > I failed at cherry-pick conflict, thanks.
> > Updated patch is attached.
> >
>
> >  cmdutils.c |   39 ++-
> >  1 file changed, 34 insertions(+), 5 deletions(-)
> > 688f0a3fc7e3a81743bc4ce3cc858b880c648595
> 0001-cmdutils-dont-call-read_header-before-listing-device.patch
> > From 2b9a20f97687f11eb5d1fd72db3b25e3f2703b73 Mon Sep 17 00:00:00 2001
> > From: Lukasz Marek 
> > Date: Mon, 15 Dec 2014 00:31:42 +0100
> > Subject: [PATCH] cmdutils: dont call read_header before listing devices
> >
> > List device callback must be able to return valid list without opening
> device.
> > This callback should return input values for open function, not
> vice-versa.
> > Read header funtion is very likey to fail without proper configuration
> provided.
> >
> > Signed-off-by: Lukasz Marek 
> > ---
> >  cmdu

[FFmpeg-devel] HTML syntax errors in http://ffmpeg.org/security.html (bug 4196)

2014-12-18 Thread Ryo ONODERA
Hi,

Could you take a look at https://trac.ffmpeg.org/ticket/4196 ?
Patch is included in this e-mail too.

Thank you.

--- FFmpeg Security.html.orig   2014-12-19 01:14:53.0 +0900
+++ FFmpeg Security.html2014-12-19 01:15:58.0 +0900
@@ -72,7 +72,7 @@
 
 FFmpeg 2.5
 
-2.5
+2.5
 
 Fixes following vulnerabilities:
 
@@ -235,7 +235,6 @@
 Fixes following vulnerabilities:
 
 
-
 CVE-2014-5271, 92096acc0a04c108f0393c78592269b748170d0a / 
52b81ff4635c077b2bc8b8d3637d933b6629d803
 CVE-2014-5272, f405267493c8baf900195bf7989f371b861041f6 / 
3539d6c63a16e1b2874bb037a86f317449c58770
 CVE-2014-8541, 9ec550c364835caaa928c361d009b75f25d774a9 / 
5c378d6a6df8243f06c87962b873bd563e58cd39

--
Ryo ONODERA // ryo...@yk.rim.or.jp
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avfilter/lut: reduce dereference in the inner loop

2014-12-18 Thread Yayoi
For rgb, with a 1080p source, 69 to 74fps on core i5(2 core, 1.8GHz),
and 136 to 160 fps on an core i7(4770R, 3.2Ghz)
Changed the yuv code for consistency, even though the performance
increase is not as obvious as rgb
---
 libavfilter/vf_lut.c | 29 ++---
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c
index 0b7a2ca..e262c6e 100644
--- a/libavfilter/vf_lut.c
+++ b/libavfilter/vf_lut.c
@@ -299,26 +299,31 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 
 if (s->is_rgb) {
 /* packed */
+const int w = inlink->w;
+const int h = in->height;
+const uint8_t (*tab)[256] = (const uint8_t (*)[256])s->lut;
+const int in_linesize  =  in->linesize[0];
+const int out_linesize = out->linesize[0];
+const int step = s->step;
+
 inrow0  = in ->data[0];
 outrow0 = out->data[0];
 
-for (i = 0; i < in->height; i ++) {
-int w = inlink->w;
-const uint8_t (*tab)[256] = (const uint8_t (*)[256])s->lut;
+for (i = 0; i < h; i ++) {
 inrow  = inrow0;
 outrow = outrow0;
 for (j = 0; j < w; j++) {
-switch (s->step) {
+switch (step) {
 case 4:  outrow[3] = tab[3][inrow[3]]; // Fall-through
 case 3:  outrow[2] = tab[2][inrow[2]]; // Fall-through
 case 2:  outrow[1] = tab[1][inrow[1]]; // Fall-through
 default: outrow[0] = tab[0][inrow[0]];
 }
-outrow += s->step;
-inrow  += s->step;
+outrow += step;
+inrow  += step;
 }
-inrow0  += in ->linesize[0];
-outrow0 += out->linesize[0];
+inrow0  += in_linesize;
+outrow0 += out_linesize;
 }
 } else {
 /* planar */
@@ -327,16 +332,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 int hsub = plane == 1 || plane == 2 ? s->hsub : 0;
 int h = FF_CEIL_RSHIFT(inlink->h, vsub);
 int w = FF_CEIL_RSHIFT(inlink->w, hsub);
+const uint8_t *tab = s->lut[plane];
+const int in_linesize  =  in->linesize[plane];
+const int out_linesize = out->linesize[plane];
 
 inrow  = in ->data[plane];
 outrow = out->data[plane];
 
 for (i = 0; i < h; i++) {
-const uint8_t *tab = s->lut[plane];
 for (j = 0; j < w; j++)
 outrow[j] = tab[inrow[j]];
-inrow  += in ->linesize[plane];
-outrow += out->linesize[plane];
+inrow  += in_linesize;
+outrow += out_linesize;
 }
 }
 }
-- 
1.8.3.4 (Apple Git-47)

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


Re: [FFmpeg-devel] HTML syntax errors in http://ffmpeg.org/security.html (bug 4196)

2014-12-18 Thread Michael Niedermayer
On Fri, Dec 19, 2014 at 02:10:55AM +0900, Ryo ONODERA wrote:
> Hi,
> 
> Could you take a look at https://trac.ffmpeg.org/ticket/4196 ?
> Patch is included in this e-mail too.
> 
> Thank you.

applied

thanks

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

I have often repented speaking, but never of holding my tongue.
-- Xenocrates


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/lut: reduce dereference in the inner loop

2014-12-18 Thread Michael Niedermayer
On Thu, Dec 18, 2014 at 12:08:54AM -0800, Yayoi wrote:
> For rgb, with a 1080p source, 69 to 74fps on core i5(2 core, 1.8GHz),
> and 136 to 160 fps on an core i7(4770R, 3.2Ghz)
> Changed the yuv code for consistency, even though the performance
> increase is not as obvious as rgb
> ---
>  libavfilter/vf_lut.c | 29 ++---
>  1 file changed, 18 insertions(+), 11 deletions(-)

applied

thanks

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

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu


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


Re: [FFmpeg-devel] libavutil: Added cbc mode to cast5.c

2014-12-18 Thread Giorgio Vazzana
2014-12-18 11:09 GMT+01:00 supraja reddy :
> Sorry for the mistake . I seem to have got cbc completely wrong.
> I have made the changes . Please let me know if there is anything missing.

> From 0bf794bc43ed7055f83bcd07cb5c1e2f4445e813 Mon Sep 17 00:00:00 2001
> From: Supraja Meedinti 
> Date: Thu, 18 Dec 2014 15:26:32 +0530
> Subject: [PATCH] libavutil: Added cbc mode to cast128
>
> Signed-off-by: Supraja Meedinti 
> ---
>  libavutil/cast5.c | 44 ++--
>  libavutil/cast5.h | 14 +-
>  2 files changed, 55 insertions(+), 3 deletions(-)
>
> diff --git a/libavutil/cast5.c b/libavutil/cast5.c
> index 14dd701..e338037 100644
> --- a/libavutil/cast5.c
> +++ b/libavutil/cast5.c
> @@ -416,7 +416,7 @@ static void encipher(AVCAST5* cs, uint8_t* dst, const 
> uint8_t* src)
>  AV_WB32(dst + 4, l);
>  }
>
> -static void decipher(AVCAST5* cs, uint8_t* dst, const uint8_t* src)
> +static void decipher(AVCAST5* cs, uint8_t* dst, const uint8_t* src, uint8_t 
> *iv)
>  {
>  uint32_t f, I, r, l;
>  l = AV_RB32(src);
> @@ -439,6 +439,11 @@ static void decipher(AVCAST5* cs, uint8_t* dst, const 
> uint8_t* src)
>  F3(r, l, 3);
>  F2(l, r, 2);
>  F1(r, l, 1);
> +if (iv) {
> +r ^= AV_RB32(iv);
> +l ^= AV_RB32(iv + 4);
> +memcpy(iv, src, 8);
> +}
>  AV_WB32(dst, r);
>  AV_WB32(dst + 4, l);
>  }
> @@ -468,11 +473,31 @@ av_cold int av_cast5_init(AVCAST5* cs, const uint8_t 
> *key, int key_bits)
>  return 0;
>  }
>
> +void av_cast5_crypt2(AVCAST5* cs, uint8_t* dst, const uint8_t* src, int 
> count, uint8_t *iv, int decrypt)
> +{
> +int i;
> +while (count--) {
> +if (decrypt) {
> +decipher(cs, dst, src, iv);
> +} else {
> +if (iv) {
> +for (i = 0; i < 8; i++)
> +dst[i] = src[i] ^ iv[i];
> +encipher(cs, dst, dst);
> +memcpy(iv, dst, 8);
> +} else {
> +encipher(cs, dst, src);
> +}
> +}
> +src = src + 8;
> +dst = dst + 8;
> +}
> +}
>  void av_cast5_crypt(AVCAST5* cs, uint8_t* dst, const uint8_t* src, int 
> count, int decrypt)
>  {
>  while (count--) {
>  if (decrypt){
> -decipher(cs, dst, src);
> +decipher(cs, dst, src, NULL);
>  } else {
>  encipher(cs, dst, src);
>  }
> @@ -504,6 +529,7 @@ int main(int argc, char** argv)
>  {0xee, 0xa9, 0xd0, 0xa2, 0x49, 0xfd, 0x3b, 0xa6, 0xb3, 0x43, 0x6f, 
> 0xb8, 0x9d, 0x6d, 0xca, 0x92},
>  {0xb2, 0xc9, 0x5e, 0xb0, 0x0c, 0x31, 0xad, 0x71, 0x80, 0xac, 0x05, 
> 0xb8, 0xe8, 0x3d, 0x69, 0x6e}
>  };
> +static uint8_t temp2[8] = {0xee, 0xa9, 0xd0, 0xa2, 0x49, 0xfd, 0x3b, 
> 0xa6};

I would call this variable iv instead of temp2, so: const uint8_t iv[2] = ...

(for another patch: we can probably remove the keyword 'static' from
all variables in main, and make key_bits const)

>  static uint8_t rpt2[2][16];
>  int i, j, err = 0;
>  static int key_bits[3] = {128, 80, 40};
> @@ -547,6 +573,20 @@ int main(int argc, char** argv)
>  }
>  }
>  }
> +for (j = 0; j < 3; j++) {
> +
> +av_cast5_init(cs, Key[j], key_bits[j]);
> +memcpy(temp, temp2, 8);
> +av_cast5_crypt2(cs, rpt2[0], rct2[0], 2, temp, 0);
> +memcpy(temp, temp2, 8);
> +av_cast5_crypt2(cs, rpt2[0], rpt2[0], 2, temp, 1);
> +for (i =0; i < 16; i++) {

Missing space between = and 0.

> +if (rct2[0][i] != rpt2[0][i]) {
> +av_log(NULL, AV_LOG_ERROR, "%d %02x %02x\n", i, rct2[0][i], 
> rpt2[0][i]);
> +err = 1;
> +}
> +}
> +}
>  av_free(cs);
>  return err;
>  }
> diff --git a/libavutil/cast5.h b/libavutil/cast5.h
> index 913d048..e5cc8b1 100644
> --- a/libavutil/cast5.h
> +++ b/libavutil/cast5.h
> @@ -52,7 +52,7 @@ struct AVCAST5 *av_cast5_alloc(void);
>  int av_cast5_init(struct AVCAST5 *ctx, const uint8_t *key, int key_bits);
>
>  /**
> -  * Encrypt or decrypt a buffer using a previously initialized context
> +  * Encrypt or decrypt a buffer using a previously initialized context, ECB 
> mode only
>*
>* @param ctx an AVCAST5 context
>* @param dst destination array, can be equal to src
> @@ -61,6 +61,18 @@ int av_cast5_init(struct AVCAST5 *ctx, const uint8_t *key, 
> int key_bits);
>* @param decrypt 0 for encryption, 1 for decryption
>   */
>  void av_cast5_crypt(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, 
> int count, int decrypt);
> +
> +/**
> +  * Encrypt or decrypt a buffer using a previously initialized context
> +  *
> +  * @param ctx an AVCAST5 context
> +  * @param dst destination array, can be equal to src
> +  * @param src source array, can be equal to dst
> +  * @param count number of 8 byte blocks
> +  * @param iv initialization vector for CBC mode, NULL for ECB mode
> +  * @par

Re: [FFmpeg-devel] [PATCH] lavfi: Port fspp to FFmpeg

2014-12-18 Thread Michael Niedermayer
On Thu, Dec 18, 2014 at 01:57:27PM +0530, arwa arif wrote:
> >
> >
> > > --- a/libavfilter/allfilters.c
> > > +++ b/libavfilter/allfilters.c
> > > @@ -141,6 +141,7 @@ void avfilter_register_all(void)
> > >  REGISTER_FILTER(FRAMEPACK,  framepack,  vf);
> > >  REGISTER_FILTER(FRAMESTEP,  framestep,  vf);
> > >  REGISTER_FILTER(FREI0R, frei0r, vf);
> > > +REGISTER_FILTER(FSPP,   fspp,   vf);
> > >  REGISTER_FILTER(GEQ,geq,vf);
> > >  REGISTER_FILTER(GRADFUN,gradfun,vf);
> > >  REGISTER_FILTER(HALDCLUT,   haldclut,   vf);
> > > diff --git a/libavfilter/libmpcodecs/vf_fspp.c
> > b/libavfilter/libmpcodecs/vf_fspp.c
> > > index d457859..3a80dc2 100644
> > > --- a/libavfilter/libmpcodecs/vf_fspp.c
> > > +++ b/libavfilter/libmpcodecs/vf_fspp.c
> > > @@ -710,8 +710,8 @@ const vf_info_t ff_vf_info_fspp = {
> > >  #if HAVE_MMX_INLINE
> > >
> > >  DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_382683433)=FIX64(0.382683433,
> > 14);
> > > -DECLARE_ALIGNED(8, uint64_t, ff_MM_FIX_0_541196100)=FIX64(0.541196100,
> > 14);
> > > -DECLARE_ALIGNED(8, uint64_t, ff_MM_FIX_0_707106781)=FIX64(0.707106781,
> > 14);
> > > +extern uint64_t ff_MM_FIX_0_707106781;
> > > +extern uint64_t ff_MM_FIX_0_541196100;
> >
> > still looks weird
> >
> 
> Carl Eugen Hoyos has commented on it in previous mails.
> 
> > +
> > > +typedef int32_t int_simd16_t;
> > > +static const int16_t FIX_0_382683433   = FIX(0.382683433, 14);
> > > +static const int16_t FIX_0_541196100   = FIX(0.541196100, 14);
> > > +static const int16_t FIX_0_707106781   = FIX(0.707106781, 14);
> > > +static const int16_t FIX_1_306562965   = FIX(1.306562965, 14);
> > > +static const int16_t FIX_1_414213562_A = FIX(1.414213562, 14);
> > > +static const int16_t FIX_1_847759065   = FIX(1.847759065, 13);
> > > +static const int16_t FIX_2_613125930   = FIX(-2.613125930, 13);
> > > +static const int16_t FIX_1_414213562   = FIX(1.414213562, 13);
> > > +static const int16_t FIX_1_082392200   = FIX(1.082392200, 13);
> > > +
> >
> > > +typedef struct fsppContext {
> >
> > typedef struct {
> >
> > should be enough
> 
> 
> The mul_thrmat function uses a pointer to this struct, so can't remove
> that.

>  LICENSE.md|1 
>  configure |1 
>  doc/filters.texi  |   30 
>  libavfilter/Makefile  |1 
>  libavfilter/allfilters.c  |1 
>  libavfilter/libmpcodecs/vf_fspp.c |4 
>  libavfilter/version.h |4 
>  libavfilter/vf_fspp.c |  672 ++
>  libavfilter/vf_fspp.h |   96 ++
>  libavfilter/x86/Makefile  |1 
>  libavfilter/x86/vf_fspp.c | 1405 
> ++
>  11 files changed, 2212 insertions(+), 4 deletions(-)
> 93ddfa311e296ef6149a7ae8492e34786cf61db9  
> 0001-lavfi-port-mp-uspp-to-a-native-libavfilter-filter.patch
> From 3da2573bb66205999cf170997a8d088ccb61c350 Mon Sep 17 00:00:00 2001
> From: Arwa Arif 
> Date: Sun, 14 Dec 2014 12:03:31 +0530

> Subject: [PATCH] lavfi: port mp=uspp to a native libavfilter filter

fspp, not uspp


[...]
> +static int config_input(AVFilterLink *inlink)
> +{
> +
> +AVFilterContext *ctx = inlink->dst;
> +FSPPContext *fspp = ctx->priv;
> +const int h = FFALIGN(inlink->h + 16, 16);
> +const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
> +
> +fspp->hsub = desc->log2_chroma_w;
> +fspp->vsub = desc->log2_chroma_h;
> +
> +fspp->temp_stride = FFALIGN(inlink->w + 16, 16);
> +fspp->temp = av_malloc_array(fspp->temp_stride, h * sizeof(*fspp->temp));
> +fspp->src  = av_malloc_array(fspp->temp_stride, h * sizeof(*fspp->src));
> +
> +if (!fspp->temp || !fspp->src)
> +return AVERROR(ENOMEM);
> +
> +if (ARCH_X86)
> +ff_fspp_init_x86(fspp);
> +
> +else {
> +fspp->store_slice  = store_slice_c;
> +fspp->store_slice2 = store_slice2_c;
> +fspp->mul_thrmat   = mul_thrmat_c;
> +fspp->column_fidct = column_fidct_c;
> +fspp->row_idct = row_idct_c;
> +fspp->row_fdct = row_fdct_c;
> +}

the *_c functions should be set before ff_fspp_init_x86() and
unconditionally
otherwise functons not set by ff_fspp_init_x86() would be NULL
and would segfault
you can see this by using -cpuflags 0

[...]

-- 
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] avcodec/mpegvideo_enc: remove rtp_mode=0 for H261

2014-12-18 Thread Michael Niedermayer
Suggested-by: Thomas Volkert 
Signed-off-by: Michael Niedermayer 
---
 libavcodec/mpegvideo_enc.c |3 ---
 1 file changed, 3 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 17d0fbf..a353d5d 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -2852,9 +2852,6 @@ static int encode_thread(AVCodecContext *c, void *arg){
 if(s->start_mb_y == mb_y && mb_y > 0 && mb_x==0) 
is_gob_start=1;
 
 switch(s->codec_id){
-case AV_CODEC_ID_H261:
-is_gob_start=0;//FIXME
-break;
 case AV_CODEC_ID_H263:
 case AV_CODEC_ID_H263P:
 if(!s->h263_slice_structured)
-- 
1.7.9.5

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


Re: [FFmpeg-devel] jQuery - add map file or remove sourceMappingURL from jQuery source

2014-12-18 Thread Michael Niedermayer
On Thu, Dec 18, 2014 at 11:07:23PM +0100, mrskman wrote:
> Hi,
> 
> please apply one of these patches, if you want to remove "GET
> https://www.ffmpeg.org/js/jquery.min.map 404 (Not Found)" from
> Google Chrome developer console (maybe other browsers display
> something similar).

applied the removial, ill leave it to the web maintainers to
revert that and add the file if preferred 

Thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch


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


Re: [FFmpeg-devel] [PATCH] cmdutils: dont call read_header before listing devices

2014-12-18 Thread Michael Niedermayer
On Thu, Dec 18, 2014 at 05:11:29PM +0100, Lukasz Marek wrote:
> On 18 December 2014 at 10:41, Michael Niedermayer  wrote:
> >
> > On Thu, Dec 18, 2014 at 01:29:39AM +0100, Lukasz Marek wrote:
> > > On 18.12.2014 01:09, Michael Niedermayer wrote:
> > > >On Wed, Dec 17, 2014 at 10:59:37PM +0100, Lukasz Marek wrote:
> > > >>On 15.12.2014 14:18, Michael Niedermayer wrote:
> > >   cmdutils.c |8 ++--
> > >   1 file changed, 6 insertions(+), 2 deletions(-)
> > > 8d012a5193b0440717f89d920661913ef160e674
> > 0001-cmdutils-dont-call-read_header-before-listing-device.patch
> > >  From 332bb7456c498518ea72dfdaa0e8c3e76d383f21 Mon Sep 17 00:00:00
> > 2001
> > > From: Lukasz Marek 
> > > Date: Mon, 15 Dec 2014 00:31:42 +0100
> > > Subject: [PATCH] cmdutils: dont call read_header before listing
> > devices
> > > 
> > > List device callback must be able to return valid list without
> > opening device.
> > > This callback should return input values for open function, not
> > vice-versa.
> > > Read header funtion is very likey to fail without proper
> > configuration provided.
> > > >>>
> > > >>>should be ok
> > > >>
> > > >>I changed a patch. I wanted to avoid situation where .read_close is
> > > >>called without .read_header being called before.
> > > >>
> > > >
> > > >>  cmdutils.c |   41 +++--
> > > >>  1 file changed, 35 insertions(+), 6 deletions(-)
> > > >>9a93c401d795bae3545a6c6112e71abd98ac22ca
> > 0001-cmdutils-dont-call-read_header-before-listing-device.patch
> > > >> From 58fe020b8f1c0e809362e152febe3ad715b1c8fc Mon Sep 17 00:00:00 2001
> > > >>From: Lukasz Marek 
> > > >>Date: Mon, 15 Dec 2014 00:31:42 +0100
> > > >>Subject: [PATCH] cmdutils: dont call read_header before listing devices
> > > >>
> > > >>List device callback must be able to return valid list without opening
> > device.
> > > >>This callback should return input values for open function, not
> > vice-versa.
> > > >>Read header funtion is very likey to fail without proper configuration
> > provided.
> > > >>
> > > >>Signed-off-by: Lukasz Marek 
> > > >>---
> > > >>  cmdutils.c | 41 +++--
> > > >>  1 file changed, 35 insertions(+), 6 deletions(-)
> > > >>
> > > >>diff --git a/cmdutils.c b/cmdutils.c
> > > >>index 4e0a406..23a5f77 100644
> > > >>--- a/cmdutils.c
> > > >>+++ b/cmdutils.c
> > > >>@@ -2052,7 +2052,37 @@ void *grow_array(void *array, int elem_size,
> > int *size, int new_size)
> > > >>  }
> > > >>
> > > >>  #if CONFIG_AVDEVICE
> > > >>-static int print_device_sources(AVInputFormat *fmt, AVDictionary
> > *opts)
> > > >>+static int alloc_input_context(AVFormatContext **avctx, AVInputFormat
> > *iformat)
> > > >>+{
> > > >>+AVFormatContext *s = avformat_alloc_context();
> > > >>+int ret = 0;
> > > >>+
> > > >>+*avctx = NULL;
> > > >>+if (!s)
> > > >>+return AVERROR(ENOMEM);
> > > >>+
> > > >>+s->iformat = iformat;
> > > >>+if (s->iformat->priv_data_size > 0) {
> > > >>+s->priv_data = av_mallocz(s->iformat->priv_data_size);
> > > >>+if (!s->priv_data) {
> > > >>+ret = AVERROR(ENOMEM);
> > > >>+goto error;
> > > >>+}
> > > >>+if (s->iformat->priv_class) {
> > > >>+*(const AVClass**)s->priv_data= s->iformat->priv_class;
> > > >>+av_opt_set_defaults(s->priv_data);
> > > >>+}
> > > >>+} else
> > > >>+s->priv_data = NULL;
> > > >>+
> > > >>+*avctx = s;
> > > >>+return 0;
> > > >>+  error:
> > > >>+avformat_free_context(s);
> > > >>+return ret;
> > > >>+}
> > > >>+
> > > >
> > > >>+static int print_device_sources(void *pfmt, AVDictionary *opts)
> > > >>  {
> > > >>  int ret, i;
> > > >>  AVFormatContext *dev = NULL;
> > > >>@@ -2069,13 +2099,12 @@ static int print_device_sources(AVInputFormat
> > *fmt, AVDictionary *opts)
> > > >>  goto fail;
> > > >>  }
> > > >>
> > > >>-/* TODO: avformat_open_input calls read_header callback which is
> > not necessary.
> > > >>- Function like avformat_alloc_output_context2 for input
> > could be helpful here. */
> > > >>-av_dict_copy(&tmp_opts, opts, 0);
> > > >>-if ((ret = avformat_open_input(&dev, NULL, fmt, &tmp_opts)) < 0) {
> > > >>+if ((ret = alloc_input_context(&dev, fmt)) < 0) {
> > > >
> > > >this fails building due to lack of a fmt variable
> > >
> > > I failed at cherry-pick conflict, thanks.
> > > Updated patch is attached.
> > >
> >
> > >  cmdutils.c |   39 ++-
> > >  1 file changed, 34 insertions(+), 5 deletions(-)
> > > 688f0a3fc7e3a81743bc4ce3cc858b880c648595
> > 0001-cmdutils-dont-call-read_header-before-listing-device.patch
> > > From 2b9a20f97687f11eb5d1fd72db3b25e3f2703b73 Mon Sep 17 00:00:00 2001
> > > From: Lukasz Marek 
> > > Date: Mon, 15 Dec 2014 00:31:42 +0100
> > > Subject: [PATCH] cmdutils: dont call read_header before listing devices

Re: [FFmpeg-devel] [PATCH] lavfi: Port fspp to FFmpeg

2014-12-18 Thread Stefano Sabatini
On date Thursday 2014-12-18 13:57:27 +0530, arwa arif encoded:
[...]
> From 3da2573bb66205999cf170997a8d088ccb61c350 Mon Sep 17 00:00:00 2001
> From: Arwa Arif 
> Date: Sun, 14 Dec 2014 12:03:31 +0530

> Subject: [PATCH] lavfi: port mp=uspp to a native libavfilter filter

mp=fspp

> 
> ---
>  LICENSE.md|1 +
>  configure |1 +
>  doc/filters.texi  |   30 +
>  libavfilter/Makefile  |1 +
>  libavfilter/allfilters.c  |1 +
>  libavfilter/libmpcodecs/vf_fspp.c |4 +-
>  libavfilter/version.h |4 +-
>  libavfilter/vf_fspp.c |  672 ++
>  libavfilter/vf_fspp.h |   96 +++
>  libavfilter/x86/Makefile  |1 +
>  libavfilter/x86/vf_fspp.c | 1405 
> +
>  11 files changed, 2212 insertions(+), 4 deletions(-)
>  create mode 100644 libavfilter/vf_fspp.c
>  create mode 100644 libavfilter/vf_fspp.h
>  create mode 100644 libavfilter/x86/vf_fspp.c
> 
> diff --git a/LICENSE.md b/LICENSE.md
> index cf9955f..188d060 100644
> --- a/LICENSE.md
> +++ b/LICENSE.md
> @@ -31,6 +31,7 @@ Specifically, the GPL parts of FFmpeg are:
>  - vf_cropdetect.c
>  - vf_decimate.c
>  - vf_delogo.c
> +- vf_fspp.c
>  - vf_geq.c
>  - vf_histeq.c
>  - vf_hqdn3d.c
> diff --git a/configure b/configure
> index e37285a..29f5534 100755
> --- a/configure
> +++ b/configure
> @@ -2575,6 +2575,7 @@ ebur128_filter_deps="gpl"
>  flite_filter_deps="libflite"
>  frei0r_filter_deps="frei0r dlopen"
>  frei0r_src_filter_deps="frei0r dlopen"
> +fspp_filter_deps="gpl"
>  geq_filter_deps="gpl"
>  histeq_filter_deps="gpl"
>  hqdn3d_filter_deps="gpl"
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 882caa0..8d2069e 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -4997,6 +4997,35 @@ frei0r=perspective:0.2/0.2|0.8/0.2
>  For more information, see
>  @url{http://frei0r.dyne.org}
>  
> +@section fspp
> +
> +Apply fast and simple postprocessing. It is a faster version of the simple
> +postprocessing filter - @ref{spp}.
> +

> +It splits (I)DCT into horizontal/vertical passes. Unlike Simple 
> postprocessing
> +filter, one of them is performed once per block, not per pixel. This allows 
> for
> +much better speed.

nit: unlike the simple postprocessing filter... allows for higher speed.

> +
> +The filter accepts the following options:
> +
> +@table @option
> +@item quality
> +Set quality. This option defines the number of levels for averaging. It 
> accepts
> +an integer in the range 0-5. If set to @code{0}, the filter will have no
> +effect. A value of @code{5} means the higher quality. For each increment of
> +that value the speed drops by a factor of approximately 2.  Default value is
> +@code{4}.
> +
> +@item qp
> +Force a constant quantization parameter. It accepts an integer in range 0-63.
> +If not set, the filter will use the QP from the video stream (if available).
> +
> +@item use_bframe_qp
> +Enable the use of the QP from the B-Frames if set to @code{1}. Using this
> +option may cause flicker since the B-Frames have often larger QP. Default is
> +@code{0} (not enabled).
> +@end table
> +
>  @section geq
>  
>  The filter accepts the following options:
> @@ -8292,6 +8321,7 @@ stereo3d=abl:sbsr
>  @end example
>  @end itemize
>  
> +@anchor{spp}
>  @section spp
>  
>  Apply a simple postprocessing filter that compresses and decompresses the 
> image
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 6b7291e..8c523b4 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -125,6 +125,7 @@ OBJS-$(CONFIG_FRAMESTEP_FILTER)  += 
> vf_framestep.o
>  OBJS-$(CONFIG_FPS_FILTER)+= vf_fps.o
>  OBJS-$(CONFIG_FRAMEPACK_FILTER)  += vf_framepack.o
>  OBJS-$(CONFIG_FREI0R_FILTER) += vf_frei0r.o
> +OBJS-$(CONFIG_FSPP_FILTER)   += vf_fspp.o
>  OBJS-$(CONFIG_GEQ_FILTER)+= vf_geq.o
>  OBJS-$(CONFIG_GRADFUN_FILTER)+= vf_gradfun.o
>  OBJS-$(CONFIG_HALDCLUT_FILTER)   += vf_lut3d.o dualinput.o 
> framesync.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index adb86be..4a915c7 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -141,6 +141,7 @@ void avfilter_register_all(void)
>  REGISTER_FILTER(FRAMEPACK,  framepack,  vf);
>  REGISTER_FILTER(FRAMESTEP,  framestep,  vf);
>  REGISTER_FILTER(FREI0R, frei0r, vf);
> +REGISTER_FILTER(FSPP,   fspp,   vf);
>  REGISTER_FILTER(GEQ,geq,vf);
>  REGISTER_FILTER(GRADFUN,gradfun,vf);
>  REGISTER_FILTER(HALDCLUT,   haldclut,   vf);
> diff --git a/libavfilter/libmpcodecs/vf_fspp.c 
> b/libavfilter/libmpcodecs/vf_fspp.c
> index d457859..3a80dc2 100644
> --- a/libavfilter/libmpcodecs/

Re: [FFmpeg-devel] [PATCH] lavfi: Port fspp to FFmpeg

2014-12-18 Thread Michael Niedermayer
On Fri, Dec 19, 2014 at 02:13:01AM +0100, Stefano Sabatini wrote:
> On date Thursday 2014-12-18 13:57:27 +0530, arwa arif encoded:
> [...]
> > From 3da2573bb66205999cf170997a8d088ccb61c350 Mon Sep 17 00:00:00 2001
> > From: Arwa Arif 
> > Date: Sun, 14 Dec 2014 12:03:31 +0530
> 
> > Subject: [PATCH] lavfi: port mp=uspp to a native libavfilter filter
> 
> mp=fspp
> 
> > 
> > ---
> >  LICENSE.md|1 +
> >  configure |1 +
> >  doc/filters.texi  |   30 +
> >  libavfilter/Makefile  |1 +
> >  libavfilter/allfilters.c  |1 +
> >  libavfilter/libmpcodecs/vf_fspp.c |4 +-
> >  libavfilter/version.h |4 +-
> >  libavfilter/vf_fspp.c |  672 ++
> >  libavfilter/vf_fspp.h |   96 +++
> >  libavfilter/x86/Makefile  |1 +
> >  libavfilter/x86/vf_fspp.c | 1405 
> > +
> >  11 files changed, 2212 insertions(+), 4 deletions(-)
> >  create mode 100644 libavfilter/vf_fspp.c
> >  create mode 100644 libavfilter/vf_fspp.h
> >  create mode 100644 libavfilter/x86/vf_fspp.c
> > 
> > diff --git a/LICENSE.md b/LICENSE.md
> > index cf9955f..188d060 100644
> > --- a/LICENSE.md
> > +++ b/LICENSE.md
> > @@ -31,6 +31,7 @@ Specifically, the GPL parts of FFmpeg are:
> >  - vf_cropdetect.c
> >  - vf_decimate.c
> >  - vf_delogo.c
> > +- vf_fspp.c
> >  - vf_geq.c
> >  - vf_histeq.c
> >  - vf_hqdn3d.c
> > diff --git a/configure b/configure
> > index e37285a..29f5534 100755
> > --- a/configure
> > +++ b/configure
> > @@ -2575,6 +2575,7 @@ ebur128_filter_deps="gpl"
> >  flite_filter_deps="libflite"
> >  frei0r_filter_deps="frei0r dlopen"
> >  frei0r_src_filter_deps="frei0r dlopen"
> > +fspp_filter_deps="gpl"
> >  geq_filter_deps="gpl"
> >  histeq_filter_deps="gpl"
> >  hqdn3d_filter_deps="gpl"
> > diff --git a/doc/filters.texi b/doc/filters.texi
> > index 882caa0..8d2069e 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -4997,6 +4997,35 @@ frei0r=perspective:0.2/0.2|0.8/0.2
> >  For more information, see
> >  @url{http://frei0r.dyne.org}
> >  
> > +@section fspp
> > +
> > +Apply fast and simple postprocessing. It is a faster version of the simple
> > +postprocessing filter - @ref{spp}.
> > +
> 
> > +It splits (I)DCT into horizontal/vertical passes. Unlike Simple 
> > postprocessing
> > +filter, one of them is performed once per block, not per pixel. This 
> > allows for
> > +much better speed.
> 
> nit: unlike the simple postprocessing filter... allows for higher speed.
> 
> > +
> > +The filter accepts the following options:
> > +
> > +@table @option
> > +@item quality
> > +Set quality. This option defines the number of levels for averaging. It 
> > accepts
> > +an integer in the range 0-5. If set to @code{0}, the filter will have no
> > +effect. A value of @code{5} means the higher quality. For each increment of
> > +that value the speed drops by a factor of approximately 2.  Default value 
> > is
> > +@code{4}.
> > +
> > +@item qp
> > +Force a constant quantization parameter. It accepts an integer in range 
> > 0-63.
> > +If not set, the filter will use the QP from the video stream (if 
> > available).
> > +
> > +@item use_bframe_qp
> > +Enable the use of the QP from the B-Frames if set to @code{1}. Using this
> > +option may cause flicker since the B-Frames have often larger QP. Default 
> > is
> > +@code{0} (not enabled).
> > +@end table
> > +
> >  @section geq
> >  
> >  The filter accepts the following options:
> > @@ -8292,6 +8321,7 @@ stereo3d=abl:sbsr
> >  @end example
> >  @end itemize
> >  
> > +@anchor{spp}
> >  @section spp
> >  
> >  Apply a simple postprocessing filter that compresses and decompresses the 
> > image
> > diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> > index 6b7291e..8c523b4 100644
> > --- a/libavfilter/Makefile
> > +++ b/libavfilter/Makefile
> > @@ -125,6 +125,7 @@ OBJS-$(CONFIG_FRAMESTEP_FILTER)  += 
> > vf_framestep.o
> >  OBJS-$(CONFIG_FPS_FILTER)+= vf_fps.o
> >  OBJS-$(CONFIG_FRAMEPACK_FILTER)  += vf_framepack.o
> >  OBJS-$(CONFIG_FREI0R_FILTER) += vf_frei0r.o
> > +OBJS-$(CONFIG_FSPP_FILTER)   += vf_fspp.o
> >  OBJS-$(CONFIG_GEQ_FILTER)+= vf_geq.o
> >  OBJS-$(CONFIG_GRADFUN_FILTER)+= vf_gradfun.o
> >  OBJS-$(CONFIG_HALDCLUT_FILTER)   += vf_lut3d.o dualinput.o 
> > framesync.o
> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> > index adb86be..4a915c7 100644
> > --- a/libavfilter/allfilters.c
> > +++ b/libavfilter/allfilters.c
> > @@ -141,6 +141,7 @@ void avfilter_register_all(void)
> >  REGISTER_FILTER(FRAMEPACK,  framepack,  vf);
> >  REGISTER_FILTER(FRAMESTEP,  framestep,  vf);
> >  REGISTER_FILTER(FREI0R, frei0r, vf);
> > +REGISTER_FILTER(FSPP,   fsp

Re: [FFmpeg-devel] libavutil: Added cbc mode to cast5.c

2014-12-18 Thread supraja reddy
Updated patch .

Thanks,

Supraja

On Fri, Dec 19, 2014 at 3:01 AM, Giorgio Vazzana  wrote:
>
> 2014-12-18 11:09 GMT+01:00 supraja reddy :
> > Sorry for the mistake . I seem to have got cbc completely wrong.
> > I have made the changes . Please let me know if there is anything
> missing.
>
> > From 0bf794bc43ed7055f83bcd07cb5c1e2f4445e813 Mon Sep 17 00:00:00 2001
> > From: Supraja Meedinti 
> > Date: Thu, 18 Dec 2014 15:26:32 +0530
> > Subject: [PATCH] libavutil: Added cbc mode to cast128
> >
> > Signed-off-by: Supraja Meedinti 
> > ---
> >  libavutil/cast5.c | 44 ++--
> >  libavutil/cast5.h | 14 +-
> >  2 files changed, 55 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavutil/cast5.c b/libavutil/cast5.c
> > index 14dd701..e338037 100644
> > --- a/libavutil/cast5.c
> > +++ b/libavutil/cast5.c
> > @@ -416,7 +416,7 @@ static void encipher(AVCAST5* cs, uint8_t* dst,
> const uint8_t* src)
> >  AV_WB32(dst + 4, l);
> >  }
> >
> > -static void decipher(AVCAST5* cs, uint8_t* dst, const uint8_t* src)
> > +static void decipher(AVCAST5* cs, uint8_t* dst, const uint8_t* src,
> uint8_t *iv)
> >  {
> >  uint32_t f, I, r, l;
> >  l = AV_RB32(src);
> > @@ -439,6 +439,11 @@ static void decipher(AVCAST5* cs, uint8_t* dst,
> const uint8_t* src)
> >  F3(r, l, 3);
> >  F2(l, r, 2);
> >  F1(r, l, 1);
> > +if (iv) {
> > +r ^= AV_RB32(iv);
> > +l ^= AV_RB32(iv + 4);
> > +memcpy(iv, src, 8);
> > +}
> >  AV_WB32(dst, r);
> >  AV_WB32(dst + 4, l);
> >  }
> > @@ -468,11 +473,31 @@ av_cold int av_cast5_init(AVCAST5* cs, const
> uint8_t *key, int key_bits)
> >  return 0;
> >  }
> >
> > +void av_cast5_crypt2(AVCAST5* cs, uint8_t* dst, const uint8_t* src, int
> count, uint8_t *iv, int decrypt)
> > +{
> > +int i;
> > +while (count--) {
> > +if (decrypt) {
> > +decipher(cs, dst, src, iv);
> > +} else {
> > +if (iv) {
> > +for (i = 0; i < 8; i++)
> > +dst[i] = src[i] ^ iv[i];
> > +encipher(cs, dst, dst);
> > +memcpy(iv, dst, 8);
> > +} else {
> > +encipher(cs, dst, src);
> > +}
> > +}
> > +src = src + 8;
> > +dst = dst + 8;
> > +}
> > +}
> >  void av_cast5_crypt(AVCAST5* cs, uint8_t* dst, const uint8_t* src, int
> count, int decrypt)
> >  {
> >  while (count--) {
> >  if (decrypt){
> > -decipher(cs, dst, src);
> > +decipher(cs, dst, src, NULL);
> >  } else {
> >  encipher(cs, dst, src);
> >  }
> > @@ -504,6 +529,7 @@ int main(int argc, char** argv)
> >  {0xee, 0xa9, 0xd0, 0xa2, 0x49, 0xfd, 0x3b, 0xa6, 0xb3, 0x43,
> 0x6f, 0xb8, 0x9d, 0x6d, 0xca, 0x92},
> >  {0xb2, 0xc9, 0x5e, 0xb0, 0x0c, 0x31, 0xad, 0x71, 0x80, 0xac,
> 0x05, 0xb8, 0xe8, 0x3d, 0x69, 0x6e}
> >  };
> > +static uint8_t temp2[8] = {0xee, 0xa9, 0xd0, 0xa2, 0x49, 0xfd,
> 0x3b, 0xa6};
>
> I would call this variable iv instead of temp2, so: const uint8_t iv[2] =
> ...
>
> (for another patch: we can probably remove the keyword 'static' from
> all variables in main, and make key_bits const)
>
> >  static uint8_t rpt2[2][16];
> >  int i, j, err = 0;
> >  static int key_bits[3] = {128, 80, 40};
> > @@ -547,6 +573,20 @@ int main(int argc, char** argv)
> >  }
> >  }
> >  }
> > +for (j = 0; j < 3; j++) {
> > +
> > +av_cast5_init(cs, Key[j], key_bits[j]);
> > +memcpy(temp, temp2, 8);
> > +av_cast5_crypt2(cs, rpt2[0], rct2[0], 2, temp, 0);
> > +memcpy(temp, temp2, 8);
> > +av_cast5_crypt2(cs, rpt2[0], rpt2[0], 2, temp, 1);
> > +for (i =0; i < 16; i++) {
>
> Missing space between = and 0.
>
> > +if (rct2[0][i] != rpt2[0][i]) {
> > +av_log(NULL, AV_LOG_ERROR, "%d %02x %02x\n", i,
> rct2[0][i], rpt2[0][i]);
> > +err = 1;
> > +}
> > +}
> > +}
> >  av_free(cs);
> >  return err;
> >  }
> > diff --git a/libavutil/cast5.h b/libavutil/cast5.h
> > index 913d048..e5cc8b1 100644
> > --- a/libavutil/cast5.h
> > +++ b/libavutil/cast5.h
> > @@ -52,7 +52,7 @@ struct AVCAST5 *av_cast5_alloc(void);
> >  int av_cast5_init(struct AVCAST5 *ctx, const uint8_t *key, int
> key_bits);
> >
> >  /**
> > -  * Encrypt or decrypt a buffer using a previously initialized context
> > +  * Encrypt or decrypt a buffer using a previously initialized context,
> ECB mode only
> >*
> >* @param ctx an AVCAST5 context
> >* @param dst destination array, can be equal to src
> > @@ -61,6 +61,18 @@ int av_cast5_init(struct AVCAST5 *ctx, const uint8_t
> *key, int key_bits);
> >* @param decrypt 0 for encryption, 1 for decryption
> >   */
> >  void av_cast5_crypt(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t
> *src, int count, int decrypt);
> > +
> > +/**
> > +  * Enc

Re: [FFmpeg-devel] [PATCH] libavfilter: unsharpen opencl filter optimizations

2014-12-18 Thread Titov, Alexey
Hi Michael,

Here is the patch. I attached a zip of this patch in the last email, but it was 
probably stripped off.
Let me know how I can help.
===

>From e94ea7add32791a1c9ac04dbd68b78cf799ca92d Mon Sep 17 00:00:00 2001
From: atitov 
Date: Wed, 17 Dec 2014 16:02:17 -0800
Subject: [PATCH] libavfilter: unsharpen opencl filter optimizations

---
 libavfilter/unsharp.h   |   4 ++
 libavfilter/unsharp_opencl.c|  76 +++---
 libavfilter/unsharp_opencl_kernel.h | 122 ++--
 libavutil/opencl.c  |  19 +-
 4 files changed, 165 insertions(+), 56 deletions(-)

diff --git a/libavfilter/unsharp.h b/libavfilter/unsharp.h
index c2aed64..fc651c0 100644
--- a/libavfilter/unsharp.h
+++ b/libavfilter/unsharp.h
@@ -41,6 +41,10 @@ typedef struct {
 cl_kernel kernel_chroma;
 cl_mem cl_luma_mask;
 cl_mem cl_chroma_mask;
+cl_mem cl_luma_mask_x;
+cl_mem cl_chroma_mask_x;
+cl_mem cl_luma_mask_y;
+cl_mem cl_chroma_mask_y;
 int in_plane_size[8];
 int out_plane_size[8];
 int plane_num;
diff --git a/libavfilter/unsharp_opencl.c b/libavfilter/unsharp_opencl.c
index 5c6b5ef..a99fc5b 100644
--- a/libavfilter/unsharp_opencl.c
+++ b/libavfilter/unsharp_opencl.c
@@ -87,42 +87,36 @@ end:
 return ret;
 }
 
-static int compute_mask_matrix(cl_mem cl_mask_matrix, int step_x, int step_y)
+static int copy_separable_masks(cl_mem cl_mask_x, cl_mem cl_mask_y, int 
step_x, int step_y)
 {
-int i, j, ret = 0;
-uint32_t *mask_matrix, *mask_x, *mask_y;
-size_t size_matrix = sizeof(uint32_t) * (2 * step_x + 1) * (2 * step_y + 
1);
-mask_x = av_mallocz_array(2 * step_x + 1, sizeof(uint32_t));
+int ret = 0;
+uint32_t *mask_x, *mask_y;
+size_t size_mask_x = sizeof(uint32_t) * (2 * step_x + 1);
+size_t size_mask_y = sizeof(uint32_t) * (2 * step_y + 1);
+mask_x = av_mallocz_array(size_mask_x);
 if (!mask_x) {
 ret = AVERROR(ENOMEM);
 goto end;
 }
-mask_y = av_mallocz_array(2 * step_y + 1, sizeof(uint32_t));
+mask_y = av_mallocz_array(size_mask_y);
 if (!mask_y) {
 ret = AVERROR(ENOMEM);
 goto end;
 }
-mask_matrix = av_mallocz(size_matrix);
-if (!mask_matrix) {
-ret = AVERROR(ENOMEM);
-goto end;
-}
+
 ret = compute_mask(step_x, mask_x);
 if (ret < 0)
 goto end;
 ret = compute_mask(step_y, mask_y);
 if (ret < 0)
 goto end;
-for (j = 0; j < 2 * step_y + 1; j++) {
-for (i = 0; i < 2 * step_x + 1; i++) {
-mask_matrix[i + j * (2 * step_x + 1)] = mask_y[j] * mask_x[i];
-}
-}
-ret = av_opencl_buffer_write(cl_mask_matrix, (uint8_t *)mask_matrix, 
size_matrix);
+
+ret = av_opencl_buffer_write(cl_mask_x, (uint8_t *)mask_x, size_mask_x);
+ret = av_opencl_buffer_write(cl_mask_y, (uint8_t *)mask_y, size_mask_y);
 end:
 av_freep(&mask_x);
 av_freep(&mask_y);
-av_freep(&mask_matrix);
+
 return ret;
 }
 
@@ -133,6 +127,11 @@ static int generate_mask(AVFilterContext *ctx)
 cl_mem mask_matrix[2];
 mask_matrix[0] = unsharp->opencl_ctx.cl_luma_mask;
 mask_matrix[1] = unsharp->opencl_ctx.cl_chroma_mask;
+cl_mem masks[4];
+masks[0] = unsharp->opencl_ctx.cl_luma_mask_x;
+masks[1] = unsharp->opencl_ctx.cl_luma_mask_y;
+masks[2] = unsharp->opencl_ctx.cl_chroma_mask_x;
+masks[3] = unsharp->opencl_ctx.cl_chroma_mask_y;
 step_x[0] = unsharp->luma.steps_x;
 step_x[1] = unsharp->chroma.steps_x;
 step_y[0] = unsharp->luma.steps_y;
@@ -144,12 +143,16 @@ static int generate_mask(AVFilterContext *ctx)
 else
 unsharp->opencl_ctx.use_fast_kernels = 1;
 
+if (!masks[0] || !masks[1] || !masks[2] || !masks[3]) {
+av_log(ctx, AV_LOG_ERROR, "Luma mask and chroma mask should not be 
NULL\n");
+return AVERROR(EINVAL);
+}
 if (!mask_matrix[0] || !mask_matrix[1]) {
 av_log(ctx, AV_LOG_ERROR, "Luma mask and chroma mask should not be 
NULL\n");
 return AVERROR(EINVAL);
 }
 for (i = 0; i < 2; i++) {
-ret = compute_mask_matrix(mask_matrix[i], step_x[i], step_y[i]);
+ret = copy_separable_masks(masks[2*i], masks[2*i+1], step_x[i], 
step_y[i]);
 if (ret < 0)
 return ret;
 }
@@ -184,7 +187,8 @@ int ff_opencl_apply_unsharp(AVFilterContext *ctx, AVFrame 
*in, AVFrame *out)
 ret = avpriv_opencl_set_parameter(&kernel1,
   
FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_inbuf),
   
FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_outbuf),
-  
FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_luma_mask),
+  
FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_luma_mask_x),
+  
FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_luma_mask_y),
   

Re: [FFmpeg-devel] [PATCH] lavfi: Port fspp to FFmpeg

2014-12-18 Thread Timothy Gu
On Dec 18, 2014 10:31 PM, "arwa arif"  wrote:
>
> On Fri, Dec 19, 2014 at 10:40 AM, Michael Niedermayer 
> wrote:
> >
> > it segfaults without -cpuflags 0 here
> > ./ffplay   -i matrixbench_mpeg2.mpg -vf fspp
> >
> >
> I tried this command on my system, and it is not giving segfault on my
> system.
>
>
> > #0  0x004d0e7a in store_slice_mmx (dst=0x7fffc4612b60 "",
> > src=0x77e07e50, dst_stride=-1440, src_stride=32, width=720,
height=8,
> > log2_scale=1) at libavfilter/x86/vf_fspp.c:49
> >
>
> Here, the value of dst_stride is -1440, which shouldn't be negative. So,
> when I looked into mplayer code, store_slice_mmx has input arguments of
> type long. Maybe that is the problem, so I have updated the patch
replacing
> int by int32_t.

Actually ptrdiff_t is a better choice here.

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


Re: [FFmpeg-devel] [PATCH] libavfilter: unsharpen opencl filter optimizations

2014-12-18 Thread Christophe Gisquet
Hi,

Le 19 déc. 2014 07:28, "Titov, Alexey"  a écrit :
>
> Hi Michael,
>
> Here is the patch. I attached a zip of this patch in the last email, but
it was probably stripped off.
> Let me know how I can help.
[...]
> diff --git a/libavutil/opencl.c b/libavutil/opencl.c
> index 36cb6fe..738d0db 100644
> --- a/libavutil/opencl.c
> +++ b/libavutil/opencl.c
> @@ -450,7 +450,24 @@ cl_program av_opencl_compile(const char
*program_name, const char *build_opts)
>  status = clBuildProgram(program, 1, &(opencl_ctx.device_id),
build_opts, NULL, NULL);
>  if (status != CL_SUCCESS) {
>  av_log(&opencl_ctx, AV_LOG_ERROR,
> -   "Compilation failed with OpenCL program: %s\n",
program_name);
> +"Compilation failed with OpenCL program: '%s' with error %d
\n", program_name, status);
> +
> +// Determine the size of the log
> +size_t log_size;
> +clGetProgramBuildInfo(program, &(opencl_ctx.device_id),
CL_PROGRAM_BUILD_LOG, 0, NULL, &log_size);
> +
> +// Allocate memory for the log
> +char *log = (char *) malloc(log_size+1);
> +
> +// Get the log
> +clGetProgramBuildInfo(program, &(opencl_ctx.device_id),
CL_PROGRAM_BUILD_LOG, log_size, log, NULL);
> +log[log_size] = '\0';
> +printf("--- Build log ---\n ");
> +// Print the log
> +printf("%s\n", log);
> +printf("--- End Build log ---\n ");
> +
> +free(log);
>  program = NULL;
>  goto end;
>  }
> --
> 1.8.4.msysgit.0

Without knowing anything about opencl, I'd say this hunk would better be a
separate patch.

Second, I guess this compile log could be a huge output, furthermore on
stdout. Using stderr would be better, and no idea about how to deal with
the 'huge' part.

Sent from a phone so please excuse terseness.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel