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 7B8834B642 for ; Mon, 10 Jun 2024 18:44:49 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 08CED68D7AD; Mon, 10 Jun 2024 21:44:31 +0300 (EEST) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D56FD68D6EC for ; Mon, 10 Jun 2024 21:44:22 +0300 (EEST) Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-421d32fda86so12527985e9.0 for ; Mon, 10 Jun 2024 11:44:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718045062; x=1718649862; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=dQGf/6/jFlhhew6Rka6Rg8tBjey/2nDYwUZr6c9waLg=; b=jNcZ5vtE7jwHOrsCz/6I0gxJL6tWEmYNELk4F8oIDb0Afc0ZC9QSywbNvPt+Ca1TnH XtYuUXOjviCm8wyvrJjWaD896K3sg4C38CzE5ew5y5T1QHmmsrDS7z5S+pU+2dYhnXPg 3Fd7YZP/3QE/Ah22bTj0OKwL1Dm7tz7gsOqYeSmk1a5z1BBfY9qd7v3dPE+OSwQ8weMB tw/Bj79xZ28GEce1l/p6meeKzoLR/U7hpQYW9JDn+4Km/8MHJr9bkKBh/bRsZS8Rrflo OdUvIPbC3v5rBg6dwVZyYMnIFHD0jCgrcb1ksABeyay1eb+O0a/XDry9y0f39LbGMvnw DTEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718045062; x=1718649862; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dQGf/6/jFlhhew6Rka6Rg8tBjey/2nDYwUZr6c9waLg=; b=cvWRnCHKz3CWl89BKs2y1R2mdrnN6f1Qf8rlS/unOhB15y7wvj32BwNl2YT82wDHan rMAoEIPzO4W5ZtQ375zRL5CaH2Za//84cSUzo8AmQL5lcCKTJgFdyE+Y9ldo3XHSDRUs zD1712U6u10Y0dvD/jqRLwyRXI6MlOSJbHa0rbtmju/lwX/ZgsmrkNlcrTHTKRU+Yj3N vUKnP1ExUwjI2jBD5T+HWpZ911wbmysP71hke3fMz9TOjp0rBLUHvesOSSaBx8dm09A0 lLK/7tNj6VZ6+K31A18Hqiwp/+37wx6M0Tk3cJ1M3NUGih8vGbSrtT989qF1YnLfcKF2 17jg== X-Gm-Message-State: AOJu0YzdZm9SRCdfBvhzObgoNaAOsaHwAs4sWOQzPvqUUPaRuQkpdSPw +KDhXjayDoq1PFj+/wQiRKbUsU9H6gZqmq+iv0R79TXSrdefHCmLlEMANg== X-Google-Smtp-Source: AGHT+IGaSu9YuJvFRTggjnhP0fCPOTU4RrTPfR8AFHo0ZLh6g7ZfzFPjCpbOtmAGKiSBYLWSCinvRw== X-Received: by 2002:a05:600c:1913:b0:421:756f:b2e8 with SMTP id 5b1f17b1804b1-421756fb522mr73470975e9.11.1718045061723; Mon, 10 Jun 2024 11:44:21 -0700 (PDT) Received: from localhost.localdomain ([51.191.0.41]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4218193b0c0sm64659165e9.31.2024.06.10.11.44.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 11:44:21 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Mon, 10 Jun 2024 19:44:04 +0100 Message-ID: <20240610184408.68171-3-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240610184408.68171-1-derek.buitenhuis@gmail.com> References: <20240610184408.68171-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/5] avutil/stereo3d: Fill out stereo info provided by Vision Pro files 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: Based on what is in the files themselves, and what the API provides to users. URLs: * https://developer.apple.com/documentation/videotoolbox/kvtcompressionpropertykey_heroeye * https://developer.apple.com/documentation/videotoolbox/kvtcompressionpropertykey_stereocamerabaseline * https://developer.apple.com/documentation/videotoolbox/kvtcompressionpropertykey_horizontaldisparityadjustment * https://developer.apple.com/documentation/coremedia/kcmformatdescriptionextension_horizontalfieldofview Signed-off-by: Derek Buitenhuis --- libavutil/stereo3d.c | 52 ++++++++++++++++++++++++++++ libavutil/stereo3d.h | 80 ++++++++++++++++++++++++++++++++++++++++++++ libavutil/version.h | 2 +- 3 files changed, 133 insertions(+), 1 deletion(-) diff --git a/libavutil/stereo3d.c b/libavutil/stereo3d.c index 9c29ab01b5..a40a9439bb 100644 --- a/libavutil/stereo3d.c +++ b/libavutil/stereo3d.c @@ -55,6 +55,18 @@ static const char * const stereo3d_type_names[] = { [AV_STEREO3D_COLUMNS] = "interleaved columns", }; +static const char * const stereo3d_view_names[] = { + [AV_STEREO3D_VIEW_PACKED] = "packed", + [AV_STEREO3D_VIEW_LEFT] = "left", + [AV_STEREO3D_VIEW_RIGHT] = "right", +}; + +static const char * const stereo3d_primary_eye_names[] = { + [AV_PRIMARY_EYE_NONE] = "none", + [AV_PRIMARY_EYE_LEFT] = "left", + [AV_PRIMARY_EYE_RIGHT] = "right", +}; + const char *av_stereo3d_type_name(unsigned int type) { if (type >= FF_ARRAY_ELEMS(stereo3d_type_names)) @@ -74,3 +86,43 @@ int av_stereo3d_from_name(const char *name) return -1; } + +const char *av_stereo3d_view_name(unsigned int view) +{ + if (view >= FF_ARRAY_ELEMS(stereo3d_view_names)) + return "unknown"; + + return stereo3d_view_names[view]; +} + +int av_stereo3d_view_from_name(const char *name) +{ + int i; + + for (i = 0; i < FF_ARRAY_ELEMS(stereo3d_view_names); i++) { + if (av_strstart(name, stereo3d_view_names[i], NULL)) + return i; + } + + return -1; +} + +const char *av_stereo3d_primary_eye_name(unsigned int eye) +{ + if (eye >= FF_ARRAY_ELEMS(stereo3d_primary_eye_names)) + return "unknown"; + + return stereo3d_primary_eye_names[eye]; +} + +int av_stereo3d_primary_eye_from_name(const char *name) +{ + int i; + + for (i = 0; i < FF_ARRAY_ELEMS(stereo3d_primary_eye_names); i++) { + if (av_strstart(name, stereo3d_primary_eye_names[i], NULL)) + return i; + } + + return -1; +} diff --git a/libavutil/stereo3d.h b/libavutil/stereo3d.h index 3aab959b79..6efbb09b32 100644 --- a/libavutil/stereo3d.h +++ b/libavutil/stereo3d.h @@ -158,6 +158,26 @@ enum AVStereo3DView { AV_STEREO3D_VIEW_RIGHT, }; +/** + * List of possible primary eyes. + */ +enum AVStereo3DPrimaryEye { + /** + * Neither eye. + */ + AV_PRIMARY_EYE_NONE, + + /** + * Left eye. + */ + AV_PRIMARY_EYE_LEFT, + + /** + * Right eye + */ + AV_PRIMARY_EYE_RIGHT, +}; + /** * Inverted views, Right/Bottom represents the left view. */ @@ -185,6 +205,28 @@ typedef struct AVStereo3D { * Determines which views are packed. */ enum AVStereo3DView view; + + /** + * Which eye is the primary eye when rendering in 2D. + */ + enum AVStereo3DPrimaryEye primary_eye; + + /** + * The distance between the centres of the lenses of the camera system, + * in micrometers. Zero if unset. + */ + uint32_t baseline; + + /** + * Relative shift of the left and right images, which changes the zero parallax plane. + * Range -10000 to 10000, mapped to -1.0 to 1.0. Zero if unset. + */ + int32_t horizontal_disparity_adjustment; + + /** + * Horizontal field of view in thousanths of a degree. Zero if unset. + */ + uint32_t horizontal_field_of_view; } AVStereo3D; /** @@ -222,6 +264,44 @@ const char *av_stereo3d_type_name(unsigned int type); */ int av_stereo3d_from_name(const char *name); +/** + * Provide a human-readable name of a given stereo3d view. + * + * @param type The input stereo3d view value. + * + * @return The name of the stereo3d view value, or "unknown". + */ +const char *av_stereo3d_view_name(unsigned int view); + +/** + * Get the AVStereo3DView form a human-readable name. + * + * @param name The input string. + * + * @return The AVStereo3DView value, or -1 if not found. + */ +int av_stereo3d_view_from_name(const char *name); + +/** + * Provide a human-readable name of a given stereo3d primary eye. + * + * @param type The input stereo3d primary eye value. + * + * @return The name of the stereo3d primary eye value, or "unknown". + */ +const char *av_stereo3d_primary_eye_name(unsigned int eye); + +/** + * Get the AVStereo3DPrimaryEye form a human-readable name. + * + * @param name The input string. + * + * @return The AVStereo3DPrimaryEye value, or -1 if not found. + */ +int av_stereo3d_primary_eye_from_name(const char *name); + + + /** * @} */ diff --git a/libavutil/version.h b/libavutil/version.h index 9d08d56884..bd4c5a2ab3 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 59 -#define LIBAVUTIL_VERSION_MINOR 21 +#define LIBAVUTIL_VERSION_MINOR 22 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ -- 2.43.0 _______________________________________________ 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".