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

📄 umc_h264_slice_decoding.h

📁 audio-video-codecs.rar语音编解码器
💻 H
📖 第 1 页 / 共 2 页
字号:

    // Update reference list
    Status UpdateReferenceList(H264DBPList *pDecoderFrameList);

    //
    // Segment decoding mode's variables
    //

    // Obtain decoding state variables
    void GetStateVariables(Ipp32s &iMBSkipFlag,  Ipp32s &iQuantPrev, Ipp32s &iPrevDQuant);
    // Save decoding state variables
    void SetStateVariables(Ipp32s iMBSkipCount, Ipp32s iQuantPrev, Ipp32s iPrevDQuant);

    AdaptiveMarkingInfo * GetAdaptiveMarkingInfo();

    void InitDistScaleFactor(Ipp32s NumL0RefActive, Ipp32s NumL1RefActive,
        H264DecoderFrame **pRefPicList0, H264DecoderFrame **pRefPicList1, ReferenceFlags *pFields0, ReferenceFlags *pFields1);

    bool IsError() const {return m_bError;}

protected:
    // Release object
    void Release(void);

    // Decode slice header
    bool DecodeSliceHeader(bool bFullInitialization = true);

    // Reference list(s) management functions & tools
    void InitPSliceRefPicList(bool bIsFieldSlice, Ipp32s /*NumL0RefActive*/, H264DecoderFrame **pRefPicList, H264DecoderFrameList *pDecoderFrameList);
    void InitBSliceRefPicLists(bool bIsFieldSlice, Ipp32s /*NumL0RefActive*/, Ipp32s /*NumL1RefActive*/, H264DecoderFrame **pRefPicList0, H264DecoderFrame **pRefPicList1, H264DecoderFrameList *pDecoderFrameList, H264RefListInfo &rli);
    Ipp32s AdjustRefPicListForFields(H264DecoderFrame **pRefPicList, ReferenceFlags *pFields, H264RefListInfo &rli);
    void ReOrderRefPicList(bool bIsFieldSlice, H264DecoderFrame **pRefPicList, ReferenceFlags *pFields, RefPicListReorderInfo *pReorderInfo, Ipp32s MaxPicNum, Ipp32s NumRefActive, H264DBPList *pDecoderFrameList);

    RefPicListReorderInfo ReorderInfoL0;                        // (RefPicListReorderInfo) reference list 0 info
    RefPicListReorderInfo ReorderInfoL1;                        // (RefPicListReorderInfo) reference list 1 info

    H264SliceHeader m_SliceHeader;                              // (H264SliceHeader) slice header
    H264Bitstream m_BitStream;                                  // (H264Bitstream) slice bit stream

    H264Bitstream m_BitStream_DXVA;                             // slice bit stream for dxva vld

    PredWeightTable m_PredWeight[2][MAX_NUM_REF_FRAMES];        // (PredWeightTable []) prediction weight table

    FactorArray     m_DistScaleFactor;
    FactorArrayMV   m_DistScaleFactorMV;
    FactorArrayAFF  *m_DistScaleFactorAFF;                      // [curmb field],[ref1field],[ref0field]
    FactorArrayMVAFF *m_DistScaleFactorMVAFF;                   // [curmb field],[ref1field],[ref0field]

    H264PicParamSet* m_pPicParamSet;                            // (H264PicParamSet *) pointer to array of picture parameters sets
    H264SeqParamSet* m_pSeqParamSet;                            // (H264SeqParamSet *) pointer to array of sequence parameters sets
    H264SeqParamSetExtension* m_pSeqParamSetEx;                 // (H264SeqParamSet *) pointer to array of sequence parameters sets

    H264DecoderFrame *m_pCurrentFrame;        // (H264DecoderFrame *) pointer to destination frame
    H264DecoderLocalMacroblockDescriptor *m_mbinfo;             // (H264DecoderLocalMacroblockDescriptor*) current frame MB information
    IntraType *m_pMBIntraTypes;                                 // (IntraType *) array of macroblock intra types

    Ipp32s m_iMBWidth;                                          // (Ipp32s) width in macroblock units
    Ipp32s m_iMBHeight;                                         // (Ipp32s) height in macroblock units
    Ipp32s m_CurrentPicParamSet;                                // (Ipp32s) current picture parameter set
    Ipp32s m_CurrentSeqParamSet;                                // (Ipp32s) current sequence parameter set

    Ipp32s m_iNumber;                                           // (Ipp32s) current slice number
    Ipp32s m_iFirstMB;                                          // (Ipp32s) first MB number in slice
    Ipp32s m_iMaxMB;                                            // (Ipp32s) last unavailable  MB number in slice

    Ipp32s m_iFirstMBFld;                                       // (Ipp32s) first MB number in slice

    bool m_bUnknownSize;                                        // (bool) size of current slice is unknown
    Ipp32s m_iAvailableMB;                                      // (Ipp32s) available number of macroblocks (used in "unknown mode")

    Ipp32s m_iCurMBToDec;                                       // (Ipp32s) current MB number to decode
    Ipp32s m_iCurMBToRec;                                       // (Ipp32s) current MB number to reconstruct
    Ipp32s m_iCurMBToDeb;                                       // (Ipp32s *) current MB number to de-blocking

    bool m_bInProcess;                                          // (bool) slice is under whole decoding
    Ipp32s m_bDecVacant;                                        // (Ipp32s) decoding is vacant
    Ipp32s m_bRecVacant;                                        // (Ipp32s) reconstruct is vacant
    Ipp32s m_bDebVacant;                                        // (Ipp32s) de-blocking is vacant
    bool m_bFirstDebThreadedCall;                               // (bool) "first threaded deblocking call" flag
    bool m_bPermanentTurnOffDeblocking;                         // (bool) "disable deblocking" flag
    bool m_bError;                                              // (bool) there is an error in decoding

    Ipp32s m_MVsDistortion;

    AdaptiveMarkingInfo     m_AdaptiveMarkingInfo;

    H264ThreadedDeblockingTools m_DebTools;                     // (H264ThreadedDeblockingTools) threaded deblocking tools

    Ipp32s m_iAllocatedMB;                                      // (Ipp32s) size of allocated buffer in macroblock

    H264CoeffsBuffer   m_CoeffsBuffers;

    // through-decoding variable(s)
    Ipp32s m_nMBSkipCount;                                      // (Ipp32u) current count of skipped macro blocks
    Ipp32s m_nQuantPrev;                                        // (Ipp32u) quantize value of previous macro block
    Ipp32s m_prev_dquant;
    Ipp32s m_field_index;                                       // (Ipp32s) current field index
    bool m_bNeedToCheckMBSliceEdges;                            // (bool) need to check inter-slice boundaries

    bool m_bDecoded;                                            // (bool) "slice has been decoded" flag
    bool m_bPrevDeblocked;                                      // (bool) "previous slice has been deblocked" flag
    bool m_bDeblocked;                                          // (bool) "slice has been deblocked" flag

    H264Slice *m_pNext;                                         // (H264Slice *) pointer to next slice in list
    H264MemoryPiece *m_pSource;                                 // (H264MemoryPiece *) pointer to owning memory piece
    H264MemoryPiece *m_pSource_DXVA;                            // (H264MemoryPiece *) pointer to owning memory piece
    Ipp64f m_dTime;                                             // (Ipp64f) slice's time stamp

    // memory management tools
    MemoryAllocator *m_pMemoryAllocator;                        // (MemoryAllocator *) pointer to memory allocation tool

    static FactorArrayAFF m_StaticFactorArrayAFF;
};

inline
void H264Slice::GetStateVariables(Ipp32s &iMBSkipFlag, Ipp32s &iQuantPrev, Ipp32s &iPrevDQuant)
{
    iMBSkipFlag = m_nMBSkipCount;
    iQuantPrev = m_nQuantPrev;
    iPrevDQuant = m_prev_dquant;

} // void H264Slice::GetStateVariables(Ipp32s &iMBSkipFlag, Ipp32s &iQuantPrev, bool &bSkipNextFDF, Ipp32s &iPrevDQuant)

inline
void H264Slice::SetStateVariables(Ipp32s iMBSkipFlag, Ipp32s iQuantPrev, Ipp32s iPrevDQuant)
{
    m_nMBSkipCount = iMBSkipFlag;
    m_nQuantPrev = iQuantPrev;
    m_prev_dquant = iPrevDQuant;

} // void H264Slice::SetStateVariables(Ipp32s iMBSkipFlag, Ipp32s iQuantPrev, bool bSkipNextFDF, Ipp32s iPrevDQuant)

inline
bool IsPictureTheSame(H264Slice *pSliceOne, H264Slice *pSliceTwo)
{
    if (!pSliceOne)
        return true;

    const H264SliceHeader *pOne = pSliceOne->GetSliceHeader();
    const H264SliceHeader *pTwo = pSliceTwo->GetSliceHeader();

    // this function checks two slices are from same picture or not
    // 7.4.1.2.4 part of h264 standart

    if ((pOne->frame_num != pTwo->frame_num) ||
        (pOne->first_mb_in_slice == pTwo->first_mb_in_slice) ||
        (pOne->pic_parameter_set_id != pTwo->pic_parameter_set_id) ||
        (pOne->field_pic_flag != pTwo->field_pic_flag) ||
        (pOne->bottom_field_flag != pTwo->bottom_field_flag))
        return false;

    if ((pOne->nal_ref_idc != pTwo->nal_ref_idc) &&
        (0 == IPP_MIN(pOne->nal_ref_idc, pTwo->nal_ref_idc)))
        return false;

    if (0 == pSliceOne->GetSeqParam()->pic_order_cnt_type)
    {
        if ((pOne->pic_order_cnt_lsb != pTwo->pic_order_cnt_lsb) ||
            (pOne->delta_pic_order_cnt_bottom != pTwo->delta_pic_order_cnt_bottom))
            return false;
    }
    else
    {
        if ((pOne->delta_pic_order_cnt[0] != pTwo->delta_pic_order_cnt[0]) ||
            (pOne->delta_pic_order_cnt[1] != pTwo->delta_pic_order_cnt[1]))
            return false;
    }

    if (pOne->nal_unit_type != pTwo->nal_unit_type)
    {
        if ((NAL_UT_IDR_SLICE == pOne->nal_unit_type) ||
            (NAL_UT_IDR_SLICE == pTwo->nal_unit_type))
            return false;
    }
    else if (NAL_UT_IDR_SLICE == pOne->nal_unit_type)
    {
        if (pOne->idr_pic_id != pTwo->idr_pic_id)
            return false;
    }

    return true;

} // bool IsPictureTheSame(H264SliceHeader *pOne, H264SliceHeader *pTwo)

