static void accesscache_put(TrackingImageAccessor *accessor,
                            int clip_index,
                            int frame,
                            libmv_InputMode input_mode,
                            int downscale,
                            int64_t transform_key,
                            ImBuf *ibuf)
{
	AccessCacheKey key;
	key.clip_index = clip_index;
	key.frame = frame;
	key.input_mode = input_mode;
	key.downscale = downscale;
	key.transform_key = transform_key;
	IMB_moviecache_put(accessor->cache, &key, ibuf);
}
void BKE_sequencer_cache_put(const SeqRenderData *context, Sequence *seq, float cfra, seq_stripelem_ibuf_t type, ImBuf *i)
{
	SeqCacheKey key;

	if (i == NULL || context->skip_cache) {
		return;
	}

	if (!moviecache) {
		moviecache = IMB_moviecache_create("seqcache", sizeof(SeqCacheKey), seqcache_hashhash, seqcache_hashcmp);
	}

	key.seq = seq;
	key.context = *context;
	key.cfra = cfra - seq->start;
	key.type = type;

	IMB_moviecache_put(moviecache, &key, i);
}
Exemple #3
0
static bool put_imbuf_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, int flag, bool destructive)
{
	MovieClipImBufCacheKey key;

	if (!clip->cache) {
		struct MovieCache *moviecache;

		// char cache_name[64];
		// BLI_snprintf(cache_name, sizeof(cache_name), "movie %s", clip->id.name);

		clip->cache = MEM_callocN(sizeof(MovieClipCache), "movieClipCache");

		moviecache = IMB_moviecache_create("movieclip", sizeof(MovieClipImBufCacheKey), moviecache_hashhash, moviecache_hashcmp);

		IMB_moviecache_set_getdata_callback(moviecache, moviecache_keydata);
		IMB_moviecache_set_priority_callback(moviecache, moviecache_getprioritydata, moviecache_getitempriority,
		                                     moviecache_prioritydeleter);

		clip->cache->moviecache = moviecache;
		clip->cache->sequence_offset = -1;
	}

	key.framenr = user_frame_to_cache_frame(clip, user->framenr);

	if (flag & MCLIP_USE_PROXY) {
		key.proxy = rendersize_to_proxy(user, flag);
		key.render_flag = user->render_flag;
	}
	else {
		key.proxy = IMB_PROXY_NONE;
		key.render_flag = 0;
	}

	if (destructive) {
		IMB_moviecache_put(clip->cache->moviecache, &key, ibuf);
		return true;
	}
	else {
		return IMB_moviecache_put_if_possible(clip->cache->moviecache, &key, ibuf);
	}
}
Exemple #4
0
static void put_imbuf_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, int flag)
{
    MovieClipImBufCacheKey key;

    if (!clip->cache) {
        clip->cache = MEM_callocN(sizeof(MovieClipCache), "movieClipCache");

        clip->cache->moviecache = IMB_moviecache_create(sizeof(MovieClipImBufCacheKey), moviecache_hashhash,
                                  moviecache_hashcmp, moviecache_keydata);
    }

    key.framenr = user->framenr;

    if (flag & MCLIP_USE_PROXY) {
        key.proxy = rendersize_to_proxy(user, flag);
        key.render_flag = user->render_flag;
    }
    else {
        key.proxy = IMB_PROXY_NONE;
        key.render_flag = 0;
    }

    IMB_moviecache_put(clip->cache->moviecache, &key, ibuf);
}