⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 umc_h264_frame.h

📁 audio-video-codecs.rar语音编解码器
💻 H
📖 第 1 页 / 共 2 页
字号:
    // m_LongTermFrameIdx.
    Ipp32s FrameNum()
    {
        return m_FrameNum;
    }

    void setFrameNum(Ipp32s FrameNum)
    {
        m_FrameNum = FrameNum;
    }

    Ipp32s FrameNumWrap()
    {
        return m_FrameNumWrap;
    }

    void setFrameNumWrap(Ipp32s FrameNumWrap)
    {
        m_FrameNumWrap = FrameNumWrap;
    };

    void UpdateFrameNumWrap(Ipp32s CurrFrameNum, Ipp32s MaxFrameNum, Ipp32s CurrPicStruct);
    // Updates m_FrameNumWrap and m_PicNum if the frame is a short-term
    // reference and a frame number wrap has occurred.

    Ipp32s LongTermFrameIdx()
    {
        return m_LongTermFrameIdx;
    }

    void setLongTermFrameIdx(Ipp32s LongTermFrameIdx)
    {
        m_LongTermFrameIdx = LongTermFrameIdx;
    };

    bool isShortTermRef(Ipp32s WhichField) const
    {
        if (m_PictureStructureForRef>=FRM_STRUCTURE )
            return m_isShortTermRef[0] && m_isShortTermRef[1];
        else
            return m_isShortTermRef[WhichField];
    };

    Ipp32s isShortTermRef() const
    {
        return m_isShortTermRef[0] + m_isShortTermRef[1]*2;
    };

    void SetisShortTermRef(Ipp32s WhichField)
    {
        if (m_PictureStructureForRef>=FRM_STRUCTURE)
            m_isShortTermRef[0] = m_isShortTermRef[1] = true;
        else
            m_isShortTermRef[WhichField] = true;
    }

    Ipp32s PicOrderCnt(Ipp32s index, Ipp32s force=0)
    {
        if ((m_PictureStructureForRef>=FRM_STRUCTURE && force==0) || force==3)
        {
            return IPP_MIN(m_PicOrderCnt[0],m_PicOrderCnt[1]);
        }
        else if (force==2)
        {
            if (isShortTermRef(0) && isShortTermRef(1))
                return IPP_MIN(m_PicOrderCnt[0],m_PicOrderCnt[1]);
            else if (isShortTermRef(0))
                return m_PicOrderCnt[0];
            else
                return m_PicOrderCnt[1];
        }
        return m_PicOrderCnt[index];
    }

    Ipp32s DeblockPicID(Ipp32s index)
    {
#if 0
        //the constants are subject to change
        return PicOrderCnt(index,force)*2+FrameNumWrap()*534+FrameNum()*878+PicNum(index,force)*14
            +RefPicListResetCount(index,force);
#else
        size_t ret = (size_t) ((Ipp8u *) this - (Ipp8u *) 0);
        return (Ipp32s) (ret + index);

#endif
    }

    void setPicOrderCnt(Ipp32s PicOrderCnt, Ipp32s index) {m_PicOrderCnt[index] = PicOrderCnt;};
    bool isLongTermRef(Ipp32s WhichField) const
    {
        if (m_PictureStructureForRef>=FRM_STRUCTURE)
            return m_isLongTermRef[0] && m_isLongTermRef[1];
        else
            return m_isLongTermRef[WhichField];
    };

    Ipp32s isLongTermRef() const
    {
        return m_isLongTermRef[0] + m_isLongTermRef[1]*2;
    };

    void SetisLongTermRef(Ipp32s WhichField)
    {
        if (m_PictureStructureForRef>=FRM_STRUCTURE)
            m_isLongTermRef[0] = m_isLongTermRef[1] = true;
        else
            m_isLongTermRef[WhichField] = true;
    }

    void unSetisShortTermRef(Ipp32s WhichField)
    {
        if (m_PictureStructureForRef>=FRM_STRUCTURE)
        {
            m_isShortTermRef[0] = m_isShortTermRef[1] = false;
        }
        else
            m_isShortTermRef[WhichField] = false;
    }

    void unSetisLongTermRef(Ipp32s WhichField)
    {
        if (m_PictureStructureForRef>=FRM_STRUCTURE)
        {
            m_isLongTermRef[0] = m_isLongTermRef[1] = false;
        }
        else
            m_isLongTermRef[WhichField] = false;
    }

    Ipp32s LongTermPicNum(Ipp32s f, Ipp32s force=0)
    {
        if ((m_PictureStructureForRef>=FRM_STRUCTURE && force==0) || force==3)
        {
            return IPP_MIN(m_LongTermPicNum[0],m_LongTermPicNum[1]);
        }
        else if (force==2)
        {
            if (isLongTermRef(0) && isLongTermRef(1))
                return IPP_MIN(m_LongTermPicNum[0],m_LongTermPicNum[1]);
            else if (isLongTermRef(0))
                return m_LongTermPicNum[0];
            else return m_LongTermPicNum[1];
        }
        return m_LongTermPicNum[f];
    }

    void setLongTermPicNum(Ipp32s LongTermPicNum,Ipp32s f) {m_LongTermPicNum[f] = LongTermPicNum;}
    void UpdateLongTermPicNum(Ipp32s CurrPicStruct);

    void IncreaseRefPicListResetCount(Ipp32s f)
    {
        /*if (m_PictureStructureForRef>=FRM_STRUCTURE)
        {
            m_RefPicListResetCount[0]++;
            m_RefPicListResetCount[1]++;
        }
        else*/
            m_RefPicListResetCount[f]++;
    }

    void InitRefPicListResetCount(Ipp32s f)
    {
        if (m_PictureStructureForRef>=FRM_STRUCTURE)
            m_RefPicListResetCount[0]=m_RefPicListResetCount[1]=0;
        else
            m_RefPicListResetCount[f]=0;
    }

    Ipp32s RefPicListResetCount(Ipp32s f,Ipp32s force=0)
    {
        if ((m_PictureStructureForRef>=FRM_STRUCTURE && force==0)|| force==3)
            return IPP_MAX(m_RefPicListResetCount[0],m_RefPicListResetCount[1]);
        else
            return m_RefPicListResetCount[f];
    }

    Ipp8s GetNumberByParity(Ipp32s parity) const
    {
        if (parity==-1) return -1;
        if (m_bottom_field_flag[0]==parity) return 0;
        if (m_bottom_field_flag[1]==parity) return 1;
        //VM_ASSERT(m_PictureStructureForDec>=FRM_STRUCTURE); // There could be only one un-paired field
        return -1;
    }

    //////////////////////////////////////////////////////////////////////////////
    // GetRefPicList
    // Returns pointer to start of specified ref pic list.
    //////////////////////////////////////////////////////////////////////////////
    H264H264DecoderRefPicListStruct* GetRefPicList(Ipp32s sliceNumber, Ipp32s list);

    const H264H264DecoderRefPicListStruct* GetRefPicList(Ipp32s sliceNumber, Ipp32s list) const;

    Status allocateParsedFrameData(const IppiSize&, Ipp32s bpp);
        // Reallocate m_pParsedFrameData, if necessary, and initialize the
        // various pointers that point into it.

    void deallocateParsedFrameData();

    bool IsAuxiliaryFrame() const
    {
        return is_auxiliary_frame;
    }

    void DefaultFill(Ipp32s field, bool isChromaOnly);

    void SetExternalPointers(
        const IppiSize &lumaSize,
        Ipp32s bpp,
        Ipp32s chroma_format,
        PlanePtrYCommon   pYPlane,
        Ipp32s      pitch_luma,
        PlanePtrUVCommon  pUPlane,
        PlanePtrUVCommon  pVPlane,
        Ipp32s      pitch_chroma);

    bool post_procces_complete;
    bool is_auxiliary_frame;
    H264DecoderFrame * primary_picture;

    Ipp32s m_iNumberOfSlices;
    Ipp32s m_iResourceNumber;

    Ipp32s m_index;
    Ipp32s m_UID;
    FrameType m_FrameType;

    Ipp32s GetError() const
    {
        return m_ErrorType;
    }

    void SetError(Ipp32s errorType)
    {
        errorType = m_ErrorType;
    }

protected:
    // Declare memory management tools
    MemoryAllocator *m_pMemoryAllocator;
    MemID m_midParsedFrameDataNew;

    Ipp32s m_ErrorType;
};

class H264DecoderFrameExtension : public H264DecoderFrame
{
    DYNAMIC_CAST_DECL(H264DecoderFrameExtension, H264DecoderFrame)

public:
    H264DecoderFrameExtension(MemoryAllocator *pMemoryAllocator);

    virtual ~H264DecoderFrameExtension();

    H264DecoderFrame * GetAuxiliaryFrame();

    void AllocateAuxiliary();

    void FillInfoToAuxiliary();

private:

    H264DecoderFrame * m_pAuxiliaryFrame;
};

inline H264DecoderFrame * GetAuxiliaryFrame(H264DecoderFrame * frame)
{
    if (frame)
    {
        H264DecoderFrameExtension * fr = DynamicCast<H264DecoderFrameExtension>(frame);
        return fr ? fr->GetAuxiliaryFrame() : 0;
    }

    return 0;
}

} // end namespace UMC

#endif // __UMC_H264_FRAME_H__
#endif // UMC_ENABLE_H264_VIDEO_DECODER

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -