App

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
app::TCubicFInt< TPIXEL, TCHANNEL > Class Template Reference

Celekm slušně funguje, pouze reindexovaná část je strašně neefektivní, ale jedná se jen o okrajovou část obrazu - 1.5 px rám. More...

`#include <TCubicFInt.hpp>`

Inheritance diagram for app::TCubicFInt< TPIXEL, TCHANNEL >:

## Public Member Functions
| TCubicFInt (const TBitmap< TPIXEL, TCHANNEL > &over)
virtual int | isInitOk () const
virtual TPIXEL * | getSrcData () const
virtual unsigned | getSrcWidth () const
virtual unsigned | getSrcHeight () const
virtual | ~TCubicFInt ()
TPIXEL | getAt (double x, double y)
virtual int | resampleTo (TBitmap< TPIXEL, TCHANNEL > &dst) const
virtual int | resampleTo_aliased (TBitmap< TPIXEL, TCHANNEL > &dst, double force=1) const

## Static Public Attributes
static const unsigned | chCount = sizeof(TPIXEL) / sizeof(TCHANNEL)
| Počet kanálů bitmapy.
static const TCHANNEL | maxVal = ~0
| Maximální hodnota kanálu.

## Protected Member Functions
TPIXEL | getAt_4ch (double x, double y)
TPIXEL | getAt_1ch (double x, double y)
virtual int | resampleTo_4ch (TBitmap< TPIXEL, TCHANNEL > &dst) const
| Převzorkuje data interpolátoru do cílové bitmapy.
virtual int | resampleTo_1ch (TBitmap< TPIXEL, TCHANNEL > &dst) const
| Převzorkuje data interpolátoru do cílové bitmapy.
virtual TFInterpolator< TPIXEL, TCHANNEL > * | newInstance (const TBitmap< TPIXEL, TCHANNEL > &over) const

## Protected Attributes
TPIXEL * | srcData
unsigned | srcWidth
unsigned | srcHeight
int | offset
int * | xReindex
int * | yReindex
double | xNoReindexFrom
double | xNoReindexTo
double | yNoReindexFrom
double | yNoReindexTo

## Detailed Description

### template<typename TPIXEL, typename TCHANNEL>
class app::TCubicFInt< TPIXEL, TCHANNEL >

Celekm slušně funguje, pouze reindexovaná část je strašně neefektivní, ale jedná se jen o okrajovou část obrazu - 1.5 px rám.

Definition at line 30 of file TCubicFInt.hpp.

## Constructor & Destructor Documentation

template<typename TPIXEL, typename TCHANNEL>

app::TCubicFInt< TPIXEL, TCHANNEL >::TCubicFInt | ( | const TBitmap< TPIXEL, TCHANNEL > & | over | ) |
| inline

Definition at line 437 of file TCubicFInt.hpp.

{
srcData = over.getData();
srcWidth = over.getWidth();
srcHeight = over.getHeight();
xNoReindexFrom = 1.5;
xNoReindexTo = srcWidth - 1.5;
yNoReindexFrom = 1.5;
yNoReindexTo = srcHeight - 1.5;
offset = (srcWidth) * (sizeof(TPIXEL) / sizeof(TCHANNEL));
int * ptr;
int * ptrEnd;
int i;
xReindex = (int *) malloc((unsigned long int) ((srcWidth + 4) * sizeof(int)));
ptr = xReindex;
ptrEnd = xReindex + srcWidth + 2;
*ptr = 0;
ptr++;
*ptr = 0;
ptr++;
i = 0;
while (ptr < ptrEnd) {
*ptr = i++;
ptr++;
}
*ptr = srcWidth - 1;
ptr++;
*ptr = srcWidth - 1;
yReindex = (int *) malloc((unsigned long int) ((srcHeight + 4) * sizeof(int)));
ptr = yReindex;
ptrEnd = yReindex + srcHeight + 2;
*ptr = 0;
ptr++;
*ptr = 0;
ptr++;
i = 0;
while (ptr < ptrEnd) {
*ptr = i++;
ptr++;
}
*ptr = srcHeight - 1;
ptr++;
*ptr = srcHeight - 1;
}
template<typename TPIXEL , typename TCHANNEL >

TCubicFInt< TPIXEL, TCHANNEL >::~TCubicFInt | ( |  | ) |
| virtual

Definition at line 59 of file TCubicFInt.cpp.

{
if (xReindex != NULL) {
free(xReindex);
}
if (yReindex != NULL) {
free(yReindex);
}
}

## Member Function Documentation

template<typename TPIXEL, typename TCHANNEL>

