From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id BCC9844803 for ; Sun, 25 Sep 2022 16:15:25 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BA90768BA89; Sun, 25 Sep 2022 19:15:15 +0300 (EEST) Received: from shout01.mail.de (shout01.mail.de [62.201.172.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BDF6F68B635 for ; Sun, 25 Sep 2022 19:15:08 +0300 (EEST) Received: from postfix01.mail.de (postfix01.bt.mail.de [10.0.121.125]) by shout01.mail.de (Postfix) with ESMTP id 6765AA052F for ; Sun, 25 Sep 2022 18:15:08 +0200 (CEST) Received: from smtp01.mail.de (smtp01.bt.mail.de [10.0.121.211]) by postfix01.mail.de (Postfix) with ESMTP id 4F6D280151 for ; Sun, 25 Sep 2022 18:15:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mailde202009; t=1664122508; bh=MU8DxTFgNFbFRSwc2XJJheJGKSVtZ2mW3m4ek045fCA=; h=From:To:Subject:Date:Message-Id:From:To:CC:Subject:Reply-To; b=PSj8s48Pj/JA/NCauxbbgZIGMvfv5rsjUYuSVKq1aMxhvr7m3cwVBvfK5sWHBqDTs RkOsijNTiQLbC4kJ7ndct6WThClVv/sqPUCb7WQWqBm0PArriI7bwkZT0ZZqyp2QW3 O+FESjWTfFa7DhTpJW54/9oYJ9mioTZQj9vfJCtnUi675s1NOxOAwCEdFPKfyxpvC/ K6T/nHI3gtdo9yOJA5WaKyHtnEdI2iQV8DwbDZVRx/TDuBExGAOT9jbg56NWMxp4dj xisWJltl0GSzp94JMB5ApV8OmeG2tayAUc3n/mXQkqGA51DmfnGwBCDW3xA9kMbege 89q59+aoYh4RA== Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp01.mail.de (Postfix) with ESMTPSA id 150C1100118 for ; Sun, 25 Sep 2022 18:15:08 +0200 (CEST) From: Thilo Borgmann To: ffmpeg-devel@ffmpeg.org Date: Sun, 25 Sep 2022 18:15:04 +0200 Message-Id: <20220925161506.80724-2-thilo.borgmann@mail.de> In-Reply-To: <20220925161506.80724-1-thilo.borgmann@mail.de> References: <20220925161506.80724-1-thilo.borgmann@mail.de> MIME-Version: 1.0 X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 3417 X-purgate-ID: 154282::1664122508-DDDB75FC-37F9C67D/0/0 Subject: [FFmpeg-devel] [PATCH v5 1/3] lavu/display: Add scaling functions to the display matrix X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --- doc/APIchanges | 3 +++ libavutil/display.c | 21 +++++++++++++++++++++ libavutil/display.h | 15 +++++++++++++++ libavutil/version.h | 4 ++-- 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 729f56be7b..42e3391b72 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2022-09-25 - xxxxxxxxxx - lavu 57.37.100 - display.h + Add av_display_matrix_scale(), av_display_scale_get() + 2022-09-03 - xxxxxxxxxx - lavu 57.36.100 - pixfmt.h Add AV_PIX_FMT_P012, AV_PIX_FMT_Y212, AV_PIX_FMT_XV30, AV_PIX_FMT_XV36 diff --git a/libavutil/display.c b/libavutil/display.c index d31061283c..90758656e3 100644 --- a/libavutil/display.c +++ b/libavutil/display.c @@ -48,6 +48,19 @@ double av_display_rotation_get(const int32_t matrix[9]) return -rotation; } +double av_display_scale_get(const int32_t matrix[9]) +{ + double scale[2]; + + scale[0] = hypot(CONV_FP(matrix[0]), CONV_FP(matrix[3])); + scale[1] = hypot(CONV_FP(matrix[1]), CONV_FP(matrix[4])); + + if (scale[0] == 0.0 || scale[1] == 0.0) + return NAN; + + return scale[0]; +} + void av_display_rotation_set(int32_t matrix[9], double angle) { double radians = -angle * M_PI / 180.0f; @@ -72,3 +85,11 @@ void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip) for (i = 0; i < 9; i++) matrix[i] *= flip[i % 3]; } + +void av_display_matrix_scale(int32_t matrix[9], double scale) +{ + matrix[0] = CONV_DB(CONV_FP(matrix[0]) * scale); + matrix[1] = CONV_DB(CONV_FP(matrix[1]) * scale); + matrix[3] = CONV_DB(CONV_FP(matrix[3]) * scale); + matrix[4] = CONV_DB(CONV_FP(matrix[4]) * scale); +} diff --git a/libavutil/display.h b/libavutil/display.h index 31d8bef361..73767b3a71 100644 --- a/libavutil/display.h +++ b/libavutil/display.h @@ -86,6 +86,14 @@ */ double av_display_rotation_get(const int32_t matrix[9]); +/** + * Extract the scaling component of the transformation matrix. + * + * @param matrix the transformation matrix + * @return the scaling by which the transformation matrix scales the frame + */ +double av_display_scale_get(const int32_t matrix[9]); + /** * Initialize a transformation matrix describing a pure clockwise * rotation by the specified angle (in degrees). @@ -105,6 +113,13 @@ void av_display_rotation_set(int32_t matrix[9], double angle); */ void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip); +/** + * Scale the input matrix. + * + * @param matrix an allocated transformation matrix + * @param scale scale factor by which the matrix should be scaled + */ +void av_display_matrix_scale(int32_t matrix[9], double scale); /** * @} * @} diff --git a/libavutil/version.h b/libavutil/version.h index 0585fa7b80..9c44cef6aa 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,8 +79,8 @@ */ #define LIBAVUTIL_VERSION_MAJOR 57 -#define LIBAVUTIL_VERSION_MINOR 36 -#define LIBAVUTIL_VERSION_MICRO 102 +#define LIBAVUTIL_VERSION_MINOR 37 +#define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ -- 2.20.1 (Apple Git-117) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".