[FFmpeg-devel] [PATCH 1/2] Makefile: Add support for MSA (MIPS-SIMD-Arch)

2015-04-17 Thread shivraj.patil
From: Shivraj Patil 

Signed-off-by: Shivraj Patil 
---
 Makefile | 2 +-
 arch.mak | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index ca2ce59..fe0e02f 100644
--- a/Makefile
+++ b/Makefile
@@ -80,7 +80,7 @@ SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS 
TOOLS  \
HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS\
ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
ALTIVEC-OBJS MMX-OBJS YASM-OBJS   \
-   MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSPR1-OBJS\
+   MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSPR1-OBJS MSA-OBJS   \
OBJS SLIBOBJS HOSTOBJS TESTOBJS
 
 define RESET
diff --git a/arch.mak b/arch.mak
index 48bc2d3..39f2917 100644
--- a/arch.mak
+++ b/arch.mak
@@ -7,6 +7,7 @@ OBJS-$(HAVE_NEON)+= $(NEON-OBJS)$(NEON-OBJS-yes)
 OBJS-$(HAVE_MIPSFPU)   += $(MIPSFPU-OBJS)$(MIPSFPU-OBJS-yes)
 OBJS-$(HAVE_MIPSDSPR1) += $(MIPSDSPR1-OBJS)  $(MIPSDSPR1-OBJS-yes)
 OBJS-$(HAVE_MIPSDSPR2) += $(MIPSDSPR2-OBJS)  $(MIPSDSPR2-OBJS-yes)
+OBJS-$(HAVE_MSA)   += $(MSA-OBJS)$(MSA-OBJS-yes)
 
 OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS) $(ALTIVEC-OBJS-yes)
 
-- 
2.3.2

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


[FFmpeg-devel] [PATCH 2/2] avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for HEVC horizontal and vertical mc functions

2015-04-17 Thread shivraj.patil
From: Shivraj Patil 

Signed-off-by: Shivraj Patil 
---
 libavcodec/hevcdsp.c|2 +
 libavcodec/hevcdsp.h|1 +
 libavcodec/mips/Makefile|2 +
 libavcodec/mips/hevcdsp_init_mips.c |   54 ++
 libavcodec/mips/hevcdsp_mips.h  |   49 ++
 libavcodec/mips/hevcdsp_msa.c   | 1259 +++
 libavutil/mips/generic_macros_msa.h |  285 
 7 files changed, 1652 insertions(+)
 create mode 100644 libavcodec/mips/hevcdsp_init_mips.c
 create mode 100644 libavcodec/mips/hevcdsp_mips.h
 create mode 100644 libavcodec/mips/hevcdsp_msa.c
 create mode 100644 libavutil/mips/generic_macros_msa.h

diff --git a/libavcodec/hevcdsp.c b/libavcodec/hevcdsp.c
index 04af178..be01e92 100644
--- a/libavcodec/hevcdsp.c
+++ b/libavcodec/hevcdsp.c
@@ -261,4 +261,6 @@ int i = 0;
 ff_hevc_dsp_init_x86(hevcdsp, bit_depth);
 if (ARCH_ARM)
 ff_hevcdsp_init_arm(hevcdsp, bit_depth);
+if (ARCH_MIPS)
+ff_hevc_dsp_init_mips(hevcdsp, bit_depth);
 }
diff --git a/libavcodec/hevcdsp.h b/libavcodec/hevcdsp.h
index a891ea7..d2ea867 100644
--- a/libavcodec/hevcdsp.h
+++ b/libavcodec/hevcdsp.h
@@ -129,4 +129,5 @@ extern const int8_t ff_hevc_qpel_filters[3][16];
 
 void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth);
 void ff_hevcdsp_init_arm(HEVCDSPContext *c, const int bit_depth);
+void ff_hevc_dsp_init_mips(HEVCDSPContext *c, const int bit_depth);
 #endif /* AVCODEC_HEVCDSP_H */
diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile
index 8e2459f..b41d8c7 100644
--- a/libavcodec/mips/Makefile
+++ b/libavcodec/mips/Makefile
@@ -18,3 +18,5 @@ OBJS-$(CONFIG_AAC_DECODER)+= 
mips/aacdec_mips.o\
  mips/aacpsdsp_mips.o
 MIPSDSPR1-OBJS-$(CONFIG_AAC_ENCODER)  += mips/aaccoder_mips.o
 MIPSFPU-OBJS-$(CONFIG_AAC_ENCODER)+= mips/iirfilter_mips.o
+OBJS-$(CONFIG_HEVC_DECODER)   += mips/hevcdsp_init_mips.o
+MSA-OBJS-$(CONFIG_HEVC_DECODER)   += mips/hevcdsp_msa.o
diff --git a/libavcodec/mips/hevcdsp_init_mips.c 
b/libavcodec/mips/hevcdsp_init_mips.c
new file mode 100644
index 000..05ed81f
--- /dev/null
+++ b/libavcodec/mips/hevcdsp_init_mips.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015 Manojkumar Bhosale (manojkumar.bhos...@imgtec.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
+ */
+
+#include "libavcodec/mips/hevcdsp_mips.h"
+
+#if HAVE_MSA
+static av_cold void hevc_dsp_init_msa(HEVCDSPContext *c,
+  const int bit_depth)
+{
+if (8 == bit_depth) {
+c->put_hevc_qpel[1][0][1] = ff_hevc_put_hevc_qpel_h4_8_msa;
+c->put_hevc_qpel[3][0][1] = ff_hevc_put_hevc_qpel_h8_8_msa;
+c->put_hevc_qpel[4][0][1] = ff_hevc_put_hevc_qpel_h12_8_msa;
+c->put_hevc_qpel[5][0][1] = ff_hevc_put_hevc_qpel_h16_8_msa;
+c->put_hevc_qpel[6][0][1] = ff_hevc_put_hevc_qpel_h24_8_msa;
+c->put_hevc_qpel[7][0][1] = ff_hevc_put_hevc_qpel_h32_8_msa;
+c->put_hevc_qpel[8][0][1] = ff_hevc_put_hevc_qpel_h48_8_msa;
+c->put_hevc_qpel[9][0][1] = ff_hevc_put_hevc_qpel_h64_8_msa;
+
+c->put_hevc_qpel[1][1][0] = ff_hevc_put_hevc_qpel_v4_8_msa;
+c->put_hevc_qpel[3][1][0] = ff_hevc_put_hevc_qpel_v8_8_msa;
+c->put_hevc_qpel[4][1][0] = ff_hevc_put_hevc_qpel_v12_8_msa;
+c->put_hevc_qpel[5][1][0] = ff_hevc_put_hevc_qpel_v16_8_msa;
+c->put_hevc_qpel[6][1][0] = ff_hevc_put_hevc_qpel_v24_8_msa;
+c->put_hevc_qpel[7][1][0] = ff_hevc_put_hevc_qpel_v32_8_msa;
+c->put_hevc_qpel[8][1][0] = ff_hevc_put_hevc_qpel_v48_8_msa;
+c->put_hevc_qpel[9][1][0] = ff_hevc_put_hevc_qpel_v64_8_msa;
+}
+}
+#endif  // #if HAVE_MSA
+
+void ff_hevc_dsp_init_mips(HEVCDSPContext *c, const int bit_depth)
+{
+#if HAVE_MSA
+hevc_dsp_init_msa(c, bit_depth);
+#endif  // #if HAVE_MSA
+}
diff --git a/libavcodec/mips/hevcdsp_mips.h b/libavcodec/mips/hevcdsp_mips.h
new file mode 100644
index 000..13cdb5b
--- /dev/null
+++ b/libavcodec/mips/hevcdsp_mips.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2015 Manojkumar Bhosale (manojkumar.bhos...@imgtec.com)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you ca

Re: [FFmpeg-devel] [PATCH 1/2] Makefile: Add support for MSA (MIPS-SIMD-Arch)

2015-04-17 Thread Nedeljko Babic
LGTM.

Thanks,
Nedeljko

Od: ffmpeg-devel-boun...@ffmpeg.org [ffmpeg-devel-boun...@ffmpeg.org] u ime 
korisnika Shivraj Patil
Poslato: 17. april 2015 15:12
Za: ffmpeg-devel@ffmpeg.org
Cc: Shivraj Patil
Tema: [FFmpeg-devel] [PATCH 1/2] Makefile: Add support for MSA  (MIPS-SIMD-Arch)

From: Shivraj Patil 

Signed-off-by: Shivraj Patil 
---
 Makefile | 2 +-
 arch.mak | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index ca2ce59..fe0e02f 100644
--- a/Makefile
+++ b/Makefile
@@ -80,7 +80,7 @@ SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS 
TOOLS  \
HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS\
ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
ALTIVEC-OBJS MMX-OBJS YASM-OBJS   \
-   MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSPR1-OBJS\
+   MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSPR1-OBJS MSA-OBJS   \
OBJS SLIBOBJS HOSTOBJS TESTOBJS

 define RESET
diff --git a/arch.mak b/arch.mak
index 48bc2d3..39f2917 100644
--- a/arch.mak
+++ b/arch.mak
@@ -7,6 +7,7 @@ OBJS-$(HAVE_NEON)+= $(NEON-OBJS)$(NEON-OBJS-yes)
 OBJS-$(HAVE_MIPSFPU)   += $(MIPSFPU-OBJS)$(MIPSFPU-OBJS-yes)
 OBJS-$(HAVE_MIPSDSPR1) += $(MIPSDSPR1-OBJS)  $(MIPSDSPR1-OBJS-yes)
 OBJS-$(HAVE_MIPSDSPR2) += $(MIPSDSPR2-OBJS)  $(MIPSDSPR2-OBJS-yes)
+OBJS-$(HAVE_MSA)   += $(MSA-OBJS)$(MSA-OBJS-yes)

 OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS) $(ALTIVEC-OBJS-yes)

