Skip to content

Commit

Permalink
Further cleanup...
Browse files Browse the repository at this point in the history
  • Loading branch information
randaz81 committed Oct 16, 2024
1 parent ed15986 commit 9610ad5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 44 deletions.
9 changes: 1 addition & 8 deletions src/libYARP_sig/src/yarp/sig/Image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,9 @@ void ImageStorage::resize(size_t x, size_t y, int pixel_type,
// allocates an empty image.
void ImageStorage::_alloc () {


_free(); // was iplDeallocateImage(pImage); but that won't work with refs

if ((type_id == VOCAB_PIXEL_MONO_FLOAT) ||
(type_id == VOCAB_PIXEL_RGB_FLOAT) ||
(type_id == VOCAB_PIXEL_HSV_FLOAT)) {
iplAllocateImageFP(pImage);
} else {
iplAllocateImage (pImage);
}
iplAllocateImage (pImage);

iplSetBorderMode (pImage, IPL_BORDER_CONSTANT, IPL_SIDE_ALL, 0);
}
Expand Down
34 changes: 1 addition & 33 deletions src/libYARP_sig/src/yarp/sig/impl/IplImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ T* AllocAligned (int size)
T *ptr = new T[size + YARP_IMAGE_ALIGN];
const int rem = (((size_t)ptr) % YARP_IMAGE_ALIGN);
const char addbytes = YARP_IMAGE_ALIGN - rem;
///((rem != 0) ? (YARP_IMAGE_ALIGN - rem) : 0);

char *p = ((char *)ptr) + addbytes;
*(p - 1) = addbytes;
Expand All @@ -42,29 +41,9 @@ void FreeAligned (T* ptr)
delete[] reinterpret_cast<T*>(((char *)ptr) - addbytes);
}


// TODO: manage IPL ROI and tiling.
IPLAPIIMPL(void, iplAllocateImage,(IplImage* image))
{
// Not implemented depth != 8
//int depth = (image->depth & IPL_DEPTH_MASK)/8;
yAssert(image->dataOrder == IPL_DATA_ORDER_PIXEL);
///yAssert(image->widthStep == image->width * (image->depth & IPL_DEPTH_MASK) / 8 * image->nChannels);
yAssert(image->imageSize == image->widthStep * image->height);

image->imageData = AllocAligned<char> (image->imageSize); // new char[image->imageSize];
yAssert(image->imageData != nullptr);
}

IPLAPIIMPL(void, iplAllocateImageFP,(IplImage* image))
{
yAssert(image->depth == IPL_DEPTH_32F);
yAssert(image->dataOrder == IPL_DATA_ORDER_PIXEL);
// yAssert(image->widthStep == image->width * (image->depth & IPL_DEPTH_MASK) / 8 * image->nChannels);
yAssert(image->imageSize == image->widthStep * image->height);

image->imageData = AllocAligned<char> (image->imageSize);
yAssert(image->imageData != nullptr);
}

IPLAPIIMPL(void, iplDeallocateImage,(IplImage* image))
Expand Down Expand Up @@ -152,13 +131,9 @@ IPLAPIIMPL(IplImage*, iplCreateImageHeader,

yAssert(dataOrder == IPL_DATA_ORDER_PIXEL);

r->dataOrder = dataOrder; // IPL_DATA_ORDER_PIXEL, IPL_DATA_ORDER_PLANE
r->dataOrder = dataOrder;
r->origin = origin;

//yAssert(align == IPL_ALIGN_QWORD); /// don't want to be bothered w/ alignment beside the
/// the 8 bytes stuff.
//yAssert(align == YARP_IMAGE_ALIGN);

r->align = align;
r->width = width;
r->height = height;
Expand All @@ -185,7 +160,6 @@ IPLAPIIMPL(void, iplDeallocateHeader,(IplImage* image))
if (image->imageData != nullptr)
{
FreeAligned<char> (image->imageData);
///delete[] image->imageData;
}

delete image;
Expand All @@ -204,12 +178,6 @@ IPLAPIIMPL(void, iplDeallocate,(IplImage* image, int flag))
case IPL_IMAGE_DATA:
iplDeallocateImage (image);
break;

case IPL_IMAGE_ROI:
case IPL_IMAGE_TILE:
case IPL_IMAGE_MASK:
// NOT IMPLEMENTED.
break;
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/libYARP_sig/src/yarp/sig/impl/IplImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ typedef struct _IplTileInfo IplTileInfo;

IPLAPIIMPL(void, iplAllocateImage,(IplImage* image));

IPLAPIIMPL(void, iplAllocateImageFP,(IplImage* image));


IPLAPIIMPL(void, iplDeallocateImage,(IplImage* image));

IPLAPIIMPL(IplImage*, iplCreateImageHeader,
Expand Down

0 comments on commit 9610ad5

Please sign in to comment.