// Declaration of internal class(es)
class H264SegmentDecoder;
class H264SegmentDecoderMultiThreaded;

class H264Task
{
public:
    // Default constructor
    H264Task(Ipp32s iThreadNumber)
        : m_iThreadNumber(iThreadNumber)
    {
        m_pSlice = 0;

        pFunction = 0;
        m_pBuffer = 0;
        m_WrittenSize = 0;

        m_iFirstMB = -1;
        m_iMaxMB = -1;
        m_iMBToProcess = -1;
        m_iTaskID = 0;
        m_bDone = false;
        m_bError = false;
    }

    Status (H264SegmentDecoderMultiThreaded::*pFunction)(Ipp32s nCurMBNumber, Ipp32s &nMaxMBNumber); // (Status (*) (Ipp32s, Ipp32s &)) pointer to working function

    CoeffsPtrCommon m_pBuffer;                                  // (Ipp16s *) pointer to working buffer
    size_t          m_WrittenSize;

    H264Slice *m_pSlice;                                        // (H264Slice *) pointer to owning slice
    H264DecoderFrameInfo * m_pSlicesInfo;

    Ipp32s m_iThreadNumber;                                     // (Ipp32s) owning thread number
    Ipp32s m_iFirstMB;                                          // (Ipp32s) first MB in slice
    Ipp32s m_iMaxMB;                                            // (Ipp32s) maximum MB number in owning slice
    Ipp32s m_iMBToProcess;                                      // (Ipp32s) number of MB to processing
    Ipp32s m_iTaskID;                                           // (Ipp32s) task identificator
    bool m_bDone;                                               // (bool) task was done
    bool m_bError;                                              // (bool) there is a error
};

enum
{
    COEFFICIENTS_BUFFER_SIZE    = 16 * 51
};

} // namespace UMC

#endif // __UMC_H264_SLICE_DECODING_H
#endif // UMC_ENABLE_H264_VIDEO_DECODER

⌨️ 快捷键说明

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