PR #24125 opened by Jamaika1
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24125
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24125.patch

https://github.com/AcademySoftwareFoundation/openapv/pull/236


>From 83cbe893a7a36a2be3fbf9b9fc5c79324c7d4521 Mon Sep 17 00:00:00 2001
From: Jamaika1 <[email protected]>
Date: Thu, 6 Aug 2026 14:30:13 +0000
Subject: [PATCH 1/3] libavcodec/liboapvenc: add per-instance custom memory
 allocator interface

https://github.com/AcademySoftwareFoundation/openapv/pull/235
Positive test:
ffmpeg_avx2.exe -v verbose -i "input.mp4" -y -c:v liboapv -preset medium -qp 22 
-an -vf "scale=1920:1080,format=yuv422p12le" -frames:v 1000 output_oapv.mkv
---
 libavcodec/liboapvenc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/liboapvenc.c b/libavcodec/liboapvenc.c
index 22a8ac4890..2ea3573a34 100644
--- a/libavcodec/liboapvenc.c
+++ b/libavcodec/liboapvenc.c
@@ -63,6 +63,7 @@ typedef struct ApvEncContext {
     oapve_t id;             // APV instance identifier
     oapvm_t mid;
     oapve_cdesc_t   cdsc;   // coding parameters i.e profile, width & height 
of input frame, num of therads, frame rate ...
+    oapvm_cdesc_t   mdesc;
     oapv_bitb_t     bitb;   // bitstream buffer (output)
     oapve_stat_t    stat;   // encoding status (output)
 
@@ -509,7 +510,8 @@ static av_cold int liboapve_init(AVCodecContext *avctx)
     }
 
     /* create metadata handler */
-    apv->mid = oapvm_create(&ret);
+    memset(&apv->mdesc, 0, sizeof(oapvm_cdesc_t));
+    apv->mid = oapvm_create(&apv->mdesc, &ret);
     if (apv->mid == NULL || OAPV_FAILED(ret)) {
         av_log(avctx, AV_LOG_ERROR, "cannot create OAPV metadata handler\n");
         return AVERROR_EXTERNAL;
-- 
2.52.0


>From 6005fd4340a5cfe0a942e5a5e22c3b4ecc98d85b Mon Sep 17 00:00:00 2001
From: Jamaika1 <[email protected]>
Date: Thu, 13 Aug 2026 14:00:31 +0000
Subject: [PATCH 2/3] libavcodec/liboapvenc: add per-instance custom memory
 allocator interface

---
 libavcodec/liboapvenc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/liboapvenc.c b/libavcodec/liboapvenc.c
index 2ea3573a34..3bdca1b610 100644
--- a/libavcodec/liboapvenc.c
+++ b/libavcodec/liboapvenc.c
@@ -63,7 +63,9 @@ typedef struct ApvEncContext {
     oapve_t id;             // APV instance identifier
     oapvm_t mid;
     oapve_cdesc_t   cdsc;   // coding parameters i.e profile, width & height 
of input frame, num of therads, frame rate ...
+#if OAPV_VER_APISET >= 1
     oapvm_cdesc_t   mdesc;
+#endif
     oapv_bitb_t     bitb;   // bitstream buffer (output)
     oapve_stat_t    stat;   // encoding status (output)
 
@@ -510,8 +512,12 @@ static av_cold int liboapve_init(AVCodecContext *avctx)
     }
 
     /* create metadata handler */
+#if OAPV_VER_APISET >= 1
     memset(&apv->mdesc, 0, sizeof(oapvm_cdesc_t));
     apv->mid = oapvm_create(&apv->mdesc, &ret);
+#else
+    apv->mid = oapvm_create(&ret);
+#endif
     if (apv->mid == NULL || OAPV_FAILED(ret)) {
         av_log(avctx, AV_LOG_ERROR, "cannot create OAPV metadata handler\n");
         return AVERROR_EXTERNAL;
-- 
2.52.0


>From 4f5285c85113ca39cdd33d57bc1bf238a5ca9e1d Mon Sep 17 00:00:00 2001
From: Jamaika1 <[email protected]>
Date: Thu, 13 Aug 2026 14:14:55 +0000
Subject: [PATCH 3/3] Add UNCONST profile extensions and rework the tile info
 API

---
 libavcodec/liboapvenc.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/libavcodec/liboapvenc.c b/libavcodec/liboapvenc.c
index 3bdca1b610..55a411bbd4 100644
--- a/libavcodec/liboapvenc.c
+++ b/libavcodec/liboapvenc.c
@@ -168,10 +168,18 @@ static inline int get_min_profile(enum AVPixelFormat 
pix_fmt)
         return AV_PROFILE_APV_444_10;
     case AV_PIX_FMT_YUV444P12:
         return AV_PROFILE_APV_444_12;
+#if OAPV_VER_APISET >= 1
+    case AV_PIX_FMT_YUV444P16:
+        return AV_PROFILE_APV_444_16C12;
+#endif
     case AV_PIX_FMT_YUVA444P10:
         return AV_PROFILE_APV_4444_10;
     case AV_PIX_FMT_YUVA444P12:
         return AV_PROFILE_APV_4444_12;
+#if OAPV_VER_APISET >= 1
+    case AV_PIX_FMT_YUVA444P16:
+        return AV_PROFILE_APV_4444_16C12;
+#endif
     }
 }
 
@@ -205,7 +213,17 @@ static int profile_is_compatible(enum AVPixelFormat 
pix_fmt, int profile)
         return chroma_format_idc >= APV_CHROMA_FORMAT_422 &&
                chroma_format_idc <= APV_CHROMA_FORMAT_4444 &&
                bit_depth >= 10 && bit_depth <= 12;
-    case AV_PROFILE_APV_400_10:
+#if OAPV_VER_APISET >= 1
+    case AV_PROFILE_APV_444_16C12:
+        return chroma_format_idc >= APV_CHROMA_FORMAT_422 &&
+               chroma_format_idc <= APV_CHROMA_FORMAT_444 &&
+               bit_depth >= 12 && bit_depth <= 16;
+    case AV_PROFILE_APV_4444_16C12:
+        return chroma_format_idc >= APV_CHROMA_FORMAT_422 &&
+               chroma_format_idc <= APV_CHROMA_FORMAT_4444 &&
+               bit_depth >= 12 && bit_depth <= 16;
+#endif
+      case AV_PROFILE_APV_400_10:
         return chroma_format_idc == APV_CHROMA_FORMAT_400 && bit_depth == 10;
     default:
         return 0;
-- 
2.52.0

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

Reply via email to