--
2.3.2

___
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 2/2] avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for HEVC horizontal and vertical mc functions

2015-04-17 Thread Nedeljko Babic
LGTM

Thanks,
Nedeljko

Od: ffmpeg-devel-boun...@ffmpeg.org [ffmpeg-devel-boun...@ffmpeg.org] u ime 
korisnika Shivraj Patil
Poslato: 17. april 2015 15:12
Za: ffmpeg-devel@ffmpeg.org
Cc: Shivraj Patil
Tema: [FFmpeg-devel] [PATCH 2/2] avcodec/mips: MSA (MIPS-SIMD-Arch) 
optimizations for HEVC horizontal and vertical mc functions

From: Shivraj Patil 

Signed-off-by: Shivraj Patil 
---
 libavcodec/hevcdsp.c|2 +
 libavcodec/hevcdsp.h|1 +
 libavcodec/mips/Makefile|2 +
 libavcodec/mips/hevcdsp_init_mips.c |   54 ++
 libavcodec/mips/hevcdsp_mips.h  |   49 ++
 libavcodec/mips/hevcdsp_msa.c   | 1259 +++
 libavutil/mips/generic_macros_msa.h |  285 
 7 files changed, 1652 insertions(+)
 create mode 100644 libavcodec/mips/hevcdsp_init_mips.c
 create mode 100644 libavcodec/mips/hevcdsp_mips.h
 create mode 100644 libavcodec/mips/hevcdsp_msa.c
 create mode 100644 libavutil/mips/generic_macros_msa.h

diff --git a/libavcodec/hevcdsp.c b/libavcodec/hevcdsp.c
index 04af178..be01e92 100644
--- a/libavcodec/hevcdsp.c
+++ b/libavcodec/hevcdsp.c
@@ -261,4 +261,6 @@ int i = 0;
 ff_hevc_dsp_init_x86(hevcdsp, bit_depth);
 if (ARCH_ARM)
 ff_hevcdsp_init_arm(hevcdsp, bit_depth);
+if (ARCH_MIPS)
+ff_hevc_dsp_init_mips(hevcdsp, bit_depth);
 }
diff --git a/libavcodec/hevcdsp.h b/libavcodec/hevcdsp.h
index a891ea7..d2ea867 100644
--- a/libavcodec/hevcdsp.h
+++ b/libavcodec/hevcdsp.h
@@ -129,4 +129,5 @@ extern const int8_t ff_hevc_qpel_filters[3][16];

 void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth);
 void ff_hevcdsp_init_arm(HEVCDSPContext *c, const int bit_depth);
+void ff_hevc_dsp_init_mips(HEVCDSPContext *c, const int bit_depth);
 #endif /* AVCODEC_HEVCDSP_H */
diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile
index 8e2459f..b41d8c7 100644
--- a/libavcodec/mips/Makefile
+++ b/libavcodec/mips/Makefile
@@ -18,3 +18,5 @@ OBJS-$(CONFIG_AAC_DECODER)+= 
mips/aacdec_mips.o\
  mips/aacpsdsp_mips.o
 MIPSDSPR1-OBJS-$(CONFIG_AAC_ENCODER)  += mips/aaccoder_mips.o
 MIPSFPU-OBJS-$(CONFIG_AAC_ENCODER)+= mips/iirfilter_mips.o
+OBJS-$(CONFIG_HEVC_DECODER)   += mips/hevcdsp_init_mips.o
+MSA-OBJS-$(CONFIG_HEVC_DECODER)   += mips/hevcdsp_msa.o
diff --git a/libavcodec/mips/hevcdsp_init_mips.c 
b/libavcodec/mips/hevcdsp_init_mips.c
new file mode 100644
index 000..05ed81f
--- /dev/null
+++ b/libavcodec/mips/hevcdsp_init_mips.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015 Manojkumar Bhosale (manojkumar.bhos...@imgtec.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
+ */
+
+#include "libavcodec/mips/hevcdsp_mips.h"
+
+#if HAVE_MSA
+static av_cold void hevc_dsp_init_msa(HEVCDSPContext *c,
+  const int bit_depth)
+{
+if (8 == bit_depth) {
+c->put_hevc_qpel[1][0][1] = ff_hevc_put_hevc_qpel_h4_8_msa;
+c->put_hevc_qpel[3][0][1] = ff_hevc_put_hevc_qpel_h8_8_msa;
+c->put_hevc_qpel[4][0][1] = ff_hevc_put_hevc_qpel_h12_8_msa;
+c->put_hevc_qpel[5][0][1] = ff_hevc_put_hevc_qpel_h16_8_msa;
+c->put_hevc_qpel[6][0][1] = ff_hevc_put_hevc_qpel_h24_8_msa;
+c->put_hevc_qpel[7][0][1] = ff_hevc_put_hevc_qpel_h32_8_msa;
+c->put_hevc_qpel[8][0][1] = ff_hevc_put_hevc_qpel_h48_8_msa;
+c->put_hevc_qpel[9][0][1] = ff_hevc_put_hevc_qpel_h64_8_msa;
+
+c->put_hevc_qpel[1][1][0] = ff_hevc_put_hevc_qpel_v4_8_msa;
+c->put_hevc_qpel[3][1][0] = ff_hevc_put_hevc_qpel_v8_8_msa;
+c->put_hevc_qpel[4][1][0] = ff_hevc_put_hevc_qpel_v12_8_msa;
+c->put_hevc_qpel[5][1][0] = ff_hevc_put_hevc_qpel_v16_8_msa;
+c->put_hevc_qpel[6][1][0] = ff_hevc_put_hevc_qpel_v24_8_msa;
+c->put_hevc_qpel[7][1][0] = ff_hevc_put_hevc_qpel_v32_8_msa;
+c->put_hevc_qpel[8][1][0] = ff_hevc_put_hevc_qpel_v48_8_msa;
+c->put_hevc_qpel[9][1][0] = ff_hevc_put_hevc_qpel_v64_8_msa;
+}
+}
+#endif  // #if HAVE_MSA
+
+void ff_hevc_dsp_init_mips(HEVCDSPContext *c, const int bit_depth)
+{
+#if HAVE_MSA
+hevc_dsp_init_msa(c, bit_depth

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

2015-04-17 Thread Andreas Cadhalpun
On 17.04.2015 02:01, Luca Barbato wrote:
> On 16/04/15 20:19, Andreas Cadhalpun wrote:
>> On 16.04.2015 19:41, Claudio Freire wrote:
>>> It should be if band->thr > 0.0f, all divisions by zero return
>>> something that casts into an ~1:
> 
> is band->thr = 0.0f a valid value?

Come to think of it, that's probably invalid.
It can happen if coeffs[g].ath is not positive.
Attached patch errors out in this case.

> band->energy can be 0?

Yes, it's set to 0.0f in calc_thr_3gpp if enough coefs are 0.

Best regards,
Andreas
>From 37a67c054435e27b058c10ea0f94ec8906dc9af6 Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun 
Date: Fri, 17 Apr 2015 15:55:32 +0200
Subject: [PATCH] aacpsy: validate absolute hearing threshold

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

diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
index 7205ee3..817140d 100644
--- a/libavcodec/aacpsy.c
+++ b/libavcodec/aacpsy.c
@@ -350,6 +350,12 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
 for (i = 1; i < band_sizes[g]; i++)
 minscale = FFMIN(minscale, ath((start + i) * line_to_frequency, ATH_ADD));
 coeffs[g].ath = minscale - minath;
+if (coeffs[g].ath <= 0.0f) {
+av_log(ctx->avctx, AV_LOG_ERROR,
+   "absolute hearing threshold for band %d not positive: %f\n",
+   g, coeffs[g].ath);
+return AVERROR(EINVAL);
+}
 start += band_sizes[g];
 }
 }
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 1/2] avcodec/g729dec: support decoding packets with multiple frames

2015-04-17 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/g729dec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c
index 6eb057f..e97677b 100644
--- a/libavcodec/g729dec.c
+++ b/libavcodec/g729dec.c
@@ -421,7 +421,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame_ptr,
 return ret;
 out_frame = (int16_t*) frame->data[0];
 
