Re: [FFmpeg-devel] [PATCH] fate: add piz exr test

2015-02-13 Thread Paul B Mahol
On 2/13/15, Michael Niedermayer  wrote:
> On Thu, Feb 12, 2015 at 04:53:48PM +, Paul B Mahol wrote:
>> Signed-off-by: Paul B Mahol 
>> ---
>>  tests/fate/image.mak | 3 +++
>>  tests/ref/fate/exr-slice-piz | 2 ++
>>  2 files changed, 5 insertions(+)
>>  create mode 100644 tests/ref/fate/exr-slice-piz
>>
>> diff --git a/tests/fate/image.mak b/tests/fate/image.mak
>> index e17f068..216b05c 100644
>> --- a/tests/fate/image.mak
>> +++ b/tests/fate/image.mak
>> @@ -48,6 +48,9 @@ fate-exr-slice-zip1: CMD = framecrc -i
>> $(TARGET_SAMPLES)/exr/rgba_slice_zip1.exr
>>  FATE_EXR += fate-exr-slice-zip16
>>  fate-exr-slice-zip16: CMD = framecrc -i
>> $(TARGET_SAMPLES)/exr/rgba_slice_zip16.exr -pix_fmt rgba64le
>>
>> +FATE_EXR += fate-exr-slice-piz
>> +fate-exr-slice-piz: CMD = framecrc -i
>> $(TARGET_SAMPLES)/exr/rgba_slice_piz.exr -pix_fmt rgba64le
>
> this appears to be failing on mips

What actual output looks like?

>
> --- tests/ref/fate/exr-slice-piz2015-02-13 01:38:32.551435305 +0100
> +++ tests/data/fate/exr-slice-piz   2015-02-13 02:46:52.479521678 +0100
> @@ -1,2 +1,2 @@
>  #tb 0: 1/25
> -0,  0,  0,1,  3169800, 0x7270db88
> +0,  0,  0,1,  3169800, 0x2d091d37
>
> [...]
>
> --
> 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"
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/parser: simplify ff_mpeg4video_split()

2015-02-13 Thread wm4
On Fri, 13 Feb 2015 13:50:23 +0800
Zhaoxiu Zeng  wrote:

> From 3cac16572aee4425377e4bc9e496ab5844200a51 Mon Sep 17 00:00:00 2001
> From: Zeng Zhaoxiu 
> Date: Fri, 13 Feb 2015 13:27:26 +0800
> Subject: [PATCH 1/2] avcodec/parser: simplify ff_mpeg4video_split()
> 
> Signed-off-by: Zeng Zhaoxiu 
> ---
>  libavcodec/parser.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/parser.c b/libavcodec/parser.c
> index aa25481..83019e7 100644
> --- a/libavcodec/parser.c
> +++ b/libavcodec/parser.c
> @@ -28,6 +28,7 @@
>  #include "libavutil/mem.h"
> 
>  #include "parser.h"
> +#include "internal.h"
> 
>  static AVCodecParser *av_first_parser = NULL;
> 
> @@ -308,13 +309,14 @@ void ff_parse_close(AVCodecParserContext *s)
> 
>  int ff_mpeg4video_split(AVCodecContext *avctx, const uint8_t *buf,
> int buf_size)
>  {
> -int i;
>  uint32_t state = -1;
> +const uint8_t *ptr = buf, *end = buf + buf_size;
> 
> -for (i = 0; i < buf_size; i++) {
> -state = state << 8 | buf[i];
> +while (ptr < end) {
> +ptr = avpriv_find_start_code(ptr, end, &state);
>  if (state == 0x1B3 || state == 0x1B6)
> -return i - 3;
> +return ptr - 4 - buf;
>  }
> +
>  return 0;
>  }

I don't know, it looks more complicated to me now. Following track of
an integer index is much easier than playing with pointer arithmetics.
Also, why this (apparently) can return a negative integer index just
fine, your pointer calculations can go out of the range [buf,
buf+buf_size], possibly leading to undefined behavior. The code
introduces a function call, without actually reducing the number of
lines.

Well, I know nothing about this code, so you don't need to listen to
me. These are just my impressions.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/vc1: simplify find_next_marker()

2015-02-13 Thread Michael Niedermayer
On Fri, Feb 13, 2015 at 12:02:04AM +0800, zhaoxiu.zeng wrote:
> From ae973955c4e8a16ad38843cef60639f9bd69abee Mon Sep 17 00:00:00 2001
> From: Zeng Zhaoxiu 
> Date: Thu, 12 Feb 2015 23:22:59 +0800
> Subject: [PATCH 1/2] avcodec/vc1: simplify find_next_marker()

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 2/2] avcodec/vc1: simplify vc1_split()

2015-02-13 Thread Michael Niedermayer
On Fri, Feb 13, 2015 at 12:03:21AM +0800, zhaoxiu.zeng wrote:
> From 1a89b725e31e7567ade7563fc67ebc5d80a7c20c Mon Sep 17 00:00:00 2001
> From: Zeng Zhaoxiu 
> Date: Thu, 12 Feb 2015 23:30:08 +0800
> Subject: [PATCH 2/2] avcodec/vc1: simplify vc1_split()
> 
> Signed-off-by: Zeng Zhaoxiu 

applied

thanks

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

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


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


[FFmpeg-devel] avformat: QuickTime Sample Description Table 'corruption' with ACLR atom.

2015-02-13 Thread Kevin Wheatley
Hi,

currently when writing ACLR atoms to .mov's there is a 'corruption'
caused by the function mov_write_avid_tag() writing an additional 4
bytes of zero's. this is potentially then followed by other atoms colr
and pasp. Looking at the specifications it appears this 4 bytes is
supposed to occur at the end of the stsd if at all, as it is optional.

I'm working on a patch to fix the 'corruption' but wondered how to
handle the optional terminator:

1) Don't write one ever
2) Write one if requested by adding a flag to -movflags stdsterminator
3) Write one by default, add a 'nostdsterminator' flag (needs a better name)
4) always write one.

I'm favouring 2 or 3

Currently I've done option 1 see
https://github.com/KevinJW/FFmpeg/compare/mov_dnxhd_stsd_corruption

Thanks

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


Re: [FFmpeg-devel] [PATCH] avcodec/wmv2: simplify cbp_table_index calculation

2015-02-13 Thread Michael Niedermayer
On Fri, Feb 13, 2015 at 12:05:36AM +0800, zhaoxiu.zeng wrote:
> From 232bb6fa60aeb02ae8ecd0b28e9785d4cfb2d7a0 Mon Sep 17 00:00:00 2001
> From: Zeng Zhaoxiu 
> Date: Thu, 12 Feb 2015 23:43:26 +0800
> Subject: [PATCH] avcodec/wmv2: simplify cbp_table_index calculation
> 
> Signed-off-by: Zeng Zhaoxiu 
> ---
>  libavcodec/wmv2.h| 11 +++
>  libavcodec/wmv2dec.c | 11 +--
>  libavcodec/wmv2enc.c | 11 +--
>  3 files changed, 13 insertions(+), 20 deletions(-)

applied

thanks

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

Observe your enemies, for they first find out your faults. -- Antisthenes


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


Re: [FFmpeg-devel] [PATCH] fate: add piz exr test

2015-02-13 Thread Michael Niedermayer
On Fri, Feb 13, 2015 at 09:14:47AM +, Paul B Mahol wrote:
> On 2/13/15, Michael Niedermayer  wrote:
> > On Thu, Feb 12, 2015 at 04:53:48PM +, Paul B Mahol wrote:
> >> Signed-off-by: Paul B Mahol 
> >> ---
> >>  tests/fate/image.mak | 3 +++
> >>  tests/ref/fate/exr-slice-piz | 2 ++
> >>  2 files changed, 5 insertions(+)
> >>  create mode 100644 tests/ref/fate/exr-slice-piz
> >>
> >> diff --git a/tests/fate/image.mak b/tests/fate/image.mak
> >> index e17f068..216b05c 100644
> >> --- a/tests/fate/image.mak
> >> +++ b/tests/fate/image.mak
> >> @@ -48,6 +48,9 @@ fate-exr-slice-zip1: CMD = framecrc -i
> >> $(TARGET_SAMPLES)/exr/rgba_slice_zip1.exr
> >>  FATE_EXR += fate-exr-slice-zip16
> >>  fate-exr-slice-zip16: CMD = framecrc -i
> >> $(TARGET_SAMPLES)/exr/rgba_slice_zip16.exr -pix_fmt rgba64le
> >>
> >> +FATE_EXR += fate-exr-slice-piz
> >> +fate-exr-slice-piz: CMD = framecrc -i
> >> $(TARGET_SAMPLES)/exr/rgba_slice_piz.exr -pix_fmt rgba64le
> >
> > this appears to be failing on mips
> 
> What actual output looks like?

