[FFmpeg-devel] [PATCH 1/2] avcodec: add av1 hardware acceleration decoder

James Almer jamrial at gmail.com
Mon Aug 24 07:14:40 EEST 2020


On 8/21/2020 2:29 AM, Fei Wang wrote:
> +static int update_reference_list (AVCodecContext *avctx)
> +{
> +    AV1DecContext *s = avctx->priv_data;
> +    AV1RawFrameHeader *header= &s->raw_frame_header;
> +    int i;
> +    int ret = 0;
> +
> +    for (i = 0; i < 8; i++) {

Use AV1_NUM_REF_FRAMES instead of 8.

> +        if (header->frame_type == AV1_FRAME_KEY ||

There's no need to check for this, and it's in fact wrong (AV1_FRAME_KEY
where show_frame == 0 does not necessarily refresh all frames).

refresh_frame_flags will have the correct value for the frame as filled
by CBS.

> +            (header->refresh_frame_flags & (1 << i))) {
> +            if (s->ref[i].tf.f->buf[0])
> +                av1_frame_unref(avctx, &s->ref[i]);
> +            if ((ret = av1_frame_ref(avctx, &s->ref[i], &s->cur_frame)) < 0) {
> +                av_log(avctx, AV_LOG_DEBUG, "Ref frame error:%d.\n", ret);
> +                return ret;
> +            }
> +        }
> +    }
> +    return 0;
> +}



More information about the ffmpeg-devel mailing list