From 9729c2396a02accb494b3052b8314b7f42517c58 Mon Sep 17 00:00:00 2001 From: Oneric Date: Fri, 18 Nov 2022 23:24:21 +0100 Subject: [PATCH] [UNTESTED] DirectVobSubFilter: stop overriding known BT.601 matrices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit e928f83920b04bb33e0df69c74bbaa8d04a47260 allowed colorimetry information to be received from the DirectShow filter chain, so we don’t need to rely on resolution-based guesses as much. However, since it only checked for BT709 (and assigned a suboptimal fallback for SMPTE240) but not BT601, a known-to-be BT601 matrix was still overriden by the fallback guess for larger video resolutions. --- .../transform/vsfilter/DirectVobSubFilter.cpp | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/filters/transform/vsfilter/DirectVobSubFilter.cpp b/src/filters/transform/vsfilter/DirectVobSubFilter.cpp index 526fdc0f5..8b8c36157 100644 --- a/src/filters/transform/vsfilter/DirectVobSubFilter.cpp +++ b/src/filters/transform/vsfilter/DirectVobSubFilter.cpp @@ -2287,10 +2287,22 @@ void CDirectVobSubFilter::SetYuvMatrix() } else { - yuv_matrix = (extformat.VideoTransferMatrix == DXVA2_VideoTransferMatrix_BT709 || - extformat.VideoTransferMatrix == DXVA2_VideoTransferMatrix_SMPTE240M || - m_xy_size_opt[SIZE_ORIGINAL_VIDEO].cx > m_bt601Width || - m_xy_size_opt[SIZE_ORIGINAL_VIDEO].cy > m_bt601Height) ? ColorConvTable::BT709 : ColorConvTable::BT601; + switch (extformat.VideoTransferMatrix) + { + // FIXME: ColorConvTable doesn't support SMPTE240M. + // Since it's more similar to BT709 than BT601, prefer the former. + case DXVA2_VideoTransferMatrix_SMPTE240M: // -fallthrough + case DXVA2_VideoTransferMatrix_BT709: + yuv_matrix = ColorConvTable::BT709; + break; + case DXVA2_VideoTransferMatrix_BT601: + yuv_matrix = ColorConvTable::BT601; + break; + default: + yuv_matrix = (m_xy_size_opt[SIZE_ORIGINAL_VIDEO].cx > m_bt601Width || + m_xy_size_opt[SIZE_ORIGINAL_VIDEO].cy > m_bt601Height) ? + ColorConvTable::BT709 : ColorConvTable::BT601; + } } } else