[FFmpeg-devel] [PATCH] proresenc_anatoliy: use put_sbits()

2015-04-18 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/proresenc_anatoliy.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
index bf6e671..cc98c66 100644
--- a/libavcodec/proresenc_anatoliy.c
+++ b/libavcodec/proresenc_anatoliy.c
@@ -156,8 +156,7 @@ typedef struct {
 
 static void encode_codeword(PutBitContext *pb, int val, int codebook)
 {
-unsigned int rice_order, exp_order, switch_bits, first_exp, exp, zeros,
-mask;
+unsigned int rice_order, exp_order, switch_bits, first_exp, exp, zeros;
 
 /* number of bits to switch between rice and exp golomb */
 switch_bits = codebook & 3;
@@ -174,10 +173,9 @@ static void encode_codeword(PutBitContext *pb, int val, 
int codebook)
 put_bits(pb, zeros, 0);
 put_bits(pb, exp + 1, val);
 } else if (rice_order) {
-mask = (1 << rice_order) - 1;
 put_bits(pb, (val >> rice_order), 0);
 put_bits(pb, 1, 1);
-put_bits(pb, rice_order, val & mask);
+put_sbits(pb, rice_order, val);
 } else {
 put_bits(pb, val, 0);
 put_bits(pb, 1, 1);
-- 
2.3.5

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


Re: [FFmpeg-devel] [PATCH 1/3] aaccoder: use put_sbits()

2015-04-18 Thread Michael Niedermayer
On Fri, Apr 17, 2015 at 11:29:42PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libavcodec/aaccoder.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

LGTM

thanks

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

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data


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


Re: [FFmpeg-devel] [PATCH 2/3] dcaenc: use put_sbits()

2015-04-18 Thread Michael Niedermayer
On Fri, Apr 17, 2015 at 11:29:43PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libavcodec/dcaenc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

LGTM

thanks

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

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus


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


Re: [FFmpeg-devel] [PATCH] proresenc_anatoliy: use put_sbits()

2015-04-18 Thread Michael Niedermayer
On Sat, Apr 18, 2015 at 04:33:56AM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libavcodec/proresenc_anatoliy.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)

LGTM

thanks

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


Re: [FFmpeg-devel] [PATCH 1/2] dca_xll: use av_clip_intp2()

2015-04-18 Thread Michael Niedermayer
On Sat, Apr 18, 2015 at 03:44:10AM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libavcodec/dca_xll.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

LGTM

thanks

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

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


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


Re: [FFmpeg-devel] [PATCH 2/2] adpcm: use av_clip_intp2()

2015-04-18 Thread Michael Niedermayer
On Sat, Apr 18, 2015 at 03:44:11AM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libavcodec/adpcm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

LGTM

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


[FFmpeg-devel] [PATCH] avutil/mips/generic_macros_msa: volatile doesnt need __

2015-04-18 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavutil/mips/generic_macros_msa.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/mips/generic_macros_msa.h 
b/libavutil/mips/generic_macros_msa.h
index d2fd87c..374382f 100644
--- a/libavutil/mips/generic_macros_msa.h
+++ b/libavutil/mips/generic_macros_msa.h
@@ -56,7 +56,7 @@
 uint8_t *dst_ptr_m = (uint8_t *) (pdst);  \
 uint64_t val_m = (val);   \
   \
-__asm__ __volatile__ (\
+__asm__ volatile (\
 "sd  %[val_m],  %[dst_ptr_m]  \n\t"   \
   \
 : [dst_ptr_m] "=m" (*dst_ptr_m)   \
@@ -73,7 +73,7 @@
 val0_m = (uint32_t) ((val) & 0x);  \
 val1_m = (uint32_t) (((val) >> 32) & 0x);  \
\
-__asm__ __volatile__ ( \
+__asm__ volatile ( \
 "usw  %[val0_m],  %[dst1_m]  \n\t" \
 "usw  %[val1_m],  %[dst2_m]  \n\t" \
\
-- 
1.7.9.5

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


Re: [FFmpeg-devel] [libav-devel] [PATCH] aacpsy: avoid norm_fac becoming NaN

2015-04-18 Thread Andreas Cadhalpun
On 18.04.2015 03:54, Luca Barbato wrote:
> if thr is really tiny norm_fac would be huge, not tiny. (or tiny and not
> huge depending if you look it before or after norm_fac = 1/norm_fac)

That depends. If band->thr is 0 this more or less means band->energy is 0
(band->thr is set to 'band->energy * 0.001258925f') and then
band->active_lines is set to 0 in calc_pe_3gpp.
Thus the problematic case is 0/0, which is undefined.

> Once you have a threshold 0 you could basically short circuit the whole
> loop

I'm not sure what a short circuit helps, when you get NaN?

> and the one below gets sort of funny since you have a 0 * Inf.

The one below isn't that funny, because norm_fac is already NaN.

> And while at it maybe it could be simplified like this (still not fully
> awake).

This simplification shouldn't change the behavior.

> @@ -685,8 +684,7 @@ static void psy_3gpp_analyze_channel(FFPsyContext
> *ctx, int channel,
>  if (active_lines > 0.0f)
>  band->thr = calc_reduced_thr_3gpp(band, 
> coeffs[g].min_snr, reduction);
>  pe += calc_pe_3gpp(band);
> -band->norm_fac = band->active_lines / band->thr;
> -norm_fac += band->norm_fac;
> +norm_fac += band->active_lines / band->thr;

Here you can still have 0/0.


Best regards,
Andreas

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


Re: [FFmpeg-devel] [libav-devel] [PATCH] aacpsy: avoid norm_fac becoming NaN

2015-04-18 Thread Andreas Cadhalpun
On 18.04.2015 04:40, Michael Niedermayer wrote:
> On Sat, Apr 18, 2015 at 12:55:08AM +0200, Andreas Cadhalpun wrote:
>> The problem is that minath is not the minimum, only close:
>> minath = ath(3410, ATH_ADD) = -5.24237967
>>  ath(3407, ATH_ADD) = -5.24241638
> 
> the exact location of the minimum depends on teh "add" value
> its around 3410 for add=0 and around 3407 for add=4

True.

> for fun, 3407.080774800152 is even closer than 3407 for add=4

Yes, but the ath function calculates with floats and thus is
inaccurate enough that it doesn't matter if the input is 3407
or 3407.1.

> but the "add" parameter should probably be user selectable

Currently ATH_ADD is a #define, but if that was made user selectable,
one could approximate the position of the minimum:
minath = ath(3410 - 0.733 * ATH_ADD, ATH_ADD)

> also if you want to prevent coeffs[].ath from becoming negative then

That isn't strictly required, because 0 is a valid value and is just
as bad as a negative one.
But I assume the model works better, if it uses something closer to the
minimum of the ath function.

> you have to check coeffs[].ath, as
> float rounding and optimizations can differ between platforms
> 
> you cannot even know for sure that
> ath(3407, ATH_ADD) == ath(i, ATH_ADD) when i == 3407
> 
> the value calculated with a constant can be calculated at build time
> but in the loop the code could have been optimized/factored/whatever
> by the compiler and produce different values as a result

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


Re: [FFmpeg-devel] [libav-devel] [PATCH] aacpsy: avoid norm_fac becoming NaN

2015-04-18 Thread Michael Niedermayer
On Sat, Apr 18, 2015 at 01:59:53PM +0200, Andreas Cadhalpun wrote:
> On 18.04.2015 04:40, Michael Niedermayer wrote:
> > On Sat, Apr 18, 2015 at 12:55:08AM +0200, Andreas Cadhalpun wrote:
> >> The problem is that minath is not the minimum, only close:
> >> minath = ath(3410, ATH_ADD) = -5.24237967
> >>  ath(3407, ATH_ADD) = -5.24241638
> > 
> > the exact location of the minimum depends on teh "add" value
> > its around 3410 for add=0 and around 3407 for add=4
> 
> True.
> 
> > for fun, 3407.080774800152 is even closer than 3407 for add=4
> 
> Yes, but the ath function calculates with floats and thus is
> inaccurate enough that it doesn't matter if the input is 3407
> or 3407.1.
> 
> > but the "add" parameter should probably be user selectable
> 
> Currently ATH_ADD is a #define, but if that was made user selectable,
> one could approximate the position of the minimum:
> minath = ath(3410 - 0.733 * ATH_ADD, ATH_ADD)
> 
> > also if you want to prevent coeffs[].ath from becoming negative then
> 
> That isn't strictly required, because 0 is a valid value and is just
> as bad as a negative one.

> But I assume the model works better, if it uses something closer to the
> minimum of the ath function.

thats more a question for claudio than me id say

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


[FFmpeg-devel] [PATCH] alsdec: ensure channel reordering is reversible

2015-04-18 Thread Andreas Cadhalpun
If the same idx is used for more than one i, at least one entry in
sconf->chan_pos remains uninitialized.

This can cause segmentation faults.

Signed-off-by: Andreas Cadhalpun 
---
 libavcodec/alsdec.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 65aa7d2..f85f1e8 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -358,10 +358,14 @@ static av_cold int read_specific_config(ALSDecContext 
*ctx)
 ctx->cs_switch = 1;
 
 for (i = 0; i < avctx->channels; i++) {
+sconf->chan_pos[i] = -1;
+}
+
+for (i = 0; i < avctx->channels; i++) {
 int idx;
 
 idx = get_bits(&gb, chan_pos_bits);
-if (idx >= avctx->channels) {
+if (idx >= avctx->channels || sconf->chan_pos[idx] != -1) {
 av_log(avctx, AV_LOG_WARNING, "Invalid channel reordering.\n");
 ctx->cs_switch = 0;
 break;
-- 
2.1.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Usecases of the AVIODir* API

2015-04-18 Thread Michael Niedermayer
On Sat, Apr 18, 2015 at 04:44:35AM +0200, Mariusz Szczepańczyk wrote:
> On Wed, Apr 8, 2015 at 8:15 PM, Michael Niedermayer 
> wrote:
> 
> > On Wed, Apr 08, 2015 at 07:58:19PM +0200, Mariusz Szczepańczyk wrote:
> > > On Wed, Apr 8, 2015 at 6:33 PM, Michael Niedermayer 
> > > wrote:
> > >
> > > > Hi
> > > >
> > > > Some people on IRC asked about the uses of the AVIODir* API and it
> > > > seems several developers do not know what the API is usefull for.
> > > >
> > > > I think this should be documented better
> > > >
> > > > also what can it be usefull for, random example:
> > > > A "file open" dialog in a player. Without such API in a ffmpeg lib
> > > > players would have to duplicate quite some code to list non local
> > > > files.
> > > >
> > > >
> > > Hi,
> > >
> > > where do you think such documentation should be added?
> > >
> > > Doxygen? doc/libavformat.texi?
> >

> > hmm, i dont know, you

i think this one was missing a word or had one too much ;)


> > doc/libavformat.texi seems very short so it feels out of place but a
> > link could maybe be added
> >
> > doxygen seems the better choice for the text itself
> > but maybe someone has better idea(s)
> >
> 
> Hey, I've written some docs. Sorry for the delay.

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato


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


[FFmpeg-devel] [PATCH] alsdec: validate time diff index

2015-04-18 Thread Andreas Cadhalpun
If begin is smaller than t, the subtraction 'begin -= t' wraps around,
because begin is unsigned. The same applies for end < t.

This causes segmentation faults.

Signed-off-by: Andreas Cadhalpun 
---
 libavcodec/alsdec.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index f85f1e8..ff6b6cf 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1290,8 +1290,16 @@ static int revert_channel_correlation(ALSDecContext 
*ctx, ALSBlockData *bd,
 
 if (ch[dep].time_diff_sign) {
 t  = -t;
+if (begin < t) {
+av_log(ctx->avctx, AV_LOG_ERROR, "begin %u smaller than 
time diff index %d.\n", begin, t);
+return AVERROR_INVALIDDATA;
+}
 begin -= t;
 } else {
+if (end < t) {
+av_log(ctx->avctx, AV_LOG_ERROR, "end %u smaller than time 
diff index %d.\n", end, t);
+return AVERROR_INVALIDDATA;
+}
 end   -= t;
 }
 
-- 
2.1.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] alsdec: ensure channel reordering is reversible

2015-04-18 Thread Michael Niedermayer
On Sat, Apr 18, 2015 at 06:31:36PM +0200, Andreas Cadhalpun wrote:
> If the same idx is used for more than one i, at least one entry in
> sconf->chan_pos remains uninitialized.
> 
> This can cause segmentation faults.
> 
> Signed-off-by: Andreas Cadhalpun 

applied

thanks

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

There will always be a question for which you do not know the correct answer.


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


Re: [FFmpeg-devel] [PATCH 1/2] dca_xll: use av_clip_intp2()

2015-04-18 Thread James Almer
On 18/04/15 7:14 AM, Michael Niedermayer wrote:
> On Sat, Apr 18, 2015 at 03:44:10AM -0300, James Almer wrote:
>> Signed-off-by: James Almer 
>> ---
>>  libavcodec/dca_xll.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> LGTM
> 
> thanks

Patchset pushed.

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


Re: [FFmpeg-devel] [PATCH 1/3] aaccoder: use put_sbits()

2015-04-18 Thread James Almer
On 18/04/15 7:06 AM, Michael Niedermayer wrote:
> On Fri, Apr 17, 2015 at 11:29:42PM -0300, James Almer wrote:
>> Signed-off-by: James Almer 
>> ---
>>  libavcodec/aaccoder.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> LGTM
> 
> thanks

Pushed the three oked so far.

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


[FFmpeg-devel] Help in understanding seeking behaviour of FFmpeg API on MP4 video with hint tracks

2015-04-18 Thread declan harrison
Hi

I need help understanding the internals of FFmpeg API seek call with
certain files.

Im using the ffmpeg libav* API in an appliaction that reduces the bitrate
of MP4 files.  The output MP4 file has 1 H264 video and 1 AAC audio track.

The application supports seeking on the input file to a specifc video frame
using
the seek API call.

I added some diagnostics to FFmpeg to help me see what happens during seek
calls.

So generally seeking works fine for me. I make seek API call on the video
track to a PTS and the MP4 demuxer
aligns its internal sample index pointers for each track, so the next time
demuxer reads for the next frame, it will
seek to  position the file pointer into the required offset to get the
required frame. The behaviour is predicatble
for input files that have audio and video tracks. So ffmpeg may 2 two
phyical file/stream seeks if it need to
locate the correct frame for audio and video.

However I have an issue when i Have an input flle with 6 tracks. 1 H264
Video track, 1 AAC audio
track, 2 Hint tracks (one for vidoe and audio), an OD track (has 1 sample)
and a Scenes track (which has 1 sample).

the layout of this file is ftyp-moov-mdat-free-free

When I perform the seek API call this time on this file, the MP4 demuxer as
expected aligns its internal sample index pointer for each track, so the
next time we request a frame from demuxer it will seek to the correct
postiion in the file to get the correct frame.

This works as expected, we seek into the correct  location in the file, and
align correctly for each of the other tracks.
Only 4 of the tracks have samples at the desired time, audio, video and
both hint tracks.

So application is able to start demuxing the frames from this seek time
(e.g. 1 second) for
all 4 tracks.

However after reading a certain amount of data another 2 seek requests are
made
internally by FFmpeg to a position in bothj of the Hint tracks at a time
unrelated
to the oriignal seek request e.g. 3 seconds.

Im at a loss to explain, why FFmpeg internally needs to perform these 2
addiitonal
seek requests into each of the hint tracks, when no other seek API call is
made.

Surely 1 seek request, results in at maximun 1 seek request per track.
However in this
case I have 2 seeks on the hint tracks.   The 'Scene'  and 'OD' track dont
have any sample
for this seek location.

Im hoping someone can explain, why this happens and how predictable it is?

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


Re: [FFmpeg-devel] [PATCH] alsdec: validate time diff index

2015-04-18 Thread Michael Niedermayer
On Sat, Apr 18, 2015 at 06:58:30PM +0200, Andreas Cadhalpun wrote:
> If begin is smaller than t, the subtraction 'begin -= t' wraps around,
> because begin is unsigned. The same applies for end < t.
> 
> This causes segmentation faults.
> 
> Signed-off-by: Andreas Cadhalpun 
> ---
>  libavcodec/alsdec.c | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
> index f85f1e8..ff6b6cf 100644
> --- a/libavcodec/alsdec.c
> +++ b/libavcodec/alsdec.c
> @@ -1290,8 +1290,16 @@ static int revert_channel_correlation(ALSDecContext 
> *ctx, ALSBlockData *bd,
>  
>  if (ch[dep].time_diff_sign) {
>  t  = -t;
> +if (begin < t) {
> +av_log(ctx->avctx, AV_LOG_ERROR, "begin %u smaller than 
> time diff index %d.\n", begin, t);
> +return AVERROR_INVALIDDATA;
> +}

begin is 1, t < 0 also the comparission is unsigned so t will overflow
in it

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

What does censorship reveal? It reveals fear. -- Julian Assange


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


Re: [FFmpeg-devel] [PATCH] alsdec: validate time diff index

2015-04-18 Thread Andreas Cadhalpun
On 18.04.2015 20:05, Michael Niedermayer wrote:
> On Sat, Apr 18, 2015 at 06:58:30PM +0200, Andreas Cadhalpun wrote:
>> If begin is smaller than t, the subtraction 'begin -= t' wraps around,
>> because begin is unsigned. The same applies for end < t.
>>
>> This causes segmentation faults.
>>
>> Signed-off-by: Andreas Cadhalpun 
>> ---
>>  libavcodec/alsdec.c | 8 
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
>> index f85f1e8..ff6b6cf 100644
>> --- a/libavcodec/alsdec.c
>> +++ b/libavcodec/alsdec.c
>> @@ -1290,8 +1290,16 @@ static int revert_channel_correlation(ALSDecContext 
>> *ctx, ALSBlockData *bd,
>>  
>>  if (ch[dep].time_diff_sign) {
>>  t  = -t;
>> +if (begin < t) {
>> +av_log(ctx->avctx, AV_LOG_ERROR, "begin %u smaller than 
>> time diff index %d.\n", begin, t);
>> +return AVERROR_INVALIDDATA;
>> +}
> 
> begin is 1, t < 0 also the comparission is unsigned so t will overflow
> in it

Sorry, I sent the wrong version of the patch. Fixed one attached.
The t < 0 case is not problematic for the subtraction.

Best regards,
Andreas

>From dac2280eae25081fa9bfd3c392cf9d7837c3a092 Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun 
Date: Sat, 18 Apr 2015 20:09:28 +0200
Subject: [PATCH] alsdec: validate time diff index

If begin is smaller than t, the subtraction 'begin -= t' wraps around,
because begin is unsigned. The same applies for end < t.

This causes segmentation faults.

Signed-off-by: Andreas Cadhalpun 
---
 libavcodec/alsdec.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index f85f1e8..e0453e9 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1290,8 +1290,16 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
 
 if (ch[dep].time_diff_sign) {
 t  = -t;
+if (t > 0 && begin < t) {
+av_log(ctx->avctx, AV_LOG_ERROR, "begin %u smaller than time diff index %d.\n", begin, t);
+return AVERROR_INVALIDDATA;
+}
 begin -= t;
 } else {
+if (t > 0 && end < t) {
+av_log(ctx->avctx, AV_LOG_ERROR, "end %u smaller than time diff index %d.\n", end, t);
+return AVERROR_INVALIDDATA;
+}
 end   -= t;
 }
 
-- 
2.1.4

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


[FFmpeg-devel] [PATCH] alsdec: limit avctx->bits_per_raw_sample to 32

2015-04-18 Thread Andreas Cadhalpun
avctx->bits_per_raw_sample is used in get_sbits_long, which only
supports up to 32 bits.

Signed-off-by: Andreas Cadhalpun 
---
 libavcodec/alsdec.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index e0453e9..8ecc47c 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1678,6 +1678,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
 avctx->sample_fmt  = sconf->resolution > 1
  ? AV_SAMPLE_FMT_S32 : AV_SAMPLE_FMT_S16;
 avctx->bits_per_raw_sample = (sconf->resolution + 1) * 8;
+if (avctx->bits_per_raw_sample > 32) {
+av_log(avctx, AV_LOG_ERROR, "Bits per raw sample %d larger than 
32.\n",
+   avctx->bits_per_raw_sample);
+ret = AVERROR_INVALIDDATA;
+goto fail;
+}
 }
 
 // set maximum Rice parameter for progressive decoding based on resolution
-- 
2.1.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/3] wavpackenc: use put_sbits()

2015-04-18 Thread Michael Niedermayer
On Fri, Apr 17, 2015 at 11:29:44PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libavcodec/wavpackenc.c | 10 +++---
>  1 file changed, 3 insertions(+), 7 deletions(-)

LGTM

thanks

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

No great genius has ever existed without some touch of madness. -- Aristotle


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


Re: [FFmpeg-devel] [PATCH] alsdec: validate time diff index

2015-04-18 Thread Michael Niedermayer
On Sat, Apr 18, 2015 at 08:13:30PM +0200, Andreas Cadhalpun wrote:
> On 18.04.2015 20:05, Michael Niedermayer wrote:
> > On Sat, Apr 18, 2015 at 06:58:30PM +0200, Andreas Cadhalpun wrote:
> >> If begin is smaller than t, the subtraction 'begin -= t' wraps around,
> >> because begin is unsigned. The same applies for end < t.
> >>
> >> This causes segmentation faults.
> >>
> >> Signed-off-by: Andreas Cadhalpun 
> >> ---
> >>  libavcodec/alsdec.c | 8 
> >>  1 file changed, 8 insertions(+)
> >>
> >> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
> >> index f85f1e8..ff6b6cf 100644
> >> --- a/libavcodec/alsdec.c
> >> +++ b/libavcodec/alsdec.c
> >> @@ -1290,8 +1290,16 @@ static int revert_channel_correlation(ALSDecContext 
> >> *ctx, ALSBlockData *bd,
> >>  
> >>  if (ch[dep].time_diff_sign) {
> >>  t  = -t;
> >> +if (begin < t) {
> >> +av_log(ctx->avctx, AV_LOG_ERROR, "begin %u smaller 
> >> than time diff index %d.\n", begin, t);
> >> +return AVERROR_INVALIDDATA;
> >> +}
> > 
> > begin is 1, t < 0 also the comparission is unsigned so t will overflow
> > in it
> 
> Sorry, I sent the wrong version of the patch. Fixed one attached.
> The t < 0 case is not problematic for the subtraction.
[...]
> @@ -1290,8 +1290,16 @@ static int revert_channel_correlation(ALSDecContext 
> *ctx, ALSBlockData *bd,
>  
>  if (ch[dep].time_diff_sign) {
>  t  = -t;
> +if (t > 0 && begin < t) {

time_diff_index is always positive, so t is always negative here
so this cant be true unless the context got corrupted or iam missing
something


> +av_log(ctx->avctx, AV_LOG_ERROR, "begin %u smaller than 
> time diff index %d.\n", begin, t);
> +return AVERROR_INVALIDDATA;
> +}
>  begin -= t;
>  } else {
> +if (t > 0 && end < t) {

and here t should always be > 0 so the test shouldnt be needed


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

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


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


Re: [FFmpeg-devel] [PATCH] alsdec: validate time diff index

2015-04-18 Thread Michael Niedermayer
On Sat, Apr 18, 2015 at 08:42:58PM +0200, Michael Niedermayer wrote:
> On Sat, Apr 18, 2015 at 08:13:30PM +0200, Andreas Cadhalpun wrote:
> > On 18.04.2015 20:05, Michael Niedermayer wrote:
> > > On Sat, Apr 18, 2015 at 06:58:30PM +0200, Andreas Cadhalpun wrote:
> > >> If begin is smaller than t, the subtraction 'begin -= t' wraps around,
> > >> because begin is unsigned. The same applies for end < t.
> > >>
> > >> This causes segmentation faults.
> > >>
> > >> Signed-off-by: Andreas Cadhalpun 
> > >> ---
> > >>  libavcodec/alsdec.c | 8 
> > >>  1 file changed, 8 insertions(+)
> > >>
> > >> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
> > >> index f85f1e8..ff6b6cf 100644
> > >> --- a/libavcodec/alsdec.c
> > >> +++ b/libavcodec/alsdec.c
> > >> @@ -1290,8 +1290,16 @@ static int 
> > >> revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
> > >>  
> > >>  if (ch[dep].time_diff_sign) {
> > >>  t  = -t;
> > >> +if (begin < t) {
> > >> +av_log(ctx->avctx, AV_LOG_ERROR, "begin %u smaller 
> > >> than time diff index %d.\n", begin, t);
> > >> +return AVERROR_INVALIDDATA;
> > >> +}
> > > 
> > > begin is 1, t < 0 also the comparission is unsigned so t will overflow
> > > in it
> > 
> > Sorry, I sent the wrong version of the patch. Fixed one attached.
> > The t < 0 case is not problematic for the subtraction.
> [...]
> > @@ -1290,8 +1290,16 @@ static int revert_channel_correlation(ALSDecContext 
> > *ctx, ALSBlockData *bd,
> >  
> >  if (ch[dep].time_diff_sign) {
> >  t  = -t;
> > +if (t > 0 && begin < t) {
> 
> time_diff_index is always positive, so t is always negative here
> so this cant be true unless the context got corrupted or iam missing
> something

or its uninitialized

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 


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


Re: [FFmpeg-devel] [PATCH] alsdec: validate time diff index

2015-04-18 Thread Michael Niedermayer
On Sat, Apr 18, 2015 at 08:47:08PM +0200, Michael Niedermayer wrote:
> On Sat, Apr 18, 2015 at 08:42:58PM +0200, Michael Niedermayer wrote:
> > On Sat, Apr 18, 2015 at 08:13:30PM +0200, Andreas Cadhalpun wrote:
> > > On 18.04.2015 20:05, Michael Niedermayer wrote:
> > > > On Sat, Apr 18, 2015 at 06:58:30PM +0200, Andreas Cadhalpun wrote:
> > > >> If begin is smaller than t, the subtraction 'begin -= t' wraps around,
> > > >> because begin is unsigned. The same applies for end < t.
> > > >>
> > > >> This causes segmentation faults.
> > > >>
> > > >> Signed-off-by: Andreas Cadhalpun 
> > > >> ---
> > > >>  libavcodec/alsdec.c | 8 
> > > >>  1 file changed, 8 insertions(+)
> > > >>
> > > >> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
> > > >> index f85f1e8..ff6b6cf 100644
> > > >> --- a/libavcodec/alsdec.c
> > > >> +++ b/libavcodec/alsdec.c
> > > >> @@ -1290,8 +1290,16 @@ static int 
> > > >> revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
> > > >>  
> > > >>  if (ch[dep].time_diff_sign) {
> > > >>  t  = -t;
> > > >> +if (begin < t) {
> > > >> +av_log(ctx->avctx, AV_LOG_ERROR, "begin %u 
> > > >> smaller than time diff index %d.\n", begin, t);
> > > >> +return AVERROR_INVALIDDATA;
> > > >> +}
> > > > 
> > > > begin is 1, t < 0 also the comparission is unsigned so t will overflow
> > > > in it
> > > 
> > > Sorry, I sent the wrong version of the patch. Fixed one attached.
> > > The t < 0 case is not problematic for the subtraction.
> > [...]
> > > @@ -1290,8 +1290,16 @@ static int 
> > > revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
> > >  
> > >  if (ch[dep].time_diff_sign) {
> > >  t  = -t;
> > > +if (t > 0 && begin < t) {
> > 
> > time_diff_index is always positive, so t is always negative here
> > so this cant be true unless the context got corrupted or iam missing
> > something
> 
> or its uninitialized

i see these get allocated without zeroing, no idea if thats related
to the issue but ill change the alloc as a precautionary meassure

[...]

-- 
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] alsdec: limit avctx->bits_per_raw_sample to 32

2015-04-18 Thread Michael Niedermayer
On Sat, Apr 18, 2015 at 08:29:13PM +0200, Andreas Cadhalpun wrote:
> avctx->bits_per_raw_sample is used in get_sbits_long, which only
> supports up to 32 bits.
> 
> Signed-off-by: Andreas Cadhalpun 
> ---
>  libavcodec/alsdec.c | 6 ++
>  1 file changed, 6 insertions(+)

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] [PATCH] alsdec: validate time diff index

2015-04-18 Thread Andreas Cadhalpun
On 18.04.2015 20:42, Michael Niedermayer wrote:
> On Sat, Apr 18, 2015 at 08:13:30PM +0200, Andreas Cadhalpun wrote:
>> @@ -1290,8 +1290,16 @@ static int revert_channel_correlation(ALSDecContext 
>> *ctx, ALSBlockData *bd,
>>  
>>  if (ch[dep].time_diff_sign) {
>>  t  = -t;
>> +if (t > 0 && begin < t) {
> 
> time_diff_index is always positive, so t is always negative here

I didn't verify this, but I added the 'begin < t' check only for symmetry
with the end case.

> so this cant be true unless the context got corrupted or iam missing
> something

If you're sure t is always negative here, this check can be dropped.

>> +av_log(ctx->avctx, AV_LOG_ERROR, "begin %u smaller than 
>> time diff index %d.\n", begin, t);
>> +return AVERROR_INVALIDDATA;
>> +}
>>  begin -= t;
>>  } else {
>> +if (t > 0 && end < t) {
> 
> and here t should always be > 0 so the test shouldnt be needed

I've only seen cases with t > 0, but the t > 0 check makes it explicit that
end < t is a comparison between unsigned variables. So I would leave it.

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


Re: [FFmpeg-devel] [PATCH] alsdec: validate time diff index

2015-04-18 Thread Michael Niedermayer
On Sat, Apr 18, 2015 at 09:13:30PM +0200, Andreas Cadhalpun wrote:
> On 18.04.2015 20:42, Michael Niedermayer wrote:
> > On Sat, Apr 18, 2015 at 08:13:30PM +0200, Andreas Cadhalpun wrote:
> >> @@ -1290,8 +1290,16 @@ static int revert_channel_correlation(ALSDecContext 
> >> *ctx, ALSBlockData *bd,
> >>  
> >>  if (ch[dep].time_diff_sign) {
> >>  t  = -t;
> >> +if (t > 0 && begin < t) {
> > 
> > time_diff_index is always positive, so t is always negative here
> 
> I didn't verify this, but I added the 'begin < t' check only for symmetry
> with the end case.
> 
> > so this cant be true unless the context got corrupted or iam missing
> > something
> 
> If you're sure t is always negative here, this check can be dropped.

maybe add a av_assert0() to protect againt future code changes


> 
> >> +av_log(ctx->avctx, AV_LOG_ERROR, "begin %u smaller 
> >> than time diff index %d.\n", begin, t);
> >> +return AVERROR_INVALIDDATA;
> >> +}
> >>  begin -= t;
> >>  } else {
> >> +if (t > 0 && end < t) {
> > 
> > and here t should always be > 0 so the test shouldnt be needed
> 
> I've only seen cases with t > 0, but the t > 0 check makes it explicit that
> end < t is a comparison between unsigned variables. So I would leave it.

sure, ok

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


[FFmpeg-devel] LFEScaleIndex larger than 127 is not implemented

2015-04-18 Thread Eugene Myronchuk
Hello Ffmpeg-devel,

  Just uploaded LFEScaleIndex-larger-than-127-is-not-implemented-example.dts то 
ftp://upload.ffmpeg.org/incoming/

Got this log during DTS decoding:

[dca @ 003b89c0] LFEScaleIndex larger than 127 is not implemented. 
Update your FFmpeg version to the newest one from Git. If the problem still 
occurs, it means that your file has a feature which has not been implemented.
[dca @ 003b89c0] If you want to help, upload a sample of this file to 
ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. 
(ffmpeg-devel@ffmpeg.org)
[dca @ 003b89c0] error decoding block
Error while decoding stream #0:0: Invalid data found when processing input

Hope this example will be useful

-- 
Best regards,
 Eugene  mailto:l...@ukr.net
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Patch for High color and High bit-depth support

2015-04-18 Thread James Zern
On Thu, Apr 16, 2015 at 6:19 PM, Debargha Mukherjee  wrote:
> Resolutions inline...
>
> From d84e140ed83bdc3889720e4a6af330198176b839 Mon Sep 17 00:00:00 2001
> From: Deb Mukherjee 
> Date: Wed, 25 Mar 2015 17:10:16 -0700
> Subject: [PATCH] Support for VP9 high-color/high-bit-depth encoding
>
> Patch to support VP9 encoding with new profiles 1-3.
> Profile 1 (8-bit 422/444) should work with default libvpx
> configuration.
> However you will need to configure libvpx with
> --enable-vp9-highbitdepth before building and linking
> with ffmpeg for profile 2 (10-/12-bit 420) and profile 3
> (10-/12-bit 422/444) encoding.
>
> You may use the appropriate profile option on the
> command line:
> -profile:v 1 for 422/444 8-bit encoding
> -profile:v 2 for 420 10-/12- bit encoding
> -profile:v 3 for 422/444 10-/12-bit encoding
> If you do not use the -profile:v option, it will be deduced
> from the source format.
> ---
>  libavcodec/libvpx.c| 47 +++-
>  libavcodec/libvpxenc.c | 85 
> --
>  2 files changed, 129 insertions(+), 3 deletions(-)
>

lgtm.

> diff --git a/libavcodec/libvpx.c b/libavcodec/libvpx.c
> index 5d29893..b432fe9 100644
> --- a/libavcodec/libvpx.c
> +++ b/libavcodec/libvpx.c
> @@ -19,12 +19,57 @@
>   */
>
>  #include 
> -
>  #include "libvpx.h"
> +#include "config.h"
> +
> +#if CONFIG_LIBVPX_VP9_ENCODER
> +#include 
> +#include 
> +#endif
> +
> +static const enum AVPixelFormat vp9_pix_fmts_def[] = {
> +AV_PIX_FMT_YUV420P,
> +AV_PIX_FMT_NONE
> +};
> +
> +#if CONFIG_LIBVPX_VP9_ENCODER
> +static const enum AVPixelFormat vp9_pix_fmts_highcol[] = {
> +AV_PIX_FMT_YUV420P,
> +AV_PIX_FMT_YUV422P,
> +AV_PIX_FMT_YUV444P,
> +AV_PIX_FMT_NONE
> +};
> +
> +static const enum AVPixelFormat vp9_pix_fmts_highbd[] = {
>

This one is only used when VPX_CODEC_CAP_HIGHBITDEPTH is defined, but I think
that's available in most cases with vp9 so should be all right.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] alsdec: ensure channel reordering is reversible

2015-04-18 Thread Thilo Borgmann
Am 18.04.15 um 19:12 schrieb Michael Niedermayer:
> On Sat, Apr 18, 2015 at 06:31:36PM +0200, Andreas Cadhalpun wrote:
>> If the same idx is used for more than one i, at least one entry in
>> sconf->chan_pos remains uninitialized.
>>
>> This can cause segmentation faults.
>>
>> Signed-off-by: Andreas Cadhalpun 
> 
> applied
> 
> thanks

Thanks!

-Thilo

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


Re: [FFmpeg-devel] [PATCH] alsdec: limit avctx->bits_per_raw_sample to 32

2015-04-18 Thread Thilo Borgmann
Am 18.04.15 um 21:11 schrieb Michael Niedermayer:
> On Sat, Apr 18, 2015 at 08:29:13PM +0200, Andreas Cadhalpun wrote:
>> avctx->bits_per_raw_sample is used in get_sbits_long, which only
>> supports up to 32 bits.
>>
>> Signed-off-by: Andreas Cadhalpun 
>> ---
>>  libavcodec/alsdec.c | 6 ++
>>  1 file changed, 6 insertions(+)
> 
> applied
> 
> thanks

Thanks!

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


Re: [FFmpeg-devel] [PATCH] alsdec: validate time diff index

2015-04-18 Thread Andreas Cadhalpun
On 18.04.2015 21:46, Michael Niedermayer wrote:
> On Sat, Apr 18, 2015 at 09:13:30PM +0200, Andreas Cadhalpun wrote:
>> On 18.04.2015 20:42, Michael Niedermayer wrote:
>>> On Sat, Apr 18, 2015 at 08:13:30PM +0200, Andreas Cadhalpun wrote:
 @@ -1290,8 +1290,16 @@ static int revert_channel_correlation(ALSDecContext 
 *ctx, ALSBlockData *bd,
  
  if (ch[dep].time_diff_sign) {
  t  = -t;
 +if (t > 0 && begin < t) {
>>>
>>> time_diff_index is always positive, so t is always negative here
>>
>> I didn't verify this, but I added the 'begin < t' check only for symmetry
>> with the end case.

I verified it now:
current->time_diff_index = get_bits(gb, ctx->ltp_lag_length - 3) + 3;
...
ctx->ltp_lag_length = 8 + (avctx->sample_rate >=  96000) +
  (avctx->sample_rate >= 192000);

So ltp_lag_length is at most 10, i.e. at most 7 bits are read for the
time_diff_index, so it is always positive.

>>> so this cant be true unless the context got corrupted or iam missing
>>> something
>>
>> If you're sure t is always negative here, this check can be dropped.
> 
> maybe add a av_assert0() to protect againt future code changes

I don't think an assert would be good here. If you want to protect against
future code changes, I would rather leave the error return.
But I'd also be fine with dropping this check altogether.
What do you prefer?

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


[FFmpeg-devel] [PATCH] avfilter/vf_colorkey: Add colorkey video filter

2015-04-18 Thread Timo Rothenpieler
---
 Changelog |   1 +
 MAINTAINERS   |   1 +
 libavfilter/Makefile  |   1 +
 libavfilter/allfilters.c  |   1 +
 libavfilter/vf_colorkey.c | 226 ++
 5 files changed, 230 insertions(+)
 create mode 100644 libavfilter/vf_colorkey.c

diff --git a/Changelog b/Changelog
index 2e30b24..e99d1e9 100644
--- a/Changelog
+++ b/Changelog
@@ -17,6 +17,7 @@ version :
 - WebM Live Chunk Muxer
 - nvenc level and tier options
 - chorus filter
+- colorkey video filter
 
 
 version 2.6:
diff --git a/MAINTAINERS b/MAINTAINERS
index 598c0b3..18f6ba3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -352,6 +352,7 @@ Filters:
   avf_showcqt.c Muhammad Faiz
   vf_blend.cPaul B Mahol
   vf_colorbalance.c Paul B Mahol
+  vf_colorkey.c Timo Rothenpieler
   vf_dejudder.c Nicholas Robbins
   vf_delogo.c   Jean Delvare (CC )
   vf_drawbox.c/drawgrid Andrey Utkin
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 48cee50..60e6b52 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -102,6 +102,7 @@ OBJS-$(CONFIG_BOXBLUR_FILTER)+= vf_boxblur.o
 OBJS-$(CONFIG_CODECVIEW_FILTER)  += vf_codecview.o
 OBJS-$(CONFIG_COLORBALANCE_FILTER)   += vf_colorbalance.o
 OBJS-$(CONFIG_COLORCHANNELMIXER_FILTER)  += vf_colorchannelmixer.o
+OBJS-$(CONFIG_COLORKEY_FILTER)   += vf_colorkey.o
 OBJS-$(CONFIG_COLORLEVELS_FILTER)+= vf_colorlevels.o
 OBJS-$(CONFIG_COLORMATRIX_FILTER)+= vf_colormatrix.o
 OBJS-$(CONFIG_COPY_FILTER)   += vf_copy.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 7961dca..2eeec7f 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -118,6 +118,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(CODECVIEW,  codecview,  vf);
 REGISTER_FILTER(COLORBALANCE,   colorbalance,   vf);
 REGISTER_FILTER(COLORCHANNELMIXER, colorchannelmixer, vf);
+REGISTER_FILTER(COLORKEY,   colorkey,   vf);
 REGISTER_FILTER(COLORLEVELS,colorlevels,vf);
 REGISTER_FILTER(COLORMATRIX,colormatrix,vf);
 REGISTER_FILTER(COPY,   copy,   vf);
diff --git a/libavfilter/vf_colorkey.c b/libavfilter/vf_colorkey.c
new file mode 100644
index 000..b5180cf
--- /dev/null
+++ b/libavfilter/vf_colorkey.c
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2015 Timo Rothenpieler 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/opt.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
+
+typedef struct ColorkeyContext {
+const AVClass *class;
+
+uint8_t colorkey_rgba[4];
+float cf[3];
+
+float similarity;
+float blend;
+} ColorkeyContext;
+
+static inline int convert_format(int fmt)
+{
+switch(fmt) {
+case AV_PIX_FMT_0RGB:
+return AV_PIX_FMT_ARGB;
+case AV_PIX_FMT_0BGR:
+return AV_PIX_FMT_ABGR;
+case AV_PIX_FMT_BGR0:
+return AV_PIX_FMT_BGRA;
+case AV_PIX_FMT_RGB0:
+return AV_PIX_FMT_RGBA;
+default:
+return fmt;
+}
+}
+
+static inline int offset_r(int fmt)
+{
+switch(fmt) {
+case AV_PIX_FMT_ARGB:
+return 1;
+case AV_PIX_FMT_ABGR:
+return 3;
+case AV_PIX_FMT_BGRA:
+return 2;
+case AV_PIX_FMT_RGBA:
+default:
+return 0;
+}
+}
+
+static inline int offset_g(int fmt)
+{
+switch(fmt) {
+case AV_PIX_FMT_ARGB:
+return 2;
+case AV_PIX_FMT_ABGR:
+return 2;
+case AV_PIX_FMT_BGRA:
+return 1;
+case AV_PIX_FMT_RGBA:
+default:
+return 1;
+}
+}
+
+static inline int offset_b(int fmt)
+{
+switch(fmt) {
+case AV_PIX_FMT_ARGB:
+return 3;
+case AV_PIX_FMT_ABGR:
+return 1;
+case AV_PIX_FMT_BGRA:
+return 0;
+case AV_PIX_FMT_RGBA:
+default:
+return 2;
+}
+}
+
+static inline int offset_a(int fmt)
+{
+switch(fmt) {
+case AV_PIX_FMT_ARGB:
+return 0;
+case AV_PIX_FMT_ABGR:
+return 0;
+case AV_

Re: [FFmpeg-devel] [libav-devel] [PATCH] aacpsy: avoid norm_fac becoming NaN

2015-04-18 Thread Andreas Cadhalpun
On 18.04.2015 21:46, Luca Barbato wrote:
> On 18/04/15 13:50, Andreas Cadhalpun wrote:
>> Here you can still have 0/0.
>>
> 
> I know, once you get a 0 you get completely out of the previous loop and
> you do not even enter in the other.
> 
> To sum up the problem, a way to tackle it is to calculate the limit of
> that expression and replace with that result whenever you get there.

I'm not sure a unique limit exists here.

> Another neat way is to figure out how many other values are 0 (thus my
> questions about how you get thr set to 0) and skip computation even before.

One could force coeffs[g].ath to be positive, e.g. by always adding a small
value to it. Then band->thr cannot be 0.

> That code needs to be reshaped a bit before even thinking about fixing
> it IMHO.

I think the crash should be fixed before a larger reshaping.

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


Re: [FFmpeg-devel] [libav-devel] [PATCH] alsdec: validate time diff index

2015-04-18 Thread Andreas Cadhalpun
On 18.04.2015 21:55, Luca Barbato wrote:
> On 18/04/15 18:58, Andreas Cadhalpun wrote:
>> If begin is smaller than t, the subtraction 'begin -= t' wraps around,
>> because begin is unsigned. The same applies for end < t.
> 
> Why that variable is unsigned?

Probably because it should never be negative.

>> This causes segmentation faults.
> 
> Do you have a sample to trigger it?

Yes, several.

Best regards,
Andreas

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


Re: [FFmpeg-devel] [PATCH] alsdec: validate time diff index

2015-04-18 Thread Michael Niedermayer
On Sat, Apr 18, 2015 at 10:28:53PM +0200, Andreas Cadhalpun wrote:
> On 18.04.2015 21:46, Michael Niedermayer wrote:
> > On Sat, Apr 18, 2015 at 09:13:30PM +0200, Andreas Cadhalpun wrote:
> >> On 18.04.2015 20:42, Michael Niedermayer wrote:
> >>> On Sat, Apr 18, 2015 at 08:13:30PM +0200, Andreas Cadhalpun wrote:
>  @@ -1290,8 +1290,16 @@ static int 
>  revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
>   
>   if (ch[dep].time_diff_sign) {
>   t  = -t;
>  +if (t > 0 && begin < t) {
> >>>
> >>> time_diff_index is always positive, so t is always negative here
> >>
> >> I didn't verify this, but I added the 'begin < t' check only for symmetry
> >> with the end case.
> 
> I verified it now:
> current->time_diff_index = get_bits(gb, ctx->ltp_lag_length - 3) + 3;
> ...
> ctx->ltp_lag_length = 8 + (avctx->sample_rate >=  96000) +
>   (avctx->sample_rate >= 192000);
> 
> So ltp_lag_length is at most 10, i.e. at most 7 bits are read for the
> time_diff_index, so it is always positive.
> 
> >>> so this cant be true unless the context got corrupted or iam missing
> >>> something
> >>
> >> If you're sure t is always negative here, this check can be dropped.
> > 
> > maybe add a av_assert0() to protect againt future code changes
> 
> I don't think an assert would be good here. If you want to protect against
> future code changes, I would rather leave the error return.
> But I'd also be fine with dropping this check altogether.
> What do you prefer?

whatever you prefer, the important part is to add checks where they
are needed

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator


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


Re: [FFmpeg-devel] LFEScaleIndex larger than 127 is not implemented

2015-04-18 Thread Michael Niedermayer
On Sat, Apr 18, 2015 at 09:35:09AM +0300, Eugene Myronchuk wrote:
> Hello Ffmpeg-devel,
> 
>   Just uploaded LFEScaleIndex-larger-than-127-is-not-implemented-example.dts 
> то ftp://upload.ffmpeg.org/incoming/
> 
> Got this log during DTS decoding:
> 
> [dca @ 003b89c0] LFEScaleIndex larger than 127 is not implemented. 
> Update your FFmpeg version to the newest one from Git. If the problem still 
> occurs, it means that your file has a feature which has not been implemented.
> [dca @ 003b89c0] If you want to help, upload a sample of this file to 
> ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. 
> (ffmpeg-devel@ffmpeg.org)
> [dca @ 003b89c0] error decoding block
> Error while decoding stream #0:0: Invalid data found when processing input
> 
> Hope this example will be useful

what is the source of this file ?
and what tool was used to extract it ?

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] avfilter/vf_colorkey: Add colorkey video filter

2015-04-18 Thread Timothy Gu
On Sat, Apr 18, 2015 at 1:30 PM Timo Rothenpieler 
wrote:

> ---
>  Changelog |   1 +
>  MAINTAINERS   |   1 +
>  libavfilter/Makefile  |   1 +
>  libavfilter/allfilters.c  |   1 +
>  libavfilter/vf_colorkey.c | 226
> ++
>  5 files changed, 230 insertions(+)
>  create mode 100644 libavfilter/vf_colorkey.c
>
What does this do? (Don't answer me in email, but write in in
doc/filters.texi.)

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


Re: [FFmpeg-devel] LFEScaleIndex larger than 127 is not implemented

2015-04-18 Thread Carl Eugen Hoyos
On Saturday 18 April 2015 08:35:09 am Eugene Myronchuk wrote:
>   Just uploaded
> LFEScaleIndex-larger-than-127-is-not-implemented-example.dts

I created ticket #4492, thank you for the sample!

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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_colorkey: Add colorkey video filter

2015-04-18 Thread Timo Rothenpieler
> What does this do? (Don't answer me in email, but write in in
> doc/filters.texi.)

Just noticed that git entirely removed my comments.

This is not (yet) for merging, but primarily a request for comments on
the implementation.
I'm sure this can be easily optimized quite a bit and also cleaned up in
the code.




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


Re: [FFmpeg-devel] [PATCH] alsdec: validate time diff index

2015-04-18 Thread Andreas Cadhalpun
On 18.04.2015 23:34, Michael Niedermayer wrote:
> On Sat, Apr 18, 2015 at 10:28:53PM +0200, Andreas Cadhalpun wrote:
>> I don't think an assert would be good here. If you want to protect against
>> future code changes, I would rather leave the error return.
>> But I'd also be fine with dropping this check altogether.
>> What do you prefer?
> 
> whatever you prefer, the important part is to add checks where they
> are needed

OK, then lets keep both checks as in the second patch I sent.

Best regards,
Andreas

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


[FFmpeg-devel] [PATCH] cmdutils: indent protocols listing

2015-04-18 Thread Lou Logan
For readability.

Signed-off-by: Lou Logan 
---
 cmdutils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cmdutils.c b/cmdutils.c
index e4e3bac..7126ce8 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -1535,10 +1535,10 @@ int show_protocols(void *optctx, const char *opt, const 
char *arg)
 printf("Supported file protocols:\n"
"Input:\n");
 while ((name = avio_enum_protocols(&opaque, 0)))
-printf("%s\n", name);
+printf("  %s\n", name);
 printf("Output:\n");
 while ((name = avio_enum_protocols(&opaque, 1)))
-printf("%s\n", name);
+printf("  %s\n", name);
 return 0;
 }
 
-- 
2.3.5

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


Re: [FFmpeg-devel] [PATCH] alsdec: validate time diff index

2015-04-18 Thread Michael Niedermayer
On Sun, Apr 19, 2015 at 12:20:01AM +0200, Andreas Cadhalpun wrote:
> On 18.04.2015 23:34, Michael Niedermayer wrote:
> > On Sat, Apr 18, 2015 at 10:28:53PM +0200, Andreas Cadhalpun wrote:
> >> I don't think an assert would be good here. If you want to protect against
> >> future code changes, I would rather leave the error return.
> >> But I'd also be fine with dropping this check altogether.
> >> What do you prefer?
> > 
> > whatever you prefer, the important part is to add checks where they
> > are needed
> 
> OK, then lets keep both checks as in the second patch I sent.

applied

thanks

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

No great genius has ever existed without some touch of madness. -- Aristotle


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


[FFmpeg-devel] [PATCH] avutil: remove pointless bmi1 define

2015-04-18 Thread James Almer
Signed-off-by: James Almer 
---
 libavutil/cpu.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index 1617464..765577d 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -115,8 +115,7 @@ int av_parse_cpu_flags(const char *s)
 #define CPUFLAG_FMA3 (AV_CPU_FLAG_FMA3 | CPUFLAG_AVX)
 #define CPUFLAG_FMA4 (AV_CPU_FLAG_FMA4 | CPUFLAG_AVX)
 #define CPUFLAG_AVX2 (AV_CPU_FLAG_AVX2 | CPUFLAG_AVX)
-#define CPUFLAG_BMI1 (AV_CPU_FLAG_BMI1)
-#define CPUFLAG_BMI2 (AV_CPU_FLAG_BMI2 | CPUFLAG_BMI1)
+#define CPUFLAG_BMI2 (AV_CPU_FLAG_BMI2 | AV_CPU_FLAG_BMI1)
 static const AVOption cpuflags_opts[] = {
 { "flags"   , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, 
INT64_MAX, .unit = "flags" },
 #if   ARCH_PPC
@@ -138,7 +137,7 @@ int av_parse_cpu_flags(const char *s)
 { "fma3", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_FMA3
 },.unit = "flags" },
 { "fma4", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_FMA4
 },.unit = "flags" },
 { "avx2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVX2
 },.unit = "flags" },
-{ "bmi1", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_BMI1
 },.unit = "flags" },
+{ "bmi1", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_BMI1
 },.unit = "flags" },
 { "bmi2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_BMI2
 },.unit = "flags" },
 { "3dnow"   , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOW   
 },.unit = "flags" },
 { "3dnowext", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOWEXT
 },.unit = "flags" },
-- 
2.3.5

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


Re: [FFmpeg-devel] [PATCH] avutil: remove pointless bmi1 define

2015-04-18 Thread Michael Niedermayer
On Sat, Apr 18, 2015 at 08:14:12PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libavutil/cpu.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

LGTM

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] cmdutils: indent protocols listing

2015-04-18 Thread Michael Niedermayer
On Sat, Apr 18, 2015 at 02:31:23PM -0800, Lou Logan wrote:
> For readability.
> 
> Signed-off-by: Lou Logan 
> ---
>  cmdutils.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

applied

thanks

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

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


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


Re: [FFmpeg-devel] [PATCH] avutil: remove pointless bmi1 define

2015-04-18 Thread James Almer
On 18/04/15 9:35 PM, Michael Niedermayer wrote:
> On Sat, Apr 18, 2015 at 08:14:12PM -0300, James Almer wrote:
>> Signed-off-by: James Almer 
>> ---
>>  libavutil/cpu.c | 5 ++---
>>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> LGTM
> 
> thanks

Pushed.

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