Ejemplo n.º 1
0
// ######################################################################
bool operator==(const GenericFrame& f1, const GenericFrame& f2)
{
  if (f1.nativeType() == f2.nativeType())
    {
      switch (f1.nativeType())
        {
        case GenericFrame::NONE: return true;
        case GenericFrame::RGB_U8: return f1.asRgbU8() == f2.asRgbU8();
        case GenericFrame::RGBD: return ((f1.asRgbU8() == f2.asRgbU8()) && (f1.asGrayU16() == f2.asGrayU16()));
        case GenericFrame::RGB_F32: return f1.asRgbF32() == f2.asRgbF32();
        case GenericFrame::GRAY_U8: return f1.asGrayU8() == f2.asGrayU8();
        case GenericFrame::GRAY_F32: return f1.asGrayF32() == f2.asGrayF32();
        case GenericFrame::VIDEO:
          {
            const VideoFrame v1 = f1.asVideo();
            const VideoFrame v2 = f2.asVideo();

            if (v1.getMode() == v2.getMode())
              return std::equal(v1.getBuffer(),
                                v1.getBuffer() + v1.getBufSize(),
                                v2.getBuffer());
            else
              return v1.toRgb() == v2.toRgb();
          }
        case GenericFrame::RGB_U16:        return f1.asRgbU16() == f2.asRgbU16();
        case GenericFrame::GRAY_U16:       return f1.asGrayU16() == f2.asGrayU16();
        }
    }

  return f1.asRgbF32() == f2.asRgbF32();
}
Ejemplo n.º 2
0
  void printHash(const VideoFrame& frame,
                 const std::string& imgname, const std::string& imgtype)
  {
    const uint32 h =
      jenkinshash(reinterpret_cast<const byte*>(frame.getBuffer()),
                  frame.getBufSize(),
                  0);

    this->doPrintHash(h, imgname, imgtype);
  }