remove wrong check for reference picture mark
update codes according to review comments.
update according review comments
remove call to GetSqrt