#define ATTR_SIZE  512
#define EOD        0x01  /* End of data (Same data with len 0) */
#define RC_EOD     0x02  /* Internal EOD var to avoid mixup with OK,BBN950705*/
#define SHORT_DIFF 0
#define SHORT_SAME 1
#define LONG_DIFF  2
#define LONG_SAME  3
#include "fil.h"

struct Buff8Struc
     {
     INT32 iMaxSize; 
     INT32 iLen;
     INT32 iPos;
     char  ByteData[1];
     };

typedef struct 
   {
   unsigned Compressed : 1; 
   INT32 iMaxSize;
   struct SequenceStruc
     {
     INT32 iStart;
     INT32 iPackType;
     INT32 iDataLen;
     INT32 iDataPos;
     }Sequence;
   struct Buff8Struc Data;
   } PixBuffer_t;


struct LongHeaderStruc
  {
  unsigned HeaderType :  2;
  unsigned Len        : 14;
  };

struct ShortHeaderStruc
  {
  unsigned HeaderType :2;
  unsigned Len        :6;
  };


struct MaskStruc
  {
  unsigned char Low;
  unsigned char High;
  };
INT32 pckBuff8Fill(struct Buff8Struc *pBuffer,INT32 iCount,
				   char Item);
void pckSameByteOutput(char *pTo,INT32 *iToPos, INT32 iCount,
					 unsigned char bValue);

INT32 pckCompressNradProd(char *SourceFileStr,char *DestFileStr);
INT32 pckCompressData(Fil_t *pInFile,Fil_t *pOutFile);
INT32 pckCompressBitmap(Fil_t *pInFile,Fil_t *pOutFile);
INT32 pckPixReset(INT32 iMode,PixBuffer_t *pBuff); 
INT32 pckPixSkip(PixBuffer_t *pBuffer,INT32 iCount); 
INT32 pckPixGetSequence (PixBuffer_t *pBuffer); 
INT32 pckPixCopy(PixBuffer_t *pFrom,PixBuffer_t *pTo,INT32 iCount);
INT32 pckComprToCompr(PixBuffer_t *pFrom,PixBuffer_t *pTo,INT32 iCount);
INT32 pckPixComprToComprSeq(PixBuffer_t *pFrom,
                            PixBuffer_t *pTo,INT32 iCount);
INT32 pckComprToExp(PixBuffer_t *pFrom,PixBuffer_t *pTo,INT32 iCount);
INT32 pckPixComprToExpSeq(PixBuffer_t *pFrom,PixBuffer_t  *pTo,INT32 iCount);
INT32 pckExpToCompr(PixBuffer_t *pFrom,PixBuffer_t *pTo);
INT32 pckExpToExp(PixBuffer_t *pFrom,PixBuffer_t *pTo,INT32 iCount);
INT32 Buff8CompressData(struct Buff8Struc *pInBuffer,struct Buff8Struc *pOutBuffer,INT32 iSourceDataSize);
INT32 pckBuff8Fill(struct Buff8Struc *pBuffer,INT32 iCount,char Item);
INT32 pckBuff8Copy(struct Buff8Struc *pFrom,struct Buff8Struc *pTo,INT32 iCount);
INT32 pckBuff8Put(struct Buff8Struc *pBuffer,char *pItem,INT32 iItemSize);
INT32 pckBuff8ExpandData(struct Buff8Struc *pInBuffer,struct Buff8Struc *pOutBuffer,INT32 iSourceDataSize);
INT32 pckRleCompressData(char *InData,INT32 iInSize,char *OutData,INT32 *iOutSize);
INT32 pckCountEqual(char *InData,INT32 iPos,INT32 iMaxPos);
INT32 pckCountDifferent(char *InData,INT32 iPos,INT32 iMaxSize);
void  pckDiffByteOutput(char *pFrom,INT32 *iFromPos,char *pTo,INT32 *iToPos,INT32 iCount);
INT32 Buff8Get(struct Buff8Struc *pBuffer,char *pItem);
INT32 pckExpandNradProd(char *pSourceFileStr,char *pDestFileStr);
INT32 pckExpandData(Fil_t  *pInFile, Fil_t *pOutFile);
INT32 pckExpandBitmap(Fil_t  *pInFile,
					  Fil_t  *pOutFile);
INT32 pckRleExpandData(char *pInBuffer,INT32 iInSize,char *pOutBuffer,INT32 *iOutSize);
