(no commit message)
[openjpeg.git] / libopenjpeg / mct.h
1 /*
2  * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
3  * Copyright (c) 2002-2007, Professor Benoit Macq
4  * Copyright (c) 2001-2003, David Janssens
5  * Copyright (c) 2002-2003, Yannick Verschueren
6  * Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
7  * Copyright (c) 2005, Herve Drolon, FreeImage Team
8  * Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr>
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32
33 #ifndef __MCT_H
34 #define __MCT_H
35 /**
36 @file mct.h
37 @brief Implementation of a multi-component transforms (MCT)
38
39 The functions in MCT.C have for goal to realize reversible and irreversible multicomponent
40 transform. The functions in MCT.C are used by some function in TCD.C.
41 */
42 #include "openjpeg.h"
43 /** @defgroup MCT MCT - Implementation of a multi-component transform */
44 /*@{*/
45
46 /** @name Exported functions */
47 /*@{*/
48 /* ----------------------------------------------------------------------- */
49 /**
50 Apply a reversible multi-component transform to an image
51 @param c0 Samples for red component
52 @param c1 Samples for green component
53 @param c2 Samples blue component
54 @param n Number of samples for each component
55 */
56 void mct_encode(OPJ_INT32 *c0, OPJ_INT32 *c1, OPJ_INT32 *c2, OPJ_UINT32 n);
57 /**
58 Apply a reversible multi-component inverse transform to an image
59 @param c0 Samples for luminance component
60 @param c1 Samples for red chrominance component
61 @param c2 Samples for blue chrominance component
62 @param n Number of samples for each component
63 */
64 void mct_decode(OPJ_INT32 *c0, OPJ_INT32 *c1, OPJ_INT32 *c2, OPJ_UINT32 n);
65 /**
66 Get norm of the basis function used for the reversible multi-component transform
67 @param compno Number of the component (0->Y, 1->U, 2->V)
68 @return 
69 */
70 OPJ_FLOAT64 mct_getnorm(OPJ_UINT32 compno);
71
72 /**
73 Apply an irreversible multi-component transform to an image
74 @param c0 Samples for red component
75 @param c1 Samples for green component
76 @param c2 Samples blue component
77 @param n Number of samples for each component
78 */
79 void mct_encode_real(OPJ_INT32 *c0, OPJ_INT32 *c1, OPJ_INT32 *c2, OPJ_UINT32 n);
80 /**
81 Apply an irreversible multi-component inverse transform to an image
82 @param c0 Samples for luminance component
83 @param c1 Samples for red chrominance component
84 @param c2 Samples for blue chrominance component
85 @param n Number of samples for each component
86 */
87 void mct_decode_real(OPJ_FLOAT32* c0, OPJ_FLOAT32* c1, OPJ_FLOAT32* c2, OPJ_UINT32 n);
88 /**
89 Get norm of the basis function used for the irreversible multi-component transform
90 @param compno Number of the component (0->Y, 1->U, 2->V)
91 @return 
92 */
93 OPJ_FLOAT64 mct_getnorm_real(OPJ_UINT32 compno);
94
95 bool mct_encode_custom(
96                                            // MCT data
97                                            OPJ_BYTE * p_coding_data, 
98                                            // size of components
99                                            OPJ_UINT32 n, 
100                                            // components
101                                            OPJ_BYTE ** p_data, 
102                                            // nb of components (i.e. size of p_data)
103                                            OPJ_UINT32 p_nb_comp, 
104                                            // tells if the data is signed
105                                            OPJ_UINT32 is_signed);
106
107 bool mct_decode_custom(
108                                            // MCT data
109                                            OPJ_BYTE * pDecodingData, 
110                                            // size of components
111                                            OPJ_UINT32 n,
112                                            // components
113                                            OPJ_BYTE ** pData, 
114                                            // nb of components (i.e. size of pData)
115                                            OPJ_UINT32 pNbComp, 
116                                            // tells if the data is signed
117                                            OPJ_UINT32 isSigned);
118
119 void opj_calculate_norms(OPJ_FLOAT64 * pNorms,OPJ_UINT32 p_nb_comps,OPJ_FLOAT32 * pMatrix);
120
121 const OPJ_FLOAT64 * get_mct_norms ();
122 const OPJ_FLOAT64 * get_mct_norms_real ();
123
124
125 /* ----------------------------------------------------------------------- */
126 /*@}*/
127
128 /*@}*/
129
130 #endif /* __MCT_H */