Ed Sheeran has won a courtroom victory after it was ruled his song Thinking Out Loud did not infringe on the copyright of Marvin Gaye's Let's Get It On.