shithub: dumb

Download patch

ref: fa3a8d1cafd0db06dc748af6755355f101978ad4
parent: 8b1e1b01ceea3d5b7cb5fa2a781a883ccfbe44af
author: Chris Moeller <kode54@gmail.com>
date: Mon Jan 11 04:00:41 EST 2010

{1/24/2007 5:52:26 AM}2007-01-23 17:42 UTC - kode54
- Fixed IT reader decompression to support compression+delta on files created with 2.15 or newer.

git-tfs-id: [http://localhost:8080/tfs/DefaultCollection/]$/foobar2000/files/plugins.root;C161

--- a/dumb/src/it/itread.c
+++ b/dumb/src/it/itread.c
@@ -122,7 +122,7 @@
 /** WARNING - do we even need to pass `right`? */
 /** WARNING - why bother memsetting at all? The whole array is written... */
 // if we do memset, dumb_silence() would be neater...
-static int decompress8(DUMBFILE *f, signed char *data, int len, int cmwt)
+static int decompress8(DUMBFILE *f, signed char *data, int len, int it215)
 {
 	int blocklen, blockpos;
 	byte bitwidth;
@@ -197,7 +197,7 @@
 			/* Version 2.15 was an unofficial version with hacked compression
 			 * code. Yay, better compression :D
 			 */
-			*data++ = cmwt == 0x215 ? d2 : d1;
+			*data++ = it215 ? d2 : d1;
 			len--;
 			blockpos++;
 		}
@@ -208,7 +208,7 @@
 
 
 
-static int decompress16(DUMBFILE *f, short *data, int len, int cmwt)
+static int decompress16(DUMBFILE *f, short *data, int len, int it215)
 {
 	int blocklen, blockpos;
 	byte bitwidth;
@@ -282,7 +282,7 @@
 			/* Version 2.15 was an unofficial version with hacked compression
 			 * code. Yay, better compression :D
 			 */
-			*data++ = cmwt == 0x215 ? d2 : d1;
+			*data++ = it215 ? d2 : d1;
 			len--;
 			blockpos++;
 		}
@@ -648,9 +648,9 @@
 //#endif
 */
 		if (sample->flags & IT_SAMPLE_16BIT)
-			decompress16(f, sample->data, datasize, cmwt);
+			decompress16(f, sample->data, datasize, ((cmwt >= 0x215) && (convert & 4)));
 		else
-			decompress8(f, sample->data, datasize, cmwt);
+			decompress8(f, sample->data, datasize, ((cmwt >= 0x215) && (convert & 4)));
  	} else if (sample->flags & IT_SAMPLE_16BIT) {
  		if (convert & 2)
 			for (n = 0; n < datasize; n++)