* commit 'a86aa16088ad7f22a8918d71adb8c040d6033d84':
vaapi_h264: Add trivial support for low-power encoding
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
... | ... |
@@ -126,6 +126,7 @@ typedef struct VAAPIEncodeH264Context { |
126 | 126 |
typedef struct VAAPIEncodeH264Options { |
127 | 127 |
int qp; |
128 | 128 |
int quality; |
129 |
+ int low_power; |
|
129 | 130 |
} VAAPIEncodeH264Options; |
130 | 131 |
|
131 | 132 |
|
... | ... |
@@ -860,7 +861,17 @@ static av_cold int vaapi_encode_h264_init_internal(AVCodecContext *avctx) |
860 | 860 |
avctx->profile); |
861 | 861 |
return AVERROR(EINVAL); |
862 | 862 |
} |
863 |
- ctx->va_entrypoint = VAEntrypointEncSlice; |
|
863 |
+ if (opt->low_power) { |
|
864 |
+#if VA_CHECK_VERSION(0, 39, 1) |
|
865 |
+ ctx->va_entrypoint = VAEntrypointEncSliceLP; |
|
866 |
+#else |
|
867 |
+ av_log(avctx, AV_LOG_ERROR, "Low-power encoding is not " |
|
868 |
+ "supported with this VAAPI version.\n"); |
|
869 |
+ return AVERROR(EINVAL); |
|
870 |
+#endif |
|
871 |
+ } else { |
|
872 |
+ ctx->va_entrypoint = VAEntrypointEncSlice; |
|
873 |
+ } |
|
864 | 874 |
|
865 | 875 |
ctx->input_width = avctx->width; |
866 | 876 |
ctx->input_height = avctx->height; |
... | ... |
@@ -943,7 +954,10 @@ static const AVOption vaapi_encode_h264_options[] = { |
943 | 943 |
{ "qp", "Constant QP (for P-frames; scaled by qfactor/qoffset for I/B)", |
944 | 944 |
OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 20 }, 0, 52, FLAGS }, |
945 | 945 |
{ "quality", "Set encode quality (trades off against speed, higher is faster)", |
946 |
- OFFSET(quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, FLAGS }, |
|
946 |
+ OFFSET(quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 8, FLAGS }, |
|
947 |
+ { "low_power", "Use low-power encoding mode (experimental: only supported " |
|
948 |
+ "on some platforms, does not support all features)", |
|
949 |
+ OFFSET(low_power), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS }, |
|
947 | 950 |
{ NULL }, |
948 | 951 |
}; |
949 | 952 |
|