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 E1EE44A8F0 for ; Thu, 23 May 2024 08:33:02 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DD07E68D3C0; Thu, 23 May 2024 11:33:00 +0300 (EEST) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1546A68C682 for ; Thu, 23 May 2024 11:32:54 +0300 (EEST) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1f05b669b6cso18019305ad.3 for ; Thu, 23 May 2024 01:32:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716453171; x=1717057971; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=hs8114GRhX5lgr3lHIZHKS7SDu7xUu6KGlPE55FHzho=; b=DDmM6tAEiPGr7enQGb5gUQS7CECzDH2YNQ8GbyKMK3YPyIsR8W0H7g5eripzi7sLz6 9qm8+kefZ/2VJKzkZE0HvEPQCmnz9Yf000OS1u3pfyA3EHzWqHyulRdomi0hIyONiOye LCAOvCVpDgJSPWIg3KU3RseketRkNapKPVl/R+4wkNWc+P/lEv8XUl1x2UIXUgWxTY4s wQNX/1asVGxkCFhy4N+Hz4yWywbht2yLBLgjehIraZFnTNbSO+Mv+i9ImkA65jwbly3V 7Xct0vvcahWaP9qRPa1vWrJwvONr5mAe9RdLNFr5qtn4hJgsUIYDTeEGFZUpF9H07ixK oEBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716453171; x=1717057971; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hs8114GRhX5lgr3lHIZHKS7SDu7xUu6KGlPE55FHzho=; b=sI+yIaMdiCVK4Bva4PHZhJfd7GDqorcBpBysptxSXeMVVpzVv0UBU+dzFvLvVcXEyE v3xwDehBMdVS6fbWg8uedPnjsB1sJ+CS7pLT2Ot8NeFblFpBPBKXv3Qnpw8FMfOLOEjy sZ9x4MqolHBB8EmWASimcQaQBWKuHV8zvBob6iDQny0RAI5Q8z6u6tOmKmhZC6nNlUdJ kB08e/LK/3s0Lft0UDldA8IrPR5i8sJVZSSccyKuhPECQ8ykOEO8cL4FbHbuUfZZ3Zxh xY/Op4lxKej4xJEBGpkPxrEQ1i+moMDxWDNoBDwE+2M2jTz9jxSrBUVqgetlVOA4Q8Dt y5TA== X-Gm-Message-State: AOJu0YygBCuZ2QzlrkC/PHjWs2V/dsvFV4G4fk5yDWZi0ITR8WKBmK14 y9maqO/monHShGv9BlUbfjSloOxvXj4pwf97p4YdJuXj+zTdXVnFlt7Nkw== X-Google-Smtp-Source: AGHT+IGYmYIHyCtyEL2/hoe5Pn4NL9911Mn6RcMervPEPOPzAg9fTAjXea9Ijv29EK0kJqB+RjToZA== X-Received: by 2002:a17:902:9a94:b0:1f3:465:2869 with SMTP id d9443c01a7336-1f31c984a71mr36901685ad.31.1716453171441; Thu, 23 May 2024 01:32:51 -0700 (PDT) Received: from localhost.localdomain ([103.208.20.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f2f9b4c020sm74568335ad.186.2024.05.23.01.32.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 01:32:50 -0700 (PDT) From: llyyr.public@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Thu, 23 May 2024 14:02:46 +0530 Message-ID: <20240523083246.31844-1-llyyr.public@gmail.com> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] 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 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: From: llyyr 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 -- 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".