code: private int selectRightToLeft( int col , int[] scores ) {
  		// see how far it can search
  		int localMax = Math.min(imageWidth-regionWidth,col+maxDisparity)-col-minDisparity;
  
  		int indexBest = 0;
  		int indexScore = col;
  		int scoreBest = scores[col];
  		indexScore += imageWidth+1;
  
  		for( int i = 1; i < localMax; i++ ,indexScore += imageWidth+1) {
  			int s = scores[indexScore];
  
  			if( s < scoreBest ) {
  				scoreBest = s;
  				indexBest = i;
  			}
  		}
  
  		return indexBest;
  	}
docs: Finds the best disparity going from right to left image.