From c123f3bf743d19f1aaed2ca6c9696472c0d1c8a5 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 23 Apr 2016 14:16:49 -0400 Subject: [PATCH] Fixed run extension, temporarily forced colour amplitude. --- Outputs/CRT/Internals/CRTOpenGL.cpp | 13 +++++-------- SignalProcessing/FIRFilter.cpp | 6 +++--- SignalProcessing/FIRFilter.hpp | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Outputs/CRT/Internals/CRTOpenGL.cpp b/Outputs/CRT/Internals/CRTOpenGL.cpp index ea92c979a..7edb4b7ca 100644 --- a/Outputs/CRT/Internals/CRTOpenGL.cpp +++ b/Outputs/CRT/Internals/CRTOpenGL.cpp @@ -449,8 +449,8 @@ char *OpenGLOutputBuilder::get_input_vertex_shader(const char *input_position, c "inputPositionsVarying[9] = inputPositionVarying + (vec2(4.0, 0.0) / textureSize);" "inputPositionsVarying[10] = inputPositionVarying + (vec2(5.0, 0.0) / textureSize);" - "phaseVarying = (phaseCyclesPerTick * (outputPosition.x - phaseTime) + phaseAmplitudeAndOffset.x) * 2.0 * 3.141592654;" - "amplitudeVarying = phaseAmplitudeAndOffset.y;" + "phaseVarying = (phaseCyclesPerTick * (extendedOutputPosition.x - phaseTime) + phaseAmplitudeAndOffset.x) * 2.0 * 3.141592654;" + "amplitudeVarying = 0.33;" // phaseAmplitudeAndOffset.y "vec2 eyePosition = 2.0*(extendedOutputPosition / outputTextureSize) - vec2(1.0) + vec2(0.5)/textureSize;" "gl_Position = vec4(eyePosition, 0.0, 1.0);" @@ -613,7 +613,7 @@ char *OpenGLOutputBuilder::get_chrominance_filter_fragment_shader() ");" "vec3 yuvColourInRange = (yuvColour - vec3(0.0, 0.5, 0.5)) * vec3(1.0, 2.0, 2.0);" - "fragColour = yuvToRGB * yuvColourInRange; " + "fragColour = yuvToRGB * yuvColourInRange;" "}"); } @@ -667,7 +667,7 @@ char *OpenGLOutputBuilder::get_output_vertex_shader(const char *header) "iSrcCoordinatesVarying = srcCoordinates;" "srcCoordinatesVarying = vec2(srcCoordinates.x / textureSize.x, (srcCoordinates.y + 0.5) / textureSize.y);" "float age = (timestampBase[int(lateralAndTimestampBaseOffset.y)] - timestamp) / ticksPerFrame;" - "alpha = 15.0*exp(-age*3.0);" //+ 0.2 + "alpha = 15.0*exp(-age*3.0);" "vec2 floatingPosition = (position / positionConversion) + lateralAndTimestampBaseOffset.x * scanNormal;" "vec2 mappedPosition = (floatingPosition - boundsOrigin) / boundsSize;" @@ -733,9 +733,6 @@ char *OpenGLOutputBuilder::get_output_fragment_shader(const char *sampling_funct std::unique_ptr OpenGLOutputBuilder::prepare_intermediate_shader(const char *input_position, const char *header, char *fragment_shader, GLenum texture_unit, bool extends) { - // TODO: at the minute, allowing extensions seems to throw the colour phase out of whack between encoding and decoding. Figure out why. - extends = false; - std::unique_ptr shader; char *vertex_shader = get_input_vertex_shader(input_position, header); if(vertex_shader && fragment_shader) @@ -778,7 +775,7 @@ void OpenGLOutputBuilder::prepare_composite_input_shader() float weights[12]; composite_y_filter_shader_program = prepare_intermediate_shader("outputPosition", "uniform sampler2D texID;", get_y_filter_fragment_shader(), composite_texture_unit, true); - SignalProcessing::FIRFilter luminance_filter(11, _cycles_per_line, 0.0f, colour_subcarrier_frequency - 50, SignalProcessing::FIRFilter::DefaultAttenuation); + SignalProcessing::FIRFilter luminance_filter(11, _cycles_per_line, 0.0f, colour_subcarrier_frequency, SignalProcessing::FIRFilter::DefaultAttenuation); composite_y_filter_shader_program->bind(); weightsUniform = composite_y_filter_shader_program->get_uniform_location("weights"); luminance_filter.get_coefficients(weights); diff --git a/SignalProcessing/FIRFilter.cpp b/SignalProcessing/FIRFilter.cpp index 7eae4e2b8..66db42376 100644 --- a/SignalProcessing/FIRFilter.cpp +++ b/SignalProcessing/FIRFilter.cpp @@ -115,7 +115,7 @@ void FIRFilter::get_coefficients(float *coefficients) } } -FIRFilter::FIRFilter(unsigned int number_of_taps, unsigned int input_sample_rate, float low_frequency, float high_frequency, float attenuation) +FIRFilter::FIRFilter(unsigned int number_of_taps, float input_sample_rate, float low_frequency, float high_frequency, float attenuation) { // we must be asked to filter based on an odd number of // taps, and at least three @@ -131,10 +131,10 @@ FIRFilter::FIRFilter(unsigned int number_of_taps, unsigned int input_sample_rate /* calculate idealised filter response */ unsigned int Np = (number_of_taps - 1) / 2; - float twoOverSampleRate = 2.0f / (float)input_sample_rate; + float twoOverSampleRate = 2.0f / input_sample_rate; float *A = new float[Np+1]; - A[0] = 2.0f * (high_frequency - low_frequency) / (float)input_sample_rate; + A[0] = 2.0f * (high_frequency - low_frequency) / input_sample_rate; for(unsigned int i = 1; i <= Np; i++) { float iPi = (float)i * (float)M_PI; diff --git a/SignalProcessing/FIRFilter.hpp b/SignalProcessing/FIRFilter.hpp index 71f6c1b0c..4f3c95588 100644 --- a/SignalProcessing/FIRFilter.hpp +++ b/SignalProcessing/FIRFilter.hpp @@ -44,7 +44,7 @@ class FIRFilter { @param high_frequency The highest frequency of signal to retain in the output. @param attenuation The attenuation of the discarded frequencies. */ - FIRFilter(unsigned int number_of_taps, unsigned int input_sample_rate, float low_frequency, float high_frequency, float attenuation); + FIRFilter(unsigned int number_of_taps, float input_sample_rate, float low_frequency, float high_frequency, float attenuation); ~FIRFilter();