1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-06 01:28:57 +00:00

Instituted de-escalating phase-related extensions, definitively to kill rounding error edges.

This commit is contained in:
Thomas Harte 2017-01-08 16:24:22 -05:00
parent cf6d03e35c
commit 79632b1d34
3 changed files with 6 additions and 16 deletions

View File

@ -425,27 +425,16 @@ void OpenGLOutputBuilder::set_timing_uniforms()
const float output_width = ((float)colour_cycle_numerator_ * 4.0f) / (float)(colour_cycle_denominator_ * IntermediateBufferWidth);
const float sample_cycles_per_line = cycles_per_line_ / output_width;
OpenGL::IntermediateShader *intermediate_shaders[] = {
composite_input_shader_program_.get(),
composite_separation_filter_program_.get(),
composite_chrominance_filter_shader_program_.get()
};
bool extends = false;
float phase_cycles_per_tick = 0.25f;
for(int c = 0; c < 3; c++)
{
if(intermediate_shaders[c]) intermediate_shaders[c]->set_phase_cycles_per_sample(phase_cycles_per_tick, extends);
extends = true;
}
if(composite_separation_filter_program_)
{
composite_separation_filter_program_->set_width_scalers(output_width, output_width);
composite_separation_filter_program_->set_separation_frequency(sample_cycles_per_line, colour_subcarrier_frequency);
composite_separation_filter_program_->set_phase_cycles_per_sample(0.25f, 6.0f);
}
if(composite_chrominance_filter_shader_program_)
{
composite_chrominance_filter_shader_program_->set_width_scalers(output_width, output_width);
composite_chrominance_filter_shader_program_->set_phase_cycles_per_sample(0.25f, 5.0f);
}
if(rgb_filter_shader_program_)
{
@ -460,6 +449,7 @@ void OpenGLOutputBuilder::set_timing_uniforms()
if(composite_input_shader_program_)
{
composite_input_shader_program_->set_width_scalers(1.0f, output_width);
composite_input_shader_program_->set_phase_cycles_per_sample(0.25f, 0.0f);
}
if(rgb_input_shader_program_)
{

View File

@ -461,10 +461,10 @@ void IntermediateShader::set_separation_frequency(float sampling_rate, float col
set_filter_coefficients(sampling_rate, colour_burst_frequency);
}
void IntermediateShader::set_phase_cycles_per_sample(float phase_cycles_per_sample, bool extend_runs_to_full_cycle)
void IntermediateShader::set_phase_cycles_per_sample(float phase_cycles_per_sample, float extension)
{
set_uniform("phaseCyclesPerTick", (GLfloat)phase_cycles_per_sample);
set_uniform("extension", extend_runs_to_full_cycle ? ceilf(1.0f / phase_cycles_per_sample) : 0.0f);
set_uniform("extension", extension);
}
void IntermediateShader::set_colour_conversion_matrices(float *fromRGB, float *toRGB)

View File

@ -76,7 +76,7 @@ public:
geometry should be extended so that a complete colour cycle is included at both the beginning and end,
to occur upon the next `bind`.
*/
void set_phase_cycles_per_sample(float phase_cycles_per_sample, bool extend_runs_to_full_cycle);
void set_phase_cycles_per_sample(float phase_cycles_per_sample, float extension);
/*!
Queues setting the matrices that convert between RGB and chrominance/luminance to occur on the next `bind`.