Thank you for your review, Kern.
I will remove VT_H264Profile and VT_HEVCProfile, replace with avctx->profile.
And submit a new patch of CBP/CHP after that.




------------------ ???????? ------------------
??????:                                                                         
                                               "FFmpeg development discussions 
and patches"                                                                    
                <ker...@gmail.com&gt;;
????????:&nbsp;2023??5??21??(??????) ????9:07
??????:&nbsp;"??????"<839789...@qq.com&gt;;
????:&nbsp;"ffmpeg-devel"<ffmpeg-devel@ffmpeg.org&gt;;
????:&nbsp;Re: [FFmpeg-devel] [PATCH] avcodec/videotoolboxenc: add CBP/CHP 
profile



On Sun, May 21, 2023 at 7:22?6?2AM xufuji456 <839789...@qq.com&gt; wrote:

&gt; The CBP/CHP profile has available with H264 in iOS 15.0.
&gt; Official Doc:
&gt; 
https://developer.apple.com/documentation/videotoolbox/kvtprofilelevel_h264_constrainedbaseline_autolevel
&gt;
&gt; Signed-off-by: xufuji456 <839789...@qq.com&gt;
&gt; ---
&gt;&nbsp; libavcodec/videotoolboxenc.c | 24 ++++++++++++++++++++++--
&gt;&nbsp; 1 file changed, 22 insertions(+), 2 deletions(-)
&gt;
&gt; diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
&gt; index b017c90c36..6a9b19831b 100644
&gt; --- a/libavcodec/videotoolboxenc.c
&gt; +++ b/libavcodec/videotoolboxenc.c
&gt; @@ -108,6 +108,8 @@ static struct{
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CFStringRef 
kVTProfileLevel_H264_High_AutoLevel;
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CFStringRef 
kVTProfileLevel_H264_Extended_5_0;
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CFStringRef 
kVTProfileLevel_H264_Extended_AutoLevel;
&gt; +&nbsp;&nbsp;&nbsp; CFStringRef 
kVTProfileLevel_H264_ConstrainedBaseline_AutoLevel;
&gt; +&nbsp;&nbsp;&nbsp; CFStringRef 
kVTProfileLevel_H264_ConstrainedHigh_AutoLevel;
&gt;
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CFStringRef 
kVTProfileLevel_HEVC_Main_AutoLevel;
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CFStringRef 
kVTProfileLevel_HEVC_Main10_AutoLevel;
&gt; @@ -171,6 +173,8 @@ static void loadVTEncSymbols(void){
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GET_SYM(kVTProfileLevel_H264_High_AutoLevel,
&gt;&nbsp; "H264_High_AutoLevel");
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
GET_SYM(kVTProfileLevel_H264_Extended_5_0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
"H264_Extended_5_0");
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
GET_SYM(kVTProfileLevel_H264_Extended_AutoLevel,
&gt; "H264_Extended_AutoLevel");
&gt; +&nbsp;&nbsp;&nbsp; 
GET_SYM(kVTProfileLevel_H264_ConstrainedBaseline_AutoLevel,
&gt; "H264_ConstrainedBaseline_AutoLevel");
&gt; +&nbsp;&nbsp;&nbsp; GET_SYM(kVTProfileLevel_H264_ConstrainedHigh_AutoLevel,
&gt;&nbsp; "H264_ConstrainedHigh_AutoLevel");
&gt;
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GET_SYM(kVTProfileLevel_HEVC_Main_AutoLevel,
&gt;&nbsp; "HEVC_Main_AutoLevel");
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
GET_SYM(kVTProfileLevel_HEVC_Main10_AutoLevel,
&gt;&nbsp; "HEVC_Main10_AutoLevel");
&gt; @@ -743,8 +747,15 @@ static bool get_vt_h264_profile_level(AVCodecContext
&gt; *avctx,
&gt;
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 
H264_PROF_BASELINE:
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 switch (vtctx-&gt;level) {
&gt; 
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 case&nbsp; 0: *profile_level_val =
&gt; -
&gt; compat_keys.kVTProfileLevel_H264_Baseline_AutoLevel; break;
&gt; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 case&nbsp; 0: {
&gt; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 // check avctx-&gt;profile has been set
&gt; constrained_baseline
&gt; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 if (avctx-&gt;profile ==
&gt; FF_PROFILE_H264_CONSTRAINED_BASELINE) {
&gt;
The profiles need to be added to the list of usable profiles in
h264_options so they can be used on the command line.

Using the FF_PROFILE_ constants doesn't follow the pattern of using the
profile constants defined in this file, but I like your approach better. To
keep things consistent, either remove the constants in VT_H264Profile and
VT_HEVCProfile and replace them with global constants, or I can follow up
with a patch.


&gt; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 *profile_level_val =
&gt; compat_keys.kVTProfileLevel_H264_ConstrainedBaseline_AutoLevel;
&gt; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 } else {
&gt; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 *profile_level_val =
&gt; compat_keys.kVTProfileLevel_H264_Baseline_AutoLevel;
&gt; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 }
&gt; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 break;
&gt; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 }
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 case 13: *profile_level_val =
&gt; kVTProfileLevel_H264_Baseline_1_3;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
break;
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 case 30: *profile_level_val =
&gt; kVTProfileLevel_H264_Baseline_3_0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
break;
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 case 31: *profile_level_val =
&gt; kVTProfileLevel_H264_Baseline_3_1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
break;
&gt; @@ -784,6 +795,15 @@ static bool get_vt_h264_profile_level(AVCodecContext
&gt; *avctx,
&gt;
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case H264_PROF_HIGH:
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 switch (vtctx-&gt;level) {
&gt; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 case&nbsp; 0: {
&gt; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 // check avctx-&gt;profile has been set constrained_high
&gt; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 if (avctx-&gt;profile == (FF_PROFILE_H264_HIGH |
&gt; FF_PROFILE_H264_CONSTRAINED)) {
&gt; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 *profile_level_val =
&gt; compat_keys.kVTProfileLevel_H264_ConstrainedHigh_AutoLevel;
&gt; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 } else {
&gt; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 *profile_level_val =
&gt; compat_keys.kVTProfileLevel_H264_High_AutoLevel;
&gt; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 }
&gt; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 break;
&gt; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 }
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 case&nbsp; 0: *profile_level_val =
&gt;
&gt;&nbsp; compat_keys.kVTProfileLevel_H264_High_AutoLevel; break;
&gt;
This duplicate case 0 can be removed.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 case 30: *profile_level_val =
&gt; --
&gt; 2.32.0 (Apple Git-132)
&gt;
&gt;
_______________________________________________
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".
_______________________________________________
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