Skip to content

Commit 7c20ffd

Browse files
authored
Update io.hpp
1 parent 070562c commit 7c20ffd

File tree

1 file changed

+0
-54
lines changed

1 file changed

+0
-54
lines changed

examples/middleware/io.hpp

-54
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "ax_sys_api.h"
2929
#include "joint.h"
3030
#include "joint_adv.h"
31-
#include "npu_cv_kit/npu_common.h"
3231

3332
namespace middleware
3433
{
@@ -211,59 +210,6 @@ namespace middleware
211210
return pBuf;
212211
}
213212

214-
AX_S32 prepare_io_npu_cv_image(AX_NPU_CV_Image* cv_image, AX_JOINT_IO_T& io, const AX_JOINT_IO_INFO_T* io_info, const uint32_t& batch = 1)
215-
{
216-
std::memset(&io, 0, sizeof(io));
217-
218-
io.nInputSize = io_info->nInputSize;
219-
if (1 != io.nInputSize)
220-
{
221-
fprintf(stderr, "[ERR]: Only single input was accepted(got %u).\n", io.nInputSize);
222-
return -1;
223-
}
224-
io.pInputs = new AX_JOINT_IO_BUFFER_T[io.nInputSize];
225-
226-
// fill input
227-
{
228-
const AX_JOINT_IOMETA_T* pMeta = io_info->pInputs;
229-
AX_JOINT_IO_BUFFER_T* pBuf = io.pInputs;
230-
231-
if (pMeta->nShapeSize <= 0)
232-
{
233-
fprintf(stderr, "[ERR]: Dimension(%u) of shape is not allowed.\n", (uint32_t)pMeta->nShapeSize);
234-
return -1;
235-
}
236-
237-
auto actual_data_size = pMeta->nSize / pMeta->pShape[0] * batch;
238-
if (cv_image->nSize != actual_data_size)
239-
{
240-
fprintf(stderr,
241-
"[ERR]: The cv_image size is not equal to model input(%s) size(%u vs %u).\n",
242-
io_info->pInputs[0].pName,
243-
(uint32_t)cv_image->nSize,
244-
actual_data_size);
245-
return -1;
246-
}
247-
248-
pBuf->pVirAddr = cv_image->pVir;
249-
pBuf->phyAddr = cv_image->pPhy;
250-
pBuf->nSize = cv_image->nSize;
251-
}
252-
253-
// deal with output
254-
{
255-
io.nOutputSize = io_info->nOutputSize;
256-
io.pOutputs = new AX_JOINT_IO_BUFFER_T[io.nOutputSize];
257-
for (size_t i = 0; i < io.nOutputSize; ++i)
258-
{
259-
const AX_JOINT_IOMETA_T* pMeta = io_info->pOutputs + i;
260-
AX_JOINT_IO_BUFFER_T* pBuf = io.pOutputs + i;
261-
alloc_joint_buffer(pMeta, pBuf);
262-
}
263-
}
264-
return AX_ERR_NPU_JOINT_SUCCESS;
265-
}
266-
267213
AX_S32 prepare_io_out_cache(const void* buf, const size_t& size, AX_JOINT_IO_T& io, const AX_JOINT_IO_INFO_T* io_info, const uint32_t& batch = 1)
268214
{
269215
std::memset(&io, 0, sizeof(io));

0 commit comments

Comments
 (0)