reformat code and minor fix
add ff.h
ff: add code for trim and reduce
ff_waf: rename output name
ff: write the reduced result