DecodeGIT

Performs GIT decoding.

Syntax

IppStatus ippsDecodeGIT_8u (const Ipp8u* pSrc, int srcLen, Ipp8u* pDst, int* pDstLen, IppGITStrategyHint strategyHint, IppGITState_8u* pGITState);

Parameters

pSrc

Pointer to the source buffer.

srcLen

Length of the source buffer.

pDst

Pointer to the destination buffer.

pDstLen

Pointer to the length of the destination buffer.

strategyHint

Suggests using of the code implemented specific strategy for lexicorgaphical reordering (see table "strategyHint Parameter"); default value is ippGITNoStrategyHint.

pGITState

Pointer to the GIT decoding state structure.

Description

The function ippsDecodeGIT is declared in the ippdc.h file. This function performs GIT decoding - it decodes data encoded by the ippsEncodeGIT function.

The ippsDecodeGIT uses the GIT state structure pGITState that contains pointers to different data structures required for GIT decoding. This structure must be initialized by the functions ippsDecodeGITInitAlloc or ippsDecodeGITInit beforehand. The function ippsDecodeGIT requires enough memory for decoding. It obtains the source data from the pSrc source vector with the srcLen length and writes the decoded data to the pDst destination vector. The size of destination buffer must be equal to or greater than maxDstLen (see ippsDecodeGITInitAlloc and ippsDecodeGITInit). pDstLen is an output parameter, it returns the actual size of the decoded data.

The code Example below shows how to use the ippsDecodeGIT_8u and supporting functions.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error if one of the pointers is NULL.

ippStsSizeErr

Indicates an error if there is not enough memory allocated for the destination buffer.

Using the Function DecodeGIT and Supporting Functions

#define BLOCKSIZE 65536 
.....................
FILE* in, out;
Ipp8u* rdata, code;
int GITStateSize, size,
codeLen, rdataLen;
IppGITState_8u pGITState; 
IppGITStrategyHint strategyHint;
......................
/*************************************************************/
/* Opening the file containing input compressed data and the */
/* file  for the restored (uncompressed) data:               */
/*************************************************************/
in = fopen("codefile", "rb");
out = fopen("datafile_restored.txt", "wb");

		
/*************************************************************/
/* Memory allocation for input code and output restored data */
/* buffers, and for the internal decoding state structure:   */
/*************************************************************/
rdata = (Ipp8u*) malloc((BLOCKSIZE << 1) * sizeof(Ipp8u));
code = (Ipp8u*) malloc(BLOCKSIZE * sizeof(Ipp8u)); 
ippsDecodeGITGetSize_8u((BLOCKSIZE << 1), &GITStateSize);
pGITState = (IppGITState_8u*) malloc(GITStateSize * sizeof(Ipp8u));  

		
/*************************************************************/
/* Initializing the memory, allocated for internal decoding  */
/* state structure and setting the decoding strategy         */
/* (should be the same as the strategy for encoding) :       */
/*************************************************************/
ippsDecodeGITInit_8u(BLOCKSIZE, pGITState);
strategyHint = ippGITLeftReorder;

		
/*************************************************************/
/* The main loop. On every iteration program reads the size       */                      
            
/* of the compressed block (codeLen) from the input code     */
/* file. After that program reads the codeLen bytes of code  */
/* from the input code file to the code array. The call of   */
/* ippsDecodeGIT_8u performs the decoding of codeLen bytes   */
/* of code to the rdata error of rdataLen. At the end        */
/* program writes the rdataLen bytes of restored data(rdata) */
/* to the output file.                                       */
/*************************************************************/
for( ; ; ) 
{
   size = fread(&codeLen, sizeof(int), 1, in);
   if(size <= 0)
     break;  
   fread(&code[0], sizeof(Ipp8u), codeLen, in);
   ippsDecodeGIT_8u(code, codeLen, rdata, &rdataLen, strategyHint, pGITState);      
   fwrite(rdata, sizeof(Ipp8u), rdataLen, out);
} /* for */

		
/*************************************************************/
/* Free the memory allocated for input code and output       */
/* restored data buffers and for the internal decoding state */
/* structure:                                                */
/*************************************************************/
free(pGITState); 
free(code);
free(rdata);
fclose(in);
fclose(out);
............

	

Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.