MISR Toolkit  1.5.1
crle.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Copyright by The HDF Group. *
3  * Copyright by the Board of Trustees of the University of Illinois. *
4  * All rights reserved. *
5  * *
6  * This file is part of HDF. The full HDF copyright notice, including *
7  * terms governing use, modification, and redistribution, is contained in *
8  * the files COPYING and Copyright.html. COPYING can be found at the root *
9  * of the source code distribution tree; Copyright.html can be found at *
10  * http://hdfgroup.org/products/hdf4/doc/Copyright.html. If you do not have *
11  * access to either file, you may request a copy from help@hdfgroup.org. *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14 /* $Id: crle.h 4932 2007-09-07 17:17:23Z bmribler $ */
15 
16 /*-----------------------------------------------------------------------------
17  * File: crle.h
18  * Purpose: Header file for run-length encoding information.
19  * Dependencies: should only be included from hcompi.h
20  * Invokes: none
21  * Contents: Structures & definitions for run-length encoding. This header
22  * should only be included in hcomp.c and crle.c.
23  * Structure definitions:
24  * Constant definitions:
25  *---------------------------------------------------------------------------*/
26 
27 /* avoid re-inclusion */
28 #ifndef __CRLE_H
29 #define __CRLE_H
30 
31 #if defined c_plusplus || defined __cplusplus
32 extern "C"
33 {
34 #endif /* c_plusplus || __cplusplus */
35 
36 /*
37  ** from crle.c
38  */
39 
40  extern int32 HCPcrle_stread
41  (accrec_t * rec);
42 
43  extern int32 HCPcrle_stwrite
44  (accrec_t * rec);
45 
46  extern int32 HCPcrle_seek
47  (accrec_t * access_rec, int32 offset, int origin);
48 
49  extern int32 HCPcrle_inquire
50  (accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
51  int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
52  int16 *pspecial);
53 
54  extern int32 HCPcrle_read
55  (accrec_t * access_rec, int32 length, void * data);
56 
57  extern int32 HCPcrle_write
58  (accrec_t * access_rec, int32 length, const void * data);
59 
60  extern intn HCPcrle_endaccess
61  (accrec_t * access_rec);
62 
63 #if defined c_plusplus || defined __cplusplus
64 }
65 #endif /* c_plusplus || __cplusplus */
66 
67 /* size of the RLE buffer */
68 #define RLE_BUF_SIZE 128
69 /* NIL code for run bytes */
70 #define RLE_NIL (-1)
71 /* minimum length of run */
72 #define RLE_MIN_RUN 3
73 /* maximum length of run */
74 #define RLE_MAX_RUN (RLE_BUF_SIZE+RLE_MIN_RUN-1)
75 /* minimum length of mix */
76 #define RLE_MIN_MIX 1
77 
78 /* RLE [en|de]coding information */
79 typedef struct
80 {
81  int32 offset; /* offset in the file */
82  uint8 buffer[RLE_BUF_SIZE]; /* buffer for storing RLE bytes */
83  intn buf_length; /* number of bytes in buffer */
84  intn buf_pos; /* offset into the buffer */
85  uintn last_byte, /* the last byte stored in the buffer */
86  second_byte; /* the second to last byte stored in the buffer */
87  enum
88  {
89  RLE_INIT, /* initial state, need to read a byte to determine
90  next state */
91  RLE_RUN, /* buffer up to the current position is a run */
92  RLE_MIX
93  } /* buffer up to the current position is a mix */
94  rle_state; /* state of the buffer storage */
95 }
97 
98 #ifndef CRLE_MASTER
99 extern funclist_t crle_funcs; /* functions to perform run-length encoding */
100 #else
101 funclist_t crle_funcs =
102 { /* functions to perform run-length encoding */
105  HCPcrle_seek,
107  HCPcrle_read,
110 };
111 #endif
112 
113 #endif /* __CRLE_H */
#define RLE_BUF_SIZE
Definition: crle.h:68
int32 HCPcrle_seek(accrec_t *access_rec, int32 offset, int origin)
intn HCPcrle_endaccess(accrec_t *access_rec)
funclist_t crle_funcs
int32 HCPcrle_write(accrec_t *access_rec, int32 length, const void *data)
void origin(double A)
HDFFCLIBAPI intf intf intf intf void * buffer
int32 HCPcrle_stwrite(accrec_t *rec)
int32 HCPcrle_read(accrec_t *access_rec, int32 length, void *data)
HDFFCLIBAPI void * data
uintn second_byte
Definition: crle.h:85
HDFFCLIBAPI intf * offset
int32 HCPcrle_inquire(accrec_t *access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref, int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess, int16 *pspecial)
int32 HCPcrle_stread(accrec_t *rec)

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:52