**************************************************
* Tile-based Belief Propagation                  *
* Version 0.9                                    *
* Chia-Kai Liang (liangck@gmail.com)             *
* May 24, 2009                                   *
**************************************************

This package partially implement the tile-based belief propagation proposed in
[1], based on the framework in [2]. Please cite both papers when you use this
package.

  [1] Hardware-Efficient Belief Propagation
      C.-K. Liang, C.-C. Cheng, Y.-C. Lai, L.-G. Chen, and H. H. Chen,
      In IEEE Computer Society Conference on Computer Vision and Pattern
      Recognition, 2009.
  [2] A Comparative Study of Energy Minimization Methods for Markov Random
      Fields.
      R. Szeliski, R. Zabih, D. Scharstein, O. Veksler, V. Kolmogorov,
      A. Agarwala, M. Tappen, and C. Rother.
      In Ninth European Conference on Computer Vision (ECCV 2006),
      volume 2, pages 16-29, Graz, Austria, May 2006.

This package has been compiled using Microsoft Visual Studio 2005 and tested
for all Middlebury benchmark. Please contact the author.

============================= INSTRUCTIONS FOR USAGE ==========================

After you download this package, copy tileBP.h, tileBP.cpp, and bpInTile.cpp,
to the MRF library provided in [2]. These files define a class TileBP inherited
from class MRF. Therefore it can be used in a way similar to other solvers.
After the energy functions are defined, the optimization can be performed using
the following codes:

    MRF *mrf = new TileBP(width, height, num_labels, energy);
    for(int out_iter = 0; out_iter < max_out_iter; out_iter++)
        mrf->optimize(1);

A reference code of the modified mrfstereo.cpp is provided in the package.

The main difference to other solvers is that there are two kinds of iterations,
inner and outer iterations. Currently, the block size and inner iteration
is made fixed in tileBP.h:

    const int TILE_SIZE = 16;
    const int INNER_ITER = 20;

Therefore, nIterations in TileBP->optimize(int) is ignored. The user can still 
adjust these two parameters.

Finally, note that due to the patent and compatibility to the MRF library, the
the following parts in [1] are not implemented in this reference version:

1. Parallel message construction
2. In-tile data cost generation and two-stage pipeline. The energy functions
   must be pre-computed or calculated on-the-fly for each node

