A little Delphine unpacker documentation addition and variable renaming.
svn-id: r32660
This commit is contained in:
parent
235504e600
commit
efc4fd7ae0
2 changed files with 22 additions and 16 deletions
|
@ -36,23 +36,23 @@ uint32 CineUnpacker::readSource() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CineUnpacker::rcr(int CF) {
|
int CineUnpacker::rcr(int inputCarry) {
|
||||||
int rCF = (_chk & 1);
|
int outputCarry = (_chunk32b & 1);
|
||||||
_chk >>= 1;
|
_chunk32b >>= 1;
|
||||||
if (CF) {
|
if (inputCarry) {
|
||||||
_chk |= 0x80000000;
|
_chunk32b |= 0x80000000;
|
||||||
}
|
}
|
||||||
return rCF;
|
return outputCarry;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CineUnpacker::nextBit() {
|
int CineUnpacker::nextBit() {
|
||||||
int CF = rcr(0);
|
int carry = rcr(0);
|
||||||
if (_chk == 0) {
|
if (_chunk32b == 0) {
|
||||||
_chk = readSource();
|
_chunk32b = readSource();
|
||||||
_crc ^= _chk;
|
_crc ^= _chunk32b;
|
||||||
CF = rcr(1);
|
carry = rcr(1);
|
||||||
}
|
}
|
||||||
return CF;
|
return carry;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 CineUnpacker::getBits(byte numBits) {
|
uint16 CineUnpacker::getBits(byte numBits) {
|
||||||
|
@ -85,8 +85,8 @@ bool CineUnpacker::unpack(byte *dst, const byte *src, int srcLen) {
|
||||||
_datasize = readSource();
|
_datasize = readSource();
|
||||||
_dst = dst + _datasize - 1;
|
_dst = dst + _datasize - 1;
|
||||||
_crc = readSource();
|
_crc = readSource();
|
||||||
_chk = readSource();
|
_chunk32b = readSource();
|
||||||
_crc ^= _chk;
|
_crc ^= _chunk32b;
|
||||||
do {
|
do {
|
||||||
if (!nextBit()) {
|
if (!nextBit()) {
|
||||||
if (!nextBit()) {
|
if (!nextBit()) {
|
||||||
|
|
|
@ -38,7 +38,13 @@ public:
|
||||||
private:
|
private:
|
||||||
/** Reads a single big endian 32-bit integer from the source and goes backwards 4 bytes. */
|
/** Reads a single big endian 32-bit integer from the source and goes backwards 4 bytes. */
|
||||||
uint32 readSource();
|
uint32 readSource();
|
||||||
int rcr(int CF);
|
|
||||||
|
/**
|
||||||
|
* Shifts the current internal 32-bit chunk to the right by one.
|
||||||
|
* Puts input carry into internal chunk's topmost (i.e. leftmost) bit.
|
||||||
|
* Returns the least significant bit that was shifted out.
|
||||||
|
*/
|
||||||
|
int rcr(int inputCarry);
|
||||||
int nextBit();
|
int nextBit();
|
||||||
uint16 getBits(byte numBits);
|
uint16 getBits(byte numBits);
|
||||||
void unpackBytes(uint16 numBytes);
|
void unpackBytes(uint16 numBytes);
|
||||||
|
@ -46,7 +52,7 @@ private:
|
||||||
private:
|
private:
|
||||||
int _datasize;
|
int _datasize;
|
||||||
uint32 _crc;
|
uint32 _crc;
|
||||||
uint32 _chk;
|
uint32 _chunk32b; //!< The current internal 32-bit chunk
|
||||||
byte *_dst;
|
byte *_dst;
|
||||||
const byte *_src;
|
const byte *_src;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue