Skip to content

Commit

Permalink
improved default NTSC custom palette
Browse files Browse the repository at this point in the history
  • Loading branch information
thrust26 committed Dec 9, 2024
1 parent 8d5eb28 commit 4bb07a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/common/PaletteHandler.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -449,13 +449,15 @@ void PaletteHandler::generateCustomPalette(ConsoleTiming timing) const
{
constexpr int NUM_CHROMA = 16;
constexpr int NUM_LUMA = 8;
constexpr float SATURATION = 0.25F; // default saturation

if(timing == ConsoleTiming::ntsc)
{
constexpr float SATURATION = 0.30F; // default NTSC saturation
vector2d IQ[NUM_CHROMA];
// YIQ is YUV shifted by 33 degrees
constexpr float offset = 33 * BSPF::PI_f / 180;
// YIQ is YUV shifted by 33°
// -90° + 33° = -57° would create a greenish yellow
// -90° + 53° = -37° creates gold (which is correct according to the documentation)
constexpr float offset = (33 + 20) * BSPF::PI_f / 180;
const float shift = myPhaseNTSC * BSPF::PI_f / 180;

// color 0 is grayscale
Expand Down Expand Up @@ -496,6 +498,7 @@ void PaletteHandler::generateCustomPalette(ConsoleTiming timing) const
}
else if(timing == ConsoleTiming::pal)
{
constexpr float SATURATION = 0.25F; // default PAL saturation
constexpr float offset = BSPF::PI_f;
const float shift = myPhasePAL * BSPF::PI_f / 180;
constexpr float fixedShift = 22.5F * BSPF::PI_f / 180;
Expand Down
2 changes: 1 addition & 1 deletion src/common/PaletteHandler.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PaletteHandler
static constexpr string_view SETTING_CUSTOM = "custom";

// Phase shift default and limits
static constexpr float DEF_NTSC_SHIFT = 26.2F;
static constexpr float DEF_NTSC_SHIFT = 26.7F; // makes color $fx fall between $1x and $2x
static constexpr float DEF_PAL_SHIFT = 31.3F; // ~= 360 / 11.5
static constexpr float MAX_PHASE_SHIFT = 4.5F;
static constexpr float DEF_RGB_SHIFT = 0.0F;
Expand Down

0 comments on commit 4bb07a9

Please sign in to comment.