A US court has ruled Ed Sheeran's 2014 hit Thinking Out Loud did not illegally copy Marvin Gaye's 1973 classic Let's Get It On.