 	cmax = 0.5 * (cmax + cmax5);
 	cavg = 0.5 * (cavg + cavg5);
 
-	auto ret = clipAABB(cmin, cmax, clr);
+#ifdef ENABLE_YCOCG
+	auto ex = 0.25 * 0.5 * (cmax.x - cmin.x);
+	float2 chroma_extent = make_float2(ex, ex);
+	float2 chroma_center = make_float2(clr0.y, clr0.z);
+	
+	cmin.y = chroma_center.x - chroma_extent.x;
+	cmin.z = chroma_center.y - chroma_extent.y;
+
+	cmax.y = chroma_center.x + chroma_extent.x;
+	cmax.z = chroma_center.y + chroma_extent.y;
+
+	cavg.y = chroma_center.x;
+	cavg.z = chroma_center.y;
+#endif
+
+	auto ret = clipAABB(cmin, cmax, clr1);
 
 	return ret;
 }

		float k_feedback = lerp(0.8, 0.2, unbiased_weight_sqr);

		auto c = lerp(clr0, clr1, k_feedback);

		auto noise4 = PDsrand4(make_float2(ix, iy) + sinTime + 0.6959174f) / 510.0f;
		noise4.w = 0;

	}
}

// https://software.intel.com/en-us/node/503873
inline __device__ float3 RGB2YCoCg(float3 c)
{
	// Y = R/4 + G/2 + B/4
	// Co = R/2 - B/2
	// Cg = -R/4 + G/2 - B/4
	return make_float3(
		c.x / 4.0 + c.y / 2.0 + c.z / 4.0,
		c.x / 2.0 - c.z / 2.0,
		-c.x / 4.0 + c.y / 2.0 - c.z / 4.0);
}

// https://software.intel.com/en-us/node/503873
inline __device__ float3 YCoCg2RGB(float3 c)
{
	// R = Y + Co - Cg
	// G = Y + Cg
	// B = Y - Co - Cg
#if 0
	return make_float3(
		clamp(c.x + c.y - c.z, 0.0f, 1.0f),
		clamp(c.x + c.z, 0.0f, 1.0f),
		clamp(c.x - c.y - c.z, 0.0f, 1.0f));
#else
	return make_float3(
		max(c.x + c.y - c.z, 0.0f),
		max(c.x + c.z, 0.0f),
		max(c.x - c.y - c.z, 0.0f));
#endif
}

inline __device__ float3 sampleColor(
	const idaten::SVGFPathTracing::AOV* __restrict__ aovs,
	int width, int height,
