VX_API_ENTRY vx_status VX_API_CALL vxSetMetaFormatAttribute(vx_meta_format meta, vx_enum attribute, const void *ptr, vx_size size)
{
    vx_status status = VX_SUCCESS;
    if (vxIsValidSpecificReference(&meta->base, VX_TYPE_META_FORMAT) == vx_false_e)
        return VX_ERROR_INVALID_REFERENCE;

    if (VX_TYPE(attribute) != meta->type) {
        return VX_ERROR_INVALID_TYPE;
    }

    switch(attribute) {
        case VX_IMAGE_FORMAT:
            if (VX_CHECK_PARAM(ptr, size, vx_df_image, 0x3)) {
                meta->dim.image.format = *(vx_df_image *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_IMAGE_HEIGHT:
            if (VX_CHECK_PARAM(ptr, size, vx_uint32, 0x3)) {
                meta->dim.image.height = *(vx_uint32 *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_IMAGE_WIDTH:
            if (VX_CHECK_PARAM(ptr, size, vx_uint32, 0x3)) {
                meta->dim.image.width = *(vx_uint32 *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        /**********************************************************************/
        case VX_ARRAY_CAPACITY:
            if (VX_CHECK_PARAM(ptr, size, vx_size, 0x3)) {
                meta->dim.array.capacity = *(vx_size *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_ARRAY_ITEMTYPE:
            if (VX_CHECK_PARAM(ptr, size, vx_enum, 0x3)) {
                meta->dim.array.item_type = *(vx_enum *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        /**********************************************************************/
        case VX_PYRAMID_FORMAT:
            if (VX_CHECK_PARAM(ptr, size, vx_df_image, 0x3)) {
                meta->dim.pyramid.format = *(vx_df_image *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_PYRAMID_HEIGHT:
            if (VX_CHECK_PARAM(ptr, size, vx_uint32, 0x3)) {
                meta->dim.pyramid.height = *(vx_uint32 *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_PYRAMID_WIDTH:
            if (VX_CHECK_PARAM(ptr, size, vx_uint32, 0x3)) {
                meta->dim.pyramid.width = *(vx_uint32 *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_PYRAMID_LEVELS:
            if (VX_CHECK_PARAM(ptr, size, vx_size, 0x3)) {
                meta->dim.pyramid.levels = *(vx_size *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_PYRAMID_SCALE:
            if (VX_CHECK_PARAM(ptr, size, vx_float32, 0x3)) {
                meta->dim.pyramid.scale = *(vx_float32 *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        /**********************************************************************/
        case VX_SCALAR_TYPE:
            if (VX_CHECK_PARAM(ptr, size, vx_enum, 0x3)) {
                meta->dim.scalar.type = *(vx_enum *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        /**********************************************************************/
        case VX_MATRIX_TYPE:
            if (VX_CHECK_PARAM(ptr, size, vx_enum, 0x3)) {
                meta->dim.matrix.type = *(vx_enum *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_MATRIX_ROWS:
            if (VX_CHECK_PARAM(ptr, size, vx_size, 0x3)) {
                meta->dim.matrix.rows = *(vx_size *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_MATRIX_COLUMNS:
            if (VX_CHECK_PARAM(ptr, size, vx_size, 0x3)) {
                meta->dim.matrix.cols = *(vx_size *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        /**********************************************************************/
        case VX_DISTRIBUTION_BINS:
            if (VX_CHECK_PARAM(ptr, size, vx_size, 0x3)) {
                meta->dim.distribution.bins = *(vx_size *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_DISTRIBUTION_RANGE:
            if (VX_CHECK_PARAM(ptr, size, vx_uint32, 0x3)) {
                meta->dim.distribution.range = *(vx_uint32 *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_DISTRIBUTION_OFFSET:
            if (VX_CHECK_PARAM(ptr, size, vx_int32, 0x3)) {
                meta->dim.distribution.offset = *(vx_int32 *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        /**********************************************************************/
        case VX_REMAP_SOURCE_WIDTH:
            if (VX_CHECK_PARAM(ptr, size, vx_uint32, 0x3)) {
                meta->dim.remap.src_width = *(vx_uint32 *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_REMAP_SOURCE_HEIGHT:
            if (VX_CHECK_PARAM(ptr, size, vx_uint32, 0x3)) {
                meta->dim.remap.src_height = *(vx_uint32 *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_REMAP_DESTINATION_WIDTH:
            if (VX_CHECK_PARAM(ptr, size, vx_uint32, 0x3)) {
                meta->dim.remap.dst_width = *(vx_uint32 *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_REMAP_DESTINATION_HEIGHT:
            if (VX_CHECK_PARAM(ptr, size, vx_uint32, 0x3)) {
                meta->dim.remap.dst_height = *(vx_uint32 *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        /**********************************************************************/
        case VX_LUT_TYPE:
            if (VX_CHECK_PARAM(ptr, size, vx_enum, 0x3)) {
                meta->dim.lut.type = *(vx_enum *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_LUT_COUNT:
            if (VX_CHECK_PARAM(ptr, size, vx_size, 0x3)) {
                meta->dim.lut.count = *(vx_size *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        /**********************************************************************/
        case VX_THRESHOLD_TYPE:
            if (VX_CHECK_PARAM(ptr, size, vx_enum, 0x3)) {
                meta->dim.threshold.type = *(vx_enum *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        default:
            status = VX_ERROR_NOT_SUPPORTED;
            break;
    }
    return status;
}
VX_API_ENTRY vx_status VX_API_CALL vxSetMetaFormatAttribute(vx_meta_format meta, vx_enum attribute, const void *ptr, vx_size size)
{
    vx_status status = VX_SUCCESS;
    if (vxIsValidSpecificReference(&meta->base, VX_TYPE_META_FORMAT) == vx_false_e)
        return VX_ERROR_INVALID_REFERENCE;

    if (VX_TYPE(attribute) != meta->type) {
        return VX_ERROR_INVALID_TYPE;
    }

    switch(attribute) {
        /**********************************************************************/
        case VX_META_FORMAT_ATTRIBUTE_DELTA_RECTANGLE:
            if (VX_CHECK_PARAM(ptr, size, vx_delta_rectangle_t, 0x3)) {
                memcpy(&meta->dim.image.delta, ptr, size);
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        /**********************************************************************/
        case VX_IMAGE_ATTRIBUTE_FORMAT:
            if (VX_CHECK_PARAM(ptr, size, vx_df_image, 0x3)) {
                meta->dim.image.format = *(vx_df_image *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_IMAGE_ATTRIBUTE_HEIGHT:
            if (VX_CHECK_PARAM(ptr, size, vx_uint32, 0x3)) {
                meta->dim.image.height = *(vx_uint32 *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_IMAGE_ATTRIBUTE_WIDTH:
            if (VX_CHECK_PARAM(ptr, size, vx_uint32, 0x3)) {
                meta->dim.image.width = *(vx_uint32 *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        /**********************************************************************/
        case VX_ARRAY_ATTRIBUTE_CAPACITY:
            if (VX_CHECK_PARAM(ptr, size, vx_size, 0x3)) {
                meta->dim.array.capacity = *(vx_size *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_ARRAY_ATTRIBUTE_ITEMTYPE:
            if (VX_CHECK_PARAM(ptr, size, vx_enum, 0x3)) {
                meta->dim.array.item_type = *(vx_enum *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        /**********************************************************************/
        case VX_PYRAMID_ATTRIBUTE_FORMAT:
            if (VX_CHECK_PARAM(ptr, size, vx_df_image, 0x3)) {
                meta->dim.pyramid.format = *(vx_df_image *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_PYRAMID_ATTRIBUTE_HEIGHT:
            if (VX_CHECK_PARAM(ptr, size, vx_uint32, 0x3)) {
                meta->dim.pyramid.height = *(vx_uint32 *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_PYRAMID_ATTRIBUTE_WIDTH:
            if (VX_CHECK_PARAM(ptr, size, vx_uint32, 0x3)) {
                meta->dim.pyramid.width = *(vx_uint32 *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_PYRAMID_ATTRIBUTE_LEVELS:
            if (VX_CHECK_PARAM(ptr, size, vx_size, 0x3)) {
                meta->dim.pyramid.levels = *(vx_size *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        case VX_PYRAMID_ATTRIBUTE_SCALE:
            if (VX_CHECK_PARAM(ptr, size, vx_float32, 0x3)) {
                meta->dim.pyramid.scale = *(vx_float32 *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        /**********************************************************************/
        case VX_SCALAR_ATTRIBUTE_TYPE:
            if (VX_CHECK_PARAM(ptr, size, vx_enum, 0x3)) {
                meta->dim.scalar.type = *(vx_enum *)ptr;
            } else {
                status = VX_ERROR_INVALID_PARAMETERS;
            }
            break;
        /**********************************************************************/
        default:
            status = VX_ERROR_NOT_SUPPORTED;
            break;
    }
    return status;
}