From: Tae-Young Chung Date: Mon, 24 Apr 2023 07:05:29 +0000 (+0900) Subject: mv_3d: fix bug which gives a base source regardless formats when mv_3d_run() invokes... X-Git-Tag: accepted/tizen/unified/20230628.155148^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=db044e5af52e7183c0803f806a3e5cd7b883f41e;p=platform%2Fcore%2Fapi%2Fmediavision.git mv_3d: fix bug which gives a base source regardless formats when mv_3d_run() invokes callback [Version] 0.28.2 [Issue type] bug fix in case of side-by-side or top-bottom stereo format is given as a base source, the only left should be invoked with a callback. Change-Id: I568df71fc8e20780fd612bdabf2978f1546e65c6 Signed-off-by: Tae-Young Chung --- diff --git a/mv_3d/3d/src/Mv3d.cpp b/mv_3d/3d/src/Mv3d.cpp index 27d7b7c4..c3f9a81e 100644 --- a/mv_3d/3d/src/Mv3d.cpp +++ b/mv_3d/3d/src/Mv3d.cpp @@ -321,21 +321,33 @@ int Mv3d::Run(mv_source_h baseSource, mv_source_h extraSource) mDfsAsyncQueue = nullptr; } - if (mInternalSource) { - int ret = mv_destroy_source(mInternalSource); - if (ret != MEDIA_VISION_ERROR_NONE) { - LOGE("Fail to destroy intern source. But keep going.."); - } - mInternalSource = nullptr; - } - GetDfsDataFromSources(baseSource, extraSource, input); mDfsAdaptor->run(input); auto depthData = mDfsAdaptor->getOutputData(); - - mDepthCallback(baseSource, static_cast(depthData.data), depthData.width, depthData.height, - mDepthUserData); + if (input.format != DFS_DATA_INPUT_FORMAT_DECOUPLED_SBS) { + if (!mInternalSource) { + int ret = mv_create_source(&mInternalSource); + if (ret != MEDIA_VISION_ERROR_NONE) { + LOGE("Fail to create internal source"); + return MEDIA_VISION_ERROR_INTERNAL; + } + } + auto leftData = mDfsAdaptor->getLeftData(); + auto ret = mv_source_fill_by_buffer(mInternalSource, static_cast(leftData.data), + leftData.stride * leftData.height, leftData.width, leftData.height, + leftData.type == DFS_DATA_TYPE_UINT8C3 ? + MEDIA_VISION_COLORSPACE_RGB888 : + MEDIA_VISION_COLORSPACE_Y800); + if (MEDIA_VISION_ERROR_NONE != ret) { + LOGE("Errors were occurred during source filling %i, but continue", ret); + } + mDepthCallback(mInternalSource, static_cast(depthData.data), depthData.width, + depthData.height, mDepthUserData); + } else { + mDepthCallback(baseSource, static_cast(depthData.data), depthData.width, depthData.height, + mDepthUserData); + } #ifdef MV_3D_POINTCLOUD_IS_AVAILABLE if (mPointcloudCallback) { mv_3d_pointcloud_s p { .type = MV_3D_POINTCLOUD_TYPE_PCD_BIN, @@ -346,6 +358,7 @@ int Mv3d::Run(mv_source_h baseSource, mv_source_h extraSource) #endif delete[] static_cast(input.data); delete[] static_cast(input.extraData); + mv_source_clear(mInternalSource); } catch (const std::exception &e) { LOGE("Failed to Run with %s", e.what()); return MEDIA_VISION_ERROR_INVALID_OPERATION;