Skip to content

Commit

Permalink
Hide debug functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Evstyukhin committed Apr 3, 2022
1 parent 1fac32f commit 8970415
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/Bc7Compress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ int Bc7MainWithArgs(const IBc7Core& bc7Core, const std::vector<std::string>& arg
if (Max(src_texture_w, src_texture_h) > 16384)
{
PRINTF("Huge image %s", src_name);
delete[] src_image_bgra;
return 1;
}

Expand Down Expand Up @@ -502,6 +503,7 @@ int Bc7MainWithArgs(const IBc7Core& bc7Core, const std::vector<std::string>& arg

SaveBc7(dst_name, (const uint8_t*)head, sizeof(head), dst_bc7, Size);

#if !defined(OPTION_LIBRARY)
PackTexture(bc7Core, dst_bc7, dst_texture_bgra, mask_agrb, src_texture_stride, src_texture_w, src_texture_h, bc7Core.pDecompress, 16, mse_alpha, mse_color, ssim);

if ((bad_name != nullptr) && bad_name[0])
Expand All @@ -519,14 +521,20 @@ int Bc7MainWithArgs(const IBc7Core& bc7Core, const std::vector<std::string>& arg

WriteImage(partitions_name, mask_agrb, src_texture_w, src_texture_h, flip);
}
#else
(void)bad_name;
(void)partitions_name;
#endif

delete[] dst_bc7;
delete[] mask_agrb;
}

if ((result_name != nullptr) && result_name[0])
{
#if !defined(OPTION_LIBRARY)
WriteImage(result_name, dst_texture_bgra, src_texture_w, src_texture_h, flip);
#endif
}

delete[] dst_texture_bgra;
Expand Down
4 changes: 2 additions & 2 deletions src/Bc7Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,7 @@ static void CompressBlock(uint8_t output[16], Cell& input) noexcept

if (input.Error.Total > denoiseStep)
{
if constexpr (kDenoise || kDenoiseStep)
if constexpr ((kDenoise > 0) || (kDenoiseStep > 0))
{
Mode6Index2::CompressBlockFast(input);
}
Expand Down Expand Up @@ -1733,7 +1733,7 @@ static void CompressBlock(uint8_t output[16], Cell& input) noexcept
}
}

#if defined(OPTION_COUNTERS)
#if !defined(OPTION_LIBRARY) && defined(OPTION_COUNTERS)
if (DetectGlitches(input, temp))
{
gCompressBad++;
Expand Down
4 changes: 4 additions & 0 deletions src/Worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ void ProcessTexture(uint8_t* dst, uint8_t* src_bgra, uint8_t* mask_agrb, int str
worker.Run(blockKernel, stride, pErrorAlpha, pErrorColor, pssim);
}

#if !defined(OPTION_LIBRARY)

static ALWAYS_INLINED __m128i ConvertBgraToAgrb(__m128i mc) noexcept
{
#if defined(__SSSE3__)
Expand Down Expand Up @@ -459,3 +461,5 @@ void ShowBadBlocks(const uint8_t* src_bgra, const uint8_t* dst_bgra, uint8_t* ma
}
}
}

#endif
2 changes: 2 additions & 0 deletions src/Worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

void ProcessTexture(uint8_t* dst, uint8_t* src_bgra, uint8_t* mask_agrb, int stride, int src_w, int src_h, PBlockKernel blockKernel, size_t block_size, int64_t& pErrorAlpha, int64_t& pErrorColor, BlockSSIM& pssim);

#if !defined(OPTION_LIBRARY)
bool DetectGlitches(const Cell& input, const Cell& output) noexcept;

void ShowBadBlocks(const uint8_t* src_bgra, const uint8_t* dst_bgra, uint8_t* mask_agrb, int stride, int src_w, int src_h) noexcept;
#endif

0 comments on commit 8970415

Please sign in to comment.