TPIXEL app::TCubicFInt< TPIXEL, TCHANNEL >::getAt | ( | double | x,
|  | double | y
| ) |  |
| inline

Definition at line 506 of file TCubicFInt.hpp.

{
if (x <= 0 || y <= 0 || x >= srcWidth || y >= srcHeight) {
return 0;
} else if (chCount == 4) {
return getAt_4ch(x, y);
} else if (chCount == 1) {
return getAt_1ch(x, y);
} else {
return 0; // Jen kvůli warningu
}
}
template<typename TPIXEL, typename TCHANNEL>

TPIXEL app::TCubicFInt< TPIXEL, TCHANNEL >::getAt_1ch | ( | double | x,
|  | double | y
| ) |  |
| inlineprotected

Definition at line 308 of file TCubicFInt.hpp.

{
if (x > xNoReindexFrom && y > yNoReindexFrom && x < xNoReindexTo && y < yNoReindexTo) {
x -= 1.5;
y -= 1.5;
int X = x;
x -= X;
int Y = y;
y -= Y;
TPIXEL retVal = 0;
TPIXEL * sPtr = (srcData + (Y) * srcWidth + (X));
TPIXEL p0, p1, p2, p3;
double tp0, tp1, tp2, tp3;
double clamp;
p0 = *sPtr;
p1 = *(sPtr + 1);
p2 = *(sPtr + 2);
p3 = *(sPtr + 3);
sPtr += offset;
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp0);
p0 = *sPtr;
p1 = *(sPtr + 1);
p2 = *(sPtr + 2);
p3 = *(sPtr + 3);
sPtr += offset;
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp1);
p0 = *sPtr;
p1 = *(sPtr + 1);
p2 = *(sPtr + 2);
p3 = *(sPtr + 3);
sPtr += offset;
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp2);
p0 = *sPtr;
p1 = *(sPtr + 1);
p2 = *(sPtr + 2);
p3 = *(sPtr + 3);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp3);
INTERPOLATE_CUBIC(tp0, tp1, tp2, tp3, y, clamp);
retVal = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp;
return retVal;
} else {
x += 1.5;
y += 1.5;
int X = x;
x -= X;
int Y = y;
y -= Y;
TPIXEL retVal = 0;
TPIXEL p0, p1, p2, p3;
TPIXEL * p00 = (srcData + yReindex[Y - 1] * srcWidth + xReindex[X - 1]);
TPIXEL * p01 = (srcData + yReindex[Y] * srcWidth + xReindex[X - 1]);
TPIXEL * p02 = (srcData + yReindex[Y + 1] * srcWidth + xReindex[X - 1]);
TPIXEL * p03 = (srcData + yReindex[Y + 2] * srcWidth + xReindex[X - 1]);
TPIXEL * p10 = (srcData + yReindex[Y - 1] * srcWidth + xReindex[X]);
TPIXEL * p11 = (srcData + yReindex[Y] * srcWidth + xReindex[X]);
TPIXEL * p12 = (srcData + yReindex[Y + 1] * srcWidth + xReindex[X]);
TPIXEL * p13 = (srcData + yReindex[Y + 2] * srcWidth + xReindex[X]);
TPIXEL * p20 = (srcData + yReindex[Y - 1] * srcWidth + xReindex[X + 1]);
TPIXEL * p21 = (srcData + yReindex[Y] * srcWidth + xReindex[X + 1]);
TPIXEL * p22 = (srcData + yReindex[Y + 1] * srcWidth + xReindex[X + 1]);
TPIXEL * p23 = (srcData + yReindex[Y + 2] * srcWidth + xReindex[X + 1]);
TPIXEL * p30 = (srcData + yReindex[Y - 1] * srcWidth + xReindex[X + 2]);
TPIXEL * p31 = (srcData + yReindex[Y] * srcWidth + xReindex[X + 2]);
TPIXEL * p32 = (srcData + yReindex[Y + 1] * srcWidth + xReindex[X + 2]);
TPIXEL * p33 = (srcData + yReindex[Y + 2] * srcWidth + xReindex[X + 2]);
double tp0, tp1, tp2, tp3;
double clamp;
p0 = *(p00);
p1 = *(p01);
p2 = *(p02);
p3 = *(p03);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp0);
p0 = *(p10);
p1 = *(p11);
p2 = *(p12);
p3 = *(p13);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp1);
p0 = *(p20);
p1 = *(p21);
p2 = *(p22);
p3 = *(p23);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp2);
p0 = *(p30);
p1 = *(p31);
p2 = *(p32);
p3 = *(p33);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp3);
INTERPOLATE_CUBIC(tp0, tp1, tp2, tp3, y, clamp);
retVal = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp;
return retVal;
}
}
template<typename TPIXEL, typename TCHANNEL>

