This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 239c679c54 lavc: add ProRes RAW videotoolbox hwaccel
239c679c54 is described below

commit 239c679c546900c94fbc325361e6965f1a94a648
Author:     wangbin <[email protected]>
AuthorDate: Thu Aug 21 10:45:16 2025 +0800
Commit:     Lynne <[email protected]>
CommitDate: Sun May 17 03:47:23 2026 +0000

    lavc: add ProRes RAW videotoolbox hwaccel
---
 Changelog                          |  1 +
 configure                          |  2 ++
 libavcodec/hwaccels.h              |  1 +
 libavcodec/prores_raw.c            |  6 +++++
 libavcodec/videotoolbox.c          | 54 ++++++++++++++++++++++++++++++++++++--
 libavutil/hwcontext_videotoolbox.c |  2 ++
 6 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index 0eb121be0f..b0f87694e8 100644
--- a/Changelog
+++ b/Changelog
@@ -10,6 +10,7 @@ version <next>:
 - transpose_cuda filter
 - Add AMF Frame Rate Converter (vf_frc_amf) filter
 - SMPTE 2094-50 metadata support and passthrough
+- ProRes RAW VideoToolbox hwaccel
 
 
 version 8.1:
diff --git a/configure b/configure
index 39a522e7e8..730b4ac46d 100755
--- a/configure
+++ b/configure
@@ -3501,6 +3501,8 @@ mpeg4_videotoolbox_hwaccel_deps="videotoolbox"
 mpeg4_videotoolbox_hwaccel_select="mpeg4_decoder"
 prores_videotoolbox_hwaccel_deps="videotoolbox"
 prores_videotoolbox_hwaccel_select="prores_decoder"
+prores_raw_videotoolbox_hwaccel_deps="videotoolbox"
+prores_raw_videotoolbox_hwaccel_select="prores_raw_decoder"
 prores_raw_vulkan_hwaccel_deps="vulkan spirv_compiler"
 prores_raw_vulkan_hwaccel_select="prores_raw_decoder"
 prores_vulkan_hwaccel_deps="vulkan spirv_compiler"
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 22cad537e1..f386b22496 100644
--- a/libavcodec/prores_raw.c
+++ b/libavcodec/prores_raw.c
@@ -314,6 +314,9 @@ static enum AVPixelFormat get_pixel_format(AVCodecContext 
*avctx,
     enum AVPixelFormat pix_fmts[] = {
 #if CONFIG_PRORES_RAW_VULKAN_HWACCEL
         AV_PIX_FMT_VULKAN,
+#endif
+#if CONFIG_PRORES_RAW_VIDEOTOOLBOX_HWACCEL
+        AV_PIX_FMT_VIDEOTOOLBOX,
 #endif
         pix_fmt,
         AV_PIX_FMT_NONE,
@@ -573,6 +576,9 @@ const FFCodec ff_prores_raw_decoder = {
     .hw_configs     = (const AVCodecHWConfigInternal *const []) {
 #if CONFIG_PRORES_RAW_VULKAN_HWACCEL
         HWACCEL_VULKAN(prores_raw),
+#endif
+#if CONFIG_PRORES_RAW_VIDEOTOOLBOX_HWACCEL
+        HWACCEL_VIDEOTOOLBOX(prores_raw),
 #endif
         NULL
     },
diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 9c0b93c8f8..8df8a3214c 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -38,6 +38,7 @@
 #include "hwaccel_internal.h"
 #include "mpegvideo.h"
 #include "proresdec.h"
+#include "prores_raw.h"
 #include <Availability.h>
 #include <AvailabilityMacros.h>
 #include <TargetConditionals.h>
@@ -844,7 +845,10 @@ static CFDictionaryRef 
videotoolbox_decoder_config_create(CMVideoCodecType codec
                                                                    
&kCFTypeDictionaryValueCallBacks);
 
     CFDictionarySetValue(config_info,
-                         codec_type == kCMVideoCodecType_HEVC ?
+                        avctx->codec_id == AV_CODEC_ID_HEVC
+                        || avctx->codec_id == AV_CODEC_ID_PRORES
+                        || avctx->codec_id == AV_CODEC_ID_PRORES_RAW
+                            ?
                             
kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder :
                             
kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder,
                          kCFBooleanTrue);
@@ -947,6 +951,9 @@ static int videotoolbox_start(AVCodecContext *avctx)
             break;
         }
         break;
+    case AV_CODEC_ID_PRORES_RAW :
+        videotoolbox->cm_codec_type = av_bswap32(avctx->codec_tag);
+        break;
     case AV_CODEC_ID_VP9 :
         videotoolbox->cm_codec_type = kCMVideoCodecType_VP9;
         break;
@@ -958,7 +965,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();
         }
@@ -1190,6 +1197,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 *ctx = avctx->priv_data;
+    AVFrame *frame = ctx->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);
@@ -1201,6 +1233,9 @@ 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 (descriptor->flags & AV_PIX_FMT_FLAG_BAYER)
+        return AV_PIX_FMT_BAYER_RGGB16;
+
 #if HAVE_KCVPIXELFORMATTYPE_444YPCBCR16BIPLANARVIDEORANGE
     if (depth > 10)
         return descriptor->log2_chroma_w == 0 ? AV_PIX_FMT_P416 : 
AV_PIX_FMT_P216;
@@ -1451,4 +1486,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 */
diff --git a/libavutil/hwcontext_videotoolbox.c 
b/libavutil/hwcontext_videotoolbox.c
index 0cb55bfb27..5add4096c6 100644
--- a/libavutil/hwcontext_videotoolbox.c
+++ b/libavutil/hwcontext_videotoolbox.c
@@ -86,6 +86,7 @@ static const struct {
 #if HAVE_KCVPIXELFORMATTYPE_422YPCBCR8_YUVS
     { kCVPixelFormatType_422YpCbCr8_yuvs,               false, 
AV_PIX_FMT_YUYV422 },
 #endif
+    { 'bp16'/*kCVPixelFormatType_16VersatileBayer*/,    false, 
AV_PIX_FMT_BAYER_RGGB16},
 };
 
 static const enum AVPixelFormat supported_formats[] = {
@@ -121,6 +122,7 @@ static const enum AVPixelFormat supported_formats[] = {
     AV_PIX_FMT_YUYV422,
 #endif
     AV_PIX_FMT_BGRA,
+    AV_PIX_FMT_BAYER_RGGB16,
 };
 
 static int vt_frames_get_constraints(AVHWDeviceContext *ctx,

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to