mirror of
https://github.com/dwsJason/gsla.git
synced 2024-12-26 20:30:26 +00:00
GSLA: seems to be spitting out a file, but is is valid?
This commit is contained in:
parent
8dfb3028c7
commit
1c0f4d5ae3
@ -351,6 +351,8 @@ void GSLAFile::SaveToFile(const char* pFilenamePath)
|
||||
pINIT->I = 'I'; pINIT->N = 'N'; pINIT->i = 'I'; pINIT->T = 'T';
|
||||
pINIT->chunk_length = 0; // temp chunk size
|
||||
|
||||
printf("Save Initial Frame\n");
|
||||
|
||||
// Need a place to put compressed data, in theory it could be bigger
|
||||
// than the original data, I think if that happens, the image was probably
|
||||
// designed to break this, anyway, give double theoretical max
|
||||
@ -362,6 +364,8 @@ void GSLAFile::SaveToFile(const char* pFilenamePath)
|
||||
// dictionary - Also use the best compression we can get here
|
||||
int compressedSize = Old_LZB_Compress(pWorkBuffer, pInitialFrame, m_frameSize);
|
||||
|
||||
printf("frameSize = %d\n", compressedSize);
|
||||
|
||||
for (int compressedIndex = 0; compressedIndex < compressedSize; ++compressedIndex)
|
||||
{
|
||||
bytes.push_back(pWorkBuffer[ compressedIndex ]);
|
||||
@ -396,11 +400,11 @@ void GSLAFile::SaveToFile(const char* pFilenamePath)
|
||||
unsigned char *pCanvas = new unsigned char[ m_frameSize ];
|
||||
memcpy(pCanvas, m_pC1PixelMaps[0], m_frameSize);
|
||||
|
||||
memcpy(pCanvas, m_pC1PixelMaps[0], m_frameSize);
|
||||
|
||||
// Let's encode some frames buddy
|
||||
for (int frameIndex = 1; frameIndex < m_pC1PixelMaps.size(); ++frameIndex)
|
||||
{
|
||||
printf("Save Frame %d\n", frameIndex+1);
|
||||
|
||||
// I don't want random data in the bank gaps, so initialize this
|
||||
// buffer with zero
|
||||
//memset(pWorkBuffer, 0, m_frameSize * 2);
|
||||
@ -409,6 +413,9 @@ void GSLAFile::SaveToFile(const char* pFilenamePath)
|
||||
m_frameSize, pWorkBuffer-bytes.size(),
|
||||
pCanvas, m_frameSize );
|
||||
|
||||
printf("frameSize = %d\n", frameSize);
|
||||
|
||||
|
||||
for (int frameIndex = 0; frameIndex < frameSize; ++frameIndex)
|
||||
{
|
||||
bytes.push_back(pWorkBuffer[ frameIndex ]);
|
||||
@ -418,10 +425,14 @@ void GSLAFile::SaveToFile(const char* pFilenamePath)
|
||||
// Add the RING Frame
|
||||
//memset(pWorkBuffer, 0, m_frameSize * 2);
|
||||
|
||||
printf("Save Ring Frame\n");
|
||||
|
||||
int ringSize = LZBA_Compress(pWorkBuffer, m_pC1PixelMaps[ 0 ],
|
||||
m_frameSize, pWorkBuffer-bytes.size(),
|
||||
pCanvas, m_frameSize );
|
||||
|
||||
printf("Ring Size %d\n", ringSize);
|
||||
|
||||
for (int ringIndex = 0; ringIndex < ringSize; ++ringIndex)
|
||||
{
|
||||
bytes.push_back(pWorkBuffer[ ringIndex ]);
|
||||
|
@ -262,7 +262,7 @@ static int AddDictionary(const DataString& data, int dictionarySize)
|
||||
pDictionary[ dictionarySize++ ] = data.pData[ dataIndex++ ];
|
||||
}
|
||||
|
||||
dictionarySize += data.size;
|
||||
//dictionarySize += data.size;
|
||||
|
||||
return dictionarySize;
|
||||
}
|
||||
@ -824,7 +824,7 @@ int LZBA_Compress(unsigned char* pDest, unsigned char* pSource, int sourceSize,
|
||||
int gapCount = 0;
|
||||
for (; tempCursorPosition < dictionarySize; ++tempCursorPosition)
|
||||
{
|
||||
if (pSource[ cursorPosition ] != pDictionary[ cursorPosition ])
|
||||
if (pSource[ tempCursorPosition ] != pDictionary[ tempCursorPosition ])
|
||||
{
|
||||
gapCount = 0;
|
||||
}
|
||||
@ -844,7 +844,9 @@ int LZBA_Compress(unsigned char* pDest, unsigned char* pSource, int sourceSize,
|
||||
// it from one part of the frame buffer to another part)
|
||||
|
||||
sourceData.pData = &pSource[ cursorPosition ];
|
||||
sourceData.size = tempCursorPosition - cursorPosition;
|
||||
sourceData.size = tempCursorPosition - cursorPosition + 1;
|
||||
|
||||
cursorPosition = tempCursorPosition;
|
||||
|
||||
while (sourceData.size > 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user