TPIXEL app::TCubicFInt< TPIXEL, TCHANNEL >::getAt_4ch | ( | double | x,
|  | double | y
| ) |  |
| inlineprotected

Definition at line 44 of file TCubicFInt.hpp.

{
if (x > xNoReindexFrom && y > yNoReindexFrom && x < xNoReindexTo && y < yNoReindexTo) {
x -= 1.5;
y -= 1.5;
int X = x;
x -= X;
int Y = y;
y -= Y;
TPIXEL retVal = 0;
TCHANNEL * ptr = (TCHANNEL *) &retVal;
TCHANNEL * sBgn = (TCHANNEL *) (srcData + (Y) * srcWidth + (X));
TCHANNEL * sPtr;
TCHANNEL p0, p1, p2, p3;
double tp0, tp1, tp2, tp3;
double clamp;
sPtr = sBgn++;
p0 = *sPtr;
p1 = *(sPtr + 4);
p2 = *(sPtr + 8);
p3 = *(sPtr + 12);
sPtr += offset;
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp0);
p0 = *sPtr;
p1 = *(sPtr + 4);
p2 = *(sPtr + 8);
p3 = *(sPtr + 12);
sPtr += offset;
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp1);
p0 = *sPtr;
p1 = *(sPtr + 4);
p2 = *(sPtr + 8);
p3 = *(sPtr + 12);
sPtr += offset;
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp2);
p0 = *sPtr;
p1 = *(sPtr + 4);
p2 = *(sPtr + 8);
p3 = *(sPtr + 12);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp3);
INTERPOLATE_CUBIC(tp0, tp1, tp2, tp3, y, clamp);
*ptr = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp;
ptr++;
sPtr = sBgn++;
p0 = *sPtr;
p1 = *(sPtr + 4);
p2 = *(sPtr + 8);
p3 = *(sPtr + 12);
sPtr += offset;
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp0);
p0 = *sPtr;
p1 = *(sPtr + 4);
p2 = *(sPtr + 8);
p3 = *(sPtr + 12);
sPtr += offset;
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp1);
p0 = *sPtr;
p1 = *(sPtr + 4);
p2 = *(sPtr + 8);
p3 = *(sPtr + 12);
sPtr += offset;
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp2);
p0 = *sPtr;
p1 = *(sPtr + 4);
p2 = *(sPtr + 8);
p3 = *(sPtr + 12);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp3);
INTERPOLATE_CUBIC(tp0, tp1, tp2, tp3, y, clamp);
*ptr = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp;
ptr++;
sPtr = sBgn++;
p0 = *sPtr;
p1 = *(sPtr + 4);
p2 = *(sPtr + 8);
p3 = *(sPtr + 12);
sPtr += offset;
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp0);
p0 = *sPtr;
p1 = *(sPtr + 4);
p2 = *(sPtr + 8);
p3 = *(sPtr + 12);
sPtr += offset;
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp1);
p0 = *sPtr;
p1 = *(sPtr + 4);
p2 = *(sPtr + 8);
p3 = *(sPtr + 12);
sPtr += offset;
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp2);
p0 = *sPtr;
p1 = *(sPtr + 4);
p2 = *(sPtr + 8);
p3 = *(sPtr + 12);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp3);
INTERPOLATE_CUBIC(tp0, tp1, tp2, tp3, y, clamp);
*ptr = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp;
ptr++;
sPtr = sBgn;
p0 = *sPtr;
p1 = *(sPtr + 4);
p2 = *(sPtr + 8);
p3 = *(sPtr + 12);
sPtr += offset;
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp0);
p0 = *sPtr;
p1 = *(sPtr + 4);
p2 = *(sPtr + 8);
p3 = *(sPtr + 12);
sPtr += offset;
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp1);
p0 = *sPtr;
p1 = *(sPtr + 4);
p2 = *(sPtr + 8);
p3 = *(sPtr + 12);
sPtr += offset;
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp2);
p0 = *sPtr;
p1 = *(sPtr + 4);
p2 = *(sPtr + 8);
p3 = *(sPtr + 12);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp3);
INTERPOLATE_CUBIC(tp0, tp1, tp2, tp3, y, clamp);
*ptr = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp;
return retVal;
} else {
x += 1.5;
y += 1.5;
int X = x;
x -= X;
int Y = y;
y -= Y;
TPIXEL retVal = 0;
TCHANNEL * ptr = (TCHANNEL *) &retVal;
TCHANNEL p0, p1, p2, p3;
TCHANNEL * p00 = (TCHANNEL *) (srcData + yReindex[Y - 1] * srcWidth + xReindex[X - 1]);
TCHANNEL * p01 = (TCHANNEL *) (srcData + yReindex[Y] * srcWidth + xReindex[X - 1]);
TCHANNEL * p02 = (TCHANNEL *) (srcData + yReindex[Y + 1] * srcWidth + xReindex[X - 1]);
TCHANNEL * p03 = (TCHANNEL *) (srcData + yReindex[Y + 2] * srcWidth + xReindex[X - 1]);
TCHANNEL * p10 = (TCHANNEL *) (srcData + yReindex[Y - 1] * srcWidth + xReindex[X]);
TCHANNEL * p11 = (TCHANNEL *) (srcData + yReindex[Y] * srcWidth + xReindex[X]);
TCHANNEL * p12 = (TCHANNEL *) (srcData + yReindex[Y + 1] * srcWidth + xReindex[X]);
TCHANNEL * p13 = (TCHANNEL *) (srcData + yReindex[Y + 2] * srcWidth + xReindex[X]);
TCHANNEL * p20 = (TCHANNEL *) (srcData + yReindex[Y - 1] * srcWidth + xReindex[X + 1]);
TCHANNEL * p21 = (TCHANNEL *) (srcData + yReindex[Y] * srcWidth + xReindex[X + 1]);
TCHANNEL * p22 = (TCHANNEL *) (srcData + yReindex[Y + 1] * srcWidth + xReindex[X + 1]);
TCHANNEL * p23 = (TCHANNEL *) (srcData + yReindex[Y + 2] * srcWidth + xReindex[X + 1]);
TCHANNEL * p30 = (TCHANNEL *) (srcData + yReindex[Y - 1] * srcWidth + xReindex[X + 2]);
TCHANNEL * p31 = (TCHANNEL *) (srcData + yReindex[Y] * srcWidth + xReindex[X + 2]);
TCHANNEL * p32 = (TCHANNEL *) (srcData + yReindex[Y + 1] * srcWidth + xReindex[X + 2]);
TCHANNEL * p33 = (TCHANNEL *) (srcData + yReindex[Y + 2] * srcWidth + xReindex[X + 2]);
double tp0, tp1, tp2, tp3;
double clamp;
p0 = *(p00++);
p1 = *(p01++);
p2 = *(p02++);
p3 = *(p03++);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp0);
p0 = *(p10++);
p1 = *(p11++);
p2 = *(p12++);
p3 = *(p13++);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp1);
p0 = *(p20++);
p1 = *(p21++);
p2 = *(p22++);
p3 = *(p23++);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp2);
p0 = *(p30++);
p1 = *(p31++);
p2 = *(p32++);
p3 = *(p33++);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp3);
INTERPOLATE_CUBIC(tp0, tp1, tp2, tp3, y, clamp);
*ptr = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp;
ptr++;
p0 = *(p00++);
p1 = *(p01++);
p2 = *(p02++);
p3 = *(p03++);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp0);
p0 = *(p10++);
p1 = *(p11++);
p2 = *(p12++);
p3 = *(p13++);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp1);
p0 = *(p20++);
p1 = *(p21++);
p2 = *(p22++);
p3 = *(p23++);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp2);
p0 = *(p30++);
p1 = *(p31++);
p2 = *(p32++);
p3 = *(p33++);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp3);
INTERPOLATE_CUBIC(tp0, tp1, tp2, tp3, y, clamp);
*ptr = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp;
ptr++;
p0 = *(p00++);
p1 = *(p01++);
p2 = *(p02++);
p3 = *(p03++);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp0);
p0 = *(p10++);
p1 = *(p11++);
p2 = *(p12++);
p3 = *(p13++);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp1);
p0 = *(p20++);
p1 = *(p21++);
p2 = *(p22++);
p3 = *(p23++);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp2);
p0 = *(p30++);
p1 = *(p31++);
p2 = *(p32++);
p3 = *(p33++);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp3);
INTERPOLATE_CUBIC(tp0, tp1, tp2, tp3, y, clamp);
*ptr = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp;
ptr++;
p0 = *(p00);
p1 = *(p01);
p2 = *(p02);
p3 = *(p03);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp0);
p0 = *(p10);
p1 = *(p11);
p2 = *(p12);
p3 = *(p13);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp1);
p0 = *(p20);
p1 = *(p21);
p2 = *(p22);
p3 = *(p23);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp2);
p0 = *(p30);
p1 = *(p31);
p2 = *(p32);
p3 = *(p33);
INTERPOLATE_CUBIC(p0, p1, p2, p3, x, tp3);
INTERPOLATE_CUBIC(tp0, tp1, tp2, tp3, y, clamp);
*ptr = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp;
return retVal;
}
}
template<typename TPIXEL, typename TCHANNEL>

