mediafoundation: Cleanup comments/dead code

Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35413>
This commit is contained in:
Sil Vilerino 2025-06-09 07:56:54 -04:00 committed by Marge Bot
parent 9f4768c37d
commit a92a24d845
4 changed files with 0 additions and 134 deletions

View file

@ -403,100 +403,6 @@ CDX12EncHMFT::PrepareForEncodeHelper( LPDX12EncodeContext pDX12EncodeContext, bo
}
}
//
// TODO: Just to test the backend, needs proper plumbing to CodecAPI
//
#if 0 // TODO: Enable me
if (//(m_EncoderCapabilities.m_HWSupportMoveRects.bits.max_motion_hints > 0)
// (m_EncoderCapabilities.m_HWSupportMoveRects.bits.supports_precision_full_pixel) &&
(pPicInfo->dpb_size > 1) /*at least 1 ref frame*/)
{
pPicInfo->move_info.input_mode = PIPE_ENC_MOVE_INFO_INPUT_MODE_MAP;
if (pPicInfo->move_info.input_mode == PIPE_ENC_MOVE_INFO_INPUT_MODE_MAP)
{
pPicInfo->move_info.num_hints = 1u;
pPicInfo->move_info.map_mv_precision = PIPE_ENC_MOVE_MAP_MOTION_UNIT_PRECISION_FULL_PIXEL;
struct pipe_resource templ = {};
memset(&templ, 0, sizeof(templ));
templ.target = PIPE_TEXTURE_2D;
templ.usage = PIPE_USAGE_DEFAULT;
templ.depth0 = 1;
templ.array_size = 1;
templ.format = PIPE_FORMAT_R16G16_SINT;
templ.width0 = pDX12EncodeContext->pPipeVideoBuffer->width;
templ.height0 = static_cast<uint16_t>(pDX12EncodeContext->pPipeVideoBuffer->height);
CHECKNULL_GOTO(
pPicInfo->move_info.gpu_motion_vectors_map[0] = m_pVlScreen->pscreen->resource_create(m_pVlScreen->pscreen, &templ),
E_OUTOFMEMORY,
done);
templ.format = PIPE_FORMAT_R8_UINT;
CHECKNULL_GOTO(
pPicInfo->move_info.gpu_motion_metadata_map[0] = m_pVlScreen->pscreen->resource_create(m_pVlScreen->pscreen, &templ),
E_OUTOFMEMORY,
done);
}
else if (pPicInfo->move_info.input_mode == PIPE_ENC_MOVE_INFO_INPUT_MODE_RECTS)
{
pPicInfo->move_info.num_rects = 2;
pPicInfo->move_info.rects[0].source_point = {
// uint32_t x;
0u,
// uint32_t y;
0u,
};
pPicInfo->move_info.rects[0].dest_rect = {
// uint32_t top;
20u,
// uint32_t left;
20u,
// uint32_t right;
36u,
// uint32_t bottom;
36u,
};
pPicInfo->move_info.rects[1].source_point = {
// uint32_t x;
40u,
// uint32_t y;
40u,
};
pPicInfo->move_info.rects[1].dest_rect = {
// uint32_t top;
50u,
// uint32_t left;
50u,
// uint32_t right;
66u,
// uint32_t bottom;
66u,
};
// It's always the latest one in reference_frames_tracker_h264 for now, but better
// to set a new uint in from reference_frames_tracker_h264 or iterate on the dpb snap array
// and find the index that matches with current pic poc == dpb.poc
pPicInfo->move_info.dpb_reference_index = pPicInfo->dpb_size - 1;
pPicInfo->move_info.precision = PIPE_ENC_MOVE_INFO_PRECISION_UNIT_FULL_PIXEL;
pPicInfo->move_info.overlapping_rects = false;
}
}
#endif
//
// TODO: Just to test the backend, needs proper plumbing to CodecAPI
//
#if 0 // TODO: Enable me
pPicInfo->gpu_stats_qp_map = pDX12EncodeContext->pPipeResourceQPMapStats;
pPicInfo->gpu_stats_satd_map = pDX12EncodeContext->pPipeResourceSATDMapStats;
pPicInfo->gpu_stats_rc_bitallocation_map = pDX12EncodeContext->pPipeResourceRCBitAllocMapStats;
pPicInfo->gpu_stats_psnr = pDX12EncodeContext->pPipeResourcePSNRStats;
#endif
// Quality vs speed
// PIPE: The quality level range is [1..m_uiMaxHWSupportedQualityVsSpeedLevel]
// A lower value means higher quality (slower encoding speed), and a value of 1 represents the highest quality
@ -535,7 +441,6 @@ CDX12EncHMFT::PrepareForEncodeHelper( LPDX12EncodeContext pDX12EncodeContext, bo
{
pPicInfo->slices_descriptors[i].macroblock_address = slice_starting_mb;
pPicInfo->slices_descriptors[i].num_macroblocks = blocks_per_slice;
pPicInfo->slices_descriptors[i].slice_type = PIPE_H264_SLICE_TYPE_P; // %%%TODO%%%
slice_starting_mb += blocks_per_slice;
}
}
@ -558,7 +463,6 @@ CDX12EncHMFT::PrepareForEncodeHelper( LPDX12EncodeContext pDX12EncodeContext, bo
{
pPicInfo->slices_descriptors[i].macroblock_address = slice_starting_mb;
pPicInfo->slices_descriptors[i].num_macroblocks = blocks_per_slice;
pPicInfo->slices_descriptors[i].slice_type = PIPE_H264_SLICE_TYPE_P; // %%%TODO%%%
slice_starting_mb += blocks_per_slice;
}
}

