[FFmpeg-devel] [PATCH RFC v2 2/3] libavcodec: Add thumbnail output to vaapi_h264 decoder

Hendrik Leppkes h.leppkes at gmail.com
Mon Apr 8 12:27:12 EEST 2019


On Mon, Apr 8, 2019 at 10:54 AM Zachary Zhou <zachary.zhou at intel.com> wrote:
>
> This is sample code for reference
>
> HW support for decode+scaling in a single HW command (VDBOX+SFC).
> The primary target usage is video analytics, but can be used playback,
> transcoding, etc.
>
> For VAAPI -
> https://github.com/intel/libva
> basically, it allows multiple outputs (in different resolutions) using the decode context in a single call (you can search for “additional_outputs” in va.h).
>
> VAAPI sample code -
> https://github.com/intel/libva-utils/commit/957a269f02b00760b7e807643c821ee26abc529b
> ---
>  libavcodec/avcodec.h       |   8 +++
>  libavcodec/decode.c        |  16 +++++
>  libavcodec/options_table.h |   4 ++
>  libavcodec/vaapi_decode.c  | 122 ++++++++++++++++++++++++++++++++++---
>  libavcodec/vaapi_decode.h  |  30 +++++++++
>  libavcodec/vaapi_h264.c    |  13 ++++
>  6 files changed, 185 insertions(+), 8 deletions(-)
>
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 0ce22ec4fa..36db21c0a5 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -3357,6 +3357,14 @@ typedef struct AVCodecContext {
>       * - encoding: unused
>       */
>      int discard_damaged_percentage;
> +
> +    /*
> +     * Thumbnail options
> +     */
> +    int thumbnail_flags;
> +    int thumbnail_format;
> +    int thumbnail_width;
> +    int thumbnail_height;
>  } AVCodecContext;
>

Global fields for such a purpose seem not appropriate. We try to get
away from fields that only serve a single purpose with a single
decoder. Nevermind that they aren't even documented.

In general I must say I'm not sure I like this entire patchset. We
have component seperation for a reason, so trying to add magic
features like that is generally a bad idea.

- Hendrik


More information about the ffmpeg-devel mailing list