summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2018-09-18 23:30:41 +0100
committerMark Thompson <sw@jkqxz.net>2018-09-23 14:42:33 +0100
commitaa2563aecc0f9f495d581e3072f76e3c59b0fd59 (patch)
tree0e77921cb889a8a306b8942a2b94d7a6fa89b697 /libavcodec
parent3b188666f19a17d15efb7eae590e988832972666 (diff)
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.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/vaapi_encode.h9
-rw-r--r--libavcodec/vaapi_encode_h264.c8
-rw-r--r--libavcodec/vaapi_encode_h265.c2
-rw-r--r--libavcodec/vaapi_encode_vp8.c1
-rw-r--r--libavcodec/vaapi_encode_vp9.c1
5 files changed, 15 insertions, 6 deletions
diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
index 0da8e356f0..30c3f7fbec 100644
--- a/libavcodec/vaapi_encode.h
+++ b/libavcodec/vaapi_encode.h
@@ -298,4 +298,13 @@ int ff_vaapi_encode2(AVCodecContext *avctx, AVPacket *pkt,
int ff_vaapi_encode_init(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 */
diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index 456806032b..5ef72b222d 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -52,7 +52,6 @@ typedef struct VAAPIEncodeH264Context {
// User options.
int qp;
int quality;
- int low_power;
int coder;
int aud;
int sei;
@@ -936,8 +935,6 @@ static av_cold int vaapi_encode_h264_init(AVCodecContext *avctx)
return AVERROR_PATCHWELCOME;
}
- ctx->low_power = priv->low_power;
-
if (avctx->bit_rate > 0) {
if (avctx->rc_max_rate == avctx->bit_rate)
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 FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
static const AVOption vaapi_encode_h264_options[] = {
+ VAAPI_ENCODE_COMMON_OPTIONS,
+
{ "qp", "Constant QP (for P-frames; scaled by qfactor/qoffset for I/B)",
OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 20 }, 0, 52, FLAGS },
{ "quality", "Set encode quality (trades off against speed, higher is faster)",
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",
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" },
diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index 9fa16593d0..b8b66b87cb 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -1099,6 +1099,8 @@ static av_cold int vaapi_encode_h265_close(AVCodecContext *avctx)
#define OFFSET(x) offsetof(VAAPIEncodeH265Context, x)
#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
static const AVOption vaapi_encode_h265_options[] = {
+ VAAPI_ENCODE_COMMON_OPTIONS,
+
{ "qp", "Constant QP (for P-frames; scaled by qfactor/qoffset for I/B)",
OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 25 }, 0, 52, FLAGS },
diff --git a/libavcodec/vaapi_encode_vp8.c b/libavcodec/vaapi_encode_vp8.c
index a502df7885..9588826bfb 100644
--- a/libavcodec/vaapi_encode_vp8.c
+++ b/libavcodec/vaapi_encode_vp8.c
@@ -228,6 +228,7 @@ static av_cold int vaapi_encode_vp8_init(AVCodecContext *avctx)
#define OFFSET(x) offsetof(VAAPIEncodeVP8Context, x)
#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
static const AVOption vaapi_encode_vp8_options[] = {
+ VAAPI_ENCODE_COMMON_OPTIONS,
{ "loop_filter_level", "Loop filter level",
OFFSET(loop_filter_level), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, 63, FLAGS },
{ "loop_filter_sharpness", "Loop filter sharpness",
diff --git a/libavcodec/vaapi_encode_vp9.c b/libavcodec/vaapi_encode_vp9.c
index 88c0ce3b0a..4d7cec0520 100644
--- a/libavcodec/vaapi_encode_vp9.c
+++ b/libavcodec/vaapi_encode_vp9.c
@@ -251,6 +251,7 @@ static av_cold int vaapi_encode_vp9_init(AVCodecContext *avctx)
#define OFFSET(x) offsetof(VAAPIEncodeVP9Context, x)
#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
static const AVOption vaapi_encode_vp9_options[] = {
+ VAAPI_ENCODE_COMMON_OPTIONS,
{ "loop_filter_level", "Loop filter level",
OFFSET(loop_filter_level), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, 63, FLAGS },
{ "loop_filter_sharpness", "Loop filter sharpness",