[libav-devel] [PATCH 00/40] bump v3

2017-03-16 Thread Vittorio Giovara
Hi, this is the third iteration of the set, with a couple of additional
API removal to fullfill our 18 months 'promise', and contains a few
patches queued for ABI changes, namely related to bistream reader and
the spherical type.

Anton Khirnov (1):
  mpeg4audio: make avpriv_copy_pce_data() inline

Carl Eugen Hoyos (1):
  spherical: Mark map pointer as const in av_spherical_tile_bounds()

Diego Biurrun (1):
  lavc: Remove deprecated XvMC support hacks

Vittorio Giovara (37):
  Bump major versions of all libraries
  lavfi: Drop deprecated way of passing options for a few filters
  lavfi: Drop deprecated functions to open a filter or a filterchain
  lavfi: Drop deprecated filter initialization
  lavfi: Drop deprecated filter registration
  lavfi: Drop deprecated non-const filter retrieval
  lavf: Drop deprecated bitexact functionality
  lavf: Drop deprecated AVFract type and related field
  lavf: Drop deprecated hint to set muxer timebase
  lavc: Drop deprecated chroma subsample function
  lavc: Drop deprecated missing sample log function
  lavc: Drop deprecated lowres option
  lavc: Drop deprecated VDPAU codec capability
  lavc: Drop deprecated VDPAU buffer fields
  lavc: Drop deprecated voxware codec entry
  lavc: Drop deprecated way of setting codec dimensions
  lavc: Drop deprecated debug mv functionality
  lavc: Drop deprecated workaround bugs options
  lavc: Drop deprecated extended aspect ratio symbol
  lavc: Drop deprecated architectures symbols
  lavc: Drop deprecated error rate option
  lavc: Drop deprecated public symbols
  lavc: Drop deprecated macroblock type symbols
  lavc: Drop deprecated av_fast_malloc() compatibility
  lavc: Drop deprecated emu edge functionality
  lavc: Drop deprecated unused public members
  lavc: Drop deprecated codec flags
  lavc: Drop deprecated avctx codec name
  lavc: Drop deprecated global afd field
  lavc: Drop deprecated way of setting audio delay on encode
  lavc: Drop deprecated time_base variable for decoding
  lavc: Drop deprecated options moved to private contexts
  lavc: Drop deprecated stream codec tag
  lavu: Drop deprecated VDPAU pixel formats
  lavu: Drop deprecated option type
  lavu: Drop deprecated av_dlog macro
  spherical: Change types of bounding and pad to uint32_t

 configure |   3 -
 libavcodec/4xm.c  |   2 +-
 libavcodec/Makefile   |   3 -
 libavcodec/allcodecs.c|   3 -
 libavcodec/asvdec.c   |   2 +-
 libavcodec/avcodec.h  | 534 --
 libavcodec/bink.c |   2 +-
 libavcodec/blockdsp.c |  10 +-
 libavcodec/blockdsp.h |  10 +-
 libavcodec/cavs.c |   2 +-
 libavcodec/codec_desc.c   |  20 +-
 libavcodec/decode.c   |   5 -
 libavcodec/dnxhddec.c |   2 +-
 libavcodec/dnxhdenc.c |   2 +-
 libavcodec/eamad.c|   2 +-
 libavcodec/eatqi.c|   2 +-
 libavcodec/encode.c   |   4 -
 libavcodec/error_resilience.c |  21 --
 libavcodec/g2meet.c   |   2 +-
 libavcodec/h263.h |   2 -
 libavcodec/imgconvert.c   |   9 -
 libavcodec/internal.h |   2 -
 libavcodec/intrax8.c  |   2 +-
 libavcodec/jvdec.c|   2 +-
 libavcodec/libx264.c  |  21 +-
 libavcodec/libxavs.c  |  26 --
 libavcodec/libxvid.c  |  30 ---
 libavcodec/mdec.c |   2 +-
 libavcodec/mimic.c|   2 +-
 libavcodec/mjpegdec.c |   2 +-
 libavcodec/motion_est.c   |  19 --
 libavcodec/mpeg12dec.c| 108 -
 libavcodec/mpeg4audio.c   |  40 
 libavcodec/mpeg4audio.h   |  40 +++-
 libavcodec/mpegutils.h|   2 -
 libavcodec/mpegvideo.c|  29 +--
 libavcodec/mpegvideo.h|   3 -
 libavcodec/mpegvideo_enc.c|  36 ---
 libavcodec/mpegvideo_parser.c |   5 -
 libavcodec/mpegvideo_xvmc.c   | 337 --
 libavcodec/options_table.h| 113 -
 libavcodec/pthread_frame.c|   5 -
 libavcodec/svq1enc.c  |  13 -
 libavcodec/utils.c|  53 -
 libavcodec/vc1dec.c   |   2 +-
 libavcodec/vdpau.h|  78 --
 libavcodec/version.h  | 118 +-
 libavcodec/wmv2.c |   2 +-
 libavcodec/x86/blockdsp.c |  16 +-
 libavcodec/xvmc.h | 174 --
 libavcodec/xvmc_internal.h|  38 ---
 libavdevice/version.h |   4 +-
 libavfilter/af_channelmap.c   |   7 -
 libavfilter/af_join.c |   8 -
 libavfilter/avfilter.c| 107 +
 libavfilter/avfilter.h|  68 +-
 libavfilter/avfiltergraph.c   |  17 --
 libavfilter/buffersrc.c   |   8 -
 libavfilter/version.h |  20 +-
 libavfilter/vf_aspect.c   |  46 
 libavformat/avformat.h|  21 --
 libavformat/dump.c|   2 +-
 libavformat/matroskadec.c |   6 +-
 libavformat/mov.c |   7 +-
 libavformat/mux.c |  18 --
 libavformat/version.h

[libav-devel] [PATCH 03/40] lavfi: Drop deprecated functions to open a filter or a filterchain

2017-03-16 Thread Vittorio Giovara
Deprecated in 03/2013.
---
 libavfilter/avfilter.c  |  8 
 libavfilter/avfilter.h  | 30 --
 libavfilter/avfiltergraph.c | 17 -
 libavfilter/version.h   |  3 ---
 4 files changed, 58 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index d9c204e766..d6bddef4a0 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -475,14 +475,6 @@ err:
 return NULL;
 }
 
-#if FF_API_AVFILTER_OPEN
-int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char 
*inst_name)
-{
-*filter_ctx = ff_filter_alloc(filter, inst_name);
-return *filter_ctx ? 0 : AVERROR(ENOMEM);
-}
-#endif
-
 static void free_link(AVFilterLink *link)
 {
 if (!link)
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 568480dd3e..babcec66f2 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -479,22 +479,6 @@ attribute_deprecated
 AVFilter **av_filter_next(AVFilter **filter);
 #endif
 
-#if FF_API_AVFILTER_OPEN
-/**
- * Create a filter instance.
- *
- * @param filter_ctx put here a pointer to the created filter context
- * on success, NULL on failure
- * @param filterthe filter to create an instance of
- * @param inst_name Name to give to the new instance. Can be NULL for none.
- * @return >= 0 in case of success, a negative error code otherwise
- * @deprecated use avfilter_graph_alloc_filter() instead
- */
-attribute_deprecated
-int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char 
*inst_name);
-#endif
-
-
 #if FF_API_AVFILTER_INIT_FILTER
 /**
  * Initialize a filter.
@@ -691,20 +675,6 @@ AVFilterContext *avfilter_graph_alloc_filter(AVFilterGraph 
*graph,
  */
 AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name);
 
-#if FF_API_AVFILTER_OPEN
-/**
- * Add an existing filter instance to a filter graph.
- *
- * @param graphctx  the filter graph
- * @param filter the filter to be added
- *
- * @deprecated use avfilter_graph_alloc_filter() to allocate a filter in a
- * filter graph
- */
-attribute_deprecated
-int avfilter_graph_add_filter(AVFilterGraph *graphctx, AVFilterContext 
*filter);
-#endif
-
 /**
  * Create and add a filter instance into an existing graph.
  * The filter instance is created from the filter filt and inited
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 5053e3c37a..58ede68a31 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -116,23 +116,6 @@ void avfilter_graph_free(AVFilterGraph **graph)
 av_freep(graph);
 }
 
-#if FF_API_AVFILTER_OPEN
-int avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter)
-{
-AVFilterContext **filters = av_realloc(graph->filters,
-   sizeof(*filters) * 
(graph->nb_filters + 1));
-if (!filters)
-return AVERROR(ENOMEM);
-
-graph->filters = filters;
-graph->filters[graph->nb_filters++] = filter;
-
-filter->graph = graph;
-
-return 0;
-}
-#endif
-
 int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter 
*filt,
  const char *name, const char *args, void 
*opaque,
  AVFilterGraph *graph_ctx)
diff --git a/libavfilter/version.h b/libavfilter/version.h
index bb437efa02..540ac48f9b 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -49,9 +49,6 @@
  * the public API and may change, break or disappear at any time.
  */
 
-#ifndef FF_API_AVFILTER_OPEN
-#define FF_API_AVFILTER_OPEN(LIBAVFILTER_VERSION_MAJOR < 7)
-#endif
 #ifndef FF_API_AVFILTER_INIT_FILTER
 #define FF_API_AVFILTER_INIT_FILTER (LIBAVFILTER_VERSION_MAJOR < 7)
 #endif
-- 
2.12.0

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

Re: [libav-devel] [PATCH] mpeg4audio: make avpriv_copy_pce_data() inline

2017-03-16 Thread Vittorio Giovara
On Thu, Mar 16, 2017 at 12:48 PM, Anton Khirnov  wrote:
> Well, I think it still needs to be namespaced somehow. ff_?

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

[libav-devel] [PATCH 2/2] vf_showinfo: Display spherical properties

2017-03-15 Thread Vittorio Giovara
---
 libavfilter/vf_showinfo.c | 41 +
 1 file changed, 41 insertions(+)

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index b44f3d2bf2..d5605e6922 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -29,6 +29,7 @@
 #include "libavutil/imgutils.h"
 #include "libavutil/internal.h"
 #include "libavutil/pixdesc.h"
+#include "libavutil/spherical.h"
 #include "libavutil/stereo3d.h"
 
 #include "avfilter.h"
@@ -39,6 +40,43 @@ typedef struct ShowInfoContext {
 unsigned int frame;
 } ShowInfoContext;
 
+static void dump_spherical(AVFilterContext *ctx, AVFrame *frame, 
AVFrameSideData *sd)
+{
+AVSphericalMapping *spherical = (AVSphericalMapping *)sd->data;
+double yaw, pitch, roll;
+
+av_log(ctx, AV_LOG_INFO, "spherical information: ");
+if (sd->size < sizeof(*spherical)) {
+av_log(ctx, AV_LOG_INFO, "invalid data");
+return;
+}
+
+if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR)
+av_log(ctx, AV_LOG_INFO, "equirectangular ");
+else if (spherical->projection == AV_SPHERICAL_CUBEMAP)
+av_log(ctx, AV_LOG_INFO, "cubemap ");
+else if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE)
+av_log(ctx, AV_LOG_INFO, "tiled equirectangular ");
+else {
+av_log(ctx, AV_LOG_WARNING, "unknown");
+return;
+}
+
+yaw = ((double)spherical->yaw) / (1 << 16);
+pitch = ((double)spherical->pitch) / (1 << 16);
+roll = ((double)spherical->roll) / (1 << 16);
+av_log(ctx, AV_LOG_INFO, "(%f/%f/%f) ", yaw, pitch, roll);
+
+if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+size_t l, t, r, b;
+av_spherical_tile_bounds(spherical, frame->width, frame->height,
+ , , , );
+av_log(ctx, AV_LOG_INFO, "[%zu, %zu, %zu, %zu] ", l, t, r, b);
+} else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
+av_log(ctx, AV_LOG_INFO, "[pad %"PRIu32"] ", spherical->padding);
+}
+}
+
 static void dump_stereo3d(AVFilterContext *ctx, AVFrameSideData *sd)
 {
 AVStereo3D *stereo;
@@ -105,6 +143,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 case AV_FRAME_DATA_A53_CC:
 av_log(ctx, AV_LOG_INFO, "A/53 closed captions (%d bytes)", 
sd->size);
 break;
+case AV_FRAME_DATA_SPHERICAL:
+dump_spherical(ctx, frame, sd);
+break;
 case AV_FRAME_DATA_STEREO3D:
 dump_stereo3d(ctx, sd);
 break;
-- 
2.12.0

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

[libav-devel] [PATCH 1/2] vf_showinfo: Simplify reporting stereo3d information

2017-03-15 Thread Vittorio Giovara
---
 libavfilter/vf_showinfo.c | 14 +-
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 204ff7a857..b44f3d2bf2 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -51,19 +51,7 @@ static void dump_stereo3d(AVFilterContext *ctx, 
AVFrameSideData *sd)
 
 stereo = (AVStereo3D *)sd->data;
 
-av_log(ctx, AV_LOG_INFO, "type - ");
-switch (stereo->type) {
-case AV_STEREO3D_2D:  av_log(ctx, AV_LOG_INFO, "2D");  
   break;
-case AV_STEREO3D_SIDEBYSIDE:  av_log(ctx, AV_LOG_INFO, "side by 
side");   break;
-case AV_STEREO3D_TOPBOTTOM:   av_log(ctx, AV_LOG_INFO, "top and 
bottom"); break;
-case AV_STEREO3D_FRAMESEQUENCE:   av_log(ctx, AV_LOG_INFO, "frame 
alternate");break;
-case AV_STEREO3D_CHECKERBOARD:av_log(ctx, AV_LOG_INFO, 
"checkerboard");   break;
-case AV_STEREO3D_LINES:   av_log(ctx, AV_LOG_INFO, 
"interleaved lines");  break;
-case AV_STEREO3D_COLUMNS: av_log(ctx, AV_LOG_INFO, 
"interleaved columns");break;
-case AV_STEREO3D_SIDEBYSIDE_QUINCUNX: av_log(ctx, AV_LOG_INFO, "side by 
side "
-   "(quincunx 
subsampling)"); break;
-default:  av_log(ctx, AV_LOG_WARNING, 
"unknown"); break;
-}
+av_log(ctx, AV_LOG_INFO, "type - %s", av_stereo3d_type_name(stereo->type));
 
 if (stereo->flags & AV_STEREO3D_FLAG_INVERT)
 av_log(ctx, AV_LOG_INFO, " (inverted)");
-- 
2.12.0

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

Re: [libav-devel] [PATCH] spherical: Change types of bounding and pad to uint32_t

2017-03-15 Thread Vittorio Giovara
On Wed, Mar 15, 2017 at 5:52 PM, Luca Barbato <lu_z...@gentoo.org> wrote:
> On 15/03/2017 22:38, Vittorio Giovara wrote:
>> These values are defined to be 32bit in the specification,
>> so it makes more sense to store them as fixed width.
>>
>> Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
>> ---
>> Updated commit message, changed a couple of internal types.
>> Vittorio
>>
>
> While you are at it would you point that the values are defined a 0.32
> fixed point?

Do you mean in the commit log? They are documented in spherical.h.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] matroskaenc: add support for Spherical Video elements

2017-03-15 Thread Vittorio Giovara
On Thu, Mar 9, 2017 at 1:11 PM, James Almer  wrote:
> Signed-off-by: James Almer 
> ---
>  libavformat/matroskaenc.c | 81 
> +++
>  libavformat/version.h |  2 +-
>  2 files changed, 82 insertions(+), 1 deletion(-)

This looks good, thanks.
Pushing with a couple of minor cosmetic changes as discussed.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] spherical: Change types of bounding and pad to uint32_t

2017-03-15 Thread Vittorio Giovara
These values are defined to be 32bit in the specification,
so it makes more sense to store them as fixed width.

Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
Updated commit message, changed a couple of internal types.
Vittorio

 libavformat/dump.c|  2 +-
 libavformat/matroskadec.c |  6 +++---
 libavformat/mov.c |  7 +++
 libavutil/spherical.h | 10 +-
 4 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/libavformat/dump.c b/libavformat/dump.c
index 7514aee7ac..c56895628d 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -339,7 +339,7 @@ static void dump_spherical(void *ctx, AVCodecParameters 
*par, AVPacketSideData *
  , , , );
 av_log(ctx, AV_LOG_INFO, "[%zu, %zu, %zu, %zu] ", l, t, r, b);
 } else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
-av_log(ctx, AV_LOG_INFO, "[pad %zu] ", spherical->padding);
+av_log(ctx, AV_LOG_INFO, "[pad %"PRIu32"] ", spherical->padding);
 }
 }
 
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 4fbf4b9a96..c6e1a190a8 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1601,8 +1601,8 @@ 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;
+uint32_t l = 0, t = 0, r = 0, b = 0;
+uint32_t padding = 0;
 int ret;
 GetByteContext gb;
 
@@ -1627,7 +1627,7 @@ static int mkv_parse_video_projection(AVStream *st, const 
MatroskaTrack *track)
 if (b >= UINT_MAX - t || r >= UINT_MAX - l) {
 av_log(NULL, AV_LOG_ERROR,
"Invalid bounding rectangle coordinates "
-   "%zu,%zu,%zu,%zu\n", l, t, r, b);
+   "%"PRIu32",%"PRIu32",%"PRIu32",%"PRIu32"\n", l, t, r, 
b);
 return AVERROR_INVALIDDATA;
 }
 } else if (track->video.projection.private.size != 0) {
diff --git a/libavformat/mov.c b/libavformat/mov.c
index c6e7a38398..1c1857eaf9 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3237,9 +3237,8 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 MOVStreamContext *sc;
 int size, version, layout;
 int32_t yaw, pitch, roll;
-size_t l = 0, t = 0, r = 0, b = 0;
-size_t padding = 0;
-uint32_t tag;
+uint32_t l = 0, t = 0, r = 0, b = 0;
+uint32_t tag, padding = 0;
 enum AVSphericalProjection projection;
 
 if (c->fc->nb_streams < 1)
@@ -3335,7 +3334,7 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 if (b >= UINT_MAX - t || r >= UINT_MAX - l) {
 av_log(c->fc, AV_LOG_ERROR,
"Invalid bounding rectangle coordinates "
-   "%zu,%zu,%zu,%zu\n", l, t, r, b);
+   "%"PRIu32",%"PRIu32",%"PRIu32",%"PRIu32"\n", l, t, r, b);
 return AVERROR_INVALIDDATA;
 }
 
