DTC 2D -> JPEG (MxN)

Input
Output (DCT / Quantization)
unDCT
Error
Constant
Cosinus-DCT (u,v,i,j = 0,0,0,0)
Quantization
DCT = Input * Cos * Constant
DCT from book (from source of input, if i have...)
Output * Quantization
Cosinus-unDCT (i,j,u,v = 0,0,0,0)

My dct experiment ----------------- a = Suma abs(cosinus-DCT)
b = Suma abs(cosinus-unDCT)
b * XSqrt(i,j) - hrozne napadne se to podoba kvantizacni tabulce, ze?

Discrete Cosine Transformation (DCT) 2D (MxN 8x8)

	  DCT(u,v) = C(i)*C(j) * suma[i=0..M-1] suma[j=0..N-1]
                     (             unDCT(i,j) * cos(PI/(2M)*(2i+1)*u) * cos(PI/(2N)*(2j+1)*v) )
	unDCT(i,j) = suma[u=0..M-1] suma[v=0..N-1]
                     ( C(u)*C(v) *   DCT(u,v) * cos(PI/(2M)*(2u+1)*i) * cos(PI/(2N)*(2v+1)*j) )

	z=0: C(z) = (1/Z)^0,5
	z>0: C(z) = (2/Z)^0,5

	--- rozdeleni operaci (pro M = N = 8) ---
	  DCT(u,v) = constant1(i,j) * suma[i,j=0..7] unDCT(i,j) * cosinus1(i,j,u,v)
	unDCT(i,j) =                  suma[u,v=0..7]   DCT(u,v) * cosinus3(u,v,i,j)

	N = M = 8 (8x8)
	i=0, j=0 : C(i) * C(j) = (1/M)^0,5 * (1/N)^0,5 = 0,125
	i=0, j>0 : C(i) * C(j) = (1/M)^0,5 * (2/N)^0,5 = 0,177
	i>0, j=0 : C(i) * C(j) = (2/M)^0,5 * (1/N)^0,5 = 0,177
	i>0, j>0 : C(i) * C(j) = (2/M)^0,5 * (2/N)^0,5 = 0,25

	constant1(i,j)    = C(i)*C(j)
	constant2(u,v)    = C(u)*C(v)
	cosinus1(u,v,i,j) = cos(PI/16*(2i+1)*u) * cos(PI/16*(2j+1)*v)
	cosinus2(i,j,u,v) = cos(PI/16*(2u+1)*i) * cos(PI/16*(2v+1)*j)
	cosinus3(u,v,i,j) = constant2(u,v) * cosinus2(i,j,u,v)

	https://planetmath.org/discretecosinetransform
	https://fr.wikipedia.org/wiki/JPEG