Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCasimir666 <casimir666@users.sourceforge.net>2008-08-28 01:24:16 +0400
committerCasimir666 <casimir666@users.sourceforge.net>2008-08-28 01:24:16 +0400
commit2fd5d27c622a705d6b4a67e7e13c7b224d409b86 (patch)
treefc79869bcdb50a385e281911d01607283ef39672 /src/subtitles/HdmvSub.cpp
parent3bc4b8d506f2fbaf6b46eb77ab57c41425a56d96 (diff)
Fix : wrong colorspace conversion in PGS
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@759 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/subtitles/HdmvSub.cpp')
-rw-r--r--src/subtitles/HdmvSub.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/subtitles/HdmvSub.cpp b/src/subtitles/HdmvSub.cpp
index 14ad0fa5e..52eefb5c7 100644
--- a/src/subtitles/HdmvSub.cpp
+++ b/src/subtitles/HdmvSub.cpp
@@ -219,7 +219,7 @@ void CHdmvSub::ParsePalette(CGolombBuffer* pGBuffer, USHORT nSize) // #497
HDMV_PALETTE* pPalette = (HDMV_PALETTE*)pGBuffer->GetBufferPos();
if (m_pCurrentObject)
- m_pCurrentObject->SetPalette (nNbEntry, pPalette);
+ m_pCurrentObject->SetPalette (nNbEntry, pPalette, m_VideoDescriptor.nVideoWidth>720);
}
void CHdmvSub::ParseObject(CGolombBuffer* pGBuffer, USHORT nUnitSize) // #498
@@ -372,18 +372,19 @@ CHdmvSub::CompositionObject::~CompositionObject()
delete[] m_pRLEData;
}
-void CHdmvSub::CompositionObject::SetPalette (int nNbEntry, HDMV_PALETTE* pPalette)
+void CHdmvSub::CompositionObject::SetPalette (int nNbEntry, HDMV_PALETTE* pPalette, bool bIsHD)
{
m_nColorNumber = nNbEntry;
for (int i=0; i<m_nColorNumber; i++)
{
- BYTE R = (BYTE)(pPalette[i].Y + 1.402*(pPalette[i].Cr-128));
- BYTE G = (BYTE)(pPalette[i].Y - 0.34414*(pPalette[i].Cb-128) - 0.71414*(pPalette[i].Cr-128));
- BYTE B = (BYTE)(pPalette[i].Y + 1.772*(pPalette[i].Cb-128));
-
- m_Colors[pPalette[i].entry_id] = pPalette[i].T<<24|R<<16|G<<8|B;
- TRACE_HDMVSUB ("%03d : %08x\n", pPalette[i].entry_id, m_Colors[pPalette[i].entry_id]);
+ if (bIsHD)
+ m_Colors[pPalette[i].entry_id] = pPalette[i].T<<24|
+ YCrCbToRGB_Rec709 (pPalette[i].Y, pPalette[i].Cr, pPalette[i].Cb);
+ else
+ m_Colors[pPalette[i].entry_id] = pPalette[i].T<<24|
+ YCrCbToRGB_Rec601 (pPalette[i].Y, pPalette[i].Cr, pPalette[i].Cb);
+// TRACE_HDMVSUB ("%03d : %08x\n", pPalette[i].entry_id, m_Colors[pPalette[i].entry_id]);
}
}