[FFmpeg-devel] [PATCH] avcodec: Pass the HDR10+ metadata to the packet side data in VP9 encoder

James Zern jzern at google.com
Wed Jun 2 23:06:18 EEST 2021


On Tue, Jun 1, 2021 at 6:23 PM Mohammad Izadi
<izadi-at-google.com at ffmpeg.org> wrote:
>
> On Fri, May 28, 2021 at 4:49 AM Michael Niedermayer <michael at niedermayer.cc>
> wrote:
>
> > On Thu, May 27, 2021 at 09:44:10AM -0700, Mohammad Izadi wrote:
> > > HDR10+ metadata is stored in the bit stream for HEVC. The story is
> > different for VP9 and cannot store the metadata in the bit stream. HDR10+
> > should be passed to packet side data an stored in the container (mkv) for
> > VP9.
> > >
> > > This CL is taking HDR10+ from AVFrame side data in libvpxenc and is
> > passing it to the AVPacket side data.
> > > ---
> > >  doc/APIchanges         |  2 +
> > >  libavcodec/avpacket.c  |  1 +
> > >  libavcodec/decode.c    |  1 +
> > >  libavcodec/libvpxenc.c | 92 ++++++++++++++++++++++++++++++++++++++++++
> > >  libavcodec/packet.h    |  8 ++++
> > >  libavcodec/version.h   |  2 +-
> > >  6 files changed, 105 insertions(+), 1 deletion(-)
> > [...]
> > > @@ -316,6 +323,53 @@ static av_cold void free_frame_list(struct
> > FrameListData *list)
> > >      }
> > >  }
> > >
> > > +static av_cold int add_hdr10_plus(AVFifoBuffer *fifo, struct
> > FrameHDR10Plus *data)
> > > +{
> > > +    int err = av_fifo_grow(fifo, sizeof(FrameHDR10Plus));
> > > +    if (err < 0)
> > > +        return err;
> > > +    av_fifo_generic_write(fifo, data, sizeof(FrameHDR10Plus), NULL);
> > > +    return 0;
> > > +}
> > > +
> > > +static av_cold void free_hdr10_plus(struct FrameHDR10Plus *p)
> > > +{
> > > +    if (!p)
> > > +        return;
> > > +    av_buffer_unref(&p->hdr10_plus);
> > > +    av_free(p);
> > > +}
> > > +
> > > +static av_cold void free_hdr10_plus_fifo(AVFifoBuffer **fifo)
> > > +{
> > > +    FrameHDR10Plus *frame_hdr10_plus = NULL;
> > > +    while (av_fifo_generic_read(*fifo, frame_hdr10_plus,
> > sizeof(*frame_hdr10_plus), NULL) > 0)
> > > +        free_hdr10_plus(frame_hdr10_plus);
> > > +    av_fifo_freep(fifo);
> > > +}
> >
> > This seems crashing
> >
> Fixed. Can you please verify it?
>

Is there a way we could enable this kind of test in fate? Mohammad, do
you have any examples of content that could be used for testing?


More information about the ffmpeg-devel mailing list