From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 4222D4A8F1 for ; Thu, 23 May 2024 08:25:10 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D1CBA68D3C6; Thu, 23 May 2024 11:25:07 +0300 (EEST) Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E542168AA84 for ; Thu, 23 May 2024 11:25:01 +0300 (EEST) Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-6f472d550cbso3001281b3a.1 for ; Thu, 23 May 2024 01:25:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716452699; x=1717057499; darn=ffmpeg.org; h=subject:date:to:message-id:from:from:to:cc:subject:date:message-id :reply-to; bh=t3GxEU5rfQ3lvwu/ApknahIXPHLc9NI0aETVaf0FlAs=; b=DE3q9iZz4Me4bMKpjk9ivaee2/xoLFQShL77sQW82Ot3ssg5ANTObuQN9lYspmWnzN 6At30qXWpDXp3l4GKGPCNkcrH5JIck4RG7eDMzysRemD8EkJwSmD3ZyakURiJuJnHiKb cRE942X3rLh+0TJQZ82vG9RlGZnYAECzTWKQE8QhfZQtBSWTZJ4DDGdW0i8NO6SIAv91 HkrtCAoUCUF4Y0+dnuAv++dFJka48ndX49Jnn5itH9xy4llk9SoTynrgD9qFzykhDaFM Y7rQI3w510w1DaioS3aHMyWU4MUMPFQ6hQkBlDgzqDeRfqa2K8NSCKH4LdrBUYYGjwWW 1qsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716452699; x=1717057499; h=subject:date:to:message-id:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t3GxEU5rfQ3lvwu/ApknahIXPHLc9NI0aETVaf0FlAs=; b=BiXB5iUO0RMOJi+woLsqhEnNcf2hi1p+ul0F5EIcXm8pL4alTaCn8iCZLWDuM2Csy6 0Y0UCdGXlF7R9uofANkBuBMFXP7cUci4WxXhMtZK4D1UevSL6YkkxBD5PIj+PKZjwmsw HgE2iECJ41Gy787YnC2ShMKQ9dbk7qVZCXTJQbtNySwjevN9Jn9D4DhHW1B5g7rIwDiV /Md7KcFVBCUDbGCvz5XSEckaLO6cn5H01OrbEl6JXwAdzXnC19OVVPbKwGjTfatd+zNv 6yEUnhGqYnSSPyBk81PBaiX7paqID4R3ixJZGyfJ+xcFWpK3AX+LKMYgKP3UST9USi0A 87fg== X-Gm-Message-State: AOJu0YzCwgyotRi+KLPgR++wPzxkKYWydrY7OtmjHKRvL+LzisR0t2p2 dD4cKO/xIZCM3GBJ/PlhF4ApGuQRvkU4CpXbiogSKXCusfIwlHV+FEz72Q== X-Google-Smtp-Source: AGHT+IEWoMDlHtQcyJwA2dXx+oC0nE8Th0cvuSNSguDNlFbFJmyoSl2wOfX1sh9IcpdfN1A8YYVe6g== X-Received: by 2002:a05:6a00:23c4:b0:6ea:9252:435 with SMTP id d2e1a72fcca58-6f6d61bed8dmr5753145b3a.30.1716452699199; Thu, 23 May 2024 01:24:59 -0700 (PDT) Received: from localhost ([103.208.20.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2b3181fsm23599693b3a.217.2024.05.23.01.24.57 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 May 2024 01:24:58 -0700 (PDT) From: llyyr X-Google-Original-From: "llyyr" Message-Id: To: Date: Thu, 29 Feb 2024 11:28:35 +0530 Subject: [FFmpeg-devel] [PATCH v2] lavc/vp9: reset segmentation fields when segmentation isn't enabled 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 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Fields under the segmentation switch are never reset on a new frame, and retain the value from the previous frame. This bugs out a bunch of hwaccel drivers when segmentation is disabled but update_map isn't reset because they don't ignore values behind switches. This commit also resets the temporal field, though it may not be required. We also do this for vp8 [1] so this commit is just mirroring the vp8 logic. This fixes an issue with certain samples [2] that causes blocky artifacts with vaapi, d3d11va and cuda (and possibly others). Mesa worked around [3] this by ignoring these fields if segmentation.enabled is 0, but d3d11va still displays blocky artifacts. [1] https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/HEAD:/libavcodec/vp8.c#l811 [2] https://github.com/mpv-player/mpv/issues/13533 [3] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27816 Signed-off-by: llyyr --- libavcodec/vp9.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c index 6e2d18bf9595..8ede2e2eb358 100644 --- a/libavcodec/vp9.c +++ b/libavcodec/vp9.c @@ -709,6 +709,12 @@ static int decode_frame_header(AVCodecContext *avctx, s->s.h.segmentation.feat[i].skip_enabled = get_bits1(&s->gb); } } + } else { + // Reset fields under segmentation switch if segmentation is disabled. + // This is necessary because some hwaccels don't ignore these fields + // if segmentation is disabled. + s->s.h.segmentation.temporal = 0; + s->s.h.segmentation.update_map = 0; } // set qmul[] based on Y/UV, AC/DC and segmentation Q idx deltas base-commit: 2e877090f958131accb8c7e5ac10e5b9865d1735 -- 2.45.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".