From 28617bb167981ac1e02655c0fc262fe1571d8e1e Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Fri, 11 Jun 2021 09:34:31 +0200 Subject: Sequencer: Transform ImBuf Processor. Inside the sequencer the cropping and transform of images/buffers were implemented locally. This reduced the optimizations that a compiler could do and added confusing code styles. This patch adds `IMB_transform` to reduce the confusion and increases compiler optimizations as more code can be inlined and we can keep track of indices inside the inner loop. This increases end-user performance by 30% when playing back aa video in VSE. Reviewed By: ISS, zeddb Differential Revision: https://developer.blender.org/D11549 --- source/blender/imbuf/IMB_imbuf.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/blender/imbuf/IMB_imbuf.h') diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 9c84127105a..651c69726ff 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -70,6 +70,7 @@ extern "C" { */ struct ImBuf; struct rcti; +struct rctf; /** * @@ -323,6 +324,11 @@ typedef enum IMB_Proxy_Size { IMB_PROXY_MAX_SLOT = 4, } IMB_Proxy_Size; +typedef enum eIMBInterpolationFilterMode { + IMB_FILTER_NEAREST, + IMB_FILTER_BILINEAR, +} eIMBInterpolationFilterMode; + /* Defaults to BL_proxy within the directory of the animation. */ void IMB_anim_set_index_dir(struct anim *anim, const char *dir); void IMB_anim_get_fname(struct anim *anim, char *file, int size); @@ -732,6 +738,12 @@ void IMB_processor_apply_threaded_scanlines(int total_scanlines, ScanlineThreadFunc do_thread, void *custom_data); +void IMB_transform(struct ImBuf *src, + struct ImBuf *dst, + float transform_matrix[3][3], + struct rctf *src_crop, + const eIMBInterpolationFilterMode filter); + /* ffmpeg */ void IMB_ffmpeg_init(void); const char *IMB_ffmpeg_last_error(void); -- cgit v1.2.3