[FFmpeg-devel] [PATCH] avcodec/vvcdec: set pict_type and AV_FRAME_FLAG_KEY

Nuo Mi nuomi2021 at gmail.com
Sat Jan 4 15:35:02 EET 2025


Hi Ruben,
Thank you for the patch.
A B/P frame's first slice may be an I slice, so it can't be used to
determine the picture type.
The ph_inter_slice_allowed_flag can quickly identify an I frame, but B/P
frame still requires checking all slices.

On Fri, Jan 3, 2025 at 12:19 AM Ruben Gonzalez <rgonzalez at fluendo.com>
wrote:

> Update VVC decoder to show frames info with ffprobe and other tools.
>
> Tested with:
> ```
> wget
> https://www.itu.int/wftp3/av-arch/jvet-site/bitstream_exchange/VVC/draft_conformance/draft6/CodingToolsSets_E_Tencent_1.zip
> unzip CodingToolsSets_E_Tencent_1.zip CodingToolsSets_E_Tencent_1.bit
> ffprobe -hide_banner CodingToolsSets_E_Tencent_1.bit -select_streams v
> -show_frames -show_entries frame=pict_type,key_frame -of csv
> ```
>
> From
> ```
> frame,0,?
> frame,0,?
> frame,0,?
> frame,0,?
> frame,0,?
> frame,0,?
> frame,0,?
> frame,0,?
> frame,0,?
> ```
>
> To:
> ```
> frame,1,I
> frame,0,B
> frame,0,B
> frame,0,B
> frame,0,B
> frame,0,B
> frame,0,B
> frame,0,P
> frame,0,B
> ```
>
> Signed-off-by: Ruben Gonzalez <rgonzalez at fluendo.com>
> ---
>  libavcodec/vvc/dec.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
> index 1cb168de7e..71408caf7b 100644
> --- a/libavcodec/vvc/dec.c
> +++ b/libavcodec/vvc/dec.c
> @@ -712,7 +712,18 @@ static int frame_start(VVCContext *s, VVCFrameContext
> *fc, SliceContext *sc)
>      if ((ret = ff_vvc_set_new_ref(s, fc, &fc->frame)) < 0)
>          goto fail;
>
> -    if (!IS_IDR(s))
> +    if (sc->sh.r->sh_slice_type == VVC_SLICE_TYPE_B)
> +        fc->frame->pict_type = AV_PICTURE_TYPE_B;
> +
> +    if (sc->sh.r->sh_slice_type == VVC_SLICE_TYPE_P)
> +        fc->frame->pict_type = AV_PICTURE_TYPE_P;
> +
> +    if (sc->sh.r->sh_slice_type == VVC_SLICE_TYPE_I)
> +        fc->frame->pict_type = AV_PICTURE_TYPE_I;
> +
> +    if (IS_IDR(s))
> +        fc->frame->flags |= AV_FRAME_FLAG_KEY;
> +    else
>          ff_vvc_bump_frame(s, fc);
>
>      av_frame_unref(fc->output_frame);
> --
> 2.47.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-devel mailing list