Ocean
OptimizerSubset.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_CV_SYNTHESIS_OPTIMIZER_SUBSET_H
9 #define META_OCEAN_CV_SYNTHESIS_OPTIMIZER_SUBSET_H
10 
13 
15 
16 namespace Ocean
17 {
18 
19 namespace CV
20 {
21 
22 namespace Synthesis
23 {
24 
25 /**
26  * This class is the base class for all optimizers that are able to optimize seperate subsets of the synthesis content.
27  * @ingroup cvsynthesis
28  */
29 class OCEAN_CV_SYNTHESIS_EXPORT OptimizerSubset : virtual public Optimizer
30 {
31  public:
32 
33  /**
34  * Creates a new optimizer object.
35  * @param layer Synthesis layer that has to be optimized
36  * @param randomGenerator Random number generator to be used during the optimization
37  */
38  inline OptimizerSubset(Layer& layer, RandomGenerator& randomGenerator);
39 
40  /**
41  * Invokes the operator.
42  * @see Optimizer::invoke().
43  */
44  bool invoke(const unsigned int radii, const unsigned int iterations = 5u, const unsigned int maxSpatialCost = 0xFFFFFFFFu, Worker* worker = nullptr, const bool applyInitialMapping = true) const override;
45 
46  protected:
47 
48  /**
49  * Optimizes a subset of the synthesis frame.
50  * @param radii Number of improvement radii during one optimization iteration for each mapping position
51  * @param maxSpatialCost Maximal spatial cost
52  * @param boundingBoxTop First row of the entire synthesis area
53  * @param boundingBoxHeight Number of rows of the entire synthesis area
54  * @param downIsMain True, if the downwards direction is the main optimization direction (for all subsets with even thread indices)
55  * @param firstColumn First column to be handled in the subset
56  * @param numberColumns Number of columns to be handled in the subset
57  * @param rowOffset Offset within the entire synthesis area (boundingBoxHeight), the subset may be moved by this offset
58  * @param firstRow First row to be handled in the subset
59  * @param numberRows Number of rows to be handled in the subset
60  * @param threadIndex Index of the thread that executes the subset optimization function
61  */
62  virtual void optimizeSubset(const unsigned int radii, const unsigned int maxSpatialCost, const unsigned int boundingBoxTop, const unsigned int boundingBoxHeight, const bool downIsMain, const unsigned int firstColumn, const unsigned int numberColumns, const unsigned int rowOffset, const unsigned int firstRow, const unsigned int numberRows, const unsigned int threadIndex) const = 0;
63 
64  protected:
65 
66  /// Random number generator of this optimizer.
68 };
69 
70 inline OptimizerSubset::OptimizerSubset(Layer& layer, RandomGenerator& randomGenerator) :
71  Optimizer(layer),
72  randomGenerator_(randomGenerator)
73 {
74  // nothing to do here
75 }
76 
77 }
78 
79 }
80 
81 }
82 
83 #endif // META_OCEAN_CV_SYNTHESIS_OPTIMIZER_SUBSET_H
This class implements the base class for all inpainting layers.
Definition: Layer.h:35
This class is the base class for all synthesis optimizers.
Definition: Optimizer.h:30
This class is the base class for all optimizers that are able to optimize seperate subsets of the syn...
Definition: OptimizerSubset.h:30
RandomGenerator & randomGenerator_
Random number generator of this optimizer.
Definition: OptimizerSubset.h:67
bool invoke(const unsigned int radii, const unsigned int iterations=5u, const unsigned int maxSpatialCost=0xFFFFFFFFu, Worker *worker=nullptr, const bool applyInitialMapping=true) const override
Invokes the operator.
virtual void optimizeSubset(const unsigned int radii, const unsigned int maxSpatialCost, const unsigned int boundingBoxTop, const unsigned int boundingBoxHeight, const bool downIsMain, const unsigned int firstColumn, const unsigned int numberColumns, const unsigned int rowOffset, const unsigned int firstRow, const unsigned int numberRows, const unsigned int threadIndex) const =0
Optimizes a subset of the synthesis frame.
OptimizerSubset(Layer &layer, RandomGenerator &randomGenerator)
Creates a new optimizer object.
Definition: OptimizerSubset.h:70
This class implements a generator for random numbers.
Definition: RandomGenerator.h:42
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15