[FFmpeg-devel] [PATCH WIP 5/5] avcodec/hevc: Add alpha layer support

Anton Khirnov anton at khirnov.net
Sat Dec 14 11:43:54 EET 2024


Quoting Zhao Zhili (2024-12-11 05:23:33)
> From: Zhao Zhili <zhilizhao at tencent.com>
> 
> ---
>  libavcodec/hevc/hevcdec.c | 75 ++++++++++++++++++++++++++++++++++++++-
>  libavcodec/hevc/hevcdec.h |  2 ++
>  libavcodec/hevc/refs.c    | 10 +++++-
>  3 files changed, 85 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
> index be35a9de82..782c9382bc 100644
> --- a/libavcodec/hevc/hevcdec.c
> +++ b/libavcodec/hevc/hevcdec.c
> @@ -458,6 +458,26 @@ static int export_multilayer(HEVCContext *s, const HEVCVPS *vps)
>      return 0;
>  }
>  
> +int ff_hevc_is_alpha_video(const HEVCContext *s) {
> +    const HEVCVPS *vps;
> +    int ret = 0;
> +
> +    if (!s->vps)
> +        return 0;

This seems like something that should not happen.

> +    vps = s->vps;
> +    if (vps->nb_layers != 2 || !vps->layer_id_in_nuh[1])
> +        return 0;
> +
> +    ret = (s->vps->scalability_mask_flag & HEVC_SCALABILITY_AUXILIARY) &&
> +          s->sei.alpha.has_alpha_channel_info;

Is the SEI really necessary? I thought it's enough to have an auxiliary
picture with AuxId=AUX_ALPHA.

Also, I'd prefer the interaction with multiview to be clearer, with e.g.
a warning message when both are present, and fewer assumptions about
only one of them being present spread over the code.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list