void PLFilterResizeBilinear::Apply(PLBmpBase * pBmpSource, PLBmp * pBmpDest) const { PLASSERT(pBmpSource->GetBitsPerPixel()==32 || pBmpSource->GetBitsPerPixel()==24); // Create a new Bitmap pBmpDest->Create(m_NewXSize, m_NewYSize, pBmpSource->GetPixelFormat(), NULL, 0, pBmpSource->GetResolution()); // Create a Filter Class from template PLBilinearContribDef f(0.64); if (pBmpSource->GetBitsPerPixel() == 32) { C2PassScale <CDataRGBA_UBYTE> sS(f); sS.Scale ((CDataRGBA_UBYTE::_RowType *) pBmpSource->GetLineArray(), pBmpSource->GetWidth(), pBmpSource->GetHeight(), (CDataRGBA_UBYTE::_RowType *) pBmpDest->GetLineArray(), pBmpDest->GetWidth(), pBmpDest->GetHeight()); } else { C2PassScale <CDataRGB_UBYTE> sS(f); sS.Scale ((CDataRGB_UBYTE::_RowType *) pBmpSource->GetLineArray(), pBmpSource->GetWidth(), pBmpSource->GetHeight(), (CDataRGB_UBYTE::_RowType *) pBmpDest->GetLineArray(), pBmpDest->GetWidth(), pBmpDest->GetHeight()); } }
void loop() { lBreak(); sM(); sE(); sR(); sR(); sY(); wBreak(); sC(); sH(); sR(); sI(); sS(); sT(); sM(); sA(); sS(); lBreak(); }
BitmapPtr FilterResizeBilinear::apply(BitmapPtr pBmpSrc) { int bpp = pBmpSrc->getBytesPerPixel(); AVG_ASSERT(bpp==4 || bpp==3 || bpp==1); BitmapPtr pBmpDest = BitmapPtr(new Bitmap(m_NewSize, pBmpSrc->getPixelFormat(), pBmpSrc->getName()+"_resized")); BilinearContribDef f(0.64); switch (bpp) { case 4: { TwoPassScale<CDataRGBA_UBYTE> sS(f); sS.Scale((CDataRGBA_UBYTE::PixelClass *) pBmpSrc->getPixels(), pBmpSrc->getSize(), pBmpSrc->getStride(), (CDataRGBA_UBYTE::PixelClass *) pBmpDest->getPixels(), pBmpDest->getSize(), pBmpDest->getStride()); } break; case 3: { TwoPassScale <CDataRGB_UBYTE> sS(f); sS.Scale((CDataRGB_UBYTE::PixelClass *) pBmpSrc->getPixels(), pBmpSrc->getSize(), pBmpSrc->getStride(), (CDataRGB_UBYTE::PixelClass *) pBmpDest->getPixels(), pBmpDest->getSize(), pBmpDest->getStride()); } break; case 1: { TwoPassScale <CDataA_UBYTE> sS(f); sS.Scale((CDataA_UBYTE::PixelClass *) pBmpSrc->getPixels(), pBmpSrc->getSize(), pBmpSrc->getStride(), (CDataA_UBYTE::PixelClass *) pBmpDest->getPixels(), pBmpDest->getSize(), pBmpDest->getStride()); } break; default: AVG_ASSERT(false); } return pBmpDest; }
void boost::svd(boost& U, boost& S, boost& V, const int k) const { bnu::matrix<float> a(matrix_data); bnu::matrix<float> u(this->num_rows(), this->num_rows()); bnu::vector<float> s(this->num_cols()); bnu::matrix<float> v(this->num_cols(), this->num_cols()); lap::gesvd('A', 'A', a, s, u, v); U = u; bnu::matrix<float> sS(k, 1); std::copy(s.begin(), s.end(), sS.begin1()); S = sS; V = v; };