Fix build warnings
authorSeungbae Shin <seungbae.shin@samsung.com>
Thu, 8 Dec 2022 11:16:56 +0000 (20:16 +0900)
committerKwanghoon Son <k.son@samsung.com>
Wed, 14 Dec 2022 06:33:18 +0000 (15:33 +0900)
[Issue type] : build
[Version] 0.26.4

Change-Id: Ie7b0eb67be7f298e76225d93a2217d5e53fcc5b6

14 files changed:
include/mv_3d.h
mv_3d/3d/include/Mv3d.h
mv_3d/3d/include/mv_3d_open.h
mv_3d/3d/src/Mv3d.cpp
mv_3d/3d/src/mv_3d.c
mv_3d/3d/src/mv_3d_open.cpp
mv_machine_learning/inference/src/DecodeInfo.cpp
mv_machine_learning/inference/src/InputMetadata.cpp
mv_machine_learning/inference/src/OutputMetadata.cpp
mv_machine_learning/meta/src/MetaParser.cpp
mv_machine_learning/object_detection/src/objectron.cpp
packaging/capi-media-vision.spec
test/testsuites/mv3d/depth_test_suite.cpp
test/testsuites/mv3d/depthstream_test_suite.cpp

index e912ae6..b94eaec 100644 (file)
@@ -398,7 +398,7 @@ int mv_3d_run_async(mv_3d_h mv3d, mv_source_h source, mv_source_h source_extra,
  * @see mv_3d_configure()
  */
 int mv_3d_pointcloud_write_file(mv_3d_h mv3d, mv_3d_pointcloud_h pointcloud, mv_3d_pointcloud_type_e type,
-                                                               char *filename);
+                                                               const char *filename);
 
 /**
  * @}
index 54298db..e459ea9 100644 (file)
@@ -89,7 +89,7 @@ public:
 
        int SetPointcloudCallback(mv_3d_pointcloud_cb pointcloudCallback, void *pointcloudUserData);
 
-       int WritePointcloudFile(mv_3d_pointcloud_h pointcloud, mv_3d_pointcloud_type_e type, char *fileName);
+       int WritePointcloudFile(mv_3d_pointcloud_h pointcloud, mv_3d_pointcloud_type_e type, const char *fileName);
 
        int Prepare();
 
index c3adb0e..c6c432f 100644 (file)
@@ -77,7 +77,8 @@ int mv3dRunAsync(mv_3d_h mv3d, mv_source_h source, mv_source_h source_extra);
  * @brief Write Pointcloud file.
  * @since_tizen 7.0
  */
-int mv3dWritePointcloudFile(mv_3d_h mv3d, mv_3d_pointcloud_h pointcloud, mv_3d_pointcloud_type_e type, char *fileName);
+int mv3dWritePointcloudFile(mv_3d_h mv3d, mv_3d_pointcloud_h pointcloud, mv_3d_pointcloud_type_e type,
+                                                       const char *fileName);
 
 #ifdef __cplusplus
 }
index bff8f47..10b5935 100644 (file)
@@ -439,7 +439,7 @@ gpointer Mv3d::DfsThreadLoop(gpointer data)
        return nullptr;
 }
 
-int Mv3d::WritePointcloudFile(mv_3d_pointcloud_h pointcloud, mv_3d_pointcloud_type_e type, char *fileName)
+int Mv3d::WritePointcloudFile(mv_3d_pointcloud_h pointcloud, mv_3d_pointcloud_type_e type, const char *fileName)
 {
 #ifdef MV_3D_POINTCLOUD_IS_AVAILABLE
        auto s = static_cast<mv_3d_pointcloud_s *>(pointcloud);
index 3dd6c70..91f6851 100644 (file)
@@ -146,7 +146,7 @@ int mv_3d_run_async(mv_3d_h mv3d, mv_source_h source, mv_source_h source_extra,
 }
 
 int mv_3d_pointcloud_write_file(mv_3d_h mv3d, mv_3d_pointcloud_h pointcloud, mv_3d_pointcloud_type_e type,
-                                                               char *filename)
+                                                               const char *filename)
 {
        MEDIA_VISION_SUPPORT_CHECK(_mv_3d_pointcloud_check_system_info_feature_supported() &&
                                                           _mv_3d_check_system_info_feature_supported());
index fded6aa..4b3b0eb 100644 (file)
@@ -306,7 +306,8 @@ int mv3dRunAsync(mv_3d_h mv3d, mv_source_h source, mv_source_h source_extra)
        return ret;
 }
 
