[trunk] updated copyright and added copyright notice required by ISO, in each file...
[openjpeg.git] / src / lib / openjp3d / raw.h
1 /*
2  * The copyright in this software is being made available under the 2-clauses 
3  * BSD License, included below. This software may be subject to other third 
4  * party and contributor rights, including patent rights, and no such rights
5  * are granted under this license.
6  *
7  * Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
8  * Copyright (c) 2005, Herve Drolon, FreeImage Team
9  * Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
10  * All rights reserved.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #ifndef __RAW_H
35 #define __RAW_H
36 /**
37 @file raw.h
38 @brief Implementation of operations for raw encoding (RAW)
39
40 The functions in RAW.C have for goal to realize the operation of raw encoding linked
41 with the corresponding mode switch.
42 */
43
44 /** @defgroup RAW RAW - Implementation of operations for raw encoding */
45 /*@{*/
46
47 /**
48 RAW encoding operations
49 */
50 typedef struct opj_raw {
51 /** Temporary buffer where bits are coded or decoded */
52         unsigned char c;                
53 /** Number of bits already read or free to write */
54         unsigned int ct;                
55 /** Maximum length to decode */
56         unsigned int lenmax;    
57 /** Length decoded */
58         unsigned int len;               
59 /** Pointer to the current position in the buffer */
60         unsigned char *bp;              
61 /** Pointer to the start of the buffer */
62         unsigned char *start;   
63 /** Pointer to the end of the buffer */
64         unsigned char *end;             
65 } opj_raw_t;
66
67 /** @name Funciones generales */
68 /*@{*/
69 /* ----------------------------------------------------------------------- */
70 /**
71 Create a new RAW handle 
72 @return Returns a new RAW handle if successful, returns NULL otherwise
73 */
74 opj_raw_t* raw_create(void);
75 /**
76 Destroy a previously created RAW handle
77 @param raw RAW handle to destroy
78 */
79 void raw_destroy(opj_raw_t *raw);
80 /**
81 Return the number of bytes written/read since initialisation
82 @param raw RAW handle to destroy
83 @return Returns the number of bytes already encoded
84 */
85 int raw_numbytes(opj_raw_t *raw);
86 /**
87 Initialize the decoder
88 @param raw RAW handle
89 @param bp Pointer to the start of the buffer from which the bytes will be read
90 @param len Length of the input buffer
91 */
92 void raw_init_dec(opj_raw_t *raw, unsigned char *bp, int len);
93 /**
94 Decode a symbol using raw-decoder. Cfr p.506 TAUBMAN
95 @param raw RAW handle
96 @return Returns the decoded symbol (0 or 1)
97 */
98 int raw_decode(opj_raw_t *raw);
99 /* ----------------------------------------------------------------------- */
100 /*@}*/
101
102 /*@}*/
103
104 #endif /* __RAW_H */