change to use correct type

This commit changes to use uint32_t for cost (always non-negative),
and promote to int64_t before calculation of the savings.

This fixes an integer overflow.

cherry-picked #a3028ddf from aom/master

Change-Id: I71c2580d188cc79d2d8069241d0353cf331b5c83
1 file changed