OpenJPH: /build/openjph/src/OpenJPH/src/core/transform/ojph_colour.cpp Source File

OpenJPH Open-source implementation of JPEG2000 Part-15

Loading...
Searching...
No Matches
ojph_colour.cpp
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.cpp
34// Author: Aous Naman
35// Date: 28 August 2019
36//***************************************************************************/
37
38#include <cmath>
39#include <climits>
40#include <mutex>
41
42#include "ojph_defs.h"
43#include "ojph_arch.h"
44#include "ojph_mem.h"
45#include "ojph_colour.h"
46#include "ojph_colour_local.h"
47
48namespace ojph {
49
50 // defined elsewhere
51 class line_buf;
52
53 namespace local {
54
56 void (*rev_convert)
57 (const line_buf *src_line, const ui32 src_line_offset,
58 line_buf *dst_line, const ui32 dst_line_offset,
59 si64 shift, ui32 width) = NULL;
60
62 void (*rev_convert_nlt_type3)
63 (const line_buf *src_line, const ui32 src_line_offset,
64 line_buf *dst_line, const ui32 dst_line_offset,
65 si64 shift, ui32 width) = NULL;
66
67
69 void (*irv_convert_to_integer) (
70 const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset,
71 ui32 bit_depth, bool is_signed, ui32 width) = NULL;
72
74 void (*irv_convert_to_float) (
75 const line_buf *src_line, ui32 src_line_offset,
76 line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width) = NULL;
77
79 void (*irv_convert_to_integer_nlt_type3) (
80 const line_buf *src_line, line_buf *dst_line, ui32 dst_line_offset,
81 ui32 bit_depth, bool is_signed, ui32 width) = NULL;
82
84 void (*irv_convert_to_float_nlt_type3) (
85 const line_buf *src_line, ui32 src_line_offset,
86 line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width) = NULL;
87
89 void (*rct_forward)
90 (const line_buf* r, const line_buf* g, const line_buf* b,
91 line_buf* y, line_buf* cb, line_buf* cr, ui32 repeat) = NULL;
92
94 void (*rct_backward)
95 (const line_buf* r, const line_buf* g, const line_buf* b,
96 line_buf* y, line_buf* cb, line_buf* cr, ui32 repeat) = NULL;
97
99 void (*ict_forward)
100 (const float *r, const float *g, const float *b,
101 float *y, float *cb, float *cr, ui32 repeat) = NULL;
102
104 void (*ict_backward)
105 (const float *y, const float *cb, const float *cr,
106 float *r, float *g, float *b, ui32 repeat) = NULL;
107
109 void init_colour_transform_functions()
110 {
111 static std::once_flag colour_transform_functions_init_flag;
112 std::call_once(colour_transform_functions_init_flag, []() {
113#if !defined(OJPH_ENABLE_WASM_SIMD) || !defined(OJPH_EMSCRIPTEN)
114
115 rev_convert = gen_rev_convert;
116 rev_convert_nlt_type3 = gen_rev_convert_nlt_type3;
117 irv_convert_to_integer = gen_irv_convert_to_integer;
118 irv_convert_to_float = gen_irv_convert_to_float;
119 irv_convert_to_integer_nlt_type3 = gen_irv_convert_to_integer_nlt_type3;
120 irv_convert_to_float_nlt_type3 = gen_irv_convert_to_float_nlt_type3;
121 rct_forward = gen_rct_forward;
122 rct_backward = gen_rct_backward;
123 ict_forward = gen_ict_forward;
124 ict_backward = gen_ict_backward;
125
126 #ifndef OJPH_DISABLE_SIMD
127
128 #if (defined(OJPH_ARCH_X86_64) || defined(OJPH_ARCH_I386))
129
130 #ifndef OJPH_DISABLE_SSE
131 if (get_cpu_ext_level() >= X86_CPU_EXT_LEVEL_SSE)
132 {
133 ict_forward = sse_ict_forward;
134 ict_backward = sse_ict_backward;
135 }
136 #endif // !OJPH_DISABLE_SSE
137
138 #ifndef OJPH_DISABLE_SSE2
139 if (get_cpu_ext_level() >= X86_CPU_EXT_LEVEL_SSE2)
140 {
141 rev_convert = sse2_rev_convert;
142 rev_convert_nlt_type3 = sse2_rev_convert_nlt_type3;
143 irv_convert_to_integer = sse2_irv_convert_to_integer;
144 irv_convert_to_float = sse2_irv_convert_to_float;
145 irv_convert_to_integer_nlt_type3 =
146 sse2_irv_convert_to_integer_nlt_type3;
147 irv_convert_to_float_nlt_type3 =
148 sse2_irv_convert_to_float_nlt_type3;
149 rct_forward = sse2_rct_forward;
150 rct_backward = sse2_rct_backward;
151 }
152 #endif // !OJPH_DISABLE_SSE2
153
154 #ifndef OJPH_DISABLE_AVX
155 if (get_cpu_ext_level() >= X86_CPU_EXT_LEVEL_AVX)
156 {
157 ict_forward = avx_ict_forward;
158 ict_backward = avx_ict_backward;
159 }
160 #endif // !OJPH_DISABLE_AVX
161
162 #ifndef OJPH_DISABLE_AVX2
163 if (get_cpu_ext_level() >= X86_CPU_EXT_LEVEL_AVX2)
164 {
165 rev_convert = avx2_rev_convert;
166 rev_convert_nlt_type3 = avx2_rev_convert_nlt_type3;
167 irv_convert_to_integer = avx2_irv_convert_to_integer;
168 irv_convert_to_float = avx2_irv_convert_to_float;
169 irv_convert_to_integer_nlt_type3 =
170 avx2_irv_convert_to_integer_nlt_type3;
171 irv_convert_to_float_nlt_type3 =
172 avx2_irv_convert_to_float_nlt_type3;
173 rct_forward = avx2_rct_forward;
174 rct_backward = avx2_rct_backward;
175 }
176 #endif // !OJPH_DISABLE_AVX2
177
178 #elif defined(OJPH_ARCH_ARM)
179
180 #endif // !(defined(OJPH_ARCH_X86_64) || defined(OJPH_ARCH_I386))
181
182 #endif // !OJPH_DISABLE_SIMD
183
184#else // OJPH_ENABLE_WASM_SIMD
185
186 rev_convert = wasm_rev_convert;
187 rev_convert_nlt_type3 = wasm_rev_convert_nlt_type3;
188 irv_convert_to_integer = wasm_irv_convert_to_integer;
189 irv_convert_to_float = wasm_irv_convert_to_float;
190 irv_convert_to_integer_nlt_type3 = wasm_irv_convert_to_integer_nlt_type3;
191 irv_convert_to_float_nlt_type3 = wasm_irv_convert_to_float_nlt_type3;
192 rct_forward = wasm_rct_forward;
193 rct_backward = wasm_rct_backward;
194 ict_forward = wasm_ict_forward;
195 ict_backward = wasm_ict_backward;
196
197#endif // !OJPH_ENABLE_WASM_SIMD
198 });
199 }
200
202 const float CT_CNST::ALPHA_RF = 0.299f;
203 const float CT_CNST::ALPHA_GF = 0.587f;
204 const float CT_CNST::ALPHA_BF = 0.114f;
205 const float CT_CNST::BETA_CbF = float(0.5/(1-double(CT_CNST::ALPHA_BF)));
206 const float CT_CNST::BETA_CrF = float(0.5/(1-double(CT_CNST::ALPHA_RF)));
207 const float CT_CNST::GAMMA_CB2G =
208 float(2.0*double(ALPHA_BF)*(1.0-double(ALPHA_BF))/double(ALPHA_GF));
209 const float CT_CNST::GAMMA_CR2G =
210 float(2.0*double(ALPHA_RF)*(1.0-double(ALPHA_RF))/double(ALPHA_GF));
211 const float CT_CNST::GAMMA_CB2B = float(2.0 * (1.0 - double(ALPHA_BF)));
212 const float CT_CNST::GAMMA_CR2R = float(2.0 * (1.0 - double(ALPHA_RF)));
213
215
216#if !defined(OJPH_ENABLE_WASM_SIMD) || !defined(OJPH_EMSCRIPTEN)
217
219 void gen_rev_convert(
220 const line_buf *src_line, const ui32 src_line_offset,
221 line_buf *dst_line, const ui32 dst_line_offset,
222 si64 shift, ui32 width)
223 {
224 if (src_line->flags & line_buf::LFT_32BIT)
225 {
226 if (dst_line->flags & line_buf::LFT_32BIT)
227 {
228 const si32 *sp = src_line->i32 + src_line_offset;
229 si32 *dp = dst_line->i32 + dst_line_offset;
230 si32 s = (si32)shift;
231 for (ui32 i = width; i > 0; --i)
232 *dp++ = *sp++ + s;
233 }
234 else
235 {
236 const si32 *sp = src_line->i32 + src_line_offset;
237 si64 *dp = dst_line->i64 + dst_line_offset;
238 for (ui32 i = width; i > 0; --i)
239 *dp++ = *sp++ + shift;
240 }
241 }
242 else
243 {
244 assert(src_line->flags & line_buf::LFT_64BIT);
245 assert(dst_line->flags & line_buf::LFT_32BIT);
246 const si64 *sp = src_line->i64 + src_line_offset;
247 si32 *dp = dst_line->i32 + dst_line_offset;
248 for (ui32 i = width; i > 0; --i)
249 *dp++ = (si32)(*sp++ + shift);
250 }
251 }
252
254 void gen_rev_convert_nlt_type3(
255 const line_buf *src_line, const ui32 src_line_offset,
256 line_buf *dst_line, const ui32 dst_line_offset,
257 si64 shift, ui32 width)
258 {
259 if (src_line->flags & line_buf::LFT_32BIT)
260 {
261 if (dst_line->flags & line_buf::LFT_32BIT)
262 {
263 const si32 *sp = src_line->i32 + src_line_offset;
264 si32 *dp = dst_line->i32 + dst_line_offset;
265 si32 s = (si32)shift;
266 for (ui32 i = width; i > 0; --i) {
267 const si32 v = *sp++;
268 *dp++ = v >= 0 ? v : (- v - s);
269 }
270 }
271 else
272 {
273 const si32 *sp = src_line->i32 + src_line_offset;
274 si64 *dp = dst_line->i64 + dst_line_offset;
275 for (ui32 i = width; i > 0; --i) {
276 const si64 v = *sp++;
277 *dp++ = v >= 0 ? v : (- v - shift);
278 }
279 }
280 }
281 else
282 {
283 assert(src_line->flags & line_buf::LFT_64BIT);
284 assert(dst_line->flags & line_buf::LFT_32BIT);
285 const si64 *sp = src_line->i64 + src_line_offset;
286 si32 *dp = dst_line->i32 + dst_line_offset;
287 for (ui32 i = width; i > 0; --i) {
288 const si64 v = *sp++;
289 *dp++ = (si32)(v >= 0 ? v : (- v - shift));
290 }
291 }
292 }
293
294
296 template<bool NLT_TYPE3>
297 static inline
298 void local_gen_irv_convert_to_integer(const line_buf *src_line,
299 line_buf *dst_line, ui32 dst_line_offset,
300 ui32 bit_depth, bool is_signed, ui32 width)
301 {
302 assert((src_line->flags & line_buf::LFT_32BIT) &&
303 (src_line->flags & line_buf::LFT_INTEGER) == 0 &&
304 (dst_line->flags & line_buf::LFT_32BIT) &&
305 (dst_line->flags & line_buf::LFT_INTEGER));
306
307 assert(bit_depth <= 32);
308 const float* sp = src_line->f32;
309 si32* dp = dst_line->i32 + dst_line_offset;
310 // There is the possibility that converting to integer will
311 // exceed the dynamic range of 32bit integer; therefore, care must be
312 // exercised.
313 // We look if the floating point number is outside the half-closed
314 // interval [-0.5f, 0.5f). If so, we limit the resulting integer
315 // to the maximum/minimum that number supports.
316 si32 neg_limit = (si32)INT_MIN >> (32 - bit_depth);
317 float mul = (float)(1ull << bit_depth);
318 float fl_up_lim = -(float)neg_limit; // val < upper
319 float fl_low_lim = (float)neg_limit; // val >= lower
320 si32 s32_up_lim = INT_MAX >> (32 - bit_depth);
321 si32 s32_low_lim = INT_MIN >> (32 - bit_depth);
322
323 if (is_signed)
324 {
325 const si32 bias = (si32)((1ULL << (bit_depth - 1)) + 1);
326 for (int i = (int)width; i > 0; --i) {
327 float t = *sp++ * mul;
328 si32 v = ojph_round(t);
329 v = t >= fl_low_lim ? v : s32_low_lim;
330 v = t < fl_up_lim ? v : s32_up_lim;
331 if (NLT_TYPE3)
332 v = (v >= 0) ? v : (- v - bias);
333 *dp++ = v;
334 }
335 }
336 else
337 {
338 const si32 half = (si32)(1ULL << (bit_depth - 1));
339 for (int i = (int)width; i > 0; --i) {
340 float t = *sp++ * mul;
341 si32 v = ojph_round(t);
342 v = t >= fl_low_lim ? v : s32_low_lim;
343 v = t < fl_up_lim ? v : s32_up_lim;
344 *dp++ = v + half;
345 }
346 }
347 }
348
350 void gen_irv_convert_to_integer(const line_buf *src_line,
351 line_buf *dst_line, ui32 dst_line_offset,
352 ui32 bit_depth, bool is_signed, ui32 width)
353 {
354 local_gen_irv_convert_to_integer<false>(src_line, dst_line,
355 dst_line_offset, bit_depth, is_signed, width);
356 }
357
359 void gen_irv_convert_to_integer_nlt_type3(const line_buf *src_line,
360 line_buf *dst_line, ui32 dst_line_offset,
361 ui32 bit_depth, bool is_signed, ui32 width)
362 {
363 local_gen_irv_convert_to_integer<true>(src_line, dst_line,
364 dst_line_offset, bit_depth, is_signed, width);
365 }
366
368 template<bool NLT_TYPE3>
369 static inline
370 void local_gen_irv_convert_to_float(const line_buf *src_line,
371 ui32 src_line_offset, line_buf *dst_line,
372 ui32 bit_depth, bool is_signed, ui32 width)
373 {
374 assert((src_line->flags & line_buf::LFT_32BIT) &&
375 (src_line->flags & line_buf::LFT_INTEGER) &&
376 (dst_line->flags & line_buf::LFT_32BIT) &&
377 (dst_line->flags & line_buf::LFT_INTEGER) == 0);
378
379 assert(bit_depth <= 32);
380 float mul = (float)(1.0 / (double)(1ULL << bit_depth));
381
382 const si32* sp = src_line->i32 + src_line_offset;
383 float* dp = dst_line->f32;
384 if (is_signed)
385 {
386 const si32 bias = (si32)((1ULL << (bit_depth - 1)) + 1);
387 for (int i = (int)width; i > 0; --i) {
388 si32 v = *sp++;
389 if (NLT_TYPE3)
390 v = (v >= 0) ? v : (- v - bias);
391 *dp++ = (float)v * mul;
392 }
393 }
394 else
395 {
396 const si32 half = (si32)(1ULL << (bit_depth - 1));
397 for (int i = (int)width; i > 0; --i) {
398 si32 v = *sp++;
399 v -= half;
400 *dp++ = (float)v * mul;
401 }
402 }
403 }
404
406 void gen_irv_convert_to_float(const line_buf *src_line,
407 ui32 src_line_offset, line_buf *dst_line,
408 ui32 bit_depth, bool is_signed, ui32 width)
409 {
410 local_gen_irv_convert_to_float<false>(src_line, src_line_offset,
411 dst_line, bit_depth, is_signed, width);
412 }
413
415 void gen_irv_convert_to_float_nlt_type3(const line_buf *src_line,
416 ui32 src_line_offset, line_buf *dst_line,
417 ui32 bit_depth, bool is_signed, ui32 width)
418 {
419 local_gen_irv_convert_to_float<true>(src_line, src_line_offset,
420 dst_line, bit_depth, is_signed, width);
421 }
422
424 void gen_rct_forward(
425 const line_buf *r, const line_buf *g, const line_buf *b,
426 line_buf *y, line_buf *cb, line_buf *cr, ui32 repeat)
427 {
428 assert((y->flags & line_buf::LFT_INTEGER) &&
429 (cb->flags & line_buf::LFT_INTEGER) &&
430 (cr->flags & line_buf::LFT_INTEGER) &&
431 (r->flags & line_buf::LFT_INTEGER) &&
432 (g->flags & line_buf::LFT_INTEGER) &&
433 (b->flags & line_buf::LFT_INTEGER));
434
435 if (y->flags & line_buf::LFT_32BIT)
436 {
437 assert((y->flags & line_buf::LFT_32BIT) &&
438 (cb->flags & line_buf::LFT_32BIT) &&
439 (cr->flags & line_buf::LFT_32BIT) &&
440 (r->flags & line_buf::LFT_32BIT) &&
441 (g->flags & line_buf::LFT_32BIT) &&
442 (b->flags & line_buf::LFT_32BIT));
443 const si32 *rp = r->i32, * gp = g->i32, * bp = b->i32;
444 si32 *yp = y->i32, * cbp = cb->i32, * crp = cr->i32;
445 for (ui32 i = repeat; i > 0; --i)
446 {
447 si32 rr = *rp++, gg = *gp++, bb = *bp++;
448 *yp++ = (rr + (gg << 1) + bb) >> 2;
449 *cbp++ = (bb - gg);
450 *crp++ = (rr - gg);
451 }
452 }
453 else
454 {
455 assert((y->flags & line_buf::LFT_64BIT) &&
456 (cb->flags & line_buf::LFT_64BIT) &&
457 (cr->flags & line_buf::LFT_64BIT) &&
458 (r->flags & line_buf::LFT_32BIT) &&
459 (g->flags & line_buf::LFT_32BIT) &&
460 (b->flags & line_buf::LFT_32BIT));
461 const si32 *rp = r->i32, *gp = g->i32, *bp = b->i32;
462 si64 *yp = y->i64, *cbp = cb->i64, *crp = cr->i64;
463 for (ui32 i = repeat; i > 0; --i)
464 {
465 si64 rr = *rp++, gg = *gp++, bb = *bp++;
466 *yp++ = (rr + (gg << 1) + bb) >> 2;
467 *cbp++ = (bb - gg);
468 *crp++ = (rr - gg);
469 }
470 }
471 }
472
474 void gen_rct_backward(
475 const line_buf *y, const line_buf *cb, const line_buf *cr,
476 line_buf *r, line_buf *g, line_buf *b, ui32 repeat)
477 {
478 assert((y->flags & line_buf::LFT_INTEGER) &&
479 (cb->flags & line_buf::LFT_INTEGER) &&
480 (cr->flags & line_buf::LFT_INTEGER) &&
481 (r->flags & line_buf::LFT_INTEGER) &&
482 (g->flags & line_buf::LFT_INTEGER) &&
483 (b->flags & line_buf::LFT_INTEGER));
484
485 if (y->flags & line_buf::LFT_32BIT)
486 {
487 assert((y->flags & line_buf::LFT_32BIT) &&
488 (cb->flags & line_buf::LFT_32BIT) &&
489 (cr->flags & line_buf::LFT_32BIT) &&
490 (r->flags & line_buf::LFT_32BIT) &&
491 (g->flags & line_buf::LFT_32BIT) &&
492 (b->flags & line_buf::LFT_32BIT));
493 const si32 *yp = y->i32, *cbp = cb->i32, *crp = cr->i32;
494 si32 *rp = r->i32, *gp = g->i32, *bp = b->i32;
495 for (ui32 i = repeat; i > 0; --i)
496 {
497 si32 yy = *yp++, cbb = *cbp++, crr = *crp++;
498 si32 gg = yy - ((cbb + crr) >> 2);
499 *rp++ = crr + gg;
500 *gp++ = gg;
501 *bp++ = cbb + gg;
502 }
503 }
504 else
505 {
506 assert((y->flags & line_buf::LFT_64BIT) &&
507 (cb->flags & line_buf::LFT_64BIT) &&
508 (cr->flags & line_buf::LFT_64BIT) &&
509 (r->flags & line_buf::LFT_32BIT) &&
510 (g->flags & line_buf::LFT_32BIT) &&
511 (b->flags & line_buf::LFT_32BIT));
512 const si64 *yp = y->i64, *cbp = cb->i64, *crp = cr->i64;
513 si32 *rp = r->i32, *gp = g->i32, *bp = b->i32;
514 for (ui32 i = repeat; i > 0; --i)
515 {
516 si64 yy = *yp++, cbb = *cbp++, crr = *crp++;
517 si64 gg = yy - ((cbb + crr) >> 2);
518 *rp++ = (si32)(crr + gg);
519 *gp++ = (si32)gg;
520 *bp++ = (si32)(cbb + gg);
521 }
522 }
523 }
524
526 void gen_ict_forward(const float *r, const float *g, const float *b,
527 float *y, float *cb, float *cr, ui32 repeat)
528 {
529 for (ui32 i = repeat; i > 0; --i)
530 {
531 *y = CT_CNST::ALPHA_RF * *r
532 + CT_CNST::ALPHA_GF * *g++
533 + CT_CNST::ALPHA_BF * *b;
534 *cb++ = CT_CNST::BETA_CbF * (*b++ - *y);
535 *cr++ = CT_CNST::BETA_CrF * (*r++ - *y++);
536 }
537 }
538
540 void gen_ict_backward(const float *y, const float *cb, const float *cr,
541 float *r, float *g, float *b, ui32 repeat)
542 {
543 for (ui32 i = repeat; i > 0; --i)
544 {
545 *g++ = *y - CT_CNST::GAMMA_CR2G * *cr - CT_CNST::GAMMA_CB2G * *cb;
546 *r++ = *y + CT_CNST::GAMMA_CR2R * *cr++;
547 *b++ = *y++ + CT_CNST::GAMMA_CB2B * *cb++;
548 }
549 }
550
551#endif // !OJPH_ENABLE_WASM_SIMD
552
553 }
554}
ojph::line_buf
Definition ojph_mem.h:161
ojph::line_buf::LFT_INTEGER
@ LFT_INTEGER
Definition ojph_mem.h:170
ojph::line_buf::LFT_32BIT
@ LFT_32BIT
Definition ojph_mem.h:168
ojph::line_buf::LFT_64BIT
@ LFT_64BIT
Definition ojph_mem.h:169
ojph::line_buf::i64
si64 * i64
Definition ojph_mem.h:186
ojph::line_buf::flags
ui32 flags
Definition ojph_mem.h:183
ojph::line_buf::f32
float * f32
Definition ojph_mem.h:187
ojph::line_buf::i32
si32 * i32
Definition ojph_mem.h:185
ojph::local
Definition ojph_bitbuffer_read.h:52
ojph::local::sse2_rct_backward
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)
ojph::local::sse2_irv_convert_to_integer
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)
ojph::local::wasm_ict_backward
void wasm_ict_backward(const float *y, const float *cb, const float *cr, float *r, float *g, float *b, ui32 repeat)
Definition ojph_colour_wasm.cpp:655
ojph::local::wasm_irv_convert_to_integer
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)
Definition ojph_colour_wasm.cpp:366
ojph::local::avx2_rct_forward
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)
ojph::local::wasm_rev_convert_nlt_type3
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)
Definition ojph_colour_wasm.cpp:126
ojph::local::rct_forward
void(* 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)
Definition ojph_colour.cpp:90
ojph::local::wasm_irv_convert_to_integer_nlt_type3
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)
Definition ojph_colour_wasm.cpp:375
ojph::local::sse2_irv_convert_to_float_nlt_type3
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)
ojph::local::sse2_irv_convert_to_integer_nlt_type3
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)
ojph::local::ict_forward
void(* ict_forward)(const float *r, const float *g, const float *b, float *y, float *cb, float *cr, ui32 repeat)
Definition ojph_colour.cpp:100
ojph::local::gen_rct_forward
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)
Definition ojph_colour.cpp:424
ojph::local::avx_ict_forward
void avx_ict_forward(const float *r, const float *g, const float *b, float *y, float *cb, float *cr, ui32 repeat)
ojph::local::gen_rct_backward
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)
Definition ojph_colour.cpp:474
ojph::local::sse2_rev_convert
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)
ojph::local::irv_convert_to_integer_nlt_type3
void(* 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)
Definition ojph_colour.cpp:79
ojph::local::irv_convert_to_float
void(* 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)
Definition ojph_colour.cpp:74
ojph::local::avx2_rct_backward
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)
ojph::local::gen_irv_convert_to_integer
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)
Definition ojph_colour.cpp:350
ojph::local::ict_backward
void(* ict_backward)(const float *y, const float *cb, const float *cr, float *r, float *g, float *b, ui32 repeat)
Definition ojph_colour.cpp:105
ojph::local::sse2_rev_convert_nlt_type3
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)
ojph::local::wasm_rev_convert
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)
Definition ojph_colour_wasm.cpp:65
ojph::local::gen_irv_convert_to_float
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)
Definition ojph_colour.cpp:406
ojph::local::init_colour_transform_functions
void init_colour_transform_functions()
Definition ojph_colour.cpp:109
ojph::local::gen_ict_forward
void gen_ict_forward(const float *r, const float *g, const float *b, float *y, float *cb, float *cr, ui32 repeat)
Definition ojph_colour.cpp:526
ojph::local::rct_backward
void(* rct_backward)(const line_buf *r, const line_buf *g, const line_buf *b, line_buf *y, line_buf *cb, line_buf *cr, ui32 repeat)
Definition ojph_colour.cpp:95
ojph::local::gen_rev_convert_nlt_type3
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)
Definition ojph_colour.cpp:254
ojph::local::irv_convert_to_integer
void(* 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)
Definition ojph_colour.cpp:69
ojph::local::wasm_irv_convert_to_float_nlt_type3
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)
Definition ojph_colour_wasm.cpp:442
ojph::local::sse_ict_forward
void sse_ict_forward(const float *r, const float *g, const float *b, float *y, float *cb, float *cr, ui32 repeat)
ojph::local::avx2_rev_convert
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)
ojph::local::avx2_irv_convert_to_float
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)
ojph::local::wasm_rct_backward
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)
Definition ojph_colour_wasm.cpp:541
ojph::local::local_gen_irv_convert_to_integer
static void local_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)
Definition ojph_colour.cpp:298
ojph::local::wasm_rct_forward
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)
Definition ojph_colour_wasm.cpp:451
ojph::local::wasm_ict_forward
void wasm_ict_forward(const float *r, const float *g, const float *b, float *y, float *cb, float *cr, ui32 repeat)
Definition ojph_colour_wasm.cpp:630
ojph::local::avx2_rev_convert_nlt_type3
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)
ojph::local::gen_ict_backward
void gen_ict_backward(const float *y, const float *cb, const float *cr, float *r, float *g, float *b, ui32 repeat)
Definition ojph_colour.cpp:540
ojph::local::gen_rev_convert
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)
Definition ojph_colour.cpp:219
ojph::local::avx2_irv_convert_to_integer
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)
ojph::local::avx2_irv_convert_to_float_nlt_type3
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)
ojph::local::irv_convert_to_float_nlt_type3
void(* 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)
Definition ojph_colour.cpp:84
ojph::local::sse2_rct_forward
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)
ojph::local::avx_ict_backward
void avx_ict_backward(const float *y, const float *cb, const float *cr, float *r, float *g, float *b, ui32 repeat)
ojph::local::avx2_irv_convert_to_integer_nlt_type3
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)
ojph::local::rev_convert_nlt_type3
void(* 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)
Definition ojph_colour.cpp:63
ojph::local::wasm_irv_convert_to_float
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)
Definition ojph_colour_wasm.cpp:433
ojph::local::rev_convert
void(* 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)
Definition ojph_colour.cpp:57
ojph::local::sse_ict_backward
void sse_ict_backward(const float *y, const float *cb, const float *cr, float *r, float *g, float *b, ui32 repeat)
ojph::local::gen_irv_convert_to_integer_nlt_type3
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)
Definition ojph_colour.cpp:359
ojph::local::gen_irv_convert_to_float_nlt_type3
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)
Definition ojph_colour.cpp:415
ojph::local::local_gen_irv_convert_to_float
static void local_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)
Definition ojph_colour.cpp:370
ojph::local::sse2_irv_convert_to_float
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)
ojph
Definition ojph_img_io.h:52
ojph::si64
int64_t si64
Definition ojph_defs.h:57
ojph::ojph_round
static si32 ojph_round(float val)
Definition ojph_arch.h:259
ojph::get_cpu_ext_level
OJPH_EXPORT int get_cpu_ext_level()
Definition ojph_arch.cpp:260
ojph::si32
int32_t si32
Definition ojph_defs.h:55
ojph::ui32
uint32_t ui32
Definition ojph_defs.h:54
ojph::X86_CPU_EXT_LEVEL_AVX2
@ X86_CPU_EXT_LEVEL_AVX2
Definition ojph_arch.h:142
ojph::X86_CPU_EXT_LEVEL_AVX
@ X86_CPU_EXT_LEVEL_AVX
Definition ojph_arch.h:141
ojph::X86_CPU_EXT_LEVEL_SSE2
@ X86_CPU_EXT_LEVEL_SSE2
Definition ojph_arch.h:136
ojph::X86_CPU_EXT_LEVEL_SSE
@ X86_CPU_EXT_LEVEL_SSE
Definition ojph_arch.h:135
ojph_arch.h
ojph_colour.h
ojph_colour_local.h
ojph_defs.h
ojph_mem.h
ojph::local::CT_CNST::GAMMA_CR2R
static const float GAMMA_CR2R
Definition ojph_colour_local.h:53
ojph::local::CT_CNST::BETA_CbF
static const float BETA_CbF
Definition ojph_colour_local.h:51
ojph::local::CT_CNST::GAMMA_CB2B
static const float GAMMA_CB2B
Definition ojph_colour_local.h:54
ojph::local::CT_CNST::ALPHA_RF
static const float ALPHA_RF
Definition ojph_colour_local.h:48
ojph::local::CT_CNST::GAMMA_CB2G
static const float GAMMA_CB2G
Definition ojph_colour_local.h:56
ojph::local::CT_CNST::GAMMA_CR2G
static const float GAMMA_CR2G
Definition ojph_colour_local.h:55
ojph::local::CT_CNST::ALPHA_BF
static const float ALPHA_BF
Definition ojph_colour_local.h:50
ojph::local::CT_CNST::BETA_CrF
static const float BETA_CrF
Definition ojph_colour_local.h:52
ojph::local::CT_CNST::ALPHA_GF
static const float ALPHA_GF
Definition ojph_colour_local.h:49