Clip editor: Fixes for prefetch
Seems metadata was never read while prefetching, at least was never requested to be read. Also fixed prefetch for multilayer EXR.
This commit is contained in:
parent
3467e40e01
commit
08ab09cf04
|
@ -45,6 +45,8 @@ void BKE_movieclip_reload(struct Main *bmain, struct MovieClip *clip);
|
|||
void BKE_movieclip_clear_cache(struct MovieClip *clip);
|
||||
void BKE_movieclip_clear_proxy_cache(struct MovieClip *clip);
|
||||
|
||||
void BKE_movieclip_convert_multilayer_ibuf(struct ImBuf *ibuf);
|
||||
|
||||
struct ImBuf *BKE_movieclip_get_ibuf(struct MovieClip *clip, struct MovieClipUser *user);
|
||||
struct ImBuf *BKE_movieclip_get_postprocessed_ibuf(struct MovieClip *clip, struct MovieClipUser *user, int postprocess_flag);
|
||||
struct ImBuf *BKE_movieclip_get_stable_ibuf(struct MovieClip *clip, struct MovieClipUser *user, float loc[2], float *scale, float *angle, int postprocess_flag);
|
||||
|
|
|
@ -197,6 +197,8 @@ static void get_proxy_fname(const MovieClip *clip,
|
|||
strcat(name, ".jpg");
|
||||
}
|
||||
|
||||
#ifdef WITH_OPENEXR
|
||||
|
||||
typedef struct MultilayerConvertContext {
|
||||
float *combined_pass;
|
||||
int num_combined_channels;
|
||||
|
@ -247,12 +249,21 @@ static void movieclip_convert_multilayer_add_pass(
|
|||
}
|
||||
}
|
||||
|
||||
#endif /* WITH_OPENEXR */
|
||||
|
||||
/* Will try to make image buffer usable when originating from the multi-layer
|
||||
* source.
|
||||
* Internally finds a first combined pass and uses that as a buffer. Not ideal,
|
||||
* but is better than a complete empty buffer. */
|
||||
static void movieclip_convert_multilayer(ImBuf *ibuf)
|
||||
void BKE_movieclip_convert_multilayer_ibuf(struct ImBuf *ibuf)
|
||||
{
|
||||
if (ibuf == NULL) {
|
||||
return;
|
||||
}
|
||||
#ifdef WITH_OPENEXR
|
||||
if (ibuf->ftype != IMB_FTYPE_OPENEXR || ibuf->userdata == NULL) {
|
||||
return;
|
||||
}
|
||||
MultilayerConvertContext ctx;
|
||||
ctx.combined_pass = NULL;
|
||||
ctx.num_combined_channels = 0;
|
||||
|
@ -271,6 +282,7 @@ static void movieclip_convert_multilayer(ImBuf *ibuf)
|
|||
}
|
||||
IMB_exr_close(ibuf->userdata);
|
||||
ibuf->userdata = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static ImBuf *movieclip_load_sequence_file(MovieClip *clip,
|
||||
|
@ -310,14 +322,7 @@ static ImBuf *movieclip_load_sequence_file(MovieClip *clip,
|
|||
|
||||
/* read ibuf */
|
||||
ibuf = IMB_loadiffname(name, loadflag, colorspace);
|
||||
|
||||
#ifdef WITH_OPENEXR
|
||||
if (ibuf) {
|
||||
if (ibuf->ftype == IMB_FTYPE_OPENEXR && ibuf->userdata) {
|
||||
movieclip_convert_multilayer(ibuf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
BKE_movieclip_convert_multilayer_ibuf(ibuf);
|
||||
|
||||
return ibuf;
|
||||
}
|
||||
|
|
|
@ -773,7 +773,7 @@ static void prefetch_task_func(TaskPool * __restrict pool, void *task_data, int
|
|||
while ((mem = prefetch_thread_next_frame(queue, clip, &size, ¤t_frame))) {
|
||||
ImBuf *ibuf;
|
||||
MovieClipUser user = {0};
|
||||
int flag = IB_rect | IB_alphamode_detect;
|
||||
int flag = IB_rect | IB_multilayer | IB_alphamode_detect | IB_metadata;
|
||||
int result;
|
||||
char *colorspace_name = NULL;
|
||||
const bool use_proxy = (clip->flag & MCLIP_USE_PROXY) &&
|
||||
|
@ -789,6 +789,10 @@ static void prefetch_task_func(TaskPool * __restrict pool, void *task_data, int
|
|||
}
|
||||
|
||||
ibuf = IMB_ibImageFromMemory(mem, size, flag, colorspace_name, "prefetch frame");
|
||||
if (ibuf == NULL) {
|
||||
continue;
|
||||
}
|
||||
BKE_movieclip_convert_multilayer_ibuf(ibuf);
|
||||
|
||||
result = BKE_movieclip_put_frame_if_possible(clip, &user, ibuf);
|
||||
|
||||
|
|
Loading…
Reference in New Issue