[FFmpeg-devel] [PATCH v3 12/14] vvcdec: add CTU parser

Nuo Mi nuomi2021 at gmail.com
Sun Oct 15 13:31:50 EEST 2023


On Sun, Oct 15, 2023 at 6:16 PM Andreas Rheinhardt <
andreas.rheinhardt at outlook.com> wrote:

> Nuo Mi:
> > ---
> >  libavcodec/vvc/vvc_ctu.c | 2398 +++++++++++++++++++++++++++++++++++++-
> >  libavcodec/vvc/vvc_ctu.h |   11 +
> >  2 files changed, 2404 insertions(+), 5 deletions(-)
> >
> > diff --git a/libavcodec/vvc/vvc_ctu.c b/libavcodec/vvc/vvc_ctu.c
> > index d46a522a0d..a212d3a44a 100644
> > --- a/libavcodec/vvc/vvc_ctu.c
> > +++ b/libavcodec/vvc/vvc_ctu.c
> > @@ -22,8 +22,2379 @@
>
> ...
>
> > +static TransformUnit* alloc_tu(VVCFrameContext *fc, CodingUnit *cu)
> > +{
> > +    TransformUnit *tu;
> > +    AVBufferRef *buf = av_buffer_pool_get(fc->tu_pool);
> > +    if (!buf)
> > +        return NULL;
> > +
> > +    tu = (TransformUnit *)buf->data;
> > +    tu->next = NULL;
> > +    tu->buf = buf;
> > +
> > +    if (cu->tus.tail)
> > +        cu->tus.tail->next =  tu;
> > +    else
> > +        cu->tus.head = tu;
> > +    cu->tus.tail = tu;
> > +
> > +    return tu;
> > +}
> > +
>
> ...
>
> > +static CodingUnit* alloc_cu(VVCLocalContext *lc, const int x0, const
> int y0)
> > +{
> > +    VVCFrameContext *fc = lc->fc;
> > +    const VVCSPS *sps   = fc->ps.sps;
> > +    const VVCPPS *pps   = fc->ps.pps;
> > +    const int rx        = x0 >> sps->ctb_log2_size_y;
> > +    const int ry        = y0 >> sps->ctb_log2_size_y;
> > +    CTU *ctu            = fc->tab.ctus + ry * pps->ctb_width + rx;
> > +    CodingUnit *cu;
> > +
> > +    AVBufferRef *buf = av_buffer_pool_get(fc->cu_pool);
> > +    if (!buf)
> > +        return NULL;
> > +    cu = (CodingUnit *)buf->data;
> > +    cu->next = NULL;
> > +    cu->buf = buf;
>
> Do I see this correctly that the CodingUnits and TransformUnits are not
> refcounted to be shared, but only to use the AVBufferPool API?
>
> Anyway, switching to the (not yet merged) RefStruct pool API simplifies
> this (e.g. it will allow to remove the AVBufferRef pointers from the
> structures).
>
Yes. You are right.
That's wonderful. I will wait for the API.

>
> > +
> > +    if (lc->cu)
> > +        lc->cu->next = cu;
> > +    else
> > +        ctu->cus = cu;
> > +    lc->cu = cu;
> > +
> > +    return cu;
> > +}
> > +
>
> _______________________________________________
> 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