Read DCLUTs from X/28/1
DCLUTs cannot be edited yet.
This commit is contained in:
@@ -348,12 +348,13 @@ QImage TeletextPageDecode::drcsImage(DRCSSource pageType, int subTable, int chr,
|
|||||||
QImage result = QImage(rawData, 12, 10, 12, QImage::Format_Indexed8);
|
QImage result = QImage(rawData, 12, 10, 12, QImage::Format_Indexed8);
|
||||||
|
|
||||||
// Now put in the colours
|
// Now put in the colours
|
||||||
// TODO read colours from X/28/1, for now we put in the default colours
|
|
||||||
for (int i=0; i<16; i++) {
|
for (int i=0; i<16; i++) {
|
||||||
|
const int clr = m_levelOnePage->dCLUT(pageType-1, drcsMode, i);
|
||||||
|
|
||||||
if (flashPhOn)
|
if (flashPhOn)
|
||||||
result.setColor(i, m_levelOnePage->CLUTtoQColor(i).rgb());
|
result.setColor(i, m_levelOnePage->CLUTtoQColor(clr).rgb());
|
||||||
else
|
else
|
||||||
result.setColor(i, m_levelOnePage->CLUTtoQColor(i ^ 8).rgb());
|
result.setColor(i, m_levelOnePage->CLUTtoQColor(clr ^ 8).rgb());
|
||||||
|
|
||||||
if (i == 3 && drcsMode == 1)
|
if (i == 3 && drcsMode == 1)
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -234,7 +234,6 @@ bool LevelOnePage::setPacket(int y, int d, QByteArray pkt)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("LevelOnePage unhandled setPacket X/%d/%d", y, d);
|
|
||||||
return PageX26Base::setPacket(y, d, pkt);
|
return PageX26Base::setPacket(y, d, pkt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,6 +382,42 @@ bool LevelOnePage::isPaletteDefault(int fromColour, int toColour) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int LevelOnePage::dCLUT(bool globalDrcs, int mode, int index) const
|
||||||
|
{
|
||||||
|
if (!packetExists(28, 1))
|
||||||
|
// Return default DCLUT as per D.1.6 and D.2.2 in the ETSI spec
|
||||||
|
return index;
|
||||||
|
|
||||||
|
const QByteArray pkt = packet(28, 1);
|
||||||
|
|
||||||
|
if (mode == 1) {
|
||||||
|
if (!globalDrcs)
|
||||||
|
index += 4;
|
||||||
|
} else if (mode == 2 || mode == 3)
|
||||||
|
index += globalDrcs ? 8 : 24;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// Some tricky bit juggling to extract 5 bits from parts of a 6-bit triplet
|
||||||
|
const int l = index/6*5 + 4;
|
||||||
|
|
||||||
|
switch (index % 6) {
|
||||||
|
case 0:
|
||||||
|
return pkt.at(l) & 0x1f;
|
||||||
|
case 1:
|
||||||
|
return ((pkt.at(l+1) & 0x0f) << 1) | (pkt.at(l) >> 5);
|
||||||
|
case 2:
|
||||||
|
return ((pkt.at(l+2) & 0x07) << 2) | (pkt.at(l+1) >> 4);
|
||||||
|
case 3:
|
||||||
|
return ((pkt.at(l+3) & 0x03) << 3) | (pkt.at(l+2) >> 3);
|
||||||
|
case 4:
|
||||||
|
return ((pkt.at(l+4) & 0x01) << 4) | (pkt.at(l+3) >> 2);
|
||||||
|
case 5:
|
||||||
|
return pkt.at(l+4) >> 1;
|
||||||
|
}
|
||||||
|
return 0; // Won't get here; used to suppress a compiler warning
|
||||||
|
}
|
||||||
|
|
||||||
int LevelOnePage::levelRequired() const
|
int LevelOnePage::levelRequired() const
|
||||||
{
|
{
|
||||||
// X/28/4 present i.e. CLUTs 0 or 1 redefined - Level 3.5
|
// X/28/4 present i.e. CLUTs 0 or 1 redefined - Level 3.5
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ public:
|
|||||||
QColor CLUTtoQColor(int index, int renderlevel=3) const;
|
QColor CLUTtoQColor(int index, int renderlevel=3) const;
|
||||||
bool isPaletteDefault(int colour) const;
|
bool isPaletteDefault(int colour) const;
|
||||||
bool isPaletteDefault(int fromColour, int toColour) const;
|
bool isPaletteDefault(int fromColour, int toColour) const;
|
||||||
|
int dCLUT(bool globalDrcs, int mode, int index) const;
|
||||||
int levelRequired() const;
|
int levelRequired() const;
|
||||||
bool leftSidePanelDisplayed() const { return m_leftSidePanelDisplayed; }
|
bool leftSidePanelDisplayed() const { return m_leftSidePanelDisplayed; }
|
||||||
void setLeftSidePanelDisplayed(bool newLeftSidePanelDisplayed);
|
void setLeftSidePanelDisplayed(bool newLeftSidePanelDisplayed);
|
||||||
|
|||||||
Reference in New Issue
Block a user