1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
20 /** \file
21  * \ingroup imbuf
22  */
23 
24 /**
25  * \brief IMage Buffer module.
26  *
27  * This module offers import/export of several graphical file formats.
28  * \ingroup imbuf
29  *
30  * \page IMB Imbuf module external interface
31  * \section imb_about About the IMB module
32  *
33  * External interface of the IMage Buffer module. This module offers
34  * import/export of several graphical file formats. It offers the
35  * ImBuf type as a common structure to refer to different graphical
36  * file formats, and to enable a uniform way of handling them.
37  *
38  * \section imb_issues Known issues with IMB
39  *
40  * - imbuf is written in C.
41  * - Endianness issues are dealt with internally.
42  * - File I/O must be done externally. The module uses FILE*'s to
43  *   direct input/output.
44  *
45  * \section imb_dependencies Dependencies
46  *
47  * IMB needs:
48  * - \ref DNA module
49  *     The #ListBase types are used for handling the memory management.
50  * - \ref blenlib module
51  *     blenlib handles guarded memory management in blender-style.
52  *     BLI_winstuff.h makes a few windows specific behaviors
53  *     posix-compliant.
54  */
55 
56 #pragma once
57 
58 /* for bool */
59 #include "../blenlib/BLI_sys_types.h"
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 #define IM_MAX_SPACE 64
66 
67 /**
68  *
69  * \attention defined in ???
70  */
71 struct ImBuf;
72 struct rcti;
73 
74 /**
75  *
76  * \attention defined in ???
77  */
78 struct anim;
79 
80 struct ColorManagedDisplay;
81 
82 struct GSet;
83 /**
84  *
85  * \attention defined in DNA_scene_types.h
86  */
87 struct ImageFormatData;
88 struct Stereo3dFormat;
89 
90 /**
91  *
92  * \attention defined in GPU_texture.h
93  */
94 struct GPUTexture;
95 
96 /**
97  *
98  * \attention Defined in allocimbuf.c
99  */
100 void IMB_init(void);
101 void IMB_exit(void);
102 
103 /**
104  *
105  * \attention Defined in readimage.c
106  */
107 struct ImBuf *IMB_ibImageFromMemory(const unsigned char *mem,
108                                     size_t size,
109                                     int flags,
110                                     char colorspace[IM_MAX_SPACE],
111                                     const char *descr);
112 
113 /**
114  *
115  * \attention Defined in readimage.c
116  */
117 struct ImBuf *IMB_testiffname(const char *filepath, int flags);
118 
119 /**
120  *
121  * \attention Defined in readimage.c
122  */
123 struct ImBuf *IMB_loadiffname(const char *filepath, int flags, char colorspace[IM_MAX_SPACE]);
124 
125 /**
126  *
127  * \attention Defined in allocimbuf.c
128  */
129 void IMB_freeImBuf(struct ImBuf *ibuf);
130 
131 /**
132  *
133  * \attention Defined in allocimbuf.c
134  */
135 struct ImBuf *IMB_allocImBuf(unsigned int x,
136                              unsigned int y,
137                              unsigned char planes,
138                              unsigned int flags);
139 
140 /**
141  * Initialize given ImBuf.
142  *
143  * Use in cases when temporary image buffer is allocated on stack.
144  *
145  * \attention Defined in allocimbuf.c
146  */
147 bool IMB_initImBuf(
148     struct ImBuf *ibuf, unsigned int x, unsigned int y, unsigned char planes, unsigned int flags);
149 
150 /**
151  * Create a copy of a pixel buffer and wrap it to a new ImBuf
152  * \attention Defined in allocimbuf.c
153  */
154 struct ImBuf *IMB_allocFromBuffer(const unsigned int *rect,
155                                   const float *rectf,
156                                   unsigned int w,
157                                   unsigned int h,
158                                   unsigned int channels);
159 
160 /**
161  *
162  * Increase reference count to imbuf
163  * (to delete an imbuf you have to call freeImBuf as many times as it
164  * is referenced)
165  *
166  * \attention Defined in allocimbuf.c
167  */
168 
169 void IMB_refImBuf(struct ImBuf *ibuf);
170 struct ImBuf *IMB_makeSingleUser(struct ImBuf *ibuf);
171 
172 /**
173  *
174  * \attention Defined in allocimbuf.c
175  */
176 struct ImBuf *IMB_dupImBuf(const struct ImBuf *ibuf1);
177 
178 /**
179  *
180  * \attention Defined in allocimbuf.c
181  */
182 bool addzbufImBuf(struct ImBuf *ibuf);
183 bool addzbuffloatImBuf(struct ImBuf *ibuf);
184 
185 /**
186  * Approximate size of ImBuf in memory
187  *
188  * \attention Defined in allocimbuf.c
189  */
190 size_t IMB_get_size_in_memory(struct ImBuf *ibuf);
191 
192 /**
193  *
194  * \attention Defined in rectop.c
195  */
196 
197 typedef enum IMB_BlendMode {
198   IMB_BLEND_MIX = 0,
199   IMB_BLEND_ADD = 1,
200   IMB_BLEND_SUB = 2,
201   IMB_BLEND_MUL = 3,
202   IMB_BLEND_LIGHTEN = 4,
203   IMB_BLEND_DARKEN = 5,
204   IMB_BLEND_ERASE_ALPHA = 6,
205   IMB_BLEND_ADD_ALPHA = 7,
206   IMB_BLEND_OVERLAY = 8,
207   IMB_BLEND_HARDLIGHT = 9,
208   IMB_BLEND_COLORBURN = 10,
209   IMB_BLEND_LINEARBURN = 11,
210   IMB_BLEND_COLORDODGE = 12,
211   IMB_BLEND_SCREEN = 13,
212   IMB_BLEND_SOFTLIGHT = 14,
213   IMB_BLEND_PINLIGHT = 15,
214   IMB_BLEND_VIVIDLIGHT = 16,
215   IMB_BLEND_LINEARLIGHT = 17,
216   IMB_BLEND_DIFFERENCE = 18,
217   IMB_BLEND_EXCLUSION = 19,
218   IMB_BLEND_HUE = 20,
219   IMB_BLEND_SATURATION = 21,
220   IMB_BLEND_LUMINOSITY = 22,
221   IMB_BLEND_COLOR = 23,
222   IMB_BLEND_INTERPOLATE = 24,
223 
224   IMB_BLEND_COPY = 1000,
225   IMB_BLEND_COPY_RGB = 1001,
226   IMB_BLEND_COPY_ALPHA = 1002,
227 } IMB_BlendMode;
228 
229 void IMB_blend_color_byte(unsigned char dst[4],
230                           const unsigned char src1[4],
231                           const unsigned char src2[4],
232                           IMB_BlendMode mode);
233 void IMB_blend_color_float(float dst[4],
234                            const float src1[4],
235                            const float src2[4],
236                            IMB_BlendMode mode);
237 
238 void IMB_rect_crop(struct ImBuf *ibuf, const struct rcti *crop);
239 
240 void IMB_rect_size_set(struct ImBuf *ibuf, const uint size[2]);
241 
242 void IMB_rectclip(struct ImBuf *dbuf,
243                   const struct ImBuf *sbuf,
244                   int *destx,
245                   int *desty,
246                   int *srcx,
247                   int *srcy,
248                   int *width,
249                   int *height);
250 void IMB_rectcpy(struct ImBuf *dbuf,
251                  const struct ImBuf *sbuf,
252                  int destx,
253                  int desty,
254                  int srcx,
255                  int srcy,
256                  int width,
257                  int height);
258 void IMB_rectblend(struct ImBuf *dbuf,
259                    const struct ImBuf *obuf,
260                    const struct ImBuf *sbuf,
261                    unsigned short *dmask,
262                    const unsigned short *curvemask,
263                    const unsigned short *texmask,
264                    float mask_max,
265                    int destx,
266                    int desty,
267                    int origx,
268                    int origy,
269                    int srcx,
270                    int srcy,
271                    int width,
272                    int height,
273                    IMB_BlendMode mode,
274                    bool accumulate);
275 void IMB_rectblend_threaded(struct ImBuf *dbuf,
276                             const struct ImBuf *obuf,
277                             const struct ImBuf *sbuf,
278                             unsigned short *dmask,
279                             const unsigned short *curvemask,
280                             const unsigned short *texmask,
281                             float mask_max,
282                             int destx,
283                             int desty,
284                             int origx,
285                             int origy,
286                             int srcx,
287                             int srcy,
288                             int width,
289                             int height,
290                             IMB_BlendMode mode,
291                             bool accumulate);
292 
293 /**
294  *
295  * \attention Defined in indexer.c
296  */
297 
298 typedef enum IMB_Timecode_Type {
299   /** Don't use time-code files at all. */
300   IMB_TC_NONE = 0,
301   /** use images in the order as they are recorded
302    * (currently, this is the only one implemented
303    * and is a sane default) */
304   IMB_TC_RECORD_RUN = 1,
305   /** Use global timestamp written by recording
306    * device (prosumer camcorders e.g. can do that). */
307   IMB_TC_FREE_RUN = 2,
308   /** Interpolate a global timestamp using the
309    * record date and time written by recording
310    * device (*every* consumer camcorder can do
311    * that :) )*/
312   IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN = 4,
313   IMB_TC_RECORD_RUN_NO_GAPS = 8,
314   IMB_TC_MAX_SLOT = 4,
315 } IMB_Timecode_Type;
316 
317 typedef enum IMB_Proxy_Size {
318   IMB_PROXY_NONE = 0,
319   IMB_PROXY_25 = 1,
320   IMB_PROXY_50 = 2,
321   IMB_PROXY_75 = 4,
322   IMB_PROXY_100 = 8,
323   IMB_PROXY_MAX_SLOT = 4,
324 } IMB_Proxy_Size;
325 
326 /* Defaults to BL_proxy within the directory of the animation. */
327 void IMB_anim_set_index_dir(struct anim *anim, const char *dir);
328 void IMB_anim_get_fname(struct anim *anim, char *file, int size);
329 
330 int IMB_anim_index_get_frame_index(struct anim *anim, IMB_Timecode_Type tc, int position);
331 
332 IMB_Proxy_Size IMB_anim_proxy_get_existing(struct anim *anim);
333 
334 struct IndexBuildContext;
335 
336 /* Prepare context for proxies/time-codes builder. */
337 struct IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim,
338                                                          IMB_Timecode_Type tcs_in_use,
339                                                          IMB_Proxy_Size proxy_sizes_in_use,
340                                                          int quality,
341                                                          const bool overwrite,
342                                                          struct GSet *file_list);
343 
344 /* Will rebuild all used indices and proxies at once. */
345 void IMB_anim_index_rebuild(struct IndexBuildContext *context,
346                             short *stop,
347                             short *do_update,
348                             float *progress);
349 
350 /* Finish rebuilding proxies/time-codes and free temporary contexts used. */
351 void IMB_anim_index_rebuild_finish(struct IndexBuildContext *context, short stop);
352 
353 /**
354  * Return the length (in frames) of the given \a anim.
355  */
356 int IMB_anim_get_duration(struct anim *anim, IMB_Timecode_Type tc);
357 
358 /**
359  * Return the fps contained in movie files (function rval is false,
360  * and frs_sec and frs_sec_base untouched if none available!)
361  */
362 bool IMB_anim_get_fps(struct anim *anim, short *frs_sec, float *frs_sec_base, bool no_av_base);
363 
364 /**
365  *
366  * \attention Defined in anim_movie.c
367  */
368 struct anim *IMB_open_anim(const char *name,
369                            int ib_flags,
370                            int streamindex,
371                            char colorspace[IM_MAX_SPACE]);
372 void IMB_suffix_anim(struct anim *anim, const char *suffix);
373 void IMB_close_anim(struct anim *anim);
374 void IMB_close_anim_proxies(struct anim *anim);
375 bool IMB_anim_can_produce_frames(const struct anim *anim);
376 
377 /**
378  *
379  * \attention Defined in anim_movie.c
380  */
381 
382 int ismovie(const char *filepath);
383 void IMB_anim_set_preseek(struct anim *anim, int preseek);
384 int IMB_anim_get_preseek(struct anim *anim);
385 
386 /**
387  *
388  * \attention Defined in anim_movie.c
389  */
390 
391 struct ImBuf *IMB_anim_absolute(struct anim *anim,
392                                 int position,
393                                 IMB_Timecode_Type tc /* = 1 = IMB_TC_RECORD_RUN */,
394                                 IMB_Proxy_Size preview_size /* = 0 = IMB_PROXY_NONE */);
395 
396 /**
397  *
398  * \attention Defined in anim_movie.c
399  * fetches a define preview-frame, usually half way into the movie.
400  */
401 struct ImBuf *IMB_anim_previewframe(struct anim *anim);
402 
403 /**
404  *
405  * \attention Defined in anim_movie.c
406  */
407 void IMB_free_anim(struct anim *anim);
408 
409 /**
410  *
411  * \attention Defined in filter.c
412  */
413 
414 #define FILTER_MASK_NULL 0
415 #define FILTER_MASK_MARGIN 1
416 #define FILTER_MASK_USED 2
417 
418 void IMB_filter(struct ImBuf *ibuf);
419 void IMB_mask_filter_extend(char *mask, int width, int height);
420 void IMB_mask_clear(struct ImBuf *ibuf, const char *mask, int val);
421 void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter);
422 void IMB_makemipmap(struct ImBuf *ibuf, int use_filter);
423 void IMB_remakemipmap(struct ImBuf *ibuf, int use_filter);
424 struct ImBuf *IMB_getmipmap(struct ImBuf *ibuf, int level);
425 
426 /**
427  *
428  * \attention Defined in cache.c
429  */
430 
431 void IMB_tile_cache_params(int totthread, int maxmem);
432 unsigned int *IMB_gettile(struct ImBuf *ibuf, int tx, int ty, int thread);
433 void IMB_tiles_to_rect(struct ImBuf *ibuf);
434 
435 /**
436  *
437  * \attention Defined in filter.c
438  */
439 void IMB_filtery(struct ImBuf *ibuf);
440 
441 /**
442  *
443  * \attention Defined in scaling.c
444  */
445 struct ImBuf *IMB_onehalf(struct ImBuf *ibuf1);
446 
447 /**
448  *
449  * \attention Defined in scaling.c
450  */
451 bool IMB_scaleImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy);
452 
453 /**
454  *
455  * \attention Defined in scaling.c
456  */
457 bool IMB_scalefastImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy);
458 
459 /**
460  *
461  * \attention Defined in scaling.c
462  */
463 void IMB_scaleImBuf_threaded(struct ImBuf *ibuf, unsigned int newx, unsigned int newy);
464 
465 /**
466  *
467  * \attention Defined in writeimage.c
468  */
469 short IMB_saveiff(struct ImBuf *ibuf, const char *filepath, int flags);
470 bool IMB_prepare_write_ImBuf(const bool isfloat, struct ImBuf *ibuf);
471 
472 /**
473  *
474  * \attention Defined in util.c
475  */
476 bool IMB_ispic(const char *name);
477 int IMB_ispic_type(const char *name);
478 
479 /**
480  *
481  * \attention Defined in util.c
482  */
483 bool IMB_isanim(const char *name);
484 
485 /**
486  *
487  * \attention Defined in util.c
488  */
489 int imb_get_anim_type(const char *name);
490 
491 /**
492  *
493  * \attention Defined in util.c
494  */
495 bool IMB_isfloat(const struct ImBuf *ibuf);
496 
497 /* Do byte/float and colorspace conversions need to take alpha into account? */
498 bool IMB_alpha_affects_rgb(const struct ImBuf *ibuf);
499 
500 /* create char buffer, color corrected if necessary, for ImBufs that lack one */
501 void IMB_rect_from_float(struct ImBuf *ibuf);
502 void IMB_float_from_rect(struct ImBuf *ibuf);
503 void IMB_color_to_bw(struct ImBuf *ibuf);
504 void IMB_saturation(struct ImBuf *ibuf, float sat);
505 
506 /* converting pixel buffers */
507 void IMB_buffer_byte_from_float(unsigned char *rect_to,
508                                 const float *rect_from,
509                                 int channels_from,
510                                 float dither,
511                                 int profile_to,
512                                 int profile_from,
513                                 bool predivide,
514                                 int width,
515                                 int height,
516                                 int stride_to,
517                                 int stride_from);
518 void IMB_buffer_byte_from_float_mask(unsigned char *rect_to,
519                                      const float *rect_from,
520                                      int channels_from,
521                                      float dither,
522                                      bool predivide,
523                                      int width,
524                                      int height,
525                                      int stride_to,
526                                      int stride_from,
527                                      char *mask);
528 void IMB_buffer_float_from_byte(float *rect_to,
529                                 const unsigned char *rect_from,
530                                 int profile_to,
531                                 int profile_from,
532                                 bool predivide,
533                                 int width,
534                                 int height,
535                                 int stride_to,
536                                 int stride_from);
537 void IMB_buffer_float_from_float(float *rect_to,
538                                  const float *rect_from,
539                                  int channels_from,
540                                  int profile_to,
541                                  int profile_from,
542                                  bool predivide,
543                                  int width,
544                                  int height,
545                                  int stride_to,
546                                  int stride_from);
547 void IMB_buffer_float_from_float_threaded(float *rect_to,
548                                           const float *rect_from,
549                                           int channels_from,
550                                           int profile_to,
551                                           int profile_from,
552                                           bool predivide,
553                                           int width,
554                                           int height,
555                                           int stride_to,
556                                           int stride_from);
557 void IMB_buffer_float_from_float_mask(float *rect_to,
558                                       const float *rect_from,
559                                       int channels_from,
560                                       int width,
561                                       int height,
562                                       int stride_to,
563                                       int stride_from,
564                                       char *mask);
565 void IMB_buffer_byte_from_byte(unsigned char *rect_to,
566                                const unsigned char *rect_from,
567                                int profile_to,
568                                int profile_from,
569                                bool predivide,
570                                int width,
571                                int height,
572                                int stride_to,
573                                int stride_from);
574 void IMB_buffer_float_unpremultiply(float *buf, int width, int height);
575 void IMB_buffer_float_premultiply(float *buf, int width, int height);
576 
577 /**
578  * Change the ordering of the color bytes pointed to by rect from
579  * rgba to abgr. size * 4 color bytes are reordered.
580  *
581  * \attention Defined in imageprocess.c
582  */
583 void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf);
584 
585 /**
586  *
587  * \attention defined in imageprocess.c
588  */
589 void bicubic_interpolation(
590     struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout);
591 void nearest_interpolation(
592     struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout);
593 void bilinear_interpolation(
594     struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout);
595 
596 void bicubic_interpolation_color(
597     struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
598 void nearest_interpolation_color(
599     struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
600 void nearest_interpolation_color_wrap(
601     struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
602 void bilinear_interpolation_color(
603     struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
604 void bilinear_interpolation_color_wrap(
605     struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
606 
607 void IMB_alpha_under_color_float(float *rect_float, int x, int y, float backcol[3]);
608 void IMB_alpha_under_color_byte(unsigned char *rect, int x, int y, const float backcol[3]);
609 
610 void IMB_sampleImageAtLocation(
611     struct ImBuf *ibuf, float x, float y, bool make_linear_rgb, float color[4]);
612 
613 /**
614  *
615  * \attention defined in readimage.c
616  */
617 struct ImBuf *IMB_loadifffile(
618     int file, const char *filepath, int flags, char colorspace[IM_MAX_SPACE], const char *descr);
619 
620 /**
621  *
622  * \attention defined in scaling.c
623  */
624 struct ImBuf *IMB_half_x(struct ImBuf *ibuf1);
625 
626 /**
627  *
628  * \attention defined in scaling.c
629  */
630 struct ImBuf *IMB_double_fast_x(struct ImBuf *ibuf1);
631 
632 /**
633  *
634  * \attention defined in scaling.c
635  */
636 struct ImBuf *IMB_double_x(struct ImBuf *ibuf1);
637 
638 /**
639  *
640  * \attention defined in scaling.c
641  */
642 struct ImBuf *IMB_half_y(struct ImBuf *ibuf1);
643 
644 /**
645  *
646  * \attention defined in scaling.c
647  */
648 struct ImBuf *IMB_double_fast_y(struct ImBuf *ibuf1);
649 
650 /**
651  *
652  * \attention defined in scaling.c
653  */
654 struct ImBuf *IMB_double_y(struct ImBuf *ibuf1);
655 
656 /**
657  *
658  * \attention Defined in rotate.c
659  */
660 void IMB_flipx(struct ImBuf *ibuf);
661 void IMB_flipy(struct ImBuf *ibuf);
662 
663 /* Premultiply alpha */
664 
665 void IMB_premultiply_alpha(struct ImBuf *ibuf);
666 void IMB_unpremultiply_alpha(struct ImBuf *ibuf);
667 
668 /**
669  *
670  * \attention Defined in allocimbuf.c
671  */
672 void IMB_freezbufImBuf(struct ImBuf *ibuf);
673 void IMB_freezbuffloatImBuf(struct ImBuf *ibuf);
674 
675 /**
676  *
677  * \attention Defined in rectop.c
678  */
679 void IMB_rectfill(struct ImBuf *drect, const float col[4]);
680 void IMB_rectfill_area(struct ImBuf *ibuf,
681                        const float col[4],
682                        int x1,
683                        int y1,
684                        int x2,
685                        int y2,
686                        struct ColorManagedDisplay *display);
687 void IMB_rectfill_alpha(struct ImBuf *ibuf, const float value);
688 
689 /* This should not be here, really,
690  * we needed it for operating on render data, IMB_rectfill_area calls it. */
691 void buf_rectfill_area(unsigned char *rect,
692                        float *rectf,
693                        int width,
694                        int height,
695                        const float col[4],
696                        struct ColorManagedDisplay *display,
697                        int x1,
698                        int y1,
699                        int x2,
700                        int y2);
701 
702 /* exported for image tools in blender, to quickly allocate 32 bits rect */
703 void *imb_alloc_pixels(
704     unsigned int x, unsigned int y, unsigned int channels, size_t typesize, const char *name);
705 
706 bool imb_addrectImBuf(struct ImBuf *ibuf);
707 void imb_freerectImBuf(struct ImBuf *ibuf);
708 
709 bool imb_addrectfloatImBuf(struct ImBuf *ibuf);
710 void imb_freerectfloatImBuf(struct ImBuf *ibuf);
711 void imb_freemipmapImBuf(struct ImBuf *ibuf);
712 
713 bool imb_addtilesImBuf(struct ImBuf *ibuf);
714 void imb_freetilesImBuf(struct ImBuf *ibuf);
715 
716 void imb_freerectImbuf_all(struct ImBuf *ibuf);
717 
718 /* threaded processors */
719 void IMB_processor_apply_threaded(
720     int buffer_lines,
721     int handle_size,
722     void *init_customdata,
723     void(init_handle)(void *handle, int start_line, int tot_line, void *customdata),
724     void *(do_thread)(void *));
725 
726 typedef void (*ScanlineThreadFunc)(void *custom_data, int start_scanline, int num_scanlines);
727 void IMB_processor_apply_threaded_scanlines(int total_scanlines,
728                                             ScanlineThreadFunc do_thread,
729                                             void *custom_data);
730 
731 /* ffmpeg */
732 void IMB_ffmpeg_init(void);
733 const char *IMB_ffmpeg_last_error(void);
734 
735 /**
736  *
737  * \attention defined in util_gpu.c
738  */
739 struct GPUTexture *IMB_create_gpu_texture(const char *name,
740                                           struct ImBuf *ibuf,
741                                           bool use_high_bitdepth,
742                                           bool use_premult);
743 struct GPUTexture *IMB_touch_gpu_texture(
744     const char *name, struct ImBuf *ibuf, int w, int h, int layers, bool use_high_bitdepth);
745 void IMB_update_gpu_texture_sub(struct GPUTexture *tex,
746                                 struct ImBuf *ibuf,
747                                 int x,
748                                 int y,
749                                 int z,
750                                 int w,
751                                 int h,
752                                 bool use_high_bitdepth,
753                                 bool use_premult);
754 
755 /**
756  *
757  * \attention defined in stereoimbuf.c
758  */
759 void IMB_stereo3d_write_dimensions(const char mode,
760                                    const bool is_squeezed,
761                                    const size_t width,
762                                    const size_t height,
763                                    size_t *r_width,
764                                    size_t *r_height);
765 void IMB_stereo3d_read_dimensions(const char mode,
766                                   const bool is_squeezed,
767                                   const size_t width,
768                                   const size_t height,
769                                   size_t *r_width,
770                                   size_t *r_height);
771 int *IMB_stereo3d_from_rect(struct ImageFormatData *im_format,
772                             const size_t x,
773                             const size_t y,
774                             const size_t channels,
775                             int *rect_left,
776                             int *rect_right);
777 float *IMB_stereo3d_from_rectf(struct ImageFormatData *im_format,
778                                const size_t x,
779                                const size_t y,
780                                const size_t channels,
781                                float *rectf_left,
782                                float *rectf_right);
783 struct ImBuf *IMB_stereo3d_ImBuf(struct ImageFormatData *im_format,
784                                  struct ImBuf *ibuf_left,
785                                  struct ImBuf *ibuf_right);
786 void IMB_ImBufFromStereo3d(struct Stereo3dFormat *s3d,
787                            struct ImBuf *ibuf_stereo,
788                            struct ImBuf **r_ibuf_left,
789                            struct ImBuf **r_ibuf_right);
790 
791 #ifdef __cplusplus
792 }
793 #endif
794