kodi
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DXVA::CEnumeratorHD Class Reference
Inheritance diagram for DXVA::CEnumeratorHD:
Inheritance graph
[legend]
Collaboration diagram for DXVA::CEnumeratorHD:
Collaboration graph
[legend]

Public Member Functions

bool Open (unsigned int width, unsigned int height, DXGI_FORMAT input_dxgi_format)
 
void Close ()
 
void OnCreateDevice () override
 
void OnDestroyDevice (bool) override
 
ProcessorCapabilities ProbeProcessorCaps ()
 
bool CheckConversion (DXGI_FORMAT inputFormat, DXGI_COLOR_SPACE_TYPE inputCS, DXGI_FORMAT outputFormat, DXGI_COLOR_SPACE_TYPE outputCS)
 Check if a conversion is supported by the dxva processor. More...
 
bool IsFormatSupportedInput (DXGI_FORMAT format)
 Check dxva processor for support of the format as input texture. More...
 
bool IsFormatSupportedOutput (DXGI_FORMAT format)
 Check dxva processor for support of the format as output texture. More...
 
void LogSupportedConversions (const DXGI_FORMAT inputFormat, const DXGI_COLOR_SPACE_TYPE inputNativeCS)
 Outputs in the log a list of conversions supported by the DXVA processor. More...
 
bool IsInitialized () const
 
bool IsEnumerator1Available ()
 Returns the availability of the interface ID3D11VideoProcessorEnumerator1 (Windows 10 supporting HDR and above) More...
 
ComPtr< ID3D11VideoProcessor > CreateVideoProcessor (UINT RateConversionIndex)
 
ComPtr< ID3D11VideoProcessorInputView > CreateVideoProcessorInputView (ID3D11Resource *pResource, const D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC *pDesc)
 
ComPtr< ID3D11VideoProcessorOutputView > CreateVideoProcessorOutputView (ID3D11Resource *pResource, const D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC *pDesc)
 
ProcessorConversions SupportedConversions (const SupportedConversionsArgs &args)
 Return a list of conversions supported by the processor for the given parameters. More...
 

Static Public Member Functions

static DXGI_COLOR_SPACE_TYPE AvToDxgiColorSpace (const DXGIColorSpaceArgs &csArgs)
 Converts ffmpeg AV parameters to a DXGI color space. More...
 

Protected Member Functions

void UnInit ()
 
bool OpenEnumerator ()
 
ProcessorFormats GetProcessorFormats (bool inputFormats, bool outputFormats) const
 Retrieve the list of DXGI_FORMAT supported by the DXVA processor. More...
 
std::vector< DXGI_FORMAT > GetProcessorRGBOutputFormats () const
 Retrieve the list of RGB DXGI_FORMAT supported as output by the DXVA processor. More...
 
bool CheckConversionInternal (DXGI_FORMAT inputFormat, DXGI_COLOR_SPACE_TYPE inputCS, DXGI_FORMAT outputFormat, DXGI_COLOR_SPACE_TYPE outputCS) const
 Check if a conversion is supported by the dxva processor. More...
 
bool IsFormatSupportedInternal (DXGI_FORMAT format, D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT support) const
 Check dxva processor for support of the format as input texture. More...
 
ProcessorConversions ListConversions (DXGI_FORMAT inputFormat, const std::vector< DXGI_COLOR_SPACE_TYPE > &inputColorSpaces, const std::vector< DXGI_FORMAT > &outputFormats, const std::vector< DXGI_COLOR_SPACE_TYPE > &outputColorSpaces) const
 Iterate over all combinations of the input parameters and return a list of the combinations that are supported conversions. More...
 
ProcessorConversions LogAndListConversions (const DXGIColorSpaceArgs &inputArgs, const DXGIColorSpaceArgs &outputArgs) const
 Helper function that outputs input/output to log and returns the results of ListConversions for the input parameters. More...
 
AVChromaLocation DefaultChromaSiting (const SupportedConversionsArgs &args) const
 Suggest chroma siting derived from source charateristics. Has limited functionality at this time and supports values that make sense for dxgi. More...
 
AVChromaLocation AlternativeChromaSiting (const AVChromaLocation &location) const
 Suggest an alternative chroma siting to help with dxva processor that don't support some dxgi color spaces. More...
 
- Protected Member Functions inherited from ID3DResource
void Register ()
 
void Unregister ()
 

Protected Attributes

CCriticalSection m_section
 
uint32_t m_width = 0
 
uint32_t m_height = 0
 
ComPtr< ID3D11VideoDevice > m_pVideoDevice
 
ComPtr< ID3D11VideoProcessorEnumerator > m_pEnumerator
 
ComPtr< ID3D11VideoProcessorEnumerator1 > m_pEnumerator1
 
DXGI_FORMAT m_input_dxgi_format {DXGI_FORMAT_UNKNOWN}
 
- Protected Attributes inherited from ID3DResource
bool m_bRegistered = false
 

Member Function Documentation

◆ AlternativeChromaSiting()

AVChromaLocation CEnumeratorHD::AlternativeChromaSiting ( const AVChromaLocation &  location) const
protected

Suggest an alternative chroma siting to help with dxva processor that don't support some dxgi color spaces.

Parameters
locationoriginal chroma siting
Returns
suggested alternative chroma siting

◆ AvToDxgiColorSpace()

