From 42c6f85642e9a8b3a86c1093434fc7e16cff78be Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Fri, 11 Oct 2013 12:12:08 -0400 Subject: [PATCH] Add some convenience Image functions. --- Base/include/Image.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Base/include/Image.h b/Base/include/Image.h index 1c70712..7e252a8 100644 --- a/Base/include/Image.h +++ b/Base/include/Image.h @@ -59,6 +59,7 @@ namespace FasTC { class Image { public: + Image() : m_Width(0), m_Height(0), m_Pixels(0) { } Image(uint32 width, uint32 height); Image(uint32 width, uint32 height, const PixelType *pixels, @@ -95,6 +96,15 @@ namespace FasTC { } bool GetBlockStreamOrder() const { return m_bBlockStreamOrder; } + template + void ConvertTo(Image &other) const { + for(uint32 j = 0; j < other.GetWidth(); j++) { + for(uint32 i = 0; i < other.GetHeight(); i++) { + other(i, j).Unpack((*this)(i, j).Pack()); + } + } + } + double ComputePSNR(Image *other); // Function to allow derived classes to populate the pixel array.