OpenJPH
Open-source implementation of JPEG2000 Part-15
Loading...
Searching...
No Matches
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, ui32 bit_depth, bool is_signed, ui32 width,
77 const nlt_rec *rec);
78
81 const line_buf *src_line, const ui32 src_line_offset,
82 line_buf *dst_line, const ui32 dst_line_offset,
83 ui32 bit_depth, bool is_signed, ui32 width, const nlt_rec *rec);
84
87 const line_buf *src_line, const ui32 src_line_offset,
88 line_buf *dst_line, const ui32 dst_line_offset,
89 si64 shift, ui32 width);
90
93 const line_buf *src_line, ui32 src_line_offset,
94 line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width);
95
98 const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset,
99 ui32 bit_depth, bool is_signed, ui32 width);
100
103 const line_buf *src_line, ui32 src_line_offset, line_buf *dst_line,
104 ui32 bit_depth, bool is_signed, ui32 width, const nlt_rec *rec);
105
108 const line_buf *src_line, ui32 src_line_offset,
109 line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width);
110
113 const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset,
114 ui32 bit_depth, bool is_signed, ui32 width, const nlt_rec *rec);
115
118 const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset,
119 ui32 bit_depth, bool is_signed, ui32 width);
120
122 void gen_rct_forward(
123 const line_buf *r, const line_buf *g, const line_buf *b,
124 line_buf *y, line_buf *cb, line_buf *cr, ui32 repeat);
125
127 void gen_rct_backward(
128 const line_buf *y, const line_buf *cb, const line_buf *cr,
129 line_buf *r, line_buf *g, line_buf *b, ui32 repeat);
130
132 void gen_ict_forward(const float *r, const float *g, const float *b,
133 float *y, float *cb, float *cr, ui32 repeat);
134
136 void gen_ict_backward(const float *y, const float *cb, const float *cr,
137 float *r, float *g, float *b, ui32 repeat);
138
140 //
141 //
142 // SSE Functions (float)
143 //
144 //
146
148 void sse_ict_forward(const float *r, const float *g, const float *b,
149 float *y, float *cb, float *cr, ui32 repeat);
150
152 void sse_ict_backward(const float *y, const float *cb, const float *cr,
153 float *r, float *g, float *b, ui32 repeat);
154
156 //
157 //
158 // SSE2 Functions (float)
159 //
160 //
162
165 const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset,
166 ui32 bit_depth, bool is_signed, ui32 width);
167
170 const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset,
171 ui32 bit_depth, bool is_signed, ui32 width, const nlt_rec *rec);
172
175 const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset,
176 ui32 bit_depth, bool is_signed, ui32 width);
177
179 //
180 //
181 // SSE2 Functions (integer)
182 //
183 //
185
188 const line_buf *src_line, const ui32 src_line_offset,
189 line_buf *dst_line, const ui32 dst_line_offset,
190 si64 shift, ui32 width);
191
194 const line_buf *src_line, const ui32 src_line_offset,
195 line_buf *dst_line, const ui32 dst_line_offset,
196 si64 shift, ui32 width);
197
200 const line_buf *src_line, ui32 src_line_offset,
201 line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width);
202
205 const line_buf *src_line, ui32 src_line_offset,
206 line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width,
207 const nlt_rec *rec);
208
211 const line_buf *src_line, ui32 src_line_offset,
212 line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width);
213
216 const line_buf *r, const line_buf *g, const line_buf *b,
217 line_buf *y, line_buf *cb, line_buf *cr, ui32 repeat);
218
221 const line_buf *y, const line_buf *cb, const line_buf *cr,
222 line_buf *r, line_buf *g, line_buf *b, ui32 repeat);
223
225 //
226 //
227 // AVX Functions (float)
228 //
229 //
231
233 void avx_ict_forward(const float *r, const float *g, const float *b,
234 float *y, float *cb, float *cr, ui32 repeat);
235
237 void avx_ict_backward(const float *y, const float *cb, const float *cr,
238 float *r, float *g, float *b, ui32 repeat);
239
241 //
242 //
243 // AVX2 Functions (integer)
244 //
245 //
247
250 const line_buf *src_line, const ui32 src_line_offset,
251 line_buf *dst_line, const ui32 dst_line_offset,
252 si64 shift, ui32 width);
253
256 const line_buf *src_line, const ui32 src_line_offset,
257 line_buf *dst_line, const ui32 dst_line_offset,
258 si64 shift, ui32 width);
259
262 const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset,
263 ui32 bit_depth, bool is_signed, ui32 width);
264
267 const line_buf *src_line, ui32 src_line_offset,
268 line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width);
269
272 const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset,
273 ui32 bit_depth, bool is_signed, ui32 width, const nlt_rec *rec);
274
277 const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset,
278 ui32 bit_depth, bool is_signed, ui32 width);
279
282 const line_buf *src_line, ui32 src_line_offset,
283 line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width,
284 const nlt_rec *rec);
285
288 const line_buf *src_line, ui32 src_line_offset,
289 line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width);
290
293 const line_buf *r, const line_buf *g, const line_buf *b,
294 line_buf *y, line_buf *cb, line_buf *cr, ui32 repeat);
295
298 const line_buf *y, const line_buf *cb, const line_buf *cr,
299 line_buf *r, line_buf *g, line_buf *b, ui32 repeat);
300
302 //
303 //
304 // WASM Functions
305 //
306 //
308
311 const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset,
312 ui32 bit_depth, bool is_signed, ui32 width);
313
316 const line_buf *src_line, ui32 src_line_offset,
317 line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width);
318
320 void wasm_rev_convert(
321 const line_buf *src_line, const ui32 src_line_offset,
322 line_buf *dst_line, const ui32 dst_line_offset,
323 si64 shift, ui32 width);
324
327 const line_buf *src_line, const ui32 src_line_offset,
328 line_buf *dst_line, const ui32 dst_line_offset,
329 si64 shift, ui32 width);
330
333 const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset,
334 ui32 bit_depth, bool is_signed, ui32 width);
335
338 const line_buf *src_line, ui32 src_line_offset,
339 line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width);
340
342 void wasm_rct_forward(
343 const line_buf *r, const line_buf *g, const line_buf *b,
344 line_buf *y, line_buf *cb, line_buf *cr, ui32 repeat);
345
348 const line_buf *y, const line_buf *cb, const line_buf *cr,
349 line_buf *r, line_buf *g, line_buf *b, ui32 repeat);
350
352 void wasm_ict_forward(const float *r, const float *g, const float *b,
353 float *y, float *cb, float *cr, ui32 repeat);
354
356 void wasm_ict_backward(const float *y, const float *cb, const float *cr,
357 float *r, float *g, float *b, ui32 repeat);
358
360 //
361 //
362 // VSX Functions
363 //
364 //
366
369 const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset,
370 ui32 bit_depth, bool is_signed, ui32 width);
371
374 const line_buf *src_line, ui32 src_line_offset,
375 line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width);
376
378 void vsx_rev_convert(
379 const line_buf *src_line, const ui32 src_line_offset,
380 line_buf *dst_line, const ui32 dst_line_offset,
381 si64 shift, ui32 width);
382
385 const line_buf *src_line, const ui32 src_line_offset,
386 line_buf *dst_line, const ui32 dst_line_offset,
387 si64 shift, ui32 width);
388
391 const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset,
392 ui32 bit_depth, bool is_signed, ui32 width);
393
396 const line_buf *src_line, ui32 src_line_offset,
397 line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width);
398
400 void vsx_rct_forward(
401 const line_buf *r, const line_buf *g, const line_buf *b,
402 line_buf *y, line_buf *cb, line_buf *cr, ui32 repeat);
403
405 void vsx_rct_backward(
406 const line_buf *y, const line_buf *cb, const line_buf *cr,
407 line_buf *r, line_buf *g, line_buf *b, ui32 repeat);
408
410 void vsx_ict_forward(const float *r, const float *g, const float *b,
411 float *y, float *cb, float *cr, ui32 repeat);
412
414 void vsx_ict_backward(const float *y, const float *cb, const float *cr,
415 float *r, float *g, float *b, ui32 repeat);
416
417 }
418}
419
420
421
422#endif // !OJPH_COLOR_LOCAL_H
void gen_rev_decode_nlt(const line_buf *src_line, const ui32 src_line_offset, line_buf *dst_line, const ui32 dst_line_offset, ui32 bit_depth, bool is_signed, ui32 width, const nlt_rec *rec)
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 sse2_irv_convert_to_integer(const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset, ui32 bit_depth, bool is_signed, ui32 width)
void wasm_ict_backward(const float *y, const float *cb, const float *cr, float *r, float *g, float *b, ui32 repeat)
void wasm_irv_convert_to_integer(const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset, ui32 bit_depth, bool is_signed, ui32 width)
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 vsx_irv_convert_to_float_nlt_type3(const line_buf *src_line, ui32 src_line_offset, line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width)
void wasm_irv_convert_to_integer_nlt_type3(const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset, ui32 bit_depth, bool is_signed, ui32 width)
void sse2_irv_convert_to_float_nlt_type3(const line_buf *src_line, ui32 src_line_offset, line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width)
void sse2_irv_convert_to_integer_nlt_type3(const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset, ui32 bit_depth, bool is_signed, 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 vsx_ict_backward(const float *y, const float *cb, const float *cr, float *r, float *g, float *b, ui32 repeat)
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 gen_irv_convert_to_integer(const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset, ui32 bit_depth, bool is_signed, ui32 width)
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_irv_convert_to_float(const line_buf *src_line, ui32 src_line_offset, line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width)
void vsx_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 vsx_ict_forward(const float *r, const float *g, const float *b, float *y, float *cb, float *cr, ui32 repeat)
void vsx_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 gen_ict_forward(const float *r, const float *g, const float *b, float *y, float *cb, float *cr, ui32 repeat)
void vsx_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_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_irv_convert_to_float_nlt_type3(const line_buf *src_line, ui32 src_line_offset, line_buf *dst_line, ui32 bit_depth, bool is_signed, 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 avx2_irv_convert_to_float(const line_buf *src_line, ui32 src_line_offset, line_buf *dst_line, ui32 bit_depth, bool is_signed, 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 avx2_irv_convert_to_integer_nlt(const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset, ui32 bit_depth, bool is_signed, ui32 width, const nlt_rec *rec)
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 gen_irv_convert_to_integer_nlt(const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset, ui32 bit_depth, bool is_signed, ui32 width, const nlt_rec *rec)
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_ict_backward(const float *y, const float *cb, const float *cr, float *r, float *g, float *b, ui32 repeat)
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 sse2_irv_convert_to_integer_nlt(const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset, ui32 bit_depth, bool is_signed, ui32 width, const nlt_rec *rec)
void avx2_irv_convert_to_float_nlt(const line_buf *src_line, ui32 src_line_offset, line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width, const nlt_rec *rec)
void vsx_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 avx2_irv_convert_to_integer(const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset, ui32 bit_depth, bool is_signed, ui32 width)
void avx2_irv_convert_to_float_nlt_type3(const line_buf *src_line, ui32 src_line_offset, line_buf *dst_line, ui32 bit_depth, bool is_signed, 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 sse2_irv_convert_to_float_nlt(const line_buf *src_line, ui32 src_line_offset, line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width, const nlt_rec *rec)
void avx_ict_backward(const float *y, const float *cb, const float *cr, float *r, float *g, float *b, ui32 repeat)
void gen_irv_convert_to_float_nlt(const line_buf *src_line, ui32 src_line_offset, line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width, const nlt_rec *rec)
void avx2_irv_convert_to_integer_nlt_type3(const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset, ui32 bit_depth, bool is_signed, ui32 width)
void vsx_irv_convert_to_float(const line_buf *src_line, ui32 src_line_offset, line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width)
void vsx_irv_convert_to_integer(const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset, ui32 bit_depth, bool is_signed, ui32 width)
void wasm_irv_convert_to_float(const line_buf *src_line, ui32 src_line_offset, line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width)
void gen_rev_encode_nlt(const line_buf *src_line, const ui32 src_line_offset, line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width, const nlt_rec *rec)
void vsx_irv_convert_to_integer_nlt_type3(const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset, ui32 bit_depth, bool is_signed, ui32 width)
void sse_ict_backward(const float *y, const float *cb, const float *cr, float *r, float *g, float *b, ui32 repeat)
void gen_irv_convert_to_integer_nlt_type3(const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset, ui32 bit_depth, bool is_signed, ui32 width)
void gen_irv_convert_to_float_nlt_type3(const line_buf *src_line, ui32 src_line_offset, line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width)
void sse2_irv_convert_to_float(const line_buf *src_line, ui32 src_line_offset, line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width)
int64_t si64
Definition ojph_defs.h:57
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