vaapi_encode: Add common options between all encoders
The only common option here is low_power - it was previously supported for H.264 only, that specific option is removed.
This commit is contained in:
parent
3b188666f1
commit
aa2563aecc
@ -2599,6 +2599,18 @@ Size / quality tradeoff: higher values are smaller / worse quality.
|
|||||||
@option{b_qoffset} / @option{b_quant_offset}
|
@option{b_qoffset} / @option{b_quant_offset}
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
|
All encoders support the following options:
|
||||||
|
@itemize
|
||||||
|
@item
|
||||||
|
@option{low_power}
|
||||||
|
|
||||||
|
Some drivers/platforms offer a second encoder for some codecs intended to use
|
||||||
|
less power than the default encoder; setting this option will attempt to use
|
||||||
|
that encoder. Note that it may support a reduced feature set, so some other
|
||||||
|
options may not be available in this mode.
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
Each encoder also has its own specific options:
|
||||||
@table @option
|
@table @option
|
||||||
|
|
||||||
@item h264_vaapi
|
@item h264_vaapi
|
||||||
@ -2606,8 +2618,6 @@ Size / quality tradeoff: higher values are smaller / worse quality.
|
|||||||
@option{level} sets the value of @emph{level_idc}.
|
@option{level} sets the value of @emph{level_idc}.
|
||||||
|
|
||||||
@table @option
|
@table @option
|
||||||
@item low_power
|
|
||||||
Use low-power encoding mode.
|
|
||||||
@item coder
|
@item coder
|
||||||
Set entropy encoder (default is @emph{cabac}). Possible values:
|
Set entropy encoder (default is @emph{cabac}). Possible values:
|
||||||
|
|
||||||
|
@ -298,4 +298,13 @@ int ff_vaapi_encode2(AVCodecContext *avctx, AVPacket *pkt,
|
|||||||
int ff_vaapi_encode_init(AVCodecContext *avctx);
|
int ff_vaapi_encode_init(AVCodecContext *avctx);
|
||||||
int ff_vaapi_encode_close(AVCodecContext *avctx);
|
int ff_vaapi_encode_close(AVCodecContext *avctx);
|
||||||
|
|
||||||
|
|
||||||
|
#define VAAPI_ENCODE_COMMON_OPTIONS \
|
||||||
|
{ "low_power", \
|
||||||
|
"Use low-power encoding mode (only available on some platforms; " \
|
||||||
|
"may not support all encoding features)", \
|
||||||
|
OFFSET(common.low_power), AV_OPT_TYPE_BOOL, \
|
||||||
|
{ .i64 = 0 }, 0, 1, FLAGS }
|
||||||
|
|
||||||
|
|
||||||
#endif /* AVCODEC_VAAPI_ENCODE_H */
|
#endif /* AVCODEC_VAAPI_ENCODE_H */
|
||||||
|
@ -52,7 +52,6 @@ typedef struct VAAPIEncodeH264Context {
|
|||||||
// User options.
|
// User options.
|
||||||
int qp;
|
int qp;
|
||||||
int quality;
|
int quality;
|
||||||
int low_power;
|
|
||||||
int coder;
|
int coder;
|
||||||
int aud;
|
int aud;
|
||||||
int sei;
|
int sei;
|
||||||
@ -936,8 +935,6 @@ static av_cold int vaapi_encode_h264_init(AVCodecContext *avctx)
|
|||||||
return AVERROR_PATCHWELCOME;
|
return AVERROR_PATCHWELCOME;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->low_power = priv->low_power;
|
|
||||||
|
|
||||||
if (avctx->bit_rate > 0) {
|
if (avctx->bit_rate > 0) {
|
||||||
if (avctx->rc_max_rate == avctx->bit_rate)
|
if (avctx->rc_max_rate == avctx->bit_rate)
|
||||||
ctx->va_rc_mode = VA_RC_CBR;
|
ctx->va_rc_mode = VA_RC_CBR;
|
||||||
@ -970,13 +967,12 @@ static av_cold int vaapi_encode_h264_close(AVCodecContext *avctx)
|
|||||||
#define OFFSET(x) offsetof(VAAPIEncodeH264Context, x)
|
#define OFFSET(x) offsetof(VAAPIEncodeH264Context, x)
|
||||||
#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
|
#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
|
||||||
static const AVOption vaapi_encode_h264_options[] = {
|
static const AVOption vaapi_encode_h264_options[] = {
|
||||||
|
VAAPI_ENCODE_COMMON_OPTIONS,
|
||||||
|
|
||||||
{ "qp", "Constant QP (for P-frames; scaled by qfactor/qoffset for I/B)",
|
{ "qp", "Constant QP (for P-frames; scaled by qfactor/qoffset for I/B)",
|
||||||
OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 20 }, 0, 52, FLAGS },
|
OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 20 }, 0, 52, FLAGS },
|
||||||
{ "quality", "Set encode quality (trades off against speed, higher is faster)",
|
{ "quality", "Set encode quality (trades off against speed, higher is faster)",
|
||||||
OFFSET(quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 8, FLAGS },
|
OFFSET(quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 8, FLAGS },
|
||||||
{ "low_power", "Use low-power encoding mode (experimental: only supported "
|
|
||||||
"on some platforms, does not support all features)",
|
|
||||||
OFFSET(low_power), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS },
|
|
||||||
{ "coder", "Entropy coder type",
|
{ "coder", "Entropy coder type",
|
||||||
OFFSET(coder), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, FLAGS, "coder" },
|
OFFSET(coder), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, FLAGS, "coder" },
|
||||||
{ "cavlc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, FLAGS, "coder" },
|
{ "cavlc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, FLAGS, "coder" },
|
||||||
|
@ -1099,6 +1099,8 @@ static av_cold int vaapi_encode_h265_close(AVCodecContext *avctx)
|
|||||||
#define OFFSET(x) offsetof(VAAPIEncodeH265Context, x)
|
#define OFFSET(x) offsetof(VAAPIEncodeH265Context, x)
|
||||||
#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
|
#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
|
||||||
static const AVOption vaapi_encode_h265_options[] = {
|
static const AVOption vaapi_encode_h265_options[] = {
|
||||||
|
VAAPI_ENCODE_COMMON_OPTIONS,
|
||||||
|
|
||||||
{ "qp", "Constant QP (for P-frames; scaled by qfactor/qoffset for I/B)",
|
{ "qp", "Constant QP (for P-frames; scaled by qfactor/qoffset for I/B)",
|
||||||
OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 25 }, 0, 52, FLAGS },
|
OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 25 }, 0, 52, FLAGS },
|
||||||
|
|
||||||
|
@ -228,6 +228,7 @@ static av_cold int vaapi_encode_vp8_init(AVCodecContext *avctx)
|
|||||||
#define OFFSET(x) offsetof(VAAPIEncodeVP8Context, x)
|
#define OFFSET(x) offsetof(VAAPIEncodeVP8Context, x)
|
||||||
#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
|
#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
|
||||||
static const AVOption vaapi_encode_vp8_options[] = {
|
static const AVOption vaapi_encode_vp8_options[] = {
|
||||||
|
VAAPI_ENCODE_COMMON_OPTIONS,
|
||||||
{ "loop_filter_level", "Loop filter level",
|
{ "loop_filter_level", "Loop filter level",
|
||||||
OFFSET(loop_filter_level), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, 63, FLAGS },
|
OFFSET(loop_filter_level), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, 63, FLAGS },
|
||||||
{ "loop_filter_sharpness", "Loop filter sharpness",
|
{ "loop_filter_sharpness", "Loop filter sharpness",
|
||||||
|
@ -251,6 +251,7 @@ static av_cold int vaapi_encode_vp9_init(AVCodecContext *avctx)
|
|||||||
#define OFFSET(x) offsetof(VAAPIEncodeVP9Context, x)
|
#define OFFSET(x) offsetof(VAAPIEncodeVP9Context, x)
|
||||||
#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
|
#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
|
||||||
static const AVOption vaapi_encode_vp9_options[] = {
|
static const AVOption vaapi_encode_vp9_options[] = {
|
||||||
|
VAAPI_ENCODE_COMMON_OPTIONS,
|
||||||
{ "loop_filter_level", "Loop filter level",
|
{ "loop_filter_level", "Loop filter level",
|
||||||
OFFSET(loop_filter_level), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, 63, FLAGS },
|
OFFSET(loop_filter_level), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, 63, FLAGS },
|
||||||
{ "loop_filter_sharpness", "Loop filter sharpness",
|
{ "loop_filter_sharpness", "Loop filter sharpness",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user