2012-01-19 48 views

回答

1

峯值正常化藉此一般形式,你就會有一些轉換,優化和錯誤檢查,添加了對16位的信號:

double* const buffer(...); 
const size_t length(...); 

double max(0); 
// find the peak 
for (size_t idx(0); idx < length; ++idx) 
    max = std::max(max, buffer[idx]); 
// process 
double mul(1.0/max); 
for (size_t idx(0); idx < length; ++idx) 
    buffer[idx] *= mul; 
相關問題