Program Listing for File vision_ascend.h

Return to documentation for file (include/runtime/include/dataset/vision_ascend.h)

#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_VISION_ASCEND_H_
#define MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_VISION_ASCEND_H_

#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>

#include "include/api/status.h"
#include "include/dataset/constants.h"
#include "include/dataset/transforms.h"

namespace mindspore {
namespace dataset {
// Transform operations for performing computer vision.
namespace vision {
/* ##################################### API class ###########################################*/

class DATASET_API DvppDecodeResizeJpeg final : public TensorTransform {
 public:
  explicit DvppDecodeResizeJpeg(const std::vector<uint32_t> &resize);

  ~DvppDecodeResizeJpeg() = default;

 protected:
  std::shared_ptr<TensorOperation> Parse() override;

  std::shared_ptr<TensorOperation> Parse(const MapTargetDevice &env) override;

 private:
  struct Data;
  std::shared_ptr<Data> data_;
};

class DATASET_API DvppDecodeResizeCropJpeg final : public TensorTransform {
 public:
  DvppDecodeResizeCropJpeg(const std::vector<uint32_t> &crop, const std::vector<uint32_t> &resize);

  ~DvppDecodeResizeCropJpeg() = default;

 protected:
  std::shared_ptr<TensorOperation> Parse() override;

  std::shared_ptr<TensorOperation> Parse(const MapTargetDevice &env) override;

 private:
  struct Data;
  std::shared_ptr<Data> data_;
};

class DATASET_API DvppDecodeVideo final : public TensorTransform {
 public:

  DvppDecodeVideo(const std::vector<uint32_t> &size, VdecStreamFormat type,
                  VdecOutputFormat out_format = VdecOutputFormat::kYuvSemiplanar420,
                  const std::string &output = "./output")
      : DvppDecodeVideo(size, type, out_format, StringToChar(output)) {}


  DvppDecodeVideo(const std::vector<uint32_t> &size, VdecStreamFormat type, const std::string &output = "./output")
      : DvppDecodeVideo(size, type, VdecOutputFormat::kYuvSemiplanar420, StringToChar(output)) {}

  DvppDecodeVideo(const std::vector<uint32_t> &size, VdecStreamFormat type, VdecOutputFormat out_format,
                  const std::vector<char> &output);

  ~DvppDecodeVideo() = default;

 protected:
  std::shared_ptr<TensorOperation> Parse() override;

  std::shared_ptr<TensorOperation> Parse(const MapTargetDevice &env) override;

 private:
  struct Data;
  std::shared_ptr<Data> data_;
};

class DATASET_API DvppDecodePng final : public TensorTransform {
 public:
  DvppDecodePng();

  ~DvppDecodePng() = default;

 protected:
  std::shared_ptr<TensorOperation> Parse() override;

  std::shared_ptr<TensorOperation> Parse(const MapTargetDevice &env) override;
};
}  // namespace vision
}  // namespace dataset
}  // namespace mindspore

#endif  // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_VISION_ASCEND_H_