Re: [libav-devel] [PATCH] [RFC] configure: Split host and target libc detection

2013-11-28 Thread Martin Storsjö

On Thu, 28 Nov 2013, Diego Biurrun wrote:


On Thu, Nov 28, 2013 at 10:48:00AM +0200, Martin Storsjö wrote:

On Wed, 27 Nov 2013, Diego Biurrun wrote:

On Wed, Nov 27, 2013 at 10:15:09PM +0200, Martin Storsjö wrote:

On Wed, 27 Nov 2013, Diego Biurrun wrote:

--- a/configure
+++ b/configure
@@ -3355,45 +3380,52 @@ esac
+add_${pfx}cppflags -U__STRICT_ANSI__
+elif check_${pfx}func_headers stdlib.h _get_doserrno; then
+eval ${pfx}libc_type=msvcrt
+add_compat strtod.o strtod=avpriv_strtod
+add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf   \
+ _snprintf=avpriv_snprintf  \
+ vsnprintf=avpriv_vsnprintf


Things like add_compat here (and below) should only be done if this
is the target libc, not if it's the host one. In general, every
single action (add/set/whatever) in this needs to include $pfx in
one way or another, otherwise it's doing something wrong.


When using msvc as host compiler this is not necessary?


Well, add_compat only adds the objects to be used in target
complication anyway, so calling that based on the host libc
detection is just broken anyway.

Apparently we've been able to cope just fine without these with MSVC
as host compiler so far. They are only added in the target
compilation to amend the existing strtod/snprintf implementations to
comply with more corner cases that we don't exercise in the host
tools. For strtod, it's about parsing hex literal strings (which
strtol can handle but not strtod in both msvcrt and bionic) - and I
don't think any of the host tools use that feature. For snprintf,
it's about getting the right semantics in case the buffer overflows
(the msvcrt implementation doesn't null terminate it in this case,
which the C standard says it should). So for target compilation,
it's needed because otherwise a whole lot of string handling
suddenly would be insecure. For host building, you're not (quite as
much at least) exposed to the threat of any random incoming data,
but only to the threat of what's in the libav source itself.


So basically we don't need it now and can maybe or even probably get
away with cutting a corner here, at least for the foreseeable future.
Still it would be cleaner to apply this to both host and target
compilation.


Cleaner perhaps, but I'd rather postpone that to a later patch instead of 
growing the scope of this patch to larger proportions anyway. This patch 
is not dead-trivial as it is anyway, and the more bells and whistles we 
add to it, the harder it gets to review and to say with good confidence 
that it's ok. And it's not needed probably any time soon anyway.


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


Re: [libav-devel] [PATCH] [RFC] configure: Split host and target libc detection

2013-11-28 Thread Diego Biurrun
On Thu, Nov 28, 2013 at 10:48:00AM +0200, Martin Storsjö wrote:
> On Wed, 27 Nov 2013, Diego Biurrun wrote:
> >On Wed, Nov 27, 2013 at 10:15:09PM +0200, Martin Storsjö wrote:
> >>On Wed, 27 Nov 2013, Diego Biurrun wrote:
> >>>--- a/configure
> >>>+++ b/configure
> >>>@@ -3355,45 +3380,52 @@ esac
> >>>+add_${pfx}cppflags -U__STRICT_ANSI__
> >>>+elif check_${pfx}func_headers stdlib.h _get_doserrno; then
> >>>+eval ${pfx}libc_type=msvcrt
> >>>+add_compat strtod.o strtod=avpriv_strtod
> >>>+add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf   \
> >>>+ _snprintf=avpriv_snprintf  \
> >>>+ vsnprintf=avpriv_vsnprintf
> >>
> >>Things like add_compat here (and below) should only be done if this
> >>is the target libc, not if it's the host one. In general, every
> >>single action (add/set/whatever) in this needs to include $pfx in
> >>one way or another, otherwise it's doing something wrong.
> >
> >When using msvc as host compiler this is not necessary?
> 
> Well, add_compat only adds the objects to be used in target
> complication anyway, so calling that based on the host libc
> detection is just broken anyway.
> 
> Apparently we've been able to cope just fine without these with MSVC
> as host compiler so far. They are only added in the target
> compilation to amend the existing strtod/snprintf implementations to
> comply with more corner cases that we don't exercise in the host
> tools. For strtod, it's about parsing hex literal strings (which
> strtol can handle but not strtod in both msvcrt and bionic) - and I
> don't think any of the host tools use that feature. For snprintf,
> it's about getting the right semantics in case the buffer overflows
> (the msvcrt implementation doesn't null terminate it in this case,
> which the C standard says it should). So for target compilation,
> it's needed because otherwise a whole lot of string handling
> suddenly would be insecure. For host building, you're not (quite as
> much at least) exposed to the threat of any random incoming data,
> but only to the threat of what's in the libav source itself.

So basically we don't need it now and can maybe or even probably get
away with cutting a corner here, at least for the foreseeable future.
Still it would be cleaner to apply this to both host and target
compilation.

> So unless there's some real need, I wouldn't try to expand the
> add_compat framework for host building yet. (Hint: It's a little
> more work than you'd expect - you'd need to build these object files
> as compat/strtod_host.o or so, to separate them from the compat objs
> for the target.)

Oh, I'm aware of the need to build (some of) the object files for the
host again.  I just stumbled across this very problem in my dvenc split
patch, which breaks when crossbuilding x86_32 on x86_64, since the dv
data tables are then in an object file needed both by the target lib
and the host hardcoded tables generator.

So maybe the time has come to allow building some of those object
files twice.

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


Re: [libav-devel] [PATCH 9/9] changelog: drop redundant new attribute

2013-11-28 Thread Diego Biurrun
On Thu, Nov 28, 2013 at 03:03:06PM +0100, Vittorio Giovara wrote:
> ---
>  Changelog |8 
>  1 file changed, 4 insertions(+), 4 deletions(-)

LGTM

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


Re: [libav-devel] [PATCH 1/9] dcadec: implement request_channel_layout.

2013-11-28 Thread Tim W.
On 28 Nov 2013, at 22:07, Anton Khirnov  wrote:

> 
> On Sun, 24 Nov 2013 00:20:05 +0100, Tim Walker  wrote:
>> ---
>> libavcodec/dcadec.c | 24 +++-
>> 1 file changed, 19 insertions(+), 5 deletions(-)
>> 
> 
> Approved by Benjamin on IRC and pushed.

Cool. I think now would be a good time to re-submit "FATE: add a test for DTS 
downmixing." :-)

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


