Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef struct zimg_image_buffer_const {
- unsigned version;
- const void *data[3];
- ptrdiff_t stride[3];
- unsigned mask[3];
- } zimg_image_buffer_const;
- typedef union zimg_image_buffer {
- struct {
- unsigned version;
- void *data[3];
- ptrdiff_t stride[3];
- unsigned mask[3];
- } m;
- zimg_image_buffer_const c;
- } zimg_image_buffer;
- typedef struct zimg_graph zimg_graph;
- // Minimum buffering mask required for input.
- unsigned zimg_graph_input_mask(const zimg_graph *graph);
- // Minimum buffering mask required for output.
- unsigned zimg_graph_output_mask(const zimg_graph *graph);
- // Other temporary data.
- size_t zimg_graph_tmp_size(const zimg_graph *graph);
- // Make line i available to the input buffer.
- typedef int (*zimg_unpack_func)(void *user, unsigned i);
- // Notify that line i is available in the output buffer.
- typedef int (*zimg_pack_func)(void *user, unsigned i);
- typedef struct zimg_unpack_yuy2_context {
- unsigned version;
- zimg_image_buffer *buf; // same as argument to graph_traverse
- const void *packed_plane;
- ptrdiff_t packed_stride;
- } zimg_unpack_yuy2_context;
- typedef struct zimg_pack_yuy2_context {
- unsigned version;
- zimg_image_buffer_const *buf; // same as argument to graph_traverse
- void *packed_plane;
- ptrdiff_tpacked_stride;
- } zimg_pack_yuy2_context;
- typedef struct zimg_unpack_rgb32_context {
- unsigned version;
- zimg_image_buffer *buf; // same as argument to graph_traverse
- const void *packed_plane;
- ptrdiff_t packed_stride;
- void *alpha_plane; // dumps alpha here
- ptrdiff_t alpha_stride;
- } zimg_unpack_rgb_context;
- typedef struct zimg_pack_rgb32_context {
- unsigned version;
- zimg_image_buffer_const *buf; // same as argument to graph_traverse
- void *packed_plane;
- ptrdiff_t packed_stride;
- const void *alpha_plane; // reinterleaves alpha from here (must be planar)
- ptrdiff_t alpha_stride;
- } zimg_pack_rgb_context;
- // use zimg_unpack/pack_yuy2_context
- int zimg_unpack_yuy2(void *user, unsigned i);
- int zimg_pack_yuy2(void *user, unsigned i);
- // use zimg_unpack/pack_rgb_context
- int zimg_unpack_rgb32(void *user, unsigned i);
- int zimg_pack_rgb32(void *user, unsigned i);
- int zimg_unpack_rgb24(void *user, unsigned i);
- int zimg_pack_rgb24(void *user, unsigned i);
- // To run on a fully allocated planar image:
- // zimg_graph_traverse(g, src_buf, dst, tmp, 0, 0, 0, 0);
- // To convert YUY2 to RGB32:
- // zimg_unpack_yuy2_context unpack_yuy2 = { ZIMG_API_VERSION, src_mutable, yuy2_ptr, yuy2_stride };
- // zimg_pack_rgb_context pack_rgb = { ZIMG_API_VERSION, dst, rgb32_ptr, rgb32_stride, 0, 0 };
- // zimg_graph_traverse(g, &src_mutable->c, dst, tmp, &zimg_unpack_yuy2, &unpack_yuy2, &zimg_pack_rgb32, &pack_rgb);
- void zimg_graph_traverse(const zimg_graph *graph, const zimg_image_buffer_const *src, const zimg_image_buffer *dst,
- void *tmp, zimg_unpack_func unpack_cb, void *unpack_priv, zimg_pack_func pack_cb, void *pack_priv);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement