From patchwork Fri Aug 21 15:29:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 21802 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 9F8FC44B5DD for ; Fri, 21 Aug 2020 18:35:13 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 733B868AB04; Fri, 21 Aug 2020 18:35:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2313568AAEC for ; Fri, 21 Aug 2020 18:35:06 +0300 (EEST) Received: by mail-wr1-f67.google.com with SMTP id a15so2324003wrh.10 for ; Fri, 21 Aug 2020 08:35:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=5BXLexTwOdcG58V8O1YskItvpzgnnVq6teyFYwFjfc0=; b=GFYd711mtiqmSIsDguhS6Qhv6dzwq1IXHCtCtiOhMHk9Fpw50GI0xo1S4M52ySFHZR M/+N/tL7PEMlEi7p3Bdj6vaZxzVpLhCA4YqYvMMTLFRlZo/2zC35dE3ssvsUHW2st2ay KLWodxYPij5KvFBZRPSdkPTwah0tpUz/yq6i7YkeIQDHzaM33wE2nejUy0r9CGe2dfWR TWq3aHKd2+beK+SLC17u5dqP3OkRbcWuZj0wF+jrlFhu1tOzKMxn7KsnXvh3kZ8mYXAb 1ZWDLispznpztRcyLDCZBJ1CCxOLjgnw1JqzvxTjXiyazTUuRphLMeIhyi4tez3jJIRf I1lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=5BXLexTwOdcG58V8O1YskItvpzgnnVq6teyFYwFjfc0=; b=OccGsnAsmQMJbE8BBqTvM1u/YiVM+3wcnizphzZACMbIrYRQ89Ic35h/ikjtJAa0FT wtIMVNtdb+t12d7Pow+Q9HRstKy6bs+TcjiMB0Pv9cwTtdrZQCiF3HUEF6TI9vIlcOKW WdWf0rdjemRpDARoaRL4vQ3yaVFuCU5Am46GKo0Zj/41tthBFCYSCJo21l9XRn6Ectg1 DBXr7vhhbAD0wepQKlRueJpZR7S/aJJUvxp7dgyBSWQMpQpLGgZFxq4uvxsSDXEbmiL/ MzBS/DERS6Bt0FcbTqTq7mqW6zM/s2hmXy10DTmSxXf9xSGbKRuEVL10ZiFkyFx1kLyt DGnw== X-Gm-Message-State: AOAM531Bdfq5QrgS9gPTzKOvsMgxY+kyA3eNzEj4I1/jmZ6j7EBpEZ07 QjKGd2EVo5YED5jw4/NZdnjvsEFPSNc= X-Google-Smtp-Source: ABdhPJyD4U6kJ0SXwdo6KlNINcL2MaD/6s6BTg4nLFKmDCDkuuX7dRRxg3IhLrlgEQpHX2g72MhnLg== X-Received: by 2002:adf:fb01:: with SMTP id c1mr3076252wrr.119.1598023786825; Fri, 21 Aug 2020 08:29:46 -0700 (PDT) Received: from localhost.localdomain ([81.2.169.31]) by smtp.gmail.com with ESMTPSA id g14sm5780032wmk.37.2020.08.21.08.29.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 08:29:46 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 Aug 2020 16:29:11 +0100 Message-Id: <20200821152911.394589-1-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avcodec/libaomdec: Set SAR based on RenderWidth and RenderHeight X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This is the same thing we do in libdav1d.c Signed-off-by: Derek Buitenhuis --- 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); + if ((img->fmt & AOM_IMG_FMT_HIGHBITDEPTH) && img->bit_depth == 8) image_copy_16_to_8(picture, img); else