// *********************************************************************
// Function    : void vFlushDPB(UINT32 u4InstID, VDEC_INFO_DEC_PRM_T *tVerMpvDecPrm, BOOL fgWithOutput)
// Description : Flush pictures in DPB
// Parameter   : None
// Return      : None
// *********************************************************************
void vFlushDPB(UINT32 u4InstID, VDEC_INFO_DEC_PRM_T *tVerMpvDecPrm, BOOL fgWithOutput)
{
  UINT32 u4MinPOCFBufIdx;

  do
  {
        if (_u4CodecVer[u4InstID] == VDEC_H265)
		{
            #ifdef VDEC_SIM_DUMP
                printk ("[INFO]H265 vFlushDPB() %d !!\n", u4MinPOCFBufIdx);
            #endif
            u4MinPOCFBufIdx = ucVDecGetMinPOCFBuf(u4InstID, tVerMpvDecPrm, FALSE);
            if(u4MinPOCFBufIdx != 0xFF)
            {
                if(fgWithOutput
                    && _ptH265FBufInfo[u4InstID][u4MinPOCFBufIdx].eH265DpbStatus == H265_DPB_STATUS_DECODED)
                {
                    //_ptFBufInfo[u4MinPOCFBufIdx].eH265DpbStatus = H264_DPB_STATUS_OUTPUTTED;
                }
                // Force set outputted
                _ptH265FBufInfo[u4InstID][u4MinPOCFBufIdx].eH265DpbStatus = H265_DPB_STATUS_OUTPUTTED;
                _ptH265FBufInfo[u4InstID][u4MinPOCFBufIdx].ucFBufRefType = NREF_PIC;

                vOutputPOCData(_ptH265FBufInfo[u4InstID][u4MinPOCFBufIdx].u4DecOrder);
            }
            
        }
		else
		{
#ifdef VDEC_SIM_DUMP
			printk("[INFO]H264 vFlushDPB() %d !!\n", u4MinPOCFBufIdx);
#endif

        u4MinPOCFBufIdx = ucVDecGetMinPOCFBuf(u4InstID, tVerMpvDecPrm, FALSE);
        if(u4MinPOCFBufIdx != 0xFF)
        {
            if(fgWithOutput
                && _ptFBufInfo[u4InstID][u4MinPOCFBufIdx].eH264DpbStatus == H264_DPB_STATUS_DECODED)
            {
                //_ptFBufInfo[u4MinPOCFBufIdx].eH264DpbStatus = H264_DPB_STATUS_OUTPUTTED;
            }
            // Force set outputted
            _ptFBufInfo[u4InstID][u4MinPOCFBufIdx].eH264DpbStatus = H264_DPB_STATUS_OUTPUTTED;
            _ptFBufInfo[u4InstID][u4MinPOCFBufIdx].ucFBufRefType = NREF_PIC;
            _ptFBufInfo[u4InstID][u4MinPOCFBufIdx].ucTFldRefType = NREF_PIC;
            _ptFBufInfo[u4InstID][u4MinPOCFBufIdx].ucBFldRefType = NREF_PIC;
            vOutputPOCData(_ptFBufInfo[u4InstID][u4MinPOCFBufIdx].u4DecOrder);
        }
        }
  }
  while(u4MinPOCFBufIdx != 0xff);

}
// *********************************************************************
// Function    : void vFlushDPB(UINT32 u4InstID, VDEC_INFO_DEC_PRM_T *tVerMpvDecPrm, BOOL fgWithOutput)
// Description : Flush pictures in DPB
// Parameter   : None
// Return      : None
// *********************************************************************
void vFlushDPB(UINT32 u4InstID, VDEC_INFO_DEC_PRM_T *tVerMpvDecPrm, BOOL fgWithOutput)
{
  UINT32 u4MinPOCFBufIdx;

  do
  {
        u4MinPOCFBufIdx = ucVDecGetMinPOCFBuf(u4InstID, tVerMpvDecPrm, FALSE);
        if(u4MinPOCFBufIdx != 0xFF)
        {
            if(fgWithOutput
                && _ptFBufInfo[u4InstID][u4MinPOCFBufIdx].eH264DpbStatus == H264_DPB_STATUS_DECODED)
            {
                //_ptFBufInfo[u4MinPOCFBufIdx].eH264DpbStatus = H264_DPB_STATUS_OUTPUTTED;
            }
            // Force set outputted
            _ptFBufInfo[u4InstID][u4MinPOCFBufIdx].eH264DpbStatus = H264_DPB_STATUS_OUTPUTTED;
            _ptFBufInfo[u4InstID][u4MinPOCFBufIdx].ucFBufRefType = NREF_PIC;
            _ptFBufInfo[u4InstID][u4MinPOCFBufIdx].ucTFldRefType = NREF_PIC;
            _ptFBufInfo[u4InstID][u4MinPOCFBufIdx].ucBFldRefType = NREF_PIC;
            vOutputPOCData(_ptFBufInfo[u4InstID][u4MinPOCFBufIdx].u4DecOrder);
        }
  }while(u4MinPOCFBufIdx != 0xff);

}