Skip to content

Commit

Permalink
Merge pull request #818 from atsampson/transatlantic
Browse files Browse the repository at this point in the history
Have a single definition of the SyncPulseType enum
  • Loading branch information
happycube authored Dec 10, 2022
2 parents 4d5bfaf + 522c8b5 commit 1dfbd72
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
8 changes: 8 additions & 0 deletions tools/ld-chroma-decoder/encoder/encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ static constexpr double kR = 0.87728321993817866838972487283129;
static constexpr double cbScale = ONE_MINUS_Kb * kB / C_SCALE;
static constexpr double crScale = ONE_MINUS_Kr * kR / C_SCALE;

// Types of sync pulse [Poynton p521 for PAL, p502 for NTSC]
enum SyncPulseType {
NONE = 0,
NORMAL,
EQUALIZATION,
BROAD
};

class Encoder
{
public:
Expand Down
8 changes: 0 additions & 8 deletions tools/ld-chroma-decoder/encoder/ntscencoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,6 @@ void NTSCEncoder::getFieldMetadata(qint32 fieldNo, LdDecodeMetaData::Field &fiel
fieldData.audioSamples = 0;
}

// Types of sync pulse [Poynton p502]
enum SyncPulseType {
NONE = 0,
NORMAL,
EQUALIZATION,
BROAD
};

// Generate a gate waveform for a sync pulse in one half of a line
static double syncPulseGate(double t, double startTime, SyncPulseType type)
{
Expand Down
18 changes: 5 additions & 13 deletions tools/ld-chroma-decoder/encoder/palencoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,6 @@ void PALEncoder::getFieldMetadata(qint32 fieldNo, LdDecodeMetaData::Field &field
fieldData.audioSamples = 0;
}

// Types of sync pulse [Poynton p521]
enum SyncPulseType {
NONE = 0,
NORMAL,
EQUALISATION,
BROAD
};

// Generate a gate waveform for a sync pulse in one half of a line
static double syncPulseGate(double t, double startTime, SyncPulseType type)
{
Expand All @@ -155,7 +147,7 @@ static double syncPulseGate(double t, double startTime, SyncPulseType type)
case NORMAL:
length = 4.7e-6;
break;
case EQUALISATION:
case EQUALIZATION:
length = 4.7e-6 / 2.0;
break;
case BROAD:
Expand Down Expand Up @@ -241,17 +233,17 @@ void PALEncoder::encodeLine(qint32 fieldNo, qint32 frameLine, const quint16 *inp
if (frameLine < 5) {
leftSyncType = BROAD;
} else if (frameLine >= 5 && frameLine < 10) {
leftSyncType = EQUALISATION;
leftSyncType = EQUALIZATION;
} else if (frameLine >= 620) {
leftSyncType = EQUALISATION;
leftSyncType = EQUALIZATION;
}
SyncPulseType rightSyncType = NONE;
if (frameLine < 4) {
rightSyncType = BROAD;
} else if (frameLine >= 4 && frameLine < 9) {
rightSyncType = EQUALISATION;
rightSyncType = EQUALIZATION;
} else if (frameLine >= 619 && frameLine < 624) {
rightSyncType = EQUALISATION;
rightSyncType = EQUALIZATION;
} else if (frameLine == 624) {
rightSyncType = BROAD;
}
Expand Down

0 comments on commit 1dfbd72

Please sign in to comment.