-int mv3dWritePointcloudFile(mv_3d_h mv3d, mv_3d_pointcloud_h pointcloud, mv_3d_pointcloud_type_e type, char *fileName)
+int mv3dWritePointcloudFile(mv_3d_h mv3d, mv_3d_pointcloud_h pointcloud, mv_3d_pointcloud_type_e type,
+                                                       const char *fileName)
 {
        LOGI("ENTER");
 
index 046fa98..3503b16 100644 (file)
@@ -187,8 +187,8 @@ int DecodeInfo::GenerateAnchor()
                                }
                                if (anchorParam.interpolatedScaleAspectRatio > 0.0f) {
                                        const float scaleNext = lastSameStrideLayer == static_cast<int>(anchorParam.strides.size()) - 1 ?
-                                                                                                       1.0f :
-                                                                                                       CalculateScale(anchorParam.minScale, anchorParam.maxScale,
+                                                                                                         1.0f :
+                                                                                                         CalculateScale(anchorParam.minScale, anchorParam.maxScale,
                                                                                                                                   lastSameStrideLayer + 1, anchorParam.strides.size());
                                        scales.push_back(std::sqrt(scale * scaleNext));
                                        aspectRatios.push_back(anchorParam.interpolatedScaleAspectRatio);
@@ -214,8 +214,8 @@ int DecodeInfo::GenerateAnchor()
                                        cv::Rect2f anchor = { cv::Point2f { (x + anchorParam.anchorOffsetX) * 1.0f / featureMapWidth,
                                                                                                                (y + anchorParam.anchorOffsetY) * 1.0f / featureMapHeight },
                                                                                  anchorParam.isFixedAnchorSize ?
-                                                                                                 cv::Size2f { 1.0f, 1.0f } :
-                                                                                                 cv::Size2f { anchorWidth[anchorId], anchorWidth[anchorId] } };
+                                                                                                       cv::Size2f { 1.0f, 1.0f } :
+                                                                                                       cv::Size2f { anchorWidth[anchorId], anchorWidth[anchorId] } };
                                        AddAnchorBox(anchor);
                                }
                        }
