]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/CCode/Source/Common/Decompress.c
- Fixed EDKT513 by adding existing section files into the dependency check of genffsf...
[mirror_edk2.git] / Tools / CCode / Source / Common / Decompress.c
1 /*++
2
3 Copyright (c) 2004, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 Decompress.c
15
16 Abstract:
17
18 Decompressor. Algorithm Ported from OPSD code (Decomp.asm)
19 for Efi and Tiano compress algorithm.
20
21 --*/
22
23 #include "Decompress.h"
24
25 //
26 // Decompression algorithm begins here
27 //
28 #define BITBUFSIZ 32
29 #define MAXMATCH 256
30 #define THRESHOLD 3
31 #define CODE_BIT 16
32 #define BAD_TABLE - 1
33
34 //
35 // C: Char&Len Set; P: Position Set; T: exTra Set
36 //
37 #define NC (0xff + MAXMATCH + 2 - THRESHOLD)
38 #define CBIT 9
39 #define EFIPBIT 4
40 #define MAXPBIT 5
41 #define TBIT 5
42 #define MAXNP ((1U << MAXPBIT) - 1)
43 #define NT (CODE_BIT + 3)
44 #if NT > MAXNP
45 #define NPT NT
46 #else
47 #define NPT MAXNP
48 #endif
49
50 typedef struct {
51 UINT8 *mSrcBase; // Starting address of compressed data
52 UINT8 *mDstBase; // Starting address of decompressed data
53 UINT32 mOutBuf;
54 UINT32 mInBuf;
55
56 UINT16 mBitCount;
57 UINT32 mBitBuf;
58 UINT32 mSubBitBuf;
59 UINT16 mBlockSize;
60 UINT32 mCompSize;
61 UINT32 mOrigSize;
62
63 UINT16 mBadTableFlag;
64
65 UINT16 mLeft[2 * NC - 1];
66 UINT16 mRight[2 * NC - 1];
67 UINT8 mCLen[NC];
68 UINT8 mPTLen[NPT];
69 UINT16 mCTable[4096];
70 UINT16 mPTTable[256];
71 } SCRATCH_DATA;
72
73 STATIC UINT16 mPbit = EFIPBIT;
74
75 STATIC
76 VOID
77 FillBuf (
78 IN SCRATCH_DATA *Sd,
79 IN UINT16 NumOfBits
80 )
81 /*++
82
83 Routine Description:
84
85 Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
86
87 Arguments:
88
89 Sd - The global scratch data
90 NumOfBit - The number of bits to shift and read.
91
92 Returns: (VOID)
93
94 --*/
95 {
96 Sd->mBitBuf = (UINT32) (Sd->mBitBuf << NumOfBits);
97
98 while (NumOfBits > Sd->mBitCount) {
99
100 Sd->mBitBuf |= (UINT32) (Sd->mSubBitBuf << (NumOfBits = (UINT16) (NumOfBits - Sd->mBitCount)));
101
102 if (Sd->mCompSize > 0) {
103 //
104 // Get 1 byte into SubBitBuf
105 //
106 Sd->mCompSize--;
107 Sd->mSubBitBuf = 0;
108 Sd->mSubBitBuf = Sd->mSrcBase[Sd->mInBuf++];
109 Sd->mBitCount = 8;
110
111 } else {
112 //
113 // No more bits from the source, just pad zero bit.
114 //
115 Sd->mSubBitBuf = 0;
116 Sd->mBitCount = 8;
117
118 }
119 }
120
121 Sd->mBitCount = (UINT16) (Sd->mBitCount - NumOfBits);
122 Sd->mBitBuf |= Sd->mSubBitBuf >> Sd->mBitCount;
123 }
124
125 STATIC
126 UINT32
127 GetBits (
128 IN SCRATCH_DATA *Sd,
129 IN UINT16 NumOfBits
130 )
131 /*++
132
133 Routine Description:
134
135 Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
136 NumOfBits of bits from source. Returns NumOfBits of bits that are
137 popped out.
138
139 Arguments:
140
141 Sd - The global scratch data.
142 NumOfBits - The number of bits to pop and read.
143
144 Returns:
145
146 The bits that are popped out.
147
148 --*/
149 {
150 UINT32 OutBits;
151
152 OutBits = (UINT32) (Sd->mBitBuf >> (BITBUFSIZ - NumOfBits));
153
154 FillBuf (Sd, NumOfBits);
155
156 return OutBits;
157 }
158
159 STATIC
160 UINT16
161 MakeTable (
162 IN SCRATCH_DATA *Sd,
163 IN UINT16 NumOfChar,
164 IN UINT8 *BitLen,
165 IN UINT16 TableBits,
166 OUT UINT16 *Table
167 )
168 /*++
169
170 Routine Description:
171
172 Creates Huffman Code mapping table according to code length array.
173
174 Arguments:
175
176 Sd - The global scratch data
177 NumOfChar - Number of symbols in the symbol set
178 BitLen - Code length array
179 TableBits - The width of the mapping table
180 Table - The table
181
182 Returns:
183
184 0 - OK.
185 BAD_TABLE - The table is corrupted.
186
187 --*/
188 {
189 UINT16 Count[17];
190 UINT16 Weight[17];
191 UINT16 Start[18];
192 UINT16 *Pointer;
193 UINT16 Index3;
194 UINT16 Index;
195 UINT16 Len;
196 UINT16 Char;
197 UINT16 JuBits;
198 UINT16 Avail;
199 UINT16 NextCode;
200 UINT16 Mask;
201
202 for (Index = 1; Index <= 16; Index++) {
203 Count[Index] = 0;
204 }
205
206 for (Index = 0; Index < NumOfChar; Index++) {
207 Count[BitLen[Index]]++;
208 }
209
210 Start[1] = 0;
211
212 for (Index = 1; Index <= 16; Index++) {
213 Start[Index + 1] = (UINT16) (Start[Index] + (Count[Index] << (16 - Index)));
214 }
215
216 if (Start[17] != 0) {
217 /*(1U << 16)*/
218 return (UINT16) BAD_TABLE;
219 }
220
221 JuBits = (UINT16) (16 - TableBits);
222
223 for (Index = 1; Index <= TableBits; Index++) {
224 Start[Index] >>= JuBits;
225 Weight[Index] = (UINT16) (1U << (TableBits - Index));
226 }
227
228 while (Index <= 16) {
229 Weight[Index++] = (UINT16) (1U << (16 - Index));
230 }
231
232 Index = (UINT16) (Start[TableBits + 1] >> JuBits);
233
234 if (Index != 0) {
235 Index3 = (UINT16) (1U << TableBits);
236 while (Index != Index3) {
237 Table[Index++] = 0;
238 }
239 }
240
241 Avail = NumOfChar;
242 Mask = (UINT16) (1U << (15 - TableBits));
243
244 for (Char = 0; Char < NumOfChar; Char++) {
245
246 Len = BitLen[Char];
247 if (Len == 0) {
248 continue;
249 }
250
251 NextCode = (UINT16) (Start[Len] + Weight[Len]);
252
253 if (Len <= TableBits) {
254
255 for (Index = Start[Len]; Index < NextCode; Index++) {
256 Table[Index] = Char;
257 }
258
259 } else {
260
261 Index3 = Start[Len];
262 Pointer = &Table[Index3 >> JuBits];
263 Index = (UINT16) (Len - TableBits);
264
265 while (Index != 0) {
266 if (*Pointer == 0) {
267 Sd->mRight[Avail] = Sd->mLeft[Avail] = 0;
268 *Pointer = Avail++;
269 }
270
271 if (Index3 & Mask) {
272 Pointer = &Sd->mRight[*Pointer];
273 } else {
274 Pointer = &Sd->mLeft[*Pointer];
275 }
276
277 Index3 <<= 1;
278 Index--;
279 }
280
281 *Pointer = Char;
282
283 }
284
285 Start[Len] = NextCode;
286 }
287 //
288 // Succeeds
289 //
290 return 0;
291 }
292
293 STATIC
294 UINT32
295 DecodeP (
296 IN SCRATCH_DATA *Sd
297 )
298 /*++
299
300 Routine Description:
301
302 Decodes a position value.
303
304 Arguments:
305
306 Sd - the global scratch data
307
308 Returns:
309
310 The position value decoded.
311
312 --*/
313 {
314 UINT16 Val;
315 UINT32 Mask;
316 UINT32 Pos;
317
318 Val = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)];
319
320 if (Val >= MAXNP) {
321 Mask = 1U << (BITBUFSIZ - 1 - 8);
322
323 do {
324
325 if (Sd->mBitBuf & Mask) {
326 Val = Sd->mRight[Val];
327 } else {
328 Val = Sd->mLeft[Val];
329 }
330
331 Mask >>= 1;
332 } while (Val >= MAXNP);
333 }
334 //
335 // Advance what we have read
336 //
337 FillBuf (Sd, Sd->mPTLen[Val]);
338
339 Pos = Val;
340 if (Val > 1) {
341 Pos = (UINT32) ((1U << (Val - 1)) + GetBits (Sd, (UINT16) (Val - 1)));
342 }
343
344 return Pos;
345 }
346
347 STATIC
348 UINT16
349 ReadPTLen (
350 IN SCRATCH_DATA *Sd,
351 IN UINT16 nn,
352 IN UINT16 nbit,
353 IN UINT16 Special
354 )
355 /*++
356
357 Routine Description:
358
359 Reads code lengths for the Extra Set or the Position Set
360
361 Arguments:
362
363 Sd - The global scratch data
364 nn - Number of symbols
365 nbit - Number of bits needed to represent nn
366 Special - The special symbol that needs to be taken care of
367
368 Returns:
369
370 0 - OK.
371 BAD_TABLE - Table is corrupted.
372
373 --*/
374 {
375 UINT16 Number;
376 UINT16 CharC;
377 UINT16 Index;
378 UINT32 Mask;
379
380 Number = (UINT16) GetBits (Sd, nbit);
381
382 if (Number == 0) {
383 CharC = (UINT16) GetBits (Sd, nbit);
384
385 for (Index = 0; Index < 256; Index++) {
386 Sd->mPTTable[Index] = CharC;
387 }
388
389 for (Index = 0; Index < nn; Index++) {
390 Sd->mPTLen[Index] = 0;
391 }
392
393 return 0;
394 }
395
396 Index = 0;
397
398 while (Index < Number) {
399
400 CharC = (UINT16) (Sd->mBitBuf >> (BITBUFSIZ - 3));
401
402 if (CharC == 7) {
403 Mask = 1U << (BITBUFSIZ - 1 - 3);
404 while (Mask & Sd->mBitBuf) {
405 Mask >>= 1;
406 CharC += 1;
407 }
408 }
409
410 FillBuf (Sd, (UINT16) ((CharC < 7) ? 3 : CharC - 3));
411
412 Sd->mPTLen[Index++] = (UINT8) CharC;
413
414 if (Index == Special) {
415 CharC = (UINT16) GetBits (Sd, 2);
416 CharC--;
417 while ((INT16) (CharC) >= 0) {
418 Sd->mPTLen[Index++] = 0;
419 CharC--;
420 }
421 }
422 }
423
424 while (Index < nn) {
425 Sd->mPTLen[Index++] = 0;
426 }
427
428 return MakeTable (Sd, nn, Sd->mPTLen, 8, Sd->mPTTable);
429 }
430
431 STATIC
432 VOID
433 ReadCLen (
434 SCRATCH_DATA *Sd
435 )
436 /*++
437
438 Routine Description:
439
440 Reads code lengths for Char&Len Set.
441
442 Arguments:
443
444 Sd - the global scratch data
445
446 Returns: (VOID)
447
448 --*/
449 {
450 UINT16 Number;
451 UINT16 CharC;
452 UINT16 Index;
453 UINT32 Mask;
454
455 Number = (UINT16) GetBits (Sd, CBIT);
456
457 if (Number == 0) {
458 CharC = (UINT16) GetBits (Sd, CBIT);
459
460 for (Index = 0; Index < NC; Index++) {
461 Sd->mCLen[Index] = 0;
462 }
463
464 for (Index = 0; Index < 4096; Index++) {
465 Sd->mCTable[Index] = CharC;
466 }
467
468 return ;
469 }
470
471 Index = 0;
472 while (Index < Number) {
473
474 CharC = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)];
475 if (CharC >= NT) {
476 Mask = 1U << (BITBUFSIZ - 1 - 8);
477
478 do {
479
480 if (Mask & Sd->mBitBuf) {
481 CharC = Sd->mRight[CharC];
482 } else {
483 CharC = Sd->mLeft[CharC];
484 }
485
486 Mask >>= 1;
487
488 } while (CharC >= NT);
489 }
490 //
491 // Advance what we have read
492 //
493 FillBuf (Sd, Sd->mPTLen[CharC]);
494
495 if (CharC <= 2) {
496
497 if (CharC == 0) {
498 CharC = 1;
499 } else if (CharC == 1) {
500 CharC = (UINT16) (GetBits (Sd, 4) + 3);
501 } else if (CharC == 2) {
502 CharC = (UINT16) (GetBits (Sd, CBIT) + 20);
503 }
504
505 CharC--;
506 while ((INT16) (CharC) >= 0) {
507 Sd->mCLen[Index++] = 0;
508 CharC--;
509 }
510
511 } else {
512
513 Sd->mCLen[Index++] = (UINT8) (CharC - 2);
514
515 }
516 }
517
518 while (Index < NC) {
519 Sd->mCLen[Index++] = 0;
520 }
521
522 MakeTable (Sd, NC, Sd->mCLen, 12, Sd->mCTable);
523
524 return ;
525 }
526
527 STATIC
528 UINT16
529 DecodeC (
530 SCRATCH_DATA *Sd
531 )
532 /*++
533
534 Routine Description:
535
536 Decode a character/length value.
537
538 Arguments:
539
540 Sd - The global scratch data.
541
542 Returns:
543
544 The value decoded.
545
546 --*/
547 {
548 UINT16 Index2;
549 UINT32 Mask;
550
551 if (Sd->mBlockSize == 0) {
552 //
553 // Starting a new block
554 //
555 Sd->mBlockSize = (UINT16) GetBits (Sd, 16);
556 Sd->mBadTableFlag = ReadPTLen (Sd, NT, TBIT, 3);
557 if (Sd->mBadTableFlag != 0) {
558 return 0;
559 }
560
561 ReadCLen (Sd);
562
563 Sd->mBadTableFlag = ReadPTLen (Sd, MAXNP, mPbit, (UINT16) (-1));
564 if (Sd->mBadTableFlag != 0) {
565 return 0;
566 }
567 }
568
569 Sd->mBlockSize--;
570 Index2 = Sd->mCTable[Sd->mBitBuf >> (BITBUFSIZ - 12)];
571
572 if (Index2 >= NC) {
573 Mask = 1U << (BITBUFSIZ - 1 - 12);
574
575 do {
576 if (Sd->mBitBuf & Mask) {
577 Index2 = Sd->mRight[Index2];
578 } else {
579 Index2 = Sd->mLeft[Index2];
580 }
581
582 Mask >>= 1;
583 } while (Index2 >= NC);
584 }
585 //
586 // Advance what we have read
587 //
588 FillBuf (Sd, Sd->mCLen[Index2]);
589
590 return Index2;
591 }
592
593 STATIC
594 VOID
595 Decode (
596 SCRATCH_DATA *Sd
597 )
598 /*++
599
600 Routine Description:
601
602 Decode the source data and put the resulting data into the destination buffer.
603
604 Arguments:
605
606 Sd - The global scratch data
607
608 Returns: (VOID)
609
610 --*/
611 {
612 UINT16 BytesRemain;
613 UINT32 DataIdx;
614 UINT16 CharC;
615
616 BytesRemain = (UINT16) (-1);
617
618 DataIdx = 0;
619
620 for (;;) {
621 CharC = DecodeC (Sd);
622 if (Sd->mBadTableFlag != 0) {
623 return ;
624 }
625
626 if (CharC < 256) {
627 //
628 // Process an Original character
629 //
630 Sd->mDstBase[Sd->mOutBuf++] = (UINT8) CharC;
631 if (Sd->mOutBuf >= Sd->mOrigSize) {
632 return ;
633 }
634
635 } else {
636 //
637 // Process a Pointer
638 //
639 CharC = (UINT16) (CharC - (UINT8_MAX + 1 - THRESHOLD));
640
641 BytesRemain = CharC;
642
643 DataIdx = Sd->mOutBuf - DecodeP (Sd) - 1;
644
645 BytesRemain--;
646 while ((INT16) (BytesRemain) >= 0) {
647 Sd->mDstBase[Sd->mOutBuf++] = Sd->mDstBase[DataIdx++];
648 if (Sd->mOutBuf >= Sd->mOrigSize) {
649 return ;
650 }
651
652 BytesRemain--;
653 }
654 }
655 }
656
657 return ;
658 }
659
660 EFI_STATUS
661 GetInfo (
662 IN VOID *Source,
663 IN UINT32 SrcSize,
664 OUT UINT32 *DstSize,
665 OUT UINT32 *ScratchSize
666 )
667 /*++
668
669 Routine Description:
670
671 The implementation of EFI_DECOMPRESS_PROTOCOL.GetInfo().
672
673 Arguments:
674
675 Source - The source buffer containing the compressed data.
676 SrcSize - The size of source buffer
677 DstSize - The size of destination buffer.
678 ScratchSize - The size of scratch buffer.
679
680 Returns:
681
682 EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
683 EFI_INVALID_PARAMETER - The source data is corrupted
684
685 --*/
686 {
687 UINT8 *Src;
688
689 *ScratchSize = sizeof (SCRATCH_DATA);
690
691 Src = Source;
692 if (SrcSize < 8) {
693 return EFI_INVALID_PARAMETER;
694 }
695
696 *DstSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
697 return EFI_SUCCESS;
698 }
699
700 EFI_STATUS
701 Decompress (
702 IN VOID *Source,
703 IN UINT32 SrcSize,
704 IN OUT VOID *Destination,
705 IN UINT32 DstSize,
706 IN OUT VOID *Scratch,
707 IN UINT32 ScratchSize
708 )
709 /*++
710
711 Routine Description:
712
713 The implementation Efi and Tiano Decompress().
714
715 Arguments:
716
717 Source - The source buffer containing the compressed data.
718 SrcSize - The size of source buffer
719 Destination - The destination buffer to store the decompressed data
720 DstSize - The size of destination buffer.
721 Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
722 ScratchSize - The size of scratch buffer.
723
724 Returns:
725
726 EFI_SUCCESS - Decompression is successfull
727 EFI_INVALID_PARAMETER - The source data is corrupted
728
729 --*/
730 {
731 UINT32 Index;
732 UINT32 CompSize;
733 UINT32 OrigSize;
734 EFI_STATUS Status;
735 SCRATCH_DATA *Sd;
736 UINT8 *Src;
737 UINT8 *Dst;
738
739 Status = EFI_SUCCESS;
740 Src = Source;
741 Dst = Destination;
742
743 if (ScratchSize < sizeof (SCRATCH_DATA)) {
744 return EFI_INVALID_PARAMETER;
745 }
746
747 Sd = (SCRATCH_DATA *) Scratch;
748
749 if (SrcSize < 8) {
750 return EFI_INVALID_PARAMETER;
751 }
752
753 CompSize = Src[0] + (Src[1] << 8) + (Src[2] << 16) + (Src[3] << 24);
754 OrigSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
755
756 if (SrcSize < CompSize + 8) {
757 return EFI_INVALID_PARAMETER;
758 }
759
760 if (DstSize != OrigSize) {
761 return EFI_INVALID_PARAMETER;
762 }
763
764 Src = Src + 8;
765
766 for (Index = 0; Index < sizeof (SCRATCH_DATA); Index++) {
767 ((UINT8 *) Sd)[Index] = 0;
768 }
769
770 Sd->mSrcBase = Src;
771 Sd->mDstBase = Dst;
772 Sd->mCompSize = CompSize;
773 Sd->mOrigSize = OrigSize;
774
775 //
776 // Fill the first BITBUFSIZ bits
777 //
778 FillBuf (Sd, BITBUFSIZ);
779
780 //
781 // Decompress it
782 //
783 Decode (Sd);
784
785 if (Sd->mBadTableFlag != 0) {
786 //
787 // Something wrong with the source
788 //
789 Status = EFI_INVALID_PARAMETER;
790 }
791
792 return Status;
793 }
794
795 EFI_STATUS
796 EfiGetInfo (
797 IN VOID *Source,
798 IN UINT32 SrcSize,
799 OUT UINT32 *DstSize,
800 OUT UINT32 *ScratchSize
801 )
802 /*++
803
804 Routine Description:
805
806 The implementation Efi Decompress GetInfo().
807
808 Arguments:
809
810 Source - The source buffer containing the compressed data.
811 SrcSize - The size of source buffer
812 DstSize - The size of destination buffer.
813 ScratchSize - The size of scratch buffer.
814
815 Returns:
816
817 EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
818 EFI_INVALID_PARAMETER - The source data is corrupted
819
820 --*/
821 {
822 return GetInfo (Source, SrcSize, DstSize, ScratchSize);
823 }
824
825 EFI_STATUS
826 TianoGetInfo (
827 IN VOID *Source,
828 IN UINT32 SrcSize,
829 OUT UINT32 *DstSize,
830 OUT UINT32 *ScratchSize
831 )
832 /*++
833
834 Routine Description:
835
836 The implementation Tiano Decompress GetInfo().
837
838 Arguments:
839
840 Source - The source buffer containing the compressed data.
841 SrcSize - The size of source buffer
842 DstSize - The size of destination buffer.
843 ScratchSize - The size of scratch buffer.
844
845 Returns:
846
847 EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
848 EFI_INVALID_PARAMETER - The source data is corrupted
849
850 --*/
851 {
852 return GetInfo (Source, SrcSize, DstSize, ScratchSize);
853 }
854
855 EFI_STATUS
856 EfiDecompress (
857 IN VOID *Source,
858 IN UINT32 SrcSize,
859 IN OUT VOID *Destination,
860 IN UINT32 DstSize,
861 IN OUT VOID *Scratch,
862 IN UINT32 ScratchSize
863 )
864 /*++
865
866 Routine Description:
867
868 The implementation of Efi Decompress().
869
870 Arguments:
871
872 Source - The source buffer containing the compressed data.
873 SrcSize - The size of source buffer
874 Destination - The destination buffer to store the decompressed data
875 DstSize - The size of destination buffer.
876 Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
877 ScratchSize - The size of scratch buffer.
878
879 Returns:
880
881 EFI_SUCCESS - Decompression is successfull
882 EFI_INVALID_PARAMETER - The source data is corrupted
883
884 --*/
885 {
886 mPbit = EFIPBIT;
887 return Decompress (Source, SrcSize, Destination, DstSize, Scratch, ScratchSize);
888 }
889
890 EFI_STATUS
891 TianoDecompress (
892 IN VOID *Source,
893 IN UINT32 SrcSize,
894 IN OUT VOID *Destination,
895 IN UINT32 DstSize,
896 IN OUT VOID *Scratch,
897 IN UINT32 ScratchSize
898 )
899 /*++
900
901 Routine Description:
902
903 The implementation of Tiano Decompress().
904
905 Arguments:
906
907 Source - The source buffer containing the compressed data.
908 SrcSize - The size of source buffer
909 Destination - The destination buffer to store the decompressed data
910 DstSize - The size of destination buffer.
911 Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
912 ScratchSize - The size of scratch buffer.
913
914 Returns:
915
916 EFI_SUCCESS - Decompression is successfull
917 EFI_INVALID_PARAMETER - The source data is corrupted
918
919 --*/
920 {
921 mPbit = MAXPBIT;
922 return Decompress (Source, SrcSize, Destination, DstSize, Scratch, ScratchSize);
923 }