diff --git a/libavutil/spherical.h b/libavutil/spherical.h
index e7fc1d69fb..fd662cf676 100644
--- a/libavutil/spherical.h
+++ b/libavutil/spherical.h
@@ -164,10 +164,10 @@ typedef struct AVSphericalMapping {
  *   projection type (@ref AV_SPHERICAL_EQUIRECTANGULAR_TILE),
  *   and should be ignored in all other cases.
  */
-size_t bound_left;   ///< Distance from the left edge
-size_t bound_top;///< Distance from the top edge
-size_t bound_right;  ///< Distance from the right edge
-size_t bound_bottom; ///< Distance from the bottom edge
+uint32_t bound_left;   ///< Distance from the left edge
+uint32_t bound_top;///< Distance from the top edge
+uint32_t bound_right;  ///< Distance from the right edge
+uint32_t bound_bottom; ///< Distance from the bottom edge
 /**
  * @}
  */
@@ -179,7 +179,7 @@ typedef struct AVSphericalMapping {
  *   (@ref AV_SPHERICAL_CUBEMAP), and should be ignored in all other
  *   cases.
  */
-size_t padding;
+uint32_t padding;
 } AVSphericalMapping;
 
 /**
-- 
2.12.0

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

Re: [libav-devel] [PATCH] spherical: Change types of bounding and pad to uint32_t

2017-03-15 Thread Vittorio Giovara
On Wed, Mar 15, 2017 at 10:54 AM, Anton Khirnov  wrote:
>
> I'm not against this change, but as this is an ABI break, it should be
> done during the major bump (which should be happening around now anyway).
> It should also be mentioned in apichages.

I am aware that this is an ABI break, but people claimed that since it
was so recent in practice it does not matter.
I don't have a strong opinion either way (I'd just like this to be over tbh).
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] spherical: Change types of bounding and pad to uint32_t

2017-03-14 Thread Vittorio Giovara
These types better reflect the ones described in the specification and
avoid any platform-specific implementation issues.

Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 libavformat/dump.c|  2 +-
 libavutil/spherical.h | 10 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavformat/dump.c b/libavformat/dump.c
index 7514aee7ac..c56895628d 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -339,7 +339,7 @@ static void dump_spherical(void *ctx, AVCodecParameters 
*par, AVPacketSideData *
  , , , );
 av_log(ctx, AV_LOG_INFO, "[%zu, %zu, %zu, %zu] ", l, t, r, b);
 } else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
-av_log(ctx, AV_LOG_INFO, "[pad %zu] ", spherical->padding);
+av_log(ctx, AV_LOG_INFO, "[pad %"PRIu32"] ", spherical->padding);
 }
 }
 
diff --git a/libavutil/spherical.h b/libavutil/spherical.h
index e7fc1d69fb..fd662cf676 100644
--- a/libavutil/spherical.h
+++ b/libavutil/spherical.h
@@ -164,10 +164,10 @@ typedef struct AVSphericalMapping {
  *   projection type (@ref AV_SPHERICAL_EQUIRECTANGULAR_TILE),
  *   and should be ignored in all other cases.
  */
-size_t bound_left;   ///< Distance from the left edge
-size_t bound_top;///< Distance from the top edge
-size_t bound_right;  ///< Distance from the right edge
-size_t bound_bottom; ///< Distance from the bottom edge
+uint32_t bound_left;   ///< Distance from the left edge
+uint32_t bound_top;///< Distance from the top edge
+uint32_t bound_right;  ///< Distance from the right edge
+uint32_t bound_bottom; ///< Distance from the bottom edge
 /**
  * @}
  */
@@ -179,7 +179,7 @@ typedef struct AVSphericalMapping {
  *   (@ref AV_SPHERICAL_CUBEMAP), and should be ignored in all other
  *   cases.
  */
-size_t padding;
+uint32_t padding;
 } AVSphericalMapping;
 
 /**
-- 
2.12.0

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

Re: [libav-devel] [PATCH] rtsp: Spin in a separate function the rtsp message parsing

2017-03-14 Thread Vittorio Giovara
On Tue, Mar 14, 2017 at 12:44 PM, Luca Barbato  wrote:
> Makes easier manage the polling function pending the
> threading support.
> ---

rtsp: Move message parsing to a separate function

Makes it easier to handle the polling function before we implement
full threading support.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] pixlet: Fix architecture-dependent code and values

2017-03-06 Thread Vittorio Giovara
On Thu, Mar 2, 2017 at 4:34 PM, Vittorio Giovara
<vittorio.giov...@gmail.com> wrote:
> @@ -389,29 +387,29 @@ static void filterfn(int16_t *dest, int16_t *tmp, 
> size_t size, float SCALE)
>  }
>
>  for (i = 0; i < hsize; i++) {
> -value = low [i + 1] * -0.07576144003329376f +
> -low [i + 0] *  0.8586296626673486f  +
> -low [i - 1] * -0.07576144003329376f +
> -high[i + 0] *  0.3535533905932737f  +
> -high[i - 1] *  0.3535533905932737f;
> -dest[i * 2] = av_clipf(value * SCALE, INT16_MIN, INT16_MAX);
> +value = (int64_t) low [i + 1] * -325392907  +
> +(int64_t) low [i + 0] *  3687786320 +
> +(int64_t) low [i - 1] * -325392907  +
> +(int64_t) high[i + 0] *  1518500249 +
> +(int64_t) high[i - 1] *  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] *  0.3687056777514043f  +
> -low [i - 1] * -0.01515228715813062f +
> -high[i + 1] *  0.07071067811865475f +
> -high[i + 0] * -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] * -65078576   +
> +(int64_t) low [i + 1] *  1583578880 +
> +(int64_t) low [i + 0] *  1583578880 +
> +(int64_t) low [i - 1] * -65078576   +
> +(int64_t) high[i + 1] *  303700064  +
> +(int64_t) high[i + 0] * -3644400640 +
> +(int64_t) high[i - 1] *  303700064;
> +dest[i * 2 + 1] = av_clip_int16(((value >> 32) * scale) >> 32);
>  }

Note: some of these values do not fit in int32_t, so I'm adding
INT64_C() to all of them, if that's ok.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] pixlet: Fix architecture-dependent code and values

2017-03-02 Thread Vittorio Giovara
Constants were using floating point precision which caused different
values to be generated on different architectures. Additionally on
big endian machines, the test would output bytes in native order which
is different from the one hardcoded in test.

So, eradicate the use of floats and use fixed point (32.32) arithmetics
everywhere, replacing floating constants with precomputed integer values,
and force the pixel format output to be the same in the fate test.

Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 libavcodec/pixlet.c   | 58 +++
 tests/fate/video.mak  |  2 +-
 tests/ref/fate/pixlet |  2 +-
 3 files changed, 33 insertions(+), 29 deletions(-)

diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c
index 3b4ff42365..5f16759e96 100644
--- a/libavcodec/pixlet.c
+++ b/libavcodec/pixlet.c
@@ -39,8 +39,6 @@
 #define H 0
 #define V 1
 
-#define SQR(x) ((x) * (x))
-
 typedef struct SubBand {
 size_t width, height;
 size_t size;
@@ -59,7 +57,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;
 
@@ -364,11 +362,11 @@ static void lowpass_prediction(int16_t *dst, int16_t 
*pred,
 }
 }
 
-static void filterfn(int16_t *dest, int16_t *tmp, size_t size, float SCALE)
+static void filterfn(int16_t *dest, int16_t *tmp, size_t 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;
@@ -389,29 +387,29 @@ static void filterfn(int16_t *dest, int16_t *tmp, size_t 
size, float SCALE)
 }
 
 for (i = 0; i < hsize; i++) {
-value = low [i + 1] * -0.07576144003329376f +
-low [i + 0] *  0.8586296626673486f  +
-low [i - 1] * -0.07576144003329376f +
-high[i + 0] *  0.3535533905932737f  +
-high[i - 1] *  0.3535533905932737f;
-dest[i * 2] = av_clipf(value * SCALE, INT16_MIN, INT16_MAX);
+value = (int64_t) low [i + 1] * -325392907  +
+(int64_t) low [i + 0] *  3687786320 +
+(int64_t) low [i - 1] * -325392907  +
+(int64_t) high[i + 0] *  1518500249 +
+(int64_t) high[i - 1] *  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] *  0.3687056777514043f  +
-low [i - 1] * -0.01515228715813062f +
-high[i + 1] *  0.07071067811865475f +
-high[i + 0] * -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] * -65078576   +
+(int64_t) low [i + 1] *  1583578880 +
+(int64_t) low [i + 0] *  1583578880 +
+(int64_t) low [i - 1] * -65078576   +
+(int64_t) high[i + 1] *  303700064  +
+(int64_t) high[i + 0] * -3644400640 +
+(int64_t) high[i - 1] *  303700064;
+dest[i * 2 + 1] = av_clip_int16(((value >> 32) * scale) >> 32);
 }
 }
 
 static void reconstruction(AVCodecContext *avctx, int16_t *dest,
size_t width, size_t height, ptrdiff_t stride,
-   float *scaling_h, float *scaling_v)
+   int64_t *scaling_h, int64_t *scaling_v)
 {
 PixletContext *ctx = avctx->priv_data;
 unsigned scaled_width, scaled_height;
@@ -423,8 +421,8 @@ static void reconstruction(AVCodecContext *avctx, int16_t 
*dest,
 tmp   = ctx->filter[0];
 
 for (i = 0; i < NB_LEVELS; i++) {
-float scale_v = scaling_v[i];
-float scale_h = scaling_h[i];
+int64_t scale_v = scaling_v[i];
+int64_t scale_h = scaling_h[i];
 scaled_width  <<= 1;
 scaled_height <<= 1;
 
@@ -457,12 +455,18 @@ static void postprocess_luma(AVFrame *frame, size_t w, 
size_t 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 << depth) - 1);
 int i, j;
 
 for (j = 0; j < h; j++) {
-for (i = 0; i < w; i++)
-dsty[i] = SQR(FFMAX(srcy[i], 0) * factor) * 65535;
+for (i = 0; i < w; i++) {
+if (srcy[i] <= 0)
+dsty[i] = 0;
+else if (srcy[i] > ((1 << depth) - 1))
+dsty[i] = 65535;
+else
+dsty[i] = ((int

Re: [libav-devel] [PATCH] fate: Set output pixel format in pixlet test

2017-03-02 Thread Vittorio Giovara
On Wed, Mar 1, 2017 at 9:56 PM, Vittorio Giovara
<vittorio.giov...@gmail.com> wrote:
> ---
> This should partially alleviate the breakage.
> Partially as in powerpc boxes should output the same hash, I still to
> verify whether it fixes the 32bit ones too.
> Vittorio
>
>  tests/fate/video.mak  | 2 +-
>  tests/ref/fate/pixlet | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

This is wrong, please ignore it.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 0/7] spherical set

2017-03-02 Thread Vittorio Giovara
On Tue, Feb 28, 2017 at 1:52 PM, Luca Barbato <lu_z...@gentoo.org> wrote:
> On 28/02/2017 16:58, Vittorio Giovara wrote:
>> Hi,
>> this should be the final version of the set. A couple of these have
>> been reviewed, but I would like to have a final complete pass before
>> pushing.
>>
>> Cheers,
>> Vittorio
>
>
> Overall looks ok, between the two versions for setting the bounds I do
> not have an opinion, pick the one you like better.

ok thank you

Oracle caught a 32 bit truncating, I changed the relevant code in sherical.c
-size_t orig_width  = (size_t) width  * UINT32_MAX /
- (UINT32_MAX - map->bound_right - map->bound_left);
-size_t orig_height = (size_t) height * UINT32_MAX /
- (UINT32_MAX - map->bound_bottom - map->bound_top);
+uint64_t orig_width  = (uint64_t) width  * UINT32_MAX /
+   (UINT32_MAX - map->bound_right - map->bound_left);
+uint64_t orig_height = (uint64_t) height * UINT32_MAX /
+   (UINT32_MAX - map->bound_bottom - map->bound_top);
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] fate: Set output pixel format in pixlet test

2017-03-01 Thread Vittorio Giovara
---
This should partially alleviate the breakage.
Partially as in powerpc boxes should output the same hash, I still to
verify whether it fixes the 32bit ones too.
Vittorio

 tests/fate/video.mak  | 2 +-
 tests/ref/fate/pixlet | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/fate/video.mak b/tests/fate/video.mak
index e35199f6c2..4b59b14631 100644
--- a/tests/fate/video.mak
+++ b/tests/fate/video.mak
@@ -247,7 +247,7 @@ FATE_SAMPLES_AVCONV-$(call DEMDEC, PAF, PAF_VIDEO) += 
fate-paf-video
 fate-paf-video: CMD = framecrc -i $(TARGET_SAMPLES)/paf/hod1-partial.paf 
-pix_fmt rgb24 -an
 
 FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, PIXLET) += fate-pixlet
-fate-pixlet: CMD = framecrc -i $(TARGET_SAMPLES)/pxlt/pixlet.mov -an
+fate-pixlet: CMD = framecrc -i $(TARGET_SAMPLES)/pxlt/pixlet.mov -an -pix_fmt 
rgb24
 
 FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, QPEG) += fate-qpeg
 fate-qpeg: CMD = framecrc -i $(TARGET_SAMPLES)/qpeg/Clock.avi -an -pix_fmt 
rgb24
diff --git a/tests/ref/fate/pixlet b/tests/ref/fate/pixlet
index dd34382ffc..8102262ee3 100644
--- a/tests/ref/fate/pixlet
+++ b/tests/ref/fate/pixlet
@@ -1,2 +1,2 @@
 #tb 0: 1/25
-0,  0,  0,1,  2764800, 0xd0b6bf48
+0,  0,  0,1,  2764800, 0x3a2e9aa4
-- 
2.12.0

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

Re: [libav-devel] [PATCH] configure: Fix typo in objcc default setting

2017-02-28 Thread Vittorio Giovara
On Tue, Feb 28, 2017 at 1:32 PM, Diego Biurrun  wrote:
> Also drop stray duplicate OBJCC config.mak entry.
> ---
>  configure | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index 9f5f009..2adaa23 100755
> --- a/configure
> +++ b/configure
> @@ -2960,7 +2960,7 @@ fi
>
>  ar_default="${cross_prefix}${ar_default}"
>  cc_default="${cross_prefix}${cc_default}"
> -occ_default="${cross_prefix}${occ_default}"
> +objcc_default="${cross_prefix}${objcc_default}"
>  nm_default="${cross_prefix}${nm_default}"
>  pkg_config_default="${cross_prefix}${pkg_config_default}"
>  ranlib="${cross_prefix}${ranlib}"
> @@ -5259,7 +5259,6 @@ CC_IDENT=$cc_ident
>  ARCH=$arch
>  INTRINSICS=$intrinsics
>  CC=$cc
> -OBJCC=$cc
>  AS=$as
>  OBJCC=$objcc
>  LD=$ld
> --

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

Re: [libav-devel] [PATCH 5/7] mov: Export bounds and padding from spherical metadata

2017-02-28 Thread Vittorio Giovara
On Tue, Feb 28, 2017 at 10:58 AM, Vittorio Giovara
<vittorio.giov...@gmail.com> wrote:
> Update the fate test as needed.
>
> Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
> ---
>  libavformat/mov.c| 28 +++-
>  tests/fate/mov.mak   |  2 +-
>  tests/ref/fate/mov-spherical |  6 +-
>  3 files changed, 33 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index f406831..d5ac6d2 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -3237,6 +3237,8 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>  MOVStreamContext *sc;
>  int size, version;
>  int32_t yaw, pitch, roll;
> +size_t l, t, r, b;
> +size_t padding = 0;
>  uint32_t tag;
>  enum AVSphericalProjection projection;
>
> @@ -3316,9 +3318,25 @@ 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 "
> +   "%zu,%zu,%zu,%zu\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");
> @@ -3335,6 +3353,14 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>  sc->spherical->pitch = pitch;
>  sc->spherical->roll  = roll;
>
> +sc->spherical->padding = padding;
> +
> +if (projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
> +sc->spherical->bound_left   = l;
> +sc->spherical->bound_top= t;
> +sc->spherical->bound_right  = r;
> +sc->spherical->bound_bottom = b;
> +}
>  return 0;

Similar to mkv, this has a local modification

-if (projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
-sc->spherical->bound_left   = l;
-sc->spherical->bound_top= t;
-sc->spherical->bound_right  = r;
-sc->spherical->bound_bottom = b;
-}
+sc->spherical->bound_left   = l;
+sc->spherical->bound_top= t;
+sc->spherical->bound_right  = r;
+sc->spherical->bound_bottom = b;

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

[libav-devel] [PATCH] mkv: Export bounds and padding from spherical metadata

2017-02-28 Thread Vittorio Giovara
Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
Updated according James' suggestion.
Vittorio

 libavformat/matroskadec.c | 55 +--
 1 file changed, 53 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 3dd54eb..4fbf4b9 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1601,18 +1601,62 @@ 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(, track->video.projection.private.data,
+ track->video.projection.private.size);
+
+if (bytestream2_get_byte() != 0) {
+av_log(NULL, AV_LOG_WARNING, "Unknown spherical metadata\n");
+return 0;
+}
+
+bytestream2_skip(, 3); // flags
 
 switch (track->video.projection.type) {
 case MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR:
-projection = AV_SPHERICAL_EQUIRECTANGULAR;
+if (track->video.projection.private.size == 20) {
+t = bytestream2_get_be32();
+b = bytestream2_get_be32();
+l = bytestream2_get_be32();
+r = bytestream2_get_be32();
+
+if (b >= UINT_MAX - t || r >= UINT_MAX - l) {
+av_log(NULL, AV_LOG_ERROR,
+   "Invalid bounding rectangle coordinates "
+   "%zu,%zu,%zu,%zu\n", l, t, r, b);
+return AVERROR_INVALIDDATA;
+}
+} 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) {
 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();
+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();
+} else {
+av_log(NULL, AV_LOG_ERROR, "Unknown spherical metadata\n");
+return AVERROR_INVALIDDATA;
 }
-projection = AV_SPHERICAL_CUBEMAP;
 break;
 default:
 av_log(NULL, AV_LOG_WARNING,
@@ -1631,6 +1675,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) {
-- 
2.10.0

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

Re: [libav-devel] [PATCH 1/4] put_bits: bounds check buffer

2017-02-28 Thread Vittorio Giovara
On Tue, Feb 28, 2017 at 11:35 AM, John Stebbins <stebb...@jetheaddev.com> wrote:
> On 02/28/2017 09:16 AM, John Stebbins wrote:
>> On 02/28/2017 08:40 AM, Luca Barbato wrote:
>>> On 28/02/2017 16:27, Vittorio Giovara wrote:
>>>> On Sun, Feb 26, 2017 at 12:58 PM, John Stebbins <stebb...@jetheaddev.com> 
>>>> wrote:
>>>>> This prevents invalid writes outside put_bits' buffer.
>>>>>
>>>>> It also has the side effect of allowing measurement of the required
>>>>> size of a buffer without the need to pre-allocate an over-sized buffer.
>>>>>
>>>>> This fixes a crash in aacenc.c where it could write past the end of the
>>>>> allocated packet, which is allocated to be the max size allowed by the
>>>>> aac spec.  aacenc.c uses the above feature to check the size
>>>>> of encoded data and try again when the size is too large.
>>>>> ---
>>>>>  libavcodec/put_bits.h | 14 ++
>>>>>  1 file changed, 10 insertions(+), 4 deletions(-)
>>>>>
>>>>> diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h
>>>>> index 17666fa..30b1dd2 100644
>>>>> --- a/libavcodec/put_bits.h
>>>>> +++ b/libavcodec/put_bits.h
>>>>> @@ -89,10 +89,14 @@ static inline void flush_put_bits(PutBitContext *s)
>>>>>  while (s->bit_left < 32) {
>>>>>  /* XXX: should test end of buffer */
>>>>>  #ifdef BITSTREAM_WRITER_LE
>>>>> -*s->buf_ptr++ = s->bit_buf;
>>>>> +if (s->buf_ptr < s->buf_end)
>>>>> +*s->buf_ptr = s->bit_buf;
>>>>> +s->buf_ptr++;
>>>>>  s->bit_buf  >>= 8;
>>>>>  #else
>>>>> -*s->buf_ptr++ = s->bit_buf >> 24;
>>>>> +if (s->buf_ptr < s->buf_end)
>>>>> +*s->buf_ptr = s->bit_buf >> 24;
>>>>> +s->buf_ptr++;
>>>>>  s->bit_buf  <<= 8;
>>>>>  #endif
>>>>>  s->bit_left  += 8;
>>>> shouldn't you move the buffer pointer only if it's within bounds?
>>>> namely, do s->buf_ptr++; only when s->buf_ptr < s->buf_end
>>>> same in the other chunk
>>>>
>>> We'd have to change the functions that report the nominal size written then.
>>>
>>>
>> Correct, the idea is that you can still call put_bits_count() to discover 
>> how much would have been written, even when
>> the buffer is too small.  So you can do things like put_bits_init((s, NULL, 
>> 0), then call execute some code that
>> "writes" using put_bits and measure what size buffer you need with 
>> put_bits_count.  aacenc.c does something like this.
>> It doesn't set a zero size buffer, but it sets a buffer that may be too 
>> small, and when it has written too much it
>> decreases lambda and tries again.
>>
>
> This conversation gives me a thought on how to improve this patch some.  
> Perhaps we should modify put_bits_count to
> return FFMIN(s->size_in_bits, (s->buf_ptr - s->buf) * 8 + 32 - s->bit_left)); 
>  And then create a new function that
> returns the number of bits that *would* have been written if the buffer was 
> not too small.  This gives an extra layer of
> safety that we never had before.  Code that doesn't intend to overwrite the 
> buffer, but does, would get the actual size
> of the buffer when calling put_bits_count and therefore wouldn't accidentally 
> access outside the buffer (e.g.
> avio_write(io, buf, put_bits_count(s) / 8)).  Code that knows it may overflow 
> the buffer (aacenc.c) would use the new
> function to check for overflow.
>
> Would this address your concern Vittorio?

I think so, and thanks for the explanation. I just hope that this
doesn't end up being more complicated than it should.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH 3.5/7] mov: Validate cubemap layout

2017-02-28 Thread Vittorio Giovara
---
As suggested by James, this goes immediately after 3/7.
Vittorio

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index f406831..2bd4807 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3235,7 +3235,7 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 {
 AVStream *st;
 MOVStreamContext *sc;
-int size, version;
+int size, version, layout;
 int32_t yaw, pitch, roll;
 uint32_t tag;
 enum AVSphericalProjection projection;
@@ -3315,6 +3315,12 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 avio_skip(pb, 3); /* 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;
 break;
 case MKTAG('e','q','u','i'):
-- 
2.10.0

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

Re: [libav-devel] [PATCH 3/3] Add Apple Pixlet decoder

2017-02-28 Thread Vittorio Giovara
On Thu, Feb 23, 2017 at 6:18 AM, Diego Biurrun <di...@biurrun.de> wrote:
> On Wed, Feb 22, 2017 at 12:53:35PM -0500, Vittorio Giovara wrote:
>> --- /dev/null
>> +++ b/libavcodec/pixlet.c
>> @@ -0,0 +1,689 @@
>> +static int read_high_coeffs(AVCodecContext *avctx, uint8_t *src, int16_t 
>> *dst,
>> +int size, int64_t c, int a, int64_t d,
>> +int width, ptrdiff_t stride)
>> +{
>> +PixletContext *ctx = avctx->priv_data;
>> +BitstreamContext *bc = >bc;
>> +unsigned cnt1, shbits, rlen, nbits, length, i = 0, j = 0, k;
>> +int ret, escape, pfx, value, yflag, xflag, flag = 0;
>> +int64_t state = 3, tmp;
>> +
>> +while (i < size) {
>> +if (state >> 8 != -3) {
>> +value = ff_clz((state >> 8) + 3) ^ 0x1F;
>> +} else {
>> +value = -1;
>> +}
>
> nit: pointless ()
>
>> +cnt1 = get_unary(bc, 0, length);
>> +if (cnt1 >= length) {
>> +cnt1 = bitstream_read(bc, nbits);
>> +} else {
>> +pfx= 14 + uint64_t) (value - 14)) >> 32) & (value - 
>> 14));
>
> Maybe just make value uint64_t instead of casting?
>
>> +static int read_highpass(AVCodecContext *avctx, uint8_t *ptr,
>> + int plane, AVFrame *frame)
>> +{
>> +for (i = 0; i < ctx->levels * 3; i++) {
>> +uint32_t magic = bytestream2_get_be32(>gb);
>> +
>> +if (magic != PIXLET_MAGIC) {
>> +av_log(avctx, AV_LOG_ERROR,
>> +   "wrong magic number: 0x%08X for plane %d, band %d\n",
>> +   magic, plane, i);
>
> magic is uint32_t, use the correct C99 printf conversion specifier.
>
>> +static int pixlet_decode_frame(AVCodecContext *avctx, void *data,
>> +   int *got_frame, AVPacket *avpkt)
>> +{
>> +uint32_t pktsize;
>> +
>> +pktsize = bytestream2_get_be32(>gb);
>> +if (pktsize <= 44 || pktsize - 4 > 
>> bytestream2_get_bytes_left(>gb)) {
>> +av_log(avctx, AV_LOG_ERROR, "Invalid packet size %u.\n", pktsize);
>
> same

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

[libav-devel] [PATCH 5/7] mov: Export bounds and padding from spherical metadata

2017-02-28 Thread Vittorio Giovara
Update the fate test as needed.

Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 libavformat/mov.c| 28 +++-
 tests/fate/mov.mak   |  2 +-
 tests/ref/fate/mov-spherical |  6 +-
 3 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index f406831..d5ac6d2 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3237,6 +3237,8 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 MOVStreamContext *sc;
 int size, version;
 int32_t yaw, pitch, roll;
+size_t l, t, r, b;
+size_t padding = 0;
 uint32_t tag;
 enum AVSphericalProjection projection;
 
@@ -3316,9 +3318,25 @@ 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 "
+   "%zu,%zu,%zu,%zu\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");
@@ -3335,6 +3353,14 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 sc->spherical->pitch = pitch;
 sc->spherical->roll  = roll;
 
+sc->spherical->padding = padding;
+
+if (projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+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/fate/mov.mak b/tests/fate/mov.mak
index 57cbb1c..9d64fd3 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -11,7 +11,7 @@ FATE_MOV += fate-mov-sar
 fate-mov-sar: CMD = probestream sample_aspect_ratio 
$(TARGET_SAMPLES)/mov/displaymatrix.mov
 
 FATE_MOV += fate-mov-spherical
-fate-mov-spherical: CMD = probestream projection,yaw,pitch,roll 
$(TARGET_SAMPLES)/mov/spherical.mov
+fate-mov-spherical: CMD = probestream 
projection,yaw,pitch,roll,left,top,right,bottom 
$(TARGET_SAMPLES)/mov/spherical.mov
 
 FATE_MOV += fate-mov-stereo3d
 fate-mov-stereo3d: CMD = probestream type $(TARGET_SAMPLES)/mov/spherical.mov
diff --git a/tests/ref/fate/mov-spherical b/tests/ref/fate/mov-spherical
index 760ae88..a3f8cdf 100644
--- a/tests/ref/fate/mov-spherical
+++ b/tests/ref/fate/mov-spherical
@@ -1,4 +1,8 @@
-equirectangular
+tiled equirectangular
+148
+73
+147
+72
 45
 30
 15
-- 
2.10.0

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

[libav-devel] [PATCH 7/7] mkv: Export bounds and padding from spherical metadata

2017-02-28 Thread Vittorio Giovara
Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 libavformat/matroskadec.c | 60 +--
 1 file changed, 58 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 3dd54eb..adcb553 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1601,18 +1601,65 @@ static int mkv_parse_video_projection(AVStream *st, 
const MatroskaTrack *track)
 AVSphericalMapping *spherical;
 enum AVSphericalProjection projection;
 size_t spherical_size;
+size_t l, t, r, b;
+size_t padding = 0;
 int ret;
+GetByteContext gb;
+
+bytestream2_init(, track->video.projection.private.data,
+ track->video.projection.private.size);
+
+if (bytestream2_get_byte() != 0) {
+av_log(NULL, AV_LOG_WARNING, "Unknown spherical metadata\n");
+return 0;
+}
+
+bytestream2_skip(, 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();
+b = bytestream2_get_be32();
+l = bytestream2_get_be32();
+r = bytestream2_get_be32();
+
+if (b >= UINT_MAX - t || r >= UINT_MAX - l) {
+av_log(NULL, AV_LOG_ERROR,
+   "Invalid bounding rectangle coordinates "
+   "%zu,%zu,%zu,%zu\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) {
 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();
+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();
+} else {
+av_log(NULL, AV_LOG_ERROR, "Unknown spherical metadata\n");
+return AVERROR_INVALIDDATA;
 }
-projection = AV_SPHERICAL_CUBEMAP;
 break;
 default:
 av_log(NULL, AV_LOG_WARNING,
@@ -1631,6 +1678,15 @@ 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;
+
+if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+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) {
-- 
2.10.0

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

[libav-devel] [PATCH 2/7] mov: Ignore old spherical metadata when newer version is present

2017-02-28 Thread Vittorio Giovara
---
 libavformat/mov.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index d5de5d6..f1ff6ad 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3335,7 +3335,8 @@ static int mov_parse_uuid_spherical(MOVStreamContext *sc, 
AVIOContext *pb, size_
 goto out;
 
 /* Check for mandatory keys and values, try to support XML as best-effort 
*/
-if (av_stristr(buffer, "") &&
+if (!sc->spherical &&
+av_stristr(buffer, "") &&
 (val = av_stristr(buffer, "")) &&
 av_stristr(val, "true") &&
 (val = av_stristr(buffer, "")) &&
@@ -3348,7 +3349,7 @@ static int mov_parse_uuid_spherical(MOVStreamContext *sc, 
AVIOContext *pb, size_
 
 sc->spherical->projection = AV_SPHERICAL_EQUIRECTANGULAR;
 
-if (av_stristr(buffer, "")) {
+if (av_stristr(buffer, "") && !sc->stereo3d) {
 enum AVStereo3DType mode;
 
 if (av_stristr(buffer, "left-right"))
-- 
2.10.0

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

[libav-devel] [PATCH 1/7] mov: Fix spherical metadata_source parsing

2017-02-28 Thread Vittorio Giovara
From: Aaron Colwell 

Signed-off-by: James Almer 
---
 libavformat/mov.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 5c9f85c..d5de5d6 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3252,7 +3252,7 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 }
 
 size = avio_rb32(pb);
-if (size > atom.size)
+if (size <= 12 || size > atom.size)
 return AVERROR_INVALIDDATA;
 
 tag = avio_rl32(pb);
@@ -3261,7 +3261,7 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 return 0;
 }
 avio_skip(pb, 4); /*  version + flags */
-avio_skip(pb, avio_r8(pb)); /* metadata_source */
+avio_skip(pb, size - 12); /* metadata_source */
 
 size = avio_rb32(pb);
 if (size > atom.size)
-- 
2.10.0

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

[libav-devel] [PATCH 4/7] spherical: Add tiled equirectangular type and projection-specific properties

2017-02-28 Thread Vittorio Giovara
Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 avtools/avprobe.c | 18 ++---
 doc/APIchanges|  5 
 libavformat/dump.c| 15 +--
 libavutil/spherical.c | 18 +
 libavutil/spherical.h | 74 +++
 libavutil/version.h   |  2 +-
 6 files changed, 126 insertions(+), 6 deletions(-)

diff --git a/avtools/avprobe.c b/avtools/avprobe.c
index 613e090..68f1922 100644
--- a/avtools/avprobe.c
+++ b/avtools/avprobe.c
@@ -792,11 +792,23 @@ static void show_stream(InputFile *ifile, InputStream 
*ist)
 spherical = (AVSphericalMapping *)sd->data;
 probe_object_header("spherical");
 
-if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR)
+if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR) {
 probe_str("projection", "equirectangular");
-else if (spherical->projection == AV_SPHERICAL_CUBEMAP)
+} else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
 probe_str("projection", "cubemap");
-else
+probe_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,
+ , , , );
+probe_str("projection", "tiled equirectangular");
+probe_object_header("bounding");
+probe_int("left", l);
+probe_int("top", t);
+probe_int("right", r);
+probe_int("bottom", b);
+probe_object_footer("bounding");
+} else
 probe_str("projection", "unknown");
 
 probe_object_header("orientation");
diff --git a/doc/APIchanges b/doc/APIchanges
index a919ffb..9367a5f 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,11 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2017-02-10 - xxx - lavu 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-xx-xx - xxx - lavc 57.34.0 - avcodec.h
   Add AVCodecContext.hw_device_ctx.
 
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 660df0a..7514aee 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -307,7 +307,7 @@ static void dump_cpb(void *ctx, AVPacketSideData *sd)
cpb->vbv_delay);
 }
 
