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

2017-02-28 Thread Luca Barbato
On 21/02/2017 23:36, Vittorio Giovara wrote:
> Signed-off-by: Vittorio Giovara 
> ---
> 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
> 

I'm not against it.

___
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 
---
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, st->codecpar, );
 break;
 default:
 av_log(ctx, AV_LOG_WARNING,
diff --git a/libavutil/spherical.c b/libavutil/spherical.c
index f6e53d1..5877292 100644
--- a/libavutil/spherical.c
+++ b/libavutil/spherical.c
@@ -32,3 +32,21 @@ AVSphericalMapping *av_spherical_alloc(size_t *size)
 
 return