Re: [libav-devel] [PATCH 3/3] Use parsers for RealVideo 3/4 to determine correct PTS

2011-08-16 Thread Kostya
On Mon, Aug 15, 2011 at 09:42:50PM +0100, Måns Rullgård wrote:
 Kostya kostya.shish...@gmail.com writes:
 
[...]
 
 Why are most of the frames completely different?  Why is there one frame
 less decoded?
 
[...]
 
 Here too many frames have a different checksum.  Why?

Because of the wonderful synchronisation system Libav inherited (and maybe
also because of wrong FPS reported).

FATE ref for RV30 sample, for example, has only 46 frames, but when I invoke
framecrc with -vsync 0 it decodes all real 109 frames, and those checksums are
the same for Libav with and without my patches.

I remember that adding proper FPS reporting made it report about actual number
of frames too, so patch is pending.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 3/3] Parse FPS in RealMedia properly

2011-08-16 Thread Kostya Shishkov
---
 libavformat/rmdec.c  |   16 +-
 tests/ref/fate/real-rv40 |  355 ++
 tests/ref/fate/rv30  |  152 ++--
 3 files changed, 352 insertions(+), 171 deletions(-)

diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index cf5c46a..7cf5720 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -293,21 +293,21 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, 
AVIOContext *pb,
 //av_log(s, AV_LOG_DEBUG, %X %X\n, st-codec-codec_tag, MKTAG('R', 
'V', '2', '0'));
 if (st-codec-codec_id == CODEC_ID_NONE)
 goto fail1;
-st-codec-width = avio_rb16(pb);
+st-codec-width  = avio_rb16(pb);
 st-codec-height = avio_rb16(pb);
-st-codec-time_base.num= 1;
-fps= avio_rb16(pb);
+avio_skip(pb, 2); // looks like bits per sample
+avio_skip(pb, 4); // always zero?
 st-codec-codec_type = AVMEDIA_TYPE_VIDEO;
 st-need_parsing = AVSTREAM_PARSE_TIMESTAMPS;
-avio_rb32(pb);
-avio_skip(pb, 2);
-avio_rb16(pb);
+fps = avio_rb32(pb);
 
 if ((ret = rm_read_extradata(pb, st-codec, codec_data_size - 
(avio_tell(pb) - codec_pos)))  0)
 return ret;
 
-//av_log(s, AV_LOG_DEBUG, fps= %d fps2= %d\n, fps, fps2);
-st-codec-time_base.den = fps * st-codec-time_base.num;
+av_reduce(st-codec-time_base.num, st-codec-time_base.den,
+  0x1, fps, (1  30) - 1);
+st-avg_frame_rate.num = st-codec-time_base.den;
+st-avg_frame_rate.den = st-codec-time_base.num;
 }
 
 skip:
diff --git a/tests/ref/fate/real-rv40 b/tests/ref/fate/real-rv40
index 22cc731..127cba2 100644
--- a/tests/ref/fate/real-rv40
+++ b/tests/ref/fate/real-rv40
@@ -1,120 +1,237 @@
 0, 0, 276480, 0x5f7a0d4f
-0, 7500, 276480, 0x5f7a0d4f
-0, 15000, 276480, 0x5f7a0d4f
-0, 22500, 276480, 0x5f7a0d4f
-0, 3, 276480, 0x5f7a0d4f
-0, 37500, 276480, 0x5f7a0d4f
-0, 45000, 276480, 0x5f7a0d4f
-0, 52500, 276480, 0x5f7a0d4f
-0, 6, 276480, 0x5f7a0d4f
-0, 67500, 276480, 0x5f7a0d4f
-0, 75000, 276480, 0x5f7a0d4f
-0, 82500, 276480, 0x5f7a0d4f
-0, 9, 276480, 0x5f7a0d4f
-0, 97500, 276480, 0x5f7a0d4f
-0, 105000, 276480, 0x5f7a0d4f
-0, 112500, 276480, 0x5f7a0d4f
-0, 12, 276480, 0x5f7a0d4f
-0, 127500, 276480, 0x5f7a0d4f
-0, 135000, 276480, 0x32ee3526
-0, 142500, 276480, 0x7ca9658e
-0, 15, 276480, 0x4ec1e418
-0, 157500, 276480, 0xa9f1506f
-0, 165000, 276480, 0x377c7b46
-0, 172500, 276480, 0xe1de7f0a
-0, 18, 276480, 0xcb379547
-0, 187500, 276480, 0x8e12331c
-0, 195000, 276480, 0xe479ffed
-0, 202500, 276480, 0xac7672dd
-0, 21, 276480, 0x776412ef
-0, 217500, 276480, 0x1cd1ab29
-0, 225000, 276480, 0x5ab69b27
-0, 232500, 276480, 0x9eca3f11
-0, 24, 276480, 0xc9c57884
-0, 247500, 276480, 0xdc07f3c9
-0, 255000, 276480, 0x27ff7a5d
-0, 262500, 276480, 0x18d4b27d
-0, 27, 276480, 0x97612c4b
-0, 277500, 276480, 0x4ec4d57f
-0, 285000, 276480, 0xbd98f57c
-0, 292500, 276480, 0xa5d670ec
-0, 30, 276480, 0x99170e64
-0, 307500, 276480, 0x7a4f2561
-0, 315000, 276480, 0x6a45425f
-0, 322500, 276480, 0xd75482c6
-0, 33, 276480, 0x6de1e34b
-0, 337500, 276480, 0xf964e18e
-0, 345000, 276480, 0xd1e98808
-0, 352500, 276480, 0x0cf65540
-0, 36, 276480, 0x22c50a3d
-0, 367500, 276480, 0xf4b1c461
-0, 375000, 276480, 0x51e9b3eb
-0, 382500, 276480, 0x6dd14ca6
-0, 39, 276480, 0xfb01efc6
-0, 397500, 276480, 0x5ac8e06f
-0, 405000, 276480, 0xe04ac45e
-0, 412500, 276480, 0xf688a3ed
-0, 42, 276480, 0xf0b3b71b
-0, 427500, 276480, 0x01840548
-0, 435000, 276480, 0x41dda2d9
-0, 442500, 276480, 0x9b209f41
-0, 45, 276480, 0x28b54815
-0, 457500, 276480, 0x34484aff
-0, 465000, 276480, 0x8facba58
-0, 472500, 276480, 0x02162c7c
-0, 48, 276480, 0x1ad43fd7
-0, 487500, 276480, 0x2b8a89c5
-0, 495000, 276480, 0x35626022
-0, 502500, 276480, 0xce5af1ec
-0, 51, 276480, 0x7fd73a99
-0, 517500, 276480, 0xcb60725a
-0, 525000, 276480, 0xd6f82cae
-0, 532500, 276480, 0xfa88a483
-0, 54, 276480, 0x04a8e3ee
-0, 547500, 276480, 0x0b41f0d7
-0, 555000, 276480, 0x754ceaf5
-0, 562500, 276480, 0xde084059
-0, 57, 276480, 0xfcebc261
-0, 577500, 276480, 0x046394ae
-0, 585000, 276480, 0x94a03c75
-0, 592500, 276480, 0x6a841f41
-0, 60, 276480, 0x923b9937
-0, 607500, 276480, 0xee82d657
-0, 615000, 276480, 0x6b9fbc80
-0, 622500, 276480, 0x6d4b49d7
-0, 63, 276480, 0x225a56c0
-0, 637500, 276480, 0xff4e1a8c
-0, 645000, 276480, 0xbaffcdcc
-0, 652500, 276480, 0x3d861ae6
-0, 66, 276480, 0xdb753d35
-0, 667500, 276480, 0xb24c8016
-0, 675000, 276480, 0x2aae902a
-0, 682500, 276480, 0x5c6e97a9
-0, 69, 276480, 0xaa12b6fd
-0, 697500, 276480, 0xbf09053c
-0, 705000, 276480, 0xdd9fb89f
-0, 712500, 276480, 0x0b752d28
-0, 72, 276480, 0x7ce5f23c
-0, 727500, 276480, 0x55dadd30
-0, 735000, 276480, 0xe45a5599
-0, 742500, 276480, 0x2f447fd3
-0, 75, 276480, 0x9d7430a1
-0, 757500, 276480, 0x51cb657c
-0, 765000, 276480, 0x4a4f76cd
-0, 772500, 

Re: [libav-devel] [PATCH 3/3] Parse FPS in RealMedia properly

2011-08-16 Thread Kostya
On Tue, Aug 16, 2011 at 09:10:57AM +0200, Kostya Shishkov wrote:
 ---
  libavformat/rmdec.c  |   16 +-
  tests/ref/fate/real-rv40 |  355 
 ++
  tests/ref/fate/rv30  |  152 ++--
  3 files changed, 352 insertions(+), 171 deletions(-)

With this patch framecrc values for test samples are the same as the values
obtained with -vsync 0.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] lavf: Add an XMV demuxer

2011-08-16 Thread Sven Hesse
Okay, new version, with doc changes, lavf bump and proper audio PTS.
From d754aa39946c87d92a5c3fbf9a4e4252d2f82615 Mon Sep 17 00:00:00 2001
From: Sven Hesse drmc...@users.sourceforge.net
Date: Mon, 15 Aug 2011 21:14:47 +0200
Subject: [PATCH] lavf: Add an XMV demuxer

---
 Changelog|1 +
 doc/general.texi |2 +
 libavcodec/wmv2dec.c |   44 +++-
 libavformat/Makefile |1 +
 libavformat/allformats.c |1 +
 libavformat/version.h|2 +-
 libavformat/xmv.c|  554 ++
 7 files changed, 593 insertions(+), 12 deletions(-)
 create mode 100644 libavformat/xmv.c

diff --git a/Changelog b/Changelog
index c43412c..293376a 100644
--- a/Changelog
+++ b/Changelog
@@ -39,6 +39,7 @@ easier to use. The changes are:
 * Presets in avconv are disabled, because only libx264 used them and
   presets for libx264 can now be specified using a private option
   '-preset presetname'.
+- XMV demuxer
 
 
 version 0.7:
diff --git a/doc/general.texi b/doc/general.texi
index be5b570..430e93a 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -259,6 +259,8 @@ library:
 @tab Multimedia format used in Westwood Studios games.
 @item Westwood Studios VQA  @tab   @tab X
 @tab Multimedia format used in Westwood Studios games.
+@item XMV   @tab   @tab X
+@tab Microsoft video container used in Xbox games.
 @item xWMA  @tab   @tab X
 @tab Microsoft audio container used by XAudio 2.
 @item YUV4MPEG pipe @tab X @tab X
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index 21fc1cf..cd3212b 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -81,23 +81,45 @@ static void parse_mb_skip(Wmv2Context * w){
 
 static int decode_ext_header(Wmv2Context *w){
 MpegEncContext * const s= w-s;
-GetBitContext gb;
 int fps;
 int code;
+int xmv = 0;
 
 if(s-avctx-extradata_size4) return -1;
 
-init_get_bits(gb, s-avctx-extradata, 32);
-
-fps= get_bits(gb, 5);
-s-bit_rate= get_bits(gb, 11)*1024;
-w-mspel_bit   = get_bits1(gb);
-s-loop_filter = get_bits1(gb);
-w-abt_flag= get_bits1(gb);
-w-j_type_bit  = get_bits1(gb);
-w-top_left_mv_flag= get_bits1(gb);
-w-per_mb_rl_bit   = get_bits1(gb);
-code   = get_bits(gb, 3);
+/* Check if that's a XMV'd WMV2 stream. */
+if (s-avctx-extradata_size == 12)
+if ((AV_RB32(s-avctx-extradata) == 0x) 
+(AV_RB32(s-avctx-extradata + 4) == 0x584D5620))
+xmv = 1;
+
+if (!xmv) {
+GetBitContext gb;
+
+init_get_bits(gb, s-avctx-extradata, 32);
+
+fps= get_bits(gb, 5);
+s-bit_rate= get_bits(gb, 11)*1024;
+w-mspel_bit   = get_bits1(gb);
+s-loop_filter = get_bits1(gb);
+w-abt_flag= get_bits1(gb);
+w-j_type_bit  = get_bits1(gb);
+w-top_left_mv_flag= get_bits1(gb);
+w-per_mb_rl_bit   = get_bits1(gb);
+code   = get_bits(gb, 3);
+} else {
+uint32_t data = AV_RL32(s-avctx-extradata + 8);
+
+fps= 0;
+s-bit_rate= 0;
+w-mspel_bit   = data  0x01;
+s-loop_filter = data  0x02;
+w-abt_flag= data  0x04;
+w-j_type_bit  = data  0x08;
+w-top_left_mv_flag= data  0x10;
+w-per_mb_rl_bit   = data  0x20;
+code   = (data  6)  7;
+}
 
 if(code==0) return -1;
 
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 917b38a..3f84019 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -298,6 +298,7 @@ OBJS-$(CONFIG_WTV_DEMUXER)   += wtv.o asfdec.o asf.o asfcrypt.o \
 avlanguage.o mpegts.o isom.o riff.o
 OBJS-$(CONFIG_WV_DEMUXER)+= wv.o apetag.o
 OBJS-$(CONFIG_XA_DEMUXER)+= xa.o
+OBJS-$(CONFIG_XMV_DEMUXER)   += xmv.o
 OBJS-$(CONFIG_XWMA_DEMUXER)  += xwma.o riff.o
 OBJS-$(CONFIG_YOP_DEMUXER)   += yop.o
 OBJS-$(CONFIG_YUV4MPEGPIPE_MUXER)+= yuv4mpeg.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index f1c3d3b..17c07a2 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -225,6 +225,7 @@ void av_register_all(void)
 REGISTER_DEMUXER  (WTV, wtv);
 REGISTER_DEMUXER  (WV, wv);
 REGISTER_DEMUXER  (XA, xa);
+REGISTER_DEMUXER  (XMV, xmv);
 REGISTER_DEMUXER  (XWMA, xwma);
 REGISTER_DEMUXER  (YOP, yop);
 REGISTER_MUXDEMUX (YUV4MPEGPIPE, yuv4mpegpipe);
diff --git a/libavformat/version.h b/libavformat/version.h
index 4473717..36f1439 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -24,7 +24,7 @@
 #include libavutil/avutil.h
 
 #define LIBAVFORMAT_VERSION_MAJOR 53
-#define 

Re: [libav-devel] [PATCH] lavf: Add an XMV demuxer

2011-08-16 Thread Kostya
On Tue, Aug 16, 2011 at 09:23:34AM +0200, Sven Hesse wrote:
 Okay, new version, with doc changes, lavf bump and proper audio PTS.

 From d754aa39946c87d92a5c3fbf9a4e4252d2f82615 Mon Sep 17 00:00:00 2001
 From: Sven Hesse drmc...@users.sourceforge.net
 Date: Mon, 15 Aug 2011 21:14:47 +0200
 Subject: [PATCH] lavf: Add an XMV demuxer
 
 ---
  Changelog|1 +
  doc/general.texi |2 +
  libavcodec/wmv2dec.c |   44 +++-
  libavformat/Makefile |1 +
  libavformat/allformats.c |1 +
  libavformat/version.h|2 +-
  libavformat/xmv.c|  554 
 ++
  7 files changed, 593 insertions(+), 12 deletions(-)
  create mode 100644 libavformat/xmv.c

Looks good to me (though there's no limit for perfection ;) and works on our
samples.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/2] Turn on resampling on sudden size change instead of bailing out during recode.

2011-08-16 Thread Kostya
On Mon, Aug 15, 2011 at 09:47:54PM +0100, Måns Rullgård wrote:
 Kostya Shishkov kostya.shish...@gmail.com writes:
 
  ---
   avconv.c |2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)
 
  diff --git a/avconv.c b/avconv.c
  index 18c5f07..74db59f 100644
  --- a/avconv.c
  +++ b/avconv.c
  @@ -1186,7 +1186,7 @@ static void do_video_out(AVFormatContext *s,
  ost-resample_width, ost-resample_height, 
  av_get_pix_fmt_name(ost-resample_pix_fmt),
  dec-width , dec-height , 
  av_get_pix_fmt_name(dec-pix_fmt));
   if(!ost-video_resample)
  -exit_program(1);
  +ost-video_resample = 1;
   }
 
   #if !CONFIG_AVFILTER
  -- 
 
 Is this a good idea?  It seems to me the correct thing to do would be to
 reconfigure the encoder if supported and only if that fails start
 scaling.

I don't know many formats that allow that. In theory this can be made a
separate option to define behaviour on size change (fail/resize/tell encoder).
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 4/6] matroskaenc: vertical alignment.

2011-08-16 Thread Anton Khirnov
---
 libavformat/matroskaenc.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 6ba750f..aa767f3 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1219,9 +1219,9 @@ AVOutputFormat ff_matroska_muxer = {
 .write_header  = mkv_write_header,
 .write_packet  = mkv_write_packet,
 .write_trailer = mkv_write_trailer,
-.flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
-.codec_tag = (const AVCodecTag* const []){ff_codec_bmp_tags, 
ff_codec_wav_tags, 0},
-.subtitle_codec = CODEC_ID_SSA,
+.flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
+.codec_tag = (const AVCodecTag* const []){ff_codec_bmp_tags, 
ff_codec_wav_tags, 0},
+.subtitle_codec= CODEC_ID_SSA,
 .query_codec   = mkv_query_codec,
 };
 #endif
-- 
1.7.5.4

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


[libav-devel] [PATCH 1/6] lavc: add avcodec_get_type() for mapping codec_id - type.

2011-08-16 Thread Anton Khirnov
---
 doc/APIchanges   |3 +++
 libavcodec/avcodec.h |8 
 libavcodec/utils.c   |   14 ++
 libavcodec/version.h |4 ++--
 4 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index ac95d16..64d1571 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil:   2011-04-18
 
 API changes, most recent first:
 
+2011-08-xx - xxx - lavc 53.8.0
+  Add avcodec_get_type().
+
 2011-08-06 - 2f63440 - lavf 53.4.0
   Add error_recognition to AVFormatContext.
 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 5bc1878..0859e0e 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -210,6 +210,7 @@ enum CodecID {
 CODEC_ID_DFA,
 
 /* various PCM codecs */
+CODEC_ID_FIRST_AUDIO = 0x1, /// A dummy id pointing at the start 
of audio codecs
 CODEC_ID_PCM_S16LE= 0x1,
 CODEC_ID_PCM_S16BE,
 CODEC_ID_PCM_U16LE,
@@ -340,6 +341,7 @@ enum CodecID {
 CODEC_ID_QDMC,
 
 /* subtitle codecs */
+CODEC_ID_FIRST_SUBTITLE = 0x17000,  /// A dummy ID pointing at 
the start of subtitle codecs.
 CODEC_ID_DVD_SUBTITLE= 0x17000,
 CODEC_ID_DVB_SUBTITLE,
 CODEC_ID_TEXT,  /// raw UTF-8 text
@@ -351,6 +353,7 @@ enum CodecID {
 CODEC_ID_SRT,
 
 /* other specific kind of codecs (generally used for attachments) */
+CODEC_ID_FIRST_UNKNOWN = 0x18000,   /// A dummy ID pointing at 
the start of various fake codecs.
 CODEC_ID_TTF= 0x18000,
 
 CODEC_ID_PROBE= 0x19000, /// codec_id is not known (like CODEC_ID_NONE) 
but lavf should attempt to identify it
@@ -4273,4 +4276,9 @@ enum AVLockOp {
  */
 int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
 
+/**
+ * Get the type of the given codec.
+ */
+enum AVMediaType avcodec_get_type(enum CodecID codec_id);
+
 #endif /* AVCODEC_AVCODEC_H */
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 0abab9a..166fbec 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1301,3 +1301,17 @@ int avcodec_thread_init(AVCodecContext *s, int 
thread_count)
 return ff_thread_init(s);
 }
 #endif
+
+enum AVMediaType avcodec_get_type(enum CodecID codec_id)
+{
+if (codec_id = CODEC_ID_NONE)
+return AVMEDIA_TYPE_UNKNOWN;
+else if (codec_id  CODEC_ID_FIRST_AUDIO)
+return AVMEDIA_TYPE_VIDEO;
+else if (codec_id  CODEC_ID_FIRST_SUBTITLE)
+return AVMEDIA_TYPE_AUDIO;
+else if (codec_id  CODEC_ID_FIRST_UNKNOWN)
+return AVMEDIA_TYPE_SUBTITLE;
+
+return AVMEDIA_TYPE_UNKNOWN;
+}
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 7eb5ce0..24a33d7 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -21,8 +21,8 @@
 #define AVCODEC_VERSION_H
 
 #define LIBAVCODEC_VERSION_MAJOR 53
-#define LIBAVCODEC_VERSION_MINOR  7
-#define LIBAVCODEC_VERSION_MICRO  1
+#define LIBAVCODEC_VERSION_MINOR  8
+#define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
-- 
1.7.5.4

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


[libav-devel] [PATCH 3/6] matroskaenc: implement query_codec()

2011-08-16 Thread Anton Khirnov
---
 libavformat/matroskaenc.c |   17 +
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index b08f546..6ba750f 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1191,6 +1191,22 @@ static int mkv_write_trailer(AVFormatContext *s)
 return 0;
 }
 
+static int mkv_query_codec(enum CodecID codec_id, int std_compliance)
+{
+int i;
+for (i = 0; ff_mkv_codec_tags[i].id != CODEC_ID_NONE; i++)
+if (ff_mkv_codec_tags[i].id == codec_id)
+return 1;
+
+if (std_compliance  FF_COMPLIANCE_NORMAL) {// mkv 
theoretically supports any
+enum AVMediaType type = avcodec_get_type(codec_id); // video/audio 
through VFW/ACM
+if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)
+return 1;
+}
+
+return 0;
+}
+
 #if CONFIG_MATROSKA_MUXER
 AVOutputFormat ff_matroska_muxer = {
 .name  = matroska,
@@ -1206,6 +1222,7 @@ AVOutputFormat ff_matroska_muxer = {
 .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
 .codec_tag = (const AVCodecTag* const []){ff_codec_bmp_tags, 
ff_codec_wav_tags, 0},
 .subtitle_codec = CODEC_ID_SSA,
+.query_codec   = mkv_query_codec,
 };
 #endif
 
-- 
1.7.5.4

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


[libav-devel] [PATCH 2/6] lavf: add avformat_query_codec().

2011-08-16 Thread Anton Khirnov
It allows to check if a given codec can be written into a container.
---
 doc/APIchanges |3 +++
 libavformat/avformat.h |   18 ++
 libavformat/utils.c|   14 ++
 3 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 64d1571..cfce48b 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil:   2011-04-18
 
 API changes, most recent first:
 
+2011-08-xx - xxx - lavf 53.4.0
+  Add avformat_query_codec().
+
 2011-08-xx - xxx - lavc 53.8.0
   Add avcodec_get_type().
 
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 957039f..2a00a9f 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -322,6 +322,14 @@ typedef struct AVOutputFormat {
 
 const AVClass *priv_class; /// AVClass for the private context
 
+/**
+ * Test if the given codec can be stored in this container.
+ *
+ * @return 1 if the codec is supported, 0 if it is not.
+ * A negative number if unknown.
+ */
+int (*query_codec)(enum CodecID id, int std_compliance);
+
 /* private fields */
 struct AVOutputFormat *next;
 } AVOutputFormat;
@@ -1595,4 +1603,14 @@ attribute_deprecated int avf_sdp_create(AVFormatContext 
*ac[], int n_files, char
  */
 int av_match_ext(const char *filename, const char *extensions);
 
+/**
+ * Test if the given container can store a codec.
+ *
+ * @param std_compliance standards compliance level, one of FF_COMPLIANCE_*
+ *
+ * @return 1 if codec with ID codec_id can be stored in ofmt, 0 if it cannot.
+ * A negative number if this information is not available.
+ */
+int avformat_query_codec(AVOutputFormat *ofmt, enum CodecID codec_id, int 
std_compliance);
+
 #endif /* AVFORMAT_AVFORMAT_H */
diff --git a/libavformat/utils.c b/libavformat/utils.c
index b848ebb..6e3cb2f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3904,3 +3904,17 @@ int64_t ff_iso8601_to_unix_time(const char *datestr)
 return 0;
 #endif
 }
+
+int avformat_query_codec(AVOutputFormat *ofmt, enum CodecID codec_id, int 
std_compliance)
+{
+if (ofmt) {
+if (ofmt-query_codec)
+return ofmt-query_codec(codec_id, std_compliance);
+else if (ofmt-codec_tag)
+return !!av_codec_get_tag(ofmt-codec_tag, codec_id);
+else if (codec_id == ofmt-video_codec || codec_id == 
ofmt-audio_codec ||
+ codec_id == ofmt-subtitle_codec)
+return 1;
+}
+return AVERROR_PATCHWELCOME;
+}
-- 
1.7.5.4

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


[libav-devel] [PATCH 6/6] avconv: print stream copy information.

2011-08-16 Thread Anton Khirnov
---
 avconv.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/avconv.c b/avconv.c
index d52516e..e9ec470 100644
--- a/avconv.c
+++ b/avconv.c
@@ -2189,6 +2189,8 @@ static int transcode(AVFormatContext **output_files,
 fprintf(stderr,  [sync #%d.%d],
 ost-sync_ist-file_index,
 ost-sync_ist-st-index);
+if (ost-st-stream_copy)
+fprintf(stderr,  (copy));
 fprintf(stderr, \n);
 }
 }
-- 
1.7.5.4

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


[libav-devel] [PATCH 5/6] avconv: use stream copy by default when possible.

2011-08-16 Thread Anton Khirnov
---
 avconv.c  |   52 ++--
 tests/codec-regression.sh |4 +-
 tests/fate.mak|4 +-
 tests/lavf-regression.sh  |   20 
 tests/regression-funcs.sh |4 +-
 5 files changed, 47 insertions(+), 37 deletions(-)

diff --git a/avconv.c b/avconv.c
index 7be6804..d52516e 100644
--- a/avconv.c
+++ b/avconv.c
@@ -2829,10 +2829,7 @@ static AVCodec *choose_codec(AVFormatContext *s, 
AVStream *st, enum AVMediaType
 }
 
 if (!codec_name) {
-if (s-oformat) {
-st-codec-codec_id = av_guess_codec(s-oformat, NULL, 
s-filename, NULL, type);
-return avcodec_find_encoder(st-codec-codec_id);
-}
+return NULL;
 } else if (!strcmp(codec_name, copy))
 st-stream_copy = 1;
 else {
@@ -3075,7 +3072,7 @@ static void parse_forced_key_frames(char *kf, 
OutputStream *ost,
 }
 }
 
-static OutputStream *new_output_stream(AVFormatContext *oc, enum AVMediaType 
type)
+static OutputStream *new_output_stream(AVFormatContext *oc, enum AVMediaType 
type, int source_idx)
 {
 OutputStream *ost;
 AVStream *st = av_new_stream(oc, oc-nb_streams  nb_streamid_map ? 
streamid_map[oc-nb_streams] : 0);
@@ -3102,6 +3099,18 @@ static OutputStream *new_output_stream(AVFormatContext 
*oc, enum AVMediaType typ
 ost-st= st;
 st-codec-codec_type = type;
 ost-enc = choose_codec(oc, st, type, codec_names);
+if (!ost-enc) {
+/* no codec specified, try copy if possible or fallback to format 
default */
+if (source_idx = 0  avformat_query_codec(oc-oformat, 
input_streams[source_idx].st-codec-codec_id,
+FF_COMPLIANCE_NORMAL) == 
1) {
+st-codec-codec_id = 
input_streams[source_idx].st-codec-codec_id;
+st-stream_copy = 1;
+} else {
+st-codec-codec_id = av_guess_codec(oc-oformat, NULL, 
oc-filename, NULL, type);
+ost-enc = avcodec_find_encoder(st-codec-codec_id);
+}
+}
+
 if (ost-enc) {
 ost-opts  = filter_codec_opts(codec_opts, ost-enc-id, oc, st);
 }
@@ -3113,13 +3122,13 @@ static OutputStream *new_output_stream(AVFormatContext 
*oc, enum AVMediaType typ
 return ost;
 }
 
-static OutputStream *new_video_stream(AVFormatContext *oc)
+static OutputStream *new_video_stream(AVFormatContext *oc, int source_idx)
 {
 AVStream *st;
 OutputStream *ost;
 AVCodecContext *video_enc;
 
-ost = new_output_stream(oc, AVMEDIA_TYPE_VIDEO);
+ost = new_output_stream(oc, AVMEDIA_TYPE_VIDEO, source_idx);
 st  = ost-st;
 if (!st-stream_copy) {
 ost-frame_aspect_ratio = frame_aspect_ratio;
@@ -3228,13 +3237,13 @@ static OutputStream *new_video_stream(AVFormatContext 
*oc)
 return ost;
 }
 
-static OutputStream *new_audio_stream(AVFormatContext *oc)
+static OutputStream *new_audio_stream(AVFormatContext *oc, int source_idx)
 {
 AVStream *st;
 OutputStream *ost;
 AVCodecContext *audio_enc;
 
-ost = new_output_stream(oc, AVMEDIA_TYPE_AUDIO);
+ost = new_output_stream(oc, AVMEDIA_TYPE_AUDIO, source_idx);
 st  = ost-st;
 
 ost-bitstream_filters = audio_bitstream_filters;
@@ -3274,13 +3283,13 @@ static OutputStream *new_audio_stream(AVFormatContext 
*oc)
 return ost;
 }
 
-static OutputStream *new_data_stream(AVFormatContext *oc)
+static OutputStream *new_data_stream(AVFormatContext *oc, int source_idx)
 {
 AVStream *st;
 OutputStream *ost;
 AVCodecContext *data_enc;
 
-ost = new_output_stream(oc, AVMEDIA_TYPE_DATA);
+ost = new_output_stream(oc, AVMEDIA_TYPE_DATA, source_idx);
 st  = ost-st;
 data_enc = st-codec;
 if (!st-stream_copy) {
@@ -3299,13 +3308,13 @@ static OutputStream *new_data_stream(AVFormatContext 
*oc)
 return ost;
 }
 
-static OutputStream *new_subtitle_stream(AVFormatContext *oc)
+static OutputStream *new_subtitle_stream(AVFormatContext *oc, int source_idx)
 {
 AVStream *st;
 OutputStream *ost;
 AVCodecContext *subtitle_enc;
 
-ost = new_output_stream(oc, AVMEDIA_TYPE_SUBTITLE);
+ost = new_output_stream(oc, AVMEDIA_TYPE_SUBTITLE, source_idx);
 st  = ost-st;
 subtitle_enc = st-codec;
 
@@ -3407,7 +3416,7 @@ static int read_avserver_streams(AVFormatContext *s, 
const char *filename)
 AVCodec *codec;
 
 codec = avcodec_find_encoder(ic-streams[i]-codec-codec_id);
-ost   = new_output_stream(s, codec-type);
+ost   = new_output_stream(s, codec-type, -1);
 st= ost-st;
 
 // FIXME: a more elegant solution is needed
@@ -3474,7 +3483,7 @@ static void opt_output_file(const char *filename)
 /* pick the best stream of each type */
 #define NEW_STREAM(type, index)\
 if (index = 0) {\
-ost = new_ ## type ## _stream(oc);\
+ost = new_ ## type ## _stream(oc, index);\
 ost-source_index = index;\
 ost-sync_ist 

Re: [libav-devel] AMD testers wanted.

2011-08-16 Thread Diego Biurrun
On Mon, Aug 15, 2011 at 02:49:01PM -0700, Alex Converse wrote:
 On Sun, Aug 14, 2011 at 11:29 AM, Loren Merritt lor...@u.washington.edu 
 wrote:
  On Sun, 14 Aug 2011, Jason Garrett-Glaser wrote:
 
  On Sun, Aug 14, 2011 at 3:41 AM, Vitor Sessak vitor1...@gmail.com wrote:
   On Sun, Aug 14, 2011 at 6:03 AM, Alex Converse alex.conve...@gmail.com 
   wrote:
   When the 3DNOW version of vector_fmul_add was preferred over SSE the 
   code
   was substantially more complex than it is now. Would someone with an 
   AMD chip
   that supports both SSE and 3DNOW be willing to benchmark them and see 
   which is
   current faster?
  
   According to /proc/cpuinfo:
   model name      : AMD Athlon(tm) 64 X2 Dual Core Processor 5600+
  
   Using the best result for each of 1000 runs:
   1334000 dezicycles in 3DNOW, 1 runs, 0 skips
   1336460 dezicycles in SSE, 1 runs, 0 skips
 
  Are we sure this isn't memory-bound?
 
  Of course it's memory-bound. So the SSE version should be faster on k10.
 
 What about on older AMD cpus?

Like a K6-III+?  :-)

If you ping me about this when I'm back home again, I can run benchmarks.

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


[libav-devel] [PATCH] Do not write ID3v1 tags by default

2011-08-16 Thread Diogo Franco
ID3v1 are legacy tags with several limitations; furthermore
avconv/ffmpeg writes the tags in UTF-8 which probably has near-0
software support.

Add a -write_id3v1 option to be able to turn it on; disabled by default.
---
 libavformat/mp3enc.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index e702e3b..3704e49 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -135,6 +135,7 @@ static int id3v2_put_ttag(AVFormatContext *s, const char 
*str1, const char *str2
 typedef struct MP3Context {
 const AVClass *class;
 int id3v2_version;
+int write_id3v1;
 int64_t nb_frames_offset;
 } MP3Context;
 
@@ -144,7 +145,7 @@ static int mp3_write_trailer(struct AVFormatContext *s)
 MP3Context *mp3 = s-priv_data;
 
 /* write the id3v1 tag */
-if (id3v1_create_tag(s, buf)  0) {
+if (mp3  mp3-write_id3v1  id3v1_create_tag(s, buf)  0) {
 avio_write(s-pb, buf, ID3v1_TAG_SIZE);
 }
 
@@ -178,6 +179,8 @@ AVOutputFormat ff_mp2_muxer = {
 static const AVOption options[] = {
 { id3v2_version, Select ID3v2 version to write. Currently 3 and 4 are 
supported.,
   offsetof(MP3Context, id3v2_version), FF_OPT_TYPE_INT, {.dbl = 4}, 3, 4, 
AV_OPT_FLAG_ENCODING_PARAM},
+{ write_id3v1, Enable ID3v1 writing. ID3v1 tags are written in UTF-8 
which may not be supported by most software.,
+  offsetof(MP3Context, write_id3v1), FF_OPT_TYPE_INT, {.dbl = 0}, 0, 1, 
AV_OPT_FLAG_ENCODING_PARAM},
 { NULL },
 };
 
-- 
1.7.5.1

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


Re: [libav-devel] [PATCH] lavf: Add an XMV demuxer

2011-08-16 Thread Diego Biurrun
On Tue, Aug 16, 2011 at 03:39:04AM +0200, Sven Hesse wrote:
 
 The attached patch adds a demuxer for Microsoft's XMV container, which
 is used in Xbox games
 (http://wiki.multimedia.cx/index.php?title=XMV).
 
 ---
  libavcodec/wmv2dec.c |   44 +++-
  libavformat/Makefile |1 +
  libavformat/allformats.c |1 +
  libavformat/xmv.c|  561 
 ++
  4 files changed, 596 insertions(+), 11 deletions(-)
  create mode 100644 libavformat/xmv.c

Please update changelog and documentation and bump minor.  See the
checklist for adding new components in the developer documentation.

 --- /dev/null
 +++ b/libavformat/xmv.c
 @@ -0,0 +1,561 @@
 +
 +#include inttypes.h

Just stdint.h should be enough.

 +file_version = avio_rl32(pb);
 +if ((file_version != 4)  (file_version != 2)) {
 +av_log(s, AV_LOG_WARNING, Found uncommon version %d\n, 
 file_version);
 +av_log_ask_for_sample(s, NULL);

You can merge the av_log call into av_log_ask_for_sample, just pass the
message as argument list instead of NULL.

 +xmv-video.data_size   =  AV_RL32(data)  0x007F;
 +
 +xmv-video.current_frame = 0;
 +xmv-video.frame_count   = (AV_RL32(data)  23)  0xFF;
 +
 +xmv-video.has_extradata = (data[3]  0x80) != 0;

nit: align the '='

 +/* Contrary to normal WMV2 video, the bit stream in XMV's
 + * WMV2 is little endian.

little-endian

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


Re: [libav-devel] [PATCH] movenc: change AV_LOG_INFO to AV_LOG_WARNING for some warnings

2011-08-16 Thread Diego Biurrun
On Tue, Aug 16, 2011 at 07:00:42AM +0200, Anton Khirnov wrote:
 ---
  libavformat/movenc.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

OK

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


[libav-devel] [PATCH] avconv: don't segfault on 0 input files.

2011-08-16 Thread Anton Khirnov
---
 avconv.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/avconv.c b/avconv.c
index e9dc790..bbefa5f 100644
--- a/avconv.c
+++ b/avconv.c
@@ -3781,7 +3781,7 @@ static void opt_output_file(const char *filename)
 }
 
 /* copy global metadata by default */
-if (metadata_global_autocopy)
+if (metadata_global_autocopy  nb_input_files)
 av_dict_copy(oc-metadata, input_files[0].ctx-metadata,
  AV_DICT_DONT_OVERWRITE);
 if (metadata_streams_autocopy)
-- 
1.7.5.4

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


Re: [libav-devel] [PATCH] avconv: don't segfault on 0 input files.

2011-08-16 Thread Kostya
On Tue, Aug 16, 2011 at 12:12:14PM +0200, Anton Khirnov wrote:
 ---
  avconv.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/avconv.c b/avconv.c
 index e9dc790..bbefa5f 100644
 --- a/avconv.c
 +++ b/avconv.c
 @@ -3781,7 +3781,7 @@ static void opt_output_file(const char *filename)
  }
  
  /* copy global metadata by default */
 -if (metadata_global_autocopy)
 +if (metadata_global_autocopy  nb_input_files)
  av_dict_copy(oc-metadata, input_files[0].ctx-metadata,
   AV_DICT_DONT_OVERWRITE);
  if (metadata_streams_autocopy)
 -- 

looks OK but commit message is not complete: avconv -i infile still works fine
so when can it segfault?
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] avconv: don't segfault on 0 input files.

2011-08-16 Thread Kostya
On Tue, Aug 16, 2011 at 12:18:04PM +0200, Kostya wrote:
 On Tue, Aug 16, 2011 at 12:12:14PM +0200, Anton Khirnov wrote:
  ---
   avconv.c |2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)
  
  diff --git a/avconv.c b/avconv.c
  index e9dc790..bbefa5f 100644
  --- a/avconv.c
  +++ b/avconv.c
  @@ -3781,7 +3781,7 @@ static void opt_output_file(const char *filename)
   }
   
   /* copy global metadata by default */
  -if (metadata_global_autocopy)
  +if (metadata_global_autocopy  nb_input_files)
   av_dict_copy(oc-metadata, input_files[0].ctx-metadata,
AV_DICT_DONT_OVERWRITE);
   if (metadata_streams_autocopy)
  -- 
 
 looks OK but commit message is not complete: avconv -i infile still works fine
 so when can it segfault?

Disregard the message (it was zero _input_ files, not output). Patch OK.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Do not write ID3v1 tags by default

2011-08-16 Thread Anton Khirnov

On Tue, 16 Aug 2011 09:43:23 +, Diogo Franco diogomfra...@gmail.com wrote:
 ID3v1 are legacy tags with several limitations; furthermore
 avconv/ffmpeg writes the tags in UTF-8 which probably has near-0
 software support.
 
 Add a -write_id3v1 option to be able to turn it on; disabled by default.
 ---
  libavformat/mp3enc.c |5 -
  1 files changed, 4 insertions(+), 1 deletions(-)
 
 diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
 index e702e3b..3704e49 100644
 --- a/libavformat/mp3enc.c
 +++ b/libavformat/mp3enc.c
 @@ -135,6 +135,7 @@ static int id3v2_put_ttag(AVFormatContext *s, const char 
 *str1, const char *str2
  typedef struct MP3Context {
  const AVClass *class;
  int id3v2_version;
 +int write_id3v1;
  int64_t nb_frames_offset;
  } MP3Context;
  
 @@ -144,7 +145,7 @@ static int mp3_write_trailer(struct AVFormatContext *s)
  MP3Context *mp3 = s-priv_data;
  
  /* write the id3v1 tag */
 -if (id3v1_create_tag(s, buf)  0) {
 +if (mp3  mp3-write_id3v1  id3v1_create_tag(s, buf)  0) {
  avio_write(s-pb, buf, ID3v1_TAG_SIZE);
  }
  
 @@ -178,6 +179,8 @@ AVOutputFormat ff_mp2_muxer = {
  static const AVOption options[] = {
  { id3v2_version, Select ID3v2 version to write. Currently 3 and 4 are 
 supported.,
offsetof(MP3Context, id3v2_version), FF_OPT_TYPE_INT, {.dbl = 4}, 3, 
 4, AV_OPT_FLAG_ENCODING_PARAM},
 +{ write_id3v1, Enable ID3v1 writing. ID3v1 tags are written in UTF-8 
 which may not be supported by most software.,
 +  offsetof(MP3Context, write_id3v1), FF_OPT_TYPE_INT, {.dbl = 0}, 0, 1, 
 AV_OPT_FLAG_ENCODING_PARAM},
  { NULL },
  };
  
 -- 
 1.7.5.1
 

Ok, queued.
(the commit message is missing a 'mp3enc:' prefix, I'll add it myself)

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 5/6] avconv: use stream copy by default when possible.

2011-08-16 Thread Kostya
On Tue, Aug 16, 2011 at 10:33:59AM +0200, Anton Khirnov wrote:
 ---
  avconv.c  |   52 ++--
  tests/codec-regression.sh |4 +-
  tests/fate.mak|4 +-
  tests/lavf-regression.sh  |   20 
  tests/regression-funcs.sh |4 +-
  5 files changed, 47 insertions(+), 37 deletions(-)

looks good to me
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 6/6] avconv: print stream copy information.

2011-08-16 Thread Kostya
On Tue, Aug 16, 2011 at 10:34:00AM +0200, Anton Khirnov wrote:
 ---
  avconv.c |2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/avconv.c b/avconv.c
 index d52516e..e9ec470 100644
 --- a/avconv.c
 +++ b/avconv.c
 @@ -2189,6 +2189,8 @@ static int transcode(AVFormatContext **output_files,
  fprintf(stderr,  [sync #%d.%d],
  ost-sync_ist-file_index,
  ost-sync_ist-st-index);
 +if (ost-st-stream_copy)
 +fprintf(stderr,  (copy));
  fprintf(stderr, \n);
  }
  }
 -- 

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


Re: [libav-devel] [PATCH 1/6] lavc: add avcodec_get_type() for mapping codec_id - type.

2011-08-16 Thread Kostya
On Tue, Aug 16, 2011 at 10:33:55AM +0200, Anton Khirnov wrote:
 ---
  doc/APIchanges   |3 +++
  libavcodec/avcodec.h |8 
  libavcodec/utils.c   |   14 ++
  libavcodec/version.h |4 ++--
  4 files changed, 27 insertions(+), 2 deletions(-)

maybe an overkil but lgtm
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/6] lavc: add avcodec_get_type() for mapping codec_id - type.

2011-08-16 Thread Anton Khirnov

On Tue, 16 Aug 2011 16:52:14 +0200, Kostya kostya.shish...@gmail.com wrote:
 On Tue, Aug 16, 2011 at 10:33:55AM +0200, Anton Khirnov wrote:
  ---
   doc/APIchanges   |3 +++
   libavcodec/avcodec.h |8 
   libavcodec/utils.c   |   14 ++
   libavcodec/version.h |4 ++--
   4 files changed, 27 insertions(+), 2 deletions(-)
 
 maybe an overkil but lgtm

I'm not too fond of this myself, better solutions welcome.

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/6] lavf: add avformat_query_codec().

2011-08-16 Thread Kostya
On Tue, Aug 16, 2011 at 10:33:56AM +0200, Anton Khirnov wrote:
 It allows to check if a given codec can be written into a container.
 ---
  doc/APIchanges |3 +++
  libavformat/avformat.h |   18 ++
  libavformat/utils.c|   14 ++
  3 files changed, 35 insertions(+), 0 deletions(-)

 +int avformat_query_codec(AVOutputFormat *ofmt, enum CodecID codec_id, int 
 std_compliance)
 +{
 +if (ofmt) {
 +if (ofmt-query_codec)
 +return ofmt-query_codec(codec_id, std_compliance);
 +else if (ofmt-codec_tag)
 +return !!av_codec_get_tag(ofmt-codec_tag, codec_id);
 +else if (codec_id == ofmt-video_codec || codec_id == 
 ofmt-audio_codec ||
 + codec_id == ofmt-subtitle_codec)
 +return 1;

streamcopying data codecs should also work

 +}
 +return AVERROR_PATCHWELCOME;
 +}
 -- 

otherwise OK
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 4/6] matroskaenc: vertical alignment.

2011-08-16 Thread Kostya
On Tue, Aug 16, 2011 at 10:33:58AM +0200, Anton Khirnov wrote:
 ---
  libavformat/matroskaenc.c |6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
 index 6ba750f..aa767f3 100644
 --- a/libavformat/matroskaenc.c
 +++ b/libavformat/matroskaenc.c
 @@ -1219,9 +1219,9 @@ AVOutputFormat ff_matroska_muxer = {
  .write_header  = mkv_write_header,
  .write_packet  = mkv_write_packet,
  .write_trailer = mkv_write_trailer,
 -.flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
 -.codec_tag = (const AVCodecTag* const []){ff_codec_bmp_tags, 
 ff_codec_wav_tags, 0},
 -.subtitle_codec = CODEC_ID_SSA,
 +.flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
 +.codec_tag = (const AVCodecTag* const []){ff_codec_bmp_tags, 
 ff_codec_wav_tags, 0},
 +.subtitle_codec= CODEC_ID_SSA,
  .query_codec   = mkv_query_codec,
  };
  #endif
 -- 

obviously OK
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 3/6] matroskaenc: implement query_codec()

2011-08-16 Thread Kostya
On Tue, Aug 16, 2011 at 10:33:57AM +0200, Anton Khirnov wrote:
 ---
  libavformat/matroskaenc.c |   17 +
  1 files changed, 17 insertions(+), 0 deletions(-)
 
 diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
 index b08f546..6ba750f 100644
 --- a/libavformat/matroskaenc.c
 +++ b/libavformat/matroskaenc.c
 @@ -1191,6 +1191,22 @@ static int mkv_write_trailer(AVFormatContext *s)
  return 0;
  }
  
 +static int mkv_query_codec(enum CodecID codec_id, int std_compliance)
 +{
 +int i;
 +for (i = 0; ff_mkv_codec_tags[i].id != CODEC_ID_NONE; i++)
 +if (ff_mkv_codec_tags[i].id == codec_id)
 +return 1;
 +
 +if (std_compliance  FF_COMPLIANCE_NORMAL) {// mkv 
 theoretically supports any
 +enum AVMediaType type = avcodec_get_type(codec_id); // 
 video/audio through VFW/ACM
 +if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)
 +return 1;
 +}

no subtitles?
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 2/4] h264: correct the check for invalid long term frame index in MMCO decode

2011-08-16 Thread Diego Biurrun
From: Jeff Downs heydo...@somuchpressure.net

The current check on MMCO parameters prohibits a max long term frame index
plus 1 of 16 (frame idx of 15) for the set max long term frame index MMCO.
Fix this off-by-one error to allow the full range of legal values.

Signed-off-by: Diego Biurrun di...@biurrun.de
---
 libavcodec/h264_refs.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index b7e43e7..12e3b94 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -685,7 +685,7 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, 
GetBitContext *gb){
 }
 if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || 
opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){
 unsigned int long_arg= get_ue_golomb_31(gb);
-if(long_arg = 32 || (long_arg = 16  !(opcode == 
MMCO_LONG2UNUSED  FIELD_PICTURE))){
+if(long_arg = 32 || (long_arg = 16  !(opcode == 
MMCO_SET_MAX_LONG  long_arg == 16)  !(opcode == MMCO_LONG2UNUSED  
FIELD_PICTURE))){
 av_log(h-s.avctx, AV_LOG_ERROR, illegal long ref in 
memory management control operation %d\n, opcode);
 return -1;
 }
-- 
1.7.1

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


[libav-devel] [PATCH 3/4] h264: correct implicit weight table computation for long ref pics

2011-08-16 Thread Diego Biurrun
From: Jeff Downs heydo...@somuchpressure.net

Correct computation of implicit weight tables when referencing pictures
that are marked for long reference.

Signed-off-by: Diego Biurrun di...@biurrun.de
---
 libavcodec/h264.c |   20 +++-
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index a9a6c8c..5d42ed3 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2174,15 +2174,17 @@ static void implicit_weight_table(H264Context *h, int 
field){
 for(ref0=ref_start; ref0  ref_count0; ref0++){
 int poc0 = h-ref_list[0][ref0].poc;
 for(ref1=ref_start; ref1  ref_count1; ref1++){
-int poc1 = h-ref_list[1][ref1].poc;
-int td = av_clip(poc1 - poc0, -128, 127);
-int w= 32;
-if(td){
-int tb = av_clip(cur_poc - poc0, -128, 127);
-int tx = (16384 + (FFABS(td)  1)) / td;
-int dist_scale_factor = (tb*tx + 32)  8;
-if(dist_scale_factor = -64  dist_scale_factor = 128)
-w = 64 - dist_scale_factor;
+int w = 32;
+if (!h-ref_list[0][ref0].long_ref  
!h-ref_list[1][ref1].long_ref) {
+int poc1 = h-ref_list[1][ref1].poc;
+int td = av_clip(poc1 - poc0, -128, 127);
+if(td){
+int tb = av_clip(cur_poc - poc0, -128, 127);
+int tx = (16384 + (FFABS(td)  1)) / td;
+int dist_scale_factor = (tb*tx + 32)  8;
+if(dist_scale_factor = -64  dist_scale_factor = 128)
+w = 64 - dist_scale_factor;
+}
 }
 if(field0){
 h-implicit_weight[ref0][ref1][0]=
-- 
1.7.1

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


Re: [libav-devel] [PATCH 3/6] matroskaenc: implement query_codec()

2011-08-16 Thread Anton Khirnov

On Tue, 16 Aug 2011 17:05:02 +0200, Kostya kostya.shish...@gmail.com wrote:
 On Tue, Aug 16, 2011 at 10:33:57AM +0200, Anton Khirnov wrote:
  ---
   libavformat/matroskaenc.c |   17 +
   1 files changed, 17 insertions(+), 0 deletions(-)
  
  diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
  index b08f546..6ba750f 100644
  --- a/libavformat/matroskaenc.c
  +++ b/libavformat/matroskaenc.c
  @@ -1191,6 +1191,22 @@ static int mkv_write_trailer(AVFormatContext *s)
   return 0;
   }
   
  +static int mkv_query_codec(enum CodecID codec_id, int std_compliance)
  +{
  +int i;
  +for (i = 0; ff_mkv_codec_tags[i].id != CODEC_ID_NONE; i++)
  +if (ff_mkv_codec_tags[i].id == codec_id)
  +return 1;
  +
  +if (std_compliance  FF_COMPLIANCE_NORMAL) {// mkv 
  theoretically supports any
  +enum AVMediaType type = avcodec_get_type(codec_id); // 
  video/audio through VFW/ACM
  +if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)
  +return 1;
  +}
 
 no subtitles?

No, there's no generic storage method for subs AFAIK.

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 3/6] matroskaenc: implement query_codec()

2011-08-16 Thread Kostya Shishkov
On 16 August 2011 17:10, Anton Khirnov an...@khirnov.net wrote:

 On Tue, 16 Aug 2011 17:05:02 +0200, Kostya kostya.shish...@gmail.com wrote:
 On Tue, Aug 16, 2011 at 10:33:57AM +0200, Anton Khirnov wrote:
  ---
   libavformat/matroskaenc.c |   17 +
   1 files changed, 17 insertions(+), 0 deletions(-)
 
  diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
  index b08f546..6ba750f 100644
  --- a/libavformat/matroskaenc.c
  +++ b/libavformat/matroskaenc.c
  @@ -1191,6 +1191,22 @@ static int mkv_write_trailer(AVFormatContext *s)
       return 0;
   }
 
  +static int mkv_query_codec(enum CodecID codec_id, int std_compliance)
  +{
  +    int i;
  +    for (i = 0; ff_mkv_codec_tags[i].id != CODEC_ID_NONE; i++)
  +        if (ff_mkv_codec_tags[i].id == codec_id)
  +            return 1;
  +
  +    if (std_compliance  FF_COMPLIANCE_NORMAL) {                // mkv 
  theoretically supports any
  +        enum AVMediaType type = avcodec_get_type(codec_id);     // 
  video/audio through VFW/ACM
  +        if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)
  +            return 1;
  +    }

 no subtitles?

 No, there's no generic storage method for subs AFAIK.

Fine then.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] AMD testers wanted.

2011-08-16 Thread Alex Converse
On Tue, Aug 16, 2011 at 2:33 AM, Diego Biurrun di...@biurrun.de wrote:
 On Mon, Aug 15, 2011 at 02:49:01PM -0700, Alex Converse wrote:
 On Sun, Aug 14, 2011 at 11:29 AM, Loren Merritt lor...@u.washington.edu 
 wrote:
  On Sun, 14 Aug 2011, Jason Garrett-Glaser wrote:
 
  On Sun, Aug 14, 2011 at 3:41 AM, Vitor Sessak vitor1...@gmail.com wrote:
   On Sun, Aug 14, 2011 at 6:03 AM, Alex Converse 
   alex.conve...@gmail.com wrote:
   When the 3DNOW version of vector_fmul_add was preferred over SSE the 
   code
   was substantially more complex than it is now. Would someone with an 
   AMD chip
   that supports both SSE and 3DNOW be willing to benchmark them and see 
   which is
   current faster?
  
   According to /proc/cpuinfo:
   model name      : AMD Athlon(tm) 64 X2 Dual Core Processor 5600+
  
   Using the best result for each of 1000 runs:
   1334000 dezicycles in 3DNOW, 1 runs, 0 skips
   1336460 dezicycles in SSE, 1 runs, 0 skips
 
  Are we sure this isn't memory-bound?
 
  Of course it's memory-bound. So the SSE version should be faster on k10.

 What about on older AMD cpus?

 Like a K6-III+?  :-)


Does K-6 III+ support SSE? Wikipedia seems to say that SSE first
showed up in AMD's line at Athlon XP/MP and Mobile Athlon 4.

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


[libav-devel] [PATCH] mpeg12: propagate chunk decode errors and fix conditional indentation

2011-08-16 Thread Dustin Brody
---
 libavcodec/mpeg12.c |   28 
 1 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 91eb3f5..4b20610 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1911,6 +1911,8 @@ static int slice_decode_thread(AVCodecContext *c, void 
*arg){
 //av_log(c, AV_LOG_DEBUG, ret:%d resync:%d/%d mb:%d/%d ts:%d/%d ec:%d\n,
 //ret, s-resync_mb_x, s-resync_mb_y, s-mb_x, s-mb_y, s-start_mb_y, 
s-end_mb_y, s-error_count);
 if(ret  0){
+if (c-error_recognition = FF_ER_EXPLODE)
+return AVERROR_INVALIDDATA;
 if(s-resync_mb_x=0  s-resync_mb_y=0)
 ff_er_add_slice(s, s-resync_mb_x, s-resync_mb_y, s-mb_x, 
s-mb_y, AC_ERROR|DC_ERROR|MV_ERROR);
 }else{
@@ -2265,8 +2267,10 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
 
 s-slice_count= 0;
 
-if(avctx-extradata  !avctx-frame_number)
-decode_chunks(avctx, picture, data_size, avctx-extradata, 
avctx-extradata_size);
+if(avctx-extradata  !avctx-frame_number 
+   decode_chunks(avctx, picture, data_size, avctx-extradata, 
avctx-extradata_size)  0 
+   avctx-error_recognition = FF_ER_EXPLODE)
+  return AVERROR_INVALIDDATA;
 
 return decode_chunks(avctx, picture, data_size, buf, buf_size);
 }
@@ -2318,11 +2322,13 @@ static int decode_chunks(AVCodecContext *avctx,
 switch(start_code) {
 case SEQ_START_CODE:
 if(last_code == 0){
-mpeg1_decode_sequence(avctx, buf_ptr,
-input_size);
+mpeg1_decode_sequence(avctx, buf_ptr,
+  input_size);
 s-sync=1;
 }else{
 av_log(avctx, AV_LOG_ERROR, ignoring SEQ_START_CODE after 
%X\n, last_code);
+if (avctx-error_recognition = FF_ER_EXPLODE)
+return AVERROR_INVALIDDATA;
 }
 break;
 
@@ -2351,6 +2357,8 @@ static int decode_chunks(AVCodecContext *avctx,
 last_code= PICTURE_START_CODE;
 }else{
 av_log(avctx, AV_LOG_ERROR, ignoring pic after %X\n, 
last_code);
+if (avctx-error_recognition = FF_ER_EXPLODE)
+return AVERROR_INVALIDDATA;
 }
 break;
 case EXT_START_CODE:
@@ -2362,6 +2370,8 @@ static int decode_chunks(AVCodecContext *avctx,
 mpeg_decode_sequence_extension(s);
 }else{
 av_log(avctx, AV_LOG_ERROR, ignoring seq ext after %X\n, 
last_code);
+if (avctx-error_recognition = FF_ER_EXPLODE)
+return AVERROR_INVALIDDATA;
 }
 break;
 case 0x2:
@@ -2378,6 +2388,8 @@ static int decode_chunks(AVCodecContext *avctx,
 mpeg_decode_picture_coding_extension(s);
 }else{
 av_log(avctx, AV_LOG_ERROR, ignoring pic cod ext after 
%X\n, last_code);
+if (avctx-error_recognition = FF_ER_EXPLODE)
+return AVERROR_INVALIDDATA;
 }
 break;
 }
@@ -2394,6 +2406,8 @@ static int decode_chunks(AVCodecContext *avctx,
 s-sync=1;
 }else{
 av_log(avctx, AV_LOG_ERROR, ignoring GOP_START_CODE after 
%X\n, last_code);
+if (avctx-error_recognition = FF_ER_EXPLODE)
+return AVERROR_INVALIDDATA;
 }
 break;
 default:
@@ -2438,6 +2452,8 @@ static int decode_chunks(AVCodecContext *avctx,
 
 if(!s2-pict_type){
 av_log(avctx, AV_LOG_ERROR, Missing picture start 
code\n);
+if (avctx-error_recognition = FF_ER_EXPLODE)
+return AVERROR_INVALIDDATA;
 break;
 }
 
@@ -2448,6 +2464,8 @@ static int decode_chunks(AVCodecContext *avctx,
 }
 if(!s2-current_picture_ptr){
 av_log(avctx, AV_LOG_ERROR, current_picture not 
initialized\n);
+if (avctx-error_recognition = FF_ER_EXPLODE)
+return AVERROR_INVALIDDATA;
 return -1;
 }
 
@@ -2476,6 +2494,8 @@ static int decode_chunks(AVCodecContext *avctx,
 emms_c();
 
 if(ret  0){
+if (avctx-error_recognition = FF_ER_EXPLODE)
+return AVERROR_INVALIDDATA;
 if(s2-resync_mb_x=0  s2-resync_mb_y=0)
 ff_er_add_slice(s2, s2-resync_mb_x, 
s2-resync_mb_y, s2-mb_x, s2-mb_y, AC_ERROR|DC_ERROR|MV_ERROR);
 }else{
-- 
1.7.2.5

___
libav-devel mailing list
libav-devel@libav.org

Re: [libav-devel] [PATCH 4/4] h264: 4:2:2 intra decoding support

2011-08-16 Thread madshi
2011/8/16 Diego Biurrun di...@biurrun.de
 From: Baptiste Coudurier baptiste.coudur...@gmail.com
 Signed-off-by: Diego Biurrun di...@biurrun.de

Wow, very nice - thanks a lot!   :-)

Best regards, madshi.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/6] lavf: add avformat_query_codec().

2011-08-16 Thread Anton Khirnov

On Tue, 16 Aug 2011 17:03:03 +0200, Kostya kostya.shish...@gmail.com wrote:
 On Tue, Aug 16, 2011 at 10:33:56AM +0200, Anton Khirnov wrote:
  It allows to check if a given codec can be written into a container.
  ---
   doc/APIchanges |3 +++
   libavformat/avformat.h |   18 ++
   libavformat/utils.c|   14 ++
   3 files changed, 35 insertions(+), 0 deletions(-)
 
  +int avformat_query_codec(AVOutputFormat *ofmt, enum CodecID codec_id, int 
  std_compliance)
  +{
  +if (ofmt) {
  +if (ofmt-query_codec)
  +return ofmt-query_codec(codec_id, std_compliance);
  +else if (ofmt-codec_tag)
  +return !!av_codec_get_tag(ofmt-codec_tag, codec_id);
  +else if (codec_id == ofmt-video_codec || codec_id == 
  ofmt-audio_codec ||
  + codec_id == ofmt-subtitle_codec)
  +return 1;
 
 streamcopying data codecs should also work
 

That doesn't mean the container supports data streams.

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/6] lavf: add avformat_query_codec().

2011-08-16 Thread Luca Barbato

On 8/16/11 6:09 PM, Anton Khirnov wrote:

That doesn't mean the container supports data streams.


nut, probably mkv and partially flv with some yet to be polished 
patches, seems to do that job well, not sure for the others.

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


[libav-devel] [PATCH] vp6: partially propagate huffman tree building errors during coeff model parsing

2011-08-16 Thread Dustin Brody
---
 libavcodec/vp6.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c
index 33cd43a..7ee6340 100644
--- a/libavcodec/vp6.c
+++ b/libavcodec/vp6.c
@@ -215,8 +215,8 @@ static int vp6_huff_cmp(const void *va, const void *vb)
 return (a-count - b-count)*16 + (b-sym - a-sym);
 }
 
-static void vp6_build_huff_tree(VP56Context *s, uint8_t coeff_model[],
-const uint8_t *map, unsigned size, VLC *vlc)
+static int vp6_build_huff_tree(VP56Context *s, uint8_t coeff_model[],
+   const uint8_t *map, unsigned size, VLC *vlc)
 {
 Node nodes[2*VP6_MAX_HUFF_SIZE], *tmp = nodes[size];
 int a, b, i;
@@ -232,8 +232,8 @@ static void vp6_build_huff_tree(VP56Context *s, uint8_t 
coeff_model[],
 
 free_vlc(vlc);
 /* then build the huffman tree accodring to probabilities */
-ff_huff_build_tree(s-avctx, vlc, size, nodes, vp6_huff_cmp,
-   FF_HUFFMAN_FLAG_HNODE_FIRST);
+return ff_huff_build_tree(s-avctx, vlc, size, nodes, vp6_huff_cmp,
+  FF_HUFFMAN_FLAG_HNODE_FIRST);
 }
 
 static void vp6_parse_coeff_models(VP56Context *s)
-- 
1.7.2.5

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


[libav-devel] [PATCH 3/3] aac: Only set sample rate and object type from ADTS if output hasn't been configured.

2011-08-16 Thread Alex Converse
Long term it would be nice to support error resilient reconfiguration
but right now setting this every frame does more harm than help.
---
 libavcodec/aacdec.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index d554f41..ef5daed 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -2092,10 +2092,10 @@ static int parse_adts_frame_header(AACContext *ac, 
GetBitContext *gb)
 if (ac-output_configured != OC_LOCKED) {
 ac-m4ac.sbr = -1;
 ac-m4ac.ps  = -1;
+ac-m4ac.sample_rate = hdr_info.sample_rate;
+ac-m4ac.sampling_index  = hdr_info.sampling_index;
+ac-m4ac.object_type = hdr_info.object_type;
 }
-ac-m4ac.sample_rate = hdr_info.sample_rate;
-ac-m4ac.sampling_index  = hdr_info.sampling_index;
-ac-m4ac.object_type = hdr_info.object_type;
 if (!ac-avctx-sample_rate)
 ac-avctx-sample_rate = hdr_info.sample_rate;
 if (hdr_info.num_aac_frames == 1) {
-- 
1.7.3.1

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


Re: [libav-devel] [PATCH 2/6] lavf: add avformat_query_codec().

2011-08-16 Thread Anton Khirnov

On Tue, 16 Aug 2011 18:34:51 +0200, Luca Barbato lu_z...@gentoo.org wrote:
 On 8/16/11 6:09 PM, Anton Khirnov wrote:
  That doesn't mean the container supports data streams.
 
 nut, probably mkv and partially flv with some yet to be polished 
 patches, seems to do that job well, not sure for the others.

Well yes, but that's up to the container-specific function.

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 5/6] avconv: use stream copy by default when possible.

2011-08-16 Thread Alex Converse
On Tue, Aug 16, 2011 at 1:33 AM, Anton Khirnov an...@khirnov.net wrote:
 ---
  avconv.c                  |   52 ++--
  tests/codec-regression.sh |    4 +-
  tests/fate.mak            |    4 +-
  tests/lavf-regression.sh  |   20 
  tests/regression-funcs.sh |    4 +-
  5 files changed, 47 insertions(+), 37 deletions(-)


Can you explain the motivation of this?
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 5/6] avconv: use stream copy by default when possible.

2011-08-16 Thread Alex Converse
On Tue, Aug 16, 2011 at 11:36 AM, Alex Converse alex.conve...@gmail.com wrote:
 On Tue, Aug 16, 2011 at 1:33 AM, Anton Khirnov an...@khirnov.net wrote:
 ---
  avconv.c                  |   52 
 ++--
  tests/codec-regression.sh |    4 +-
  tests/fate.mak            |    4 +-
  tests/lavf-regression.sh  |   20 
  tests/regression-funcs.sh |    4 +-
  5 files changed, 47 insertions(+), 37 deletions(-)


 Can you explain the motivation of this?


I also think this should have sat a bit longer. It's a big behavioral
change. Many people didn't have adequate time to see this patch.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 5/6] avconv: use stream copy by default when possible.

2011-08-16 Thread Alex Converse
On Tue, Aug 16, 2011 at 11:45 AM, Anton Khirnov an...@khirnov.net wrote:

 On Tue, 16 Aug 2011 11:36:23 -0700, Alex Converse alex.conve...@gmail.com 
 wrote:
 On Tue, Aug 16, 2011 at 1:33 AM, Anton Khirnov an...@khirnov.net wrote:
  ---
   avconv.c                  |   52 
  ++--
   tests/codec-regression.sh |    4 +-
   tests/fate.mak            |    4 +-
   tests/lavf-regression.sh  |   20 
   tests/regression-funcs.sh |    4 +-
   5 files changed, 47 insertions(+), 37 deletions(-)
 

 Can you explain the motivation of this?

 It seems to sane to me to not reencode (if possible) unless the user
 explicitly asked for it. Surely it's better than current insanely
 low-quality defaults.


Unfortunately copy is subtly broken in a lot of situations.

 I've asked for opinions on IRC and didn't see anyone disagree yet.


All development is supposed to take place on the ML. Not everyone is
on IRC at the same time. IRC is fine for collaboration but when all is
said and done everything should come through the list for everyone to
see.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 5/6] avconv: use stream copy by default when possible.

2011-08-16 Thread Anton Khirnov

On Tue, 16 Aug 2011 11:50:21 -0700, Alex Converse alex.conve...@gmail.com 
wrote:
 On Tue, Aug 16, 2011 at 11:45 AM, Anton Khirnov an...@khirnov.net wrote:
 
  On Tue, 16 Aug 2011 11:36:23 -0700, Alex Converse alex.conve...@gmail.com 
  wrote:
  On Tue, Aug 16, 2011 at 1:33 AM, Anton Khirnov an...@khirnov.net wrote:
   ---
    avconv.c                  |   52 
   ++--
    tests/codec-regression.sh |    4 +-
    tests/fate.mak            |    4 +-
    tests/lavf-regression.sh  |   20 
    tests/regression-funcs.sh |    4 +-
    5 files changed, 47 insertions(+), 37 deletions(-)
  
 
  Can you explain the motivation of this?
 
  It seems to sane to me to not reencode (if possible) unless the user
  explicitly asked for it. Surely it's better than current insanely
  low-quality defaults.
 
 
 Unfortunately copy is subtly broken in a lot of situations.
 
  I've asked for opinions on IRC and didn't see anyone disagree yet.
 
 
 All development is supposed to take place on the ML. Not everyone is
 on IRC at the same time. IRC is fine for collaboration but when all is
 said and done everything should come through the list for everyone to
 see.

Sorry. Reverted for now.

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 5/6] avconv: use stream copy by default when possible.

2011-08-16 Thread Alex Converse
On Tue, Aug 16, 2011 at 11:50 AM, Alex Converse alex.conve...@gmail.com wrote:
 On Tue, Aug 16, 2011 at 11:45 AM, Anton Khirnov an...@khirnov.net wrote:

 On Tue, 16 Aug 2011 11:36:23 -0700, Alex Converse alex.conve...@gmail.com 
 wrote:
 On Tue, Aug 16, 2011 at 1:33 AM, Anton Khirnov an...@khirnov.net wrote:
  ---
   avconv.c                  |   52 
  ++--
   tests/codec-regression.sh |    4 +-
   tests/fate.mak            |    4 +-
   tests/lavf-regression.sh  |   20 
   tests/regression-funcs.sh |    4 +-
   5 files changed, 47 insertions(+), 37 deletions(-)
 

 Can you explain the motivation of this?

 It seems to sane to me to not reencode (if possible) unless the user
 explicitly asked for it. Surely it's better than current insanely
 low-quality defaults.


 Unfortunately copy is subtly broken in a lot of situations.


Situations where it generates unexpectedly broken files by default:

1) places where we need the mp4_adtstoasc bsf (ADTS source, global
header container)
2) places where we need the h264_mp4toannexb bsf
3) places where we need the chomp bsf (zero padded audio in ASF)
4) places where we lump codecs that are normally signaled individually
under one codec_id (e.g., PRORES (which we can't decode anyway right
now) to a lesser extent AAC).

Places where this is a behavioral regression but avconv isn't
responsible for the breakage things:
1) Broken bitstream features (all the workarounds in h263dec)
2) Rarely used bitstream features. We can decode a lot of oddities and
borken files that many other deocders don't support. These are the
sort of features we never incude in our output (In AAC: PCE based
channel configurations, channel element reordering, CCEs, Main and LTP
profiles: none of these play on iTunes)

Places where this does something that the user probably doesn't expect:
1) avconv -i in.mp3 out.wav #user probably wants pcm_s16le not ACM
2) avconv -i in.y4m out.mkv #user probably doesn't want to slap on mkv
header on uncompressed input
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 5/6] avconv: use stream copy by default when possible.

2011-08-16 Thread Rob
On 16 August 2011 21:16, Alex Converse alex.conve...@gmail.com wrote:
 On Tue, Aug 16, 2011 at 11:50 AM, Alex Converse alex.conve...@gmail.com 
 wrote:
 On Tue, Aug 16, 2011 at 11:45 AM, Anton Khirnov an...@khirnov.net wrote:

 On Tue, 16 Aug 2011 11:36:23 -0700, Alex Converse alex.conve...@gmail.com 
 wrote:
 On Tue, Aug 16, 2011 at 1:33 AM, Anton Khirnov an...@khirnov.net wrote:
  ---
   avconv.c                  |   52 
  ++--
   tests/codec-regression.sh |    4 +-
   tests/fate.mak            |    4 +-
   tests/lavf-regression.sh  |   20 
   tests/regression-funcs.sh |    4 +-
   5 files changed, 47 insertions(+), 37 deletions(-)
 

 Can you explain the motivation of this?

 It seems to sane to me to not reencode (if possible) unless the user
 explicitly asked for it. Surely it's better than current insanely
 low-quality defaults.


 Unfortunately copy is subtly broken in a lot of situations.


 Situations where it generates unexpectedly broken files by default:

 1) places where we need the mp4_adtstoasc bsf (ADTS source, global
 header container)
 2) places where we need the h264_mp4toannexb bsf
 3) places where we need the chomp bsf (zero padded audio in ASF)
 4) places where we lump codecs that are normally signaled individually
 under one codec_id (e.g., PRORES (which we can't decode anyway right
 now) to a lesser extent AAC).

