From patchwork Sun Mar 12 21:16:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 2906 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.50.79 with SMTP id y76csp924119vsy; Sun, 12 Mar 2017 14:17:04 -0700 (PDT) X-Received: by 10.28.103.3 with SMTP id b3mr7177551wmc.99.1489353424481; Sun, 12 Mar 2017 14:17:04 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n133si8241193wmf.140.2017.03.12.14.17.04; Sun, 12 Mar 2017 14:17:04 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9EBD2689CE0; Sun, 12 Mar 2017 23:16:46 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe04-2.mx.upcmail.net (vie01a-dmta-pe04-2.mx.upcmail.net [62.179.121.164]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 603D2689C73 for ; Sun, 12 Mar 2017 23:16:40 +0200 (EET) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe04.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1cnArH-0004KQ-1u for ffmpeg-devel@ffmpeg.org; Sun, 12 Mar 2017 22:16:55 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id v9Gm1u01a0S5wYM019Gnup; Sun, 12 Mar 2017 22:16:48 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 12 Mar 2017 22:16:46 +0100 Message-Id: <20170312211646.27123-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.11.0 Subject: [FFmpeg-devel] [PATCH] Change type of spherical stuff to uint32_t X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Using the same type across platforms is more robust and avoids platform specific issues from differences in range. Also fixed point integers are on a semantical level not size_t Previous version reviewed-by: James Almer Signed-off-by: Michael Niedermayer --- ffprobe.c | 2 +- libavformat/dump.c | 6 +++--- libavutil/spherical.c | 6 +++--- libavutil/spherical.h | 16 ++++++++-------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ffprobe.c b/ffprobe.c index b104390990..b3466b1708 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -1793,7 +1793,7 @@ static void print_pkt_side_data(WriterContext *w, print_str("projection", "cubemap"); print_int("padding", spherical->padding); } else if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) { - size_t l, t, r, b; + uint32_t l, t, r, b; av_spherical_tile_bounds(spherical, par->width, par->height, &l, &t, &r, &b); print_str("projection", "tiled equirectangular"); diff --git a/libavformat/dump.c b/libavformat/dump.c index 505d572301..a6309cbf71 100644 --- a/libavformat/dump.c +++ b/libavformat/dump.c @@ -370,12 +370,12 @@ static void dump_spherical(void *ctx, AVCodecParameters *par, AVPacketSideData * 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; + uint32_t l, t, r, b; av_spherical_tile_bounds(spherical, par->width, par->height, &l, &t, &r, &b); - av_log(ctx, AV_LOG_INFO, "[%zu, %zu, %zu, %zu] ", l, t, r, b); + av_log(ctx, AV_LOG_INFO, "[%"PRIu32", %"PRIu32", %"PRIu32", %"PRIu32"] ", 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.c b/libavutil/spherical.c index 0ca2dd367a..66056961a0 100644 --- a/libavutil/spherical.c +++ b/libavutil/spherical.c @@ -34,9 +34,9 @@ AVSphericalMapping *av_spherical_alloc(size_t *size) } void av_spherical_tile_bounds(AVSphericalMapping *map, - size_t width, size_t height, - size_t *left, size_t *top, - size_t *right, size_t *bottom) + uint32_t width, uint32_t height, + uint32_t *left, uint32_t*top, + uint32_t *right, uint32_t *bottom) { /* conversion from 0.32 coordinates to pixels */ uint64_t orig_width = (uint64_t) width * UINT32_MAX / diff --git a/libavutil/spherical.h b/libavutil/spherical.h index db9bdc0be5..ff25c139ee 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; /** @@ -203,9 +203,9 @@ AVSphericalMapping *av_spherical_alloc(size_t *size); * @param bottom Pixels from the bottom edge. */ void av_spherical_tile_bounds(AVSphericalMapping *map, - size_t width, size_t height, - size_t *left, size_t *top, - size_t *right, size_t *bottom); + uint32_t width, uint32_t height, + uint32_t *left, uint32_t *top, + uint32_t *right, uint32_t *bottom); /** * @} * @}