OpenJPH
Open-source implementation of JPEG2000 Part-15
ojph_colour_local.h
Go to the documentation of this file.
1//***************************************************************************/
2// This software is released under the 2-Clause BSD license, included
3// below.
4//
5// Copyright (c) 2019, Aous Naman
6// Copyright (c) 2019, Kakadu Software Pty Ltd, Australia
7// Copyright (c) 2019, The University of New South Wales, Australia
8//
9// Redistribution and use in source and binary forms, with or without
10// modification, are permitted provided that the following conditions are
11// met:
12//
13// 1. Redistributions of source code must retain the above copyright
14// notice, this list of conditions and the following disclaimer.
15//
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
21// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
26// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31//***************************************************************************/
32// This file is part of the OpenJPH software implementation.
33// File: ojph_colour_local.h
34// Author: Aous Naman
35// Date: 28 August 2019
36//***************************************************************************/
37
38
39#ifndef OJPH_COLOR_LOCAL_H
40#define OJPH_COLOR_LOCAL_H
41
42namespace ojph {
43 namespace local {
44
45 struct CT_CNST
46 {
47 // for irreversible color transform
48 static const float ALPHA_RF;
49 static const float ALPHA_GF;
50 static const float ALPHA_BF;
51 static const float BETA_CbF;
52 static const float BETA_CrF;
53 static const float GAMMA_CR2R;
54 static const float GAMMA_CB2B;
55 static const float GAMMA_CR2G;
56 static const float GAMMA_CB2G;
57 };
58
60 //
61 //
62 // Generic Functions
63 //
64 //
66
68 void gen_rev_convert(
69 const line_buf *src_line, const ui32 src_line_offset,
70 line_buf *dst_line, const ui32 dst_line_offset,
71 si64 shift, ui32 width);
72
75 const line_buf *src_line, const ui32 src_line_offset,
76 line_buf *dst_line, const ui32 dst_line_offset,
77 si64 shift, ui32 width);
78
80 void gen_cnvrt_si32_to_float_shftd(const si32 *sp, float *dp, float mul,
81 ui32 width);
82
84 void gen_cnvrt_si32_to_float(const si32 *sp, float *dp, float mul,
85 ui32 width);
86
88 void gen_cnvrt_float_to_si32_shftd(const float *sp, si32 *dp, float mul,
89 ui32 width);
90
92 void gen_cnvrt_float_to_si32(const float *sp, si32 *dp, float mul,
93 ui32 width);
94
96 void gen_rct_forward(
97 const line_buf *r, const line_buf *g, const line_buf *b,
98 line_buf *y, line_buf *cb, line_buf *cr, ui32 repeat);
99
101 void gen_rct_backward(
102 const line_buf *y, const line_buf *cb, const line_buf *cr,
103 line_buf *r, line_buf *g, line_buf *b, ui32 repeat);
104
106 void gen_ict_forward(const float *r, const float *g, const float *b,
107 float *y, float *cb, float *cr, ui32 repeat);
108
110 void gen_ict_backward(const float *y, const float *cb, const float *cr,
111 float *r, float *g, float *b, ui32 repeat);
112
114 //
115 //
116 // SSE Functions (float)
117 //
118 //
120
122 void sse_cnvrt_si32_to_float_shftd(const si32 *sp, float *dp, float mul,
123 ui32 width);
124
126 void sse_cnvrt_si32_to_float(const si32 *sp, float *dp, float mul,
127 ui32 width);
128
130 void sse_cnvrt_float_to_si32_shftd(const float *sp, si32 *dp, float mul,
131 ui32 width);
132
134 void sse_cnvrt_float_to_si32(const float *sp, si32 *dp, float mul,
135 ui32 width);
136
138 void sse_ict_forward(const float *r, const float *g, const float *b,
139 float *y, float *cb, float *cr, ui32 repeat);
140
142 void sse_ict_backward(const float *y, const float *cb, const float *cr,
143 float *r, float *g, float *b, ui32 repeat);
144
146 //
147 //
148 // SSE2 Functions (float)
149 //
150 //
152
154 void sse2_cnvrt_float_to_si32_shftd(const float *sp, si32 *dp, float mul,
155 ui32 width);
156
158 void sse2_cnvrt_float_to_si32(const float *sp, si32 *dp, float mul,
159 ui32 width);
160
162 //
163 //
164 // SSE2 Functions (integer)
165 //
166 //
168
170 void sse2_rev_convert(
171 const line_buf *src_line, const ui32 src_line_offset,
172 line_buf *dst_line, const ui32 dst_line_offset,
173 si64 shift, ui32 width);
174
177 const line_buf *src_line, const ui32 src_line_offset,
178 line_buf *dst_line, const ui32 dst_line_offset,
179 si64 shift, ui32 width);
180
182 void sse2_rct_forward(
183 const line_buf *r, const line_buf *g, const line_buf *b,
184 line_buf *y, line_buf *cb, line_buf *cr, ui32 repeat);
185
188 const line_buf *y, const line_buf *cb, const line_buf *cr,
189 line_buf *r, line_buf *g, line_buf *b, ui32 repeat);
190
192 //
193 //
194 // AVX Functions (float)
195 //
196 //
198
200 void avx_cnvrt_si32_to_float_shftd(const si32 *sp, float *dp, float mul,
201 ui32 width);
202
204 void avx_cnvrt_si32_to_float(const si32 *sp, float *dp, float mul,
205 ui32 width);
206
208 void avx_cnvrt_float_to_si32_shftd(const float *sp, si32 *dp, float mul,
209 ui32 width);
210
212 void avx_cnvrt_float_to_si32(const float *sp, si32 *dp, float mul,
213 ui32 width);
214
216 void avx_ict_forward(const float *r, const float *g, const float *b,
217 float *y, float *cb, float *cr, ui32 repeat);
218
220 void avx_ict_backward(const float *y, const float *cb, const float *cr,
221 float *r, float *g, float *b, ui32 repeat);
222
224 //
225 //
226 // AVX2 Functions (integer)
227 //
228 //
230
232 void avx2_rev_convert(
233 const line_buf *src_line, const ui32 src_line_offset,
234 line_buf *dst_line, const ui32 dst_line_offset,
235 si64 shift, ui32 width);
236
239 const line_buf *src_line, const ui32 src_line_offset,
240 line_buf *dst_line, const ui32 dst_line_offset,
241 si64 shift, ui32 width);
242
244 void avx2_rct_forward(
245 const line_buf *r, const line_buf *g, const line_buf *b,
246 line_buf *y, line_buf *cb, line_buf *cr, ui32 repeat);
247
250 const line_buf *y, const line_buf *cb, const line_buf *cr,
251 line_buf *r, line_buf *g, line_buf *b, ui32 repeat);
252
254 //
255 //
256 // WASM Functions
257 //
258 //
260
262 void wasm_cnvrt_si32_to_float_shftd(const si32 *sp, float *dp, float mul,
263 ui32 width);
264
266 void wasm_cnvrt_si32_to_float(const si32 *sp, float *dp, float mul,
267 ui32 width);
268
270 void wasm_cnvrt_float_to_si32_shftd(const float *sp, si32 *dp, float mul,
271 ui32 width);
272
274 void wasm_cnvrt_float_to_si32(const float *sp, si32 *dp, float mul,
275 ui32 width);
276
278 void wasm_rev_convert(
279 const line_buf *src_line, const ui32 src_line_offset,
280 line_buf *dst_line, const ui32 dst_line_offset,
281 si64 shift, ui32 width);
282
285 const line_buf *src_line, const ui32 src_line_offset,
286 line_buf *dst_line, const ui32 dst_line_offset,
287 si64 shift, ui32 width);
288
290 void wasm_rct_forward(
291 const line_buf *r, const line_buf *g, const line_buf *b,
292 line_buf *y, line_buf *cb, line_buf *cr, ui32 repeat);
293
296 const line_buf *y, const line_buf *cb, const line_buf *cr,
297 line_buf *r, line_buf *g, line_buf *b, ui32 repeat);
298
300 void wasm_ict_forward(const float *r, const float *g, const float *b,
301 float *y, float *cb, float *cr, ui32 repeat);
302
304 void wasm_ict_backward(const float *y, const float *cb, const float *cr,
305 float *r, float *g, float *b, ui32 repeat);
306
307 }
308}
309
310
311
312#endif // !OJPH_COLOR_LOCAL_H
void wasm_cnvrt_float_to_si32_shftd(const float *sp, si32 *dp, float mul, ui32 width)
void sse2_rct_backward(const line_buf *y, const line_buf *cb, const line_buf *cr, line_buf *r, line_buf *g, line_buf *b, ui32 repeat)
void wasm_ict_backward(const float *y, const float *cb, const float *cr, float *r, float *g, float *b, ui32 repeat)
void avx2_rct_forward(const line_buf *r, const line_buf *g, const line_buf *b, line_buf *y, line_buf *cb, line_buf *cr, ui32 repeat)
void wasm_rev_convert_nlt_type3(const line_buf *src_line, const ui32 src_line_offset, line_buf *dst_line, const ui32 dst_line_offset, si64 shift, ui32 width)
void wasm_cnvrt_si32_to_float_shftd(const si32 *sp, float *dp, float mul, ui32 width)
void avx_cnvrt_float_to_si32(const float *sp, si32 *dp, float mul, ui32 width)
void gen_rct_forward(const line_buf *r, const line_buf *g, const line_buf *b, line_buf *y, line_buf *cb, line_buf *cr, ui32 repeat)
void avx_ict_forward(const float *r, const float *g, const float *b, float *y, float *cb, float *cr, ui32 repeat)
void gen_rct_backward(const line_buf *y, const line_buf *cb, const line_buf *cr, line_buf *r, line_buf *g, line_buf *b, ui32 repeat)
void sse2_rev_convert(const line_buf *src_line, const ui32 src_line_offset, line_buf *dst_line, const ui32 dst_line_offset, si64 shift, ui32 width)
void avx_cnvrt_si32_to_float_shftd(const si32 *sp, float *dp, float mul, ui32 width)
void avx2_rct_backward(const line_buf *y, const line_buf *cb, const line_buf *cr, line_buf *r, line_buf *g, line_buf *b, ui32 repeat)
void sse2_rev_convert_nlt_type3(const line_buf *src_line, const ui32 src_line_offset, line_buf *dst_line, const ui32 dst_line_offset, si64 shift, ui32 width)
void wasm_rev_convert(const line_buf *src_line, const ui32 src_line_offset, line_buf *dst_line, const ui32 dst_line_offset, si64 shift, ui32 width)
void gen_cnvrt_si32_to_float(const si32 *sp, float *dp, float mul, ui32 width)
void gen_ict_forward(const float *r, const float *g, const float *b, float *y, float *cb, float *cr, ui32 repeat)
void sse_cnvrt_float_to_si32_shftd(const float *sp, si32 *dp, float mul, ui32 width)
void wasm_cnvrt_float_to_si32(const float *sp, si32 *dp, float mul, ui32 width)
void sse2_cnvrt_float_to_si32_shftd(const float *sp, si32 *dp, float mul, ui32 width)
void gen_rev_convert_nlt_type3(const line_buf *src_line, const ui32 src_line_offset, line_buf *dst_line, const ui32 dst_line_offset, si64 shift, ui32 width)
void sse_ict_forward(const float *r, const float *g, const float *b, float *y, float *cb, float *cr, ui32 repeat)
void avx2_rev_convert(const line_buf *src_line, const ui32 src_line_offset, line_buf *dst_line, const ui32 dst_line_offset, si64 shift, ui32 width)
void avx_cnvrt_si32_to_float(const si32 *sp, float *dp, float mul, ui32 width)
void wasm_rct_backward(const line_buf *y, const line_buf *cb, const line_buf *cr, line_buf *r, line_buf *g, line_buf *b, ui32 repeat)
void sse_cnvrt_si32_to_float_shftd(const si32 *sp, float *dp, float mul, ui32 width)
void wasm_rct_forward(const line_buf *r, const line_buf *g, const line_buf *b, line_buf *y, line_buf *cb, line_buf *cr, ui32 repeat)
void wasm_ict_forward(const float *r, const float *g, const float *b, float *y, float *cb, float *cr, ui32 repeat)
void avx2_rev_convert_nlt_type3(const line_buf *src_line, const ui32 src_line_offset, line_buf *dst_line, const ui32 dst_line_offset, si64 shift, ui32 width)
void gen_cnvrt_float_to_si32(const float *sp, si32 *dp, float mul, ui32 width)
void gen_ict_backward(const float *y, const float *cb, const float *cr, float *r, float *g, float *b, ui32 repeat)
void wasm_cnvrt_si32_to_float(const si32 *sp, float *dp, float mul, ui32 width)
void gen_rev_convert(const line_buf *src_line, const ui32 src_line_offset, line_buf *dst_line, const ui32 dst_line_offset, si64 shift, ui32 width)
void gen_cnvrt_float_to_si32_shftd(const float *sp, si32 *dp, float mul, ui32 width)
void sse2_rct_forward(const line_buf *r, const line_buf *g, const line_buf *b, line_buf *y, line_buf *cb, line_buf *cr, ui32 repeat)
void avx_cnvrt_float_to_si32_shftd(const float *sp, si32 *dp, float mul, ui32 width)
void avx_ict_backward(const float *y, const float *cb, const float *cr, float *r, float *g, float *b, ui32 repeat)
void sse2_cnvrt_float_to_si32(const float *sp, si32 *dp, float mul, ui32 width)
void sse_cnvrt_si32_to_float(const si32 *sp, float *dp, float mul, ui32 width)
void gen_cnvrt_si32_to_float_shftd(const si32 *sp, float *dp, float mul, ui32 width)
void sse_ict_backward(const float *y, const float *cb, const float *cr, float *r, float *g, float *b, ui32 repeat)
void sse_cnvrt_float_to_si32(const float *sp, si32 *dp, float mul, ui32 width)
int64_t si64
Definition: ojph_defs.h:57
int32_t si32
Definition: ojph_defs.h:55
uint32_t ui32
Definition: ojph_defs.h:54
static const float GAMMA_CR2R
static const float BETA_CbF
static const float GAMMA_CB2B
static const float ALPHA_RF
static const float GAMMA_CB2G
static const float GAMMA_CR2G
static const float ALPHA_BF
static const float BETA_CrF
static const float ALPHA_GF