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