Explicit RGB components mapping. Qualcomm returns it mapping value as below
r: 0 g: 0 b: 0 a: 0
This commit is contained in:
@@ -407,15 +407,25 @@ bool MediaCodecSurfaceManager::CreateVulkanImage(void* vk_device, void* vk_insta
|
||||
LogInfo(" YcbcrModel: " + std::to_string(ycbcrConversionCreateInfo.ycbcrModel));
|
||||
LogInfo(" YcbcrRange: " + std::to_string(ycbcrConversionCreateInfo.ycbcrRange));
|
||||
|
||||
// Use MediaCodec suggested component mapping for all devices
|
||||
// Previous Qualcomm-specific swizzle workaround removed - trust MediaCodec
|
||||
ycbcrConversionCreateInfo.components = ahb_format_props.samplerYcbcrConversionComponents;
|
||||
// Component mapping: MediaCodec returns all 0 (IDENTITY) on Qualcomm, which doesn't work
|
||||
// Need to set explicit component mapping for NV12 format
|
||||
if (is_qualcomm_gpu && ahb_format_props.samplerYcbcrConversionComponents.r == 0) {
|
||||
// WORKAROUND: Qualcomm returns IDENTITY for all components, but needs explicit mapping
|
||||
ycbcrConversionCreateInfo.components.r = VK_COMPONENT_SWIZZLE_R; // R channel
|
||||
ycbcrConversionCreateInfo.components.g = VK_COMPONENT_SWIZZLE_G; // G channel
|
||||
ycbcrConversionCreateInfo.components.b = VK_COMPONENT_SWIZZLE_B; // B channel
|
||||
ycbcrConversionCreateInfo.components.a = VK_COMPONENT_SWIZZLE_A; // A channel
|
||||
LogInfo(" FORCED explicit R/G/B/A mapping (MediaCodec returned IDENTITY)");
|
||||
} else {
|
||||
ycbcrConversionCreateInfo.components = ahb_format_props.samplerYcbcrConversionComponents;
|
||||
LogInfo(" Using MediaCodec suggested components");
|
||||
}
|
||||
|
||||
LogInfo(" Using MediaCodec suggested components:");
|
||||
LogInfo(" r: " + std::to_string(ahb_format_props.samplerYcbcrConversionComponents.r));
|
||||
LogInfo(" g: " + std::to_string(ahb_format_props.samplerYcbcrConversionComponents.g));
|
||||
LogInfo(" b: " + std::to_string(ahb_format_props.samplerYcbcrConversionComponents.b));
|
||||
LogInfo(" a: " + std::to_string(ahb_format_props.samplerYcbcrConversionComponents.a));
|
||||
LogInfo(" Component mapping:");
|
||||
LogInfo(" r: " + std::to_string(ycbcrConversionCreateInfo.components.r));
|
||||
LogInfo(" g: " + std::to_string(ycbcrConversionCreateInfo.components.g));
|
||||
LogInfo(" b: " + std::to_string(ycbcrConversionCreateInfo.components.b));
|
||||
LogInfo(" a: " + std::to_string(ycbcrConversionCreateInfo.components.a));
|
||||
|
||||
// Use MediaCodec suggested chroma offset (DON'T override!)
|
||||
ycbcrConversionCreateInfo.xChromaOffset = static_cast<VkChromaLocation>(ahb_format_props.suggestedXChromaOffset);
|
||||
|
||||
Reference in New Issue
Block a user