Can these situations be covered by some requirement of the bitstream
format and automagic selection or avoidance of the usage of the bsf
for relevant mappings?

 Places where this is a behavioral regression but avconv isn't
 responsible for the breakage things:
 1) Broken bitstream features (all the workarounds in h263dec)
 2) Rarely used bitstream features. We can decode a lot of oddities and
 borken files that many other deocders don't support. These are the
 sort of features we never incude in our output (In AAC: PCE based
 channel configurations, channel element reordering, CCEs, Main and LTP
 profiles: none of these play on iTunes)

This is indeed more tricky to do automatically without explicitly
identifying those properties and acting accordingly. And even then
some properties might be unknown or not yet have detection
implemented. Bleh.

 Places where this does something that the user probably doesn't expect:
 1) avconv -i in.mp3 out.wav #user probably wants pcm_s16le not ACM
 2) avconv -i in.y4m out.mkv #user probably doesn't want to slap on mkv
 header on uncompressed input

I personally think using command lines like this under-specifies what
avconv should do and would prefer mandatory explicit specification of
the target format. I recognise that users might have other
expectations and want to write a shorter command line or not have to
think about what the command could do and expect it to do what they
want it to do.

Those two seem to suggest that perhaps for some container formats
there is a general acceptance that they would normally contain
uncompressed or compressed streams. Mapping such somehow would cause
inconsistency, but perhaps it would improve usability for what people
might expect anyway. Are people more strongly tied to expectations on
file formats or to consistency of operation?

Best regards,
Rob
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 5/6] avconv: use stream copy by default when possible.

2011-08-16 Thread Justin Ruggles
On 08/16/2011 03:16 PM, Alex Converse wrote:

 On Tue, Aug 16, 2011 at 11:50 AM, Alex Converse alex.conve...@gmail.com 
 wrote:
 On Tue, Aug 16, 2011 at 11:45 AM, Anton Khirnov an...@khirnov.net wrote:

 On Tue, 16 Aug 2011 11:36:23 -0700, Alex Converse alex.conve...@gmail.com 
 wrote:
 On Tue, Aug 16, 2011 at 1:33 AM, Anton Khirnov an...@khirnov.net wrote:
 ---
  avconv.c  |   52 
 ++--
  tests/codec-regression.sh |4 +-
  tests/fate.mak|4 +-
  tests/lavf-regression.sh  |   20 
  tests/regression-funcs.sh |4 +-
  5 files changed, 47 insertions(+), 37 deletions(-)


 Can you explain the motivation of this?

 It seems to sane to me to not reencode (if possible) unless the user
 explicitly asked for it. Surely it's better than current insanely
 low-quality defaults.



I agree about the bitrate/quality defaults not being very useful, but
that can be fixed by per-codec defaults and/or by somehow signalling the
encoder to choose better values at codec init.

 Unfortunately copy is subtly broken in a lot of situations.

 
 Situations where it generates unexpectedly broken files by default:
 
 1) places where we need the mp4_adtstoasc bsf (ADTS source, global
 header container)
 2) places where we need the h264_mp4toannexb bsf
 3) places where we need the chomp bsf (zero padded audio in ASF)
 4) places where we lump codecs that are normally signaled individually
 under one codec_id (e.g., PRORES (which we can't decode anyway right
 now) to a lesser extent AAC).
 
 Places where this is a behavioral regression but avconv isn't
 responsible for the breakage things:
 1) Broken bitstream features (all the workarounds in h263dec)
 2) Rarely used bitstream features. We can decode a lot of oddities and
 borken files that many other deocders don't support. These are the
 sort of features we never incude in our output (In AAC: PCE based
 channel configurations, channel element reordering, CCEs, Main and LTP
 profiles: none of these play on iTunes)
 
 Places where this does something that the user probably doesn't expect:
 1) avconv -i in.mp3 out.wav #user probably wants pcm_s16le not ACM


+1. Having to put -acodec pcm_s16le when decoding to wav would be
annoying.  You can put almost any audio codec in wav, but people will
want PCM 99% of the time.

I agree with Alex on the IRC vs ML thing. I'm on vacation this week so I
am checking email daily and have not been on IRC.

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


[libav-devel] [PATCH] vp6: partially propagate huffman tree building errors during coeff model parsing and fix misspelling

2011-08-16 Thread Dustin Brody
---
 libavcodec/vp6.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c
index 33cd43a..657a5da 100644
--- a/libavcodec/vp6.c
+++ b/libavcodec/vp6.c
@@ -215,8 +215,8 @@ static int vp6_huff_cmp(const void *va, const void *vb)
 return (a-count - b-count)*16 + (b-sym - a-sym);
 }
 
-static void vp6_build_huff_tree(VP56Context *s, uint8_t coeff_model[],
-const uint8_t *map, unsigned size, VLC *vlc)
+static int vp6_build_huff_tree(VP56Context *s, uint8_t coeff_model[],
+   const uint8_t *map, unsigned size, VLC *vlc)
 {
 Node nodes[2*VP6_MAX_HUFF_SIZE], *tmp = nodes[size];
 int a, b, i;
@@ -231,9 +231,9 @@ static void vp6_build_huff_tree(VP56Context *s, uint8_t 
coeff_model[],
 }
 
 free_vlc(vlc);
-/* then build the huffman tree accodring to probabilities */
-ff_huff_build_tree(s-avctx, vlc, size, nodes, vp6_huff_cmp,
-   FF_HUFFMAN_FLAG_HNODE_FIRST);
+/* then build the huffman tree according to probabilities */
+return ff_huff_build_tree(s-avctx, vlc, size, nodes, vp6_huff_cmp,
+  FF_HUFFMAN_FLAG_HNODE_FIRST);
 }
 
 static void vp6_parse_coeff_models(VP56Context *s)
-- 
1.7.2.5

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


Re: [libav-devel] [PATCH 1/4] h264: fix PCM intra-coded blocks in monochrome case

2011-08-16 Thread Ronald S. Bultje
Hi,

On Tue, Aug 16, 2011 at 8:05 AM, Diego Biurrun di...@biurrun.de wrote:
 From: Jeff Downs heydo...@somuchpressure.net

 Signed-off-by: Diego Biurrun di...@biurrun.de
 ---
  libavcodec/h264.c |   43 ++-
  1 files changed, 30 insertions(+), 13 deletions(-)
