Void TEncGOP::compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP, bool isField, bool isTff) { /*compressGOP的一些初始设定或者说是初始参数*/ TComPic* pcPic; TComPicYuv* pcPicYuvRecOut; TComSlice* pcSlice; TComOutputBitstream *pcBitstreamRedirect; pcBitstreamRedirect = new TComOutputBitstream; AccessUnit::iterator itLocationToPushSliceHeaderNALU; // used to store location where NALU containing slice header is to be inserted UInt uiOneBitstreamPerSliceLength = 0; TEncSbac* pcSbacCoders = NULL; TComOutputBitstream* pcSubstreamsOut = NULL; //Set GOP Size(设定GOP的大小) xInitGOP( iPOCLast, iNumPicRcvd, rcListPic, rcListPicYuvRecOut, isField ); m_iNumPicCoded = 0; SEIPictureTiming pictureTimingSEI; Bool writeSOP = m_pcCfg->getSOPDescriptionSEIEnabled(); // Initialize Scalable Nesting SEI with single layer values SEIScalableNesting scalableNestingSEI; scalableNestingSEI.m_bitStreamSubsetFlag = 1; // If the nested SEI messages are picture buffereing SEI mesages, picure timing SEI messages or sub-picture timing SEI messages, bitstream_subset_flag shall be equal to 1 scalableNestingSEI.m_nestingOpFlag = 0; scalableNestingSEI.m_nestingNumOpsMinus1 = 0; //nesting_num_ops_minus1 scalableNestingSEI.m_allLayersFlag = 0; scalableNestingSEI.m_nestingNoOpMaxTemporalIdPlus1 = 6 + 1; //nesting_no_op_max_temporal_id_plus1 scalableNestingSEI.m_nestingNumLayersMinus1 = 1 - 1; //nesting_num_layers_minus1 scalableNestingSEI.m_nestingLayerId[0] = 0; scalableNestingSEI.m_callerOwnsSEIs = true; Int picSptDpbOutputDuDelay = 0; UInt *accumBitsDU = NULL; UInt *accumNalsDU = NULL; SEIDecodingUnitInfo decodingUnitInfoSEI; #if EFFICIENT_FIELD_IRAP Int IRAPGOPid = -1; Bool IRAPtoReorder = false; Bool swapIRAPForward = false; if(isField) { Int pocCurr; for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ ) { // determine actual POC if(iPOCLast == 0) //case first frame or first top field { pocCurr=0; } else if(iPOCLast == 1 && isField) //case first bottom field, just like the first frame, the poc computation is not right anymore, we set the right value { pocCurr = 1; } else { pocCurr = iPOCLast - iNumPicRcvd + m_pcCfg->getGOPEntry(iGOPid).m_POC - isField; } // check if POC corresponds to IRAP NalUnitType tmpUnitType = getNalUnitType(pocCurr, m_iLastIDR, isField); if(tmpUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP && tmpUnitType <= NAL_UNIT_CODED_SLICE_CRA) // if picture is an IRAP { if(pocCurr%2 == 0 && iGOPid < m_iGopSize-1 && m_pcCfg->getGOPEntry(iGOPid).m_POC == m_pcCfg->getGOPEntry(iGOPid+1).m_POC-1) { // if top field and following picture in enc order is associated bottom field IRAPGOPid = iGOPid; IRAPtoReorder = true; swapIRAPForward = true; break; } if(pocCurr%2 != 0 && iGOPid > 0 && m_pcCfg->getGOPEntry(iGOPid).m_POC == m_pcCfg->getGOPEntry(iGOPid-1).m_POC+1) { // if picture is an IRAP remember to process it first IRAPGOPid = iGOPid; IRAPtoReorder = true; swapIRAPForward = false; break; } } } } #endif
for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ ) { 大循环:第418行~第1981行 } delete pcBitstreamRedirect; if( accumBitsDU != NULL) delete accumBitsDU; if( accumNalsDU != NULL) delete accumNalsDU; assert ( (m_iNumPicCoded == iNumPicRcvd) || (isField && iPOCLast == 1) ); }