⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 coder.h

📁 LastWave
💻 H
字号:
/*..........................................................................*//*                                                                          *//*      L a s t W a v e    P a c k a g e 'compress2d' 2.1                   *//*                                                                          *//*      Copyright (C) 1998-2002 Geoff Davis, Emmanuel Bacry, Jerome Fraleu. *//*                                                                          *//*      The original program was written in C++ by Geoff Davis.             *//*      Then it has been translated in C and adapted to LastWave by         *//*      J. Fraleu and E. Bacry.                                             *//*                                                                          *//*      If you are interested in the C++ code please go to                  *//*          http://www.cs.dartmouth.edu/~gdavis                             *//*                                                                          *//*      emails : geoffd@microsoft.com                                       *//*               fraleu@cmap.polytechnique.fr                               *//*               lastwave@cmap.polytechnique.fr                             *//*                                                                          *//*..........................................................................*//*                                                                          *//*      This program is a free software, you can redistribute it and/or     *//*      modify it under the terms of the GNU General Public License as      *//*      published by the Free Software Foundation; either version 2 of the  *//*      License, or (at your option) any later version                      *//*                                                                          *//*      This program is distributed in the hope that it will be useful,     *//*      but WITHOUT ANY WARRANTY; without even the implied warranty of      *//*      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the       *//*      GNU General Public License for more details.                        *//*                                                                          *//*      You should have received a copy of the GNU General Public License   *//*      along with this program (in a file named COPYRIGHT);                *//*      if not, write to the Free Software Foundation, Inc.,                *//*      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA             *//*                                                                          *//*..........................................................................*/#ifndef CODER_H#define CODER_Htypedef struct encoder {  BITOUT bitout;  ARITHENCODER arith;  CDELTAENCODE intcoder;} Encoder, *ENCODER;extern ENCODER NewEncoder (FILE *out, FILE *log);extern void DeleteEncoder (ENCODER e);extern void FlushEncoder(ENCODER e);extern void WriteIntEncoder (ENCODER e, int i);extern void WritePositiveEncoder (ENCODER e, int i);extern void WriteNonNegEncoder (ENCODER e, int i);typedef struct decoder {  BITIN bitin;  ARITHDECODER arith;  CDELTADECODE intcoder;  } Decoder, *DECODER;extern DECODER NewDecoder (FILE * in, FILE  *log);extern void DeleteDecoder (DECODER d);extern int ReadIntDecoder (DECODER d);extern int ReadPositiveDecoder (DECODER d);extern int ReadNonNegDecoder(DECODER d);#define EntropyCoderType 1#define EntropyCoderFields char type; int histoCapacitytypedef struct  entropyCoder {  EntropyCoderFields;  } EntropyCoder, *ENTROPYCODER;extern ENTROPYCODER NewEntropyCoder(int histoCapacity);extern void DeleteEntropyCoder(ENTROPYCODER e);extern LWFLOAT WriteEntropyCoder(ENTROPYCODER ec, ENCODER encoder, int symbol, char update,int context1, int context2);extern int ReadEntropyCoder(ENTROPYCODER ec, DECODER decoder, char update,int context1, int context2);extern LWFLOAT CostEntropyCoder (ENTROPYCODER ec, int symbol, char update, int context1, int context2);extern LWFLOAT UpdateCostEntropyCoder (ENTROPYCODER ec, int symbol, int context1 , int context2);extern void UpdateEntropyCoder  (ENTROPYCODER ec,int symbol, int context1 , int context2);extern LWFLOAT EntropyEntropyCoder(ENTROPYCODER ec, LWFLOAT p); extern void ResetEntropyCoder(ENTROPYCODER ec); #define MonoLayerCoderType 2#define MonoLayerCoderFields EntropyCoderFields; int nSymtypedef struct monoLayerCoder {  MonoLayerCoderFields;  } MonoLayerCoder, *MONOLAYERCODER;extern MONOLAYERCODER NewMonoLayerCoder (int histoCapacity) ;extern void DeleteMonoLayerCoder (MONOLAYERCODER e); extern void SetNSymMonoLayerCoder(MONOLAYERCODER m, int nSym);#define EscapeCoderType 3typedef struct escapeCoder {  MonoLayerCoderFields;  IHISTOGRAM freq, uniform;  char *seen;} EscapeCoder, *ESCAPECODER;extern ESCAPECODER NewEscapeCoder1(int histoCapacity); extern ESCAPECODER NewEscapeCoder3(int histoCapacity, int nSym);extern void ResetEscapeCoder (ESCAPECODER e);extern void DeleteEscapeCoder (ESCAPECODER e);extern void SetNSymEscapeCoder (ESCAPECODER e, int newNSym);extern LWFLOAT WriteEscapeCoder(ESCAPECODER ec, ENCODER encoder, int symbol, char update,int context1, int context2);extern int ReadEscapeCoder (ESCAPECODER ec, DECODER decoder, char update, int context1, int context2);extern LWFLOAT CostEscapeCoder (ESCAPECODER ec, int symbol, char update, int context1, int context2);/*---------------------------------------------------------------------------*/typedef struct coeffset {  ESCAPECODER entropy;  int  nData;  LWFLOAT *data;  struct uniformQuant *quant;    LWFLOAT rate;     /* cost (in bits) to perform each quantization */  LWFLOAT dist;     /* distortion incurred using each quantizer  */  int capacity; /* of the histogramm for Arithmetic Coder  */} CoeffSet, *COEFFSET;extern COEFFSET NewCoeffSet (LWFLOAT *data, int nData,LWFLOAT stepSize, int ZeroCenter);extern void DeleteCoeffSet(COEFFSET c);extern void WriteHeaderCoeffSet (COEFFSET c, ENCODER encoder);extern void ReadHeaderCoeffSet  (COEFFSET c, DECODER decoder);extern void EncodeCoeffSet (COEFFSET c, ENCODER encoder);extern void DecodeCoeffSet (COEFFSET c,  DECODER decoder);extern void GetRateDistCoeffSet (COEFFSET c);#endif/*---------------------------------------------------------------------------*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -