[libav-commits] swscale: add dithering to yuv2yuvX_altivec_real

2011-08-12 Thread Luca Barbato
Module: libav
Branch: master
Commit: 3304a1e69a8a050eb66d2304acd2d01354fa1aac

Author:Luca Barbato 
Committer: Luca Barbato 
Date:  Wed Aug 10 02:16:26 2011 +0200

swscale: add dithering to yuv2yuvX_altivec_real

It just does that part in scalar form, I doubt using a vector store
over 2 array would speed it up particularly.

The function should be written to not use a scratch buffer.

---

 libswscale/ppc/swscale_altivec.c |   21 +++--
 1 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/libswscale/ppc/swscale_altivec.c b/libswscale/ppc/swscale_altivec.c
index f988b53..7fdca39 100644
--- a/libswscale/ppc/swscale_altivec.c
+++ b/libswscale/ppc/swscale_altivec.c
@@ -92,6 +92,7 @@ altivec_packIntArrayToCharArray(int *val, uint8_t* dest, int 
dstW)
 }
 }
 
+//FIXME remove the usage of scratch buffers.
 static void
 yuv2yuvX_altivec_real(SwsContext *c,
   const int16_t *lumFilter, const int16_t **lumSrc,
@@ -101,17 +102,13 @@ yuv2yuvX_altivec_real(SwsContext *c,
   uint8_t *dest[4], int dstW, int chrDstW)
 {
 uint8_t *yDest = dest[0], *uDest = dest[1], *vDest = dest[2];
-const vector signed int vini = {(1 << 18), (1 << 18), (1 << 18), (1 << 
18)};
+const uint8_t *lumDither = c->lumDither8, *chrDither = c->chrDither8;
 register int i, j;
 {
 DECLARE_ALIGNED(16, int, val)[dstW];
 
-for (i = 0; i < (dstW -7); i+=4) {
-vec_st(vini, i << 2, val);
-}
-for (; i < dstW; i++) {
-val[i] = (1 << 18);
-}
+for (i=0; ihttps://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] h264: add missing brackets.

2011-08-12 Thread Ronald S. Bultje
Module: libav
Branch: master
Commit: 28ca701e0b57dfaf03ab1835ce62faa1de8c4712

Author:Ronald S. Bultje 
Committer: Ronald S. Bultje 
Date:  Fri Aug 12 12:32:31 2011 -0700

h264: add missing brackets.

This caused failure of a few fate tests.

---

 libavcodec/h264_refs.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index 50925ce..b7e43e7 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -515,9 +515,10 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO 
*mmco, int mmco_count){
 pic = find_short(h, frame_num, &j);
 if(!pic){
 if(mmco[i].opcode != MMCO_SHORT2LONG || 
!h->long_ref[mmco[i].long_arg]
-   || h->long_ref[mmco[i].long_arg]->frame_num != frame_num)
-av_log(h->s.avctx, AV_LOG_ERROR, "mmco: unref short 
failure\n");
-err = AVERROR_INVALIDDATA;
+   || h->long_ref[mmco[i].long_arg]->frame_num != frame_num) {
+av_log(h->s.avctx, AV_LOG_ERROR, "mmco: unref short 
failure\n");
+err = AVERROR_INVALIDDATA;
+}
 continue;
 }
 }

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] swscale: use 15-bit intermediates for 9/10-bit scaling.

2011-08-12 Thread Ronald S. Bultje
Module: libav
Branch: master
Commit: 28c1115a915e4e198bfb6bd39909b2d1327c1454

Author:Ronald S. Bultje 
Committer: Ronald S. Bultje 
Date:  Tue Aug  2 15:42:35 2011 -0700

swscale: use 15-bit intermediates for 9/10-bit scaling.

---

 libswscale/ppc/swscale_altivec.c   |2 +-
 libswscale/swscale.c   |  237 ++--
 libswscale/swscale_internal.h  |  108 ++---
 libswscale/utils.c |   20 ++-
 libswscale/x86/swscale_template.c  |2 +-
 tests/ref/lavfi/pixdesc|   20 ++--
 tests/ref/lavfi/pixfmts_copy   |   20 ++--
 tests/ref/lavfi/pixfmts_crop   |   16 ++--
 tests/ref/lavfi/pixfmts_hflip  |   16 ++--
 tests/ref/lavfi/pixfmts_null   |   20 ++--
 tests/ref/lavfi/pixfmts_scale  |   28 ++--
 tests/ref/lavfi/pixfmts_vflip  |   20 ++--
 tests/ref/vsynth1/dnxhd_720p_10bit |8 +-
 tests/ref/vsynth2/dnxhd_720p_10bit |8 +-
 14 files changed, 302 insertions(+), 223 deletions(-)

diff --git a/libswscale/ppc/swscale_altivec.c b/libswscale/ppc/swscale_altivec.c
index 369e93b..f988b53 100644
--- a/libswscale/ppc/swscale_altivec.c
+++ b/libswscale/ppc/swscale_altivec.c
@@ -406,7 +406,7 @@ void ff_sws_init_swScale_altivec(SwsContext *c)
 if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC))
 return;
 
-if (c->scalingBpp == 8) {
+if (c->srcBpc == 8 && c->dstBpc <= 10) {
 c->hScale   = hScale_altivec_real;
 }
 if (!is16BPS(dstFormat) && !is9_OR_10BPS(dstFormat) &&
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index dd9f4a1..f5b0ab4 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -211,17 +211,9 @@ yuv2yuvX16_c_template(const int16_t *lumFilter, const 
int32_t **lumSrc,
 
 #define output_pixel(pos, val) \
 if (big_endian) { \
-if (output_bits == 16) { \
-AV_WB16(pos, av_clip_uint16(val >> shift)); \
-} else { \
-AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits)); \
-} \
+AV_WB16(pos, av_clip_uint16(val >> shift)); \
 } else { \
-if (output_bits == 16) { \
-AV_WL16(pos, av_clip_uint16(val >> shift)); \
-} else { \
-AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits)); \
-} \
+AV_WL16(pos, av_clip_uint16(val >> shift)); \
 }
 for (i = 0; i < dstW; i++) {
 int val = 1 << (30-output_bits - 1);
@@ -263,7 +255,67 @@ yuv2yuvX16_c_template(const int16_t *lumFilter, const 
int32_t **lumSrc,
 #undef output_pixel
 }
 
-#define yuv2NBPS(bits, BE_LE, is_be) \
+static av_always_inline void
+yuv2yuvX10_c_template(const int16_t *lumFilter, const int16_t **lumSrc,
+  int lumFilterSize, const int16_t *chrFilter,
+  const int16_t **chrUSrc, const int16_t **chrVSrc,
+  int chrFilterSize, const int16_t **alpSrc,
+  uint16_t *dest[4], int dstW, int chrDstW,
+  int big_endian, int output_bits)
+{
+//FIXME Optimize (just quickly written not optimized..)
+int i;
+uint16_t *yDest = dest[0], *uDest = dest[1], *vDest = dest[2],
+ *aDest = CONFIG_SWSCALE_ALPHA ? dest[3] : NULL;
+int shift = 11 + 16 - output_bits - 1;
+
+#define output_pixel(pos, val) \
+if (big_endian) { \
+AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits)); \
+} else { \
+AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits)); \
+}
+for (i = 0; i < dstW; i++) {
+int val = 1 << (26-output_bits - 1);
+int j;
+
+for (j = 0; j < lumFilterSize; j++)
+val += (lumSrc[j][i] * lumFilter[j]) >> 1;
+
+output_pixel(&yDest[i], val);
+}
+
+if (uDest) {
+for (i = 0; i < chrDstW; i++) {
+int u = 1 << (26-output_bits - 1);
+int v = 1 << (26-output_bits - 1);
+int j;
+
+for (j = 0; j < chrFilterSize; j++) {
+u += (chrUSrc[j][i] * chrFilter[j]) >> 1;
+v += (chrVSrc[j][i] * chrFilter[j]) >> 1;
+}
+
+output_pixel(&uDest[i], u);
+output_pixel(&vDest[i], v);
+}
+}
+
+if (CONFIG_SWSCALE_ALPHA && aDest) {
+for (i = 0; i < dstW; i++) {
+int val = 1 << (26-output_bits - 1);
+int j;
+
+for (j = 0; j < lumFilterSize; j++)
+val += (alpSrc[j][i] * lumFilter[j]) >> 1;
+
+output_pixel(&aDest[i], val);
+}
+}
+#undef output_pixel
+}
+
+#define yuv2NBPS(bits, BE_LE, is_be, yuv2yuvX_template_fn, typeX_t) \
 static void yuv2yuvX ## bits ## BE_LE ## _c(SwsContext *c, const int16_t 
