FUNC&NBSP;DST (In []float64) []float64 { out := make ([]float64, len (in)) nr := len (in) for i := 0 ; i < nr; i++ { for j := 0; j < nr; j++ { tmp := (Float64 (i) + 0.5) * (Float64 (j) + 0.5) / float64 (NR) out[i] += In[j] * math. Sin (Tmp*math. Pi) } } return &NBSP;OUT}FUNC&NBSP;IDST (In []float64) &NBSP;[]FLOAT64&NBSP;{&NBSP;&NBSP;&NBSP;&NBSP;OUT&NBSP;:=&NBSP;DST ( IN) &NBSP;&NBSP;&NBSP;&NBSP;FOR&NBSP;I,&NBSP;V&NBSP;:=&NBSP;RANGE&NBSP;OUT&NBSP;{&NBSP;&NBSP;&NBsp; out[i] = v * 2 / float64 (Len (in)) &NBSP;&NBSP;}&NBSP;&NBSP;&NBSP;&NBSP;RETURN&NBSP;OUT}FUNC&NBSP;DCT (In []float64) []float64 { out := make ([]float64, len (in)) nr := Len (in) for i := 0; i < nr; i++ { for j := 0; j < nr; j++ { tmp := float64 (i) * (Float64 (j) + 0.5) / float64 (NR) out[i] += in[j] * math. Cos (Tmp*math. Pi) } } return &NBSP;OUT}FUNC&NBSP;IDCT (In []float64) &NBSP;[]FLOAT64&NBsp { out := make ([]float64, len (in)) nr := len (in) for i := 0; i < nr; i++ { out[i] = in[i] / 2 for j := 0; j < nr; j++ { tmp := float64 (j) * (Float64 (i) + 0.5) / float64 (NR) out[i] += in[j] * math. Cos (Tmp*math. Pi) } out[i] = out[i] * 2 / float64 (NR) } Return out}
Go language: Discrete sine transform and discrete cosine transform and inverse transformation