libjxl

FORK: libjxl patches used on blog
git clone https://git.neptards.moe/blog/libjxl.git
Log | Files | Refs | Submodules | README | LICENSE

codec_config.cc (1311B)


      1 // Copyright (c) the JPEG XL Project Authors. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file.
      5 
      6 #include "tools/codec_config.h"
      7 
      8 #include <hwy/targets.h>
      9 
     10 #include "tools/tool_version.h"
     11 
     12 namespace jpegxl {
     13 namespace tools {
     14 
     15 std::string CodecConfigString(uint32_t lib_version) {
     16   std::string config;
     17 
     18   if (lib_version != 0) {
     19     char version_str[20];
     20     snprintf(version_str, sizeof(version_str), "v%d.%d.%d ",
     21              lib_version / 1000000, (lib_version / 1000) % 1000,
     22              lib_version % 1000);
     23     config += version_str;
     24   }
     25 
     26   std::string version = kJpegxlVersion;
     27   if (version != "(unknown)") {
     28     config += version + ' ';
     29   }
     30 
     31 #if defined(ADDRESS_SANITIZER)
     32   config += " asan ";
     33 #elif defined(MEMORY_SANITIZER)
     34   config += " msan ";
     35 #elif defined(THREAD_SANITIZER)
     36   config += " tsan ";
     37 #else
     38 #endif
     39 
     40   bool saw_target = false;
     41   config += "[";
     42   for (const uint32_t target : hwy::SupportedAndGeneratedTargets()) {
     43     config += hwy::TargetName(target);
     44     config += ',';
     45     saw_target = true;
     46   }
     47   if (!saw_target) {
     48     config += "no targets found,";
     49   }
     50   config.resize(config.size() - 1);  // remove trailing comma
     51   config += "]";
     52 
     53   return config;
     54 }
     55 
     56 }  // namespace tools
     57 }  // namespace jpegxl