1 #ifndef _JPEG2000_PACKET_INDEX_H_
2 #define _JPEG2000_PACKET_INDEX_H_
34 vector<FileSegment>
aux;
57 assert(max_offset > 0);
61 while(max_offset > 0) {
83 for(vector<FileSegment>::const_iterator i = index.
aux.begin(); i != index.
aux.end(); i++)
96 assert(segment.
offset >= MINIMUM_OFFSET);
98 int last = aux.size() - 1;
101 aux.push_back(segment);
105 if(aux[last].IsContiguousTo(segment)) {
106 offsets.
back() = aux[last].offset;
111 assert(last < (MINIMUM_OFFSET - 1));
114 aux.push_back(segment);
126 return offsets.
size();
145 uint64_t off_i = offsets[i];
147 if(off_i < MINIMUM_OFFSET)
return aux[off_i];
149 uint64_t off_i1 = offsets[i + 1];
151 if(off_i1 < MINIMUM_OFFSET)
152 off_i1 = aux[off_i1].offset;
void clear()
Clears the content.
Definition: vint_vector.h:130
FileSegment operator[](int i) const
Operator used for accessing the items.
Definition: packet_index.h:143
This class has been implemented with the same philosophy that the class STL vector, but specifically designed to store integers with a length in bytes that can be not multiple from 2 (e.g.
Definition: vint_vector.h:24
Contains a set of classes to easy the handling of data and files, as well as the serialization.
Definition: data.h:9
Class used for indexing the packets of a codestream image.
Definition: packet_index.h:22
Identifies a data segment of a file.
Definition: file_segment.h:20
uint64_t offset
Offset of the data segment.
Definition: file_segment.h:23
vector< FileSegment > aux
Vector of file segments to handle the different sets of packets that are not contiguous.
Definition: packet_index.h:34
vint_vector offsets
Vector of packet offsets.
Definition: packet_index.h:28
int size() const
Returns the size of the vector, in number of items.
Definition: vint_vector.h:138
const PacketIndex & operator=(const PacketIndex &index)
Copy assignment.
Definition: packet_index.h:79
PacketIndex()
Empty constructor.
Definition: packet_index.h:47
PacketIndex(uint64_t max_offset)
Initializes the object.
Definition: packet_index.h:55
Set of classes for handling (reading and indexing) image files with the format defined in the Part 1 ...
Definition: codestream_index.h:10
void set_num_bytes(int num_bytes)
Changes the number of bytes of the integer values.
Definition: vint_vector.h:78
virtual ~PacketIndex()
Definition: packet_index.h:158
int Size() const
Returns the number of elements of the vector.
Definition: packet_index.h:124
void Clear()
Clears the content.
Definition: packet_index.h:132
PacketIndex(const PacketIndex &index)
Copy constructor.
Definition: packet_index.h:71
void push_back(uint64_t value)
Adds a new item to the end of the vector.
Definition: vint_vector.h:121
PacketIndex & Add(const FileSegment &segment)
Adds a new packet segment to the index.
Definition: packet_index.h:94
uint64_t & back()
Return the reference of the last item of the vector.
Definition: vint_vector.h:146