1 #ifndef _JPIP_WOI_COMPOSER_H_
2 #define _JPIP_WOI_COMPOSER_H_
14 using namespace jpeg2000;
67 this->coding_parameters = coding_parameters;
82 this->coding_parameters = coding_parameters;
87 min_precinct_xy = coding_parameters->GetPrecincts(current_packet.resolution, pxy1);
88 if (min_precinct_xy.x != 0) min_precinct_xy.
x--;
89 if (min_precinct_xy.y != 0) min_precinct_xy.y--;
91 max_precinct_xy = coding_parameters->GetPrecincts(current_packet.resolution, pxy2);
92 if (max_precinct_xy.x != 0) max_precinct_xy.x--;
93 if (max_precinct_xy.y != 0) max_precinct_xy.y--;
95 current_packet.precinct_xy = min_precinct_xy;
103 pxy1 = composer.
pxy1;
104 pxy2 = composer.
pxy2;
120 return current_packet;
130 if(!more_packets)
return false;
132 if(packet) *packet = current_packet;
134 if (current_packet.precinct_xy.x < max_precinct_xy.x) current_packet.precinct_xy.x++;
137 current_packet.precinct_xy.x = min_precinct_xy.x;
139 if (current_packet.precinct_xy.y < max_precinct_xy.y) current_packet.precinct_xy.y++;
142 current_packet.precinct_xy.y = min_precinct_xy.y;
144 if (current_packet.component < (coding_parameters->num_components - 1)) current_packet.component++;
147 current_packet.component = 0;
149 if (current_packet.resolution < max_resolution) current_packet.resolution++;
152 current_packet.resolution = 0;
154 if (current_packet.layer < (coding_parameters->num_layers - 1)) current_packet.layer++;
156 more_packets =
false;
161 min_precinct_xy = coding_parameters->GetPrecincts(current_packet.resolution, pxy1);
162 if (min_precinct_xy.x != 0) min_precinct_xy.x--;
163 if (min_precinct_xy.y != 0) min_precinct_xy.y--;
165 max_precinct_xy = coding_parameters->GetPrecincts(current_packet.resolution, pxy2);
166 if (max_precinct_xy.x != 0) max_precinct_xy.x--;
167 if (max_precinct_xy.y != 0) max_precinct_xy.y--;
169 current_packet.precinct_xy = min_precinct_xy;
WOIComposer & operator=(const WOIComposer &composer)
Copy assignment.
Definition: woi_composer.h:101
WOIComposer()
Initializes the object.
Definition: woi_composer.h:47
SHARED_PTR< CodingParameters > Ptr
Pointer to an object of this class.
Definition: coding_parameters.h:97
Class that identifies a WOI (Window Of Interest).
Definition: woi.h:24
bool more_packets
Flag to control the last packet.
Definition: woi_composer.h:32
WOIComposer(CodingParameters::Ptr coding_parameters)
Initializes the object.
Definition: woi_composer.h:64
Point pxy2
Bottom-right corner of the WOI.
Definition: woi_composer.h:31
void Reset(const WOI &woi, CodingParameters::Ptr coding_parameters)
Resets the packets navigation and starts a new one.
Definition: woi_composer.h:77
bool GetNextPacket(Packet *packet=NULL)
Moves to the next packet of the WOI.
Definition: woi_composer.h:128
Packet current_packet
Current packet.
Definition: woi_composer.h:36
Size max_precinct_xy
Maximum precinct.
Definition: woi_composer.h:35
Represents a couple of integer values that can be used to identify a coordinate as well as a size...
Definition: point.h:18
Size size
Size of the WOI (width and height)
Definition: woi.h:27
Point pxy1
Upper-left corner of the WOI.
Definition: woi_composer.h:30
Size min_precinct_xy
Minimum precinct.
Definition: woi_composer.h:34
int max_resolution
Maximum resolution.
Definition: woi_composer.h:33
virtual ~WOIComposer()
Definition: woi_composer.h:178
Packet GetCurrentPacket() const
Returns the current packet.
Definition: woi_composer.h:118
int x
Value X.
Definition: point.h:21
int resolution
Resolution level where the WOI is located (0 == the highest)
Definition: woi.h:29
By means of this class it is possible to find out the which packets of an image are associated to a W...
Definition: woi_composer.h:27
CodingParameters::Ptr coding_parameters
Pointer to the associated coding parameters.
Definition: woi_composer.h:41
Point position
Position of the upper-left corner of the WOI.
Definition: woi.h:28
Contains the information of a packet.
Definition: packet.h:15
WOIComposer(const WOIComposer &composer)
Copy constructor.
Definition: woi_composer.h:55