DXGI_COLOR_SPACE_TYPE CEnumeratorHD::AvToDxgiColorSpace ( const DXGIColorSpaceArgs csArgs)
static

Converts ffmpeg AV parameters to a DXGI color space.

Parameters
csArgsffmpeg AV picture parameters
Returns
DXGI color space. Special value DXGI_COLOR_SPACE_CUSTOM used when there is no match.

◆ CheckConversion()

bool CEnumeratorHD::CheckConversion ( DXGI_FORMAT  inputFormat,
DXGI_COLOR_SPACE_TYPE  inputCS,
DXGI_FORMAT  outputFormat,
DXGI_COLOR_SPACE_TYPE  outputCS 
)

Check if a conversion is supported by the dxva processor.

Parameters
inputFormatthe input format
inputCSthe input color space
outputFormatthe output format
outputCSthe output color space
Returns
true when the conversion is supported, false when it is not or the API used to validate is not availe (Windows < 10)

◆ CheckConversionInternal()

bool CEnumeratorHD::CheckConversionInternal ( DXGI_FORMAT  inputFormat,
DXGI_COLOR_SPACE_TYPE  inputCS,
DXGI_FORMAT  outputFormat,
DXGI_COLOR_SPACE_TYPE  outputCS 
) const
protected

Check if a conversion is supported by the dxva processor.

Parameters
inputFormatthe input format
inputCSthe input color space
outputFormatthe output format
outputCSthe output color space
Returns
true when the conversion is supported, false when it is not or the API used to validate is not available (Windows < 10)

◆ DefaultChromaSiting()

AVChromaLocation CEnumeratorHD::DefaultChromaSiting ( const SupportedConversionsArgs args) const
protected

Suggest chroma siting derived from source charateristics. Has limited functionality at this time and supports values that make sense for dxgi.

Parameters
argsdescription of the sourcce
Returns
suggested chroma siting.

◆ GetProcessorFormats()

ProcessorFormats CEnumeratorHD::GetProcessorFormats ( bool  inputFormats,
bool  outputFormats 
) const
protected

Retrieve the list of DXGI_FORMAT supported by the DXVA processor.

Parameters
inputFormatsyes/no populate the input formats vector of the returned structure
outputFormatsyes/no populate the output formats vector of the returned structure
Returns
requested list of input and/or output formats.

◆ GetProcessorRGBOutputFormats()

std::vector< DXGI_FORMAT > CEnumeratorHD::GetProcessorRGBOutputFormats ( ) const
protected

Retrieve the list of RGB DXGI_FORMAT supported as output by the DXVA processor.

Returns
Vector of formats

◆ IsEnumerator1Available()

bool DXVA::CEnumeratorHD::IsEnumerator1Available ( )
inline

Returns the availability of the interface ID3D11VideoProcessorEnumerator1 (Windows 10 supporting HDR and above)

Returns
true when the interface is available and initialized, false otherwise

◆ IsFormatSupportedInput()

bool CEnumeratorHD::IsFormatSupportedInput ( DXGI_FORMAT  format)

Check dxva processor for support of the format as input texture.

Parameters
formatthe format
Returns
true supported, false not supported

◆ IsFormatSupportedInternal()

bool CEnumeratorHD::IsFormatSupportedInternal ( DXGI_FORMAT  format,
D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT  support 
) const
protected

Check dxva processor for support of the format as input texture.

Parameters
formatthe format
Returns
true supported, false not supported

◆ IsFormatSupportedOutput()

bool CEnumeratorHD::IsFormatSupportedOutput ( DXGI_FORMAT  format)

Check dxva processor for support of the format as output texture.

Parameters
formatthe format
Returns
true supported, false not supported

◆ ListConversions()

ProcessorConversions CEnumeratorHD::ListConversions ( DXGI_FORMAT  inputFormat,
const std::vector< DXGI_COLOR_SPACE_TYPE > &  inputColorSpaces,
const std::vector< DXGI_FORMAT > &  outputFormats,
const std::vector< DXGI_COLOR_SPACE_TYPE > &  outputColorSpaces 
) const
protected

Iterate over all combinations of the input parameters and return a list of the combinations that are supported conversions.

Parameters
inputFormatThe input format
inputColorSpacesThe possible source color spaces
outputFormatsThe possible output formats
outputColorSpacesThe possible output color spaces
Returns
List of the supported conversion.

◆ LogAndListConversions()

ProcessorConversions CEnumeratorHD::LogAndListConversions ( const DXGIColorSpaceArgs inputArgs,
const DXGIColorSpaceArgs outputArgs 
) const
protected

Helper function that outputs input/output to log and returns the results of ListConversions for the input parameters.

Parameters
inputArgsdescription of the source
outputColorSpacesdescription of the destination
Returns
List of the supported conversion.

◆ LogSupportedConversions()

void CEnumeratorHD::LogSupportedConversions ( const DXGI_FORMAT  inputFormat,
const DXGI_COLOR_SPACE_TYPE  inputNativeCS 
)

Outputs in the log a list of conversions supported by the DXVA processor.

Parameters
inputFormatthe source format
inputNativeCSthe input color space that would be used with a direct mapping from avcodec to D3D11, without any workarounds or tricks.

◆ SupportedConversions()

ProcessorConversions CEnumeratorHD::SupportedConversions ( const SupportedConversionsArgs args)

Return a list of conversions supported by the processor for the given parameters.

Parameters
argsparameters
Returns
list of conversions

The documentation for this class was generated from the following files: