Re: [FFmpeg-devel] [PATCH 1/2] vaapi_h264: Add named options for setting profile and level
On 04/12/17 05:25, Li, Zhong wrote: >> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf >> Of Mark Thompson >> Sent: Saturday, December 2, 2017 11:36 PM >> To: ffmpeg-devel@ffmpeg.org >> Subject: Re: [FFmpeg-devel] [PATCH 1/2] vaapi_h264: Add named options for >> setting profile and level >> >> On 01/12/17 05:24, Li, Zhong wrote: >>>> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On >> Behalf >>>> Of Moritz Barsnick >>>> Sent: Thursday, November 30, 2017 10:33 PM >>>> To: FFmpeg development discussions and patches >>>> >>>> Subject: Re: [FFmpeg-devel] [PATCH 1/2] vaapi_h264: Add named options >>>> for setting profile and level >>>> >>>> On Thu, Nov 30, 2017 at 08:52:21 +, Li, Zhong wrote: >>>>>> +{ LEVEL("6", 60) }, >>>>>> +{ LEVEL("6.1", 61) }, >>>>>> +{ LEVEL("6.2", 62) }, >>>>> >>>>> IIRC, level 5.2 is the maximum level of H264? >>>> >>>> Higher levels were introduced in 2016. Edition V12 of H.264 lists 6, >>>> 6.1 and 6.2 in Annex A, Table A-1. It basically lists the same thing >>>> as >>>> Wikipedia: >>>> https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels >>> >>> Exactly. >> To clarify, are you happy with this patch and the matching one for H.265 >> now? > > Yeah, LGTM. > For h265, level_idc is not set by avctx->level in libx265, so we can just > make it consistent with nvenc instead of libx264. Yep. Applied; thank you! - Mark ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] vaapi_h264: Add named options for setting profile and level
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf > Of Mark Thompson > Sent: Saturday, December 2, 2017 11:36 PM > To: ffmpeg-devel@ffmpeg.org > Subject: Re: [FFmpeg-devel] [PATCH 1/2] vaapi_h264: Add named options for > setting profile and level > > On 01/12/17 05:24, Li, Zhong wrote: > >> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On > Behalf > >> Of Moritz Barsnick > >> Sent: Thursday, November 30, 2017 10:33 PM > >> To: FFmpeg development discussions and patches > >> > >> Subject: Re: [FFmpeg-devel] [PATCH 1/2] vaapi_h264: Add named options > >> for setting profile and level > >> > >> On Thu, Nov 30, 2017 at 08:52:21 +, Li, Zhong wrote: > >>>> +{ LEVEL("6", 60) }, > >>>> +{ LEVEL("6.1", 61) }, > >>>> +{ LEVEL("6.2", 62) }, > >>> > >>> IIRC, level 5.2 is the maximum level of H264? > >> > >> Higher levels were introduced in 2016. Edition V12 of H.264 lists 6, > >> 6.1 and 6.2 in Annex A, Table A-1. It basically lists the same thing > >> as > >> Wikipedia: > >> https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels > > > > Exactly. > To clarify, are you happy with this patch and the matching one for H.265 > now? Yeah, LGTM. For h265, level_idc is not set by avctx->level in libx265, so we can just make it consistent with nvenc instead of libx264. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] vaapi_h264: Add named options for setting profile and level
On 01/12/17 05:24, Li, Zhong wrote: >> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf >> Of Moritz Barsnick >> Sent: Thursday, November 30, 2017 10:33 PM >> To: FFmpeg development discussions and patches >> >> Subject: Re: [FFmpeg-devel] [PATCH 1/2] vaapi_h264: Add named options for >> setting profile and level >> >> On Thu, Nov 30, 2017 at 08:52:21 +, Li, Zhong wrote: >>>> +{ LEVEL("6", 60) }, >>>> +{ LEVEL("6.1", 61) }, >>>> +{ LEVEL("6.2", 62) }, >>> >>> IIRC, level 5.2 is the maximum level of H264? >> >> Higher levels were introduced in 2016. Edition V12 of H.264 lists 6, >> 6.1 and 6.2 in Annex A, Table A-1. It basically lists the same thing as >> Wikipedia: >> https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels > > Exactly. To clarify, are you happy with this patch and the matching one for H.265 now? Thanks, - Mark ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] vaapi_h264: Add named options for setting profile and level
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf > Of Moritz Barsnick > Sent: Thursday, November 30, 2017 10:33 PM > To: FFmpeg development discussions and patches > > Subject: Re: [FFmpeg-devel] [PATCH 1/2] vaapi_h264: Add named options for > setting profile and level > > On Thu, Nov 30, 2017 at 08:52:21 +, Li, Zhong wrote: > > > +{ LEVEL("6", 60) }, > > > +{ LEVEL("6.1", 61) }, > > > +{ LEVEL("6.2", 62) }, > > > > IIRC, level 5.2 is the maximum level of H264? > > Higher levels were introduced in 2016. Edition V12 of H.264 lists 6, > 6.1 and 6.2 in Annex A, Table A-1. It basically lists the same thing as > Wikipedia: > https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels Exactly. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] vaapi_h264: Add named options for setting profile and level
On Thu, Nov 30, 2017 at 08:52:21 +, Li, Zhong wrote: > > +{ LEVEL("6", 60) }, > > +{ LEVEL("6.1", 61) }, > > +{ LEVEL("6.2", 62) }, > > IIRC, level 5.2 is the maximum level of H264? Higher levels were introduced in 2016. Edition V12 of H.264 lists 6, 6.1 and 6.2 in Annex A, Table A-1. It basically lists the same thing as Wikipedia: https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels Moritz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] vaapi_h264: Add named options for setting profile and level
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf > Of Mark Thompson > +#define LEVEL(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \ > + { .i64 = value }, 0, 0, FLAGS, "level" > +{ LEVEL("1", 10) }, > +{ LEVEL("1.1", 11) }, > +{ LEVEL("1.2", 12) }, > +{ LEVEL("1.3", 13) }, > +{ LEVEL("2", 20) }, > +{ LEVEL("2.1", 21) }, > +{ LEVEL("2.2", 22) }, > +{ LEVEL("3", 30) }, > +{ LEVEL("3.1", 31) }, > +{ LEVEL("3.2", 32) }, > +{ LEVEL("4", 40) }, > +{ LEVEL("4.1", 41) }, > +{ LEVEL("4.2", 42) }, > +{ LEVEL("5", 50) }, > +{ LEVEL("5.1", 51) }, > +{ LEVEL("5.2", 52) }, > +{ LEVEL("6", 60) }, > +{ LEVEL("6.1", 61) }, > +{ LEVEL("6.2", 62) }, IIRC, level 5.2 is the maximum level of H264? > +#undef LEVEL > + > { NULL }, > }; ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] vaapi_h264: Add named options for setting profile and level
--- libavcodec/vaapi_encode_h264.c | 48 -- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c index 5fd0bf7796..6940823b8e 100644 --- a/libavcodec/vaapi_encode_h264.c +++ b/libavcodec/vaapi_encode_h264.c @@ -93,6 +93,8 @@ typedef struct VAAPIEncodeH264Options { int coder; int aud; int sei; +int profile; +int level; } VAAPIEncodeH264Options; @@ -886,6 +888,11 @@ static av_cold int vaapi_encode_h264_init(AVCodecContext *avctx) ctx->codec = &vaapi_encode_type_h264; +if (avctx->profile == FF_PROFILE_UNKNOWN) +avctx->profile = opt->profile; +if (avctx->level == FF_LEVEL_UNKNOWN) +avctx->level = opt->level; + switch (avctx->profile) { case FF_PROFILE_H264_BASELINE: av_log(avctx, AV_LOG_WARNING, "H.264 baseline profile is not " @@ -1010,12 +1017,49 @@ static const AVOption vaapi_encode_h264_options[] = { { "recovery_point", "Include recovery points where appropriate", 0, AV_OPT_TYPE_CONST, { .i64 = SEI_RECOVERY_POINT }, INT_MIN, INT_MAX, FLAGS, "sei" }, + +{ "profile", "Set profile (profile_idc and constraint_set*_flag)", + OFFSET(profile), AV_OPT_TYPE_INT, + { .i64 = FF_PROFILE_H264_HIGH }, 0x, 0x, FLAGS, "profile" }, + +#define PROFILE(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \ + { .i64 = value }, 0, 0, FLAGS, "profile" +{ PROFILE("constrained_baseline", FF_PROFILE_H264_CONSTRAINED_BASELINE) }, +{ PROFILE("main", FF_PROFILE_H264_MAIN) }, +{ PROFILE("high", FF_PROFILE_H264_HIGH) }, +#undef PROFILE + +{ "level", "Set level (level_idc)", + OFFSET(level), AV_OPT_TYPE_INT, + { .i64 = 51 }, 0x00, 0xff, FLAGS, "level" }, + +#define LEVEL(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \ + { .i64 = value }, 0, 0, FLAGS, "level" +{ LEVEL("1", 10) }, +{ LEVEL("1.1", 11) }, +{ LEVEL("1.2", 12) }, +{ LEVEL("1.3", 13) }, +{ LEVEL("2", 20) }, +{ LEVEL("2.1", 21) }, +{ LEVEL("2.2", 22) }, +{ LEVEL("3", 30) }, +{ LEVEL("3.1", 31) }, +{ LEVEL("3.2", 32) }, +{ LEVEL("4", 40) }, +{ LEVEL("4.1", 41) }, +{ LEVEL("4.2", 42) }, +{ LEVEL("5", 50) }, +{ LEVEL("5.1", 51) }, +{ LEVEL("5.2", 52) }, +{ LEVEL("6", 60) }, +{ LEVEL("6.1", 61) }, +{ LEVEL("6.2", 62) }, +#undef LEVEL + { NULL }, }; static const AVCodecDefault vaapi_encode_h264_defaults[] = { -{ "profile","100" }, -{ "level", "51" }, { "b", "0" }, { "bf", "2" }, { "g", "120" }, -- 2.11.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel