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

James Zern jzern at google.com
Thu May 27 07:11:34 EEST 2021


On Wed, May 26, 2021 at 6:35 PM Mohammad Izadi
<izadi-at-google.com at ffmpeg.org> wrote:
> [...]
> +static void add_hdr10_plus(AVFifoBuffer *fifo, struct FrameHDR10Plus *data)
> +{
> +    av_fifo_grow(fifo, sizeof(FrameHDR10Plus));

This return should be checked.

> +    av_fifo_generic_write(fifo, data, sizeof(FrameHDR10Plus), NULL);
> +}
>
> [...]
> +static int copy_hdr10_plus_to_pkt(AVFifoBuffer *fifo, AVPacket *pkt)
> +{
> +    FrameHDR10Plus *frame_hdr10_plus;
> +    uint8_t *data;
> +    if (av_fifo_size(fifo) < 1)
> +        return 0;
> +
> +    av_fifo_generic_read(fifo, frame_hdr10_plus, sizeof(*frame_hdr10_plus), NULL);
> +    if (!frame_hdr10_plus || !pkt || !(frame_hdr10_plus->hdr10_plus) || frame_hdr10_plus->pts != pkt->pts)

The inner ()s can be remove in the hdr10_plus check

> -    if(!avctx->bit_rate)
> -        if(avctx->rc_max_rate || avctx->rc_buffer_size || avctx->rc_initial_buffer_occupancy) {
> +    if (!avctx->bit_rate)
> +        if (avctx->rc_max_rate || avctx->rc_buffer_size || avctx->rc_initial_buffer_occupancy) {

Let's leave the cosmetic change to a separate commit.

> +    /**
> +     * HDR10+ dynamic metadata associated with a video frame. The metadata is in
> +     * the form of the AVDynamicHDRPlus struct and contains
> +     * information for color volume transform - application 4 of
> +     * SPMTE 2094-40:2016 standard.

SMPTE


More information about the ffmpeg-devel mailing list