beautypg.com

Intel Extensible Firmware Interface User Manual

Page 980

background image

Extensible Firmware Interface Specification

H-16

12/01/02

Version 1.10

return Status;
}

InitSlide();

HufEncodeStart();

mRemainder = FreadCrc(&mText[WNDSIZ], WNDSIZ + MAXMATCH);

mMatchLen = 0;
mPos = WNDSIZ;
InsertNode();
if (mMatchLen > mRemainder) {
mMatchLen = mRemainder;
}
while (mRemainder > 0) {
LastMatchLen = mMatchLen;
LastMatchPos = mMatchPos;
GetNextMatch();
if (mMatchLen > mRemainder) {
mMatchLen = mRemainder;
}

if (mMatchLen > LastMatchLen || LastMatchLen < THRESHOLD) {

//
// Not enough benefits are gained by outputting a pointer,
// so just output the original character
//

Output(mText[mPos - 1], 0);
} else {

//
// Outputting a pointer is beneficial enough, do it.
//

Output(LastMatchLen + (UINT8_MAX + 1 - THRESHOLD),
(mPos - LastMatchPos - 2) & (WNDSIZ - 1));
while (--LastMatchLen > 0) {
GetNextMatch();
}
if (mMatchLen > mRemainder) {
mMatchLen = mRemainder;
}
}
}

HufEncodeEnd();
FreeMemory();
return EFI_SUCCESS;
}

STATIC
VOID
CountTFreq ()
/*++