This adds common code to query driver support and set appropriate address/size information for each slice. It only supports rectangular slices for now, since that is the most common use-case.
Showing the changes to libavcodec/vaapi_encode.h (1 of 3 files). Show all
Unified · Split
| @@ -52,6 +52,10 @@ enum { · 51 unmodified lines | |||
| 52 | 52 | ||
| 53 | typedef struct VAAPIEncodeSlice { | 53 | typedef struct VAAPIEncodeSlice { |
| 54 | int index; | 54 | int index; |
| 55 | int row_start; | ||
| 56 | int row_size; | ||
| 57 | int block_start; | ||
| 58 | int block_size; | ||
| 55 | void *priv_data; | 59 | void *priv_data; |
| 56 | void *codec_slice_params; | 60 | void *codec_slice_params; |
| 57 | } VAAPIEncodeSlice; | 61 | } VAAPIEncodeSlice; |
| @@ -125,6 +129,10 @@ typedef struct VAAPIEncodeContext { · 67 unmodified lines | |||
| 125 | int surface_width; | 129 | int surface_width; |
| 126 | int surface_height; | 130 | int surface_height; |
| 127 | 131 | ||
| 132 | // The block size for slice calculations. | ||
| 133 | int slice_block_width; | ||
| 134 | int slice_block_height; | ||
| 135 | |||
| 128 | // Everything above this point must be set before calling | 136 | // Everything above this point must be set before calling |
| 129 | // ff_vaapi_encode_init(). | 137 | // ff_vaapi_encode_init(). |
| 130 | 138 | ||
| @@ -224,6 +232,12 @@ typedef struct VAAPIEncodeContext { · 93 unmodified lines | |||
| 224 | int64_t dts_pts_diff; | 232 | int64_t dts_pts_diff; |
| 225 | int64_t ts_ring[MAX_REORDER_DELAY * 3]; | 233 | int64_t ts_ring[MAX_REORDER_DELAY * 3]; |
| 226 | 234 | ||
| 235 | // Slice structure. | ||
| 236 | int slice_block_rows; | ||
| 237 | int slice_block_cols; | ||
| 238 | int nb_slices; | ||
| 239 | int slice_size; | ||
| 240 | |||
| 227 | // Frame type decision. | 241 | // Frame type decision. |
| 228 | int gop_size; | 242 | int gop_size; |
| 229 | int p_per_i; | 243 | int p_per_i; |
| @@ -234,11 +248,19 @@ typedef struct VAAPIEncodeContext { · 4 unmodified lines | |||
| 234 | int end_of_stream; | 248 | int end_of_stream; |
| 235 | } VAAPIEncodeContext; | 249 | } VAAPIEncodeContext; |
| 236 | 250 | ||
| 251 | enum { | ||
| 252 | // Codec supports controlling the subdivision of pictures into slices. | ||
| 253 | FLAG_SLICE_CONTROL = 1 << 0, | ||
| 254 | }; | ||
| 255 | |||
| 237 | typedef struct VAAPIEncodeType { | 256 | typedef struct VAAPIEncodeType { |
| 238 | // List of supported profiles and corresponding VAAPI profiles. | 257 | // List of supported profiles and corresponding VAAPI profiles. |
| 239 | // (Must end with FF_PROFILE_UNKNOWN.) | 258 | // (Must end with FF_PROFILE_UNKNOWN.) |
| 240 | const VAAPIEncodeProfile *profiles; | 259 | const VAAPIEncodeProfile *profiles; |
| 241 | 260 | ||
| 261 | // Codec feature flags. | ||
| 262 | int flags; | ||
| 263 | |||
| 242 | // Perform any extra codec-specific configuration after the | 264 | // Perform any extra codec-specific configuration after the |
| 243 | // codec context is initialised (set up the private data and | 265 | // codec context is initialised (set up the private data and |
| 244 | // add any necessary global parameters). | 266 | // add any necessary global parameters). |