History

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.

Mark Thompson committed 8 years ago

Commit aa2563a1 parent 3b188666 files · +27 −8Browse files

Unified · Split

6 files
  1. doc/encoders.texi +12 −2
  2. libavcodec/vaapi_encode.h +9 −0
  3. libavcodec/vaapi_encode_h264.c +2 −6
  4. libavcodec/vaapi_encode_h265.c +2 −0
  5. libavcodec/vaapi_encode_vp8.c +1 −0
  6. libavcodec/vaapi_encode_vp9.c +1 −0
doc/encoders.texi+12−2
@@ -2599,6 +2599,18 @@ Size / quality tradeoff: higher values are smaller / worse quality. · 2598 unmodified lines
2599@option{b_qoffset} / @option{b_quant_offset}2599@option{b_qoffset} / @option{b_quant_offset}
2600@end itemize2600@end itemize
2601 2601
2602All encoders support the following options:
2603@itemize
2604@item
2605@option{low_power}
2606
2607Some drivers/platforms offer a second encoder for some codecs intended to use
2608less power than the default encoder; setting this option will attempt to use
2609that encoder. Note that it may support a reduced feature set, so some other
2610options may not be available in this mode.
2611@end itemize
2612
2613Each encoder also has its own specific options:
2602@table @option2614@table @option
2603 2615
2604@item h264_vaapi2616@item h264_vaapi
@@ -2606,8 +2618,6 @@ Size / quality tradeoff: higher values are smaller / worse quality. · 1 unmodified line
2606@option{level} sets the value of @emph{level_idc}.2618@option{level} sets the value of @emph{level_idc}.
2607 2619
2608@table @option2620@table @option
2609@item low_power
2610Use low-power encoding mode.
2611@item coder2621@item coder
2612Set entropy encoder (default is @emph{cabac}). Possible values:2622Set entropy encoder (default is @emph{cabac}). Possible values:
2613 2623
libavcodec/vaapi_encode.h+9−0
@@ -298,4 +298,13 @@ int ff_vaapi_encode2(AVCodecContext *avctx, AVPacket *pkt, · 297 unmodified lines
298int ff_vaapi_encode_init(AVCodecContext *avctx);298int ff_vaapi_encode_init(AVCodecContext *avctx);
299int ff_vaapi_encode_close(AVCodecContext *avctx);299int ff_vaapi_encode_close(AVCodecContext *avctx);
300 300
301
302#define VAAPI_ENCODE_COMMON_OPTIONS \
303 { "low_power", \
304 "Use low-power encoding mode (only available on some platforms; " \
305 "may not support all encoding features)", \
306 OFFSET(common.low_power), AV_OPT_TYPE_BOOL, \
307 { .i64 = 0 }, 0, 1, FLAGS }
308
309
301#endif /* AVCODEC_VAAPI_ENCODE_H */310#endif /* AVCODEC_VAAPI_ENCODE_H */
libavcodec/vaapi_encode_h264.c+2−6
@@ -52,7 +52,6 @@ typedef struct VAAPIEncodeH264Context { · 51 unmodified lines
52 // User options.52 // User options.
53 int qp;53 int qp;
54 int quality;54 int quality;
55 int low_power;
56 int coder;55 int coder;
57 int aud;56 int aud;
58 int sei;57 int sei;
@@ -936,8 +935,6 @@ static av_cold int vaapi_encode_h264_init(AVCodecContext *avctx) · 877 unmodified lines
936 return AVERROR_PATCHWELCOME;935 return AVERROR_PATCHWELCOME;
937 }936 }
938 937
939 ctx->low_power = priv->low_power;
940
941 if (avctx->bit_rate > 0) {938 if (avctx->bit_rate > 0) {
942 if (avctx->rc_max_rate == avctx->bit_rate)939 if (avctx->rc_max_rate == avctx->bit_rate)
943 ctx->va_rc_mode = VA_RC_CBR;940 ctx->va_rc_mode = VA_RC_CBR;
@@ -970,13 +967,12 @@ static av_cold int vaapi_encode_h264_close(AVCodecContext *avctx) · 26 unmodified lines
970#define OFFSET(x) offsetof(VAAPIEncodeH264Context, x)967#define OFFSET(x) offsetof(VAAPIEncodeH264Context, x)
971#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)968#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
972static const AVOption vaapi_encode_h264_options[] = {969static const AVOption vaapi_encode_h264_options[] = {
970 VAAPI_ENCODE_COMMON_OPTIONS,
971
973 { "qp", "Constant QP (for P-frames; scaled by qfactor/qoffset for I/B)",972 { "qp", "Constant QP (for P-frames; scaled by qfactor/qoffset for I/B)",
974 OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 20 }, 0, 52, FLAGS },973 OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 20 }, 0, 52, FLAGS },
975 { "quality", "Set encode quality (trades off against speed, higher is faster)",974 { "quality", "Set encode quality (trades off against speed, higher is faster)",
976 OFFSET(quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 8, FLAGS },975 OFFSET(quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 8, FLAGS },
977 { "low_power", "Use low-power encoding mode (experimental: only supported "
978 "on some platforms, does not support all features)",
979 OFFSET(low_power), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS },
980 { "coder", "Entropy coder type",976 { "coder", "Entropy coder type",
981 OFFSET(coder), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, FLAGS, "coder" },977 OFFSET(coder), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, FLAGS, "coder" },
982 { "cavlc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, FLAGS, "coder" },978 { "cavlc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, FLAGS, "coder" },
libavcodec/vaapi_encode_h265.c+2−0
@@ -1099,6 +1099,8 @@ static av_cold int vaapi_encode_h265_close(AVCodecContext *avctx) · 1098 unmodified lines
1099#define OFFSET(x) offsetof(VAAPIEncodeH265Context, x)1099#define OFFSET(x) offsetof(VAAPIEncodeH265Context, x)
1100#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)1100#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
1101static const AVOption vaapi_encode_h265_options[] = {1101static const AVOption vaapi_encode_h265_options[] = {
1102 VAAPI_ENCODE_COMMON_OPTIONS,
1103
1102 { "qp", "Constant QP (for P-frames; scaled by qfactor/qoffset for I/B)",1104 { "qp", "Constant QP (for P-frames; scaled by qfactor/qoffset for I/B)",
1103 OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 25 }, 0, 52, FLAGS },1105 OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 25 }, 0, 52, FLAGS },
1104 1106
libavcodec/vaapi_encode_vp8.c+1−0
@@ -228,6 +228,7 @@ static av_cold int vaapi_encode_vp8_init(AVCodecContext *avctx) · 227 unmodified lines
228#define OFFSET(x) offsetof(VAAPIEncodeVP8Context, x)228#define OFFSET(x) offsetof(VAAPIEncodeVP8Context, x)
229#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)229#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
230static const AVOption vaapi_encode_vp8_options[] = {230static const AVOption vaapi_encode_vp8_options[] = {
231 VAAPI_ENCODE_COMMON_OPTIONS,
231 { "loop_filter_level", "Loop filter level",232 { "loop_filter_level", "Loop filter level",
232 OFFSET(loop_filter_level), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, 63, FLAGS },233 OFFSET(loop_filter_level), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, 63, FLAGS },
233 { "loop_filter_sharpness", "Loop filter sharpness",234 { "loop_filter_sharpness", "Loop filter sharpness",
libavcodec/vaapi_encode_vp9.c+1−0
@@ -251,6 +251,7 @@ static av_cold int vaapi_encode_vp9_init(AVCodecContext *avctx) · 250 unmodified lines
251#define OFFSET(x) offsetof(VAAPIEncodeVP9Context, x)251#define OFFSET(x) offsetof(VAAPIEncodeVP9Context, x)
252#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)252#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
253static const AVOption vaapi_encode_vp9_options[] = {253static const AVOption vaapi_encode_vp9_options[] = {
254 VAAPI_ENCODE_COMMON_OPTIONS,
254 { "loop_filter_level", "Loop filter level",255 { "loop_filter_level", "Loop filter level",
255 OFFSET(loop_filter_level), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, 63, FLAGS },256 OFFSET(loop_filter_level), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, 63, FLAGS },
256 { "loop_filter_sharpness", "Loop filter sharpness",257 { "loop_filter_sharpness", "Loop filter sharpness",

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t