Commit Graph

100 Commits

Author SHA1 Message Date
John Kiril Swenson
35cab63eaf Cleanup: VSE: Rename Strip::machine to channel
This should make VSE code more readable and easier to understand from an
outside perspective.

The name was chosen to be `channel` rather than `channel_index` to keep
things short and concise -- it should be clear based on the context
whether we are talking about the strip's channel index (singular case,
`Strip::channel` or `SeqTimelineChannel::index`) vs. the channel list
(plural case, e.g. `Editing::channels`).

Pull Request: https://projects.blender.org/blender/blender/pulls/138919
2025-05-21 19:13:20 +02:00
John Kiril Swenson
41781df1a6 Cleanup: VSE: Rename seq1 and seq2 references
This patch renames `seq1` and `seq2` to `input1` and `input2` in `Strip`
and `StripSelection` structs to consist with recent refactors in
#132179.  It also renames other instances of `seq1` and `seq2` (e.g.
local variables) to `strip1` and `strip2` instead.

There is only one small breaking change to the Python API with
`strips.new_effect()` taking in the new names now. There should be
no other functional changes involved.

Pull Request: https://projects.blender.org/blender/blender/pulls/138296
2025-05-15 05:01:39 +02:00
Aras Pranckevicius
9e4c26574a VSE: new cache implementation
Rework internals of how VSE caching is done. Primarily to make all the
caching logic more understandable from development point of view, but
also has several user visible implications (more details in the PR):
- Simpler and fewer caching UI options,
- Disk cache is gone (primary reason: proxies are kinda the same thing),
- VSE cache size set in preferences is actual size used for VSE caches
  now (previously caching stopped as soon as whole Blender used that
  much memory, even if some memory usage was not about VSE at all),
- Certain scenarios of cache invalidation are faster now.

Pull Request: https://projects.blender.org/blender/blender/pulls/137926
2025-05-14 12:59:46 +02:00
Hans Goudey
f90e448c6a Cleanup: Use blender::Mutex for various static mutexes
Change almost all `static ThreadMutex` to `static blender::Mutex`.
See b7a1325c3c.

Pull Request: https://projects.blender.org/blender/blender/pulls/138556
2025-05-07 19:32:00 +02:00
Jacques Lucke
e8d1491e62 Refactor: Depsgraph: simplify query API further
* Remove `DEG_get_evaluated_object` in favor of `DEG_get_evaluated`.
* Remove `DEG_is_original_object` in favor of `DEG_is_original`.
* Remove `DEG_is_evaluated_object` in favor of `DEG_is_evaluated`.

Pull Request: https://projects.blender.org/blender/blender/pulls/138317
2025-05-02 15:08:29 +02:00
John Kiril Swenson
2ab59859c9 Cleanup: VSE: Replace remaining seq and sequence references
Ref: #132179

Renames:
- `Editing.act_seq` -> `Editing.act_strip`
- `SequenceModifierData` -> `StripModifierData`
  - Its member `mask_sequence` is now `mask_strip`.
- `MetaStack.parseq` -> `MetaStack.parent_strip`
- Remaining function names/parameters that were not dealt with in #132748
- Various references to `seq` or `sequence` throughout code and docs when
  referring to a strip

Also moves `_get` to the end of the renamed function names where
applicable for standardization (unless "by" or "from" are used).

There should be no changes to current behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/138077
2025-05-01 00:22:04 +02:00
Aras Pranckevicius
393a1d3d88 Cleanup: DURIAN_CAMERA_SWITCH is always on
The DURIAN_CAMERA_SWITCH feature has been always on since c3401eb5cb
(2009, Blender 2.51), remove the preprocessor option to turn it off.

Pull Request: https://projects.blender.org/blender/blender/pulls/137991
2025-04-25 14:20:52 +02:00
Brecht Van Lommel
637c6497e9 Refactor: Use more typed MEM_calloc<>, avoid unnecessary size_t cast
Handle some cases that were missed in previous refactor. And eliminate
unnecessary size_t casts as these could hide issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/137404
2025-04-21 17:59:41 +02:00
Brecht Van Lommel
a02e0fa147 Refactor: Improve image buffer save/load function names and arguments 2025-03-27 22:07:51 +01:00
Bastien Montagne
1d76cbab64 Cleanup: sequencer: Replace 'void' MEM_[cm]allocN with templated, type-safe MEM_[cm]allocN<T>.
The main issue of 'type-less' standard C allocations is that there is no check on
allocated type possible.

This is a serious source of annoyance (and crashes) when making some
low-level structs non-trivial, as tracking down all usages of these
structs in higher-level other structs and their allocation is... really
painful.

MEM_[cm]allocN<T> templates on the other hand do check that the
given type is trivial, at build time (static assert), which makes such issue...
trivial to catch.

NOTE: New code should strive to use MEM_new (i.e. allocation and
construction) as much as possible, even for trivial PoD types.

Pull Request: https://projects.blender.org/blender/blender/pulls/135747
2025-03-10 17:16:43 +01:00
Richard Antalik
68abed543b Refactor: Remove module prefix form symbols in sequnecer namespaces
Remove
SEQ_ prefix for blender::seq namespace and
ED_sequencer for blender::ed::vse namespace

Pull Request: https://projects.blender.org/blender/blender/pulls/135560
2025-03-06 13:04:39 +01:00
Richard Antalik
a08246a1a2 Refactor: Move VSE code to namespaces
This PR creates 2 namespaces for VSE code:
- `blender::seq` for sequencer core code
- `blender::ed::vse` for editor code

These names are chosen to not be in conflict with each other.
No namespace was used for RNA.

Finally, file `BKE_sequencer_offscreen.h` was moved from BKE to sequencer.

Pull Request: https://projects.blender.org/blender/blender/pulls/135500
2025-03-06 06:22:14 +01:00
Aras Pranckevicius
cc2c6692c0 Cleanup: Name more IMB things as "byte" or "float" instead of "rect" and "rectFloat"
- IB_rect -> IB_byte_data
- IB_rectfloat -> IB_float_data
- Rename some functions:
	- IMB_get_rect_len -> IMB_get_pixel_count
	- IMB_rect_from_float -> IMB_byte_from_float
	- IMB_float_from_rect_ex -> IMB_float_from_byte_ex
	- IMB_float_from_rect -> IMB_float_from_byte
	- imb_addrectImBuf -> IMB_alloc_byte_pixels
	- imb_freerectImBuf -> IMB_free_byte_pixels
	- imb_addrectfloatImBuf -> IMB_alloc_float_pixels
	- imb_freerectfloatImBuf -> IMB_free_float_pixels
	- imb_freemipmapImBuf -> IMB_free_mipmaps
	- imb_freerectImbuf_all -> IMB_free_all_data
- Remove IB_multiview (not used at all)
- Remove obsolete "module" comments in public IMB headers

Pull Request: https://projects.blender.org/blender/blender/pulls/135348
2025-03-03 17:11:45 +01:00
Aras Pranckevicius
148aa54398 ImBuf: unify color space transform threaded/non-threaded functions
There's no point in having non-threaded image color space conversion functions.
So merge the threaded and non-threaded functions and clarify names while at it:

- IMB_colormanagement_transform & IMB_colormanagement_transform_threaded
    -> IMB_colormanagement_transform_float
- IMB_colormanagement_transform_byte & IMB_colormanagement_transform_byte_threaded
    -> IMB_colormanagement_transform_byte
- IMB_colormanagement_transform_from_byte & IMB_colormanagement_transform_from_byte_threaded
    -> IMB_colormanagement_transform_byte_to_float

These places were doing single-threaded colorspace conversion previously, and
thus now are potentially faster:
- IMB_rect_from_float (used in many places)
- EXR image "save as render" saving (image_exr_from_scene_linear_to_output)
- Object baking (write_internal_bake_pixels, write_external_bake_pixels)
- General image saving, clipboard copy, movie preparation
  (IMB_colormanagement_imbuf_for_write)
