Beatmup
Kernels::ApplyColorMatrix< in_t, out_t > Class Template Reference

Application of a Color::Matrix on CPU. More...

Static Public Member Functions

static void process (AbstractBitmap &input, AbstractBitmap &output, int x, int y, const pixfloat4 &biasF, const Color::Matrix &matrixF, bool useIntApprox, msize nPix)
 

Detailed Description

template<class in_t, class out_t>
class Kernels::ApplyColorMatrix< in_t, out_t >

Application of a Color::Matrix on CPU.

Definition at line 36 of file color_matrix.cpp.

Member Function Documentation

◆ process()

template<class in_t , class out_t >
static void Kernels::ApplyColorMatrix< in_t, out_t >::process ( AbstractBitmap input,
AbstractBitmap output,
int  x,
int  y,
const pixfloat4 biasF,
const Color::Matrix matrixF,
bool  useIntApprox,
msize  nPix 
)
inlinestatic

Definition at line 38 of file color_matrix.cpp.

38  {
39  in_t in(input, x, y);
40  out_t out(output, x, y);
41 
42  if (useIntApprox) {
43  pixint4 matrixI[4], biasI;
44  biasI = biasF;
45  for (int i = 0; i < 4; i++)
46  matrixI[i] = matrixF[i];
47  for (msize n = 0; n < nPix; n++) {
48  out.assign(
49  (in() * matrixI[CHANNELS_4.R]).sum() + biasI.val[CHANNELS_4.R],
50  (in() * matrixI[CHANNELS_4.G]).sum() + biasI.val[CHANNELS_4.G],
51  (in() * matrixI[CHANNELS_4.B]).sum() + biasI.val[CHANNELS_4.B],
52  (in() * matrixI[CHANNELS_4.A]).sum() + biasI.val[CHANNELS_4.A]
53  );
54  in++;
55  out++;
56  }
57  }
58  else
59  for (msize n = 0; n < nPix; n++) {
60  out.assign(
61  (in() * matrixF[CHANNELS_4.R]).sum() + biasF[CHANNELS_4.R],
62  (in() * matrixF[CHANNELS_4.G]).sum() + biasF[CHANNELS_4.G],
63  (in() * matrixF[CHANNELS_4.B]).sum() + biasF[CHANNELS_4.B],
64  (in() * matrixF[CHANNELS_4.A]).sum() + biasF[CHANNELS_4.A]
65  );
66  in++;
67  out++;
68  }
69  }
uint32_t msize
memory size
Definition: basic_types.h:30
static const struct Beatmup::@1 CHANNELS_4
4-channel integer arithmetic
jobject jlong jint jint y
jobject jlong jint x
JNIEnv jlong jint out
int n

The documentation for this class was generated from the following file: