diff mbox series

[FFmpeg-devel,2/3] avcodec/videotoolboxenc: remove AUTO_PROFILE define

Message ID tencent_CEAC40EF9AEF9F7FAB4E4EB670572D039A08@qq.com
State Accepted
Commit 3fafc842f191454313f9e0b92f62148b2e328c97
Headers show
Series [FFmpeg-devel,1/3] avcodec/videotoolboxenc: use int as the type of profile | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Zhao Zhili June 9, 2023, 11:14 a.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

Use FF_PROFILE_UNKNOWN as auto mode.
---
 libavcodec/videotoolboxenc.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Tomas Härdin June 24, 2023, 9:21 a.m. UTC | #1
fre 2023-06-09 klockan 19:14 +0800 skrev Zhao Zhili:
> From: Zhao Zhili <zhilizhao@tencent.com>
> 
> Use FF_PROFILE_UNKNOWN as auto mode.

Won't this break code that relies on AUTO_PROFILE? On the other hand
zero refers to profiles that actually exist such as profile0 for vp9,
so the old behavior is kinda bad.

/Tomas
Zhao Zhili June 25, 2023, 6:48 a.m. UTC | #2
> On Jun 24, 2023, at 17:21, Tomas Härdin <git@haerdin.se> wrote:
> 
> fre 2023-06-09 klockan 19:14 +0800 skrev Zhao Zhili:
>> From: Zhao Zhili <zhilizhao@tencent.com>
>> 
>> Use FF_PROFILE_UNKNOWN as auto mode.
> 
> Won't this break code that relies on AUTO_PROFILE? On the other hand

If you mean that setting profile via the integer number is broken, I had
the same consideration. Rick said "Only the string representation of the
profiles are documented. The mapping from integer to profile isn’t.”
I agree on this simple case.

http://ffmpeg.org/pipermail/ffmpeg-devel/2023-May/310074.html

> zero refers to profiles that actually exist such as profile0 for vp9,
> so the old behavior is kinda bad.
> 
> /Tomas
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 26485a3dea..9f65519700 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -206,7 +206,6 @@  static void loadVTEncSymbols(void){
     GET_SYM(kVTCompressionPropertyKey_MinAllowedFrameQP, "MinAllowedFrameQP");
 }
 
-#define AUTO_PROFILE 0
 #define H264_PROFILE_CONSTRAINED_HIGH (FF_PROFILE_H264_HIGH | FF_PROFILE_H264_CONSTRAINED)
 
 typedef enum VTH264Entropy{
@@ -737,7 +736,7 @@  static bool get_vt_h264_profile_level(AVCodecContext *avctx,
     VTEncContext *vtctx = avctx->priv_data;
     int profile = vtctx->profile;
 
-    if (profile == AUTO_PROFILE && vtctx->level) {
+    if (profile == FF_PROFILE_UNKNOWN && vtctx->level) {
         //Need to pick a profile if level is not auto-selected.
         profile = vtctx->has_b_frames ? FF_PROFILE_H264_MAIN : FF_PROFILE_H264_BASELINE;
     }
@@ -745,7 +744,7 @@  static bool get_vt_h264_profile_level(AVCodecContext *avctx,
     *profile_level_val = NULL;
 
     switch (profile) {
-        case AUTO_PROFILE:
+        case FF_PROFILE_UNKNOWN:
             return true;
 
         case FF_PROFILE_H264_BASELINE:
@@ -869,7 +868,7 @@  static bool get_vt_hevc_profile_level(AVCodecContext *avctx,
     *profile_level_val = NULL;
 
     switch (profile) {
-        case AUTO_PROFILE:
+        case FF_PROFILE_UNKNOWN:
             return true;
         case FF_PROFILE_HEVC_MAIN:
             *profile_level_val =
@@ -2891,7 +2890,7 @@  static const enum AVPixelFormat prores_pix_fmts[] = {
 
 #define OFFSET(x) offsetof(VTEncContext, x)
 static const AVOption h264_options[] = {
-    { "profile", "Profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = AUTO_PROFILE }, 0, INT_MAX, VE, "profile" },
+    { "profile", "Profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, INT_MAX, VE, "profile" },
     { "baseline",             "Baseline Profile",             0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_BASELINE             }, INT_MIN, INT_MAX, VE, "profile" },
     { "constrained_baseline", "Constrained Baseline Profile", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_CONSTRAINED_BASELINE }, INT_MIN, INT_MAX, VE, "profile" },
     { "main",                 "Main Profile",                 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_MAIN                 }, INT_MIN, INT_MAX, VE, "profile" },
@@ -2948,7 +2947,7 @@  const FFCodec ff_h264_videotoolbox_encoder = {
 };
 
 static const AVOption hevc_options[] = {
-    { "profile", "Profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = AUTO_PROFILE }, 0, INT_MAX, VE, "profile" },
+    { "profile", "Profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, INT_MAX, VE, "profile" },
     { "main",     "Main Profile",     0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_HEVC_MAIN    }, INT_MIN, INT_MAX, VE, "profile" },
     { "main10",   "Main10 Profile",   0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_HEVC_MAIN_10 }, INT_MIN, INT_MAX, VE, "profile" },