Skip to content

Commit

Permalink
Disabled compression for IMAGES / SEQUENCES.
Browse files Browse the repository at this point in the history
  • Loading branch information
spotlessmind1975 committed Jun 4, 2023
1 parent 44e9f5e commit b17c944
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 66 deletions.
66 changes: 33 additions & 33 deletions ugbc/src/targets/common/images_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,35 +224,35 @@ Variable * images_load( Environment * _environment, char * _filename, char * _al

if ( _bank_expansion && _environment->expansionBanks ) {

// Try to compress the result of image conversion.
// This means that the buffer will be compressed using MSC1
// algorithm, up to 32 frequent sequences. The original size of
// the buffer will be considered as "uncompressed" size.
MSC1Compressor * compressor = msc1_create( 32 );
final->uncompressedSize = final->size;
MemoryBlock * output = msc1_compress( compressor, final->valueBuffer, final->uncompressedSize, &final->size );

int temporary;
MemoryBlock * outputCheck = msc1_uncompress( compressor, output, final->size, &temporary );
if ( memcmp( outputCheck, final->valueBuffer, final->uncompressedSize ) != 0 ) {
CRITICAL("Compression failed");
}
msc1_free( compressor );
// printf( "%s: %d bytes -> %d bytes\n", _filename, final->uncompressedSize, final->size );
// If the compressed memory is greater than the original
// size, we discard the compression and we will continue as
// usual.
if ( final->uncompressedSize < final->size ) {
final->size = final->uncompressedSize;
final->uncompressedSize = 0;
free( output );
}
// Otherwise, we can safely replace the original data
// buffer with the compressed one.
else {
free( final->valueBuffer );
final->valueBuffer = output;
}
// // Try to compress the result of image conversion.
// // This means that the buffer will be compressed using MSC1
// // algorithm, up to 32 frequent sequences. The original size of
// // the buffer will be considered as "uncompressed" size.
// MSC1Compressor * compressor = msc1_create( 32 );
// final->uncompressedSize = final->size;
// MemoryBlock * output = msc1_compress( compressor, final->valueBuffer, final->uncompressedSize, &final->size );

// int temporary;
// MemoryBlock * outputCheck = msc1_uncompress( compressor, output, final->size, &temporary );
// if ( memcmp( outputCheck, final->valueBuffer, final->uncompressedSize ) != 0 ) {
// CRITICAL("Compression failed");
// }
// msc1_free( compressor );
// // printf( "%s: %d bytes -> %d bytes\n", _filename, final->uncompressedSize, final->size );
// // If the compressed memory is greater than the original
// // size, we discard the compression and we will continue as
// // usual.
// if ( final->uncompressedSize < final->size ) {
// final->size = final->uncompressedSize;
// final->uncompressedSize = 0;
// free( output );
// }
// // Otherwise, we can safely replace the original data
// // buffer with the compressed one.
// else {
// free( final->valueBuffer );
// final->valueBuffer = output;
// }

Bank * bank = _environment->expansionBanks;

Expand Down Expand Up @@ -282,11 +282,11 @@ Variable * images_load( Environment * _environment, char * _filename, char * _al
// memory. If uncompressed size is zero, it means that
// the memory block is not compressed -- so we can use the
// size as well.
int realSize = final->uncompressedSize;
if ( realSize == 0 ) realSize = final->size;
// int realSize = final->uncompressedSize;
// if ( realSize == 0 ) realSize = final->size;

if ( _environment->maxExpansionBankSize[_bank_expansion] < realSize ) {
_environment->maxExpansionBankSize[_bank_expansion] = realSize;
if ( _environment->maxExpansionBankSize[_bank_expansion] < final->frameSize ) {
_environment->maxExpansionBankSize[_bank_expansion] = final->frameSize;
}

} else if ( _flags & FLAG_COMPRESSED ) {
Expand Down
66 changes: 33 additions & 33 deletions ugbc/src/targets/common/sequence_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,35 +213,35 @@ Variable * sequence_load( Environment * _environment, char * _filename, char * _

if ( _bank_expansion && _environment->expansionBanks ) {

// Try to compress the result of image conversion.
// This means that the buffer will be compressed using MSC1
// algorithm, up to 32 frequent sequences. The original size of
// the buffer will be considered as "uncompressed" size.
MSC1Compressor * compressor = msc1_create( 32 );
final->uncompressedSize = final->size;
MemoryBlock * output = msc1_compress( compressor, final->valueBuffer, final->uncompressedSize, &final->size );

int temporary;
MemoryBlock * outputCheck = msc1_uncompress( compressor, output, final->size, &temporary );
if ( memcmp( outputCheck, final->valueBuffer, final->uncompressedSize ) != 0 ) {
CRITICAL("Compression failed");
}
msc1_free( compressor );
// printf( "%s: %d bytes -> %d bytes\n", _filename, final->uncompressedSize, final->size );
// If the compressed memory is greater than the original
// size, we discard the compression and we will continue as
// usual.
if ( final->uncompressedSize < final->size ) {
final->size = final->uncompressedSize;
final->uncompressedSize = 0;
free( output );
}
// Otherwise, we can safely replace the original data
// buffer with the compressed one.
else {
free( final->valueBuffer );
final->valueBuffer = output;
}
// // Try to compress the result of image conversion.
// // This means that the buffer will be compressed using MSC1
// // algorithm, up to 32 frequent sequences. The original size of
// // the buffer will be considered as "uncompressed" size.
// MSC1Compressor * compressor = msc1_create( 32 );
// final->uncompressedSize = final->size;
// MemoryBlock * output = msc1_compress( compressor, final->valueBuffer, final->uncompressedSize, &final->size );

// int temporary;
// MemoryBlock * outputCheck = msc1_uncompress( compressor, output, final->size, &temporary );
// if ( memcmp( outputCheck, final->valueBuffer, final->uncompressedSize ) != 0 ) {
// CRITICAL("Compression failed");
// }
// msc1_free( compressor );
// // printf( "%s: %d bytes -> %d bytes\n", _filename, final->uncompressedSize, final->size );
// // If the compressed memory is greater than the original
// // size, we discard the compression and we will continue as
// // usual.
// if ( final->uncompressedSize < final->size ) {
// final->size = final->uncompressedSize;
// final->uncompressedSize = 0;
// free( output );
// }
// // Otherwise, we can safely replace the original data
// // buffer with the compressed one.
// else {
// free( final->valueBuffer );
// final->valueBuffer = output;
// }

Bank * bank = _environment->expansionBanks;

Expand Down Expand Up @@ -271,11 +271,11 @@ Variable * sequence_load( Environment * _environment, char * _filename, char * _
// memory. If uncompressed size is zero, it means that
// the memory block is not compressed -- so we can use the
// size as well.
int realSize = final->uncompressedSize;
if ( realSize == 0 ) realSize = final->size;
// int realSize = final->uncompressedSize;
// if ( realSize == 0 ) realSize = final->size;

if ( _environment->maxExpansionBankSize[_bank_expansion] < realSize ) {
_environment->maxExpansionBankSize[_bank_expansion] = realSize;
if ( _environment->maxExpansionBankSize[_bank_expansion] < final->frameSize ) {
_environment->maxExpansionBankSize[_bank_expansion] = final->frameSize;
}

} else if ( _flags & FLAG_COMPRESSED ) {
Expand Down

0 comments on commit b17c944

Please sign in to comment.