32 in_t in1(bitmap1), in2(bitmap2);
34 for (
int y = roi1.
a.
y;
y < roi1.
b.
y; ++
y) {
35 in1.goTo(roi1.
a.
x,
y);
36 in2.goTo(roi2.
a.
x, roi2.
a.
y +
y - roi1.
a.
y);
37 for (
int x = roi2.
a.
x;
x < roi2.
b.
x; ++
x, in1++, in2++) {
38 const auto diff = in1() - in2();
39 result += diff.abs().makeFloat().sum();
53 in_t in1(bitmap1), in2(bitmap2);
55 for (
int y = roi1.
a.
y;
y < roi1.
b.
y; ++
y) {
56 in1.goTo(roi1.
a.
x,
y);
57 in2.goTo(roi2.
a.
x, roi2.
a.
y +
y - roi1.
a.
y);
58 for (
int x = roi2.
a.
x;
x < roi2.
b.
x; ++
x, in1++, in2++) {
59 const auto diff = (in1() - in2()).makeFloat();
60 result += (diff * diff).sum();
145 return 20 * std::log10(std::sqrt((
double)
n) / metric.
getResult());
A very basic class for any image.
const unsigned char getNumberOfChannels() const
Returns number of bytes per pixel stored in each bitmap.
Context & getContext() const
const ImageResolution getSize() const
Returns the bitmap resolution within ImageResolution object.
void unlock(AbstractBitmap *bitmap)
Drops a lock to the bitmap.
void readLock(GraphicPipeline *gpu, AbstractBitmap *bitmap, ProcessingTarget target)
Locks content of a bitmap for reading using a specific processing target device.
float performTask(AbstractTask &task, const PoolIndex pool=DEFAULT_POOL)
Performs a given task.
CustomRectangle< numeric > split(const int part, const int totalParts)
Internal low-level GPU control API.
IntRectangle halfOpenedRectangle() const
Measures the difference between two bitmaps.
static float psnr(AbstractBitmap &bitmap1, AbstractBitmap &bitmap2)
bool process(TaskThread &thread)
Executes the task on CPU within a given thread.
void afterProcessing(ThreadIndex threadCount, GraphicPipeline *gpu, bool aborted)
Instruction called after the task is executed.
void setNorm(Norm norm)
Specifies the norm to use in the measurement.
void setBitmaps(AbstractBitmap *bitmap1, AbstractBitmap *bitmap2)
Sets input images.
AbstractBitmap * bitmap[2]
std::vector< double > results
void beforeProcessing(ThreadIndex threadCount, ProcessingTarget target, GraphicPipeline *gpu)
Instruction called before the task is executed.
Norm
Norm (distance) to measure between two images.
static void check(const bool condition, const std::string &message)
virtual ThreadIndex numThreads() const =0
ThreadIndex currentThread() const
static void process(AbstractBitmap &bitmap1, AbstractBitmap &bitmap2, const IntRectangle &roi1, const IntRectangle &roi2, double &result)
static void process(AbstractBitmap &bitmap1, AbstractBitmap &bitmap2, const IntRectangle &roi1, const IntRectangle &roi2, double &result)
unsigned char ThreadIndex
number of threads / thread index
jobject jlong jint jint y
Beatmup::InternalBitmap * bitmap
return bitmap getPixelFormat()