/* Extracts decompressed data to its original form. If the compressed source data specified by Source is successfully decompressed into Destination, then RETURN_SUCCESS is returned. If the compressed source data specified by Source is not in a valid compressed data format, then RETURN_INVALID_PARAMETER is returned. */
EFI_STATUS EFIAPI BrotliUefiDecompress(IN CONST VOID *Source, IN UINTN SourceSize, IN OUT VOID *Destination, IN OUT VOID *Scratch)
/* Extracts decompressed data to its original form. If the compressed source data specified by Source is successfully decompressed into Destination, then RETURN_SUCCESS is returned. If the compressed source data specified by Source is not in a valid compressed data format, then RETURN_INVALID_PARAMETER is returned. */
EFI_STATUS EFIAPI BrotliUefiDecompress(IN CONST VOID *Source, IN UINTN SourceSize, IN OUT VOID *Destination, IN OUT VOID *Scratch)
{
  UINTN        DestSize = 0;
  EFI_STATUS   Status;
  BROTLI_BUFF  BroBuff;
  UINT64       GetSize;
  UINT8        MaxOffset;
  MaxOffset = BROTLI_SCRATCH_MAX;
  GetSize   = BrGetDecodedSizeOfBuf ((UINT8 *)Source, MaxOffset - BROTLI_INFO_SIZE, MaxOffset);
  BroBuff.Buff     = Scratch;
  BroBuff.BuffSize = (UINTN)GetSize;
  Status = BrotliDecompress (
             (VOID *)((UINT8 *)Source + BROTLI_SCRATCH_MAX),
             SourceSize - BROTLI_SCRATCH_MAX,
             Destination,
             DestSize,
             (VOID *)(&BroBuff)
             );
  return Status;
}