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 291B94AED9 for ; Thu, 23 May 2024 08:38:26 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 07EFF68D3C0; Thu, 23 May 2024 11:38:24 +0300 (EEST) Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3E11A68CFAB for ; Thu, 23 May 2024 11:38:17 +0300 (EEST) Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6f4472561f1so2433432b3a.0 for ; Thu, 23 May 2024 01:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716453495; x=1717058295; 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=LzRsBmURY0Ujd+yi1X+59DsFciG8S5ndlKHVs+QIDP8=; b=ZFqdG6epq53+X8hPGUXliCNED03NUuMXD6e6JbcsyzhoRhJBlYFlSID51FsZnIl1yS F7KwqsEmMr/XtRpdbAmPGVIsyRNUI8VQ2o1ToP0umzlOhFkvPnRRRtAdMNpN2mDWC607 H5XaLVLOBaMEKhHrnOIbbwa6vAvVa4ddHbb3GDnqqoxQidhq43NHqe2GnMb+MmrQz1h2 pJy3+rYMf2JM5WhKkht7oISZ0WbSpzj9XH8WmWSwDHiJ4v2vJnpNaZ3J79nSQPkgjPH+ jOvEbZkMHa3yf+rBSfiEIYxU8sWsQLmuMYb0cN5IPCxhpeUxaYhhdGE1hlqPcRlJqS7t STsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716453495; x=1717058295; 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=LzRsBmURY0Ujd+yi1X+59DsFciG8S5ndlKHVs+QIDP8=; b=qtCKLFhB2OUXB7xnFjMHg8our1gr6dtymKwBTf9Ml9SINaLD88W+A8CzrYwWNayFcF 91CBkXUiWwHFgUmGxTxaXUm6gj4+7mjREX6erQBiYrM+2GWuTHg6od7fWn+1ad4X+nIz Evtdc3xinC+q8twJdA+0lzDf8o0MdmQRPATdZ6wtPrj/zXUuj9lHscMjV+hyER12tojR mpXzWemfIVavg2OQpO3Du9WLVp/ZOEJvPqSa400FKNAHEuiamdmQhim8BFJiX2PmJlip Te80DEb05UbQwJLcP7Dxt4w9PTYMgm40sOQIXUG8ES3YFbiZwIo4v/Vcav9NEK8wab+o c1Fg== X-Gm-Message-State: AOJu0YyTfJLZXkdAseJxCd/7hBCejUw0Cm+j6sp3mfxKr1i1sVTfssis FlJA+oHNBqPfOztmP1j2B38Yd7ZEW32YTbKfP72N7YoJ9gi8L/gcTnoASw== X-Google-Smtp-Source: AGHT+IGYQPOegAsaQsI0IgDAeXxcY4fbibfDV+Wu/602JvykJE6QvyKpbqepaSsP2acqTWiPIYuCzQ== X-Received: by 2002:a05:6a00:1a94:b0:6f4:1799:c714 with SMTP id d2e1a72fcca58-6f6d6043093mr5663099b3a.12.1716453494680; Thu, 23 May 2024 01:38:14 -0700 (PDT) Received: from localhost.localdomain ([103.208.20.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2b301d3sm23605438b3a.205.2024.05.23.01.38.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 01:38:14 -0700 (PDT) From: llyyr.public@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Thu, 23 May 2024 14:07:51 +0530 Message-ID: <20240523083750.1332-2-llyyr.public@gmail.com> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 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 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".