Browse Source

fix the header file sorting problem in the master branch code view and fix resize overflow

tags/v1.6.0
liu-yongqi-63 4 years ago
parent
commit
218db63c9e
9 changed files with 42 additions and 25 deletions
  1. +1
    -1
      mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.cc
  2. +1
    -1
      mindspore/ccsrc/minddata/dataset/engine/datasetops/source/div2k_op.cc
  3. +1
    -1
      mindspore/ccsrc/minddata/dataset/engine/datasetops/source/flickr_op.cc
  4. +4
    -4
      mindspore/ccsrc/minddata/dataset/engine/datasetops/source/text_file_op.cc
  5. +2
    -2
      mindspore/ccsrc/minddata/dataset/engine/datasetops/source/tf_reader_op.cc
  6. +1
    -1
      mindspore/ccsrc/minddata/dataset/engine/datasetops/source/usps_op.cc
  7. +1
    -1
      mindspore/ccsrc/minddata/dataset/engine/datasetops/source/voc_op.cc
  8. +30
    -13
      mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/image_process.cc
  9. +1
    -1
      mindspore/ccsrc/minddata/dataset/kernels/py_func_op.cc

+ 1
- 1
mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.cc View File

@@ -16,8 +16,8 @@
#include "minddata/dataset/engine/datasetops/rename_op.h"

#include <set>
#include <vector>
#include <unordered_map>
#include <vector>

#include "minddata/dataset/core/config_manager.h"
#include "minddata/dataset/util/log_adapter.h"


+ 1
- 1
mindspore/ccsrc/minddata/dataset/engine/datasetops/source/div2k_op.cc View File

@@ -21,11 +21,11 @@
#include <set>
#include <utility>

#include "utils/file_utils.h"
#include "minddata/dataset/core/config_manager.h"
#include "minddata/dataset/core/tensor_shape.h"
#include "minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h"
#include "minddata/dataset/engine/execution_tree.h"
#include "utils/file_utils.h"
#include "utils/ms_utils.h"

