[FFmpeg-devel] [PATCH] avcodec/vvcdec: set pict_type and AV_FRAME_FLAG_KEY
Nuo Mi
nuomi2021 at gmail.com
Wed Jan 8 15:04:02 EET 2025
On Wed, Jan 8, 2025 at 12:35 AM Rubén Gonzalez <rgonzalez at fluendo.com>
wrote:
> Hi Nuo Mi,
>
> thanks for your feedback. Unfortunately I don't have enough knowledge/time
> to improve the patch. I only mimicked H.26[45].
>
> IMHO, reporting AV_FRAME_FLAG_KEY is better than nothing, so I will send a
> new patch only with AV_FRAME_FLAG_KEY logic and create a bug report in trac
> to support pict_type.
>
> - if (!IS_IDR(s))
> + if (IS_IDR(s))
> + fc->frame->flags |= AV_FRAME_FLAG_KEY;
> + else
> ff_vvc_bump_frame(s, fc);
>
Hi Ruben,
Unfortunately, this is also incorrect. In VVC, an intra random access point
(IRAP) can indeed serve as a key frame.
Please go ahead and create an issue—I will send a patch and add you as a
co-author.
Your help in reviewing the patch would be greatly appreciated
Thank you
>
> On Sat, Jan 4, 2025 at 2:35 PM Nuo Mi <nuomi2021 at gmail.com> wrote:
>
>> 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