add encoder macro implementation