Re: [libav-devel] [PATCH 4/9] mpeg12dec: parse frame packing arrangment user_data and save relevant stereo3d information

2013-11-28 Thread Diego Biurrun
arrang_e_ment

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


Re: [libav-devel] [PATCH 1/9] dcadec: implement request_channel_layout.

2013-11-28 Thread Anton Khirnov

On Sun, 24 Nov 2013 00:20:05 +0100, Tim Walker  wrote:
> ---
>  libavcodec/dcadec.c | 24 +++-
>  1 file changed, 19 insertions(+), 5 deletions(-)
> 

Approved by Benjamin on IRC and pushed.

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


Re: [libav-devel] [PATCH] img2: add stereo 3d still picture file extensions

2013-11-28 Thread Luca Barbato
On 28/11/13 16:10, Vittorio Giovara wrote:
> From: Martin Lambers 
> 

Ok.

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


[libav-devel] [PATCH] avcodec: Use av_reallocp where suitable

2013-11-28 Thread Alexandra Khirnova
---
 libavcodec/binkaudio.c|   10 +-
 libavcodec/bitstream.c|   10 +++---
 libavcodec/eatgv.c|4 +++-
 libavcodec/flashsv.c  |   29 +
 libavcodec/g2meet.c   |   17 ++---
 libavcodec/h264_mp4toannexb_bsf.c |   19 +++
 libavcodec/libmp3lame.c   |   10 +++---
 libavcodec/libschroedingerenc.c   |9 +++--
 libavcodec/libtheoraenc.c |   10 +-
 libavcodec/libvpxenc.c|   10 ++
 libavcodec/shorten.c  |   27 ++-
 libavcodec/zmbv.c |   16 +++-
 12 files changed, 79 insertions(+), 92 deletions(-)

diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c
index ddaa613..d0d58d5 100644
--- a/libavcodec/binkaudio.c
+++ b/libavcodec/binkaudio.c
@@ -293,7 +293,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
 int ret, consumed = 0;
 
 if (!get_bits_left(gb)) {
-uint8_t *buf;
+int err;
 /* handle end-of-stream */
 if (!avpkt->size) {
 *got_frame_ptr = 0;
@@ -303,10 +303,10 @@ static int decode_frame(AVCodecContext *avctx, void *data,
 av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
 return AVERROR_INVALIDDATA;
 }
-buf = av_realloc(s->packet_buffer, avpkt->size + 
FF_INPUT_BUFFER_PADDING_SIZE);
-if (!buf)
-return AVERROR(ENOMEM);
-s->packet_buffer = buf;
+if ((err = av_reallocp(&s->packet_buffer,
+   avpkt->size +
+   FF_INPUT_BUFFER_PADDING_SIZE)) < 0)
+return err;
 memcpy(s->packet_buffer, avpkt->data, avpkt->size);
 init_get_bits(gb, s->packet_buffer, avpkt->size * 8);
 consumed = avpkt->size;
diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index e7c476b..22521e1 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -106,12 +106,16 @@ static int alloc_table(VLC *vlc, int size, int use_static)
 
 vlc->table_size += size;
 if (vlc->table_size > vlc->table_allocated) {
+int err;
 if (use_static)
 return AVERROR_BUG;
 vlc->table_allocated += (1 << vlc->bits);
-vlc->table = av_realloc(vlc->table, sizeof(VLC_TYPE) * 2 * 
vlc->table_allocated);
-if (!vlc->table)
-return AVERROR(ENOMEM);
+if ((err = av_reallocp(&vlc->table,
+   sizeof(VLC_TYPE) * 2 *
+   vlc->table_allocated)) < 0) {
+vlc->table_allocated = 0;
+return err;
+}
 }
 return index;
 }
diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c
index 7ab18c5..0129636 100644
--- a/libavcodec/eatgv.c
+++ b/libavcodec/eatgv.c
@@ -178,7 +178,9 @@ static int tgv_decode_inter(TgvContext *s, AVFrame *frame,
 }
 
 if (num_blocks_packed > s->num_blocks_packed) {
-s->block_codebook = av_realloc(s->block_codebook, 
num_blocks_packed*16);
+int err;
+if ((err = av_reallocp(&s->block_codebook, num_blocks_packed * 16)) < 
0)
+return err;
 s->num_blocks_packed = num_blocks_packed;
 }
 
diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c
index a6e8dae..92b32f7 100644
--- a/libavcodec/flashsv.c
+++ b/libavcodec/flashsv.c
@@ -296,13 +296,11 @@ static int flashsv_decode_frame(AVCodecContext *avctx, 
void *data,
 /* the block size could change between frames, make sure the buffer
  * is large enough, if not, get a larger one */
 if (s->block_size < s->block_width * s->block_height) {
-int tmpblock_size = 3 * s->block_width * s->block_height;
+int tmpblock_size = 3 * s->block_width * s->block_height, err;
 
-s->tmpblock = av_realloc(s->tmpblock, tmpblock_size);
-if (!s->tmpblock) {
-av_log(avctx, AV_LOG_ERROR,
-   "Cannot allocate decompression buffer.\n");
-return AVERROR(ENOMEM);
+if ((err = av_reallocp(&s->tmpblock, tmpblock_size)) < 0) {
+av_log(avctx, AV_LOG_ERROR, "Cannot allocate decompression 
buffer.\n");
+return err;
 }
 if (s->ver == 2) {
 s->deflate_block_size = calc_deflate_block_size(tmpblock_size);
@@ -311,12 +309,9 @@ static int flashsv_decode_frame(AVCodecContext *avctx, 
void *data,
"Cannot determine deflate buffer size.\n");
 return -1;
 }
-s->deflate_block = av_realloc(s->deflate_block,
-  s->deflate_block_size);
-if (!s->deflate_block) {
-av_log(avctx, AV_LOG_ERROR,
-   "Cannot allocate deflate buffer.\n");
-return AVERROR(ENOMEM);
+if ((err = av_reallocp(&s->deflate_block, s->deflate_block_size)) 
< 0) {
+ 

[libav-devel] [PATCH] img2: add stereo 3d still picture file extensions

2013-11-28 Thread Vittorio Giovara
From: Martin Lambers 

---
 libavformat/img2.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/img2.c b/libavformat/img2.c
index 3b49a32..493df6d 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -31,8 +31,11 @@ typedef struct {
 static const IdStrMap img_tags[] = {
 { AV_CODEC_ID_MJPEG,  "jpeg" },
 { AV_CODEC_ID_MJPEG,  "jpg"  },
+{ AV_CODEC_ID_MJPEG,  "jps"  },
+{ AV_CODEC_ID_MJPEG,  "mpo"  },
 { AV_CODEC_ID_LJPEG,  "ljpg" },
 { AV_CODEC_ID_PNG,"png"  },
+{ AV_CODEC_ID_PNG,"pns"  },
 { AV_CODEC_ID_PNG,"mng"  },
 { AV_CODEC_ID_PPM,"ppm"  },
 { AV_CODEC_ID_PPM,"pnm"  },
-- 
1.7.9.5

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


Re: [libav-devel] [PATCH] x86: dsputil: Suppress deprecation warnings for XvMC bits

2013-11-28 Thread Vittorio Giovara
On Mon, Nov 25, 2013 at 8:57 PM, Diego Biurrun  wrote:
> These parts are scheduled for removal on the next version bump.

Queued, thanks.
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 7/9] lavfi: add new framepack filter

2013-11-28 Thread Vittorio Giovara
---
 Changelog  |1 +
 doc/filters.texi   |   19 ++
 libavfilter/Makefile   |1 +
 libavfilter/allfilters.c   |1 +
 libavfilter/version.h  |4 +-
 libavfilter/vf_framepack.c |  488 
 6 files changed, 512 insertions(+), 2 deletions(-)
 create mode 100644 libavfilter/vf_framepack.c

diff --git a/Changelog b/Changelog
index 78b3338..5a47b18 100644
--- a/Changelog
+++ b/Changelog
@@ -51,6 +51,7 @@ version 10:
 - support for decoding through VDPAU in avconv (the -hwaccel option)
 - remove mp3_header_(de)compress bitstream filters
 - codec level stereoscopic metadata handling
+- framepack filter
 
 
 version 9:
diff --git a/doc/filters.texi b/doc/filters.texi
index b32aad1..04779bc 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1252,6 +1252,25 @@ frames with a negative PTS.
 
 @end table
 
+@section framepack
+
+Packs two different video streams into a stereoscopic video. The two videos
+should have the same size and framerate; you may conveniently adjust those
+values with the @ref{scale} and @ref{fps} filters. If one video lasts longer
+than the other, the last frame is repeated.
+
+This filter also sets proper signalling on supported codecs.
+
+This filter accepts the following named parameters:
+@table @option
+
+@item format
+Desired framepacking format. Supported values are @var{2d} (default),
+@var{sbs}, @var{sbsqnx}, @var{tab}, @var{lines}, @var{columns}, 
@var{frameseq}, @var{check}.
+See a detailed format description in @file{libavutil/stereo3d.h}.
+
+@end table
+
 @anchor{frei0r}
 @section frei0r
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 96fa8c0..92c1561 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -54,6 +54,7 @@ OBJS-$(CONFIG_FADE_FILTER)   += vf_fade.o
 OBJS-$(CONFIG_FIELDORDER_FILTER) += vf_fieldorder.o
 OBJS-$(CONFIG_FORMAT_FILTER) += vf_format.o
 OBJS-$(CONFIG_FPS_FILTER)+= vf_fps.o
+OBJS-$(CONFIG_FRAMEPACK_FILTER)  += vf_framepack.o
 OBJS-$(CONFIG_FREI0R_FILTER) += vf_frei0r.o
 OBJS-$(CONFIG_GRADFUN_FILTER)+= vf_gradfun.o
 OBJS-$(CONFIG_HFLIP_FILTER)  += vf_hflip.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index f041f5c..9702a0a 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -74,6 +74,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(FIELDORDER, fieldorder, vf);
 REGISTER_FILTER(FORMAT, format, vf);
 REGISTER_FILTER(FPS,fps,vf);
+REGISTER_FILTER(FRAMEPACK,  framepack,  vf);
 REGISTER_FILTER(FREI0R, frei0r, vf);
 REGISTER_FILTER(GRADFUN,gradfun,vf);
 REGISTER_FILTER(HFLIP,  hflip,  vf);
diff --git a/libavfilter/version.h b/libavfilter/version.h
index bc079b4..3f7d9dc 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -30,8 +30,8 @@
 #include "libavutil/avutil.h"
 
 #define LIBAVFILTER_VERSION_MAJOR  3
-#define LIBAVFILTER_VERSION_MINOR  11
-#define LIBAVFILTER_VERSION_MICRO  1
+#define LIBAVFILTER_VERSION_MINOR  12
+#define LIBAVFILTER_VERSION_MICRO  0
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
diff --git a/libavfilter/vf_framepack.c b/libavfilter/vf_framepack.c
new file mode 100644
index 000..35f5656
--- /dev/null
+++ b/libavfilter/vf_framepack.c
@@ -0,0 +1,488 @@
+/*
+ * Copyright (c) 2013 Vittorio Giovara
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * Generate a frame packed video, by combining two views in a single surface.
+ */
+
+#include "libavutil/common.h"
+#include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/rational.h"
+#include "libavutil/stereo3d.h"
+
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
+
+#define LEFT_VIEW  0
+#define RIGHT_VIEW 1
+
+typedef struct FramepackContext {
+const AVClass *class;
+
+const AVPixFmtDescriptor *pix_desc; ///< agreed pixel format
+
+enum AVStereo3DType format; 

[libav-devel] [PATCH 5/9] mpeg12enc: set frame packing information when relevant metadata is found

2013-11-28 Thread Vittorio Giovara
---
 libavcodec/mpeg12enc.c |   41 +
 1 file changed, 41 insertions(+)

diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 2e03ce3..6c4ef6d 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -30,6 +30,8 @@
 #include "libavutil/attributes.h"
 #include "libavutil/log.h"
 #include "libavutil/opt.h"
+#include "libavutil/stereo3d.h"
+
 #include "avcodec.h"
 #include "bytestream.h"
 #include "mathops.h"
@@ -350,6 +352,7 @@ void ff_mpeg1_encode_slice_header(MpegEncContext *s)
 
 void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
 {
+AVFrameSideData *side_data;
 mpeg1_encode_sequence_header(s);
 
 /* mpeg1 picture header */
@@ -433,6 +436,44 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int 
picture_number)
 for (i = 0; i < sizeof(svcd_scan_offset_placeholder); i++)
 put_bits(&s->pb, 8, svcd_scan_offset_placeholder[i]);
 }
+side_data = av_frame_get_side_data(&s->current_picture_ptr->f,
+   AV_FRAME_DATA_STEREO3D);
+if (side_data) {
+AVStereo3D *stereo = (AVStereo3D *)side_data->data;
+uint8_t fpa_type;
+
+switch (stereo->type) {
+case AV_STEREO3D_SIDEBYSIDE:
+fpa_type = 0x03;
+break;
+case AV_STEREO3D_TOPBOTTOM:
+fpa_type = 0x04;
+break;
+case AV_STEREO3D_2D:
+fpa_type = 0x08;
+break;
+case AV_STEREO3D_SIDEBYSIDE_QUINCUNX:
+fpa_type = 0x23;
+break;
+default:
+fpa_type = 0;
+break;
+}
+
+if (fpa_type != 0) {
+put_header(s, USER_START_CODE);
+put_bits(&s->pb, 8, 'J');   // 
S3D_video_format_signaling_identifier
+put_bits(&s->pb, 8, 'P');
+put_bits(&s->pb, 8, '3');
+put_bits(&s->pb, 8, 'D');
+put_bits(&s->pb, 8, 0x03);  // S3D_video_format_length
+
+put_bits(&s->pb, 1, 1); // reserved_bit
+put_bits(&s->pb, 7, fpa_type); // S3D_video_format_type
+put_bits(&s->pb, 8, 0x04);  // reserved_data[0]
+put_bits(&s->pb, 8, 0xFF);  // reserved_data[1]
+}
+}
 
 s->mb_y = 0;
 ff_mpeg1_encode_slice_header(s);
-- 
1.7.9.5

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


[libav-devel] [PATCH 9/9] changelog: drop redundant new attribute

2013-11-28 Thread Vittorio Giovara
---
 Changelog |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Changelog b/Changelog
index 5a47b18..468fdef 100644
--- a/Changelog
+++ b/Changelog
@@ -7,13 +7,13 @@ version 10:
 - reference-counting for AVFrame and AVPacket data
 - avconv now fails when input options are used for output file
   or vice versa
-- new avconv options -filter_script and -filter_complex_script, which allow a
+- avconv options -filter_script and -filter_complex_script, which allow a
   filtergraph description to be read from a file
 - uniform options syntax across all filters
-- new interlace filter
+- interlace filter
 - JPEG 2000 decoder
-- new asetpts filter (same as setpts, but for audio)
-- new trim and atrim filters
+- asetpts filter (same as setpts, but for audio)
+- trim and atrim filters
 - avconv -t and -ss (output-only) options are now sample-accurate when
   transcoding audio
 - Matroska muxer can now put the index at the beginning of the file.
-- 
1.7.9.5

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


[libav-devel] [PATCH 1/9] avframe: add codec-independent stereoscopic metadata

2013-11-28 Thread Vittorio Giovara
---
 Changelog|1 +
 doc/APIchanges   |4 ++
 libavutil/Makefile   |2 +
 libavutil/frame.h|4 ++
 libavutil/stereo3d.c |   53 ++
 libavutil/stereo3d.h |  152 ++
 libavutil/version.h  |2 +-
 7 files changed, 217 insertions(+), 1 deletion(-)
 create mode 100644 libavutil/stereo3d.c
 create mode 100644 libavutil/stereo3d.h

diff --git a/Changelog b/Changelog
index 9747720..78b3338 100644
--- a/Changelog
+++ b/Changelog
@@ -50,6 +50,7 @@ version 10:
 - VP9 decoder
 - support for decoding through VDPAU in avconv (the -hwaccel option)
 - remove mp3_header_(de)compress bitstream filters
+- codec level stereoscopic metadata handling
 
 
 version 9:
diff --git a/doc/APIchanges b/doc/APIchanges
index 1e380e9..cef97f2 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,10 @@ libavutil: 2012-10-22
 
 API changes, most recent first:
 
+2013-11-xx - xxx- - lavu 52.20.0 - frame.h
+  Add AV_FRAME_DATA_STEREO3D value to the AVFrameSideDataType enum, which
+  identifies codec-independent stereo3d information.
+
 2013-11-xx - xxx- - lavu 52.19.0 - frame.h
   Add AV_FRAME_DATA_A53_CC value to the AVFrameSideDataType enum, which
   identifies ATSC A53 Part 4 Closed Captions data.
diff --git a/libavutil/Makefile b/libavutil/Makefile
index 9381c77..a635725 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -41,6 +41,7 @@ HEADERS = adler32.h   
  \
   rational.h\
   samplefmt.h   \
   sha.h \
+  stereo3d.h\
   time.h\
   version.h \
   xtea.h\
@@ -93,6 +94,7 @@ OBJS = adler32.o  
  \
rc4.o\
samplefmt.o  \
sha.o\
+   stereo3d.o   \
time.o   \
tree.o   \
utils.o  \
diff --git a/libavutil/frame.h b/libavutil/frame.h
index d869d83..e4e57a0 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -41,6 +41,10 @@ enum AVFrameSideDataType {
  * The number of bytes of CC data is AVFrameSideData.size.
  */
 AV_FRAME_DATA_A53_CC,
+/**
+ * Codec independent stereo3d metadata, defined in libavutil/stereo3d.h.
+ */
+AV_FRAME_DATA_STEREO3D,
 };
 
 typedef struct AVFrameSideData {
diff --git a/libavutil/stereo3d.c b/libavutil/stereo3d.c
new file mode 100644
index 000..559b43d
--- /dev/null
+++ b/libavutil/stereo3d.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2013 Vittorio Giovara 
+ *
+ * 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 
+
+#include "common.h"
+#include "stereo3d.h"
+
+AVStereo3D *av_stereo3d_alloc(void)
+{
+AVStereo3D *data = av_mallocz(sizeof(*data));
+
+if (!data)
+return NULL;
+
+return data;
+}
+
+void av_stereo3d_free(AVStereo3D **data)
+{
+if (!data || !*data)
+return;
+
+av_freep(data);
+}
+
+AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame)
+{
+AVFrameSideData *side_data = av_frame_new_side_data(frame,
+AV_FRAME_DATA_STEREO3D,
+sizeof(AVStereo3D));
+if (!side_data)
+return NULL;
+
+return (AVStereo3D *)side_data->data;
+}
diff --git a/libavutil/stereo3d.h b/libavutil/stereo3d.h
new file mode 100644
index 000..31f4ae7
--- /dev/null
+++ b/libavutil/stereo3d.h
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2013 Vittorio Giova

[libav-devel] [PATCH 4/9] mpeg12dec: parse frame packing arrangment user_data and save relevant stereo3d information

2013-11-28 Thread Vittorio Giovara
---
 libavcodec/mpeg12dec.c |   63 +++-
 1 file changed, 51 insertions(+), 12 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 9d0c3be..633bbcf 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -27,6 +27,7 @@
 
 #include "libavutil/attributes.h"
 #include "libavutil/internal.h"
+#include "libavutil/stereo3d.h"
 #include "internal.h"
 #include "avcodec.h"
 #include "dsputil.h"
@@ -2108,18 +2109,56 @@ static void mpeg_decode_user_data(AVCodecContext *avctx,
 const uint8_t *buf_end = p + buf_size;
 
 /* we parse the DTG active format information */
-if (buf_end - p >= 5 &&
-p[0] == 'D' && p[1] == 'T' && p[2] == 'G' && p[3] == '1') {
-int flags = p[4];
-p += 5;
-if (flags & 0x80) {
-/* skip event id */
-p += 2;
-}
-if (flags & 0x40) {
-if (buf_end - p < 1)
-return;
-avctx->dtg_active_format = p[0] & 0x0f;
+if (buf_end - p >= 5) {
+if (p[0] == 'D' &&
+p[1] == 'T' &&
+p[2] == 'G' &&
+p[3] == '1') {
+int flags = p[4];
+p += 5;
+if (flags & 0x80) {
+/* skip event id */
+p += 2;
+}
+if (flags & 0x40) {
+if (buf_end - p < 1)
+return;
+avctx->dtg_active_format = p[0] & 0x0f;
+}
+} else if (p[0] == 'J' &&
+   p[1] == 'P' &&
+   p[2] == '3' &&
+   p[3] == 'D') {
+if (p[4] == 0x03) { // S3D_video_format_length
+// the mask ignores reserved_bit
+const uint8_t S3D_video_format_type = p[5] & 0x7F;
+
+if (S3D_video_format_type == 0x03 ||
+S3D_video_format_type == 0x04 ||
+S3D_video_format_type == 0x08 ||
+S3D_video_format_type == 0x23) {
+Mpeg1Context *s1   = avctx->priv_data;
+MpegEncContext *s  = &s1->mpeg_enc_ctx;
+AVStereo3D *stereo = 
av_stereo3d_create_side_data(&s->current_picture_ptr->f);
+if (!stereo)
+return;
+
+switch (S3D_video_format_type) {
+case 0x03:
+stereo->type = AV_STEREO3D_SIDEBYSIDE;
+break;
+case 0x04:
+stereo->type = AV_STEREO3D_TOPBOTTOM;
+break;
+case 0x08:
+stereo->type = AV_STEREO3D_2D;
+break;
+case 0x23:
+stereo->type = AV_STEREO3D_SIDEBYSIDE_QUINCUNX;
+break;
+}
+}
+}
 }
 } else if (mpeg_decode_a53_cc(avctx, p, buf_size)) {
 return;
-- 
1.7.9.5

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


[libav-devel] [PATCH 2/9] h264: parse frame packing arrangement SEI messages and save relevant stereo3d information

2013-11-28 Thread Vittorio Giovara
---
 libavcodec/h264.c |   41 +
 libavcodec/h264.h |   11 ++-
 libavcodec/h264_sei.c |   40 
 3 files changed, 91 insertions(+), 1 deletion(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 86d453b..29a6960 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -27,6 +27,7 @@
 
 #include "libavutil/avassert.h"
 #include "libavutil/imgutils.h"
+#include "libavutil/stereo3d.h"
 #include "internal.h"
 #include "cabac.h"
 #include "cabac_functions.h"
@@ -2029,6 +2030,46 @@ static void decode_postinit(H264Context *h, int 
setup_finished)
 }
 }
 
+if (h->sei_frame_packing_present &&
+h->frame_packing_arrangement_type >= 0 &&
+h->frame_packing_arrangement_type <= 6 &&
+h->content_interpretation_type > 0 &&
+h->content_interpretation_type < 3) {
+AVStereo3D *stereo = av_stereo3d_create_side_data(&cur->f);
+if (!stereo)
+return;
+
+switch (h->frame_packing_arrangement_type) {
+case 0:
+stereo->type = AV_STEREO3D_CHECKERBOARD;
+break;
+case 1:
+stereo->type = AV_STEREO3D_LINES;
+break;
+case 2:
+stereo->type = AV_STEREO3D_COLUMNS;
+break;
+case 3:
+if (h->quincunx_subsampling)
+stereo->type = AV_STEREO3D_SIDEBYSIDE_QUINCUNX;
+else
+stereo->type = AV_STEREO3D_SIDEBYSIDE;
+break;
+case 4:
+stereo->type = AV_STEREO3D_TOPBOTTOM;
+break;
+case 5:
+stereo->type = AV_STEREO3D_FRAMESEQUENCE;
+break;
+case 6:
+stereo->type = AV_STEREO3D_2D;
+break;
+}
+
+if (h->content_interpretation_type == 2)
+stereo->flags = AV_STEREO3D_FLAG_INVERT;
+}
+
 // FIXME do something with unavailable reference frames
 
 /* Sort B-frames into display order */
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 920e3fc..a828bf9 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -123,7 +123,8 @@ typedef enum {
 SEI_BUFFERING_PERIOD= 0,   ///< buffering period (H.264, D.1.1)
 SEI_TYPE_PIC_TIMING = 1,   ///< picture timing
 SEI_TYPE_USER_DATA_UNREGISTERED = 5,   ///< unregistered user data
-SEI_TYPE_RECOVERY_POINT = 6///< recovery point (frame # to 
decoder sync)
+SEI_TYPE_RECOVERY_POINT = 6,   ///< recovery point (frame # to 
decoder sync)
+SEI_TYPE_FRAME_PACKING  = 45,  ///< frame packing arrangement
 } SEI_Type;
 
 /**
@@ -586,6 +587,14 @@ typedef struct H264Context {
 int prev_interlaced_frame;
 
 /**
+ * frame_packing_arrangment SEI message
+ */
+int sei_frame_packing_present;
+int frame_packing_arrangement_type;
+int content_interpretation_type;
+int quincunx_subsampling;
+
+/**
  * Bit set of clock types for fields/frames in picture timing SEI message.
  * For each found ct_type, appropriate bit is set (e.g., bit 1 for
  * interlaced).
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 27a2c76..746c213 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -42,6 +42,7 @@ void ff_h264_reset_sei(H264Context *h)
 h->sei_dpb_output_delay =  0;
 h->sei_cpb_removal_delay= -1;
 h->sei_buffering_period_present =  0;
+h->sei_frame_packing_present=  0;
 }
 
 static int decode_picture_timing(H264Context *h)
@@ -175,6 +176,40 @@ static int decode_buffering_period(H264Context *h)
 return 0;
 }
 
+static int decode_frame_packing_arrangement(H264Context *h)
+{
+int cancel;
+int quincunx =  0;
+int content  = -1;
+int type = -1;
+
+get_ue_golomb(&h->gb);  // frame_packing_arrangement_id
+cancel = get_bits1(&h->gb); // 
frame_packing_arrangement_cancel_flag
+if (cancel == 0) {
+type = get_bits(&h->gb, 7); // frame_packing_arrangement_type
+quincunx = get_bits1(&h->gb);   // quincunx_sampling_flag
+content = get_bits(&h->gb, 6);  // content_interpretation_type
+
+// the following skips: spatial_flipping_flag, frame0_flipped_flag,
+// field_views_flag, current_frame_is_frame0_flag,
+// frame0_self_contained_flag, frame1_self_contained_flag
+skip_bits(&h->gb, 6);
+
+if (quincunx == 0 && type != 5)
+skip_bits(&h->gb, 16);  // frame[01]_grid_position_[xy]
+skip_bits(&h->gb, 8);   // 
frame_packing_arrangement_reserved_byte
+get_ue_golomb(&h->gb);  // 
frame_packing_arrangement_repetition_period
+}
+skip_bits1(&h->gb); // 
frame_packing_arrangement_extension_flag
+
+h->sei_frame_packing_present  = (cancel == 0);
+h->frame_packing_arrangement_type = type;
+h->content_interp

[libav-devel] [PATCH 8/9] fate: add framepack filter test

2013-11-28 Thread Vittorio Giovara
---
 tests/fate/filter-video.mak |4 +++
 tests/filtergraphs/framepack|3 +++
 tests/ref/fate/filter-framepack |   52 +++
 3 files changed, 59 insertions(+)
 create mode 100644 tests/filtergraphs/framepack
 create mode 100644 tests/ref/fate/filter-framepack

diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index 4191af3..b3e9eee 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -24,6 +24,10 @@ fate-filter-fade: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf 
fade=in:0:25,fade=out
 FATE_FILTER_VSYNTH-$(call ALLYES, INTERLACE_FILTER FIELDORDER_FILTER) += 
fate-filter-fieldorder
 fate-filter-fieldorder: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf 
interlace=tff,fieldorder=bff -sws_flags +accurate_rnd+bitexact
 
+FATE_FILTER_VSYNTH-$(CONFIG_FRAMEPACK_FILTER) += fate-filter-framepack
+fate-filter-framepack: tests/data/filtergraphs/framepack
+fate-filter-framepack: CMD = framecrc -c:v pgmyuv -i $(SRC) -c:v pgmyuv -i 
$(SRC) -filter_complex_script $(TARGET_PATH)/tests/data/filtergraphs/framepack
+
 FATE_FILTER_VSYNTH-$(CONFIG_GRADFUN_FILTER) += fate-filter-gradfun
 fate-filter-gradfun: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf gradfun
 
diff --git a/tests/filtergraphs/framepack b/tests/filtergraphs/framepack
new file mode 100644
index 000..a2501af
--- /dev/null
+++ b/tests/filtergraphs/framepack
@@ -0,0 +1,3 @@
+[1:v][0:v] framepack=sbs [sbs];
+[0:v][1:v] framepack=columns [columns];
+[sbs][columns] framepack=frameseq
diff --git a/tests/ref/fate/filter-framepack b/tests/ref/fate/filter-framepack
new file mode 100644
index 000..30c3160
--- /dev/null
+++ b/tests/ref/fate/filter-framepack
@@ -0,0 +1,52 @@
+#tb 0: 1/50
+0,  0,  0,1,   304128, 0x901a13ed
+0,  1,  1,1,   304128, 0x8cde13ed
+0,  2,  2,1,   304128, 0xc97fcaa2
+0,  3,  3,1,   304128, 0x8139eca3
+0,  4,  4,1,   304128, 0x295c016f
+0,  5,  5,1,   304128, 0x813a6cb3
+0,  6,  6,1,   304128, 0x0e1b51db
+0,  7,  7,1,   304128, 0x0c46f846
+0,  8,  8,1,   304128, 0xdf281767
+0,  9,  9,1,   304128, 0xfc37005b
+0, 10, 10,1,   304128, 0x0be5722a
+0, 11, 11,1,   304128, 0xc1618ec0
+0, 12, 12,1,   304128, 0xc6f0f9b9
+0, 13, 13,1,   304128, 0x6f015ad1
+0, 14, 14,1,   304128, 0xf17e4455
+0, 15, 15,1,   304128, 0xbcb31bc9
+0, 16, 16,1,   304128, 0x95891e0a
+0, 17, 17,1,   304128, 0xeacf9c30
+0, 18, 18,1,   304128, 0x8cca7190
+0, 19, 19,1,   304128, 0x5eddd598
+0, 20, 20,1,   304128, 0xf153b80d
+0, 21, 21,1,   304128, 0xfc9aeaef
+0, 22, 22,1,   304128, 0x53284824
+0, 23, 23,1,   304128, 0xf41b3ab2
+0, 24, 24,1,   304128, 0x53add1de
+0, 25, 25,1,   304128, 0x3e6cf3bb
+0, 26, 26,1,   304128, 0xbc35327b
+0, 27, 27,1,   304128, 0x78a72d79
+0, 28, 28,1,   304128, 0x8597b11d
+0, 29, 29,1,   304128, 0x370248b9
+0, 30, 30,1,   304128, 0x520dca1c
+0, 31, 31,1,   304128, 0xd39bd594
+0, 32, 32,1,   304128, 0xc5548a4b
+0, 33, 33,1,   304128, 0x6129f929
+0, 34, 34,1,   304128, 0x0eb9f460
+0, 35, 35,1,   304128, 0xbc3f86f0
+0, 36, 36,1,   304128, 0x55662a05
+0, 37, 37,1,   304128, 0xfab16f56
+0, 38, 38,1,   304128, 0x925a03f0
+0, 39, 39,1,   304128, 0xd2c1b298
+0, 40, 40,1,   304128, 0xd2fe9dba
+0, 41, 41,1,   304128, 0xf0c5b24a
+0, 42, 42,1,   304128, 0xb5a63c1f
+0, 43, 43,1,   304128, 0xc3807f61
+0, 44, 44,1,   304128, 0x3c9341d8
+0, 45, 45,1,   304128, 0xf0fc08e2
+0, 46, 46,1,   304128, 0x086cfce6
+0, 47, 47,1,   304128, 0xd3aea7fe
+0, 48, 48,1,   304128, 0xf45e8b93
+0, 49, 49,1,   304128, 0x39b76915
+0, 50, 50,1,   304128, 0x55feb1e3
-- 
1.7.9.5

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


[libav-devel] [PATCH 6/9] hevc: parse frame packing arrangement SEI messages and save relevant stereo3d information

2013-11-28 Thread Vittorio Giovara
---
 libavcodec/hevc.h  |6 ++
 libavcodec/hevc_refs.c |   38 ++
 libavcodec/hevc_sei.c  |   15 ++-
 3 files changed, 54 insertions(+), 5 deletions(-)

diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h
index ab95035..d19f312 100644
--- a/libavcodec/hevc.h
+++ b/libavcodec/hevc.h
@@ -920,6 +920,12 @@ typedef struct HEVCContext {
 
 int nal_length_size;///< Number of bytes used for nal length (1, 2 or 
4)
 int nuh_layer_id;
+
+/** frame packing arrangement variables */
+int sei_frame_packing_present;
+int frame_packing_arrangement_type;
+int content_interpretation_type;
+int quincunx_subsampling;
 } HEVCContext;
 
 int ff_hevc_decode_short_term_rps(HEVCContext *s, ShortTermRPS *rps,
diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
index 2fbe9e7..0183e40 100644
--- a/libavcodec/hevc_refs.c
+++ b/libavcodec/hevc_refs.c
@@ -22,6 +22,7 @@
  */
 
 #include "libavutil/pixdesc.h"
+#include "libavutil/stereo3d.h"
 
 #include "internal.h"
 #include "thread.h"
@@ -151,6 +152,39 @@ int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, 
int poc)
 return 0;
 }
 
+static int set_side_data(HEVCContext *s, AVFrame *out)
+{
+if (s->sei_frame_packing_present &&
+s->frame_packing_arrangement_type >= 3 &&
+s->frame_packing_arrangement_type <= 5 &&
+s->content_interpretation_type > 0 &&
+s->content_interpretation_type < 3) {
+AVStereo3D *stereo = av_stereo3d_create_side_data(out);
+if (!stereo)
+return AVERROR(ENOMEM);
+
+switch (s->frame_packing_arrangement_type) {
+case 3:
+if (s->quincunx_subsampling)
+stereo->type = AV_STEREO3D_SIDEBYSIDE_QUINCUNX;
+else
+stereo->type = AV_STEREO3D_SIDEBYSIDE;
+break;
+case 4:
+stereo->type = AV_STEREO3D_TOPBOTTOM;
+break;
+case 5:
+stereo->type = AV_STEREO3D_FRAMESEQUENCE;
+break;
+}
+
+if (s->content_interpretation_type == 2)
+stereo->flags = AV_STEREO3D_FLAG_INVERT;
+}
+
+return 0;
+}
+
 int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush)
 {
 do {
@@ -190,6 +224,10 @@ int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int 
flush)
 if (ret < 0)
 return ret;
 
+ret = set_side_data(s, out);
+if (ret < 0)
+return ret;
+
 for (i = 0; i < 3; i++) {
 int hshift = (i > 0) ? desc->log2_chroma_w : 0;
 int vshift = (i > 0) ? desc->log2_chroma_h : 0;
diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index 1cf698b..eed7b33 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -46,17 +46,17 @@ static void decode_nal_sei_decoded_picture_hash(HEVCContext 
*s)
 }
 }
 
-static void decode_nal_sei_frame_packing_arrangement(HEVCLocalContext *lc)
+static void decode_nal_sei_frame_packing_arrangement(HEVCContext *s)
 {
-GetBitContext *gb = &lc->gb;
-int cancel, type, quincunx;
+GetBitContext *gb = &s->HEVClc.gb;
+int cancel, type, quincunx, content;
 
 get_ue_golomb(gb);  // frame_packing_arrangement_id
 cancel = get_bits1(gb); // frame_packing_cancel_flag
 if (cancel == 0) {
 type = get_bits(gb, 7); // frame_packing_arrangement_type
 quincunx = get_bits1(gb);   // quincunx_sampling_flag
-skip_bits(gb, 6);   // content_interpretation_type
+content  = get_bits(gb, 6); // content_interpretation_type
 
 // the following skips spatial_flipping_flag frame0_flipped_flag
 // field_views_flag current_frame_is_frame0_flag
@@ -69,6 +69,11 @@ static void 
decode_nal_sei_frame_packing_arrangement(HEVCLocalContext *lc)
 skip_bits1(gb); // frame_packing_arrangement_persistance_flag
 }
 skip_bits1(gb); // upsampled_aspect_ratio_flag
+
+s->sei_frame_packing_present  = (cancel == 0);
+s->frame_packing_arrangement_type = type;
+s->content_interpretation_type= content;
+s->quincunx_subsampling   = quincunx;
 }
 
 static int decode_nal_sei_message(HEVCContext *s)
@@ -93,7 +98,7 @@ static int decode_nal_sei_message(HEVCContext *s)
 if (payload_type == 256)
 decode_nal_sei_decoded_picture_hash(s);
 else if (payload_type == 45)
-decode_nal_sei_frame_packing_arrangement(&s->HEVClc);
+decode_nal_sei_frame_packing_arrangement(s);
 else {
 av_log(s->avctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", 
payload_type);
 skip_bits(gb, 8 * payload_size);
-- 
1.7.9.5

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


[libav-devel] [PATCH 3/9] libx264: set frame packing information when relevant information is found

2013-11-28 Thread Vittorio Giovara
---
 libavcodec/libx264.c |   38 +-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 08bb509..abf0a3e 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -23,6 +23,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/mem.h"
 #include "libavutil/pixdesc.h"
+#include "libavutil/stereo3d.h"
 #include "avcodec.h"
 #include "internal.h"
 
@@ -134,6 +135,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, 
const AVFrame *frame,
 x264_nal_t *nal;
 int nnal, i, ret;
 x264_picture_t pic_out;
+AVFrameSideData *side_data;
 
 x264_picture_init( &x4->pic );
 x4->pic.img.i_csp   = x4->params.i_csp;
@@ -163,8 +165,42 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, 
const AVFrame *frame,
 x4->params.vui.i_sar_width  = ctx->sample_aspect_ratio.num;
 x264_encoder_reconfig(x4->enc, &x4->params);
 }
-}
 
+side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_STEREO3D);
+if (side_data) {
+AVStereo3D *stereo = (AVStereo3D *)side_data->data;
+int fpa_type;
+
+switch (stereo->type) {
+case AV_STEREO3D_CHECKERBOARD:
+fpa_type = 0;
+break;
+case AV_STEREO3D_LINES:
+fpa_type = 1;
+break;
+case AV_STEREO3D_COLUMNS:
+fpa_type = 2;
+break;
+case AV_STEREO3D_SIDEBYSIDE:
+fpa_type = 3;
+break;
+case AV_STEREO3D_TOPBOTTOM:
+fpa_type = 4;
+break;
+case AV_STEREO3D_FRAMESEQUENCE:
+fpa_type = 5;
+break;
+default:
+fpa_type = -1;
+break;
+}
+
+if (fpa_type != x4->params.i_frame_packing) {
+x4->params.i_frame_packing = fpa_type;
+x264_encoder_reconfig(x4->enc, &x4->params);
+}
+}
+}
 do {
 if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL, 
&pic_out) < 0)
 return -1;
-- 
1.7.9.5

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


Re: [libav-devel] [PATCH] mpeg4videodec: move MpegEncContext.shape to Mpeg4DecContext

2013-11-28 Thread Martin Storsjö

On Wed, 27 Nov 2013, Anton Khirnov wrote:


---
Did it slightly differently so it's more resistant to changes in the following
fields
---
libavcodec/h263dec.c   |4 ++--
libavcodec/ituh263dec.c|4 ++--
libavcodec/mpeg4video.h|6 +++--
libavcodec/mpeg4video_parser.c |4 ++--
libavcodec/mpeg4videodec.c |   47 +++-
libavcodec/mpegvideo.c |3 ++-
libavcodec/mpegvideo.h |1 -
7 files changed, 39 insertions(+), 30 deletions(-)


Interesting solution - looks ok to me.

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


Re: [libav-devel] [PATCH] [RFC] configure: Split host and target libc detection

2013-11-28 Thread Martin Storsjö

On Wed, 27 Nov 2013, Diego Biurrun wrote:


On Wed, Nov 27, 2013 at 10:15:09PM +0200, Martin Storsjö wrote:

On Wed, 27 Nov 2013, Diego Biurrun wrote:

--- a/configure
+++ b/configure
@@ -3355,45 +3380,52 @@ esac

# determine libc flavour

-# uclibc defines __GLIBC__, so it needs to be checked before glibc.
-if check_cpp_condition features.h "defined __UCLIBC__"; then
-libc_type=uclibc
-add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
-elif check_cpp_condition features.h "defined __GLIBC__"; then
-libc_type=glibc
-add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
-# MinGW headers can be installed on Cygwin, so check for newlib first.
-elif check_cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
-libc_type=newlib
-add_cppflags -U__STRICT_ANSI__
-elif check_header _mingw.h; then
-libc_type=mingw
-check_cpp_condition _mingw.h \
-"defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) || 
\
-(__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
-die "ERROR: MinGW runtime version must be >= 3.15."
-add_cppflags -U__STRICT_ANSI__
-elif check_func_headers stdlib.h _get_doserrno; then
-libc_type=msvcrt
-add_compat strtod.o strtod=avpriv_strtod
-add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf   \
- _snprintf=avpriv_snprintf  \
- vsnprintf=avpriv_vsnprintf
-# The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
-# 0x601 by default unless something else is set by the user.
-# This can easily lead to us detecting functions only present
-# in such new versions and producing binaries requiring windows 7.0.
-# Therefore explicitly set the default to XP unless the user has
-# set something else on the command line.
-check_cpp_condition stdlib.h "defined(_WIN32_WINNT)" || add_cppflags 
-D_WIN32_WINNT=0x0502
-elif check_cpp_condition stddef.h "defined __KLIBC__"; then
-libc_type=klibc
-elif check_cpp_condition sys/cdefs.h "defined __BIONIC__"; then
-libc_type=bionic
-add_compat strtod.o strtod=avpriv_strtod
-fi
+probe_libc(){
+pfx=$1
+# uclibc defines __GLIBC__, so it needs to be checked before glibc.
+if check_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
+eval ${pfx}libc_type=uclibc
+add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
+elif check_${pfx}cpp_condition features.h "defined __GLIBC__"; then
+eval ${pfx}libc_type=glibc
+add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
+# MinGW headers can be installed on Cygwin, so check for newlib first.
+elif check_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
+eval ${pfx}libc_type=newlib
+add_${pfx}cppflags -U__STRICT_ANSI__
+elif check_${pfx}header _mingw.h; then
+eval ${pfx}libc_type=mingw
+mingw_condition="defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) || 
(__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)"
+check_${pfx}cpp_condition _mingw.h "defined $mingw_condition " ||
+die "ERROR: MinGW runtime version must be >= 3.15."


Any technical reason to split out mingw_condition into a separate
variable here, or is it just an unrelated refactoring you're doing
at the same time (which raises a few questions for a reviewer)? If
there's no pressing need for it (keeping lines short is not enough,
when it comes to a nontrivial change as this one), I'd rather have
it kept as before, to reduce the amount of changes here. It can
always be refactored in a separate commit with an adequate
explanation.


I /think/ it failed back when I tested this on MinGW, but I have to
test again now.  I just rebased on master and tested under Linux to
get some initial comments, hence the [RFC].  Otherwise I completely
agree with you in general.


Ok, needs to be investigated at least.


+add_${pfx}cppflags -U__STRICT_ANSI__
+elif check_${pfx}func_headers stdlib.h _get_doserrno; then
+eval ${pfx}libc_type=msvcrt
+add_compat strtod.o strtod=avpriv_strtod
+add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf   \
+ _snprintf=avpriv_snprintf  \
+ vsnprintf=avpriv_vsnprintf


Things like add_compat here (and below) should only be done if this
is the target libc, not if it's the host one. In general, every
single action (add/set/whatever) in this needs to include $pfx in
one way or another, otherwise it's doing something wrong.


When using msvc as host compiler this is not necessary?


Well, add_compat only adds the objects to be used in target complication 
anyway, so calling that based on the host libc detection is just broken 
anyway.


Apparently we've been able to cope just fine without these with MSVC as 
host compiler so far. They are only added in the target com