virtual TPIXEL* app::TCubicFInt< TPIXEL, TCHANNEL >::getSrcData | ( |  | ) | const
| inlinevirtual

Implements app::TFInterpolator< TPIXEL, TCHANNEL >.

Definition at line 493 of file TCubicFInt.hpp.

{
return srcData;
}
template<typename TPIXEL, typename TCHANNEL>

virtual unsigned app::TCubicFInt< TPIXEL, TCHANNEL >::getSrcHeight | ( |  | ) | const
| inlinevirtual

Implements app::TFInterpolator< TPIXEL, TCHANNEL >.

Definition at line 500 of file TCubicFInt.hpp.

{
return srcHeight;
}
template<typename TPIXEL, typename TCHANNEL>

virtual unsigned app::TCubicFInt< TPIXEL, TCHANNEL >::getSrcWidth | ( |  | ) | const
| inlinevirtual

Implements app::TFInterpolator< TPIXEL, TCHANNEL >.

Definition at line 497 of file TCubicFInt.hpp.

{
return srcWidth;
}
template<typename TPIXEL, typename TCHANNEL>

virtual int app::TCubicFInt< TPIXEL, TCHANNEL >::isInitOk | ( |  | ) | const
| inlinevirtual

Implements app::TFInterpolator< TPIXEL, TCHANNEL >.

