|
|
|
@ -495,6 +495,28 @@ void VulkanHdrGenerator::processImageBatch(
|
|
|
|
|
vkUnmapMemory(device, outputBufferMemory);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add this function to VulkanHdrGenerator.cpp, just before the generateHdr method
|
|
|
|
|
void boostBrightness(std::vector<float>& imageData, float boost = 10.0f) {
|
|
|
|
|
if (imageData.empty()) return;
|
|
|
|
|
|
|
|
|
|
// Find current average brightness
|
|
|
|
|
float totalLum = 0.0f;
|
|
|
|
|
for (size_t i = 0; i < imageData.size(); i += 3) {
|
|
|
|
|
float r = imageData[i];
|
|
|
|
|
float g = imageData[i+1];
|
|
|
|
|
float b = imageData[i+2];
|
|
|
|
|
float lum = 0.2126f * r + 0.7152f * g + 0.0722f * b;
|
|
|
|
|
totalLum += lum;
|
|
|
|
|
}
|
|
|
|
|
float avgLum = totalLum / (imageData.size() / 3);
|
|
|
|
|
ALOGI("Original average luminance: %.4f", avgLum);
|
|
|
|
|
|
|
|
|
|
// Simple linear scaling without tone mapping
|
|
|
|
|
for (size_t i = 0; i < imageData.size(); ++i) {
|
|
|
|
|
imageData[i] *= boost;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool VulkanHdrGenerator::generateHdr(
|
|
|
|
|
const std::vector<std::string>& bmpFiles,
|
|
|
|
|
const std::string& outputFile,
|
|
|
|
@ -567,8 +589,16 @@ bool VulkanHdrGenerator::generateHdr(
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// After all tiles are processed and before writing:
|
|
|
|
|
ALOGI("Applying brightness boost to final HDR image");
|
|
|
|
|
boostBrightness(outputHdrData, 30.0f); // Try a large value like 10.0
|
|
|
|
|
|
|
|
|
|
// Write output HDR
|
|
|
|
|
return HdrWriter::writeRGB(outputFile, outputHdrData, (int)imageWidth, (int)imageHeight, HdrWriter::Format::BMP);
|
|
|
|
|
bool res = HdrWriter::writeRGB(outputFile, outputHdrData, (int)imageWidth, (int)imageHeight, HdrWriter::Format::BMP);
|
|
|
|
|
|
|
|
|
|
ALOGI("BMP saved");
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t VulkanHdrGenerator::findComputeQueueFamily(VkPhysicalDevice device) {
|
|
|
|
|