Basically OUT1 follows IN1 and OUT2 follows IN2.
Two mbed control signals are needed if you want to control both speed and direction. One of them is PWM to control the speed, the other signal controls direction.
For example PWM to IN1, Direction to IN2.
Direction=0 and PWM of 0% will mean Brake, PWM=100% will mean max speed.
Direction=1 and PWM of 0% will mean Max speed in other direction, PWM=100% will mean brake.
You can use an external EXOR gate to reverse the reversed behavior of PWM, but it is easier and cheaper to just hide that behaviour in a software method.
When you connect both INputs to the same PWM the motor will never run.
When you connect one input to the PWM and the other to the inverted PWM (using an external inverter) the motor will stop at PWM=50% and run in opposite directions when you go to PWM=0% or PWM=100%. This will work, but you loose resolution in the speedcontrol range.
Each motor needs to be controlled by 2 pwm signals, so that's 8. What are the performance differences between a software pwm and hardware pwm? Is it okay to mix them?