[FFmpeg-cvslog] avcodec/h264, videotoolbox: fix crash after VT decoder fails

2017-03-07 Thread Aman Gupta
ffmpeg | branch: master | Aman Gupta  | Tue Feb 21 10:48:37 2017 
-0800| [b6eaa3928e198554a3934dd5ad6eac4d16f27df2] | committer: wm4

avcodec/h264, videotoolbox: fix crash after VT decoder fails

The way videotoolbox hooks in as a hwaccel is pretty hacky. The VT decode
API is not invoked until end_frame(), so alloc_frame() returns a dummy
frame with a 1-byte buffer. When end_frame() is eventually called, the
dummy buffer is replaced with the actual decoded data from
VTDecompressionSessionDecodeFrame().

When the VT decoder fails, the frame returned to the h264 decoder from
alloc_frame() remains invalid and should not be used. Before
9747219958060d8c4f697df62e7f172c2a77e6c7, it was accidentally being
returned all the way up to the API user. After that commit, the dummy
frame was unref'd so the user received an error.

However, since that commit, VT hwaccel failures started causing random
segfaults in the h264 decoder. This happened more often on iOS where the
VT implementation is more likely to throw errors on bitstream anomolies.
A recent report of this issue can be see in
http://ffmpeg.org/pipermail/libav-user/2016-November/009831.html

The issue here is that the dummy frame is still referenced internally by the
h264 decoder, as part of the reflist and cur_pic_ptr. Deallocating the
frame causes assertions like this one to trip later on during decoding:

  Assertion h->cur_pic_ptr->f->buf[0] failed at src/libavcodec/h264_slice.c:1340

With this commit, we leave the dummy 1-byte frame intact, but avoid returning it
to the user.

This reverts commit 9747219958060d8c4f697df62e7f172c2a77e6c7.

Signed-off-by: wm4 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b6eaa3928e198554a3934dd5ad6eac4d16f27df2
---

 libavcodec/h264_refs.c| 3 +--
 libavcodec/h264dec.c  | 7 ++-
 libavcodec/version.h  | 2 +-
 libavcodec/videotoolbox.c | 2 --
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index 97bf588..ad29675 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -571,8 +571,7 @@ void ff_h264_remove_all_refs(H264Context *h)
 
 if (h->short_ref_count && !h->last_pic_for_ec.f->data[0]) {
 ff_h264_unref_picture(h, &h->last_pic_for_ec);
-if (h->short_ref[0]->f->buf[0])
-ff_h264_ref_picture(h, &h->last_pic_for_ec, h->short_ref[0]);
+ff_h264_ref_picture(h, &h->last_pic_for_ec, h->short_ref[0]);
 }
 
 for (i = 0; i < h->short_ref_count; i++) {
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 41c0964..35598ea 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -850,7 +850,12 @@ static int output_frame(H264Context *h, AVFrame *dst, 
H264Picture *srcp)
 AVFrame *src = srcp->f;
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(src->format);
 int i;
-int ret = av_frame_ref(dst, src);
+int ret;
+
+if (src->format == AV_PIX_FMT_VIDEOTOOLBOX && src->buf[0]->size == 1)
+return AVERROR_EXTERNAL;
+
+ret = av_frame_ref(dst, src);
 if (ret < 0)
 return ret;
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 7647ad2..cd9ed87 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  57
 #define LIBAVCODEC_VERSION_MINOR  82
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 9199b02..67adad5 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -352,8 +352,6 @@ static int videotoolbox_common_end_frame(AVCodecContext 
*avctx, AVFrame *frame)
 AVVideotoolboxContext *videotoolbox = avctx->hwaccel_context;
 VTContext *vtctx = avctx->internal->hwaccel_priv_data;
 
-av_buffer_unref(&frame->buf[0]);
-
 if (!videotoolbox->session || !vtctx->bitstream)
 return AVERROR_INVALIDDATA;
 

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


[FFmpeg-cvslog] avcodec/pixlet: fix architecture-dependent code and values

2017-03-07 Thread Vittorio Giovara
ffmpeg | branch: master | Vittorio Giovara  | Tue 
Mar  7 13:57:34 2017 +0100| [a6b1180e390925c0ceb78fd223fd18f8c1e39c94] | 
committer: Paul B Mahol

avcodec/pixlet: fix architecture-dependent code and values

The constants used in the decoder used floating point precision,
and this caused different values to be generated on different
architectures.

So, eradicate floating point numbers and use fixed point (32.32)
arithmetics everywhere, replacing constants with precomputed integer
values.

Signed-off-by: Vittorio Giovara 
Signed-off-by: Paul B Mahol 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a6b1180e390925c0ceb78fd223fd18f8c1e39c94
---

 libavcodec/pixlet.c | 57 -
 1 file changed, 30 insertions(+), 27 deletions(-)

diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c
index bb7f94c..1d4734d 100644
--- a/libavcodec/pixlet.c
+++ b/libavcodec/pixlet.c
@@ -55,7 +55,7 @@ typedef struct PixletContext {
 
 int16_t *filter[2];
 int16_t *prediction;
-float scaling[4][2][NB_LEVELS];
+int64_t scaling[4][2][NB_LEVELS];
 SubBand band[4][NB_LEVELS * 3 + 1];
 } PixletContext;
 
@@ -360,11 +360,11 @@ static void lowpass_prediction(int16_t *dst, int16_t 
*pred, int width, int heigh
 }
 }
 
