gcov: Remove un-used code and exclude case
authorKwanghoon Son <k.son@samsung.com>
Wed, 20 Dec 2023 04:19:09 +0000 (13:19 +0900)
committerKwanghoon Son <k.son@samsung.com>
Wed, 27 Dec 2023 03:22:49 +0000 (12:22 +0900)
Change-Id: Ica4496ab1e8102bd8b60e7d1b9cc468d586d427f
Signed-off-by: Kwanghoon Son <k.son@samsung.com>
mv_3d/3d/src/Mv3d.cpp
mv_common/include/MediaSource.h
mv_common/src/MediaSource.cpp
mv_common/src/mv_common.cpp

index b0df0fa..c1c960c 100644 (file)
@@ -34,6 +34,7 @@ namespace mediavision
 {
 namespace mv3d
 {
+// LCOV_EXCL_START
 static void __destroyNotifyCb(gpointer data)
 {
        if (!data)
@@ -47,6 +48,7 @@ static void __destroyNotifyCb(gpointer data)
 
        delete remained;
 }
+// LCOV_EXCL_STOP
 
 Mv3d::Mv3d()
                : mDfsParameter()
@@ -206,6 +208,7 @@ void Mv3d::GetBufferFromSource(mv_source_h source, unsigned char *&buffer, unsig
        height = mediaSource->getHeight();
        stride = mediaSource->getWidthStride();
 
+       // LCOV_EXCL_START
        switch (mediaSource->getColorspace()) {
        case MEDIA_VISION_COLORSPACE_RGB888:
                type = DFS_DATA_TYPE_UINT8C3;
@@ -220,6 +223,7 @@ void Mv3d::GetBufferFromSource(mv_source_h source, unsigned char *&buffer, unsig
        default: //NOT tested
                throw std::runtime_error("invalid color space");
        }
+       // LCOV_EXCL_STOP
 
        if (width != stride && type == DFS_DATA_TYPE_UINT8C1) {
                //copy only Y channel
index 50cd369..c640760 100644 (file)
@@ -59,21 +59,6 @@ public:
        virtual ~MediaSource();
 
        /**
-        * @brief Allocates the buffer on the MediaSource
-        *
-        * @since_tizen 5.5
-        * @param [in] bufferSize   The buffer size
-        * @param [in] width        The image width
-        * @param [in] height       The image height
-        * @param [in] colorspace   The image colorspace
-        * @return true if alloc process is ok. Otherwise return false.
-        *
-        * @see MediaSource::MediaSource()
-        * @see MediaSource::fill()
-        */
-       bool alloc(unsigned int bufferSize, unsigned int width, unsigned int height, mv_colorspace_e colorspace);
-
-       /**
         * @brief   Clears the MediaSource.
         * @details Releases all internal resources and set parameters to default values.
         *
@@ -102,25 +87,6 @@ public:
                          mv_colorspace_e colorspace);
 
        /**
-        * @brief Fills the MediaSource based on the buffer and metadata.
-        *
-        * @since_tizen 5.5
-        * @remarks Allocate m_pBuffer by MediaSource::alloc(). This doesn't allocate buffer.
-        * @param [in] buffer       The buffer of image data
-        * @param [in] bufferSize   The buffer size
-        * @param [in] width        The image width
-        * @param [in] height       The image height
-        * @param [in] offset       The offset of memory where buffer is filled.
-        * @return true if filled process is ok. Otherwise return false.
-        *
-        * @see MediaSource::alloc()
-        * @see MediaSource::MediaSource()
-        * @see MediaSource::clear()
-        */
-       bool fill(const unsigned char *buffer, unsigned int bufferSize, unsigned int width, unsigned int height,
-                         size_t offset);
-
-       /**
         * @brief Gets data buffer of the MediaSource.
         *
         * @since_tizen 2.4
index 3c8fa66..e5acfa4 100644 (file)
@@ -31,45 +31,6 @@ MediaSource::~MediaSource()
        clear();
 }
 
-bool MediaSource::alloc(unsigned int bufferSize, unsigned int width, unsigned int height, mv_colorspace_e colorspace)
-{
-       if (bufferSize == 0)
-               return false;
-
-       LOGD("Call clear() first for media source %p", this);
-       clear();
-
-       Plane plane;
-       auto &pBuffer = plane.buffer;
-       auto &pImageSize = plane.imageSize;
-
-       pBuffer = new (std::nothrow) unsigned char[bufferSize];
-       if (pBuffer == NULL) {
-               LOGE("Memory allocating for buffer in media source %p failed!", this);
-               return false;
-       }
-
-       LOGD("Assign new size of the internal buffer of media source %p. "
-                "New size is %ui.",
-                this, bufferSize);
-       pImageSize = bufferSize;
-
-       LOGD("Assign new size (%ui x %ui) of the internal buffer image for "
-                "the media source %p",
-                width, height, this);
-       _width = width;
-       _height = height;
-
-       LOGD("Assign new colorspace (%i) of the internal buffer image for "
-                "the media source %p",
-                colorspace, this);
-       _colorspace = colorspace;
-
-       _plane.push_back(plane);
-
-       return true;
-}
-
 void MediaSource::clear(void)
 {
        if (_packet) {
@@ -138,36 +99,6 @@ bool MediaSource::fill(const unsigned char *buffer, unsigned int bufferSize, uns
        return true;
 }
 
-bool MediaSource::fill(const unsigned char *buffer, unsigned int bufferSize, unsigned int width, unsigned int height,
-                                          size_t offset)
-{
-       if (bufferSize == 0 || buffer == NULL) {
-               LOGE("bufferSize is %d and buffer[%p]", bufferSize, buffer);
-               return false;
-       }
-
-       if (_plane.empty()) {
-               LOGE("_plane is empty");
-               return false;
-       }
-
-       auto &pBuffer = _plane.back().buffer;
-
-       LOGD("Allocate memory [%i] for buffer in media source %p", bufferSize, this);
-       LOGD("Assign new size (%ui x %ui) of the internal buffer image for "
-                "the media source %p",
-                width, height, this);
-
-       LOGD("Copy data from external buffer (%p) to the internal buffer (%p + %zd) of "
-                "media source %p",
-                buffer, pBuffer, offset, this);
-       std::memcpy(pBuffer + offset, buffer, bufferSize);
-
-       LOGD("size is %ui x %ui [%ui] on buffer(%p).", width, height, bufferSize, this);
-
-       return true;
-}
-
 unsigned char *MediaSource::getBuffer(void) const
 {
        if (_plane.empty())
index e0d5665..3b48e8e 100644 (file)
@@ -124,6 +124,7 @@ int mv_source_fill_by_media_packet(mv_source_h source, media_packet_h media_pack
                return MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT;
        }
 
+       // LCOV_EXCL_START
        switch (mimetype) {
        case MEDIA_FORMAT_I420:
                image_colorspace = MEDIA_VISION_COLORSPACE_I420;
@@ -161,6 +162,7 @@ int mv_source_fill_by_media_packet(mv_source_h source, media_packet_h media_pack
                         mimetype);
                return MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT;
        }
+       // LCOV_EXCL_STOP
 
        ret = media_packet_get_number_of_video_planes(media_packet, &plane_num);
        if (plane_num <= 0 || ret != MEDIA_PACKET_ERROR_NONE) {