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 B7B324B137 for ; Thu, 30 May 2024 01:21:37 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DD21168D52E; Thu, 30 May 2024 04:21:23 +0300 (EEST) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7AC1568D428 for ; Thu, 30 May 2024 04:21:14 +0300 (EEST) Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-355080e6ff9so356746f8f.2 for ; Wed, 29 May 2024 18:21:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717032073; x=1717636873; darn=ffmpeg.org; h=subject:date:from:to:message-id:in-reply-to:from:to:cc:subject:date :message-id:reply-to; bh=oCer7xXb4XZWxud7cevzndRCucf0ZcGicelCbQd2hjI=; b=dQESKGcdf6ZmrPNk/4IVCVzHjgoFvcfObSBdhm4Huimbk6APeR7DI98scB1u8+EGC+ mfV6F4uhwDvtInEWuVHDO6k2G3/1gmoT6dBcHzK5vyy0OSz2PdCzkiVqhqEYllsooVDA VMdTWSzIMFu6WBoL4WQaRdQB+ToAuCdurr+OAfC9pEMh2YZP+CP23N43Nl2xiDf0sYfv g0DG9MiDL65wHIsK1enrC+iScQMMJrnBJTO5a4XUElCGvgGHnPpC3xr21E1iCSmh2Ghv S9+J8XcfkcsZgvWjePr2Vlua5Ef+Qj+x7vp9HRxZw4utbGahrybBRve8wwvZvHUDkyxT Fsqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717032073; x=1717636873; h=subject:date:from:to:message-id:in-reply-to:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=oCer7xXb4XZWxud7cevzndRCucf0ZcGicelCbQd2hjI=; b=E9l6PvSn/ts4RSDk7ZpllE5vcqRWQtotdN9UErP3/RfnTKwutv/mvcMnzX3xlTKUEG jnABowdTIGtrSD5HPdY3QsPwwDAI4rLygz3MsiNVXKRWzRLfDF31EmPg4O1amznS1j7T Os4RBdMLTcr+plw0PPU/rxbYn6kdTU0tlBy7OD32yK3Wnw/yLly/8bEvT11XnriIYFsm oEW1ePM6Dx9D8fAYh4XESfmTci+LysGwpQwqsokPSig26xiJ7GT9VRsxZVA3tFTGkhFf KGu9Bj356G1m1nZXv4a8FIUsHnQljybspiqENHxrUvgmCSuy/RSK0R+Rt+TNudHFQ6xZ nA6w== X-Gm-Message-State: AOJu0YzYe0AMYZk8oT02zEDdwd/IHWGmAShW4DhwESoKFnkYbfjKva5t E6QFEbYGdoKgZd+bXYJxQ6K3WNwhd8M9XC/ufJxD4Rp/iv62ve0qAkL4hg== X-Google-Smtp-Source: AGHT+IFAX0XDhnC6bcFQjS6xZBHJyxfWLMl4tdCLfUrNFaNya8Bsuy8YVx6XejP5ofWSmhawgHCE4Q== X-Received: by 2002:a05:600c:3caa:b0:41a:41c8:d8e7 with SMTP id 5b1f17b1804b1-4212780a849mr8030455e9.3.1717032073121; Wed, 29 May 2024 18:21:13 -0700 (PDT) Received: from localhost (p200300cccf0f49001441a6a3c951ef29.dip0.t-ipconnect.de. [2003:cc:cf0f:4900:1441:a6a3:c951:ef29]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-578523cba01sm9160400a12.35.2024.05.29.18.21.12 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 May 2024 18:21:12 -0700 (PDT) In-Reply-To: Message-Id: To: From: "Marvin Scholz" Date: Mon, 20 May 2024 03:12:01 +0200 Subject: [FFmpeg-devel] [PATCH v3 3/3] avutil/hwcontext_videotoolbox: Set CVBuffer CGColorSpace 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 MIME-Version: 1.0 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: In addition to the other properties, try to obtain the right CGColorSpace and set it as well, else it could lead to a CVBuffer tagged as BT.2020 but with a CGColorSpace indicating BT.709. Therefore it is essential for consistency to set a colorspace according to the other values, or if none can be obtained (for example because the other values are all unspecified) unset it as well. Fix #10884 --- libavutil/hwcontext_videotoolbox.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libavutil/hwcontext_videotoolbox.c b/libavutil/hwcontext_videotoolbox.c index 0af2ab822f..953155ce32 100644 --- a/libavutil/hwcontext_videotoolbox.c +++ b/libavutil/hwcontext_videotoolbox.c @@ -535,6 +535,7 @@ CFStringRef av_map_videotoolbox_color_trc_from_av(enum AVColorTransferCharacteri static int vt_pixbuf_set_colorspace(void *log_ctx, CVPixelBufferRef pixbuf, const AVFrame *src) { + CGColorSpaceRef colorspace = NULL; CFStringRef colormatrix = NULL, colorpri = NULL, colortrc = NULL; Float32 gamma = 0; @@ -587,6 +588,21 @@ static int vt_pixbuf_set_colorspace(void *log_ctx, } else CVBufferRemoveAttachment(pixbuf, kCVImageBufferGammaLevelKey); + if (__builtin_available(macOS 10.8, iOS 10, *)) { + CFDictionaryRef attachments = CVBufferCopyAttachments(pixbuf, kCVAttachmentMode_ShouldPropagate); + if (attachments) { + colorspace = CVImageBufferCreateColorSpaceFromAttachments(attachments); + CFRelease(attachments); + } + } + + if (colorspace) { + CVBufferSetAttachment(pixbuf, kCVImageBufferCGColorSpaceKey, + colorspace, kCVAttachmentMode_ShouldPropagate); + CFRelease(colorspace); + } else + CVBufferRemoveAttachment(pixbuf, kCVImageBufferCGColorSpaceKey); + return 0; } -- 2.39.3 (Apple Git-146) _______________________________________________ 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".