Re: [FFmpeg-devel] [PATCH 05/11] avcodec/mips: loongson optimize mpegvideo with mmi v2

2016-05-16 Thread 周晓勇
avcodec/mips/mpegvideo_mmi: Version 2 of the optimizations for loongson mmi

1. no longer use the register names directly and optimized code format
2. to be compatible with O32, specify type of address variable with 
mips_reg and handle the address variable with PTR_ operator








在 2016-05-13 18:04:34,"周晓勇"  写道:

From cb8887caf25b300ef2f307f930593e9edf394977 Mon Sep 17 00:00:00 2001
From: Zhou Xiaoyong 
Date: Thu, 12 May 2016 01:48:03 +0800
Subject: [PATCH 05/11] avcodec/mips: loongson optimize mpegvideo with mmi v2


---
 libavcodec/mips/mpegvideo_mmi.c | 667 +---
 1 file changed, 358 insertions(+), 309 deletions(-)


diff --git a/libavcodec/mips/mpegvideo_mmi.c b/libavcodec/mips/mpegvideo_mmi.c
index 94781e6..450a18c 100644
--- a/libavcodec/mips/mpegvideo_mmi.c
+++ b/libavcodec/mips/mpegvideo_mmi.c
@@ -23,11 +23,14 @@
  */
 
 #include "mpegvideo_mips.h"