see:
http://ffmpeg.org/~michael/mips.tif


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

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates


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


Re: [FFmpeg-devel] avformat: QuickTime Sample Description Table 'corruption' with ACLR atom.

2015-02-13 Thread Michael Niedermayer
On Fri, Feb 13, 2015 at 02:43:13PM +, Kevin Wheatley wrote:
> Hi,
> 
> currently when writing ACLR atoms to .mov's there is a 'corruption'
> caused by the function mov_write_avid_tag() writing an additional 4
> bytes of zero's. this is potentially then followed by other atoms colr
> and pasp. Looking at the specifications it appears this 4 bytes is
> supposed to occur at the end of the stsd if at all, as it is optional.
> 
> I'm working on a patch to fix the 'corruption' but wondered how to
> handle the optional terminator:
> 
> 1) Don't write one ever
> 2) Write one if requested by adding a flag to -movflags stdsterminator
> 3) Write one by default, add a 'nostdsterminator' flag (needs a better name)
> 4) always write one.
> 
> I'm favouring 2 or 3

what difference does the terminator make ?
does it improve compatibility with other software ?


> 
> Currently I've done option 1 see
> https://github.com/KevinJW/FFmpeg/compare/mov_dnxhd_stsd_corruption
> 
> Thanks
> 
> Kevin
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 

-- 
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] DSP function ARM NEON patches for hevc

2015-02-13 Thread Michael Niedermayer
On Thu, Feb 05, 2015 at 02:22:28PM +0100, Mickaƫl Raulet wrote:
> Michael,
> 
> Please find some commits that can be cherry picked from
> https://github.com/OpenHEVC/FFmpeg/commits/ffmpeg_patch
> 

> Optimized deblocking filter (8bits only)
> 1b9ee47d2f43b0a029a9468233626102eb1473b8

this breaks the neon clobber test see:
fate.ffmpeg.org/report.cgi?time=20150211030204&slot=armv7l-panda-gcc4.6-cortexa8-clobber

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

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


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


Re: [FFmpeg-devel] avformat: QuickTime Sample Description Table 'corruption' with ACLR atom.

2015-02-13 Thread Kevin Wheatley
On Fri, Feb 13, 2015 at 3:06 PM, Michael Niedermayer  wrote:
> On Fri, Feb 13, 2015 at 02:43:13PM +, Kevin Wheatley wrote:

> what difference does the terminator make ?
> does it improve compatibility with other software ?


I believe there are some versions of Apple's Final Cut that need the
terminator, I've also been wondering if mp4 has the same needs but I
don't have the spec to cross check.

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


[FFmpeg-devel] [PATCH 1/3] avcodec/wmalosslessdec: change type of acfilter_coeffs from int64_t to int16_t

2015-02-13 Thread zhaoxiu.zeng
>From f1ea8512460b62e802134f5894bfa274e8914f24 Mon Sep 17 00:00:00 2001
From: Zeng Zhaoxiu 
Date: Fri, 13 Feb 2015 23:37:13 +0800
Subject: [PATCH 1/3] avcodec/wmalosslessdec: change type of acfilter_coeffs
 from int64_t to int16_t

Signed-off-by: Zeng Zhaoxiu 
---
 libavcodec/wmalosslessdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 557b6b9..9bd5e7b 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -127,7 +127,7 @@ typedef struct WmallDecodeCtx {
 
 int8_t  acfilter_order;
 int8_t  acfilter_scaling;
-int64_t acfilter_coeffs[16];
+int16_t acfilter_coeffs[16];
 int acfilter_prevvalues[WMALL_MAX_CHANNELS][16];
 
 int8_t  mclms_order;
@@ -818,7 +818,7 @@ static void revert_inter_ch_decorr(WmallDecodeCtx *s, int 
tile_size)
 static void revert_acfilter(WmallDecodeCtx *s, int tile_size)
 {
 int ich, pred, i, j;
-int64_t *filter_coeffs = s->acfilter_coeffs;
+int16_t *filter_coeffs = s->acfilter_coeffs;
 int scaling= s->acfilter_scaling;
 int order  = s->acfilter_order;
 
-- 
2.1.0

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


[FFmpeg-devel] [PATCH 2/3] avcodec/wmalosslessdec: optimize sign operation

2015-02-13 Thread zhaoxiu.zeng
>From b08b4a38c87000fe5549de96f65de6ba77740b30 Mon Sep 17 00:00:00 2001
From: Zeng Zhaoxiu 
Date: Fri, 13 Feb 2015 23:52:29 +0800
Subject: [PATCH 2/3] avcodec/wmalosslessdec: optimize sign operation

Signed-off-by: Zeng Zhaoxiu 
---
 libavcodec/wmalosslessdec.c | 34 --
 1 file changed, 8 insertions(+), 26 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 9bd5e7b..1916594 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -175,6 +175,8 @@ typedef struct WmallDecodeCtx {
 int channel_coeffs[WMALL_MAX_CHANNELS][WMALL_BLOCK_MAX_SIZE];
 } WmallDecodeCtx;
 
+/** Get sign of integer (1 for positive, -1 for negative and 0 for zero) */
+#define WMASIGN(x) ((x > 0) - (x < 0))
 
 static av_cold int decode_init(AVCodecContext *avctx)
 {
@@ -631,22 +633,14 @@ static void mclms_update(WmallDecodeCtx *s, int icoef, 
int *pred)
 for (i = 0; i < order * num_channels; i++)
 s->mclms_coeffs[i + ich * order * num_channels] +=
 s->mclms_updates[s->mclms_recent + i];
-for (j = 0; j < ich; j++) {
-if (s->channel_residues[j][icoef] > 0)
-s->mclms_coeffs_cur[ich * num_channels + j] += 1;
-else if (s->channel_residues[j][icoef] < 0)
-s->mclms_coeffs_cur[ich * num_channels + j] -= 1;
-}
+for (j = 0; j < ich; j++)
+s->mclms_coeffs_cur[ich * num_channels + j] += 
WMASIGN(s->channel_residues[j][icoef]);
 } else if (pred_error < 0) {
 for (i = 0; i < order * num_channels; i++)
 s->mclms_coeffs[i + ich * order * num_channels] -=
 s->mclms_updates[s->mclms_recent + i];
-for (j = 0; j < ich; j++) {
-if (s->channel_residues[j][icoef] > 0)
-s->mclms_coeffs_cur[ich * num_channels + j] -= 1;
-else if (s->channel_residues[j][icoef] < 0)
-s->mclms_coeffs_cur[ich * num_channels + j] += 1;
-}
+for (j = 0; j < ich; j++)
+s->mclms_coeffs_cur[ich * num_channels + j] -= 
WMASIGN(s->channel_residues[j][icoef]);
 }
 }
 
@@ -658,11 +652,7 @@ static void mclms_update(WmallDecodeCtx *s, int icoef, int 
*pred)
 else if (s->channel_residues[ich][icoef] < -range)
 s->mclms_prevvalues[s->mclms_recent] = -range;
 
-s->mclms_updates[s->mclms_recent] = 0;
-if (s->channel_residues[ich][icoef] > 0)
-s->mclms_updates[s->mclms_recent] = 1;
-else if (s->channel_residues[ich][icoef] < 0)
-s->mclms_updates[s->mclms_recent] = -1;
+s->mclms_updates[s->mclms_recent] = 
WMASIGN(s->channel_residues[ich][icoef]);
 }
 
 if (s->mclms_recent == 0) {
@@ -724,12 +714,7 @@ static void lms_update(WmallDecodeCtx *s, int ich, int 
ilms, int input)
 }
 
 s->cdlms[ich][ilms].lms_prevvalues[recent] = av_clip(input, -range, range 
- 1);
-if (!input)
-s->cdlms[ich][ilms].lms_updates[recent] = 0;
-else if (input < 0)
-s->cdlms[ich][ilms].lms_updates[recent] = -s->update_speed[ich];
-else
-s->cdlms[ich][ilms].lms_updates[recent] = s->update_speed[ich];
+s->cdlms[ich][ilms].lms_updates[recent] = WMASIGN(input) * 
s->update_speed[ich];
 
 s->cdlms[ich][ilms].lms_updates[recent + (order >> 4)] >>= 2;
 s->cdlms[ich][ilms].lms_updates[recent + (order >> 3)] >>= 1;
@@ -773,9 +758,6 @@ static void use_normal_update_speed(WmallDecodeCtx *s, int 
ich)
 s->update_speed[ich] = 8;
 }
 
