From patchwork Tue Jul 30 13:11:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giovanni Mascellani X-Patchwork-Id: 50818 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:b88e:0:b0:489:2eb3:e4c4 with SMTP id p14csp484129vqn; Tue, 30 Jul 2024 07:31:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVr7m+710/ffvvvkChmZJ0k+ImEAL8GSRHq/uuDR1T/eVUWEz1Jg6oVkCInoBdC6w5SiRLS9dJkmSXMkRbEkjp5RfqdJ6rtXydzUw== X-Google-Smtp-Source: AGHT+IHfWpy0L6N3wLS7f0+i48p4pZHqn9PwYtxipR+Ei09tNFHqYGlwuTV4KXGScV2XVpj8dbwg X-Received: by 2002:a2e:95cd:0:b0:2ef:185d:e3d7 with SMTP id 38308e7fff4ca-2f12ee2342emr71366061fa.38.1722349919631; Tue, 30 Jul 2024 07:31:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722349919; cv=none; d=google.com; s=arc-20160816; b=H4eqVwmwG8AaJYcaGRnEnl/tjQ3zc+pGdN3yvOZJNJq9sYVyXvDKoAbasH2iRFpoxc MVBpirnT4B6tnTUjAq6KmTwFM9BUhp6boKYWIAnTYfmQVPvGprfHlI6LR6IaoFL1BVIv A5JKH4R0SgZqgCM6hbKuyIyD82jMBz6UJWpZNMN9LMWXbNzDP10eEJ5S+x6AkxGXBapF E/SygyV3jepSp1JwFTwFU5TFhCD99va+jMg07XTn3CC+N0uVw/IREHqJm1/CsLaruVf9 9S+g/G7pCdGetxtfkVddg7Q1m0yLQWymUWd0iUhr41VOSa8CYPUHEJ7tUmlf7wWJzUbE 5vgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=YLSvvQWRp39w1YF+1lTOiZJEQwoPjIsC2gKrP4Xq+rI=; fh=NJUXiZ9ySL+5Ow7BwRN07JO06kUiUS+DYYL0pKl745k=; b=rfQnoF9hgqSCvGnnvbVT4d1m+RVRlscLSWUUhUwcQc7TyiGPiWzhYKEpgWQ+hPQ00l oEXFdIL8jhbgim//6+ib8xKqpLQv1LLPqkngMMwXXoofQzmbh6UW3AKMTxWEJpyz3muk aSZNqvYowEDrXjcAOJUCJI1v5BJFpUGGyA84tSqtymZQXp+U6Wc7wMul/AjHqG26AVfD fI3pANjy1Io9s9Gc9Nh+cW6hQcWRCU0h/4TS8QIHh2+sMVEW8oRSo6sU+E+ikdk1wn0z gKTRNKJKTK3gvlMCBK1R3Y9HEm6L+IWhKLXkQ2zFumDNs6TtiVZkU7TASYmk/zUpRxdv c4TQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@codeweavers.com header.s=s1 header.b=Lav3Jhl6; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codeweavers.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 38308e7fff4ca-2f03d159056si31630171fa.422.2024.07.30.07.31.59; Tue, 30 Jul 2024 07:31:59 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@codeweavers.com header.s=s1 header.b=Lav3Jhl6; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codeweavers.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E74D268D795; Tue, 30 Jul 2024 16:12:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.codeweavers.com (mail.codeweavers.com [4.36.192.163]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 666D668D733 for ; Tue, 30 Jul 2024 16:12:09 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=codeweavers.com; s=s1; h=Message-ID:Date:Subject:Cc:To:From:Sender; bh=ECaq/VfQ/BkDDt2K+JovGpufLRCWahkcvNPNDus5ckE=; b=Lav3Jhl6yY34Z5O2kKxcm5EtsJ io9PJ/tlsVCZU7qFeVFNm3WldCIxhZKy2G00rSau26kkmTHJGa6YEU7GZORyhqKm7cY3uwzhuyhlZ 1O+3Q7KXbChumaS8oL8kTp0eCUKPmsvQegg8oolBkXgmAJxI7JQpmsk27C88GPhy1XsyNScEl+sYK z18rsPp9JBlQeCl6Q3Mk01nz2UhwxcC6UJL0U37UIuOaId7/fAAhjpDhpyqcPOln29q7V+76W8k21 mZzhl/e0D4g+ElQR9cOeFloUPcL+AXtInP0FFfwhgvgrsOR6Z7GRpEqMjiGwkhLUP8Nd/HUdcHz5h 30089jTA==; Received: from cw141ip115.vpn.codeweavers.com ([10.69.141.115] helo=localhost.localdomain) by mail.codeweavers.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sYme7-0055F4-06; Tue, 30 Jul 2024 08:12:08 -0500 From: Giovanni Mascellani To: ffmpeg-devel@ffmpeg.org Date: Tue, 30 Jul 2024 15:11:48 +0200 Message-ID: <20240730131149.210571-2-gmascellani@codeweavers.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240730131149.210571-1-gmascellani@codeweavers.com> References: <20240730131149.210571-1-gmascellani@codeweavers.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/h2645_vui: Interpret a degenerate SAR as 1/1. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Cc: Giovanni Mascellani Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: E6S+5cHfegNr The specification doesn't say what should happen in this case. Other implementations (e.g., Microsoft's Media Foundations) seem to interpret this as 1/1. Signed-off-by: Giovanni Mascellani --- libavcodec/h2645_vui.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/h2645_vui.c b/libavcodec/h2645_vui.c index e5c7bf46f9..a9c0dbbef9 100644 --- a/libavcodec/h2645_vui.c +++ b/libavcodec/h2645_vui.c @@ -46,6 +46,10 @@ void ff_h2645_decode_common_vui_params(GetBitContext *gb, H2645VUI *vui, void *l else if (vui->aspect_ratio_idc == EXTENDED_SAR) { vui->sar.num = get_bits(gb, 16); vui->sar.den = get_bits(gb, 16); + if (vui->sar.num == 0 || vui->sar.den == 0) { + vui->sar.num = 1; + vui->sar.den = 1; + } } else av_log(logctx, AV_LOG_WARNING, "Unknown SAR index: %u.\n", vui->aspect_ratio_idc); From patchwork Tue Jul 30 13:11:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giovanni Mascellani X-Patchwork-Id: 50816 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:b88e:0:b0:489:2eb3:e4c4 with SMTP id p14csp431834vqn; Tue, 30 Jul 2024 06:12:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWCKfE1aB77gr7xmqLyQsbqAzwYo6UsLEMsuf5jbatqw6qEMb7/pBtBS41g2RMxcwRUisQbW6sPjcJDMMdiIoNZRBJotOoK3Jfg1g== X-Google-Smtp-Source: AGHT+IFUW28Eg3PiQBmwtmH6UgvXhHVTbcgFaXzr8UTQXeQMaqMZ+UgkNR3yJTiMSXqGmUciKMHG X-Received: by 2002:a17:907:3da7:b0:a7a:952b:95b1 with SMTP id a640c23a62f3a-a7d4006dcc0mr871628466b.24.1722345152552; Tue, 30 Jul 2024 06:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722345152; cv=none; d=google.com; s=arc-20160816; b=E5x62Sdrs2wDQkzN8sD3MnQ8eOmCp5yd59zoT4tp79CDSzbgk1tYhVcgunwujDM56E bKuEDjaqSWwIw7TxPSnnZDRmqU/ofShzdEoukVpgV4/rhe9nEtW15Eya6m/3g3APVHmZ oeq2DquYAPf8P7SUTYDqyAdjnz9wGbDo2shalhDcI0FRlsDPott45I7ZVhbc+WaCPy7O poblanzsZZrerx0iEBUf4F1L6fmDBeWAC9mcWoor2Pu9TuXs372Nwrq3KZzPfNc6B4aF /lbHDHss6dlkevJIY/uixH3E/F+EyPM2/28HhaHpq7wxFfTf4zkMmyZ6ItQArgTaVTMT yWUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=l9DnfuQ5l0M8+3JcucUGf/Gic3M3pNG6SEGLuvNe6wA=; fh=NJUXiZ9ySL+5Ow7BwRN07JO06kUiUS+DYYL0pKl745k=; b=o8QwkjKJxYSZyUTpTHzK3Z7GA7Qx9UN0dK81ROC0VmiD53X6cckgC7hIWVSbpFzQRT HlrJaBNPdc8sNlW8vYRqpLUIjvD0j3hZR8a4/gamxxGzjgKXb/FqxI8oTeAt9tcW7QLQ ux9Amy5PRPkfduua1K9Z34DGnCtq+G+ei9kC05AvZPZhZUnEqvwjTEAghFLjrfs6Zwp5 ALPJjjb3W8A+Fa6E6C19T70hmHdOiIq7JlbX3ssiigNp2iMfJOhDoYpUO3i4V8tb16Bt Bm0GgdMcM/aW9Eq43hY5h+m5+b65/dkcXZQdCjo0nOCvsf4f9jo2GzftaP+QKsXdXrHH fh+A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@codeweavers.com header.s=s1 header.b=I0K59Jrn; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codeweavers.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a7acac91401si781836666b.777.2024.07.30.06.12.32; Tue, 30 Jul 2024 06:12:32 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@codeweavers.com header.s=s1 header.b=I0K59Jrn; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codeweavers.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2F30168D7A9; Tue, 30 Jul 2024 16:12:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.codeweavers.com (mail.codeweavers.com [4.36.192.163]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2C64468D76C for ; Tue, 30 Jul 2024 16:12:12 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=codeweavers.com; s=s1; h=Message-ID:Date:Subject:Cc:To:From:Sender; bh=NuBf44Qj6+fLFCbrpNwxZt4rC0co9hHegINM0tGdX1A=; b=I0K59JrnYIf63u3UpthbnCFWlO W56bwAiUF4huo7qg+rvEXsmETgHOVhgnGAhPN2Gx8CQ82yW381dog3IOBCYJu0bZ8Rxg9Eafsv8KY +QPM15CgrfZg8vC/SdMSBLJlQnLQ08aI7ibQOmj0DxODQ0TAFVhTyzvD34FhQnQhQxA/vcZoDxwnP dYzGG9Hz31ZVx8890wxxo+2e/ckylWTpJCQeYYIwAhx4lfS3QJoF8iuUjwwXSn9vChOmXZvDo4NJr l4dmLhR0+aoKOhXgPWF6fo92P/HAN6TpfxnJGBwrpliM1QI/9o4ibNJpQxqM7IOoj7fdXMhHKkgYT cQZ8UYnw==; Received: from cw141ip115.vpn.codeweavers.com ([10.69.141.115] helo=localhost.localdomain) by mail.codeweavers.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sYme9-0055F4-39; Tue, 30 Jul 2024 08:12:10 -0500 From: Giovanni Mascellani To: ffmpeg-devel@ffmpeg.org Date: Tue, 30 Jul 2024 15:11:49 +0200 Message-ID: <20240730131149.210571-3-gmascellani@codeweavers.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240730131149.210571-1-gmascellani@codeweavers.com> References: <20240730131149.210571-1-gmascellani@codeweavers.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/evc_ps: Interpret a degenerate SAR as 1/1. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Cc: Giovanni Mascellani Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: bPxSEPQOWD5c The specification doesn't say what should happen in this case. Other implementations (e.g., Microsoft's Media Foundations) seem to interpret this as 1/1. Signed-off-by: Giovanni Mascellani --- libavcodec/evc_ps.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/evc_ps.c b/libavcodec/evc_ps.c index 637572d324..6c871e965e 100644 --- a/libavcodec/evc_ps.c +++ b/libavcodec/evc_ps.c @@ -87,6 +87,10 @@ static int vui_parameters(GetBitContext *gb, VUIParameters *vui) if (vui->aspect_ratio_idc == EXTENDED_SAR) { vui->sar_width = get_bits(gb, 16); vui->sar_height = get_bits(gb, 16); + if (vui->sar_width == 0 || vui->sar_height == 0) { + vui->sar_width = 1; + vui->sar_height = 1; + } } } vui->overscan_info_present_flag = get_bits(gb, 1);