From cbe5fe53328156e510804a59e3c45fae1b80cefe Mon Sep 17 00:00:00 2001
From: popcornmix <popcornmix@gmail.com>
Date: Fri, 17 Sep 2021 15:23:16 +0100
Subject: [PATCH 4/7] DVDVideoCodecDRMPRIME: Leave deinterlace filter active on
 a progressive frame

Interlaced content often has strange mixtures of interlace and progressive frames (e.g. IIPPPPIIPPPP)
and currently we can be creating and destroying the deinterlace filter graph almost every frame.

If it's been created, then leave it active until end of file. The frames marked as progressive should
be just copied by deinterlace filter
---
 .../VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp     | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index 606e8902668f..0210b72d037c 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -896,6 +896,10 @@ std::string CDVDVideoCodecDRMPRIME::GetFilterChain(bool interlaced)
   if (!m_processInfo.Supports(mInt))
     mInt = m_processInfo.GetFallbackDeintMethod();
 
+  // avoid disabling deinterlace graph for occasional progressive frames - they will be copied by deinterlace
+  if (!m_filters.empty())
+    interlaced = true;
+
   if (mInt != VS_INTERLACEMETHOD_NONE && interlaced && !m_deintFilterName.empty())
     filterChain += m_deintFilterName;
 
-- 
2.39.5

