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
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
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
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
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
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
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
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
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
100 (const float *r, const float *g, const float *b,
101 float *y, float *cb, float *cr, ui32 repeat) = NULL;
102
105 (const float *y, const float *cb, const float *cr,
106 float *r, float *g, float *b, ui32 repeat) = NULL;
107
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
125
126 #ifndef OJPH_DISABLE_SIMD
127
128 #if (defined(OJPH_ARCH_X86_64) || defined(OJPH_ARCH_I386))
129
130 #ifndef OJPH_DISABLE_SSE
132 {
135 }
136 #endif // !OJPH_DISABLE_SSE
137
138 #ifndef OJPH_DISABLE_SSE2
140 {
151 }
152 #endif // !OJPH_DISABLE_SSE2
153
154 #ifndef OJPH_DISABLE_AVX
156 {
159 }
160 #endif // !OJPH_DISABLE_AVX
161
162 #ifndef OJPH_DISABLE_AVX2
164 {
175 }
176 #endif // !OJPH_DISABLE_AVX2
177
178 #elif defined(OJPH_ARCH_ARM)
179
180 #elif defined(OJPH_ARCH_PPC64LE)
181
183 {
184 // 128-bit VSX kernels; see ojph_simd_vsx.h
197 }
198
199 #endif // !(defined(OJPH_ARCH_X86_64) || defined(OJPH_ARCH_I386))
200
201 #endif // !OJPH_DISABLE_SIMD
202
203#else // OJPH_ENABLE_WASM_SIMD
204
215
216#endif // !OJPH_ENABLE_WASM_SIMD
217 });
218 }
219
221 const float CT_CNST::ALPHA_RF = 0.299f;
222 const float CT_CNST::ALPHA_GF = 0.587f;
223 const float CT_CNST::ALPHA_BF = 0.114f;
224 const float CT_CNST::BETA_CbF = float(0.5/(1-double(CT_CNST::ALPHA_BF)));
225 const float CT_CNST::BETA_CrF = float(0.5/(1-double(CT_CNST::ALPHA_RF)));
226 const float CT_CNST::GAMMA_CB2G =
227 float(2.0*double(ALPHA_BF)*(1.0-double(ALPHA_BF))/double(ALPHA_GF));
228 const float CT_CNST::GAMMA_CR2G =
229 float(2.0*double(ALPHA_RF)*(1.0-double(ALPHA_RF))/double(ALPHA_GF));
230 const float CT_CNST::GAMMA_CB2B = float(2.0 * (1.0 - double(ALPHA_BF)));
231 const float CT_CNST::GAMMA_CR2R = float(2.0 * (1.0 - double(ALPHA_RF)));
232
234
235#if !defined(OJPH_ENABLE_WASM_SIMD) || !defined(OJPH_EMSCRIPTEN)
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 {
243 if (src_line->flags & line_buf::LFT_32BIT)
244 {
245 if (dst_line->flags & line_buf::LFT_32BIT)
246 {
247 const si32 *sp = src_line->i32 + src_line_offset;
248 si32 *dp = dst_line->i32 + dst_line_offset;
249 si32 s = (si32)shift;
250 for (ui32 i = width; i > 0; --i)
251 *dp++ = *sp++ + s;
252 }
253 else
254 {
255 const si32 *sp = src_line->i32 + src_line_offset;
256 si64 *dp = dst_line->i64 + dst_line_offset;
257 for (ui32 i = width; i > 0; --i)
258 *dp++ = *sp++ + shift;
259 }
260 }
261 else
262 {
263 assert(src_line->flags & line_buf::LFT_64BIT);
264 assert(dst_line->flags & line_buf::LFT_32BIT);
265 const si64 *sp = src_line->i64 + src_line_offset;
266 si32 *dp = dst_line->i32 + dst_line_offset;
267 for (ui32 i = width; i > 0; --i)
268 *dp++ = (si32)(*sp++ + shift);
269 }
270 }
271
274 const line_buf *src_line, const ui32 src_line_offset,
275 line_buf *dst_line, const ui32 dst_line_offset,
276 si64 shift, ui32 width)
277 {
278 if (src_line->flags & line_buf::LFT_32BIT)
279 {
280 if (dst_line->flags & line_buf::LFT_32BIT)
281 {
282 const si32 *sp = src_line->i32 + src_line_offset;
283 si32 *dp = dst_line->i32 + dst_line_offset;
284 si32 s = (si32)shift;
285 for (ui32 i = width; i > 0; --i) {
286 const si32 v = *sp++;
287 *dp++ = v >= 0 ? v : (- v - s);
288 }
289 }
290 else
291 {
292 const si32 *sp = src_line->i32 + src_line_offset;
293 si64 *dp = dst_line->i64 + dst_line_offset;
294 for (ui32 i = width; i > 0; --i) {
295 const si64 v = *sp++;
296 *dp++ = v >= 0 ? v : (- v - shift);
297 }
298 }
299 }
300 else
301 {
302 assert(src_line->flags & line_buf::LFT_64BIT);
303 assert(dst_line->flags & line_buf::LFT_32BIT);
304 const si64 *sp = src_line->i64 + src_line_offset;
305 si32 *dp = dst_line->i32 + dst_line_offset;
306 for (ui32 i = width; i > 0; --i) {
307 const si64 v = *sp++;
308 *dp++ = (si32)(v >= 0 ? v : (- v - shift));
309 }
310 }
311 }
312
313
315 template<bool NLT_TYPE3>
316 static inline
318 line_buf *dst_line, ui32 dst_line_offset,
319 ui32 bit_depth, bool is_signed, ui32 width)
320 {
321 assert((src_line->flags & line_buf::LFT_32BIT) &&
322 (src_line->flags & line_buf::LFT_INTEGER) == 0 &&
323 (dst_line->flags & line_buf::LFT_32BIT) &&
324 (dst_line->flags & line_buf::LFT_INTEGER));
325
326 assert(bit_depth <= 32);
327 const float* sp = src_line->f32;
328 si32* dp = dst_line->i32 + dst_line_offset;
329 // There is the possibility that converting to integer will
330 // exceed the dynamic range of 32bit integer; therefore, care must be
331 // exercised.
332 // We look if the floating point number is outside the half-closed
333 // interval [-0.5f, 0.5f). If so, we limit the resulting integer
334 // to the maximum/minimum that number supports.
335 si32 neg_limit = (si32)INT_MIN >> (32 - bit_depth);
336 float mul = (float)(1ull << bit_depth);
337 float fl_up_lim = -(float)neg_limit; // val < upper
338 float fl_low_lim = (float)neg_limit; // val >= lower
339 si32 s32_up_lim = INT_MAX >> (32 - bit_depth);
340 si32 s32_low_lim = INT_MIN >> (32 - bit_depth);
341
342 if (is_signed)
343 {
344 const si32 bias = (si32)((1ULL << (bit_depth - 1)) + 1);
345 for (int i = (int)width; i > 0; --i) {
346 float t = *sp++ * mul;
347 si32 v = ojph_round(t);
348 v = t >= fl_low_lim ? v : s32_low_lim;
349 v = t < fl_up_lim ? v : s32_up_lim;
350 if (NLT_TYPE3)
351 v = (v >= 0) ? v : (- v - bias);
352 *dp++ = v;
353 }
354 }
355 else
356 {
357 const si32 half = (si32)(1ULL << (bit_depth - 1));
358 for (int i = (int)width; i > 0; --i) {
359 float t = *sp++ * mul;
360 si32 v = ojph_round(t);
361 v = t >= fl_low_lim ? v : s32_low_lim;
362 v = t < fl_up_lim ? v : s32_up_lim;
363 *dp++ = v + half;
364 }
365 }
366 }
367
370 line_buf *dst_line, ui32 dst_line_offset,
371 ui32 bit_depth, bool is_signed, ui32 width)
372 {
374 dst_line_offset, bit_depth, is_signed, width);
375 }
376
379 line_buf *dst_line, ui32 dst_line_offset,
380 ui32 bit_depth, bool is_signed, ui32 width)
381 {
383 dst_line_offset, bit_depth, is_signed, width);
384 }
385
387 template<bool NLT_TYPE3>
388 static inline
390 ui32 src_line_offset, line_buf *dst_line,
391 ui32 bit_depth, bool is_signed, ui32 width)
392 {
393 assert((src_line->flags & line_buf::LFT_32BIT) &&
394 (src_line->flags & line_buf::LFT_INTEGER) &&
395 (dst_line->flags & line_buf::LFT_32BIT) &&
396 (dst_line->flags & line_buf::LFT_INTEGER) == 0);
397
398 assert(bit_depth <= 32);
399 float mul = (float)(1.0 / (double)(1ULL << bit_depth));
400
401 const si32* sp = src_line->i32 + src_line_offset;
402 float* dp = dst_line->f32;
403 if (is_signed)
404 {
405 const si32 bias = (si32)((1ULL << (bit_depth - 1)) + 1);
406 for (int i = (int)width; i > 0; --i) {
407 si32 v = *sp++;
408 if (NLT_TYPE3)
409 v = (v >= 0) ? v : (- v - bias);
410 *dp++ = (float)v * mul;
411 }
412 }
413 else
414 {
415 const si32 half = (si32)(1ULL << (bit_depth - 1));
416 for (int i = (int)width; i > 0; --i) {
417 si32 v = *sp++;
418 v -= half;
419 *dp++ = (float)v * mul;
420 }
421 }
422 }
423
425 void gen_irv_convert_to_float(const line_buf *src_line,
426 ui32 src_line_offset, line_buf *dst_line,
427 ui32 bit_depth, bool is_signed, ui32 width)
428 {
429 local_gen_irv_convert_to_float<false>(src_line, src_line_offset,
430 dst_line, bit_depth, is_signed, width);
431 }
432
435 ui32 src_line_offset, line_buf *dst_line,
436 ui32 bit_depth, bool is_signed, ui32 width)
437 {
438 local_gen_irv_convert_to_float<true>(src_line, src_line_offset,
439 dst_line, bit_depth, is_signed, width);
440 }
441
444 const line_buf *r, const line_buf *g, const line_buf *b,
445 line_buf *y, line_buf *cb, line_buf *cr, ui32 repeat)
446 {
447 assert((y->flags & line_buf::LFT_INTEGER) &&
453
454 if (y->flags & line_buf::LFT_32BIT)
455 {
456 assert((y->flags & line_buf::LFT_32BIT) &&
457 (cb->flags & line_buf::LFT_32BIT) &&
458 (cr->flags & line_buf::LFT_32BIT) &&
459 (r->flags & line_buf::LFT_32BIT) &&
460 (g->flags & line_buf::LFT_32BIT) &&
462 const si32 *rp = r->i32, * gp = g->i32, * bp = b->i32;
463 si32 *yp = y->i32, * cbp = cb->i32, * crp = cr->i32;
464 for (ui32 i = repeat; i > 0; --i)
465 {
466 si32 rr = *rp++, gg = *gp++, bb = *bp++;
467 *yp++ = (rr + (gg << 1) + bb) >> 2;
468 *cbp++ = (bb - gg);
469 *crp++ = (rr - gg);
470 }
471 }
472 else
473 {
474 assert((y->flags & line_buf::LFT_64BIT) &&
475 (cb->flags & line_buf::LFT_64BIT) &&
476 (cr->flags & line_buf::LFT_64BIT) &&
477 (r->flags & line_buf::LFT_32BIT) &&
478 (g->flags & line_buf::LFT_32BIT) &&
480 const si32 *rp = r->i32, *gp = g->i32, *bp = b->i32;
481 si64 *yp = y->i64, *cbp = cb->i64, *crp = cr->i64;
482 for (ui32 i = repeat; i > 0; --i)
483 {
484 si64 rr = *rp++, gg = *gp++, bb = *bp++;
485 *yp++ = (rr + (gg << 1) + bb) >> 2;
486 *cbp++ = (bb - gg);
487 *crp++ = (rr - gg);
488 }
489 }
490 }
491
494 const line_buf *y, const line_buf *cb, const line_buf *cr,
495 line_buf *r, line_buf *g, line_buf *b, ui32 repeat)
496 {
497 assert((y->flags & line_buf::LFT_INTEGER) &&
503
504 if (y->flags & line_buf::LFT_32BIT)
505 {
506 assert((y->flags & line_buf::LFT_32BIT) &&
507 (cb->flags & line_buf::LFT_32BIT) &&
508 (cr->flags & line_buf::LFT_32BIT) &&
509 (r->flags & line_buf::LFT_32BIT) &&
510 (g->flags & line_buf::LFT_32BIT) &&
512 const si32 *yp = y->i32, *cbp = cb->i32, *crp = cr->i32;
513 si32 *rp = r->i32, *gp = g->i32, *bp = b->i32;
514 for (ui32 i = repeat; i > 0; --i)
515 {
516 si32 yy = *yp++, cbb = *cbp++, crr = *crp++;
517 si32 gg = yy - ((cbb + crr) >> 2);
518 *rp++ = crr + gg;
519 *gp++ = gg;
520 *bp++ = cbb + gg;
521 }
522 }
523 else
524 {
525 assert((y->flags & line_buf::LFT_64BIT) &&
526 (cb->flags & line_buf::LFT_64BIT) &&
527 (cr->flags & line_buf::LFT_64BIT) &&
528 (r->flags & line_buf::LFT_32BIT) &&
529 (g->flags & line_buf::LFT_32BIT) &&
531 const si64 *yp = y->i64, *cbp = cb->i64, *crp = cr->i64;
532 si32 *rp = r->i32, *gp = g->i32, *bp = b->i32;
533 for (ui32 i = repeat; i > 0; --i)
534 {
535 si64 yy = *yp++, cbb = *cbp++, crr = *crp++;
536 si64 gg = yy - ((cbb + crr) >> 2);
537 *rp++ = (si32)(crr + gg);
538 *gp++ = (si32)gg;
539 *bp++ = (si32)(cbb + gg);
540 }
541 }
542 }
543
545 void gen_ict_forward(const float *r, const float *g, const float *b,
546 float *y, float *cb, float *cr, ui32 repeat)
547 {
548 for (ui32 i = repeat; i > 0; --i)
549 {
550 *y = CT_CNST::ALPHA_RF * *r
551 + CT_CNST::ALPHA_GF * *g++
552 + CT_CNST::ALPHA_BF * *b;
553 *cb++ = CT_CNST::BETA_CbF * (*b++ - *y);
554 *cr++ = CT_CNST::BETA_CrF * (*r++ - *y++);
555 }
556 }
557
559 void gen_ict_backward(const float *y, const float *cb, const float *cr,
560 float *r, float *g, float *b, ui32 repeat)
561 {
562 for (ui32 i = repeat; i > 0; --i)
563 {
564 *g++ = *y - CT_CNST::GAMMA_CR2G * *cr - CT_CNST::GAMMA_CB2G * *cb;
565 *r++ = *y + CT_CNST::GAMMA_CR2R * *cr++;
566 *b++ = *y++ + CT_CNST::GAMMA_CB2B * *cb++;
567 }
568 }
569
570#endif // !OJPH_ENABLE_WASM_SIMD
571
572 }
573}
float * f32
Definition ojph_mem.h:187
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(* 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_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(* ict_forward)(const float *r, const float *g, const float *b, float *y, float *cb, float *cr, ui32 repeat)
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(* 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(* 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 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(* ict_backward)(const float *y, const float *cb, const float *cr, float *r, float *g, float *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_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 init_colour_transform_functions()
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(* 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)
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(* 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_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)
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)
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_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 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(* 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 avx_ict_backward(const float *y, const float *cb, const float *cr, float *r, float *g, float *b, ui32 repeat)
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(* 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(const line_buf *src_line, ui32 src_line_offset, line_buf *dst_line, ui32 bit_depth, bool is_signed, ui32 width)
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)
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)
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)
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
static si32 ojph_round(float val)
Definition ojph_arch.h:317
@ PPC_CPU_EXT_LEVEL_ARCH_3_00
Definition ojph_arch.h:180
OJPH_EXPORT int get_cpu_ext_level()
int32_t si32
Definition ojph_defs.h:55
uint32_t ui32
Definition ojph_defs.h:54
@ X86_CPU_EXT_LEVEL_AVX2
Definition ojph_arch.h:163
@ X86_CPU_EXT_LEVEL_AVX
Definition ojph_arch.h:162
@ X86_CPU_EXT_LEVEL_SSE2
Definition ojph_arch.h:157
@ X86_CPU_EXT_LEVEL_SSE
Definition ojph_arch.h:156
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