[FFmpeg-devel] [PATCH] avcodec/libaomdec: Set SAR based on RenderWidth and RenderHeight

James Almer jamrial at gmail.com
Fri Aug 21 19:36:55 EEST 2020


On 8/21/2020 12:29 PM, Derek Buitenhuis wrote:
> This is the same thing we do in libdav1d.c
> 
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> ---
>  libavcodec/libaomdec.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c
> index a72ac984e7..1b0f35936e 100644
> --- a/libavcodec/libaomdec.c
> +++ b/libavcodec/libaomdec.c
> @@ -197,6 +197,13 @@ static int aom_decode(AVCodecContext *avctx, void *data, int *got_frame,
>          }
>          if ((ret = ff_get_buffer(avctx, picture, 0)) < 0)
>              return ret;
> +        
> +        av_reduce(&picture->sample_aspect_ratio.num,
> +                  &picture->sample_aspect_ratio.den,
> +                  picture->height * img->r_w,
> +                  picture->width * img->r_h,
> +                  INT_MAX);

Should probably also add a ff_set_sar(avctx,
picture->sample_aspect_ratio) call after this. I'll do the same for
libdav1d.

LGTM in any case.

> +
>          if ((img->fmt & AOM_IMG_FMT_HIGHBITDEPTH) && img->bit_depth == 8)
>              image_copy_16_to_8(picture, img);
>          else
> 



More information about the ffmpeg-devel mailing list