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 | 53 | typedef struct VAAPIEncodeSlice { |
| 54 | 54 | int index; |
| 55 | + int row_start; | |
| 56 | + int row_size; | |
| 57 | + int block_start; | |
| 58 | + int block_size; | |
| 55 | 59 | void *priv_data; |
| 56 | 60 | void *codec_slice_params; |
| 57 | 61 | } VAAPIEncodeSlice; |
| @@ -125,6 +129,10 @@ typedef struct VAAPIEncodeContext { · 67 unmodified lines | ||
| 125 | 129 | int surface_width; |
| 126 | 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 | 136 | // Everything above this point must be set before calling |
| 129 | 137 | // ff_vaapi_encode_init(). |
| 130 | 138 | |
| @@ -224,6 +232,12 @@ typedef struct VAAPIEncodeContext { · 93 unmodified lines | ||
| 224 | 232 | int64_t dts_pts_diff; |
| 225 | 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 | 241 | // Frame type decision. |
| 228 | 242 | int gop_size; |
| 229 | 243 | int p_per_i; |
| @@ -234,11 +248,19 @@ typedef struct VAAPIEncodeContext { · 4 unmodified lines | ||
| 234 | 248 | int end_of_stream; |
| 235 | 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 | 256 | typedef struct VAAPIEncodeType { |
| 238 | 257 | // List of supported profiles and corresponding VAAPI profiles. |
| 239 | 258 | // (Must end with FF_PROFILE_UNKNOWN.) |
| 240 | 259 | const VAAPIEncodeProfile *profiles; |
| 241 | 260 | |
| 261 | + // Codec feature flags. | |
| 262 | + int flags; | |
| 263 | + | |
| 242 | 264 | // Perform any extra codec-specific configuration after the |
| 243 | 265 | // codec context is initialised (set up the private data and |
| 244 | 266 | // add any necessary global parameters). |