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