-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;
@@ -321,6 +321,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, "cubemap ");
+else if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE)
+av_log(ctx, AV_LOG_INFO, "tiled equirectangular ");
 else {
 av_log(ctx, AV_LOG_WARNING, "unknown");
 return;
@@ -330,6 +332,15 @@ static void dump_spherical(void *ctx, AVPacketSideData *sd)
 pitch = ((double)spherical->pitch) / (1 << 16);
 roll = ((double)spherical->roll) / (1 << 16);
 av_log(ctx, AV_LOG_INFO, "(%f/%f/%f) ", yaw, pitch, roll);
+
+if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+size_t l, t, r, b;
+av_spherical_tile_bounds(spherical, par->width, par->height,
+ , , , );
+av_log(ctx, AV_LOG_INFO, "[%zu, %zu, %zu, %zu] ", l, t, r, b);
+} else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
+av_log(ctx, AV_LOG_INFO, "[pad %zu] ", spherical->padding);
+}
 }
 
 static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
@@ -382,7 +393,7 @@ static void dump_sidedata(void *ctx, AVStream *st, const 
char *indent)
 break;
 case AV_PKT_DATA_SPHERICAL:
 av_log(ctx, AV_LOG_INFO, "spherical: ");
-dump_spherical(ctx, );
+dump_spherical(ctx, st->codecpar, );
 break;
 default:
 av_log(ctx, AV_LOG_WARNING,
diff --git a/libavutil/spherical.c b/libavutil/spherical.c
index f6e53d1..5877292 1

[libav-devel] [PATCH 6/7] matroskadec: add support for Spherical Video elements

2017-02-28 Thread Vittorio Giovara
From: James Almer <jamr...@gmail.com>

Signed-off-by: James Almer <jamr...@gmail.com>
Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 libavformat/matroska.h| 14 ++
 libavformat/matroskadec.c | 69 +++
 2 files changed, 83 insertions(+)

diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index 91bb978..4e9f96e 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -118,6 +118,13 @@
 #define MATROSKA_ID_VIDEOASPECTRATIO 0x54B3
 #define MATROSKA_ID_VIDEOCOLORSPACE 0x2EB524
 
+#define MATROSKA_ID_VIDEOPROJECTION 0x7670
+#define MATROSKA_ID_VIDEOPROJECTIONTYPE 0x7671
+#define MATROSKA_ID_VIDEOPROJECTIONPRIVATE 0x7672
+#define MATROSKA_ID_VIDEOPROJECTIONPOSEYAW 0x7673
+#define MATROSKA_ID_VIDEOPROJECTIONPOSEPITCH 0x7674
+#define MATROSKA_ID_VIDEOPROJECTIONPOSEROLL 0x7675
+
 /* IDs in the trackaudio master */
 #define MATROSKA_ID_AUDIOSAMPLINGFREQ 0xB5
 #define MATROSKA_ID_AUDIOOUTSAMPLINGFREQ 0x78B5
@@ -256,6 +263,13 @@ typedef enum {
   MATROSKA_VIDEO_STEREOMODE_TYPE_NB,
 } MatroskaVideoStereoModeType;
 
+typedef enum {
+  MATROSKA_VIDEO_PROJECTION_TYPE_RECTANGULAR= 0,
+  MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR= 1,
+  MATROSKA_VIDEO_PROJECTION_TYPE_CUBEMAP= 2,
+  MATROSKA_VIDEO_PROJECTION_TYPE_MESH   = 3,
+} MatroskaVideoProjectionType;
+
 /*
  * Matroska Codec IDs, strings
  */
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 4e121b6..3dd54eb 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -45,6 +45,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/lzo.h"
 #include "libavutil/mathematics.h"
+#include "libavutil/spherical.h"
 
 #include "libavcodec/bytestream.h"
 #include "libavcodec/flac.h"
@@ -116,6 +117,14 @@ typedef struct MatroskaTrackEncoding {
 MatroskaTrackCompression compression;
 } MatroskaTrackEncoding;
 
+typedef struct MatroskaTrackVideoProjection {
+uint64_t type;
+EbmlBin private;
+double yaw;
+double pitch;
+double roll;
+} MatroskaTrackVideoProjection;
+
 typedef struct MatroskaTrackVideo {
 double   frame_rate;
 uint64_t display_width;
@@ -126,6 +135,7 @@ typedef struct MatroskaTrackVideo {
 uint64_t interlaced;
 uint64_t field_order;
 uint64_t stereo_mode;
+MatroskaTrackVideoProjection projection;
 } MatroskaTrackVideo;
 
 typedef struct MatroskaTrackAudio {
@@ -309,6 +319,15 @@ static EbmlSyntax matroska_info[] = {
 { 0 }
 };
 
+static const EbmlSyntax matroska_track_video_projection[] = {
+{ MATROSKA_ID_VIDEOPROJECTIONTYPE,  EBML_UINT,  0, 
offsetof(MatroskaTrackVideoProjection, type), { .u = 
MATROSKA_VIDEO_PROJECTION_TYPE_RECTANGULAR } },
+{ MATROSKA_ID_VIDEOPROJECTIONPRIVATE,   EBML_BIN,   0, 
offsetof(MatroskaTrackVideoProjection, private) },
+{ MATROSKA_ID_VIDEOPROJECTIONPOSEYAW,   EBML_FLOAT, 0, 
offsetof(MatroskaTrackVideoProjection, yaw), { .f=0.0 } },
+{ MATROSKA_ID_VIDEOPROJECTIONPOSEPITCH, EBML_FLOAT, 0, 
offsetof(MatroskaTrackVideoProjection, pitch), { .f=0.0 } },
+{ MATROSKA_ID_VIDEOPROJECTIONPOSEROLL,  EBML_FLOAT, 0, 
offsetof(MatroskaTrackVideoProjection, roll), { .f=0.0 } },
+{ 0 }
+};
+
 static EbmlSyntax matroska_track_video[] = {
 { MATROSKA_ID_VIDEOFRAMERATE,  EBML_FLOAT, 0, 
offsetof(MatroskaTrackVideo, frame_rate) },
 { MATROSKA_ID_VIDEODISPLAYWIDTH,   EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, display_width) },
@@ -316,6 +335,7 @@ static EbmlSyntax matroska_track_video[] = {
 { MATROSKA_ID_VIDEOPIXELWIDTH, EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, pixel_width) },
 { MATROSKA_ID_VIDEOPIXELHEIGHT,EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, pixel_height) },
 { MATROSKA_ID_VIDEOCOLORSPACE, EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, fourcc) },
+{ MATROSKA_ID_VIDEOPROJECTION, EBML_NEST,  0, 
offsetof(MatroskaTrackVideo, projection), { .n = 
matroska_track_video_projection } },
 { MATROSKA_ID_VIDEOPIXELCROPB, EBML_NONE },
 { MATROSKA_ID_VIDEOPIXELCROPT, EBML_NONE },
 { MATROSKA_ID_VIDEOPIXELCROPL, EBML_NONE },
@@ -1576,6 +1596,51 @@ static void mkv_stereo_mode_display_mul(int stereo_mode,
 }
 }
 
+static int mkv_parse_video_projection(AVStream *st, const MatroskaTrack *track)
+{
+AVSphericalMapping *spherical;
+enum AVSphericalProjection projection;
+size_t spherical_size;
+int ret;
+
+switch (track->video.projection.type) {
+case MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR:
+projection = AV_SPHERICAL_EQUIRECTANGULAR;
+break;
+case MATROSKA_VIDEO_PROJECTION_TYPE_CUBEMAP:
+if (track->video.projection.private.size < 4) {
+av_log(NULL, AV_LOG_ERROR, "Missing projection private 
properties\n");
+return AVERROR_INVALIDDATA;
+}
+proj

[libav-devel] [PATCH 3/7] mov: Validate spherical metadata version

2017-02-28 Thread Vittorio Giovara
---
 libavformat/mov.c | 26 ++
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index f1ff6ad..f406831 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3235,7 +3235,7 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 {
 AVStream *st;
 MOVStreamContext *sc;
-int size;
+int size, version;
 int32_t yaw, pitch, roll;
 uint32_t tag;
 enum AVSphericalProjection projection;
@@ -3260,7 +3260,13 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 av_log(c->fc, AV_LOG_ERROR, "Missing spherical video header\n");
 return 0;
 }
-avio_skip(pb, 4); /*  version + flags */
+version = avio_r8(pb);
+if (version != 0) {
+av_log(c->fc, AV_LOG_WARNING, "Unknown spherical version %d\n",
+   version);
+return 0;
+}
+avio_skip(pb, 3); /* flags */
 avio_skip(pb, size - 12); /* metadata_source */
 
 size = avio_rb32(pb);
@@ -3282,7 +3288,13 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 av_log(c->fc, AV_LOG_ERROR, "Missing projection header box\n");
 return 0;
 }
-avio_skip(pb, 4); /*  version + flags */
+version = avio_r8(pb);
+if (version != 0) {
+av_log(c->fc, AV_LOG_WARNING, "Unknown spherical version %d\n",
+   version);
+return 0;
+}
+avio_skip(pb, 3); /* flags */
 
 /* 16.16 fixed point */
 yaw   = avio_rb32(pb);
@@ -3294,7 +3306,13 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 return AVERROR_INVALIDDATA;
 
 tag = avio_rl32(pb);
-avio_skip(pb, 4); /*  version + flags */
+version = avio_r8(pb);
+if (version != 0) {
+av_log(c->fc, AV_LOG_WARNING, "Unknown spherical version %d\n",
+   version);
+return 0;
+}
+avio_skip(pb, 3); /* flags */
 switch (tag) {
 case MKTAG('c','b','m','p'):
 projection = AV_SPHERICAL_CUBEMAP;
-- 
2.10.0

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

[libav-devel] [PATCH 0/7] spherical set

2017-02-28 Thread Vittorio Giovara
Hi,
this should be the final version of the set. A couple of these have
been reviewed, but I would like to have a final complete pass before
pushing.

Cheers,
Vittorio

Aaron Colwell (1):
  mov: Fix spherical metadata_source parsing

James Almer (1):
  matroskadec: add support for Spherical Video elements

Vittorio Giovara (5):
  mov: Ignore old spherical metadata when newer version is present
  mov: Validate spherical metadata version
  spherical: Add tiled equirectangular type and projection-specific
properties
  mov: Export bounds and padding from spherical metadata
  mkv: Export bounds and padding from spherical metadata

 avtools/avprobe.c|  18 +--
 doc/APIchanges   |   5 ++
 libavformat/dump.c   |  15 +-
 libavformat/matroska.h   |  14 +
 libavformat/matroskadec.c| 125 +++
 libavformat/mov.c|  63 ++
 libavutil/spherical.c|  18 +++
 libavutil/spherical.h|  74 +
 libavutil/version.h  |   2 +-
 tests/fate/mov.mak   |   2 +-
 tests/ref/fate/mov-spherical |   6 ++-
 11 files changed, 325 insertions(+), 17 deletions(-)

-- 
2.10.0

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

Re: [libav-devel] [PATCH 1/4] put_bits: bounds check buffer

2017-02-28 Thread Vittorio Giovara
On Sun, Feb 26, 2017 at 12:58 PM, John Stebbins  wrote:
> This prevents invalid writes outside put_bits' buffer.
>
> It also has the side effect of allowing measurement of the required
> size of a buffer without the need to pre-allocate an over-sized buffer.
>
> This fixes a crash in aacenc.c where it could write past the end of the
> allocated packet, which is allocated to be the max size allowed by the
> aac spec.  aacenc.c uses the above feature to check the size
> of encoded data and try again when the size is too large.
> ---
>  libavcodec/put_bits.h | 14 ++
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h
> index 17666fa..30b1dd2 100644
> --- a/libavcodec/put_bits.h
> +++ b/libavcodec/put_bits.h
> @@ -89,10 +89,14 @@ static inline void flush_put_bits(PutBitContext *s)
>  while (s->bit_left < 32) {
>  /* XXX: should test end of buffer */
>  #ifdef BITSTREAM_WRITER_LE
> -*s->buf_ptr++ = s->bit_buf;
> +if (s->buf_ptr < s->buf_end)
> +*s->buf_ptr = s->bit_buf;
> +s->buf_ptr++;
>  s->bit_buf  >>= 8;
>  #else
> -*s->buf_ptr++ = s->bit_buf >> 24;
> +if (s->buf_ptr < s->buf_end)
> +*s->buf_ptr = s->bit_buf >> 24;
> +s->buf_ptr++;
>  s->bit_buf  <<= 8;
>  #endif
>  s->bit_left  += 8;

shouldn't you move the buffer pointer only if it's within bounds?
namely, do s->buf_ptr++; only when s->buf_ptr < s->buf_end
same in the other chunk
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH 3/3] Add Apple Pixlet decoder

2017-02-22 Thread Vittorio Giovara
From: Paul B Mahol <one...@gmail.com>

Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
Changes from last iteration:
- lowpass_prediction is rewritten to be clearer (by Anton)
- bitstream_unget is used instead of read + branch/skip
Missing version.h bump, I'll add it at push time.
Vittorio

 Changelog   |   1 +
 doc/general.texi|   1 +
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/avcodec.h|   1 +
 libavcodec/codec_desc.c |   7 +
 libavcodec/pixlet.c | 689 
 libavformat/isom.c  |   2 +
 tests/fate/video.mak|   3 +
 tests/ref/fate/pixlet   |   2 +
 10 files changed, 708 insertions(+)
 create mode 100644 libavcodec/pixlet.c
 create mode 100644 tests/ref/fate/pixlet

diff --git a/Changelog b/Changelog
index 713883d..8e8bbcb 100644
--- a/Changelog
+++ b/Changelog
@@ -8,6 +8,7 @@ version :
 - VAAPI-accelerated deinterlacing
 - config.log and other configuration files moved into avbuild/ directory
 - VAAPI-accelerated MPEG-2 and VP8 encoding
+- Apple Pixlet decoder
 
 
 version 12:
diff --git a/doc/general.texi b/doc/general.texi
index d232300..54e319f 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -590,6 +590,7 @@ following image formats are supported:
 @item ANSI/ASCII art @tab @tab  X
 @item Apple Intermediate Codec @tab @tab  X
 @item Apple MJPEG-B  @tab @tab  X
+@item Apple Pixlet   @tab @tab  X
 @item Apple ProRes   @tab  X  @tab  X
 @item Apple QuickDraw@tab @tab  X
 @tab fourcc: qdrw
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 7d28d66..7f295dc 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -375,6 +375,7 @@ OBJS-$(CONFIG_PGMYUV_DECODER)  += pnmdec.o pnm.o
 OBJS-$(CONFIG_PGMYUV_ENCODER)  += pnmenc.o
 OBJS-$(CONFIG_PGSSUB_DECODER)  += pgssubdec.o
 OBJS-$(CONFIG_PICTOR_DECODER)  += pictordec.o cga_data.o
+OBJS-$(CONFIG_PIXLET_DECODER)  += pixlet.o
 OBJS-$(CONFIG_PNG_DECODER) += png.o pngdec.o pngdsp.o
 OBJS-$(CONFIG_PNG_ENCODER) += png.o pngenc.o
 OBJS-$(CONFIG_PPM_DECODER) += pnmdec.o pnm.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 46c42c5..1bfddb0 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -231,6 +231,7 @@ void avcodec_register_all(void)
 REGISTER_ENCDEC (PGM,   pgm);
 REGISTER_ENCDEC (PGMYUV,pgmyuv);
 REGISTER_DECODER(PICTOR,pictor);
+REGISTER_DECODER(PIXLET,pixlet);
 REGISTER_ENCDEC (PNG,   png);
 REGISTER_ENCDEC (PPM,   ppm);
 REGISTER_ENCDEC (PRORES,prores);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index b7bf85a..489a618 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -392,6 +392,7 @@ enum AVCodecID {
 AV_CODEC_ID_MAGICYUV,
 AV_CODEC_ID_TRUEMOTION2RT,
 AV_CODEC_ID_AV1,
+AV_CODEC_ID_PIXLET,
 
 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
start of audio codecs
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 18568c9..ab2018b 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1212,6 +1212,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Alliance for Open Media AV1"),
 .props = AV_CODEC_PROP_LOSSY,
 },
+{
+.id= AV_CODEC_ID_PIXLET,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "pixlet",
+.long_name = NULL_IF_CONFIG_SMALL("Apple Pixlet"),
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+},
 
 /* image codecs */
 {
diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c
new file mode 100644
index 000..713167d
--- /dev/null
+++ b/libavcodec/pixlet.c
@@ -0,0 +1,689 @@
+/*
+ * Apple Pixlet decoder
+ * Copyright (c) 2016 Paul B Mahol
+ *
+ * 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 "libavutil/imgutils.h"
+#include "libavutil/intmath.h"

[libav-devel] [PATCH 1/3] intmath: add faster clz support

2017-02-22 Thread Vittorio Giovara
From: Ganesh Ajjanagadde 

---
 libavutil/intmath.h | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/libavutil/intmath.h b/libavutil/intmath.h
index a5ee652..780bbab 100644
--- a/libavutil/intmath.h
+++ b/libavutil/intmath.h
@@ -44,6 +44,10 @@
 #   endif
 #endif /* ff_log2 */
 
+#ifndef ff_clz
+#   define ff_clz(v) __builtin_clz(v)
+#endif /* ff_clz */
+
 #endif /* AV_GCC_VERSION_AT_LEAST(3,4) */
 
 extern const uint8_t ff_log2_tab[256];
@@ -132,6 +136,21 @@ static av_always_inline av_const int ff_ctz_c(int v)
 }
 #endif
 
+#ifndef ff_clz
+#define ff_clz ff_clz_c
+static av_always_inline av_const unsigned ff_clz_c(unsigned x)
+{
+unsigned i = sizeof(x) * 8;
+
+while (x) {
+x >>= 1;
+i--;
+}
+
+return i;
+}
+#endif
+
 /**
  * Trailing zero bit count.
  *
-- 
2.10.0

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

[libav-devel] [PATCH 2/3] libavutil: add av_mod_uintp2

2017-02-22 Thread Vittorio Giovara
From: James Almer 

Signed-off-by: James Almer 
---
 libavutil/common.h | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/libavutil/common.h b/libavutil/common.h
index d2ddcba..3832f10 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -182,6 +182,17 @@ static av_always_inline av_const unsigned 
av_clip_uintp2_c(int a, int p)
 else   return  a;
 }
 
+/**
+ * Clear high bits from an unsigned integer starting with specific bit position
+ * @param  a value to clip
+ * @param  p bit position to clip at
+ * @return clipped value
+ */
+static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned 
p)
+{
+return a & ((1 << p) - 1);
+}
+
 /**
  * Add two signed 32-bit values with saturation.
  *
@@ -410,6 +421,9 @@ static av_always_inline av_const int 
av_popcount64_c(uint64_t x)
 #ifndef av_clip_uintp2
 #   define av_clip_uintp2   av_clip_uintp2_c
 #endif
+#ifndef av_mod_uintp2
+#   define av_mod_uintp2av_mod_uintp2_c
+#endif
 #ifndef av_sat_add32
 #   define av_sat_add32 av_sat_add32_c
 #endif
-- 
2.10.0

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

Re: [libav-devel] [PATCH 5/5] fate: Add build-only targets to FATE

2017-02-22 Thread Vittorio Giovara
On Wed, Feb 22, 2017 at 11:39 AM, Diego Biurrun  wrote:
> ---
> diff --git a/tests/fate/examples.mak b/tests/fate/examples.mak
> new file mode 100644
> index 000..9809645
> --- /dev/null
> +++ b/tests/fate/examples.mak
> @@ -0,0 +1,32 @@
> +FATE_EXAMPLES-$(CONFIG_DECODE_AUDIO_EXAMPLE)+= fate-example-decode_audio
> +fate-example-decode_audio: doc/examples/decode_audio$(EXESUF)
> +
> +FATE_EXAMPLES-$(CONFIG_DECODE_VIDEO_EXAMPLE)+= fate-example-decode_video
> +fate-example-decode_video: doc/examples/decode_video$(EXESUF)
> +
> +FATE_EXAMPLES-$(CONFIG_ENCODE_AUDIO_EXAMPLE)+= fate-example-encode_audio
> +fate-example-encode_audio: doc/examples/encode_audio$(EXESUF)
> +
> +FATE_EXAMPLES-$(CONFIG_ENCODE_VIDEO_EXAMPLE)+= fate-example-encode_video
> +fate-example-encode_video: doc/examples/encode_video$(EXESUF)
> +
> +FATE_EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE)+= fate-example-filter_audio
> +fate-example-filter_audio: doc/examples/filter_audio$(EXESUF)
> +
> +FATE_EXAMPLES-$(CONFIG_METADATA_EXAMPLE)+= fate-example-metadata
> +fate-example-metadata: doc/examples/metadata$(EXESUF)
> +
> +FATE_EXAMPLES-$(CONFIG_OUTPUT_EXAMPLE)  += fate-example-output
> +fate-example-output: doc/examples/output$(EXESUF)
> +
> +FATE_EXAMPLES-$(CONFIG_QSVDEC_EXAMPLE)  += fate-example-qsvdec
> +fate-example-qsvdec: doc/examples/qsvdec$(EXESUF)
> +
> +FATE_EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE)   += fate-example-transcode_aac
> +fate-example-transcode_aac: doc/examples/transcode_aac$(EXESUF)
> +
> +$(FATE_EXAMPLES-yes): CMD = null
> +$(FATE_EXAMPLES-yes): CMP = null
> +
> +FATE += $(FATE_EXAMPLES-yes)
> +fate-examples: $(FATE_EXAMPLES-yes)
> --

Is this file needed? I'm quite sure we'd forget to update it when
examples are added
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 3/5] fate: Rename WMV8_DRM decoder tests to WMV3_DRM

2017-02-22 Thread Vittorio Giovara
On Wed, Feb 22, 2017 at 11:39 AM, Diego Biurrun  wrote:
> The codec used in those files is WMV3/WMV9, not WMV2/WMV8.
> ---
>  tests/fate/microsoft.mak | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/tests/fate/microsoft.mak b/tests/fate/microsoft.mak
> index 5b32c7f..4e66307 100644
> --- a/tests/fate/microsoft.mak
> +++ b/tests/fate/microsoft.mak
> @@ -34,15 +34,15 @@ fate-msvideo1: $(FATE_MSVIDEO1)
>  FATE_SAMPLES_AVCONV-$(call DEMDEC, ASF, MTS2) += fate-mts2
>  fate-mts2: CMD = framecrc -i $(TARGET_SAMPLES)/mts2/ScreenCapture.xesc
>
> -FATE_WMV8_DRM += fate-wmv8-drm
> +FATE_WMV3_DRM += fate-wmv3-drm
>  # discard last packet to avoid fails due to overread of VC-1 decoder
> -fate-wmv8-drm: CMD = framecrc -cryptokey 
> 137381538c84c068111902a59c5cf6c340247c39 -i 
> $(TARGET_SAMPLES)/wmv8/wmv_drm.wmv -an -frames:v 129
> +fate-wmv3-drm: CMD = framecrc -cryptokey 
> 137381538c84c068111902a59c5cf6c340247c39 -i 
> $(TARGET_SAMPLES)/wmv3/wmv_drm.wmv -an -frames:v 129
>
> -FATE_WMV8_DRM += fate-wmv8-drm-nodec
> -fate-wmv8-drm-nodec: CMD = framecrc -cryptokey 
> 137381538c84c068111902a59c5cf6c340247c39 -i 
> $(TARGET_SAMPLES)/wmv8/wmv_drm.wmv -c copy
> +FATE_WMV3_DRM += fate-wmv3-drm-nodec
> +fate-wmv3-drm-nodec: CMD = framecrc -cryptokey 
> 137381538c84c068111902a59c5cf6c340247c39 -i 
> $(TARGET_SAMPLES)/wmv3/wmv_drm.wmv -c copy
>
> -FATE_SAMPLES_AVCONV-$(call DEMDEC, ASF, WMV3) += $(FATE_WMV8_DRM)
> -fate-wmv8_drm: $(FATE_WMV8_DRM)
> +FATE_SAMPLES_AVCONV-$(call DEMDEC, ASF, WMV3) += $(FATE_WMV3_DRM)
> +fate-wmv3_drm: $(FATE_WMV3_DRM)
>
>  FATE_SAMPLES_AVCONV-$(call DEMDEC, ASF, WMV2) += fate-wmv8-intrax8
>  fate-wmv8-intrax8: CMD = framecrc -flags +bitexact -i 
> $(TARGET_SAMPLES)/wmv8/wmv8_x8intra.wmv -an
> --

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

Re: [libav-devel] [PATCH 2/5] Use modern avconv syntax for codec selection in documentation and tests

2017-02-22 Thread Vittorio Giovara
On Wed, Feb 22, 2017 at 11:39 AM, Diego Biurrun  wrote:
> ---
>  doc/encoders.texi|  2 +-
>  doc/faq.texi |  8 
>  doc/filters.texi |  4 ++--
>  tests/fate-run.sh|  4 ++--
>  tests/fate/demux.mak | 34 +-
>  tests/fate/h264.mak  |  2 +-
>  tests/fate/microsoft.mak |  2 +-
>  tests/fate/mp3.mak   | 14 +++---
>  tests/fate/mpc.mak   |  4 ++--
>  tests/fate/utvideo.mak   |  2 +-
>  tests/fate/video.mak |  4 ++--
>  tests/fate/vqf.mak   |  2 +-
>  tests/lavf-regression.sh | 28 ++--
>  13 files changed, 55 insertions(+), 55 deletions(-)
>
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index bc5b336..41b8398 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -38,7 +38,7 @@ always faster, just that one or the other may be better 
> suited to a
>  particular system. The floating-point encoder will generally produce better
>  quality audio for a given bitrate. The @var{ac3_fixed} encoder is not the
>  default codec for any of the output formats, so it must be specified 
> explicitly
> -using the option @code{-acodec ac3_fixed} in order to use it.
> +using the option @code{-c:a ac3_fixed} in order to use it.
>
>  @subsection AC-3 Metadata
>
> diff --git a/doc/faq.texi b/doc/faq.texi
> index b400124..f3d55bd 100644
> --- a/doc/faq.texi
> +++ b/doc/faq.texi
> @@ -234,7 +234,7 @@ mkfifo intermediate2.mpg
>  avconv -i input1.avi -y intermediate1.mpg < /dev/null &
>  avconv -i input2.avi -y intermediate2.mpg < /dev/null &
>  cat intermediate1.mpg intermediate2.mpg |\
> -avconv -f mpeg -i - -c:v mpeg4 -acodec libmp3lame output.avi
> +avconv -f mpeg -i - -c:v mpeg4 -c:a libmp3lame output.avi
>  @end example
>
>  Similarly, the yuv4mpegpipe format, and the raw video, raw audio codecs also
> @@ -253,13 +253,13 @@ mkfifo temp2.a
>  mkfifo temp2.v
>  mkfifo all.a
>  mkfifo all.v
> -avconv -i input1.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > 
> temp1.a < /dev/null &
> -avconv -i input2.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > 
> temp2.a < /dev/null &
> +avconv -i input1.flv -vn -f u16le -c:a pcm_s16le -ac 2 -ar 44100 - > temp1.a 
> < /dev/null &
> +avconv -i input2.flv -vn -f u16le -c:a pcm_s16le -ac 2 -ar 44100 - > temp2.a 
> < /dev/null &
>  avconv -i input1.flv -an -f yuv4mpegpipe - > temp1.v < /dev/null &
>  @{ avconv -i input2.flv -an -f yuv4mpegpipe - < /dev/null | tail -n +2 > 
> temp2.v ; @} &
>  cat temp1.a temp2.a > all.a &
>  cat temp1.v temp2.v > all.v &
> -avconv -f u16le -acodec pcm_s16le -ac 2 -ar 44100 -i all.a \
> +avconv -f u16le -c:a pcm_s16le -ac 2 -ar 44100 -i all.a \
> -f yuv4mpegpipe -i all.v \
> -y output.flv
>  rm temp[12].[av] all.[av]
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 954765f..947fd79 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -661,10 +661,10 @@ avconv -i HDCD16.flac -af hdcd OUT24.flac
>
>  When using the filter with WAV, note that the default encoding for WAV is 
> 16-bit,
>  so the resulting 20-bit stream will be truncated back to 16-bit. Use 
> something
> -like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
> +like @command{-c:a pcm_s24le} after the filter to get 24-bit PCM output.
>  @example
>  avconv -i HDCD16.wav -af hdcd OUT16.wav
> -avconv -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
> +avconv -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
>  @end example
>
>  The filter accepts the following options:
> diff --git a/tests/fate-run.sh b/tests/fate-run.sh
> index 623fd63..43fcee0 100755
> --- a/tests/fate-run.sh
> +++ b/tests/fate-run.sh
> @@ -164,8 +164,8 @@ video_filter(){
>  label=${test#filter-}
>  raw_src="${target_path}/tests/vsynth1/%02d.pgm"
>  printf '%-20s' $label
> -avconv $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src \
> -$FLAGS $ENC_OPTS -vf "$filters" -vcodec rawvideo -frames:v 5 $* -f 
> nut md5:
> +avconv $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src \
> +$FLAGS $ENC_OPTS -vf "$filters" -c:v rawvideo -frames:v 5 $* -f nut 
> md5:
>  }
>
>  pixfmts(){
> diff --git a/tests/fate/demux.mak b/tests/fate/demux.mak
> index d529341..44c4d6e 100644
> --- a/tests/fate/demux.mak
> +++ b/tests/fate/demux.mak
> @@ -1,26 +1,26 @@
>  FATE_SAMPLES_AVCONV-$(call DEMDEC, AAC, AAC) += fate-adts-demux
> -fate-adts-demux: CMD = crc -i $(TARGET_SAMPLES)/aac/ct_faac-adts.aac -acodec 
> copy
> +fate-adts-demux: CMD = crc -i $(TARGET_SAMPLES)/aac/ct_faac-adts.aac -c:a 
> copy
>
>  FATE_SAMPLES_AVCONV-$(CONFIG_AEA_DEMUXER) += fate-aea-demux
> -fate-aea-demux: CMD = crc -i $(TARGET_SAMPLES)/aea/chirp.aea -acodec copy
> +fate-aea-demux: CMD = crc -i $(TARGET_SAMPLES)/aea/chirp.aea -c:a copy
>
>  FATE_SAMPLES_AVCONV-$(CONFIG_BINK_DEMUXER) += fate-bink-demux
> -fate-bink-demux: CMD = crc -i $(TARGET_SAMPLES)/bink/Snd0a7d9b58.dee -vn 
> -acodec copy
> +fate-bink-demux: CMD = crc -i 

[libav-devel] [PATCHv3 3/3] mkv: Export bounds and padding from spherical metadata

2017-02-21 Thread Vittorio Giovara
Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 libavformat/matroskadec.c | 60 +--
 1 file changed, 58 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 3dd54eb..adcb553 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1601,18 +1601,65 @@ static int mkv_parse_video_projection(AVStream *st, 
const MatroskaTrack *track)
 AVSphericalMapping *spherical;
 enum AVSphericalProjection projection;
 size_t spherical_size;
+size_t l, t, r, b;
+size_t padding = 0;
 int ret;
+GetByteContext gb;
+
+bytestream2_init(, track->video.projection.private.data,
+ track->video.projection.private.size);
+
+if (bytestream2_get_byte() != 0) {
+av_log(NULL, AV_LOG_WARNING, "Unknown spherical metadata\n");
+return 0;
+}
+
+bytestream2_skip(, 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();
+b = bytestream2_get_be32();
+l = bytestream2_get_be32();
+r = bytestream2_get_be32();
+
+if (b >= UINT_MAX - t || r >= UINT_MAX - l) {
+av_log(NULL, AV_LOG_ERROR,
+   "Invalid bounding rectangle coordinates "
+   "%zu,%zu,%zu,%zu\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) {
 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();
+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();
+} else {
+av_log(NULL, AV_LOG_ERROR, "Unknown spherical metadata\n");
+return AVERROR_INVALIDDATA;
 }
-projection = AV_SPHERICAL_CUBEMAP;
 break;
 default:
 av_log(NULL, AV_LOG_WARNING,
@@ -1631,6 +1678,15 @@ 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;
+
+if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+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) {
-- 
2.10.0

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

[libav-devel] [PATCHv3 2/3] mov: Export bounds and padding from spherical metadata

2017-02-21 Thread Vittorio Giovara
Update the fate test as needed.

Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 libavformat/mov.c| 28 +++-
 tests/fate/mov.mak   |  2 +-
 tests/ref/fate/mov-spherical |  6 +-
 3 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index e2168c3..668b54e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3237,6 +3237,8 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 MOVStreamContext *sc;
 int size, version;
 int32_t yaw, pitch, roll;
+size_t l, t, r, b;
+size_t padding = 0;
 uint32_t tag;
 enum AVSphericalProjection projection;
 
@@ -3316,9 +3318,25 @@ 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 "
+   "%zu,%zu,%zu,%zu\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");
@@ -3335,6 +3353,14 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 sc->spherical->pitch = pitch;
 sc->spherical->roll  = roll;
 
+sc->spherical->padding = padding;
+
+if (projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+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/fate/mov.mak b/tests/fate/mov.mak
index 57cbb1c..9d64fd3 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -11,7 +11,7 @@ FATE_MOV += fate-mov-sar
 fate-mov-sar: CMD = probestream sample_aspect_ratio 
$(TARGET_SAMPLES)/mov/displaymatrix.mov
 
 FATE_MOV += fate-mov-spherical
-fate-mov-spherical: CMD = probestream projection,yaw,pitch,roll 
$(TARGET_SAMPLES)/mov/spherical.mov
+fate-mov-spherical: CMD = probestream 
projection,yaw,pitch,roll,left,top,right,bottom 
$(TARGET_SAMPLES)/mov/spherical.mov
 
 FATE_MOV += fate-mov-stereo3d
 fate-mov-stereo3d: CMD = probestream type $(TARGET_SAMPLES)/mov/spherical.mov
diff --git a/tests/ref/fate/mov-spherical b/tests/ref/fate/mov-spherical
index 760ae88..a3f8cdf 100644
--- a/tests/ref/fate/mov-spherical
+++ b/tests/ref/fate/mov-spherical
@@ -1,4 +1,8 @@
-equirectangular
+tiled equirectangular
+148
+73
+147
+72
 45
 30
 15
-- 
2.10.0

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

[libav-devel] [PATCHv3 1/3] spherical: Add tiled equirectangular type and projection-specific properties

2017-02-21 Thread Vittorio Giovara
Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
This leaves bounds unchanged, simplifying future muxing code.
Add a convenience function where human-readable values are needed.
Update mov and mkv in subsequent patches.
Vittorio

 avtools/avprobe.c | 18 ++---
 doc/APIchanges|  5 
 libavformat/dump.c| 15 +--
 libavutil/spherical.c | 18 +
 libavutil/spherical.h | 74 +++
 libavutil/version.h   |  2 +-
 6 files changed, 126 insertions(+), 6 deletions(-)

diff --git a/avtools/avprobe.c b/avtools/avprobe.c
index 613e090..68f1922 100644
--- a/avtools/avprobe.c
+++ b/avtools/avprobe.c
@@ -792,11 +792,23 @@ static void show_stream(InputFile *ifile, InputStream 
*ist)
 spherical = (AVSphericalMapping *)sd->data;
 probe_object_header("spherical");
 
-if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR)
+if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR) {
 probe_str("projection", "equirectangular");
-else if (spherical->projection == AV_SPHERICAL_CUBEMAP)
+} else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
 probe_str("projection", "cubemap");
-else
+probe_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,
+ , , , );
+probe_str("projection", "tiled equirectangular");
+probe_object_header("bounding");
+probe_int("left", l);
+probe_int("top", t);
+probe_int("right", r);
+probe_int("bottom", b);
+probe_object_footer("bounding");
+} else
 probe_str("projection", "unknown");
 
 probe_object_header("orientation");
diff --git a/doc/APIchanges b/doc/APIchanges
index a919ffb..9367a5f 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,11 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2017-02-10 - xxx - lavu 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-xx-xx - xxx - lavc 57.34.0 - avcodec.h
   Add AVCodecContext.hw_device_ctx.
 
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 660df0a..7514aee 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -307,7 +307,7 @@ static void dump_cpb(void *ctx, AVPacketSideData *sd)
cpb->vbv_delay);
 }
 
-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;
@@ -321,6 +321,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, "cubemap ");
+else if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE)
+av_log(ctx, AV_LOG_INFO, "tiled equirectangular ");
 else {
 av_log(ctx, AV_LOG_WARNING, "unknown");
 return;
@@ -330,6 +332,15 @@ static void dump_spherical(void *ctx, AVPacketSideData *sd)
 pitch = ((double)spherical->pitch) / (1 << 16);
 roll = ((double)spherical->roll) / (1 << 16);
 av_log(ctx, AV_LOG_INFO, "(%f/%f/%f) ", yaw, pitch, roll);
+
+if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+size_t l, t, r, b;
+av_spherical_tile_bounds(spherical, par->width, par->height,
+ , , , );
+av_log(ctx, AV_LOG_INFO, "[%zu, %zu, %zu, %zu] ", l, t, r, b);
+} else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
+av_log(ctx, AV_LOG_INFO, "[pad %zu] ", spherical->padding);
+}
 }
 
 static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
@@ -382,7 +393,7 @@ static void dump_sidedata(void *ctx, AVStream *st, const 
char *indent)
 break;
 case AV_PKT_DATA_SPHERICAL:
 av_log(ctx, AV_LOG_INFO, "spherical: ");
-dump_spherical(ctx, );
+dump_spherical(ctx

Re: [libav-devel] [PATCH 1/5] rtsp: Factor out packet reading

2017-02-20 Thread Vittorio Giovara
On Sun, Feb 19, 2017 at 6:10 PM, Luca Barbato  wrote:
> ---
>  libavformat/rtsp.c | 67 
> +-
>  1 file changed, 41 insertions(+), 26 deletions(-)
>
> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> index 7e59857..2c21fa7 100644
> --- a/libavformat/rtsp.c
> +++ b/libavformat/rtsp.c
> @@ -2043,6 +2043,45 @@ static int pick_stream(AVFormatContext *s, RTSPStream 
> **rtsp_st,
>  return AVERROR(EAGAIN);
>  }
>
> +
> +static int read_packet(AVFormatContext *s,

nit: extra empty line
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] matroskaenc: factor ts_offset in block timecode computation

2017-02-16 Thread Vittorio Giovara
On Thu, Feb 16, 2017 at 11:14 AM, John Stebbins  wrote:
> On 02/15/2017 10:09 PM, Luca Barbato wrote:
>> On 15/02/2017 23:29, John Stebbins wrote:
>>> ts_offset was added to cluster timecode, but then effectively subtracted
>>> back off the block timecode
>>> ---
>>>  libavformat/matroskaenc.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
>>> index e951a0f..2fe6e0e 100644
>>> --- a/libavformat/matroskaenc.c
>>> +++ b/libavformat/matroskaenc.c
>>> @@ -1461,6 +1461,7 @@ static void mkv_write_block(AVFormatContext *s, 
>>> AVIOContext *pb,
>>>  uint8_t *data = NULL;
>>>  int offset = 0, size = pkt->size;
>>>  int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : 
>>> pkt->pts;
>>> +ts += mkv->tracks[pkt->stream_index].ts_offset;
>>>
>>>  av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, 
>>> "
>>> "pts %" PRId64 ", dts %" PRId64 ", duration %" PRId64 ", flags 
>>> %d\n",
>>>
>> What does it fix? should it go in stable?
>>
>>
>
> When setting initial_padding for an audio stream, the timestamps are written 
> incorrectly to the mkv file.
> cluster timecode gets written as pts0 + ts_offset which is correct, but then 
> block timecode gets written as
> pts - cluster timecode which expanded is pts - (pts0 + ts_offset) .  Adding 
> cluster and block tc back together
> cluster tc + block tc = (pts0 + ts_offset) + (pts - (pts0 + ts_offset)) = pts
> But the result should be pts + ts_offset since demux will subtract the 
> CodecDelay element from pts
> and set initial_padding to CodecDelay. This patch gives the correct result.

Bonus points if this comment is added verbatim to the commit log.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] h264_sei: Check actual presence of picture timing SEI message

2017-02-15 Thread Vittorio Giovara
From: Michael Niedermayer 

Signed-off-by: Michael Niedermayer 
---
This should hopefully be a better fix for the undetected interlaced
samples I reported a couple of days ago.
Vittorio

 libavcodec/h264_parser.c | 4 ++--
 libavcodec/h264_sei.c| 3 +++
 libavcodec/h264_sei.h| 1 +
 libavcodec/h264_slice.c  | 4 ++--
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index bca0071..bc35a61 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -471,7 +471,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
 }
 }
 
-if (sps->pic_struct_present_flag) {
+if (sps->pic_struct_present_flag && p->sei.picture_timing.present) 
{
 switch (p->sei.picture_timing.pic_struct) {
 case SEI_PIC_STRUCT_TOP_FIELD:
 case SEI_PIC_STRUCT_BOTTOM_FIELD:
@@ -502,7 +502,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
 
 if (p->picture_structure == PICT_FRAME) {
 s->picture_structure = AV_PICTURE_STRUCTURE_FRAME;
-if (sps->pic_struct_present_flag) {
+if (sps->pic_struct_present_flag && 
p->sei.picture_timing.present) {
 switch (p->sei.picture_timing.pic_struct) {
 case SEI_PIC_STRUCT_TOP_BOTTOM:
 case SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 5053962..a7e627e 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -45,6 +45,7 @@ void ff_h264_sei_uninit(H264SEIContext *h)
 h->picture_timing.dpb_output_delay  = 0;
 h->picture_timing.cpb_removal_delay = -1;
 
+h->picture_timing.present  = 0;
 h->buffering_period.present= 0;
 h->frame_packing.present   = 0;
 h->display_orientation.present = 0;
@@ -119,6 +120,8 @@ static int decode_picture_timing(H264SEIPictureTiming *h, 
GetBitContext *gb,
 av_log(logctx, AV_LOG_DEBUG, "ct_type:%X pic_struct:%d\n",
h->ct_type, h->pic_struct);
 }
+
+h->present = 1;
 return 0;
 }
 
diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h
index 9197795..da3b391 100644
--- a/libavcodec/h264_sei.h
+++ b/libavcodec/h264_sei.h
@@ -64,6 +64,7 @@ typedef enum {
 } SEI_FpaType;
 
 typedef struct H264SEIPictureTiming {
+int present;
 SEI_PicStructType pic_struct;
 
 /**
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 91a3b25..a703853 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1131,7 +1131,7 @@ static int h264_export_frame_props(H264Context *h)
 /* Prioritize picture timing SEI information over used
  * decoding process if it exists. */
 
-if (sps->pic_struct_present_flag) {
+if (sps->pic_struct_present_flag && h->sei.picture_timing.present) {
 H264SEIPictureTiming *pt = >sei.picture_timing;
 switch (pt->pic_struct) {
 case SEI_PIC_STRUCT_FRAME:
@@ -1176,7 +1176,7 @@ static int h264_export_frame_props(H264Context *h)
 /* Derive top_field_first from field pocs. */
 cur->f->top_field_first = cur->field_poc[0] < cur->field_poc[1];
 } else {
-if (sps->pic_struct_present_flag) {
+if (sps->pic_struct_present_flag && h->sei.picture_timing.present) {
 /* Use picture timing SEI information. Even if it is a
  * information of a past frame, better than nothing. */
 if (h->sei.picture_timing.pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM 
||
-- 
2.10.0

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

Re: [libav-devel] [PATCH 4/5] mov: Export bounds and padding from spherical metadata

2017-02-15 Thread Vittorio Giovara
On Wed, Feb 15, 2017 at 11:29 AM, wm4 <nfx...@googlemail.com> wrote:
> On Wed, 15 Feb 2017 11:16:40 -0500
> Vittorio Giovara <vittorio.giov...@gmail.com> wrote:
>
>> On Wed, Feb 15, 2017 at 11:12 AM, wm4 <nfx...@googlemail.com> wrote:
>> > On Fri, 10 Feb 2017 16:08:10 -0500
>> > Vittorio Giovara <vittorio.giov...@gmail.com> wrote:
>> >> @@ -3369,6 +3393,26 @@ static int 
>> >> mov_parse_uuid_spherical(MOVStreamContext *sc, AVIOContext *pb, size_
>> >>  val = av_stristr(buffer, "");
>> >>  if (val)
>> >>  sc->spherical->roll = strtol(val, NULL, 10) * (1 << 16);
>> >> +
>> >> +/* tiling */
>> >> +val = av_stristr(buffer, "");
>> >> +if (val)
>> >> +sc->spherical->left_bound = strtol(val, NULL, 10);
>> >> +val = av_stristr(buffer, "");
>> >> +if (val)
>> >> +sc->spherical->top_bound = strtol(val, NULL, 10);
>> >> +val = av_stristr(buffer, 
>> >> "");
>> >> +if (val)
>> >> +sc->spherical->right_bound =
>> >> +sc->width - sc->spherical->left_bound - strtol(val, 
>> >> NULL, 10);
>> >> +val = av_stristr(buffer, 
>> >> "");
>> >> +if (val)
>> >> +sc->spherical->bottom_bound =
>> >> +sc->height - sc->spherical->top_bound - strtol(val, 
>> >> NULL, 10);
>> >
>> > Does this try to parse XML?
>>
>> ¯\_(ツ)_/¯
>>
>> > Who is responsible for this crime (storing it as XML in mp4)?
>>
>> https://github.com/google/spatial-media/blob/master/docs/spherical-video-rfc.md
>
> If it calls itself RFC it's not too late yet?

There is a v2 which supersedes this one, this code is minimal support
for random files that might be still around.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCHv2 4/6] mov: Export bounds and padding from spherical metadata

2017-02-15 Thread Vittorio Giovara
Update the fate test as needed.

Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
Validate bounding rectangle in spec v2.
Use James' suggestion about UINT32_MAX.
Vittorio

 libavformat/mov.c| 53 +++-
 tests/fate/mov.mak   |  2 +-
 tests/ref/fate/mov-spherical |  6 -
 3 files changed, 58 insertions(+), 3 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 6d1b2b2..d727612 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3231,6 +3231,8 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 MOVStreamContext *sc;
 int size;
 int32_t yaw, pitch, roll;
+size_t l, t, r, b;
+size_t padding = 0;
 uint32_t tag;
 enum AVSphericalProjection projection;
 
@@ -3292,9 +3294,25 @@ 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 "
+   "%zu,%zu,%zu,%zu\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");
@@ -3311,6 +3329,19 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 sc->spherical->pitch = pitch;
 sc->spherical->roll  = roll;
 
+sc->spherical->padding = padding;
+
+if (projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+/* conversion from 0.32 coordinates to pixels */
+size_t orig_width  = (size_t) sc->width  * UINT32_MAX / (UINT32_MAX - 
r - l);
+size_t orig_height = (size_t) sc->height * UINT32_MAX / (UINT32_MAX - 
b - t);
+
+/* add a (UINT32_MAX - 1) to round up integer division */
+sc->spherical->bound_left   = (orig_width  * l + UINT32_MAX - 1) / 
UINT32_MAX;
+sc->spherical->bound_top= (orig_height * t + UINT32_MAX - 1) / 
UINT32_MAX;
+sc->spherical->bound_right  = orig_width  - sc->width  - 
sc->spherical->bound_left;
+sc->spherical->bound_bottom = orig_height - sc->height - 
sc->spherical->bound_top;
+}
 return 0;
 }
 
@@ -3369,6 +3400,26 @@ static int mov_parse_uuid_spherical(MOVStreamContext 
*sc, AVIOContext *pb, size_
 val = av_stristr(buffer, "");
 if (val)
 sc->spherical->roll = strtol(val, NULL, 10) * (1 << 16);
+
+/* tiling */
+val = av_stristr(buffer, "");
+if (val)
+sc->spherical->bound_left = strtol(val, NULL, 10);
+val = av_stristr(buffer, "");
+if (val)
+sc->spherical->bound_top = strtol(val, NULL, 10);
+val = av_stristr(buffer, "");
+if (val)
+sc->spherical->bound_right =
+sc->width - sc->spherical->bound_left - strtol(val, NULL, 10);
+val = av_stristr(buffer, "");
+if (val)
+sc->spherical->bound_bottom =
+sc->height - sc->spherical->bound_top - strtol(val, NULL, 10);
+
+if (sc->spherical->bound_left || sc->spherical->bound_top ||
+sc->spherical->bound_right || sc->spherical->bound_bottom)
+sc->spherical->projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE;
 }
 
 out:
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 57cbb1c..9d64fd3 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -11,7 +11,7 @@ FATE_MOV += fate-mov-sar
 fate-mov-sar: CMD = probestream sample_aspect_ratio 
$(TARGET_SAMPLES)/mov/displaymatrix.mov
 
 FATE_MOV += fate-mov-spherical
-fate-mov-spherical: CMD = probestream projection,yaw,pitch,roll 
$(TARGET_SAMPLES)/mov/spherical.mov
+fate-mov-spherical: CMD = probestream 
projection,yaw,pitch,roll,left,top,right,bottom 
$(TARGET_SAMPLES)/mov/spherical.mov
 
 FATE_MOV += fate-mov-stereo3d
 fate-mov-stereo3d: CMD = probestream type $(TARGET_SAMPLES)/mov/spherical.mov
diff --git a/tests/ref/fate/mov-spherical b/tests/ref/fate/mov-spherical
index 760ae88..a3f8cdf 100644
--- a/tests/ref/fate/mov-spherical
+++ b/tests/ref/fate/mov-spherical
@@ -1,4 +1,8 @@
-equirectangular
+tiled equirectangular
+148
+73
+147
+72
 45
 30
 15
-- 
2.10.0

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

[libav-devel] [PATCHv2 5/6] mkv: Export bounds and padding from spherical metadata

2017-02-15 Thread Vittorio Giovara
Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
Update according to James' review.
Vittorio

 libavformat/matroskadec.c | 65 +--
 1 file changed, 63 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 3dd54eb..ea9d094 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1601,18 +1601,65 @@ static int mkv_parse_video_projection(AVStream *st, 
const MatroskaTrack *track)
 AVSphericalMapping *spherical;
 enum AVSphericalProjection projection;
 size_t spherical_size;
+size_t l, t, r, b;
+size_t padding = 0;
 int ret;
+GetByteContext gb;
+
+bytestream2_init(, track->video.projection.private.data,
+ track->video.projection.private.size);
+
+if (bytestream2_get_byte() != 0) {
+av_log(NULL, AV_LOG_WARNING, "Unknown spherical metadata\n");
+return 0;
+}
+
+bytestream2_skip(, 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();
+b = bytestream2_get_be32();
+l = bytestream2_get_be32();
+r = bytestream2_get_be32();
+
+if (b >= UINT_MAX - t || r >= UINT_MAX - l) {
+av_log(NULL, AV_LOG_ERROR,
+   "Invalid bounding rectangle coordinates "
+   "%zu,%zu,%zu,%zu\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) {
 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();
+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();
+} else {
+av_log(NULL, AV_LOG_ERROR, "Unknown spherical metadata\n");
+return AVERROR_INVALIDDATA;
 }
-projection = AV_SPHERICAL_CUBEMAP;
 break;
 default:
 av_log(NULL, AV_LOG_WARNING,
@@ -1631,6 +1678,20 @@ 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;
+
+if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+/* conversion from 0.32 coordinates to pixels */
+size_t orig_width  = (size_t) track->video.pixel_width  * UINT32_MAX / 
(UINT32_MAX - r - l);
+size_t orig_height = (size_t) track->video.pixel_height * UINT32_MAX / 
(UINT32_MAX - b - t);
+
+/* add a (UINT32_MAX - 1) to round up integer division */
+spherical->bound_left   = (orig_width  * l + UINT32_MAX - 1) / 
UINT32_MAX;
+spherical->bound_top= (orig_height * t + UINT32_MAX - 1) / 
UINT32_MAX;
+spherical->bound_right  = orig_width  - track->video.pixel_width  - 
spherical->bound_left;
+spherical->bound_bottom = orig_height - track->video.pixel_height - 
spherical->bound_top;
+}
+
 ret = av_stream_add_side_data(st, AV_PKT_DATA_SPHERICAL, (uint8_t 
*)spherical,
   spherical_size);
 if (ret < 0) {
-- 
2.10.0

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

[libav-devel] [PATCH 6/6] mov: Validate spherical metadata version

2017-02-15 Thread Vittorio Giovara
---
Patch suggested by James.
Vittorio

 libavformat/mov.c | 26 ++
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index d727612..0d9e83a 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3229,7 +3229,7 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 {
 AVStream *st;
 MOVStreamContext *sc;
-int size;
+int size, version;
 int32_t yaw, pitch, roll;
 size_t l, t, r, b;
 size_t padding = 0;
@@ -3256,7 +3256,13 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 av_log(c->fc, AV_LOG_ERROR, "Missing spherical video header\n");
 return 0;
 }
-avio_skip(pb, 4); /*  version + flags */
+version = avio_r8(pb);
+if (version != 0) {
+av_log(c->fc, AV_LOG_WARNING, "Unknown spherical version %d\n",
+   version);
+return 0;
+}
+avio_skip(pb, 3); /* flags */
 avio_skip(pb, size - 12); /* metadata_source */
 
 size = avio_rb32(pb);
@@ -3278,7 +3284,13 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 av_log(c->fc, AV_LOG_ERROR, "Missing projection header box\n");
 return 0;
 }
-avio_skip(pb, 4); /*  version + flags */
+version = avio_r8(pb);
+if (version != 0) {
+av_log(c->fc, AV_LOG_WARNING, "Unknown spherical version %d\n",
+   version);
+return 0;
+}
+avio_skip(pb, 3); /* flags */
 
 /* 16.16 fixed point */
 yaw   = avio_rb32(pb);
@@ -3290,7 +3302,13 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 return AVERROR_INVALIDDATA;
 
 tag = avio_rl32(pb);
-avio_skip(pb, 4); /*  version + flags */
+version = avio_r8(pb);
+if (version != 0) {
+av_log(c->fc, AV_LOG_WARNING, "Unknown spherical version %d\n",
+   version);
+return 0;
+}
+avio_skip(pb, 3); /* flags */
 switch (tag) {
 case MKTAG('c','b','m','p'):
 projection = AV_SPHERICAL_CUBEMAP;
-- 
2.10.0

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

[libav-devel] [PATCHv2 1/6] mov: Fix spherical metadata_source parsing

2017-02-15 Thread Vittorio Giovara
From: Aaron Colwell 

Signed-off-by: James Almer 
---
Updated to the right chunks.
Vittorio

 libavformat/mov.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 11bcff0..6d1b2b2 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3246,7 +3246,7 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 }
 
 size = avio_rb32(pb);
-if (size > atom.size)
+if (size <= 12 || size > atom.size)
 return AVERROR_INVALIDDATA;
 
 tag = avio_rl32(pb);
@@ -3255,7 +3255,7 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 return 0;
 }
 avio_skip(pb, 4); /*  version + flags */
-avio_skip(pb, avio_r8(pb)); /* metadata_source */
+avio_skip(pb, size - 12); /* metadata_source */
 
 size = avio_rb32(pb);
 if (size > atom.size)
-- 
2.10.0

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

[libav-devel] [PATCHv2 3/6] spherical: Add tiled equirectangular type and projection-specific properties

2017-02-15 Thread Vittorio Giovara
Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
Modified names and applied other comments.
Vittorio

 avprobe.c | 15 +++---
 doc/APIchanges|  5 +
 libavformat/dump.c| 10 +
 libavutil/spherical.h | 56 +++
 libavutil/version.h   |  2 +-
 5 files changed, 84 insertions(+), 4 deletions(-)

diff --git a/avprobe.c b/avprobe.c
index 613e090..dfe6f61 100644
--- a/avprobe.c
+++ b/avprobe.c
@@ -792,11 +792,20 @@ static void show_stream(InputFile *ifile, InputStream 
*ist)
 spherical = (AVSphericalMapping *)sd->data;
 probe_object_header("spherical");
 
-if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR)
+if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR) {
 probe_str("projection", "equirectangular");
-else if (spherical->projection == AV_SPHERICAL_CUBEMAP)
+} else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
 probe_str("projection", "cubemap");
-else
+probe_int("padding", spherical->padding);
+} else if (spherical->projection == 
AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+probe_str("projection", "tiled equirectangular");
+probe_object_header("bounding");
+probe_int("left", spherical->bound_left);
+probe_int("top", spherical->bound_top);
+probe_int("right", spherical->bound_right);
+probe_int("bottom", spherical->bound_bottom);
+probe_object_footer("bounding");
+} else
 probe_str("projection", "unknown");
 
 probe_object_header("orientation");
diff --git a/doc/APIchanges b/doc/APIchanges
index e7a0b14..30aa6a9 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,11 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2017-02-10 - xxx - lavu 55.33.0 - spherical.h
+  Add AV_SPHERICAL_EQUIRECTANGULAR_TILE, and projection-specific properties
+  (bound_left, bound_top, bound_right, bound_bottom, padding) to
+  AVSphericalMapping.
+
 2017-02-11 - xxx - lavu 55.32.0 - frame.h
   Add AVFrame.opaque_ref.
 
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 660df0a..6dd701e 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -321,6 +321,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, "cubemap ");
+else if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE)
+av_log(ctx, AV_LOG_INFO, "tiled equirectangular ");
 else {
 av_log(ctx, AV_LOG_WARNING, "unknown");
 return;
@@ -330,6 +332,14 @@ static void dump_spherical(void *ctx, AVPacketSideData *sd)
 pitch = ((double)spherical->pitch) / (1 << 16);
 roll = ((double)spherical->roll) / (1 << 16);
 av_log(ctx, AV_LOG_INFO, "(%f/%f/%f) ", yaw, pitch, roll);
+
+if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+av_log(ctx, AV_LOG_INFO, "[%zu, %zu, %zu, %zu] ",
+   spherical->bound_left, spherical->bound_top,
+   spherical->bound_right, spherical->bound_bottom);
+} else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
+av_log(ctx, AV_LOG_INFO, "[pad %zu] ", spherical->padding);
+}
 }
 
 static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
