cmdline only: print image properties (i.e. image name, path, file size, image size, image width, height, miplevel and format)
| 1911 | |
| 1912 | //cmdline only: print image properties (i.e. image name, path, file size, image size, image width, height, miplevel and format) |
| 1913 | static bool OutputImageProps(const std::string& filePath) |
| 1914 | { |
| 1915 | MipSet mipSet = {}; |
| 1916 | |
| 1917 | if (!(CMP_FileExists(filePath))) |
| 1918 | { |
| 1919 | PrintInfo("Error: Image File is not found.\n"); |
| 1920 | return false; |
| 1921 | } |
| 1922 | |
| 1923 | // file name |
| 1924 | { |
| 1925 | std::string fileName = CMP_GetFileName(filePath); |
| 1926 | PrintInfo("File Name: %s\n", fileName.c_str()); |
| 1927 | } |
| 1928 | |
| 1929 | // full path |
| 1930 | PrintInfo("File Full Path: %s\n", CMP_GetFullPath(filePath).c_str()); |
| 1931 | |
| 1932 | // file size |
| 1933 | uintmax_t fileSize = CMP_GetFileSize(filePath); |
| 1934 | |
| 1935 | if (fileSize > 1024000) |
| 1936 | { |
| 1937 | fileSize /= 1024000; |
| 1938 | PrintInfo("File Size: %ju MB\n", fileSize); |
| 1939 | } |
| 1940 | else if (fileSize > 1024) |
| 1941 | { |
| 1942 | fileSize /= 1024; |
| 1943 | PrintInfo("File Size: %ju KB\n", fileSize); |
| 1944 | } |
| 1945 | else |
| 1946 | { |
| 1947 | PrintInfo("File Size: %ju Bytes\n", fileSize); |
| 1948 | } |
| 1949 | |
| 1950 | // load image into mipset |
| 1951 | if (AMDLoadMIPSTextureImage(filePath.c_str(), &mipSet, g_CmdPrams.use_OCV, &g_pluginManager) != 0) |
| 1952 | { |
| 1953 | PrintInfo("Error: reading image, data type not supported.\n"); |
| 1954 | return false; |
| 1955 | } |
| 1956 | |
| 1957 | //image size |
| 1958 | |
| 1959 | CMIPS CMips; |
| 1960 | MipLevel* mipLevel = CMips.GetMipLevel(&mipSet, 0, 0); |
| 1961 | uintmax_t imagesize = mipLevel->m_dwLinearSize; |
| 1962 | |
| 1963 | if (imagesize > 1024000) |
| 1964 | { |
| 1965 | imagesize /= 1024000; |
| 1966 | PrintInfo("Image Size: %ju MB\n", imagesize); |
| 1967 | } |
| 1968 | else if (imagesize > 1024) |
| 1969 | { |
| 1970 | imagesize /= 1024; |
no test coverage detected