summaryrefslogtreecommitdiff
path: root/libavcodec/vaapi_encode.h
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2018-09-18 23:30:40 +0100
committerMark Thompson <sw@jkqxz.net>2018-09-23 14:42:33 +0100
commit3b188666f19a17d15efb7eae590e988832972666 (patch)
tree9442d49ab736e26b84bf4983cf3e781cdc076a32 /libavcodec/vaapi_encode.h
parenta00763be8861bcf499675b2af89d29e4e113cdc9 (diff)
vaapi_encode: Choose profiles dynamically
Previously there was one fixed choice for each codec (e.g. H.265 -> Main profile), and using anything else then required an explicit option from the user. This changes to selecting the profile based on the input format and the set of profiles actually supported by the driver (e.g. P010 input will choose Main 10 profile for H.265 if the driver supports it). The entrypoint and render target format are also chosen dynamically in the same way, removing those explicit selections from the per-codec code.
Diffstat (limited to 'libavcodec/vaapi_encode.h')
-rw-r--r--libavcodec/vaapi_encode.h43
1 files changed, 36 insertions, 7 deletions
diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
index c7370a17e2..0da8e356f0 100644
--- a/libavcodec/vaapi_encode.h
+++ b/libavcodec/vaapi_encode.h
@@ -23,6 +23,10 @@
#include <va/va.h>
+#if VA_CHECK_VERSION(1, 0, 0)
+#include <va/va_str.h>
+#endif
+
#include "libavutil/hwcontext.h"
#include "libavutil/hwcontext_vaapi.h"
@@ -86,18 +90,32 @@ typedef struct VAAPIEncodePicture {
VAAPIEncodeSlice *slices;
} VAAPIEncodePicture;
+typedef struct VAAPIEncodeProfile {
+ // lavc profile value (FF_PROFILE_*).
+ int av_profile;
+ // Supported bit depth.
+ int depth;
+ // Number of components.
+ int nb_components;
+ // Chroma subsampling in width dimension.
+ int log2_chroma_w;
+ // Chroma subsampling in height dimension.
+ int log2_chroma_h;
+ // VAAPI profile value.
+ VAProfile va_profile;
+} VAAPIEncodeProfile;
+
typedef struct VAAPIEncodeContext {
const AVClass *class;
// Codec-specific hooks.
const struct VAAPIEncodeType *codec;
- // Encoding profile (VAProfileXXX).
- VAProfile va_profile;
- // Encoding entrypoint (usually VAEntryointEncSlice).
- VAEntrypoint va_entrypoint;
- // Surface colour/sampling format (usually VA_RT_FORMAT_YUV420).
- unsigned int va_rt_format;
+ // Global options.
+
+ // Use low power encoding mode.
+ int low_power;
+
// Rate control mode.
unsigned int va_rc_mode;
// Supported packed headers (initially the desired set, modified
@@ -113,6 +131,14 @@ typedef struct VAAPIEncodeContext {
// Everything above this point must be set before calling
// ff_vaapi_encode_init().
+ // Chosen encoding profile details.
+ const VAAPIEncodeProfile *profile;
+
+ // Encoding profile (VAProfile*).
+ VAProfile va_profile;
+ // Encoding entrypoint (VAEntryoint*).
+ VAEntrypoint va_entrypoint;
+
// Configuration attributes to use when creating va_config.
VAConfigAttrib config_attributes[MAX_CONFIG_ATTRIBUTES];
int nb_config_attributes;
@@ -204,8 +230,11 @@ typedef struct VAAPIEncodeContext {
int end_of_stream;
} VAAPIEncodeContext;
-
typedef struct VAAPIEncodeType {
+ // List of supported profiles and corresponding VAAPI profiles.
+ // (Must end with FF_PROFILE_UNKNOWN.)
+ const VAAPIEncodeProfile *profiles;
+
// Perform any extra codec-specific configuration after the
// codec context is initialised (set up the private data and
// add any necessary global parameters).