*lumFilter, \
   const int16_t **_lumSrc, int lumFilterSize, \
   const int16_t *chrFilter, const int16_t 
**_chrUSrc, \
@@ -271,21 +323,21 @@ static void yuv2yuvX ## bits ## BE_LE ## _c(SwsContext 
*c, const int16_t *lumFil
  

[libav-commits] rv34: free+allocate buffer instead of reallocating it to preserve alignment

2011-08-12 Thread Kostya Shishkov
Module: libav
Branch: master
Commit: 78622ef362c7c8d4606fe1a38f612f039413c7c3

Author:Kostya Shishkov 
Committer: Ronald S. Bultje 
Date:  Fri Aug 12 21:50:28 2011 +0200

rv34: free+allocate buffer instead of reallocating it to preserve alignment

Signed-off-by: Ronald S. Bultje 

---

 libavcodec/rv34.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index cdc559f..253c395 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1311,7 +1311,8 @@ static int rv34_decode_slice(RV34DecContext *r, int end, 
const uint8_t* buf, int
 if (!r->tmp_b_block_base || s->width != r->si.width || s->height != 
r->si.height) {
 int i;
 
-r->tmp_b_block_base = av_realloc(r->tmp_b_block_base, s->linesize 
* 48);
+av_free(r->tmp_b_block_base); //realloc() doesn't guarantee 
alignment
+r->tmp_b_block_base = av_malloc(s->linesize * 48);
 for (i = 0; i < 2; i++)
 r->tmp_b_block_y[i] = r->tmp_b_block_base + i * 16 * 
s->linesize;
 for (i = 0; i < 4; i++)

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] Move x86inc.asm to libavutil/.

2011-08-12 Thread Ronald S. Bultje
Module: libav
Branch: master
Commit: 3a39195b1db5620901a049cd690752b1935f5e0f

Author:Ronald S. Bultje 
Committer: Ronald S. Bultje 
Date:  Sat Jul 23 18:36:35 2011 -0700

Move x86inc.asm to libavutil/.

This allows using it in libswscale/ also.

---

 libavcodec/x86/ac3dsp.asm|2 +-
 libavcodec/x86/dct32_sse.asm |2 +-
 libavcodec/x86/deinterlace.asm   |2 +-
 libavcodec/x86/dsputil_yasm.asm  |2 +-
 libavcodec/x86/dsputilenc_yasm.asm   |2 +-
 libavcodec/x86/fft_mmx.asm   |2 +-
 libavcodec/x86/fmtconvert.asm|2 +-
 libavcodec/x86/h264_chromamc.asm |2 +-
 libavcodec/x86/h264_chromamc_10bit.asm   |2 +-
 libavcodec/x86/h264_deblock.asm  |2 +-
 libavcodec/x86/h264_deblock_10bit.asm|2 +-
 libavcodec/x86/h264_idct.asm |2 +-
 libavcodec/x86/h264_idct_10bit.asm   |2 +-
 libavcodec/x86/h264_intrapred.asm|2 +-
 libavcodec/x86/h264_intrapred_10bit.asm  |2 +-
 libavcodec/x86/h264_qpel_10bit.asm   |2 +-
 libavcodec/x86/h264_weight.asm   |2 +-
 libavcodec/x86/h264_weight_10bit.asm |2 +-
 libavcodec/x86/vc1dsp_yasm.asm   |2 +-
 libavcodec/x86/vp3dsp.asm|2 +-
 libavcodec/x86/vp56dsp.asm   |2 +-
 libavcodec/x86/vp8dsp.asm|2 +-
 {libavcodec => libavutil}/x86/x86inc.asm |0
 23 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/libavcodec/x86/ac3dsp.asm b/libavcodec/x86/ac3dsp.asm
index c1b0906..44124c5 100644
--- a/libavcodec/x86/ac3dsp.asm
+++ b/libavcodec/x86/ac3dsp.asm
@@ -19,7 +19,7 @@
 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;**
 
-%include "x86inc.asm"
+%include "libavutil/x86/x86inc.asm"
 %include "x86util.asm"
 
 SECTION_RODATA
diff --git a/libavcodec/x86/dct32_sse.asm b/libavcodec/x86/dct32_sse.asm
index 720a061..4e938ad 100644
--- a/libavcodec/x86/dct32_sse.asm
+++ b/libavcodec/x86/dct32_sse.asm
@@ -19,7 +19,7 @@
 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;**
 
-%include "x86inc.asm"
+%include "libavutil/x86/x86inc.asm"
 %include "x86util.asm"
 
 SECTION_RODATA 32
diff --git a/libavcodec/x86/deinterlace.asm b/libavcodec/x86/deinterlace.asm
index 8613485..a782b2a 100644
--- a/libavcodec/x86/deinterlace.asm
+++ b/libavcodec/x86/deinterlace.asm
@@ -20,7 +20,7 @@
 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;**
 
-%include "x86inc.asm"
+%include "libavutil/x86/x86inc.asm"
 %include "x86util.asm"
 
 SECTION_RODATA
diff --git a/libavcodec/x86/dsputil_yasm.asm b/libavcodec/x86/dsputil_yasm.asm
index 4e1ec24..c75bd5c 100644
--- a/libavcodec/x86/dsputil_yasm.asm
+++ b/libavcodec/x86/dsputil_yasm.asm
@@ -19,7 +19,7 @@
 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;**
 
-%include "x86inc.asm"
+%include "libavutil/x86/x86inc.asm"
 
 SECTION_RODATA
 pb_f: times 16 db 15
diff --git a/libavcodec/x86/dsputilenc_yasm.asm 
b/libavcodec/x86/dsputilenc_yasm.asm
index 6063ff1..0945022 100644
--- a/libavcodec/x86/dsputilenc_yasm.asm
+++ b/libavcodec/x86/dsputilenc_yasm.asm
@@ -21,7 +21,7 @@
 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;*
 
-%include "x86inc.asm"
+%include "libavutil/x86/x86inc.asm"
 %include "x86util.asm"
 
 SECTION .text
diff --git a/libavcodec/x86/fft_mmx.asm b/libavcodec/x86/fft_mmx.asm
index 27276a1..2177a6b 100644
--- a/libavcodec/x86/fft_mmx.asm
+++ b/libavcodec/x86/fft_mmx.asm
@@ -28,7 +28,7 @@
 ; in blocks as conventient to the vector size.
 ; i.e. {4x real, 4x imaginary, 4x real, ...} (or 2x respectively)
 
-%include "x86inc.asm"
+%include "libavutil/x86/x86inc.asm"
 
 %ifdef ARCH_X86_64
 %define pointer resq
diff --git a/libavcodec/x86/fmtconvert.asm b/libavcodec/x86/fmtconvert.asm
index efab87d..a69b3ff 100644
--- a/libavcodec/x86/fmtconvert.asm
+++ b/libavcodec/x86/fmtconvert.asm
@@ -19,7 +19,7 @@
 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;**
 
-%include "x86inc.asm"
+%include "libavutil/x86/x86inc.asm"
 %include "x86util.asm"
 
 SECTION_TEXT
diff --git a/libavcodec/x86/h264_chromamc.asm b/libavcodec/x86/h264_chromamc.asm
index 16cf2ec..201dcd8 100644
--- a/libavcodec/x86/h264_chromamc.asm
+++ b/libavcodec/x86/h264_chromamc.asm
@@ -20,7 +20,7 @@
 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;**

[libav-commits] Move x86util.asm from libavcodec/ to libavutil/.

2011-08-12 Thread Ronald S. Bultje
Module: libav
Branch: master
Commit: b2c087871dafc7d030b2d48457ddff597dfd4925

Author:Ronald S. Bultje 
Committer: Ronald S. Bultje 
Date:  Wed Aug  3 09:48:08 2011 -0700

Move x86util.asm from libavcodec/ to libavutil/.

This allows using it in swscale also.

---

 libavcodec/x86/ac3dsp.asm |2 +-
 libavcodec/x86/dct32_sse.asm  |2 +-
 libavcodec/x86/deinterlace.asm|2 +-
 libavcodec/x86/dsputilenc_yasm.asm|2 +-
 libavcodec/x86/fmtconvert.asm |2 +-
 libavcodec/x86/h264_chromamc.asm  |2 +-
 libavcodec/x86/h264_chromamc_10bit.asm|2 +-
 libavcodec/x86/h264_deblock.asm   |2 +-
 libavcodec/x86/h264_deblock_10bit.asm |2 +-
 libavcodec/x86/h264_idct.asm  |2 +-
 libavcodec/x86/h264_idct_10bit.asm|2 +-
 libavcodec/x86/h264_intrapred.asm |2 +-
 libavcodec/x86/h264_intrapred_10bit.asm   |2 +-
 libavcodec/x86/h264_qpel_10bit.asm|2 +-
 libavcodec/x86/h264_weight_10bit.asm  |2 +-
 libavcodec/x86/vc1dsp_yasm.asm|2 +-
 libavcodec/x86/vp3dsp.asm |2 +-
 libavcodec/x86/vp56dsp.asm|2 +-
 libavcodec/x86/vp8dsp.asm |2 +-
 {libavcodec => libavutil}/x86/x86util.asm |0
 20 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/libavcodec/x86/ac3dsp.asm b/libavcodec/x86/ac3dsp.asm
index 44124c5..9e92678 100644
--- a/libavcodec/x86/ac3dsp.asm
+++ b/libavcodec/x86/ac3dsp.asm
@@ -20,7 +20,7 @@
 ;**
 
 %include "libavutil/x86/x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
 
 SECTION_RODATA
 
diff --git a/libavcodec/x86/dct32_sse.asm b/libavcodec/x86/dct32_sse.asm
index 4e938ad..f3eaf3a 100644
--- a/libavcodec/x86/dct32_sse.asm
+++ b/libavcodec/x86/dct32_sse.asm
@@ -20,7 +20,7 @@
 ;**
 
 %include "libavutil/x86/x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
 
 SECTION_RODATA 32
 
diff --git a/libavcodec/x86/deinterlace.asm b/libavcodec/x86/deinterlace.asm
index a782b2a..9150f45 100644
--- a/libavcodec/x86/deinterlace.asm
+++ b/libavcodec/x86/deinterlace.asm
@@ -21,7 +21,7 @@
 ;**
 
 %include "libavutil/x86/x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
 
 SECTION_RODATA
 
diff --git a/libavcodec/x86/dsputilenc_yasm.asm 
b/libavcodec/x86/dsputilenc_yasm.asm
index 0945022..a0531b0 100644
--- a/libavcodec/x86/dsputilenc_yasm.asm
+++ b/libavcodec/x86/dsputilenc_yasm.asm
@@ -22,7 +22,7 @@
 ;*
 
 %include "libavutil/x86/x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
 
 SECTION .text
 
diff --git a/libavcodec/x86/fmtconvert.asm b/libavcodec/x86/fmtconvert.asm
index a69b3ff..e384e8f 100644
--- a/libavcodec/x86/fmtconvert.asm
+++ b/libavcodec/x86/fmtconvert.asm
@@ -20,7 +20,7 @@
 ;**
 
 %include "libavutil/x86/x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
 
 SECTION_TEXT
 
diff --git a/libavcodec/x86/h264_chromamc.asm b/libavcodec/x86/h264_chromamc.asm
index 201dcd8..caef7dd 100644
--- a/libavcodec/x86/h264_chromamc.asm
+++ b/libavcodec/x86/h264_chromamc.asm
@@ -21,7 +21,7 @@
 ;**
 
 %include "libavutil/x86/x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
 
 SECTION_RODATA
 
diff --git a/libavcodec/x86/h264_chromamc_10bit.asm 
b/libavcodec/x86/h264_chromamc_10bit.asm
index af57484..56c0511 100644
--- a/libavcodec/x86/h264_chromamc_10bit.asm
+++ b/libavcodec/x86/h264_chromamc_10bit.asm
@@ -23,7 +23,7 @@
 ;**
 
 %include "libavutil/x86/x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
 
 SECTION_RODATA
 
diff --git a/libavcodec/x86/h264_deblock.asm b/libavcodec/x86/h264_deblock.asm
index ac25dca..1304e40 100644
--- a/libavcodec/x86/h264_deblock.asm
+++ b/libavcodec/x86/h264_deblock.asm
@@ -25,7 +25,7 @@
 ;**
 
 %include "libavutil/x86/x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
 
 SECTION .text
 
diff --git a/libavcodec/x86/h264_deblock_10bit.asm 
b/libavcodec/x86/h264_deblock_10bit.asm
index 0f52544..0a1809c 100644
--- a/libavcodec/x86/h264_deblock_10bit.asm
+++ b/libavcodec/x86/h264_deblock_10bit.asm
@@ -25,7 +25,7 @@
 ;**
 
 %include "libavutil/x86/x86inc.asm"
-%include "x86util.asm"
+%incl

[libav-commits] Add a news entry for the fftools rename.

2011-08-12 Thread Anton Khirnov
Module: libav.org
Branch: master
Commit: 1db580cc0c999bf1f40cff6b7d1d2f743482b595

Author:Anton Khirnov 
Committer: Anton Khirnov 
Date:  Tue Aug  9 15:13:02 2011 +0200

Add a news entry for the fftools rename.

---

 src/index |   75 +
 1 files changed, 75 insertions(+), 0 deletions(-)

diff --git a/src/index b/src/index
index 633ade7..fa88ee2 100644
--- a/src/index
+++ b/src/index
@@ -33,6 +33,81 @@ with the latest developments by subscribing to both the
 
 News
 
+August 09 2011
+
+
+For consistency with our new name we have renamed ffplay to
+avplay, ffserver to avserver and ffprobe to
+avprobe. Their behavior is the same, just the names were changed.
+
+
+
+With ffmpeg (the commandline tool) we decided to use this opportunity to
+fix some longstanding usability problems, which involves breaking 
compatibility.
+Therefore we have added a new tool named avconv which is based on
+ffmpeg, but has a different (hopefully more powerful and easier to use)
+syntax for some options.
+ffmpeg will be kept in its current state for some time, so no scripts or
+frontends using it will break. However it will not be developed further.
+
+
+
+Differences between avconv and ffmpeg are:
+
+In ffmpeg some options (like -newvideo/-newaudio/...) are
+irregular in the sense that they're specified after the output
+filename instead of before, like all other options. In avconv this
+irregularity is removed, all options apply to the next input or output
+file.
+-newvideo/-newaudio/-newsubtitle options were removed. Not only
+were they irregular and highly confusing, they were also redundant. In
+avconv the -map option will create new streams in the output
+file and map input streams to them. E.g. avconv -i INPUT -map 0
+OUTPUT will create an output stream for each stream in the first input
+file.
+The -map option now has slightly different and more powerful
+syntax:
+
+ Colons (':') are used to separate file index/stream type/stream
+index instead of dots. Comma (',') is used to separate the sync stream
+instead of colon.. This is done for consistency with other 
options.
+ It's possible to specify stream type. E.g. -map 0:a:2
+creates an output stream from the third input audio stream.
+ Omitting the stream index now maps all the streams of the given
+type, not just the first. E.g. -map 0:s creates output streams
+for all the subtitle streams in the first input file.
+ Since -map can now match multiple streams, negative mappings were
+introduced. Negative mappings disable some streams from an already
+defined map. E.g. '-map 0 -map -0:a:1' means 'create output streams for
+all the stream in the first input file, except for the second audio
+stream'.
+
+ -vcodec/-acodec/-scodec options are gone, replaced by -c
+(or -codec), which allows to precisely specify target stream(s)
+consistently with other options. E.g. -c:v lib264 sets the codec 
for all
+video streams, -c:a:0 libvorbis sets the codec for the first audio 
stream
+and -c copy copies all the streams without reencoding.
+ It is now possible to precisely specify which stream should an 
AVOption
+apply to. E.g. -b:v:0 2M sets the bitrate for the first video 
stream,
+while -b:a 128k sets the bitrate for all audio streams. Note that 
the
+old -ab 128k syntax is deprecated and will stop working soon.
+ -map_chapters now takes only an input file index and applies to
+the next output file. This is consistent with how all the other options
+work.
+ -map_metadata now takes only an input metadata specifier and
+applies to the next output file. Output metadata specifier is now part of
+the option name, similarly to the AVOptions/map/codec feature above.
+ Presets in avconv are disabled, because only libx264 used them
+and presets for libx264 can now be specified using a private option 
-preset
+presetname.
+
+
+
+
+Note that the avconv interface is not considered stable yet. More
+incompatible changes may come in the following weeks. We will announce here 
when
+avconv is stable.
+
 July 21 2011
 
 

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] avconv: get rid of new* options.

