Print Page

From mywiki
Jump to navigation Jump to search

Pass 1

b = 0x27ea7e8bf8c80000
x = 0
y = 0
		/* read the unary MSBs and end bit */
		x = y = COUNT_ZERO_MSBS2(b);  /* x=y=2 
b = 0x27ea7e8bf8c80000
x = 2
y = 2
/*	if(x == FLAC__BITS_PER_WORD) {
			x = ucbits;
			do {
				/* didn't find stop bit yet, have to keep going... */
				cwords++;
				if (cwords >= words)
					goto incomplete_msbs;
				b = br->buffer[cwords];
				y = COUNT_ZERO_MSBS2(b);
				x += y;
			} while(y == FLAC__BITS_PER_WORD);
		}
    */
		b <<= y;
b = 0x9fa9fa2fe3200000
x = 2
y = 2
		b <<= 1; /* account for stop bit */
b = 0x3f53f45fc6400000
x = 2
y = 2
		ucbits = (ucbits - x - 1) % FLAC__BITS_PER_WORD;
b = 0x3f53f45fc6400000
x = 2
y = 2
ucbits = 0x2a 42
		msbs = x;
b = 0x3f53f45fc6400000
x = 2
y = 2
ucbits = 0x2a 42
msbs = 2
		if(x > limit)
			return false;

		/* read the binary LSBs */
		x = (FLAC__uint32)(b >> (FLAC__BITS_PER_WORD - parameter)); /* parameter < 32, so we can cast to 32-bit uint32_t */
b = 0x3f53f45fc6400000
x = 0xfd
y = 2
ucbits = 0x2a 42
msbs = 2
parameter = 0xA 10
		if(parameter <= ucbits) {
			ucbits -= parameter;
b = 0x3f53f45fc6400000
x = 0xfd
y = 2
ucbits = 0x20 32
msbs = 2
parameter = 0xA 10
			b <<= parameter;
b = 0x4fd17f1900000000
x = 0xfd
y = 2
ucbits = 0x20 32
msbs = 2
parameter = 0xA 10
		} else {
			/* there are still bits left to read, they will all be in the next word */
			cwords++;
			if (cwords >= words)
				goto incomplete_lsbs;
			b = br->buffer[cwords];
			ucbits += FLAC__BITS_PER_WORD - parameter;
			x |= (FLAC__uint32)(b >> ucbits);
			b <<= FLAC__BITS_PER_WORD - ucbits;
		}
		lsbs = x;
b = 0x4fd17f1900000000
x = 0xfd
y = 2
ucbits = 0x20 32
msbs = 2
parameter = 0xA 10
lsbs = 0xfd
		/* compose the value */
		x = (msbs << parameter) | lsbs;
b = 0x4fd17f1900000000
x = 0x8fd
y = 2
ucbits = 0x20 32
msbs = 2
parameter = 0xA 10
lsbs = 0xfd
		*val++ = (int)(x >> 1) ^ -(int)(x & 1);
b = 0x4fd17f1900000000
x = 0x8fd
y = 2
ucbits = 0x20 32
msbs = 2
parameter = 0xA 10
lsbs = 0xfd

  • val++ = FFFFBF18

Pass 2

b = 0x4fd17f1900000000
x = 0x8fd
y = 2
		/* read the unary MSBs and end bit */
		x = y = COUNT_ZERO_MSBS2(b);  /* x=y=2 
b = 0x4fd17f1900000000
x = 1
y = 1
/*	if(x == FLAC__BITS_PER_WORD) {
			x = ucbits;
			do {
				/* didn't find stop bit yet, have to keep going... */
				cwords++;
				if (cwords >= words)
					goto incomplete_msbs;
				b = br->buffer[cwords];
				y = COUNT_ZERO_MSBS2(b);
				x += y;
			} while(y == FLAC__BITS_PER_WORD);
		}
    */
		b <<= y;
b = 0x9fa2fe3200000000
x = 1
y = 1
		b <<= 1; /* account for stop bit */
b = 0x3f45fc6400000000
x = 1
y = 1
		ucbits = (ucbits - x - 1) % FLAC__BITS_PER_WORD;
b = 0x3f45fc6400000000
x = 1
y = 1
ucbits = 0x1e 30
		msbs = x;
b = 0x3f45fc6400000000
x = 1
y = 1
ucbits = 0x1E 30
msbs = 1
		if(x > limit)
			return false;

		/* read the binary LSBs */
		x = (FLAC__uint32)(b >> (FLAC__BITS_PER_WORD - parameter)); /* parameter < 32, so we can cast to 32-bit uint32_t */
b = 0x3f45fc6400000000
x = 0xfd
y = 1
ucbits = 0x1E 30
msbs = 1
parameter = 0xA 10
		if(parameter <= ucbits) {
			ucbits -= parameter;
b = 0x3f45fc6400000000
x = 0xfd
y = 1
ucbits = 0x14 20
msbs = 1
parameter = 0xA 10
			b <<= parameter;
b = 0x17f1900000000000
x = 0xfd
y = 1
ucbits = 0x14 20
msbs = 1
parameter = 0xA 10
		} else {
			/* there are still bits left to read, they will all be in the next word */
			cwords++;
			if (cwords >= words)
				goto incomplete_lsbs;
			b = br->buffer[cwords];
			ucbits += FLAC__BITS_PER_WORD - parameter;
			x |= (FLAC__uint32)(b >> ucbits);
			b <<= FLAC__BITS_PER_WORD - ucbits;
		}
		lsbs = x;
b = 0x17f1900000000000
x = 0xfd
y = 1
ucbits = 0x14 20
msbs = 1
parameter = 0xA 10
lsbs = 0xfd
		/* compose the value */
		x = (msbs << parameter) | lsbs;
b = 0x17f1900000000000
x = 0x4fd
y = 1
ucbits = 0x14 20
msbs = 1
parameter = 0xA 10
lsbs = 0xfd
		*val++ = (int)(x >> 1) ^ -(int)(x & 1);
b = 0x17f1900000000000
x = 0x4fd
y = 1
ucbits = 0x14 20
msbs = 1
parameter = 0xA 10
lsbs = 0xfd

  • val++ = ffffDF18
	continue;

Notes for code analysis
4 bytes / int 32 Bits.

little endian memory dump of in storage buffer

19 7F D1 4F 19 7F D1 4F 19 7F D1 4F FD 44 01 37  56 26 0A 25 B2 EE F6 7F 9D 10 5D 79 62 33 5B 9F B4 0E 65 24 15 7A 35 13 370144FD4FD17F19 at 2380 in test.flac.

File

3701 44FD 4FD1 4FD1 7F19 7FF6 EEB2 250A 2656 does not line up with contiguous memory location.  Only 64 bit word valid in memory (if reversed) 
loc 2380 in file

word