libswresample: move condition to start of loop.

This avoids several issue like calculating sum/maxcoef
incorrectly due to adding up matrix entries that will
be overwritten, as well as out-of-range writes to
s->matrix if the maximum allowed number of channels is used.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