diff --git a/libavutil/spherical.h b/libavutil/spherical.h
index 0045eb9..230fbc4 100644
--- a/libavutil/spherical.h
+++ b/libavutil/spherical.h
@@ -63,6 +63,13 @@ enum AVSphericalProjection {
  * to the back.
  */
 AV_SPHERICAL_CUBEMAP,
+
+/**
+ * Video represents a portion of a sphere mapped on a flat surface
+ * using equirectangular projection. The @ref bounding fields indicate
+ * the position of the current video in a larger surface.
+ */
+AV_SPHERICAL_EQUIRECTANGULAR_TILE,
 };
 
 /**
@@ -122,6 +129,55 @@ typedef struct AVSphericalMapping {
 /**
  * @}
  */
+
+/**
+ * @name Bounding rectangle
+ * @anchor bounding
+ * @{
+ * These fields indicate the location of the current tile, and where
+ * it should be mapped relative to the original surface.
+ *
+ * @code{.unparsed}
+ *  ++--+
+ *  ||bound_top |
+ *  |++ |
+

[libav-devel] [PATCHv2 2/6] matroskadec: add support for Spherical Video elements

2017-02-15 Thread Vittorio Giovara
From: James Almer <jamr...@gmail.com>

Signed-off-by: James Almer <jamr...@gmail.com>
Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
Updated according review.
Vittorio

 libavformat/matroska.h| 14 ++
 libavformat/matroskadec.c | 69 +++
 2 files changed, 83 insertions(+)

diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index 91bb978..4e9f96e 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -118,6 +118,13 @@
 #define MATROSKA_ID_VIDEOASPECTRATIO 0x54B3
 #define MATROSKA_ID_VIDEOCOLORSPACE 0x2EB524
 
+#define MATROSKA_ID_VIDEOPROJECTION 0x7670
+#define MATROSKA_ID_VIDEOPROJECTIONTYPE 0x7671
+#define MATROSKA_ID_VIDEOPROJECTIONPRIVATE 0x7672
+#define MATROSKA_ID_VIDEOPROJECTIONPOSEYAW 0x7673
+#define MATROSKA_ID_VIDEOPROJECTIONPOSEPITCH 0x7674
+#define MATROSKA_ID_VIDEOPROJECTIONPOSEROLL 0x7675
+
 /* IDs in the trackaudio master */
 #define MATROSKA_ID_AUDIOSAMPLINGFREQ 0xB5
 #define MATROSKA_ID_AUDIOOUTSAMPLINGFREQ 0x78B5
@@ -256,6 +263,13 @@ typedef enum {
   MATROSKA_VIDEO_STEREOMODE_TYPE_NB,
 } MatroskaVideoStereoModeType;
 
+typedef enum {
+  MATROSKA_VIDEO_PROJECTION_TYPE_RECTANGULAR= 0,
+  MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR= 1,
+  MATROSKA_VIDEO_PROJECTION_TYPE_CUBEMAP= 2,
+  MATROSKA_VIDEO_PROJECTION_TYPE_MESH   = 3,
+} MatroskaVideoProjectionType;
+
 /*
  * Matroska Codec IDs, strings
  */
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 4e121b6..3dd54eb 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -45,6 +45,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/lzo.h"
 #include "libavutil/mathematics.h"
+#include "libavutil/spherical.h"
 
 #include "libavcodec/bytestream.h"
 #include "libavcodec/flac.h"
@@ -116,6 +117,14 @@ typedef struct MatroskaTrackEncoding {
 MatroskaTrackCompression compression;
 } MatroskaTrackEncoding;
 
+typedef struct MatroskaTrackVideoProjection {
+uint64_t type;
+EbmlBin private;
+double yaw;
+double pitch;
+double roll;
+} MatroskaTrackVideoProjection;
+
 typedef struct MatroskaTrackVideo {
 double   frame_rate;
 uint64_t display_width;
@@ -126,6 +135,7 @@ typedef struct MatroskaTrackVideo {
 uint64_t interlaced;
 uint64_t field_order;
 uint64_t stereo_mode;
+MatroskaTrackVideoProjection projection;
 } MatroskaTrackVideo;
 
 typedef struct MatroskaTrackAudio {
@@ -309,6 +319,15 @@ static EbmlSyntax matroska_info[] = {
 { 0 }
 };
 
+static const EbmlSyntax matroska_track_video_projection[] = {
+{ MATROSKA_ID_VIDEOPROJECTIONTYPE,  EBML_UINT,  0, 
offsetof(MatroskaTrackVideoProjection, type), { .u = 
MATROSKA_VIDEO_PROJECTION_TYPE_RECTANGULAR } },
+{ MATROSKA_ID_VIDEOPROJECTIONPRIVATE,   EBML_BIN,   0, 
offsetof(MatroskaTrackVideoProjection, private) },
+{ MATROSKA_ID_VIDEOPROJECTIONPOSEYAW,   EBML_FLOAT, 0, 
offsetof(MatroskaTrackVideoProjection, yaw), { .f=0.0 } },
+{ MATROSKA_ID_VIDEOPROJECTIONPOSEPITCH, EBML_FLOAT, 0, 
offsetof(MatroskaTrackVideoProjection, pitch), { .f=0.0 } },
+{ MATROSKA_ID_VIDEOPROJECTIONPOSEROLL,  EBML_FLOAT, 0, 
offsetof(MatroskaTrackVideoProjection, roll), { .f=0.0 } },
+{ 0 }
+};
+
 static EbmlSyntax matroska_track_video[] = {
 { MATROSKA_ID_VIDEOFRAMERATE,  EBML_FLOAT, 0, 
offsetof(MatroskaTrackVideo, frame_rate) },
 { MATROSKA_ID_VIDEODISPLAYWIDTH,   EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, display_width) },
@@ -316,6 +335,7 @@ static EbmlSyntax matroska_track_video[] = {
 { MATROSKA_ID_VIDEOPIXELWIDTH, EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, pixel_width) },
 { MATROSKA_ID_VIDEOPIXELHEIGHT,EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, pixel_height) },
 { MATROSKA_ID_VIDEOCOLORSPACE, EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, fourcc) },
+{ MATROSKA_ID_VIDEOPROJECTION, EBML_NEST,  0, 
offsetof(MatroskaTrackVideo, projection), { .n = 
matroska_track_video_projection } },
 { MATROSKA_ID_VIDEOPIXELCROPB, EBML_NONE },
 { MATROSKA_ID_VIDEOPIXELCROPT, EBML_NONE },
 { MATROSKA_ID_VIDEOPIXELCROPL, EBML_NONE },
@@ -1576,6 +1596,51 @@ static void mkv_stereo_mode_display_mul(int stereo_mode,
 }
 }
 
+static int mkv_parse_video_projection(AVStream *st, const MatroskaTrack *track)
+{
+AVSphericalMapping *spherical;
+enum AVSphericalProjection projection;
+size_t spherical_size;
+int ret;
+
+switch (track->video.projection.type) {
+case MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR:
+projection = AV_SPHERICAL_EQUIRECTANGULAR;
+break;
+case MATROSKA_VIDEO_PROJECTION_TYPE_CUBEMAP:
+if (track->video.projection.private.size < 4) {
+av_log(NULL, AV_LOG_ERROR, "Missing projection private 
properties\n");
+return AVERROR

Re: [libav-devel] [PATCH 4/5] mov: Export bounds and padding from spherical metadata

2017-02-15 Thread Vittorio Giovara
On Wed, Feb 15, 2017 at 11:12 AM, wm4 <nfx...@googlemail.com> wrote:
> On Fri, 10 Feb 2017 16:08:10 -0500
> Vittorio Giovara <vittorio.giov...@gmail.com> wrote:
>> @@ -3369,6 +3393,26 @@ static int mov_parse_uuid_spherical(MOVStreamContext 
>> *sc, AVIOContext *pb, size_
>>  val = av_stristr(buffer, "");
>>  if (val)
>>  sc->spherical->roll = strtol(val, NULL, 10) * (1 << 16);
>> +
>> +/* tiling */
>> +val = av_stristr(buffer, "");
>> +if (val)
>> +sc->spherical->left_bound = strtol(val, NULL, 10);
>> +val = av_stristr(buffer, "");
>> +if (val)
>> +sc->spherical->top_bound = strtol(val, NULL, 10);
>> +val = av_stristr(buffer, 
>> "");
>> +if (val)
>> +sc->spherical->right_bound =
>> +sc->width - sc->spherical->left_bound - strtol(val, NULL, 
>> 10);
>> +val = av_stristr(buffer, 
>> "");
>> +if (val)
>> +sc->spherical->bottom_bound =
>> +sc->height - sc->spherical->top_bound - strtol(val, NULL, 
>> 10);
>
> Does this try to parse XML?

¯\_(ツ)_/¯

> Who is responsible for this crime (storing it as XML in mp4)?

https://github.com/google/spatial-media/blob/master/docs/spherical-video-rfc.md
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 4/5] mov: Export bounds and padding from spherical metadata

2017-02-15 Thread Vittorio Giovara
On Wed, Feb 15, 2017 at 2:46 AM, Anton Khirnov <an...@khirnov.net> wrote:
> Quoting Vittorio Giovara (2017-02-10 22:08:10)
>> Update the fate test as needed.
>> ---
>>  libavformat/mov.c| 46 
>> +++-
>>  tests/fate/mov.mak   |  2 +-
>>  tests/ref/fate/mov-spherical |  6 +-
>>  3 files changed, 51 insertions(+), 3 deletions(-)
>>
>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>> index 4a6f9c0..bc35677 100644
>> --- a/libavformat/mov.c
>> +++ b/libavformat/mov.c
>> @@ -3231,6 +3231,8 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext 
>> *pb, MOVAtom atom)
>>  MOVStreamContext *sc;
>>  int size;
>>  int32_t yaw, pitch, roll;
>> +size_t l, t, r, b;
>> +size_t padding = 0;
>>  uint32_t tag;
>>  enum AVSphericalProjection projection;
>>
>> @@ -3292,9 +3294,17 @@ 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 (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");
>> @@ -3311,6 +3321,20 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext 
>> *pb, MOVAtom atom)
>>  sc->spherical->pitch = pitch;
>>  sc->spherical->roll  = roll;
>>
>> +sc->spherical->padding = padding;
>> +
>> +if (projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
>> +/* conversion from 0.32 coordinates to pixels */
>> +uint32_t max_coord = (uint32_t) -1;
>> +size_t orig_width  = (size_t) sc->width  * max_coord / (max_coord - 
>> r - l);
>> +size_t orig_height = (size_t) sc->height * max_coord / (max_coord - 
>> b - t);
>> +
>> +/* add a (max_coord - 1) to round up integer division */
>> +sc->spherical->left_bound   = (orig_width  * l + max_coord - 1) / 
>> max_coord;
>> +sc->spherical->top_bound= (orig_height * t + max_coord - 1) / 
>> max_coord;
>> +sc->spherical->right_bound  = orig_width  - sc->width  - 
>> sc->spherical->left_bound;
>> +sc->spherical->bottom_bound = orig_height - sc->height - 
>> sc->spherical->top_bound;
>> +}
>>  return 0;
>>  }
>>
>> @@ -3369,6 +3393,26 @@ static int mov_parse_uuid_spherical(MOVStreamContext 
>> *sc, AVIOContext *pb, size_
>>  val = av_stristr(buffer, "");
>>  if (val)
>>  sc->spherical->roll = strtol(val, NULL, 10) * (1 << 16);
>> +
>> +/* tiling */
>> +val = av_stristr(buffer, "");
>> +if (val)
>> +sc->spherical->left_bound = strtol(val, NULL, 10);
>> +val = av_stristr(buffer, "");
>> +if (val)
>> +sc->spherical->top_bound = strtol(val, NULL, 10);
>> +val = av_stristr(buffer, 
>> "");
>> +if (val)
>> +sc->spherical->right_bound =
>> +sc->width - sc->spherical->left_bound - strtol(val, NULL, 
>> 10);
>> +val = av_stristr(buffer, 
>> "");
>> +if (val)
>> +sc->spherical->bottom_bound =
>> +sc->height - sc->spherical->top_bound - strtol(val, NULL, 
>> 10);
>
> Shouldn't these check that the result is sane?

yolo?

Spec v1 has no limits, while v2 has checks on the bottom and right
bounds only, like

projection_bounds_bottom must be less than 0x - projection_bounds_top

Given that they are expressed in size_t and that users can use it only
for additions I'm unsure how to properly validate these fields.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 1/5] mov: Fix spherical metadata_source parsing

2017-02-15 Thread Vittorio Giovara
On Wed, Feb 15, 2017 at 2:22 AM, Anton Khirnov <an...@khirnov.net> wrote:
> Quoting Vittorio Giovara (2017-02-10 22:08:07)
>> From: Aaron Colwell <acolw...@google.com>
>>
>> Signed-off-by: James Almer <jamr...@gmail.com>
>> ---
>>  libavformat/mov.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>> index 2810960..4a6f9c0 100644
>> --- a/libavformat/mov.c
>> +++ b/libavformat/mov.c
>> @@ -3255,7 +3255,7 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext 
>> *pb, MOVAtom atom)
>>  return 0;
>>  }
>>  avio_skip(pb, 4); /*  version + flags */
>> -avio_skip(pb, avio_r8(pb)); /* metadata_source */
>> +avio_skip(pb, size - 12); /* metadata_source */
>>
>>  size = avio_rb32(pb);
>>  if (size > atom.size)
>> @@ -3268,7 +3268,7 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext 
>> *pb, MOVAtom atom)
>>  }
>>
>>  size = avio_rb32(pb);
>> -if (size > atom.size)
>> +if (size <= 12 || size > atom.size)
>>  return AVERROR_INVALIDDATA;
>>
>>  tag = avio_rl32(pb);
>> --
>> 2.10.0
>
> The first hunk looks ok, but the second one is strange? Why specifically
> that check. I see a bunch of similar code in this function where similar
> checks might also make sense, yet one is added only here.

hm, yes, the < 12 check should be *before* the first chunk, i guess
git am got confused to which block of code the diff belonged to (and I
didn't check either).
I'll send an updated version, thanks for spotting.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] mov: Do not try to parse multiple stsd boxes for the same track

2017-02-13 Thread Vittorio Giovara
On Sat, Feb 11, 2017 at 4:44 PM, Luca Barbato  wrote:
> Bug-Id: 1017
> CC: libav-sta...@libav.org
> ---
>
>  libavformat/mov.c | 6 ++
>  1 file changed, 6 insertions(+)
>
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 2810960..001abcc 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -1911,6 +1911,12 @@ static int mov_read_stsd(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>  avio_rb24(pb); /* flags */
>  entries = avio_rb32(pb);
>
> +if (sc->extradata) {
> +av_log(c->fc, AV_LOG_ERROR,
> +   "A stsd atom already found for the track.\n");

atom is the "mov" way of saying "box" and that might cause confusion,
so I would rephrase the error message just

"Duplicate stsd found in this track"

Related, I'd drop "boxes" from the commit title as well.

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

Re: [libav-devel] [PATCH 3/4] Rename "tools" subdirectory to "utilities"

2017-02-13 Thread Vittorio Giovara
On Sat, Feb 11, 2017 at 2:58 PM, Luca Barbato  wrote:
> On 06/01/2017 14:45, Diego Biurrun wrote:
>> ---
>
> Seems fine.
>

I don't mean to bikeshed the name, but why?
Is it too similar to avtools directory? If so please mention that in
the commit log.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] h264: Correctly initialize interlaced_frame if tff is set

2017-02-10 Thread Vittorio Giovara
In particular cases, it is possible to initialize top_field_first
but not interlaced_frame. Make sure to correctly tag a frame
as interlaced when this happens.

Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 libavcodec/h264_slice.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index f1f5fc0..331e0c3 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1047,15 +1047,17 @@ static int h264_export_frame_props(H264Context *h)
 
 if (cur->field_poc[0] != cur->field_poc[1]) {
 /* Derive top_field_first from field pocs. */
-cur->f->top_field_first = cur->field_poc[0] < cur->field_poc[1];
+cur->f->interlaced_frame =
+cur->f->top_field_first  = cur->field_poc[0] < cur->field_poc[1];
 } else {
 if (cur->f->interlaced_frame || sps->pic_struct_present_flag) {
 /* Use picture timing SEI information. Even if it is a
  * information of a past frame, better than nothing. */
 if (h->sei.picture_timing.pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM 
||
-h->sei.picture_timing.pic_struct == 
SEI_PIC_STRUCT_TOP_BOTTOM_TOP)
-cur->f->top_field_first = 1;
-else
+h->sei.picture_timing.pic_struct == 
SEI_PIC_STRUCT_TOP_BOTTOM_TOP) {
+cur->f->interlaced_frame =
+cur->f->top_field_first  = 1;
+} else
 cur->f->top_field_first = 0;
 } else {
 /* Most likely progressive */
-- 
2.10.0

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

[libav-devel] [PATCH 1/5] mov: Fix spherical metadata_source parsing

2017-02-10 Thread Vittorio Giovara
From: Aaron Colwell 

Signed-off-by: James Almer 
---
 libavformat/mov.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 2810960..4a6f9c0 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3255,7 +3255,7 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 return 0;
 }
 avio_skip(pb, 4); /*  version + flags */
-avio_skip(pb, avio_r8(pb)); /* metadata_source */
+avio_skip(pb, size - 12); /* metadata_source */
 
 size = avio_rb32(pb);
 if (size > atom.size)
@@ -3268,7 +3268,7 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 }
 
 size = avio_rb32(pb);
-if (size > atom.size)
+if (size <= 12 || size > atom.size)
 return AVERROR_INVALIDDATA;
 
 tag = avio_rl32(pb);
-- 
2.10.0

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

[libav-devel] [PATCH 5/5] mkv: Export bounds and padding from spherical metadata

2017-02-10 Thread Vittorio Giovara
---
 libavformat/matroskadec.c | 34 +-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index a44ceeb..ebfd414 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1601,17 +1601,34 @@ static int mkv_parse_video_projection(AVStream *st, 
const MatroskaTrack *track)
 AVSphericalMapping *spherical;
 enum AVSphericalProjection projection;
 size_t spherical_size;
+size_t l, t, r, b;
+size_t padding = 0;
 int ret;
+GetByteContext gb;
+
+bytestream2_init(, track->video.projection.private.data,
+ track->video.projection.private.size);
 
 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 {
+projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE;
+bytestream2_skip(, 4); // version + flags
+t = bytestream2_get_be32();
+b = bytestream2_get_be32();
+l = bytestream2_get_be32();
+r = bytestream2_get_be32();
+}
 break;
 case MATROSKA_VIDEO_PROJECTION_TYPE_CUBEMAP:
 if (track->video.projection.private.size < 4) {
 av_log(NULL, AV_LOG_ERROR, "Missing projection private 
properties\n");
 return AVERROR_INVALIDDATA;
 }
+bytestream2_skip(, 4); // layout
+padding = bytestream2_get_be32();
 projection = AV_SPHERICAL_CUBEMAP;
 break;
 default:
@@ -1627,6 +1644,21 @@ 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;
+
+if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+/* conversion from 0.32 coordinates to pixels */
+uint32_t max_coord = (uint32_t) -1;
+size_t orig_width  = (size_t) track->video.pixel_width  * max_coord / 
(max_coord - r - l);
+size_t orig_height = (size_t) track->video.pixel_height * max_coord / 
(max_coord - b - t);
+
+/* add a (max_coord - 1) to round up integer division */
+spherical->left_bound   = (orig_width  * l + max_coord - 1) / 
max_coord;
+spherical->top_bound= (orig_height * t + max_coord - 1) / 
max_coord;
+spherical->right_bound  = orig_width  - track->video.pixel_width  - 
spherical->left_bound;
+spherical->bottom_bound = orig_height - track->video.pixel_height - 
spherical->top_bound;
+}
+
 ret = av_stream_add_side_data(st, AV_PKT_DATA_SPHERICAL, (uint8_t 
*)spherical,
   spherical_size);
 if (ret < 0)
-- 
2.10.0

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

[libav-devel] [PATCH 4/5] mov: Export bounds and padding from spherical metadata

2017-02-10 Thread Vittorio Giovara
Update the fate test as needed.
---
 libavformat/mov.c| 46 +++-
 tests/fate/mov.mak   |  2 +-
 tests/ref/fate/mov-spherical |  6 +-
 3 files changed, 51 insertions(+), 3 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 4a6f9c0..bc35677 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3231,6 +3231,8 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 MOVStreamContext *sc;
 int size;
 int32_t yaw, pitch, roll;
+size_t l, t, r, b;
+size_t padding = 0;
 uint32_t tag;
 enum AVSphericalProjection projection;
 
@@ -3292,9 +3294,17 @@ 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 (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");
@@ -3311,6 +3321,20 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 sc->spherical->pitch = pitch;
 sc->spherical->roll  = roll;
 
+sc->spherical->padding = padding;
+
+if (projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+/* conversion from 0.32 coordinates to pixels */
+uint32_t max_coord = (uint32_t) -1;
+size_t orig_width  = (size_t) sc->width  * max_coord / (max_coord - r 
- l);
+size_t orig_height = (size_t) sc->height * max_coord / (max_coord - b 
- t);
+
+/* add a (max_coord - 1) to round up integer division */
+sc->spherical->left_bound   = (orig_width  * l + max_coord - 1) / 
max_coord;
+sc->spherical->top_bound= (orig_height * t + max_coord - 1) / 
max_coord;
+sc->spherical->right_bound  = orig_width  - sc->width  - 
sc->spherical->left_bound;
+sc->spherical->bottom_bound = orig_height - sc->height - 
sc->spherical->top_bound;
+}
 return 0;
 }
 
@@ -3369,6 +3393,26 @@ static int mov_parse_uuid_spherical(MOVStreamContext 
*sc, AVIOContext *pb, size_
 val = av_stristr(buffer, "");
 if (val)
 sc->spherical->roll = strtol(val, NULL, 10) * (1 << 16);
+
+/* tiling */
+val = av_stristr(buffer, "");
+if (val)
+sc->spherical->left_bound = strtol(val, NULL, 10);
+val = av_stristr(buffer, "");
+if (val)
+sc->spherical->top_bound = strtol(val, NULL, 10);
+val = av_stristr(buffer, "");
+if (val)
+sc->spherical->right_bound =
+sc->width - sc->spherical->left_bound - strtol(val, NULL, 10);
+val = av_stristr(buffer, "");
+if (val)
+sc->spherical->bottom_bound =
+sc->height - sc->spherical->top_bound - strtol(val, NULL, 10);
+
+if (sc->spherical->left_bound || sc->spherical->top_bound ||
+sc->spherical->right_bound || sc->spherical->bottom_bound)
+sc->spherical->projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE;
 }
 
 out:
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 57cbb1c..9d64fd3 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -11,7 +11,7 @@ FATE_MOV += fate-mov-sar
 fate-mov-sar: CMD = probestream sample_aspect_ratio 
$(TARGET_SAMPLES)/mov/displaymatrix.mov
 
 FATE_MOV += fate-mov-spherical
-fate-mov-spherical: CMD = probestream projection,yaw,pitch,roll 
$(TARGET_SAMPLES)/mov/spherical.mov
+fate-mov-spherical: CMD = probestream 
projection,yaw,pitch,roll,left,top,right,bottom 
$(TARGET_SAMPLES)/mov/spherical.mov
 
 FATE_MOV += fate-mov-stereo3d
 fate-mov-stereo3d: CMD = probestream type $(TARGET_SAMPLES)/mov/spherical.mov
diff --git a/tests/ref/fate/mov-spherical b/tests/ref/fate/mov-spherical
index 760ae88..a3f8cdf 100644
--- a/tests/ref/fate/mov-spherical
+++ b/tests/ref/fate/mov-spherical
@@ -1,4 +1,8 @@
-equirectangular
+tiled equirectangular
+148
+73
+147
+72
 45
 30
 15
-- 
2.10.0

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

[libav-devel] [PATCH 2/5] matroskadec: add support for Spherical Video elements

2017-02-10 Thread Vittorio Giovara
From: James Almer <jamr...@gmail.com>

Signed-off-by: James Almer <jamr...@gmail.com>
Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 libavformat/matroska.h| 14 +++
 libavformat/matroskadec.c | 63 +++
 2 files changed, 77 insertions(+)

diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index 91bb978..4e9f96e 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -118,6 +118,13 @@
 #define MATROSKA_ID_VIDEOASPECTRATIO 0x54B3
 #define MATROSKA_ID_VIDEOCOLORSPACE 0x2EB524
 
+#define MATROSKA_ID_VIDEOPROJECTION 0x7670
+#define MATROSKA_ID_VIDEOPROJECTIONTYPE 0x7671
+#define MATROSKA_ID_VIDEOPROJECTIONPRIVATE 0x7672
+#define MATROSKA_ID_VIDEOPROJECTIONPOSEYAW 0x7673
+#define MATROSKA_ID_VIDEOPROJECTIONPOSEPITCH 0x7674
+#define MATROSKA_ID_VIDEOPROJECTIONPOSEROLL 0x7675
+
 /* IDs in the trackaudio master */
 #define MATROSKA_ID_AUDIOSAMPLINGFREQ 0xB5
 #define MATROSKA_ID_AUDIOOUTSAMPLINGFREQ 0x78B5
@@ -256,6 +263,13 @@ typedef enum {
   MATROSKA_VIDEO_STEREOMODE_TYPE_NB,
 } MatroskaVideoStereoModeType;
 
+typedef enum {
+  MATROSKA_VIDEO_PROJECTION_TYPE_RECTANGULAR= 0,
+  MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR= 1,
+  MATROSKA_VIDEO_PROJECTION_TYPE_CUBEMAP= 2,
+  MATROSKA_VIDEO_PROJECTION_TYPE_MESH   = 3,
+} MatroskaVideoProjectionType;
+
 /*
  * Matroska Codec IDs, strings
  */
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 4e121b6..a44ceeb 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -45,6 +45,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/lzo.h"
 #include "libavutil/mathematics.h"
+#include "libavutil/spherical.h"
 
 #include "libavcodec/bytestream.h"
 #include "libavcodec/flac.h"
@@ -116,6 +117,14 @@ typedef struct MatroskaTrackEncoding {
 MatroskaTrackCompression compression;
 } MatroskaTrackEncoding;
 
+typedef struct MatroskaTrackVideoProjection {
+uint64_t type;
+EbmlBin private;
+double yaw;
+double pitch;
+double roll;
+} MatroskaTrackVideoProjection;
+
 typedef struct MatroskaTrackVideo {
 double   frame_rate;
 uint64_t display_width;
@@ -126,6 +135,7 @@ typedef struct MatroskaTrackVideo {
 uint64_t interlaced;
 uint64_t field_order;
 uint64_t stereo_mode;
+MatroskaTrackVideoProjection projection;
 } MatroskaTrackVideo;
 
 typedef struct MatroskaTrackAudio {
@@ -309,6 +319,15 @@ static EbmlSyntax matroska_info[] = {
 { 0 }
 };
 
+static const EbmlSyntax matroska_track_video_projection[] = {
+{ MATROSKA_ID_VIDEOPROJECTIONTYPE,  EBML_UINT,  0, 
offsetof(MatroskaTrackVideoProjection, type), { .u = 
MATROSKA_VIDEO_PROJECTION_TYPE_RECTANGULAR } },
+{ MATROSKA_ID_VIDEOPROJECTIONPRIVATE,   EBML_BIN,   0, 
offsetof(MatroskaTrackVideoProjection, private) },
+{ MATROSKA_ID_VIDEOPROJECTIONPOSEYAW,   EBML_FLOAT, 0, 
offsetof(MatroskaTrackVideoProjection, yaw), { .f=0.0 } },
+{ MATROSKA_ID_VIDEOPROJECTIONPOSEPITCH, EBML_FLOAT, 0, 
offsetof(MatroskaTrackVideoProjection, pitch), { .f=0.0 } },
+{ MATROSKA_ID_VIDEOPROJECTIONPOSEROLL,  EBML_FLOAT, 0, 
offsetof(MatroskaTrackVideoProjection, roll), { .f=0.0 } },
+{ 0 }
+};
+
 static EbmlSyntax matroska_track_video[] = {
 { MATROSKA_ID_VIDEOFRAMERATE,  EBML_FLOAT, 0, 
offsetof(MatroskaTrackVideo, frame_rate) },
 { MATROSKA_ID_VIDEODISPLAYWIDTH,   EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, display_width) },
@@ -316,6 +335,7 @@ static EbmlSyntax matroska_track_video[] = {
 { MATROSKA_ID_VIDEOPIXELWIDTH, EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, pixel_width) },
 { MATROSKA_ID_VIDEOPIXELHEIGHT,EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, pixel_height) },
 { MATROSKA_ID_VIDEOCOLORSPACE, EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, fourcc) },
+{ MATROSKA_ID_VIDEOPROJECTION, EBML_NEST,  0, 
offsetof(MatroskaTrackVideo, projection), { .n = 
matroska_track_video_projection } },
 { MATROSKA_ID_VIDEOPIXELCROPB, EBML_NONE },
 { MATROSKA_ID_VIDEOPIXELCROPT, EBML_NONE },
 { MATROSKA_ID_VIDEOPIXELCROPL, EBML_NONE },
@@ -1576,6 +1596,45 @@ static void mkv_stereo_mode_display_mul(int stereo_mode,
 }
 }
 
+static int mkv_parse_video_projection(AVStream *st, const MatroskaTrack *track)
+{
+AVSphericalMapping *spherical;
+enum AVSphericalProjection projection;
+size_t spherical_size;
+int ret;
+
+switch (track->video.projection.type) {
+case MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR:
+projection = AV_SPHERICAL_EQUIRECTANGULAR;
+break;
+case MATROSKA_VIDEO_PROJECTION_TYPE_CUBEMAP:
+if (track->video.projection.private.size < 4) {
+av_log(NULL, AV_LOG_ERROR, "Missing projection private 
properties\n");
+return AVERROR_INVALIDDATA;
+

[libav-devel] [PATCH 3/5] spherical: Add tiled equirectangular type and projection-specific properties

2017-02-10 Thread Vittorio Giovara
Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 avprobe.c | 15 +++---
 doc/APIchanges|  5 +
 libavformat/dump.c| 10 +
 libavutil/spherical.h | 56 +++
 libavutil/version.h   |  2 +-
 5 files changed, 84 insertions(+), 4 deletions(-)

diff --git a/avprobe.c b/avprobe.c
index a24e644..7e20da1 100644
--- a/avprobe.c
+++ b/avprobe.c
@@ -792,11 +792,20 @@ static void show_stream(InputFile *ifile, InputStream 
*ist)
 spherical = (AVSphericalMapping *)sd->data;
 probe_object_header("spherical");
 
-if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR)
+if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR) {
 probe_str("projection", "equirectangular");
-else if (spherical->projection == AV_SPHERICAL_CUBEMAP)
+} else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
 probe_str("projection", "cubemap");
-else
+probe_int("padding", spherical->padding);
+} else if (spherical->projection == 
AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+probe_str("projection", "tiled equirectangular");
+probe_object_header("bounding");
+probe_int("left", spherical->left_bound);
+probe_int("top", spherical->top_bound);
+probe_int("right", spherical->right_bound);
+probe_int("bottom", spherical->bottom_bound);
+probe_object_footer("bounding");
+} else
 probe_str("projection", "unknown");
 
 probe_object_header("orientation");
diff --git a/doc/APIchanges b/doc/APIchanges
index c161618..f2b2d0e 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,11 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2017-02-10 - xxx - lavu 55.31.0 - spherical.h
+  Add AV_SPHERICAL_EQUIRECTANGULAR_TILE, and projection-specific properties
+  (left_bound, top_bound, right_bound, bottom_bound, padding) to
+  AVSphericalMapping.
+
 2017-02-01 - xxx - lavc - avcodec.h
   Deprecate AVCodecContext.refcounted_frames. This was useful for deprecated
   API only (avcodec_decode_video2/avcodec_decode_audio4). The new decode APIs
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 660df0a..b7ae13d 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -321,6 +321,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, "cubemap ");
+else if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE)
+av_log(ctx, AV_LOG_INFO, "tiled equirectangular ");
 else {
 av_log(ctx, AV_LOG_WARNING, "unknown");
 return;
@@ -330,6 +332,14 @@ static void dump_spherical(void *ctx, AVPacketSideData *sd)
 pitch = ((double)spherical->pitch) / (1 << 16);
 roll = ((double)spherical->roll) / (1 << 16);
 av_log(ctx, AV_LOG_INFO, "(%f/%f/%f) ", yaw, pitch, roll);
+
+if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+av_log(ctx, AV_LOG_INFO, "[%zu, %zu, %zu, %zu] ",
+   spherical->left_bound, spherical->top_bound,
+   spherical->right_bound, spherical->bottom_bound);
+} else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
+av_log(ctx, AV_LOG_INFO, "[pad %zu] ", spherical->padding);
+}
 }
 
 static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
diff --git a/libavutil/spherical.h b/libavutil/spherical.h
index 0045eb9..559f7e6 100644
--- a/libavutil/spherical.h
+++ b/libavutil/spherical.h
@@ -63,6 +63,13 @@ enum AVSphericalProjection {
  * to the back.
  */
 AV_SPHERICAL_CUBEMAP,
+
+/**
+ * Video represents a portion of a sphere mapped on a flat surface
+ * using equirectangular projection. The @ref bounding fields indicate
+ * the position of the current video in a larger surface.
+ */
+AV_SPHERICAL_EQUIRECTANGULAR_TILE,
 };
 
 /**
@@ -122,6 +129,55 @@ typedef struct AVSphericalMapping {
 /**
  * @}
  */
+
+/**
+ * @name Bounding rectangle
+ * @anchor bounding
+ * @{
+ * These fields indicate the location of the current tile, and where
+ * it should be mapped relative to the original surface.
+ *
+ * @code{.unparsed}
+ *  +

Re: [libav-devel] [PATCH] travis: Ignore the filter-fade test

2017-02-09 Thread Vittorio Giovara
On Thu, Feb 9, 2017 at 8:30 PM, Luca Barbato  wrote:
> On 26/01/2017 12:42, Luca Barbato wrote:
>> It glitches with the stale travis linux target.
>> ---
>>
>>  .travis.yml | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/.travis.yml b/.travis.yml
>> index 8e9629a..f7dab48 100644
>> --- a/.travis.yml
>> +++ b/.travis.yml
>> @@ -20,7 +20,7 @@ install:
>>- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install yasm; fi
>>  script:
>>- mkdir -p libav-samples
>> -  - ./configure --samples=libav-samples --cc=$CC
>> +  - ./configure --samples=libav-samples --cc=$CC --ignore-tests=filter-fade
>>- make -j 8
>>- make fate-rsync
>>- make check -j 8
>> --
>> 2.9.2
>
> Ping, I'd merge it tomorrow, not into figuring out what makes that
> combination of compiler and vm upset with that specific filter.

I'm ok with it but please change the commit log to something more descriptive.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] imgutils: Document av_image_get_buffer_size()

2017-02-08 Thread Vittorio Giovara
On Tue, Feb 7, 2017 at 10:01 AM, Vittorio Giovara
<vittorio.giov...@gmail.com> wrote:
> ---
>  libavutil/imgutils.h | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/libavutil/imgutils.h b/libavutil/imgutils.h
> index 67063a2..ac1bcb8 100644
> --- a/libavutil/imgutils.h
> +++ b/libavutil/imgutils.h
> @@ -169,7 +169,12 @@ int av_image_fill_arrays(uint8_t *dst_data[4], int 
> dst_linesize[4],
>   * Return the size in bytes of the amount of data required to store an
>   * image with the given parameters.
>   *
> - * @param[in] align the assumed linesize alignment
> + * @param pix_fmt  the pixel format of the image
> + * @param widththe width of the image in pixels
> + * @param height   the height of the image in pixels
> + * @param alignthe assumed linesize alignment
> + * @return the size in bytes required for src, a negative error code
> + * in case of failure

I was pointed to the fact that there is no `src` field, I'll replace
the @return line with
 * @return the buffer size in bytes, a negative error code in case of failure
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 3/5] frame: allow align=0 (meaning automatic) for av_frame_get_buffer()

2017-02-08 Thread Vittorio Giovara
On Wed, Feb 8, 2017 at 5:50 AM, Anton Khirnov  wrote:
> This will avoid every caller from hardcoding some specific alignment,
> which may break in the future with new instruction sets.
> ---
>  doc/APIchanges  | 4 
>  libavutil/frame.c   | 4 
>  libavutil/frame.h   | 4 +++-
>  libavutil/version.h | 2 +-
>  4 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index acd1536..fd751f3 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -13,6 +13,10 @@ libavutil: 2015-08-28
>
>  API changes, most recent first:
>
> +2017-02-xx - xxx - lavu 55.31.1 - frame.h
> +  Allow passing the value of 0 (meaning "automatic") as the required 
> alignment
> +  to av_frame_get_buffer().
> +
>  2017-02-xx - xxx - lavu 55.31.0 - cpu.h
>Add av_cpu_max_align() for querying maximum required data alignment.
>
> diff --git a/libavutil/frame.c b/libavutil/frame.c
> index aafaa57..aa5820c 100644
> --- a/libavutil/frame.c
> +++ b/libavutil/frame.c
> @@ -19,6 +19,7 @@
>  #include "channel_layout.h"
>  #include "buffer.h"
>  #include "common.h"
> +#include "cpu.h"
>  #include "dict.h"
>  #include "frame.h"
>  #include "imgutils.h"
> @@ -103,6 +104,9 @@ static int get_video_buffer(AVFrame *frame, int align)
>  if (ret < 0)
>  return ret;
>
> +if (align <= 0)
> +align = av_cpu_max_align();

should you maybe be stricter here and check for == 0, failing for negative?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] imgutils: Document av_image_get_buffer_size()

2017-02-07 Thread Vittorio Giovara
---
 libavutil/imgutils.h | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavutil/imgutils.h b/libavutil/imgutils.h
index 67063a2..ac1bcb8 100644
--- a/libavutil/imgutils.h
+++ b/libavutil/imgutils.h
@@ -169,7 +169,12 @@ int av_image_fill_arrays(uint8_t *dst_data[4], int 
dst_linesize[4],
  * Return the size in bytes of the amount of data required to store an
  * image with the given parameters.
  *
- * @param[in] align the assumed linesize alignment
+ * @param pix_fmt  the pixel format of the image
+ * @param widththe width of the image in pixels
+ * @param height   the height of the image in pixels
+ * @param alignthe assumed linesize alignment
+ * @return the size in bytes required for src, a negative error code
+ * in case of failure
  */
 int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int 
height, int align);
 
-- 
2.10.0

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

Re: [libav-devel] [PATCH] asfdec: use the BMP_HEADER specific Format Data size instead of

2017-02-07 Thread Vittorio Giovara
On Tue, Feb 7, 2017 at 8:15 AM, Alexandra Hájková
 wrote:
> the ASF specific Format Data size. Fixes video decoding problem
> part of the bug 1020.
> ---
>  libavformat/asfdec.c  | 8 +---
>  libavformat/avidec.c  | 2 +-
>  libavformat/riff.h| 2 +-
>  libavformat/riffdec.c | 6 --
>  libavformat/wtv.c | 2 +-
>  5 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
> index d602af8..10f8644 100644
> --- a/libavformat/asfdec.c
> +++ b/libavformat/asfdec.c
> @@ -691,16 +691,18 @@ static int asf_read_properties(AVFormatContext *s, 
> const GUIDParseTable *g)
>
>  static int parse_video_info(AVIOContext *pb, AVStream *st)
>  {
> -uint16_t size;
> +uint16_t size_;
> +uint32_t size;

This is a big NO from me. You should rename them according to what
they actually are (eg size_format_data and size_bmp_header).
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [fosdem] bof room

2017-02-05 Thread Vittorio Giovara
Hi,
there will be a BoF room available for Libav talks and development at
1.15pm/13.15 in the H building (first floor).
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] Add Apple Pixlet decoder

2017-02-04 Thread Vittorio Giovara
From: Paul B Mahol <one...@gmail.com>

Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
Patch updated according to Diego and Anton's review.
Vittorio

 Changelog   |   1 +
 doc/general.texi|   1 +
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/avcodec.h|   1 +
 libavcodec/codec_desc.c |   7 +
 libavcodec/pixlet.c | 689 
 libavcodec/version.h|   2 +-
 libavformat/isom.c  |   2 +
 tests/fate/video.mak|   3 +
 tests/ref/fate/pixlet   |   5 +
 11 files changed, 712 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/pixlet.c
 create mode 100644 tests/ref/fate/pixlet

diff --git a/Changelog b/Changelog
index 713883d..8e8bbcb 100644
--- a/Changelog
+++ b/Changelog
@@ -8,6 +8,7 @@ version :
 - VAAPI-accelerated deinterlacing
 - config.log and other configuration files moved into avbuild/ directory
 - VAAPI-accelerated MPEG-2 and VP8 encoding
+- Apple Pixlet decoder
 
 
 version 12:
diff --git a/doc/general.texi b/doc/general.texi
index d232300..54e319f 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -590,6 +590,7 @@ following image formats are supported:
 @item ANSI/ASCII art @tab @tab  X
 @item Apple Intermediate Codec @tab @tab  X
 @item Apple MJPEG-B  @tab @tab  X
+@item Apple Pixlet   @tab @tab  X
 @item Apple ProRes   @tab  X  @tab  X
 @item Apple QuickDraw@tab @tab  X
 @tab fourcc: qdrw
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 7d28d66..7f295dc 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -375,6 +375,7 @@ OBJS-$(CONFIG_PGMYUV_DECODER)  += pnmdec.o pnm.o
 OBJS-$(CONFIG_PGMYUV_ENCODER)  += pnmenc.o
 OBJS-$(CONFIG_PGSSUB_DECODER)  += pgssubdec.o
 OBJS-$(CONFIG_PICTOR_DECODER)  += pictordec.o cga_data.o
+OBJS-$(CONFIG_PIXLET_DECODER)  += pixlet.o
 OBJS-$(CONFIG_PNG_DECODER) += png.o pngdec.o pngdsp.o
 OBJS-$(CONFIG_PNG_ENCODER) += png.o pngenc.o
 OBJS-$(CONFIG_PPM_DECODER) += pnmdec.o pnm.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 46c42c5..1bfddb0 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -231,6 +231,7 @@ void avcodec_register_all(void)
 REGISTER_ENCDEC (PGM,   pgm);
 REGISTER_ENCDEC (PGMYUV,pgmyuv);
 REGISTER_DECODER(PICTOR,pictor);
+REGISTER_DECODER(PIXLET,pixlet);
 REGISTER_ENCDEC (PNG,   png);
 REGISTER_ENCDEC (PPM,   ppm);
 REGISTER_ENCDEC (PRORES,prores);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 1872156..84b4d3f 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -392,6 +392,7 @@ enum AVCodecID {
 AV_CODEC_ID_MAGICYUV,
 AV_CODEC_ID_TRUEMOTION2RT,
 AV_CODEC_ID_AV1,
+AV_CODEC_ID_PIXLET,
 
 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
start of audio codecs
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 18568c9..ab2018b 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1212,6 +1212,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Alliance for Open Media AV1"),
 .props = AV_CODEC_PROP_LOSSY,
 },
+{
+.id= AV_CODEC_ID_PIXLET,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "pixlet",
+.long_name = NULL_IF_CONFIG_SMALL("Apple Pixlet"),
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+},
 
 /* image codecs */
 {
diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c
new file mode 100644
index 000..6ef875d
--- /dev/null
+++ b/libavcodec/pixlet.c
@@ -0,0 +1,689 @@
+/*
+ * Apple Pixlet decoder
+ * Copyright (c) 2016 Paul B Mahol
+ *
+ * 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 "libavutil/imgutils.h"
+#include "libavutil/intmath.h"
+#include "libavutil/opt.h"
+
+#include "avcodec.h"
+#include "

Re: [libav-devel] [PATCH] Add Apple Pixlet decoder

2017-02-04 Thread Vittorio Giovara
On Sat, Feb 4, 2017 at 11:11 AM, Diego Biurrun <di...@biurrun.de> wrote:
> On Fri, Feb 03, 2017 at 05:57:33PM +0100, Vittorio Giovara wrote:
>> --- /dev/null
>> +++ b/libavcodec/pixlet.c
>> +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];
>
> pointless casts?
>
>> +static void postprocess_chroma(AVFrame *frame, int w, int h, int depth)
>> +{
>> +uint16_t *dstu = (uint16_t *)frame->data[1];
>> +uint16_t *dstv = (uint16_t *)frame->data[2];
>> +int16_t *srcu  = (int16_t *)frame->data[1];
>> +int16_t *srcv  = (int16_t *)frame->data[2];
>
> same?
>
>> +static int decode_plane(AVCodecContext *avctx, int plane,
>> +AVPacket *avpkt, AVFrame *frame)
>> +dst= (int16_t *) frame->data[plane];
>> +dst[0] = sign_extend(bytestream2_get_be16(>gb), 16);
>
> same?

All these casts are necessary because frame->data is uint8_t*.
Fixed all the other comments.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH 2/2] libavutil: add av_mod_uintp2

2017-02-03 Thread Vittorio Giovara
From: James Almer 

Signed-off-by: James Almer 
---
Second api requirment for pixlet.
Vittorio

 libavutil/common.h | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/libavutil/common.h b/libavutil/common.h
index d2ddcba..3832f10 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -182,6 +182,17 @@ static av_always_inline av_const unsigned 
av_clip_uintp2_c(int a, int p)
 else   return  a;
 }
 
+/**
+ * Clear high bits from an unsigned integer starting with specific bit position
+ * @param  a value to clip
+ * @param  p bit position to clip at
+ * @return clipped value
+ */
+static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned 
p)
+{
+return a & ((1 << p) - 1);
+}
+
 /**
  * Add two signed 32-bit values with saturation.
  *
@@ -410,6 +421,9 @@ static av_always_inline av_const int 
av_popcount64_c(uint64_t x)
 #ifndef av_clip_uintp2
 #   define av_clip_uintp2   av_clip_uintp2_c
 #endif
+#ifndef av_mod_uintp2
+#   define av_mod_uintp2av_mod_uintp2_c
+#endif
 #ifndef av_sat_add32
 #   define av_sat_add32 av_sat_add32_c
 #endif
-- 
2.10.0

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

[libav-devel] [PATCH 1/2] intmath: add faster clz support

2017-02-03 Thread Vittorio Giovara
From: Ganesh Ajjanagadde 

---
One of the api requirements for pixlet.
Vittorio

 libavutil/intmath.h | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/libavutil/intmath.h b/libavutil/intmath.h
index a5ee652..780bbab 100644
--- a/libavutil/intmath.h
+++ b/libavutil/intmath.h
@@ -44,6 +44,10 @@
 #   endif
 #endif /* ff_log2 */
 
+#ifndef ff_clz
+#   define ff_clz(v) __builtin_clz(v)
+#endif /* ff_clz */
+
 #endif /* AV_GCC_VERSION_AT_LEAST(3,4) */
 
 extern const uint8_t ff_log2_tab[256];
@@ -132,6 +136,21 @@ static av_always_inline av_const int ff_ctz_c(int v)
 }
 #endif
 
+#ifndef ff_clz
+#define ff_clz ff_clz_c
+static av_always_inline av_const unsigned ff_clz_c(unsigned x)
+{
+unsigned i = sizeof(x) * 8;
+
+while (x) {
+x >>= 1;
+i--;
+}
+
+return i;
+}
+#endif
+
 /**
  * Trailing zero bit count.
  *
-- 
2.10.0

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

[libav-devel] [PATCH] Add Apple Pixlet decoder

2017-02-03 Thread Vittorio Giovara
From: Paul B Mahol <one...@gmail.com>

Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 Changelog   |   1 +
 doc/general.texi|   1 +
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/avcodec.h|   1 +
 libavcodec/codec_desc.c |   7 +
 libavcodec/pixlet.c | 692 
 libavcodec/version.h|   2 +-
 libavformat/isom.c  |   2 +
 tests/fate/video.mak|   3 +
 tests/ref/fate/pixlet   |   5 +
 11 files changed, 715 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/pixlet.c
 create mode 100644 tests/ref/fate/pixlet

diff --git a/Changelog b/Changelog
index 713883d..8e8bbcb 100644
--- a/Changelog
+++ b/Changelog
@@ -8,6 +8,7 @@ version :
 - VAAPI-accelerated deinterlacing
 - config.log and other configuration files moved into avbuild/ directory
 - VAAPI-accelerated MPEG-2 and VP8 encoding
+- Apple Pixlet decoder
 
 
 version 12:
diff --git a/doc/general.texi b/doc/general.texi
index d232300..54e319f 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -590,6 +590,7 @@ following image formats are supported:
 @item ANSI/ASCII art @tab @tab  X
 @item Apple Intermediate Codec @tab @tab  X
 @item Apple MJPEG-B  @tab @tab  X
+@item Apple Pixlet   @tab @tab  X
 @item Apple ProRes   @tab  X  @tab  X
 @item Apple QuickDraw@tab @tab  X
 @tab fourcc: qdrw
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 7d28d66..7f295dc 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -375,6 +375,7 @@ OBJS-$(CONFIG_PGMYUV_DECODER)  += pnmdec.o pnm.o
 OBJS-$(CONFIG_PGMYUV_ENCODER)  += pnmenc.o
 OBJS-$(CONFIG_PGSSUB_DECODER)  += pgssubdec.o
 OBJS-$(CONFIG_PICTOR_DECODER)  += pictordec.o cga_data.o
+OBJS-$(CONFIG_PIXLET_DECODER)  += pixlet.o
 OBJS-$(CONFIG_PNG_DECODER) += png.o pngdec.o pngdsp.o
 OBJS-$(CONFIG_PNG_ENCODER) += png.o pngenc.o
 OBJS-$(CONFIG_PPM_DECODER) += pnmdec.o pnm.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 46c42c5..1bfddb0 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -231,6 +231,7 @@ void avcodec_register_all(void)
 REGISTER_ENCDEC (PGM,   pgm);
 REGISTER_ENCDEC (PGMYUV,pgmyuv);
 REGISTER_DECODER(PICTOR,pictor);
+REGISTER_DECODER(PIXLET,pixlet);
 REGISTER_ENCDEC (PNG,   png);
 REGISTER_ENCDEC (PPM,   ppm);
 REGISTER_ENCDEC (PRORES,prores);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 1872156..84b4d3f 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -392,6 +392,7 @@ enum AVCodecID {
 AV_CODEC_ID_MAGICYUV,
 AV_CODEC_ID_TRUEMOTION2RT,
 AV_CODEC_ID_AV1,
+AV_CODEC_ID_PIXLET,
 
 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
start of audio codecs
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 18568c9..ab2018b 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1212,6 +1212,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Alliance for Open Media AV1"),
 .props = AV_CODEC_PROP_LOSSY,
 },
+{
+.id= AV_CODEC_ID_PIXLET,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "pixlet",
+.long_name = NULL_IF_CONFIG_SMALL("Apple Pixlet"),
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+},
 
 /* image codecs */
 {
diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c
new file mode 100644
index 000..c13f348
--- /dev/null
+++ b/libavcodec/pixlet.c
@@ -0,0 +1,692 @@
+/*
+ * Apple Pixlet decoder
+ * Copyright (c) 2016 Paul B Mahol
+ *
+ * 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 "libavutil/imgutils.h"
+#include "libavutil/intmath.h"
+#include "libavutil/opt.h"
+
+#include "avcodec.h"
+#include "bitstream.h"
+#include "bytestream.h"
+#incl

[libav-devel] [PATCH] mov: Rework stsc index validation

2017-02-03 Thread Vittorio Giovara
In order to avoid potential integer overflow change the comparison
andmake sure to use the same unsigned type for both elements.
---
Thanks to Clement for pointing this issue out.
Vittorio

 libavformat/isom.h | 2 +-
 libavformat/mov.c  | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index 85b8761..8cc5ab7 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -111,7 +111,7 @@ typedef struct MOVStreamContext {
 MOVStts *ctts_data;
 unsigned int stsc_count;
 MOVStsc *stsc_data;
-int stsc_index;
+unsigned int stsc_index;
 int stsc_sample;
 unsigned int stps_count;
 unsigned *stps_data;  ///< partial sync sample for mpeg-2 open gop
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 9afd020..e42e04f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1983,13 +1983,13 @@ static int mov_read_stsc(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 return 0;
 }
 
-static inline int mov_stsc_index_valid(int index, int count)
+static inline int mov_stsc_index_valid(unsigned int index, unsigned int count)
 {
-return index + 1 < count;
+return index < count - 1;
 }
 
 /* Compute the samples value for the stsc entry at the given index. */
-static inline int mov_get_stsc_samples(MOVStreamContext *sc, int index)
+static inline int mov_get_stsc_samples(MOVStreamContext *sc, unsigned int 
index)
 {
 int chunk_count;
 
@@ -3982,7 +3982,7 @@ static int mov_seek_stream(AVFormatContext *s, AVStream 
*st, int64_t timestamp,
 {
 MOVStreamContext *sc = st->priv_data;
 int sample, time_sample;
-int i;
+unsigned int i;
 
 sample = av_index_search_timestamp(st, timestamp, flags);
 av_log(s, AV_LOG_TRACE, "stream %d, timestamp %"PRId64", sample %d\n", 
st->index, timestamp, sample);
-- 
2.10.0

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

Re: [libav-devel] [PATCH 03/12] configure: Use inline asm check helper function where appropriate

2017-02-01 Thread Vittorio Giovara
On Wed, Feb 1, 2017 at 6:37 PM, Diego Biurrun <di...@biurrun.de> wrote:
> On Wed, Feb 01, 2017 at 01:12:47PM +0100, Vittorio Giovara wrote:
>> On Wed, Feb 1, 2017 at 12:23 PM, Diego Biurrun <di...@biurrun.de> wrote:
>> > On Wed, Feb 01, 2017 at 10:51:15AM +0100, Vittorio Giovara wrote:
>> >> On Tue, Jan 24, 2017 at 6:12 PM, Diego Biurrun <di...@biurrun.de> wrote:
>> >> > --- a/configure
>> >> > +++ b/configure
>> >> > @@ -4165,9 +4165,7 @@ EOF
>> >> >
>> >> > -check_cc <> >> > -void foo(void) { __asm__ volatile ("" ::); }
>> >> > -EOF
>> >> > +check_inline_asm inline_asm '"" ::'
>> >>
>> >> Is the change just a more succinct check or is there a particular reason 
>> >> for it?
>> >
>> > The former:
>> >
>> > check_inline_asm(){
>> > log check_inline_asm "$@"
>> > name="$1"
>> > code="$2"
>> > shift 2
>> > disable $name
>> > check_cc "$@" <> > void foo(void){ __asm__ volatile($code); }
>> > EOF
>> > }
>>
>> ok thanks for the clarification, maybe you could mention that this
>> change is only a simplification and not a behavioral change.
>
> Like this:
>
>   configure: Simplify inline asm check with appropriate helper function
>
> ?
>
> Diego
> ___

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

Re: [libav-devel] [PATCH 03/12] configure: Use inline asm check helper function where appropriate

2017-02-01 Thread Vittorio Giovara
On Wed, Feb 1, 2017 at 12:23 PM, Diego Biurrun <di...@biurrun.de> wrote:
> On Wed, Feb 01, 2017 at 10:51:15AM +0100, Vittorio Giovara wrote:
>> On Tue, Jan 24, 2017 at 6:12 PM, Diego Biurrun <di...@biurrun.de> wrote:
>> > --- a/configure
>> > +++ b/configure
>> > @@ -4165,9 +4165,7 @@ EOF
>> >
>> > -check_cc <> > -void foo(void) { __asm__ volatile ("" ::); }
>> > -EOF
>> > +check_inline_asm inline_asm '"" ::'
>>
>> Is the change just a more succinct check or is there a particular reason for 
>> it?
>
> The former:
>
> check_inline_asm(){
> log check_inline_asm "$@"
> name="$1"
> code="$2"
> shift 2
> disable $name
> check_cc "$@" < void foo(void){ __asm__ volatile($code); }
> EOF
> }

ok thanks for the clarification, maybe you could mention that this
change is only a simplification and not a behavioral change.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 4/4] h264dec: drop pointless counting of consumed bytes

2017-02-01 Thread Vittorio Giovara
On Wed, Feb 1, 2017 at 11:34 AM, Anton Khirnov <an...@khirnov.net> wrote:
> Quoting Vittorio Giovara (2017-02-01 10:44:11)
>> On Wed, Feb 1, 2017 at 10:25 AM, Anton Khirnov <an...@khirnov.net> wrote:
>> > Video decoders always consume full packets.
>> > ---
>> >  libavcodec/h264dec.c | 20 +++-
>> >  1 file changed, 3 insertions(+), 17 deletions(-)
>>
>> Do you mean that get_consumed_bytes() was always equal to buf_size?
>> Also there are several decoders that don't completely consume packets,
>> so the commit line could be changed to h264 only probably.
>
> No, I mean that the return value is always ignored by the generic code
> for video decoders. See
> https://git.libav.org/?p=libav.git;a=blob;f=libavcodec/decode.c;h=f4088cdae8d6a364f95ee3e04a601157fcfe16aa;hb=HEAD#l355
> So it doesn't matter what value is returned here.

ok, but IMO it's hard to get that from the current commit description.
Could you amend it in a more direct way?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] svq3: fix the slice size check

2017-02-01 Thread Vittorio Giovara
On Wed, Feb 1, 2017 at 11:52 AM, Anton Khirnov  wrote:
> Currently it incorrectly compares bits with bytes.
>
> Also, move the check right before where it's relevant, so that the
> correct number of remaining bits is used.
>
> CC: libav-sta...@libav.org
> ---
>  libavcodec/svq3.c | 9 -
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
> index 8bbd331..f8143a2 100644
> --- a/libavcodec/svq3.c
> +++ b/libavcodec/svq3.c
> @@ -1030,17 +1030,16 @@ static int svq3_decode_slice_header(AVCodecContext 
> *avctx)
>  slice_bits   = slice_length * 8;
>  slice_bytes  = slice_length + length - 1;
>
> -if (slice_bytes > get_bits_left(>gb)) {
> -av_log(avctx, AV_LOG_ERROR, "slice after bitstream end\n");
> -return -1;
> -}
> -
>  skip_bits(>gb, 8);
>
>  av_fast_malloc(>slice_buf, >slice_size, slice_bytes + 
> AV_INPUT_BUFFER_PADDING_SIZE);
>  if (!s->slice_buf)
>  return AVERROR(ENOMEM);
>
> +if (slice_bytes * 8 > get_bits_left(>gb)) {
> +av_log(avctx, AV_LOG_ERROR, "slice after bitstream end\n");
> +return -1;
> +}
>  memcpy(s->slice_buf, s->gb.buffer + s->gb.index / 8, slice_bytes);
>
>  init_get_bits(>gb_slice, s->slice_buf, slice_bits);
> --

ok, can you also change the returned error to AVERROR_INVALIDDATA?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 11/12] configure: Simplify dlopen check

2017-02-01 Thread Vittorio Giovara
On Tue, Jan 24, 2017 at 6:12 PM, Diego Biurrun  wrote:
> ---
> @@ -4452,11 +4448,8 @@ check_code cc arm_neon.h "int16x8_t test = 
> vdupq_n_s16(0)" && enable intrinsics_
>
>  check_ldflags -Wl,--as-needed
>
> -if check_func dlopen; then
> -ldl=
> -elif check_func dlopen -ldl; then
> -ldl=-ldl
> -fi
> +# On some systems dynamic loading requires no extra linker flags
> +check_lib libdl dlfcn.h dlopen || check_lib libdl dlfcn.h dlopen -ldl
>
>  if ! disabled network; then
>  check_func getaddrinfo $network_extralibs
> @@ -4639,7 +4632,7 @@ done
>
>  # these are off by default, so fail if requested and not available
>  enabled avisynth  && require_header avisynth/avisynth_c.h
> -enabled avxsynth  && require avxsynth "avxsynth/avxsynth_c.h 
> dlfcn.h" dlopen -ldl
> +enabled avxsynth  && require_header avxsynth/avxsynth_c.h
>  enabled cuda  && require cuda cuda.h cuInit -lcuda
>  enabled frei0r&& require_header frei0r.h
>  enabled gnutls&& require_pkg_config "" gnutls gnutls/gnutls.h 
> gnutls_global_init
> --

The change is ok, I'm just unsure whether the check_lib should be
closer to where the other check_lib checks are.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 10/12] configure: Drop weak dependencies on external libraries for webm muxer