-static void filter(int16_t *dest, int16_t *tmp, unsigned size, float SCALE)
+static void filterfn(int16_t *dest, int16_t *tmp, unsigned size, int64_t scale)
 {
 int16_t *low, *high, *ll, *lh, *hl, *hh;
 int hsize, i, j;
-float value;
+int64_t value;
 
 hsize = size >> 1;
 low = tmp + 4;
@@ -385,33 +385,33 @@ static void filter(int16_t *dest, int16_t *tmp, unsigned 
size, float SCALE)
 }
 
 for (i = 0; i < hsize; i++) {
-value = low [i+1] * -0.07576144003329376f +
-low [i  ] *  0.8586296626673486f  +
-low [i-1] * -0.07576144003329376f +
-high[i  ] *  0.3535533905932737f  +
-high[i-1] *  0.3535533905932737f;
-dest[i * 2] = av_clipf(value * SCALE, INT16_MIN, INT16_MAX);
+value = (int64_t) low [i + 1] * -INT64_C(325392907)  +
+(int64_t) low [i + 0] *  INT64_C(3687786320) +
+(int64_t) low [i - 1] * -INT64_C(325392907)  +
+(int64_t) high[i + 0] *  INT64_C(1518500249) +
+(int64_t) high[i - 1] *  INT64_C(1518500249);
+dest[i * 2] = av_clip_int16(((value >> 32) * scale) >> 32);
 }
 
 for (i = 0; i < hsize; i++) {
-value = low [i+2] * -0.01515228715813062f +
-low [i+1] *  0.3687056777514043f  +
-low [i  ] *  0.3687056777514043f  +
-low [i-1] * -0.01515228715813062f +
-high[i+1] *  0.07071067811865475f +
-high[i  ] * -0.8485281374238569f  +
-high[i-1] *  0.07071067811865475f;
-dest[i * 2 + 1] = av_clipf(value * SCALE, INT16_MIN, INT16_MAX);
+value = (int64_t) low [i + 2] * -INT64_C(65078576)   +
+(int64_t) low [i + 1] *  INT64_C(1583578880) +
+(int64_t) low [i + 0] *  INT64_C(1583578880) +
+(int64_t) low [i - 1] * -INT64_C(65078576)   +
+(int64_t) high[i + 1] *  INT64_C(303700064)  +
+(int64_t) high[i + 0] * -INT64_C(3644400640) +
+(int64_t) high[i - 1] *  INT64_C(303700064);
+dest[i * 2 + 1] = av_clip_int16(((value >> 32) * scale) >> 32);
 }
 }
 
 static void reconstruction(AVCodecContext *avctx,
int16_t *dest, unsigned width, unsigned height, 
ptrdiff_t stride, int nb_levels,
-   float *scaling_H, float *scaling_V)
+   int64_t *scaling_H, int64_t *scaling_V)
 {
 PixletContext *ctx = avctx->priv_data;
 unsigned scaled_width, scaled_height;
-float scale_H, scale_V;
+int64_t scale_H, scale_V;
 int16_t *ptr, *tmp;
 int i, j, k;
 
@@ -427,7 +427,7 @@ static void reconstruction(AVCodecContext *avctx,
 
 ptr = dest;
 for (j = 0; j < scaled_height; j++) {
-filter(ptr, ctx->filter[1], scaled_width, scale_V);
+filterfn(ptr, ctx->filter[1], scaled_width, scale_V);
 ptr += stride;
 }
 
@@ -438,7 +438,7 @@ static void reconstruction(AVCodecContext *avctx,
 ptr += stride;
 }
 
-filter(tmp, ctx->filter[1], scaled_height, scale_H);
+filterfn(tmp, ctx->filter[1], scaled_height, scale_H);
 
 ptr = dest + j;
 for (k = 0; k < scaled_height; k++) {
@@ -449,19 +449,22 @@ static void reconstruction(AVCodecContext *avctx,
 }
 }
 
-#define SQR(a) ((a) * (a))
-
 static void postprocess_luma(AVFrame *frame, int w, int h, int depth)
 {
 uint16_t *dsty = (uint16_t *)frame->data[0];
 int16_t *srcy  = (int16_t *)frame->data[0];
 ptrdiff_t stridey = frame->linesize[0] / 2;
-const float factor = 1.0f / ((1 << de

[FFmpeg-cvslog] avfilter/allfilters: make avfilter_register_all thread safe

2017-03-07 Thread Muhammad Faiz
ffmpeg | branch: master | Muhammad Faiz  | Tue Mar  7 
15:54:44 2017 +0700| [af7010ad0557fe66d35886581eecebf02e92637c] | committer: 
Muhammad Faiz

avfilter/allfilters: make avfilter_register_all thread safe

use ff_thread_once

Suggested-by: wm4 
Signed-off-by: Muhammad Faiz 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=af7010ad0557fe66d35886581eecebf02e92637c
---

 libavfilter/allfilters.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 15a74c4..df1af8d 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/thread.h"
 #include "avfilter.h"
 #include "config.h"
 #include "opencl_allkernels.h"
@@ -37,14 +38,8 @@
 avfilter_register(&ff_##x); \
 }
 
-void avfilter_register_all(void)
+static void register_all(void)
 {
-static int initialized;
-
-if (initialized)
-return;
-initialized = 1;
-
 REGISTER_FILTER(ABENCH, abench, af);
 REGISTER_FILTER(ACOMPRESSOR,acompressor,af);
 REGISTER_FILTER(ACROSSFADE, acrossfade, af);
@@ -380,3 +375,10 @@ void avfilter_register_all(void)
 REGISTER_FILTER_UNCONDITIONAL(vf_fifo);
 ff_opencl_register_filter_kernel_code_all();
 }
+
+void avfilter_register_all(void)
+{
+AVOnce control = AV_ONCE_INIT;
+
+ff_thread_once(&control, register_all);
+}

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


[FFmpeg-cvslog] avfilter/allformats: make av_register_all thread safe

2017-03-07 Thread Muhammad Faiz
ffmpeg | branch: master | Muhammad Faiz  | Tue Mar  7 
15:53:27 2017 +0700| [49635f0a46365f361ce665356bb41e199176021b] | committer: 
Muhammad Faiz

avfilter/allformats: make av_register_all thread safe

use ff_thread_once

Suggested-by: wm4 
Signed-off-by: Muhammad Faiz 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=49635f0a46365f361ce665356bb41e199176021b
---

 libavformat/allformats.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 35869e3..132e58b 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/thread.h"
 #include "avformat.h"
 #include "rtp.h"
 #include "rdt.h"
@@ -41,13 +42,8 @@
 
 #define REGISTER_MUXDEMUX(X, x) REGISTER_MUXER(X, x); REGISTER_DEMUXER(X, x)
 
-void av_register_all(void)
+static void register_all(void)
 {
-static int initialized;
-
-if (initialized)
-return;
-
 avcodec_register_all();
 
 /* (de)muxers */
@@ -383,6 +379,11 @@ void av_register_all(void)
 REGISTER_DEMUXER (LIBMODPLUG,   libmodplug);
 REGISTER_MUXDEMUX(LIBNUT,   libnut);
 REGISTER_DEMUXER (LIBOPENMPT,   libopenmpt);
+}
+
+void av_register_all(void)
+{
+AVOnce control = AV_ONCE_INIT;
 
-initialized = 1;
+ff_thread_once(&control, register_all);
 }

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


[FFmpeg-cvslog] avcodec/allcodecs: make avcodec_register_all thread safe

2017-03-07 Thread Muhammad Faiz
ffmpeg | branch: master | Muhammad Faiz  | Tue Mar  7 
15:51:12 2017 +0700| [e85e8408802dc3a474e6a610867df8e57c768339] | committer: 
Muhammad Faiz

avcodec/allcodecs: make avcodec_register_all thread safe

use ff_thread_once

Suggested-by: wm4 
Signed-off-by: Muhammad Faiz 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e85e8408802dc3a474e6a610867df8e57c768339
---

 libavcodec/allcodecs.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index a265ce5..074efd4 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -25,6 +25,7 @@
  */
 
 #include "config.h"
+#include "libavutil/thread.h"
 #include "avcodec.h"
 #include "version.h"
 
@@ -58,14 +59,8 @@
 av_register_codec_parser(&ff_##x##_parser); \
 }
 
-void avcodec_register_all(void)
+static void register_all(void)
 {
-static int initialized;
-
-if (initialized)
-return;
-initialized = 1;
-
 /* hardware accelerators */
 REGISTER_HWACCEL(H263_VAAPI,h263_vaapi);
 REGISTER_HWACCEL(H263_VIDEOTOOLBOX, h263_videotoolbox);
@@ -718,3 +713,10 @@ void avcodec_register_all(void)
 REGISTER_PARSER(VP9,vp9);
 REGISTER_PARSER(XMA,xma);
 }
+
+void avcodec_register_all(void)
+{
+static AVOnce control = AV_ONCE_INIT;
+
+ff_thread_once(&control, register_all);
+}

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


[FFmpeg-cvslog] avdevice/alldevices: make avdevice_register_all thread safe

2017-03-07 Thread Muhammad Faiz
ffmpeg | branch: master | Muhammad Faiz  | Tue Mar  7 
15:55:38 2017 +0700| [776f289c0fe82c4e3418a7c504ae3247eb10ffd7] | committer: 
Muhammad Faiz

avdevice/alldevices: make avdevice_register_all thread safe

use ff_thread_once

Suggested-by: wm4 
Signed-off-by: Muhammad Faiz 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=776f289c0fe82c4e3418a7c504ae3247eb10ffd7
---

 libavdevice/alldevices.c | 16 +---
 libavdevice/avdevice.h   |  1 -
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c
index a761be4..75f4ae0 100644
--- a/libavdevice/alldevices.c
+++ b/libavdevice/alldevices.c
@@ -19,6 +19,7 @@
  */
 
 #include "config.h"
+#include "libavutil/thread.h"
 #include "avdevice.h"
 
 #define REGISTER_OUTDEV(X, x)   \
@@ -37,14 +38,8 @@
 
 #define REGISTER_INOUTDEV(X, x) REGISTER_OUTDEV(X, x); REGISTER_INDEV(X, x)
 
-void avdevice_register_all(void)
+static void register_all(void)
 {
-static int initialized;
-
-if (initialized)
-return;
-initialized = 1;
-
 /* devices */
 REGISTER_INOUTDEV(ALSA, alsa);
 REGISTER_INDEV   (AVFOUNDATION, avfoundation);
@@ -76,3 +71,10 @@ void avdevice_register_all(void)
 REGISTER_INDEV   (LIBCDIO,  libcdio);
 REGISTER_INDEV   (LIBDC1394,libdc1394);
 }
+
+void avdevice_register_all(void)
+{
+AVOnce control = AV_ONCE_INIT;
+
+ff_thread_once(&control, register_all);
+}
diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h
index 6153f2c..84f374a 100644
--- a/libavdevice/avdevice.h
+++ b/libavdevice/avdevice.h
@@ -67,7 +67,6 @@ const char *avdevice_license(void);
 
 /**
  * Initialize libavdevice and register all the input and output devices.
- * @warning This function is not thread safe.
  */
 void avdevice_register_all(void);
 

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


[FFmpeg-cvslog] mkv: Export bounds and padding from spherical metadata

2017-03-07 Thread Vittorio Giovara
ffmpeg | branch: master | Vittorio Giovara  | Fri 
Feb 10 16:02:22 2017 -0500| [bde96422686fdb4bf754e9d03c0c535572b02f30] | 
committer: Vittorio Giovara

mkv: Export bounds and padding from spherical metadata

Update the fate test as needed.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bde96422686fdb4bf754e9d03c0c535572b02f30
---

 libavformat/matroskadec.c  | 64 --
 tests/ref/fate/matroska-spherical-mono |  6 +++-
 2 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 11265fb..fdc3f26 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1913,16 +1913,67 @@ static int mkv_parse_video_projection(AVStream *st, 
const MatroskaTrack *track)
 AVSphericalMapping *spherical;
 enum AVSphericalProjection projection;
 size_t spherical_size;
+size_t l = 0, t = 0, r = 0, b = 0;
+size_t padding = 0;
 int ret;
+GetByteContext gb;
+
+bytestream2_init(&gb, track->video.projection.private.data,
+ track->video.projection.private.size);
+
+if (bytestream2_get_byte(&gb) != 0) {
+av_log(NULL, AV_LOG_WARNING, "Unknown spherical metadata\n");
+return 0;
+}
+
+bytestream2_skip(&gb, 3); // flags
 
 switch (track->video.projection.type) {
 case MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR:
-projection = AV_SPHERICAL_EQUIRECTANGULAR;
+if (track->video.projection.private.size == 0)
+projection = AV_SPHERICAL_EQUIRECTANGULAR;
+else if (track->video.projection.private.size == 20) {
+t = bytestream2_get_be32(&gb);
+b = bytestream2_get_be32(&gb);
+l = bytestream2_get_be32(&gb);
+r = bytestream2_get_be32(&gb);
+
+if (b >= UINT_MAX - t || r >= UINT_MAX - l) {
+av_log(NULL, AV_LOG_ERROR,
+   "Invalid bounding rectangle coordinates "
+   "%"SIZE_SPECIFIER",%"SIZE_SPECIFIER","
+   "%"SIZE_SPECIFIER",%"SIZE_SPECIFIER"\n",
+   l, t, r, b);
+return AVERROR_INVALIDDATA;
+}
+
+if (l || t || r || b)
+projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE;
+else
+projection = AV_SPHERICAL_EQUIRECTANGULAR;
+} else {
+av_log(NULL, AV_LOG_ERROR, "Unknown spherical metadata\n");
+return AVERROR_INVALIDDATA;
+}
 break;
 case MATROSKA_VIDEO_PROJECTION_TYPE_CUBEMAP:
-if (track->video.projection.private.size < 4)
+if (track->video.projection.private.size < 4) {
+av_log(NULL, AV_LOG_ERROR, "Missing projection private 
properties\n");
+return AVERROR_INVALIDDATA;
+} else if (track->video.projection.private.size == 12) {
+uint32_t layout = bytestream2_get_be32(&gb);
+if (layout == 0) {
+projection = AV_SPHERICAL_CUBEMAP;
+} else {
+av_log(NULL, AV_LOG_WARNING,
+   "Unknown spherical cubemap layout %"PRIu32"\n", layout);
+return 0;
+}
+padding = bytestream2_get_be32(&gb);
+} else {
+av_log(NULL, AV_LOG_ERROR, "Unknown spherical metadata\n");
 return AVERROR_INVALIDDATA;
-projection = AV_SPHERICAL_CUBEMAP;
+}
 break;
 default:
 return 0;
@@ -1937,6 +1988,13 @@ static int mkv_parse_video_projection(AVStream *st, 
const MatroskaTrack *track)
 spherical->pitch = (int32_t)(track->video.projection.pitch * (1 << 16));
 spherical->roll  = (int32_t)(track->video.projection.roll  * (1 << 16));
 
+spherical->padding = padding;
+
+spherical->bound_left   = l;
+spherical->bound_top= t;
+spherical->bound_right  = r;
+spherical->bound_bottom = b;
+
 ret = av_stream_add_side_data(st, AV_PKT_DATA_SPHERICAL, (uint8_t 
*)spherical,
   spherical_size);
 if (ret < 0) {
diff --git a/tests/ref/fate/matroska-spherical-mono 
b/tests/ref/fate/matroska-spherical-mono
index 8048aff..a70d879 100644
--- a/tests/ref/fate/matroska-spherical-mono
+++ b/tests/ref/fate/matroska-spherical-mono
@@ -8,7 +8,11 @@ inverted=0
 [SIDE_DATA]
 side_data_type=Spherical Mapping
 side_data_size=56
-projection=equirectangular
+projection=tiled equirectangular
+bound_left=148
+bound_top=73
+bound_right=147
+bound_bottom=72
 yaw=45
 pitch=30
 roll=15

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


[FFmpeg-cvslog] mov: Export bounds and padding from spherical metadata

2017-03-07 Thread Vittorio Giovara
ffmpeg | branch: master | Vittorio Giovara  | Fri 
Feb 10 15:36:56 2017 -0500| [022b4ea5837bb79b9fe32bf707c3117be8e6d730] | 
committer: Vittorio Giovara

mov: Export bounds and padding from spherical metadata

Update the fate test as needed.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=022b4ea5837bb79b9fe32bf707c3117be8e6d730
---

 libavformat/mov.c | 28 +++-
 tests/ref/fate/mov-spherical-mono |  6 +-
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 2a7cbfe..cc098cd 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4637,6 +4637,8 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 MOVStreamContext *sc;
 int size;
 int32_t yaw, pitch, roll;
+size_t l = 0, t = 0, r = 0, b = 0;
+size_t padding = 0;
 uint32_t tag;
 enum AVSphericalProjection projection;
 
@@ -4698,9 +4700,26 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 switch (tag) {
 case MKTAG('c','b','m','p'):
 projection = AV_SPHERICAL_CUBEMAP;
+padding = avio_rb32(pb);
 break;
 case MKTAG('e','q','u','i'):
-projection = AV_SPHERICAL_EQUIRECTANGULAR;
+t = avio_rb32(pb);
+b = avio_rb32(pb);
+l = avio_rb32(pb);
+r = avio_rb32(pb);
+
+if (b >= UINT_MAX - t || r >= UINT_MAX - l) {
+av_log(c->fc, AV_LOG_ERROR,
+   "Invalid bounding rectangle coordinates %"SIZE_SPECIFIER","
+   "%"SIZE_SPECIFIER",%"SIZE_SPECIFIER",%"SIZE_SPECIFIER"\n",
+   l, t, r, b);
+return AVERROR_INVALIDDATA;
+}
+
+if (l || t || r || b)
+projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE;
+else
+projection = AV_SPHERICAL_EQUIRECTANGULAR;
 break;
 default:
 av_log(c->fc, AV_LOG_ERROR, "Unknown projection type\n");
@@ -4717,6 +4736,13 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 sc->spherical->pitch = pitch;
 sc->spherical->roll  = roll;
 
+sc->spherical->padding = padding;
+
+sc->spherical->bound_left   = l;
+sc->spherical->bound_top= t;
+sc->spherical->bound_right  = r;
+sc->spherical->bound_bottom = b;
+
 return 0;
 }
 
diff --git a/tests/ref/fate/mov-spherical-mono 
b/tests/ref/fate/mov-spherical-mono
index 8048aff..a70d879 100644
--- a/tests/ref/fate/mov-spherical-mono
+++ b/tests/ref/fate/mov-spherical-mono
@@ -8,7 +8,11 @@ inverted=0
 [SIDE_DATA]
 side_data_type=Spherical Mapping
 side_data_size=56
-projection=equirectangular
+projection=tiled equirectangular
+bound_left=148
+bound_top=73
+bound_right=147
+bound_bottom=72
 yaw=45
 pitch=30
 roll=15

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


[FFmpeg-cvslog] spherical: Add tiled equirectangular type and projection-specific properties

2017-03-07 Thread Vittorio Giovara
ffmpeg | branch: master | Vittorio Giovara  | Fri 
Feb 10 15:26:55 2017 -0500| [1b7ffddb3a999f37443c58232b112534c0abcf28] | 
committer: Vittorio Giovara

spherical: Add tiled equirectangular type and projection-specific properties

Signed-off-by: Vittorio Giovara 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1b7ffddb3a999f37443c58232b112534c0abcf28
---

 doc/APIchanges |  5 +++
 ffprobe.c  | 19 +++--
 libavformat/dump.c | 15 ++-
 libavutil/spherical.c  | 18 +
 libavutil/spherical.h  | 74 ++
 libavutil/version.h|  4 +-
 tests/ref/fate/matroska-spherical-mono |  2 +-
 tests/ref/fate/mov-spherical-mono  |  2 +-
 8 files changed, 129 insertions(+), 10 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 6922ea5..dc36a6b 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,11 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2017-02-10 - xxx - lavu 55.48.100 / 55.33.0 - spherical.h
+  Add AV_SPHERICAL_EQUIRECTANGULAR_TILE, av_spherical_tile_bounds(),
+  and projection-specific properties (bound_left, bound_top, bound_right,
+  bound_bottom, padding) to AVSphericalMapping.
+
 2017-03-02 - xxx - lavc 57.81.104 - videotoolbox.h
   AVVideotoolboxContext.cv_pix_fmt_type can now be set to 0 to output the
   native decoder format. (The default value is not changed.)
diff --git a/ffprobe.c b/ffprobe.c
index 046f080..c85c3a1 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1762,6 +1762,7 @@ static inline int show_tags(WriterContext *w, 
AVDictionary *tags, int section_id
 }
 
 static void print_pkt_side_data(WriterContext *w,
+AVCodecParameters *par,
 const AVPacketSideData *side_data,
 int nb_side_data,
 SectionID id_data_list,
@@ -1788,9 +1789,19 @@ static void print_pkt_side_data(WriterContext *w,
 const AVSphericalMapping *spherical = (AVSphericalMapping 
*)sd->data;
 if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR)
 print_str("projection", "equirectangular");
-else if (spherical->projection == AV_SPHERICAL_CUBEMAP)
+else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
 print_str("projection", "cubemap");
-else
+print_int("padding", spherical->padding);
+} else if (spherical->projection == 
AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+size_t l, t, r, b;
+av_spherical_tile_bounds(spherical, par->width, par->height,
+ &l, &t, &r, &b);
+print_str("projection", "tiled equirectangular");
+print_int("bound_left", l);
+print_int("bound_top", t);
+print_int("bound_right", r);
+print_int("bound_bottom", b);
+} else
 print_str("projection", "unknown");
 
 print_int("yaw", (double) spherical->yaw / (1 << 16));
@@ -1843,7 +1854,7 @@ static void show_packet(WriterContext *w, InputFile 
*ifile, AVPacket *pkt, int p
 av_dict_free(&dict);
 }
 
-print_pkt_side_data(w, pkt->side_data, pkt->side_data_elems,
+print_pkt_side_data(w, st->codecpar, pkt->side_data, 
pkt->side_data_elems,
 SECTION_ID_PACKET_SIDE_DATA_LIST,
 SECTION_ID_PACKET_SIDE_DATA);
 }
@@ -2404,7 +2415,7 @@ static int show_stream(WriterContext *w, AVFormatContext 
*fmt_ctx, int stream_id
 ret = show_tags(w, stream->metadata, in_program ? 
SECTION_ID_PROGRAM_STREAM_TAGS : SECTION_ID_STREAM_TAGS);
 
 if (stream->nb_side_data) {
-print_pkt_side_data(w, stream->side_data, stream->nb_side_data,
+print_pkt_side_data(w, stream->codecpar, stream->side_data, 
stream->nb_side_data,
 SECTION_ID_STREAM_SIDE_DATA_LIST,
 SECTION_ID_STREAM_SIDE_DATA);
 }
diff --git a/libavformat/dump.c b/libavformat/dump.c
index d9aa3af..505d572 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -343,7 +343,7 @@ static void dump_mastering_display_metadata(void *ctx, 
AVPacketSideData* sd) {
av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance));
 }
 
-static void dump_spherical(void *ctx, AVPacketSideData *sd)
+static void dump_spherical(void *ctx, AVCodecParameters *par, AVPacketSideData 
*sd)
 {
 AVSphericalMapping *spherical = (AVSphericalMapping *)sd->data;
 double yaw, pitch, roll;
@@ -357,6 +357,8 @@ static void dump_spherical(void *ctx, AVPacketSideData *sd)
 av_log(ctx, AV_LOG_INFO, "equirectangular ");
 else if (spherical->projection == AV_SPHERICAL_CUBEMAP)
 av_log(ctx, AV_LOG_INFO, "c

[FFmpeg-cvslog] avcodec/vp8: remove redundant check

2017-03-07 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Mar  7 00:53:52 2017 +0100| [5098a6f6275a57f122cd8f03e7ffbe5dd090b8e0] | 
committer: Michael Niedermayer

avcodec/vp8: remove redundant check

Reviewed-by: Paul B Mahol 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5098a6f6275a57f122cd8f03e7ffbe5dd090b8e0
---

 libavcodec/vp8.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index cc15852..fb17ff1 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -2497,8 +2497,6 @@ int vp78_decode_mb_row_sliced(AVCodecContext *avctx, void 
*tdata, int jobnr,
 
 td->thread_nr = threadnr;
 for (mb_y = jobnr; mb_y < s->mb_height; mb_y += num_jobs) {
-if (mb_y >= s->mb_height)
-break;
 td->thread_mb_pos = mb_y << 16;
 ret = s->decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr);
 if (ret < 0)

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


[FFmpeg-cvslog] avcodec/vp568: Check that there is enough data for ff_vp56_init_range_decoder()

2017-03-07 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Mar  7 19:09:38 2017 +0100| [55d7371fe0c44c025eb0e75215e0685870f31874] | 
committer: Michael Niedermayer

avcodec/vp568: Check that there is enough data for ff_vp56_init_range_decoder()

Fixes: timeout in 730/clusterfuzz-testcase-5265113739165696 (part 1 of 2)

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Reviewed-by: BBB
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=55d7371fe0c44c025eb0e75215e0685870f31874
---

 libavcodec/vp5.c |  5 -
 libavcodec/vp56.h|  2 +-
 libavcodec/vp56rac.c |  5 -
 libavcodec/vp6.c | 15 +++
 libavcodec/vp8.c | 21 ++---
 libavcodec/vp9.c |  9 +++--
 6 files changed, 41 insertions(+), 16 deletions(-)

diff --git a/libavcodec/vp5.c b/libavcodec/vp5.c
index 54db620..b5f06a0 100644
--- a/libavcodec/vp5.c
+++ b/libavcodec/vp5.c
@@ -38,8 +38,11 @@ static int vp5_parse_header(VP56Context *s, const uint8_t 
*buf, int buf_size)
 {
 VP56RangeCoder *c = &s->c;
 int rows, cols;
+int ret;
 
-ff_vp56_init_range_decoder(&s->c, buf, buf_size);
+ret = ff_vp56_init_range_decoder(&s->c, buf, buf_size);
+if (ret < 0)
+return ret;
 s->frames[VP56_FRAME_CURRENT]->key_frame = !vp56_rac_get(c);
 vp56_rac_get(c);
 ff_vp56_init_dequant(s, vp56_rac_gets(c, 6));
diff --git a/libavcodec/vp56.h b/libavcodec/vp56.h
index e5c5bea..c049399 100644
--- a/libavcodec/vp56.h
+++ b/libavcodec/vp56.h
@@ -224,7 +224,7 @@ int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
  */
 
 extern const uint8_t ff_vp56_norm_shift[256];
-void ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int 
buf_size);
+int ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int 
buf_size);
 
 static av_always_inline unsigned int vp56_rac_renorm(VP56RangeCoder *c)
 {
diff --git a/libavcodec/vp56rac.c b/libavcodec/vp56rac.c
index 6061b7e..e70302b 100644
--- a/libavcodec/vp56rac.c
+++ b/libavcodec/vp56rac.c
@@ -37,11 +37,14 @@ const uint8_t ff_vp56_norm_shift[256]= {
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 };
 
-void ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int 
buf_size)
+int ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int 
buf_size)
 {
 c->high = 255;
 c->bits = -16;
 c->buffer = buf;
 c->end = buf + buf_size;
+if (buf_size < 1)
+return AVERROR_INVALIDDATA;
 c->code_word = bytestream_get_be24(&c->buffer);
+return 0;
 }
diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c
index 662126c..f0e60a3 100644
--- a/libavcodec/vp6.c
+++ b/libavcodec/vp6.c
@@ -52,6 +52,7 @@ static int vp6_parse_header(VP56Context *s, const uint8_t 
*buf, int buf_size)
 int sub_version;
 int rows, cols;
 int res = 0;
+int ret;
 int separated_coeff = buf[0] & 1;
 
 s->frames[VP56_FRAME_CURRENT]->key_frame = !(buf[0] & 0x80);
@@ -93,7 +94,7 @@ static int vp6_parse_header(VP56Context *s, const uint8_t 
*buf, int buf_size)
 s->avctx->coded_width  = 16 * cols;
 s->avctx->coded_height = 16 * rows;
 } else {
-int ret = ff_set_dimensions(s->avctx, 16 * cols, 16 * rows);
+ret = ff_set_dimensions(s->avctx, 16 * cols, 16 * rows);
 if (ret < 0)
 return ret;
 
@@ -105,7 +106,9 @@ static int vp6_parse_header(VP56Context *s, const uint8_t 
*buf, int buf_size)
 res = VP56_SIZE_CHANGE;
 }
 
-ff_vp56_init_range_decoder(c, buf+6, buf_size-6);
+ret = ff_vp56_init_range_decoder(c, buf+6, buf_size-6);
+if (ret < 0)
+return ret;
 vp56_rac_gets(c, 2);
 
 parse_filter_info = s->filter_header;
@@ -122,7 +125,9 @@ static int vp6_parse_header(VP56Context *s, const uint8_t 
*buf, int buf_size)
 buf += 2;
 buf_size -= 2;
 }
-ff_vp56_init_range_decoder(c, buf+1, buf_size-1);
+ret = ff_vp56_init_range_decoder(c, buf+1, buf_size-1);
+if (ret < 0)
+return ret;
 
 s->golden_frame = vp56_rac_get(c);
 if (s->filter_header) {
@@ -165,7 +170,9 @@ static int vp6_parse_header(VP56Context *s, const uint8_t 
*buf, int buf_size)
 s->parse_coeff = vp6_parse_coeff_huffman;
 init_get_bits(&s->gb, buf, buf_size<<3);
 } else {
-ff_vp56_init_range_decoder(&s->cc, buf, buf_size);
+ret = ff_vp56_init_range_decoder(&s->cc, buf, buf_size);
+if (ret < 0)
+return ret;
 s->ccp = &s->cc;
 }
 } else {
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index fb17ff1..a3d057d 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -261,6 +261,7 @@ static int setup_partitions(VP8Context *s, const uint8_t 
*buf, int buf_size)

[FFmpeg-cvslog] avcodec/vp8: Check for the bitstream end per MB in decode_mb_row_no_filter ()

2017-03-07 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Mar  7 19:09:39 2017 +0100| [1afd246960202917e244c844c534e9c1e3c323f5] | 
committer: Michael Niedermayer

avcodec/vp8: Check for the bitstream end per MB in decode_mb_row_no_filter()

Fixes: timeout in 730/clusterfuzz-testcase-5265113739165696 (part 2 of 2)

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Reviewed-by: BBB
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1afd246960202917e244c844c534e9c1e3c323f5
---

 libavcodec/vp8.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index a3d057d..6759b31 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -2330,6 +2330,8 @@ static av_always_inline int 
decode_mb_row_no_filter(AVCodecContext *avctx, void
 s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN;
 
 for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) {
+if (c->end <= c->buffer && c->bits >= 0)
+return AVERROR_INVALIDDATA;
 // Wait for previous thread to read mb_x+2, and reach mb_y-1.
 if (prev_td != td) {
 if (threadnr != 0) {

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


[FFmpeg-cvslog] matroskadec: cosmetics: Rearrange checks for projection-depedendent properties

2017-03-07 Thread Vittorio Giovara
ffmpeg | branch: master | Vittorio Giovara  | Tue 
Mar  7 17:34:32 2017 -0500| [9ae3506696badc226a4e73a35009de17aeee14ce] | 
committer: Vittorio Giovara

matroskadec: cosmetics: Rearrange checks for projection-depedendent properties

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9ae3506696badc226a4e73a35009de17aeee14ce
---

 libavformat/matroskadec.c | 21 +
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index fdc3f26..fdb23ab 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1930,9 +1930,7 @@ static int mkv_parse_video_projection(AVStream *st, const 
MatroskaTrack *track)
 
 switch (track->video.projection.type) {
 case MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR:
-if (track->video.projection.private.size == 0)
-projection = AV_SPHERICAL_EQUIRECTANGULAR;
-else if (track->video.projection.private.size == 20) {
+if (track->video.projection.private.size == 20) {
 t = bytestream2_get_be32(&gb);
 b = bytestream2_get_be32(&gb);
 l = bytestream2_get_be32(&gb);
@@ -1946,15 +1944,15 @@ static int mkv_parse_video_projection(AVStream *st, 
const MatroskaTrack *track)
l, t, r, b);
 return AVERROR_INVALIDDATA;
 }
-
-if (l || t || r || b)
-projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE;
-else
-projection = AV_SPHERICAL_EQUIRECTANGULAR;
-} else {
+} else if (track->video.projection.private.size != 0) {
 av_log(NULL, AV_LOG_ERROR, "Unknown spherical metadata\n");
 return AVERROR_INVALIDDATA;
 }
+
+if (l || t || r || b)
+projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE;
+else
+projection = AV_SPHERICAL_EQUIRECTANGULAR;
 break;
 case MATROSKA_VIDEO_PROJECTION_TYPE_CUBEMAP:
 if (track->video.projection.private.size < 4) {
@@ -1962,13 +1960,12 @@ static int mkv_parse_video_projection(AVStream *st, 
const MatroskaTrack *track)
 return AVERROR_INVALIDDATA;
 } else if (track->video.projection.private.size == 12) {
 uint32_t layout = bytestream2_get_be32(&gb);
-if (layout == 0) {
-projection = AV_SPHERICAL_CUBEMAP;
-} else {
+if (layout) {
 av_log(NULL, AV_LOG_WARNING,
"Unknown spherical cubemap layout %"PRIu32"\n", layout);
 return 0;
 }
+projection = AV_SPHERICAL_CUBEMAP;
 padding = bytestream2_get_be32(&gb);
 } else {
 av_log(NULL, AV_LOG_ERROR, "Unknown spherical metadata\n");

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


[FFmpeg-cvslog] mov: Fix checking layout and loading padding for cubemaps

2017-03-07 Thread Vittorio Giovara
ffmpeg | branch: master | Vittorio Giovara  | Tue 
Mar  7 17:29:52 2017 -0500| [ac8c72f8f1f758ae7606db42eac83d04418aec48] | 
committer: Vittorio Giovara

mov: Fix checking layout and loading padding for cubemaps

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ac8c72f8f1f758ae7606db42eac83d04418aec48
---

 libavformat/mov.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index cc098cd..d5c3949 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4635,7 +4635,7 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 {
 AVStream *st;
 MOVStreamContext *sc;
-int size;
+int size, layout;
 int32_t yaw, pitch, roll;
 size_t l = 0, t = 0, r = 0, b = 0;
 size_t padding = 0;
@@ -4699,6 +4699,12 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 avio_skip(pb, 4); /*  version + flags */
 switch (tag) {
 case MKTAG('c','b','m','p'):
+layout = avio_rb32(pb);
+if (layout) {
+av_log(c->fc, AV_LOG_WARNING,
+   "Unsupported cubemap layout %d\n", layout);
+return 0;
+}
 projection = AV_SPHERICAL_CUBEMAP;
 padding = avio_rb32(pb);
 break;

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


[FFmpeg-cvslog] lavc/libx265: Add gray10 and gray12 encoding support.

2017-03-07 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Wed Mar  8 
00:25:33 2017 +0100| [587226ad45948dfd360c4c2cb14341f1dfdfe351] | committer: 
Carl Eugen Hoyos

lavc/libx265: Add gray10 and gray12 encoding support.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=587226ad45948dfd360c4c2cb14341f1dfdfe351
---

 libavcodec/libx265.c | 5 +
 libavcodec/version.h | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index f9b287e..784b51c 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -167,6 +167,8 @@ static av_cold int libx265_encode_init(AVCodecContext 
*avctx)
 ctx->params->internalCsp = X265_CSP_I444;
 break;
 case AV_PIX_FMT_GRAY8:
+case AV_PIX_FMT_GRAY10:
+case AV_PIX_FMT_GRAY12:
 if (ctx->api->api_build_number < 85) {
 av_log(avctx, AV_LOG_ERROR,
"libx265 version is %d, must be at least 85 for gray 
encoding.\n",
@@ -350,6 +352,7 @@ static const enum AVPixelFormat x265_csp_ten[] = {
 AV_PIX_FMT_YUV444P10,
 AV_PIX_FMT_GBRP10,
 AV_PIX_FMT_GRAY8,
+AV_PIX_FMT_GRAY10,
 AV_PIX_FMT_NONE
 };
 
@@ -367,6 +370,8 @@ static const enum AVPixelFormat x265_csp_twelve[] = {
 AV_PIX_FMT_YUV444P12,
 AV_PIX_FMT_GBRP12,
 AV_PIX_FMT_GRAY8,
+AV_PIX_FMT_GRAY10,
+AV_PIX_FMT_GRAY12,
 AV_PIX_FMT_NONE
 };
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index cd9ed87..b00e011 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  57
 #define LIBAVCODEC_VERSION_MINOR  82
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \

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


[FFmpeg-cvslog] lsws/input: Do not define unused functions.

2017-03-07 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Tue Mar  7 
09:28:00 2017 +0100| [a9c20598b505ac2314843cc0855fdd3e6460322c] | committer: 
Carl Eugen Hoyos

lsws/input: Do not define unused functions.

Fixes warnings like the following:
libswscale/input.c:951:13: warning: ‘planar_rgb14be_to_a’ defined but not used

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a9c20598b505ac2314843cc0855fdd3e6460322c
---

 libswscale/input.c | 21 -
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/libswscale/input.c b/libswscale/input.c
index 8b5f348..f32f896 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -948,17 +948,24 @@ static void planar_rgb##nbits##endian_name##_to_y(uint8_t 
*dst, const uint8_t *s
 {  
 \
 planar_rgb16_to_y(dst, src, w, nbits, endian, rgb2yuv);
 \
 }  
 \
-static void planar_rgb##nbits##endian_name##_to_a(uint8_t *dst, const uint8_t 
*src[4],  \
-  int w, int32_t *rgb2yuv) 
 \
-{  
 \
-planar_rgb16_to_a(dst, src, w, nbits, endian, rgb2yuv);
 \
-}  
 \
 static void planar_rgb##nbits##endian_name##_to_uv(uint8_t *dstU, uint8_t 
*dstV,\
const uint8_t *src[4], int 
w, int32_t *rgb2yuv)  \
 {  
 \
 planar_rgb16_to_uv(dstU, dstV, src, w, nbits, endian, rgb2yuv);
 \
 }  
 \
 
+#define rgb9plus_planar_transparency_funcs(nbits)   \
+static void planar_rgb##nbits##le_to_a(uint8_t *dst, const uint8_t *src[4], \
+   int w, int32_t *rgb2yuv) \
+{   \
+planar_rgb16_to_a(dst, src, w, nbits, 0, rgb2yuv);  \
+}   \
+static void planar_rgb##nbits##be_to_a(uint8_t *dst, const uint8_t *src[4], \
+   int w, int32_t *rgb2yuv) \
+{   \
+planar_rgb16_to_a(dst, src, w, nbits, 1, rgb2yuv);  \
+}
+
 #define rgb9plus_planar_funcs(nbits)\
 rgb9plus_planar_funcs_endian(nbits, le, 0)  \
 rgb9plus_planar_funcs_endian(nbits, be, 1)
@@ -969,6 +976,10 @@ rgb9plus_planar_funcs(12)
 rgb9plus_planar_funcs(14)
 rgb9plus_planar_funcs(16)
 
+rgb9plus_planar_transparency_funcs(10)
+rgb9plus_planar_transparency_funcs(12)
+rgb9plus_planar_transparency_funcs(16)
+
 av_cold void ff_sws_init_input_funcs(SwsContext *c)
 {
 enum AVPixelFormat srcFormat = c->srcFormat;

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


[FFmpeg-cvslog] lsws/slice: Move a misplaced const.

2017-03-07 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Sun Feb 26 
11:18:25 2017 +0100| [851f4255e0e2001f73c393db48b3eb3bd2a8b96e] | committer: 
Carl Eugen Hoyos

lsws/slice: Move a misplaced const.

Fixes a gcc warning:
libswscale/slice.c:178:56: warning: assignment discards 'const' qualifier from 
pointer target type [-Wdiscarded-qualifiers]

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=851f4255e0e2001f73c393db48b3eb3bd2a8b96e
---

 libswscale/slice.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libswscale/slice.c b/libswscale/slice.c
index e14456f..db4fa87 100644
--- a/libswscale/slice.c
+++ b/libswscale/slice.c
@@ -158,7 +158,7 @@ int ff_init_slice_from_src(SwsSlice * s, uint8_t *src[4], 
int stride[4], int src
 chrY + chrH,
 lumY + lumH};
 
-const uint8_t *src_[4] = {src[0] + (relative ? 0 : start[0]) * stride[0],
+uint8_t *const src_[4] = {src[0] + (relative ? 0 : start[0]) * stride[0],
   src[1] + (relative ? 0 : start[1]) * stride[1],
   src[2] + (relative ? 0 : start[2]) * stride[2],
   src[3] + (relative ? 0 : start[3]) * stride[3]};

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


[FFmpeg-cvslog] Revert "lavu/atomic: add support for the new memory model aware gcc built-ins"

2017-03-07 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Mar  7 00:23:07 
2017 -0300| [dbc932e745fe4dc9ffbe48d0332a95cbbaa2b228] | committer: James Almer

Revert "lavu/atomic: add support for the new memory model aware gcc built-ins"

This reverts commit faa9d2982969c999ab0e443a226eff116f7f8e4b.

This change became superfluous when support for C11 atomics was introduced.
Reverting it will make the removal of this implementation in an upcoming
merge conflict free.

Reviewed-by: wm4 
Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dbc932e745fe4dc9ffbe48d0332a95cbbaa2b228
---

 configure  |  4 +---
 libavutil/atomic_gcc.h | 17 -
 2 files changed, 1 insertion(+), 20 deletions(-)

diff --git a/configure b/configure
index 0199fec..6350942 100755
--- a/configure
+++ b/configure
@@ -1821,7 +1821,6 @@ ARCH_FEATURES="
 
 BUILTIN_LIST="
 atomic_cas_ptr
-atomic_compare_exchange
 machine_rw_barrier
 MemoryBarrier
 mm_empty
@@ -2322,7 +2321,7 @@ symver_if_any="symver_asm_label symver_gnu_asm"
 valgrind_backtrace_deps="!optimizations valgrind_valgrind_h"
 
 # threading support
-atomics_gcc_if_any="sync_val_compare_and_swap atomic_compare_exchange"
+atomics_gcc_if="sync_val_compare_and_swap"
 atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
 atomics_win32_if="MemoryBarrier"
 atomics_native_if_any="$ATOMICS_LIST"
@@ -5533,7 +5532,6 @@ if ! disabled network; then
 fi
 
 check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; 
atomic_cas_ptr(ptr, oldval, newval)"
-check_builtin atomic_compare_exchange "" "int *ptr, *oldval; int newval; 
__atomic_compare_exchange_n(ptr, oldval, newval, 0, __ATOMIC_SEQ_CST, 
__ATOMIC_SEQ_CST)"
 check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
 check_builtin MemoryBarrier windows.h "MemoryBarrier()"
 check_builtin sarestart signal.h "SA_RESTART"
diff --git a/libavutil/atomic_gcc.h b/libavutil/atomic_gcc.h
index 5f9fc49..2bb43c3 100644
--- a/libavutil/atomic_gcc.h
+++ b/libavutil/atomic_gcc.h
@@ -28,40 +28,27 @@
 #define avpriv_atomic_int_get atomic_int_get_gcc
 static inline int atomic_int_get_gcc(volatile int *ptr)
 {
-#if HAVE_ATOMIC_COMPARE_EXCHANGE
-return __atomic_load_n(ptr, __ATOMIC_SEQ_CST);
-#else
 __sync_synchronize();
 return *ptr;
-#endif
 }
 
 #define avpriv_atomic_int_set atomic_int_set_gcc
 static inline void atomic_int_set_gcc(volatile int *ptr, int val)
 {
-#if HAVE_ATOMIC_COMPARE_EXCHANGE
-__atomic_store_n(ptr, val, __ATOMIC_SEQ_CST);
-#else
 *ptr = val;
 __sync_synchronize();
-#endif
 }
 
 #define avpriv_atomic_int_add_and_fetch atomic_int_add_and_fetch_gcc
 static inline int atomic_int_add_and_fetch_gcc(volatile int *ptr, int inc)
 {
-#if HAVE_ATOMIC_COMPARE_EXCHANGE
-return __atomic_add_fetch(ptr, inc, __ATOMIC_SEQ_CST);
-#else
 return __sync_add_and_fetch(ptr, inc);
-#endif
 }
 
 #define avpriv_atomic_ptr_cas atomic_ptr_cas_gcc
 static inline void *atomic_ptr_cas_gcc(void * volatile *ptr,
void *oldval, void *newval)
 {
-#if HAVE_SYNC_VAL_COMPARE_AND_SWAP
 #ifdef __ARMCC_VERSION
 // armcc will throw an error if ptr is not an integer type
 volatile uintptr_t *tmp = (volatile uintptr_t*)ptr;
@@ -69,10 +56,6 @@ static inline void *atomic_ptr_cas_gcc(void * volatile *ptr,
 #else
 return __sync_val_compare_and_swap(ptr, oldval, newval);
 #endif
-#else
-__atomic_compare_exchange_n(ptr, &oldval, newval, 0, __ATOMIC_SEQ_CST, 
__ATOMIC_SEQ_CST);
-return oldval;
-#endif
 }
 
 #endif /* AVUTIL_ATOMIC_GCC_H */

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