+#include "libavutil/mips/asmdefs.h"
 
 void ff_dct_unquantize_h263_intra_mmi(MpegEncContext *s, int16_t *block,
 int n, int qscale)
 {
 int64_t level, qmul, qadd, nCoeffs;
+double ftmp[6];
+mips_reg addr[1];
 
 qmul = qscale << 1;
 av_assert2(s->block_last_index[n]>=0 || s->h263_aic);
@@ -49,48 +52,50 @@ void ff_dct_unquantize_h263_intra_mmi(MpegEncContext *s, 
int16_t *block,
 nCoeffs = s->inter_scantable.raster_end[s->block_last_index[n]];
 
 __asm__ volatile (
-"xor $f12, $f12, $f12   \r\n"
-"lwc1 $f12, %1  \n\r"
-"xor $f10, $f10, $f10   \r\n"
-"lwc1 $f10, %2  \r\n"
-"xor $f14, $f14, $f14   \r\n"
-"packsswh $f12, $f12, $f12  \r\n"
-"packsswh $f12, $f12, $f12  \r\n"
-"packsswh $f10, $f10, $f10  \r\n"
-"packsswh $f10, $f10, $f10  \r\n"
-"psubh $f14, $f14, $f10 \r\n"
-"xor $f8, $f8, $f8  \r\n"
-".p2align 4 \r\n"
-"1: \r\n"
-"daddu $8, %0, %3   \r\n"
-"gsldlc1 $f0, 7($8) \r\n"
-"gsldrc1 $f0, 0($8) \r\n"
-"gsldlc1 $f2, 15($8)\r\n"
-"gsldrc1 $f2, 8($8) \r\n"
-"mov.d $f4, $f0 \r\n"
-"mov.d $f6, $f2 \r\n"
-"pmullh $f0, $f0, $f12  \r\n"
-"pmullh $f2, $f2, $f12  \r\n"
-"pcmpgth $f4, $f4, $f8  \r\n"
-"pcmpgth $f6, $f6, $f8  \r\n"
-"xor $f0, $f0, $f4  \r\n"
-"xor $f2, $f2, $f6  \r\n"
-"paddh $f0, $f0, $f14   \r\n"
-"paddh $f2, $f2, $f14   \r\n"
-"xor $f4, $f4, $f0  \r\n"
-"xor $f6, $f6, $f2  \r\n"
-"pcmpeqh $f0, $f0, $f14 \r\n"
-"pcmpeqh $f2, $f2, $f14 \r\n"
-"pandn $f0, $f0, $f4\r\n"
-"pandn $f2, $f2, $f6\r\n"
-"gssdlc1 $f0, 7($8) \r\n"
-"gssdrc1 $f0, 0($8) \r\n"
-"gssdlc1 $f2, 15($8)\r\n"
-"gssdrc1 $f2, 8($8) \r\n"
-"addi %3, %3, 16\r\n"
-"blez %3, 1b\r\n"
-::"r"(block+nCoeffs),"m"(qmul),"m"(qadd),"r"(2*(-nCoeffs))
-:"$8","memory"
+"xor%[ftmp0],   %[ftmp0],   %[ftmp0]\n\t"
+"packsswh   %[qmul],%[qmul],%[qmul] \n\t"
+"packsswh   %[qmul],%[qmul],%[qmul] \n\t"
+"packsswh   %[qadd],%[qadd],%[qadd] \n\t"
+"packsswh   %[qadd],%[qadd],%[qadd] \n\t"
+"psubh  %[ftmp0],   %[ftmp0],   %[qadd] \n\t"
+"xor%[ftmp5],   %[ftmp5],   %[ftmp5]\n\t"
+".p2align   4   \n\t"
+"1: \n\t"
+PTR_ADDU   "%[addr0],   %[block],   %[nCoeffs]  \n\t"
+"gsldlc1%[ftmp1],   0x07(%[addr0])  \n\t"
+"gsldrc1%[ftmp1],   0x00(%[addr0])  \n\t"
+"gsldlc1%[ftmp2],   0x0f(%[addr0])  \n\t"
+"gsldrc1%[ftmp2],   0x08(%[addr0])  \n\t"
+"mov.d  %[ftmp3],   %[ftmp1]\n\t"
+"mov.d  %[ftmp4],   %[ftmp2]\n\t"
+"pmullh %[ftmp1],   %[ftmp1],   %[qmul] \n\t"
+"pmullh %[ftmp2],   %[ftmp2],   %[qmul] \n\t"
+"pcmpgth%[ftmp3],   %[ftmp3],   %[ftmp5]\n\t"
+"pcmpgth%[ftmp4],   %[ftmp4], 

Re: [FFmpeg-devel] [PATCH 04/11] avcodec/mips: loongson optimize h264chroma with mmi v2

2016-05-16 Thread 周晓勇
avcodec/mips/h264chroma_mmi: Version 2 of the optimizations for loongson mmi

1. no longer use the register names directly and optimized code format
2. to be compatible with O32, specify type of address variable with 
mips_reg and handle the address variable with PTR_ operator
3. use uld and mtc1 to workaround cpu 3A2000 gslwlc1 bug (gslwlc1 
instruction extension bug in O32 ABI)








在 2016-05-13 18:04:02,"周晓勇"  写道:

From 157e001724cdb1461ecfff2f02d0a7b0d6335943 Mon Sep 17 00:00:00 2001
From: ZhouXiaoyong 
Date: Sat, 7 May 2016 14:20:49 +0800
Subject: [PATCH 04/11] avcodec/mips: loongson optimize h264chroma with mmi v2


---
 libavcodec/mips/h264chroma_mmi.c | 1123 +-
 1 file changed, 629 insertions(+), 494 deletions(-)


diff --git a/libavcodec/mips/h264chroma_mmi.c b/libavcodec/mips/h264chroma_mmi.c
index ef29476..3dd123d 100644
--- a/libavcodec/mips/h264chroma_mmi.c
+++ b/libavcodec/mips/h264chroma_mmi.c
@@ -23,6 +23,8 @@
  */
 
 #include "h264chroma_mips.h"
+#include "constants.h"
+#include "libavutil/mips/asmdefs.h"
 
 void ff_put_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, int stride,
 int h, int x, int y)
@@ -32,171 +34,177 @@ void ff_put_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t 
*src, int stride,
 const int C = (8 - x) * y;
 const int D = x * y;
 const int E = B + C;
-int i;
-
-av_assert2(x<8 && y<8 && x>=0 && y>=0);
+double ftmp[10];
+uint64_t tmp[1];
+mips_reg addr[1];
 
 if (D) {
-for (i=0; i

Re: [FFmpeg-devel] 回复: Re: [PATCH 03/11] avcodec/mips: loongson optimize h264dsp with mmi v2

2016-05-16 Thread Michael Niedermayer
Hi

On Mon, May 16, 2016 at 11:49:29PM +0800, 周晓勇 wrote:
> it's for most of all the optimization patches, so should i recommit all 
> patches with expatiation?
> 
> 
> 
> 
> 
> 在2016年05月16日 22:46 ,Michael Niedermayer写道:
> 
> On Mon, May 16, 2016 at 12:50:15PM +0800, 周晓勇 wrote:
> > 1.no longer use register name directly and optimized code format
> > 2.to be compatibal with O32, specify type of address variable with mips_reg 
> > and handle the address varialbe with PTR_ operator
> > 3.optimize some unalignment faults in load and store
> > 4.use uld and mtc1 to workaround cpu 3A2000 gslwlc1 bug (gslwlc1 
> > instruction extension bug in O32 ABI)
> 
> does this apply to just this patch or all patches or what should
> be done with the others ?
> every needs a good commit message

if the same message applies to all then resubmiting should not be
needed

if some should have a different message then please tell me which
need what

applied this patch with the new message

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


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


Re: [FFmpeg-devel] [PATCH] avformat/utils: Check negative bps before shifting in ff_get_pcm_codec_id()

2016-05-16 Thread Michael Niedermayer
On Mon, May 16, 2016 at 03:21:43PM -0700, chcunning...@chromium.org wrote:
> From: Chris Cunningham 
> 
> Fixes: undefined shift.
> ---
>  libavformat/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 5f5f03e..ad5cfa2 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -2955,7 +2955,7 @@ enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, 
> unsigned int tag)
>  
>  enum AVCodecID ff_get_pcm_codec_id(int bps, int flt, int be, int sflags)
>  {
> -if (bps > 64U)
> +if (bps <= 0 || bps > 64U)

the U is no longer needed if < 0 is explicitly checked for

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

Never trust a computer, one day, it may think you are the virus. -- Compn


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


Re: [FFmpeg-devel] [PATCH] Respect payload offset in av_grow_packet

2016-05-16 Thread Michael Niedermayer
On Mon, May 16, 2016 at 12:25:00PM +0300, Andriy Lysnevych wrote:
> Sorry, looks like problems with my mail client. Sending patch as attachment.

>  avpacket.c |   25 +++--
>  1 file changed, 15 insertions(+), 10 deletions(-)
> 7afc9ec25e99e6106402207ce30714a3e65a9639  
> 0001-Respect-payload-offset-in-av_grow_packet.patch
> From 45f69d7f02928ad8abae3fc591082997590c597a Mon Sep 17 00:00:00 2001
> From: Andriy Lysnevych 
> Date: Mon, 16 May 2016 12:08:33 +0300
> Subject: [PATCH] Respect payload offset in av_grow_packet
> 
> ---
>  libavcodec/avpacket.c | 25 +++--
>  1 file changed, 15 insertions(+), 10 deletions(-)
> 
> diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
> index bcc7c79..327cd41 100644
> --- a/libavcodec/avpacket.c
> +++ b/libavcodec/avpacket.c
> @@ -110,24 +110,29 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
>  {
>  int new_size;
>  av_assert0((unsigned)pkt->size <= INT_MAX - 
> AV_INPUT_BUFFER_PADDING_SIZE);
> -if (!pkt->size)
> -return av_new_packet(pkt, grow_by);
> -if ((unsigned)grow_by >
> -INT_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE))
> -return -1;
>  
>  new_size = pkt->size + grow_by + AV_INPUT_BUFFER_PADDING_SIZE;

you remove the overflow check, which makes this undefined behavior
(note that this is also so when the value is not used)

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 1
"Used only once"- "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."


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] avformat/dtshddec: parse chunks stored after audio data

2016-05-16 Thread James Almer
On 5/16/2016 5:50 PM, Paul B Mahol wrote:
> On 5/16/16, James Almer  wrote:
>> Signed-off-by: James Almer 
>> ---
>> The samples in fate have three to four chunks after the STRMDATA one, for
>> example.
>>
>>  libavformat/dtshddec.c | 20 
>>  1 file changed, 16 insertions(+), 4 deletions(-)
>>
> 
> lgtm

Patchset pushed, thanks.

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


Re: [FFmpeg-devel] [PATCH 1/2] avformat/dtshddec: parse chunks stored after audio data

2016-05-16 Thread Paul B Mahol
On 5/16/16, James Almer  wrote:
> Signed-off-by: James Almer 
> ---
> The samples in fate have three to four chunks after the STRMDATA one, for
> example.
>
>  libavformat/dtshddec.c | 20 
>  1 file changed, 16 insertions(+), 4 deletions(-)
>

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


Re: [FFmpeg-devel] [PATCH 2/2] avformat/dtshddec: implement AUPR_HDR chunk parsing

2016-05-16 Thread Paul B Mahol
On 5/16/16, James Almer  wrote:
> This allow the demuxer to always report a proper stream duration, and
> more detailed stream information if no decoder is available.
>
> Signed-off-by: James Almer 
> ---
>  libavformat/dtshddec.c | 24 +++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
>

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


[FFmpeg-devel] [PATCH] -- Add input swap functionality to movie filter(src_movie.c)

2016-05-16 Thread Felt, Patrick
This is a rework of the previously submitted patch to not require globals.  
I’ve also renamed variables per standard.  Attached is the output of git 
format-patch (let me know if I should just paste contents into the body in the 
future.  This just felt a little cleaner).





swap-official-patch
Description: swap-official-patch
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] avformat/dtshddec: implement AUPR_HDR chunk parsing

2016-05-16 Thread James Almer
This allow the demuxer to always report a proper stream duration, and
more detailed stream information if no decoder is available.

Signed-off-by: James Almer 
---
 libavformat/dtshddec.c | 24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/libavformat/dtshddec.c b/libavformat/dtshddec.c
index 1fba957..c4ca3b4 100644
--- a/libavformat/dtshddec.c
+++ b/libavformat/dtshddec.c
@@ -21,7 +21,9 @@
 
 #include "libavutil/intreadwrite.h"
 #include "libavutil/dict.h"
+#include "libavcodec/dca.h"
 #include "avformat.h"
+#include "internal.h"
 
 #define AUPR_HDR 0x415550522D484452
 #define AUPRINFO 0x41555052494E464F
@@ -54,6 +56,7 @@ static int dtshd_read_header(AVFormatContext *s)
 DTSHDDemuxContext *dtshd = s->priv_data;
 AVIOContext *pb = s->pb;
 uint64_t chunk_type, chunk_size;
+int64_t duration;
 AVStream *st;
 int ret;
 char *value;
@@ -88,9 +91,24 @@ static int dtshd_read_header(AVFormatContext *s)
 if (dtshd->data_end <= chunk_size)
 return AVERROR_INVALIDDATA;
 if (!pb->seekable)
-return 0;
+goto break_loop;
 goto skip;
 break;
+case AUPR_HDR:
+if (chunk_size < 21)
+return AVERROR_INVALIDDATA;
+avio_skip(pb, 3);
+st->codecpar->sample_rate = avio_rb24(pb);
+if (!st->codecpar->sample_rate)
+return AVERROR_INVALIDDATA;
+duration  = avio_rb32(pb); // num_frames
+duration *= avio_rb16(pb); // samples_per_frames
+st->duration = duration;
+avio_skip(pb, 5);
+st->codecpar->channels = ff_dca_count_chs_for_mask(avio_rb16(pb));
+st->codecpar->initial_padding = avio_rb16(pb);
+avio_skip(pb, chunk_size - 21);
+break;
 case FILEINFO:
 if (chunk_size > INT_MAX)
 goto skip;
@@ -115,6 +133,10 @@ skip:
 
 avio_seek(pb, dtshd->data_start, SEEK_SET);
 
+break_loop:
+if (st->codecpar->sample_rate)
+avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
+
 return 0;
 }
 
-- 
2.8.1

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


[FFmpeg-devel] [PATCH 1/2] avformat/dtshddec: parse chunks stored after audio data

2016-05-16 Thread James Almer
Signed-off-by: James Almer 
---
The samples in fate have three to four chunks after the STRMDATA one, for 
example.

 libavformat/dtshddec.c | 20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/libavformat/dtshddec.c b/libavformat/dtshddec.c
index f3af096..1fba957 100644
--- a/libavformat/dtshddec.c
+++ b/libavformat/dtshddec.c
@@ -38,6 +38,7 @@
 #define TIMECODE 0x54494D45434F4445
 
 typedef struct DTSHDDemuxContext {
+uint64_tdata_start;
 uint64_tdata_end;
 } DTSHDDemuxContext;
 
@@ -64,10 +65,13 @@ static int dtshd_read_header(AVFormatContext *s)
 st->codecpar->codec_id   = AV_CODEC_ID_DTS;
 st->need_parsing = AVSTREAM_PARSE_FULL_RAW;
 
-while (!avio_feof(pb)) {
+for (;;) {
 chunk_type = avio_rb64(pb);
 chunk_size = avio_rb64(pb);
 
+if (avio_feof(pb))
+break;
+
 if (chunk_size < 4) {
 av_log(s, AV_LOG_ERROR, "chunk size too small\n");
 return AVERROR_INVALIDDATA;
@@ -79,10 +83,13 @@ static int dtshd_read_header(AVFormatContext *s)
 
 switch (chunk_type) {
 case STRMDATA:
-dtshd->data_end = chunk_size + avio_tell(pb);
+dtshd->data_start = avio_tell(pb);
+dtshd->data_end = dtshd->data_start + chunk_size;
 if (dtshd->data_end <= chunk_size)
 return AVERROR_INVALIDDATA;
-return 0;
+if (!pb->seekable)
+return 0;
+goto skip;
 break;
 case FILEINFO:
 if (chunk_size > INT_MAX)
@@ -103,7 +110,12 @@ skip:
 };
 }
 
-return AVERROR_EOF;
+if (!dtshd->data_end)
+return AVERROR_EOF;
+
+avio_seek(pb, dtshd->data_start, SEEK_SET);
+
+return 0;
 }
 
 static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
-- 
2.8.1

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


Re: [FFmpeg-devel] [PATCH 2/3] avcodec/aacenc_is: Assert that minthr is not 0.0, this would lead to division by 0 later

2016-05-16 Thread Claudio Freire
On Mon, May 16, 2016 at 12:26 PM, Kieran Kunhya  wrote:
>> Testcase is fate-aac-pred-encode
>>
>> Signed-off-by: Michael Niedermayer 
>> ---
>>  libavcodec/aacenc_is.c |3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/libavcodec/aacenc_is.c b/libavcodec/aacenc_is.c
>> index 473897b..e5cfa14 100644
>> --- a/libavcodec/aacenc_is.c
>> +++ b/libavcodec/aacenc_is.c
>> @@ -64,6 +64,9 @@ struct AACISError ff_aac_is_encoding_err(AACEncContext
>> *s, ChannelElement *cpe,
>>  abs_pow34_v(I34, IS,   sce0->ics.swb_sizes[g]);
>>  maxval = find_max_val(1, sce0->ics.swb_sizes[g], I34);
>>  is_band_type = find_min_book(maxval, is_sf_idx);
>> +
>> +av_assert0(minthr != 0.0);
>> +
>>  dist1 += quantize_band_cost(s, [start + (w+w2)*128], L34,
>>  sce0->ics.swb_sizes[g],
>>  sce0->sf_idx[w*16+g],
>> --
>> 1.7.9.5
>>
>>
>>
> Does this assert on actual input data?

A threshold of 0 would in theory cause a zeroed band (zeroes[i] == 1),
and those should be skipped.

I think the proper fix would be figuring out why those aren't being
skipped, if that is the case.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] 回复: Re: [PATCH 03/11] avcodec/mips: loongson optimize h264dsp with mmi v2

2016-05-16 Thread 周晓勇
it's for most of all the optimization patches, so should i recommit all patches 
with expatiation?





在2016年05月16日 22:46 ,Michael Niedermayer写道:

On Mon, May 16, 2016 at 12:50:15PM +0800, 周晓勇 wrote:
> 1.no longer use register name directly and optimized code format
> 2.to be compatibal with O32, specify type of address variable with mips_reg 
> and handle the address varialbe with PTR_ operator
> 3.optimize some unalignment faults in load and store
> 4.use uld and mtc1 to workaround cpu 3A2000 gslwlc1 bug (gslwlc1 instruction 
> extension bug in O32 ABI)

does this apply to just this patch or all patches or what should
be done with the others ?
every needs a good commit message

[...]

--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Updated (v3) -- Add input mode autodetect to the decklink module.

2016-05-16 Thread Felt, Patrick
bump

On 5/12/16, 4:07 PM, "ffmpeg-devel on behalf of Felt, Patrick" 
 wrote:

>I hang my head in shame.  I neglected to notice that time wasn’t already 
>included and so I had to modify the patch.  Apologies for the noise.
>
>-- Add input mode autodetect to the decklink module. Previously users had to 
>supply the input format like this 'DeckLink Device@modenum'.  This patch 
>allows users to either leave it off completely, or supply 0 or negative number 
>to indicate autodetect is requested. Autodetect only works the first time so 
>if the mode changes mid stream you'll die
>
>---
> libavdevice/decklink_common.cpp | 110 
> libavdevice/decklink_common.h   |   5 ++
> libavdevice/decklink_common_c.h |   1 +
> libavdevice/decklink_dec.cpp|  86 +--
> libavdevice/decklink_dec_c.c|   1 +
> 5 files changed, 188 insertions(+), 15 deletions(-)
>
>diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp
>index ac7964c..1d51294 100644
>--- a/libavdevice/decklink_common.cpp
>+++ b/libavdevice/decklink_common.cpp
>@@ -98,6 +98,90 @@ HRESULT ff_decklink_get_display_name(IDeckLink *This, const 
>char **displayName)
> return hr;
> }
> 
>+long ff_decklink_mode_to_bm(AVFormatContext *avctx,
>+   decklink_direction_t direction,
>+   int ffmpeg_mode,
>+   IDeckLinkDisplayMode **mode)
>+{
>+struct decklink_cctx *cctx = (struct decklink_cctx *) avctx->priv_data;
>+struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
>+IDeckLinkDisplayModeIterator *itermode;
>+IDeckLinkDisplayMode *internal_mode;
>+
>+int result=0;
>+HRESULT res;
>+
>+if (direction == DIRECTION_IN) {
>+res = ctx->dli->GetDisplayModeIterator ();
>+} else {
>+res = ctx->dlo->GetDisplayModeIterator ();
>+}
>+
>+if (res != S_OK) {
>+av_log(avctx, AV_LOG_ERROR, "Could not get the mode iterator\n");
>+return -1;
>+}
>+
>+while (itermode->Next(_mode) == S_OK) {
>+if (++result == ffmpeg_mode) {
>+break;
>+}
>+
>+internal_mode->Release();
>+}
>+
>+itermode->Release();
>+if (internal_mode) {
>+result = internal_mode->GetDisplayMode();
>+if (mode) {
>+*mode = internal_mode;
>+} else {
>+internal_mode->Release();
>+}
>+
>+return result;
>+}
>+
>+return 0;
>+}
>+
>+int ff_decklink_mode_to_ffmpeg(AVFormatContext *avctx,
>+   decklink_direction_t direction,
>+   IDeckLinkDisplayMode **mode)
>+{
>+struct decklink_cctx *cctx = (struct decklink_cctx *) avctx->priv_data;
>+struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
>+IDeckLinkDisplayModeIterator *itermode;
>+IDeckLinkDisplayMode *internal_mode;
>+long bdm_mode_number = (*mode)->GetDisplayMode();
>+int result=1, found=0;
>+HRESULT res;
>+
>+if (direction == DIRECTION_IN) {
>+res = ctx->dli->GetDisplayModeIterator ();
>+} else {
>+res = ctx->dlo->GetDisplayModeIterator ();
>+}
>+
>+if (res != S_OK) {
>+av_log(avctx, AV_LOG_ERROR, "Could not get the mode iterator\n");
>+return -1;
>+}
>+
>+while (itermode->Next(_mode) == S_OK) {
>+if (internal_mode->GetDisplayMode() == bdm_mode_number) {
>+internal_mode->Release();
>+found = 1;
>+break;
>+}
>+internal_mode->Release();
>+result++;
>+}
>+
>+itermode->Release();
>+return (found) ? result : -1;
>+}
>+
> int ff_decklink_set_format(AVFormatContext *avctx,
>int width, int height,
>int tb_num, int tb_den,
>@@ -197,6 +281,29 @@ int ff_decklink_list_devices(AVFormatContext *avctx)
> return 0;
> }
> 
>+int ff_decklink_device_autodetect(AVFormatContext *avctx)
>+{
>+HRESULT res;
>+struct decklink_cctx *cctx = (struct decklink_cctx *) avctx->priv_data;
>+struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
>+IDeckLinkAttributes *attrs = NULL;
>+bool auto_detect;
>+
>+res = ctx->dl->QueryInterface(IID_IDeckLinkAttributes, (void**));
>+if (res != S_OK) {
>+av_log(avctx, AV_LOG_ERROR, "Could not get decklink attributes\n");
>+return -1;
>+}
>+
>+res = attrs->GetFlag(BMDDeckLinkSupportsInputFormatDetection, 
>_detect);
>+if (res != S_OK) {
>+av_log(avctx, AV_LOG_ERROR, "Attribute fetch failed\n");
>+return -1;
>+}
>+
>+return (auto_detect) ? 1 : 0;
>+}
>+
> int ff_decklink_list_formats(AVFormatContext *avctx, decklink_direction_t 
> direction)
> {
> struct decklink_cctx *cctx = (struct decklink_cctx *) avctx->priv_data;
>@@ -219,6 +326,9 @@ int 

Re: [FFmpeg-devel] why ffmpeg reports error when decoding rm or rmvb files

2016-05-16 Thread Moritz Barsnick
On Mon, May 16, 2016 at 09:46:15 -0400, compn wrote:
> > I'm using the following command to decode some rm and rmvb files, and
> > ffmpeg reports error as shown below:
> 
> hi, does error still occur with latest 2016 ffmpeg?

I believe this patch was Carl Eugen's suggestion for a fix, but the
thread went OT...
http://ffmpeg.org/pipermail/ffmpeg-devel/2016-May/194083.html

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


Re: [FFmpeg-devel] [PATCH 03/11] avcodec/mips: loongson optimize h264dsp with mmi v2

2016-05-16 Thread Michael Niedermayer
On Mon, May 16, 2016 at 12:50:15PM +0800, 周晓勇 wrote:
> 1.no longer use register name directly and optimized code format
> 2.to be compatibal with O32, specify type of address variable with mips_reg 
> and handle the address varialbe with PTR_ operator
> 3.optimize some unalignment faults in load and store
> 4.use uld and mtc1 to workaround cpu 3A2000 gslwlc1 bug (gslwlc1 instruction 
> extension bug in O32 ABI)

does this apply to just this patch or all patches or what should
be done with the others ?
every needs a good commit message

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] why ffmpeg reports error when decoding rm or rmvb files

2016-05-16 Thread compn
On Mon, 16 May 2016 17:35:03 +0800 (CST)
qw  wrote:

> Hi,
> 
> I'm using the following command to decode some rm and rmvb files, and
> ffmpeg reports error as shown below:
> 
> [root@PT-18376 test-clips]# ffmpeg -i hanma.rm -xerror -f
> null /dev/null ffmpeg version 2.8.3 Copyright (c) 2000-2015 the
> FFmpeg developers built with icc (ICC) 14.0.2 20140120

hi, does error still occur with latest 2016 ffmpeg?

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


Re: [FFmpeg-devel] [PATCH 3/3] avcodec/wmalosslessdec: Use unsigned operations for overflowing cases

2016-05-16 Thread Michael Niedermayer
On Mon, May 16, 2016 at 02:31:20PM +0200, Paul B Mahol wrote:
> On 5/16/16, Michael Niedermayer  wrote:
> > Fixes undefined behavior in fate-lossless-wma24-2
> >
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/lossless_audiodsp.c |4 ++--
> >  libavcodec/wmalosslessdec.c|6 +++---
> >  2 files changed, 5 insertions(+), 5 deletions(-)
> >
> 
> 
> You sure this doesn't introduce artifacts?

It only changes cases that are undefined in C, so before this patch
its certainly wrong as different compilers with different options
will do different things (thats how i found it)

see 
http://fatebeta.ffmpeg.org/report/x86_64-freebsd10-clang33-ftrapv/20160515224104#failed_tests

If its as intended after the patch i dont know. I hoped somone would
know when seeing the patch, thats why i posted it ...
but fate still passes and all the changed cases are from fate testcases


[...]
-- 
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 3/3] avcodec/wmalosslessdec: Use unsigned operations for overflowing cases

2016-05-16 Thread Paul B Mahol
On 5/16/16, Michael Niedermayer  wrote:
> Fixes undefined behavior in fate-lossless-wma24-2
>
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/lossless_audiodsp.c |4 ++--
>  libavcodec/wmalosslessdec.c|6 +++---
>  2 files changed, 5 insertions(+), 5 deletions(-)
>


You sure this doesn't introduce artifacts?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/3] avcodec/lpc: Avoid smearing NaNs in compute_ref_coefs()

2016-05-16 Thread Michael Niedermayer
Testcase is fate

Signed-off-by: Michael Niedermayer 
---
 libavcodec/lpc.h |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/lpc.h b/libavcodec/lpc.h
index edb1a6b..2c32409 100644
--- a/libavcodec/lpc.h
+++ b/libavcodec/lpc.h
@@ -149,7 +149,11 @@ static inline void compute_ref_coefs(const LPC_TYPE 
*autoc, int max_order,
 gen1[j] = gen1[j + 1] + ref[i - 1] * gen0[j];
 gen0[j] = gen1[j + 1] * ref[i - 1] + gen0[j];
 }
-ref[i] = -gen1[0] / err;
+
+if (gen1[0] == 0 && err == 0)
+ref[i] = 0;
+else
+ref[i] = -gen1[0] / err;
 err   +=  gen1[0] * ref[i];
 if (error)
 error[i] = err;
-- 
1.7.9.5

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


[FFmpeg-devel] [PATCH 3/3] avcodec/wmalosslessdec: Use unsigned operations for overflowing cases

2016-05-16 Thread Michael Niedermayer
Fixes undefined behavior in fate-lossless-wma24-2

Signed-off-by: Michael Niedermayer 
---
 libavcodec/lossless_audiodsp.c |4 ++--
 libavcodec/wmalosslessdec.c|6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/lossless_audiodsp.c b/libavcodec/lossless_audiodsp.c
index e3ea8e1..3a9f9b2 100644
--- a/libavcodec/lossless_audiodsp.c
+++ b/libavcodec/lossless_audiodsp.c
@@ -45,9 +45,9 @@ static int32_t scalarproduct_and_madd_int32_c(int16_t *v1, 
const int32_t *v2,
 int res = 0;
 
 do {
-res   += *v1 * *v2++;
+res   += *v1 * (uint32_t)*v2++;
 *v1++ += mul * *v3++;
-res   += *v1 * *v2++;
+res   += *v1 * (uint32_t)*v2++;
 *v1++ += mul * *v3++;
 } while (order-=2);
 return res;
diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 1ea5918..eb94ed8 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -674,10 +674,10 @@ static void mclms_predict(WmallDecodeCtx *s, int icoef, 
int *pred)
 if (!s->is_channel_coded[ich])
 continue;
 for (i = 0; i < order * num_channels; i++)
-pred[ich] += s->mclms_prevvalues[i + s->mclms_recent] *
+pred[ich] += (uint32_t)s->mclms_prevvalues[i + s->mclms_recent] *
  s->mclms_coeffs[i + order * num_channels * ich];
 for (i = 0; i < ich; i++)
-pred[ich] += s->channel_residues[i][icoef] *
+pred[ich] += (uint32_t)s->channel_residues[i][icoef] *
  s->mclms_coeffs_cur[i + num_channels * ich];
 pred[ich] += 1 << s->mclms_scaling - 1;
 pred[ich] >>= s->mclms_scaling;
@@ -822,7 +822,7 @@ static void revert_acfilter(WmallDecodeCtx *s, int 
tile_size)
 for (i = order; i < tile_size; i++) {
 pred = 0;
 for (j = 0; j < order; j++)
-pred += s->channel_residues[ich][i - j - 1] * filter_coeffs[j];
+pred += (uint32_t)s->channel_residues[ich][i - j - 1] * 
filter_coeffs[j];
 pred >>= scaling;
 s->channel_residues[ich][i] += pred;
 }
-- 
1.7.9.5

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


[FFmpeg-devel] [PATCH 2/3] avcodec/aacenc_is: Assert that minthr is not 0.0, this would lead to division by 0 later

2016-05-16 Thread Michael Niedermayer
Testcase is fate-aac-pred-encode

Signed-off-by: Michael Niedermayer 
---
 libavcodec/aacenc_is.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/aacenc_is.c b/libavcodec/aacenc_is.c
index 473897b..e5cfa14 100644
--- a/libavcodec/aacenc_is.c
+++ b/libavcodec/aacenc_is.c
@@ -64,6 +64,9 @@ struct AACISError ff_aac_is_encoding_err(AACEncContext *s, 
ChannelElement *cpe,
 abs_pow34_v(I34, IS,   sce0->ics.swb_sizes[g]);
 maxval = find_max_val(1, sce0->ics.swb_sizes[g], I34);
 is_band_type = find_min_book(maxval, is_sf_idx);
+
+av_assert0(minthr != 0.0);
+
 dist1 += quantize_band_cost(s, [start + (w+w2)*128], L34,
 sce0->ics.swb_sizes[g],
 sce0->sf_idx[w*16+g],
-- 
1.7.9.5

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


[FFmpeg-devel] why ffmpeg reports error when decoding rm or rmvb files

2016-05-16 Thread qw
Hi,

I'm using the following command to decode some rm and rmvb files, and ffmpeg 
reports error as shown below:

[root@PT-18376 test-clips]# ffmpeg -i hanma.rm -xerror -f null /dev/null
ffmpeg version 2.8.3 Copyright (c) 2000-2015 the FFmpeg developers
  built with icc (ICC) 14.0.2 20140120
  configuration: --cc=/opt/intel/bin/icc --enable-version3 --enable-asm 
--enable-yasm --enable-avfilter --enable-libvidstab --disable-static 
--enable-shared --enable-libx264 --enable-gpl --prefix=/usr/local/ 
--extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib 
--enable-libfdk_aac --enable-nonfree --enable-libass --enable-libfreetype 
--extra-libs=-lfreetype
  libavutil  54. 31.100 / 54. 31.100
  libavcodec 56. 60.100 / 56. 60.100
  libavformat56. 40.101 / 56. 40.101
  libavdevice56.  4.100 / 56.  4.100
  libavfilter 5. 40.101 /  5. 40.101
  libswscale  3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc53.  3.100 / 53.  3.100
[rm @ 0x1d703a0] Invalid stream index 2 for index at pos 7110127
Input #0, rm, from 'hanma.rm':
  Metadata:
title   :
author  :
copyright   :
comment :
ASMRuleBook : #($Bandwidth >= 0),Stream1Bandwidth = 64082, 
Stream0Bandwidth = 285918;
Audiences   : 350k Download (VBR);
audioMode   : music
Creation Date   : 4/19/2016 14:41:27
Generated By: Helix Producer SDK 11.0 for Windows, Build 11.0.0.2013
Modification Date: 4/19/2016 14:41:27
videoMode   : sharp
  Duration: 00:02:39.75, start: 0.00, bitrate: 356 kb/s
Stream #0:0: Video: rv40 (RV40 / 0x30345652), yuv420p, 448x336, 286 kb/s, 
30 fps, 30 tbr, 1k tbn, 1k tbc
Stream #0:1: Audio: cook (cook / 0x6B6F6F63), 44100 Hz, stereo, fltp, 64 
kb/s
Output #0, null, to '/dev/null':
  Metadata:
title   :
author  :
copyright   :
comment :
ASMRuleBook : #($Bandwidth >= 0),Stream1Bandwidth = 64082, 
Stream0Bandwidth = 285918;
Audiences   : 350k Download (VBR);
audioMode   : music
Creation Date   : 4/19/2016 14:41:27
Generated By: Helix Producer SDK 11.0 for Windows, Build 11.0.0.2013
Modification Date: 4/19/2016 14:41:27
videoMode   : sharp
encoder : Lavf56.40.101
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 448x336, q=2-31, 
200 kb/s, 30 fps, 30 tbn, 30 tbc
Metadata:
  encoder : Lavc56.60.100 rawvideo
Stream #0:1: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Metadata:
  encoder : Lavc56.60.100 pcm_s16le
Stream mapping:
  Stream #0:0 -> #0:0 (rv40 (native) -> rawvideo (native))
  Stream #0:1 -> #0:1 (cook (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
hanma.rm: Input/output errorN/A   
Conversion failed!

From the above message, ffmpeg reports error when reaching the end of input 
files, because av_read_frame() return a value that is not AVERROR_EOF. I use 
the same command to decode other clips, such mkv and mp4.

Why ffmpeg reports error when decoding rm and rmvb files?

rm and rmvb samples can be downloaded from
http://pan.baidu.com/s/1hs113Bu
http://pan.baidu.com/s/1qYKNY7y
 
Thanks!

B.R.

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


[FFmpeg-devel] [PATCH] fix: the "delete-segment" flag did not work properly

2016-05-16 Thread develop
From: Boris Nagels 

Implementation in commit 97b65f6. The set length of the list was populated 
twice (e.g. setting the list-size to 10, creates a list of approx. 20 files). 
Now calculation works on the theoretical playlist length compensated for the 
segment lengths that are currently in the playlist.
---
 libavformat/hlsenc.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 7ab7cbb..c6ab7c5 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -126,12 +126,17 @@ static int hls_delete_old_segments(HLSContext *hls) {
 char *dirname = NULL, *p, *sub_path;
 char *path = NULL;
 
+   // Calculate the maximum playlist duration.
+   playlist_duration = hls->max_nb_segments * hls->time;
+
+   // Compensate for the segments that are currently in the playlist.
 segment = hls->segments;
 while (segment) {
-playlist_duration += segment->duration;
+playlist_duration -= segment->duration;
 segment = segment->next;
 }
 
+   // Check the old-segments.
 segment = hls->old_segments;
 while (segment) {
 playlist_duration -= segment->duration;
-- 
2.6.4 (Apple Git-63)

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


Re: [FFmpeg-devel] [PATCH] Respect payload offset in av_grow_packet

2016-05-16 Thread Andriy Lysnevych
Sorry, looks like problems with my mail client. Sending patch as attachment.
From 45f69d7f02928ad8abae3fc591082997590c597a Mon Sep 17 00:00:00 2001
From: Andriy Lysnevych 
Date: Mon, 16 May 2016 12:08:33 +0300
Subject: [PATCH] Respect payload offset in av_grow_packet

---
 libavcodec/avpacket.c | 25 +++--
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index bcc7c79..327cd41 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -110,24 +110,29 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
 {
 int new_size;
 av_assert0((unsigned)pkt->size <= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE);
-if (!pkt->size)
-return av_new_packet(pkt, grow_by);
-if ((unsigned)grow_by >
-INT_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE))
-return -1;
 
 new_size = pkt->size + grow_by + AV_INPUT_BUFFER_PADDING_SIZE;
 if (pkt->buf) {
-int ret = av_buffer_realloc(>buf, new_size);
-if (ret < 0)
-return ret;
+int data_offset = pkt->data - pkt->buf->data;
+if ((unsigned)grow_by >
+INT_MAX - (pkt->size + data_offset + AV_INPUT_BUFFER_PADDING_SIZE))
+return -1;
+if (new_size + data_offset > pkt->buf->size) {
+int ret = av_buffer_realloc(>buf, new_size + data_offset);
+if (ret < 0)
+return ret;
+pkt->data = pkt->buf->data + data_offset;
+}
 } else {
+if ((unsigned)grow_by >
+INT_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE))
+return -1;
 pkt->buf = av_buffer_alloc(new_size);
 if (!pkt->buf)
 return AVERROR(ENOMEM);
-memcpy(pkt->buf->data, pkt->data, FFMIN(pkt->size, pkt->size + grow_by));
+memcpy(pkt->buf->data, pkt->data, pkt->size);
+pkt->data = pkt->buf->data;
 }
-pkt->data  = pkt->buf->data;
 pkt->size += grow_by;
 memset(pkt->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
 
-- 
2.7.4

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


Re: [FFmpeg-devel] [PATCH] Respect payload offset in av_grow_packet

2016-05-16 Thread Andriy Lysnevych
Patch for latest master

---
 libavcodec/avpacket.c | 25 +++--
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index bcc7c79..327cd41 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -110,24 +110,29 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
 {
 int new_size;
 av_assert0((unsigned)pkt->size <= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE);
-if (!pkt->size)
-return av_new_packet(pkt, grow_by);
-if ((unsigned)grow_by >
-INT_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE))
-return -1;

 new_size = pkt->size + grow_by + AV_INPUT_BUFFER_PADDING_SIZE;
 if (pkt->buf) {
-int ret = av_buffer_realloc(>buf, new_size);
-if (ret < 0)
-return ret;
+int data_offset = pkt->data - pkt->buf->data;
+if ((unsigned)grow_by >
+INT_MAX - (pkt->size + data_offset + AV_INPUT_BUFFER_PADDING_SIZE))
+return -1;
+if (new_size + data_offset > pkt->buf->size) {
+int ret = av_buffer_realloc(>buf, new_size + data_offset);
+if (ret < 0)
+return ret;
+pkt->data = pkt->buf->data + data_offset;
+}
 } else {
+if ((unsigned)grow_by >
+INT_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE))
+return -1;
 pkt->buf = av_buffer_alloc(new_size);
 if (!pkt->buf)
 return AVERROR(ENOMEM);
-memcpy(pkt->buf->data, pkt->data, FFMIN(pkt->size, pkt->size
+ grow_by));
+memcpy(pkt->buf->data, pkt->data, pkt->size);
+pkt->data = pkt->buf->data;
 }
-pkt->data  = pkt->buf->data;
 pkt->size += grow_by;
 memset(pkt->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE);

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


[FFmpeg-devel] [PATCH] avformat: Add Pro-MPEG CoP #3-R2 FEC protocol

2016-05-16 Thread Vlad Tarca
Pro-MPEG Code of Practice #3 release 2 forward error correction for rtp_mpegts 
streams

Signed-off-by: Vlad Tarca 
---
 Changelog   |   1 +
 doc/general.texi|   1 +
 doc/protocols.texi  |  35 
 libavformat/Makefile|   1 +
 libavformat/prompeg.c   | 489 
 libavformat/protocols.c |   1 +
 libavformat/rtpproto.c  |  64 ++-
 7 files changed, 589 insertions(+), 3 deletions(-)
 create mode 100644 libavformat/prompeg.c

diff --git a/Changelog b/Changelog
index 402594d..15b3663 100644
--- a/Changelog
+++ b/Changelog
@@ -35,6 +35,7 @@ version :
 - Generic OpenMAX IL encoder with support for Raspberry Pi
 - IFF ANIM demuxer & decoder
 - Direct Stream Transfer (DST) decoder
+- Pro-MPEG CoP #3-R2 FEC protocol
 
 version 3.0:
 - Common Encryption (CENC) MP4 encoding and decoding support
diff --git a/doc/general.texi b/doc/general.texi
index 2d3dd0b..80a434a 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -1126,6 +1126,7 @@ performance on systems without hardware floating point 
support).
 @item MMSH @tab X
 @item MMST @tab X
 @item pipe @tab X
+@item Pro-MPEG FEC @tab X
 @item RTMP @tab X
 @item RTMPE@tab X
 @item RTMPS@tab X
diff --git a/doc/protocols.texi b/doc/protocols.texi
index a1084bd..fed0f3b 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -513,6 +513,41 @@ time, which is valuable if data transmission is slow.
 Note that some formats (typically MOV), require the output protocol to
 be seekable, so they will fail with the pipe output protocol.
 
+@section prompeg
+
+Pro-MPEG Code of Practice #3 Release 2 FEC protocol.
+
+The Pro-MPEG CoP#3 FEC is a 2D parity-check forward error correction mechanism
+for MPEG-2 Transport Streams sent over RTP.
+
+This protocol must be used in conjunction with the @code{rtp_mpegts} muxer and
+the @code{rtp} protocol.
+
+The required syntax is:
+@example
+-f rtp_mpegts -fec prompeg=@var{option}=@var{val}... 
rtp://@var{hostname}:@var{port}
+@end example
+
+The destination UDP ports are @code{port + 2} for the column FEC stream
+and @code{port + 4} for the row FEC stream.
+
+This protocol accepts the following options:
+@table @option
+
+@item l=@var{n}
+The number of columns (4-20, LxD <= 100)
+
+@item d=@var{n}
+The number of rows (4-20, LxD <= 100)
+
+@end table
+
+Example usage:
+
+@example
+-f rtp_mpegts -fec prompeg=l=8:d=4 rtp://@var{hostname}:@var{port}
+@end example
+
 @section rtmp
 
 Real-Time Messaging Protocol.
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 742aff5..d29a9cc 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -546,6 +546,7 @@ OBJS-$(CONFIG_MD5_PROTOCOL)  += md5proto.o
 OBJS-$(CONFIG_MMSH_PROTOCOL) += mmsh.o mms.o asf.o
 OBJS-$(CONFIG_MMST_PROTOCOL) += mmst.o mms.o asf.o
 OBJS-$(CONFIG_PIPE_PROTOCOL) += file.o
+OBJS-$(CONFIG_PROMPEG_PROTOCOL)  += prompeg.o
 OBJS-$(CONFIG_RTMP_PROTOCOL) += rtmpproto.o rtmppkt.o
 OBJS-$(CONFIG_RTMPE_PROTOCOL)+= rtmpproto.o rtmppkt.o
 OBJS-$(CONFIG_RTMPS_PROTOCOL)+= rtmpproto.o rtmppkt.o
diff --git a/libavformat/prompeg.c b/libavformat/prompeg.c
new file mode 100644
index 000..d60e40b
--- /dev/null
+++ b/libavformat/prompeg.c
@@ -0,0 +1,489 @@
+/*
+ * Pro-MPEG Code of Practice #3 Release 2 FEC
+ * Copyright (c) 2016 Mobibase, France (http://www.mobibase.com)
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * Pro-MPEG Code of Practice #3 Release 2 FEC protocol
+ * @author Vlad Tarca 
+ */
+
+/*
+ * Reminder:
+
+ [RFC 2733] FEC Packet Structure
+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   | RTP Header|
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   | FEC Header|
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   | FEC Payload   |
+   |   |
+   

[FFmpeg-devel] how to know via ffmpeg lib whether disk is full or not

2016-05-16 Thread qw
Hi,

In some rare case, when there are huge AV transcoding tasks, disk will become 
full if old files are not deleted immediately. Then those transcoding tasks 
can't work correctly.

In general transcoding application, av_interleaved_write_frame() and 
av_read_frame() are used to make media files, such as mp4, flv, and mkv.

Do the two functions or other ffmpeg functions support the function that ffmpeg 
lib can detect the disk status and report error when disk is full? And how to 
know via ffmpeg lib whether disk is full or not?

Thanks!

B.R.

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


Re: [FFmpeg-devel] [PATCH] avfilter: add loudnorm

2016-05-16 Thread Paul B Mahol
On 5/15/16, Kyle Swanson  wrote:
> On Sat, May 14, 2016 at 5:49 PM, Paul B Mahol  wrote:
>> On 5/14/16, Kyle Swanson  wrote:
>>> Hi,
>>>
>>> If nobody else has any changes, can this please be pushed?
>>
>> What about removal of libebur128 dependency?
>>
>
> I figured loudnorm can be pushed now, and porting libebur128 to ffmpeg
> and removing the dependency can be done next. Updates to the ebur128
> and astats filter to use the new libebur128 ported code can be another
> patch after that. That makes sense to me, but maybe there's a more
> preferable way to do it.

Well, I'm fine with this patch as is. But it would be better if no external
dependency is required.

Anybody against pushing this as is?

>
>>>
>>> Thanks
>>>
>>> On Wed, May 11, 2016 at 1:35 PM, Kyle Swanson  wrote:
 Hi,

 Updated patch attached.
>>> ___
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] add MTAF demuxer and decoder

2016-05-16 Thread Paul B Mahol
On 5/16/16, James Almer  wrote:
> On 5/15/2016 6:33 PM, Paul B Mahol wrote:
>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
>> index 3f0ffd1..3a9dd95 100644
>> --- a/libavcodec/Makefile
>> +++ b/libavcodec/Makefile
>> @@ -707,6 +707,7 @@ OBJS-$(CONFIG_ADPCM_IMA_WAV_ENCODER)  +=
>> adpcmenc.o adpcm_data.o
>>  OBJS-$(CONFIG_ADPCM_IMA_WS_DECODER)   += adpcm.o adpcm_data.o
>>  OBJS-$(CONFIG_ADPCM_MS_DECODER)   += adpcm.o adpcm_data.o
>>  OBJS-$(CONFIG_ADPCM_MS_ENCODER)   += adpcmenc.o adpcm_data.o
>> +OBJS-$(CONFIG_ADPCM_MTAF_DECODER) += adpcm.o adpcm_data.o
>>  OBJS-$(CONFIG_ADPCM_PSX_DECODER)  += adpcm.o adpcm_data.o
>>  OBJS-$(CONFIG_ADPCM_SBPRO_2_DECODER)  += adpcm.o adpcm_data.o
>>  OBJS-$(CONFIG_ADPCM_SBPRO_3_DECODER)  += adpcm.o adpcm_data.o
>> diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
>> index 0b6b92e..e624b85 100644
>> --- a/libavcodec/adpcm.c
>> +++ b/libavcodec/adpcm.c
>> @@ -107,6 +107,10 @@ static av_cold int adpcm_decode_init(AVCodecContext *
>> avctx)
>>  case AV_CODEC_ID_ADPCM_EA_XAS:
>>  max_channels = 6;
>>  break;
>> +case AV_CODEC_ID_ADPCM_MTAF:
>> +min_channels = 2;
>> +max_channels = 8;
>> +break;
>>  case AV_CODEC_ID_ADPCM_PSX:
>>  max_channels = 8;
>>  break;
>> @@ -159,6 +163,7 @@ static av_cold int adpcm_decode_init(AVCodecContext *
>> avctx)
>>  case AV_CODEC_ID_ADPCM_AFC:
>>  case AV_CODEC_ID_ADPCM_DTK:
>>  case AV_CODEC_ID_ADPCM_PSX:
>> +case AV_CODEC_ID_ADPCM_MTAF:
>>  avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
>>  break;
>>  case AV_CODEC_ID_ADPCM_IMA_WS:
>> @@ -342,6 +347,15 @@ static inline int16_t
>> adpcm_yamaha_expand_nibble(ADPCMChannelStatus *c, uint8_t
>>  return c->predictor;
>>  }
>>
>> +static inline int16_t adpcm_mtaf_expand_nibble(ADPCMChannelStatus *c,
>> uint8_t nibble)
>> +{
>
> You should use local variables here, like in other expand_nibbble()
> functions.

I don't see point of that.

>
>> +c->predictor += ff_adpcm_mtaf_stepsize[c->step][nibble];
>> +c->predictor = av_clip_int16(c->predictor);
>> +c->step += ff_adpcm_index_table[nibble];
>> +c->step = av_clip(c->step, 0, 31);
>
> av_clip_uintp2(step, 5);

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


Re: [FFmpeg-devel] [PATCH] avcodec: add properties for lossless to AVCodecParameters

2016-05-16 Thread Hendrik Leppkes
On Mon, May 16, 2016 at 4:43 AM, James Almer  wrote:
> On 5/8/2016 12:18 PM, Hendrik Leppkes wrote:
>> On Sun, May 8, 2016 at 12:10 PM, Michael Niedermayer
>>  wrote:
>>> Fixes Ticket5467
>>>
>>> Signed-off-by: Michael Niedermayer 
>>> ---
>>>  libavcodec/avcodec.h |4 
>>>  libavcodec/utils.c   |2 ++
>>>  2 files changed, 6 insertions(+)
>>>
>>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
>>> index 3813a0a..1db2e0f 100644
>>> --- a/libavcodec/avcodec.h
>>> +++ b/libavcodec/avcodec.h
>>> @@ -4050,6 +4050,10 @@ typedef struct AVCodecParameters {
>>>   * Audio only. Number of samples to skip after a discontinuity.
>>>   */
>>>  int seek_preroll;
>>> +
>>> +/** Properties, like FF_CODEC_PROPERTY_LOSSLESS.
>>> + */
>>> +int properties;
>>>  } AVCodecParameters;
>>>
>>
>> There properties are not part of any container we support and therefor
>> not really fitting into this structure.
>>
>> - Hendrik
>
> Guess i'm late to the party, but we support the DTS-HD container and it has a
> field that reports if the stream is lossless or not.
> See 
> http://atsc.org/wp-content/uploads/2015/03/Non-Real-Time-Content-Delivery.pdf
> section E.2.8 and table E.12, Bitw_Aupres_Metadata field.
>

DTS-HD has profiles to express this though, it doesn't need such a flag.
And I would argue maybe other codecs should also use profiles to
differentiate different codec modes.

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