* [FFmpeg-devel] [PATCH 2/3] avcodec/videotoolboxenc: remove AUTO_PROFILE define
[not found] <20230609111455.17989-1-quinkblack@foxmail.com>
@ 2023-06-09 11:14 ` Zhao Zhili
2023-06-24 9:21 ` Tomas Härdin
2023-06-09 11:14 ` [FFmpeg-devel] [PATCH 3/3] avcodec/videotoolboxenc: inherit profile from AVCodecContext Zhao Zhili
1 sibling, 1 reply; 4+ messages in thread
From: Zhao Zhili @ 2023-06-09 11:14 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
From: Zhao Zhili <zhilizhao@tencent.com>
Use FF_PROFILE_UNKNOWN as auto mode.
---
libavcodec/videotoolboxenc.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
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" },
--
2.40.1
_______________________________________________
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".
^ permalink raw reply [flat|nested] 4+ messages in thread
* [FFmpeg-devel] [PATCH 3/3] avcodec/videotoolboxenc: inherit profile from AVCodecContext
[not found] <20230609111455.17989-1-quinkblack@foxmail.com>
2023-06-09 11:14 ` [FFmpeg-devel] [PATCH 2/3] avcodec/videotoolboxenc: remove AUTO_PROFILE define Zhao Zhili
@ 2023-06-09 11:14 ` Zhao Zhili
1 sibling, 0 replies; 4+ messages in thread
From: Zhao Zhili @ 2023-06-09 11:14 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
From: Zhao Zhili <zhilizhao@tencent.com>
This can happen when user set the avctx->profile field directly
instead of specify profile via option.
---
libavcodec/videotoolboxenc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 9f65519700..a313087876 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -1746,6 +1746,9 @@ static av_cold int vtenc_init(AVCodecContext *avctx)
pthread_mutex_init(&vtctx->lock, NULL);
pthread_cond_init(&vtctx->cv_sample_sent, NULL);
+ // It can happen when user set avctx->profile directly.
+ if (vtctx->profile == FF_PROFILE_UNKNOWN)
+ vtctx->profile = avctx->profile;
vtctx->session = NULL;
status = vtenc_configure_encoder(avctx);
if (status) return status;
--
2.40.1
_______________________________________________
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".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/3] avcodec/videotoolboxenc: remove AUTO_PROFILE define
2023-06-09 11:14 ` [FFmpeg-devel] [PATCH 2/3] avcodec/videotoolboxenc: remove AUTO_PROFILE define Zhao Zhili
@ 2023-06-24 9:21 ` Tomas Härdin
2023-06-25 6:48 ` "zhilizhao(赵志立)"
0 siblings, 1 reply; 4+ messages in thread
From: Tomas Härdin @ 2023-06-24 9:21 UTC (permalink / raw)
To: FFmpeg development discussions and patches
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
_______________________________________________
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".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/3] avcodec/videotoolboxenc: remove AUTO_PROFILE define
2023-06-24 9:21 ` Tomas Härdin
@ 2023-06-25 6:48 ` "zhilizhao(赵志立)"
0 siblings, 0 replies; 4+ messages in thread
From: "zhilizhao(赵志立)" @ 2023-06-25 6:48 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> 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".
_______________________________________________
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".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-06-25 6:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20230609111455.17989-1-quinkblack@foxmail.com>
2023-06-09 11:14 ` [FFmpeg-devel] [PATCH 2/3] avcodec/videotoolboxenc: remove AUTO_PROFILE define Zhao Zhili
2023-06-24 9:21 ` Tomas Härdin
2023-06-25 6:48 ` "zhilizhao(赵志立)"
2023-06-09 11:14 ` [FFmpeg-devel] [PATCH 3/3] avcodec/videotoolboxenc: inherit profile from AVCodecContext Zhao Zhili
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git