10 # include <vcl_msvc_warnings.h> 18 static const unsigned long large_image_limit_ = 1024ul * 1024ul * 8ul;
29 for (
unsigned bi = 0; bi<bsrc->n_block_i(); ++bi)
30 for (
unsigned bj = 0; bj<bsrc->n_block_j(); ++bj)
33 if (!blk)
return false;
34 if (!bdet->put_block(bi, bj, *blk))
return false;
47 if (dest->ni() != src->ni() || dest->nj() != src->nj() ||
48 dest->nplanes() != src->nplanes() || dest->pixel_format() != src->pixel_format() )
51 if (src->ni() == 0 || src->nj() == 0 || src->nplanes() == 0)
return true;
55 unsigned src_sbi=0, src_sbj=0, dest_sbi=0, dest_sbj=0;
63 if (src_sbi>0&&src_sbj>0&&src_sbi==dest_sbi&&src_sbj==dest_sbj)
64 return copy_resource_by_blocks(src, dest);
66 if (src->ni() * src->nj() * src->nplanes() < large_image_limit_)
69 if (!view_ref)
return false;
70 return dest->put_view(*view_ref);
74 unsigned got_to_line =0;
75 unsigned block_size = std::max(static_cast<unsigned>(large_image_limit_ / src->ni()),1u);
77 while (got_to_line < src->nj())
80 std::min(block_size, src->nj()-got_to_line));
81 if (!view_ref)
return false;
82 if (!dest->put_view(*view_ref,0,got_to_line))
return false;
83 got_to_line += block_size;
91 if(src ==
nullptr)
return nullptr;
vil_image_resource_sptr vil_new_image_resource(unsigned ni, unsigned nj, unsigned nplanes, vil_pixel_format format)
Make a new image of given format.
A blocked representation of the image_resource.
vil_blocked_image_resource_sptr blocked_image_resource(const vil_image_resource_sptr &ir)
cast to blocked resource if possible.
#define vil_property_size_block_i
For unblocked images, the following properties are not implemented.
Various image copying functions.
There is no class or function called vil_property.
#define vil_property_size_block_j
Block size in rows.
Representation of a generic image source or destination.
bool vil_copy_deep(const vil_image_resource_sptr &src, vil_image_resource_sptr &dest)
Copy src to dest.