Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save warped-rudi/3366f6f20c55d25797f5 to your computer and use it in GitHub Desktop.
Save warped-rudi/3366f6f20c55d25797f5 to your computer and use it in GitHub Desktop.
JPEG-performance-metering
diff -Naur a/Texture.cpp b/Texture.cpp
--- a/xbmc/guilib/Texture.cpp 2013-12-12 22:47:49.000000000 +0100
+++ b/xbmc/guilib/Texture.cpp 2014-01-16 21:22:58.000000000 +0100
@@ -36,6 +36,8 @@
#include "filesystem/AndroidAppFile.h"
#endif
+#include "threads/SystemClock.h"
+
/************************************************************************/
/* */
/************************************************************************/
@@ -248,6 +250,7 @@
else
pImage = ImageFactory::CreateLoaderFromMimeType(strMimeType);
+ CLog::Log(LOGNOTICE, "%s - Loading %s", __FUNCTION__, texturePath.c_str());
if(!LoadIImage(pImage, (unsigned char *) inputBuff, inputBuffSize, width, height, autoRotate))
{
delete pImage;
@@ -275,6 +279,7 @@
unsigned int height = maxHeight ? std::min(maxHeight, g_Windowing.GetMaxTextureSize()) : g_Windowing.GetMaxTextureSize();
IImage* pImage = ImageFactory::CreateLoaderFromMimeType(mimeType);
+ CLog::Log(LOGNOTICE, "%s - Loading %s from memory", __FUNCTION__, mimeType.c_str());
if(!LoadIImage(pImage, buffer, size, width, height))
{
delete pImage;
@@ -291,6 +296,8 @@
bool CBaseTexture::LoadIImage(IImage *pImage, unsigned char* buffer, unsigned int bufSize, unsigned int width, unsigned int height, bool autoRotate)
{
+ unsigned int start = XbmcThreads::SystemClockMillis();
+
if(pImage != NULL && pImage->LoadImageFromMemory(buffer, bufSize, width, height))
{
if (pImage->Width() > 0 && pImage->Height() > 0)
@@ -298,6 +305,9 @@
Allocate(pImage->Width(), pImage->Height(), XB_FMT_A8R8G8B8);
if (pImage->Decode(m_pixels, GetPitch(), XB_FMT_A8R8G8B8))
{
+ start = XbmcThreads::SystemClockMillis() - start;
+ CLog::Log(LOGNOTICE, "%s: loaded in %d ms", __FUNCTION__, /*texturePath.c_str(),*/ start);
+
if (autoRotate && pImage->Orientation())
m_orientation = pImage->Orientation() - 1;
m_hasAlpha = pImage->hasAlpha();
@@ -308,6 +318,7 @@
}
}
}
+ CLog::Log(LOGNOTICE, "%s - failed !", __FUNCTION__);
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment