[FFmpeg-devel] [PATCH 2/2] avcodec/libdav1d: export frame sample aspect ratio

Anton Khirnov anton at khirnov.net
Mon May 18 18:16:16 EEST 2020


Quoting James Almer (2020-05-11 16:27:56)
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>  libavcodec/libdav1d.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
> index 72f06c550e..a265a487d8 100644
> --- a/libavcodec/libdav1d.c
> +++ b/libavcodec/libdav1d.c
> @@ -335,6 +335,12 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
>              goto fail;
>      }
>  
> +    av_reduce(&frame->sample_aspect_ratio.num,
> +              &frame->sample_aspect_ratio.den,
> +              frame->height * (int64_t)p->frame_hdr->render_width,
> +              frame->width  * (int64_t)p->frame_hdr->render_height,
> +              INT_MAX);

Wondered whether av_div_q might make it look better, but probably not by
much.

Patch looks ok.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list