コード例 #1
0
ファイル: zimg.cpp プロジェクト: theomission/zimg
zimg_error_code_e zimg_filter_graph_process(const zimg_filter_graph *ptr, const zimg_image_buffer_const *src, const zimg_image_buffer *dst, void *tmp,
        zimg_filter_graph_callback unpack_cb, void *unpack_user,
        zimg_filter_graph_callback pack_cb, void *pack_user)
{
    _zassert_d(ptr, "null pointer");
    _zassert_d(src, "null pointer");
    _zassert_d(dst, "null pointer");

    POINTER_ALIGNMENT_ASSERT(src->plane[0].data);
    POINTER_ALIGNMENT_ASSERT(src->plane[1].data);
    POINTER_ALIGNMENT_ASSERT(src->plane[2].data);

    STRIDE_ALIGNMENT_ASSERT(src->plane[0].stride);
    STRIDE_ALIGNMENT_ASSERT(src->plane[1].stride);
    STRIDE_ALIGNMENT_ASSERT(src->plane[2].stride);

    POINTER_ALIGNMENT_ASSERT(dst->plane[0].data);
    POINTER_ALIGNMENT_ASSERT(dst->plane[1].data);
    POINTER_ALIGNMENT_ASSERT(dst->plane[2].data);

    STRIDE_ALIGNMENT_ASSERT(dst->plane[0].stride);
    STRIDE_ALIGNMENT_ASSERT(dst->plane[1].stride);
    STRIDE_ALIGNMENT_ASSERT(dst->plane[2].stride);

    POINTER_ALIGNMENT_ASSERT(tmp);

    EX_BEGIN
    const zimg::graph::FilterGraph *graph = assert_dynamic_cast<const zimg::graph::FilterGraph>(ptr);
    auto src_buf = import_image_buffer(*src);
    auto dst_buf = import_image_buffer(*dst);

    graph->process(src_buf, dst_buf, tmp, { unpack_cb, unpack_user }, { pack_cb, pack_user });
    EX_END
}
コード例 #2
0
ファイル: zimg2.cpp プロジェクト: gitter-badger/zimg-1
int zimg2_filter_process(const zimg_filter *ptr, void *ctx, const zimg_image_buffer_const *src, const zimg_image_buffer *dst, void *tmp, unsigned i, unsigned left, unsigned right)
{
	EX_BEGIN
	const zimg::IZimgFilter *filter_ptr = cast_filter_ptr(ptr);

	assert(src);
	assert(dst);

	POINTER_ALIGNMENT_ASSERT(src->data[0]);
	POINTER_ALIGNMENT_ASSERT(src->data[1]);
	POINTER_ALIGNMENT_ASSERT(src->data[2]);

	POINTER_ALIGNMENT_ASSERT(dst->m.data[0]);
	POINTER_ALIGNMENT_ASSERT(dst->m.data[1]);
	POINTER_ALIGNMENT_ASSERT(dst->m.data[2]);

	STRIDE_ALIGNMENT_ASSERT(src->stride[0]);
	STRIDE_ALIGNMENT_ASSERT(src->stride[1]);
	STRIDE_ALIGNMENT_ASSERT(src->stride[2]);

	STRIDE_ALIGNMENT_ASSERT(dst->m.stride[0]);
	STRIDE_ALIGNMENT_ASSERT(dst->m.stride[1]);
	STRIDE_ALIGNMENT_ASSERT(dst->m.stride[2]);

	zimg::ZimgImageBufferConst src_buf = import_image_buffer(*src);
	zimg::ZimgImageBuffer dst_buf = import_image_buffer(*dst);

	filter_ptr->process(ctx, src_buf, dst_buf, tmp, i, left, right);
	EX_END
}