📄 arithm.h
字号:
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
/* A R I T H M E T I C C O D E I M P L E M E N T A T I O N */
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
/* > > > > > ANSI C version 4.03 - 05/30/95 < < < < < */
/* Amir Said - amir@densis.fee.unicamp.br */
/* Faculty of Electrical Engineering */
/* University of Campinas (UNICAMP) - Campinas, SP 13081, Brazil */
/* William A. Pearlman - pearlman@ecse.rpi.edu */
/* Dept. of Electrical, Computer, and Systems Engineering */
/* Rensselaer Polytechnic Institute - Troy, NY 12180, USA */
/* - - Inclusion - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include <stdlib.h>
#include <stdio.h>
/* - - External definitions - - - - - - - - - - - - - - - - - - - - - */
#define MaxSymbols 65537
/* - - Data types - - - - - - - - - - - - - - - - - - - - - - - - - - */
typedef struct {
int numb_symb, * freq, * cum_freq, * index_to_symb, * symb_to_index,p;
} Adaptive_Model;
typedef struct {
FILE * out_file;
int bit_buffer, bit_index, bits_to_follow;
long low, high, byte_counter;
} Encoder;
typedef struct {
FILE * in_file;
int bit_buffer, bit_index, extra_bits;
long low, high, value, byte_counter;
} Decoder;
/* - - Interface to < Adaptive_Model > - - - - - - - - - - - - - - - - */
void Create_Model(Adaptive_Model * M, int numb_symb);
void Reset_Model(Adaptive_Model * M);
void Set_New_Model(Adaptive_Model * M, int numb_symb);
void Dispose_Model(Adaptive_Model * M);
/* - - Interface to < Encoder > - - - - - - - - - - - - - - - - - - - */
void Start_Encoder(Encoder * E, char * file_name);
long Stop_Encoder(Encoder * E);
void Write_Symbol(Encoder * E, Adaptive_Model * M, int symb);
void Write_Bits(Encoder * E, int bits, int word);
long Bytes_Used(Encoder * E);
/* - - Interface to < Arithm_Decoder > - - - - - - - - - - - - - - - - */
void Start_Decoder(Decoder * D, char * file_name);
void Stop_Decoder(Decoder * E);
int Read_Symbol(Decoder * D, Adaptive_Model * M);
int Read_Bits(Decoder * E, int bits);
long Bytes_Read(Decoder * E);
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
/* end of file < arithm.h > */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -