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 ESMTPS id 4F4D34BA8F for ; Fri, 31 Jan 2025 14:00:55 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0C96868C0C0; Fri, 31 Jan 2025 16:00:51 +0200 (EET) Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B137968BF5B for ; Fri, 31 Jan 2025 16:00:44 +0200 (EET) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-216281bc30fso46082925ad.0 for ; Fri, 31 Jan 2025 06:00:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738332042; x=1738936842; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=lh19jC6AXgjXCRi2hJq+kOtn3Dz/GVBhBwxtz5lXkb4=; b=FFAOHCNn5dl7kZvW2mgCAzS0r+sDndrrNsY5HzIoD49hHjWAPLMWjO/OyTIZdO0y3G 0BL2PeD49FFkcVQNuCBN2RZ2jUoaqXsW8qflKRwueUHLss1QUGfjFc66D6+dj1I6Y1Cd K3FKOur18K6TQ8NTjEMv3BXfDhK7qnvDAWPimuXYggGBI9BUcMwlQB8K80cXHsyyAjx5 HzI3jkdbBmvSpi/rtyqU+5TJT0P/xwEutkliQv8x+aEiBAk7tQ526555p5cgUV/hc+Bp WsK2ngAAc4sUUxQ/XxLaUqOkuTJla4fH6LiHuZmtBlHNIpdSCX7efFeZ1lZsItJctVb9 wTCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738332042; x=1738936842; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lh19jC6AXgjXCRi2hJq+kOtn3Dz/GVBhBwxtz5lXkb4=; b=KN90ZV1PqcAc5geZQuaW43+ZIg/aj5VwBiwiwbTpZgwVifnXZn76+MTXa4wNorNNXx lTB0FNmAI4YJEmrscx8Fx7rf6ylpVOZQMcNSV8W7S2wzqrz4K9RFdW+hLt03WiLZ7Eir zD6dNffZN6yhIzH5x1TI9Le+8wznLuIuW2zXoQEogJavU0TXBqtem16EBwRMsTBGA8It dI7AMgoy5Z+exmFAIIvgpH+Xj7YSqYCJ5cb8Z0NePXR+prrAR3WeOM6847f9mPpsgLn5 NOpmGmSpISbVUSuNAxgPzaRl7UlawUWrYqYDseXgTUN+nLh7N+zaRX0dIYF4EgLKzMgH SaQw== X-Gm-Message-State: AOJu0YxjBUkF5JMpe5czhUCBuwEPw9u7kSZo8uxpimrLvpVTULILqkHA n4+6T+jR4BCi/nfNdaILxJ3fTrZQjBlilpoNvIxAwjyu5Y7iZNIWBxrS1m43 X-Gm-Gg: ASbGncsTjouFGClEBTad7qBUBPiew1XgBi2ywVC2P+6jUG8p89UeGUNIQN83ovPftIZ ai7WyaRzNyKo/CSa4fhfuTk4yaF79pGE+g1FElM1asZT6Y4pxxRctzftlfHMVjLxDxXk+ASy87g 8kJISvT9fy0ZxJOckngFoZdmMyjSbl9rcj4f/0SZdPYMS+w+pr1bujddmF/A59Ss+0QaeeDoont gXb6BFcOaWZe83zvUTfuhMdB4XFFTsYHGjVgt0s/h1Yr21plRZDtPcyDMFrSNYn6Tplj8LDUpYu mFZyPycoAxkuASRaWd/F6KbfnVEAjnxr X-Google-Smtp-Source: AGHT+IEQk/v4okBAls8itLGiWwmMglzO1ZYFq8AqyXar4cQ6XDqt+L0MNv+LV+6nSO66/hyeuvVZmQ== X-Received: by 2002:a05:6a20:1582:b0:1e1:384e:20f1 with SMTP id adf61e73a8af0-1ed7a5361d5mr18263244637.25.1738332041820; Fri, 31 Jan 2025 06:00:41 -0800 (PST) Received: from localhost.localdomain ([2800:2121:b040:c:aca0:6b6b:5a40:f8fa]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-acec0971315sm2616304a12.65.2025.01.31.06.00.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jan 2025 06:00:41 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Fri, 31 Jan 2025 11:00:15 -0300 Message-ID: <20250131140020.10887-1-jamrial@gmail.com> X-Mailer: git-send-email 2.48.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/6] avutil: add an API to handle 3D Reference Displays Information 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: As defined in section G.14.3.2.3 of ITU-T H.265, it's required for proper signaling of MV-HEVC. Signed-off-by: James Almer --- libavutil/Makefile | 2 + libavutil/tdrdi.c | 35 ++++++++++++ libavutil/tdrdi.h | 129 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 166 insertions(+) create mode 100644 libavutil/tdrdi.c create mode 100644 libavutil/tdrdi.h diff --git a/libavutil/Makefile b/libavutil/Makefile index f8031815bd..a9a98d18a5 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -84,6 +84,7 @@ HEADERS = adler32.h \ sha512.h \ spherical.h \ stereo3d.h \ + tdrdi.h \ threadmessage.h \ time.h \ timecode.h \ @@ -176,6 +177,7 @@ OBJS = adler32.o \ slicethread.o \ spherical.o \ stereo3d.o \ + tdrdi.o \ threadmessage.o \ time.o \ timecode.o \ diff --git a/libavutil/tdrdi.c b/libavutil/tdrdi.c new file mode 100644 index 0000000000..144f31db05 --- /dev/null +++ b/libavutil/tdrdi.c @@ -0,0 +1,35 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg 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. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include + +#include "mem.h" +#include "tdrdi.h" + +AV3DReferenceDisplaysInfo *av_tdrdi_alloc(size_t *size) +{ + AV3DReferenceDisplaysInfo *tdrdi = av_mallocz(sizeof(AV3DReferenceDisplaysInfo)); + if (!tdrdi) + return NULL; + + if (size) + *size = sizeof(*tdrdi); + + return tdrdi; +} diff --git a/libavutil/tdrdi.h b/libavutil/tdrdi.h new file mode 100644 index 0000000000..896873374c --- /dev/null +++ b/libavutil/tdrdi.h @@ -0,0 +1,129 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg 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. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu_video_spherical + * Spherical video + */ + +#ifndef AVUTIL_TDRDI_H +#define AVUTIL_TDRDI_H + +#include +#include + +/** + * @defgroup lavu_video_reference_displays_info 3D Reference Displays Information + * @ingroup lavu_video + * + * @{ + */ + +#define AV_TDRDI_MAX_NUM_REF_DISPLAY 32 +/** + * This structure describes information about the reference display width(s) and reference + * viewing distance(s) as well as information about the corresponding reference stereo pair(s) + * See section G.14.3.2.3 of ITU-T H.265 for more information. + * + * @note The struct must be allocated with av_tdrdi_alloc() and + * its size is not a part of the public ABI. + */ +typedef struct AV3DReferenceDisplaysInfo { + /** + * The exponent of the maximum allowable truncation error for + * {exponent,mantissa}_ref_display_width as given by 2 ^ (-prec_ref_display_width). + */ + uint8_t prec_ref_display_width; + + /** + * A flag to indicate the presence of reference viewing distance. + * If false, the values of prec_ref_viewing_dist, exponent_ref_viewing_distance, + * and mantissa_ref_viewing_distance are undefined. + */ + uint8_t ref_viewing_distance_flag; + + /** + * The exponent of the maximum allowable truncation error for + * {exponent,mantissa}_ref_viewing_distance as given by 2 ^ (-prec_ref_viewing_dist). + * The value of prec_ref_viewing_dist shall be in the range of 0 to 31, inclusive. + */ + uint8_t prec_ref_viewing_dist; + + /** + * The number of reference displays that are signalled in this struct. + * Allowed range is 1 to 32, inclusive. + */ + uint8_t num_ref_displays; + + /** + * The ViewId of the left view of a stereo pair corresponding to the n-th reference display. + */ + uint16_t left_view_id[AV_TDRDI_MAX_NUM_REF_DISPLAY]; + + /** + * The ViewId of the left view of a stereo pair corresponding to the n-th reference display. + */ + uint16_t right_view_id[AV_TDRDI_MAX_NUM_REF_DISPLAY]; + + /** + * The exponent part of the reference display width of the n-th reference display. + */ + uint8_t exponent_ref_display_width[AV_TDRDI_MAX_NUM_REF_DISPLAY]; + + /** + * The mantissa part of the reference display width of the n-th reference display. + */ + uint8_t mantissa_ref_display_width[AV_TDRDI_MAX_NUM_REF_DISPLAY]; + + /** + * Tthe exponent part of the reference viewing distance of the n-th reference display. + */ + uint8_t exponent_ref_viewing_distance[AV_TDRDI_MAX_NUM_REF_DISPLAY]; + + /** + * The mantissa part of the reference viewing distance of the n-th reference display. + */ + uint8_t mantissa_ref_viewing_distance[AV_TDRDI_MAX_NUM_REF_DISPLAY]; + + /** + * An array of flags to indicates that the information about additional horizontal shift of + * the left and right views for the n-th reference display is present. + */ + uint8_t additional_shift_present_flag[AV_TDRDI_MAX_NUM_REF_DISPLAY]; + + /** + * The recommended additional horizontal shift for a stereo pair corresponding to the n-th + * reference baseline and the n-th reference display. + */ + int16_t num_sample_shift[AV_TDRDI_MAX_NUM_REF_DISPLAY]; +} AV3DReferenceDisplaysInfo; + +/** + * Allocate a AV3DReferenceDisplaysInfo structure and initialize its fields to default + * values. + * + * @return the newly allocated struct or NULL on failure + */ +AV3DReferenceDisplaysInfo *av_tdrdi_alloc(size_t *size); + +/** + * @} + */ + +#endif /* AVUTIL_TDRDI_H */ -- 2.48.1 _______________________________________________ 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".