-if (buf_size == 10) {
+if (buf_size % 10 == 0) {
 packet_type = FORMAT_G729_8K;
 format = &format_g729_8k;
 //Reset voice decision
@@ -711,7 +711,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame_ptr,
 memmove(ctx->exc_base, ctx->exc_base + 2 * SUBFRAME_SIZE, 
(PITCH_DELAY_MAX+INTERPOL_LEN)*sizeof(int16_t));
 
 *got_frame_ptr = 1;
-return buf_size;
+return packet_type == FORMAT_G729_8K ? 10 : 8;
 }
 
 AVCodec ff_g729_decoder = {
@@ -722,5 +722,5 @@ AVCodec ff_g729_decoder = {
 .priv_data_size = sizeof(G729Context),
 .init   = decoder_init,
 .decode = decode_frame,
-.capabilities   = CODEC_CAP_DR1,
+.capabilities   = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1,
 };
-- 
1.7.11.2

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


[FFmpeg-devel] [PATCH 2/2] avformat/riff: support G729A

2015-04-17 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavformat/riff.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/riff.c b/libavformat/riff.c
index 440a36b..0f98422 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -405,6 +405,7 @@ const AVCodecTag ff_codec_wav_tags[] = {
 { AV_CODEC_ID_ADPCM_G726,  0x0064 },
 { AV_CODEC_ID_ADPCM_IMA_WAV,   0x0069 },
 { AV_CODEC_ID_METASOUND,   0x0075 },
+{ AV_CODEC_ID_G729,0x0083 },
 { AV_CODEC_ID_AAC, 0x00ff },
 { AV_CODEC_ID_G723_1,  0x0111 },
 { AV_CODEC_ID_SIPR,0x0130 },
-- 
1.7.11.2

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


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/g729dec: support decoding packets with multiple frames

2015-04-17 Thread Michael Niedermayer
On Fri, Apr 17, 2015 at 02:37:32PM +, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  libavcodec/g729dec.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

LGTM

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

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


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


Re: [FFmpeg-devel] [PATCH 2/2] avformat/riff: support G729A

2015-04-17 Thread Michael Niedermayer
On Fri, Apr 17, 2015 at 02:37:33PM +, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  libavformat/riff.c | 1 +
>  1 file changed, 1 insertion(+)

LGTM

where can i find such sample ?

Thanks

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

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


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


[FFmpeg-devel] [PATCH 1/4] avformat/mp3dec: fix gapless audio when seeking in CBR mode

2015-04-17 Thread wm4
Removing a bunch of questionable hacks makes it work. These hacks
apparently try to make concatenated mp3s with Lame headers seekable,
which doesn't make too much sense anyway. The main change is that we
trust the Xing header file size field now (the same field is used for
seeking with Xing TOC). Note that a mp3 might contain an unknown number
of unsupported additional tags, so we can't reliably compute this size
manually.
---
Yep, this actually broke gapless again.
---
 libavformat/mp3dec.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 1692d88..06bc1d0 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -437,16 +437,10 @@ static int mp3_seek(AVFormatContext *s, int stream_index, 
int64_t timestamp,
 && st->duration > 0
 && mp3->header_filesize > s->internal->data_offset
 && mp3->frames) {
-int64_t filesize = avio_size(s->pb);
-int64_t duration;
-if (filesize <= s->internal->data_offset)
-filesize = mp3->header_filesize;
-filesize -= s->internal->data_offset;
-duration = av_rescale(st->duration, filesize, mp3->header_filesize - 
s->internal->data_offset);
 ie = &ie1;
-timestamp = av_clip64(timestamp, 0, duration);
+timestamp = av_clip64(timestamp, 0, st->duration);
 ie->timestamp = timestamp;
-ie->pos   = av_rescale(timestamp, filesize, duration) + 
s->internal->data_offset;
+ie->pos   = av_rescale(timestamp, mp3->header_filesize, 
st->duration) + s->internal->data_offset;
 } else if (mp3->xing_toc) {
 if (ret < 0)
 return ret;
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 2/4] fate: gapless: fix a typo in comment

2015-04-17 Thread wm4
---
 tests/fate-run.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index c68c389..f1afebb 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -236,7 +236,7 @@ gapless(){
 do_md5sum $decfile1
 # test decoded (and cut) data
 ffmpeg -i "$sample" $extra_args -flags +bitexact -f wav md5:
-# the same as aboce again, with seeking to the start
+# the same as above again, with seeking to the start
 ffmpeg -ss $start_offset -i "$sample" $extra_args -flags +bitexact -c:a 
copy -f framecrc -y $decfile2
 do_md5sum $decfile2
 ffmpeg -ss $start_offset -i "$sample" $extra_args -flags +bitexact -f wav 
md5:
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 4/4] fate: gapless: test mp3 both with and without TOC

2015-04-17 Thread wm4
---
I had too many issues with this difference.
---
 tests/fate/gapless.mak   | 3 ++-
 tests/ref/fate/gapless-mp3-notoc | 5 +
 2 files changed, 7 insertions(+), 1 deletion(-)
 create mode 100644 tests/ref/fate/gapless-mp3-notoc

diff --git a/tests/fate/gapless.mak b/tests/fate/gapless.mak
index 7f0848d..a09dac6 100644
--- a/tests/fate/gapless.mak
+++ b/tests/fate/gapless.mak
@@ -1,5 +1,6 @@
-FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3
+FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3 fate-gapless-mp3-notoc
 fate-gapless-mp3: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 "-usetoc 
1"
+fate-gapless-mp3-notoc: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 
"-usetoc 0"
 
 FATE_GAPLESS = $(FATE_GAPLESS-yes)
 
diff --git a/tests/ref/fate/gapless-mp3-notoc b/tests/ref/fate/gapless-mp3-notoc
new file mode 100644
index 000..3528e71
--- /dev/null
+++ b/tests/ref/fate/gapless-mp3-notoc
@@ -0,0 +1,5 @@
+d5c88cf38416329a052a9b0cb140fb4c *tests/data/fate/gapless-mp3-notoc.out-1
+c96c3ae7bd3300fd2f4debac222de5b7
+68f040b12d79c71e3b2e8ba90a9cbd96 *tests/data/fate/gapless-mp3-notoc.out-2
+c96c3ae7bd3300fd2f4debac222de5b7
+e750fc8ae00ba29a03983edafbb63975 *tests/data/fate/gapless-mp3-notoc.out-3
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 3/4] fate: gapless: test seeking to a specific position

2015-04-17 Thread wm4
---
This is somewhat different from seeking to start. Seeking to start
should give exactly the same result as not seeking at all, while
seeking to the middle does not set skip metadata for the first
packet.
---
 tests/fate-run.sh  | 6 +-
 tests/ref/fate/gapless-mp3 | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index f1afebb..0165812 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -226,7 +226,8 @@ gapless(){
 
 decfile1="${outdir}/${test}.out-1"
 decfile2="${outdir}/${test}.out-2"
-cleanfiles="$cleanfiles $decfile1 $decfile2"
+decfile3="${outdir}/${test}.out-3"
+cleanfiles="$cleanfiles $decfile1 $decfile2 $decfile3"
 
 # large enough to make ffmpeg.c seek to the start of the file
 start_offset=-1
@@ -240,6 +241,9 @@ gapless(){
 ffmpeg -ss $start_offset -i "$sample" $extra_args -flags +bitexact -c:a 
copy -f framecrc -y $decfile2
 do_md5sum $decfile2
 ffmpeg -ss $start_offset -i "$sample" $extra_args -flags +bitexact -f wav 
md5:
+# test packet data, with seeking to a specific position
+ffmpeg -ss 5 -i "$sample" $extra_args -flags +bitexact -c:a copy -f 
framecrc -y $decfile3
+do_md5sum $decfile3
 }
 
 mkdir -p "$outdir"
diff --git a/tests/ref/fate/gapless-mp3 b/tests/ref/fate/gapless-mp3
index 2c178c0..3cff9a8 100644
--- a/tests/ref/fate/gapless-mp3
+++ b/tests/ref/fate/gapless-mp3
@@ -2,3 +2,4 @@ d5c88cf38416329a052a9b0cb140fb4c 
*tests/data/fate/gapless-mp3.out-1
 c96c3ae7bd3300fd2f4debac222de5b7
 68f040b12d79c71e3b2e8ba90a9cbd96 *tests/data/fate/gapless-mp3.out-2
 c96c3ae7bd3300fd2f4debac222de5b7
+e750fc8ae00ba29a03983edafbb63975 *tests/data/fate/gapless-mp3.out-3
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH 2/2] avformat/riff: support G729A

2015-04-17 Thread Paul B Mahol
On 4/17/15, Michael Niedermayer  wrote:
> On Fri, Apr 17, 2015 at 02:37:33PM +, Paul B Mahol wrote:
>> Signed-off-by: Paul B Mahol 
>> ---
>>  libavformat/riff.c | 1 +
>>  1 file changed, 1 insertion(+)
>
> LGTM
>
> where can i find such sample ?

MyTest.wav in incoming.

>
> Thanks
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Asymptotically faster algorithms should always be preferred if you have
> asymptotical amounts of data
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] Makefile: Add support for MSA (MIPS-SIMD-Arch)

2015-04-17 Thread Michael Niedermayer
On Fri, Apr 17, 2015 at 01:58:36PM +, Nedeljko Babic wrote:
> LGTM.

applied

thanks

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

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.


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/mips: MSA (MIPS-SIMD-Arch) optimizations for HEVC horizontal and vertical mc functions

2015-04-17 Thread Michael Niedermayer
On Fri, Apr 17, 2015 at 01:58:54PM +, Nedeljko Babic wrote:
> LGTM

applied

thanks


> 
> Thanks,
> Nedeljko
> 
> Od: ffmpeg-devel-boun...@ffmpeg.org [ffmpeg-devel-boun...@ffmpeg.org] u ime 
> korisnika Shivraj Patil
> Poslato: 17. april 2015 15:12
> Za: ffmpeg-devel@ffmpeg.org
> Cc: Shivraj Patil
> Tema: [FFmpeg-devel] [PATCH 2/2] avcodec/mips: MSA (MIPS-SIMD-Arch) 
> optimizations for HEVC horizontal and vertical mc functions
> 
> From: Shivraj Patil 
> 
> Signed-off-by: Shivraj Patil 
> ---
>  libavcodec/hevcdsp.c|2 +
>  libavcodec/hevcdsp.h|1 +
>  libavcodec/mips/Makefile|2 +
>  libavcodec/mips/hevcdsp_init_mips.c |   54 ++
>  libavcodec/mips/hevcdsp_mips.h  |   49 ++
>  libavcodec/mips/hevcdsp_msa.c   | 1259 
> +++
>  libavutil/mips/generic_macros_msa.h |  285 
>  7 files changed, 1652 insertions(+)
>  create mode 100644 libavcodec/mips/hevcdsp_init_mips.c
>  create mode 100644 libavcodec/mips/hevcdsp_mips.h
>  create mode 100644 libavcodec/mips/hevcdsp_msa.c
>  create mode 100644 libavutil/mips/generic_macros_msa.h

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

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


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


Re: [FFmpeg-devel] [PATCH 1/4] avformat/mp3dec: fix gapless audio when seeking in CBR mode

2015-04-17 Thread Michael Niedermayer
On Fri, Apr 17, 2015 at 05:27:00PM +0200, wm4 wrote:
> Removing a bunch of questionable hacks makes it work. These hacks
> apparently try to make concatenated mp3s with Lame headers seekable,
> which doesn't make too much sense anyway. The main change is that we
> trust the Xing header file size field now (the same field is used for
> seeking with Xing TOC). Note that a mp3 might contain an unknown number
> of unsupported additional tags, so we can't reliably compute this size
> manually.
> ---
> Yep, this actually broke gapless again.
> ---
>  libavformat/mp3dec.c | 10 ++
>  1 file changed, 2 insertions(+), 8 deletions(-)

applied

thanks

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

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


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


Re: [FFmpeg-devel] [PATCH 2/4] fate: gapless: fix a typo in comment

2015-04-17 Thread Michael Niedermayer
On Fri, Apr 17, 2015 at 05:27:01PM +0200, wm4 wrote:
> ---
>  tests/fate-run.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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] [PATCH 3/4] fate: gapless: test seeking to a specific position

