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

Mohammad Izadi izadi at google.com
Mon Jun 7 19:53:10 EEST 2021


On Wed, Jun 2, 2021 at 1:34 PM James Zern <jzern-at-google.com at ffmpeg.org>
wrote:

> 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?
>
Yes. I already added a test for H265 in this patch:
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20201123212933.3560940-1-izadi@google.com/
A video sample is attached in the patch as well. I will add a test in fate
in my followup patches after handling the packet in mkv  as would have
access to output.

> _______________________________________________
> 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