本文整理汇总了C++中Pyramid::append_new方法的典型用法代码示例。如果您正苦于以下问题:C++ Pyramid::append_new方法的具体用法?C++ Pyramid::append_new怎么用?C++ Pyramid::append_new使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pyramid
的用法示例。
在下文中一共展示了Pyramid::append_new方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_pyramid
void create_pyramid(const Parameters ¶ms, Pyramid &pyr,
const rod::dimage<float3> &img0,
const rod::dimage<float3> &img1)
{
rod::base_timer &timer_total = rod::timers.gpu_add("Pyramid creation");
size_t nlevels
= log2(std::min(img0.width(),img0.height())) - log2(params.start_res)+1;
rod::base_timer *timer
= &rod::timers.gpu_add("level 0",img0.width()*img0.height(),"P");
rod::dimage<float> luma0(img0.width(),img0.height()),
luma1(img1.width(),img1.height());
PyramidLevel &lvl0 = pyr.append_new(img0.width(), img0.height());
luminance(&luma0, &img0);
luminance(&luma1, &img1);
copy_to_array(lvl0.img0, &luma0);
copy_to_array(lvl0.img1, &luma1);
timer->stop();
int base_level = 0;
for(int l=1; l<nlevels; ++l)
{
int w = round(img0.width()/((float)(1<<l))),
h = round(img0.height()/((float)(1<<l)));
std::clog << "Level " << l << ": " << w << "x" << h << std::endl;
std::ostringstream ss;
ss << "level " << l;
rod::scoped_timer_stop sts(rod::timers.gpu_add(ss.str(), w*h,"P"));
PyramidLevel &lvl = pyr.append_new(w,h);
while((float)pyr[base_level].width/w * pyr[base_level].height/h>=1024)
++base_level;
luma0.resize(w,h);
luma1.resize(w,h);
downsample(&luma0, pyr[base_level].img0,
pyr[base_level].width, pyr[base_level].height);
downsample(&luma1, pyr[base_level].img1,
pyr[base_level].width, pyr[base_level].height);
copy_to_array(lvl.img0, &luma0);
copy_to_array(lvl.img1, &luma1);
}
timer_total.stop();
}