/*
- Copyright (C) Arturo San Emeterio Campos 1999. All rights reserved.
- Permission is granted to make verbatim copies of this file for private
- use only. There is ABSOLUTELY NO WARRANTY. Use it at your OWN RISK.
+ Copyright (C) Arturo San Emeterio Campos 1999. All rights reserved.
+ Permission is granted to make verbatim copies of this file for private
+ use only. There is ABSOLUTELY NO WARRANTY. Use it at your OWN RISK.
- This file is: "ppmcdata.c"
- Email: arturo@arturocampos.com
- Web: http://www.arturocampos.com
+ This file is: "ppmcdata.c"
+Email: arturo@arturocampos.com
+Web: http://www.arturocampos.com
- Part of the ppmc encoder and decoder.
+Part of the ppmc encoder and decoder.
- This module contains global data.
+This module contains global data.
*/
#include "ppmc.h" //defines
// Those are the pointers and variables used for managing the mem pool for
// both context, and bytes and frequencies.
struct _byte_and_freq *_bytes_pool, //pointer to pool containing linked
- //lists with bytes and frequencies
- *_bytes_pool_max; //the maximum of this buffer
-struct context *_context_pool; //pointer to pool containing contexts
-struct context *_context_pool_max; //the same as with _bytes_pool
+ //lists with bytes and frequencies
+ *_bytes_pool_max; //the maximum of this buffer
+ struct context *_context_pool; //pointer to pool containing contexts
+ struct context *_context_pool_max; //the same as with _bytes_pool
-unsigned long _bytes_pool_index; //index in array of pointers
-unsigned long _context_pool_index;
+ unsigned long _bytes_pool_index; //index in array of pointers
+ unsigned long _context_pool_index;
-//the following is an array keeping pointers to different buffers. A new
-//buffer is allocated when the current one is full, so we always have a
-//buffer for linked lists. (without allocating a buffer for every element)
-struct _byte_and_freq *_bytes_pool_array[_mempool_max_index];
-struct context *_context_pool_array[_mempool_max_index];
+ //the following is an array keeping pointers to different buffers. A new
+ //buffer is allocated when the current one is full, so we always have a
+ //buffer for linked lists. (without allocating a buffer for every element)
+ struct _byte_and_freq *_bytes_pool_array[_mempool_max_index];
+ struct context *_context_pool_array[_mempool_max_index];
-char ppmc_out_of_memory; //0 if we have enough memory, 1 instead, any
- //routine that needs to allocate memory must
- //quit if that's 1.
+ char ppmc_out_of_memory; //0 if we have enough memory, 1 instead, any
+ //routine that needs to allocate memory must
+ //quit if that's 1.
-// Variables which contain current byte to code and order
-unsigned long byte, //current byte to code
- o1_byte, //order-1 byte
- o2_byte, //order-2 byte
- o3_byte, //order-3 byte
- o4_byte; //order-4 byte
+ // Variables which contain current byte to code and order
+ unsigned long byte, //current byte to code
+ o1_byte, //order-1 byte
+ o2_byte, //order-2 byte
+ o3_byte, //order-3 byte
+ o4_byte; //order-4 byte
unsigned long o2_cntxt; //used in the hash key of order-2
unsigned long o3_cntxt; //use as hash key for order-3
unsigned long full_o4_cntxt; //order-4-3-2-1
unsigned long coded_in_order; //in which order the last byte was coded
- //it's for update exclusion
- //also used for decoding
+//it's for update exclusion
+//also used for decoding
// Variables used for coding
unsigned long
- total_cump, //the total cumulative probability
- symb_cump, //the symbol cumulative probability
- symb_prob; //the symbol frequency
+total_cump, //the total cumulative probability
+ symb_cump, //the symbol cumulative probability
+ symb_prob; //the symbol frequency
rangecoder rc_coder; //state of range coder
rangecoder rc_decoder; //state of range decoder
// File handles
- FILE *file_input, //file to code
- *file_output; //file where the coded data is placed
+FILE *file_input, //file to code
+ *file_output; //file where the coded data is placed
// Pointers to linked lists and context structures used for faster updating
struct _byte_and_freq *o2_ll_node; //pointer to linked lists under order-2
- //where does it points depends in which
- //order the byte was coded.
+//where does it points depends in which
+//order the byte was coded.
struct _byte_and_freq *o3_ll_node; //the same but for order-3
struct _byte_and_freq *o4_ll_node;