- Linear conversion when reading HDR images/movies
  (colormanage_imbuf_make_linear)
- EXR multi-layer conversion (render_result_new_from_exr)

For one case I benchmarked, which is to render out a 2D stabilized 10 bit input
movie clip out of VSE, the total render time went from 49sec down to 44sec
(Ryzen 5950X), one of the single-threaded parts was the colorspace conversion
in the movieclip code.

Pull Request: https://projects.blender.org/blender/blender/pulls/135155
2025-02-26 12:11:47 +01:00
Brecht Van Lommel
20138318cc Merge branch 'blender-v4.4-release' 2025-02-18 13:21:45 +01:00
Brecht Van Lommel
4e02acf2ba Fix #134607: Sequencer render animation preview not working
This main thread check was introduced in 4536a4c610. At the time OpenGL
only ever worked in the main thread, but that limitation was lifted in
Blender 2.80.

With this operator being converted to use the jobs system, it now needs
to work in non-main threads. Note that this code does not run in parallel
with main thread drawing anyway, because of WM_job_main_thread_lock_acquire
and draw manager locks. What changed is that we can now activate OpenGL
contexts on other threads.

Pull Request: https://projects.blender.org/blender/blender/pulls/134696
2025-02-18 13:21:02 +01:00
Richard Antalik
2a44bdfbd0 Refactor: Use C++ types for vectors strip image transform code
All 2D vectors related to image transform code were changed to float2.
Previously, it was decided, that 4x4 matrix should be used for 2D
affine transform, but this is changed to 3x3 now.

Texture painting code did rely on `IMB_transform` with 4x4 matrix.
To avoid large changes, I have added function
`BLI_rctf_transform_calc_m3_pivot_min`.

Main motivation is cleaner code - ease of use of c++ API, and avoiding
returning values by arguments.

Pull Request: https://projects.blender.org/blender/blender/pulls/133692
2025-02-17 11:23:00 +01:00
Campbell Barton
640e70b6e8 Cleanup: various non-functional changes for C++ 2025-02-13 13:33:09 +11:00
Aras Pranckevicius
4f0fd32d6f VSE: Over Drop effect was not doing anything useful, map it to Alpha Over
Behavior of it was exactly the same as Alpha Over for the last 18 years (since
327d413eb3 in 2006 March), so just remap it to regular alpha over on file read.

Pull Request: https://projects.blender.org/blender/blender/pulls/134342
2025-02-10 16:10:01 +01:00
Bastien Montagne
87a4c0d3a8 Refactor: Make Library.runtime an allocated pointer.
Move `Library.runtime` to be a pointer, move the related
`LibraryRuntime` struct to `BKE_library.hh`. Similar to e.g.
Mesh.runtime, that pointer is expected to always be valid, and is
allocated at readtime or when creating a new Library ID.

Related smaller changes:
* Write code now uses standard ID writing codepath for Library IDs too.
  * Runtime pointer is reset to nullptr before writing.
* Looking up a library by its absolute path is now handled through a
  dedicated utils, `search_filepath_abs`, instead of using
  `BLI_findstring`.

Pull Request: https://projects.blender.org/blender/blender/pulls/134188
2025-02-07 17:47:16 +01:00
Aras Pranckevicius
2b39897d18 Fix #133799: render of VSE 10/12bpp videos broken unless source strips are float
10/12bpp movie writing code assumes that input image is properly
floating point for these cases. That is always true for regular
rendering, however VSE can produce 8bpp images, if there
are no float/HDR strips in there. Make these convert into a float
image in the render pipeline when needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/133802
2025-01-30 14:55:41 +01:00
Richard Antalik
bf19960937 Refactor: VSE: Use C++ matrix BLI API
This PR explicitly declares integer type for `image_center_offs`, which
formalizes accidentally implemented correct behavior. Previously type
was float, all rhs types in expression were integers, so result was int
cast to float.

Comment is also added clarifying why integer must be used - float may
cause images to be interpolated, even when translation is set to 0.

There should be no functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/133573
2025-01-28 02:01:07 +01:00
Aras Pranckevicius
5ef08c2a96 Fix #112586: VSE can't use multi-layer EXR images
The rest of blender does handle multi-layer EXR images, using the
"combined" or RGBA/RGB layers when the visual result is needed. Make
VSE do the same.

While fixing this, I found several issues in other not well tested code
and had to fix them:

- IMB_buffer_float_from_float_threaded was wrongly using source channels
  as destination channels, producing garbage result.
- IMB_scale_into_new was not assigning channels to destination image.

Pull Request: https://projects.blender.org/blender/blender/pulls/132790
2025-01-08 10:45:24 +01:00
Falk David
ff91c27481 Cleanup: VSE: Rename SequenceType to StripType as well as flags
Rename the flags from `SEQ_TYPE_*` to `STRIP_TYPE_*`.

Pull Request: https://projects.blender.org/blender/blender/pulls/132753
2025-01-07 16:10:36 +01:00
Falk David
82cfa92233 Cleanup: VSE: Rename seq_ functions/variables to strip_
This should only rename functions and variables that are
referring to (operations on) a single `Strip`.

Pull Request: https://projects.blender.org/blender/blender/pulls/132748
2025-01-07 16:03:11 +01:00
Falk David
8541296e9d Cleanup: VSE: Rename Strip *seq variables to strip
This only renames variables named `seq` and not other variants,
like `seq_*` or `seq1`.

Pull Request: https://projects.blender.org/blender/blender/pulls/132736
2025-01-07 14:09:45 +01:00
Aras Pranckevicius
016167e8f3 Fix #132529: VSE strip scaled to 0.0 occludes strips below it
The "does a strip cover whole screen" logic did not handle the case
of completely zero size strip, and thus was wrongly deciding
that the strip is opaque.

Pull Request: https://projects.blender.org/blender/blender/pulls/132714
2025-01-07 10:01:11 +01:00
Aras Pranckevicius
ab1fc88f2e Fix #132646: VSE proxy strip incorrectly occludes strips below it
Depending on proxy size and scaling factor, the "does proxy cover
whole screen" code was producing wrong results, due to mismatched
resolutions it was working on: SeqRenderData at that point contains
proxy resolution (reduced), but SEQ_image_transform_final_quad_get
works at full resolution. The produced quad needs to be scaled down
to what the render context is operating at.
2025-01-07 10:01:10 +01:00
Falk David
655a17a6ab Refactor: VSE: Rename Sequence to Strip
This renames the struct `Sequence` to `Strip`.

While the motivation for this partially comes from
the "Sequence Design" #131329, it seems like this
is a good refactor whether the design gets implemented
or not.

The `Sequence` represents what users see as strips in the
VSE. Many places in the code already refere to a `Sequence`
as "strip". It's the C-style "base class" of all strip types.

This also renames the python RNA type `bpy.types.Sequence`
to `bpy.types.Strip` which means that this technically breaks
the python API.

Pull Request: https://projects.blender.org/blender/blender/pulls/132179
2025-01-06 14:19:24 +01:00
Aras Pranckevicius
4546367bb3 Cleanup: Add ibuf channel expectation asserts in VSE code
Whole of VSE assumes that all images are always 4 channels. Add
asserts in several places to more clearly indicate that.

Pull Request: https://projects.blender.org/blender/blender/pulls/132546
2025-01-02 14:33:52 +01:00
Aras Pranckevicius
c26db69f58 VSE: Simplify and optimize effect multi-threading
Cleanup (and make slightly faster as a side effect) the way VSE effects
do multi-threading. Previously (some of them) were using
IMB_processor_apply_threaded with C-like machinery (which internally
uses a task pool), switch that over to a helper apply_effect_op
(which internally uses a parallel for). Based on profiling, parallel
for is slightly more efficient (task pool takes a bit until all the
tasks are "pushed" into the pool). Note however that some VSE effects
were already doing parallel for internally; these are not affected.

VSE scene at 4K resolution, with four 4K resolution PNG images blended
over each other, time it takes to do render_strip_stack:
- Ryzen 5950X (Win/VS2022): 38.9ms -> 34.7ms
- Mac M4 Max: 21.9ms -> 19.8ms

Now that all VSE effects are internally threaded via parallel for,
there's no need for the init_execution and execute_slice machinery,
so remove all that.

You might also notice that half of "over drop" effect code is gone.
It was accidentally not doing anything whatsoever for the last 18 years
(since 2.42), and currently observed behavior matches documentation
and "internet knowledge", so let's  accept it as correct.

Pull Request: https://projects.blender.org/blender/blender/pulls/132380
2025-01-01 11:11:49 +01:00
Aras Pranckevicius
2720bd529d Refactor: split off VSE effects code into separate files
Part of #130975: split off overly large VSE effects.cc (almost 4000
lines) into separate source files. No behavior changes.

- Add / Subtract / Multiply all go into one source file,
- Blend Over / Blend Under / Over Drop / other blend modes all go
  into one source file,
- Cross and Gamma Cross go into one source file,
- All others go into their own files.

Pull Request: https://projects.blender.org/blender/blender/pulls/132323
2024-12-27 12:52:38 +01:00
Falk David
a7d3ced570 Refactor: VSE: Rename Strip to StripData
This renames the `Strip` struct to `StripData` and also renames
the `Sequence::strip` member to `Sequence::data`.

This is a first step towards naming the `Sequence` struct to `Strip`.

Pull Request: https://projects.blender.org/blender/blender/pulls/132165
2024-12-20 18:02:31 +01:00
Aras Pranckevicius
e99252d7fd Refactor: more cleanups and renamed to movie/ffmpeg related files
- All movie related public headers now have MOV_ prefix instead of
  IMB_movie_.
- All movie related public functions now have MOV_ prefix as well,
  instead of IMB_movie_ or IMB_anim_.
- IMB_anim.hh -> MOV_read.hh (also ImBufAnim -> MovieReader), and
  various utility functions not related to playback were split off
  into MOV_util.hh.
- Other function name tweaks for clarity, e.g. IMB_suffix_anim
  -> MOV_set_multiview_suffix and so on.
- All except one usages of MOV_get_fps (nee IMB_anim_get_fps) were
  ultimately just converting returned value into a float. So make
  MOV_get_fps just return that directly. For the (exactly just one)
  place that needs numerator and denominator, have
  MOV_get_fps_num_denom.
- Code comments on the public header functions.
- Removed never-used code paths inside movie timecode proxy building
  file.

It might be easier to review each commit separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/132145
2024-12-20 13:23:08 +01:00
Aras Pranckevicius
974efe7d23 Refactor: move ffmpeg/video related code into one place
Previously, code related to reading/writing movie files via ffmpeg was
scattered around: some under blenkernel, some directly in generic
imbuf headers, some under intern/ffmpeg. Some of the files were named
with not exactly clear names. Some parts not directly related to movies
were including ffmpeg headers directly (rna_scene.cc).

What is in this PR:

Movie and ffmpeg related code is now under imbuf/movie:
- IMB_anim.hh: movie reading, proxy querying, various utility functions.
- IMB_movie_enums.hh: simple enum definitions,
- IMB_movie_write.hh: movie writing functions.
- intern: actual implementation and private headers.
    - ffmpeg_compat.h: various ffmpeg version difference handling
      utilities,
    - ffmpeg_swscale.hh/cc: scaling and format conversion utilities
      for ffmpeg libswscale,
    - ffmpeg_util.hh/cc: misc utilities related to ffmpeg,
    - movie_proxy_indexer.hh/cc: proxies and timecode indexing for movies,
    - movie_read.hh/cc: decoding of movies into images,
    - movie_write.cc: encoding of images into movies.
- tests: basic ffmpeg library unit tests that previously
  lived under intern/ffmpeg.

