From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 384EC4DC44 for ; Fri, 2 Jan 2026 18:55:02 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'ETNtFKTtW/YiQ4gfXDwEcnSc1FUhgfhu/eVpyqK4xmg=', expected b'WFSyGoK7auhooDmOsZxKiSJEq78MeQsZ/EJ14TGH2IY=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1767380090; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=ETNtFKTtW/YiQ4gfXDwEcnSc1FUhgfhu/eVpyqK4xmg=; b=3kNxK3AavN9gVnzQgrUCkPqmpQCZ85UHaw0g6iA0DFpUCC0PezQbA7NWaEfWS17HCBPpP uontCWAnFFFdXN1Jh0dS1IVLjmdAOFiIBDEMj119mtLaWjHDWojXJQpS8I1Gx81TTPZd1g8 D4+1bsSu3ykCX0/fXiPBKcCwBbWTO+2RhYfWZW+UNCnZy1jCdCJtmFU4fa8ZqNBiffkhTmi qx+iqIQRx+kU/ilk4R9+l/wRWYNU40zwZ56WP57U9iPJJ/aQdbvFpVhnWbhN3oCwFo4fXkH Pp3i+YADNrsxYtrG2n5OIQKTEzENHtgtSW2ab+0DMXtyypyL+vmyToYIX+Iw== Received: from [172.20.0.4] (unknown [172.20.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 9F460690D4C; Fri, 2 Jan 2026 20:54:50 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1767380073; b=OgKePDFXnzB6XorSp/HuF6FCm12rfeX+MAFE5Hwt6NhS/ysWMiCzybMfwiYCxOsrdBo0R plyQWxoq/2Mv2mWAIaSomiBwgMM4LZnh+c40oR/rkbbI+VH/d/S80qZo60u0/wxsNeJ9YyD ld38iVzZkdqYNJJQVJ3TF3PrUsmCyxo5pbt9T/n8GhHRfhEDYFhJ9zscPLtxfrw6gUkpBOx 6jDHlZD7BgRt+h75/YwQfEdb5HKXgFIakti7JVdkcZx0mo7QCP8OqlYnrKGQP2zGzK2jq70 DzsQsiXJLWbpy/easXuPMe8LDjbGhMZrMy0OP3reIlQQk3F+xZTAbfW2spKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1767380073; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=ZmmAUs4BzWYOC2aFbdu2QEVhsqmVMLoCHjawnoBjFxY=; b=K1l0z7j2t1iNptMQGHyk6Rs98GfTNw1RITiYo2KNN245CYoaIanRMzA5RkiNHRQ6VRE9K 6YPxd8ua62f5O/OgMca//qNbVoUnbSWRCcc5N21tbd/c5eSRBTzoXhc1sp9O8Ssd7T14sm0 isK++RdIjvD86MjYyiOwkKi614JY83S+0dLcjhE37OellXXx7yr0bl8d7cUPif15VKroBQG aN63O3ZlBs8SpCNd0VS6k73VLQ4egheyUPTl9V0FA+Sl8AWKUwqvGeZ2vIY8kVkd+oqGI1T +LgIXgRsd87hMTJVs2R53Y0QF06M5RX+Fdu9aaVAnYWCxV9fmaQSYXSpD8cA== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1767380066; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=WFSyGoK7auhooDmOsZxKiSJEq78MeQsZ/EJ14TGH2IY=; b=nhKsnnegmz3l1TJcJbBRnwHtx2mMPiYwxED3x57P/UYuKH3O1Yo7Losnwb0MO/I8wTRMn tzVFxWjb+31+MEyy0ofLfU3gy7gjA40hBeKWBQ2zw3laiLk2tAmndhrXX4nQIMbQBkYsEsE LXyZAqsEdBLGnYcsG7hY0L71ApK3z3SMkZv30XcGkgps08arBFNsZ7oGy5kogMNOqvtYRMt HVUzJQaMoZzmNQTRl1KDvnseiVM6HVcVifOHIKVOfN1iVguDOpI4XmbFQfYAUGBrdEZDR3Z Ie1wqMpHjscn6+c+nvFC+wLWpkiRZ2wQIqAxYfSYfV4YsXTbhOwobfwKGong== Received: from de3a2b3407a2 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id E6FB568FD9F for ; Fri, 2 Jan 2026 20:54:25 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Fri, 02 Jan 2026 18:54:25 -0000 Message-ID: <176738006612.25.6208335767139457151@4457048688e7> Message-ID-Hash: V52FB2VTDA6XUN6MGROBOZPIUMWI2FBB X-Message-ID-Hash: V52FB2VTDA6XUN6MGROBOZPIUMWI2FBB X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PR] lavc/prores_raw: add videotoolbox hwaccel (PR #21361) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: averne via ffmpeg-devel Cc: averne Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #21361 opened by averne URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21361 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21361.patch >>From 3f0069bd9b3af1df0096a9bb312f74e69cc276c4 Mon Sep 17 00:00:00 2001 From: averne Date: Fri, 2 Jan 2026 19:38:06 +0100 Subject: [PATCH 1/3] lavu/videotoolbox: add 16-bit bayer format mapping --- configure | 2 ++ libavutil/hwcontext_videotoolbox.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/configure b/configure index 301a3e5e3e..6db36a604a 100755 --- a/configure +++ b/configure @@ -2537,6 +2537,7 @@ TYPES_LIST=" kCVPixelFormatType_444YpCbCr8BiPlanarVideoRange kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange kCVPixelFormatType_444YpCbCr16BiPlanarVideoRange + kCVPixelFormatType_16VersatileBayer kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ kCVImageBufferTransferFunction_ITU_R_2100_HLG kCVImageBufferTransferFunction_Linear @@ -6950,6 +6951,7 @@ enabled videotoolbox && { check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_444YpCbCr8BiPlanarVideoRange "-framework CoreVideo" check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange "-framework CoreVideo" check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_444YpCbCr16BiPlanarVideoRange "-framework CoreVideo" + check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_16VersatileBayer "-framework CoreVideo" check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ "-framework CoreVideo" check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_ITU_R_2100_HLG "-framework CoreVideo" check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_Linear "-framework CoreVideo" diff --git a/libavutil/hwcontext_videotoolbox.c b/libavutil/hwcontext_videotoolbox.c index 102fa485e5..419dc5b8c0 100644 --- a/libavutil/hwcontext_videotoolbox.c +++ b/libavutil/hwcontext_videotoolbox.c @@ -82,6 +82,9 @@ static const struct { #if HAVE_KCVPIXELFORMATTYPE_444YPCBCR16BIPLANARVIDEORANGE { kCVPixelFormatType_444YpCbCr16BiPlanarVideoRange, false, AV_PIX_FMT_P416 }, #endif +#if HAVE_KCVPIXELFORMATTYPE_16VERSATILEBAYER + { kCVPixelFormatType_16VersatileBayer, false, AV_PIX_FMT_BAYER_RGGB16 }, +#endif }; static const enum AVPixelFormat supported_formats[] = { @@ -112,6 +115,9 @@ static const enum AVPixelFormat supported_formats[] = { #endif #if HAVE_KCVPIXELFORMATTYPE_444YPCBCR16BIPLANARVIDEORANGE AV_PIX_FMT_P416, +#endif +#if HAVE_KCVPIXELFORMATTYPE_16VERSATILEBAYER + AV_PIX_FMT_BAYER_RGGB16, #endif AV_PIX_FMT_BGRA, }; -- 2.49.1 >>From f040dd0ba16edb71d5aba456abfcc06f757161fd Mon Sep 17 00:00:00 2001 From: averne Date: Fri, 2 Jan 2026 19:43:12 +0100 Subject: [PATCH 2/3] lavc/videotoolbox: select 16-bit bayer format when applicable --- libavcodec/videotoolbox.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index 2cd22cba1a..a4d9cd355b 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -818,9 +818,11 @@ static CFDictionaryRef videotoolbox_buffer_attributes_create(int width, CFDictionarySetValue(buffer_attributes, kCVPixelBufferWidthKey, w); CFDictionarySetValue(buffer_attributes, kCVPixelBufferHeightKey, h); #if TARGET_OS_IPHONE - CFDictionarySetValue(buffer_attributes, kCVPixelBufferOpenGLESCompatibilityKey, kCFBooleanTrue); + CFDictionarySetValue(buffer_attributes, kCVPixelBufferOpenGLESCompatibilityKey, + pix_fmt != kCVPixelFormatType_16VersatileBayer ? kCFBooleanTrue : kCFBooleanFalse); #else - CFDictionarySetValue(buffer_attributes, kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey, kCFBooleanTrue); + CFDictionarySetValue(buffer_attributes, kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey, + pix_fmt != kCVPixelFormatType_16VersatileBayer ? kCFBooleanTrue : kCFBooleanFalse); #endif CFRelease(io_surface_properties); @@ -1200,6 +1202,11 @@ static enum AVPixelFormat videotoolbox_best_pixel_format(AVCodecContext *avctx) if (descriptor->flags & AV_PIX_FMT_FLAG_ALPHA) return (depth > 8) ? AV_PIX_FMT_AYUV64 : AV_PIX_FMT_AYUV; +#if HAVE_KCVPIXELFORMATTYPE_16VERSATILEBAYER + if (descriptor->flags & AV_PIX_FMT_FLAG_BAYER) + return AV_PIX_FMT_BAYER_RGGB16; +#endif + #if HAVE_KCVPIXELFORMATTYPE_444YPCBCR16BIPLANARVIDEORANGE if (depth > 10) return descriptor->log2_chroma_w == 0 ? AV_PIX_FMT_P416 : AV_PIX_FMT_P216; -- 2.49.1 >>From 3987f6bbe6b0b07e857a82b75e9d8d12ff3b8c31 Mon Sep 17 00:00:00 2001 From: averne Date: Fri, 2 Jan 2026 19:39:31 +0100 Subject: [PATCH 3/3] lavc: add a ProRes RAW VideoToolboox hwaccel --- libavcodec/hwaccels.h | 1 + libavcodec/prores_raw.c | 6 +++++ libavcodec/videotoolbox.c | 54 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 60 insertions(+), 1 deletion(-) diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h index 3de191288a..35c5d57377 100644 --- a/libavcodec/hwaccels.h +++ b/libavcodec/hwaccels.h @@ -69,6 +69,7 @@ extern const struct FFHWAccel ff_mpeg4_vdpau_hwaccel; extern const struct FFHWAccel ff_mpeg4_videotoolbox_hwaccel; extern const struct FFHWAccel ff_prores_videotoolbox_hwaccel; extern const struct FFHWAccel ff_prores_vulkan_hwaccel; +extern const struct FFHWAccel ff_prores_raw_videotoolbox_hwaccel; extern const struct FFHWAccel ff_prores_raw_vulkan_hwaccel; extern const struct FFHWAccel ff_vc1_d3d11va_hwaccel; extern const struct FFHWAccel ff_vc1_d3d11va2_hwaccel; diff --git a/libavcodec/prores_raw.c b/libavcodec/prores_raw.c index 8be566ed36..f9a688760c 100644 --- a/libavcodec/prores_raw.c +++ b/libavcodec/prores_raw.c @@ -313,6 +313,9 @@ static enum AVPixelFormat get_pixel_format(AVCodecContext *avctx, enum AVPixelFormat pix_fmt) { enum AVPixelFormat pix_fmts[] = { +#if CONFIG_PRORES_RAW_VIDEOTOOLBOX_HWACCEL + AV_PIX_FMT_VIDEOTOOLBOX, +#endif #if CONFIG_PRORES_RAW_VULKAN_HWACCEL AV_PIX_FMT_VULKAN, #endif @@ -548,6 +551,9 @@ const FFCodec ff_prores_raw_decoder = { .caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .hw_configs = (const AVCodecHWConfigInternal *const []) { +#if CONFIG_PRORES_RAW_VIDEOTOOLBOX_HWACCEL + HWACCEL_VIDEOTOOLBOX(prores_raw), +#endif #if CONFIG_PRORES_RAW_VULKAN_HWACCEL HWACCEL_VULKAN(prores_raw), #endif diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index a4d9cd355b..af7d297b58 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -37,6 +37,7 @@ #include "hwaccel_internal.h" #include "mpegvideo.h" #include "proresdec.h" +#include "prores_raw.h" #include #include #include @@ -948,6 +949,17 @@ static int videotoolbox_start(AVCodecContext *avctx) break; } break; + case AV_CODEC_ID_PRORES_RAW : + switch (avctx->codec_tag) { + default: + av_log(avctx, AV_LOG_WARNING, "Unknown prores raw profile %d\n", avctx->codec_tag); + // fall-through + case MKTAG('a', 'p', 'r', 'n'): // kCMVideoCodecType_AppleProResRAW + case MKTAG('a', 'p', 'r', 'h'): // kCMVideoCodecType_AppleProResRAWHQ + videotoolbox->cm_codec_type = av_bswap32(avctx->codec_tag); + break; + } + break; case AV_CODEC_ID_VP9 : videotoolbox->cm_codec_type = kCMVideoCodecType_VP9; break; @@ -959,7 +971,7 @@ static int videotoolbox_start(AVCodecContext *avctx) } #if defined(MAC_OS_X_VERSION_10_9) && !TARGET_OS_IPHONE && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9) && AV_HAS_BUILTIN(__builtin_available) - if (avctx->codec_id == AV_CODEC_ID_PRORES) { + if (avctx->codec_id == AV_CODEC_ID_PRORES || avctx->codec_id == AV_CODEC_ID_PRORES_RAW) { if (__builtin_available(macOS 10.9, *)) { VTRegisterProfessionalVideoWorkflowVideoDecoders(); } @@ -1191,6 +1203,31 @@ static int videotoolbox_prores_end_frame(AVCodecContext *avctx) return ff_videotoolbox_common_end_frame(avctx, frame); } +static int videotoolbox_prores_raw_start_frame(AVCodecContext *avctx, + const AVBufferRef *buffer_ref, + const uint8_t *buffer, + uint32_t size) +{ + VTContext *vtctx = avctx->internal->hwaccel_priv_data; + + return ff_videotoolbox_buffer_copy(vtctx, buffer, size); +} + +static int videotoolbox_prores_raw_decode_slice(AVCodecContext *avctx, + const uint8_t *buffer, + uint32_t size) +{ + return 0; +} + +static int videotoolbox_prores_raw_end_frame(AVCodecContext *avctx) +{ + ProResRAWContext *s = avctx->priv_data; + AVFrame *frame = s->frame; + + return ff_videotoolbox_common_end_frame(avctx, frame); +} + static enum AVPixelFormat videotoolbox_best_pixel_format(AVCodecContext *avctx) { int depth; const AVPixFmtDescriptor *descriptor = av_pix_fmt_desc_get(avctx->sw_pix_fmt); @@ -1457,4 +1494,19 @@ const FFHWAccel ff_prores_videotoolbox_hwaccel = { .priv_data_size = sizeof(VTContext), }; +const FFHWAccel ff_prores_raw_videotoolbox_hwaccel = { + .p.name = "prores_raw_videotoolbox", + .p.type = AVMEDIA_TYPE_VIDEO, + .p.id = AV_CODEC_ID_PRORES_RAW, + .p.pix_fmt = AV_PIX_FMT_VIDEOTOOLBOX, + .alloc_frame = ff_videotoolbox_alloc_frame, + .start_frame = videotoolbox_prores_raw_start_frame, + .decode_slice = videotoolbox_prores_raw_decode_slice, + .end_frame = videotoolbox_prores_raw_end_frame, + .frame_params = ff_videotoolbox_frame_params, + .init = ff_videotoolbox_common_init, + .uninit = ff_videotoolbox_uninit, + .priv_data_size = sizeof(VTContext), +}; + #endif /* CONFIG_VIDEOTOOLBOX */ -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org