average method
Helper funciton to compute the average of an array after dct caclulations
Implementation
num average(List pixels) {
// Calculate the average value from top 8x8 pixels, except for the first one.
var n = pixels.length - 1;
return pixels.sublist(1, n).reduce((a, b) => a + b) / n;
}