Intel の TBB を使用して並列化を開始したシリアル コードがいくつかあります。私の最初の目的は、コード内のほぼすべての for ループを並列化することでした (for ループ内で for を並列化することさえありました)。現在、それを実行してスピードアップを実現しています。並列化する場所/アイデア/オプションをさらに探しています...問題についてあまり言及していないと、これは少し曖昧に聞こえるかもしれませんが、コードで調査できる一般的なアイデアをここで探しています。
アルゴの概要 (次のアルゴは、画像のすべてのレベルで実行され、最短から始まり、実際の高さと幅に達するまで、幅と高さが 2 ずつ増加します)。
For all image pairs starting with the smallest pair
For height = 2 to image_height - 2
Create a 5 by image_width ROI of both left and right images.
For width = 2 to image_width - 2
Create a 5 by 5 window of the left ROI centered around width and find best match in the right ROI using NCC
Create a 5 by 5 window of the right ROI centered around width and find best match in the left ROI using NCC
Disparity = current_width - best match
The edge pixels that did not receive a disparity gets the disparity of its neighbors
For height = 0 to image_height
For width = 0 to image_width
Check smoothness, uniqueness and order constraints*(parallelized separately)
For height = 0 to image_height
For width = 0 to image_width
For disparity that failed constraints, use the average disparity of
neighbors that passed the constraints
Normalize all disparity and output to screen