optimisation: reworked intra_prediction() so that yy is computed fully only