[FFmpeg-devel] [PATCH 0/4] Fix various issues in wavpack

2014-08-22 Thread Christophe Gisquet
Another batch of different issues.

Christophe Gisquet (4):
  wavpackenc: fix number of samples per block
  wavpackenc: make assert more thorough
  wavpack: check number of channels
  wavpackenc: reset trailer info on block encoding

 libavcodec/wavpack.c| 5 -
 libavcodec/wavpackenc.c | 7 +--
 2 files changed, 9 insertions(+), 3 deletions(-)

-- 
1.9.2.msysgit.0

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


[FFmpeg-devel] [PATCH 2/4] wavpackenc: make assert more thorough

2014-08-22 Thread Christophe Gisquet
It was only validating that normal data wasn't filling the buffer.
However, extra data may be written afterwards.
---
 libavcodec/wavpackenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/wavpackenc.c b/libavcodec/wavpackenc.c
index 169836a..299a035 100644
--- a/libavcodec/wavpackenc.c
+++ b/libavcodec/wavpackenc.c
@@ -2813,7 +2813,7 @@ static int wavpack_encode_block(WavPackEncodeContext *s,
 block_size = bytestream2_tell_p(pb);
 AV_WL32(out + 4, block_size - 8);
 
-av_assert0(put_bits_left(s-pb)  0);
+av_assert0(!bytestream2_get_eof(pb));
 
 return block_size;
 }
-- 
1.9.2.msysgit.0

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


[FFmpeg-devel] [PATCH 3/4] wavpack: check number of channels

