예제 #1
0
static void hue_correct_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
{
	HueCorrectModifierData *hcmd = (HueCorrectModifierData *) smd;

	curvemapping_initialize(&hcmd->curve_mapping);

	modifier_apply_threaded(ibuf, mask, hue_correct_apply_threaded, &hcmd->curve_mapping);
}
예제 #2
0
static void whiteBalance_apply(SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
{
	WhiteBalanceThreadData data;
	WhiteBalanceModifierData *wbmd = (WhiteBalanceModifierData *) smd;

	copy_v3_v3(data.white, wbmd->white_value);

	modifier_apply_threaded(ibuf, mask, whiteBalance_apply_threaded, &data);
}
예제 #3
0
static void brightcontrast_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
{
	BrightContrastModifierData *bcmd = (BrightContrastModifierData *) smd;
	BrightContrastThreadData data;

	data.bright = bcmd->bright;
	data.contrast = bcmd->contrast;

	modifier_apply_threaded(ibuf, mask, brightcontrast_apply_threaded, &data);
}
예제 #4
0
static void whiteBalance_apply(SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
{
	WhiteBalanceThreadData data;
	WhiteBalanceModifierData *wbmd = (WhiteBalanceModifierData *) smd;

	copy_v3_v3(data.white, wbmd->white_value);
	IMB_colormanagement_display_to_scene_linear_v3(data.white,
	                                               IMB_colormanagement_display_get_named(wbmd->modifier.scene->display_settings.display_device));
	data.colorspace = ibuf->rect_colorspace;

	modifier_apply_threaded(ibuf, mask, whiteBalance_apply_threaded, &data);
}
예제 #5
0
static void curves_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
{
	CurvesModifierData *cmd = (CurvesModifierData *) smd;

	float black[3] = {0.0f, 0.0f, 0.0f};
	float white[3] = {1.0f, 1.0f, 1.0f};

	curvemapping_initialize(&cmd->curve_mapping);

	curvemapping_premultiply(&cmd->curve_mapping, 0);
	curvemapping_set_black_white(&cmd->curve_mapping, black, white);

	modifier_apply_threaded(ibuf, mask, curves_apply_threaded, &cmd->curve_mapping);

	curvemapping_premultiply(&cmd->curve_mapping, 1);
}
예제 #6
0
static void tonemapmodifier_apply(struct SequenceModifierData *smd,
                                  ImBuf *ibuf,
                                  ImBuf *mask)
{
	SequencerTonemapModifierData *tmmd = (SequencerTonemapModifierData *) smd;
	AvgLogLum data;
	data.tmmd = tmmd;
	data.colorspace = (ibuf->rect_float != NULL)
	                      ? ibuf->float_colorspace
	                      : ibuf->rect_colorspace;
	float lsum = 0.0f;
	int p = ibuf->x * ibuf->y;
	float *fp = ibuf->rect_float;
	unsigned char *cp = (unsigned char *)ibuf->rect;
	float avl, maxl = -FLT_MAX, minl = FLT_MAX;
	const float sc = 1.0f / p;
	float Lav = 0.f;
	float cav[4] = {0.0f, 0.0f, 0.0f, 0.0f};
	while (p--) {
		float pixel[4];
		if (fp != NULL) {
			copy_v4_v4(pixel, fp);
		}
		else {
			straight_uchar_to_premul_float(pixel, cp);
		}
		IMB_colormanagement_colorspace_to_scene_linear_v3(pixel, data.colorspace);
		float L = IMB_colormanagement_get_luminance(pixel);
		Lav += L;
		add_v3_v3(cav, pixel);
		lsum += logf(max_ff(L, 0.0f) + 1e-5f);
		maxl = (L > maxl) ? L : maxl;
		minl = (L < minl) ? L : minl;
		if (fp != NULL) {
			fp += 4;
		}
		else {
			cp += 4;
		}
	}
	data.lav = Lav * sc;
	mul_v3_v3fl(data.cav, cav, sc);
	maxl = logf(maxl + 1e-5f);
	minl = logf(minl + 1e-5f);
	avl = lsum * sc;
	data.auto_key = (maxl > minl) ? ((maxl - avl) / (maxl - minl)) : 1.0f;
	float al = expf(avl);
	data.al = (al == 0.0f) ? 0.0f : (tmmd->key / al);
	data.igm = (tmmd->gamma == 0.0f) ? 1.0f : (1.0f / tmmd->gamma);

	if (tmmd->type == SEQ_TONEMAP_RD_PHOTORECEPTOR) {
		modifier_apply_threaded(ibuf,
		                        mask,
		                        tonemapmodifier_apply_threaded_photoreceptor,
		                        &data);
	}
	else /* if (tmmd->type == SEQ_TONEMAP_RD_SIMPLE) */ {
		modifier_apply_threaded(ibuf,
		                        mask,
		                        tonemapmodifier_apply_threaded_simple,
		                        &data);
	}
}
예제 #7
0
static void maskmodifier_apply(struct SequenceModifierData *UNUSED(smd), ImBuf *ibuf, ImBuf *mask)
{
	// SequencerMaskModifierData *bcmd = (SequencerMaskModifierData *)smd;

	modifier_apply_threaded(ibuf, mask, maskmodifier_apply_threaded, NULL);
}