Selection of the reference unit for prediction within a chosen coding or prediction mode