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

#include <resampling_kernels.h>

Static Public Member Functions

static void process (AbstractBitmap &input, AbstractBitmap &output, IntRectangle &src, IntRectangle &dst, const TaskThread &tt)
 Resamples a rectangle from an input bitmap to a rectangle in an output bitmap by nearest neighbor interpolation. More...
 

Detailed Description

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

Definition at line 28 of file resampling_kernels.h.

Member Function Documentation

◆ process()

template<class in_t , class out_t >
static void Kernels::NearestNeighborResampling< in_t, out_t >::process ( AbstractBitmap input,
AbstractBitmap output,
IntRectangle src,
IntRectangle dst,
const TaskThread tt 
)
inlinestatic

Resamples a rectangle from an input bitmap to a rectangle in an output bitmap by nearest neighbor interpolation.

Definition at line 34 of file resampling_kernels.h.

34  {
35  in_t in(input);
36  out_t out(output);
37 
38  const int
39  srcW = src.width(), srcH = src.height(),
40  dstW = dst.width(), dstH = dst.height(),
41  shiftX = srcW / 2,
42  shiftY = srcH / 2;
43 
44  // dest image slice to process in the current thread
45  const int
46  sliceStart = tt.currentThread() * dstH / tt.numThreads(),
47  sliceStop = (tt.currentThread() + 1) * dstH / tt.numThreads();
48 
49  for (int y = sliceStart; y < sliceStop; ++y) {
50  out.goTo(dst.a.x, dst.a.y + y);
51  const int sy = src.a.y + (y * srcH + shiftY) / dstH;
52 
53  for (int x = 0; x < dstW; ++x) {
54  const int sx = src.a.x + (x * srcW + shiftX) / dstW;
55  in.goTo(sx, sy);
56  out = in();
57  out++;
58  }
59 
60  if (tt.isTaskAborted())
61  return;
62  }
63  }
numeric height() const
Definition: geometry.h:178
numeric width() const
Definition: geometry.h:174
CustomPoint< numeric > a
Definition: geometry.h:131
virtual ThreadIndex numThreads() const =0
ThreadIndex currentThread() const
Definition: parallelism.h:165
virtual bool isTaskAborted() const =0
Returns true if the task is asked to stop from outside.
jobject jlong jint jint y
jobject jlong jint x
JNIEnv jlong jint out
return(jlong) new Beatmup jlong jstring src

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