2014-08-22 Thread Christophe Gisquet
This means container and codec disagree. The codec is supposed to
know better so this could be an error instead.
---
 libavcodec/wavpack.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 9f72ebe..1ad3901 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -906,7 +906,10 @@ static int wavpack_decode_block(AVCodecContext *avctx, int 
block_no,
 chmask = bytestream2_get_le32(gb);
 break;
 case 5:
-bytestream2_skip(gb, 1);
+size = bytestream2_get_byte(gb);
+if (avctx-channels != size)
+av_log(avctx, AV_LOG_WARNING, %i channels signalled
+instead of %i.\n, size, avctx-channels);
 chan  |= (bytestream2_get_byte(gb)  0xF)  8;
 chmask = bytestream2_get_le16(gb);
 break;
-- 
1.9.2.msysgit.0

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


[FFmpeg-devel] [PATCH 4/4] wavpackenc: reset trailer info on block encoding

2014-08-22 Thread Christophe Gisquet
In some cases, in particular if several blocks are needed because of
the channel layout (e.g. 2.1), the information used to write the
trailing bits terminating the sample data was not reset.

This would cause potential desync on the decoder, although decoded
samples were actually mostly fine.

Fixes ticket #3879.
---
 libavcodec/wavpackenc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/wavpackenc.c b/libavcodec/wavpackenc.c
index 299a035..63971c6 100644
--- a/libavcodec/wavpackenc.c
+++ b/libavcodec/wavpackenc.c
@@ -2487,6 +2487,9 @@ static int wavpack_encode_block(WavPackEncodeContext *s,
 struct Decorr *dpp;
 PutByteContext pb;
 
+if (s-flags  WV_MONO_DATA) {
+CLEAR(s-w);
+}
 if (!(s-flags  WV_MONO)  s-optimize_mono) {
 int32_t lor = 0, diff = 0;
 
-- 
1.9.2.msysgit.0

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


Re: [FFmpeg-devel] [PATCH 0/4] Exploit compile-time constant

2014-08-22 Thread Mickaël Raulet
Patch okay.

Mickaël
Le 4 août 2014 à 10:31, Christophe Gisquet christophe.gisq...@gmail.com a 
écrit :

 Hi,
 
 2014-08-02 14:48 GMT+02:00 Michael Niedermayer michae...@gmx.at:
 seems to fail with
 libavcodec/x86/hevc_mc.asm:1258: error: (add:2) cannot reference symbol 
 `MAX_PB_SIZE' in preprocessor
 
 I forgot the initial patch when generating the patchset, that you can
 find here. I expect no changes for the others, so I didn't bother
 resending them/starting another thread.
 
 -- 
 Christophe
 0001-x86-hevc_mc-assume-2nd-source-stride-is-64.patch___
 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/4] wavpackenc: fix number of samples per block

2014-08-22 Thread Michael Niedermayer
On Fri, Aug 22, 2014 at 09:31:42AM +, Christophe Gisquet wrote:
 Currently, the encoder will try to reduce it down to 15, but the
 decoder will complain starting at 131072 (WV_MAX_SAMPLES). Therefore,
 change the loop limit.
 
 Fixes ticket #3881.
 ---
  libavcodec/wavpackenc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

applied

thanks

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

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


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


Re: [FFmpeg-devel] [PATCH 2/4] wavpackenc: make assert more thorough

2014-08-22 Thread Michael Niedermayer
On Fri, Aug 22, 2014 at 09:31:43AM +, Christophe Gisquet wrote:
 It was only validating that normal data wasn't filling the buffer.
 However, extra data may be written afterwards.
 ---
  libavcodec/wavpackenc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

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] [PATCH 0/4] Exploit compile-time constant

2014-08-22 Thread Michael Niedermayer
On Fri, Aug 22, 2014 at 11:40:17AM +0200, Mickaël Raulet wrote:
 Patch okay.

patch applied

just to make sure i dont misunderstand, that okay was just for this
patch or the whole patchset ?

thanks

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

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA


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


Re: [FFmpeg-devel] [PATCH 0/4] Exploit compile-time constant

2014-08-22 Thread Mickaël Raulet
for the whole patchset.

Mickaël
Le 22 août 2014 à 13:25, Michael Niedermayer michae...@gmx.at a écrit :

 On Fri, Aug 22, 2014 at 11:40:17AM +0200, Mickaël Raulet wrote:
 Patch okay.
 
 patch applied
 
 just to make sure i dont misunderstand, that okay was just for this
 patch or the whole patchset ?
 
 thanks
 
 [...]
 -- 
 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
 
 In fact, the RIAA has been known to suggest that students drop out
 of college or go to community college in order to be able to afford
 settlements. -- The RIAA

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


Re: [FFmpeg-devel] [PATCH 3/4] wavpack: check number of channels

2014-08-22 Thread Paul B Mahol
On 8/22/14, Christophe Gisquet christophe.gisq...@gmail.com wrote:
 This means container and codec disagree. The codec is supposed to
 know better so this could be an error instead.
 ---
  libavcodec/wavpack.c | 5 -
  1 file changed, 4 insertions(+), 1 deletion(-)

 diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
 index 9f72ebe..1ad3901 100644
 --- a/libavcodec/wavpack.c
 +++ b/libavcodec/wavpack.c
 @@ -906,7 +906,10 @@ static int wavpack_decode_block(AVCodecContext *avctx,
 int block_no,
  chmask = bytestream2_get_le32(gb);
  break;
  case 5:
 -bytestream2_skip(gb, 1);
 +size = bytestream2_get_byte(gb);
 +if (avctx-channels != size)
 +av_log(avctx, AV_LOG_WARNING, %i channels signalled
 +instead of %i.\n, size, avctx-channels);
  chan  |= (bytestream2_get_byte(gb)  0xF)  8;
  chmask = bytestream2_get_le16(gb);
  break;
 --
 1.9.2.msysgit.0

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


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


Re: [FFmpeg-devel] [PATCH 4/4] wavpackenc: reset trailer info on block encoding

2014-08-22 Thread Paul B Mahol
On 8/22/14, Christophe Gisquet christophe.gisq...@gmail.com wrote:
 In some cases, in particular if several blocks are needed because of
 the channel layout (e.g. 2.1), the information used to write the
 trailing bits terminating the sample data was not reset.

 This would cause potential desync on the decoder, although decoded
 samples were actually mostly fine.

 Fixes ticket #3879.
 ---
  libavcodec/wavpackenc.c | 3 +++
  1 file changed, 3 insertions(+)

 diff --git a/libavcodec/wavpackenc.c b/libavcodec/wavpackenc.c
 index 299a035..63971c6 100644
 --- a/libavcodec/wavpackenc.c
 +++ b/libavcodec/wavpackenc.c
 @@ -2487,6 +2487,9 @@ static int wavpack_encode_block(WavPackEncodeContext
 *s,
  struct Decorr *dpp;
  PutByteContext pb;

 +if (s-flags  WV_MONO_DATA) {
 +CLEAR(s-w);
 +}
  if (!(s-flags  WV_MONO)  s-optimize_mono) {
  int32_t lor = 0, diff = 0;

 --
 1.9.2.msysgit.0

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


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


Re: [FFmpeg-devel] [PATCH 1/4] hevc: move MAX_PB_SIZE declaration

2014-08-22 Thread Michael Niedermayer
On Mon, Jul 28, 2014 at 05:17:25PM +, Christophe Gisquet wrote:
 ---
  libavcodec/hevc.h| 1 -
  libavcodec/hevcdsp.h | 2 ++
  2 files changed, 2 insertions(+), 1 deletion(-)

applied

thanks

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

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.


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


Re: [FFmpeg-devel] [PATCH 2/4] hevcdsp: remove compilation-time-fixed parameter

2014-08-22 Thread Michael Niedermayer
On Mon, Jul 28, 2014 at 05:17:26PM +, Christophe Gisquet wrote:
 The dststride parameter is always MAX_PB_SIZE.
 ---
  libavcodec/hevc.c |  4 ++--
  libavcodec/hevcdsp.h  |  4 ++--
  libavcodec/hevcdsp_template.c | 27 +--
  libavcodec/x86/hevc_mc.asm| 16 
  libavcodec/x86/hevcdsp.h  |  2 +-
  libavcodec/x86/hevcdsp_init.c | 16 
  6 files changed, 34 insertions(+), 35 deletions(-)

applied

thanks

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

It is what and why we do it that matters, not just one of them.


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


Re: [FFmpeg-devel] [PATCH 3/4] hevcdsp: remove more instances of compile-time-fixed parameters

2014-08-22 Thread Michael Niedermayer
On Mon, Aug 04, 2014 at 06:46:17PM +0200, Christophe Gisquet wrote:
 2014-07-28 19:17 GMT+02:00 Christophe Gisquet christophe.gisq...@gmail.com:
  ---
   libavcodec/hevc.c |  8 +++
   libavcodec/hevcdsp.h  |  8 +++
   libavcodec/hevcdsp_template.c | 56 
  +--
   libavcodec/x86/hevc_mc.asm| 18 +++---
   libavcodec/x86/hevcdsp.h  |  6 ++---
   libavcodec/x86/hevcdsp_init.c | 12 +-
   6 files changed, 54 insertions(+), 54 deletions(-)
 
 Update patch with a warning fixed and cleaned an asm macro.
 
 -- 
 Christophe

  hevc.c |9 +++-
  hevcdsp.h  |8 +++
  hevcdsp_template.c |   56 
 ++---
  x86/hevc_mc.asm|   42 +--
  x86/hevcdsp.h  |6 ++---
  x86/hevcdsp_init.c |   12 +--
  6 files changed, 64 insertions(+), 69 deletions(-)
 9110391cb7b08816698b8d0776bc59685d1edab6  
 0003-hevcdsp-remove-more-instances-of-compile-time-fixed-.patch
 From 73c99b093fb6c74706ac311b76bd0f4afb61f550 Mon Sep 17 00:00:00 2001
 From: Christophe Gisquet christophe.gisq...@gmail.com
 Date: Mon, 28 Jul 2014 12:13:06 +0200
 Subject: [PATCH 3/4] hevcdsp: remove more instances of compile-time-fixed
  parameters

applied

thanks

[...]
-- 
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] x86: hevcdsp: use compilation-time-fixed constant

2014-08-22 Thread Michael Niedermayer
On Mon, Jul 28, 2014 at 05:17:28PM +, Christophe Gisquet wrote:
 The stride for some buffers is known.
 ---
  libavcodec/x86/hevc_mc.asm | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

applied

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
100% positive feedback - All either got their money back or didnt complain
Best seller ever, very honest - Seller refunded buyer after failed scam


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


Re: [FFmpeg-devel] [PATCH 0/4] Exploit compile-time constant

2014-08-22 Thread Michael Niedermayer
On Fri, Aug 22, 2014 at 02:04:36PM +0200, Mickaël Raulet wrote:
 for the whole patchset.

all applied

thx

[...]
-- 
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] h264: Move AFD to side data to match MPEG-2

2014-08-22 Thread Christophe Gisquet
Hi,

2014-08-22 1:21 GMT+02:00 Christophe Gisquet christophe.gisq...@gmail.com:
 Maybe all that side data stuff should be moved to the end of the
 function first (but before the last thread-related line), and fixed,
 then you also add this hunk there?

Not a good thing to do either, after discussing with Michael. I'll
send a patch to change what is there at the moment, and you can model
your change from it.

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


[FFmpeg-devel] [PATCH] h264: do not return on sidedata allocation failure

2014-08-22 Thread Christophe Gisquet
Hi,

following [PATCH] h264: Move AFD to side data to match MPEG-2, it
was mentioned making sidedata allocation failures non-fatal.

This patch is a proposal for this.

-- 
Christophe
From 7092da22cf0efbdb0988810bd30c279d18388fdc Mon Sep 17 00:00:00 2001
From: Christophe Gisquet christophe.gisq...@gmail.com
Date: Fri, 22 Aug 2014 16:49:54 +0200
Subject: [PATCH] h264: do not return on sidedata allocation failure

Not having allocated it is not a good reason to leave the object
in an undetermined state. Though a particular setting like the
AV_EF_* flags could be useful to control that behaviour.
---
 libavcodec/h264.c | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 389307b..cfe627f 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -835,9 +835,7 @@ static void decode_postinit(H264Context *h, int setup_finished)
 h-content_interpretation_type  0 
 h-content_interpretation_type  3) {
 AVStereo3D *stereo = av_stereo3d_create_side_data(cur-f);
-if (!stereo)
-return;
-
+if (stereo) {
 switch (h-frame_packing_arrangement_type) {
 case 0:
 stereo-type = AV_STEREO3D_CHECKERBOARD;
@@ -867,6 +865,7 @@ static void decode_postinit(H264Context *h, int setup_finished)
 
 if (h-content_interpretation_type == 2)
 stereo-flags = AV_STEREO3D_FLAG_INVERT;
+}
 }
 
 if (h-sei_display_orientation_present 
@@ -875,12 +874,11 @@ static void decode_postinit(H264Context *h, int setup_finished)
 AVFrameSideData *rotation = av_frame_new_side_data(cur-f,
AV_FRAME_DATA_DISPLAYMATRIX,
sizeof(int32_t) * 9);
-if (!rotation)
-return;
-
-av_display_rotation_set((int32_t *)rotation-data, angle);
-av_display_matrix_flip((int32_t *)rotation-data,
-   h-sei_vflip, h-sei_hflip);
+if (rotation) {
+av_display_rotation_set((int32_t *)rotation-data, angle);
+av_display_matrix_flip((int32_t *)rotation-data,
+   h-sei_vflip, h-sei_hflip);
+}
 }
 
 cur-mmco_reset = h-mmco_reset;
-- 
1.9.2.msysgit.0

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


[FFmpeg-devel] [PATCH] Adds support for constant quality mode in VP9.

2014-08-22 Thread Deb Mukherjee
Changes in the parameter mapping for libvpx to support the constant
quality mode in VP9. The assumption in the patch is that if crf is
provided but bitrate is 0, then the 'constant quality' mode of VP9
is used. However if both are present, the 'constrained quality' mode
is used as before.
---
 libavcodec/libvpxenc.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 830a793..bc13f70 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -300,10 +300,15 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 enccfg.g_pass = VPX_RC_ONE_PASS;
 
 if (avctx-rc_min_rate == avctx-rc_max_rate 
-avctx-rc_min_rate == avctx-bit_rate  avctx-bit_rate)
+avctx-rc_min_rate == avctx-bit_rate  avctx-bit_rate) {
 enccfg.rc_end_usage = VPX_CBR;
-else if (ctx-crf)
+} else if (ctx-crf = 0) {
 enccfg.rc_end_usage = VPX_CQ;
+#if CONFIG_LIBVPX_VP9_ENCODER
+if (!avctx-bit_rate  avctx-codec_id == AV_CODEC_ID_VP9)
+enccfg.rc_end_usage = VPX_Q;
+#endif
+}
 
 if (avctx-bit_rate) {
 enccfg.rc_target_bitrate = av_rescale_rnd(avctx-bit_rate, 1, 1000,
@@ -311,7 +316,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 } else {
 if (enccfg.rc_end_usage == VPX_CQ) {
 enccfg.rc_target_bitrate = 100;
-} else {
+} else if (enccfg.rc_end_usage != VPX_Q) {
 avctx-bit_rate = enccfg.rc_target_bitrate * 1000;
 av_log(avctx, AV_LOG_WARNING,
Neither bitrate nor constrained quality specified, using 
default bitrate of %dkbit/sec\n,
@@ -324,7 +329,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 if (avctx-qmax = 0)
 enccfg.rc_max_quantizer = avctx-qmax;
 
-if (enccfg.rc_end_usage == VPX_CQ) {
+if (enccfg.rc_end_usage == VPX_CQ || enccfg.rc_end_usage == VPX_Q) {
 if (ctx-crf  enccfg.rc_min_quantizer || ctx-crf  
enccfg.rc_max_quantizer) {
 av_log(avctx, AV_LOG_ERROR,
CQ level must be between minimum and maximum quantizer 
value (%d-%d)\n,
@@ -430,7 +435,8 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 if (avctx-codec_id == AV_CODEC_ID_VP8)
 codecctl_int(avctx, VP8E_SET_TOKEN_PARTITIONS,  
av_log2(avctx-slices));
 codecctl_int(avctx, VP8E_SET_STATIC_THRESHOLD,  avctx-mb_threshold);
-codecctl_int(avctx, VP8E_SET_CQ_LEVEL,  ctx-crf);
+if (ctx-crf = 0)
+codecctl_int(avctx, VP8E_SET_CQ_LEVEL,  ctx-crf);
 if (ctx-max_intra_rate = 0)
 codecctl_int(avctx, VP8E_SET_MAX_INTRA_BITRATE_PCT, 
ctx-max_intra_rate);
 
@@ -775,7 +781,7 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket *pkt,
  by the bool decoder, meaning that partitions can be 
decoded even  \
  though earlier partitions have been lost. Note that 
intra predicition \
   is still done over the partition boundary.,   
0, AV_OPT_TYPE_CONST, {.i64 = VPX_ERROR_RESILIENT_PARTITIONS}, 0, 0, VE, er}, 
\
-{ crf,  Select the quality for constant quality mode, 
offsetof(VP8Context, crf), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 63, VE }, \
+{ crf,  Select the quality for constant quality mode, 
offsetof(VP8Context, crf), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 63, VE }, \
 
 #define LEGACY_OPTIONS \
 {speed, , offsetof(VP8Context, cpu_used), AV_OPT_TYPE_INT, {.i64 = 1}, 
-16, 16, VE}, \
-- 
2.1.0.rc2.206.gedb03e5

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


[FFmpeg-devel] [PATCH] Adds support for setting aq_mode in libvpx encoder

2014-08-22 Thread Deb Mukherjee
Sets aq_mode in the [0, 3] range for the libvpx encode wrapper.
0: none
1: variance aq
2: complexity aq
3: cyclic refresh aq
---
 doc/encoders.texi  | 5 -
 libavcodec/libvpxenc.c | 9 +
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 8df80c4..44b49ce 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1330,7 +1330,7 @@ ffmpeg -i INPUT -codec:v libtheora -b:v 1000k OUTPUT.ogg
 
 @section libvpx
 
-VP8 format supported through libvpx.
+VP8/VP9 format supported through libvpx.
 
 Requires the presence of the libvpx headers and library during configuration.
 You need to explicitly configure the build with @code{--enable-libvpx}.
@@ -1442,6 +1442,9 @@ g_lag_in_frames
 @item vp8flags error_resilient
 g_error_resilient
 
+@item aq_mode
+@code{VP9E_SET_AQ_MODE}
+
 @end table
 
 For more information about libvpx see:
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 830a793..43015d6 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -96,6 +96,7 @@ typedef struct VP8EncoderContext {
 int tile_columns;
 int tile_rows;
 int frame_parallel;
+int aq_mode;
 } VP8Context;
 
 /** String mappings for enum vp8e_enc_control_id */
@@ -123,6 +124,7 @@ static const char *const ctlidstr[] = {
 [VP9E_SET_TILE_COLUMNS]= VP9E_SET_TILE_COLUMNS,
 [VP9E_SET_TILE_ROWS]   = VP9E_SET_TILE_ROWS,
 [VP9E_SET_FRAME_PARALLEL_DECODING] = VP9E_SET_FRAME_PARALLEL_DECODING,
+[VP9E_SET_AQ_MODE] = VP9E_SET_AQ_MODE,
 #endif
 };
 
@@ -444,6 +446,8 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 codecctl_int(avctx, VP9E_SET_TILE_ROWS, ctx-tile_rows);
 if (ctx-frame_parallel = 0)
 codecctl_int(avctx, VP9E_SET_FRAME_PARALLEL_DECODING, 
ctx-frame_parallel);
+if (ctx-aq_mode = 0)
+codecctl_int(avctx, VP9E_SET_AQ_MODE, ctx-aq_mode);
 }
 #endif
 
@@ -803,6 +807,11 @@ static const AVOption vp9_options[] = {
 { tile-columns,Number of tile columns to use, log2, 
OFFSET(tile_columns),AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},
 { tile-rows,   Number of tile rows to use, log2,
OFFSET(tile_rows),   AV_OPT_TYPE_INT, {.i64 = -1}, -1, 2, VE},
 { frame-parallel,  Enable frame parallel decodability features, 
OFFSET(frame_parallel),  AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, VE},
+{ aq-mode, adaptive quantization mode,  
OFFSET(aq_mode), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 3, VE},
+{ none,NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 0}, 0, 0, VE, 
aq_mode }, \
+{ variance,NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 1}, 0, 0, VE, 
aq_mode }, \
+{ complexity,  NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 2}, 0, 0, VE, 
aq_mode }, \
+{ cyclic,  NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 3}, 0, 0, VE, 
aq_mode }, \
 LEGACY_OPTIONS
 { NULL }
 };
-- 
2.1.0.rc2.206.gedb03e5

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


Re: [FFmpeg-devel] [PATCH] Adds support for constant quality mode in VP9.

2014-08-22 Thread James Zern
On Fri, Aug 22, 2014 at 10:53 AM, Deb Mukherjee debar...@google.com wrote:
 [...]
 @@ -311,7 +316,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
  } else {
  if (enccfg.rc_end_usage == VPX_CQ) {
  enccfg.rc_target_bitrate = 100;
 -} else {
 +} else if (enccfg.rc_end_usage != VPX_Q) {

These still need to be protected as they're vp9-only and newer than
what configure tests for to enable vp8.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] vidstabutils: improve documentation

2014-08-22 Thread Michael Niedermayer
On Thu, Aug 21, 2014 at 07:12:10PM -0700, Timothy Gu wrote:
 Signed-off-by: Timothy Gu timothyg...@gmail.com
 ---
  libavfilter/vidstabutils.h | 17 ++---
  1 file changed, 14 insertions(+), 3 deletions(-)

both patches applied

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

The real ebay dictionary, page 2
100% positive feedback - All either got their money back or didnt complain
Best seller ever, very honest - Seller refunded buyer after failed scam


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


[FFmpeg-devel] [PATCH] Adds decode support for formats other than 420

2014-08-22 Thread Deb Mukherjee
Handles new VP9 profiles 1-3 with different color sampling and
bit-depths.
---
 libavcodec/libvpxdec.c | 69 +++---
 1 file changed, 60 insertions(+), 9 deletions(-)

diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
index 94e1e4d..7c397fb 100644
--- a/libavcodec/libvpxdec.c
+++ b/libavcodec/libvpxdec.c
@@ -60,7 +60,58 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 return 0;
 }
 
-static int vp8_decode(AVCodecContext *avctx,
+// returns 0 on success, 1 on unsupported
+static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img) {
+int ret = 0;
+if (avctx-codec_id == AV_CODEC_ID_VP8) {
+if (img-fmt != VPX_IMG_FMT_I420)
+return 1;
+}
+switch (img-fmt) {
+case VPX_IMG_FMT_I420:
+avctx-pix_fmt = AV_PIX_FMT_YUV420P;
+break;
+case VPX_IMG_FMT_I422:
+avctx-pix_fmt = AV_PIX_FMT_YUV422P;
+break;
+case VPX_IMG_FMT_I444:
+avctx-pix_fmt = AV_PIX_FMT_YUV444P;
+break;
+case VPX_IMG_FMT_I42016:
+if (img-bit_depth == 10) {
+avctx-pix_fmt = AV_PIX_FMT_YUV420P10LE;
+} else if (img-bit_depth == 12) {
+avctx-pix_fmt = AV_PIX_FMT_YUV420P12LE;
+} else {
+ret = 1;
+}
+break;
+case VPX_IMG_FMT_I42216:
+if (img-bit_depth == 10) {
+avctx-pix_fmt = AV_PIX_FMT_YUV422P10LE;
+} else if (img-bit_depth == 12) {
+avctx-pix_fmt = AV_PIX_FMT_YUV422P12LE;
+} else {
+ret = 1;
+}
+break;
+case VPX_IMG_FMT_I44416:
+if (img-bit_depth == 10) {
+avctx-pix_fmt = AV_PIX_FMT_YUV444P10LE;
+} else if (img-bit_depth == 12) {
+avctx-pix_fmt = AV_PIX_FMT_YUV444P12LE;
+} else {
+ret = 1;
+}
+break;
+default:
+ret = 1;
+break;
+}
+return ret;
+}
+
+static int vpx_decode(AVCodecContext *avctx,
   void *data, int *got_frame, AVPacket *avpkt)
 {
 VP8Context *ctx = avctx-priv_data;
@@ -82,9 +133,9 @@ static int vp8_decode(AVCodecContext *avctx,
 }
 
 if ((img = vpx_codec_get_frame(ctx-decoder, iter))) {
-if (img-fmt != VPX_IMG_FMT_I420) {
-av_log(avctx, AV_LOG_ERROR, Unsupported output colorspace (%d)\n,
-   img-fmt);
+if (set_pix_fmt(avctx, img)) {
+av_log(avctx, AV_LOG_ERROR, Unsupported output colorspace (%d) / 
bit_depth (%d)\n,
+   img-fmt, img-bit_depth);
 return AVERROR_INVALIDDATA;
 }
 
@@ -104,7 +155,7 @@ static int vp8_decode(AVCodecContext *avctx,
 return avpkt-size;
 }
 
-static av_cold int vp8_free(AVCodecContext *avctx)
+static av_cold int vpx_free(AVCodecContext *avctx)
 {
 VP8Context *ctx = avctx-priv_data;
 vpx_codec_destroy(ctx-decoder);
@@ -124,8 +175,8 @@ AVCodec ff_libvpx_vp8_decoder = {
 .id = AV_CODEC_ID_VP8,
 .priv_data_size = sizeof(VP8Context),
 .init   = vp8_init,
-.close  = vp8_free,
-.decode = vp8_decode,
+.close  = vpx_free,
+.decode = vpx_decode,
 .capabilities   = CODEC_CAP_AUTO_THREADS | CODEC_CAP_DR1,
 };
 #endif /* CONFIG_LIBVPX_VP8_DECODER */
@@ -143,8 +194,8 @@ AVCodec ff_libvpx_vp9_decoder = {
 .id = AV_CODEC_ID_VP9,
 .priv_data_size = sizeof(VP8Context),
 .init   = vp9_init,
-.close  = vp8_free,
-.decode = vp8_decode,
+.close  = vpx_free,
+.decode = vpx_decode,
 .capabilities   = CODEC_CAP_AUTO_THREADS | CODEC_CAP_DR1,
 .init_static_data = ff_vp9_init_static,
 };
-- 
2.1.0.rc2.206.gedb03e5

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


Re: [FFmpeg-devel] [PATCH] Adds support for constant quality mode in VP9.

2014-08-22 Thread Timothy Gu
On Aug 22, 2014 1:29 PM, Debargha Mukherjee debar...@google.com wrote:

 Unless the codec is VP9, VPX_Q will not be set. So the behavior does not
 change for VP8.

If it's not set, then the code won't compile with older libvpx.

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


Re: [FFmpeg-devel] [RFC] [PATCH] hevc_ps: reorder SPS reading to allow some errors

2014-08-22 Thread Michael Niedermayer
On Thu, Aug 21, 2014 at 10:07:23PM -0700, Timothy Gu wrote:
 On Aug 21, 2014 10:14 AM, Christophe Gisquet christophe.gisq...@gmail.com
 wrote:
 
  Hi,
 
  2014-08-21 3:06 GMT+02:00 Michael Niedermayer michae...@gmx.at:
   heres a narrower solution for this file
   not sure its better
   i can apply whichever you prefer, probably we wont find out which
   is the best solution before pushing something and waiting for more
   bug reports
 
  Thanks for narrowing it done, and now I have dug it further.
 
  When you look at what get parsed before that,
  vui-def_disp_win.left_offset gets an insane value unrelated to the
  video dimensions. I tried  instead to do as if
  vui-default_display_window_flag and related syntax does not exist.
 
  Then, the timing info is decoded, and the values are actually normal:
  vui_num_units_in_tick = 1000
  vui_time_scale = 23976
  (rest less relevant and meaningfull)
 
  So I think the actual bug in that stream is that it does not contain
  any default_display_window information. Why is that? Probably because
  the encoder writes an older VUI syntax, and several bits get
  misinterpreted. By luck they don't bother us. It would be nice to know
  what syntax is used, but there could be so many variations...
 
  The attached therefore barely improves on your patch.
 
  -int sar_present;
  +GetBitContext backup;
  +int sar_present, alt = 1;
 
 Shouldn't alt be initialized to 0?

fixed

thanks

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

Avoid a single point of failure, be that a person or equipment.


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


Re: [FFmpeg-devel] [PATCH] Adds decode support for formats other than 420

2014-08-22 Thread Reimar Döffinger
On 22.08.2014, at 22:31, Deb Mukherjee debar...@google.com wrote:
 +// returns 0 on success, 1 on unsupported

Please choose one of the standard ways, either 1 for success and 0 failure, or 
negative failure, 0 or positive success. This variant, at least in the context 
of FFmpeg, is just confusing/misleading
Though potentially just returning the pixfmt and using an invalid value on 
error might work out even better, but not sure and I don't have a strong 
opinion on that.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Adds decode support for formats other than 420

2014-08-22 Thread James Almer
On 22/08/14 5:31 PM, Deb Mukherjee wrote:
 Handles new VP9 profiles 1-3 with different color sampling and
 bit-depths.
 ---
  libavcodec/libvpxdec.c | 69 
 +++---
  1 file changed, 60 insertions(+), 9 deletions(-)
 
 diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
 index 94e1e4d..7c397fb 100644
 --- a/libavcodec/libvpxdec.c
 +++ b/libavcodec/libvpxdec.c
 @@ -60,7 +60,58 @@ static av_cold int vpx_init(AVCodecContext *avctx,
  return 0;
  }
  
 -static int vp8_decode(AVCodecContext *avctx,
 +// returns 0 on success, 1 on unsupported

0 on success, AVERROR_INVALIDDATA otherwise.

 +static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img) {
 +int ret = 0;

No need for this variable. Just return the corresponding value directly.

 +if (avctx-codec_id == AV_CODEC_ID_VP8) {
 +if (img-fmt != VPX_IMG_FMT_I420)
 +return 1;
 +}
 +switch (img-fmt) {
 +case VPX_IMG_FMT_I420:
 +avctx-pix_fmt = AV_PIX_FMT_YUV420P;
 +break;
 +case VPX_IMG_FMT_I422:
 +avctx-pix_fmt = AV_PIX_FMT_YUV422P;
 +break;
 +case VPX_IMG_FMT_I444:
 +avctx-pix_fmt = AV_PIX_FMT_YUV444P;
 +break;
 +case VPX_IMG_FMT_I42016:

Fails to compile with libvpx 1.3.0 and older.

A quick solution would be to check if VPX_IMG_FMT_HIGH is defined and put all 
these inside pre-processor guards.

 +if (img-bit_depth == 10) {
 +avctx-pix_fmt = AV_PIX_FMT_YUV420P10LE;
 +} else if (img-bit_depth == 12) {
 +avctx-pix_fmt = AV_PIX_FMT_YUV420P12LE;
 +} else {
 +ret = 1;
 +}
 +break;
 +case VPX_IMG_FMT_I42216:
 +if (img-bit_depth == 10) {
 +avctx-pix_fmt = AV_PIX_FMT_YUV422P10LE;
 +} else if (img-bit_depth == 12) {
 +avctx-pix_fmt = AV_PIX_FMT_YUV422P12LE;
 +} else {
 +ret = 1;
 +}
 +break;
 +case VPX_IMG_FMT_I44416:
 +if (img-bit_depth == 10) {
 +avctx-pix_fmt = AV_PIX_FMT_YUV444P10LE;
 +} else if (img-bit_depth == 12) {
 +avctx-pix_fmt = AV_PIX_FMT_YUV444P12LE;
 +} else {
 +ret = 1;
 +}
 +break;
 +default:
 +ret = 1;
 +break;
 +}
 +return ret;
 +}
 +
 +static int vpx_decode(AVCodecContext *avctx,
void *data, int *got_frame, AVPacket *avpkt)
  {
  VP8Context *ctx = avctx-priv_data;
 @@ -82,9 +133,9 @@ static int vp8_decode(AVCodecContext *avctx,
  }
  
  if ((img = vpx_codec_get_frame(ctx-decoder, iter))) {
 -if (img-fmt != VPX_IMG_FMT_I420) {
 -av_log(avctx, AV_LOG_ERROR, Unsupported output colorspace 
 (%d)\n,
 -   img-fmt);
 +if (set_pix_fmt(avctx, img)) {

if ((ret = set_pix_fmt(avctx, img))  0)

Then use return ret; below to propagate the value returned by set_pix_fmt();

 +av_log(avctx, AV_LOG_ERROR, Unsupported output colorspace (%d) 
 / bit_depth (%d)\n,
 +   img-fmt, img-bit_depth);

Same here, bit_depth is not available in the vpx_image struct in libvpx = 
1.3.0.
Either remove it, or hardcode an 8 if VPX_IMG_FMT_HIGH is not defined.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/showcqt: add fontcolor option

2014-08-22 Thread Muhammad Faiz
On Thu, Aug 21, 2014 at 7:33 AM, Muhammad Faiz mfc...@gmail.com wrote:

 On Thu, Aug 21, 2014 at 3:49 AM, Clément Bœsch u...@pkh.me wrote:

 On Wed, Aug 20, 2014 at 07:10:56AM +0700, Muhammad Faiz wrote:
 [...]
  +static double r_func(void *p, double x)
  +{
  +x = av_clipd(x, 0.0, 1.0);
  +return (int)(x*255.0+0.5)  16;

 You can probably use lrint() here:
 return lrint(av_clipd(x, 0.0, 1.0) * 255.0)  16;

 I don't think so. According to libc doc, lrint round to integer according
 to rounding mode, so sometimes it doesn't round to nearest.


  +av_expr_free(fontcolor_expr);
   av_expr_free(volume_expr);
   av_expr_free(tlength_expr);

 drop these 3 lines...

   end_time = av_gettime_relative();
  @@ -482,6 +515,12 @@ static int config_output(AVFilterLink *outlink)
   outlink-time_base = av_make_q(1, s-fps);
   outlink-frame_rate = av_make_q(s-fps, 1);

   return 0;

 ...drop this line as well...

  +
  +eval_error:

 ...and rename this to out or something more generic

  +av_expr_free(fontcolor_expr);
  +av_expr_free(volume_expr);
  +av_expr_free(tlength_expr);
  +return ret;
   }
 

 It's just programming style. And there are more lines that should be
 changed:
 s-outpicref = ff_get_video_buffer(outlink, outlink-w, outlink-h);
 if (!s-outpicref)
 return AVERROR(ENOMEM);

 s-spectogram = av_calloc(spectogram_height,
 s-outpicref-linesize[0]);
 if (!s-spectogram)
 return AVERROR(ENOMEM);


  Please bump libavfilter/version.h micro and I'll probably apply this
 version.

 Incremented.

 Thank's
 Muhammad Faiz


Update patch to the latest master branch.

Thank's.

Muhammad Faiz

---
 doc/filters.texi  |  26 
 libavfilter/avf_showcqt.c | 102 --
 libavfilter/version.h |   2 +-
 3 files changed, 98 insertions(+), 32 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 8badc54..41a924a 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10660,6 +10660,26 @@ Default value is @code{3.0}.
 @item fontfile
 Specify font file for use with freetype. If not specified, use embedded font.
 
+@item fontcolor
+Specify font color expression. This is arithmetic expression that should return
+integer value 0xRRGGBB. The expression can contain variables:
+@table @option
+@item frequency, freq, f
+the frequency where transform is evaluated
+@item timeclamp, tc
+value of timeclamp option
+@end table
+and functions:
+@table @option
+@item midi(f)
+midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
+@item r(x), g(x), b(x)
+red, green, and blue value of intensity x
+@end table
+Default value is @code{st(0, (midi(f)-59.5)/12);
+st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
+r(1-ld(1)) + b(ld(1))}
+
 @item fullhd
 If set to 1 (the default), the video size is 1920x1080 (full HD),
 if set to 0, the video size is 960x540. Use this option to make CPU usage 
lower.
@@ -10721,6 +10741,12 @@ Lower Q factor
 tlength=100/f*tc/(100/f+tc)
 @end example
 
+@item
+Custom fontcolor, C-note is colored green, others are colored blue
+@example
+fontcolor='if(mod(floor(midi(f)+0.5),12), 0xFF, g(1))'
+@end example
+
 @end itemize
 
 @section showspectrum
diff --git a/libavfilter/avf_showcqt.c b/libavfilter/avf_showcqt.c
index 012362b..e650f74 100644
--- a/libavfilter/avf_showcqt.c
+++ b/libavfilter/avf_showcqt.c
@@ -54,6 +54,9 @@
 #define TLENGTH_DEFAULT 384/f*tc/(384/f+tc)
 #define VOLUME_MIN 1e-10
 #define VOLUME_MAX 100.0
+#define FONTCOLOR_DEFAULT st(0, (midi(f)-59.5)/12); \
+st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0)); \
+r(1-ld(1)) + b(ld(1))
 
 typedef struct {
 FFTSample value;
@@ -73,7 +76,7 @@ typedef struct {
 uint8_t *font_alpha;
 char *fontfile; /* using freetype */
 int coeffs_len[VIDEO_WIDTH];
-uint8_t font_color[VIDEO_WIDTH];
+uint8_t fontcolor_value[VIDEO_WIDTH*3];  /* result of fontcolor option */
 int64_t frame_count;
 int spectogram_count;
 int spectogram_index;
@@ -82,6 +85,7 @@ typedef struct {
 int remaining_fill;
 char *tlength;
 char *volume;
+char *fontcolor;
 double timeclamp;   /* lower timeclamp, time-accurate, higher timeclamp, 
freq-accurate (at low freq)*/
 float coeffclamp;   /* lower coeffclamp, more precise, higher coeffclamp, 
faster */
 int fullhd; /* if true, output video is at full HD resolution, 
otherwise it will be halved */
@@ -103,6 +107,7 @@ static const AVOption showcqt_options[] = {
 { fps, set video fps, OFFSET(fps), AV_OPT_TYPE_INT, { .i64 = 25 }, 10, 
100, FLAGS },
 { count, set number of transform per frame, OFFSET(count), 
AV_OPT_TYPE_INT, { .i64 = 6 }, 1, 30, FLAGS },
 { fontfile, set font file, OFFSET(fontfile), AV_OPT_TYPE_STRING, { 
.str = NULL }, CHAR_MIN, CHAR_MAX, FLAGS },
+{ fontcolor, set font color, OFFSET(fontcolor), AV_OPT_TYPE_STRING, { 
.str = 

Re: [FFmpeg-devel] [PATCH] h264: do not return on sidedata allocation failure

2014-08-22 Thread Michael Niedermayer
On Fri, Aug 22, 2014 at 04:57:35PM +0200, Christophe Gisquet wrote:
 Hi,
 
 following [PATCH] h264: Move AFD to side data to match MPEG-2, it
 was mentioned making sidedata allocation failures non-fatal.
 
 This patch is a proposal for this.
 
 -- 
 Christophe

  h264.c |   16 +++-
  1 file changed, 7 insertions(+), 9 deletions(-)
 61b22a11c4da578ae8f65225ae5fa1de6633548d  
 0001-h264-do-not-return-on-sidedata-allocation-failure.patch
 From 7092da22cf0efbdb0988810bd30c279d18388fdc Mon Sep 17 00:00:00 2001
 From: Christophe Gisquet christophe.gisq...@gmail.com
 Date: Fri, 22 Aug 2014 16:49:54 +0200
 Subject: [PATCH] h264: do not return on sidedata allocation failure
 
 Not having allocated it is not a good reason to leave the object
 in an undetermined state. Though a particular setting like the
 AV_EF_* flags could be useful to control that behaviour.

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 3
Rare item - Common item with rare defect or maybe just a lie
Professional - 'Toy' made in china, not functional except as doorstop
Experts will know - The seller hopes you are not an expert


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


Re: [FFmpeg-devel] [PATCH] Adds support for setting aq_mode in libvpx encoder

2014-08-22 Thread James Almer
On 22/08/14 3:25 PM, Deb Mukherjee wrote:
 @@ -803,6 +807,11 @@ static const AVOption vp9_options[] = {
  { tile-columns,Number of tile columns to use, log2, 
 OFFSET(tile_columns),AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},
  { tile-rows,   Number of tile rows to use, log2,
 OFFSET(tile_rows),   AV_OPT_TYPE_INT, {.i64 = -1}, -1, 2, VE},
  { frame-parallel,  Enable frame parallel decodability features, 
 OFFSET(frame_parallel),  AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, VE},
 +{ aq-mode, adaptive quantization mode,  
 OFFSET(aq_mode), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 3, VE},

This one needs aq_mode after VE as well. Otherwise none of the constants 
below will work for it.

 +{ none,NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 0}, 0, 0, VE, 
 aq_mode }, \
 +{ variance,NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 1}, 0, 0, VE, 
 aq_mode }, \
 +{ complexity,  NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 2}, 0, 0, VE, 
 aq_mode }, \
 +{ cyclic,  NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 3}, 0, 0, VE, 
 aq_mode }, \

Instead of NULL you could write a short description for each of them.

  LEGACY_OPTIONS
  { NULL }
  };
 

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


[FFmpeg-devel] [PATCH] lavc/tiff: add support for LZMA compression

2014-08-22 Thread James Almer
Derived from deflate code.
Requires liblzma.

Signed-off-by: James Almer jamr...@gmail.com
---
 Changelog |  1 +
 configure |  5 +++-
 libavcodec/tiff.c | 85 +--
 3 files changed, 88 insertions(+), 3 deletions(-)

diff --git a/Changelog b/Changelog
index 6260d0c..40d3c79 100644
--- a/Changelog
+++ b/Changelog
@@ -7,6 +7,7 @@ version next:
 - large optimizations in dctdnoiz to make it usable
 - request icecast metadata by default
 - support for using metadata in stream specifiers in fftools
+- LZMA compression support in TIFF decoder
 
 
 version 2.3:
diff --git a/configure b/configure
index ffd0436..5af9d36 100755
--- a/configure
+++ b/configure
@@ -253,6 +253,7 @@ External library support:
native MPEG-4/Xvid encoder exists [no]
   --enable-libzmq  enable message passing via libzmq [no]
   --enable-libzvbi enable teletext support via libzvbi [no]
+  --disable-lzma   disable lzma [autodetect]
   --enable-decklinkenable Blackmagick DeckLink output [no]
   --enable-openal  enable OpenAL 1.1 capture support [no]
   --enable-opencl  enable OpenCL code
@@ -1380,6 +1381,7 @@ EXTERNAL_LIBRARY_LIST=
 libxvid
 libzmq
 libzvbi
+lzma
 openal
 opencl
 opengl
@@ -2187,7 +2189,7 @@ svq3_decoder_suggest=zlib
 tak_decoder_select=audiodsp
 theora_decoder_select=vp3_decoder
 thp_decoder_select=mjpeg_decoder
-tiff_decoder_suggest=zlib
+tiff_decoder_suggest=zlib lzma
 tiff_encoder_suggest=zlib
 truehd_decoder_select=mlp_parser
 truemotion2_decoder_select=bswapdsp
@@ -4758,6 +4760,7 @@ fi
 
 disabled  zlib || check_lib   zlib.h  zlibVersion -lz   || disable  zlib
 disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
+disabled  lzma || check_lib2  lzma.h lzma_version_number -llzma || disable lzma
 
 check_lib math.h sin -lm  LIBM=-lm
 disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h 
DtsCrystalHDVersion -lcrystalhd || disable crystalhd
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 2bb7c90..613ad3d 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -28,6 +28,9 @@
 #if CONFIG_ZLIB
 #include zlib.h
 #endif
+#if CONFIG_LZMA
+#include lzma.h
+#endif
 
 #include libavutil/attributes.h
 #include libavutil/avstring.h
@@ -378,6 +381,70 @@ static int tiff_unpack_zlib(TiffContext *s, AVFrame *p, 
uint8_t *dst, int stride
 }
 #endif
 
+#if CONFIG_LZMA
+static int tiff_uncompress_lzma(uint8_t *dst, uint64_t *len, const uint8_t 
*src,
+int size)
+{
+lzma_stream stream = LZMA_STREAM_INIT;
+lzma_ret ret;
+
+stream.next_in   = (uint8_t *)src;
+stream.avail_in  = size;
+stream.next_out  = dst;
+stream.avail_out = *len;
+ret  = lzma_stream_decoder(stream, UINT64_MAX, 0);
+if (ret != LZMA_OK) {
+av_log(NULL, AV_LOG_ERROR, LZMA init error: %d\n, ret);
+return ret;
+}
+ret = lzma_code(stream, LZMA_RUN);
+lzma_end(stream);
+*len = stream.total_out;
+return ret == LZMA_STREAM_END ? LZMA_OK : ret;
+}
+
+static int tiff_unpack_lzma(TiffContext *s, AVFrame *p, uint8_t *dst, int 
stride,
+const uint8_t *src, int size, int width, int lines,
+int strip_start, int is_yuv)
+{
+uint64_t outlen = width * lines;
+int ret, line;
+uint8_t *buf = av_malloc(outlen);
+if (!buf)
+return AVERROR(ENOMEM);
+if (s-fill_order) {
+if ((ret = deinvert_buffer(s, src, size))  0) {
+av_free(buf);
+return ret;
+}
+src = s-deinvert_buf;
+}
+ret = tiff_uncompress_lzma(buf, outlen, src, size);
+if (ret != LZMA_OK) {
+av_log(s-avctx, AV_LOG_ERROR,
+   Uncompressing failed (%PRIu64 of %PRIu64) with error 
%d\n, outlen,
+   (uint64_t)width * lines, ret);
+av_free(buf);
+return AVERROR_UNKNOWN;
+}
+src = buf;
+for (line = 0; line  lines; line++) {
+if (s-bpp  8  s-avctx-pix_fmt == AV_PIX_FMT_PAL8) {
+horizontal_fill(s-bpp, dst, 1, src, 0, width, 0);
+} else {
+memcpy(dst, src, width);
+}
+if (is_yuv) {
+unpack_yuv(s, p, dst, strip_start + line);
+line += s-subsampling[1] - 1;
+}
+dst += stride;
+src += width;
+}
+av_free(buf);
+return 0;
+}
+#endif
 
 static int tiff_unpack_fax(TiffContext *s, uint8_t *dst, int stride,
const uint8_t *src, int size, int width, int lines)
@@ -457,6 +524,16 @@ static int tiff_unpack_strip(TiffContext *s, AVFrame *p, 
uint8_t *dst, int strid
 return AVERROR(ENOSYS);
 #endif
 }
+if (s-compr == TIFF_LZMA) {
+#if CONFIG_LZMA
+return tiff_unpack_lzma(s, p, dst, stride, src, size, width, lines,
+strip_start, is_yuv);
+#else
+