📄 umc_h264_core_enc.h
字号:
Ipp8u *m_pParsedFrameData;
T_EncodeMBOffsets *m_pMBOffsets;
// This points to a huge, monolithic buffer that contains data
// derived from parsing the current frame.
// Logically this information belongs in the H264DecoderFrame class.
// However, algorithmically, we only need to keep around this
// information for the most recent reference frame.
// Thus, as a space saving optimization, we
// allocate this information in the Decoder class rather than
// in the H264DecoderFrame class.
EnumPicCodType* eFrameType;
H264EncoderFrame<PixType>** eFrameSeq;
CH264pBs<PixType,CoeffsType>* m_bs1; // Pointer to the main bitstream.
// dimension dependent variables:
IppiSize m_PaddedSize;
public:
H264EncoderParams m_info;
H264_Encoder_Compression_Flags cflags;
H264_Encoder_Compression_Notes cnotes;
H264EncoderFrameList<PixType> m_cpb;
H264EncoderFrameList<PixType> m_dpb;
Ipp32s m_dpbSize;
H264EncoderFrame<PixType> *m_pCurrentFrame;
H264EncoderFrame<PixType> *m_pLastFrame; // ptr to last frame
H264EncoderFrame<PixType> *m_pReconstructFrame;
// Table to obtain value to advance the 4x4 block offset for the next block.
Ipp32s m_EncBlockOffsetInc[2][48];
Ipp32s m_is_cur_pic_afrm;
bool m_is_mb_data_initialized;
Ipp32s m_field_index;
Ipp32s m_NumShortEntriesInList;
Ipp32s m_NumLongEntriesInList;
AdaptiveMarkingInfo m_AdaptiveMarkingInfo;
RefPicListReorderInfo m_ReorderInfoL0;
RefPicListReorderInfo m_ReorderInfoL1;
Ipp32s m_InitialOffsets[2][2];
Ipp32s m_MaxLongTermFrameIdx;
protected:
Ipp8u * m_pAllocEncoderInst;
// flags read by DetermineFrameType while sequencing the profile:
bool m_bMakeNextFrameKey;
bool m_bMakeNextFrameIDR;
Ipp32s m_uIntraFrameInterval;
Ipp32s m_uIDRFrameInterval;
Ipp32s m_l1_cnt_to_start_B;
H264EncoderThreadPrivateSlice<PixType, CoeffsType> *m_Slices; // thread independent slice information.
Status CheckEncoderParameters();
void GetLeftLocationForCurrentMBLumaNonMBAFF(H264CurrentMacroblockDescriptor<PixType, CoeffsType>& cur_mb, H264BlockLocation *Block);
void GetLeftLocationForCurrentMBChromaNonMBAFF(H264CurrentMacroblockDescriptor<PixType, CoeffsType>& cur_mb, H264BlockLocation *Block);
void GetTopLocationForCurrentMBLumaNonMBAFF(H264CurrentMacroblockDescriptor<PixType, CoeffsType>& cur_mb, H264BlockLocation *Block);
void GetTopLocationForCurrentMBChromaNonMBAFF(H264CurrentMacroblockDescriptor<PixType, CoeffsType>& cur_mb, H264BlockLocation *Block);
void GetTopLeftLocationForCurrentMBLumaNonMBAFF(H264CurrentMacroblockDescriptor<PixType, CoeffsType>& cur_mb, H264BlockLocation *Block);
void GetTopRightLocationForCurrentMBLumaNonMBAFF(H264CurrentMacroblockDescriptor<PixType, CoeffsType>& cur_mb, H264BlockLocation *Block);
void GetLeftLocationForCurrentMBLumaMBAFF(H264CurrentMacroblockDescriptor<PixType, CoeffsType>& cur_mb, H264BlockLocation *Block, Ipp32s AdditionalDecrement=0);
void GetLeftLocationForCurrentMBChromaMBAFF(H264CurrentMacroblockDescriptor<PixType, CoeffsType>& cur_mb, H264BlockLocation *Block);
void GetTopLocationForCurrentMBLumaMBAFF(H264CurrentMacroblockDescriptor<PixType, CoeffsType>& cur_mb, H264BlockLocation *Block, bool is_deblock_calls);
void GetTopLocationForCurrentMBChromaMBAFF(H264CurrentMacroblockDescriptor<PixType, CoeffsType>& cur_mb, H264BlockLocation *Block);
void GetTopLeftLocationForCurrentMBLumaMBAFF(H264CurrentMacroblockDescriptor<PixType, CoeffsType>& cur_mb, H264BlockLocation *Block);
void GetTopRightLocationForCurrentMBLumaMBAFF(H264CurrentMacroblockDescriptor<PixType, CoeffsType>& cur_mb, H264BlockLocation *Block);
Ipp32s GetColocatedLocation(H264EncoderThreadPrivateSlice<PixType,CoeffsType> *curr_slice,
H264EncoderFrame<PixType> *pRefFrame, Ipp8u Field,
Ipp8s& block, Ipp8s *scale = 0);
void UpdateNeighbouringAddresses(H264EncoderThreadPrivateSlice<PixType,CoeffsType> *curr_slice,
bool could_ignore_slice_edges = false);
void UpdateNeighbouringBlocks(H264EncoderThreadPrivateSlice<PixType, CoeffsType> *curr_slice, bool is_deblock_calls = false);
void UpdateCurrentMBInfo(H264EncoderThreadPrivateSlice<PixType, CoeffsType> *curr_slice);
void MBFrameFieldSelect(H264EncoderThreadPrivateSlice<PixType, CoeffsType> *curr_slice);
Ipp32s ComputeMBFrameFieldCost(H264EncoderThreadPrivateSlice<PixType, CoeffsType> *curr_slice, bool is_frame);
void Estimate_One_MV_Predictor(H264EncoderThreadPrivateSlice<PixType, CoeffsType> *curr_slice,
Ipp32u uMB, // which MB
Ipp32u uBlock, // which 4x4 Block (UL Corner, Raster Order)
Ipp32u uList, // 0, 1 for L0 or L1.
H264MotionVector *pMVIn, // Optional MV to pass in. Will be used to fill block MV buffer if not NULL.
Ipp32u uBlocksWide, // 1, 2, or 4
Ipp32u uBlocksHigh, // 1, 2, or 4 (4x16 and 16x4 not permitted)
H264MotionVector *pMVPred, // resulting MV predictor
H264MotionVector *pMVDelta); // resulting MV delta
void UpdateRefPicListCommon(); // A former part of UpdateRefPicList() which does not depend on slice type.
Status UpdateRefPicList(H264EncoderThreadPrivateSlice<PixType, CoeffsType> *curr_slice,
EncoderRefPicList<PixType> * ref_pic_list,
H264SliceHeader &SHdr,
RefPicListReorderInfo *pReorderInfo_L0,
RefPicListReorderInfo *pReorderInfo_L1);
void InitPSliceRefPicList(H264EncoderThreadPrivateSlice<PixType, CoeffsType> *curr_slice, bool bIsFieldSlice,
H264EncoderFrame<PixType> **pRefPicList); // pointer to start of list 0
void InitBSliceRefPicLists(H264EncoderThreadPrivateSlice<PixType, CoeffsType> *curr_slice, bool bIsFieldSlice,
H264EncoderFrame<PixType> **pRefPicList0, // pointer to start of list 0
H264EncoderFrame<PixType> **pRefPicList1); // pointer to start of list 1
void InitDistScaleFactor(H264EncoderThreadPrivateSlice<PixType, CoeffsType> *curr_slice,
Ipp32s NumL0RefActive,
H264EncoderFrame<PixType> **pRefPicList0,
H264EncoderFrame<PixType> **pRefPicList1,
Ipp8s *pFields0,
Ipp8s *pFields1);
void AdjustRefPicListForFields(H264EncoderFrame<PixType> **pRefPicList,Ipp8s *pFields);
void ReOrderRefPicList(bool bIsFieldSlice,
H264EncoderFrame<PixType> **pRefPicList,
Ipp8s *pFields,
RefPicListReorderInfo *pReorderInfo,
Ipp32s MaxPicNum,
Ipp32s NumRefActive);
Status UpdateRefPicMarking();
Status CompressFrame(EnumPicCodType &, EnumPicClass &, MediaData* outBitstream);
Status EncodeDummyFrame(MediaData* dst); // Encodes blank frame when overflow
EnumPicCodType DetermineFrameType(Ipp32s);
Status encodeFrameHeader (CH264pBs<PixType,CoeffsType>*,
MediaData* dst,
bool bIDR_Pic,
bool& startPicture); //Do we need to start new picture?
void SetSequenceParameters ();
void SetPictureParameters ();
void SetDPBSize();
void SetSliceHeaderCommon(H264EncoderFrame<PixType> *);
void InferFDFForSkippedMBs(H264EncoderThreadPrivateSlice<PixType, CoeffsType> *curr_slice);
Status MoveFromCPBToDPB();
Status CleanDPB();
Ipp32s m_iProfileIndex;
Ipp8u* m_pBitStream; // Pointer to bitstream buffer.
bool m_bScratchBufferAllocated;
// indicated whether bitstream- and scratch
// buffers have been allocated. Should happen
// only once per StartSequence
bool m_bBuffersAllocated;
// Indicates that all working buffers have been
// allocated.
Ipp32u m_uTRWrapAround;
// Wrap around for TR
Ipp32u m_uFrames_Num;
// Decode order frame number.
Ipp32u m_uFrameCounter;
// Counts frames in input order so that the sequence numbers of input frames can
// be normalized to a strictly increasing counter.
// Boolean indicating that a QP mask has been set and should
// be used for the next encode of this frame. This flag is
// always cleared
bool m_bQPMapIsReady;
// Store the size of the QP map.
Ipp32u m_QPMapSize;
// Input color convertor.
// video noise reduction prefilter.
CNoiseReductionFilter<PixType>* m_noisepf;
Ipp32s m_Pitch;
Ipp64s m_total_bits_encoded; //Bit counter for all stream
public:
Ipp32u GetBsBufferMaxSize(const Ipp32u w, const Ipp32u h);
Status Start_Sequence();
Status End_Sequence();
Status Encode(VideoData* src,
MediaData* dst,
const H264_Encoder_Compression_Flags,
H264_Encoder_Compression_Notes&);
Status Set_Key_Frame_Controls(const H264_Key_Frame_Controls&);
Status Make_Next_Frame_Key();
Status Set_B_Frames(Ipp32u number_of_B_frames);
Status Set_Num_Slices(Ipp32u number_of_slices);
Status Set_Deblocking_Loop_Filter(Ipp8u Use_Filter,
Ipp32s Alpha,
Ipp32s Beta);
private:
Status Allocate_Buffers();
void Deallocate_Buffers();
// public methods
// These should be the same for all cores.
public:
Status Start_Picture (const EnumPicClass * pic_class, EnumPicCodType pic_type);
// allocate memory
Status Allocate_Core_Memory(const Ipp32u num_slices,
const IppiSize & desired_padded_size,
CBaseBitstream *bs);
// free memory
Status Free_Core_Memory();
// Compress picture slice
Status Compress_Slice(H264EncoderThreadPrivateSlice<PixType, CoeffsType> *curr_slice, bool is_first_mb);
Ipp32u MB_Decision(H264EncoderThreadPrivateSlice<PixType, CoeffsType> *curr_slice, Ipp32s uMB);
Status Compress_Slice_MBAFF(H264EncoderThreadPrivateSlice<PixType, CoeffsType> *curr_slice);
bool Intra_Slice_Test();
// This routine returns true if the current slice has coded a number of macroblocks
// as INTRA that exceeded the INTRA_PERCENTAGE_THRESHOLD constant.
// any processing needed after each picture
void End_Picture();
#ifdef _DEBUG
static void PrintBufferLine(PixType*, Ipp32u);
#endif
// general frame data used by most core functions
private:
void InitializeMBData();
void Make_MBSlices();
void AdvancedIntraModeSelectOneMacroblock(
H264EncoderThreadPrivateSlice<PixType, CoeffsType> *curr_slice,
Ipp32u uMB, // which MB
Ipp32u uBestSAD, //Best previous SAD
Ipp32u *puAIMBSAD // return total MB SAD here
);
void Encode4x4IntraBlock(H264EncoderThreadPrivateSlice<PixType, CoeffsType> *curr_slice, Ipp32s block);
void Encode8x8IntraBlock(H264EncoderThreadPrivateSlice<PixType, CoeffsType> *curr_slice, Ipp32s block);
void Encode16x16IntraBlock(H264EncoderThreadPrivateSlice<PixType, CoeffsType> *curr_slice);
void EncodeChroma(H264EncoderThreadPrivateSlice<PixType, CoeffsType> *curr_slice);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -