1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef IMAGE_PROCESSING_UTILS_H 17 #define IMAGE_PROCESSING_UTILS_H 18 19 #include "pixelmap_native_impl.h" 20 #include "surface_buffer.h" 21 22 #include "algorithm_errors.h" 23 #include "image_processing_types.h" 24 25 namespace OHOS { 26 namespace Media { 27 namespace VideoProcessingEngine { 28 class ImageProcessingUtils { 29 public: 30 static ImageProcessing_ErrorCode InnerErrorToCAPI(VPEAlgoErrCode errorCode); 31 static std::string ToString(ImageProcessing_ErrorCode errorCode); 32 static sptr<SurfaceBuffer> GetSurfaceBufferFromPixelMap(const std::shared_ptr<OHOS::Media::PixelMap>& pixelmap); 33 static ImageProcessing_ErrorCode ConvertPixelmapToSurfaceBuffer( 34 const std::shared_ptr<OHOS::Media::PixelMap>& pixelmap, sptr<SurfaceBuffer> bufferImpl); 35 static ImageProcessing_ErrorCode ConvertSurfaceBufferToPixelmap(const sptr<SurfaceBuffer>& buffer, 36 std::shared_ptr<OHOS::Media::PixelMap>& pixelmap); 37 static ImageProcessing_ErrorCode SetSurfaceBufferToPixelMap(const sptr<SurfaceBuffer>& buffer, 38 std::shared_ptr<OHOS::Media::PixelMap>& pixelmap); 39 }; 40 } // namespace VideoProcessingEngine 41 } // namespace Media 42 } // namespace OHOS 43 44 #endif // IMAGE_PROCESSING_UTILS_H