From: Tae-Young Chung Date: Fri, 3 Mar 2023 08:29:21 +0000 (+0900) Subject: Apply da timestamp to mv_3d X-Git-Tag: accepted/tizen/7.0/unified/20230307.080144^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f6de9c0c87ae97935f9ef6b05a00f4a203d44d2e;p=platform%2Fcore%2Fapi%2Fmediavision.git Apply da timestamp to mv_3d [Version] 0.23.44 [Issue type] update In case of da profile, mv_source_h can be filled by buffer with timestamp. When the mv_source_h with the timestamp is given to mv_3d_run_async() an user can get the timestamp from a mv_source_h which is given through the mv_3d_depth_cb(). Change-Id: I7b9933144dded08d4163e09465d9d19423def8e5 Signed-off-by: Tae-Young Chung --- diff --git a/mv_3d/3d/src/Mv3d.cpp b/mv_3d/3d/src/Mv3d.cpp index 50bc3403..fbf6b3f5 100644 --- a/mv_3d/3d/src/Mv3d.cpp +++ b/mv_3d/3d/src/Mv3d.cpp @@ -21,7 +21,9 @@ #include #include #include - +#ifdef WITH_DA_PROFILE +#include +#endif #ifdef MV_3D_POINTCLOUD_IS_AVAILABLE #include using namespace open3d; @@ -44,6 +46,9 @@ namespace mv3d delete[] static_cast(remained->data); delete[] static_cast(remained->extraData); +#ifdef WITH_DA_PROFILE + delete static_cast(remained->timestamp); +#endif delete remained; } @@ -253,7 +258,11 @@ namespace mv3d input.stride = stride; input.format = (mWidth == width && mHeight * 2 == height) ? DFS_DATA_INPUT_FORMAT_COUPLED_TB : DFS_DATA_INPUT_FORMAT_COUPLED_SBS; - +#ifdef WITH_DA_PROFILE + da_timestamp_s *timestamp = new da_timestamp_s; + mv_source_get_timestamp(baseSource, timestamp); + input.timestamp = static_cast(timestamp); +#endif if (extraSource) { extraBuffer = nullptr; @@ -435,6 +444,17 @@ namespace mv3d auto depthData = handle->mDfsAdaptor->getOutputData(); auto leftData = handle->mDfsAdaptor->getLeftData(); +#ifdef WITH_DA_PROFILE + int ret = mv_source_fill_by_buffer_da(handle->mInternalSource, + static_cast(leftData.data), + leftData.stride * leftData.height, + leftData.width, + leftData.height, + leftData.stride, + leftData.type == DFS_DATA_TYPE_UINT8C3 ? MEDIA_VISION_COLORSPACE_RGB888 : + MEDIA_VISION_COLORSPACE_Y800, + static_cast(pInput->timestamp)); +#else int ret = mv_source_fill_by_buffer(handle->mInternalSource, static_cast(leftData.data), leftData.stride * leftData.height, @@ -442,6 +462,7 @@ namespace mv3d leftData.height, leftData.type == DFS_DATA_TYPE_UINT8C3 ? MEDIA_VISION_COLORSPACE_RGB888 : MEDIA_VISION_COLORSPACE_Y800); +#endif if (MEDIA_VISION_ERROR_NONE != ret) { LOGW("Errors were occurred during source filling %i", ret); continue; @@ -462,6 +483,9 @@ namespace mv3d #endif delete[] static_cast(pInput->data); delete[] static_cast(pInput->extraData); +#ifdef WITH_DA_PROFILE + delete static_cast(pInput->timestamp); +#endif mv_source_clear(handle->mInternalSource); } diff --git a/packaging/capi-media-vision.spec b/packaging/capi-media-vision.spec index fd442b3c..407383d3 100644 --- a/packaging/capi-media-vision.spec +++ b/packaging/capi-media-vision.spec @@ -1,6 +1,6 @@ Name: capi-media-vision Summary: Media Vision library for Tizen Native API -Version: 0.23.43 +Version: 0.23.44 Release: 0 Group: Multimedia/Framework License: Apache-2.0 and BSD-3-Clause diff --git a/test/testsuites/mv3d/depthstream_test_suite.cpp b/test/testsuites/mv3d/depthstream_test_suite.cpp index 552493b3..b597f819 100644 --- a/test/testsuites/mv3d/depthstream_test_suite.cpp +++ b/test/testsuites/mv3d/depthstream_test_suite.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -34,6 +35,9 @@ #include "mv_3d.h" #include #include +#ifdef WITH_DA_PROFILE +#include +#endif #include #include @@ -183,6 +187,19 @@ static void _depth_stereo_cb(mv_source_h source, unsigned short *depth, unsigned { auto mv3d = static_cast(user_data); +#ifdef WITH_DA_PROFILE + printf("_depth_stereo_cb: "); + da_timestamp_s timestamp; + mv_source_get_timestamp(source, ×tamp); + printf("timestamp [%"PRIu64"],\ + ts_sof[%"PRIu64"],\ + ts_aux[%"PRIu64"],\ + ts_eof[%"PRIu64"]\n", + timestamp.timestamp, + timestamp.ts_sof, + timestamp.ts_aux, + timestamp.ts_eof); +#endif cv::Mat dump(cv::Size(width, height), CV_16U); for (int y = 0; y < height; y++) { @@ -205,6 +222,17 @@ static int _vision_source_cb(vision_source_buffer_s *buffer, void *user_data) printf("_vision_source_cb: %lld ms\n", static_cast(app->stopWatch.elapsedTime().count())); + +#ifdef WITH_DA_PROFILE + mv_source_fill_by_buffer_da(app->mv_source, + buffer->planes[0].data, + buffer->resolution.width * buffer->resolution.height, + buffer->resolution.width, + buffer->resolution.height, + buffer->planes[0].align_width, + MEDIA_VISION_COLORSPACE_Y800, + static_cast(buffer->priv)); +#else for (unsigned int h = 0; h < buffer->resolution.height; h++) { memcpy(app->buffer + buffer->resolution.width * h, buffer->planes[0].data + (buffer->planes[0].align_width * h), @@ -212,6 +240,7 @@ static int _vision_source_cb(vision_source_buffer_s *buffer, void *user_data) } mv_source_fill_by_buffer(app->mv_source, app->buffer, app->imgWidth * app->imgHeight, app->imgWidth, app->imgHeight, MEDIA_VISION_COLORSPACE_Y800); +#endif if (isAsync) mv_3d_run_async(app->mv3d_handle, app->mv_source, nullptr, nullptr);