MCPcopy Create free account
hub / github.com/GPUOpen-Tools/compressonator / CMP_CreateBlockEncoder

Function CMP_CreateBlockEncoder

cmp_framework/compute_base.cpp:586–620  ·  view source on GitHub ↗

Block Level Encoder Support

Source from the content-addressed store, hash-verified

584// Block Level Encoder Support
585//
586CMP_ERROR CMP_API CMP_CreateBlockEncoder(void** block_encoder, CMP_EncoderSetting encodeSettings)
587{
588 CMP_RegisterHostPlugins(); // Keep for legacy, user should now use CMP_InitFramework
589
590 PluginInterface_Encoder* encoder_codec;
591 encoder_codec = reinterpret_cast<PluginInterface_Encoder*>(g_pluginManager.GetPlugin("ENCODER", GetFormatDesc((CMP_FORMAT)encodeSettings.format)));
592 if (encoder_codec == NULL)
593 {
594 PrintInfo("Failed to load [%s] encoder\n", GetFormatDesc((CMP_FORMAT)encodeSettings.format));
595 return CMP_ERR_UNABLE_TO_LOAD_ENCODER;
596 }
597
598 CMP_Encoder* blockEncoder = (CMP_Encoder*)encoder_codec->TC_Create();
599 if (blockEncoder == NULL)
600 {
601 PrintInfo("Failed to create block encoder [%s]\n", GetFormatDesc((CMP_FORMAT)encodeSettings.format));
602 return CMP_ERR_UNABLE_TO_CREATE_ENCODER;
603 }
604
605 KernelOptions kernelOptions;
606 kernelOptions.height = encodeSettings.height;
607 kernelOptions.width = encodeSettings.width;
608 kernelOptions.fquality = encodeSettings.quality;
609
610 encoder_codec->TC_Init(&kernelOptions);
611
612 blockEncoder->m_quality = encodeSettings.quality;
613 blockEncoder->m_srcHeight = encodeSettings.height;
614 blockEncoder->m_srcWidth = encodeSettings.width;
615
616 *block_encoder = blockEncoder;
617 delete encoder_codec;
618
619 return CMP_OK;
620}
621
622CMP_ERROR CMP_API CMP_CompressBlock(void** block_encoder, void* SourceTexture, unsigned int sourceStride, void* DestTexture, unsigned int DestStride)
623{

Callers 4

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 6

CMP_RegisterHostPluginsFunction · 0.85
GetFormatDescFunction · 0.85
PrintInfoFunction · 0.85
GetPluginMethod · 0.80
TC_CreateMethod · 0.45
TC_InitMethod · 0.45

Tested by 2

mainFunction · 0.68
mainFunction · 0.68