Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2022-03-17 09:41:50 +0300
committerHaihao Xiang <haihao.xiang@intel.com>2022-04-11 06:38:43 +0300
commit99b333e5ff5a91de2a5d740bbc9fa344154511c1 (patch)
treeb8f66b368c9b5c84a411ab3646aba9572e8c5df5 /libavcodec/vaapi_encode_vp9.c
parenta285968a0b122484635846babd9a1e8183e70fb0 (diff)
vaapi_encode: Move block size calculation after entrypoint selection
The block size can be dependent on the profile and entrypoint selected. It defaults to 16x16, with codecs able to override this choice with their own function. Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Diffstat (limited to 'libavcodec/vaapi_encode_vp9.c')
-rw-r--r--libavcodec/vaapi_encode_vp9.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/libavcodec/vaapi_encode_vp9.c b/libavcodec/vaapi_encode_vp9.c
index 9ca4e451a3..52373543d3 100644
--- a/libavcodec/vaapi_encode_vp9.c
+++ b/libavcodec/vaapi_encode_vp9.c
@@ -184,6 +184,17 @@ static int vaapi_encode_vp9_init_picture_params(AVCodecContext *avctx,
return 0;
}
+static av_cold int vaapi_encode_vp9_get_encoder_caps(AVCodecContext *avctx)
+{
+ VAAPIEncodeContext *ctx = avctx->priv_data;
+
+ // Surfaces must be aligned to 64x64 superblock boundaries.
+ ctx->surface_width = FFALIGN(avctx->width, 64);
+ ctx->surface_height = FFALIGN(avctx->height, 64);
+
+ return 0;
+}
+
static av_cold int vaapi_encode_vp9_configure(AVCodecContext *avctx)
{
VAAPIEncodeContext *ctx = avctx->priv_data;
@@ -231,6 +242,7 @@ static const VAAPIEncodeType vaapi_encode_type_vp9 = {
.picture_priv_data_size = sizeof(VAAPIEncodeVP9Picture),
+ .get_encoder_caps = &vaapi_encode_vp9_get_encoder_caps,
.configure = &vaapi_encode_vp9_configure,
.sequence_params_size = sizeof(VAEncSequenceParameterBufferVP9),
@@ -251,10 +263,6 @@ static av_cold int vaapi_encode_vp9_init(AVCodecContext *avctx)
// can write its own headers and there is no metadata to include.
ctx->desired_packed_headers = 0;
- // Surfaces must be aligned to superblock boundaries.
- ctx->surface_width = FFALIGN(avctx->width, 64);
- ctx->surface_height = FFALIGN(avctx->height, 64);
-
return ff_vaapi_encode_init(avctx);
}