| 830 | } |
| 831 | |
| 832 | bool Tr2DxtCompressSurface( Tr2DxtCompressionFormat eCompressFmt, |
| 833 | const uint8_t* inBuf, |
| 834 | unsigned width, |
| 835 | unsigned height, |
| 836 | uint8_t* outBuf, |
| 837 | size_t outputPitch, |
| 838 | volatile const bool& cancel, |
| 839 | Tr2DxtCompressionSquishQuality squishQualityEnum ) |
| 840 | { |
| 841 | CCP_STATS_ZONE( __FUNCTION__ ); |
| 842 | |
| 843 | int squishQuality = squish::kColourRangeFit; |
| 844 | |
| 845 | ptrdiff_t outputBytes = 0; |
| 846 | |
| 847 | switch( squishQualityEnum ) |
| 848 | { |
| 849 | case TR2DXT_COMPRESS_SQ_ITER_CLUSTER_FIT: |
| 850 | squishQuality = squish::kColourIterativeClusterFit; |
| 851 | break; |
| 852 | |
| 853 | case TR2DXT_COMPRESS_SQ_CLUSTER_FIT: |
| 854 | squishQuality = squish::kColourClusterFit; |
| 855 | break; |
| 856 | |
| 857 | case TR2DXT_COMPRESS_SQ_RANGE_FIT: |
| 858 | squishQuality = squish::kColourRangeFit; |
| 859 | break; |
| 860 | default: |
| 861 | break; |
| 862 | } |
| 863 | |
| 864 | switch( eCompressFmt ) |
| 865 | { |
| 866 | case TR2DXT_COMPRESS_RT_DXT1: |
| 867 | CompressImageDXT1( (const uint8_t*)inBuf, (uint8_t*)outBuf, width, height, outputBytes, cancel ); |
| 868 | break; |
| 869 | |
| 870 | case TR2DXT_COMPRESS_RT_DXT5: |
| 871 | CompressImageDXT5( (const uint8_t*)inBuf, (uint8_t*)outBuf, width, height, outputBytes, cancel ); |
| 872 | break; |
| 873 | |
| 874 | case TR2DXT_COMPRESS_RT_DXT5N: |
| 875 | CompressNormalMapDXT5( (const uint8_t*)inBuf, (uint8_t*)outBuf, width, height, outputBytes, cancel ); |
| 876 | break; |
| 877 | |
| 878 | case TR2DXT_COMPRESS_RT_YCOCGDXT5: |
| 879 | ConvertRGBToCoCg_Y( (uint8_t*)inBuf, width, height ); |
| 880 | CompressYCoCgDXT5( (const uint8_t*)inBuf, (uint8_t*)outBuf, width, height, outputBytes, cancel ); |
| 881 | break; |
| 882 | |
| 883 | case TR2DXT_COMPRESS_RT_3DC: |
| 884 | CompressNormalMap3Dc( (const uint8_t*)inBuf, (uint8_t*)outBuf, width, height, outputBytes, cancel ); |
| 885 | break; |
| 886 | |
| 887 | case TR2DXT_COMPRESS_SQUISH_DXT1: |
| 888 | CompressImageSquish( (const uint8_t*)inBuf, |
| 889 | width, |
no test coverage detected