Inverting encoded ref