[FFmpeg-devel] [PATCH] avcodec/vvcdec: set pict_type and AV_FRAME_FLAG_KEY
Rubén Gonzalez
rgonzalez at fluendo.com
Mon Jan 13 23:01:05 EET 2025
I tested your ([PATCH v2] lavc/vvc/refs: export keyframe and picture type
in output frames) implementation and it works correctly.
For instance, I found different output from my original implementation in
SUBPIC_D_ERICSSON_1.bit[1].
Thanks you.
[1]
https://www.itu.int/wftp3/av-arch/jvet-site/bitstream_exchange/VVC/draft_conformance/draft6/SUBPIC_D_ERICSSON_1.zip
On Wed, Jan 8, 2025 at 5:56 PM Rubén Gonzalez <rgonzalez at fluendo.com> wrote:
> Sounds very good, thanks!
>
> Issue: https://trac.ffmpeg.org/ticket/11406
>
> I would be glad to try it.
>
>
> On Wed, Jan 8, 2025 at 2:04 PM Nuo Mi <nuomi2021 at gmail.com> wrote:
>
>>
>>
>> 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