• 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_DECODE_RESIZE_JPEG_OP_H
18 #define MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_DVPP_DECODE_RESIZE_JPEG_OP_H
19 
20 #include <memory>
21 #include <string>
22 #include <vector>
23 
24 #include "acl/acl.h"
25 #include "mindspore/core/utils/log_adapter.h"
26 #include "minddata/dataset/core/data_type.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 
35 namespace mindspore {
36 namespace dataset {
37 class DvppDecodeResizeJpegOp : public TensorOp {
38  public:
DvppDecodeResizeJpegOp(int32_t resized_height,int32_t resized_width)39   DvppDecodeResizeJpegOp(int32_t resized_height, int32_t resized_width)
40       : resized_height_(resized_height), resized_width_(resized_width) {}
41 
42   /// \brief Destructor
43   ~DvppDecodeResizeJpegOp() = default;
44 
45   Status Compute(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output) override;
46 
47   Status Compute(const std::shared_ptr<DeviceTensor> &input, std::shared_ptr<DeviceTensor> *output) override;
48 
49   Status OutputShape(const std::vector<TensorShape> &inputs, std::vector<TensorShape> &outputs) override;
50 
Name()51   std::string Name() const override { return kDvppDecodeResizeJpegOp; }
52 
53   Status SetAscendResource(const std::shared_ptr<DeviceResource> &resource) override;
54 
55  private:
56   int32_t resized_height_;
57   int32_t resized_width_;
58 
59   std::shared_ptr<MDAclProcess> processor_;
60 };
61 }  // namespace dataset
62 }  // namespace mindspore
63 
64 #endif  // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_DVPP_DECODE_RESIZE_JPEG_OP_H
65