Block Level Encoder Support
| 584 | // Block Level Encoder Support |
| 585 | // |
| 586 | CMP_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 | |
| 622 | CMP_ERROR CMP_API CMP_CompressBlock(void** block_encoder, void* SourceTexture, unsigned int sourceStride, void* DestTexture, unsigned int DestStride) |
| 623 | { |