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 220CA4AED3 for ; Thu, 23 May 2024 08:29:19 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2428268D3C6; Thu, 23 May 2024 11:29:16 +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 CD78568C4C8 for ; Thu, 23 May 2024 11:29:09 +0300 (EEST) Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-6f73cd613aaso491163b3a.0 for ; Thu, 23 May 2024 01:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716452947; x=1717057747; darn=ffmpeg.org; h=subject:date:to:message-id:from:from:to:cc:subject:date:message-id :reply-to; bh=t3GxEU5rfQ3lvwu/ApknahIXPHLc9NI0aETVaf0FlAs=; b=m96lzx6tGaQ6gHXss+09upYdjMCkaycn05zVZPVs1U8Du0bYGw7zV9YQj9wpZFBind jOXweP4/XZjDKp1jA0+/s8Ok9WjxEEkNAhd/WScC0zMljWce4xLBJG5n2AQFgteBtgeP GFkdvhwOFdIfhl2R7/Y1GCc251QTQlu5Rc+7ZuAJWAECKjyGNRi7CpjzBW1oDFUxJs9L lxbLuz8uJyMjEFMlpaee8dTeYsw0lbSt0n1bErQgzxQGmGgc6rc89POpZ+jDr4iSzNOr 45WnKkxIq8pauIsQvswtB+S0EmaewcRfALSat6Ve1huyPyAl6+PeYTnqmYCCEjeF3QKo OEKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716452947; x=1717057747; h=subject:date:to:message-id:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t3GxEU5rfQ3lvwu/ApknahIXPHLc9NI0aETVaf0FlAs=; b=DM7Zawni+JnufL4HIJ/Qv/yQ7mxtJlX2ahOFmOnltts9FkmkkVpRpq0+kutW9/qcTH n1LvVG8gkpOPStF6gSDFkuQkMIh1cwc+uJM1qu7BbFtxjxJc8FnHT+q3kiLV4YZ/+wwV FmGftk9Sf+AGMLerO80LpgMrZckurHOkGsELktghVtYEZ4lrTUraX36HhKgBo31xXjvT kRAcX2Rl4aqsS6fIrwXQVfLySUc0ZjIu8nCpxkbeNhHry7AC8vt6rl/hTEMUHAGz1y5x C8hfzmehZS3j6nHu5MrIjAGCAy+jgv8rrY1Obe/GstVt4aetZmw3awRtB13emkHQ5n+P Byzg== X-Gm-Message-State: AOJu0YwjES0CHPiU7mn1LdkTJRoe85VUrE6flO0wdkUULl6icoRCJNYl 7LhNCWAzq8he11EPW3W60OT5syzl1UMhsxXkc4gZFe7MHT0jPioWn0p20w== X-Google-Smtp-Source: AGHT+IGBOuXIWcYez9lRnrbSp4DOsDBFVfLQzHo1KxdfcZVxVvz3XtN7i/Q0sk0mYhZ6nHqhxqvB/Q== X-Received: by 2002:a05:6a20:9688:b0:1b0:3910:3796 with SMTP id adf61e73a8af0-1b205d0f382mr1743073637.31.1716452947350; Thu, 23 May 2024 01:29:07 -0700 (PDT) Received: from localhost ([103.208.20.250]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-63411346dc1sm20724831a12.83.2024.05.23.01.29.04 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 May 2024 01:29:05 -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".