Пример #1
0
void m58846_device::execute_one()
{
	// handle one opcode
	switch (m_op & 0x1f0)
	{
		case 0x30: op_sey(); break;
		case 0x70: op_sp(); break;
		case 0xa0: op_a(); break;
		case 0xb0: op_la(); break;

		case 0xc0: case 0xd0: case 0xe0: case 0xf0: op_lxy(); break;

		default:
			switch (m_op & 0x1fc)
			{
		case 0x20: op_szb(); break;
		case 0x4c: op_sb(); break;
		case 0x58: op_szk(); break;
		case 0x5c: op_rb(); break;
		case 0x60: op_xam(); break;
		case 0x64: op_tam(); break;
		case 0x68: op_xamd(); break;
		case 0x6c: op_xami(); break;

		default:
			switch (m_op)
			{
		case 0x06: case 0x07: op_su(); break;
		case 0x40: case 0x41: op_lcps(); break;
		case 0x4a: case 0x4b: op_lz(); break;
		case 0x54: case 0x55: op_ias(); break;

		case 0x00: op_nop(); break;
		case 0x01: op_ba(); break;
		case 0x02: op_iny(); break;
		case 0x03: op_dey(); break;
		case 0x04: op_di(); break;
		case 0x05: op_ei(); break;
		case 0x09: op_tabe(); break; // undocumented
		case 0x0a: op_am(); break;
		case 0x0b: op_ose(); break;
		case 0x0c: op_tya(); break;
		case 0x0f: op_cma(); break;

		case 0x10: op_cls(); break;
		case 0x11: op_clds(); break;
		case 0x13: op_cld(); break;
		case 0x14: op_rd(); break;
		case 0x15: op_sd(); break;
		case 0x16: op_tepa(); break;
		case 0x17: op_ospa(); break;
		case 0x18: op_rl(); break; // undocumented
		case 0x19: op_rr(); break; // undocumented
		case 0x1a: op_teab(); break;
		case 0x1b: op_osab(); break;
		case 0x1c: op_tba(); break;
		case 0x1d: op_tay(); break;
		case 0x1e: op_tab(); break;

		case 0x26: op_seam(); break;
		case 0x2b: op_szd(); break;
		case 0x2f: op_szc(); break;

		case 0x43: op_amc(); break;
		case 0x44: op_rt(); break;
		case 0x45: op_rts(); break;
		case 0x46: op_rti(); break;
		case 0x48: op_rc(); break;
		case 0x49: op_sc(); break;

		case 0x53: op_amcs(); break;
		case 0x57: op_iak(); break;

		case 0x81: op_ofa(); break;
		case 0x82: op_snz1(); break;
		case 0x83: op_snz2(); break;
		case 0x84: op_oga(); break;
		case 0x85: op_t2ab(); break;
		case 0x86: op_tva(); break;
		case 0x8a: op_tab2(); break;
		case 0x8c: op_iaf(); break;

		default:
			melps4_cpu_device::execute_one();
			break;

			}
			break; // 0x1ff

			}
			break; // 0x1fc

	} // big switch
}
Пример #2
0
void	Transfer::init_table ()
{
	_curve_s = conv_string_to_curve (*this, _transs);
	_curve_d = conv_string_to_curve (*this, _transd);
	OpSPtr         op_s = conv_curve_to_op (_curve_s, true );
	OpSPtr         op_d = conv_curve_to_op (_curve_d, false);

	// Linear or log LUT?
	_loglut_flag = false;
	if (   _vi_in.format->sampleType == ::stFloat
	    && _curve_s == fmtcl::TransCurve_LINEAR)
	{
		// Curves with extended range or with fast-evolving slope at 0.
		// Actually we could just use the log LUT for all the curves...?
		// 10 bits per stop + interpolation should be enough for all of them.
		// What about the speed?
		if (   _curve_d == fmtcl::TransCurve_470BG
		    || _curve_d == fmtcl::TransCurve_LINEAR
		    || _curve_d == fmtcl::TransCurve_61966_2_4
		    || _curve_d == fmtcl::TransCurve_2084
		    || _curve_d == fmtcl::TransCurve_428
		    || _curve_d == fmtcl::TransCurve_1886
		    || _curve_d == fmtcl::TransCurve_1886A
		    || _curve_d == fmtcl::TransCurve_SLOG
		    || _curve_d == fmtcl::TransCurve_LOGC2
		    || _curve_d == fmtcl::TransCurve_LOGC3
		    || _curve_d == fmtcl::TransCurve_CANONLOG)
		{
			_loglut_flag = true;
		}
		if (_gcor < 0.5)
		{
			_loglut_flag = true;
		}
		if (fabs (_contrast) >= 3.0/2 || fabs (_contrast) <= 2.0/3)
		{
			_loglut_flag = true;
		}
	}

	// Black level
	const double   lw = op_s->get_max ();
	if (_lvl_black > 0 && _lvl_black < lw)
	{
		/*
		Black level (brightness) and contrast settings as defined
		in ITU-R BT.1886:
			L = a' * fi (V + b')

		With:
			fi = EOTF (gamma to linear)
			L  = Lb for V = 0
			L  = Lw for V = Vmax

		For power functions, could be rewritten as:
			L = fi (a * V + b)

		Substitution:
			Lb = fi (           b)
			Lw = fi (a * Vmax + b)

		Then, given:
			f = OETF (linear to gamma)

		We get:
			f (Lb) = b
			f (Lw) = a * Vmax + b

			b =           f (Lb)
			a = (f (Lw) - f (Lb)) / Vmax
		*/
		OpSPtr         oetf = conv_curve_to_op (_curve_s, false);
		const double   lwg  = (*oetf) (lw        );
		const double   lbg  = (*oetf) (_lvl_black);
		const double   vmax =  lwg;
		const double   a    = (lwg - lbg) / vmax;
		const double   b    =        lbg;
		OpSPtr         op_a (new fmtcl::TransOpAffine (a, b));
		op_s = OpSPtr (new fmtcl::TransOpCompose (op_a, op_s));
	}

	// Gamma correction
	if (! fstb::is_eq (_gcor, 1.0))
	{
		OpSPtr         op_g (new fmtcl::TransOpPow (true, _gcor, 1, 1e6));
		op_d = OpSPtr (new fmtcl::TransOpCompose (op_g, op_d));
	}

	// Contrast
	if (! fstb::is_eq (_contrast, 1.0))
	{
		OpSPtr         op_c (new fmtcl::TransOpContrast (_contrast));
		op_d = OpSPtr (new fmtcl::TransOpCompose (op_c, op_d));
	}

	// LUTify
	OpSPtr         op_f (new fmtcl::TransOpCompose (op_s, op_d));

	const fmtcl::SplFmt  src_fmt = conv_vsfmt_to_splfmt (*_vi_in.format);
	const fmtcl::SplFmt  dst_fmt = conv_vsfmt_to_splfmt (*_vi_out.format);
	_lut_uptr = std::unique_ptr <fmtcl::TransLut> (new fmtcl::TransLut (
		*op_f, _loglut_flag,
		src_fmt, _vi_in.format->bitsPerSample, _full_range_src_flag,
		dst_fmt, _vi_out.format->bitsPerSample, _full_range_dst_flag,
		_sse2_flag, _avx2_flag
	));
}