Exemple #1
0
void CDXVADecoderMpeg2::UpdatePictureParams(int nSurfaceIndex)
{
    DXVA2_ConfigPictureDecode* cpd = GetDXVA2Config();     // Ok for DXVA1 too (parameters have been copied)

    m_PictureParams.wDecodedPictureIndex = nSurfaceIndex;

    // Manage reference picture list
    if (!m_PictureParams.bPicBackwardPrediction) {
        if (m_wRefPictureIndex[0] != NO_REF_FRAME) {
            RemoveRefFrame(m_wRefPictureIndex[0]);
        }
        m_wRefPictureIndex[0] = m_wRefPictureIndex[1];
        m_wRefPictureIndex[1] = nSurfaceIndex;
    }
    m_PictureParams.wForwardRefPictureIndex = (m_PictureParams.bPicIntra == 0) ? m_wRefPictureIndex[0] : NO_REF_FRAME;
    m_PictureParams.wBackwardRefPictureIndex = (m_PictureParams.bPicBackwardPrediction == 1) ? m_wRefPictureIndex[1] : NO_REF_FRAME;

    // Shall be 0 if bConfigResidDiffHost is 0 or if BPP > 8
    if (cpd->ConfigResidDiffHost == 0 || m_PictureParams.bBPPminus1 > 7) {
        m_PictureParams.bPicSpatialResid8 = 0;
    } else {
        if (m_PictureParams.bBPPminus1 == 7 && m_PictureParams.bPicIntra && cpd->ConfigResidDiffHost)
            // Shall be 1 if BPP is 8 and bPicIntra is 1 and bConfigResidDiffHost is 1
        {
            m_PictureParams.bPicSpatialResid8 = 1;
        } else
            // Shall be 1 if bConfigSpatialResid8 is 1
        {
            m_PictureParams.bPicSpatialResid8 = cpd->ConfigSpatialResid8;
        }
    }

    // Shall be 0 if bConfigResidDiffHost is 0 or if bConfigSpatialResid8 is 0 or if BPP > 8
    if (cpd->ConfigResidDiffHost == 0 || cpd->ConfigSpatialResid8 == 0 || m_PictureParams.bBPPminus1 > 7) {
        m_PictureParams.bPicOverflowBlocks = 0;
    }

    // Shall be 1 if bConfigHostInverseScan is 1 or if bConfigResidDiffAccelerator is 0.

    if (cpd->ConfigHostInverseScan == 1 || cpd->ConfigResidDiffAccelerator == 0) {
        m_PictureParams.bPicScanFixed   = 1;

        if (cpd->ConfigHostInverseScan != 0) {
            m_PictureParams.bPicScanMethod  = 3;    // 11 = Arbitrary scan with absolute coefficient address.
        } else if (FFGetAlternateScan(m_pFilter->GetAVCtx())) {
            m_PictureParams.bPicScanMethod  = 1;    // 00 = Zig-zag scan (MPEG-2 Figure 7-2)
        } else {
            m_PictureParams.bPicScanMethod  = 0;    // 01 = Alternate-vertical (MPEG-2 Figure 7-3),
        }
    }
}
void CDXVADecoderMpeg2::UpdatePictureParams()
{
	DXVA2_ConfigPictureDecode* cpd			= GetDXVA2Config(); // Ok for DXVA1 too (parameters have been copied)
	DXVA_PictureParameters* DXVAPicParams	= &m_DXVA_Context.DXVA_MPEG2Context[m_nFieldNum].DXVAPicParams;

	// Shall be 0 if bConfigResidDiffHost is 0 or if BPP > 8
	if (cpd->ConfigResidDiffHost == 0 || DXVAPicParams->bBPPminus1 > 7) {
		DXVAPicParams->bPicSpatialResid8 = 0;
	} else {
		if (DXVAPicParams->bBPPminus1 == 7 && DXVAPicParams->bPicIntra && cpd->ConfigResidDiffHost) {
			// Shall be 1 if BPP is 8 and bPicIntra is 1 and bConfigResidDiffHost is 1
			DXVAPicParams->bPicSpatialResid8 = 1;
		} else {
			// Shall be 1 if bConfigSpatialResid8 is 1
			DXVAPicParams->bPicSpatialResid8 = cpd->ConfigSpatialResid8;
		}
	}

	// Shall be 0 if bConfigResidDiffHost is 0 or if bConfigSpatialResid8 is 0 or if BPP > 8
	if (cpd->ConfigResidDiffHost == 0 || cpd->ConfigSpatialResid8 == 0 || DXVAPicParams->bBPPminus1 > 7) {
		DXVAPicParams->bPicOverflowBlocks = 0;
	}

	// Shall be 1 if bConfigHostInverseScan is 1 or if bConfigResidDiffAccelerator is 0.
	if (cpd->ConfigHostInverseScan == 1 || cpd->ConfigResidDiffAccelerator == 0) {
		DXVAPicParams->bPicScanFixed = 1;

		if (cpd->ConfigHostInverseScan != 0) {
			DXVAPicParams->bPicScanMethod	= 3;    // 11 = Arbitrary scan with absolute coefficient address.
		} else if (FFGetAlternateScan(m_pFilter->GetAVCtx())) {
			DXVAPicParams->bPicScanMethod	= 1;    // 00 = Zig-zag scan (MPEG-2 Figure 7-2)
		} else {
			DXVAPicParams->bPicScanMethod	= 0;    // 01 = Alternate-vertical (MPEG-2 Figure 7-3),
		}
	}
}
CDXVADecoderH264::CDXVADecoderH264(CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, const GUID* guidDecoder, DXVAMode nMode, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config)
	: CDXVADecoder(pFilter, pDirectXVideoDec, guidDecoder, nMode, nPicEntryNumber, pDXVA2Config)
{
	m_bUseLongSlice = (GetDXVA2Config()->ConfigBitstreamRaw != 2);
	Init();
}