MCPcopy Create free account
hub / github.com/Aleksoid1978/VideoRenderer / CopySample

Method CopySample

Source/DX9VideoProcessor.cpp:1330–1536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1328}
1329
1330HRESULT CDX9VideoProcessor::CopySample(IMediaSample* pSample)
1331{
1332 uint64_t tick = GetPreciseTick();
1333
1334 // Get frame type
1335 m_CurrentSampleFmt = DXVA2_SampleProgressiveFrame; // Progressive
1336 m_bDoubleFrames = false;
1337 if (m_bInterlaced) {
1338 if (CComQIPtr<IMediaSample2> pMS2 = pSample) {
1339 AM_SAMPLE2_PROPERTIES props;
1340 if (SUCCEEDED(pMS2->GetProperties(sizeof(props), (BYTE*)&props))) {
1341 if ((props.dwTypeSpecificFlags & AM_VIDEO_FLAG_WEAVE) == 0) {
1342 if (props.dwTypeSpecificFlags & AM_VIDEO_FLAG_FIELD1FIRST) {
1343 m_CurrentSampleFmt = DXVA2_SampleFieldInterleavedEvenFirst; // Top-field first
1344 } else {
1345 m_CurrentSampleFmt = DXVA2_SampleFieldInterleavedOddFirst; // Bottom-field first
1346 }
1347 m_bDoubleFrames = m_iVPDeinterlacing && m_bDeintDouble && m_DXVA2VP.IsReady();
1348 }
1349 }
1350 }
1351 }
1352
1353 HRESULT hr = S_OK;
1354 m_FieldDrawn = 0;
1355 bool updateStats = false;
1356
1357 if (CComQIPtr<IMediaSideData> pMediaSideData = pSample) {
1358 size_t size = 0;
1359 MediaSideData3DOffset* offset = nullptr;
1360 hr = pMediaSideData->GetSideData(IID_MediaSideData3DOffset, (const BYTE**)&offset, &size);
1361 if (SUCCEEDED(hr) && size == sizeof(MediaSideData3DOffset) && offset->offset_count > 0 && offset->offset[0]) {
1362 m_nStereoSubtitlesOffsetInPixels = offset->offset[0];
1363 }
1364
1365 if (m_srcParams.CSType == CS_YUV && (m_bHdrPreferDoVi || !SourceIsPQorHLG())) {
1366 MediaSideDataDOVIMetadata* pDOVIMetadata = nullptr;
1367 hr = pMediaSideData->GetSideData(IID_MediaSideDataDOVIMetadataV2, (const BYTE**)&pDOVIMetadata, &size);
1368 if (SUCCEEDED(hr) && size == sizeof(MediaSideDataDOVIMetadata) && CheckDoviMetadata(pDOVIMetadata, 0)) {
1369 const bool bYCCtoRGBChanged = !m_PSConvColorData.bEnable ||
1370 (memcmp(
1371 &m_Dovi.msd.ColorMetadata.ycc_to_rgb_matrix,
1372 &pDOVIMetadata->ColorMetadata.ycc_to_rgb_matrix,
1373 sizeof(MediaSideDataDOVIMetadata::ColorMetadata.ycc_to_rgb_matrix) + sizeof(MediaSideDataDOVIMetadata::ColorMetadata.ycc_to_rgb_offset)
1374 ) != 0);
1375 const bool bRGBtoLMSChanged =
1376 (memcmp(
1377 &m_Dovi.msd.ColorMetadata.rgb_to_lms_matrix,
1378 &pDOVIMetadata->ColorMetadata.rgb_to_lms_matrix,
1379 sizeof(MediaSideDataDOVIMetadata::ColorMetadata.rgb_to_lms_matrix)
1380 ) != 0);
1381 const bool bMappingCurvesChanged =
1382 (memcmp(
1383 &m_Dovi.msd.Mapping.curves,
1384 &pDOVIMetadata->Mapping.curves,
1385 sizeof(MediaSideDataDOVIMetadata::Mapping.curves)
1386 ) != 0);
1387

Callers

nothing calls this directly

Calls 9

GetPreciseTickFunction · 0.85
DLogFunction · 0.85
GetSideDataMethod · 0.80
GetFramesMethod · 0.80
GetNextInputSurfaceMethod · 0.80
IsReadyMethod · 0.45
GetServiceMethod · 0.45
GetDescMethod · 0.45

Tested by

no test coverage detected