2017-02-01 Thread Vittorio Giovara
On Tue, Jan 24, 2017 at 6:12 PM, Diego Biurrun  wrote:
> Weak dependencies on external libraries do not obviate having to
> explicitly enable these libraries, so the weak dependency does not
> simplify the configure command line nor have any real effect.
> ---
>  configure | 1 -
>  1 file changed, 1 deletion(-)

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

Re: [libav-devel] [PATCH 09/12] configure: Add proper weak dependency of drawtext filter on libfontconfig

2017-02-01 Thread Vittorio Giovara
On Tue, Jan 24, 2017 at 6:12 PM, Diego Biurrun  wrote:
> ---
>  configure | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/configure b/configure
> index 90bc8b2..9ff6ad0 100755
> --- a/configure
> +++ b/configure
> @@ -2471,6 +2471,7 @@ deinterlace_qsv_filter_deps="libmfx"
>  deinterlace_vaapi_filter_deps="vaapi"
>  delogo_filter_deps="gpl"
>  drawtext_filter_deps="libfreetype"
> +drawtext_filter_suggest="libfontconfig"
>  frei0r_filter_deps="frei0r dlopen"
>  frei0r_filter_extralibs='$ldl'
>  frei0r_src_filter_deps="frei0r dlopen"
> --

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

Re: [libav-devel] [PATCH 06/12] configure: Add require_cpp_condition() convenience function

2017-02-01 Thread Vittorio Giovara
On Tue, Jan 24, 2017 at 6:12 PM, Diego Biurrun  wrote:
> Simplifies checking for conditions in external library headers and
> aborting if said conditions are not met.
> ---
>  configure | 17 +++--
>  1 file changed, 11 insertions(+), 6 deletions(-)

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

Re: [libav-devel] [PATCH 05/12] configure: Add require_header() convenience function

2017-02-01 Thread Vittorio Giovara
On Tue, Jan 24, 2017 at 6:12 PM, Diego Biurrun  wrote:
> Simplifies checking for external library headers and aborting if
> the external library support was requested, but is not available.
> ---
>  configure | 15 +++
>  1 file changed, 11 insertions(+), 4 deletions(-)

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

Re: [libav-devel] [PATCH 03/12] configure: Use inline asm check helper function where appropriate

2017-02-01 Thread Vittorio Giovara
On Tue, Jan 24, 2017 at 6:12 PM, Diego Biurrun  wrote:
> ---
>  configure | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/configure b/configure
> index f7436c5..c543c05 100755
> --- a/configure
> +++ b/configure
> @@ -4165,9 +4165,7 @@ EOF
>  sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ 
> \t]*ff_extern/)) }')
>  extern_prefix=${sym%%ff_extern*}
>
> -check_cc < -void foo(void) { __asm__ volatile ("" ::); }
> -EOF
> +check_inline_asm inline_asm '"" ::'
>
>  _restrict=
>  for restrict_keyword in restrict __restrict__ __restrict; do
> --

Is the change just a more succinct check or is there a particular reason for it?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 02/12] configure: Merge compiler/libc/os hacks sections

2017-02-01 Thread Vittorio Giovara
On Tue, Jan 24, 2017 at 6:12 PM, Diego Biurrun  wrote:
> ---
>  configure | 27 +--
>  1 file changed, 13 insertions(+), 14 deletions(-)
>
> diff --git a/configure b/configure
> index 2c8b57e..f7436c5 100755
> --- a/configure
> +++ b/configure
> @@ -4097,26 +4097,25 @@ test -n "$libc_type" && enable libc_$libc_type
>  probe_libc host_
>  test -n "$host_libc_type" && enable host_libc_$host_libc_type
>
> +# hacks for compiler/libc/os combinations
> +
>  case $libc_type in
>  bionic)
>  add_compat strtod.o strtod=avpriv_strtod
>  ;;
> +glibc)
> +if enabled tms470; then
> +CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
> +add_cppflags -D__USER_LABEL_PREFIX__=
> +add_cppflags -D__builtin_memset=memset
> +add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
> +add_cflags   -pds=48# incompatible redefinition of macro
> +elif enabled ccc; then
> +add_ldflags -Wl,-z,now  # calls to libots crash without this
> +fi
> +;;
>  esac
>
> -# hacks for compiler/libc/os combinations
> -
> -if enabled_all tms470 libc_glibc; then
> -CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
> -add_cppflags -D__USER_LABEL_PREFIX__=
> -add_cppflags -D__builtin_memset=memset
> -add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
> -add_cflags   -pds=48# incompatible redefinition of macro
> -fi
> -
> -if enabled_all ccc libc_glibc; then
> -add_ldflags -Wl,-z,now  # calls to libots crash without this
> -fi
> -
>  check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" 
> ||
>  add_cppflags '-I\$(SRC_PATH)/compat/float'
>
> --

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

Re: [libav-devel] [PATCH 01/12] configure: Use cppflags check helper functions where appropriate

2017-02-01 Thread Vittorio Giovara
On Tue, Jan 24, 2017 at 6:12 PM, Diego Biurrun  wrote:
> ---
>  configure | 14 --
>  1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/configure b/configure
> index 61d1807..2c8b57e 100755
> --- a/configure
> +++ b/configure
> @@ -3746,18 +3746,12 @@ add_cppflags -D_ISOC99_SOURCE
>
>  # some compilers silently accept -std=c11, so we also need to check that the
>  # version macro is defined properly
> -if test_cflags_cpp -std=c11 "__STDC_VERSION__ >= 201112L"; then
> -add_cflags -std=c11
> -else
> +check_cpp_condition stdlib.h  "__STDC_VERSION__ >= 201112L" &&
> +add_cflags -std=c11 ||
>  check_cflags -std=c99
> -fi
>
> -check_cc -D_FILE_OFFSET_BITS=64 < -#include 
> -EOF
> -check_cc -D_LARGEFILE_SOURCE < -#include 
> -EOF
> +check_cppflags -D_FILE_OFFSET_BITS=64
> +check_cppflags -D_LARGEFILE_SOURCE
>
>  add_host_cppflags -D_ISOC99_SOURCE
>  check_host_cflags -std=c99
> --

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

Re: [libav-devel] [PATCH 2/7] pthread_frame: merge the functionality for normal decoder init and init_thread_copy

2017-02-01 Thread Vittorio Giovara
On Wed, Feb 1, 2017 at 10:15 AM, Anton Khirnov  wrote:
> diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
> index b27aa54..771520b 100644
> --- a/libavcodec/h264dec.c
> +++ b/libavcodec/h264dec.c
> @@ -383,14 +383,16 @@ static av_cold int h264_decode_init(AVCodecContext 
> *avctx)
>  h->avctx->framerate.num *= 2;
>  avctx->ticks_per_frame = 2;
>
> -if (avctx->extradata_size > 0 && avctx->extradata) {
> -   ret = ff_h264_decode_extradata(avctx->extradata, 
> avctx->extradata_size,
> -  >ps, >is_avc, 
> >nal_length_size,
> -  avctx->err_recognition, avctx);
> -   if (ret < 0) {
> -   h264_decode_end(avctx);
> -   return ret;
> -   }
> +if (!avctx->internal->is_copy) {
> +if (avctx->extradata_size > 0 && avctx->extradata) {

Probably just a nit, but you could merge the two ifs here, so that you
don't have to reindent the block and minimize code changes. Same for a
few places below.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 4/4] h264dec: drop pointless counting of consumed bytes

2017-02-01 Thread Vittorio Giovara
On Wed, Feb 1, 2017 at 10:25 AM, Anton Khirnov  wrote:
> Video decoders always consume full packets.
> ---
>  libavcodec/h264dec.c | 20 +++-
>  1 file changed, 3 insertions(+), 17 deletions(-)

Do you mean that get_consumed_bytes() was always equal to buf_size?
Also there are several decoders that don't completely consume packets,
so the commit line could be changed to h264 only probably.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 3/4] h264dec: replace a pointless ref+unref with move_ref

2017-02-01 Thread Vittorio Giovara
On Wed, Feb 1, 2017 at 10:25 AM, Anton Khirnov  wrote:
> ---
>  libavcodec/h264dec.c | 5 +
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
> index b92795d..6ce0287 100644
> --- a/libavcodec/h264dec.c
> +++ b/libavcodec/h264dec.c
> @@ -699,10 +699,7 @@ static int h264_decode_frame(AVCodecContext *avctx, void 
> *data,
>
>  *got_frame = 0;
>  if (h->output_frame->buf[0]) {
> -ret = av_frame_ref(pict, h->output_frame);
> -av_frame_unref(h->output_frame);
> -if (ret < 0)
> -return ret;
> +av_frame_move_ref(pict, h->output_frame);
>  *got_frame = 1;
>  }
>  }
> --

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

Re: [libav-devel] [PATCH 1/4] h264: mark the currently active SPS as const

2017-02-01 Thread Vittorio Giovara
On Wed, Feb 1, 2017 at 10:25 AM, Anton Khirnov  wrote:
> It is never modified anymore.
> ---
>  libavcodec/h264_ps.h| 3 +--
>  libavcodec/h264_slice.c | 2 +-
>  2 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/h264_ps.h b/libavcodec/h264_ps.h
> index 9a32d93..1b482f3 100644
> --- a/libavcodec/h264_ps.h
> +++ b/libavcodec/h264_ps.h
> @@ -136,8 +136,7 @@ typedef struct H264ParamSets {
>
>  /* currently active parameters sets */
>  const PPS *pps;
> -// FIXME this should properly be const
> -SPS *sps;
> +const SPS *sps;
>  } H264ParamSets;
>
>  /**
> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
> index f1f5fc0..aa6d951 100644
> --- a/libavcodec/h264_slice.c
> +++ b/libavcodec/h264_slice.c
> @@ -799,7 +799,7 @@ static enum AVPixelFormat get_pixel_format(H264Context *h)
>  /* export coded and cropped frame dimensions to AVCodecContext */
>  static int init_dimensions(H264Context *h)
>  {
> -SPS *sps = h->ps.sps;
> +const SPS *sps = h->ps.sps;
>  int cr = sps->crop_right;
>  int cl = sps->crop_left;
>  int ct = sps->crop_top;
> --

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

Re: [libav-devel] [PATCH] build: Move cli tools to a separate subdirectory

2017-01-31 Thread Vittorio Giovara
On Tue, Jan 31, 2017 at 9:11 PM, Diego Biurrun  wrote:
> This unclutters the top-level directory and groups related files together.
> ---
> diff --git a/avtools/Makefile b/avtools/Makefile
> new file mode 100644
> index 000..04d2a02
> --- /dev/null
> +++ b/avtools/Makefile
> @@ -0,0 +1,43 @@
> +AVPROGS-$(CONFIG_AVCONV)   += avtools/avconv
> +AVPROGS-$(CONFIG_AVPLAY)   += avtools/avplay
> +AVPROGS-$(CONFIG_AVPROBE)  += avtools/avprobe

IMO the final executable should still stay in the build directory.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 14/14] wma: Convert to the new bitstream reader

2017-01-26 Thread Vittorio Giovara
On Thu, Jan 26, 2017 at 11:10 AM, Diego Biurrun  wrote:
> From: Alexandra Hájková 
>
> ---
>
> Carried over from the last batch.
>
>  libavcodec/wma.c|  41 +++
>  libavcodec/wma.h|   8 +-
>  libavcodec/wmadec.c |  64 +--
>  libavcodec/wmalosslessdec.c | 188 +++
>  libavcodec/wmaprodec.c  | 207 +-
>  libavcodec/wmavoice.c   | 262 
> ++--
>  6 files changed, 387 insertions(+), 383 deletions(-)

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

Re: [libav-devel] [PATCH 12/14] jpeg: Convert to the new bitstream reader

2017-01-26 Thread Vittorio Giovara
On Thu, Jan 26, 2017 at 11:10 AM, Diego Biurrun  wrote:
> From: Alexandra Hájková 
>
> ---
>  libavcodec/jpeglsdec.c |  48 +-
>  libavcodec/jpeglsenc.c |  14 +--
>  libavcodec/mjpegbdec.c |  44 -
>  libavcodec/mjpegdec.c  | 242 
> +
>  libavcodec/mjpegdec.h  |   5 +-
>  libavcodec/mxpegdec.c  |   9 +-
>  6 files changed, 165 insertions(+), 197 deletions(-)

This is hardly a fringe codec ;)

> @@ -542,26 +533,14 @@ static int decode_block_progressive(MJpegDecodeContext 
> *s, int16_t *block,
>  return 0;
>  }
>
> -{
> -OPEN_READER(re, >gb);
>  for (i = ss; ; i++) {
> -UPDATE_CACHE(re, >gb);
> -GET_VLC(code, re, >gb, s->vlcs[2][ac_index].table, 9, 2);
> +code = bitstream_read_vlc(>bc, s->vlcs[2][ac_index].table, 9, 
> 2);
>
>  run = ((unsigned) code) >> 4;
>  code &= 0xF;
>  if (code) {
>  i += run;
> -if (code > MIN_CACHE_BITS - 16)
> -UPDATE_CACHE(re, >gb);
> -
> -{
> -int cache = GET_CACHE(re, >gb);
> -int sign  = (~cache) >> 31;
> -level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign;
> -}
> -
> -LAST_SKIP_BITS(re, >gb, code);
> +level = bitstream_read_xbits(>bc, code);
>
>  if (i >= se) {
>  if (i == se) {
> @@ -584,17 +563,13 @@ static int decode_block_progressive(MJpegDecodeContext 
> *s, int16_t *block,
>  } else {
>  val = (1 << run);
>  if (run) {
> -UPDATE_CACHE(re, >gb);
> -val += NEG_USR32(GET_CACHE(re, >gb), run);
> -LAST_SKIP_BITS(re, >gb, run);
> +val += NEG_USR32(bitstream_read(>bc, 32), run);
>  }
>  *EOBRUN = val - 1;
>  break;
>  }
>  }
>  }
> -CLOSE_READER(re, >gb);
> -}
>
>  if (i > *last_nnz)
>  *last_nnz = i;

This chunk will be oddly indented after the patch, I would leave the
{} around it (and then realign optionally, or not since there are a
lot of places like that)

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

Re: [libav-devel] [PATCH 08/14] shorten: Convert to the new bitstream reader

2017-01-26 Thread Vittorio Giovara
On Thu, Jan 26, 2017 at 11:10 AM, Diego Biurrun  wrote:
> From: Alexandra Hájková 
>
> ---
>  libavcodec/shorten.c | 49 +
>  1 file changed, 25 insertions(+), 24 deletions(-)

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

Re: [libav-devel] [PATCH 03/14] cavs: Convert to the new bitstream reader

2017-01-26 Thread Vittorio Giovara
On Thu, Jan 26, 2017 at 11:10 AM, Diego Biurrun  wrote:
> From: Alexandra Hájková 
>
> ---
>  libavcodec/cavs.c|   8 +--
>  libavcodec/cavs.h|   4 +-
>  libavcodec/cavsdec.c | 178 
> +--
>  3 files changed, 95 insertions(+), 95 deletions(-)

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

Re: [libav-devel] [PATCH 10/14] ffv1: Convert to the new bitstream reader

2017-01-26 Thread Vittorio Giovara
On Thu, Jan 26, 2017 at 11:10 AM, Diego Biurrun  wrote:
> From: Alexandra Hájková 
>
> ---
>  libavcodec/ffv1.h|  4 ++--
>  libavcodec/ffv1dec.c | 24 
>  2 files changed, 14 insertions(+), 14 deletions(-)

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

Re: [libav-devel] [PATCH 06/14] loco: Convert to the new bitstream reader

2017-01-26 Thread Vittorio Giovara
On Thu, Jan 26, 2017 at 11:10 AM, Diego Biurrun  wrote:
> From: Alexandra Hájková 
>
> ---
>  libavcodec/loco.c | 14 +++---
>  1 file changed, 7 insertions(+), 7 deletions(-)

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

Re: [libav-devel] [PATCH 07/14] ralf: Convert to the new bitstream reader

2017-01-26 Thread Vittorio Giovara
On Thu, Jan 26, 2017 at 11:10 AM, Diego Biurrun  wrote:
> From: Alexandra Hájková 
>
> ---
>  libavcodec/ralf.c | 68 
> ---
>  1 file changed, 35 insertions(+), 33 deletions(-)

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

Re: [libav-devel] [PATCH 02/14] aic: Convert to the new bitstream reader

2017-01-26 Thread Vittorio Giovara
On Thu, Jan 26, 2017 at 11:10 AM, Diego Biurrun  wrote:
> From: Alexandra Hájková 
>
> ---
>  libavcodec/aic.c | 30 +++---
>  1 file changed, 15 insertions(+), 15 deletions(-)

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

Re: [libav-devel] [PATCH 05/14] fic: Convert to the new bitstream reader

2017-01-26 Thread Vittorio Giovara
On Thu, Jan 26, 2017 at 11:10 AM, Diego Biurrun  wrote:
> From: Alexandra Hájková 
>
> ---
>  libavcodec/fic.c | 18 +-
>  1 file changed, 9 insertions(+), 9 deletions(-)

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

Re: [libav-devel] [PATCH 11/14] h261dec: Convert to the new bitstream reader

2017-01-26 Thread Vittorio Giovara
On Thu, Jan 26, 2017 at 11:10 AM, Diego Biurrun  wrote:
> From: Alexandra Hájková 
>
> ---
>  libavcodec/h261dec.c   | 92 
> ++
>  libavcodec/mpegvideo.h |  3 ++
>  libavformat/h261dec.c  | 11 +++---
>  3 files changed, 56 insertions(+), 50 deletions(-)

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

<    1   2   3   4   5   6   7   8   9   10   >