2015-04-17 Thread Michael Niedermayer
On Fri, Apr 17, 2015 at 05:27:02PM +0200, wm4 wrote:
> ---
> This is somewhat different from seeking to start. Seeking to start
> should give exactly the same result as not seeking at all, while
> seeking to the middle does not set skip metadata for the first
> packet.
> ---
>  tests/fate-run.sh  | 6 +-
>  tests/ref/fate/gapless-mp3 | 1 +
>  2 files changed, 6 insertions(+), 1 deletion(-)

applied

thanks

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

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus


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


Re: [FFmpeg-devel] [PATCH 4/4] fate: gapless: test mp3 both with and without TOC

2015-04-17 Thread Michael Niedermayer
On Fri, Apr 17, 2015 at 05:27:03PM +0200, wm4 wrote:
> ---
> I had too many issues with this difference.
> ---
>  tests/fate/gapless.mak   | 3 ++-
>  tests/ref/fate/gapless-mp3-notoc | 5 +
>  2 files changed, 7 insertions(+), 1 deletion(-)
>  create mode 100644 tests/ref/fate/gapless-mp3-notoc

applied

thanks

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

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


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


[FFmpeg-devel] [PATCH] avcodec/mpegaudiodec_template: skip first frame after seeking

2015-04-17 Thread Michael Niedermayer
This could be made optional if preferred
---
 libavcodec/mpegaudiodec_template.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/mpegaudiodec_template.c 
b/libavcodec/mpegaudiodec_template.c
index 2326a90..70c17a1 100644
--- a/libavcodec/mpegaudiodec_template.c
+++ b/libavcodec/mpegaudiodec_template.c
@@ -87,6 +87,7 @@ typedef struct MPADecodeContext {
 MPADSPContext mpadsp;
 AVFloatDSPContext *fdsp;
 AVFrame *frame;
+int flushed;
 } MPADecodeContext;
 
 #define HEADER_SIZE 4
@@ -1645,6 +1646,11 @@ static int mp_decode_frame(MPADecodeContext *s, OUT_INT 
**samples,
 }
 }
 
+if (s->flushed) {
+s->avctx->internal->skip_samples = 
FFMAX(s->avctx->internal->skip_samples, s->frame->nb_samples);
+s->flushed = 0;
+}
+
 return nb_frames * 32 * sizeof(OUT_INT) * s->nb_channels;
 }
 
@@ -1723,6 +1729,7 @@ static void mp_flush(MPADecodeContext *ctx)
 memset(ctx->mdct_buf, 0, sizeof(ctx->mdct_buf));
 ctx->last_buf_size = 0;
 ctx->dither_state = 0;
+ctx->flushed = 1;
 }
 
 static void flush(AVCodecContext *avctx)
-- 
1.7.9.5

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


Re: [FFmpeg-devel] [PATCH] avcodec/mpegaudiodec_template: skip first frame after seeking

2015-04-17 Thread wm4
On Fri, 17 Apr 2015 19:04:02 +0200
Michael Niedermayer  wrote:

> This could be made optional if preferred
> ---
>  libavcodec/mpegaudiodec_template.c |7 +++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/libavcodec/mpegaudiodec_template.c 
> b/libavcodec/mpegaudiodec_template.c
> index 2326a90..70c17a1 100644
> --- a/libavcodec/mpegaudiodec_template.c
> +++ b/libavcodec/mpegaudiodec_template.c
> @@ -87,6 +87,7 @@ typedef struct MPADecodeContext {
>  MPADSPContext mpadsp;
>  AVFloatDSPContext *fdsp;
>  AVFrame *frame;
> +int flushed;
>  } MPADecodeContext;
>  
>  #define HEADER_SIZE 4
> @@ -1645,6 +1646,11 @@ static int mp_decode_frame(MPADecodeContext *s, 
> OUT_INT **samples,
>  }
>  }
>  
> +if (s->flushed) {
> +s->avctx->internal->skip_samples = 
> FFMAX(s->avctx->internal->skip_samples, s->frame->nb_samples);
> +s->flushed = 0;
> +}
> +
>  return nb_frames * 32 * sizeof(OUT_INT) * s->nb_channels;
>  }
>  
> @@ -1723,6 +1729,7 @@ static void mp_flush(MPADecodeContext *ctx)
>  memset(ctx->mdct_buf, 0, sizeof(ctx->mdct_buf));
>  ctx->last_buf_size = 0;
>  ctx->dither_state = 0;
> +ctx->flushed = 1;
>  }
>  
>  static void flush(AVCodecContext *avctx)

Would this not break gapless audio if you seek back to the first frame
after being done decoding? (Consider usecases like infinite looping.)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/mpegaudiodec_template: skip first frame after seeking

2015-04-17 Thread Michael Niedermayer
On Fri, Apr 17, 2015 at 07:21:23PM +0200, wm4 wrote:
> On Fri, 17 Apr 2015 19:04:02 +0200
> Michael Niedermayer  wrote:
> 
> > This could be made optional if preferred
> > ---
> >  libavcodec/mpegaudiodec_template.c |7 +++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/libavcodec/mpegaudiodec_template.c 
> > b/libavcodec/mpegaudiodec_template.c
> > index 2326a90..70c17a1 100644
> > --- a/libavcodec/mpegaudiodec_template.c
> > +++ b/libavcodec/mpegaudiodec_template.c
> > @@ -87,6 +87,7 @@ typedef struct MPADecodeContext {
> >  MPADSPContext mpadsp;
> >  AVFloatDSPContext *fdsp;
> >  AVFrame *frame;
> > +int flushed;
> >  } MPADecodeContext;
> >  
> >  #define HEADER_SIZE 4
> > @@ -1645,6 +1646,11 @@ static int mp_decode_frame(MPADecodeContext *s, 
> > OUT_INT **samples,
> >  }
> >  }
> >  
> > +if (s->flushed) {
> > +s->avctx->internal->skip_samples = 
> > FFMAX(s->avctx->internal->skip_samples, s->frame->nb_samples);
> > +s->flushed = 0;
> > +}
> > +
> >  return nb_frames * 32 * sizeof(OUT_INT) * s->nb_channels;
> >  }
> >  
> > @@ -1723,6 +1729,7 @@ static void mp_flush(MPADecodeContext *ctx)
> >  memset(ctx->mdct_buf, 0, sizeof(ctx->mdct_buf));
> >  ctx->last_buf_size = 0;
> >  ctx->dither_state = 0;
> > +ctx->flushed = 1;
> >  }
> >  
> >  static void flush(AVCodecContext *avctx)
> 
> Would this not break gapless audio if you seek back to the first frame
> after being done decoding? (Consider usecases like infinite looping.)

i did not test it but the skip value from AVPacket should override
this if its set
the first packet should contain skip sidedata or the mp3 would start
with a "half" empty output frame

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

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin


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


Re: [FFmpeg-devel] [PATCH] avcodec/mpegaudiodec_template: skip first frame after seeking

2015-04-17 Thread wm4
On Fri, 17 Apr 2015 19:47:50 +0200
Michael Niedermayer  wrote:

