* [FFmpeg-devel] [PATCH v1] lavc/vaapi_encode_av1: Add qp option explicitly to set base q index @ 2023-11-27 0:58 fei.w.wang-at-intel.com 2023-11-27 13:36 ` Mark Thompson 0 siblings, 1 reply; 4+ messages in thread From: fei.w.wang-at-intel.com @ 2023-11-27 0:58 UTC (permalink / raw) To: ffmpeg-devel; +Cc: fei.w.wang From: Fei Wang <fei.w.wang@intel.com> Keep same way with librav1e/libsvtav1/qsv_av1.. to make it more acceptable instead of using global option "-global_quality". Fix #10615 Signed-off-by: Fei Wang <fei.w.wang@intel.com> --- doc/encoders.texi | 1 + libavcodec/vaapi_encode_av1.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 27a9acf076..2cffc32daf 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -4079,6 +4079,7 @@ Each encoder also has its own specific options: @table @option @item av1_vaapi +@option{qp} sets the value of @emph{base_q_index}. @option{profile} sets the value of @emph{seq_profile}. @option{tier} sets the value of @emph{seq_tier}. @option{level} sets the value of @emph{seq_level_idx}. diff --git a/libavcodec/vaapi_encode_av1.c b/libavcodec/vaapi_encode_av1.c index 5a9ff0f798..2e327fec5a 100644 --- a/libavcodec/vaapi_encode_av1.c +++ b/libavcodec/vaapi_encode_av1.c @@ -79,6 +79,7 @@ typedef struct VAAPIEncodeAV1Context { int cdef_param_size; /** user options */ + int qp; int profile; int level; int tier; @@ -786,6 +787,9 @@ static av_cold int vaapi_encode_av1_init(AVCodecContext *avctx) return AVERROR(EINVAL); } + if (priv->qp > 0) + ctx->explicit_qp = priv->qp; + ret = ff_vaapi_encode_init(avctx); if (ret < 0) return ret; @@ -864,6 +868,8 @@ static av_cold int vaapi_encode_av1_close(AVCodecContext *avctx) static const AVOption vaapi_encode_av1_options[] = { VAAPI_ENCODE_COMMON_OPTIONS, VAAPI_ENCODE_RC_OPTIONS, + { "qp", "Base q index (for P-frames; scaled by qfactor/qoffset for I/B)", + OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 255, FLAGS }, { "profile", "Set profile (seq_profile)", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = AV_PROFILE_UNKNOWN }, AV_PROFILE_UNKNOWN, 0xff, FLAGS, "profile" }, -- 2.25.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 v1] lavc/vaapi_encode_av1: Add qp option explicitly to set base q index 2023-11-27 0:58 [FFmpeg-devel] [PATCH v1] lavc/vaapi_encode_av1: Add qp option explicitly to set base q index fei.w.wang-at-intel.com @ 2023-11-27 13:36 ` Mark Thompson 2023-11-28 3:15 ` Xiang, Haihao 0 siblings, 1 reply; 4+ messages in thread From: Mark Thompson @ 2023-11-27 13:36 UTC (permalink / raw) To: ffmpeg-devel On 27/11/2023 00:58, fei.w.wang-at-intel.com@ffmpeg.org wrote: > From: Fei Wang <fei.w.wang@intel.com> > > Keep same way with librav1e/libsvtav1/qsv_av1.. to make it more > acceptable instead of using global option "-global_quality". > > Fix #10615 > > Signed-off-by: Fei Wang <fei.w.wang@intel.com> > --- > doc/encoders.texi | 1 + > libavcodec/vaapi_encode_av1.c | 6 ++++++ > 2 files changed, 7 insertions(+) > > diff --git a/doc/encoders.texi b/doc/encoders.texi > index 27a9acf076..2cffc32daf 100644 > --- a/doc/encoders.texi > +++ b/doc/encoders.texi > @@ -4079,6 +4079,7 @@ Each encoder also has its own specific options: > @table @option > > @item av1_vaapi > +@option{qp} sets the value of @emph{base_q_index}. > @option{profile} sets the value of @emph{seq_profile}. > @option{tier} sets the value of @emph{seq_tier}. > @option{level} sets the value of @emph{seq_level_idx}. > diff --git a/libavcodec/vaapi_encode_av1.c b/libavcodec/vaapi_encode_av1.c > index 5a9ff0f798..2e327fec5a 100644 > --- a/libavcodec/vaapi_encode_av1.c > +++ b/libavcodec/vaapi_encode_av1.c > @@ -79,6 +79,7 @@ typedef struct VAAPIEncodeAV1Context { > int cdef_param_size; > > /** user options */ > + int qp; > int profile; > int level; > int tier; > @@ -786,6 +787,9 @@ static av_cold int vaapi_encode_av1_init(AVCodecContext *avctx) > return AVERROR(EINVAL); > } > > + if (priv->qp > 0) > + ctx->explicit_qp = priv->qp; > + > ret = ff_vaapi_encode_init(avctx); > if (ret < 0) > return ret; > @@ -864,6 +868,8 @@ static av_cold int vaapi_encode_av1_close(AVCodecContext *avctx) > static const AVOption vaapi_encode_av1_options[] = { > VAAPI_ENCODE_COMMON_OPTIONS, > VAAPI_ENCODE_RC_OPTIONS, > + { "qp", "Base q index (for P-frames; scaled by qfactor/qoffset for I/B)", > + OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 255, FLAGS }, > { "profile", "Set profile (seq_profile)", > OFFSET(profile), AV_OPT_TYPE_INT, > { .i64 = AV_PROFILE_UNKNOWN }, AV_PROFILE_UNKNOWN, 0xff, FLAGS, "profile" }, Disagree; QP is not a concept in AV1. Further, your examples from other encoders do not have a consistent view of what it should mean. librav1e.c: { "qp", "use constant quantizer mode", OFFSET(quantizer), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 255, VE }, 0-255 is presumably the base_q_idx scale. libsvtav1.c: { "qp", "Initial Quantizer level value", OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 63, VE }, 0-63 is presumably the H.26x-qp-ish scale used by some VP9/AV1 encoders which maps nonlinearly to the internal scale. qsv_av1 doesn't seem to have such an option. Thanks, - Mark _______________________________________________ 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 v1] lavc/vaapi_encode_av1: Add qp option explicitly to set base q index 2023-11-27 13:36 ` Mark Thompson @ 2023-11-28 3:15 ` Xiang, Haihao 2023-12-19 6:18 ` Wang, Fei W 0 siblings, 1 reply; 4+ messages in thread From: Xiang, Haihao @ 2023-11-28 3:15 UTC (permalink / raw) To: ffmpeg-devel On Ma, 2023-11-27 at 13:36 +0000, Mark Thompson wrote: > On 27/11/2023 00:58, fei.w.wang-at-intel.com@ffmpeg.org wrote: > > From: Fei Wang <fei.w.wang@intel.com> > > > > Keep same way with librav1e/libsvtav1/qsv_av1.. to make it more > > acceptable instead of using global option "-global_quality". > > > > Fix #10615 > > > > Signed-off-by: Fei Wang <fei.w.wang@intel.com> > > --- > > doc/encoders.texi | 1 + > > libavcodec/vaapi_encode_av1.c | 6 ++++++ > > 2 files changed, 7 insertions(+) > > > > diff --git a/doc/encoders.texi b/doc/encoders.texi > > index 27a9acf076..2cffc32daf 100644 > > --- a/doc/encoders.texi > > +++ b/doc/encoders.texi > > @@ -4079,6 +4079,7 @@ Each encoder also has its own specific options: > > @table @option > > > > @item av1_vaapi > > +@option{qp} sets the value of @emph{base_q_index}. > > @option{profile} sets the value of @emph{seq_profile}. > > @option{tier} sets the value of @emph{seq_tier}. > > @option{level} sets the value of @emph{seq_level_idx}. > > diff --git a/libavcodec/vaapi_encode_av1.c b/libavcodec/vaapi_encode_av1.c > > index 5a9ff0f798..2e327fec5a 100644 > > --- a/libavcodec/vaapi_encode_av1.c > > +++ b/libavcodec/vaapi_encode_av1.c > > @@ -79,6 +79,7 @@ typedef struct VAAPIEncodeAV1Context { > > int cdef_param_size; > > > > /** user options */ > > + int qp; > > int profile; > > int level; > > int tier; > > @@ -786,6 +787,9 @@ static av_cold int vaapi_encode_av1_init(AVCodecContext > > *avctx) > > return AVERROR(EINVAL); > > } > > > > + if (priv->qp > 0) > > + ctx->explicit_qp = priv->qp; > > + > > ret = ff_vaapi_encode_init(avctx); > > if (ret < 0) > > return ret; > > @@ -864,6 +868,8 @@ static av_cold int vaapi_encode_av1_close(AVCodecContext > > *avctx) > > static const AVOption vaapi_encode_av1_options[] = { > > VAAPI_ENCODE_COMMON_OPTIONS, > > VAAPI_ENCODE_RC_OPTIONS, > > + { "qp", "Base q index (for P-frames; scaled by qfactor/qoffset for > > I/B)", > > + OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 255, FLAGS }, > > { "profile", "Set profile (seq_profile)", > > OFFSET(profile), AV_OPT_TYPE_INT, > > { .i64 = AV_PROFILE_UNKNOWN }, AV_PROFILE_UNKNOWN, 0xff, FLAGS, > > "profile" }, > > Disagree; QP is not a concept in AV1. Yes, it not a concept in AV1. nvenc h264/hevc/av1 encoders provide the same qp option: libavcodec/nvenc_av1.c: { "qp", "Constant quantization parameter rate control method", libavcodec/nvenc_h264.c: { "qp", "Constant quantization parameter rate control method", libavcodec/nvenc_hevc.c: { "qp", "Constant quantization parameter rate control method", May we provide the same qp option for vaapi h264/hevc/av1 encoders too? User will be able to use same options when using these encoders. Thanks Haihao > Further, your examples from other encoders do not have a consistent view of > what it should mean. > > librav1e.c: > > { "qp", "use constant quantizer mode", OFFSET(quantizer), > AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 255, VE }, > > 0-255 is presumably the base_q_idx scale. > > libsvtav1.c: > > { "qp", "Initial Quantizer level value", OFFSET(qp), > AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 63, VE }, > > 0-63 is presumably the H.26x-qp-ish scale used by some VP9/AV1 encoders which > maps nonlinearly to the internal scale. > > qsv_av1 doesn't seem to have such an option. > > Thanks, > > - Mark > _______________________________________________ > 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
* Re: [FFmpeg-devel] [PATCH v1] lavc/vaapi_encode_av1: Add qp option explicitly to set base q index 2023-11-28 3:15 ` Xiang, Haihao @ 2023-12-19 6:18 ` Wang, Fei W 0 siblings, 0 replies; 4+ messages in thread From: Wang, Fei W @ 2023-12-19 6:18 UTC (permalink / raw) To: ffmpeg-devel On Tue, 2023-11-28 at 03:15 +0000, Xiang, Haihao wrote: > On Ma, 2023-11-27 at 13:36 +0000, Mark Thompson wrote: > > On 27/11/2023 00:58, fei.w.wang-at-intel.com@ffmpeg.org wrote: > > > From: Fei Wang <fei.w.wang@intel.com> > > > > > > Keep same way with librav1e/libsvtav1/qsv_av1.. to make it more > > > acceptable instead of using global option "-global_quality". > > > > > > Fix #10615 > > > > > > Signed-off-by: Fei Wang <fei.w.wang@intel.com> > > > --- > > > doc/encoders.texi | 1 + > > > libavcodec/vaapi_encode_av1.c | 6 ++++++ > > > 2 files changed, 7 insertions(+) > > > > > > diff --git a/doc/encoders.texi b/doc/encoders.texi > > > index 27a9acf076..2cffc32daf 100644 > > > --- a/doc/encoders.texi > > > +++ b/doc/encoders.texi > > > @@ -4079,6 +4079,7 @@ Each encoder also has its own specific > > > options: > > > @table @option > > > > > > @item av1_vaapi > > > +@option{qp} sets the value of @emph{base_q_index}. > > > @option{profile} sets the value of @emph{seq_profile}. > > > @option{tier} sets the value of @emph{seq_tier}. > > > @option{level} sets the value of @emph{seq_level_idx}. > > > diff --git a/libavcodec/vaapi_encode_av1.c > > > b/libavcodec/vaapi_encode_av1.c > > > index 5a9ff0f798..2e327fec5a 100644 > > > --- a/libavcodec/vaapi_encode_av1.c > > > +++ b/libavcodec/vaapi_encode_av1.c > > > @@ -79,6 +79,7 @@ typedef struct VAAPIEncodeAV1Context { > > > int cdef_param_size; > > > > > > /** user options */ > > > + int qp; > > > int profile; > > > int level; > > > int tier; > > > @@ -786,6 +787,9 @@ static av_cold int > > > vaapi_encode_av1_init(AVCodecContext > > > *avctx) > > > return AVERROR(EINVAL); > > > } > > > > > > + if (priv->qp > 0) > > > + ctx->explicit_qp = priv->qp; > > > + > > > ret = ff_vaapi_encode_init(avctx); > > > if (ret < 0) > > > return ret; > > > @@ -864,6 +868,8 @@ static av_cold int > > > vaapi_encode_av1_close(AVCodecContext > > > *avctx) > > > static const AVOption vaapi_encode_av1_options[] = { > > > VAAPI_ENCODE_COMMON_OPTIONS, > > > VAAPI_ENCODE_RC_OPTIONS, > > > + { "qp", "Base q index (for P-frames; scaled by > > > qfactor/qoffset for > > > I/B)", > > > + OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 255, FLAGS > > > }, > > > { "profile", "Set profile (seq_profile)", > > > OFFSET(profile), AV_OPT_TYPE_INT, > > > { .i64 = AV_PROFILE_UNKNOWN }, AV_PROFILE_UNKNOWN, 0xff, > > > FLAGS, > > > "profile" }, > > > > Disagree; QP is not a concept in AV1. > > Yes, it not a concept in AV1. > > nvenc h264/hevc/av1 encoders provide the same qp option: > > libavcodec/nvenc_av1.c: { "qp", "Constant quantization > parameter > rate control method", > libavcodec/nvenc_h264.c: { "qp", "Constant quantization > parameter > rate control method", > libavcodec/nvenc_hevc.c: { "qp", "Constant quantization > parameter > rate control method", > > May we provide the same qp option for vaapi h264/hevc/av1 encoders > too? User > will be able to use same options when using these encoders. > > Thanks > Haihao > > > > Further, your examples from other encoders do not have a > > consistent view of > > what it should mean. We may also assign different meaning for different VAAPI encoder in its individual option description. And it may be more reasonable to use "-qp" together with "-rc_mode CQP" and "-i/b_qfactor/qoffset" options. Thanks Fei > > > > librav1e.c: > > > > { "qp", "use constant quantizer mode", OFFSET(quantizer), > > AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 255, VE }, > > > > 0-255 is presumably the base_q_idx scale. > > > > libsvtav1.c: > > > > { "qp", "Initial Quantizer level value", OFFSET(qp), > > AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 63, VE }, > > > > 0-63 is presumably the H.26x-qp-ish scale used by some VP9/AV1 > > encoders which > > maps nonlinearly to the internal scale. > > > > qsv_av1 doesn't seem to have such an option. > > > > Thanks, > > > > - Mark > > _______________________________________________ > > 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". _______________________________________________ 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-12-19 6:18 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-11-27 0:58 [FFmpeg-devel] [PATCH v1] lavc/vaapi_encode_av1: Add qp option explicitly to set base q index fei.w.wang-at-intel.com 2023-11-27 13:36 ` Mark Thompson 2023-11-28 3:15 ` Xiang, Haihao 2023-12-19 6:18 ` Wang, Fei W
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