-/** Get sign of integer (1 for positive, -1 for negative and 0 for zero) */
-#define WMASIGN(x) ((x > 0) - (x < 0))
-
 static void revert_cdlms(WmallDecodeCtx *s, int ch,
  int coef_begin, int coef_end)
 {
-- 
2.1.0

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


[FFmpeg-devel] [PATCH 3/3] avcodec/wmalosslessdec: cleanup

2015-02-13 Thread zhaoxiu.zeng
>From 4096d5565e55bdbc3dbe3b0aa3be920f73c00aa8 Mon Sep 17 00:00:00 2001
From: Zeng Zhaoxiu 
Date: Sat, 14 Feb 2015 00:27:03 +0800
Subject: [PATCH 3/3] avcodec/wmalosslessdec: cleanup

Signed-off-by: Zeng Zhaoxiu 
---
 libavcodec/wmalosslessdec.c | 24 
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 1916594..bce0d6a 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -553,10 +553,7 @@ static int decode_channel_residues(WmallDecodeCtx *s, int 
ch, int tile_size)
 s->ave_sum[ch] = residue + s->ave_sum[ch] -
  (s->ave_sum[ch] >> s->movave_scaling);
 
-if (residue & 1)
-residue = -(residue >> 1) - 1;
-else
-residue = residue >> 1;
+residue = (residue >> 1) ^ -(residue & 1);
 s->channel_residues[ch][i] = residue;
 }
 
@@ -644,14 +641,10 @@ static void mclms_update(WmallDecodeCtx *s, int icoef, 
int *pred)
 }
 }
 
