/* * Copyright (c) Hisilicon Technologies Co., Ltd. 2021-2023. All rights reserved. * Description: ImageTarget for output * Author: Hisilicon * Created: 2021.04.16 */ #ifndef IMAGEKIT_IMAGE_TARGET_H #define IMAGEKIT_IMAGE_TARGET_H #include #include "ImageBuf.h" #include "ImageTexture.h" namespace PhoenixImage { /* * * @brief Image Render target class. . */ class ImageTarget : public ImageTexture { public: /** * @brief ImageTexture constructor, generate fbo internal. * @param [in] imageTexture: The ImageTexture bind to the fbo. */ ImageTarget(BufHolder *buFHolder, int32_t width, int32_t height); /** * @brief ImageTexture constructor, using external fbo. * @param [in] imageTexture: The ImageTexture bind to the fbo. * @param [in] framebuffer: The fbo generated outside. */ ImageTarget(uint32_t tex, uint32_t textureTarget, int32_t width, int32_t height, uint32_t framebuffer); /** * @brief ImageTexture destructor. */ ~ImageTarget(); /** * @brief acquires the most recently putted buffer by BufHolder, and sets the image contents of the target * framebuffer to it . */ int32_t UpdateTargetImage(); /** * @brief increase reference count_ of the object. */ void IncRef() { count_.fetch_add(1, std::memory_order_relaxed); } /** * @brief decrease reference count_ of the object, the object will be freed if reference count_ is 0. */ size_t DecRef() { return count_.fetch_sub(1, std::memory_order_acq_rel); } protected: mutable std::atomic_size_t count_; uint32_t frameBuffer_; bool needFreeFBO_; }; } /* namespace PhoenixImage */ #endif