Definition at line 485 of file TCubicFInt.hpp.

{
if (xReindex != NULL && yReindex != NULL) {
return 1;
} else {
return 0;
}
}
template<typename TPIXEL, typename TCHANNEL>

virtual TFInterpolator<TPIXEL, TCHANNEL>* app::TCubicFInt< TPIXEL, TCHANNEL >::newInstance | ( | const TBitmap< TPIXEL, TCHANNEL > & | over | ) | const
| inlineprotectedvirtual

Implements app::TFInterpolator< TPIXEL, TCHANNEL >.

Definition at line 429 of file TCubicFInt.hpp.

{
return new TCubicFInt<TPIXEL, TCHANNEL>(over);
}
template<typename TPIXEL , typename TCHANNEL >

int TFInterpolator< TPIXEL, TCHANNEL >::resampleTo | ( | TBitmap< TPIXEL, TCHANNEL > & | dst | ) | const
| virtualinherited

Definition at line 13 of file TFInterpolator.cpp.

{
if (chCount == 1) {
return resampleTo_1ch(dst);
} else if (chCount == 4) {
return resampleTo_4ch(dst);
} else {
return 100;
}
}
template<typename TPIXEL , typename TCHANNEL >

int TCubicFInt< TPIXEL, TCHANNEL >::resampleTo_1ch | ( | TBitmap< TPIXEL, TCHANNEL > & | dst | ) | const
| protectedvirtual

Převzorkuje data interpolátoru do cílové bitmapy.

Parameters

  dst |

Returns

Implements app::TFInterpolator< TPIXEL, TCHANNEL >.

Definition at line 153 of file TCubicFInt.cpp.

