![]() |
Version: 1.0 |
This class allows to generate the forests associated to an algorithm when the pixel prediction is applied. More...
#include <forest_handler.h>
Public Member Functions | |
ForestHandler (const BinaryDrag< conact > &bd, const pixel_set &ps, ForestHandlerFlags flag=ForestHandlerFlags::CENTER_LINES|ForestHandlerFlags::FIRST_LINE) | |
void | DrawOnFile (const std::string &prefix, DrawDagFlags flags=DrawDagFlags::NONE) |
void | GenerateCode (BEFORE_AFTER_FUNC(before_main)=BeforeMainShiftOne, BEFORE_AFTER_FUNC(after_main)=DefaultEmptyFunc, BEFORE_AFTER_FUNC(before_end)=BeforeEnd, BEFORE_AFTER_FUNC(after_end)=AfterEnd, BEFORE_AFTER_FUNC(after_end_no_loop)=AfterEndNoLoop, int flags=0) |
Generates the code for the all the forests groups, each of them in a separate file. More... | |
void | Compress (DragCompressorFlags flags=DragCompressorFlags::PRINT_STATUS_BAR|DragCompressorFlags::IGNORE_LEAVES, int iterations=- 1) |
Compresses all the drags of the forest using an exhaustive approach. More... | |
LineForestHandler & | GetLineForestHandler (ForestHandlerFlags forest_id) |
Public Attributes | |
std::map< ForestHandlerFlags, LineForestHandler > | f_ |
std::map< ForestHandlerFlags, std::string > | names |
std::map< ForestHandlerFlags, std::string > | prefixs |
This class allows to generate the forests associated to an algorithm when the pixel prediction is applied.
When applying pixel prediction optimization many different forest should be generated. The number of forests depends on the mask size and on vertical shift size. This class considers only Rosenfeld and Grana masks like situations. In the former case the vertical shift is unitary and only first line forests and central lines forest are required. In the latter case the mask has a vertical shift of 2 pixels. In this case four different group of forests are required:
A forest group, defined by the LineForestHandler is composed by a main forest and multiple end of the line forests. The number of the end of the line forest depends on the mask horizontal shift. For unitary shift we will have just one end of the line forest, when the mask has a horizontal shift of two pixels we will have two end of the line forests and so on.
The forests generation requires the original decision tree associated to the algorithm on which apply the prediction optimization and the pixel set associated to the mask. The ForestHandlerFlagg enum class allows to select which kind of forests groups you want the ForestHandler generates for you.
Definition at line 40 of file forest_handler.h.
|
inline |
Definition at line 57 of file forest_handler.h.
|
inline |
Compresses all the drags of the forest using an exhaustive approach.
[in] | flags | Flags to be used. Available flags are the ones from the DragCompressorFlags enum class. Use the or to combine multiple flags. Default value is DragCompressorFlags::PRINT_STATUS_BAR | DragCompressorFlags::IGNORE_LEAVES. |
[in] | iterations | Allows to introduce an early stopping criteria. If it is different from -1 the procedure will stop after "iterations" steps, otherwise it will continue until end. Default value is -1. |
Definition at line 163 of file forest_handler.h.
|
inline |
Definition at line 95 of file forest_handler.h.
|
inline |
Generates the code for the all the forests groups, each of them in a separate file.
[in] | before_main | Pointer to the function* which defines what the code generator has to write before printing the code of a tree from the main group of a line. An example is provided with the BeforeMainShiftOne (default value), or by the BeforeMainShifTwo function. The function behavior should depends on the horizontal shift of the mask involved |
[in] | after_main | Pointer to the function* which defines what the code generator has to write after printing the code of a tree from the main group of a line. Usually it is empty. The default value is DefaultEmptyFunc. |
[in] | before_end | Pointer to the function* which defines what the code generator has to write before printing the code of a tree from the end of the line groups. Usually it is just a label. The default value is BeforeEnd. |
[in] | after_end | Pointer to the function* which defines what the code generator has to write after printing the code of a tree from the end of the (CENTER!) line groups. Usually it is just a "continue;" or a "goto". The default value is AfterEnd. |
[in] | after_end_no_loop | Pointer to the function* which defines what the code generator has to write after printing the code of a tree from the end of the (NON CENTER!) lines groups. The default value is AfterEndNoLoop. |
[in] | flag | Not used yet. Default value is zero. |
all the functions must have the following signature:
Definition at line 129 of file forest_handler.h.
|
inline |
Definition at line 169 of file forest_handler.h.
std::map<ForestHandlerFlags, LineForestHandler> ForestHandler::f_ |
Definition at line 42 of file forest_handler.h.
std::map<ForestHandlerFlags, std::string> ForestHandler::names |
Definition at line 43 of file forest_handler.h.
std::map<ForestHandlerFlags, std::string> ForestHandler::prefixs |
Definition at line 49 of file forest_handler.h.