2011-08-12 Thread Anton Khirnov
Module: libav
Branch: master
Commit: 3d4f0dab79ccc8b1a662de440a789ec00b428963

Author:Anton Khirnov 
Committer: Anton Khirnov 
Date:  Fri Jul 29 08:36:13 2011 +0200

avconv: get rid of new* options.

They are confusing, irregular and redundant -- -map already contains all
the information.  Stream maps can now be parsed in opt_output_file().

Add a more user-friendly default behavior in case no maps are present.

Breaks -programid for now, but it never worked properly anyway. A better
solution will be written soon.

---

 avconv.c|  311 ++-
 doc/avconv.texi |   59 ---
 2 files changed, 125 insertions(+), 245 deletions(-)

diff --git a/avconv.c b/avconv.c
index 0db47a8..1407565 100644
--- a/avconv.c
+++ b/avconv.c
@@ -464,7 +464,6 @@ static int exit_program(int ret)
 av_free(vstats_filename);
 
 av_free(streamid_map);
-av_free(stream_maps);
 av_free(meta_data_maps);
 
 av_freep(&input_streams);
@@ -1946,8 +1945,7 @@ static void parse_forced_key_frames(char *kf, 
OutputStream *ost,
 static int transcode(AVFormatContext **output_files,
  int nb_output_files,
  InputFile *input_files,
- int nb_input_files,
- StreamMap *stream_maps, int nb_stream_maps)
+ int nb_input_files)
 {
 int ret = 0, i, j, k, n, nb_ostreams = 0;
 AVFormatContext *is, *os;
@@ -1975,32 +1973,6 @@ static int transcode(AVFormatContext **output_files,
 }
 nb_ostreams += os->nb_streams;
 }