{
if (srcData == NULL) {
return 1;
}
TPIXEL * const dstData = dst.getData();
if (dstData == NULL) {
return 2;
}
if (!isInitOk()) {
return 3;
}
unsigned origWidth = srcWidth;
unsigned origHeight = srcHeight;
unsigned dstWidth = dst.getWidth();
unsigned dstHeight = dst.getHeight();
unsigned tmpWidth = srcHeight;
unsigned tmpHeight = dstWidth;
TPIXEL * const tmpData = (TPIXEL *) malloc((unsigned long) (tmpWidth * tmpHeight * sizeof(TPIXEL)));
if (tmpData == NULL) {
return 3;
}
double xDelta = srcWidth / (double) dstWidth;
double xMin = xDelta / 2.0;
double yDelta = srcHeight / (double) dstHeight;
double yMin = yDelta / 2.0;
REINDEXED_INTERPOLATION_GENERAL_ALGORITHM(
TPIXEL * sData = srcData; int sWidth = origWidth; int sHeight = origHeight; TPIXEL * dData = tmpData; int dWidth = tmpWidth; int dHeight = tmpHeight; double x0 = xMin; double dx = xDelta; int * reindexer = xReindex; double noReindexFrom = xNoReindexFrom; double noReindexTo = xNoReindexTo; TCHANNEL p0; TCHANNEL p1; TCHANNEL p2; TCHANNEL p3; double clamp; int X; double nx;,
nx = x + 0.5; X = nx; nx -= X; p0 = sPtrRowBgn[reindexer[X++]]; p1 = sPtrRowBgn[reindexer[X++]]; p2 = sPtrRowBgn[reindexer[X++]]; p3 = sPtrRowBgn[reindexer[X]]; INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dPtr = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp;,
nx = x - 1.5; X = nx; nx -= X; sPtr = sPtrRowBgn + X; p0 = *(sPtr++); p1 = *(sPtr++); p2 = *(sPtr++); p3 = *(sPtr); INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dPtr = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp;)
REINDEXED_INTERPOLATION_GENERAL_ALGORITHM(
TPIXEL * sData = tmpData; int sWidth = tmpWidth; int sHeight = tmpHeight; TPIXEL * dData = dstData; int dWidth = dstWidth; int dHeight = dstHeight; double x0 = yMin; double dx = yDelta; int * reindexer = yReindex; double noReindexFrom = yNoReindexFrom; double noReindexTo = yNoReindexTo; TCHANNEL p0; TCHANNEL p1; TCHANNEL p2; TCHANNEL p3; double clamp; int X; double nx;,
nx = x + 0.5; X = nx; nx -= X; p0 = sPtrRowBgn[reindexer[X++]]; p1 = sPtrRowBgn[reindexer[X++]]; p2 = sPtrRowBgn[reindexer[X++]]; p3 = sPtrRowBgn[reindexer[X]]; INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dPtr = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp;,
nx = x - 1.5; X = nx; nx -= X; sPtr = sPtrRowBgn + X; p0 = *(sPtr++); p1 = *(sPtr++); p2 = *(sPtr++); p3 = *(sPtr); INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dPtr = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp;)
free(tmpData);
return 0;
}
template<typename TPIXEL , typename TCHANNEL >

int TCubicFInt< TPIXEL, TCHANNEL >::resampleTo_4ch | ( | TBitmap< TPIXEL, TCHANNEL > & | dst | ) | const
| protectedvirtual

Převzorkuje data interpolátoru do cílové bitmapy.

Parameters

  dst |

Returns

Implements app::TFInterpolator< TPIXEL, TCHANNEL >.

Definition at line 70 of file TCubicFInt.cpp.

