Kern, please help to review this patch, which has added CBP profile with 
profile options.
As for the VT_H264Profile replacement, let you take over, follow up this patch.


Thanks


------------------ ???????? ------------------
??????:                                                                         
                                               "xufuji456"                      
                                                              
<839789...@qq.com&gt;;
????????:&nbsp;2023??5??23??(??????) ????10:27
??????:&nbsp;"ffmpeg-devel"<ffmpeg-devel@ffmpeg.org&gt;;
????:&nbsp;"??????"<839789...@qq.com&gt;;
????:&nbsp;[PATCH] avcodec/videotoolboxenc: add CBP/CHP profile



The Constrained_Baseline and Constrained_High profile of H264 has available in 
iOS 15.0

Signed-off-by: xufuji456 <839789...@qq.com&gt;
---
&nbsp;libavcodec/videotoolboxenc.c | 25 +++++++++++++++++++++----
&nbsp;1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index b017c90c36..028095cd04 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -108,6 +108,8 @@ static struct{
&nbsp;&nbsp;&nbsp;&nbsp; CFStringRef kVTProfileLevel_H264_High_AutoLevel;
&nbsp;&nbsp;&nbsp;&nbsp; CFStringRef kVTProfileLevel_H264_Extended_5_0;
&nbsp;&nbsp;&nbsp;&nbsp; CFStringRef kVTProfileLevel_H264_Extended_AutoLevel;
+&nbsp;&nbsp;&nbsp; CFStringRef 
kVTProfileLevel_H264_ConstrainedBaseline_AutoLevel;
+&nbsp;&nbsp;&nbsp; CFStringRef kVTProfileLevel_H264_ConstrainedHigh_AutoLevel;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; CFStringRef kVTProfileLevel_HEVC_Main_AutoLevel;
&nbsp;&nbsp;&nbsp;&nbsp; CFStringRef kVTProfileLevel_HEVC_Main10_AutoLevel;
@@ -171,6 +173,8 @@ static void loadVTEncSymbols(void){
&nbsp;&nbsp;&nbsp;&nbsp; 
GET_SYM(kVTProfileLevel_H264_High_AutoLevel,&nbsp;&nbsp;&nbsp;&nbsp; 
"H264_High_AutoLevel");
&nbsp;&nbsp;&nbsp;&nbsp; 
GET_SYM(kVTProfileLevel_H264_Extended_5_0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
"H264_Extended_5_0");
&nbsp;&nbsp;&nbsp;&nbsp; GET_SYM(kVTProfileLevel_H264_Extended_AutoLevel, 
"H264_Extended_AutoLevel");
+&nbsp;&nbsp;&nbsp; GET_SYM(kVTProfileLevel_H264_ConstrainedBaseline_AutoLevel, 
"H264_ConstrainedBaseline_AutoLevel");
+&nbsp;&nbsp;&nbsp; 
GET_SYM(kVTProfileLevel_H264_ConstrainedHigh_AutoLevel,&nbsp;&nbsp;&nbsp;&nbsp; 
"H264_ConstrainedHigh_AutoLevel");
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; 
GET_SYM(kVTProfileLevel_HEVC_Main_AutoLevel,&nbsp;&nbsp;&nbsp;&nbsp; 
"HEVC_Main_AutoLevel");
&nbsp;&nbsp;&nbsp;&nbsp; 
GET_SYM(kVTProfileLevel_HEVC_Main10_AutoLevel,&nbsp;&nbsp; 
"HEVC_Main10_AutoLevel");
@@ -193,8 +197,10 @@ static void loadVTEncSymbols(void){
&nbsp;typedef enum VT_H264Profile {
&nbsp;&nbsp;&nbsp;&nbsp; H264_PROF_AUTO,
&nbsp;&nbsp;&nbsp;&nbsp; H264_PROF_BASELINE,
+&nbsp;&nbsp;&nbsp; H264_PROF_CONSTRAINED_BASELINE,
&nbsp;&nbsp;&nbsp;&nbsp; H264_PROF_MAIN,
&nbsp;&nbsp;&nbsp;&nbsp; H264_PROF_HIGH,
+&nbsp;&nbsp;&nbsp; H264_PROF_CONSTRAINED_HIGH,
&nbsp;&nbsp;&nbsp;&nbsp; H264_PROF_EXTENDED,
&nbsp;&nbsp;&nbsp;&nbsp; H264_PROF_COUNT
&nbsp;} VT_H264Profile;
@@ -763,6 +769,10 @@ static bool get_vt_h264_profile_level(AVCodecContext 
*avctx,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;
&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case H264_PROF_CONSTRAINED_BASELINE:
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
*profile_level_val =&nbsp; 
compat_keys.kVTProfileLevel_H264_ConstrainedBaseline_AutoLevel;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;
+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case H264_PROF_MAIN:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; switch 
(vtctx-&gt;level) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 case&nbsp; 0: *profile_level_val =
@@ -805,6 +815,11 @@ static bool get_vt_h264_profile_level(AVCodecContext 
*avctx,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 compat_keys.kVTProfileLevel_H264_High_5_2;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
break;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case H264_PROF_CONSTRAINED_HIGH:
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
*profile_level_val =&nbsp; 
compat_keys.kVTProfileLevel_H264_ConstrainedHigh_AutoLevel;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;
+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case H264_PROF_EXTENDED:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; switch 
(vtctx-&gt;level) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 case&nbsp; 0: *profile_level_val =
@@ -2757,10 +2772,12 @@ static const enum AVPixelFormat prores_pix_fmts[] = {
&nbsp;#define OFFSET(x) offsetof(VTEncContext, x)
&nbsp;static const AVOption h264_options[] = {
&nbsp;&nbsp;&nbsp;&nbsp; { "profile", "Profile", OFFSET(profile), 
AV_OPT_TYPE_INT64, { .i64 = H264_PROF_AUTO }, H264_PROF_AUTO, H264_PROF_COUNT, 
VE, "profile" },
-&nbsp;&nbsp;&nbsp; { "baseline", "Baseline Profile", 0, AV_OPT_TYPE_CONST, { 
.i64 = H264_PROF_BASELINE }, INT_MIN, INT_MAX, VE, "profile" },
-&nbsp;&nbsp;&nbsp; { "main",&nbsp;&nbsp;&nbsp;&nbsp; "Main 
Profile",&nbsp;&nbsp;&nbsp;&nbsp; 0, AV_OPT_TYPE_CONST, { .i64 = 
H264_PROF_MAIN&nbsp;&nbsp;&nbsp;&nbsp; }, INT_MIN, INT_MAX, VE, "profile" },
-&nbsp;&nbsp;&nbsp; { "high",&nbsp;&nbsp;&nbsp;&nbsp; "High 
Profile",&nbsp;&nbsp;&nbsp;&nbsp; 0, AV_OPT_TYPE_CONST, { .i64 = 
H264_PROF_HIGH&nbsp;&nbsp;&nbsp;&nbsp; }, INT_MIN, INT_MAX, VE, "profile" },
-&nbsp;&nbsp;&nbsp; { "extended", "Extend Profile",&nbsp;&nbsp; 0, 
AV_OPT_TYPE_CONST, { .i64 = H264_PROF_EXTENDED }, INT_MIN, INT_MAX, VE, 
"profile" },
+&nbsp;&nbsp;&nbsp; { 
"baseline",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 "Baseline 
Profile",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 0, AV_OPT_TYPE_CONST, { .i64 = 
H264_PROF_BASELINE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 }, INT_MIN, INT_MAX, VE, "profile" },
+&nbsp;&nbsp;&nbsp; { "constrained_baseline", "Constrained_Baseline Profile", 
0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_CONSTRAINED_BASELINE }, INT_MIN, 
INT_MAX, VE, "profile" },
+&nbsp;&nbsp;&nbsp; { 
"main",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 "Main 
Profile",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 0, AV_OPT_TYPE_CONST, { .i64 = 
H264_PROF_MAIN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 }, INT_MIN, INT_MAX, VE, "profile" },
+&nbsp;&nbsp;&nbsp; { 
"high",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 "High 
Profile",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 0, AV_OPT_TYPE_CONST, { .i64 = 
H264_PROF_HIGH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 }, INT_MIN, INT_MAX, VE, "profile" },
+&nbsp;&nbsp;&nbsp; { "constrained_high",&nbsp;&nbsp;&nbsp;&nbsp; 
"Constrained_High Profile",&nbsp;&nbsp;&nbsp;&nbsp; 0, AV_OPT_TYPE_CONST, { 
.i64 = H264_PROF_CONSTRAINED_HIGH&nbsp;&nbsp;&nbsp;&nbsp; }, INT_MIN, INT_MAX, 
VE, "profile" },
+&nbsp;&nbsp;&nbsp; { 
"extended",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 "Extend 
Profile",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 0, AV_OPT_TYPE_CONST, { .i64 = 
H264_PROF_EXTENDED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 }, INT_MIN, INT_MAX, VE, "profile" },
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; { "level", "Level", OFFSET(level), AV_OPT_TYPE_INT, { 
.i64 = 0 }, 0, 52, VE, "level" },
&nbsp;&nbsp;&nbsp;&nbsp; { "1.3", "Level 1.3, only available with Baseline 
Profile", 0, AV_OPT_TYPE_CONST, { .i64 = 13 }, INT_MIN, INT_MAX, VE, "level" },
-- 
2.32.0 (Apple Git-132)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to