@@ -34,6 +34,22 @@ void Thumbnailer::configure(const Size &sourceSize, PixelFormat pixelFormat)
validConfiguration_ = true;
}
+static std::string datetime()
+{
+ time_t rawtime;
+ struct tm *timeinfo;
+ char buffer[80];
+ static unsigned int milliseconds = 0;
+
+ time(&rawtime);
+ timeinfo = localtime(&rawtime);
+
+ strftime(buffer, 80, "%d-%m-%Y.%H-%M-%S.", timeinfo);
+
+ /* milliseconds is just a fast hack to ensure unique filenames */
+ return std::string(buffer) + std::to_string(milliseconds++);
+}
+
/* Compute a thumbnail size with same aspect ratio as source. */
void Thumbnailer::computeThumbnailSize()
{
@@ -99,6 +115,12 @@ int Thumbnailer::scaleBuffer(const FrameBuffer *source, Span<uint8_t> &dest)
}
}
+ /* Helper code: Write the output pixels to a file so we can inspect */
+ File file("/tmp/" + datetime() + ".raw");
+ int32_t ret = file.open(File::WriteOnly);
+ ret = file.write({ destination, dstSize });
+ LOG(Thumbnailer, Info) << "Wrote " << ret << " bytes: " << targetSize_.width << "x" << targetSize_.height;
+
/* Write scaled pixels to dest */
dest = { destination, dstSize };
Signed-off-by: Umang Jain <email@uajain.com> --- src/android/jpeg/thumbnailer.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)