> On Fri, Apr 17, 2015 at 07:21:23PM +0200, wm4 wrote:
> > On Fri, 17 Apr 2015 19:04:02 +0200
> > Michael Niedermayer  wrote:
> > 
> > > This could be made optional if preferred
> > > ---
> > >  libavcodec/mpegaudiodec_template.c |7 +++
> > >  1 file changed, 7 insertions(+)
> > > 
> > > diff --git a/libavcodec/mpegaudiodec_template.c 
> > > b/libavcodec/mpegaudiodec_template.c
> > > index 2326a90..70c17a1 100644
> > > --- a/libavcodec/mpegaudiodec_template.c
> > > +++ b/libavcodec/mpegaudiodec_template.c
> > > @@ -87,6 +87,7 @@ typedef struct MPADecodeContext {
> > >  MPADSPContext mpadsp;
> > >  AVFloatDSPContext *fdsp;
> > >  AVFrame *frame;
> > > +int flushed;
> > >  } MPADecodeContext;
> > >  
> > >  #define HEADER_SIZE 4
> > > @@ -1645,6 +1646,11 @@ static int mp_decode_frame(MPADecodeContext *s, 
> > > OUT_INT **samples,
> > >  }
> > >  }
> > >  
> > > +if (s->flushed) {
> > > +s->avctx->internal->skip_samples = 
> > > FFMAX(s->avctx->internal->skip_samples, s->frame->nb_samples);
> > > +s->flushed = 0;
> > > +}
> > > +
> > >  return nb_frames * 32 * sizeof(OUT_INT) * s->nb_channels;
> > >  }
> > >  
> > > @@ -1723,6 +1729,7 @@ static void mp_flush(MPADecodeContext *ctx)
> > >  memset(ctx->mdct_buf, 0, sizeof(ctx->mdct_buf));
> > >  ctx->last_buf_size = 0;
> > >  ctx->dither_state = 0;
> > > +ctx->flushed = 1;
> > >  }
> > >  
> > >  static void flush(AVCodecContext *avctx)
> > 
> > Would this not break gapless audio if you seek back to the first frame
> > after being done decoding? (Consider usecases like infinite looping.)
> 
> i did not test it but the skip value from AVPacket should override
> this if its set
> the first packet should contain skip sidedata or the mp3 would start
> with a "half" empty output frame
> 
> [...]

I wonder if it would be safer and generally less disruptive if the
demuxer added the skip value to the first AVPacket after every seek?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] tests/tiny_psnr: Make the search range extend both sides from the specified shift value

2015-04-17 Thread Michael Niedermayer
On Sun, Apr 12, 2015 at 03:28:15PM +0200, Michael Niedermayer wrote:
> This is what one would expect from the help text
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  tests/tiny_psnr.c |3 +++
>  1 file changed, 3 insertions(+)

applied

[...]
-- 
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] hls: skip to next segment if the current is unavailable

2015-04-17 Thread wm4
On Thu, 16 Apr 2015 13:47:20 +0200
wm4  wrote:

> Apparently, some live streams can delete segments too early, maybe
> because the client is too far behind. In this case, it's better to skip
> the segment, instead of returning EOF. (Yes, the HLS demuxer actually
> returns AVERROR_EOF if opening the segment returns a 404 HTTP error.)
> ---
> I'd say this is fairly controversial.
> ---
>  libavformat/hls.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/hls.c b/libavformat/hls.c
> index 4a7d003..451b78e 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -1087,7 +1087,8 @@ reload:
>  if (ret < 0) {
>  av_log(v->parent, AV_LOG_WARNING, "Failed to open segment of 
> playlist %d\n",
> v->index);
> -return ret;
> +v->cur_seq_no += 1;
> +goto reload;
>  }
>  just_opened = 1;
>  }

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


[FFmpeg-devel] [PATCH] avformat/rawdec: set AVFMT_NOTIMESTAMPS on more demuxers

2015-04-17 Thread wm4
This affects a bunch of demuxers, including raw h264.
---
 libavformat/rawdec.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/rawdec.h b/libavformat/rawdec.h
index a464bbb..959dc6e 100644
--- a/libavformat/rawdec.h
+++ b/libavformat/rawdec.h
@@ -67,7 +67,7 @@ AVInputFormat ff_ ## shortname ## _demuxer = {\
 };
 
 #define FF_DEF_RAWVIDEO_DEMUXER(shortname, longname, probe, ext, id)\
-FF_DEF_RAWVIDEO_DEMUXER2(shortname, longname, probe, ext, id, 
AVFMT_GENERIC_INDEX)
+FF_DEF_RAWVIDEO_DEMUXER2(shortname, longname, probe, ext, id, 
AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS)
 
 #define FF_RAWSUB_DEMUXER_CLASS(name)\
 static const AVClass name ## _demuxer_class = {\
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH] avformat/rawdec: set AVFMT_NOTIMESTAMPS on more demuxers

2015-04-17 Thread Michael Niedermayer
On Fri, Apr 17, 2015 at 09:59:36PM +0200, wm4 wrote:
> This affects a bunch of demuxers, including raw h264.
> ---
>  libavformat/rawdec.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

this breaks fate-hevc-paramchange-yuv420p-yuv420p10

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin


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/rawdec: set AVFMT_NOTIMESTAMPS on more demuxers

2015-04-17 Thread wm4
On Fri, 17 Apr 2015 22:52:07 +0200
Michael Niedermayer  wrote:

> On Fri, Apr 17, 2015 at 09:59:36PM +0200, wm4 wrote:
> > This affects a bunch of demuxers, including raw h264.
> > ---
> >  libavformat/rawdec.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> this breaks fate-hevc-paramchange-yuv420p-yuv420p10
> 
> [...]
> 

Only the (insignificant) timestamps are different.

This "fixes" it:

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 6c7ca0a..591 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3143,7 +3143,7 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
 !st->codec->extradata)
 break;
 if (st->first_dts == AV_NOPTS_VALUE &&
-!(ic->iformat->flags & AVFMT_NOTIMESTAMPS) &&
+/*!(ic->iformat->flags & AVFMT_NOTIMESTAMPS) &&*/
 st->codec_info_nb_frames < ic->max_ts_probe &&
 (st->codec->codec_type == AVMEDIA_TYPE_VIDEO ||
  st->codec->codec_type == AVMEDIA_TYPE_AUDIO))

I have no idea what this does, and it happens in
avformat_find_stream_info(), which is satan.

Would it be ok to send a new patch with the timestamps changed in the
ref file?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] hls: skip to next segment if the current is unavailable

2015-04-17 Thread Michael Niedermayer
On Thu, Apr 16, 2015 at 01:47:20PM +0200, wm4 wrote:
> Apparently, some live streams can delete segments too early, maybe
> because the client is too far behind. In this case, it's better to skip
> the segment, instead of returning EOF. (Yes, the HLS demuxer actually
> returns AVERROR_EOF if opening the segment returns a 404 HTTP error.)
> ---
> I'd say this is fairly controversial.
> ---
>  libavformat/hls.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

applied

thanks

[...]
-- 
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] [libav-devel] [PATCH] aacpsy: avoid norm_fac becoming NaN

2015-04-17 Thread Andreas Cadhalpun
On 17.04.2015 23:39, Luca Barbato wrote:
> On 17/04/15 16:08, Andreas Cadhalpun wrote:
>> On 17.04.2015 02:01, Luca Barbato wrote:
>>> is band->thr = 0.0f a valid value?
>>
>> Come to think of it, that's probably invalid.

I retract that, it seems band->thr = 0.0f is valid.

>> It can happen if coeffs[g].ath is not positive.
> 
> ath() returns easily Inf and negative values...

It returns Inf for 0 and Inf, though that's not the
problem here. Neither is that it can return negative
values, because the minimum of the ath() function is
(or rather should be) subtracted:
coeffs[g].ath = minscale - minath;

The problem is that minath is not the minimum, only close:
minath = ath(3410, ATH_ADD) = -5.24237967
 ath(3407, ATH_ADD) = -5.24241638

