Skip to content

Commit

Permalink
Measuring throughput in Mpx/s
Browse files Browse the repository at this point in the history
  • Loading branch information
Андрей Евстюхин committed Jun 18, 2018
1 parent abbddad commit 62b24f6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
6 changes: 4 additions & 2 deletions Etc2Compress/Etc2Compress.cpp
Expand Up @@ -6994,11 +6994,13 @@ static __m128i PackTexture(uint8_t* dst_etc1, uint8_t* src_bgra, int src_w, int

if ((mode == PackMode::CompressAlphaEnhanced) || (mode == PackMode::CompressColorEnhanced))
{
int n = (src_h * src_w) >> 4;
int pixels = src_h * src_w;

int span = Max((int)std::chrono::duration_cast<std::chrono::milliseconds>(finish - start).count(), 1);

printf(" Compressed %d blocks, elapsed %i ms, %i bps\n", n, span, (int)(n * 1000LL / span));
int kpx_s = pixels / span;

printf(" Compressed %d blocks, elapsed %i ms, throughput %d.%03d Mpx/s\n", pixels >> 4, span, kpx_s / 1000, kpx_s % 1000);
}

return _mm_unpacklo_epi64(_mm_cvtsi64_si128(mse), _mm_castpd_si128(_mm_load_sd(&ssim)));
Expand Down
6 changes: 4 additions & 2 deletions EtcCompress/EtcCompress.cpp
Expand Up @@ -3915,11 +3915,13 @@ static __m128i PackTexture(uint8_t* dst_etc1, uint8_t* src_bgra, int src_w, int

if ((mode == PackMode::CompressAlpha) || (mode == PackMode::CompressColor))
{
int n = (src_h * src_w) >> 4;
int pixels = src_h * src_w;

int span = Max((int)std::chrono::duration_cast<std::chrono::milliseconds>(finish - start).count(), 1);

printf("Compressed %d blocks, elapsed %i ms, %i bps\n", n, span, (int)(n * 1000LL / span));
int kpx_s = pixels / span;

printf("Compressed %d blocks, elapsed %i ms, throughput %d.%03d Mpx/s\n", pixels >> 4, span, kpx_s / 1000, kpx_s % 1000);
}

return _mm_unpacklo_epi64(_mm_cvtsi64_si128(mse), _mm_castpd_si128(_mm_load_sd(&ssim)));
Expand Down
8 changes: 5 additions & 3 deletions PvrtcCompress/PvrtcCompress.cpp
Expand Up @@ -4525,13 +4525,15 @@ static void PackTexture(const char* name, int Size, uint8_t* dst_bgra, const cha

if (mse > 0)
{
int n = (src_s * src_s) >> 4;
int pixels = src_s * src_s;

printf(" Texture %s = %f, elapsed %i ms, %i bps\n",
int kpx_s = pixels / span;

printf(" Texture %s = %f, elapsed %i ms, throughput %d.%03d Mpx/s\n",
psnr,
10.0 * log((255.0 * 255.0) * kColor * (src_s * src_s) / mse) / log(10.0),
span,
(int)(n * 1000LL / span));
kpx_s / 1000, kpx_s % 1000);
}
else
{
Expand Down

0 comments on commit 62b24f6

Please sign in to comment.