Mobile or FPGA? A Comprehensive Evaluation on Energy Efficiency and a Unified Optimization Framework