Attached patch is fixing this. With it the minimal value
of coeffs[g].ath is 0.0f. 

>> Attached patch errors out in this case.

Scratch that patch. It shouldn't be negative (fixed with
attached patch), but 0.0f is possible.

>>> band->energy can be 0?
>>
>> Yes, it's set to 0.0f in calc_thr_3gpp if enough coefs are 0.
> 
> and in that case the threshold? (that is calculated as a fraction of the
> energy at least in one place).

In that case band->thr is set to coeffs[g].ath:
band->thr_quiet = band->thr = FFMAX(band->thr, coeffs[g].ath);

So band->thr still can be 0.0f, i.e. the patch checking for (band->thr > 0.0f)
is still necessary.

Best regards,
Andreas
>From 667787601c17bd1d461f3171bedafd17214216e6 Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun 
Date: Sat, 18 Apr 2015 00:33:50 +0200
Subject: [PATCH] aacpsy: fix calculation of minath in psy_3gpp_init

The minimum of the ath(x, ATH_ADD) function is at 3407 (-5.24241638)
not at 3410 (-5.24237967).

Signed-off-by: Andreas Cadhalpun 
---
 libavcodec/aacpsy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
index 7205ee3..c9bcfaf 100644
--- a/libavcodec/aacpsy.c
+++ b/libavcodec/aacpsy.c
@@ -313,7 +313,7 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
 ctx->bitres.size   = 6144 - pctx->frame_bits;
 ctx->bitres.size  -= ctx->bitres.size % 8;
 pctx->fill_level   = ctx->bitres.size;
-minath = ath(3410, ATH_ADD);
+minath = ath(3407, ATH_ADD);
 for (j = 0; j < 2; j++) {
 AacPsyCoeffs *coeffs = pctx->psy_coef[j];
 const uint8_t *band_sizes = ctx->bands[j];
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH] avformat/rawdec: set AVFMT_NOTIMESTAMPS on more demuxers

2015-04-17 Thread Michael Niedermayer
On Fri, Apr 17, 2015 at 11:24:41PM +0200, wm4 wrote:
> On Fri, 17 Apr 2015 22:52:07 +0200
> Michael Niedermayer  wrote:
> 
> > On Fri, Apr 17, 2015 at 09:59:36PM +0200, wm4 wrote:
> > > This affects a bunch of demuxers, including raw h264.
> > > ---
> > >  libavformat/rawdec.h | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > this breaks fate-hevc-paramchange-yuv420p-yuv420p10
> > 
> > [...]
> > 
> 
> Only the (insignificant) timestamps are different.
> 
> This "fixes" it:
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 6c7ca0a..591 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -3143,7 +3143,7 @@ int avformat_find_stream_info(AVFormatContext *ic, 
> AVDictionary **options)
>  !st->codec->extradata)
>  break;
>  if (st->first_dts == AV_NOPTS_VALUE &&
> -!(ic->iformat->flags & AVFMT_NOTIMESTAMPS) &&
> +/*!(ic->iformat->flags & AVFMT_NOTIMESTAMPS) &&*/
>  st->codec_info_nb_frames < ic->max_ts_probe &&
>  (st->codec->codec_type == AVMEDIA_TYPE_VIDEO ||
>   st->codec->codec_type == AVMEDIA_TYPE_AUDIO))
> 
> I have no idea what this does, and it happens in
> avformat_find_stream_info(), which is satan.

the code waits for the first timestamp unless AVFMT_NOTIMESTAMPS is
set or some other threashold is reached
removing AVFMT_NOTIMESTAMPS would make the code wait for the first
timestamp for cases that do not have any timestamp

i have a mostly working solution in a branch locally but i need to
think about it a bit more and do more testing


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

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


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


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

2015-04-17 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/dcaenc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
index d57d658..c8a215c 100644
--- a/libavcodec/dcaenc.c
+++ b/libavcodec/dcaenc.c
@@ -847,8 +847,7 @@ static void put_subframe_samples(DCAEncContext *c, int ss, 
int band, int ch)
 int i;
 for (i = 0; i < 8; i++) {
 int bits = bit_consumption[c->abits[band][ch]] / 16;
-int32_t mask = (1 << bits) - 1;
-put_bits(&c->pb, bits, c->quantized[ss * 8 + i][band][ch] & mask);
+put_sbits(&c->pb, bits, c->quantized[ss * 8 + i][band][ch]);
 }
 }
 }
-- 
2.3.5

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


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

2015-04-17 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/wavpackenc.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/libavcodec/wavpackenc.c b/libavcodec/wavpackenc.c
index c174950..87f1445 100644
--- a/libavcodec/wavpackenc.c
+++ b/libavcodec/wavpackenc.c
@@ -2143,7 +2143,6 @@ static void pack_int32(WavPackEncodeContext *s,
int nb_samples)
 {
 const int sent_bits = s->int32_sent_bits;
-int32_t value, mask = (1 << sent_bits) - 1;
 PutBitContext *pb = &s->pb;
 int i, pre_shift;
 
@@ -2154,15 +2153,12 @@ static void pack_int32(WavPackEncodeContext *s,
 
 if (s->flags & WV_MONO_DATA) {
 for (i = 0; i < nb_samples; i++) {
-value = (samples_l[i] >> pre_shift) & mask;
-put_bits(pb, sent_bits, value);
+put_sbits(pb, sent_bits, samples_l[i] >> pre_shift);
 }
 } else {
 for (i = 0; i < nb_samples; i++) {
-value = (samples_l[i] >> pre_shift) & mask;
-put_bits(pb, sent_bits, value);
-value = (samples_r[i] >> pre_shift) & mask;
-put_bits(pb, sent_bits, value);
+put_sbits(pb, sent_bits, samples_l[i] >> pre_shift);
+put_sbits(pb, sent_bits, samples_r[i] >> pre_shift);
 }
 }
 }
-- 
2.3.5

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


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

2015-04-17 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/aaccoder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index f07e523..2929f3a 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -210,7 +210,7 @@ static av_always_inline float 
quantize_and_encode_band_cost_template(
 int len = av_log2(coef);
 
 put_bits(pb, len - 4 + 1, (1 << (len - 4 + 1)) - 2);
-put_bits(pb, len, coef & ((1 << len) - 1));
+put_sbits(pb, len, coef);
 }
 }
 }
-- 
2.3.5

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


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

2015-04-17 Thread Ronald S. Bultje
Hi,

On Fri, Apr 17, 2015 at 10:29 PM, James Almer  wrote:

