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 09BF04AEFB for ; Thu, 23 May 2024 16:06:00 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1364168D47C; Thu, 23 May 2024 19:05:58 +0300 (EEST) Received: from out203-205-221-242.mail.qq.com (out203-205-221-242.mail.qq.com [203.205.221.242]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1DFD768CEB8 for ; Thu, 23 May 2024 19:05:49 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1716480346; bh=9P8WtrUy10yzQ6Jl39tOPOFeux5+sdNf4QIBqbowUDQ=; h=From:Subject:Date:In-Reply-To:Cc:To:References; b=o+dTY5DwzfHl67E5gsdiM7+GmFmMSWNDjwjrE52tzBduvdSIza+eI5zkbG09TXqTH 4Tcc/6qFI6NUgFXo6IpufvfOfGIeDt6UMJFWbS8L2PDb3gP7UvDkASwRmKhjBMkx1b cTaNIvBNWXGhPPpGDAAkAqZZS46UL7YHoG8A9gKs= Received: from smtpclient.apple ([113.118.103.69]) by newxmesmtplogicsvrszc19-0.qq.com (NewEsmtp) with SMTP id 1671FA95; Fri, 24 May 2024 00:05:39 +0800 X-QQ-mid: xmsmtpt1716480339tl7s3o4la Message-ID: X-QQ-XMAILINFO: Nd/Exl7W9DK55yZjyRDk0dVs0hrHMxHg+AAFMBhMBXBfzc4B6LGLwja8ovnnpP Hc/XzRoCmQCo83Lz1WzKyUieVQmgbsqL7JIK8+NxsLfTCjqU25G/SrwJu6qAhoW4D25B4vOxAxeF Ratu26SgYIflZ4q4LPS8vv8L6HrlHzgcFoCT3gvp1iEF4+ih27yDW9K+FjM86WStzPSoue4uzcLD UFXabXrNiHSFzv30oNNvk78Zrs7sbQS+8eH/Hln5J/lRBK61lsR1up18uvdMQzCbBTJ0MAACyAiP 7uaxrQMZAddxfXboqcYXsr7EOrzObNMeELRMc/ZELTPPpHRtM4uVKP08NQmjrrcJrjN8DJ4TBBzZ LoYBKAP3sg4+Q/SztdvJZxgPxm8ZCtW+myopj6324stGv2G3A7140o3N0W6VmR19c6oK90HWicfx stxjt6amXK+r1+XoHSGm4aDweIIP1E640srAdefgcjmKbEDGC9QyiEAdEurSkD26j9GXKDOTGO9+ o4WC8Fgu4/FFeryrXcWJ5Qln48QKmYMt8dgKPIoIxcMyqGOQKBt+dIXs1e/x6nIA/jcDquhTrClN ogqz0FL37NeIMWTvCa2oVtOjjlhNG46Y3SfDpSvn/mVHrrzGuTKSVJ3/ddW5jmnmRkEDdONfWFe3 qcj+Hx5TTYXIHuA16lkAltMc+NNOQhvO0WTqfUBPU2F/1BbMehBQW71eBJSj28zEa8bFelUN6CJA ghL5WQuvss6mrxtN7Xk/2oZBR8LmJP5lRVjoKb6WUCA2CVc55krw8PPfv7TDGAUuAKYn9Kh6azOU oRWrtiTlY9VpmF/v87WsF8fF4KwC8npf/UkdcsPZZxxgCjPMbSQT4hHRpMBc6L+ghGCuzBMkhuTt 2YmgmGJ0o415rvTqd4ptVMEOjOIVxQripaL/Qq91/aEleaj31Ub5xsudP5Xeeupm4vGC9e+EdyPh kPY7QPvILox4p/AasUafAb2CcMU3qg2CVLAAhya+xP4TiWHOe8jg== X-QQ-XMRINFO: Mp0Kj//9VHAxr69bL5MkOOs= From: Zhao Zhili X-OQ-MSGID: <5190206A-F497-4098-8511-8192E0EBFC37@foxmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.500.171.1.1\)) Date: Fri, 24 May 2024 00:05:29 +0800 In-Reply-To: <0112D1C4-AAE8-4CE4-83B5-3416DC6B0DDD@me.com> To: FFmpeg development discussions and patches References: <0112D1C4-AAE8-4CE4-83B5-3416DC6B0DDD@me.com> X-Mailer: Apple Mail (2.3774.500.171.1.1) X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH v2] avutil/hwcontext_videotoolbox: Set proper CVBuffer colorspace 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 Cc: Gnattu OC , Marvin Scholz 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: > On May 21, 2024, at 09:56, Gnattu OC via ffmpeg-devel wrote: > >> >> On May 20, 2024, at 09:12, Marvin Scholz wrote: >> >> Fix #10884 >> --- >> libavutil/hwcontext_videotoolbox.c | 54 +++++++++++++++++++++--------- >> 1 file changed, 38 insertions(+), 16 deletions(-) >> >> diff --git a/libavutil/hwcontext_videotoolbox.c b/libavutil/hwcontext_videotoolbox.c >> index 9f82b104c3..4a35bfc7ff 100644 >> --- a/libavutil/hwcontext_videotoolbox.c >> +++ b/libavutil/hwcontext_videotoolbox.c >> @@ -530,6 +530,8 @@ 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; >> + CFMutableDictionaryRef attachments = NULL; >> CFStringRef colormatrix = NULL, colorpri = NULL, colortrc = NULL; >> Float32 gamma = 0; >> >> @@ -550,37 +552,57 @@ static int vt_pixbuf_set_colorspace(void *log_ctx, >> else if (src->color_trc == AVCOL_TRC_GAMMA28) >> gamma = 2.8; >> >> + attachments = CFDictionaryCreateMutable(NULL, 0, >> + &kCFTypeDictionaryKeyCallBacks, >> + &kCFTypeDictionaryValueCallBacks); >> + if (!attachments) >> + return AVERROR(ENOMEM); >> + >> if (colormatrix) { >> - CVBufferSetAttachment( >> - pixbuf, >> + CFDictionarySetValue( >> + attachments, >> kCVImageBufferYCbCrMatrixKey, >> - colormatrix, >> - kCVAttachmentMode_ShouldPropagate); >> + colormatrix); >> } >> if (colorpri) { >> - CVBufferSetAttachment( >> - pixbuf, >> + CFDictionarySetValue( >> + attachments, >> kCVImageBufferColorPrimariesKey, >> - colorpri, >> - kCVAttachmentMode_ShouldPropagate); >> + colorpri); >> } >> if (colortrc) { >> - CVBufferSetAttachment( >> - pixbuf, >> + CFDictionarySetValue( >> + attachments, >> kCVImageBufferTransferFunctionKey, >> - colortrc, >> - kCVAttachmentMode_ShouldPropagate); >> + colortrc); >> } >> if (gamma != 0) { >> CFNumberRef gamma_level = CFNumberCreate(NULL, kCFNumberFloat32Type, &gamma); >> - CVBufferSetAttachment( >> - pixbuf, >> + CFDictionarySetValue( >> + attachments, >> kCVImageBufferGammaLevelKey, >> - gamma_level, >> - kCVAttachmentMode_ShouldPropagate); >> + gamma_level); >> CFRelease(gamma_level); >> } >> >> + if (__builtin_available(macOS 10.8, iOS 10, *)) >> + colorspace = CVImageBufferCreateColorSpaceFromAttachments(attachments); >> + >> + if (colorspace) { >> + CFDictionarySetValue( >> + attachments, >> + kCVImageBufferCGColorSpaceKey, >> + colorspace); >> + CFRelease(colorspace); >> + } else >> + av_log(log_ctx, AV_LOG_WARNING, "Unable to set proper colorspace for the CVImageBuffer.\n"); > > This will spam the console on SDR video inputs because they have nothing to be set as the attachment and the colorspace creation will always fail and return nil. I will just remove the log message and apply the patch this week if no objection. > >> + >> + CVBufferSetAttachments( >> + pixbuf, >> + attachments, >> + kCVAttachmentMode_ShouldPropagate); >> + CFRelease(attachments); >> + >> return 0; >> } >> >> >> base-commit: 463c573e6b6489c588bee90124d5cf92db8ccaaa >> -- >> 2.39.3 (Apple Git-145) >> _______________________________________________ >> 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". > > _______________________________________________ > 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". _______________________________________________ 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".