-if (nb_stream_maps > 0 && nb_stream_maps != nb_ostreams) {
-fprintf(stderr, "Number of stream maps must match number of output 
streams\n");
-ret = AVERROR(EINVAL);
-goto fail;
-}
-
-/* Sanity check the mapping args -- do the input files & streams exist? */
-for(i=0;i nb_input_files - 1 ||
-si < 0 || si > input_files[fi].ctx->nb_streams - 1) {
-fprintf(stderr,"Could not find input stream #%d.%d\n", fi, si);
-ret = AVERROR(EINVAL);
-goto fail;
-}
-fi = stream_maps[i].sync_file_index;
-si = stream_maps[i].sync_stream_index;
-if (fi < 0 || fi > nb_input_files - 1 ||
-si < 0 || si > input_files[fi].ctx->nb_streams - 1) {
-fprintf(stderr,"Could not find sync stream #%d.%d\n", fi, si);
-ret = AVERROR(EINVAL);
-goto fail;
-}
-}
 
 ost_table = av_mallocz(sizeof(OutputStream *) * nb_ostreams);
 if (!ost_table)
@@ -2008,80 +1980,8 @@ static int transcode(AVFormatContext **output_files,
 n = 0;
 for(k=0;knb_streams;i++,n++) {
-int found;
-ost = ost_table[n] = output_streams_for_file[k][i];
-if (nb_stream_maps > 0) {
-ost->source_index = 
input_files[stream_maps[n].file_index].ist_index +
-stream_maps[n].stream_index;
-
-/* Sanity check that the stream types match */
-if (input_streams[ost->source_index].st->codec->codec_type != 
ost->st->codec->codec_type) {
-int i= ost->file_index;
-av_dump_format(output_files[i], i, 
output_files[i]->filename, 1);
-fprintf(stderr, "Codec type mismatch for mapping #%d.%d -> 
#%d.%d\n",
-stream_maps[n].file_index, stream_maps[n].stream_index,
-ost->file_index, ost->index);
-exit_program(1);
-}
-
-} else {
-int best_nb_frames=-1;
-/* get corresponding input stream index : we select the first 
one with the right type */
-found = 0;
-for (j = 0; j < nb_input_streams; j++) {
-int skip=0;
-ist = &input_streams[j];
-if(opt_programid){
-int pi,si;
-AVFormatContext *f = input_files[ist->file_index].ctx;
-skip=1;
-for(pi=0; pinb_programs; pi++){
-AVProgram *p= f->programs[pi];
-if(p->id == opt_programid)
-for(si=0; sinb_stream_indexes; si++){
-if(f->streams[ p->stream_index[si] ] == 
ist->st)
-skip=0;
-}
-}
-}
-if (ist->discard && ist->st->discard != AVDISCARD_ALL && 
!skip &&
-ist->st->codec->codec_type == 
ost->st->codec->codec_type) {
-if(best_nb_frames < ist->st->codec_info_nb_frames){
-best_nb_frames= ist->st->codec_info_nb_frames;
-ost->source_index = j;
-found = 1;
-

[libav-commits] cmdutils: allow precisely specifying a stream for AVOptions.

2011-08-12 Thread Anton Khirnov
Module: libav
Branch: master
Commit: d4863fc1a83ceab1d75469b406a2c67e5659b2a0

Author:Anton Khirnov 
Committer: Anton Khirnov 
Date:  Thu Jul 28 16:47:38 2011 +0200

cmdutils: allow precisely specifying a stream for AVOptions.

---

 avconv.c |8 +++--
 avplay.c |2 +-
 cmdutils.c   |   60 ++---
 cmdutils.h   |   16 ++-
 doc/fftools-common-opts.texi |   17 
 ffmpeg.c |4 +-
 6 files changed, 94 insertions(+), 13 deletions(-)

diff --git a/avconv.c b/avconv.c
index f5ca05a..0db47a8 100644
--- a/avconv.c
+++ b/avconv.c
@@ -674,8 +674,10 @@ static OutputStream *new_output_stream(AVFormatContext 
*oc, int file_idx, AVCode
 ost->index = idx;
 ost->st= st;
 ost->enc   = codec;
-if (codec)
-ost->opts  = filter_codec_opts(codec_opts, codec->id, 1);
+if (codec) {
+st->codec->codec_type = codec->type;
+ost->opts  = filter_codec_opts(codec_opts, codec->id, oc, st);
+}
 
 avcodec_get_context_defaults3(st->codec, codec);
 
@@ -3137,7 +3139,7 @@ static int opt_input_file(const char *opt, const char 
*filename)
 ist->st = st;
 ist->file_index = nb_input_files;
 ist->discard = 1;
-ist->opts = filter_codec_opts(codec_opts, ist->st->codec->codec_id, 0);
+ist->opts = filter_codec_opts(codec_opts, ist->st->codec->codec_id, 
ic, st);
 
 if (i < nb_ts_scale)
 ist->ts_scale = ts_scale[i];
diff --git a/avplay.c b/avplay.c
index f43cf6f..e9b58a8 100644
--- a/avplay.c
+++ b/avplay.c
@@ -2134,7 +2134,7 @@ static int stream_component_open(VideoState *is, int 
stream_index)
 return -1;
 avctx = ic->streams[stream_index]->codec;
 
-opts = filter_codec_opts(codec_opts, avctx->codec_id, 0);
+opts = filter_codec_opts(codec_opts, avctx->codec_id, ic, 
ic->streams[stream_index]);
 
 /* prepare audio output */
 if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
diff --git a/cmdutils.c b/cmdutils.c
index 1df2556..e00e902 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -289,7 +289,14 @@ unknown_opt:
 int opt_default(const char *opt, const char *arg)
 {
 const AVOption *o;
-if ((o = av_opt_find(avcodec_opts[0], opt, NULL, 0, 
AV_OPT_SEARCH_CHILDREN)) ||
+char opt_stripped[128];
+const char *p;
+
+if (!(p = strchr(opt, ':')))
+p = opt + strlen(opt);
+av_strlcpy(opt_stripped, opt, FFMIN(sizeof(opt_stripped), p - opt + 1));
+
+if ((o = av_opt_find(avcodec_opts[0], opt_stripped, NULL, 0, 
AV_OPT_SEARCH_CHILDREN)) ||
  ((opt[0] == 'v' || opt[0] == 'a' || opt[0] == 's') &&
   (o = av_opt_find(avcodec_opts[0], opt+1, NULL, 0, 0
 av_dict_set(&codec_opts, opt, arg, FLAGS);
@@ -782,12 +789,42 @@ FILE *get_preset_file(char *filename, size_t 
filename_size,
 return f;
 }
 
-AVDictionary *filter_codec_opts(AVDictionary *opts, enum CodecID codec_id, int 
encoder)
+int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
+{
+if (*spec <= '9' && *spec >= '0')
/* opt:index */
+return strtol(spec, NULL, 0) == st->index;
+else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd') { 
/* opt:[vasd] */
+enum AVMediaType type;
+
+switch (*spec++) {
+case 'v': type = AVMEDIA_TYPE_VIDEO;break;
+case 'a': type = AVMEDIA_TYPE_AUDIO;break;
+case 's': type = AVMEDIA_TYPE_SUBTITLE; break;
+case 'd': type = AVMEDIA_TYPE_DATA; break;
+}
+if (type != st->codec->codec_type)
+return 0;
+if (*spec++ == ':') {   /* possibly 
followed by :index */
+int i, index = strtol(spec, NULL, 0);
+for (i = 0; i < s->nb_streams; i++)
+if (s->streams[i]->codec->codec_type == type && index-- == 0)
+   return i == st->index;
+return 0;
+}
+return 1;
+} else if (!*spec) /* empty specifier, matches everything */
+return 1;
+
+av_log(s, AV_LOG_ERROR, "Invalid stream specifier: %s.\n", spec);
+return AVERROR(EINVAL);
+}
+
+AVDictionary *filter_codec_opts(AVDictionary *opts, enum CodecID codec_id, 
AVFormatContext *s, AVStream *st)
 {
 AVDictionary*ret = NULL;
 AVDictionaryEntry *t = NULL;
-AVCodec   *codec = encoder ? avcodec_find_encoder(codec_id) : 
avcodec_find_decoder(codec_id);
-intflags = encoder ? AV_OPT_FLAG_ENCODING_PARAM : 
AV_OPT_FLAG_DECODING_PARAM;
+AVCodec   *codec = s->oformat ? avcodec_find_encoder(codec_id) : 
avcodec_find_decoder(codec_id);
+intflags = s->oformat ? AV_OPT_FLAG_ENCODING_PARAM : 
AV_OPT_FLAG_DECODING_PARAM;
 char  prefix = 0;
 
 if (!codec)
@@ -800,11 +837,24 @@ AVDictionary *filter_codec_opts(AVDictionary *opts, en

[libav-commits] APIchanges: note error_recognition in lavf

2011-08-12 Thread Dustin Brody
Module: libav
Branch: master
Commit: e3a70c7c5ff589ff6ce70fa0a29dc220f95dff17

Author:Dustin Brody 
Committer: Anton Khirnov 
Date:  Sat Aug  6 01:42:35 2011 -0400

APIchanges: note error_recognition in lavf

Signed-off-by: Anton Khirnov 

---

 doc/APIchanges |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 09a12fe..ac95d16 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil:   2011-04-18
 
 API changes, most recent first:
 
+2011-08-06 - 2f63440 - lavf 53.4.0
+  Add error_recognition to AVFormatContext.
+
 2011-08-02 - 9d39cbf - lavc 53.7.1
   Add AV_PKT_FLAG_CORRUPT AVPacket flag.
 

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] lavf: add support for error_recognition, use it in avidec, and bump minor API version

2011-08-12 Thread Dustin Brody
Module: libav
Branch: master
Commit: 2f63440c59bf8c4a2e90280e23e8cadb235a42e6

Author:Dustin Brody 
Committer: Anton Khirnov 
Date:  Sat Aug  6 04:42:34 2011 +

lavf: add support for error_recognition, use it in avidec, and bump minor API 
version

Signed-off-by: Anton Khirnov 

---

 libavformat/avformat.h |8 
 libavformat/avidec.c   |6 --
 libavformat/options.c  |3 +++
 libavformat/version.h  |2 +-
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 2f68aba..957039f 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -854,6 +854,14 @@ typedef struct AVFormatContext {
  * decoding: number of frames used to probe fps
  */
 int fps_probe_size;
+
+/**
+ * Error recognition; higher values will detect more errors but may
+ * misdetect some more or less valid parts as errors.
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+int error_recognition;
 } AVFormatContext;
 
 typedef struct AVPacketList {
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 0ea093c..8c0ef13 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -667,8 +667,9 @@ static int avi_read_header(AVFormatContext *s, 
AVFormatParameters *ap)
 break;
 case MKTAG('i', 'n', 'd', 'x'):
 i= avio_tell(pb);
-if(pb->seekable && !(s->flags & AVFMT_FLAG_IGNIDX)){
-read_braindead_odml_indx(s, 0);
+if(pb->seekable && !(s->flags & AVFMT_FLAG_IGNIDX) &&
+   read_braindead_odml_indx(s, 0) < 0 && s->error_recognition >= 
FF_ER_EXPLODE){
+goto fail;
 }
 avio_seek(pb, i+size, SEEK_SET);
 break;
@@ -706,6 +707,7 @@ static int avi_read_header(AVFormatContext *s, 
AVFormatParameters *ap)
 if(size > 100){
 av_log(s, AV_LOG_ERROR, "Something went wrong during header 
parsing, "
 "I will ignore it and try to continue 
anyway.\n");
+if (s->error_recognition >= FF_ER_EXPLODE) goto fail;
 avi->movi_list = avio_tell(pb) - 4;
 avi->movi_end  = avio_size(pb);
 goto end_of_header;
diff --git a/libavformat/options.c b/libavformat/options.c
index 9611628..3ca8c83 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -87,6 +87,9 @@ static const AVOption options[]={
 {"fdebug", "print specific debug info", OFFSET(debug), FF_OPT_TYPE_FLAGS, 
{.dbl = DEFAULT }, 0, INT_MAX, E|D, "fdebug"},
 {"ts", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_FDEBUG_TS }, INT_MIN, INT_MAX, 
E|D, "fdebug"},
 {"max_delay", "maximum muxing or demuxing delay in microseconds", 
OFFSET(max_delay), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, E|D},
+{"fer", "set error detection aggressivity", OFFSET(error_recognition), 
FF_OPT_TYPE_INT, {.dbl = FF_ER_CAREFUL }, INT_MIN, INT_MAX, D, "fer"},
+{"careful", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_CAREFUL }, INT_MIN, 
INT_MAX, D, "fer"},
+{"explode", "abort decoding on error recognition", 0, FF_OPT_TYPE_CONST, {.dbl 
= FF_ER_EXPLODE }, INT_MIN, INT_MAX, D, "fer"},
 {"fpsprobesize", "number of frames used to probe fps", OFFSET(fps_probe_size), 
FF_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX-1, D},
 {NULL},
 };
diff --git a/libavformat/version.h b/libavformat/version.h
index bb12b51..4473717 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -24,7 +24,7 @@
 #include "libavutil/avutil.h"
 
 #define LIBAVFORMAT_VERSION_MAJOR 53
-#define LIBAVFORMAT_VERSION_MINOR  3
+#define LIBAVFORMAT_VERSION_MINOR  4
 #define LIBAVFORMAT_VERSION_MICRO  0
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] avconv: change semantics of -map

2011-08-12 Thread Anton Khirnov
Module: libav
Branch: master
Commit: 8d2e4a7e687b7fdbb939e236399cf774dc7bead6

Author:Anton Khirnov 
Committer: Anton Khirnov 
Date:  Fri Jul 29 15:21:51 2011 +0200

avconv: change semantics of -map

New syntax contains an optional stream type, allowing to refer to n-th
stream of specific type.

Omitting stream number now maps all streams of the given type.

---

 avconv.c|  106 +++
 doc/avconv.texi |   47 +++--
 2 files changed, 111 insertions(+), 42 deletions(-)

diff --git a/avconv.c b/avconv.c
index 1407565..877079c 100644
--- a/avconv.c
+++ b/avconv.c
@@ -79,6 +79,7 @@ const int program_birth_year = 2000;
 
 /* select an input stream for an output stream */
 typedef struct StreamMap {
+int disabled;   /** 1 is this mapping is disabled by a negative 
map */
 int file_index;
 int stream_index;
 int sync_file_index;
@@ -2780,27 +2781,82 @@ static int opt_codec_tag(const char *opt, const char 
*arg)
 
 static int opt_map(const char *opt, const char *arg)
 {
-StreamMap *m;
-char *p;
+StreamMap *m = NULL;
+int i, negative = 0, file_idx;
+int sync_file_idx = -1, sync_stream_idx;
+char *p, *sync;
+char *map;
+
+if (*arg == '-') {
+negative = 1;
+arg++;
+}
+map = av_strdup(arg);
+
+/* parse sync stream first, just pick first matching stream */
+if (sync = strchr(map, ',')) {
+*sync = 0;
+sync_file_idx = strtol(sync + 1, &sync, 0);
+if (sync_file_idx >= nb_input_files || sync_file_idx < 0) {
+av_log(NULL, AV_LOG_ERROR, "Invalid sync file index: %d.\n", 
sync_file_idx);
+exit_program(1);
+}
+if (*sync)
+sync++;
+for (i = 0; i < input_files[sync_file_idx].ctx->nb_streams; i++)
+if (check_stream_specifier(input_files[sync_file_idx].ctx,
+   
input_files[sync_file_idx].ctx->streams[i], sync) == 1) {
+sync_stream_idx = i;
+break;
+}
+if (i == input_files[sync_file_idx].ctx->nb_streams) {
+av_log(NULL, AV_LOG_ERROR, "Sync stream specification in map %s 
does not "
+   "match any streams.\n", arg);
+exit_program(1);
+}
+}
 
-stream_maps = grow_array(stream_maps, sizeof(*stream_maps), 
&nb_stream_maps, nb_stream_maps + 1);
-m = &stream_maps[nb_stream_maps-1];
 
-m->file_index = strtol(arg, &p, 0);
-if (*p)
-p++;
+file_idx = strtol(map, &p, 0);
+if (file_idx >= nb_input_files || file_idx < 0) {
+av_log(NULL, AV_LOG_ERROR, "Invalid input file index: %d.\n", 
file_idx);
+exit_program(1);
+}
+if (negative)
+/* disable some already defined maps */
+for (i = 0; i < nb_stream_maps; i++) {
+m = &stream_maps[i];
+if (check_stream_specifier(input_files[m->file_index].ctx,
+   
input_files[m->file_index].ctx->streams[m->stream_index],
+   *p == ':' ? p + 1 : p) > 0)
+m->disabled = 1;
+}
+else
+for (i = 0; i < input_files[file_idx].ctx->nb_streams; i++) {
+if (check_stream_specifier(input_files[file_idx].ctx, 
input_files[file_idx].ctx->streams[i],
+*p == ':' ? p + 1 : p) <= 0)
+continue;
+stream_maps = grow_array(stream_maps, sizeof(*stream_maps), 
&nb_stream_maps, nb_stream_maps + 1);
+m = &stream_maps[nb_stream_maps - 1];
 
-m->stream_index = strtol(p, &p, 0);
-if (*p) {
-p++;
-m->sync_file_index = strtol(p, &p, 0);
-if (*p)
-p++;
-m->sync_stream_index = strtol(p, &p, 0);
-} else {
-m->sync_file_index = m->file_index;
-m->sync_stream_index = m->stream_index;
+m->file_index   = file_idx;
+m->stream_index = i;
+
+if (sync_file_idx >= 0) {
+m->sync_file_index   = sync_file_idx;
+m->sync_stream_index = sync_stream_idx;
+} else {
+m->sync_file_index   = file_idx;
+m->sync_stream_index = i;
+}
+}
+
+if (!m) {
+av_log(NULL, AV_LOG_ERROR, "Stream map '%s' matches no streams.\n", 
arg);
+exit_program(1);
 }
+
+av_freep(&map);
 return 0;
 }
 
@@ -3514,21 +3570,9 @@ static void opt_output_file(const char *filename)
 } else {
 for (i = 0; i < nb_stream_maps; i++) {
 StreamMap *map = &stream_maps[i];
-int fi = map->file_index;
-int si = map->stream_index;
 
-if (fi < 0 || fi >= nb_input_files ||
-si < 0 || si >= input_files[fi].ctx->nb_streams) {
-av_log(NULL, AV_LOG_ERROR, "Input stream #%d.%d does not 

[libav-commits] libx264: Include hint for possible values for configuring libx264

2011-08-12 Thread Reinhard Tartler
Module: libav
Branch: master
Commit: 69c4bee8fa56e5da7fc30198c7c1352c6c4a55c0

Author:Reinhard Tartler 
Committer: Reinhard Tartler 
Date:  Tue Aug  9 14:44:12 2011 +0200

libx264: Include hint for possible values for configuring libx264

The output of the x264 commandline tool contains the most uptodate
description of the possible values for the -preset, -tune and -profile
options.

---

 libavcodec/libx264.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index bcf8b1f..fea67f1 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -362,10 +362,10 @@ static av_cold int X264_init(AVCodecContext *avctx)
 #define OFFSET(x) offsetof(X264Context, x)
 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
-{ "preset","Set the encoding preset",
OFFSET(preset),FF_OPT_TYPE_STRING, { 0 }, 0, 0, VE},
-{ "tune",  "Tune the encoding params",   
OFFSET(tune),  FF_OPT_TYPE_STRING, { 0 }, 0, 0, VE},
-{ "profile",   "Set profile restrictions",   
OFFSET(profile),   FF_OPT_TYPE_STRING, { 0 }, 0, 0, VE},
-{ "fastfirstpass", "Use fast settings when encoding first pass", 
OFFSET(fastfirstpass), FF_OPT_TYPE_INT,{ 1 }, 0, 1, VE},
+{ "preset","Set the encoding preset (cf. x264 --fullhelp)",   
OFFSET(preset),FF_OPT_TYPE_STRING, { 0 }, 0, 0, VE},
+{ "tune",  "Tune the encoding params (cf. x264 --fullhelp)",  
OFFSET(tune),  FF_OPT_TYPE_STRING, { 0 }, 0, 0, VE},
+{ "profile",   "Set profile restrictions (cf. x264 --fullhelp) ", 
OFFSET(profile),   FF_OPT_TYPE_STRING, { 0 }, 0, 0, VE},
+{ "fastfirstpass", "Use fast settings when encoding first pass",  
OFFSET(fastfirstpass), FF_OPT_TYPE_INT,{ 1 }, 0, 1, VE},
 { NULL },
 };
 

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] configure: add missing CFLAGS to fix building on the HURD

2011-08-12 Thread Pino Toscano
Module: libav
Branch: master
Commit: f60d13663742d1c695680ede83c4d646bc57d380

Author:Pino Toscano 
Committer: Reinhard Tartler 
Date:  Fri Aug 12 14:11:21 2011 +0200

configure: add missing CFLAGS to fix building on the HURD

Signed-off-by: Reinhard Tartler 
Signed-off-by: Luca Barbato 

---

 configure |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index 65839df..9c6ce0a 100755
--- a/configure
+++ b/configure
@@ -2498,6 +2498,7 @@ case $target_os in
 add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
 ;;
 gnu)
+add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
 ;;
 qnx)
 add_cppflags -D_QNX_SOURCE

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] cmdutils: allow ':'-separated modifiers in option names.

2011-08-12 Thread Anton Khirnov
Module: libav
Branch: master
Commit: d70e51225062239c250ab6bc935b9711cf97c615

Author:Anton Khirnov 
Committer: Anton Khirnov 
Date:  Fri Jul 29 13:47:37 2011 +0200

cmdutils: allow ':'-separated modifiers in option names.

---

 cmdutils.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/cmdutils.c b/cmdutils.c
index d3fdae7..1df2556 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -141,8 +141,11 @@ void show_help_options(const OptionDef *options, const 
char *msg, int mask, int
 }
 
 static const OptionDef* find_option(const OptionDef *po, const char *name){
+const char *p = strchr(name, ':');
+int len = p ? p - name : strlen(name);
+
 while (po->name != NULL) {
-if (!strcmp(name, po->name))
+if (!strncmp(name, po->name, len) && strlen(po->name) == len)
 break;
 po++;
 }

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] avconv: make -map_metadata work consistently with the other options

2011-08-12 Thread Anton Khirnov
Module: libav
Branch: master
Commit: e6e6060c9be60f5eb6c94556ca4c92f76cba0d1f

Author:Anton Khirnov 
Committer: Anton Khirnov 
Date:  Fri Jul 29 13:07:27 2011 +0200

avconv: make -map_metadata work consistently with the other options

Before, it took an input and output file index, now it only takes an
input file and applies to the next output file.

Stream/chapter/program specification is now part of the option name and
the delimiter was changed from ',' to ':' to be consistent with the
similar feature for AVOptions.

---

 avconv.c|  145 ---
 doc/avconv.texi |   14 +++---
 2 files changed, 80 insertions(+), 79 deletions(-)

diff --git a/avconv.c b/avconv.c
index b72b26d..f5ca05a 100644
--- a/avconv.c
+++ b/avconv.c
@@ -2091,10 +2091,6 @@ static int transcode(AVFormatContext **output_files,
 codec = ost->st->codec;
 icodec = ist->st->codec;
 
-if (metadata_streams_autocopy)
-av_dict_copy(&ost->st->metadata, ist->st->metadata,
- AV_DICT_DONT_OVERWRITE);
-
 ost->st->disposition = ist->st->disposition;
 codec->bits_per_raw_sample= icodec->bits_per_raw_sample;
 codec->chroma_sample_location = icodec->chroma_sample_location;
@@ -2399,63 +2395,6 @@ static int transcode(AVFormatContext **output_files,
 ist->is_start = 1;
 }
 
-/* set meta data information from input file if required */
-for (i=0;i= (nb_elems)) {\
-snprintf(error, sizeof(error), "Invalid %s index %d while 
processing metadata maps\n",\
- (desc), (index));\
-ret = AVERROR(EINVAL);\
-goto dump_format;\
-}
-
-int out_file_index = meta_data_maps[i][0].file;
-int in_file_index = meta_data_maps[i][1].file;
-if (in_file_index < 0 || out_file_index < 0)
-continue;
-METADATA_CHECK_INDEX(out_file_index, nb_output_files, "output file")
-METADATA_CHECK_INDEX(in_file_index, nb_input_files, "input file")
-
-files[0] = output_files[out_file_index];
-files[1] = input_files[in_file_index].ctx;
-
-for (j = 0; j < 2; j++) {
-MetadataMap *map = &meta_data_maps[i][j];
-
-switch (map->type) {
-case 'g':
-meta[j] = &files[j]->metadata;
-break;
-case 's':
-METADATA_CHECK_INDEX(map->index, files[j]->nb_streams, 
"stream")
-meta[j] = &files[j]->streams[map->index]->metadata;
-break;
-case 'c':
-METADATA_CHECK_INDEX(map->index, files[j]->nb_chapters, 
"chapter")
-meta[j] = &files[j]->chapters[map->index]->metadata;
-break;
-case 'p':
-METADATA_CHECK_INDEX(map->index, files[j]->nb_programs, 
"program")
-meta[j] = &files[j]->programs[map->index]->metadata;
-break;
-}
-}
-
-av_dict_copy(meta[0], *meta[1], AV_DICT_DONT_OVERWRITE);
-}
-
-/* copy global metadata by default */
-if (metadata_global_autocopy) {
-
-for (i = 0; i < nb_output_files; i++)
-av_dict_copy(&output_files[i]->metadata, 
input_files[0].ctx->metadata,
- AV_DICT_DONT_OVERWRITE);
-}
-
 /* open files and write file headers */
 for(i=0;ifile = strtol(arg, &p, 0);
-parse_meta_type(p, &m->type, &m->index, &p);
-if (*p)
-p++;
+parse_meta_type(p, &m->type, &m->index);
 
-m1 = &meta_data_maps[nb_meta_data_maps - 1][1];
-m1->file = strtol(p, &p, 0);
-parse_meta_type(p, &m1->type, &m1->index, &p);
+m1 = &meta_data_maps[nb_meta_data_maps - 1][0];
+if (p = strchr(opt, ':'))
+parse_meta_type(p, &m1->type, &m1->index);
+else
+m1->type = 'g';
 
 if (m->type == 'g' || m1->type == 'g')
 metadata_global_autocopy = 0;
@@ -3777,6 +3716,62 @@ static void opt_output_file(const char *filename)
 if (chapters_input_file >= 0)
 copy_chapters(chapters_input_file, nb_output_files - 1);
 
+/* copy metadata */
+for (i = 0; i < nb_meta_data_maps; i++) {
+AVFormatContext *files[2];
+AVDictionary**meta[2];
+int j;
+
+#define METADATA_CHECK_INDEX(index, nb_elems, desc)\
+if ((index) < 0 || (index) >= (nb_elems)) {\
+av_log(NULL, AV_LOG_ERROR, "Invalid %s index %d while processing 
metadata maps\n",\
+ (desc), (index));\
+exit_program(1);\
+}
+
+int in_file_index = meta_data_maps[i][1].file;
+if (in_file_index < 0)
+continue;
+METADATA_CHECK_INDEX(in_file_index, nb_input_files, "input file")
+
+files[0] = oc;
+files[1] = input_files[in_file_index].ctx;
+
+for (j = 0; j < 2; j++) {
+MetadataMap *map = &meta_data_maps[i][j];
+
+switch (map->type

[libav-commits] avconv: remove deprecated options.

2011-08-12 Thread Anton Khirnov
Module: libav
Branch: master
Commit: c9065c29176bade732745425029116b0548a959c

Author:Anton Khirnov 
Committer: Anton Khirnov 
Date:  Thu Jul 28 12:57:24 2011 +0200

avconv: remove deprecated options.

---

 avconv.c|   52 
 doc/avconv.texi |   15 ---
 2 files changed, 0 insertions(+), 67 deletions(-)

diff --git a/avconv.c b/avconv.c
index 9a47ed7..b72b26d 100644
--- a/avconv.c
+++ b/avconv.c
@@ -143,8 +143,6 @@ static int do_deinterlace = 0;
 static int top_field_first = -1;
 static int me_threshold = 0;
 static int intra_dc_precision = 8;
-static int loop_input = 0;
-static int loop_output = AVFMT_NOOUTPUTLOOP;
 static int qp_hist = 0;
 #if CONFIG_AVFILTER
 static char *vfilters = NULL;
@@ -2889,20 +2887,6 @@ static int opt_audio_channels(const char *opt, const 
char *arg)
 return 0;
 }
 
-static int opt_video_channel(const char *opt, const char *arg)
-{
-av_log(NULL, AV_LOG_WARNING, "This option is deprecated, use -channel.\n");
-opt_default("channel", arg);
-return 0;
-}
-
-static int opt_video_standard(const char *opt, const char *arg)
-{
-av_log(NULL, AV_LOG_WARNING, "This option is deprecated, use 
-standard.\n");
-opt_default("standard", arg);
-return 0;
-}
-
 static int opt_codec(int *pstream_copy, char **pcodec_name,
   int codec_type, const char *arg)
 {
@@ -3028,13 +3012,6 @@ static int opt_map_metadata(const char *opt, const char 
*arg)
 return 0;
 }
 
-static int opt_map_meta_data(const char *opt, const char *arg)
-{
-fprintf(stderr, "-map_meta_data is deprecated and will be removed soon. "
-"Use -map_metadata instead.\n");
-return opt_map_metadata(opt, arg);
-}
-
 static int opt_input_ts_scale(const char *opt, const char *arg)
 {
 unsigned int stream;
@@ -3063,19 +3040,6 @@ static int opt_start_time(const char *opt, const char 
*arg)
 return 0;
 }
 
-static int opt_recording_timestamp(const char *opt, const char *arg)
-{
-char buf[128];
-int64_t recording_timestamp = parse_time_or_die(opt, arg, 0) / 1E6;
-struct tm time = *gmtime((time_t*)&recording_timestamp);
-strftime(buf, sizeof(buf), "creation_time=%FT%T%z", &time);
-opt_metadata("metadata", buf);
-
-av_log(NULL, AV_LOG_WARNING, "%s is deprecated, set the 'creation_time' 
metadata "
- "tag instead.\n", opt);
-return 0;
-}
-
 static int opt_input_ts_offset(const char *opt, const char *arg)
 {
 input_ts_offset = parse_time_or_die(opt, arg, 1);
@@ -3192,11 +3156,6 @@ static int opt_input_file(const char *opt, const char 
*filename)
 opt_programid=0;
 }
 
-if (loop_input) {
-av_log(NULL, AV_LOG_WARNING, "-loop_input is deprecated, use -loop 
1\n");
-ic->loop_input = loop_input;
-}
-
 /* Set AVCodecContext options for avformat_find_stream_info */
 opts = setup_find_stream_info_opts(ic, codec_opts);
 orig_nb_streams = ic->nb_streams;
@@ -3797,10 +3756,6 @@ static void opt_output_file(const char *filename)
 
 oc->preload= (int)(mux_preload*AV_TIME_BASE);
 oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE);
-if (loop_output >= 0) {
-av_log(NULL, AV_LOG_WARNING, "-loop_output is deprecated, use 
-loop\n");
-oc->loop_output = loop_output;
-}
 oc->flags |= AVFMT_FLAG_NONBLOCK;
 
 /* copy chapters */
@@ -4212,8 +4167,6 @@ static const OptionDef options[] = {
 { "i", HAS_ARG, {(void*)opt_input_file}, "input file name", "filename" },
 { "y", OPT_BOOL, {(void*)&file_overwrite}, "overwrite output files" },
 { "map", HAS_ARG | OPT_EXPERT, {(void*)opt_map}, "set input stream 
mapping", "file.stream[:syncfile.syncstream]" },
-{ "map_meta_data", HAS_ARG | OPT_EXPERT, {(void*)opt_map_meta_data}, 
"DEPRECATED set meta data information of outfile from infile",
-  "outfile[,metadata]:infile[,metadata]" },
 { "map_metadata", HAS_ARG | OPT_EXPERT, {(void*)opt_map_metadata}, "set 
metadata information of outfile from infile",
   "outfile[,metadata]:infile[,metadata]" },
 { "map_chapters",  OPT_INT | HAS_ARG | OPT_EXPERT, 
{(void*)&chapters_input_file},  "set chapters mapping", "input_file_index" },
@@ -4222,7 +4175,6 @@ static const OptionDef options[] = {
 { "ss", HAS_ARG, {(void*)opt_start_time}, "set the start time offset", 
"time_off" },
 { "itsoffset", HAS_ARG, {(void*)opt_input_ts_offset}, "set the input ts 
offset", "time_off" },
 { "itsscale", HAS_ARG, {(void*)opt_input_ts_scale}, "set the input ts 
scale", "stream:scale" },
-{ "timestamp", HAS_ARG, {(void*)opt_recording_timestamp}, "set the 
recording timestamp ('now' to set the current time)", "time" },
 { "metadata", HAS_ARG, {(void*)opt_metadata}, "add metadata", 
"string=string" },
 { "dframes", OPT_INT | HAS_ARG, {(void*)&max_frames[AVMEDIA_TYPE_DATA]}, 
"set the number of data frames to record", "number" },
 { "benchmark", OPT

[libav-commits] avconv: make -map_chapters accept only the input file index.

2011-08-12 Thread Anton Khirnov
Module: libav
Branch: master
Commit: b9aac90bd875c5cb6f42fcb53e3a8fde3f315a7e

Author:Anton Khirnov 
Committer: Anton Khirnov 
Date:  Wed Jul 27 21:39:12 2011 +0200

avconv: make -map_chapters accept only the input file index.

This is consistent with how all the other options work.

---

 avconv.c|   80 ---
 doc/avconv.texi |9 +++---
 2 files changed, 28 insertions(+), 61 deletions(-)

diff --git a/avconv.c b/avconv.c
index 956de7b..9a47ed7 100644
--- a/avconv.c
+++ b/avconv.c
@@ -94,11 +94,6 @@ typedef struct MetadataMap {
 int  index; //< stream/chapter/program number
 } MetadataMap;
 
-typedef struct ChapterMap {
-int in_file;
-int out_file;
-} ChapterMap;
-
 static const OptionDef options[];
 
 #define MAX_FILES 100
@@ -121,8 +116,7 @@ static int metadata_global_autocopy   = 1;
 static int metadata_streams_autocopy  = 1;
 static int metadata_chapters_autocopy = 1;
 
-static ChapterMap *chapter_maps = NULL;
-static int nb_chapter_maps;
+static int chapters_input_file = INT_MAX;
 
 /* indexed by output file stream index */
 static int *streamid_map = NULL;
@@ -2464,38 +2458,6 @@ static int transcode(AVFormatContext **output_files,
  AV_DICT_DONT_OVERWRITE);
 }
 
-/* copy chapters according to chapter maps */
-for (i = 0; i < nb_chapter_maps; i++) {
-int infile  = chapter_maps[i].in_file;
-int outfile = chapter_maps[i].out_file;
-
-if (infile < 0 || outfile < 0)
-continue;
-if (infile >= nb_input_files) {
-snprintf(error, sizeof(error), "Invalid input file index %d in 
chapter mapping.\n", infile);
-ret = AVERROR(EINVAL);
-goto dump_format;
-}
-if (outfile >= nb_output_files) {
-snprintf(error, sizeof(error), "Invalid output file index %d in 
chapter mapping.\n",outfile);
-ret = AVERROR(EINVAL);
-goto dump_format;
-}
-copy_chapters(infile, outfile);
-}
-
-/* copy chapters from the first input file that has them*/
-if (!nb_chapter_maps)
-for (i = 0; i < nb_input_files; i++) {
-if (!input_files[i].ctx->nb_chapters)
-continue;
-
-for (j = 0; j < nb_output_files; j++)
-if ((ret = copy_chapters(i, j)) < 0)
-goto dump_format;
-break;
-}
-
 /* open files and write file headers */
 for(i=0;iout_file = strtol(arg, &p, 0);
-if (*p)
-p++;
-
-c->in_file = strtol(p, &p, 0);
-return 0;
-}
-
 static int opt_input_ts_scale(const char *opt, const char *arg)
 {
 unsigned int stream;
@@ -3732,7 +3678,7 @@ static int opt_streamid(const char *opt, const char *arg)
 static void opt_output_file(const char *filename)
 {
 AVFormatContext *oc;
-int err, use_video, use_audio, use_subtitle, use_data;
+int i, err, use_video, use_audio, use_subtitle, use_data;
 int input_has_video, input_has_audio, input_has_subtitle, input_has_data;
 AVOutputFormat *file_oformat;
 
@@ -3857,12 +3803,32 @@ static void opt_output_file(const char *filename)
 }
 oc->flags |= AVFMT_FLAG_NONBLOCK;
 
+/* copy chapters */
+if (chapters_input_file >= nb_input_files) {
+if (chapters_input_file == INT_MAX) {
+/* copy chapters from the first input file that has them*/
+chapters_input_file = -1;
+for (i = 0; i < nb_input_files; i++)
+if (input_files[i].ctx->nb_chapters) {
+chapters_input_file = i;
+break;
+}
+} else {
+av_log(NULL, AV_LOG_ERROR, "Invalid input file index %d in chapter 
mapping.\n",
+   chapters_input_file);
+exit_program(1);
+}
+}
+if (chapters_input_file >= 0)
+copy_chapters(chapters_input_file, nb_output_files - 1);
+
 frame_rate= (AVRational){0, 0};
 frame_width   = 0;
 frame_height  = 0;
 audio_sample_rate = 0;
 audio_channels= 0;
 audio_sample_fmt  = AV_SAMPLE_FMT_NONE;
+chapters_input_file = INT_MAX;
 
 av_freep(&forced_key_frames);
 uninit_opts();
@@ -4250,7 +4216,7 @@ static const OptionDef options[] = {
   "outfile[,metadata]:infile[,metadata]" },
 { "map_metadata", HAS_ARG | OPT_EXPERT, {(void*)opt_map_metadata}, "set 
metadata information of outfile from infile",
   "outfile[,metadata]:infile[,metadata]" },
-{ "map_chapters",  HAS_ARG | OPT_EXPERT, {(void*)opt_map_chapters},  "set 
chapters mapping", "outfile:infile" },
+{ "map_chapters",  OPT_INT | HAS_ARG | OPT_EXPERT, 
{(void*)&chapters_input_file},  "set chapters mapping", "input_file_index" },
 { "t", HAS_ARG, {(void*)opt_recording_time}, "record or transcode 
\"duration\" seconds of audio/video", "duration" },
 { "fs", HAS_ARG | OPT_INT64, {(void*)&limit_filesize}, "set the li

[libav-commits] ffmpeg: add a warning stating that the program is deprecated.

2011-08-12 Thread Anton Khirnov
Module: libav
Branch: master
Commit: 791a86c37a03b94207bc2d0ad4cbe7f39d7e495a

Author:Anton Khirnov 
Committer: Anton Khirnov 
Date:  Wed Jul 27 21:04:26 2011 +0200

ffmpeg: add a warning stating that the program is deprecated.

---

 ffmpeg.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index c155a73..1a6ba51 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -4394,6 +4394,10 @@ int main(int argc, char **argv)
 
 show_banner();
 
+av_log(NULL, AV_LOG_WARNING, "This program is not developed anymore and is 
only "
+ "provided for compatibility. Use avconv 
instead "
+ "(see Changelog for the list of incompatible 
changes).\n");
+
 /* parse options */
 parse_options(argc, argv, options, opt_output_file);
 

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits