filter-cmp: use scratch buffers for template evaluation