> Signed-off-by: James Almer 
> ---
>  libavcodec/wavpackenc.c | 10 +++---
>  1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/libavcodec/wavpackenc.c b/libavcodec/wavpackenc.c
> index c174950..87f1445 100644
> --- a/libavcodec/wavpackenc.c
> +++ b/libavcodec/wavpackenc.c
> @@ -2143,7 +2143,6 @@ static void pack_int32(WavPackEncodeContext *s,
> int nb_samples)
>  {
>  const int sent_bits = s->int32_sent_bits;
> -int32_t value, mask = (1 << sent_bits) - 1;
>  PutBitContext *pb = &s->pb;
>  int i, pre_shift;
>
> @@ -2154,15 +2153,12 @@ static void pack_int32(WavPackEncodeContext *s,
>
>  if (s->flags & WV_MONO_DATA) {
>  for (i = 0; i < nb_samples; i++) {
> -value = (samples_l[i] >> pre_shift) & mask;
> -put_bits(pb, sent_bits, value);
> +put_sbits(pb, sent_bits, samples_l[i] >> pre_shift);
>  }
>  } else {
>  for (i = 0; i < nb_samples; i++) {
> -value = (samples_l[i] >> pre_shift) & mask;
> -put_bits(pb, sent_bits, value);
> -value = (samples_r[i] >> pre_shift) & mask;
> -put_bits(pb, sent_bits, value);
> +put_sbits(pb, sent_bits, samples_l[i] >> pre_shift);
> +put_sbits(pb, sent_bits, samples_r[i] >> pre_shift);


>From a bit coder's perspective, you could just as well write a
put_(s)bits_upper() which doesn't write until the final lowest (1) bit.

(You don't have to do that, just pointing it out.)

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


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

2015-04-17 Thread Michael Niedermayer
On Sat, Apr 18, 2015 at 12:55:08AM +0200, Andreas Cadhalpun wrote:
> On 17.04.2015 23:39, Luca Barbato wrote:
> > On 17/04/15 16:08, Andreas Cadhalpun wrote:
> >> On 17.04.2015 02:01, Luca Barbato wrote:
> >>> is band->thr = 0.0f a valid value?
> >>
> >> Come to think of it, that's probably invalid.
> 
> I retract that, it seems band->thr = 0.0f is valid.
> 
> >> It can happen if coeffs[g].ath is not positive.
> > 
> > ath() returns easily Inf and negative values...
> 
> It returns Inf for 0 and Inf, though that's not the
> problem here. Neither is that it can return negative
> values, because the minimum of the ath() function is
> (or rather should be) subtracted:
> coeffs[g].ath = minscale - minath;
> 
> The problem is that minath is not the minimum, only close:
> minath = ath(3410, ATH_ADD) = -5.24237967
>  ath(3407, ATH_ADD) = -5.24241638

the exact location of the minimum depends on teh "add" value
its around 3410 for add=0 and around 3407 for add=4
for fun, 3407.080774800152 is even closer than 3407 for add=4

but the "add" parameter should probably be user selectable

also if you want to prevent coeffs[].ath from becoming negative then
you have to check coeffs[].ath, as
float rounding and optimizations can differ between platforms

you cannot even know for sure that
ath(3407, ATH_ADD) == ath(i, ATH_ADD) when i == 3407

the value calculated with a constant can be calculated at build time
but in the loop the code could have been optimized/factored/whatever
by the compiler and produce different values as a result

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


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

2015-04-17 Thread Mariusz SzczepaƄczyk
On Wed, Apr 8, 2015 at 8:15 PM, Michael Niedermayer 
wrote:

> On Wed, Apr 08, 2015 at 07:58:19PM +0200, Mariusz SzczepaƄczyk wrote:
> > On Wed, Apr 8, 2015 at 6:33 PM, Michael Niedermayer 
> > wrote:
> >
> > > Hi
> > >
> > > Some people on IRC asked about the uses of the AVIODir* API and it
> > > seems several developers do not know what the API is usefull for.
> > >
> > > I think this should be documented better
> > >
> > > also what can it be usefull for, random example:
> > > A "file open" dialog in a player. Without such API in a ffmpeg lib
> > > players would have to duplicate quite some code to list non local
> > > files.
> > >
> > >
> > Hi,
> >
> > where do you think such documentation should be added?
> >
> > Doxygen? doc/libavformat.texi?
>
> hmm, i dont know, you
> doc/libavformat.texi seems very short so it feels out of place but a
> link could maybe be added
>
> doxygen seems the better choice for the text itself
> but maybe someone has better idea(s)
>

Hey, I've written some docs. Sorry for the delay.

Mariusz
From 0386742856c87d83350f2c8d26c924c012b7da30 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mariusz=20Szczepa=C5=84czyk?= 
Date: Sat, 18 Apr 2015 04:31:14 +0200
Subject: [PATCH] lavf: add documentation on directory listing API

---
 libavformat/avformat.h | 47 +++
 1 file changed, 47 insertions(+)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 4211a95..514e646 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -233,6 +233,53 @@
  *
  * @defgroup lavf_io I/O Read/Write
  * @{
+ * @section lavf_io_dirlist Directory listing
+ * The directory listing API allows to list files on remote servers.
+ *
+ * Some of possible use cases:
+ * - an "open file" dialog to choose files from a remote location,
+ * - a recursive media finder providing a player with an ability to play all
+ * files from a given directory.
+ *
+ * @subsection lavf_io_dirlist_open Opening a directory
+ * At first, a directory needs to be opened by calling avio_open_dir()
+ * supplied with a URL and, optionally, ::AVDictionary containing
+ * protocol-specific parameters. The function returns zero or positive
+ * integer and allocates AVIODirContext on success.
+ *
+ * @code
+ * AVIODirContext *ctx = NULL;
+ * if (avio_open_dir(&ctx, "smb://example.com/some_dir", NULL) < 0) {
+ * fprintf(stderr, "Cannot open directory.\n");
+ * abort();
+ * }
+ * @endcode
+ *
+ * This code tries to open a sample directory using smb protocol without
+ * any additional parameters.
+ *
+ * @subsection lavf_io_dirlist_read Reading entries
+ * Each directory's entry (i.e. file, another directory, anything else
+ * within ::AVIODirEntryType) is represented by AVIODirEntry.
+ * Reading consecutive entries from an opened AVIODirContext is done by
+ * repeatedly calling avio_read_dir() on it. Each call returns zero or
+ * positive integer if successful. Reading can be stopped right after the
+ * NULL entry has been read -- it means there are no entries left to be
+ * read. The following code reads all entries from a directory associated
+ * with ctx and prints their names to standard output.
+ * @code
+ * AVIODirEntry *entry = NULL;
+ * for (;;) {
+ * if (avio_read_dir(ctx, &entry) < 0) {
+ * fprintf(stderr, "Cannot list directory.\n");
+ * abort();
+ * }
+ * if (!entry)
+ * break;
+ * printf("%s\n", entry->name);
+ * avio_free_directory_entry(&entry);
+ * }
+ * @endcode
  * @}
  *
  * @defgroup lavf_codec Demuxers
-- 
2.3.3

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


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

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

diff --git a/libavcodec/dca_xll.c b/libavcodec/dca_xll.c
index 9e1085c..98fd4c8 100644
--- a/libavcodec/dca_xll.c
+++ b/libavcodec/dca_xll.c
@@ -393,7 +393,7 @@ static void dca_xll_inv_adapt_pred(int *samples, int 
nsamples, unsigned order,
 for (; j < order; j++)
 s += (int64_t) c[j] * prev[DCA_XLL_AORDER_MAX + i - 1 - j];
 
-samples[i] -= av_clip((s + 0x8000) >> 16, -0x100, 0xff);
+samples[i] -= av_clip_intp2((s + 0x8000) >> 16, 24);
 }
 }
 for (i = order; i < nsamples; i++) {
@@ -402,7 +402,7 @@ static void dca_xll_inv_adapt_pred(int *samples, int 
nsamples, unsigned order,
 
 /* NOTE: Equations seem to imply addition, while the
  * pseudocode seems to use subtraction.*/
-samples[i] -= av_clip((s + 0x8000) >> 16, -0x100, 0xff);
+samples[i] -= av_clip_intp2((s + 0x8000) >> 16, 24);
 }
 }
 
-- 
2.3.5

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


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

2015-04-17 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/adpcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 1c3fdc4..56d1660 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -1498,7 +1498,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void 
*data,
 prev = 0;
 }
 
-prev = av_clip((prev + 0x20) >> 6, -0x20, 0x1f);
+prev = av_clip_intp2((prev + 0x20) >> 6, 21);
 
 byte = bytestream2_get_byteu(&gb);
 if (!channel)
-- 
2.3.5

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