decode basic header