コード例 #1
0
ファイル: movieclip.c プロジェクト: Walid-Shouman/Blender
/* note: currently used by proxy job for movies, threading happens within single frame
 * (meaning scaling shall be threaded)
 */
void BKE_movieclip_build_proxy_frame(MovieClip *clip, int clip_flag, struct MovieDistortion *distortion,
                                     int cfra, int *build_sizes, int build_count, bool undistorted)
{
	ImBuf *ibuf;
	MovieClipUser user;

	if (!build_count)
		return;

	user.framenr = cfra;
	user.render_flag = 0;
	user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL;

	ibuf = BKE_movieclip_get_ibuf_flag(clip, &user, clip_flag, MOVIECLIP_CACHE_SKIP);

	if (ibuf) {
		ImBuf *tmpibuf = ibuf;
		int i;

		if (undistorted)
			tmpibuf = get_undistorted_ibuf(clip, distortion, ibuf);

		for (i = 0; i < build_count; i++)
			movieclip_build_proxy_ibuf(clip, tmpibuf, cfra, build_sizes[i], undistorted, true);

		IMB_freeImBuf(ibuf);

		if (tmpibuf != ibuf)
			IMB_freeImBuf(tmpibuf);
	}
}
コード例 #2
0
ファイル: movieclip.c プロジェクト: nttputus/blensor
static ImBuf *put_postprocessed_frame_to_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf,
        int flag, int postprocess_flag)
{
    MovieClipCache *cache = clip->cache;
    MovieTrackingCamera *camera = &clip->tracking.camera;
    ImBuf *postproc_ibuf = NULL;

    if (cache->postprocessed.ibuf)
        IMB_freeImBuf(cache->postprocessed.ibuf);

    cache->postprocessed.framenr = user->framenr;
    cache->postprocessed.flag = postprocess_flag;

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

    if (need_undistortion_postprocess(user, flag)) {
        copy_v2_v2(cache->postprocessed.principal, camera->principal);
        copy_v3_v3(&cache->postprocessed.k1, &camera->k1);
        cache->postprocessed.undistoriton_used = TRUE;
        postproc_ibuf = get_undistorted_ibuf(clip, NULL, ibuf);
    }
    else {
        cache->postprocessed.undistoriton_used = FALSE;
    }

    if (postprocess_flag) {
        int disable_red   = postprocess_flag & MOVIECLIP_DISABLE_RED,
            disable_green = postprocess_flag & MOVIECLIP_DISABLE_GREEN,
            disable_blue  = postprocess_flag & MOVIECLIP_DISABLE_BLUE,
            grayscale     = postprocess_flag & MOVIECLIP_PREVIEW_GRAYSCALE;

        if (!postproc_ibuf)
            postproc_ibuf = IMB_dupImBuf(ibuf);

        if (disable_red || disable_green || disable_blue || grayscale)
            BKE_tracking_disable_imbuf_channels(postproc_ibuf, disable_red, disable_green, disable_blue, 1);
    }

    IMB_refImBuf(postproc_ibuf);

    cache->postprocessed.ibuf = postproc_ibuf;

    if (cache->stabilized.ibuf) {
        /* force stable buffer be re-calculated */
        IMB_freeImBuf(cache->stabilized.ibuf);
        cache->stabilized.ibuf = NULL;
    }

    return postproc_ibuf;
}
コード例 #3
0
ファイル: movieclip.c プロジェクト: Walid-Shouman/Blender
/* note: currently used by proxy job for sequences, threading happens within sequence
 * (different threads handles different frames, no threading within frame is needed)
 */
void BKE_movieclip_build_proxy_frame_for_ibuf(MovieClip *clip, ImBuf *ibuf, struct MovieDistortion *distortion,
                                              int cfra, int *build_sizes, int build_count, bool undistorted)
{
	if (!build_count)
		return;

	if (ibuf) {
		ImBuf *tmpibuf = ibuf;
		int i;

		if (undistorted)
			tmpibuf = get_undistorted_ibuf(clip, distortion, ibuf);

		for (i = 0; i < build_count; i++)
			movieclip_build_proxy_ibuf(clip, tmpibuf, cfra, build_sizes[i], undistorted, false);

		if (tmpibuf != ibuf)
			IMB_freeImBuf(tmpibuf);
	}
}
コード例 #4
0
ファイル: movieclip.c プロジェクト: Walid-Shouman/Blender
static ImBuf *postprocess_frame(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, int postprocess_flag)
{
	ImBuf *postproc_ibuf = NULL;

	if (need_undistortion_postprocess(user)) {
		postproc_ibuf = get_undistorted_ibuf(clip, NULL, ibuf);
	}
	else {
		postproc_ibuf = IMB_dupImBuf(ibuf);
	}

	if (postprocess_flag) {
		bool disable_red   = (postprocess_flag & MOVIECLIP_DISABLE_RED) != 0,
			 disable_green = (postprocess_flag & MOVIECLIP_DISABLE_GREEN) != 0,
			 disable_blue  = (postprocess_flag & MOVIECLIP_DISABLE_BLUE) != 0,
			 grayscale     = (postprocess_flag & MOVIECLIP_PREVIEW_GRAYSCALE) != 0;

		if (disable_red || disable_green || disable_blue || grayscale)
			BKE_tracking_disable_channels(postproc_ibuf, disable_red, disable_green, disable_blue, 1);
	}

	return postproc_ibuf;
}