namespace mindspore {


+ 1
- 1
mindspore/ccsrc/minddata/dataset/engine/datasetops/source/flickr_op.cc View File

@@ -20,11 +20,11 @@
#include <set>
#include <utility>

#include "utils/file_utils.h"
#include "minddata/dataset/core/config_manager.h"
#include "minddata/dataset/core/tensor_shape.h"
#include "minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h"
#include "minddata/dataset/engine/execution_tree.h"
#include "utils/file_utils.h"
#include "utils/ms_utils.h"

namespace mindspore {


+ 4
- 4
mindspore/ccsrc/minddata/dataset/engine/datasetops/source/text_file_op.cc View File

@@ -20,13 +20,13 @@
#include <string>
#include <utility>

#include "utils/file_utils.h"
#include "minddata/dataset/engine/datasetops/source/text_file_op.h"
#include "minddata/dataset/core/config_manager.h"
#include "minddata/dataset/util/wait_post.h"
#include "minddata/dataset/util/random.h"
#include "minddata/dataset/engine/datasetops/source/io_block.h"
#include "minddata/dataset/engine/datasetops/source/text_file_op.h"
#include "minddata/dataset/engine/execution_tree.h"
#include "minddata/dataset/util/random.h"
#include "minddata/dataset/util/wait_post.h"
#include "utils/file_utils.h"

namespace mindspore {
namespace dataset {


+ 2
- 2
mindspore/ccsrc/minddata/dataset/engine/datasetops/source/tf_reader_op.cc View File

@@ -24,8 +24,6 @@
#include <utility>
#include <vector>

#include "utils/file_utils.h"
#include "proto/example.pb.h"
#include "minddata/dataset/core/config_manager.h"
#include "minddata/dataset/core/global_context.h"
#include "minddata/dataset/engine/data_schema.h"
@@ -35,6 +33,8 @@
#include "minddata/dataset/util/status.h"
#include "minddata/dataset/util/task_manager.h"
#include "minddata/dataset/util/wait_post.h"
#include "proto/example.pb.h"
#include "utils/file_utils.h"
#include "utils/system/crc32c.h"

namespace mindspore {


+ 1
- 1
mindspore/ccsrc/minddata/dataset/engine/datasetops/source/usps_op.cc View File

@@ -21,11 +21,11 @@
#include <set>
#include <utility>

#include "utils/file_utils.h"
#include "minddata/dataset/core/config_manager.h"
#include "minddata/dataset/core/tensor_shape.h"
#include "minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h"
#include "minddata/dataset/engine/execution_tree.h"
#include "utils/file_utils.h"
#include "utils/ms_utils.h"

namespace mindspore {


+ 1
- 1
mindspore/ccsrc/minddata/dataset/engine/datasetops/source/voc_op.cc View File

@@ -18,11 +18,11 @@
#include <algorithm>
#include <fstream>

#include "utils/file_utils.h"
#include "minddata/dataset/core/config_manager.h"
#include "minddata/dataset/core/tensor_shape.h"
#include "minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h"
#include "minddata/dataset/engine/execution_tree.h"
#include "utils/file_utils.h"
#include "utils/ms_utils.h"

namespace mindspore {


+ 30
- 13
mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/image_process.cc View File

@@ -49,11 +49,11 @@ constexpr int32_t kB2R = kV2R * 128 + kY2GB;

static bool Equal(const float &a, const float &b) { return std::fabs(a - b) < 1e-6; }

static inline void InitBilinearWeight(int *data_ptr, int16_t *weight_ptr, double scale, int dst_length, int src_length,
static inline bool InitBilinearWeight(int *data_ptr, int16_t *weight_ptr, double scale, int dst_length, int src_length,
int a) {
const int RESIZE_SCALE = 1 << 11;
if (data_ptr == nullptr || weight_ptr == nullptr) {
return;
return false;
}

int *data_start_ptr = data_ptr;
@@ -78,15 +78,19 @@ static inline void InitBilinearWeight(int *data_ptr, int16_t *weight_ptr, double
weight_start_ptr[i * 2] = t0;
weight_start_ptr[i * 2 + 1] = t1;
}
return true;
}

static void ResizeBilinear3C(const unsigned char *src, int src_width, int src_height, unsigned char *dst, int dst_width,
static bool ResizeBilinear3C(const unsigned char *src, int src_width, int src_height, unsigned char *dst, int dst_width,
int dst_height) {
double scale_width = static_cast<double>(src_width) / dst_width;
double scale_height = static_cast<double>(src_height) / dst_height;

if (dst_height >= (INT_MAX / 2 - dst_width)) {
return;
return false;
}
if (dst_height >= (INT_MAX / 3 / dst_width)) {
return false;
}
int *data_buf = new int[2 * dst_width + 2 * dst_height];

@@ -96,8 +100,12 @@ static void ResizeBilinear3C(const unsigned char *src, int src_width, int src_he
int16_t *x_weight = reinterpret_cast<int16_t *>(data_buf + dst_width + dst_height);
int16_t *y_weight = reinterpret_cast<int16_t *>(x_weight + dst_width);

InitBilinearWeight(x_offset, x_weight, scale_width, dst_width, src_width, 3);
InitBilinearWeight(y_offset, y_weight, scale_height, dst_height, src_height, 1);
if (!InitBilinearWeight(x_offset, x_weight, scale_width, dst_width, src_width, 3)) {
return false;
}
if (!InitBilinearWeight(y_offset, y_weight, scale_height, dst_height, src_height, 1)) {
return false;
}

LiteMat x_tmp_buf0(dst_width * 3 + 1, LDataType::UINT16);
LiteMat x_tmp_buf1(dst_width * 3 + 1, LDataType::UINT16);
@@ -160,16 +168,21 @@ static void ResizeBilinear3C(const unsigned char *src, int src_width, int src_he
y_weight += 2;
}
delete[] data_buf;
return true;
}

static void ResizeBilinear1C(const unsigned char *src, int src_width, int src_height, unsigned char *dst, int dst_width,
static bool ResizeBilinear1C(const unsigned char *src, int src_width, int src_height, unsigned char *dst, int dst_width,
int dst_height) {
double scale_width = static_cast<double>(src_width) / dst_width;
double scale_height = static_cast<double>(src_height) / dst_height;

if (dst_height >= (INT_MAX / 2 - dst_width)) {
return;
return false;
}
if (dst_height >= (INT_MAX / dst_width)) {
return false;
}

int *data_buf = new int[2 * dst_width + 2 * dst_height];

int *x_offset = data_buf;
@@ -178,8 +191,12 @@ static void ResizeBilinear1C(const unsigned char *src, int src_width, int src_he
int16_t *x_weight = reinterpret_cast<int16_t *>(data_buf + dst_width + dst_height);
int16_t *y_weight = reinterpret_cast<int16_t *>(x_weight + dst_width);

InitBilinearWeight(x_offset, x_weight, scale_width, dst_width, src_width, 1);
InitBilinearWeight(y_offset, y_weight, scale_height, dst_height, src_height, 1);
if (!InitBilinearWeight(x_offset, x_weight, scale_width, dst_width, src_width, 1)) {
return false;
}
if (!InitBilinearWeight(y_offset, y_weight, scale_height, dst_height, src_height, 1)) {
return false;
}

LiteMat x_tmp_buf0(dst_width, LDataType::UINT16);
LiteMat x_tmp_buf1(dst_width, LDataType::UINT16);
@@ -239,6 +256,7 @@ static void ResizeBilinear1C(const unsigned char *src, int src_width, int src_he
y_weight += 2;
}
delete[] data_buf;
return true;
}

static inline uint8_t clip(float value) {
@@ -392,13 +410,12 @@ bool ResizeBilinear(const LiteMat &src, LiteMat &dst, int dst_w, int dst_h) {
if (src.channel_ == 3) {
const unsigned char *src_start_p = src;
unsigned char *dst_start_p = dst;
(void)ResizeBilinear3C(src_start_p, src.width_, src.height_, dst_start_p, dst_w, dst_h);
return ResizeBilinear3C(src_start_p, src.width_, src.height_, dst_start_p, dst_w, dst_h);
} else { // channel == 1
const unsigned char *src_start_p = src;
unsigned char *dst_start_p = dst;
(void)ResizeBilinear1C(src_start_p, src.width_, src.height_, dst_start_p, dst_w, dst_h);
return ResizeBilinear1C(src_start_p, src.width_, src.height_, dst_start_p, dst_w, dst_h);
}
return true;
}

static bool ConvertBGR(const unsigned char *data, LDataType data_type, int w, int h, LiteMat &mat) {


+ 1
- 1
mindspore/ccsrc/minddata/dataset/kernels/py_func_op.cc View File

@@ -19,8 +19,8 @@
#include <vector>

#include "minddata/dataset/core/tensor.h"
#include "minddata/dataset/kernels/tensor_op.h"
#include "minddata/dataset/kernels/ir/data/transforms_ir.h"
#include "minddata/dataset/kernels/tensor_op.h"
#include "minddata/dataset/util/status.h"
#include "minddata/dataset/util/validators.h"



Loading…
Cancel
Save