From a83612094585cc6b588e1bd014266b3daf9c15a9 Mon Sep 17 00:00:00 2001
From: Thomas Harte <thomas.harte@gmail.com>
Date: Tue, 3 Jan 2017 22:32:07 -0500
Subject: [PATCH] =?UTF-8?q?Restored=20proper=20colour=20separation,=20but?=
 =?UTF-8?q?=20somewhere=20a=20massive=20hit=20in=20horizontal=20resolution?=
 =?UTF-8?q?=20is=20happening=20=E2=80=94=20much=20greater=20than=20one=20w?=
 =?UTF-8?q?ould=20expect=20from=20the=20sample=20size=20picked.=20So=20inv?=
 =?UTF-8?q?estigation=20to=20come.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Outputs/CRT/Internals/CRTConstants.hpp | 2 +-
 Outputs/CRT/Internals/CRTOpenGL.cpp    | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/Outputs/CRT/Internals/CRTConstants.hpp b/Outputs/CRT/Internals/CRTConstants.hpp
index b7fefe8b9..54f14edbe 100644
--- a/Outputs/CRT/Internals/CRTConstants.hpp
+++ b/Outputs/CRT/Internals/CRTConstants.hpp
@@ -36,7 +36,7 @@ const GLsizei InputBufferBuilderWidth = 2048;
 const GLsizei InputBufferBuilderHeight = 512;
 
 // This is the size of the intermediate buffers used during composite to RGB conversion
-const GLsizei IntermediateBufferWidth = 4096;
+const GLsizei IntermediateBufferWidth = 2048;
 const GLsizei IntermediateBufferHeight = 512;
 
 // Some internal buffer sizes
diff --git a/Outputs/CRT/Internals/CRTOpenGL.cpp b/Outputs/CRT/Internals/CRTOpenGL.cpp
index 6ad598b9f..01535b2d3 100644
--- a/Outputs/CRT/Internals/CRTOpenGL.cpp
+++ b/Outputs/CRT/Internals/CRTOpenGL.cpp
@@ -383,26 +383,27 @@ void OpenGLOutputBuilder::set_timing_uniforms()
 
 	float colour_subcarrier_frequency = (float)colour_cycle_numerator_ / (float)colour_cycle_denominator_;
 	float output_width = ((float)colour_cycle_numerator_ * 4.0f) / (float)(colour_cycle_denominator_ * IntermediateBufferWidth);
+	float sample_cycles_per_line = cycles_per_line_ / output_width;
 
 	if(composite_separation_filter_program_)
 	{
 		composite_separation_filter_program_->set_width_scalers(output_width, output_width);
-		composite_separation_filter_program_->set_separation_frequency(cycles_per_line_, colour_subcarrier_frequency);
+		composite_separation_filter_program_->set_separation_frequency(sample_cycles_per_line, colour_subcarrier_frequency);
 	}
 	if(composite_y_filter_shader_program_)
 	{
 		composite_y_filter_shader_program_->set_width_scalers(output_width, output_width);
-		composite_y_filter_shader_program_->set_filter_coefficients(cycles_per_line_, colour_subcarrier_frequency * 0.25f);
+		composite_y_filter_shader_program_->set_filter_coefficients(sample_cycles_per_line, colour_subcarrier_frequency * 0.25f);
 	}
 	if(composite_chrominance_filter_shader_program_)
 	{
 		composite_chrominance_filter_shader_program_->set_width_scalers(output_width, output_width);
-		composite_chrominance_filter_shader_program_->set_filter_coefficients(cycles_per_line_, colour_subcarrier_frequency * 0.5f);
+		composite_chrominance_filter_shader_program_->set_filter_coefficients(sample_cycles_per_line, colour_subcarrier_frequency * 0.5f);
 	}
 	if(rgb_filter_shader_program_)
 	{
 		rgb_filter_shader_program_->set_width_scalers(output_width, output_width);
-		rgb_filter_shader_program_->set_filter_coefficients(cycles_per_line_, (float)input_frequency_ * 0.5f);
+		rgb_filter_shader_program_->set_filter_coefficients(sample_cycles_per_line, (float)input_frequency_ * 0.5f);
 	}
 	if(output_shader_program_)
 	{