From patchwork Sat Sep 14 10:45:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51588 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:9fc3:0:b0:48e:c0f8:d0de with SMTP id k3csp303520vqy; Sat, 14 Sep 2024 04:19:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWDi8msJWBDUEDjmnBP6yLSpo9vTzKgqbIirrINlqx/70xZ8z9C6d6uPYTdcY7cHk8OLC3MStEQeFSb9meyo9RE@gmail.com X-Google-Smtp-Source: AGHT+IHjfuBmwzdGH/i6RD27zvWPphUu/kLDBLfydMvmya8HPHZFIxsvu+WPPCD56imy/EnoXUL4 X-Received: by 2002:a17:907:6d1f:b0:a86:4649:28e6 with SMTP id a640c23a62f3a-a9029690562mr964620166b.57.1726312765634; Sat, 14 Sep 2024 04:19:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726312765; cv=none; d=google.com; s=arc-20240605; b=ZtvMmCCrGkD1o1yntIsSFOLK5plCwybzY1UkfaHpJyefaXBLRiYCEp5hJi/q5URXxS ApoqnH9/VfGkwlgXtn2aO6fkOHtcNFKB0g9nK+pvv97kYeFKuKecXrbjmfthsjly7qoa 2vC31gwqXrixClmjggeCZ9PFpKxoCuq7DQ0YFTxQEMGHuqIVsOmJcLbPQSiZhKEikOP/ 2vS471HsxdQCRyn5K2e+efjX/VTB4IM4VpKgW64ROuWkd9ZBBMj2iHT1+lcBSjHEALi1 niGjtcLEd7s9LMn3f+WhIefB2FtYGY6x829GVbUbp1dbTcv7/+7hJ/jE4BwMqh17imml w4tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=I7NyOv8cByvFqxd7Edjr8FxcXnimFI7q+H+EW32C/RQ=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=VJ6vdr852JNpSNYSkrT0mPHWo1EmDIxyuNXVo6++QazKNo/DfXvtRst/zXTxPu6weI MWA4I+3KqOZjs+LHlVsIY5L0p2vVxTfpOGG5NNCLeL4DUeZZKhng4jfYIKV7Act1JeZm a2S9YMdy/JYxgVktfb9MgOzpiQuhr0mRWFXtk9qQD4Z7Uy+tHYrbnblab/hSum+9ITj8 mzs1CyFLOi2rIuLFnLu+X5y0dh+uuXwqWNyvkgkowgyEL4xmnAqPiZphCleQPIItKaXM kBOklmyXAUabODhawnUxNDgn8bY1fwkxb4GYoHx5YGOH9Pxgxnl0N8X1X9KdwbfD6cCO 5rEQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b="KE/PoK5t"; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a906109a602si91714366b.61.2024.09.14.04.19.25; Sat, 14 Sep 2024 04:19:25 -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; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b="KE/PoK5t"; 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 6799768DDC8; Sat, 14 Sep 2024 14:11:02 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D7A3A68DA8C for ; Sat, 14 Sep 2024 14:10:53 +0300 (EEST) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=KE/PoK5t; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id AF62F4E12 for ; Sat, 14 Sep 2024 13:10:50 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id lgSxn1UG3oYf for ; Sat, 14 Sep 2024 13:10:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1726312246; bh=TDn//xYq4XiqHFsOxCRCMF4vqrr23J9oCwgdus3PAbQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KE/PoK5tMYFG1mIMwV8sEDrwlC7eAjmMMOeDtRkXx240dfwX3TOVtWaN/k74rXMgW xNPAvBMncH8KKiP3DXCA+K8bgh2lBfbqcnVk6+KWF9Z45XgiRzF30x4fyn2qdap84a G6XuA2XSDyEB1Jd0rCUI2W2/VOaVS/qMtBqIXOXBFEc14DBYWgllfq9Vx4CG2kbuhD rbnx+6vFV/etTCxqDO7sQ5VJgbNB0CEvijNTofPmoQ/ZVppMjF/iA5QwJj8yP9v7yA 8FgqzSmBYfEebnGSuIZc2HJ9hJ1U4akAmjDBEltuDk3H0W2+iKAFEAHwhBSexZqtPB 6lpP2p1PVA+mg== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id 8B3774E1A for ; Sat, 14 Sep 2024 13:10:46 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 94C553A1E95 for ; Sat, 14 Sep 2024 13:10:41 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 14 Sep 2024 12:45:41 +0200 Message-ID: <20240914111036.17164-17-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240914111036.17164-1-anton@khirnov.net> References: <20240914111036.17164-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 16/23] avcodec/hevc/refs: export Stereo 3D side data 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: /ELTeXwUnI5a From: James Almer Use the 3D Reference Displays Info SEI message to link a view_id with an eye. Signed-off-by: James Almer --- libavcodec/hevc/hevcdec.c | 1 + libavcodec/hevc/refs.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index 692f19e97e..b784b10bcf 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -3968,6 +3968,7 @@ static int hevc_update_thread_context(AVCodecContext *dst, s->sei.common.mastering_display = s0->sei.common.mastering_display; s->sei.common.content_light = s0->sei.common.content_light; s->sei.common.aom_film_grain = s0->sei.common.aom_film_grain; + s->sei.tdrdi = s0->sei.tdrdi; return 0; } diff --git a/libavcodec/hevc/refs.c b/libavcodec/hevc/refs.c index b9b08ca416..ac1b07a308 100644 --- a/libavcodec/hevc/refs.c +++ b/libavcodec/hevc/refs.c @@ -22,6 +22,7 @@ */ #include "libavutil/mem.h" +#include "libavutil/stereo3d.h" #include "container_fifo.h" #include "decode.h" @@ -94,6 +95,7 @@ static HEVCFrame *alloc_frame(HEVCContext *s, HEVCLayerContext *l) // add view ID side data if it's nontrivial if (vps->nb_layers > 1 || view_id) { + HEVCSEITDRDI *tdrdi = &s->sei.tdrdi; AVFrameSideData *sd = av_frame_side_data_new(&frame->f->side_data, &frame->f->nb_side_data, AV_FRAME_DATA_VIEW_ID, @@ -101,6 +103,23 @@ static HEVCFrame *alloc_frame(HEVCContext *s, HEVCLayerContext *l) if (!sd) goto fail; *(int*)sd->data = view_id; + + if (tdrdi->num_ref_displays) { + AVStereo3D *stereo_3d; + + av_frame_remove_side_data(frame->f, AV_FRAME_DATA_STEREO3D); + stereo_3d = av_stereo3d_create_side_data(frame->f); + if (!stereo_3d) + goto fail; + + stereo_3d->type = AV_STEREO3D_FRAMESEQUENCE; + if (tdrdi->left_view_id[0] == view_id) + stereo_3d->view = AV_STEREO3D_VIEW_LEFT; + else if (tdrdi->right_view_id[0] == view_id) + stereo_3d->view = AV_STEREO3D_VIEW_RIGHT; + else + stereo_3d->view = AV_STEREO3D_VIEW_UNSPEC; + } } if (!(s->layers_active_output & (1 << s->cur_layer)))