私はiOS用の画像処理アプリに取り組んでいますが、しきい値処理は本当に大きなボトルネックです。だから私はNEONを使ってそれを最適化しようとしています。これがCバージョンの関数です。NEONを使用してこれを書き直す方法はありますか(残念ながら、私はこれについてまったく経験がありません)?
static void thresh_8u( const Image& _src, Image& _dst, uchar thresh, uchar maxval, int type ) {
int i, j;
uchar tab[256];
Size roi = _src.size();
roi.width *= _src.channels();
memset(&tab[0], 0, thresh);
memset(&tab[thresh], maxval, 256-thresh);
for( i = 0; i < roi.height; i++ ) {
const uchar* src = (const uchar*)(_src.data + _src.step*i);
uchar* dst = (uchar*)(_dst.data + _dst.step*i);
j = 0;
for(; j <= roi.width; ++j) {
dst[j] = tab[src[j]];
}
}
}