• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2021 Huawei Technologies Co., Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_DVPP_RESIZE_JPEG_OP_H
18 #define MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_DVPP_RESIZE_JPEG_OP_H
19 
20 #include <memory>
21 #include <string>
22 #include <vector>
23 
24 #include "acl/acl.h"
25 #include "minddata/dataset/core/data_type.h"
26 #include "minddata/dataset/core/device_tensor.h"
27 #include "minddata/dataset/core/device_resource.h"
28 #include "minddata/dataset/core/tensor.h"
29 #include "minddata/dataset/kernels/image/dvpp/utils/ErrorCode.h"
30 #include "minddata/dataset/kernels/image/dvpp/utils/MDAclProcess.h"
31 #include "minddata/dataset/kernels/image/dvpp/utils/ResourceManager.h"
32 #include "minddata/dataset/kernels/tensor_op.h"
33 #include "minddata/dataset/util/status.h"
34 #include "mindspore/core/utils/log_adapter.h"
35 
36 namespace mindspore {
37 namespace dataset {
38 class DvppResizeJpegOp : public TensorOp {
39  public:
DvppResizeJpegOp(int32_t resized_height,int32_t resized_width)40   DvppResizeJpegOp(int32_t resized_height, int32_t resized_width)
41       : resized_height_(resized_height), resized_width_(resized_width) {}
42 
43   /// \brief Destructor
44   ~DvppResizeJpegOp() = default;
45 
46   Status Compute(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output) override;
47 
48   Status Compute(const std::shared_ptr<DeviceTensor> &input, std::shared_ptr<DeviceTensor> *output) override;
49 
50   Status OutputShape(const std::vector<TensorShape> &inputs, std::vector<TensorShape> &outputs) override;
51 
Name()52   std::string Name() const override { return kDvppDecodeResizeJpegOp; }
53 
54   Status SetAscendResource(const std::shared_ptr<DeviceResource> &resource) override;
55 
56  private:
57   int32_t resized_height_;
58   int32_t resized_width_;
59 
60   std::shared_ptr<MDAclProcess> processor_;
61 };
62 }  // namespace dataset
63 }  // namespace mindspore
64 
65 #endif  // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_DVPP_RESIZE_JPEG_OP_H
66