Blender  V2.93
render.c
Go to the documentation of this file.
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  * - Blender Foundation, 2003-2009
20  * - Peter Schlaile <peter [at] schlaile [dot] de> 2005/2006
21  */
22 
27 #include <time.h>
28 
29 #include "MEM_guardedalloc.h"
30 
31 #include "DNA_anim_types.h"
32 #include "DNA_mask_types.h"
33 #include "DNA_scene_types.h"
34 #include "DNA_sequence_types.h"
35 #include "DNA_space_types.h"
36 
37 #include "BLI_linklist.h"
38 #include "BLI_listbase.h"
39 #include "BLI_path_util.h"
40 
41 #include "BKE_anim_data.h"
42 #include "BKE_animsys.h"
43 #include "BKE_fcurve.h"
44 #include "BKE_global.h"
45 #include "BKE_image.h"
46 #include "BKE_layer.h"
47 #include "BKE_lib_id.h"
48 #include "BKE_main.h"
49 #include "BKE_mask.h"
50 #include "BKE_movieclip.h"
51 #include "BKE_scene.h"
53 
54 #include "DEG_depsgraph.h"
55 #include "DEG_depsgraph_query.h"
56 
57 #include "IMB_colormanagement.h"
58 #include "IMB_imbuf.h"
59 #include "IMB_imbuf_types.h"
60 #include "IMB_metadata.h"
61 
62 #include "RNA_access.h"
63 
64 #include "RE_engine.h"
65 #include "RE_pipeline.h"
66 
67 #include "SEQ_effects.h"
68 #include "SEQ_modifier.h"
69 #include "SEQ_proxy.h"
70 #include "SEQ_render.h"
71 #include "SEQ_sequencer.h"
72 #include "SEQ_utils.h"
73 
74 #include "effects.h"
75 #include "image_cache.h"
76 #include "multiview.h"
77 #include "prefetch.h"
78 #include "proxy.h"
79 #include "render.h"
80 #include "strip_time.h"
81 #include "utils.h"
82 
85  ListBase *seqbasep,
86  float timeline_frame,
87  int chanshown);
88 
90 SequencerDrawView sequencer_view3d_fn = NULL; /* NULL in background mode */
91 
92 /* -------------------------------------------------------------------- */
96 {
97 #if 0
98  /* Bute buffer is supposed to be in sequencer working space already. */
99  if (ibuf->rect != NULL) {
101  }
102 #endif
103  if (ibuf->rect_float != NULL) {
105  }
106 }
107 
108 void seq_imbuf_to_sequencer_space(Scene *scene, ImBuf *ibuf, bool make_float)
109 {
110  /* Early output check: if both buffers are NULL we have nothing to convert. */
111  if (ibuf->rect_float == NULL && ibuf->rect == NULL) {
112  return;
113  }
114  /* Get common conversion settings. */
115  const char *to_colorspace = scene->sequencer_colorspace_settings.name;
116  /* Perform actual conversion logic. */
117  if (ibuf->rect_float == NULL) {
118  /* We are not requested to give float buffer and byte buffer is already
119  * in thee required colorspace. Can skip doing anything here.
120  */
121  const char *from_colorspace = IMB_colormanagement_get_rect_colorspace(ibuf);
122  if (!make_float && STREQ(from_colorspace, to_colorspace)) {
123  return;
124  }
125  if (false) {
126  /* The idea here is to provide as fast playback as possible and
127  * enforcing float buffer here (a) uses more cache memory (b) might
128  * make some other effects slower to apply.
129  *
130  * However, this might also have negative effect by adding weird
131  * artifacts which will then not happen in final render.
132  */
133  IMB_colormanagement_transform_byte_threaded((unsigned char *)ibuf->rect,
134  ibuf->x,
135  ibuf->y,
136  ibuf->channels,
137  from_colorspace,
138  to_colorspace);
139  }
140  else {
141  /* We perform conversion to a float buffer so we don't worry about
142  * precision loss.
143  */
144  imb_addrectfloatImBuf(ibuf);
146  (unsigned char *)ibuf->rect,
147  ibuf->x,
148  ibuf->y,
149  ibuf->channels,
150  from_colorspace,
151  to_colorspace);
152  /* We don't need byte buffer anymore. */
153  imb_freerectImBuf(ibuf);
154  }
155  }
156  else {
157  const char *from_colorspace = IMB_colormanagement_get_float_colorspace(ibuf);
158  /* Unknown input color space, can't perform conversion. */
159  if (from_colorspace == NULL || from_colorspace[0] == '\0') {
160  return;
161  }
162  /* We don't want both byte and float buffers around: they'll either run
163  * out of sync or conversion of byte buffer will lose precision in there.
164  */
165  if (ibuf->rect != NULL) {
166  imb_freerectImBuf(ibuf);
167  }
169  ibuf->rect_float, ibuf->x, ibuf->y, ibuf->channels, from_colorspace, to_colorspace, true);
170  }
172 }
173 
175 {
176  const char *from_colorspace = scene->sequencer_colorspace_settings.name;
177  const char *to_colorspace = IMB_colormanagement_role_colorspace_name_get(
179 
180  if (!ibuf->rect_float) {
181  return;
182  }
183 
184  if (to_colorspace && to_colorspace[0] != '\0') {
186  ibuf->rect_float, ibuf->x, ibuf->y, ibuf->channels, from_colorspace, to_colorspace, true);
187  IMB_colormanagement_assign_float_colorspace(ibuf, to_colorspace);
188  }
189 }
190 
192 {
193  const char *from_colorspace = scene->sequencer_colorspace_settings.name;
194  const char *to_colorspace = IMB_colormanagement_role_colorspace_name_get(
196 
197  if (to_colorspace && to_colorspace[0] != '\0') {
198  IMB_colormanagement_transform_v4(pixel, from_colorspace, to_colorspace);
199  }
200  else {
201  /* if no color management enables fallback to legacy conversion */
202  srgb_to_linearrgb_v4(pixel, pixel);
203  }
204 }
205 
208 /* -------------------------------------------------------------------- */
212  struct Depsgraph *depsgraph,
213  Scene *scene,
214  int rectx,
215  int recty,
216  int preview_render_size,
217  int for_render,
218  SeqRenderData *r_context)
219 {
220  r_context->bmain = bmain;
221  r_context->depsgraph = depsgraph;
222  r_context->scene = scene;
223  r_context->rectx = rectx;
224  r_context->recty = recty;
225  r_context->preview_render_size = preview_render_size;
226  r_context->for_render = for_render;
227  r_context->motion_blur_samples = 0;
228  r_context->motion_blur_shutter = 0;
229  r_context->skip_cache = false;
230  r_context->is_proxy_render = false;
231  r_context->view_id = 0;
232  r_context->gpu_offscreen = NULL;
233  r_context->task_id = SEQ_TASK_MAIN_RENDER;
234  r_context->is_prefetch_render = false;
235 }
236 
238 {
239  state->scene_parents = NULL;
240 }
241 
242 StripElem *SEQ_render_give_stripelem(Sequence *seq, int timeline_frame)
243 {
244  StripElem *se = seq->strip->stripdata;
245 
246  if (seq->type == SEQ_TYPE_IMAGE) {
247  /* only IMAGE strips use the whole array, MOVIE strips use only the first element,
248  * all other strips don't use this...
249  */
250 
251  int frame_index = (int)seq_give_frame_index(seq, timeline_frame);
252 
253  if (frame_index == -1 || se == NULL) {
254  return NULL;
255  }
256 
257  se += frame_index + seq->anim_startofs;
258  }
259  return se;
260 }
261 
262 static int evaluate_seq_frame_gen(Sequence **seq_arr,
263  ListBase *seqbase,
264  int timeline_frame,
265  int chanshown)
266 {
267  /* Use arbitrary sized linked list, the size could be over MAXSEQ. */
268  LinkNodePair effect_inputs = {NULL, NULL};
269  int totseq = 0;
270 
271  memset(seq_arr, 0, sizeof(Sequence *) * (MAXSEQ + 1));
272 
273  LISTBASE_FOREACH (Sequence *, seq, seqbase) {
274  if ((seq->startdisp <= timeline_frame) && (seq->enddisp > timeline_frame)) {
275  if ((seq->type & SEQ_TYPE_EFFECT) && !(seq->flag & SEQ_MUTE)) {
276 
277  if (seq->seq1) {
278  BLI_linklist_append_alloca(&effect_inputs, seq->seq1);
279  }
280 
281  if (seq->seq2) {
282  BLI_linklist_append_alloca(&effect_inputs, seq->seq2);
283  }
284 
285  if (seq->seq3) {
286  BLI_linklist_append_alloca(&effect_inputs, seq->seq3);
287  }
288  }
289 
290  seq_arr[seq->machine] = seq;
291  totseq++;
292  }
293  }
294 
295  /* Drop strips which are used for effect inputs, we don't want
296  * them to blend into render stack in any other way than effect
297  * string rendering. */
298  for (LinkNode *seq_item = effect_inputs.list; seq_item; seq_item = seq_item->next) {
299  Sequence *seq = seq_item->link;
300  /* It's possible that effect strip would be placed to the same
301  * 'machine' as its inputs. We don't want to clear such strips
302  * from the stack. */
303  if (seq_arr[seq->machine] && seq_arr[seq->machine]->type & SEQ_TYPE_EFFECT) {
304  continue;
305  }
306  /* If we're shown a specified channel, then we want to see the strips
307  * which belongs to this machine. */
308  if (chanshown != 0 && chanshown <= seq->machine) {
309  continue;
310  }
311  seq_arr[seq->machine] = NULL;
312  }
313 
314  return totseq;
315 }
316 
324 int SEQ_render_evaluate_frame(ListBase *seqbase, int timeline_frame)
325 {
326  Sequence *seq_arr[MAXSEQ + 1];
327  return evaluate_seq_frame_gen(seq_arr, seqbase, timeline_frame, 0);
328 }
329 
331 {
332  return (seq && !(seq->flag & SEQ_MUTE) && seq->type != SEQ_TYPE_SOUND_RAM);
333 }
334 
336  int timeline_frame,
337  int chanshown,
338  Sequence **seq_arr_out)
339 {
340  Sequence *seq_arr[MAXSEQ + 1];
341  int b = chanshown;
342  int cnt = 0;
343 
344  if (b > MAXSEQ) {
345  return 0;
346  }
347 
348  if (evaluate_seq_frame_gen(seq_arr, seqbasep, timeline_frame, chanshown)) {
349  if (b == 0) {
350  b = MAXSEQ;
351  }
352  for (; b > 0; b--) {
353  if (video_seq_is_rendered(seq_arr[b])) {
354  break;
355  }
356  }
357  }
358 
359  chanshown = b;
360 
361  for (; b > 0; b--) {
362  if (video_seq_is_rendered(seq_arr[b])) {
363  if (seq_arr[b]->blend_mode == SEQ_BLEND_REPLACE) {
364  break;
365  }
366  }
367  }
368 
369  for (; b <= chanshown && b >= 0; b++) {
370  if (video_seq_is_rendered(seq_arr[b])) {
371  seq_arr_out[cnt++] = seq_arr[b];
372  }
373  }
374 
375  return cnt;
376 }
377 
380 /* -------------------------------------------------------------------- */
383 /*
384  * input preprocessing for SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE, SEQ_TYPE_MOVIECLIP and SEQ_TYPE_SCENE
385  *
386  * Do all the things you can't really do afterwards using sequence effects
387  * (read: before rescaling to render resolution has been done)
388  *
389  * Order is important!
390  *
391  * - Deinterlace
392  * - Crop and transform in image source coordinate space
393  * - Flip X + Flip Y (could be done afterwards, backward compatibility)
394  * - Promote image to float data (affects pipeline operations afterwards)
395  * - Color balance (is most efficient in the byte -> float
396  * (future: half -> float should also work fine!)
397  * case, if done on load, since we can use lookup tables)
398  * - Premultiply
399  */
400 
401 static bool sequencer_use_transform(const Sequence *seq)
402 {
403  const StripTransform *transform = seq->strip->transform;
404 
405  if (transform->xofs != 0 || transform->yofs != 0 || transform->scale_x != 1 ||
406  transform->scale_y != 1 || transform->rotation != 0) {
407  return true;
408  }
409 
410  return false;
411 }
412 
413 static bool sequencer_use_crop(const Sequence *seq)
414 {
415  const StripCrop *crop = seq->strip->crop;
416  if (crop->left > 0 || crop->right > 0 || crop->top > 0 || crop->bottom > 0) {
417  return true;
418  }
419 
420  return false;
421 }
422 
424  Sequence *seq,
425  float UNUSED(timeline_frame))
426 {
427  float mul;
428 
429  if (context && context->is_proxy_render) {
430  return false;
431  }
432 
433  if ((seq->flag & (SEQ_FILTERY | SEQ_FLIPX | SEQ_FLIPY | SEQ_MAKE_FLOAT)) ||
435  return true;
436  }
437 
438  mul = seq->mul;
439 
440  if (seq->blend_mode == SEQ_BLEND_REPLACE) {
441  mul *= seq->blend_opacity / 100.0f;
442  }
443 
444  if (mul != 1.0f) {
445  return true;
446  }
447 
448  if (seq->sat != 1.0f) {
449  return true;
450  }
451 
452  if (seq->modifiers.first) {
453  return true;
454  }
455 
456  return false;
457 }
458 
467 
468 typedef struct ImageTransformThreadData {
472  /* image_scale_factor is used to scale proxies to correct preview size. */
474  /* Preview scale factor is needed to correct translation to match preview size. */
479  int tot_line;
481 
488 static bool seq_need_scale_to_render_size(const Sequence *seq, bool is_proxy_image)
489 {
490  if (is_proxy_image) {
491  return true;
492  }
493  if ((seq->type & SEQ_TYPE_EFFECT) != 0 || seq->type == SEQ_TYPE_MASK ||
494  seq->type == SEQ_TYPE_META ||
495  (seq->type == SEQ_TYPE_SCENE && ((seq->flag & SEQ_SCENE_STRIPS) != 0))) {
496  return true;
497  }
498  return false;
499 }
500 
501 static void sequencer_image_crop_transform_init(void *handle_v,
502  int start_line,
503  int tot_line,
504  void *init_data_v)
505 {
508 
509  handle->ibuf_source = init_data->ibuf_source;
510  handle->ibuf_out = init_data->ibuf_out;
511  handle->seq = init_data->seq;
512 
513  handle->preview_scale_factor = init_data->preview_scale_factor;
514  if (seq_need_scale_to_render_size(init_data->seq, init_data->is_proxy_image)) {
515  handle->image_scale_factor = 1.0f;
516  }
517  else {
518  handle->image_scale_factor = handle->preview_scale_factor;
519  }
520 
521  /* Proxy image is smaller, so crop values must be corrected by proxy scale factor.
522  * Proxy scale factor always matches preview_scale_factor. */
524  init_data->is_proxy_image) ?
525  init_data->preview_scale_factor :
526  1.0f;
527 
528  handle->for_render = init_data->for_render;
529  handle->start_line = start_line;
530  handle->tot_line = tot_line;
531 }
532 
534 {
536  const StripTransform *transform = data->seq->strip->transform;
537  const float scale_x = transform->scale_x * data->image_scale_factor;
538  const float scale_y = transform->scale_y * data->image_scale_factor;
539  const float image_center_offs_x = (data->ibuf_out->x - data->ibuf_source->x) / 2;
540  const float image_center_offs_y = (data->ibuf_out->y - data->ibuf_source->y) / 2;
541  const float translate_x = transform->xofs * data->preview_scale_factor + image_center_offs_x;
542  const float translate_y = transform->yofs * data->preview_scale_factor + image_center_offs_y;
543  const float pivot[2] = {data->ibuf_source->x / 2, data->ibuf_source->y / 2};
544  float transform_matrix[3][3];
545  loc_rot_size_to_mat3(transform_matrix,
546  (const float[]){translate_x, translate_y},
547  transform->rotation,
548  (const float[]){scale_x, scale_y});
549  transform_pivot_set_m3(transform_matrix, pivot);
550  invert_m3(transform_matrix);
551 
552  /* Image crop is done by offsetting image boundary limits. */
553  const StripCrop *c = data->seq->strip->crop;
554  const int left = c->left * data->crop_scale_factor;
555  const int right = c->right * data->crop_scale_factor;
556  const int top = c->top * data->crop_scale_factor;
557  const int bottom = c->bottom * data->crop_scale_factor;
558 
559  const float source_pixel_range_max[2] = {data->ibuf_source->x - right,
560  data->ibuf_source->y - top};
561  const float source_pixel_range_min[2] = {left, bottom};
562 
563  const int width = data->ibuf_out->x;
564  for (int yi = data->start_line; yi < data->start_line + data->tot_line; yi++) {
565  for (int xi = 0; xi < width; xi++) {
566  float uv[2] = {xi, yi};
567  mul_v2_m3v2(uv, transform_matrix, uv);
568 
569  if (source_pixel_range_min[0] >= uv[0] || uv[0] >= source_pixel_range_max[0] ||
570  source_pixel_range_min[1] >= uv[1] || uv[1] >= source_pixel_range_max[1]) {
571  continue;
572  }
573 
574  if (data->for_render) {
575  bilinear_interpolation(data->ibuf_source, data->ibuf_out, uv[0], uv[1], xi, yi);
576  }
577  else {
578  nearest_interpolation(data->ibuf_source, data->ibuf_out, uv[0], uv[1], xi, yi);
579  }
580  }
581  }
582 
583  return NULL;
584 }
585 
586 static void multibuf(ImBuf *ibuf, const float fmul)
587 {
588  char *rt;
589  float *rt_float;
590 
591  int a;
592 
593  rt = (char *)ibuf->rect;
594  rt_float = ibuf->rect_float;
595 
596  if (rt) {
597  const int imul = (int)(256.0f * fmul);
598  a = ibuf->x * ibuf->y;
599  while (a--) {
600  rt[0] = min_ii((imul * rt[0]) >> 8, 255);
601  rt[1] = min_ii((imul * rt[1]) >> 8, 255);
602  rt[2] = min_ii((imul * rt[2]) >> 8, 255);
603  rt[3] = min_ii((imul * rt[3]) >> 8, 255);
604 
605  rt += 4;
606  }
607  }
608  if (rt_float) {
609  a = ibuf->x * ibuf->y;
610  while (a--) {
611  rt_float[0] *= fmul;
612  rt_float[1] *= fmul;
613  rt_float[2] *= fmul;
614  rt_float[3] *= fmul;
615 
616  rt_float += 4;
617  }
618  }
619 }
620 
622  Sequence *seq,
623  float timeline_frame,
624  ImBuf *ibuf,
625  const bool is_proxy_image)
626 {
627  Scene *scene = context->scene;
628  ImBuf *preprocessed_ibuf = NULL;
629 
630  /* Deinterlace. */
631  if ((seq->flag & SEQ_FILTERY) && !ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_MOVIECLIP)) {
632  /* Change original image pointer to avoid another duplication in SEQ_USE_TRANSFORM. */
633  preprocessed_ibuf = IMB_makeSingleUser(ibuf);
634  ibuf = preprocessed_ibuf;
635 
636  IMB_filtery(preprocessed_ibuf);
637  }
638 
639  if (sequencer_use_crop(seq) || sequencer_use_transform(seq) || context->rectx != ibuf->x ||
640  context->recty != ibuf->y) {
641  const int x = context->rectx;
642  const int y = context->recty;
643  preprocessed_ibuf = IMB_allocImBuf(x, y, 32, ibuf->rect_float ? IB_rectfloat : IB_rect);
644 
646  init_data.ibuf_source = ibuf;
647  init_data.ibuf_out = preprocessed_ibuf;
648  init_data.seq = seq;
649  init_data.is_proxy_image = is_proxy_image;
650 
651  /* Get scale factor if preview resolution doesn't match project resolution. */
652  if (context->preview_render_size == SEQ_RENDER_SIZE_SCENE) {
653  init_data.preview_scale_factor = (float)scene->r.size / 100;
654  }
655  else {
656  init_data.preview_scale_factor = SEQ_rendersize_to_scale_factor(
657  context->preview_render_size);
658  }
659 
660  init_data.for_render = context->for_render;
662  sizeof(ImageTransformThreadData),
663  &init_data,
666  seq_imbuf_assign_spaces(scene, preprocessed_ibuf);
667  IMB_metadata_copy(preprocessed_ibuf, ibuf);
668  IMB_freeImBuf(ibuf);
669  }
670 
671  /* Duplicate ibuf if we still have original. */
672  if (preprocessed_ibuf == NULL) {
673  preprocessed_ibuf = IMB_makeSingleUser(ibuf);
674  }
675 
676  if (seq->flag & SEQ_FLIPX) {
677  IMB_flipx(preprocessed_ibuf);
678  }
679 
680  if (seq->flag & SEQ_FLIPY) {
681  IMB_flipy(preprocessed_ibuf);
682  }
683 
684  if (seq->sat != 1.0f) {
685  IMB_saturation(preprocessed_ibuf, seq->sat);
686  }
687 
688  if (seq->flag & SEQ_MAKE_FLOAT) {
689  if (!preprocessed_ibuf->rect_float) {
690  seq_imbuf_to_sequencer_space(scene, preprocessed_ibuf, true);
691  }
692 
693  if (preprocessed_ibuf->rect) {
694  imb_freerectImBuf(preprocessed_ibuf);
695  }
696  }
697 
698  float mul = seq->mul;
699  if (seq->blend_mode == SEQ_BLEND_REPLACE) {
700  mul *= seq->blend_opacity / 100.0f;
701  }
702 
703  if (mul != 1.0f) {
704  multibuf(preprocessed_ibuf, mul);
705  }
706 
707  if (seq->modifiers.first) {
708  ImBuf *ibuf_new = SEQ_modifier_apply_stack(context, seq, preprocessed_ibuf, timeline_frame);
709 
710  if (ibuf_new != preprocessed_ibuf) {
711  IMB_metadata_copy(ibuf_new, preprocessed_ibuf);
712  IMB_freeImBuf(preprocessed_ibuf);
713  preprocessed_ibuf = ibuf_new;
714  }
715  }
716 
717  return preprocessed_ibuf;
718 }
719 
721  Sequence *seq,
722  ImBuf *ibuf,
723  float timeline_frame,
724  bool use_preprocess,
725  const bool is_proxy_image)
726 {
727  if (context->is_proxy_render == false &&
728  (ibuf->x != context->rectx || ibuf->y != context->recty)) {
729  use_preprocess = true;
730  }
731 
732  /* Proxies and effect strips are not stored in cache. */
733  if (!is_proxy_image && (seq->type & SEQ_TYPE_EFFECT) == 0) {
734  seq_cache_put(context, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibuf);
735  }
736 
737  if (use_preprocess) {
738  ibuf = input_preprocess(context, seq, timeline_frame, ibuf, is_proxy_image);
739  }
740 
741  seq_cache_put(context, seq, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED, ibuf);
742  return ibuf;
743 }
744 
745 typedef struct RenderEffectInitData {
751 
754 
755 typedef struct RenderEffectThread {
761 
765 
766 static void render_effect_execute_init_handle(void *handle_v,
767  int start_line,
768  int tot_line,
769  void *init_data_v)
770 {
771  RenderEffectThread *handle = (RenderEffectThread *)handle_v;
773 
774  handle->sh = init_data->sh;
775  handle->context = init_data->context;
776  handle->seq = init_data->seq;
777  handle->timeline_frame = init_data->timeline_frame;
778  handle->facf0 = init_data->facf0;
779  handle->facf1 = init_data->facf1;
780  handle->ibuf1 = init_data->ibuf1;
781  handle->ibuf2 = init_data->ibuf2;
782  handle->ibuf3 = init_data->ibuf3;
783  handle->out = init_data->out;
784 
785  handle->start_line = start_line;
786  handle->tot_line = tot_line;
787 }
788 
789 static void *render_effect_execute_do_thread(void *thread_data_v)
790 {
791  RenderEffectThread *thread_data = (RenderEffectThread *)thread_data_v;
792 
793  thread_data->sh->execute_slice(thread_data->context,
794  thread_data->seq,
795  thread_data->timeline_frame,
796  thread_data->facf0,
797  thread_data->facf1,
798  thread_data->ibuf1,
799  thread_data->ibuf2,
800  thread_data->ibuf3,
801  thread_data->start_line,
802  thread_data->tot_line,
803  thread_data->out);
804 
805  return NULL;
806 }
807 
809  const SeqRenderData *context,
810  Sequence *seq,
811  float timeline_frame,
812  float facf0,
813  float facf1,
814  ImBuf *ibuf1,
815  ImBuf *ibuf2,
816  ImBuf *ibuf3)
817 {
819  ImBuf *out = sh->init_execution(context, ibuf1, ibuf2, ibuf3);
820 
821  init_data.sh = sh;
822  init_data.context = context;
823  init_data.seq = seq;
824  init_data.timeline_frame = timeline_frame;
825  init_data.facf0 = facf0;
826  init_data.facf1 = facf1;
827  init_data.ibuf1 = ibuf1;
828  init_data.ibuf2 = ibuf2;
829  init_data.ibuf3 = ibuf3;
830  init_data.out = out;
831 
833  sizeof(RenderEffectThread),
834  &init_data,
837 
838  return out;
839 }
840 
843  Sequence *seq,
844  float timeline_frame)
845 {
846  Scene *scene = context->scene;
847  float fac, facf;
848  int early_out;
849  int i;
850  struct SeqEffectHandle sh = SEQ_effect_handle_get(seq);
851  FCurve *fcu = NULL;
852  ImBuf *ibuf[3];
853  Sequence *input[3];
854  ImBuf *out = NULL;
855 
856  ibuf[0] = ibuf[1] = ibuf[2] = NULL;
857 
858  input[0] = seq->seq1;
859  input[1] = seq->seq2;
860  input[2] = seq->seq3;
861 
862  if (!sh.execute && !(sh.execute_slice && sh.init_execution)) {
863  /* effect not supported in this version... */
864  out = IMB_allocImBuf(context->rectx, context->recty, 32, IB_rect);
865  return out;
866  }
867 
868  if (seq->flag & SEQ_USE_EFFECT_DEFAULT_FADE) {
869  sh.get_default_fac(seq, timeline_frame, &fac, &facf);
870  facf = fac;
871  }
872  else {
873  fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "effect_fader", 0, NULL);
874  if (fcu) {
875  fac = facf = evaluate_fcurve(fcu, timeline_frame);
876  }
877  else {
878  fac = facf = seq->effect_fader;
879  }
880  }
881 
882  early_out = sh.early_out(seq, fac, facf);
883 
884  switch (early_out) {
885  case EARLY_NO_INPUT:
886  out = sh.execute(context, seq, timeline_frame, fac, facf, NULL, NULL, NULL);
887  break;
888  case EARLY_DO_EFFECT:
889  for (i = 0; i < 3; i++) {
890  /* Speed effect requires time remapping of `timeline_frame` for input(s). */
891  if (input[0] && seq->type == SEQ_TYPE_SPEED) {
892  float target_frame = seq_speed_effect_target_frame_get(context, seq, timeline_frame, i);
893  ibuf[i] = seq_render_strip(context, state, input[0], target_frame);
894  }
895  else { /* Other effects. */
896  if (input[i]) {
897  ibuf[i] = seq_render_strip(context, state, input[i], timeline_frame);
898  }
899  }
900  }
901 
902  if (ibuf[0] && (ibuf[1] || SEQ_effect_get_num_inputs(seq->type) == 1)) {
903  if (sh.multithreaded) {
905  &sh, context, seq, timeline_frame, fac, facf, ibuf[0], ibuf[1], ibuf[2]);
906  }
907  else {
908  out = sh.execute(context, seq, timeline_frame, fac, facf, ibuf[0], ibuf[1], ibuf[2]);
909  }
910  }
911  break;
912  case EARLY_USE_INPUT_1:
913  if (input[0]) {
914  out = seq_render_strip(context, state, input[0], timeline_frame);
915  }
916  break;
917  case EARLY_USE_INPUT_2:
918  if (input[1]) {
919  out = seq_render_strip(context, state, input[1], timeline_frame);
920  }
921  break;
922  }
923 
924  for (i = 0; i < 3; i++) {
925  IMB_freeImBuf(ibuf[i]);
926  }
927 
928  if (out == NULL) {
929  out = IMB_allocImBuf(context->rectx, context->recty, 32, IB_rect);
930  }
931 
932  return out;
933 }
936 /* -------------------------------------------------------------------- */
943  Sequence *seq,
944  char *name,
945  char *prefix,
946  const char *ext,
947  int view_id)
948 {
949 
950  ImBuf *ibuf = NULL;
951 
952  int flag = IB_rect | IB_metadata;
953  if (seq->alpha_mode == SEQ_ALPHA_PREMUL) {
954  flag |= IB_alphamode_premul;
955  }
956 
957  if (prefix[0] == '\0') {
958  ibuf = IMB_loadiffname(name, flag, seq->strip->colorspace_settings.name);
959  }
960  else {
961  char str[FILE_MAX];
962  BKE_scene_multiview_view_prefix_get(context->scene, name, prefix, &ext);
963  seq_multiview_name(context->scene, view_id, prefix, ext, str, FILE_MAX);
964  ibuf = IMB_loadiffname(str, flag, seq->strip->colorspace_settings.name);
965  }
966 
967  if (ibuf == NULL) {
968  return NULL;
969  }
970 
971  /* We don't need both (speed reasons)! */
972  if (ibuf->rect_float != NULL && ibuf->rect != NULL) {
973  imb_freerectImBuf(ibuf);
974  }
975 
976  /* All sequencer color is done in SRGB space, linear gives odd cross-fades. */
977  seq_imbuf_to_sequencer_space(context->scene, ibuf, false);
978 
979  return ibuf;
980 }
981 
983  Scene *scene, Sequence *seq, int totfiles, char *name, char *r_prefix, const char *r_ext)
984 {
985  if (totfiles > 1) {
986  BKE_scene_multiview_view_prefix_get(scene, name, r_prefix, &r_ext);
987  if (r_prefix[0] == '\0') {
988  return false;
989  }
990  }
991  else {
992  r_prefix[0] = '\0';
993  }
994 
995  return (seq->flag & SEQ_USE_VIEWS) != 0 && (scene->r.scemode & R_MULTIVIEW) != 0;
996 }
997 
999  Sequence *seq,
1000  float UNUSED(frame_index),
1001  float timeline_frame,
1002  bool *r_is_proxy_image)
1003 {
1004  char name[FILE_MAX];
1005  const char *ext = NULL;
1006  char prefix[FILE_MAX];
1007  ImBuf *ibuf = NULL;
1008 
1009  StripElem *s_elem = SEQ_render_give_stripelem(seq, timeline_frame);
1010  if (s_elem == NULL) {
1011  return NULL;
1012  }
1013 
1014  BLI_join_dirfile(name, sizeof(name), seq->strip->dir, s_elem->name);
1016 
1017  /* Try to get a proxy image. */
1018  ibuf = seq_proxy_fetch(context, seq, timeline_frame);
1019  if (ibuf != NULL) {
1020  *r_is_proxy_image = true;
1021  return ibuf;
1022  }
1023 
1024  /* Proxy not found, render original. */
1025  const int totfiles = seq_num_files(context->scene, seq->views_format, true);
1026  bool is_multiview_render = seq_image_strip_is_multiview_render(
1027  context->scene, seq, totfiles, name, prefix, ext);
1028 
1029  if (is_multiview_render) {
1030  int totviews = BKE_scene_multiview_num_views_get(&context->scene->r);
1031  ImBuf **ibufs_arr = MEM_callocN(sizeof(ImBuf *) * totviews, "Sequence Image Views Imbufs");
1032 
1033  for (int view_id = 0; view_id < totfiles; view_id++) {
1034  ibufs_arr[view_id] = seq_render_image_strip_view(context, seq, name, prefix, ext, view_id);
1035  }
1036 
1037  if (ibufs_arr[0] == NULL) {
1038  return NULL;
1039  }
1040 
1041  if (seq->views_format == R_IMF_VIEWS_STEREO_3D) {
1042  IMB_ImBufFromStereo3d(seq->stereo3d_format, ibufs_arr[0], &ibufs_arr[0], &ibufs_arr[1]);
1043  }
1044 
1045  for (int view_id = 0; view_id < totviews; view_id++) {
1046  SeqRenderData localcontext = *context;
1047  localcontext.view_id = view_id;
1048 
1049  if (view_id != context->view_id) {
1050  ibufs_arr[view_id] = seq_render_preprocess_ibuf(
1051  &localcontext, seq, ibufs_arr[view_id], timeline_frame, true, false);
1052  }
1053  }
1054 
1055  /* Return the original requested ImBuf. */
1056  ibuf = ibufs_arr[context->view_id];
1057 
1058  /* Remove the others (decrease their refcount). */
1059  for (int view_id = 0; view_id < totviews; view_id++) {
1060  if (ibufs_arr[view_id] != ibuf) {
1061  IMB_freeImBuf(ibufs_arr[view_id]);
1062  }
1063  }
1064 
1065  MEM_freeN(ibufs_arr);
1066  }
1067  else {
1068  ibuf = seq_render_image_strip_view(context, seq, name, prefix, ext, context->view_id);
1069  }
1070 
1071  if (ibuf == NULL) {
1072  return NULL;
1073  }
1074 
1075  s_elem->orig_width = ibuf->x;
1076  s_elem->orig_height = ibuf->y;
1077 
1078  return ibuf;
1079 }
1080 
1082  Sequence *seq,
1083  int timeline_frame)
1084 {
1085  char name[PROXY_MAXFILE];
1086  StripProxy *proxy = seq->strip->proxy;
1087 
1088  if (proxy->anim == NULL) {
1089  if (seq_proxy_get_custom_file_fname(seq, name, context->view_id)) {
1090  proxy->anim = openanim(name, IB_rect, 0, seq->strip->colorspace_settings.name);
1091  }
1092  if (proxy->anim == NULL) {
1093  return NULL;
1094  }
1095  }
1096 
1097  int frameno = (int)seq_give_frame_index(seq, timeline_frame) + seq->anim_startofs;
1098  return IMB_anim_absolute(proxy->anim, frameno, IMB_TC_NONE, IMB_PROXY_NONE);
1099 }
1100 
1105  Sequence *seq,
1106  float frame_index,
1107  float timeline_frame,
1108  StripAnim *sanim,
1109  bool *r_is_proxy_image)
1110 {
1111  ImBuf *ibuf = NULL;
1112  IMB_Proxy_Size psize = SEQ_rendersize_to_proxysize(context->preview_render_size);
1113 
1114  if (SEQ_can_use_proxy(context, seq, psize)) {
1115  /* Try to get a proxy image.
1116  * Movie proxies are handled by ImBuf module with exception of `custom file` setting. */
1117  if (context->scene->ed->proxy_storage != SEQ_EDIT_PROXY_DIR_STORAGE &&
1119  ibuf = seq_render_movie_strip_custom_file_proxy(context, seq, timeline_frame);
1120  }
1121  else {
1122  ibuf = IMB_anim_absolute(sanim->anim,
1123  frame_index + seq->anim_startofs,
1124  seq->strip->proxy ? seq->strip->proxy->tc : IMB_TC_RECORD_RUN,
1125  psize);
1126  }
1127 
1128  if (ibuf != NULL) {
1129  *r_is_proxy_image = true;
1130  }
1131  }
1132 
1133  /* Fetching for requested proxy size failed, try fetching the original instead. */
1134  if (ibuf == NULL) {
1135  ibuf = IMB_anim_absolute(sanim->anim,
1136  frame_index + seq->anim_startofs,
1137  seq->strip->proxy ? seq->strip->proxy->tc : IMB_TC_RECORD_RUN,
1138  IMB_PROXY_NONE);
1139  }
1140  if (ibuf == NULL) {
1141  return NULL;
1142  }
1143 
1144  seq_imbuf_to_sequencer_space(context->scene, ibuf, false);
1145 
1146  /* We don't need both (speed reasons)! */
1147  if (ibuf->rect_float != NULL && ibuf->rect != NULL) {
1148  imb_freerectImBuf(ibuf);
1149  }
1150 
1151  return ibuf;
1152 }
1153 
1155  Sequence *seq,
1156  float frame_index,
1157  float timeline_frame,
1158  bool *r_is_proxy_image)
1159 {
1160  /* Load all the videos. */
1161  seq_open_anim_file(context->scene, seq, false);
1162 
1163  ImBuf *ibuf = NULL;
1164  StripAnim *sanim = seq->anims.first;
1165  const int totfiles = seq_num_files(context->scene, seq->views_format, true);
1166  bool is_multiview_render = (seq->flag & SEQ_USE_VIEWS) != 0 &&
1167  (context->scene->r.scemode & R_MULTIVIEW) != 0 &&
1168  BLI_listbase_count_at_most(&seq->anims, totfiles + 1) == totfiles;
1169 
1170  if (is_multiview_render) {
1171  ImBuf **ibuf_arr;
1172  int totviews = BKE_scene_multiview_num_views_get(&context->scene->r);
1173  ibuf_arr = MEM_callocN(sizeof(ImBuf *) * totviews, "Sequence Image Views Imbufs");
1174  int ibuf_view_id;
1175 
1176  for (ibuf_view_id = 0, sanim = seq->anims.first; sanim; sanim = sanim->next, ibuf_view_id++) {
1177  if (sanim->anim) {
1178  ibuf_arr[ibuf_view_id] = seq_render_movie_strip_view(
1179  context, seq, frame_index, timeline_frame, sanim, r_is_proxy_image);
1180  }
1181  }
1182 
1183  if (seq->views_format == R_IMF_VIEWS_STEREO_3D) {
1184  if (ibuf_arr[0] == NULL) {
1185  /* Probably proxy hasn't been created yet. */
1186  MEM_freeN(ibuf_arr);
1187  return NULL;
1188  }
1189 
1190  IMB_ImBufFromStereo3d(seq->stereo3d_format, ibuf_arr[0], &ibuf_arr[0], &ibuf_arr[1]);
1191  }
1192 
1193  for (int view_id = 0; view_id < totviews; view_id++) {
1194  SeqRenderData localcontext = *context;
1195  localcontext.view_id = view_id;
1196 
1197  if (view_id != context->view_id) {
1198  ibuf_arr[view_id] = seq_render_preprocess_ibuf(
1199  &localcontext, seq, ibuf_arr[view_id], timeline_frame, true, false);
1200  }
1201  }
1202 
1203  /* Return the original requested ImBuf. */
1204  ibuf = ibuf_arr[context->view_id];
1205 
1206  /* Remove the others (decrease their refcount). */
1207  for (int view_id = 0; view_id < totviews; view_id++) {
1208  if (ibuf_arr[view_id] != ibuf) {
1209  IMB_freeImBuf(ibuf_arr[view_id]);
1210  }
1211  }
1212 
1213  MEM_freeN(ibuf_arr);
1214  }
1215  else {
1217  context, seq, frame_index, timeline_frame, sanim, r_is_proxy_image);
1218  }
1219 
1220  if (ibuf == NULL) {
1221  return NULL;
1222  }
1223 
1224  if (*r_is_proxy_image == false) {
1225  seq->strip->stripdata->orig_width = ibuf->x;
1226  seq->strip->stripdata->orig_height = ibuf->y;
1227  }
1228 
1229  return ibuf;
1230 }
1231 
1233 {
1234  ImBuf *ibuf = NULL;
1235  float tloc[2], tscale, tangle;
1237  ibuf = BKE_movieclip_get_stable_ibuf(seq->clip, &user, tloc, &tscale, &tangle, 0);
1238  }
1239  else {
1240  ibuf = BKE_movieclip_get_ibuf_flag(seq->clip, &user, seq->clip->flag, MOVIECLIP_CACHE_SKIP);
1241  }
1242  return ibuf;
1243 }
1244 
1246  Sequence *seq,
1247  float frame_index,
1248  bool *r_is_proxy_image)
1249 {
1250  ImBuf *ibuf = NULL;
1251  MovieClipUser user;
1252  IMB_Proxy_Size psize = SEQ_rendersize_to_proxysize(context->preview_render_size);
1253 
1254  if (!seq->clip) {
1255  return NULL;
1256  }
1257 
1258  memset(&user, 0, sizeof(MovieClipUser));
1259 
1260  BKE_movieclip_user_set_frame(&user, frame_index + seq->anim_startofs + seq->clip->start_frame);
1261 
1263  switch (psize) {
1264  case IMB_PROXY_NONE:
1266  break;
1267  case IMB_PROXY_100:
1269  break;
1270  case IMB_PROXY_75:
1272  break;
1273  case IMB_PROXY_50:
1275  break;
1276  case IMB_PROXY_25:
1278  break;
1279  }
1280 
1283  }
1284 
1285  /* Try to get a proxy image. */
1286  ibuf = seq_get_movieclip_ibuf(seq, user);
1287 
1288  if (ibuf != NULL && psize != IMB_PROXY_NONE) {
1289  *r_is_proxy_image = true;
1290  }
1291 
1292  /* If proxy is not found, grab full-size frame. */
1293  if (ibuf == NULL) {
1295  ibuf = seq_get_movieclip_ibuf(seq, user);
1296  }
1297 
1298  return ibuf;
1299 }
1300 
1302  Mask *mask,
1303  float frame_index,
1304  bool make_float)
1305 {
1306  /* TODO - add option to rasterize to alpha imbuf? */
1307  ImBuf *ibuf = NULL;
1308  float *maskbuf;
1309  int i;
1310 
1311  if (!mask) {
1312  return NULL;
1313  }
1314 
1315  AnimData *adt;
1316  Mask *mask_temp;
1317  MaskRasterHandle *mr_handle;
1318 
1319  mask_temp = (Mask *)BKE_id_copy_ex(
1321 
1322  BKE_mask_evaluate(mask_temp, mask->sfra + frame_index, true);
1323 
1324  /* anim-data */
1325  adt = BKE_animdata_from_id(&mask->id);
1326  const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct(
1327  context->depsgraph, mask->sfra + frame_index);
1328  BKE_animsys_evaluate_animdata(&mask_temp->id, adt, &anim_eval_context, ADT_RECALC_ANIM, false);
1329 
1330  maskbuf = MEM_mallocN(sizeof(float) * context->rectx * context->recty, __func__);
1331 
1332  mr_handle = BKE_maskrasterize_handle_new();
1333 
1335  mr_handle, mask_temp, context->rectx, context->recty, true, true, true);
1336 
1337  BKE_id_free(NULL, &mask_temp->id);
1338 
1339  BKE_maskrasterize_buffer(mr_handle, context->rectx, context->recty, maskbuf);
1340 
1341  BKE_maskrasterize_handle_free(mr_handle);
1342 
1343  if (make_float) {
1344  /* pixels */
1345  const float *fp_src;
1346  float *fp_dst;
1347 
1348  ibuf = IMB_allocImBuf(context->rectx, context->recty, 32, IB_rectfloat);
1349 
1350  fp_src = maskbuf;
1351  fp_dst = ibuf->rect_float;
1352  i = context->rectx * context->recty;
1353  while (--i) {
1354  fp_dst[0] = fp_dst[1] = fp_dst[2] = *fp_src;
1355  fp_dst[3] = 1.0f;
1356 
1357  fp_src += 1;
1358  fp_dst += 4;
1359  }
1360  }
1361  else {
1362  /* pixels */
1363  const float *fp_src;
1364  unsigned char *ub_dst;
1365 
1366  ibuf = IMB_allocImBuf(context->rectx, context->recty, 32, IB_rect);
1367 
1368  fp_src = maskbuf;
1369  ub_dst = (unsigned char *)ibuf->rect;
1370  i = context->rectx * context->recty;
1371  while (--i) {
1372  ub_dst[0] = ub_dst[1] = ub_dst[2] = (unsigned char)(*fp_src * 255.0f); /* already clamped */
1373  ub_dst[3] = 255;
1374 
1375  fp_src += 1;
1376  ub_dst += 4;
1377  }
1378  }
1379 
1380  MEM_freeN(maskbuf);
1381 
1382  return ibuf;
1383 }
1384 
1385 static ImBuf *seq_render_mask_strip(const SeqRenderData *context, Sequence *seq, float frame_index)
1386 {
1387  bool make_float = (seq->flag & SEQ_MAKE_FLOAT) != 0;
1388 
1389  return seq_render_mask(context, seq->mask, frame_index, make_float);
1390 }
1391 
1393  Sequence *seq,
1394  float frame_index,
1395  float timeline_frame)
1396 {
1397  ImBuf *ibuf = NULL;
1398  double frame;
1399  Object *camera;
1400 
1401  struct {
1402  int scemode;
1403  int timeline_frame;
1404  float subframe;
1405 
1406 #ifdef DURIAN_CAMERA_SWITCH
1407  int mode;
1408 #endif
1409  } orig_data;
1410 
1411  /* Old info:
1412  * Hack! This function can be called from do_render_seq(), in that case
1413  * the seq->scene can already have a Render initialized with same name,
1414  * so we have to use a default name. (compositor uses scene name to
1415  * find render).
1416  * However, when called from within the UI (image preview in sequencer)
1417  * we do want to use scene Render, that way the render result is defined
1418  * for display in render/imagewindow
1419  *
1420  * Hmm, don't see, why we can't do that all the time,
1421  * and since G.is_rendering is uhm, gone... (Peter)
1422  */
1423 
1424  /* New info:
1425  * Using the same name for the renders works just fine as the do_render_seq()
1426  * render is not used while the scene strips are rendered.
1427  *
1428  * However rendering from UI (through sequencer_preview_area_draw) can crash in
1429  * very many cases since other renders (material preview, an actual render etc.)
1430  * can be started while this sequence preview render is running. The only proper
1431  * solution is to make the sequencer preview render a proper job, which can be
1432  * stopped when needed. This would also give a nice progress bar for the preview
1433  * space so that users know there's something happening.
1434  *
1435  * As a result the active scene now only uses OpenGL rendering for the sequencer
1436  * preview. This is far from nice, but is the only way to prevent crashes at this
1437  * time.
1438  *
1439  * -jahka
1440  */
1441 
1442  const bool is_rendering = G.is_rendering;
1443  const bool is_background = G.background;
1444  const bool do_seq_gl = is_rendering ? 0 : (context->scene->r.seq_prev_type) != OB_RENDER;
1445  bool have_comp = false;
1446  bool use_gpencil = true;
1447  /* do we need to re-evaluate the frame after rendering? */
1448  bool is_frame_update = false;
1449  Scene *scene;
1450  int is_thread_main = BLI_thread_is_main();
1451 
1452  /* don't refer to seq->scene above this point!, it can be NULL */
1453  if (seq->scene == NULL) {
1454  return NULL;
1455  }
1456 
1457  /* Prevent rendering scene recursively. */
1458  if (seq->scene == context->scene) {
1459  return NULL;
1460  }
1461 
1462  scene = seq->scene;
1463  frame = (double)scene->r.sfra + (double)frame_index + (double)seq->anim_startofs;
1464 
1465 #if 0 /* UNUSED */
1466  have_seq = (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first);
1467 #endif
1468  have_comp = (scene->r.scemode & R_DOCOMP) && scene->use_nodes && scene->nodetree;
1469 
1470  /* Get view layer for the strip. */
1472  /* Depsgraph will be NULL when doing rendering. */
1474 
1475  orig_data.scemode = scene->r.scemode;
1476  orig_data.timeline_frame = scene->r.cfra;
1477  orig_data.subframe = scene->r.subframe;
1478 #ifdef DURIAN_CAMERA_SWITCH
1479  orig_data.mode = scene->r.mode;
1480 #endif
1481 
1482  BKE_scene_frame_set(scene, frame);
1483 
1484  if (seq->scene_camera) {
1485  camera = seq->scene_camera;
1486  }
1487  else {
1489  camera = scene->camera;
1490  }
1491 
1492  if (have_comp == false && camera == NULL) {
1493  goto finally;
1494  }
1495 
1496  if (seq->flag & SEQ_SCENE_NO_GPENCIL) {
1497  use_gpencil = false;
1498  }
1499 
1500  /* prevent eternal loop */
1501  scene->r.scemode &= ~R_DOSEQ;
1502 
1503 #ifdef DURIAN_CAMERA_SWITCH
1504  /* stooping to new low's in hackyness :( */
1506 #endif
1507 
1508  is_frame_update = (orig_data.timeline_frame != scene->r.cfra) ||
1509  (orig_data.subframe != scene->r.subframe);
1510 
1511  if ((sequencer_view3d_fn && do_seq_gl && camera) && is_thread_main) {
1512  char err_out[256] = "unknown";
1513  const int width = (scene->r.xsch * scene->r.size) / 100;
1514  const int height = (scene->r.ysch * scene->r.size) / 100;
1515  const char *viewname = BKE_scene_multiview_render_view_name_get(&scene->r, context->view_id);
1516 
1517  unsigned int draw_flags = V3D_OFSDRAW_NONE;
1518  draw_flags |= (use_gpencil) ? V3D_OFSDRAW_SHOW_ANNOTATION : 0;
1519  draw_flags |= (context->scene->r.seq_flag & R_SEQ_OVERRIDE_SCENE_SETTINGS) ?
1521  0;
1522 
1523  /* for old scene this can be uninitialized,
1524  * should probably be added to do_versions at some point if the functionality stays */
1525  if (context->scene->r.seq_prev_type == 0) {
1526  context->scene->r.seq_prev_type = 3 /* == OB_SOLID */;
1527  }
1528 
1529  /* opengl offscreen render */
1530  depsgraph = BKE_scene_ensure_depsgraph(context->bmain, scene, view_layer);
1532  Object *camera_eval = DEG_get_evaluated_object(depsgraph, camera);
1533  ibuf = sequencer_view3d_fn(
1534  /* set for OpenGL render (NULL when scrubbing) */
1535  depsgraph,
1536  scene,
1537  &context->scene->display.shading,
1538  context->scene->r.seq_prev_type,
1539  camera_eval,
1540  width,
1541  height,
1542  IB_rect,
1543  draw_flags,
1544  scene->r.alphamode,
1545  viewname,
1546  context->gpu_offscreen,
1547  err_out);
1548  if (ibuf == NULL) {
1549  fprintf(stderr, "seq_render_scene_strip failed to get opengl buffer: %s\n", err_out);
1550  }
1551  }
1552  else {
1554  const int totviews = BKE_scene_multiview_num_views_get(&scene->r);
1555  ImBuf **ibufs_arr;
1556 
1557  ibufs_arr = MEM_callocN(sizeof(ImBuf *) * totviews, "Sequence Image Views Imbufs");
1558 
1559  /* XXX: this if can be removed when sequence preview rendering uses the job system
1560  *
1561  * disable rendered preview for sequencer while rendering -- it's very much possible
1562  * that preview render will went into conflict with final render
1563  *
1564  * When rendering from command line renderer is called from main thread, in this
1565  * case it's always safe to render scene here
1566  */
1567  if (!is_thread_main || is_rendering == false || is_background || context->for_render) {
1568  if (re == NULL) {
1569  re = RE_NewSceneRender(scene);
1570  }
1571 
1573  re, context->bmain, scene, have_comp ? NULL : view_layer, camera, frame, false);
1574 
1575  /* restore previous state after it was toggled on & off by RE_RenderFrame */
1576  G.is_rendering = is_rendering;
1577  }
1578 
1579  for (int view_id = 0; view_id < totviews; view_id++) {
1580  SeqRenderData localcontext = *context;
1581  RenderResult rres;
1582 
1583  localcontext.view_id = view_id;
1584 
1585  RE_AcquireResultImage(re, &rres, view_id);
1586 
1587  if (rres.rectf) {
1588  ibufs_arr[view_id] = IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat);
1589  memcpy(ibufs_arr[view_id]->rect_float,
1590  rres.rectf,
1591  sizeof(float[4]) * rres.rectx * rres.recty);
1592 
1593  if (rres.rectz) {
1594  addzbuffloatImBuf(ibufs_arr[view_id]);
1595  memcpy(
1596  ibufs_arr[view_id]->zbuf_float, rres.rectz, sizeof(float) * rres.rectx * rres.recty);
1597  }
1598 
1599  /* float buffers in the sequencer are not linear */
1600  seq_imbuf_to_sequencer_space(context->scene, ibufs_arr[view_id], false);
1601  }
1602  else if (rres.rect32) {
1603  ibufs_arr[view_id] = IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect);
1604  memcpy(ibufs_arr[view_id]->rect, rres.rect32, 4 * rres.rectx * rres.recty);
1605  }
1606 
1607  if (view_id != context->view_id) {
1608  seq_cache_put(&localcontext, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibufs_arr[view_id]);
1609  }
1610 
1612  }
1613 
1614  /* return the original requested ImBuf */
1615  ibuf = ibufs_arr[context->view_id];
1616 
1617  /* "remove" the others (decrease their refcount) */
1618  for (int view_id = 0; view_id < totviews; view_id++) {
1619  if (ibufs_arr[view_id] != ibuf) {
1620  IMB_freeImBuf(ibufs_arr[view_id]);
1621  }
1622  }
1623  MEM_freeN(ibufs_arr);
1624  }
1625 
1626 finally:
1627  /* restore */
1628  scene->r.scemode = orig_data.scemode;
1629  scene->r.cfra = orig_data.timeline_frame;
1630  scene->r.subframe = orig_data.subframe;
1631 
1632  if (is_frame_update && (depsgraph != NULL)) {
1634  }
1635 
1636 #ifdef DURIAN_CAMERA_SWITCH
1637  /* stooping to new low's in hackyness :( */
1638  scene->r.mode &= orig_data.mode | ~R_NO_CAMERA_SWITCH;
1639 #endif
1640 
1641  return ibuf;
1642 }
1643 
1649  Sequence *seq,
1650  float frame_index)
1651 {
1652  ImBuf *ibuf = NULL;
1653  ListBase *seqbase = NULL;
1654  int offset;
1655 
1656  seqbase = SEQ_get_seqbase_from_sequence(seq, &offset);
1657 
1658  if (seqbase && !BLI_listbase_is_empty(seqbase)) {
1659 
1660  if (seq->flag & SEQ_SCENE_STRIPS && seq->scene) {
1661  BKE_animsys_evaluate_all_animation(context->bmain, context->depsgraph, frame_index + offset);
1662  }
1663 
1665  state,
1666  seqbase,
1667  /* scene strips don't have their start taken into account */
1668  frame_index + offset,
1669  0);
1670  }
1671 
1672  return ibuf;
1673 }
1676 /* -------------------------------------------------------------------- */
1681  Sequence *seq,
1682  float timeline_frame,
1683  bool *r_is_proxy_image)
1684 {
1685  ImBuf *ibuf = NULL;
1686  float frame_index = seq_give_frame_index(seq, timeline_frame);
1687  int type = (seq->type & SEQ_TYPE_EFFECT) ? SEQ_TYPE_EFFECT : seq->type;
1688  switch (type) {
1689  case SEQ_TYPE_META: {
1690  ibuf = do_render_strip_seqbase(context, state, seq, frame_index);
1691  break;
1692  }
1693 
1694  case SEQ_TYPE_SCENE: {
1695  if (seq->flag & SEQ_SCENE_STRIPS) {
1696  if (seq->scene && (context->scene != seq->scene)) {
1697  /* recursive check */
1698  if (BLI_linklist_index(state->scene_parents, seq->scene) != -1) {
1699  break;
1700  }
1701  LinkNode scene_parent = {
1702  .next = state->scene_parents,
1703  .link = seq->scene,
1704  };
1705  state->scene_parents = &scene_parent;
1706  /* end check */
1707 
1708  /* Use the Scene sequence-strip's scene for the context when rendering the
1709  * scene's sequences (necessary for multi-cam selector among others). */
1710  SeqRenderData local_context = *context;
1711  local_context.scene = seq->scene;
1712  local_context.skip_cache = true;
1713 
1714  ibuf = do_render_strip_seqbase(&local_context, state, seq, frame_index);
1715 
1716  /* step back in the list */
1717  state->scene_parents = state->scene_parents->next;
1718  }
1719  }
1720  else {
1721  /* scene can be NULL after deletions */
1722  ibuf = seq_render_scene_strip(context, seq, frame_index, timeline_frame);
1723  }
1724 
1725  break;
1726  }
1727 
1728  case SEQ_TYPE_EFFECT: {
1729  ibuf = seq_render_effect_strip_impl(context, state, seq, timeline_frame);
1730  break;
1731  }
1732 
1733  case SEQ_TYPE_IMAGE: {
1734  ibuf = seq_render_image_strip(context, seq, frame_index, timeline_frame, r_is_proxy_image);
1735  break;
1736  }
1737 
1738  case SEQ_TYPE_MOVIE: {
1739  ibuf = seq_render_movie_strip(context, seq, frame_index, timeline_frame, r_is_proxy_image);
1740  break;
1741  }
1742 
1743  case SEQ_TYPE_MOVIECLIP: {
1744  ibuf = seq_render_movieclip_strip(context, seq, frame_index, r_is_proxy_image);
1745 
1746  if (ibuf) {
1747  /* duplicate frame so movie cache wouldn't be confused by sequencer's stuff */
1748  ImBuf *i = IMB_dupImBuf(ibuf);
1749  IMB_freeImBuf(ibuf);
1750  ibuf = i;
1751 
1752  if (ibuf->rect_float) {
1753  seq_imbuf_to_sequencer_space(context->scene, ibuf, false);
1754  }
1755  }
1756 
1757  break;
1758  }
1759 
1760  case SEQ_TYPE_MASK: {
1761  /* ibuf is always new */
1762  ibuf = seq_render_mask_strip(context, seq, frame_index);
1763  break;
1764  }
1765  }
1766 
1767  if (ibuf) {
1768  seq_imbuf_assign_spaces(context->scene, ibuf);
1769  }
1770 
1771  return ibuf;
1772 }
1773 
1776  Sequence *seq,
1777  float timeline_frame)
1778 {
1779  ImBuf *ibuf = NULL;
1780  bool use_preprocess = false;
1781  bool is_proxy_image = false;
1782 
1783  ibuf = seq_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED);
1784  if (ibuf != NULL) {
1785  return ibuf;
1786  }
1787 
1788  /* Proxies are not stored in cache. */
1789  if (!SEQ_can_use_proxy(
1790  context, seq, SEQ_rendersize_to_proxysize(context->preview_render_size))) {
1791  ibuf = seq_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_RAW);
1792  }
1793 
1794  if (ibuf == NULL) {
1795  ibuf = do_render_strip_uncached(context, state, seq, timeline_frame, &is_proxy_image);
1796  }
1797 
1798  if (ibuf) {
1799  use_preprocess = seq_input_have_to_preprocess(context, seq, timeline_frame);
1801  context, seq, ibuf, timeline_frame, use_preprocess, is_proxy_image);
1802  }
1803 
1804  if (ibuf == NULL) {
1805  ibuf = IMB_allocImBuf(context->rectx, context->recty, 32, IB_rect);
1806  seq_imbuf_assign_spaces(context->scene, ibuf);
1807  }
1808 
1809  return ibuf;
1810 }
1811 
1813 {
1814  bool swap_input = false;
1815 
1816  /* bad hack, to fix crazy input ordering of
1817  * those two effects */
1818 
1820  swap_input = true;
1821  }
1822 
1823  return swap_input;
1824 }
1825 
1827 {
1829  float facf = seq->blend_opacity / 100.0f;
1830  int early_out = sh.early_out(seq, facf, facf);
1831 
1833  return early_out;
1834  }
1835 
1837  if (early_out == EARLY_USE_INPUT_2) {
1838  return EARLY_USE_INPUT_1;
1839  }
1840  if (early_out == EARLY_USE_INPUT_1) {
1841  return EARLY_USE_INPUT_2;
1842  }
1843  }
1844  return early_out;
1845 }
1846 
1848  const SeqRenderData *context, Sequence *seq, float timeline_frame, ImBuf *ibuf1, ImBuf *ibuf2)
1849 {
1850  ImBuf *out;
1852  float facf = seq->blend_opacity / 100.0f;
1853  int swap_input = seq_must_swap_input_in_blend_mode(seq);
1854 
1855  if (swap_input) {
1856  if (sh.multithreaded) {
1858  &sh, context, seq, timeline_frame, facf, facf, ibuf2, ibuf1, NULL);
1859  }
1860  else {
1861  out = sh.execute(context, seq, timeline_frame, facf, facf, ibuf2, ibuf1, NULL);
1862  }
1863  }
1864  else {
1865  if (sh.multithreaded) {
1867  &sh, context, seq, timeline_frame, facf, facf, ibuf1, ibuf2, NULL);
1868  }
1869  else {
1870  out = sh.execute(context, seq, timeline_frame, facf, facf, ibuf1, ibuf2, NULL);
1871  }
1872  }
1873 
1874  return out;
1875 }
1876 
1879  ListBase *seqbasep,
1880  float timeline_frame,
1881  int chanshown)
1882 {
1883  Sequence *seq_arr[MAXSEQ + 1];
1884  int count;
1885  int i;
1886  ImBuf *out = NULL;
1887 
1888  count = seq_get_shown_sequences(seqbasep, timeline_frame, chanshown, (Sequence **)&seq_arr);
1889 
1890  if (count == 0) {
1891  return NULL;
1892  }
1893 
1894  for (i = count - 1; i >= 0; i--) {
1895  int early_out;
1896  Sequence *seq = seq_arr[i];
1897 
1898  out = seq_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_COMPOSITE);
1899 
1900  if (out) {
1901  break;
1902  }
1903  if (seq->blend_mode == SEQ_BLEND_REPLACE) {
1904  out = seq_render_strip(context, state, seq, timeline_frame);
1905  break;
1906  }
1907 
1909 
1910  switch (early_out) {
1911  case EARLY_NO_INPUT:
1912  case EARLY_USE_INPUT_2:
1913  out = seq_render_strip(context, state, seq, timeline_frame);
1914  break;
1915  case EARLY_USE_INPUT_1:
1916  if (i == 0) {
1917  out = IMB_allocImBuf(context->rectx, context->recty, 32, IB_rect);
1918  }
1919  break;
1920  case EARLY_DO_EFFECT:
1921  if (i == 0) {
1922  ImBuf *ibuf1 = IMB_allocImBuf(context->rectx, context->recty, 32, IB_rect);
1923  ImBuf *ibuf2 = seq_render_strip(context, state, seq, timeline_frame);
1924 
1925  out = seq_render_strip_stack_apply_effect(context, seq, timeline_frame, ibuf1, ibuf2);
1926 
1927  seq_cache_put(context, seq_arr[i], timeline_frame, SEQ_CACHE_STORE_COMPOSITE, out);
1928 
1929  IMB_freeImBuf(ibuf1);
1930  IMB_freeImBuf(ibuf2);
1931  }
1932  break;
1933  }
1934  if (out) {
1935  break;
1936  }
1937  }
1938 
1939  i++;
1940  for (; i < count; i++) {
1941  Sequence *seq = seq_arr[i];
1942 
1944  ImBuf *ibuf1 = out;
1945  ImBuf *ibuf2 = seq_render_strip(context, state, seq, timeline_frame);
1946 
1947  out = seq_render_strip_stack_apply_effect(context, seq, timeline_frame, ibuf1, ibuf2);
1948 
1949  IMB_freeImBuf(ibuf1);
1950  IMB_freeImBuf(ibuf2);
1951  }
1952 
1953  seq_cache_put(context, seq_arr[i], timeline_frame, SEQ_CACHE_STORE_COMPOSITE, out);
1954  }
1955 
1956  return out;
1957 }
1958 
1964 ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float timeline_frame, int chanshown)
1965 {
1966  Scene *scene = context->scene;
1967  Editing *ed = SEQ_editing_get(scene, false);
1968  ListBase *seqbasep;
1969 
1970  if (ed == NULL) {
1971  return NULL;
1972  }
1973 
1974  if ((chanshown < 0) && !BLI_listbase_is_empty(&ed->metastack)) {
1975  int count = BLI_listbase_count(&ed->metastack);
1976  count = max_ii(count + chanshown, 0);
1977  seqbasep = ((MetaStack *)BLI_findlink(&ed->metastack, count))->oldbasep;
1978  }
1979  else {
1980  seqbasep = ed->seqbasep;
1981  }
1982 
1985  ImBuf *out = NULL;
1986  Sequence *seq_arr[MAXSEQ + 1];
1987  int count;
1988 
1989  count = seq_get_shown_sequences(seqbasep, timeline_frame, chanshown, seq_arr);
1990 
1991  if (count) {
1992  out = seq_cache_get(context, seq_arr[count - 1], timeline_frame, SEQ_CACHE_STORE_FINAL_OUT);
1993  }
1994 
1995  seq_cache_free_temp_cache(context->scene, context->task_id, timeline_frame);
1996 
1997  if (count && !out) {
1999  out = seq_render_strip_stack(context, &state, seqbasep, timeline_frame, chanshown);
2000 
2001  if (context->is_prefetch_render) {
2002  seq_cache_put(context, seq_arr[count - 1], timeline_frame, SEQ_CACHE_STORE_FINAL_OUT, out);
2003  }
2004  else {
2006  context, seq_arr[count - 1], timeline_frame, SEQ_CACHE_STORE_FINAL_OUT, out);
2007  }
2009  }
2010 
2011  seq_prefetch_start(context, timeline_frame);
2012 
2013  return out;
2014 }
2015 
2017  float timeline_frame,
2018  int chan_shown,
2019  ListBase *seqbasep)
2020 {
2023 
2024  return seq_render_strip_stack(context, &state, seqbasep, timeline_frame, chan_shown);
2025 }
2026 
2028  float timeline_frame,
2029  Sequence *seq)
2030 {
2033 
2034  ImBuf *ibuf = seq_render_strip(context, &state, seq, timeline_frame);
2035 
2036  return ibuf;
2037 }
typedef float(TangentPoint)[2]
struct AnimData * BKE_animdata_from_id(struct ID *id)
Definition: anim_data.c:96
void BKE_animsys_evaluate_all_animation(struct Main *main, struct Depsgraph *depsgraph, float ctime)
Definition: anim_sys.c:2887
AnimationEvalContext BKE_animsys_eval_context_construct(struct Depsgraph *depsgraph, float eval_time)
Definition: anim_sys.c:637
@ ADT_RECALC_ANIM
Definition: BKE_animsys.h:238
void BKE_animsys_evaluate_animdata(struct ID *id, struct AnimData *adt, const struct AnimationEvalContext *anim_eval_context, eAnimData_Recalc recalc, const bool flush_to_original)
float evaluate_fcurve(struct FCurve *fcu, float evaltime)
Definition: fcurve.c:2186
struct FCurve * id_data_find_fcurve(ID *id, void *data, struct StructRNA *type, const char *prop_name, int index, bool *r_driven)
Definition: fcurve.c:221
struct anim * openanim(const char *name, int flags, int streamindex, char colorspace[IMA_MAX_SPACE])
Definition: image.c:3115
struct ViewLayer * BKE_view_layer_default_render(const struct Scene *scene)
@ LIB_ID_COPY_LOCALIZE
Definition: BKE_lib_id.h:145
@ LIB_ID_COPY_NO_ANIMDATA
Definition: BKE_lib_id.h:120
struct ID * BKE_id_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r_newid, const int flag)
void BKE_id_free(struct Main *bmain, void *idv)
const char * BKE_main_blendfile_path_from_global(void)
Definition: main.c:439
void BKE_mask_evaluate(struct Mask *mask, const float ctime, const bool do_newframe)
Definition: mask.c:1595
void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle)
void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mask, const int width, const int height, const bool do_aspect_correct, const bool do_mask_aa, const bool do_feather)
void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle, const unsigned int width, const unsigned int height, float *buffer)
Rasterize a buffer from a single mask (threaded execution).
MaskRasterHandle * BKE_maskrasterize_handle_new(void)
#define MOVIECLIP_CACHE_SKIP
struct ImBuf * BKE_movieclip_get_ibuf_flag(struct MovieClip *clip, struct MovieClipUser *user, int flag, int cache_flag)
Definition: movieclip.c:1354
void BKE_movieclip_user_set_frame(struct MovieClipUser *user, int framenr)
Definition: movieclip.c:1633
struct ImBuf * BKE_movieclip_get_stable_ibuf(struct MovieClip *clip, struct MovieClipUser *user, float loc[2], float *scale, float *angle, int postprocess_flag)
Definition: movieclip.c:1467
void BKE_scene_frame_set(struct Scene *scene, double cfra)
Definition: scene.c:2475
void BKE_scene_multiview_view_prefix_get(struct Scene *scene, const char *name, char *r_prefix, const char **r_ext)
Definition: scene.c:3301
bool BKE_scene_camera_switch_update(struct Scene *scene)
Definition: scene.c:2349
void BKE_scene_graph_update_for_newframe(struct Depsgraph *depsgraph)
Definition: scene.c:2794
int BKE_scene_multiview_num_views_get(const struct RenderData *rd)
struct Depsgraph * BKE_scene_ensure_depsgraph(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer)
Definition: scene.c:3526
const char * BKE_scene_multiview_render_view_name_get(const struct RenderData *rd, const int view_id)
struct ImBuf *(* SequencerDrawView)(struct Depsgraph *depsgraph, struct Scene *scene, struct View3DShading *shading_override, enum eDrawType drawtype, struct Object *camera, int width, int height, enum eImBufFlags flag, eV3DOffscreenDrawFlag draw_flags, int alpha_mode, const char *viewname, struct GPUOffScreen *ofs, char err_out[256])
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
Definition: BLI_listbase.h:124
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:172
int BLI_listbase_count_at_most(const struct ListBase *listbase, const int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
MINLINE void srgb_to_linearrgb_v4(float linear[4], const float srgb[4])
void loc_rot_size_to_mat3(float R[3][3], const float loc[2], const float angle, const float size[2])
Definition: math_matrix.c:2622
void transform_pivot_set_m3(float mat[3][3], const float pivot[2])
Definition: math_matrix.c:2425
void mul_v2_m3v2(float r[2], const float m[3][3], const float v[2])
Definition: math_matrix.c:714
bool invert_m3(float R[3][3])
Definition: math_matrix.c:1152
#define FILE_MAX
void BLI_join_dirfile(char *__restrict dst, const size_t maxlen, const char *__restrict dir, const char *__restrict file) ATTR_NONNULL()
Definition: path_util.c:1737
bool BLI_path_abs(char *path, const char *basepath) ATTR_NONNULL()
Definition: path_util.c:1016
#define BLI_MUTEX_INITIALIZER
Definition: BLI_threads.h:84
int BLI_thread_is_main(void)
Definition: threads.cc:234
void BLI_mutex_lock(ThreadMutex *mutex)
Definition: threads.cc:401
void BLI_mutex_unlock(ThreadMutex *mutex)
Definition: threads.cc:406
pthread_mutex_t ThreadMutex
Definition: BLI_threads.h:83
#define UNUSED(x)
#define ELEM(...)
#define STREQ(a, b)
typedef double(DMatrix)[4][4]
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
@ MCLIP_PROXY_RENDER_USE_FALLBACK_RENDER
@ MCLIP_PROXY_RENDER_UNDISTORT
@ MCLIP_PROXY_RENDER_SIZE_75
@ MCLIP_PROXY_RENDER_SIZE_100
@ MCLIP_PROXY_RENDER_SIZE_50
@ MCLIP_PROXY_RENDER_SIZE_FULL
@ MCLIP_PROXY_RENDER_SIZE_25
@ OB_RENDER
#define R_MULTIVIEW
@ R_SEQ_OVERRIDE_SCENE_SETTINGS
#define R_NO_CAMERA_SWITCH
#define R_DOCOMP
#define R_DOSEQ
@ R_IMF_VIEWS_STEREO_3D
#define SEQ_BLEND_REPLACE
@ SEQ_MUTE
@ SEQ_FILTERY
@ SEQ_FLIPX
@ SEQ_MAKE_FLOAT
@ SEQ_SCENE_NO_GPENCIL
@ SEQ_SCENE_STRIPS
@ SEQ_USE_EFFECT_DEFAULT_FADE
@ SEQ_FLIPY
@ SEQ_USE_VIEWS
#define SEQ_MOVIECLIP_RENDER_STABILIZED
#define SEQ_MOVIECLIP_RENDER_UNDISTORTED
@ SEQ_CACHE_STORE_PREPROCESSED
@ SEQ_CACHE_STORE_RAW
@ SEQ_CACHE_STORE_FINAL_OUT
@ SEQ_CACHE_STORE_COMPOSITE
@ SEQ_ALPHA_PREMUL
#define MAXSEQ
@ SEQ_STORAGE_PROXY_CUSTOM_FILE
#define SEQ_EDIT_PROXY_DIR_STORAGE
@ SEQ_TYPE_SOUND_RAM
@ SEQ_TYPE_META
@ SEQ_TYPE_OVERDROP
@ SEQ_TYPE_ALPHAUNDER
@ SEQ_TYPE_SCENE
@ SEQ_TYPE_MOVIECLIP
@ SEQ_TYPE_ALPHAOVER
@ SEQ_TYPE_IMAGE
@ SEQ_TYPE_SPEED
@ SEQ_TYPE_EFFECT
@ SEQ_TYPE_MOVIE
@ SEQ_TYPE_MASK
@ SEQ_RENDER_SIZE_SCENE
@ V3D_OFSDRAW_NONE
@ V3D_OFSDRAW_OVERRIDE_SCENE_SETTINGS
@ V3D_OFSDRAW_SHOW_ANNOTATION
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble right
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble top
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble bottom
const char * IMB_colormanagement_get_rect_colorspace(struct ImBuf *ibuf)
void IMB_colormanagement_transform_from_byte_threaded(float *float_buffer, unsigned char *byte_buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace)
void IMB_colormanagement_assign_float_colorspace(struct ImBuf *ibuf, const char *name)
void IMB_colormanagement_transform_threaded(float *buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace, bool predivide)
void IMB_colormanagement_transform_byte_threaded(unsigned char *buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace)
void IMB_colormanagement_assign_rect_colorspace(struct ImBuf *ibuf, const char *name)
const char * IMB_colormanagement_role_colorspace_name_get(int role)
@ COLOR_ROLE_SCENE_LINEAR
void IMB_colormanagement_transform_v4(float pixel[4], const char *from_colorspace, const char *to_colorspace)
const char * IMB_colormanagement_get_float_colorspace(struct ImBuf *ibuf)
void nearest_interpolation(struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout)
Definition: imageprocess.c:337
struct ImBuf * IMB_makeSingleUser(struct ImBuf *ibuf)
Definition: allocimbuf.c:246
struct ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, unsigned char planes, unsigned int flags)
Definition: allocimbuf.c:478
struct ImBuf * IMB_dupImBuf(const struct ImBuf *ibuf1)
IMB_Proxy_Size
Definition: IMB_imbuf.h:317
@ IMB_PROXY_100
Definition: IMB_imbuf.h:322
@ IMB_PROXY_75
Definition: IMB_imbuf.h:321
@ IMB_PROXY_50
Definition: IMB_imbuf.h:320
@ IMB_PROXY_25
Definition: IMB_imbuf.h:319
@ IMB_PROXY_NONE
Definition: IMB_imbuf.h:318
void IMB_freeImBuf(struct ImBuf *ibuf)
Definition: allocimbuf.c:211
void IMB_filtery(struct ImBuf *ibuf)
Definition: filter.c:119
void imb_freerectImBuf(struct ImBuf *ibuf)
Definition: allocimbuf.c:115
void IMB_processor_apply_threaded(int buffer_lines, int handle_size, void *init_customdata, void(init_handle)(void *handle, int start_line, int tot_line, void *customdata), void *(do_thread)(void *))
Definition: imageprocess.c:362
void IMB_ImBufFromStereo3d(struct Stereo3dFormat *s3d, struct ImBuf *ibuf_stereo, struct ImBuf **r_ibuf_left, struct ImBuf **r_ibuf_right)
Definition: stereoimbuf.c:1279
bool addzbuffloatImBuf(struct ImBuf *ibuf)
Definition: allocimbuf.c:289
void IMB_saturation(struct ImBuf *ibuf, float sat)
Definition: divers.c:887
bool imb_addrectfloatImBuf(struct ImBuf *ibuf)
Definition: allocimbuf.c:386
struct ImBuf * IMB_loadiffname(const char *filepath, int flags, char colorspace[IM_MAX_SPACE])
Definition: readimage.c:224
void IMB_flipx(struct ImBuf *ibuf)
Definition: rotate.c:92
struct ImBuf * IMB_anim_absolute(struct anim *anim, int position, IMB_Timecode_Type tc, IMB_Proxy_Size preview_size)
Definition: anim_movie.c:1580
void IMB_flipy(struct ImBuf *ibuf)
Definition: rotate.c:33
@ IMB_TC_NONE
Definition: IMB_imbuf.h:300
@ IMB_TC_RECORD_RUN
Definition: IMB_imbuf.h:304
Contains defines and structs used throughout the imbuf module.
@ IB_alphamode_premul
@ IB_rectfloat
@ IB_metadata
@ IB_rect
void IMB_metadata_copy(struct ImBuf *dimb, struct ImBuf *simb)
Definition: metadata.c:80
Read Guarded memory(de)allocation.
static void init_data(ModifierData *md)
StructRNA RNA_Sequence
@ SEQ_TASK_MAIN_RENDER
Definition: SEQ_render.h:36
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
static void mul(btAlignedObjectArray< T > &items, const Q &value)
Scene scene
const Depsgraph * depsgraph
struct SeqEffectHandle SEQ_effect_handle_get(Sequence *seq)
Definition: effects.c:4291
int SEQ_effect_get_num_inputs(int seq_type)
Definition: effects.c:4328
struct SeqEffectHandle seq_effect_get_sequence_blend(Sequence *seq)
Definition: effects.c:4306
float seq_speed_effect_target_frame_get(const SeqRenderData *context, Sequence *seq, float timeline_frame, int input)
Definition: effects.c:3279
#define str(s)
bool seq_cache_put_if_possible(const SeqRenderData *context, Sequence *seq, float timeline_frame, int type, ImBuf *ibuf)
Definition: image_cache.c:1404
void seq_cache_put(const SeqRenderData *context, Sequence *seq, float timeline_frame, int type, ImBuf *i)
Definition: image_cache.c:1429
void seq_cache_free_temp_cache(Scene *scene, short id, int timeline_frame)
Definition: image_cache.c:1195
struct ImBuf * seq_cache_get(const SeqRenderData *context, Sequence *seq, float timeline_frame, int type)
Definition: image_cache.c:1338
int count
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:47
BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer, const float *float_buffer, unsigned char *byte_output, float *float_output, int width, int height, int components, float u, float v, bool wrap_x, bool wrap_y)
Definition: math_interp.c:264
static ulong state[N]
static int left
int seq_num_files(Scene *scene, char views_format, const bool is_multiview)
Definition: multiview.c:44
void seq_multiview_name(Scene *scene, const int view_id, const char *prefix, const char *ext, char *r_path, size_t r_size)
Definition: multiview.c:57
static unsigned c
Definition: RandGen.cpp:97
static unsigned a[3]
Definition: RandGen.cpp:92
void RE_ReleaseResultImage(Render *re)
Definition: pipeline.c:512
Render * RE_GetSceneRender(const Scene *scene)
Definition: pipeline.c:591
void RE_RenderFrame(Render *re, Main *bmain, Scene *scene, ViewLayer *single_layer, Object *camera_override, int frame, const bool write_still)
Definition: pipeline.c:1877
void RE_AcquireResultImage(Render *re, RenderResult *rr, const int view_id)
Definition: pipeline.c:466
Render * RE_NewSceneRender(const Scene *scene)
Definition: pipeline.c:598
void seq_prefetch_start(const SeqRenderData *context, float timeline_frame)
Definition: prefetch.c:537
int SEQ_rendersize_to_proxysize(int render_size)
Definition: proxy.c:84
ImBuf * seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int timeline_frame)
Definition: proxy.c:213
bool SEQ_can_use_proxy(const struct SeqRenderData *context, Sequence *seq, int psize)
Definition: proxy.c:203
double SEQ_rendersize_to_scale_factor(int render_size)
Definition: proxy.c:99
bool seq_proxy_get_custom_file_fname(Sequence *seq, char *name, const int view_id)
Definition: proxy.c:112
#define PROXY_MAXFILE
Definition: proxy.h:35
static ImBuf * seq_render_mask_strip(const SeqRenderData *context, Sequence *seq, float frame_index)
Definition: render.c:1385
static ImBuf * seq_render_preprocess_ibuf(const SeqRenderData *context, Sequence *seq, ImBuf *ibuf, float timeline_frame, bool use_preprocess, const bool is_proxy_image)
Definition: render.c:720
static ImBuf * seq_render_strip_stack_apply_effect(const SeqRenderData *context, Sequence *seq, float timeline_frame, ImBuf *ibuf1, ImBuf *ibuf2)
Definition: render.c:1847
ImBuf * SEQ_render_give_ibuf(const SeqRenderData *context, float timeline_frame, int chanshown)
Definition: render.c:1964
static ImBuf * seq_render_image_strip(const SeqRenderData *context, Sequence *seq, float UNUSED(frame_index), float timeline_frame, bool *r_is_proxy_image)
Definition: render.c:998
static ImBuf * seq_render_strip_stack(const SeqRenderData *context, SeqRenderState *state, ListBase *seqbasep, float timeline_frame, int chanshown)
Definition: render.c:1877
static void * render_effect_execute_do_thread(void *thread_data_v)
Definition: render.c:789
static ImBuf * input_preprocess(const SeqRenderData *context, Sequence *seq, float timeline_frame, ImBuf *ibuf, const bool is_proxy_image)
Definition: render.c:621
static bool seq_input_have_to_preprocess(const SeqRenderData *context, Sequence *seq, float UNUSED(timeline_frame))
Definition: render.c:423
static ImBuf * seq_render_scene_strip(const SeqRenderData *context, Sequence *seq, float frame_index, float timeline_frame)
Definition: render.c:1392
SequencerDrawView sequencer_view3d_fn
Definition: render.c:90
static ThreadMutex seq_render_mutex
Definition: render.c:89
static int seq_get_early_out_for_blend_mode(Sequence *seq)
Definition: render.c:1826
ImBuf * seq_render_mask(const SeqRenderData *context, Mask *mask, float frame_index, bool make_float)
Definition: render.c:1301
struct RenderEffectInitData RenderEffectInitData
ImBuf * seq_render_effect_execute_threaded(struct SeqEffectHandle *sh, const SeqRenderData *context, Sequence *seq, float timeline_frame, float facf0, float facf1, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *ibuf3)
Definition: render.c:808
static ImBuf * do_render_strip_seqbase(const SeqRenderData *context, SeqRenderState *state, Sequence *seq, float frame_index)
Definition: render.c:1647
struct ImageTransformThreadData ImageTransformThreadData
StripElem * SEQ_render_give_stripelem(Sequence *seq, int timeline_frame)
Definition: render.c:242
static ImBuf * do_render_strip_uncached(const SeqRenderData *context, SeqRenderState *state, Sequence *seq, float timeline_frame, bool *r_is_proxy_image)
Definition: render.c:1679
static ImBuf * seq_render_effect_strip_impl(const SeqRenderData *context, SeqRenderState *state, Sequence *seq, float timeline_frame)
Definition: render.c:841
ImBuf * SEQ_render_give_ibuf_direct(const SeqRenderData *context, float timeline_frame, Sequence *seq)
Definition: render.c:2027
ImBuf * seq_render_give_ibuf_seqbase(const SeqRenderData *context, float timeline_frame, int chan_shown, ListBase *seqbasep)
Definition: render.c:2016
static ImBuf * seq_render_movie_strip_view(const SeqRenderData *context, Sequence *seq, float frame_index, float timeline_frame, StripAnim *sanim, bool *r_is_proxy_image)
Definition: render.c:1104
int SEQ_render_evaluate_frame(ListBase *seqbase, int timeline_frame)
Definition: render.c:324
static bool video_seq_is_rendered(Sequence *seq)
Definition: render.c:330
static void sequencer_image_crop_transform_init(void *handle_v, int start_line, int tot_line, void *init_data_v)
Definition: render.c:501
void SEQ_render_new_render_data(Main *bmain, struct Depsgraph *depsgraph, Scene *scene, int rectx, int recty, int preview_render_size, int for_render, SeqRenderData *r_context)
Definition: render.c:211
ImBuf * seq_render_strip(const SeqRenderData *context, SeqRenderState *state, Sequence *seq, float timeline_frame)
Definition: render.c:1774
void seq_imbuf_assign_spaces(Scene *scene, ImBuf *ibuf)
Definition: render.c:95
static void multibuf(ImBuf *ibuf, const float fmul)
Definition: render.c:586
struct RenderEffectThread RenderEffectThread
static bool seq_need_scale_to_render_size(const Sequence *seq, bool is_proxy_image)
Definition: render.c:488
static bool seq_must_swap_input_in_blend_mode(Sequence *seq)
Definition: render.c:1812
static ImBuf * seq_render_movieclip_strip(const SeqRenderData *context, Sequence *seq, float frame_index, bool *r_is_proxy_image)
Definition: render.c:1245
static void * sequencer_image_crop_transform_do_thread(void *data_v)
Definition: render.c:533
void seq_render_state_init(SeqRenderState *state)
Definition: render.c:237
int seq_get_shown_sequences(ListBase *seqbasep, int timeline_frame, int chanshown, Sequence **seq_arr_out)
Definition: render.c:335
static bool sequencer_use_crop(const Sequence *seq)
Definition: render.c:413
static bool seq_image_strip_is_multiview_render(Scene *scene, Sequence *seq, int totfiles, char *name, char *r_prefix, const char *r_ext)
Definition: render.c:982
static ImBuf * seq_render_movie_strip(const SeqRenderData *context, Sequence *seq, float frame_index, float timeline_frame, bool *r_is_proxy_image)
Definition: render.c:1154
static bool sequencer_use_transform(const Sequence *seq)
Definition: render.c:401
static ImBuf * seq_render_movie_strip_custom_file_proxy(const SeqRenderData *context, Sequence *seq, int timeline_frame)
Definition: render.c:1081
void seq_imbuf_to_sequencer_space(Scene *scene, ImBuf *ibuf, bool make_float)
Definition: render.c:108
struct ImageTransformThreadInitData ImageTransformThreadInitData
void SEQ_render_imbuf_from_sequencer_space(Scene *scene, ImBuf *ibuf)
Definition: render.c:174
static int evaluate_seq_frame_gen(Sequence **seq_arr, ListBase *seqbase, int timeline_frame, int chanshown)
Definition: render.c:262
static ImBuf * seq_get_movieclip_ibuf(Sequence *seq, MovieClipUser user)
Definition: render.c:1232
static ImBuf * seq_render_image_strip_view(const SeqRenderData *context, Sequence *seq, char *name, char *prefix, const char *ext, int view_id)
Definition: render.c:942
static void render_effect_execute_init_handle(void *handle_v, int start_line, int tot_line, void *init_data_v)
Definition: render.c:766
void SEQ_render_pixel_from_sequencer_space_v4(struct Scene *scene, float pixel[4])
Definition: render.c:191
#define EARLY_USE_INPUT_2
Definition: render.h:40
#define EARLY_DO_EFFECT
Definition: render.h:38
#define EARLY_USE_INPUT_1
Definition: render.h:39
#define EARLY_NO_INPUT
Definition: render.h:37
struct SELECTID_Context context
Definition: select_engine.c:47
ImBuf * SEQ_modifier_apply_stack(const SeqRenderData *context, Sequence *seq, ImBuf *ibuf, int timeline_frame)
Editing * SEQ_editing_get(Scene *scene, bool alloc)
Definition: sequencer.c:232
float seq_give_frame_index(Sequence *seq, float timeline_frame)
Definition: strip_time.c:48
ListBase seqbase
ListBase * seqbasep
ListBase metastack
int channels
unsigned int * rect
float * rect_float
LinkNode * list
Definition: BLI_linklist.h:50
struct LinkNode * next
Definition: BLI_linklist.h:39
void * first
Definition: DNA_listBase.h:47
Definition: BKE_main.h:116
const SeqRenderData * context
Definition: render.c:747
struct SeqEffectHandle * sh
Definition: render.c:746
Sequence * seq
Definition: render.c:748
float timeline_frame
Definition: render.c:749
float timeline_frame
Definition: render.c:759
const SeqRenderData * context
Definition: render.c:757
ImBuf * ibuf1
Definition: render.c:760
struct SeqEffectHandle * sh
Definition: render.c:756
ImBuf * ibuf3
Definition: render.c:760
ImBuf * ibuf2
Definition: render.c:760
Sequence * seq
Definition: render.c:758
float * rectz
Definition: RE_pipeline.h:127
float * rectf
Definition: RE_pipeline.h:125
struct bNodeTree * nodetree
struct Editing * ed
struct RenderData r
struct Object * camera
char use_nodes
ColorManagedColorspaceSettings sequencer_colorspace_settings
int(* early_out)(struct Sequence *seq, float facf0, float facf1)
Definition: SEQ_effects.h:71
void(* get_default_fac)(struct Sequence *seq, float timeline_frame, float *facf0, float *facf1)
Definition: SEQ_effects.h:77
void(* execute_slice)(const struct SeqRenderData *context, struct Sequence *seq, float timeline_frame, float facf0, float facf1, struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3, int start_line, int total_lines, struct ImBuf *out)
Definition: SEQ_effects.h:98
struct ImBuf *(* execute)(const struct SeqRenderData *context, struct Sequence *seq, float timeline_frame, float facf0, float facf1, struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3)
Definition: SEQ_effects.h:84
struct ImBuf *(* init_execution)(const struct SeqRenderData *context, struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3)
Definition: SEQ_effects.h:93
int preview_render_size
Definition: SEQ_render.h:46
struct Main * bmain
Definition: SEQ_render.h:41
bool is_proxy_render
Definition: SEQ_render.h:52
struct Scene * scene
Definition: SEQ_render.h:43
struct GPUOffScreen * gpu_offscreen
Definition: SEQ_render.h:59
bool skip_cache
Definition: SEQ_render.h:51
float motion_blur_shutter
Definition: SEQ_render.h:50
int motion_blur_samples
Definition: SEQ_render.h:49
bool is_prefetch_render
Definition: SEQ_render.h:53
struct Depsgraph * depsgraph
Definition: SEQ_render.h:42
eSeqTaskId task_id
Definition: SEQ_render.h:56
struct MovieClip * clip
struct Scene * scene
ListBase anims
struct Object * scene_camera
struct Sequence * seq3
struct Mask * mask
ListBase modifiers
struct Sequence * seq1
struct Sequence * seq2
struct Stereo3dFormat * stereo3d_format
struct anim * anim
struct StripAnim * next
char name[256]
struct anim * anim
ColorManagedColorspaceSettings colorspace_settings
StripProxy * proxy
StripTransform * transform
StripElem * stripdata
char dir[768]
StripCrop * crop
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
#define G(x, y, z)
ListBase * SEQ_get_seqbase_from_sequence(Sequence *seq, int *r_offset)
Definition: utils.c:241
void seq_open_anim_file(Scene *scene, Sequence *seq, bool openfile)
Definition: utils.c:266