{
if (srcData == NULL) {
return 1;
}
TPIXEL * const dstData = dst.getData();
if (dstData == NULL) {
return 2;
}
if (!isInitOk()) {
return 3;
}
unsigned origWidth = srcWidth;
unsigned origHeight = srcHeight;
unsigned dstWidth = dst.getWidth();
unsigned dstHeight = dst.getHeight();
unsigned tmpWidth = srcHeight;
unsigned tmpHeight = dstWidth;
TPIXEL * const tmpData = (TPIXEL *) malloc((unsigned long) (tmpWidth * tmpHeight * sizeof(TPIXEL)));
if (tmpData == NULL) {
return 3;
}
double xDelta = srcWidth / (double) dstWidth;
double xMin = xDelta / 2.0;
double yDelta = srcHeight / (double) dstHeight;
double yMin = yDelta / 2.0;
REINDEXED_INTERPOLATION_GENERAL_ALGORITHM(
TPIXEL * sData = srcData; int sWidth = origWidth; int sHeight = origHeight; TPIXEL * dData = tmpData; int dWidth = tmpWidth; int dHeight = tmpHeight; double x0 = xMin; double dx = xDelta; int * reindexer = xReindex; double noReindexFrom = xNoReindexFrom; double noReindexTo = xNoReindexTo; TCHANNEL * px0; TCHANNEL * px1; TCHANNEL * px2; TCHANNEL * px3; TCHANNEL * dpx; double clamp; TCHANNEL p0; TCHANNEL p1; TCHANNEL p2; TCHANNEL p3; int X; double nx;,
nx = x + 0.5; X = nx; nx -= X; px0 = (TCHANNEL *)(sPtrRowBgn + reindexer[X++]); px1 = (TCHANNEL *)(sPtrRowBgn + reindexer[X++]); px2 = (TCHANNEL *)(sPtrRowBgn + reindexer[X++]); px3 = (TCHANNEL *)(sPtrRowBgn + reindexer[X]); dpx = (TCHANNEL *)dPtr;
p0 = *(px0++); p1 = *(px1++); p2 = *(px2++); p3 = *(px3++); INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dpx = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp; dpx++;
p0 = *(px0++); p1 = *(px1++); p2 = *(px2++); p3 = *(px3++); INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dpx = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp; dpx++;
p0 = *(px0++); p1 = *(px1++); p2 = *(px2++); p3 = *(px3++); INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dpx = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp; dpx++;
p0 = *(px0); p1 = *(px1); p2 = *(px2); p3 = *(px3); INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dpx = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp;,
nx = x - 1.5; X = nx; nx -= X; sPtr = sPtrRowBgn + X; px0 = (TCHANNEL *) sPtr++; px1 = (TCHANNEL *) sPtr++; px2 = (TCHANNEL *) sPtr++; px3 = (TCHANNEL *) sPtr; dpx = (TCHANNEL *)dPtr;
p0 = *(px0++); p1 = *(px1++); p2 = *(px2++); p3 = *(px3++); INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dpx = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp; dpx++;
p0 = *(px0++); p1 = *(px1++); p2 = *(px2++); p3 = *(px3++); INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dpx = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp; dpx++;
p0 = *(px0++); p1 = *(px1++); p2 = *(px2++); p3 = *(px3++); INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dpx = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp; dpx++;
p0 = *(px0); p1 = *(px1); p2 = *(px2); p3 = *(px3); INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dpx = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp;)
REINDEXED_INTERPOLATION_GENERAL_ALGORITHM(
TPIXEL * sData = tmpData; int sWidth = tmpWidth; int sHeight = tmpHeight; TPIXEL * dData = dstData; int dWidth = dstWidth; int dHeight = dstHeight; double x0 = yMin; double dx = yDelta; int * reindexer = yReindex; double noReindexFrom = yNoReindexFrom; double noReindexTo = yNoReindexTo; TCHANNEL * px0; TCHANNEL * px1; TCHANNEL * px2; TCHANNEL * px3; TCHANNEL * dpx; double clamp; TCHANNEL p0; TCHANNEL p1; TCHANNEL p2; TCHANNEL p3; int X; double nx;,
nx = x + 0.5; X = nx; nx -= X; px0 = (TCHANNEL *)(sPtrRowBgn + reindexer[X++]); px1 = (TCHANNEL *)(sPtrRowBgn + reindexer[X++]); px2 = (TCHANNEL *)(sPtrRowBgn + reindexer[X++]); px3 = (TCHANNEL *)(sPtrRowBgn + reindexer[X]); dpx = (TCHANNEL *)dPtr;
p0 = *(px0++); p1 = *(px1++); p2 = *(px2++); p3 = *(px3++); INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dpx = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp; dpx++;
p0 = *(px0++); p1 = *(px1++); p2 = *(px2++); p3 = *(px3++); INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dpx = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp; dpx++;
p0 = *(px0++); p1 = *(px1++); p2 = *(px2++); p3 = *(px3++); INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dpx = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp; dpx++;
p0 = *(px0); p1 = *(px1); p2 = *(px2); p3 = *(px3); INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dpx = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp;,
nx = x - 1.5; X = nx; nx -= X; sPtr = sPtrRowBgn + X; px0 = (TCHANNEL *) sPtr++; px1 = (TCHANNEL *) sPtr++; px2 = (TCHANNEL *) sPtr++; px3 = (TCHANNEL *) sPtr; dpx = (TCHANNEL *)dPtr;
p0 = *(px0++); p1 = *(px1++); p2 = *(px2++); p3 = *(px3++); INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dpx = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp; dpx++;
p0 = *(px0++); p1 = *(px1++); p2 = *(px2++); p3 = *(px3++); INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dpx = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp; dpx++;
p0 = *(px0++); p1 = *(px1++); p2 = *(px2++); p3 = *(px3++); INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dpx = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp; dpx++;
p0 = *(px0); p1 = *(px1); p2 = *(px2); p3 = *(px3); INTERPOLATE_CUBIC(p0, p1, p2, p3, nx, clamp); *dpx = (clamp > maxVal) ? maxVal : (clamp < 0) ? 0 : clamp;)
free(tmpData);
return 0;
}
template<typename TPIXEL , typename TCHANNEL >

int TFInterpolator< TPIXEL, TCHANNEL >::resampleTo_aliased | ( | TBitmap< TPIXEL, TCHANNEL > & | dst,
|  | double | force = `1`
| ) |  | const
| virtualinherited

Definition at line 24 of file TFInterpolator.cpp.

{
if (getSrcData() == NULL) {
return 1;
}
TPIXEL * const dstData = dst.getData();
if (dstData == NULL) {
return 2;
}
if (!isInitOk()) {
return 3;
}
unsigned origWidth = getSrcWidth();
unsigned origHeight = getSrcHeight();
unsigned dstWidth = dst.getWidth();
unsigned dstHeight = dst.getHeight();
// Jako sigmu bereme poloměr pixeli, pokud tento po násobení sílou je větší než hraniční, provede se filtrace, ta je ale možná zbytečně agresivní
// a vztah pro určení sigmy je jen od oka... Každopádně filtruje se pro zmenšní o více než 1%, filtrace ale nenaskakuje na nejmenší míře (ta je 0.35, nikoliv 0.505
double xSigma = force * origWidth / (2.0 * dstWidth);
double ySigma = force * origHeight / (2.0 * dstHeight);
xSigma = (xSigma < 0.505) ? 0 : xSigma;
ySigma = (ySigma < 0.505) ? 0 : ySigma;
if (xSigma > 0.35 || ySigma > 0.35) {
TBitmap<TPIXEL, TCHANNEL> * source = new TBitmap<TPIXEL, TCHANNEL>(getSrcData(), getSrcWidth(), getSrcHeight(), dst.getType(), false); // Wrapper
if (source == NULL) {
return 4;
}
TBitmap<TPIXEL, TCHANNEL> * preBlurred = new TBitmap<TPIXEL, TCHANNEL>(*source);
if (preBlurred == NULL) {
delete source;
return 5;
}
TGaussianBlur<TPIXEL, TCHANNEL> preBlur(xSigma, ySigma);
preBlur.applyTo(*preBlurred, preBlurred->getRect());
TFInterpolator<TPIXEL, TCHANNEL> * i = newInstance(*preBlurred);
if (i == NULL) {
delete source;
delete preBlurred;
return 6;
}
int retVal = 7;
if (i->isInitOk()) {
retVal = i->resampleTo(dst);
}
delete source;
delete preBlurred;
delete i;
return retVal;
} else {
return resampleTo(dst);
}
}

## Member Data Documentation

template<typename TPIXEL, typename TCHANNEL>

const unsigned TCubicFInt< TPIXEL, TCHANNEL >::chCount = sizeof(TPIXEL) / sizeof(TCHANNEL)
| static

Počet kanálů bitmapy.

Definition at line 434 of file TCubicFInt.hpp.

template<typename TPIXEL, typename TCHANNEL>

const TCHANNEL TCubicFInt< TPIXEL, TCHANNEL >::maxVal = ~0
| static

Maximální hodnota kanálu.

Definition at line 435 of file TCubicFInt.hpp.

template<typename TPIXEL, typename TCHANNEL>

int app::TCubicFInt< TPIXEL, TCHANNEL >::offset
| protected

Definition at line 35 of file TCubicFInt.hpp.

template<typename TPIXEL, typename TCHANNEL>

TPIXEL* app::TCubicFInt< TPIXEL, TCHANNEL >::srcData
| protected

Definition at line 32 of file TCubicFInt.hpp.

template<typename TPIXEL, typename TCHANNEL>

unsigned app::TCubicFInt< TPIXEL, TCHANNEL >::srcHeight
| protected

Definition at line 34 of file TCubicFInt.hpp.

template<typename TPIXEL, typename TCHANNEL>

unsigned app::TCubicFInt< TPIXEL, TCHANNEL >::srcWidth
| protected

Definition at line 33 of file TCubicFInt.hpp.

template<typename TPIXEL, typename TCHANNEL>

double app::TCubicFInt< TPIXEL, TCHANNEL >::xNoReindexFrom
| protected

Definition at line 39 of file TCubicFInt.hpp.

template<typename TPIXEL, typename TCHANNEL>

double app::TCubicFInt< TPIXEL, TCHANNEL >::xNoReindexTo
| protected

Definition at line 40 of file TCubicFInt.hpp.

template<typename TPIXEL, typename TCHANNEL>

int* app::TCubicFInt< TPIXEL, TCHANNEL >::xReindex
| protected

Definition at line 37 of file TCubicFInt.hpp.

template<typename TPIXEL, typename TCHANNEL>

double app::TCubicFInt< TPIXEL, TCHANNEL >::yNoReindexFrom
| protected

Definition at line 41 of file TCubicFInt.hpp.

template<typename TPIXEL, typename TCHANNEL>

double app::TCubicFInt< TPIXEL, TCHANNEL >::yNoReindexTo
| protected

Definition at line 42 of file TCubicFInt.hpp.

template<typename TPIXEL, typename TCHANNEL>

int* app::TCubicFInt< TPIXEL, TCHANNEL >::yReindex
| protected

Definition at line 38 of file TCubicFInt.hpp.

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

- /home/xxx/eclipse_workspaces/app/appcore/jni/app/interpolators_fast/TCubicFInt.hpp
- /home/xxx/eclipse_workspaces/app/appcore/jni/app/interpolators_fast/TCubicFInt.cpp