On a conforming loan amount if your existing second mortgage or home equity line was not obtained in conjunction with purchasing your home, then paying it off with a new mortgage is considered cash out.
On a jumbo loan amount, and depnding on the loan program, paying off a second mortgage loan that is “seasoned” will not be considered a cash out refinance.