本文整理汇总了C++中IBAprep函数的典型用法代码示例。如果您正苦于以下问题:C++ IBAprep函数的具体用法?C++ IBAprep怎么用?C++ IBAprep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IBAprep函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: logtime
bool
ImageBufAlgo::sub(ImageBuf& dst, Image_or_Const A_, Image_or_Const B_, ROI roi,
int nthreads)
{
pvt::LoggedTimer logtime("IBA::sub");
if (A_.is_img() && B_.is_img()) {
const ImageBuf &A(A_.img()), &B(B_.img());
if (!IBAprep(roi, &dst, &A, &B))
return false;
ROI origroi = roi;
roi.chend = std::min(roi.chend, std::min(A.nchannels(), B.nchannels()));
bool ok;
OIIO_DISPATCH_COMMON_TYPES3(ok, "sub", sub_impl, dst.spec().format,
A.spec().format, B.spec().format, dst, A, B,
roi, nthreads);
if (roi.chend < origroi.chend && A.nchannels() != B.nchannels()) {
// Edge case: A and B differed in nchannels, we allocated dst to be
// the bigger of them, but adjusted roi to be the lesser. Now handle
// the channels that got left out because they were not common to
// all the inputs.
ASSERT(roi.chend <= dst.nchannels());
roi.chbegin = roi.chend;
roi.chend = origroi.chend;
if (A.nchannels() > B.nchannels()) { // A exists
copy(dst, A, dst.spec().format, roi, nthreads);
} else { // B exists
copy(dst, B, dst.spec().format, roi, nthreads);
}
}
return ok;
}
if (A_.is_val() && B_.is_img()) // canonicalize to A_img, B_val
A_.swap(B_);
if (A_.is_img() && B_.is_val()) {
const ImageBuf& A(A_.img());
cspan<float> b = B_.val();
if (!IBAprep(roi, &dst, &A,
IBAprep_CLAMP_MUTUAL_NCHANNELS | IBAprep_SUPPORT_DEEP))
return false;
IBA_FIX_PERCHAN_LEN_DEF(b, A.nchannels());
// Negate b (into a copy)
int nc = A.nchannels();
float* vals = ALLOCA(float, nc);
for (int c = 0; c < nc; ++c)
vals[c] = -b[c];
b = cspan<float>(vals, nc);
if (dst.deep()) {
// While still serial, set up all the sample counts
dst.deepdata()->set_all_samples(A.deepdata()->all_samples());
return add_impl_deep(dst, A, b, roi, nthreads);
}
bool ok;
OIIO_DISPATCH_COMMON_TYPES2(ok, "sub", add_impl, dst.spec().format,
A.spec().format, dst, A, b, roi, nthreads);
return ok;
}
// Remaining cases: error
dst.error("ImageBufAlgo::sub(): at least one argument must be an image");
return false;
}
开发者ID:AtomicFiction,项目名称:oiio,代码行数:60,代码来源:imagebufalgo_addsub.cpp
示例2: ASSERT
bool
ImageBufAlgo::absdiff (ImageBuf &dst, const ImageBuf &A, const ImageBuf &B,
ROI roi, int nthreads)
{
if (! IBAprep (roi, &dst, &A, &B))
return false;
ROI origroi = roi;
roi.chend = std::min (roi.chend, std::min (A.nchannels(), B.nchannels()));
bool ok;
OIIO_DISPATCH_COMMON_TYPES3 (ok, "absdiff", absdiff_impl, dst.spec().format,
A.spec().format, B.spec().format,
dst, A, B, roi, nthreads);
if (roi.chend < origroi.chend && A.nchannels() != B.nchannels()) {
// Edge case: A and B differed in nchannels, we allocated dst to be
// the bigger of them, but adjusted roi to be the lesser. Now handle
// the channels that got left out because they were not common to
// all the inputs.
ASSERT (roi.chend <= dst.nchannels());
roi.chbegin = roi.chend;
roi.chend = origroi.chend;
if (A.nchannels() > B.nchannels()) { // A exists
abs (dst, A, roi, nthreads);
} else { // B exists
abs (dst, B, roi, nthreads);
}
}
return ok;
}
开发者ID:AheadIO,项目名称:oiio,代码行数:29,代码来源:imagebufalgo_pixelmath.cpp
示例3: rotate180
bool
ImageBufAlgo::rotate180 (ImageBuf &dst, const ImageBuf &src,
ROI roi, int nthreads)
{
if (&dst == &src) { // Handle in-place operation
ImageBuf tmp;
tmp.swap (const_cast<ImageBuf&>(src));
return rotate180 (dst, tmp, roi, nthreads);
}
ROI src_roi = roi.defined() ? roi : src.roi();
ROI src_roi_full = src.roi_full();
int xoffset = src_roi.xbegin - src_roi_full.xbegin;
int xstart = src_roi_full.xend - xoffset - src_roi.width();
int yoffset = src_roi.ybegin - src_roi_full.ybegin;
int ystart = src_roi_full.yend - yoffset - src_roi.height();
ROI dst_roi (xstart, xstart+src_roi.width(),
ystart, ystart+src_roi.height(),
src_roi.zbegin, src_roi.zend,
src_roi.chbegin, src_roi.chend);
ASSERT (dst_roi.width() == src_roi.width() &&
dst_roi.height() == src_roi.height());
// Compute the destination ROI, it's the source ROI reflected across
// the midline of the display window.
IBAprep (dst_roi, &dst, &src);
bool ok;
OIIO_DISPATCH_TYPES2 (ok, "rotate180", rotate180_,
dst.spec().format, src.spec().format,
dst, src, dst_roi, nthreads);
return ok;
}
开发者ID:brianhall77,项目名称:oiio,代码行数:32,代码来源:imagebufalgo_copy.cpp
示例4: logtime
bool
ImageBufAlgo::transpose (ImageBuf &dst, const ImageBuf &src,
ROI roi, int nthreads)
{
pvt::LoggedTimer logtime("IBA::transpose");
if (! roi.defined())
roi = get_roi (src.spec());
roi.chend = std::min (roi.chend, src.nchannels());
ROI dst_roi (roi.ybegin, roi.yend, roi.xbegin, roi.xend,
roi.zbegin, roi.zend, roi.chbegin, roi.chend);
bool dst_initialized = dst.initialized();
if (! IBAprep (dst_roi, &dst))
return false;
if (! dst_initialized) {
ROI r = src.roi_full();
ROI dst_roi_full (r.ybegin, r.yend, r.xbegin, r.xend,
r.zbegin, r.zend, r.chbegin, r.chend);
dst.set_roi_full (dst_roi_full);
}
bool ok;
if (dst.spec().format == src.spec().format) {
OIIO_DISPATCH_TYPES (ok, "transpose", transpose_, dst.spec().format,
dst, src, roi, nthreads);
} else {
OIIO_DISPATCH_COMMON_TYPES2 (ok, "transpose", transpose_, dst.spec().format,
src.spec().format, dst, src, roi, nthreads);
}
return ok;
}
开发者ID:StereoD-Development,项目名称:oiio,代码行数:29,代码来源:imagebufalgo_orient.cpp
示例5: colorconvert
bool
ImageBufAlgo::colorconvert (ImageBuf &dst, const ImageBuf &src,
const ColorProcessor* processor, bool unpremult,
ROI roi, int nthreads)
{
// If the processor is NULL, return false (error)
if (!processor) {
dst.error ("Passed NULL ColorProcessor to colorconvert() [probable application bug]");
return false;
}
// If the processor is a no-op and the conversion is being done
// in place, no work needs to be done. Early exit.
if (processor->isNoOp() && (&dst == &src))
return true;
if (! IBAprep (roi, &dst, &src))
return false;
// If the processor is a no-op (and it's not an in-place conversion),
// use paste() to simplify the operation.
if (processor->isNoOp()) {
roi.chend = std::max (roi.chbegin+4, roi.chend);
return ImageBufAlgo::paste (dst, roi.xbegin, roi.ybegin, roi.zbegin,
roi.chbegin, src, roi, nthreads);
}
bool ok = true;
OIIO_DISPATCH_COMMON_TYPES2 (ok, "colorconvert", colorconvert_impl,
dst.spec().format, src.spec().format,
dst, src, processor, unpremult, roi, nthreads);
return ok;
}
开发者ID:jproccia,项目名称:oiio,代码行数:33,代码来源:color_ocio.cpp
示例6: flip
bool
ImageBufAlgo::flip(ImageBuf &dst, const ImageBuf &src, ROI roi, int nthreads)
{
if (&dst == &src) { // Handle in-place operation
ImageBuf tmp;
tmp.swap (const_cast<ImageBuf&>(src));
return flip (dst, tmp, roi, nthreads);
}
pvt::LoggedTimer logtime("IBA::flip");
ROI src_roi = roi.defined() ? roi : src.roi();
ROI src_roi_full = src.roi_full();
int offset = src_roi.ybegin - src_roi_full.ybegin;
int start = src_roi_full.yend - offset - src_roi.height();
ROI dst_roi (src_roi.xbegin, src_roi.xend,
start, start+src_roi.height(),
src_roi.zbegin, src_roi.zend,
src_roi.chbegin, src_roi.chend);
ASSERT (dst_roi.width() == src_roi.width() &&
dst_roi.height() == src_roi.height());
// Compute the destination ROI, it's the source ROI reflected across
// the midline of the display window.
if (! IBAprep (dst_roi, &dst, &src))
return false;
bool ok;
OIIO_DISPATCH_COMMON_TYPES2 (ok, "flip", flip_,
dst.spec().format, src.spec().format,
dst, src, dst_roi, nthreads);
return ok;
}
开发者ID:StereoD-Development,项目名称:oiio,代码行数:31,代码来源:imagebufalgo_orient.cpp
示例7: IBAprep
bool
ImageBufAlgo::mul (ImageBuf &dst, const float *val, ROI roi, int nthreads)
{
IBAprep (roi, &dst);
OIIO_DISPATCH_TYPES ("mul", mul_impl, dst.spec().format,
dst, val, roi, nthreads);
return true;
}
开发者ID:jcrogel,项目名称:oiio,代码行数:8,代码来源:imagebufalgo_pixelmath.cpp
示例8: logtime
bool
ImageBufAlgo::div(ImageBuf& dst, Image_or_Const A_, Image_or_Const B_, ROI roi,
int nthreads)
{
pvt::LoggedTimer logtime("IBA::div");
if (A_.is_img() && B_.is_img()) {
const ImageBuf &A(A_.img()), &B(B_.img());
if (!IBAprep(roi, &dst, &A, &B, IBAprep_CLAMP_MUTUAL_NCHANNELS))
return false;
bool ok;
OIIO_DISPATCH_COMMON_TYPES3(ok, "div", div_impl, dst.spec().format,
A.spec().format, B.spec().format, dst, A, B,
roi, nthreads);
return ok;
}
if (A_.is_val() && B_.is_img()) // canonicalize to A_img, B_val
A_.swap(B_);
if (A_.is_img() && B_.is_val()) {
const ImageBuf& A(A_.img());
cspan<float> b = B_.val();
if (!IBAprep(roi, &dst, &A,
IBAprep_CLAMP_MUTUAL_NCHANNELS | IBAprep_SUPPORT_DEEP))
return false;
IBA_FIX_PERCHAN_LEN_DEF(b, dst.nchannels());
int nc = dst.nchannels();
float* binv = OIIO_ALLOCA(float, nc);
for (int c = 0; c < nc; ++c)
binv[c] = (b[c] == 0.0f) ? 0.0f : 1.0f / b[c];
b = cspan<float>(binv, nc); // re-wrap
if (dst.deep()) {
// While still serial, set up all the sample counts
dst.deepdata()->set_all_samples(A.deepdata()->all_samples());
return mul_impl_deep(dst, A, b, roi, nthreads);
}
bool ok;
OIIO_DISPATCH_COMMON_TYPES2(ok, "div", mul_impl, dst.spec().format,
A.spec().format, dst, A, b, roi, nthreads);
return ok;
}
// Remaining cases: error
dst.error("ImageBufAlgo::div(): at least one argument must be an image");
return false;
}
开发者ID:AtomicFiction,项目名称:oiio,代码行数:45,代码来源:imagebufalgo_muldiv.cpp
示例9: IBAprep
bool
ImageBufAlgo::flop (ImageBuf &dst, const ImageBuf &src, ROI roi, int nthreads)
{
IBAprep (roi, &dst);
OIIO_DISPATCH_TYPES2 ("flop", flop_,
dst.spec().format, src.spec().format, dst, src,
roi, nthreads);
return false;
}
开发者ID:jcrogel,项目名称:oiio,代码行数:9,代码来源:imagebufalgo_copy.cpp
示例10: fill
bool
ImageBufAlgo::zero (ImageBuf &dst, ROI roi, int nthreads)
{
if (! IBAprep (roi, &dst))
return false;
float *zero = ALLOCA(float,roi.chend);
memset (zero, 0, roi.chend*sizeof(float));
return fill (dst, zero, roi, nthreads);
}
开发者ID:nerd93,项目名称:oiio,代码行数:9,代码来源:imagebufalgo.cpp
示例11:
bool
ImageBufAlgo::mul (ImageBuf &dst, const ImageBuf &A, const float *b,
ROI roi, int nthreads)
{
if (! IBAprep (roi, &dst, &A))
return false;
OIIO_DISPATCH_TYPES2 ("mul", mul_impl, dst.spec().format,
A.spec().format, dst, A, b, roi, nthreads);
return true;
}
开发者ID:dfelinto,项目名称:oiio,代码行数:10,代码来源:imagebufalgo_pixelmath.cpp
示例12: ASSERT
bool
ImageBufAlgo::fill (ImageBuf &dst, const float *pixel, ROI roi, int nthreads)
{
ASSERT (pixel && "fill must have a non-NULL pixel value pointer");
if (! IBAprep (roi, &dst))
return false;
OIIO_DISPATCH_TYPES ("fill", fill_, dst.spec().format,
dst, pixel, roi, nthreads);
return true;
}
开发者ID:nerd93,项目名称:oiio,代码行数:10,代码来源:imagebufalgo.cpp
示例13: float
bool
ImageBufAlgo::resize (ImageBuf &dst, const ImageBuf &src,
const std::string &filtername_, float fwidth,
ROI roi, int nthreads)
{
if (! IBAprep (roi, &dst, &src))
return false;
const ImageSpec &srcspec (src.spec());
const ImageSpec &dstspec (dst.spec());
if (dstspec.nchannels != srcspec.nchannels) {
dst.error ("channel number mismatch: %d vs. %d",
dst.spec().nchannels, src.spec().nchannels);
return false;
}
if (dstspec.depth > 1 || srcspec.depth > 1) {
dst.error ("ImageBufAlgo::resize does not support volume images");
return false;
}
// Resize ratios
float wratio = float(dstspec.full_width) / float(srcspec.full_width);
float hratio = float(dstspec.full_height) / float(srcspec.full_height);
// Set up a shared pointer with custom deleter to make sure any
// filter we allocate here is properly destroyed.
boost::shared_ptr<Filter2D> filter ((Filter2D*)NULL, Filter2D::destroy);
std::string filtername = filtername_;
if (filtername.empty()) {
// No filter name supplied -- pick a good default
if (wratio > 1.0f || hratio > 1.0f)
filtername = "blackman-harris";
else
filtername = "lanczos3";
}
for (int i = 0, e = Filter2D::num_filters(); i < e; ++i) {
FilterDesc fd;
Filter2D::get_filterdesc (i, &fd);
if (fd.name == filtername) {
float w = fwidth > 0.0f ? fwidth : fd.width * std::max (1.0f, wratio);
float h = fwidth > 0.0f ? fwidth : fd.width * std::max (1.0f, hratio);
filter.reset (Filter2D::create (filtername, w, h));
break;
}
}
if (! filter) {
dst.error ("Filter \"%s\" not recognized", filtername);
return false;
}
OIIO_DISPATCH_TYPES2 ("resize", resize_,
dstspec.format, srcspec.format,
dst, src, filter.get(), roi, nthreads);
return false;
}
开发者ID:nerd93,项目名称:oiio,代码行数:55,代码来源:imagebufalgo.cpp
示例14: IBAprep
bool
ImageBufAlgo::circular_shift (ImageBuf &dst, const ImageBuf &src,
int xshift, int yshift, int zshift,
ROI roi, int nthreads)
{
IBAprep (roi, &dst, &src);
OIIO_DISPATCH_TYPES2 ("circular_shift", circular_shift_,
dst.spec().format, src.spec().format, dst, src,
xshift, yshift, zshift, roi, roi, nthreads);
return false;
}
开发者ID:UIKit0,项目名称:oiio,代码行数:11,代码来源:imagebufalgo_copy.cpp
示例15:
bool
ImageBufAlgo::mul (ImageBuf &dst, const ImageBuf &A, const float *b,
ROI roi, int nthreads)
{
if (! IBAprep (roi, &dst, &A, IBAprep_CLAMP_MUTUAL_NCHANNELS))
return false;
bool ok;
OIIO_DISPATCH_COMMON_TYPES2 (ok, "mul", mul_impl, dst.spec().format,
A.spec().format, dst, A, b, roi, nthreads);
return ok;
}
开发者ID:ShaderManager,项目名称:oiio,代码行数:11,代码来源:imagebufalgo_pixelmath.cpp
示例16:
bool
ImageBufAlgo::pow (ImageBuf &dst, const ImageBuf &A, const float *b,
ROI roi, int nthreads)
{
if (! IBAprep (roi, &dst, &A))
return false;
bool ok;
OIIO_DISPATCH_TYPES2 (ok, "pow", pow_impl, dst.spec().format,
A.spec().format, dst, A, b, roi, nthreads);
return ok;
}
开发者ID:bms20,项目名称:oiio,代码行数:11,代码来源:imagebufalgo_pixelmath.cpp
示例17: ALLOCA
bool
ImageBufAlgo::mul (ImageBuf &dst, const ImageBuf &A, float b,
ROI roi, int nthreads)
{
if (! IBAprep (roi, &dst, &A))
return false;
int nc = A.nchannels();
float *vals = ALLOCA (float, nc);
for (int c = 0; c < nc; ++c)
vals[c] = b;
OIIO_DISPATCH_TYPES2 ("mul", mul_impl, dst.spec().format,
A.spec().format, dst, A, vals, roi, nthreads);
}
开发者ID:dfelinto,项目名称:oiio,代码行数:13,代码来源:imagebufalgo_pixelmath.cpp
示例18:
bool
ImageBufAlgo::checker (ImageBuf &dst, int width, int height, int depth,
const float *color1, const float *color2,
int xoffset, int yoffset, int zoffset,
ROI roi, int nthreads)
{
if (! IBAprep (roi, &dst))
return false;
OIIO_DISPATCH_TYPES ("checker", checker_, dst.spec().format,
dst, Dim3(width, height, depth), color1, color2,
Dim3(xoffset, yoffset, zoffset), roi, nthreads);
return true;
}
开发者ID:nerd93,项目名称:oiio,代码行数:13,代码来源:imagebufalgo.cpp
示例19: get_roi
bool
ImageBufAlgo::transpose (ImageBuf &dst, const ImageBuf &src,
ROI roi, int nthreads)
{
if (! roi.defined())
roi = get_roi (src.spec());
roi.chend = std::min (roi.chend, src.nchannels());
ROI dst_roi (roi.ybegin, roi.yend, roi.xbegin, roi.xend,
roi.zbegin, roi.zend, roi.chbegin, roi.chend);
IBAprep (dst_roi, &dst);
OIIO_DISPATCH_TYPES2 ("transpose", transpose_, dst.spec().format,
src.spec().format, dst, src, roi, nthreads);
return false;
}
开发者ID:UIKit0,项目名称:oiio,代码行数:14,代码来源:imagebufalgo_copy.cpp
示例20: ALLOCA
bool
ImageBufAlgo::pow (ImageBuf &dst, const ImageBuf &A, float b,
ROI roi, int nthreads)
{
if (! IBAprep (roi, &dst, &A, IBAprep_CLAMP_MUTUAL_NCHANNELS))
return false;
int nc = A.nchannels();
float *vals = ALLOCA (float, nc);
for (int c = 0; c < nc; ++c)
vals[c] = b;
bool ok;
OIIO_DISPATCH_COMMON_TYPES2 (ok, "pow", pow_impl, dst.spec().format,
A.spec().format, dst, A, vals, roi, nthreads);
return ok;
}
开发者ID:ShaderManager,项目名称:oiio,代码行数:15,代码来源:imagebufalgo_pixelmath.cpp
注:本文中的IBAprep函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论