-for (ich = num_channels - 1; ich >= 0; ich--) {
+for (ich = num_channels; ich-- > 0; ) {
 s->mclms_recent--;
-s->mclms_prevvalues[s->mclms_recent] = s->channel_residues[ich][icoef];
-if (s->channel_residues[ich][icoef] > range - 1)
-s->mclms_prevvalues[s->mclms_recent] = range - 1;
-else if (s->channel_residues[ich][icoef] < -range)
-s->mclms_prevvalues[s->mclms_recent] = -range;
-
+s->mclms_prevvalues[s->mclms_recent] = 
av_clip(s->channel_residues[ich][icoef],
+-range, range - 1);
 s->mclms_updates[s->mclms_recent] = 
WMASIGN(s->channel_residues[ich][icoef]);
 }
 
@@ -726,7 +719,7 @@ static void lms_update(WmallDecodeCtx *s, int ich, int 
ilms, int input)
 static void use_high_update_speed(WmallDecodeCtx *s, int ich)
 {
 int ilms, recent, icoef;
-for (ilms = s->cdlms_ttl[ich] - 1; ilms >= 0; ilms--) {
+for (ilms = s->cdlms_ttl[ich]; ilms-- > 0; ) {
 recent = s->cdlms[ich][ilms].recent;
 if (s->update_speed[ich] == 16)
 continue;
@@ -744,7 +737,7 @@ static void use_high_update_speed(WmallDecodeCtx *s, int 
ich)
 static void use_normal_update_speed(WmallDecodeCtx *s, int ich)
 {
 int ilms, recent, icoef;
-for (ilms = s->cdlms_ttl[ich] - 1; ilms >= 0; ilms--) {
+for (ilms = s->cdlms_ttl[ich]; ilms-- > 0; ) {
 recent = s->cdlms[ich][ilms].recent;
 if (s->update_speed[ich] == 8)
 continue;
@@ -764,7 +757,7 @@ static void revert_cdlms(WmallDecodeCtx *s, int ch,
 int icoef, pred, ilms, num_lms, residue, input;
 
 num_lms = s->cdlms_ttl[ch];
-for (ilms = num_lms - 1; ilms >= 0; ilms--) {
+for (ilms = num_lms; ilms-- > 0; ) {
 for (icoef = coef_begin; icoef < coef_end; icoef++) {
 pred = 1 << (s->cdlms[ch][ilms].scaling - 1);
 residue = s->channel_residues[ch][icoef];
@@ -1073,8 +1066,7 @@ static int decode_frame(WmallDecodeCtx *s)
 
 av_dlog(s->avctx, "Frame done\n");
 
-if (s->skip_frame)
-s->skip_frame = 0;
+s->skip_frame = 0;
 
 if (s->len_prefix) {
 if (len != (get_bits_count(gb) - s->frame_offset) + 2) {
-- 
2.1.0

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


[FFmpeg-devel] [PATCH 2/2] avcodec/apedec: simplify sign conversion

2015-02-13 Thread zhaoxiu.zeng
>From fcc874caec6aa2ae439b476559a7a1ee25aecc4e Mon Sep 17 00:00:00 2001
From: Zeng Zhaoxiu 
Date: Sat, 14 Feb 2015 00:37:25 +0800
Subject: [PATCH 2/2] avcodec/apedec: simplify sign conversion

Signed-off-by: Zeng Zhaoxiu 
---
 libavcodec/apedec.c | 23 +--
 1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index f1ddf80..536361c 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -505,10 +505,7 @@ static inline int ape_decode_value_3860(APEContext *ctx, 
GetBitContext *gb,
 rice->k++;
 
 /* Convert to signed */
-if (x & 1)
-return (x >> 1) + 1;
-else
-return -(x >> 1);
+return ((x >> 1) ^ ((x & 1) - 1)) + 1;
 }
 
 static inline int ape_decode_value_3900(APEContext *ctx, APERice *rice)
@@ -542,10 +539,7 @@ static inline int ape_decode_value_3900(APEContext *ctx, 
APERice *rice)
 update_rice(rice, x);
 
 /* Convert to signed */
-if (x & 1)
-return (x >> 1) + 1;
-else
-return -(x >> 1);
+return ((x >> 1) ^ ((x & 1) - 1)) + 1;
 }
 
 static inline int ape_decode_value_3990(APEContext *ctx, APERice *rice)
@@ -588,10 +582,7 @@ static inline int ape_decode_value_3990(APEContext *ctx, 
APERice *rice)
 update_rice(rice, x);
 
 /* Convert to signed */
-if (x & 1)
-return (x >> 1) + 1;
-else
-return -(x >> 1);
+return ((x >> 1) ^ ((x & 1) - 1)) + 1;
 }
 
 static void decode_array_(APEContext *ctx, GetBitContext *gb,
@@ -634,12 +625,8 @@ static void decode_array_(APEContext *ctx, 
GetBitContext *gb,
 }
 }
 
-for (i = 0; i < blockstodecode; i++) {
-if (out[i] & 1)
-out[i] = (out[i] >> 1) + 1;
-else
-out[i] = -(out[i] >> 1);
-}
+for (i = 0; i < blockstodecode; i++)
+out[i] = ((out[i] >> 1) ^ ((out[i] & 1) - 1)) + 1;
 }
 
 static void entropy_decode_mono_(APEContext *ctx, int blockstodecode)
-- 
2.1.0

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


[FFmpeg-devel] [PATCH 1/2] avcodec/apedec: move 'coeffs[256] and delay[256]' into, long_filter_high_3800

2015-02-13 Thread zhaoxiu.zeng
>From b6ab794e41c549509c3e2aad30c0fc67726dbd56 Mon Sep 17 00:00:00 2001
From: Zeng Zhaoxiu 
Date: Sat, 14 Feb 2015 00:33:32 +0800
Subject: [PATCH 1/2] avcodec/apedec: move 'coeffs[256] and delay[256]' into
 long_filter_high_3800

Signed-off-by: Zeng Zhaoxiu 
---
 libavcodec/apedec.c | 18 --
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 383b7fe..f1ddf80 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -899,11 +899,11 @@ static av_always_inline int filter_3800(APEPredictor *p,
 return p->filterA[filter];
 }
 
-static void long_filter_high_3800(int32_t *buffer, int order, int shift,
-  int32_t *coeffs, int32_t *delay, int length)
+static void long_filter_high_3800(int32_t *buffer, int order, int shift, int 
length)
 {
 int i, j;
 int32_t dotprod, sign;
+int32_t coeffs[256], delay[256];
 
 memset(coeffs, 0, order * sizeof(*coeffs));
 for (i = 0; i < order; i++)
@@ -947,13 +947,12 @@ static void predictor_decode_stereo_3800(APEContext *ctx, 
int count)
 APEPredictor *p = &ctx->predictor;
 int32_t *decoded0 = ctx->decoded[0];
 int32_t *decoded1 = ctx->decoded[1];
-int32_t coeffs[256], delay[256];
 int start = 4, shift = 10;
 
 if (ctx->compression_level == COMPRESSION_LEVEL_HIGH) {
 start = 16;
-long_filter_high_3800(decoded0, 16, 9, coeffs, delay, count);
-long_filter_high_3800(decoded1, 16, 9, coeffs, delay, count);
+long_filter_high_3800(decoded0, 16, 9, count);
+long_filter_high_3800(decoded1, 16, 9, count);
 } else if (ctx->compression_level == COMPRESSION_LEVEL_EXTRA_HIGH) {
 int order = 128, shift2 = 11;
 
@@ -965,8 +964,8 @@ static void predictor_decode_stereo_3800(APEContext *ctx, 
int count)
 long_filter_ehigh_3830(decoded1 + order, count - order);
 }
 start = order;
-long_filter_high_3800(decoded0, order, shift2, coeffs, delay, count);
-long_filter_high_3800(decoded1, order, shift2, coeffs, delay, count);
+long_filter_high_3800(decoded0, order, shift2, count);
+long_filter_high_3800(decoded1, order, shift2, count);
 }
 
 while (count--) {
@@ -1002,12 +1001,11 @@ static void predictor_decode_mono_3800(APEContext *ctx, 
int count)
 {
 APEPredictor *p = &ctx->predictor;
 int32_t *decoded0 = ctx->decoded[0];
-int32_t coeffs[256], delay[256];
 int start = 4, shift = 10;
 
 if (ctx->compression_level == COMPRESSION_LEVEL_HIGH) {
 start = 16;
-long_filter_high_3800(decoded0, 16, 9, coeffs, delay, count);
+long_filter_high_3800(decoded0, 16, 9, count);
 } else if (ctx->compression_level == COMPRESSION_LEVEL_EXTRA_HIGH) {
 int order = 128, shift2 = 11;
 
@@ -1018,7 +1016,7 @@ static void predictor_decode_mono_3800(APEContext *ctx, 
int count)
 long_filter_ehigh_3830(decoded0 + order, count - order);
 }
 start = order;
-long_filter_high_3800(decoded0, order, shift2, coeffs, delay, count);
+long_filter_high_3800(decoded0, order, shift2, count);
 }
 
 while (count--) {
-- 
2.1.0


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


[FFmpeg-devel] [PATCH] MAINTAINERS: Remove 1.2 from the maintained releases

2015-02-13 Thread Michael Niedermayer
The only distributions which still use it according to
https://trac.ffmpeg.org/wiki/Downstreams
are ROSA 2012 LTS but its https://abf.rosalinux.ru/advisories lists no security 
updates for FFmpeg 1.2
and "gentoo stable" but its http://www.gentoo.org/security/en/glsa/index.xml 
also lists no security updates for 1.2
also http://packages.gentoo.org/package/media-video/ffmpeg lists stable as 
shipping 1.2.6 which is 6 point
releases behind
so it appears our security updates do not reach these distributions and 
continued maintaince from us would in
that case be a waste of time

CC: Alexis Ballier 
Signed-off-by: Michael Niedermayer 
---
 MAINTAINERS |1 -
 1 file changed, 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 13b211e..a35a5e8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -542,7 +542,6 @@ Releases
 2.5 Michael Niedermayer
 2.4 Michael Niedermayer
 2.2 Michael Niedermayer
-1.2 Michael Niedermayer
 
 If you want to maintain an older release, please contact us
 
-- 
1.7.9.5

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


[FFmpeg-devel] [PATCH] avcodec/golomb: simplify sign conversion

2015-02-13 Thread zhaoxiu.zeng
>From 7d782e106cf485ca9a44d4283a18402bf0a84fb9 Mon Sep 17 00:00:00 2001
From: Zeng Zhaoxiu 
Date: Sat, 14 Feb 2015 00:44:39 +0800
Subject: [PATCH] avcodec/golomb: simplify sign conversion

Signed-off-by: Zeng Zhaoxiu 
---
 libavcodec/golomb.h | 41 +
 1 file changed, 13 insertions(+), 28 deletions(-)

diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index c4b1354..1632ee3 100644
--- a/libavcodec/golomb.h
+++ b/libavcodec/golomb.h
@@ -195,7 +195,7 @@ static inline int get_se_golomb(GetBitContext *gb)
 
 return ff_se_golomb_vlc_code[buf];
 } else {
-int log = av_log2(buf);
+int log = av_log2(buf), sign;
 LAST_SKIP_BITS(re, gb, 31 - log);
 UPDATE_CACHE(re, gb);
 buf = GET_CACHE(re, gb);
@@ -205,10 +205,8 @@ static inline int get_se_golomb(GetBitContext *gb)
 LAST_SKIP_BITS(re, gb, 32 - log);
 CLOSE_READER(re, gb);
 
-if (buf & 1)
-buf = -(buf >> 1);
-else
-buf = (buf >> 1);
+sign = -(buf & 1);
+buf  = ((buf >> 1) ^ sign) - sign;
 
 return buf;
 }
@@ -217,13 +215,10 @@ static inline int get_se_golomb(GetBitContext *gb)
 static inline int get_se_golomb_long(GetBitContext *gb)
 {
 unsigned int buf = get_ue_golomb_long(gb);
+int sign;
 
-if (buf & 1)
-buf = (buf + 1) >> 1;
-else
-buf = -(buf >> 1);
-
-return buf;
+sign = (buf & 1) - 1;
+return ((buf >> 1) ^ sign) + 1;
 }
 
 static inline int svq3_get_se_golomb(GetBitContext *gb)
@@ -264,13 +259,9 @@ static inline int dirac_get_se_golomb(GetBitContext *gb)
 uint32_t ret = svq3_get_ue_golomb(gb);
 
 if (ret) {
-uint32_t buf;
-OPEN_READER(re, gb);
-UPDATE_CACHE(re, gb);
-buf = SHOW_SBITS(re, gb, 1);
-LAST_SKIP_BITS(re, gb, 1);
-ret = (ret ^ buf) - buf;
-CLOSE_READER(re, gb);
+int sign;
+sign = -get_bits1(gb);
+ret = (ret ^ sign) - sign;
 }
 
 return ret;
@@ -372,14 +363,11 @@ static inline int get_sr_golomb(GetBitContext *gb, int k, 
int limit,
 int esc_len)
 {
 int v = get_ur_golomb(gb, k, limit, esc_len);
+int sign;
 
 v++;
-if (v & 1)
-return v >> 1;
-else
-return -(v >> 1);
-
-//return (v>>1) ^ -(v&1);
+sign = (v & 1) - 1;
+return ((v >> 1) ^ sign) - sign;
 }
 
 /**
@@ -406,10 +394,7 @@ static inline unsigned int 
get_ur_golomb_shorten(GetBitContext *gb, int k)
 static inline int get_sr_golomb_shorten(GetBitContext *gb, int k)
 {
 int uvar = get_ur_golomb_jpegls(gb, k + 1, INT_MAX, 0);
-if (uvar & 1)
-return ~(uvar >> 1);
-else
-return uvar >> 1;
+return (uvar >> 1) ^ -(uvar & 1);
 }
 
 #ifdef TRACE
-- 
2.1.0

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


Re: [FFmpeg-devel] avformat: QuickTime Sample Description Table 'corruption' with ACLR atom.

2015-02-13 Thread Michael Niedermayer
On Fri, Feb 13, 2015 at 04:34:37PM +, Kevin Wheatley wrote:
> On Fri, Feb 13, 2015 at 3:06 PM, Michael Niedermayer  wrote:
> > On Fri, Feb 13, 2015 at 02:43:13PM +, Kevin Wheatley wrote:
> 
> > what difference does the terminator make ?
> > does it improve compatibility with other software ?
> 
> 
> I believe there are some versions of Apple's Final Cut that need the
> terminator, I've also been wondering if mp4 has the same needs but I
> don't have the spec to cross check.

if compatibility is better with it and it doesnt break anything then
it should be added ba default

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

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.


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


Re: [FFmpeg-devel] avformat: QuickTime Sample Description Table 'corruption' with ACLR atom.

2015-02-13 Thread Kevin Wheatley
OK I'll proceed with that.

Thanks

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


Re: [FFmpeg-devel] [PATCH 1/3] avcodec/wmalosslessdec: change type of acfilter_coeffs from int64_t to int16_t

2015-02-13 Thread Michael Niedermayer
On Sat, Feb 14, 2015 at 12:49:49AM +0800, zhaoxiu.zeng wrote:
> From f1ea8512460b62e802134f5894bfa274e8914f24 Mon Sep 17 00:00:00 2001
> From: Zeng Zhaoxiu 
> Date: Fri, 13 Feb 2015 23:37:13 +0800
> Subject: [PATCH 1/3] avcodec/wmalosslessdec: change type of acfilter_coeffs
>  from int64_t to int16_t

applied

thanks

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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


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] avcodec/wmalosslessdec: optimize sign operation

2015-02-13 Thread Michael Niedermayer
On Sat, Feb 14, 2015 at 12:51:27AM +0800, zhaoxiu.zeng wrote:
> From b08b4a38c87000fe5549de96f65de6ba77740b30 Mon Sep 17 00:00:00 2001
> From: Zeng Zhaoxiu 
> Date: Fri, 13 Feb 2015 23:52:29 +0800
> Subject: [PATCH 2/3] avcodec/wmalosslessdec: optimize sign operation
> 
> Signed-off-by: Zeng Zhaoxiu 
> ---
>  libavcodec/wmalosslessdec.c | 34 --
>  1 file changed, 8 insertions(+), 26 deletions(-)

applied

thanks

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

DNS cache poisoning attacks, popular search engine, Google internet authority
dont be evil, please


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


Re: [FFmpeg-devel] avformat: QuickTime Sample Description Table 'corruption' with ACLR atom.

2015-02-13 Thread Kevin Wheatley
I've rebased the patch against current master, it is a lot of FATE
changes due to the extra 4 bytes...

It should now merge appropriately, see https://github.com/FFmpeg/FFmpeg/pull/110

Please let me know if anything needs tweaking

Thanks

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


Re: [FFmpeg-devel] [PATCH 0/7] using ffmpeg as an RTSP client

2015-02-13 Thread Gilles Chanteperdrix
On Sun, Feb 08, 2015 at 10:20:20PM +0100, Gilles Chanteperdrix wrote:
> Hi,
> 
> I am using ffmpeg 2.5.3 as an RTSP client and found a few missing
> pieces, which the following series of patches should address.

Hi,

ping ?

I sent these patches almost a week ago and received no answer. Is it
because the patches are not conform to the submission rules, or
simply because people are to busy for reviewing them?

Thanks in advance.
Regards.

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


Re: [FFmpeg-devel] [PATCH 0/7] using ffmpeg as an RTSP client

2015-02-13 Thread James Almer
On 13/02/15 3:45 PM, Gilles Chanteperdrix wrote:
> On Sun, Feb 08, 2015 at 10:20:20PM +0100, Gilles Chanteperdrix wrote:
>> Hi,
>>
>> I am using ffmpeg 2.5.3 as an RTSP client and found a few missing
>> pieces, which the following series of patches should address.
> 
> Hi,
> 
> ping ?
> 
> I sent these patches almost a week ago and received no answer. Is it
> because the patches are not conform to the submission rules, or
> simply because people are to busy for reviewing them?
> 
> Thanks in advance.
> Regards.

Are you subscribed to the mailing list? Otherwise you'll not get the replies 
delivered to your email.
Six out of seven patches got comments so far. You can check them here
http://ffmpeg.org/pipermail/ffmpeg-devel/2015-February/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 0/7] using ffmpeg as an RTSP client

2015-02-13 Thread Gilles Chanteperdrix
On Fri, Feb 13, 2015 at 07:45:27PM +0100, Gilles Chanteperdrix wrote:
> On Sun, Feb 08, 2015 at 10:20:20PM +0100, Gilles Chanteperdrix wrote:
> > Hi,
> > 
> > I am using ffmpeg 2.5.3 as an RTSP client and found a few missing
> > pieces, which the following series of patches should address.
> 
> Hi,
> 
> ping ?
> 
> I sent these patches almost a week ago and received no answer. Is it
> because the patches are not conform to the submission rules, or
> simply because people are to busy for reviewing them?

Never mind. Sorry for the noise.

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


Re: [FFmpeg-devel] [PATCH 1/7] avformat/rtpdec_ac3: add AC3 RTP depacketization

2015-02-13 Thread Gilles Chanteperdrix
On Thu, Feb 12, 2015 at 10:07:39PM +0100, Thomas Volkert wrote:
> >+if (nr_frames > 1) {
> >+av_log(ctx, AV_LOG_ERROR,
> >+   "Unimplemented multiple AC3 frames per packet\n");
> 
> You could use avpriv_report_missing_feature() here.

I am not sure that the case where there are multiple frames in one
packet is not already working: frames are concatenated without not
headers, so the full AC3 parser should be able to split the packet
in multiple frames right ? Unfortunately, I do not have an example
using this feature.


> >+if (nr_frames > 1) {
> >+av_log(ctx, AV_LOG_ERROR,
> >+   "Unimplemented multiple AC3 frames per packet\n");
> 
> You could use avpriv_report_missing_feature() here.

I am not sure that the case where there are multiple frames in one
packet is not already working: frames are concatenated without not
headers, so the full AC3 parser should be able to split the packet
in multiple frames right ? Unfortunately, I do not have an example
using this feature.

> 
> Do you see any use for the optional SDP parameter?
> If yes, you could add an AC3 specific parser for SDP line and link it as
> ".parse_sdp_a_line" line here.

Which optional SDP parameter? channels,ptime,maxptime ?

> What do you think about a packetizer as counterpart?

Currently, I am using live555 as an RTSP server. I did not check
ffmpeg documentation to see how to run an RTSP server. I will check.

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


[FFmpeg-devel] RTP patches v2

2015-02-13 Thread Gilles Chanteperdrix
Hi,

please find a second version of some patches for various RTP audio
payload format. This second version addresses Thomas Volkert
comments.

Regards.

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


[FFmpeg-devel] [PATCH 1/3] avformat/rtpdec_mpeg4: reassemble fragmented AAC frames

2015-02-13 Thread Gilles Chanteperdrix
Signed-off-by: Gilles Chanteperdrix 
---
 libavformat/rtpdec_mpeg4.c | 84 +-
 1 file changed, 76 insertions(+), 8 deletions(-)

diff --git a/libavformat/rtpdec_mpeg4.c b/libavformat/rtpdec_mpeg4.c
index 9655d30..f2814b5 100644
--- a/libavformat/rtpdec_mpeg4.c
+++ b/libavformat/rtpdec_mpeg4.c
@@ -33,6 +33,8 @@
 #include "libavutil/avstring.h"
 #include "libavcodec/get_bits.h"
 
+#define MAX_AAC_HBR_FRAME_SIZE 8191
+
 /** Structure listing useful vars to parse RTP packet payload */
 struct PayloadContext {
 int sizelength;
@@ -59,8 +61,9 @@ struct PayloadContext {
 int au_headers_length_bytes;
 int cur_au_index;
 
-uint8_t buf[RTP_MAX_PACKET_LENGTH];
+uint8_t buf[FFMAX(RTP_MAX_PACKET_LENGTH, MAX_AAC_HBR_FRAME_SIZE)];
 int buf_pos, buf_size;
+uint32_t timestamp;
 };
 
 typedef struct {
@@ -168,30 +171,95 @@ static int aac_parse_packet(AVFormatContext *ctx, 
PayloadContext *data,
 {
 int ret;
 
+
 if (!buf) {
-if (data->cur_au_index > data->nb_au_headers)
+if (data->cur_au_index > data->nb_au_headers) {
+av_log(ctx, AV_LOG_ERROR, "Invalid parser state\n");
 return AVERROR_INVALIDDATA;
-if (data->buf_size - data->buf_pos < 
data->au_headers[data->cur_au_index].size)
+}
+if (data->buf_size - data->buf_pos < 
data->au_headers[data->cur_au_index].size) {
+av_log(ctx, AV_LOG_ERROR, "Invalid AU size\n");
 return AVERROR_INVALIDDATA;
-if ((ret = av_new_packet(pkt, 
data->au_headers[data->cur_au_index].size)) < 0)
+}
+if ((ret = av_new_packet(pkt, 
data->au_headers[data->cur_au_index].size)) < 0) {
+av_log(ctx, AV_LOG_ERROR, "Out of memory\n");
 return ret;
+}
 memcpy(pkt->data, &data->buf[data->buf_pos], 
data->au_headers[data->cur_au_index].size);
 data->buf_pos += data->au_headers[data->cur_au_index].size;
 pkt->stream_index = st->index;
 data->cur_au_index++;
-return data->cur_au_index < data->nb_au_headers;
+
+if (data->cur_au_index == data->nb_au_headers) {
+data->buf_pos = 0;
+return 0;
+}
+
+return 1;
 }
 
-if (rtp_parse_mp4_au(data, buf, len))
+if (rtp_parse_mp4_au(data, buf, len)) {
+av_log(ctx, AV_LOG_ERROR, "Error parsing AU headers\n");
 return -1;
+}
 
 buf += data->au_headers_length_bytes + 2;
 len -= data->au_headers_length_bytes + 2;
+if (data->nb_au_headers == 1 && len < data->au_headers[0].size) {
+/* Packet is fragmented */
+
+if (!data->buf_pos) {
+if (data->au_headers[0].size > MAX_AAC_HBR_FRAME_SIZE) {
+av_log(ctx, AV_LOG_ERROR, "Invalid AU size\n");
+return AVERROR_INVALIDDATA;
+}
+
+data->buf_size = data->au_headers[0].size;
+data->timestamp = *timestamp;
+}
+
+if (data->timestamp != *timestamp
+|| data->au_headers[0].size != data->buf_size
+|| data->buf_pos + len > MAX_AAC_HBR_FRAME_SIZE) {
+data->buf_pos = 0;
+data->buf_size = 0;
+av_log(ctx, AV_LOG_ERROR, "Invalid packet received\n");
+return AVERROR_INVALIDDATA;
+}
 
-if (len < data->au_headers[0].size)
+memcpy(&data->buf[data->buf_pos], buf, len);
+data->buf_pos += len;
+
+if (!(flags & RTP_FLAG_MARKER))
+return AVERROR(EAGAIN);
+
+if (data->buf_pos != data->buf_size) {
+data->buf_pos = 0;
+av_log(ctx, AV_LOG_ERROR, "Missed some packets, discarding 
frame\n");
+return AVERROR_INVALIDDATA;
+}
+
+data->buf_pos = 0;
+ret = av_new_packet(pkt, data->buf_size);
+if (ret < 0) {
+av_log(ctx, AV_LOG_ERROR, "Out of memory\n");
+return ret;
+}
+pkt->stream_index = st->index;
+
+memcpy(pkt->data, data->buf, data->buf_size);
+
+return 0;
+}
+
+if (len < data->au_headers[0].size) {
+av_log(ctx, AV_LOG_ERROR, "First AU larger than packet size\n");
 return AVERROR_INVALIDDATA;
-if ((ret = av_new_packet(pkt, data->au_headers[0].size)) < 0)
+}
+if ((ret = av_new_packet(pkt, data->au_headers[0].size)) < 0) {
+av_log(ctx, AV_LOG_ERROR, "Out of memory\n");
 return ret;
+}
 memcpy(pkt->data, buf, data->au_headers[0].size);
 len -= data->au_headers[0].size;
 buf += data->au_headers[0].size;
-- 
1.8.4

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


[FFmpeg-devel] [PATCH 3/3] avformat/rtpdec_ac3: add AC3 RTP depacketization (RFC 4184)

2015-02-13 Thread Gilles Chanteperdrix
Signed-off-by: Gilles Chanteperdrix 
---
 Changelog|   1 +
 MAINTAINERS  |   1 +
 libavformat/Makefile |   1 +
 libavformat/rtpdec.c |   1 +
 libavformat/rtpdec_ac3.c | 157 +++
 libavformat/rtpdec_formats.h |   1 +
 libavformat/version.h|   4 +-
 7 files changed, 164 insertions(+), 2 deletions(-)
 create mode 100644 libavformat/rtpdec_ac3.c

diff --git a/Changelog b/Changelog
index 775fc79..085fd17 100644
--- a/Changelog
+++ b/Changelog
@@ -24,6 +24,7 @@ version :
 - ported softpulldown filter from libmpcodecs as repeatfields filter
 - dcshift filter
 - RTP parser for loss tolerant payload format for MP3 audio (RFC 5219)
+- RTP parser for AC3 payload format (RFC 4184)
 
 
 version 2.5:
diff --git a/MAINTAINERS b/MAINTAINERS
index 13b211e..8430222 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -465,6 +465,7 @@ Muxers/Demuxers:
   rmdec.c, rmenc.c  Ronald S. Bultje, Kostya Shishkov
   rtmp* Kostya Shishkov
   rtp.c, rtpenc.c   Martin Storsjo
+  rtpdec_ac3.*  Gilles Chanteperdrix
   rtpdec_h261.*, rtpenc_h261.*  Thomas Volkert
   rtpdec_hevc.*, rtpenc_hevc.*  Thomas Volkert
   rtpdec_asf.*  Ronald S. Bultje
diff --git a/libavformat/Makefile b/libavformat/Makefile
index ec312ba..073a42d 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -29,6 +29,7 @@ OBJS-$(CONFIG_RIFFENC)   += riffenc.o
 OBJS-$(CONFIG_RTPDEC)+= rdt.o   \
 rtp.o   \
 rtpdec.o\
+rtpdec_ac3.o\
 rtpdec_amr.o\
 rtpdec_asf.o\
 rtpdec_g726.o   \
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index c632340..550da4a 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -72,6 +72,7 @@ void 
ff_register_dynamic_payload_handler(RTPDynamicProtocolHandler *handler)
 
 void ff_register_rtp_dynamic_payload_handlers(void)
 {
+ff_register_dynamic_payload_handler(&ff_ac3_dynamic_handler);
 ff_register_dynamic_payload_handler(&ff_amr_nb_dynamic_handler);
 ff_register_dynamic_payload_handler(&ff_amr_wb_dynamic_handler);
 ff_register_dynamic_payload_handler(&ff_g726_16_dynamic_handler);
diff --git a/libavformat/rtpdec_ac3.c b/libavformat/rtpdec_ac3.c
new file mode 100644
index 000..728f421
--- /dev/null
+++ b/libavformat/rtpdec_ac3.c
@@ -0,0 +1,157 @@
+/*
+ * RTP parser for AC3 payload format (RFC 4184)
+ * Copyright (c) 2015 Gilles Chanteperdrix 
+ *
+ * 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 "avformat.h"
+#include "rtpdec_formats.h"
+
+#define RTP_AC3_PAYLOAD_HEADER_SIZE 2
+
+struct PayloadContext {
+unsigned nr_frames;
+unsigned last_frame;
+uint32_t timestamp;
+AVIOContext *fragment;
+};
+
+static av_cold int ac3_init(AVFormatContext *s, int st_index, 
+   PayloadContext *data)
+{
+if (st_index < 0)
+return 0;
+s->streams[st_index]->need_parsing = AVSTREAM_PARSE_FULL;
+return 0;
+}
+
+static PayloadContext *ac3_new_context(void)
+{
+return av_mallocz(sizeof(PayloadContext));
+}
+
+static inline void free_fragment_if_needed(PayloadContext *data)
+{
+if (data->fragment) {
+uint8_t *p;
+avio_close_dyn_buf(data->fragment, &p);
+av_free(p);
+data->fragment = NULL;
+}
+}
+
+static void ac3_free_context(PayloadContext *data)
+{
+free_fragment_if_needed(data);
+av_free(data);
+}
+
+static int ac3_handle_packet(AVFormatContext *ctx, PayloadContext *data,
+  AVStream *st, AVPacket *pkt, uint32_t *timestamp,
+  const uint8_t *buf, int len, uint16_t seq,
+  int flags)
+{
+unsigned frame_type;
+unsigned nr_frames;
+int err;
+
+if (len < RT

[FFmpeg-devel] [PATCH 2/3] avformat/rtpdec_mpeg12: add robust MPEG audio depacketization (RFC 5219)

2015-02-13 Thread Gilles Chanteperdrix
Signed-off-by: Gilles Chanteperdrix 
---
 Changelog   |   1 +
 libavcodec/mpegaudio_parser.c   |  14 ++-
 libavcodec/mpegaudiodecheader.c |   3 +-
 libavformat/rtpdec.c|   1 +
 libavformat/rtpdec_formats.h|   1 +
 libavformat/rtpdec_mpeg12.c | 204 
 libavformat/version.h   |   4 +-
 7 files changed, 223 insertions(+), 5 deletions(-)

diff --git a/Changelog b/Changelog
index c663d5e..775fc79 100644
--- a/Changelog
+++ b/Changelog
@@ -23,6 +23,7 @@ version :
 - Changed default DNxHD colour range in QuickTime .mov derivatives to mpeg 
range
 - ported softpulldown filter from libmpcodecs as repeatfields filter
 - dcshift filter
+- RTP parser for loss tolerant payload format for MP3 audio (RFC 5219)
 
 
 version 2.5:
diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c
index 79dbf63..42f4706 100644
--- a/libavcodec/mpegaudio_parser.c
+++ b/libavcodec/mpegaudio_parser.c
@@ -64,7 +64,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
 }else{
 while(icodec_id;
 
 state= (state<<8) + buf[i++];
 
@@ -90,6 +90,16 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
 avctx->bit_rate += (bit_rate - avctx->bit_rate) / 
(s->header_count - header_threshold);
 }
 }
+
+if (s1->flags & PARSER_FLAG_COMPLETE_FRAMES) {
+s->frame_size = 0;
+next = buf_size;
+} else if (codec_id == AV_CODEC_ID_MP3ADU) {
+av_log(avctx, AV_LOG_ERROR,
+"MP3ADU full parser not implemented");
+return AVERROR_PATCHWELCOME;
+}
+
 break;
 }
 }
@@ -110,7 +120,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
 
 
 AVCodecParser ff_mpegaudio_parser = {
-.codec_ids  = { AV_CODEC_ID_MP1, AV_CODEC_ID_MP2, AV_CODEC_ID_MP3 },
+.codec_ids  = { AV_CODEC_ID_MP1, AV_CODEC_ID_MP2, AV_CODEC_ID_MP3, 
AV_CODEC_ID_MP3ADU },
 .priv_data_size = sizeof(MpegAudioParseContext),
 .parser_parse   = mpegaudio_parse,
 .parser_close   = ff_parse_close,
diff --git a/libavcodec/mpegaudiodecheader.c b/libavcodec/mpegaudiodecheader.c
index 5db1957..6af6e4b 100644
--- a/libavcodec/mpegaudiodecheader.c
+++ b/libavcodec/mpegaudiodecheader.c
@@ -134,7 +134,8 @@ int avpriv_mpa_decode_header2(uint32_t head, int 
*sample_rate, int *channels, in
 break;
 default:
 case 3:
-*codec_id = AV_CODEC_ID_MP3;
+if (*codec_id != AV_CODEC_ID_MP3ADU)
+*codec_id = AV_CODEC_ID_MP3;
 if (s->lsf)
 *frame_size = 576;
 else
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 4ff209c..c632340 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -89,6 +89,7 @@ void ff_register_rtp_dynamic_payload_handlers(void)
 ff_register_dynamic_payload_handler(&ff_mp4a_latm_dynamic_handler);
 ff_register_dynamic_payload_handler(&ff_mp4v_es_dynamic_handler);
 ff_register_dynamic_payload_handler(&ff_mpeg_audio_dynamic_handler);
+ff_register_dynamic_payload_handler(&ff_mpeg_audio_robust_dynamic_handler);
 ff_register_dynamic_payload_handler(&ff_mpeg_video_dynamic_handler);
 ff_register_dynamic_payload_handler(&ff_mpeg4_generic_dynamic_handler);
 ff_register_dynamic_payload_handler(&ff_mpegts_dynamic_handler);
diff --git a/libavformat/rtpdec_formats.h b/libavformat/rtpdec_formats.h
index 87e316f..da22d70 100644
--- a/libavformat/rtpdec_formats.h
+++ b/libavformat/rtpdec_formats.h
@@ -52,6 +52,7 @@ extern RTPDynamicProtocolHandler ff_jpeg_dynamic_handler;
 extern RTPDynamicProtocolHandler ff_mp4a_latm_dynamic_handler;
 extern RTPDynamicProtocolHandler ff_mp4v_es_dynamic_handler;
 extern RTPDynamicProtocolHandler ff_mpeg_audio_dynamic_handler;
+extern RTPDynamicProtocolHandler ff_mpeg_audio_robust_dynamic_handler;
 extern RTPDynamicProtocolHandler ff_mpeg_video_dynamic_handler;
 extern RTPDynamicProtocolHandler ff_mpeg4_generic_dynamic_handler;
 extern RTPDynamicProtocolHandler ff_mpegts_dynamic_handler;
diff --git a/libavformat/rtpdec_mpeg12.c b/libavformat/rtpdec_mpeg12.c
index d73ff1e..d99c507 100644
--- a/libavformat/rtpdec_mpeg12.c
+++ b/libavformat/rtpdec_mpeg12.c
@@ -2,6 +2,9 @@
  * Common code for the RTP depacketization of MPEG-1/2 formats.
  * Copyright (c) 2002 Fabrice Bellard
  *
+ * RTP parser for loss tolerant payload format for MP3 audio (RFC 5219)
+ * Copyright (c) 2015 Gilles Chanteperdrix 
+ *
  * This file is part of FFmpeg.
  *
  * FFmpeg is free software; you can redistribute it and/or
@@ -23,6 +26,8 @@
 #include "libavutil/intreadwrite.h"
 #include "rtpdec_formats.h"
 
+#define RTP_MPA_PAYLOAD_HEADER_SIZE 1
+
 static av_cold int mpeg_init(AVFormatContext *ctx, int st_index, 
PayloadContext *data)
 {
   

Re: [FFmpeg-devel] [PATCH 3/3] avcodec/wmalosslessdec: cleanup

2015-02-13 Thread Michael Niedermayer
On Sat, Feb 14, 2015 at 12:53:12AM +0800, zhaoxiu.zeng wrote:
> From 4096d5565e55bdbc3dbe3b0aa3be920f73c00aa8 Mon Sep 17 00:00:00 2001
> From: Zeng Zhaoxiu 
> Date: Sat, 14 Feb 2015 00:27:03 +0800
> Subject: [PATCH 3/3] avcodec/wmalosslessdec: cleanup
> 
> Signed-off-by: Zeng Zhaoxiu 

[...]

> @@ -644,14 +641,10 @@ static void mclms_update(WmallDecodeCtx *s, int icoef, 
> int *pred)
>  }
>  }
>  
> -for (ich = num_channels - 1; ich >= 0; ich--) {
> +for (ich = num_channels; ich-- > 0; ) {

all changes except the ones like above, applied

thanks

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

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


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


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/apedec: move 'coeffs[256] and delay[256]' into, long_filter_high_3800

2015-02-13 Thread Michael Niedermayer
On Sat, Feb 14, 2015 at 12:55:34AM +0800, zhaoxiu.zeng wrote:
> From b6ab794e41c549509c3e2aad30c0fc67726dbd56 Mon Sep 17 00:00:00 2001
> From: Zeng Zhaoxiu 
> Date: Sat, 14 Feb 2015 00:33:32 +0800
> Subject: [PATCH 1/2] avcodec/apedec: move 'coeffs[256] and delay[256]' into
>  long_filter_high_3800

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] matroskaenc: Warning message when RAWVIDEO have unsupported colour space.

2015-02-13 Thread Vitaly _Vi Shukela
Show warning if the resulting file is expected to be unplayable.
The warning also has a hint about NUT format which support more pixel
formats for rawvideo data.

The file is muxed anyway, as it can be useful for some special tools.

Signed-off-by: Vitaly _Vi Shukela 
---
 libavformat/matroskaenc.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index e8e8da0..41a71ae 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -963,6 +963,10 @@ static int mkv_write_track(AVFormatContext *s, 
MatroskaMuxContext *mkv,
 
 if (codec->codec_id == AV_CODEC_ID_RAWVIDEO) {
 uint32_t color_space = av_le2ne32(codec->codec_tag);
+if (!color_space) {
+av_log(s, AV_LOG_ERROR, "Warning: putting raw video in this 
colour space to Matroska is not suppoerted\n"
+"The resulting file will be 
unplayable. Consider NUT format instead.\n");
+}
 put_ebml_binary(pb, MATROSKA_ID_VIDEOCOLORSPACE, &color_space, 
sizeof(color_space));
 }
 
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH] avcodec/golomb: simplify sign conversion

2015-02-13 Thread Michael Niedermayer
On Sat, Feb 14, 2015 at 12:58:58AM +0800, zhaoxiu.zeng wrote:
> From 7d782e106cf485ca9a44d4283a18402bf0a84fb9 Mon Sep 17 00:00:00 2001
> From: Zeng Zhaoxiu 
> Date: Sat, 14 Feb 2015 00:44:39 +0800
> Subject: [PATCH] avcodec/golomb: simplify sign conversion
> 
> Signed-off-by: Zeng Zhaoxiu 

applied

thanks

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

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus


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] avcodec/apedec: simplify sign conversion

2015-02-13 Thread Michael Niedermayer
On Sat, Feb 14, 2015 at 12:56:28AM +0800, zhaoxiu.zeng wrote:
> From fcc874caec6aa2ae439b476559a7a1ee25aecc4e Mon Sep 17 00:00:00 2001
> From: Zeng Zhaoxiu 
> Date: Sat, 14 Feb 2015 00:37:25 +0800
> Subject: [PATCH 2/2] avcodec/apedec: simplify sign conversion

applied

thanks

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

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates


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


[FFmpeg-devel] [RFC][PATCH] ffplay: factorize subtitle rendering code to a private filter

2015-02-13 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 Makefile |   1 +
 doc/ffplay.texi  |   4 +
 ffplay.c | 336 +
 libavfilter/Makefile |   1 +
 libavfilter/vf_ffplay_subtitle.c | 347 +++
 libavfilter/vf_ffplay_subtitle.h |  38 +
 6 files changed, 434 insertions(+), 293 deletions(-)
 create mode 100644 libavfilter/vf_ffplay_subtitle.c
 create mode 100644 libavfilter/vf_ffplay_subtitle.h

diff --git a/Makefile b/Makefile
index 845a274..8b6b914 100644
--- a/Makefile
+++ b/Makefile
@@ -32,6 +32,7 @@ OBJS-ffmpeg   += ffmpeg_opt.o ffmpeg_filter.o
 OBJS-ffmpeg-$(HAVE_VDPAU_X11) += ffmpeg_vdpau.o
 OBJS-ffmpeg-$(HAVE_DXVA2_LIB) += ffmpeg_dxva2.o
 OBJS-ffmpeg-$(CONFIG_VDA) += ffmpeg_vda.o
+OBJS-ffplay   += libavfilter/vf_ffplay_subtitle.o
 OBJS-ffserver += ffserver_config.o
 
 TESTTOOLS   = audiogen videogen rotozoom tiny_psnr tiny_ssim base64
diff --git a/doc/ffplay.texi b/doc/ffplay.texi
index 45731a2..3e66fde 100644
--- a/doc/ffplay.texi
+++ b/doc/ffplay.texi
@@ -91,6 +91,10 @@ syntax.
 You can specify this parameter multiple times and cycle through the specified
 filtergraphs along with the show modes by pressing the key @key{w}.
 
+You can use the special @code{ffplay_subtitle} filter to blend movie subtitles
+onto the video somewhere in the filtergraph. If no such filter is specified, it
+will be implicity added to the output of the filtergraph.
+
 @item -af @var{filtergraph}
 @var{filtergraph} is a description of the filtergraph to apply to
 the input audio.
diff --git a/ffplay.c b/ffplay.c
index 8c62f9c..e49f333 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -52,6 +52,7 @@
 # include "libavfilter/avfilter.h"
 # include "libavfilter/buffersink.h"
 # include "libavfilter/buffersrc.h"
+# include "libavfilter/vf_ffplay_subtitle.h"
 #endif
 
 #include 
@@ -310,7 +311,7 @@ static int screen_width  = 0;
 static int screen_height = 0;
 static int audio_disable;
 static int video_disable;
-static int subtitle_disable;
+static int subtitle_disable = !CONFIG_AVFILTER;
 static const char* wanted_stream_spec[AVMEDIA_TYPE_NB] = {0};
 static int seek_by_bytes = -1;
 static int display_disable;
@@ -825,235 +826,6 @@ static void fill_border(int xleft, int ytop, int width, 
int height, int x, int y
color, update);
 }
 
-#define ALPHA_BLEND(a, oldp, newp, s)\
-oldp << s) * (255 - (a))) + (newp * (a))) / (255 << s))
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
-unsigned int v = ((const uint32_t *)(s))[0];\
-a = (v >> 24) & 0xff;\
-r = (v >> 16) & 0xff;\
-g = (v >> 8) & 0xff;\
-b = v & 0xff;\
-}
-
-#define YUVA_IN(y, u, v, a, s, pal)\
-{\
-unsigned int val = ((const uint32_t *)(pal))[*(const uint8_t*)(s)];\
-a = (val >> 24) & 0xff;\
-y = (val >> 16) & 0xff;\
-u = (val >> 8) & 0xff;\
-v = val & 0xff;\
-}
-
-#define YUVA_OUT(d, y, u, v, a)\
-{\
-((uint32_t *)(d))[0] = (a << 24) | (y << 16) | (u << 8) | v;\
-}
-
-
-#define BPP 1
-
-static void blend_subrect(AVPicture *dst, const AVSubtitleRect *rect, int 
imgw, int imgh)
-{
-int wrap, wrap3, width2, skip2;
-int y, u, v, a, u1, v1, a1, w, h;
-uint8_t *lum, *cb, *cr;
-const uint8_t *p;
-const uint32_t *pal;
-int dstx, dsty, dstw, dsth;
-
-dstw = av_clip(rect->w, 0, imgw);
-dsth = av_clip(rect->h, 0, imgh);
-dstx = av_clip(rect->x, 0, imgw - dstw);
-dsty = av_clip(rect->y, 0, imgh - dsth);
-lum = dst->data[0] + dsty * dst->linesize[0];
-cb  = dst->data[1] + (dsty >> 1) * dst->linesize[1];
-cr  = dst->data[2] + (dsty >> 1) * dst->linesize[2];
-
-width2 = ((dstw + 1) >> 1) + (dstx & ~dstw & 1);
-skip2 = dstx >> 1;
-wrap = dst->linesize[0];
-wrap3 = rect->pict.linesize[0];
-p = rect->pict.data[0];
-pal = (const uint32_t *)rect->pict.data[1];  /* Now in YCrCb! */
-
-if (dsty & 1) {
-lum += dstx;
-cb += skip2;
-cr += skip2;
-
-if (dstx & 1) {
-YUVA_IN(y, u, v, a, p, pal);
-lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
-cb[0] = ALPHA_BLEND(a >> 2, cb[0], u, 0);
-cr[0] = ALPHA_BLEND(a >> 2, cr[0], v, 0);
-cb++;
-cr++;
-lum++;
-p += BPP;
-}
-for (w = dstw - (dstx & 1); w >= 2; w -= 2) {
-YUVA_IN(y, u, v, a, p, pal);
-u1 = u;
-v1 = v;
-a1 = a;
-lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
-
-YUVA_IN(y, u, v, a, p + BPP, pal);
-u1 += u;
-v1 += v;
-a1 += a;
-lum[1] = ALPHA_BLEND(a, lum[1], y, 0);
-cb[0] = ALPHA_BLEND(a1 >> 2, cb[0], u1, 1);
-cr[0] = ALPHA_BLEND(a1 >> 2, cr[0], v1, 1);
-cb++;
-cr++;
-p += 2 * BPP;
-lum += 2;
-}
-if (w) {
- 

[FFmpeg-devel] [PATCH 2/2] avformat/utils: If scan_all_pmts is explicitly disabled then skip streams outside programs in avformat_find_stream_info()

2015-02-13 Thread Michael Niedermayer
This reduces the startup delay if such streams exist and never get fully 
analyzed

Signed-off-by: Michael Niedermayer 
---
 libavformat/utils.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index fb79ecd..bcfadef 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3013,6 +3013,7 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
 int64_t max_analyze_duration = ic->max_analyze_duration2;
 int64_t max_stream_analyze_duration;
 int64_t probesize = ic->probesize2;
+int64_t scan_all_pmts = -1;
 
 if (!max_analyze_duration)
 max_analyze_duration = ic->max_analyze_duration;
@@ -3021,6 +3022,7 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
 flush_codecs = probesize > 0;
 
 av_opt_set(ic, "skip_clear", "1", AV_OPT_SEARCH_CHILDREN);
+av_opt_get_int(ic, "scan_all_pmts", AV_OPT_SEARCH_CHILDREN, 
&scan_all_pmts);
 
 max_stream_analyze_duration = max_analyze_duration;
 if (!max_analyze_duration) {
@@ -3112,6 +3114,10 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
 int fps_analyze_framecount = 20;
 
 st = ic->streams[i];
+
+if (ic->nb_programs && !scan_all_pmts && 
!av_find_program_from_stream(ic, NULL, i))
+continue;
+
 if (!has_codec_parameters(st, NULL))
 break;
 /* If the timebase is coarse (like the usual millisecond precision
-- 
1.7.9.5

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


[FFmpeg-devel] [PATCH 1/2] avformat: Optimize av_find_program_from_stream() so it is O(1) instead of O(streams*programs)

2015-02-13 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavformat/avformat.h |5 +
 libavformat/mpegts.c   |3 +++
 libavformat/utils.c|   10 ++
 3 files changed, 18 insertions(+)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 3007f81..3dbbaca 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -,6 +,11 @@ typedef struct AVStream {
  * - decoding: Set by libavformat to calculate sample_aspect_ratio 
internally
  */
 AVRational display_aspect_ratio;
+
+/**
+ * Internal data for optimizig finding AVPrograms
+ */
+int program_index;
 } AVStream;
 
 AVRational av_stream_get_r_frame_rate(const AVStream *s);
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index afda648..0d7eb65 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -263,6 +263,9 @@ static void clear_avprogram(MpegTSContext *ts, unsigned int 
programid)
 }
 if (!prg)
 return;
+for (i = 0; inb_stream_indexes; i++) {
+ts->stream->streams[prg->stream_index[i]]->program_index = INT_MAX;
+}
 prg->nb_stream_indexes = 0;
 }
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 917f8ce..fb79ecd 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3455,6 +3455,12 @@ AVProgram *av_find_program_from_stream(AVFormatContext 
*ic, AVProgram *last, int
 {
 int i, j;
 
+i = ic->streams[s]->program_index;
+if (inb_programs);
+return ic->programs[i];
+}
+
 for (i = 0; i < ic->nb_programs; i++) {
 if (ic->programs[i] == last) {
 last = NULL;
@@ -3707,6 +3713,7 @@ AVStream *avformat_new_stream(AVFormatContext *s, const 
AVCodec *c)
 st->info->fps_last_dts  = AV_NOPTS_VALUE;
 
 st->inject_global_side_data = s->internal->inject_global_side_data;
+st->program_index = INT_MAX;
 
 s->streams[s->nb_streams++] = st;
 return st;
@@ -3774,6 +3781,7 @@ void ff_program_add_stream_index(AVFormatContext *ac, int 
progid, unsigned idx)
 {
 int i, j;
 AVProgram *program = NULL;
+AVStream *st = ac->streams[idx];
 void *tmp;
 
 if (idx >= ac->nb_streams) {
@@ -3794,6 +3802,8 @@ void ff_program_add_stream_index(AVFormatContext *ac, int 
progid, unsigned idx)
 return;
 program->stream_index = tmp;
 program->stream_index[program->nb_stream_indexes++] = idx;
+st->program_index = FFMIN(st->program_index, i);
+
 return;
 }
 }
-- 
1.7.9.5

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