View file

@ -439,7 +439,6 @@ CDX12EncHMFT::PrepareForEncodeHelper( LPDX12EncodeContext pDX12EncodeContext, bo
{
pPicInfo->slices_descriptors[i].slice_segment_address = slice_starting_mb;
pPicInfo->slices_descriptors[i].num_ctu_in_slice = blocks_per_slice;
pPicInfo->slices_descriptors[i].slice_type = PIPE_H265_SLICE_TYPE_P; // %%%TODO%%%
slice_starting_mb += blocks_per_slice;
}
}
@ -671,7 +670,6 @@ CDX12EncHMFT::GetCodecPrivateData( LPBYTE pSPSPPSData, DWORD dwSPSPPSDataLen, LP
h265_pic_desc.base.profile = m_outputPipeProfile;
// TODO: might not be needed for 265, check later, for now dup logic
h265_pic_desc.pic_order_cnt_type = ( p_picture_period > 2 ) ? 0u : 2u;
h265_pic_desc.pic_order_cnt = 0; // cur_frame_desc->gop_info->picture_order_count;
h265_pic_desc.picture_type = PIPE_H2645_ENC_PICTURE_TYPE_IDR; // cur_frame_desc->gop_info->frame_type;

View file

@ -220,8 +220,6 @@ typedef struct tVUInfo
BOOL bEnableVST;
VideoSignalType stVidSigType;
// TODO: This seems incomplete, more VUI params to fill and then plumb to DX12 backend VUI header writer
} VUInfo;
// Slice control modes supported by the encoder.
@ -409,7 +407,6 @@ class __declspec( uuid( HMFT_GUID ) ) CDX12EncHMFT : CMFD3DManager,
MFRatio m_PixelAspectRatio = { 1, 1 }; // default to 1:1
MFNominalRange m_eNominalRange = MFNominalRange_16_235;
// TODO%%% Convert this to a map based on CODECAPI_guidname...
BOOL m_bForceKeyFrame = FALSE;
UINT32 m_uiRateControlMode = eAVEncCommonRateControlMode_CBR;
BOOL m_bRateControlModeSet = FALSE;

View file

@ -637,7 +637,6 @@ CDX12EncHMFT::OnDrain()
}
CHECKHR_GOTO( QueueEvent( METransformDrainComplete, GUID_NULL, S_OK, nullptr ), done );
// NOTE: Draining doesn't really complete here, it completes on next MFT_MESSAGE_NOTIFY_START_OF_STREAM
// %%%TODO - consider using m_bStreaming as the control variable, instead of the additional m_bDraining?
done:
return hr;
}
@ -908,9 +907,6 @@ CDX12EncHMFT::InitializeEncoder( pipe_video_profile videoProfile, UINT32 Width,
NULL,
PIPE_FD_TYPE_TIMELINE_SEMAPHORE );
// TODO: CODECAPI_AVEncMPVDefaultBPictureCount > 0 not implemented fully (e.g frame batching by display order +
// reordered pipe submission in encode order from MF sample input frames queue)
hr = S_OK;
}
@ -1282,36 +1278,7 @@ CDX12EncHMFT::xThreadProc( void *pCtx )
UINT64 frameDuration = 0;
GUID guidMajorType = { 0 };
GUID guidSubType = { 0 };
#if 0
// to ensure DTS is always less than or equal to PTS for MPEG-2 TS/PS and MPEG-4 file format
// an offset is added to PTS
// ideally the offset shall be (frame duration) * (the max number of reordered frames)
// MS H.264 encoder has a fixed GOP pattern of IPBPB... or IPBBPBB.. or IPBBBPBBB...
// that is, the number of reordered frames is 1 currently
if (m_uiBFrameCount)
{
hr = spOutputSample->SetSampleTime(qwOutputSamplePTS+qwOutputSamplePTSDuration);
}
else
{
hr = spOutputSample->SetSampleTime(qwOutputSamplePTS);
}
if (EncOutputInfo.m_pQPMap && EncOutputInfo.m_dwQPMapSize) {
pOutputSamples[0].pSample->SetBlob (MFSampleExtension_VideoEncodeQPMap, EncOutputInfo.m_pQPMap, EncOutputInfo.m_dwQPMapSize);
}
pOutputSamples[0].pSample->SetUINT32( MFSampleExtension_LongTermReferenceFrameInfo, ( ( EncOutputInfo.m_dwUsedLTRIndex << 16 ) | 0x0000ffff ) & ( EncOutputInfo.m_dwLongTermFrameIdx | 0xffff0000 ) );
if (m_uiMeanAbsoluteDifference)
{
UINT32 uiMeanSAD = EncOutputInfo.m_uiMeanSAD;
CHECKHR_GOTO(pOutputSamples[0].pSample->SetUINT32(MFSampleExtension_MeanAbsoluteDifference, uiMeanSAD), done);
}
if (EncOutputInfo.m_bLastSlice)
{
(void)pOutputSamples[0].pSample->SetUINT32(MFSampleExtension_LastSlice, 1);
}
#endif
pThis->m_spOutputType->GetMajorType( &guidMajorType );
spOutputSample->SetGUID( MF_MT_MAJOR_TYPE, guidMajorType );
pThis->m_spOutputType->GetGUID( MF_MT_SUBTYPE, &guidSubType );