[FFmpeg-devel] [PATCH V2 2/4] lavc/vaapi_encode: Add max slices number query.
Mark Thompson
sw at jkqxz.net
Thu Aug 10 00:29:49 EEST 2017
On 02/08/17 06:55, Jun Zhao wrote:
> From 2a0bd4795fcf7d889c3c93b03e8698015a519260 Mon Sep 17 00:00:00 2001
> From: Jun Zhao <jun.zhao at intel.com>
> Date: Tue, 1 Aug 2017 04:16:30 -0400
> Subject: [PATCH V2 2/4] lavc/vaapi_encode: Add max slices number query.
>
> Add max slices number query.
>
> Signed-off-by: Jun Zhao <jun.zhao at intel.com>
> ---
> libavcodec/vaapi_encode.c | 4 ++++
> libavcodec/vaapi_encode.h | 3 +++
> 2 files changed, 7 insertions(+)
>
> diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
> index 11d9803b5d..9fc70bdd55 100644
> --- a/libavcodec/vaapi_encode.c
> +++ b/libavcodec/vaapi_encode.c
> @@ -972,6 +972,7 @@ static av_cold int vaapi_encode_config_attributes(AVCodecContext *avctx)
> { VAConfigAttribRTFormat },
> { VAConfigAttribRateControl },
> { VAConfigAttribEncMaxRefFrames },
> + { VAConfigAttribEncMaxSlices },
> { VAConfigAttribEncPackedHeaders },
> };
>
> @@ -1102,6 +1103,9 @@ static av_cold int vaapi_encode_config_attributes(AVCodecContext *avctx)
> }
> }
> break;
> + case VAConfigAttribEncMaxSlices:
> + ctx->max_slices = attr[i].value;
> + break;
> case VAConfigAttribEncPackedHeaders:
> if (ctx->va_packed_headers & ~attr[i].value) {
> // This isn't fatal, but packed headers are always
> diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
> index b542772aed..fd55aa6cdc 100644
> --- a/libavcodec/vaapi_encode.h
> +++ b/libavcodec/vaapi_encode.h
> @@ -103,6 +103,9 @@ typedef struct VAAPIEncodeContext {
> // Supported packed headers (initially the desired set, modified
> // later to what is actually supported).
> unsigned int va_packed_headers;
> + // Supported max-slices number per frame. (0 means driver cannot
> + // support max mutil-slices query)
> + int max_slices;
>
> // The required size of surfaces. This is probably the input
> // size (AVCodecContext.width|height) aligned up to whatever
A few lines further down:
// Everything above this point must be set before calling
// ff_vaapi_encode_init().
max_slices is not in this category, so it should be somewhere below.
> --
> 2.11.0
>
Probably fine? Without too much thought I would probably write this the other way around (check the value in vaapi_encode_config_attributes(), then know it is correct thereafter, like max_b_frames), but maybe that causes more problems with unexpected failure and needing to mess with MPEG-2.
- Mark
More information about the ffmpeg-devel
mailing list