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
25992599 @option{b_qoffset} / @option{b_quant_offset}
26002600 @end itemize
26012601
2602+All encoders support the following options:
2603+@itemize
2604+@item
2605+@option{low_power}
2606+
2607+Some drivers/platforms offer a second encoder for some codecs intended to use
2608+less power than the default encoder; setting this option will attempt to use
2609+that encoder. Note that it may support a reduced feature set, so some other
2610+options may not be available in this mode.
2611+@end itemize
2612+
2613+Each encoder also has its own specific options:
26022614 @table @option
26032615
26042616 @item h264_vaapi
@@ -2606,8 +2618,6 @@ Size / quality tradeoff: higher values are smaller / worse quality. · 1 unmodified line
26062618 @option{level} sets the value of @emph{level_idc}.
26072619
26082620 @table @option
2609−@item low_power
2610−Use low-power encoding mode.
26112621 @item coder
26122622 Set entropy encoder (default is @emph{cabac}). Possible values:
26132623
libavcodec/vaapi_encode.h+9−0
@@ -298,4 +298,13 @@ int ff_vaapi_encode2(AVCodecContext *avctx, AVPacket *pkt, · 297 unmodified lines
298298 int ff_vaapi_encode_init(AVCodecContext *avctx);
299299 int ff_vaapi_encode_close(AVCodecContext *avctx);
300300
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+
301310 #endif /* AVCODEC_VAAPI_ENCODE_H */
libavcodec/vaapi_encode_h264.c+2−6
@@ -52,7 +52,6 @@ typedef struct VAAPIEncodeH264Context { · 51 unmodified lines
5252 // User options.
5353 int qp;
5454 int quality;
55− int low_power;
5655 int coder;
5756 int aud;
5857 int sei;
@@ -936,8 +935,6 @@ static av_cold int vaapi_encode_h264_init(AVCodecContext *avctx) · 877 unmodified lines
936935 return AVERROR_PATCHWELCOME;
937936 }
938937
939− ctx->low_power = priv->low_power;
940−
941938 if (avctx->bit_rate > 0) {
942939 if (avctx->rc_max_rate == avctx->bit_rate)
943940 ctx->va_rc_mode = VA_RC_CBR;
@@ -970,13 +967,12 @@ static av_cold int vaapi_encode_h264_close(AVCodecContext *avctx) · 26 unmodified lines
970967 #define OFFSET(x) offsetof(VAAPIEncodeH264Context, x)
971968 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
972969 static const AVOption vaapi_encode_h264_options[] = {
970+ VAAPI_ENCODE_COMMON_OPTIONS,
971+
973972 { "qp", "Constant QP (for P-frames; scaled by qfactor/qoffset for I/B)",
974973 OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 20 }, 0, 52, FLAGS },
975974 { "quality", "Set encode quality (trades off against speed, higher is faster)",
976975 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 },
980976 { "coder", "Entropy coder type",
981977 OFFSET(coder), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, FLAGS, "coder" },
982978 { "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
10991099 #define OFFSET(x) offsetof(VAAPIEncodeH265Context, x)
11001100 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
11011101 static const AVOption vaapi_encode_h265_options[] = {
1102+ VAAPI_ENCODE_COMMON_OPTIONS,
1103+
11021104 { "qp", "Constant QP (for P-frames; scaled by qfactor/qoffset for I/B)",
11031105 OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 25 }, 0, 52, FLAGS },
11041106
libavcodec/vaapi_encode_vp8.c+1−0
@@ -228,6 +228,7 @@ static av_cold int vaapi_encode_vp8_init(AVCodecContext *avctx) · 227 unmodified lines
228228 #define OFFSET(x) offsetof(VAAPIEncodeVP8Context, x)
229229 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
230230 static const AVOption vaapi_encode_vp8_options[] = {
231+ VAAPI_ENCODE_COMMON_OPTIONS,
231232 { "loop_filter_level", "Loop filter level",
232233 OFFSET(loop_filter_level), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, 63, FLAGS },
233234 { "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
251251 #define OFFSET(x) offsetof(VAAPIEncodeVP9Context, x)
252252 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
253253 static const AVOption vaapi_encode_vp9_options[] = {
254+ VAAPI_ENCODE_COMMON_OPTIONS,
254255 { "loop_filter_level", "Loop filter level",
255256 OFFSET(loop_filter_level), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, 63, FLAGS },
256257 { "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