movementdetector: Move variable declarations to beginning of the block

Change-Id: Ia6ea3827fa912301fff8a91fd1ff33052e2167e9