@@ -367,10 +367,12 @@ int DecodeInfo::GenerateYOLOAnchor()
        for (int y = 0; y < gridHeight; ++y) {
                for (int x = 0; x < gridWidth; ++x) {
                        for (int anchorPerCell = 0; anchorPerCell < maxAnchorPerCell; ++anchorPerCell) {
-                               cv::Rect2f anchor = { cv::Point2f { (static_cast<float>(x) + anchorParam.anchorOffsetX),
-                                                                                                       (static_cast<float>(y) + anchorParam.anchorOffsetY) },
-                                                                         cv::Size2f { anchorParam.vxScales[anchorPerCell] * static_cast<float>(stride),
-                                                                                                  anchorParam.vyScales[anchorPerCell] * static_cast<float>(stride) } };
+                               cv::Rect2f anchor = {
+                                       cv::Point2f { (static_cast<float>(x) + anchorParam.anchorOffsetX),
+                                                                 (static_cast<float>(y) + anchorParam.anchorOffsetY) },
+                                       cv::Size2f { static_cast<float>(anchorParam.vxScales[anchorPerCell]) * static_cast<float>(stride),
+                                                                static_cast<float>(anchorParam.vyScales[anchorPerCell]) * static_cast<float>(stride) }
+                               };
                                cal.push_back(anchor);
                        }
                }
index cb7d7c8..8d065a1 100644 (file)
@@ -189,7 +189,7 @@ int InputMetadata::Parse(JsonObject *root, std::string key_name)
        JsonArray *inputList = json_object_get_array_member(root, key_name.c_str());
        LOGI("input tensor count : %d", json_array_get_length(inputList));
 
-       for (auto idx = 0; idx < json_array_get_length(inputList); ++idx) {
+       for (guint idx = 0; idx < json_array_get_length(inputList); ++idx) {
                JsonNode *node = json_array_get_element(inputList, idx);
                std::string token(json_to_string(node, 1));
                int pos = token.find(":");
index 7fd2e22..6fa915c 100644 (file)
@@ -224,7 +224,7 @@ int OutputMetadata::Parse(JsonObject *root, std::string key_name)
 
        LOGI("output tensor count = %d", json_array_get_length(outputList));
 
-       for (auto idx = 0; idx < json_array_get_length(outputList); ++idx) {
+       for (guint idx = 0; idx < json_array_get_length(outputList); ++idx) {
                JsonNode *output_node = json_array_get_element(outputList, idx);
                std::string token(json_to_string(output_node, 1));
                int pos = token.find(":");
index 58aafbd..2da31fc 100644 (file)
@@ -166,7 +166,7 @@ void MetaParser::parseTensor(JsonObject *in_obj, const char *node_name)
 
        MetaMap &metaMap = string("input").compare(node_name) == 0 ? _inputMetaMap : _outputMetaMap;
 
-       for (auto idx = 0; idx < json_array_get_length(inputList); ++idx) {
+       for (guint idx = 0; idx < json_array_get_length(inputList); ++idx) {
                JsonNode *node = json_array_get_element(inputList, idx);
                string token(json_to_string(node, 1));
                int pos = token.find(":");
index ce2d94e..a02ec68 100644 (file)
@@ -123,7 +123,7 @@ object_detection_3d_result_s &Objectron::getResult()
                auto metaInfo = _parser->getOutputMetaMap()["Identity_1"];
                auto decodingBox = static_pointer_cast<DecodingBox>(metaInfo->decodingTypeMap[DecodingType::BOX]);
 
-               for (auto idx = 0; idx < decodingBox->edges.size(); idx += 2)
+               for (size_t idx = 0; idx < decodingBox->edges.size(); idx += 2)
                        _result.edge_index_vec.push_back({ decodingBox->edges[idx], decodingBox->edges[idx + 1] });
 
                _result.number_of_edges = decodingBox->edges.size();
index ca35f79..ef22857 100644 (file)
@@ -1,6 +1,6 @@
 Name:        capi-media-vision
 Summary:     Media Vision library for Tizen Native API
-Version:     0.26.3
+Version:     0.26.4
 Release:     0
 Group:       Multimedia/Framework
 License:     Apache-2.0 and BSD-3-Clause
index 5431c52..a29a50c 100644 (file)
@@ -129,6 +129,7 @@ static void WriteFilePFM(unsigned short *data, int width, int height, const char
        fclose(stream);
 }
 
+#if BUILD_VISUALIZER
 // translate value x in [0..1] into color triplet using "jet" color map
 // if out of range, use darker colors
 // variation of an idea by http://www.metastine.com/?p=7
@@ -143,6 +144,7 @@ static void jet(float x, int &r, int &g, int &b)
        g = __max(0, __min(255, (int) (round(255 * (1.5 - 4 * fabs(x - .5))))));
        b = __max(0, __min(255, (int) (round(255 * (1.5 - 4 * fabs(x - .25))))));
 }
+#endif
 
 static void WriteFilePNG(unsigned short *data, int width, int height, const char *filename, float minDisp,
                                                 float maxDisp, float depth2Disp, int distanceMode)
@@ -198,6 +200,7 @@ static void SendDataToRemoteUrl(unsigned short *data, int width, int height, flo
 #endif
 }
 
+#if 0 // FIXME: Not in USE
 static void WritePLY(double *data, int size, const char *filename)
 {
        std::ofstream stream(filename, std::ofstream::out);
@@ -216,6 +219,7 @@ static void WritePLY(double *data, int size, const char *filename)
 
        return;
 }
+#endif
 
 static void _depth_middlebury_cb(mv_source_h source, unsigned short *depth, unsigned int width, unsigned int height,
                                                                 void *user_data)
@@ -308,7 +312,7 @@ int perform_middlebury_test()
                        printf("Incorrect! Try again.\n");
                }
        } else {
-               while (sel_distance <= 0 || sel_distance > ARRAY_SIZE(distances)) {
+               while (sel_distance <= 0 || sel_distance > static_cast<int>(ARRAY_SIZE(distances))) {
                        sel_distance = show_menu_linear("Select Action", distances, ARRAY_SIZE(distances));
                }
        }
index 9d376f7..ee20920 100644 (file)
@@ -153,10 +153,10 @@ static void _depth_stereo_remote_cb(mv_source_h source, unsigned short *depth, u
 {
        auto mv3d = static_cast<appdata *>(user_data);
 
-       for (int y = 0; y < height; y++) {
+       for (unsigned int y = 0; y < height; y++) {
                unsigned short *src = depth + y * width;
                unsigned char *dst = mv3d->remoteData.buffer + y * (width * 4);
-               for (int x = 0; x < width; x++) {
+               for (unsigned int x = 0; x < width; x++) {
                        float value =
                                        TRANSLATE_VAL(((440.92750f * 21.87095f / static_cast<float>(src[x])) - 8.0f) / (88.f /*96-8*/));
                        dst[x * 4] = COLORMAP_JET_R(value);
@@ -180,9 +180,9 @@ static void _depth_stereo_cb(mv_source_h source, unsigned short *depth, unsigned
 
        cv::Mat dump(cv::Size(width, height), CV_16U);
 
-       for (int y = 0; y < height; y++) {
+       for (unsigned int y = 0; y < height; y++) {
                unsigned short *ptr = depth + y * width;
-               for (int x = 0; x < width; x++) {
+               for (unsigned int x = 0; x < width; x++) {
                        dump.at<unsigned short>(y, x) =
                                        static_cast<unsigned short>(440.92750f * 21.87095f / static_cast<float>(ptr[x]));
                }
@@ -253,7 +253,8 @@ int main(int argc, char *argv[])
        printf("enter main\n");
 
        vision_source_format_s format { .pixel_format = VISION_SOURCE_PIXEL_FORMAT_NV12,
-                                                                       .resolution = { camWidth << 1, camHeight },
+                                                                       .resolution = { static_cast<unsigned int>(camWidth << 1),
+                                                                                                       static_cast<unsigned int>(camHeight) },
                                                                        .fps = 10,
                                                                        .quality = 0,
                                                                        .bitrate = 0 };