Interface changes (at C++ level, no Python API changes):
- Mostly just movie related functions that were BKE_ previously, are now IMB_.
- I did one large-ish change though, and that is to remove bMovieHandle
  struct that had pointers to several functions. Now that is
  IMB_movie_write_begin, IMB_movie_write_append, IMB_movie_write_end
  functions using a single opaque struct handle. As a result, usages
  of that in pipeline.cc and render_opengl.cc have changed.

Pull Request: https://projects.blender.org/blender/blender/pulls/132074
2024-12-19 12:34:30 +01:00
Bastien Montagne
b325142d17 Merge branch 'blender-v4.3-release' 2024-11-12 16:55:40 +01:00
Bastien Montagne
0b3a7cbe69 Cleanup: Move BKE_image.h and related headers to C++.
NOTE: This also required some changes to Cycles code itself, who is now
directly including `BKE_image.hh` instead of declaring a few prototypes
of these functions in its `blender/utils.h` header (due to C++ functions
names mangling, this was not working anymore).

Pull Request: https://projects.blender.org/blender/blender/pulls/130174
2024-11-12 16:53:54 +01:00
Richard Antalik
f27220f6b6 Merge branch 'blender-v4.3-release' 2024-11-06 05:44:11 +01:00
Richard Antalik
6ee1eb49be Fix #126167: Speed effect does not interpolate frame numbers
Only convert frame number to integer when image interpolation is not
used.

Pull Request: https://projects.blender.org/blender/blender/pulls/129839
2024-11-06 05:39:30 +01:00
Jacques Lucke
a17ac76d13 BLI: support accessing underlying memory buffer of Vector container
This extends the `Vector` API to support transfering ownership of a memory
buffer to and from a `Vector`. This reduces the need for unnecessary copies in
some cases which converting between data-structures. A new
`VectorSet::extract_vector` method is added that takes O(1) time. Previously,
this was only possible in O(n) time by copying the entire array.

The `Vector::release` method can be used to e.g. build a vector with the C++
container, but then extract it for use in DNA data.

Pull Request: https://projects.blender.org/blender/blender/pulls/129736
2024-11-03 12:09:05 +01:00
Richard Antalik
580b4a1a2d Fix #127479: VSE produces blank scene offscreen renders
If conditions are not met for offscreen rendering, render job is used as
fallback. This can be skipped if there is possibility of race condition.
This was only considered for case where `context->for_render` was false,
since this indicates that call is invoked by the job itself.

If scene strip display is set to `OB_RENDER`, it needs to start the
render job. So variable `do_seq_gl` was renamed to `is_preview` and
reused in race avoidance connditon. This was done to convey clearer
meaning and match comments.

This change does make code less safe - race is avoided by UI not
allowing to run F12 render and opengl render at the same time. However,
I don't think, this could be easily resolved on VSE side without
suspending thread or being able to run multiple render jobs.

Pull Request: https://projects.blender.org/blender/blender/pulls/127926
2024-09-27 18:41:26 +02:00
Campbell Barton
381898b6dc Refactor: move BLI_path_util header to C++, rename to BLI_path_utils
Move to a C++ header to allow C++ features to be used there,
use the "utils" suffix as it's preferred for new files.

Ref !128147
2024-09-26 21:13:39 +10:00
Aras Pranckevicius
ecce5f45ac Cleanup: rename MAXSEQ -> SEQ_MAX_CHANNELS and make it C++ constexpr
When I was learning VSE code, MAXSEQ constant (a preprocessor define!) was
confusing. It makes it sound like it is "max sequences", but it is actually
"max channels". So rename it to SEQ_MAX_CHANNELS and make it C++ constexpr int
instead of preprocessor macro.

Pull Request: https://projects.blender.org/blender/blender/pulls/128024
2024-09-23 15:43:45 +02:00
Campbell Barton
2360a3911c BLI_listbase: add a utility to check the number of items in the list
To avoid unnecessary looping over listbase items the function
`BLI_listbase_count_at_most` was used however it resulting in an awkward
expression: `BLI_listbase_count_at_most(list, count + 1) == count`
replace this with `BLI_listbase_count_is_equal_to(list, count)`.
2024-09-16 11:39:00 +10:00
Aras Pranckevicius
78972f8559 Fix #127192: VSE Tonemap now works as expected on strips that don't cover whole screen
When doing average/min/max luminance calculations for tonemapping, ignore
pixels that are outside of the strip rectangle. Due to how VSE innards work,
when a strip is positioned to not cover the whole screen, "the rest" is filled
with transparent black. For tonemapping, this was dragging average calculated
luminance way down.

Images of the issue in PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/127207
2024-09-11 12:42:03 +02:00
Aras Pranckevicius
0d9b793dfa VSE: Multi-thread Saturation and Multiply strip color controls
Image/movie strip controls color controls: "Saturation" and "Multiply" were
both single-threaded code. Multi-thread both of them. Timings to apply them
on a 4K resolution byte image, on Ryzen 5950X (Win10/VS2022):

- Saturation: 97ms -> 6.3ms
- Multiply: 11.5ms -> 1.1ms

Pull Request: https://projects.blender.org/blender/blender/pulls/127409
2024-09-11 12:37:50 +02:00
Aras Pranckevicius
9d3b2b51a7 Cleanup: None of VSE effects have three image inputs
So remove all code related to "ibuf3" handling since it is just always null.

Pull Request: https://projects.blender.org/blender/blender/pulls/127348
2024-09-09 18:02:59 +02:00
Aras Pranckevicius
577630d24f VSE: Optimize away some pointless image copies when applying modifiers
SEQ_modifier_apply_stack is called from exactly one place, and it always
was throwing away the input image, and taking the newly produced image.
Which means, we can stop copying it. Just run the modifiers on the
input image.

In a test file that is HD (1080p) resolution, two EXR image sequences,
adjustment layer with Color Balance, and a text strip on top,
playback framerate (Ryzen 5950X, Win10/VS2022) goes 20.8 -> 22.1 fps

Pull Request: https://projects.blender.org/blender/blender/pulls/127346
2024-09-09 14:55:24 +02:00
Aras Pranckevicius
5c259a1bae VSE: Faster processing of alpha-over strip at the bottom of strip stack
When a strip with alpha-over blend mode (which is default) has an alpha
channel and is at the bottom of the whole stack, there's no point in
blending it with black color; the result will be identical.

So stop doing that. Also, whenever some other case happens at the bottom
of the stack (e.g. some other blend mode), create the fake "black input"
image at the needed color type (float or byte) and with the correct
color space already applied. Otherwise, especially for floats, VSE
spends much time converting this fake black input from byte to float,
and then converting it to sequencer color space.

Test case of two EXR files blended over each other, at 4K resolution,
on Ryzen 5950X (Win10/VS2022):
- whole sequencer_preview_region_draw 115ms -> 75ms
- seq_render_give_ibuf part: 64ms -> 24ms

Pull Request: https://projects.blender.org/blender/blender/pulls/127310
2024-09-09 13:16:12 +02:00
Aras Pranckevicius
528471541b VSE: Faster and more consistent thumbnails
Implementing part of design outlined in #126087.

- VSE thumbnail cache has a new implementation, hopefully simpler
  and easier to understand.
    - Instead of cache key being a VSE strip, frame index, plus
      complicated logic for cache items linking etc.,
    - The cache is keyed by media file path (if multiple strips
      use the same input file, they will share cache entries), frame
      index within media file, and any extra data (e.g. steam index
      for multi-steam videos)
- Much reduced cache flickering and strange/weird thumbnail choices.
    - Likewise, thumbnails no longer disappear-and-reload on operations
      like Undo, dragging new video strip into timeline, or F12 render.
- Thumbnails now load faster.
    - Images use dedicated/faster thumbnail loading routines when a
      format can do that (e.g. JPG and EXR can).
    - Movies reuse ffmpeg decoding context for neighboring strips
      that use the same file (as often happens when cutting footage)
    - Thumbnail requests are processed on several threads now too.

Images and more detail in PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/126405
2024-08-29 08:27:12 +02:00