mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
Merge pull request #28048 from asmorkalov:as/stateless_hal_filtering
Improved HAL status check for filter, sepFilter and morphology operations to support stateless HAL
This commit is contained in:
@@ -1174,13 +1174,31 @@ static bool replacementFilter2D(int stype, int dtype, int kernel_type,
|
||||
cvhalFilter2D* ctx;
|
||||
int res = cv_hal_filterInit(&ctx, kernel_data, kernel_step, kernel_type, kernel_width, kernel_height, width, height,
|
||||
stype, dtype, borderType, delta, anchor_x, anchor_y, isSubmatrix, src_data == dst_data);
|
||||
if (res != CV_HAL_ERROR_OK)
|
||||
if (res == CV_HAL_ERROR_NOT_IMPLEMENTED)
|
||||
{
|
||||
return false;
|
||||
} else if (res != CV_HAL_ERROR_OK)
|
||||
{
|
||||
CV_Error_(cv::Error::StsInternal,
|
||||
("HAL implementation filterInit ==> " CVAUX_STR(cv_hal_filterInit) " returned %d (0x%08x)", res, res));
|
||||
}
|
||||
|
||||
res = cv_hal_filter(ctx, src_data, src_step, dst_data, dst_step, width, height, full_width, full_height, offset_x, offset_y);
|
||||
bool success = (res == CV_HAL_ERROR_OK);
|
||||
if (res != CV_HAL_ERROR_OK && res != CV_HAL_ERROR_NOT_IMPLEMENTED )
|
||||
{
|
||||
CV_Error_(cv::Error::StsInternal,
|
||||
("HAL implementation filter ==> " CVAUX_STR(cv_hal_filter) " returned %d (0x%08x)", res, res));
|
||||
}
|
||||
|
||||
res = cv_hal_filterFree(ctx);
|
||||
if (res != CV_HAL_ERROR_OK)
|
||||
return false;
|
||||
success &= (res == CV_HAL_ERROR_OK);
|
||||
if (res != CV_HAL_ERROR_OK && res != CV_HAL_ERROR_NOT_IMPLEMENTED )
|
||||
{
|
||||
CV_Error_(cv::Error::StsInternal,
|
||||
("HAL implementation filterFree ==> " CVAUX_STR(cv_hal_filterFree) " returned %d (0x%08x)", res, res));
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -1372,13 +1390,31 @@ static bool replacementSepFilter(int stype, int dtype, int ktype,
|
||||
kernelx_data, kernelx_len,
|
||||
kernely_data, kernely_len,
|
||||
anchor_x, anchor_y, delta, borderType);
|
||||
if (res != CV_HAL_ERROR_OK)
|
||||
if (res == CV_HAL_ERROR_NOT_IMPLEMENTED)
|
||||
{
|
||||
return false;
|
||||
} else if (res != CV_HAL_ERROR_OK)
|
||||
{
|
||||
CV_Error_(cv::Error::StsInternal,
|
||||
("HAL implementation sepFilterInit ==> " CVAUX_STR(cv_hal_sepFilterInit) " returned %d (0x%08x)", res, res));
|
||||
}
|
||||
|
||||
res = cv_hal_sepFilter(ctx, src_data, src_step, dst_data, dst_step, width, height, full_width, full_height, offset_x, offset_y);
|
||||
bool success = (res == CV_HAL_ERROR_OK);
|
||||
if (res != CV_HAL_ERROR_OK && res != CV_HAL_ERROR_NOT_IMPLEMENTED )
|
||||
{
|
||||
CV_Error_(cv::Error::StsInternal,
|
||||
("HAL implementation sepFilter ==> " CVAUX_STR(cv_hal_sepFilter) " returned %d (0x%08x)", res, res));
|
||||
}
|
||||
|
||||
res = cv_hal_sepFilterFree(ctx);
|
||||
if (res != CV_HAL_ERROR_OK)
|
||||
return false;
|
||||
success &= (res == CV_HAL_ERROR_OK);
|
||||
if (res != CV_HAL_ERROR_OK && res != CV_HAL_ERROR_NOT_IMPLEMENTED )
|
||||
{
|
||||
CV_Error_(cv::Error::StsInternal,
|
||||
("HAL implementation sepFilterFree ==> " CVAUX_STR(cv_hal_sepFilterFree) " returned %d (0x%08x)", res, res));
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
@@ -218,8 +218,14 @@ static bool halMorph(int op, int src_type, int dst_type,
|
||||
anchor_x, anchor_y,
|
||||
borderType, borderValue,
|
||||
iterations, isSubmatrix, src_data == dst_data);
|
||||
if (res != CV_HAL_ERROR_OK)
|
||||
if (res == CV_HAL_ERROR_NOT_IMPLEMENTED)
|
||||
{
|
||||
return false;
|
||||
} else if (res != CV_HAL_ERROR_OK)
|
||||
{
|
||||
CV_Error_(cv::Error::StsInternal,
|
||||
("HAL implementation morphInit ==> " CVAUX_STR(cv_hal_morphInit) " returned %d (0x%08x)", res, res));
|
||||
}
|
||||
|
||||
res = cv_hal_morph(ctx, src_data, src_step, dst_data, dst_step, width, height,
|
||||
roi_width, roi_height,
|
||||
@@ -227,10 +233,19 @@ static bool halMorph(int op, int src_type, int dst_type,
|
||||
roi_width2, roi_height2,
|
||||
roi_x2, roi_y2);
|
||||
bool success = (res == CV_HAL_ERROR_OK);
|
||||
if (res != CV_HAL_ERROR_OK && res != CV_HAL_ERROR_NOT_IMPLEMENTED )
|
||||
{
|
||||
CV_Error_(cv::Error::StsInternal,
|
||||
("HAL implementation morph ==> " CVAUX_STR(cv_hal_morph) " returned %d (0x%08x)", res, res));
|
||||
}
|
||||
|
||||
res = cv_hal_morphFree(ctx);
|
||||
if (res != CV_HAL_ERROR_OK)
|
||||
return false;
|
||||
success &= (res == CV_HAL_ERROR_OK);
|
||||
if (res != CV_HAL_ERROR_OK && res != CV_HAL_ERROR_NOT_IMPLEMENTED )
|
||||
{
|
||||
CV_Error_(cv::Error::StsInternal,
|
||||
("HAL implementation morphFree ==> " CVAUX_STR(cv_hal_morphFree) " returned %d (0x%08x)", res, res));
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user