Kaynağa Gözat

Make windows happy.

jcsyshc 2 yıl önce
ebeveyn
işleme
c40d54b101
3 değiştirilmiş dosya ile 20 ekleme ve 3 silme
  1. 1 1
      src/config.h
  2. 11 0
      src/raw_file_saver.cpp
  3. 8 2
      src/third_party/rs.c

+ 1 - 1
src/config.h

@@ -20,7 +20,7 @@ static constexpr auto right_camera_name = "RightEye";
 
 static constexpr auto default_len_focus = 8; // 8mm, maybe not useful
 
-static constexpr auto default_camera_exposure_time_ms = 5; // 5ms
+static constexpr auto default_camera_exposure_time_ms = 7; // 5ms
 static constexpr auto default_camera_analog_gain = 20; // 20dB
 static constexpr auto default_camera_fps = 30; // 30 fps
 

+ 11 - 0
src/raw_file_saver.cpp

@@ -66,7 +66,11 @@ struct raw_file_saver::impl {
     void handle_file(const file_info &info) {
         static constexpr auto block_size = 512 * 1024; // 512KiB
         auto save_file_path = prefix_path / info.file_name;
+#ifdef _MSC_VER
+        auto file = _wfopen(save_file_path.c_str(), L"wb");
+#else
         auto file = fopen(save_file_path.c_str(), "wb");
+#endif
         assert(file != nullptr);
         auto block_cnt = info.length / block_size;
         auto write_cnt = fwrite(info.data, block_size, block_cnt, file);
@@ -82,7 +86,14 @@ struct raw_file_saver::impl {
     void handle_image(const image_info &info) {
         auto img = cv::Mat{info.height, info.width, info.cv_type, info.data};
         auto save_file_path = prefix_path / info.file_name;
+#ifdef _MSC_VER
+        static constexpr size_t max_file_path_length = 256;
+        static char file_path_buf[max_file_path_length];
+        std::wcstombs(file_path_buf, save_file_path.c_str(), max_file_path_length);
+        cv::imwrite(file_path_buf, img);
+#else
         cv::imwrite(save_file_path, img);
+#endif
         free(info.data);
     }
 

+ 8 - 2
src/third_party/rs.c

@@ -169,9 +169,15 @@ modnn(int x)
  * A value related to the multiplication is held in a local variable
  * declared with USE_GF_MULC . See usage in addmul1().
  */
-_Alignas(16) static gf gf_mul_table[(GF_SIZE + 1)*(GF_SIZE + 1)];
 
-#define gf_mul(x,y) gf_mul_table[(x<<8)+y]
+#ifdef _MSC_VER
+__declspec(align(16))
+#else
+_Alignas(16)
+#endif
+static gf gf_mul_table[(GF_SIZE + 1) * (GF_SIZE + 1)];
+
+#define gf_mul(x, y) gf_mul_table[(x<<8)+y]
 
 #define USE_GF_MULC register gf * __gf_mulc_
 #define GF_MULC0(c) __gf_mulc_ = &gf_mul_table[(c)<<8]