Update o3de to use new packages of ISPCTexComp and squish-ccr (#3556)
Update package name and hash Add compressor names. Update ImageProcessingAtom unit tests. Removed some unused test assets under ImageProcessingAtom Enalbe ISPC to all the platforms. Better error message with compression/decompression Add temp folder to git ignore added ispccompressor for all platform. valid it with linux Update windows package hashes. Removed AZ_TRAIT_IMAGEPROCESSING_USE_ISPC_TEXTURE_COMPRESSOR Minor refactor with image processing unit tests. Signed-off-by: qingtao <qingtao@amazon.com>
This commit is contained in:
@@ -141,6 +141,11 @@ namespace ImageProcessingAtom
|
||||
ColorSpace CTSquisher::GetSupportedColorSpace([[maybe_unused]] EPixelFormat compressFormat) const
|
||||
{
|
||||
return ColorSpace::autoSelect;
|
||||
}
|
||||
|
||||
const char* CTSquisher::GetName() const
|
||||
{
|
||||
return "CTSquisher";
|
||||
}
|
||||
|
||||
EPixelFormat CTSquisher::GetSuggestedUncompressedFormat(EPixelFormat compressedfmt, EPixelFormat uncompressedfmt) const
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace ImageProcessingAtom
|
||||
|
||||
EPixelFormat GetSuggestedUncompressedFormat(EPixelFormat compressedfmt, EPixelFormat uncompressedfmt) const override;
|
||||
ColorSpace GetSupportedColorSpace(EPixelFormat compressFormat) const final;
|
||||
const char* GetName() const final;
|
||||
|
||||
private:
|
||||
static CryTextureSquisher::ECodingPreset GetCompressPreset(EPixelFormat compressFmt, EPixelFormat uncompressFmt);
|
||||
|
||||
@@ -10,22 +10,15 @@
|
||||
#include <Compressors/CTSquisher.h>
|
||||
#include <Compressors/PVRTC.h>
|
||||
#include <Compressors/ETC2.h>
|
||||
|
||||
// this is required for the AZ_TRAIT_IMAGEPROCESSING_USE_ISPC_TEXTURE_COMPRESSOR define
|
||||
#include <ImageProcessing_Traits_Platform.h>
|
||||
|
||||
#if AZ_TRAIT_IMAGEPROCESSING_USE_ISPC_TEXTURE_COMPRESSOR
|
||||
#include <Compressors/ISPCTextureCompressor.h>
|
||||
#endif
|
||||
|
||||
namespace ImageProcessingAtom
|
||||
{
|
||||
ICompressorPtr ICompressor::FindCompressor(EPixelFormat fmt, ColorSpace colorSpace, bool isCompressing)
|
||||
ICompressorPtr ICompressor::FindCompressor(EPixelFormat fmt, [[maybe_unused]] ColorSpace colorSpace, bool isCompressing)
|
||||
{
|
||||
// The ISPC texture compressor is able to compress BC1, BC3, BC6H and BC7 formats, and all of the ASTC formats.
|
||||
// Note: The ISPC texture compressor is only able to compress images that are a multiple of the compressed format's blocksize.
|
||||
// Another limitation is that the compressor requires LDR source images to be in sRGB colorspace.
|
||||
#if AZ_TRAIT_IMAGEPROCESSING_USE_ISPC_TEXTURE_COMPRESSOR
|
||||
if (ISPCCompressor::IsCompressedPixelFormatSupported(fmt))
|
||||
{
|
||||
if ((isCompressing && ISPCCompressor::IsSourceColorSpaceSupported(colorSpace, fmt)) || (!isCompressing && ISPCCompressor::DoesSupportDecompress(fmt)))
|
||||
@@ -33,7 +26,6 @@ namespace ImageProcessingAtom
|
||||
return ICompressorPtr(new ISPCCompressor());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (CTSquisher::IsCompressedPixelFormatSupported(fmt))
|
||||
{
|
||||
|
||||
@@ -48,6 +48,7 @@ namespace ImageProcessingAtom
|
||||
virtual IImageObjectPtr DecompressImage(IImageObjectPtr srcImage, EPixelFormat fmtDst) const = 0;
|
||||
virtual EPixelFormat GetSuggestedUncompressedFormat(EPixelFormat compressedfmt, EPixelFormat uncompressedfmt) const = 0;
|
||||
virtual ColorSpace GetSupportedColorSpace(EPixelFormat compressFormat) const = 0;
|
||||
virtual const char* GetName() const = 0;
|
||||
|
||||
//find compressor for specified compressed pixel format. isCompressing to indicate if it's for compressing or decompressing
|
||||
static ICompressorPtr FindCompressor(EPixelFormat fmt, ColorSpace colorSpace, bool isCompressing);
|
||||
|
||||
@@ -111,6 +111,11 @@ namespace ImageProcessingAtom
|
||||
{
|
||||
return ColorSpace::autoSelect;
|
||||
}
|
||||
|
||||
const char* ETC2Compressor::GetName() const
|
||||
{
|
||||
return "ETC2Compressor";
|
||||
}
|
||||
|
||||
IImageObjectPtr ETC2Compressor::CompressImage(IImageObjectPtr srcImage, EPixelFormat fmtDst,
|
||||
const CompressOption* compressOption) const
|
||||
|
||||
@@ -24,7 +24,8 @@ namespace ImageProcessingAtom
|
||||
IImageObjectPtr DecompressImage(IImageObjectPtr srcImage, EPixelFormat fmtDst) const override;
|
||||
|
||||
EPixelFormat GetSuggestedUncompressedFormat(EPixelFormat compressedfmt, EPixelFormat uncompressedfmt) const override;
|
||||
virtual ColorSpace GetSupportedColorSpace(EPixelFormat compressFormat) const final;
|
||||
ColorSpace GetSupportedColorSpace(EPixelFormat compressFormat) const final;
|
||||
const char* GetName() const final;
|
||||
|
||||
};
|
||||
} // namespace ImageProcessingAtom
|
||||
|
||||
@@ -111,6 +111,11 @@ namespace ImageProcessingAtom
|
||||
return ColorSpace::autoSelect;
|
||||
}
|
||||
|
||||
const char* ISPCCompressor::GetName() const
|
||||
{
|
||||
return "ISPCCompressor";
|
||||
}
|
||||
|
||||
IImageObjectPtr ISPCCompressor::CompressImage(IImageObjectPtr sourceImage, EPixelFormat destinationFormat, const CompressOption* compressOption) const
|
||||
{
|
||||
// Used to find the profile setters, depending on the image quality
|
||||
|
||||
@@ -28,7 +28,9 @@ namespace ImageProcessingAtom
|
||||
|
||||
ColorSpace GetSupportedColorSpace(EPixelFormat compressFormat) const final;
|
||||
IImageObjectPtr CompressImage(IImageObjectPtr sourceImage, EPixelFormat destinationFormat, const CompressOption* compressOption) const final;
|
||||
IImageObjectPtr DecompressImage(IImageObjectPtr sourceImage, EPixelFormat destinationFormat) const final;
|
||||
IImageObjectPtr DecompressImage(IImageObjectPtr sourceImage, EPixelFormat destinationFormat) const final;
|
||||
const char* GetName() const final;
|
||||
|
||||
|
||||
EPixelFormat GetSuggestedUncompressedFormat(EPixelFormat compressedfmt, EPixelFormat uncompressedfmt) const final;
|
||||
};
|
||||
|
||||
@@ -107,6 +107,11 @@ namespace ImageProcessingAtom
|
||||
return ColorSpace::autoSelect;
|
||||
}
|
||||
|
||||
const char* PVRTCCompressor::GetName() const
|
||||
{
|
||||
return "PVRTCCompressor";
|
||||
}
|
||||
|
||||
bool PVRTCCompressor::DoesSupportDecompress([[maybe_unused]] EPixelFormat fmtDst)
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -25,5 +25,6 @@ namespace ImageProcessingAtom
|
||||
|
||||
EPixelFormat GetSuggestedUncompressedFormat(EPixelFormat compressedfmt, EPixelFormat uncompressedfmt) const override;
|
||||
ColorSpace GetSupportedColorSpace(EPixelFormat compressFormat) const final;
|
||||
const char* GetName() const final;
|
||||
};
|
||||
} // namespace ImageProcessingAtom
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/std/time.h>
|
||||
|
||||
#include <Processing/ImageFlags.h>
|
||||
#include <Processing/ImageObjectImpl.h>
|
||||
@@ -97,9 +98,18 @@ namespace ImageProcessingAtom
|
||||
else
|
||||
{
|
||||
IImageObjectPtr dstImage = nullptr;
|
||||
const PixelFormatInfo* compressedInfo = CPixelFormats::GetInstance().GetPixelFormatInfo(compressedFmt);
|
||||
if (isSrcUncompressed)
|
||||
{
|
||||
AZ::u64 startTime = AZStd::GetTimeUTCMilliSecond();
|
||||
dstImage = compressor->CompressImage(Get(), fmtDst, &m_compressOption);
|
||||
AZ::u64 endTime = AZStd::GetTimeUTCMilliSecond();
|
||||
[[maybe_unused]] double processTime = static_cast<double>(endTime - startTime) / 1000.0;
|
||||
if (dstImage)
|
||||
{
|
||||
AZ_TracePrintf("Image Processing", "Image [%dx%d] was compressed to [%s] format by [%s] in %.3f seconds\n",
|
||||
Get()->GetWidth(0), Get()->GetHeight(0), compressedInfo->szName, compressor->GetName(), processTime);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -107,11 +117,13 @@ namespace ImageProcessingAtom
|
||||
}
|
||||
|
||||
Set(dstImage);
|
||||
}
|
||||
|
||||
if (Get() == nullptr)
|
||||
{
|
||||
AZ_Error("Image Processing", false, "The selected compressor failed to compress this image");
|
||||
|
||||
if (dstImage == nullptr)
|
||||
{
|
||||
AZ_Error("Image Processing", false, "Failed to use [%s] to %s [%s] format", compressor->GetName(),
|
||||
isSrcUncompressed ? "compress" : "decompress",
|
||||
compressedInfo->szName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace ImageProcessingAtom
|
||||
builderDescriptor.m_busId = azrtti_typeid<ImageBuilderWorker>();
|
||||
builderDescriptor.m_createJobFunction = AZStd::bind(&ImageBuilderWorker::CreateJobs, &m_imageBuilder, AZStd::placeholders::_1, AZStd::placeholders::_2);
|
||||
builderDescriptor.m_processJobFunction = AZStd::bind(&ImageBuilderWorker::ProcessJob, &m_imageBuilder, AZStd::placeholders::_1, AZStd::placeholders::_2);
|
||||
builderDescriptor.m_version = 23; // [ATOM-14022]
|
||||
builderDescriptor.m_version = 24; // [SPEC-7821]
|
||||
builderDescriptor.m_analysisFingerprint = ImageProcessingAtom::BuilderSettingManager::Instance()->GetAnalysisFingerprint();
|
||||
m_imageBuilder.BusConnect(builderDescriptor.m_busId);
|
||||
AssetBuilderSDK::AssetBuilderBus::Broadcast(&AssetBuilderSDK::AssetBuilderBusTraits::RegisterBuilderInformation, builderDescriptor);
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace ImageProcessingAtom
|
||||
QImage qimage(filename.c_str());
|
||||
if (qimage.isNull())
|
||||
{
|
||||
AZ_Error("ImageProcessing", false, "Failed to load [%s] via QImage", filename.c_str());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -13,4 +13,3 @@
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_PVRTEXLIB_USE_WINDLL_IMPORT 0
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_SQUISH_DO_NOT_USE_FASTCALL 0
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_USE_BASE10_BYTE_PREFIX 0
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_USE_ISPC_TEXTURE_COMPRESSOR 0
|
||||
|
||||
-1
@@ -13,4 +13,3 @@
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_PVRTEXLIB_USE_WINDLL_IMPORT 0
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_SQUISH_DO_NOT_USE_FASTCALL 1
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_USE_BASE10_BYTE_PREFIX 0
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_USE_ISPC_TEXTURE_COMPRESSOR 0
|
||||
|
||||
-1
@@ -13,4 +13,3 @@
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_PVRTEXLIB_USE_WINDLL_IMPORT 0
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_SQUISH_DO_NOT_USE_FASTCALL 1
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_USE_BASE10_BYTE_PREFIX 1
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_USE_ISPC_TEXTURE_COMPRESSOR 0
|
||||
|
||||
-1
@@ -13,4 +13,3 @@
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_PVRTEXLIB_USE_WINDLL_IMPORT 1
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_SQUISH_DO_NOT_USE_FASTCALL 0
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_USE_BASE10_BYTE_PREFIX 0
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_USE_ISPC_TEXTURE_COMPRESSOR 1
|
||||
|
||||
-8
@@ -6,11 +6,3 @@
|
||||
#
|
||||
#
|
||||
|
||||
# windows requires the 3rd Party ISPCTexComp library.
|
||||
|
||||
ly_associate_package(PACKAGE_NAME ISPCTexComp-2021.3-rev1-windows TARGETS ISPCTexComp PACKAGE_HASH 324fb051a549bc96571530e63c01e18a4c860db45317734d86276fe27a45f6dd)
|
||||
|
||||
set(LY_BUILD_DEPENDENCIES
|
||||
PUBLIC
|
||||
3rdParty::ISPCTexComp
|
||||
)
|
||||
|
||||
-2
@@ -9,6 +9,4 @@
|
||||
set(FILES
|
||||
ImageProcessing_Traits_Platform.h
|
||||
ImageProcessing_Traits_Windows.h
|
||||
../../Compressors/ISPCTextureCompressor.cpp
|
||||
../../Compressors/ISPCTextureCompressor.h
|
||||
)
|
||||
|
||||
-1
@@ -13,4 +13,3 @@
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_PVRTEXLIB_USE_WINDLL_IMPORT 0
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_SQUISH_DO_NOT_USE_FASTCALL 1
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_USE_BASE10_BYTE_PREFIX 1
|
||||
#define AZ_TRAIT_IMAGEPROCESSING_USE_ISPC_TEXTURE_COMPRESSOR 0
|
||||
|
||||
@@ -869,7 +869,7 @@ namespace ImageProcessingAtom
|
||||
return process;
|
||||
}
|
||||
|
||||
void ImageConvertProcess::CreateIBLCubemap(AZ::Uuid presetUUID, const char* fileNameSuffix, IImageObjectPtr cubemapImage)
|
||||
void ImageConvertProcess::CreateIBLCubemap(AZ::Uuid presetUUID, const char* fileNameSuffix, IImageObjectPtr& cubemapImage)
|
||||
{
|
||||
const AZStd::string& platformId = m_input->m_platform;
|
||||
AZStd::string_view filePath;
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace ImageProcessingAtom
|
||||
bool FillCubemapMipmaps();
|
||||
|
||||
//IBL cubemap generation, this creates a separate ImageConvertProcess
|
||||
void CreateIBLCubemap(AZ::Uuid presetUUID, const char* fileNameSuffix, IImageObjectPtr cubemapImage);
|
||||
void CreateIBLCubemap(AZ::Uuid presetUUID, const char* fileNameSuffix, IImageObjectPtr& cubemapImage);
|
||||
|
||||
//convert color space to linear with pixel format rgba32f
|
||||
bool ConvertToLinear();
|
||||
|
||||
@@ -36,10 +36,6 @@ namespace ImageProcessingAtom
|
||||
AZ::u32 GetWidth(AZ::u32 mip) const override;
|
||||
AZ::u32 GetHeight(AZ::u32 mip) const override;
|
||||
AZ::u32 GetMipCount() const override;
|
||||
bool IsCubemap() const override
|
||||
{
|
||||
return false;
|
||||
};
|
||||
|
||||
void GetImagePointer(AZ::u32 mip, AZ::u8*& pMem, AZ::u32& pitch) const override;
|
||||
AZ::u32 GetMipBufSize(AZ::u32 mip) const override;
|
||||
|
||||
Reference in New Issue
Block a user