Reduced usage of typdefs.h

Preliminary step to move types out of legacyheader.

Renamed parameter called "matrix" because cppcheck gets
confused if a parameter is called the same as a type.

Part of #1415

Change-Id: I9207a7b8de7f092bab890da128abbb48a8d97b79