Exemplo n.º 1
0
bool	Primaries::RgbSystem::read_coord_tuple (Vec2 &c, const vsutl::FilterBase &filter, const ::VSMap &in, ::VSMap &out, const char *name_0)
{
	bool           set_flag = false;
	typedef std::vector <double> Vect;
	Vect           v_def;

	Vect           c_v = filter.get_arg_vflt (in, out, name_0, v_def);
	if (c_v.size () != 0)
	{
		if (c_v.size () != c.size ())
		{
			fstb::snprintf4all (
				filter._filter_error_msg_0,
				filter._max_error_buf_len,
				"%s: wrong number of coordinates (expected %d).",
				name_0,
				int (c.size ())
			);
			filter.throw_inval_arg (filter._filter_error_msg_0);
		}
		double            sum = 0;
		for (size_t k = 0; k < c_v.size (); ++k)
		{
			sum += c_v [k];
			c [k] = c_v [k];
		}
		if (c [1] == 0)
		{
			fstb::snprintf4all (
				filter._filter_error_msg_0,
				filter._max_error_buf_len,
				"%s: y coordinate cannot be 0.",
				name_0
			);
			filter.throw_inval_arg (filter._filter_error_msg_0);
		}

		set_flag = true;
	}

	return (set_flag);
}
Exemplo n.º 2
0
void	Primaries::RgbSystem::init (const vsutl::FilterBase &filter, const ::VSMap &in, ::VSMap &out, const char *preset_0)
{
	assert (preset_0 != 0);

	std::string    preset_str = filter.get_arg_str (in, out, preset_0, "");
	fstb::conv_to_lower_case (preset_str);
	_preset = conv_string_to_primaries (preset_str, preset_0);
	if (_preset >= 0)
	{
		set (_preset);
	}
}
Exemplo n.º 3
0
fmtcl::ColorSpaceH265	Matrix::find_cs_from_mat_str (const vsutl::FilterBase &flt, const std::string &mat, bool allow_2020cl_flag)
{
	assert (&flt != 0);
	assert (&mat != 0);

	fmtcl::ColorSpaceH265   cs = fmtcl::ColorSpaceH265_UNSPECIFIED;

	if (mat.empty () || mat == "rgb")
	{
		cs = fmtcl::ColorSpaceH265_RGB;
	}
	else if (mat == "601")
	{
		cs = fmtcl::ColorSpaceH265_SMPTE170M;
	}
	else if (mat == "709")
	{
		cs = fmtcl::ColorSpaceH265_BT709;
	}
	else if (mat == "240")
	{
		cs = fmtcl::ColorSpaceH265_SMPTE240M;
	}
	else if (mat == "fcc")
	{
		cs = fmtcl::ColorSpaceH265_FCC;
	}
	else if (mat == "ycgco" || mat == "ycocg")
	{
		cs = fmtcl::ColorSpaceH265_YCGCO;
	}
	else if (mat == "2020")
	{
		cs = fmtcl::ColorSpaceH265_BT2020NCL;
	}
	else if (mat == "2020CL" && allow_2020cl_flag)
	{
		cs = fmtcl::ColorSpaceH265_BT2020CL;
	}
	else
	{
		flt.throw_inval_arg ("unknown matrix identifier.");
	}

	return (cs);
}
Exemplo n.º 4
0
// str should be already converted to lower case
fmtcl::TransCurve	Transfer::conv_string_to_curve (const vsutl::FilterBase &flt, const std::string &str)
{
	assert (&flt != 0);
	assert (&str != 0);

	fmtcl::TransCurve c = fmtcl::TransCurve_UNDEF;
	if (str == "709")
	{
		c = fmtcl::TransCurve_709;
	}
	else if (str == "470m")
	{
		c = fmtcl::TransCurve_470M;
	}
	else if (str == "470bg")
	{
		c = fmtcl::TransCurve_470BG;
	}
	else if (str == "601")
	{
		c = fmtcl::TransCurve_601;
	}
	else if (str == "240")
	{
		c = fmtcl::TransCurve_240;
	}
	else if (str.empty () || str == "linear")
	{
		c = fmtcl::TransCurve_LINEAR;
	}
	else if (str == "log100")
	{
		c = fmtcl::TransCurve_LOG100;
	}
	else if (str == "log316")
	{
		c = fmtcl::TransCurve_LOG316;
	}
	else if (str == "61966-2-4")
	{
		c = fmtcl::TransCurve_61966_2_4;
	}
	else if (str == "1361")
	{
		c = fmtcl::TransCurve_1361;
	}
	else if (str == "61966-2-1" || str == "srgb" || str == "sycc")
	{
		c = fmtcl::TransCurve_SRGB;
	}
	else if (str == "2020_10")
	{
		c = fmtcl::TransCurve_2020_10;
	}
	else if (str == "2020_12" || str == "2020")
	{
		c = fmtcl::TransCurve_2020_12;
	}
	else if (str == "2084")
	{
		c = fmtcl::TransCurve_2084;
	}
	else if (str == "428-1" || str == "428")
	{
		c = fmtcl::TransCurve_428;
	}
	else if (str == "1886")
	{
		c = fmtcl::TransCurve_1886;
	}
	else if (str == "1886a")
	{
		c = fmtcl::TransCurve_1886A;
	}
	else if (str == "filmstream")
	{
		c = fmtcl::TransCurve_FILMSTREAM;
	}
	else if (str == "slog")
	{
		c = fmtcl::TransCurve_SLOG;
	}
	else if (str == "logc2")
	{
		c = fmtcl::TransCurve_LOGC2;
	}
	else if (str == "logc3")
	{
		c = fmtcl::TransCurve_LOGC3;
	}
	else if (str == "canonlog")
	{
		c = fmtcl::TransCurve_CANONLOG;
	}
	else
	{
		flt.throw_inval_arg ("unknown matrix identifier.");
	}


	return (c);
}