patches: fix bug in computation of number of coefficients needed to reconstruct patch with a maximum RMSE