#define DJ_DBG
#include <djMath.h>
#include <djImage.h>
#include <string.h>

using namespace dj;

int main(int, char **)
{
do {
  DJ_DBG_LOG();
  DJ_DBG_FNC("pixelCopy");
  
  randSeed();
  
  Vec2i inSize, outSize;
  Pixel inPixel, outPixel;

  inSize.set(rand(100, 1000), rand(100, 1000));
  outSize.set(rand(100, 1000), rand(100, 1000));
  inPixel.set(
    PIXEL_FORMAT(rand(pixelFormatSize)),
    PIXEL_TYPE(rand(pixelTypeSize))
  );
  outPixel.set(
    PIXEL_FORMAT(rand(pixelFormatSize)),
    PIXEL_TYPE(rand(pixelTypeSize))
  );
  
  /*inSize = Vec2i(2048, 1556);
  outSize = Vec2i(2048, 1556);
  inPixel.set(PIXEL_RGBA, PIXEL_F32);
  outPixel.set(PIXEL_RGBA, PIXEL_F32);*/
  
  Image input(inSize, inPixel), output(outSize, outPixel);
  DJ_DBG_PRN("input = " << input);
  DJ_DBG_PRN("output = " << output);
  
do {
  Timer t;
  t.start();
  pixelCopy(input, &output);
  /*::memcpy(
    output.data(), input.data(),
    area(input.size()) * pixelSize(input.format()) * pixelSize(input.type())
  );*/
  t.check();
  const int size = area(input.size()) * pixelSize(output.pixel());
  DJ_DBG_PRN("MBs = " << (size / double(megabyte) / t.seconds()));
} while (0);
  
} while (1);
}
