Skip to content
This repository was archived by the owner on May 17, 2023. It is now read-only.

Eliminate self-invented shared_ptr-like classes #1739

Open
mgonchar opened this issue Oct 21, 2019 · 3 comments
Open

Eliminate self-invented shared_ptr-like classes #1739

mgonchar opened this issue Oct 21, 2019 · 3 comments
Assignees

Comments

@mgonchar
Copy link
Contributor

We have some manual implementation of refcounter class here. I believe we can replace it with std::shared_ptr

@dvrogozh
Copy link
Contributor

You point to the samples code which is less important than the library itself. Can we review these cases in the library at the first place:

# fgrep -rsn RefCounter _studio/
_studio/mfx_lib/shared/include/mfx_common_decode_int.h:76:class RefCounter
_studio/mfx_lib/shared/include/mfx_common_decode_int.h:80:    RefCounter() : m_refCounter(0)
_studio/mfx_lib/shared/include/mfx_common_decode_int.h:88:    void ResetRefCounter() { m_refCounter = 0; }
_studio/mfx_lib/shared/include/mfx_common_decode_int.h:90:    uint32_t GetRefCounter() const { return m_refCounter; }
_studio/mfx_lib/shared/include/mfx_common_decode_int.h:95:    virtual ~RefCounter()
_studio/mfx_lib/shared/src/mfx_common_decode_int.cpp:327:void RefCounter::IncrementReference() const
_studio/mfx_lib/shared/src/mfx_common_decode_int.cpp:332:void RefCounter::DecrementReference()
_studio/shared/umc/codec/h264_dec/include/umc_h264_dec_defs_dec.h:273:class RefCounter
_studio/shared/umc/codec/h264_dec/include/umc_h264_dec_defs_dec.h:277:    RefCounter() : m_refCounter(0)
_studio/shared/umc/codec/h264_dec/include/umc_h264_dec_defs_dec.h:285:    void ResetRefCounter() {m_refCounter = 0;}
_studio/shared/umc/codec/h264_dec/include/umc_h264_dec_defs_dec.h:287:    uint32_t GetRefCounter() {return m_refCounter;}
_studio/shared/umc/codec/h264_dec/include/umc_h264_dec_defs_dec.h:292:    virtual ~RefCounter()
_studio/shared/umc/codec/h264_dec/include/umc_h264_dec_defs_dec.h:301:class HeapObject : public RefCounter
_studio/shared/umc/codec/h264_dec/include/umc_h264_headers.h:70:        header->ResetRefCounter();
_studio/shared/umc/codec/h264_dec/include/umc_h264_frame.h:46:    , public RefCounter
_studio/shared/umc/codec/h264_dec/include/umc_h264_frame.h:142:    typedef std::list<RefCounter *>  ReferenceList;
_studio/shared/umc/codec/h264_dec/include/umc_h264_frame.h:155:    void AddReference(RefCounter * reference);
_studio/shared/umc/codec/h264_dec/include/umc_h264_frame.h:231:    bool        isDisposable()    { return (!IsFullFrame() || (m_wasOutputted && m_wasDisplayed)) && !GetRefCounter(); }
_studio/shared/umc/codec/h264_dec/include/umc_h264_frame.h:447:    return (pTmp->m_wasOutputted || !pTmp->IsFullFrame())&& !pTmp->GetRefCounter();
_studio/shared/umc/codec/h264_dec/src/umc_h264_frame.cpp:93:    ResetRefCounter();
_studio/shared/umc/codec/h264_dec/src/umc_h264_frame.cpp:122:void H264DecoderFrame::AddReference(RefCounter * reference)
_studio/shared/umc/codec/h264_dec/src/umc_h264_frame.cpp:141:        RefCounter * reference = *iter;
_studio/shared/umc/codec/h264_dec/src/umc_h264_frame.cpp:156:    ResetRefCounter();
_studio/shared/umc/codec/h264_dec/src/umc_h264_frame_list.cpp:1238:        Trace(VM_STRING("Busy - %d \n"), pTmp->GetRefCounter());
_studio/shared/umc/codec/h264_dec/src/umc_h264_heap.cpp:312:void RefCounter::IncrementReference() const
_studio/shared/umc/codec/h264_dec/src/umc_h264_heap.cpp:317:void RefCounter::DecrementReference()
_studio/shared/umc/codec/h264_dec/src/umc_h264_task_supplier.cpp:2863:    DEBUG_PRINT((VM_STRING("Outputted POC - %d, busyState - %d, uid - %d, viewId - %d, pppp - %d\n"), pFrame->m_PicOrderCnt[0], pFrame->GetRefCounter(), pFrame->m_UID, pFrame->m_viewId, pppp++));
_studio/shared/umc/codec/h264_dec/src/umc_h264_va_supplier.cpp:230:    VM_ASSERT(!pFrame || pFrame->GetRefCounter() == 0);
_studio/shared/umc/codec/h265_dec/include/umc_h265_dec_defs.h:374:class RefCounter
_studio/shared/umc/codec/h265_dec/include/umc_h265_dec_defs.h:378:    RefCounter() : m_refCounter(0)
_studio/shared/umc/codec/h265_dec/include/umc_h265_dec_defs.h:386:    void ResetRefCounter() {m_refCounter = 0;}
_studio/shared/umc/codec/h265_dec/include/umc_h265_dec_defs.h:388:    uint32_t GetRefCounter() {return m_refCounter;}
_studio/shared/umc/codec/h265_dec/include/umc_h265_dec_defs.h:393:    virtual ~RefCounter()
_studio/shared/umc/codec/h265_dec/include/umc_h265_dec_defs.h:403:class HeapObject : public RefCounter
_studio/shared/umc/codec/h265_dec/include/umc_h265_frame.h:85:class H265DecoderFrame : public H265DecYUVBufferPadded, public RefCounter
_studio/shared/umc/codec/h265_dec/include/umc_h265_frame.h:156:    typedef std::list<RefCounter *>  ReferenceList;
_studio/shared/umc/codec/h265_dec/include/umc_h265_frame.h:229:                                            !GetRefCounter()); }
_studio/shared/umc/codec/h265_dec/include/umc_h265_frame.h:338:        !pTmp->GetRefCounter());
_studio/shared/umc/codec/h265_dec/include/umc_h265_headers.h:72:        header->ResetRefCounter();
_studio/shared/umc/codec/h265_dec/src/umc_h265_frame.cpp:55:    ResetRefCounter();
_studio/shared/umc/codec/h265_dec/src/umc_h265_frame.cpp:119:        RefCounter *reference = *iter;
_studio/shared/umc/codec/h265_dec/src/umc_h265_frame.cpp:132:    ResetRefCounter();
_studio/shared/umc/codec/h265_dec/src/umc_h265_frame_list.cpp:347:        DEBUG_PRINT((VM_STRING("POC = %d %p (%d)"), pCurr->PicOrderCnt(), (RefCounter *)pCurr, pCurr->GetRefCounter()));
_studio/shared/umc/codec/h265_dec/src/umc_h265_frame_list.cpp:499:        Trace(VM_STRING("\n\nPTR = %p UID - %d POC - %d  - resetcount - %d, frame ID - %d\n"), (RefCounter *)pTmp, pTmp->m_UID, pTmp->m_PicOrderCnt, pTmp->RefPicListResetCount(), pTmp->GetFrameData()->GetFrameMID());
_studio/shared/umc/codec/h265_dec/src/umc_h265_frame_list.cpp:501:        Trace(VM_STRING("Busy - %d, decoded - %d \n"), pTmp->GetRefCounter(), pTmp->IsDecodingCompleted());
_studio/shared/umc/codec/h265_dec/src/umc_h265_heap.cpp:321:void RefCounter::IncrementReference() const
_studio/shared/umc/codec/h265_dec/src/umc_h265_heap.cpp:326:void RefCounter::DecrementReference()
_studio/shared/umc/codec/h265_dec/src/umc_h265_task_supplier.cpp:176:                DEBUG_PRINT1((VM_STRING("Dereferencing frame with POC %d, busy = %d\n"), pTmp->m_PicOrderCnt, pTmp->GetRefCounter()));
_studio/shared/umc/codec/h265_dec/src/umc_h265_task_supplier.cpp:185:                DEBUG_PRINT1((VM_STRING("Dereferencing frame with POC %d, busy = %d\n"), pTmp->m_PicOrderCnt, pTmp->GetRefCounter()));
_studio/shared/umc/codec/h265_dec/src/umc_h265_task_supplier.cpp:954:    VM_ASSERT(!pFrame || pFrame->GetRefCounter() == 0);
_studio/shared/umc/codec/mpeg2_dec/include/umc_mpeg2_frame.h:98:    class MPEG2DecoderFrame : public RefCounter
_studio/shared/umc/codec/mpeg2_dec/src/umc_mpeg2_frame.cpp:227:        ResetRefCounter();

@egorovdanil egorovdanil self-assigned this Feb 26, 2020
egorovdanil added a commit to egorovdanil/MediaSDK that referenced this issue Jun 24, 2020
egorovdanil added a commit to egorovdanil/MediaSDK that referenced this issue Sep 9, 2020
egorovdanil added a commit to egorovdanil/MediaSDK that referenced this issue Sep 9, 2020
egorovdanil added a commit to egorovdanil/MediaSDK that referenced this issue Sep 9, 2020
@daleksan
Copy link
Contributor

daleksan commented Jun 9, 2021

Hi @egorovdanil do you have any updates?

@egorovdanil
Copy link
Contributor

Hi @daleksan I postponed this task due to the higher priority tasks on me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants