[FFmpeg-devel] [PATCH] lavc/libdav1d: fix exporting framerate

James Almer jamrial at gmail.com
Mon May 15 15:41:55 EEST 2023


On 5/15/2023 9:22 AM, Anton Khirnov wrote:
> Same issues as in the previous commit.
> ---
>   libavcodec/Makefile   |  2 +-
>   libavcodec/libdav1d.c | 10 ++++------
>   2 files changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 9587e56493..4d59411662 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -1086,7 +1086,7 @@ OBJS-$(CONFIG_LIBARIBCAPTION_DECODER)     += libaribcaption.o ass.o
>   OBJS-$(CONFIG_LIBCELT_DECODER)            += libcelt_dec.o
>   OBJS-$(CONFIG_LIBCODEC2_DECODER)          += libcodec2.o
>   OBJS-$(CONFIG_LIBCODEC2_ENCODER)          += libcodec2.o
> -OBJS-$(CONFIG_LIBDAV1D_DECODER)           += libdav1d.o
> +OBJS-$(CONFIG_LIBDAV1D_DECODER)           += libdav1d.o av1_parse.o
>   OBJS-$(CONFIG_LIBDAVS2_DECODER)           += libdavs2.o
>   OBJS-$(CONFIG_LIBFDK_AAC_DECODER)         += libfdk-aacdec.o
>   OBJS-$(CONFIG_LIBFDK_AAC_ENCODER)         += libfdk-aacenc.o
> diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
> index af072da681..4c48f0099a 100644
> --- a/libavcodec/libdav1d.c
> +++ b/libavcodec/libdav1d.c
> @@ -30,6 +30,7 @@
>   #include "libavutil/opt.h"
>   
>   #include "atsc_a53.h"
> +#include "av1_parse.h"
>   #include "avcodec.h"
>   #include "bytestream.h"
>   #include "codec_internal.h"
> @@ -154,12 +155,9 @@ static void libdav1d_init_params(AVCodecContext *c, const Dav1dSequenceHeader *s
>       else
>           c->pix_fmt = pix_fmt[seq->layout][seq->hbd];
>   
> -    if (seq->num_units_in_tick && seq->time_scale) {
> -        av_reduce(&c->framerate.den, &c->framerate.num,
> -                  seq->num_units_in_tick, seq->time_scale, INT_MAX);
> -        if (seq->equal_picture_interval)
> -            c->ticks_per_frame = seq->num_ticks_per_picture;
> -    }
> +    c->framerate = ff_av1_framerate(seq->num_ticks_per_picture,
> +                                    (unsigned)seq->num_units_in_tick,
> +                                    (unsigned)seq->time_scale);
>   
>      if (seq->film_grain_present)
>          c->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;

LGTM


More information about the ffmpeg-devel mailing list