avformat/utils: reorder operations in update_wrap_reference()

prevents a integer overflow

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avformat/utils: move update_wrap_reference() up

simplifies code
also remove extra {}

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>