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 00A964AED2 for ; Thu, 23 May 2024 08:32:07 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BF34968D3C0; Thu, 23 May 2024 11:32:05 +0300 (EEST) Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3051868D1BC for ; Thu, 23 May 2024 11:31:59 +0300 (EEST) Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-6f67f4bebadso2063932b3a.0 for ; Thu, 23 May 2024 01:31:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716453117; x=1717057917; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=hs8114GRhX5lgr3lHIZHKS7SDu7xUu6KGlPE55FHzho=; b=lSClAbZl1eIX/BnF3F6iUYQN8mEJLr75aVRzRm1nh3EXU1eJgGPLtIELN6uU9f1xqz PiJRbR202ikdwFo3YNEr643ovhY1NYOYfw0FkejGe/YcMmHPKgxpWjQTGvD8Hih4t/C6 m9q4WSCgZ4RF+Ocl0M+Zxk7q4JQEP3j7ji0MMN8YnjCPjHqbK1y4NpPnfPdR8fyTkIZ7 rJlw2t3j2/d+VG+VtTX6RQ4rVEvWvphoO4tEbYWDeDlGLdveq49xl2IddxMLE2zUprpF G7RrJQiQVeqYK9aIeTcEpcql669l4E4bxgeE/GdcHrXPE6sbVgYdpHmZN2TpsVjUN5LO MgPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716453117; x=1717057917; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hs8114GRhX5lgr3lHIZHKS7SDu7xUu6KGlPE55FHzho=; b=aiGQZdmPI+1uqj3Zy+O93TAQp/Y4Gz4oSSb4hjAfoSf7wU6uJm4px/oauu3Epu+BYi 0rr8vYrbQbnbXRWJwgGuc3vYJpSK6kuuzI5v5E7bC6Sf0dkAXqAnnmiTt6uwbYfQHKwn xTE6lhdJJDI7OpXOq1Ak8urtPKsd/QmDfT/mBTGPhX0lKyvLlV5L/peJVkVi5CdkmwST I+5rKmBCMLsbxl8f/EbKxqR/Z9GHw2y6aaNhEq/+Q+5swVn2cHKm4WGzDTJyX7FLQQ/a +aMl+wf2y+3JtHcELmMRUxrr5qyYTuQEcj/sqLA5hI5NrEE+fkCRdpOzXVaS11pN/9Ra dzoQ== X-Gm-Message-State: AOJu0YzFj7xjxD8Tw2j1bUpwDo7a1W9OWuNQLr0tDuKsSv1KrUpay/3b ztCkQMkXnaHUhrp4pNWJLsPIf1jWsDSP4ukCf/fRvuTvmgJZw6/U2cNuig== X-Google-Smtp-Source: AGHT+IF9NFAIAnPFP1QZGw5UoAYgMImQycF6aDwOO/NMAb7YIRwK8iN+cV6wCOnZ50VfDSBu+s6TpQ== X-Received: by 2002:a05:6a00:1912:b0:6ee:1c9d:b471 with SMTP id d2e1a72fcca58-6f6d61665a7mr4437763b3a.25.1716453117104; Thu, 23 May 2024 01:31:57 -0700 (PDT) Received: from localhost.localdomain ([103.208.20.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2af589fsm23623335b3a.158.2024.05.23.01.31.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 01:31:56 -0700 (PDT) From: llyyr.public@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Thu, 23 May 2024 14:01:51 +0530 Message-ID: <20240523083151.31699-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 Cc: llyyr 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".