[..]
 @@ -1812,8 +1812,8 @@ static av_always_inline void 
 hl_decode_mb_internal(H264Context *h, int simple, i
     }

     if (!simple  IS_INTRA_PCM(mb_type)) {
 +        const int bit_depth = h-sps.bit_depth_luma;
         if (pixel_shift) {
 -            const int bit_depth = h-sps.bit_depth_luma;

This isn't necessary, see below.

 @@ -1824,15 +1824,25 @@ static av_always_inline void 
 hl_decode_mb_internal(H264Context *h, int simple, i
                     tmp_y[j] = get_bits(gb, bit_depth);
             }
             if(simple || !CONFIG_GRAY || !(s-flagsCODEC_FLAG_GRAY)){
 -                for (i = 0; i  8; i++) {
 -                    uint16_t *tmp_cb = (uint16_t*)(dest_cb + i*uvlinesize);
 -                    for (j = 0; j  8; j++)
 -                        tmp_cb[j] = get_bits(gb, bit_depth);
 -                }
 -                for (i = 0; i  8; i++) {
 -                    uint16_t *tmp_cr = (uint16_t*)(dest_cr + i*uvlinesize);
 -                    for (j = 0; j  8; j++)
 -                        tmp_cr[j] = get_bits(gb, bit_depth);
 +                if (!h-sps.chroma_format_idc) {
 +                    for (i = 0; i  8; i++) {
 +                        uint16_t *tmp_cb = (uint16_t*)(dest_cb + 
 i*uvlinesize);
 +                        uint16_t *tmp_cr = (uint16_t*)(dest_cr + 
 i*uvlinesize);
 +                        for (j = 0; j  8; j++) {
 +                            tmp_cb[j] = tmp_cr[j] = 1  (bit_depth - 1);
 +                        }
 +                    }

Please use two separate loops here. Also, the assignment of tmp_cb/cr
is equivalent in both ends of the if, so just do that outside the if.

[..]
 +                } else {
 +                    for (i = 0; i  8; i++) {
 +                        uint16_t *tmp_cb = (uint16_t*)(dest_cb + 
 i*uvlinesize);
 +                        for (j = 0; j  8; j++)
 +                            tmp_cb[j] = get_bits(gb, bit_depth);
 +                    }
 +                    for (i = 0; i  8; i++) {
 +                        uint16_t *tmp_cr = (uint16_t*)(dest_cr + 
 i*uvlinesize);
 +                        for (j = 0; j  8; j++)
 +                            tmp_cr[j] = get_bits(gb, bit_depth);
 +                    }
[..]
 @@ -1840,9 +1850,16 @@ static av_always_inline void 
 hl_decode_mb_internal(H264Context *h, int simple, i
                 memcpy(dest_y + i*  linesize, h-mb       + i*8, 16);
             }
             if(simple || !CONFIG_GRAY || !(s-flagsCODEC_FLAG_GRAY)){
 -                for (i=0; i8; i++) {
 -                    memcpy(dest_cb+ i*uvlinesize, h-mb + 128 + i*4,  8);
 -                    memcpy(dest_cr+ i*uvlinesize, h-mb + 160 + i*4,  8);
 +                if (!h-sps.chroma_format_idc) {
 +                    for (i = 0; i  8; i++) {
 +                        memset(dest_cb + i*uvlinesize, 1  (bit_depth - 1), 
 8);
 +                        memset(dest_cr + i*uvlinesize, 1  (bit_depth - 1), 
 8);
 +                    }

This is silly, pixel_shift is ever only true if bit_depth8, so
1(bit_depth-1) is always 128, just use that.

[..]
 +                } else {
 +                    for (i = 0; i  8; i++) {
 +                        memcpy(dest_cb + i*uvlinesize, h-mb + 128 + i*4,  
 8);
 +                        memcpy(dest_cr + i*uvlinesize, h-mb + 160 + i*4,  
 8);
 +                    }

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


Re: [libav-devel] [PATCH 2/4] h264: correct the check for invalid long term frame index in MMCO decode

2011-08-16 Thread Ronald S. Bultje
Hi,

On Tue, Aug 16, 2011 at 8:05 AM, Diego Biurrun di...@biurrun.de wrote:
 From: Jeff Downs heydo...@somuchpressure.net

 The current check on MMCO parameters prohibits a max long term frame index
 plus 1 of 16 (frame idx of 15) for the set max long term frame index MMCO.
 Fix this off-by-one error to allow the full range of legal values.

 Signed-off-by: Diego Biurrun di...@biurrun.de
 ---
  libavcodec/h264_refs.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
 index b7e43e7..12e3b94 100644
 --- a/libavcodec/h264_refs.c
 +++ b/libavcodec/h264_refs.c
 @@ -685,7 +685,7 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, 
 GetBitContext *gb){
                 }
                 if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || 
 opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){
                     unsigned int long_arg= get_ue_golomb_31(gb);
 -                    if(long_arg = 32 || (long_arg = 16  !(opcode == 
 MMCO_LONG2UNUSED  FIELD_PICTURE))){
 +                    if(long_arg = 32 || (long_arg = 16  !(opcode == 
 MMCO_SET_MAX_LONG  long_arg == 16)  !(opcode == MMCO_LONG2UNUSED  
 FIELD_PICTURE))){

I believe Alexander (Strange) said this change was OK.

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


Re: [libav-devel] [PATCH 3/4] h264: correct implicit weight table computation for long ref pics

2011-08-16 Thread Ronald S. Bultje
Hi,

On Tue, Aug 16, 2011 at 8:05 AM, Diego Biurrun di...@biurrun.de wrote:
 From: Jeff Downs heydo...@somuchpressure.net

 Correct computation of implicit weight tables when referencing pictures
 that are marked for long reference.

 Signed-off-by: Diego Biurrun di...@biurrun.de
 ---
  libavcodec/h264.c |   20 +++-
  1 files changed, 11 insertions(+), 9 deletions(-)

 diff --git a/libavcodec/h264.c b/libavcodec/h264.c
 index a9a6c8c..5d42ed3 100644
 --- a/libavcodec/h264.c
 +++ b/libavcodec/h264.c
 @@ -2174,15 +2174,17 @@ static void implicit_weight_table(H264Context *h, int 
 field){
     for(ref0=ref_start; ref0  ref_count0; ref0++){
         int poc0 = h-ref_list[0][ref0].poc;
         for(ref1=ref_start; ref1  ref_count1; ref1++){
 -            int poc1 = h-ref_list[1][ref1].poc;
 -            int td = av_clip(poc1 - poc0, -128, 127);
 -            int w= 32;
 -            if(td){
 -                int tb = av_clip(cur_poc - poc0, -128, 127);
 -                int tx = (16384 + (FFABS(td)  1)) / td;
 -                int dist_scale_factor = (tb*tx + 32)  8;
 -                if(dist_scale_factor = -64  dist_scale_factor = 128)
 -                    w = 64 - dist_scale_factor;
 +            int w = 32;
 +            if (!h-ref_list[0][ref0].long_ref  
 !h-ref_list[1][ref1].long_ref) {
 +                int poc1 = h-ref_list[1][ref1].poc;
 +                int td = av_clip(poc1 - poc0, -128, 127);
 +                if(td){
 +                    int tb = av_clip(cur_poc - poc0, -128, 127);
 +                    int tx = (16384 + (FFABS(td)  1)) / td;
 +                    int dist_scale_factor = (tb*tx + 32)  8;
 +                    if(dist_scale_factor = -64  dist_scale_factor = 128)
 +                        w = 64 - dist_scale_factor;
 +                }

Which sample/bug does this fix? I really have no idea if this is
correct without spending some significant time on the spec right
now... Jason, Loren, do you guys know?

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


[libav-devel] [PATCH] avconv: Don't unnecessarily convert ipts to a double.

2011-08-16 Thread Alex Converse
---
 avconv.c |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/avconv.c b/avconv.c
index 66772aa..50fa1a7 100644
--- a/avconv.c
+++ b/avconv.c
@@ -2213,25 +2213,26 @@ static int transcode(AVFormatContext **output_files,
 for(; received_sigterm == 0;) {
 int file_index, ist_index;
 AVPacket pkt;
-double ipts_min;
+int64_t ipts_min;
 double opts_min;
 
 redo:
-ipts_min= 1e100;
+ipts_min = INT64_MAX;
 opts_min= 1e100;
 
 /* select the stream that we must read now by looking at the
smallest output pts */
 file_index = -1;
 for(i=0;inb_ostreams;i++) {
-double ipts, opts;
+int64_t ipts;
+double  opts;
 ost = ost_table[i];
 os = output_files[ost-file_index];
 ist = input_streams[ost-source_index];
 if(ist-is_past_recording_time || no_packet[ist-file_index])
 continue;
 opts = ost-st-pts.val * av_q2d(ost-st-time_base);
-ipts = (double)ist-pts;
+ipts = ist-pts;
 if (!input_files[ist-file_index].eof_reached){
 if(ipts  ipts_min) {
 ipts_min = ipts;
-- 
1.7.3.1

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


Re: [libav-devel] [PATCH 2/2] aac: Set SBR and PS to unsignalled during headerless and ADTS initialization.

2011-08-16 Thread Alex Converse
On Wed, Aug 10, 2011 at 4:37 PM, Alex Converse alex.conve...@gmail.com wrote:
 ---
  libavcodec/aacdec.c |    2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)

 diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
 index 74a1b94..943ecd5 100644
 --- a/libavcodec/aacdec.c
 +++ b/libavcodec/aacdec.c
 @@ -579,6 +579,8 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
         sr = sample_rate_idx(avctx-sample_rate);
         ac-m4ac.sampling_index = sr;
         ac-m4ac.channels = avctx-channels;
 +        ac-m4ac.sbr = -1;
 +        ac-m4ac.ps = -1;

         for (i = 0; i  FF_ARRAY_ELEMS(ff_mpeg4audio_channels); i++)
             if (ff_mpeg4audio_channels[i] == avctx-channels)
 --
 1.7.3.1

ping?
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Use deinterleavers for demangling audio packets in RealMedia.

2011-08-16 Thread Ronald S. Bultje
Hi,

On Sat, Aug 13, 2011 at 12:02 PM, Kostya Shishkov
kostya.shish...@gmail.com wrote:
 Unlike other containers RealMedia stores its audio packets in scrambled form,
 with interleaver ID preceeding audio codec ID. Currently deinterleaving
 decision is tied to the codec while it's possible to have non-default
 deinterleaver with audio codec (like Int0 deinterleaver instead of specific
 one for Sipro).
 ---
  libavformat/rmdec.c |   44 +---
  1 files changed, 33 insertions(+), 11 deletions(-)

LGTM.

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


[libav-devel] [PATCH] mpeg12: propagate chunk decode errors and fix conditional indentation

2011-08-16 Thread Dustin Brody
---
 libavcodec/mpeg12.c |   26 ++
 1 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 91eb3f5..200289a 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1911,6 +1911,8 @@ static int slice_decode_thread(AVCodecContext *c, void 
*arg){
 //av_log(c, AV_LOG_DEBUG, ret:%d resync:%d/%d mb:%d/%d ts:%d/%d ec:%d\n,
 //ret, s-resync_mb_x, s-resync_mb_y, s-mb_x, s-mb_y, s-start_mb_y, 
s-end_mb_y, s-error_count);
 if(ret  0){
+if (c-error_recognition = FF_ER_EXPLODE)
+return AVERROR_INVALIDDATA;
 if(s-resync_mb_x=0  s-resync_mb_y=0)
 ff_er_add_slice(s, s-resync_mb_x, s-resync_mb_y, s-mb_x, 
s-mb_y, AC_ERROR|DC_ERROR|MV_ERROR);
 }else{
@@ -2265,8 +2267,10 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
 
 s-slice_count= 0;
 
-if(avctx-extradata  !avctx-frame_number)
-decode_chunks(avctx, picture, data_size, avctx-extradata, 
avctx-extradata_size);
+if(avctx-extradata  !avctx-frame_number 
+   decode_chunks(avctx, picture, data_size, avctx-extradata, 
avctx-extradata_size)  0 
+   avctx-error_recognition = FF_ER_EXPLODE)
+  return AVERROR_INVALIDDATA;
 
 return decode_chunks(avctx, picture, data_size, buf, buf_size);
 }
@@ -2318,11 +2322,13 @@ static int decode_chunks(AVCodecContext *avctx,
 switch(start_code) {
 case SEQ_START_CODE:
 if(last_code == 0){
-mpeg1_decode_sequence(avctx, buf_ptr,
-input_size);
+mpeg1_decode_sequence(avctx, buf_ptr,
+  input_size);
 s-sync=1;
 }else{
 av_log(avctx, AV_LOG_ERROR, ignoring SEQ_START_CODE after 
%X\n, last_code);
+if (avctx-error_recognition = FF_ER_EXPLODE)
+return AVERROR_INVALIDDATA;
 }
 break;
 
@@ -2351,6 +2357,8 @@ static int decode_chunks(AVCodecContext *avctx,
 last_code= PICTURE_START_CODE;
 }else{
 av_log(avctx, AV_LOG_ERROR, ignoring pic after %X\n, 
last_code);
+if (avctx-error_recognition = FF_ER_EXPLODE)
+return AVERROR_INVALIDDATA;
 }
 break;
 case EXT_START_CODE:
@@ -2362,6 +2370,8 @@ static int decode_chunks(AVCodecContext *avctx,
 mpeg_decode_sequence_extension(s);
 }else{
 av_log(avctx, AV_LOG_ERROR, ignoring seq ext after %X\n, 
last_code);
+if (avctx-error_recognition = FF_ER_EXPLODE)
+return AVERROR_INVALIDDATA;
 }
 break;
 case 0x2:
@@ -2378,6 +2388,8 @@ static int decode_chunks(AVCodecContext *avctx,
 mpeg_decode_picture_coding_extension(s);
 }else{
 av_log(avctx, AV_LOG_ERROR, ignoring pic cod ext after 
%X\n, last_code);
+if (avctx-error_recognition = FF_ER_EXPLODE)
+return AVERROR_INVALIDDATA;
 }
 break;
 }
@@ -2394,6 +2406,8 @@ static int decode_chunks(AVCodecContext *avctx,
 s-sync=1;
 }else{
 av_log(avctx, AV_LOG_ERROR, ignoring GOP_START_CODE after 
%X\n, last_code);
+if (avctx-error_recognition = FF_ER_EXPLODE)
+return AVERROR_INVALIDDATA;
 }
 break;
 default:
@@ -2438,6 +2452,8 @@ static int decode_chunks(AVCodecContext *avctx,
 
 if(!s2-pict_type){
 av_log(avctx, AV_LOG_ERROR, Missing picture start 
code\n);
+if (avctx-error_recognition = FF_ER_EXPLODE)
+return AVERROR_INVALIDDATA;
 break;
 }
 
@@ -2476,6 +2492,8 @@ static int decode_chunks(AVCodecContext *avctx,
 emms_c();
 
 if(ret  0){
+if (avctx-error_recognition = FF_ER_EXPLODE)
+return AVERROR_INVALIDDATA;
 if(s2-resync_mb_x=0  s2-resync_mb_y=0)
 ff_er_add_slice(s2, s2-resync_mb_x, 
s2-resync_mb_y, s2-mb_x, s2-mb_y, AC_ERROR|DC_ERROR|MV_ERROR);
 }else{
-- 
1.7.2.5

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


[libav-devel] PATCH: LATM muxer

2011-08-16 Thread Kieran Kunhya
Adds support for LATM muxing
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 3/3] Use parsers for RealVideo 3/4 to determine correct PTS

2011-08-16 Thread Ronald S. Bultje
Hi,

On Mon, Aug 15, 2011 at 11:43 PM, Kostya kostya.shish...@gmail.com wrote:
 On Mon, Aug 15, 2011 at 09:42:50PM +0100, Måns Rullgård wrote:
 Kostya kostya.shish...@gmail.com writes:

 [...]

 Why are most of the frames completely different?  Why is there one frame
 less decoded?

 [...]

 Here too many frames have a different checksum.  Why?

 Because of the wonderful synchronisation system Libav inherited (and maybe
 also because of wrong FPS reported).

 FATE ref for RV30 sample, for example, has only 46 frames, but when I invoke
 framecrc with -vsync 0 it decodes all real 109 frames, and those checksums are
 the same for Libav with and without my patches.

 I remember that adding proper FPS reporting made it report about actual number
 of frames too, so patch is pending.

With that patch, the output is indeed correct. Nice job.

For this patch:

 +} else {
 +if (type != 3)
 +s-pts = pc-key_dts + ((pts - pc-key_pts)  0x1FFF);
 +else
 +s-pts = pc-key_dts - ((pc-key_pts - pts)  0x1FFF);
 +}

I suppose this could use some doxy. What happens if we have a matroska
file with RV40 video? Does it need the PTS correction? Is the parser
invoked?

 +s-pict_type = type + !type;

This will subtly break if someone ever decides to change the meaning
of s-pict_type defines/enums.

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


Re: [libav-devel] [PATCH 3/3] Parse FPS in RealMedia properly

2011-08-16 Thread Ronald S. Bultje
Hi,

On Tue, Aug 16, 2011 at 12:13 AM, Kostya kostya.shish...@gmail.com wrote:
 On Tue, Aug 16, 2011 at 09:10:57AM +0200, Kostya Shishkov wrote:
 ---
  libavformat/rmdec.c      |   16 +-
  tests/ref/fate/real-rv40 |  355 
 ++
  tests/ref/fate/rv30      |  152 ++--
  3 files changed, 352 insertions(+), 171 deletions(-)

 With this patch framecrc values for test samples are the same as the values
 obtained with -vsync 0.

Nice work. Once I understand why we have a parser, it's fine with me.
I.e. this patch and first are OK.

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


[libav-devel] [PATCH] sws: implement MMX/SSE2/SSSE3/SSE4 versions for horizontal scaling.

2011-08-16 Thread Ronald S. Bultje
From: Ronald S. Bultje rsbul...@gmail.com

(Speed: scaling luma on a 1920-pixel wide movie (using the 4tap filter)
goes from ~343k cycles to 64.4k cycles (sse2), 56.3k cycles (ssse3) or
53.0k cycles (sse4), i.e. up to a ~6.5x speedup.)
---
 libswscale/Makefile   |1 +
 libswscale/x86/scale.asm  |  415 +
 libswscale/x86/swscale_mmx.c  |   85 
 libswscale/x86/swscale_template.c |  162 ---
 4 files changed, 501 insertions(+), 162 deletions(-)
 create mode 100644 libswscale/x86/scale.asm

diff --git a/libswscale/Makefile b/libswscale/Makefile
index 57e867a..5671b2e 100644
--- a/libswscale/Makefile
+++ b/libswscale/Makefile
@@ -17,6 +17,7 @@ OBJS-$(HAVE_MMX)   +=  x86/rgb2rgb.o\
x86/swscale_mmx.o\
x86/yuv2rgb_mmx.o
 OBJS-$(HAVE_VIS)   +=  sparc/yuv2rgb_vis.o
+OBJS-$(HAVE_YASM)  +=  x86/scale.o
 
 TESTPROGS = colorspace swscale
 
diff --git a/libswscale/x86/scale.asm b/libswscale/x86/scale.asm
new file mode 100644
index 000..92972aa
--- /dev/null
+++ b/libswscale/x86/scale.asm
@@ -0,0 +1,415 @@
+;**
+;* x86-optimized horizontal line scaling functions
+;* Copyright (c) 2011 Ronald S. Bultje rsbul...@gmail.com
+;*
+;* This file is part of Libav.
+;*
+;* Libav 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.
+;*
+;* Libav 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 Libav; if not, write to the Free Software
+;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+;**
+
+%include x86inc.asm
+%include x86util.asm
+
+SECTION_RODATA
+
+max_19bit_int: times 4 dd 0x7
+max_19bit_flt: times 4 dd 524287.0
+minshort:  times 8 dw 0x8000
+unicoeff:  times 4 dd 0x2000
+
+SECTION .text
+
+;-
+; horizontal line scaling
+;
+; void hscalesource_widthtointermediate_nbits_filterSize_opt
+;   (SwsContext *c, int{16,32}_t *dst,
+;int dstW, const uint{8,16}_t *src,
+;const int16_t *filter,
+;const int16_t *filterPos, int filterSize);
+;
+; Scale one horizontal line. Input is either 8-bits width or 16-bits width
+; ($source_width can be either 8, 9, 10 or 16, difference is whether we have to
+; downscale before multiplying). Filter is 14-bits. Output is either 15bits
+; (in int16_t) or 19bits (in int32_t), as given in $intermediate_nbits. Each
+; output pixel is generated from $filterSize input pixels, the position of
+; the first pixel is given in filterPos[nOutputPixel].
+;-
+
+; SCALE_FUNC source_width, intermediate_nbits, filtersize, filtersuffix, opt, 
n_args, n_xmm
+%macro SCALE_FUNC 7
+cglobal hscale%1to%2_%4_%5, %6, 7, %7
+%ifdef ARCH_X86_64
+movsxdr2, r2d
+%endif ; x86-64
+%if %2 == 19
+%if mmsize == 8 ; mmx
+mova  m2, [max_19bit_int]
+%elifidn %5, sse4
+mova  m2, [max_19bit_int]
+%else ; ssse3/sse2
+mova  m2, [max_19bit_flt]
+%endif ; mmx/sse2/ssse3/sse4
+%endif ; %2 == 19
+%if %1 == 16
+mova  m6, [minshort]
+mova  m7, [unicoeff]
+%elif %1 == 8
+pxor  m3, m3
+%endif ; %1 == 8/16
+
+%if %1 == 8
+%define movlh movd
+%define movbh movh
+%define srcmul 1
+%else ; %1 == 9-16
+%define movlh movq
+%define movbh movu
+%define srcmul 2
+%endif ; %1 == 8/9-16
+
+%ifnidn %3, X
+
+; setup loop
+%if %3 == 8
+shl   r2, 1  ; this allows *16 (i.e. now *8) in 
lea instructions for the 8-tap filter
+%define r2shr 1
+%else ; %3 == 4
+%define r2shr 0
+%endif ; %3 == 8
+lea   r4, [r4+r2*8]
+%if %2 == 15
+lea   r1, [r1+r2*(2r2shr)]
+%else ; %2 == 19
+lea   r1, [r1+r2*(4r2shr)]
+%endif ; %2 == 15/19
+lea   r5, [r5+r2*(2r2shr)]
+neg   r2
+
+.loop:
+%if %3 == 4 ; filterSize == 4 scaling
+; load 2x4 or 4x4 source pixels into m0/m1
+movsx r0, word [r5+r2*2+0]   ; filterPos[0]
+movsx r6, word [r5+r2*2+2]   ; filterPos[1]
+movlh m0, [r3+r0*srcmul] ; src[filterPos[0] + {0,1,2,3}]
+%if mmsize == 8
+movlh   

Re: [libav-devel] PATCH: LATM muxer

2011-08-16 Thread Alex Converse
On Tue, Aug 16, 2011 at 4:05 PM, Kieran Kunhya kie...@kunhya.com wrote:
 Includes the patch this time...
 --- /dev/null
 +++ b/libavformat/latmenc.c
 @@ -0,0 +1,175 @@
 +/*
 + * LATM muxer
 + * Copyright (c) 2011 Kieran Kunhya kie...@kunhya.com
 + *
 + * This file is part of Libav.
 + *
 + * Libav 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.
 + *
 + * Libav 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 Libav; if not, write to the Free Software
 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
 USA
 + */
 +
 +#include libavcodec/get_bits.h
 +#include libavcodec/put_bits.h
 +#include libavcodec/avcodec.h
 +#include libavcodec/mpeg4audio.h
 +#include libavutil/opt.h
 +#include avformat.h
 +
 +typedef struct {
 +int object_type;
 +int sample_rate_index;
 +int channel_conf;
 +int counter;
 +int mod;
 +} LATMContext;
 +
 +static const AVOption options[] = {
 +{ smc-interval, StreamMuxConfig interval.,
 +  offsetof(LATMContext, mod), FF_OPT_TYPE_INT, {.dbl = 0x0014 }, 0x0001, 
 0x, AV_OPT_FLAG_ENCODING_PARAM},
 +{ NULL },
 +};
 +
 +static const AVClass latm_muxer_class = {
 +.class_name = LATM muxer,
 +.item_name  = av_default_item_name,
 +.option = options,
 +.version= LIBAVUTIL_VERSION_INT,
 +};
 +
 +static int latm_decode_extradata(AVFormatContext *s, LATMContext *latm, 
 uint8_t *buf, int size)
 +{
 +GetBitContext gb;
 +MPEG4AudioConfig m4ac;
 +int off;
 +
 +init_get_bits(gb, buf, size * 8);
 +off = ff_mpeg4audio_get_config(m4ac, buf, size);
 +if (off  0)
 +return off;
 +skip_bits_long(gb, off);
 +latm-object_type= m4ac.object_type;

nit: you have one more space here than elsewhere

 +latm-sample_rate_index = m4ac.sampling_index;
 +latm-channel_conf  = m4ac.chan_config;
 +
 +/* FIXME: disallow formats which aren't allowed in LATM */

What kind of formats are we talking about. I'd rather libav not be
responsible for any more out of spec files.

 +
 +return 0;
 +}
 +
 +static int latm_write_header(AVFormatContext *s)
 +{
 +LATMContext *latm = s-priv_data;
 +AVCodecContext *avc = s-streams[0]-codec;
 +
 +if (avc-extradata_size  0 
 +latm_decode_extradata(s, latm, avc-extradata,
 +  avc-extradata_size)  0)
 +return -1;
 +
 +return 0;
 +}
 +
 +static int latm_write_frame_header(LATMContext *ctx, PutBitContext *bs)
 +{
 +/* AudioMuxElement */
 +put_bits(bs, 1, !!ctx-counter);
 +
 +if (!ctx-counter) {
 +/* StreamMuxConfig */
 +put_bits(bs, 1, 0); /* audioMuxVersion */
 +put_bits(bs, 1, 1); /* allStreamsSameTimeFraming */
 +put_bits(bs, 6, 0); /* numSubFrames */
 +put_bits(bs, 4, 0); /* numProgram */
 +put_bits(bs, 3, 0); /* numLayer */
 +
 +/* AudioSpecificConfig */

It looks like we are byte aligned. Why not just copy the audio
specific config? I know backward compatibile signalling is not allowed
but that should be trivial to strip off.

 +/* No one seems to set SBR flags here */
 +put_bits(bs, 5, ctx-object_type); /* AudioObjectType */

There are three types of AAC signaling setting SBR here implies
non-backward compatible signalling and requires bonus fields below.

 +put_bits(bs, 4, ctx-sample_rate_index); /* samplingFrequencyIndex */
 +put_bits(bs, 4, ctx-channel_conf); /* channelConfiguration */

Not sure if PCE is allowed in LATM but if it is you are dropping it on
the floor.

 +
 +/* GASpecificConfig */
 +put_bits(bs, 1, 0); /* frameLengthFlag (TODO: support 960 samples) */
 +put_bits(bs, 1, 0); /* dependsOnCoreCoder */
 +put_bits(bs, 1, 0); /* extensionFlag */
 +
 +put_bits(bs, 3, 0); /* frameLengthType */
 +put_bits(bs, 8, 0); /* latmBufferFullness */
 +
 +put_bits(bs, 1, 0); /* otherDataPresent */
 +put_bits(bs, 1, 0); /* crcCheckPresent */
 +}
 +
 +ctx-counter++;
 +ctx-counter %= ctx-mod;
 +
 +return 0;
 +}
 +
 +static int latm_write_packet(AVFormatContext *s, AVPacket *pkt)
 +{
 +LATMContext *ctx = s-priv_data;
 +AVIOContext *pb = s-pb;
 +PutBitContext bs;
 +int i, len;
 +uint8_t loas_header[] = \x56\xe0\x00;
 +
 +uint8_t *buf = av_malloc(pkt-size+16);
 +if (!buf)
 +return AVERROR(ENOMEM);
 +

Maybe it is best to check for an ADTS header and fail?

 +

Re: [libav-devel] [PATCH] sws: implement MMX/SSE2/SSSE3/SSE4 versions for horizontal scaling.

2011-08-16 Thread Jason Garrett-Glaser
On Tue, Aug 16, 2011 at 4:47 PM, Ronald S. Bultje rsbul...@gmail.com wrote:
 From: Ronald S. Bultje rsbul...@gmail.com

 (Speed: scaling luma on a 1920-pixel wide movie (using the 4tap filter)
 goes from ~343k cycles to 64.4k cycles (sse2), 56.3k cycles (ssse3) or
 53.0k cycles (sse4), i.e. up to a ~6.5x speedup.)

What's the speed of the original asm?

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


Re: [libav-devel] [libav-commits] lavc: add avcodec_get_type() for mapping codec_id - type.

2011-08-16 Thread Ronald S. Bultje
Hi,

On Tue, Aug 16, 2011 at 11:24 AM, Anton Khirnov g...@libav.org wrote:
 Module: libav
 Branch: master
 Commit: bca06e77e1b07f1dab04c3b9fef6fdcb62b4a401

 Author:    Anton Khirnov an...@khirnov.net
 Committer: Anton Khirnov an...@khirnov.net
 Date:      Thu Aug 11 17:45:50 2011 +0200

 lavc: add avcodec_get_type() for mapping codec_id - type.

 ---

  doc/APIchanges       |    3 +++
  libavcodec/avcodec.h |    8 
  libavcodec/utils.c   |   14 ++
  libavcodec/version.h |    4 ++--
  4 files changed, 27 insertions(+), 2 deletions(-)
[..]
     /* other specific kind of codecs (generally used for attachments) */
 +    CODEC_ID_FIRST_UNKNOWN = 0x18000,           /// A dummy ID pointing at 
 the start of various fake codecs.
     CODEC_ID_TTF= 0x18000,
[..]
 +    else if (codec_id  CODEC_ID_FIRST_UNKNOWN)
 +        return AVMEDIA_TYPE_SUBTITLE;
 +
 +    return AVMEDIA_TYPE_UNKNOWN;

AVMEDIA_TYPE_DATA?

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


Re: [libav-devel] [libav-commits] matroskaenc: implement query_codec()

2011-08-16 Thread Ronald S. Bultje
Hi.

On Tue, Aug 16, 2011 at 11:24 AM, Anton Khirnov g...@libav.org wrote:
 +    if (std_compliance  FF_COMPLIANCE_NORMAL) {                // mkv 
 theoretically supports any
 +        enum AVMediaType type = avcodec_get_type(codec_id);     // 
 video/audio through VFW/ACM
 +        if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)
 +            return 1;
 +    }

What does this do? I think you want to check that we actually can
generate a fourcc/twocc for it.

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


Re: [libav-devel] [PATCH 4/4] h264: 4:2:2 intra decoding support

2011-08-16 Thread Ronald S. Bultje
Hi,

On Tue, Aug 16, 2011 at 8:05 AM, Diego Biurrun di...@biurrun.de wrote:
 -        h-pred8x8[DC_PRED8x8     ]= FUNCC(pred8x8_dc                     , 
 depth);\
 -        h-pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc                , 
 depth);\
 -        h-pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x8_top_dc                 , 
 depth);\
 -        h-pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, 
 depth);\
 -        h-pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, 
 depth);\
 -        h-pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, 
 depth);\
 -        h-pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, 
 depth);\
 +        if (chroma_format_idc == 1) {\
 +            h-pred8x8[DC_PRED8x8     ]= FUNCC(pred8x8_dc                    
  , depth);\
 +            h-pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc               
  , depth);\
 +            h-pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x8_top_dc                
  , depth);\
 +            h-pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= 
 FUNC(pred8x8_mad_cow_dc_l0t, depth);\
 +            h-pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= 
 FUNC(pred8x8_mad_cow_dc_0lt, depth);\
 +            h-pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= 
 FUNC(pred8x8_mad_cow_dc_l00, depth);\
 +            h-pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= 
 FUNC(pred8x8_mad_cow_dc_0l0, depth);\
 +        } else {\
 +            h-pred8x8[DC_PRED8x8     ]= FUNCC(pred8x16_dc                   
  , depth);\
 +            h-pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x16_left_dc              
  , depth);\
 +            h-pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x16_top_dc               
  , depth);\
 +            h-pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= 
 FUNC(pred8x8_mad_cow_dc_l0t, depth);\
 +            h-pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= 
 FUNC(pred8x8_mad_cow_dc_0lt, depth);\
 +            h-pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= 
 FUNC(pred8x8_mad_cow_dc_l00, depth);\
 +            h-pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= 
 FUNC(pred8x8_mad_cow_dc_0l0, depth);\
 +        }\

Typo? The last 4 should be 8x16, not 8x8.

I believe the neon code misses the if (chroma == 1) additions to the
8x8 prediction init code. They should be added, else fate will fail on
arm devices.

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