1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Tweaks coefficients some more; makes sure that data is never larger than the intermediate buffers.

This commit is contained in:
Thomas Harte 2020-09-02 20:14:41 -04:00
parent 8bab9d5d60
commit 6efd8782fe

View File

@ -544,6 +544,11 @@ using BufferingScanTarget = Outputs::Display::BufferingScanTarget;
const float minimumSize = 4.0f * float(modals.colour_cycle_numerator) / float(modals.colour_cycle_denominator);
while(uniforms()->cyclesMultiplier * modals.cycles_per_line < minimumSize) {
uniforms()->cyclesMultiplier += 1.0f;
if(uniforms()->cyclesMultiplier * modals.cycles_per_line > 2048) {
uniforms()->cyclesMultiplier -= 1.0f;
break;
}
}
// Create the composition render pass.
@ -567,10 +572,10 @@ using BufferingScanTarget = Outputs::Display::BufferingScanTarget;
// Generate the chrominance filter.
{
auto *const chromaCoefficients = uniforms()->chromaCoefficients;
SignalProcessing::FIRFilter chrominancefilter(15, float(_lineBufferPixelsPerLine), 0.0f, colourCyclesPerLine * 0.25f); // * (isSVideoOutput ? 1.0f : 0.25f)
SignalProcessing::FIRFilter chrominancefilter(15, float(_lineBufferPixelsPerLine), 0.0f, colourCyclesPerLine * 0.01f);
const auto calculatedChromaCoefficients = chrominancefilter.get_coefficients();
for(size_t c = 0; c < 8; ++c) {
chromaCoefficients[c].y = chromaCoefficients[c].z = calculatedChromaCoefficients[c] * (isSVideoOutput ? 4.0f : 4.0f);
chromaCoefficients[c].y = chromaCoefficients[c].z = calculatedChromaCoefficients[c] * (isSVideoOutput ? 4.0f : 2.0f);
chromaCoefficients[c].x = 0.0f;
}
chromaCoefficients[7].x = 1.0f;
@ -578,7 +583,7 @@ using BufferingScanTarget = Outputs::Display::BufferingScanTarget;
// Luminance is under-filtered during the separation phase in order not to subtract too much from chrominance;
// therefore an additional filtering is applied here.
if(!isSVideoOutput) {
SignalProcessing::FIRFilter luminancefilter(15, float(_lineBufferPixelsPerLine), 0.0f, colourCyclesPerLine);
SignalProcessing::FIRFilter luminancefilter(15, float(_lineBufferPixelsPerLine), 0.0f, colourCyclesPerLine * 0.8f);
const auto calculatedLumaCoefficients = luminancefilter.get_coefficients();
for(size_t c = 0; c < 8; ++c) {
chromaCoefficients[c].x = calculatedLumaCoefficients[c];
@ -589,7 +594,7 @@ using BufferingScanTarget = Outputs::Display::BufferingScanTarget;
// Generate the luminance separation filter.
{
auto *const luminanceCoefficients = uniforms()->lumaCoefficients;
SignalProcessing::FIRFilter luminancefilter(15, float(_lineBufferPixelsPerLine), 0.0f, colourCyclesPerLine * 1.25f);
SignalProcessing::FIRFilter luminancefilter(15, float(_lineBufferPixelsPerLine), 0.0f, colourCyclesPerLine);
const auto calculatedCoefficients = luminancefilter.get_coefficients();
memcpy(luminanceCoefficients, calculatedCoefficients.data(), sizeof(float)*8);
}