/src/vvenc/source/Lib/CommonLib/Unit.h
Line | Count | Source |
1 | | /* ----------------------------------------------------------------------------- |
2 | | The copyright in this software is being made available under the Clear BSD |
3 | | License, included below. No patent rights, trademark rights and/or |
4 | | other Intellectual Property Rights other than the copyrights concerning |
5 | | the Software are granted under this license. |
6 | | |
7 | | The Clear BSD License |
8 | | |
9 | | Copyright (c) 2019-2026, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. & The VVenC Authors. |
10 | | All rights reserved. |
11 | | |
12 | | Redistribution and use in source and binary forms, with or without modification, |
13 | | are permitted (subject to the limitations in the disclaimer below) provided that |
14 | | the following conditions are met: |
15 | | |
16 | | * Redistributions of source code must retain the above copyright notice, |
17 | | this list of conditions and the following disclaimer. |
18 | | |
19 | | * Redistributions in binary form must reproduce the above copyright |
20 | | notice, this list of conditions and the following disclaimer in the |
21 | | documentation and/or other materials provided with the distribution. |
22 | | |
23 | | * Neither the name of the copyright holder nor the names of its |
24 | | contributors may be used to endorse or promote products derived from this |
25 | | software without specific prior written permission. |
26 | | |
27 | | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY |
28 | | THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND |
29 | | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
30 | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
31 | | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
32 | | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
33 | | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
34 | | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
35 | | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
36 | | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
37 | | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
38 | | POSSIBILITY OF SUCH DAMAGE. |
39 | | |
40 | | |
41 | | ------------------------------------------------------------------------------------------- */ |
42 | | /** \file Unit.h |
43 | | * \brief defines unit as a set of blocks and basic unit types (coding, prediction, transform) |
44 | | */ |
45 | | |
46 | | #pragma once |
47 | | |
48 | | #include "CommonDef.h" |
49 | | #include "Common.h" |
50 | | #include "Mv.h" |
51 | | #include "MotionInfo.h" |
52 | | |
53 | | #include <array> |
54 | | #include <iterator> |
55 | | |
56 | | //! \ingroup CommonLib |
57 | | //! \{ |
58 | | |
59 | | namespace vvenc { |
60 | | |
61 | | // --------------------------------------------------------------------------- |
62 | | // tools |
63 | | // --------------------------------------------------------------------------- |
64 | | |
65 | | inline Position recalcPosition(const ChromaFormat _cf, const ComponentID srcCId, const ComponentID dstCId, const Position& pos) |
66 | 0 | { |
67 | 0 | if( toChannelType( srcCId ) == toChannelType( dstCId ) ) |
68 | 0 | { |
69 | 0 | return pos; |
70 | 0 | } |
71 | 0 | else if (isLuma(srcCId) && isChroma(dstCId)) |
72 | 0 | { |
73 | 0 | return Position(pos.x >> getComponentScaleX(dstCId, _cf), pos.y >> getComponentScaleY(dstCId, _cf)); |
74 | 0 | } |
75 | 0 | else |
76 | 0 | { |
77 | 0 | return Position(pos.x << getComponentScaleX(srcCId, _cf), pos.y << getComponentScaleY(srcCId, _cf)); |
78 | 0 | } |
79 | 0 | } |
80 | | |
81 | | inline Position recalcPosition( const ChromaFormat _cf, const ChannelType srcCHt, const ChannelType dstCHt, const Position& pos ) |
82 | 0 | { |
83 | 0 | if( srcCHt == dstCHt ) |
84 | 0 | { |
85 | 0 | return pos; |
86 | 0 | } |
87 | 0 | else if( isLuma( srcCHt ) && isChroma( dstCHt ) ) |
88 | 0 | { |
89 | 0 | return Position( pos.x >> getChannelTypeScaleX( dstCHt, _cf ), pos.y >> getChannelTypeScaleY( dstCHt, _cf ) ); |
90 | 0 | } |
91 | 0 | else |
92 | 0 | { |
93 | 0 | return Position( pos.x << getChannelTypeScaleX( srcCHt, _cf ), pos.y << getChannelTypeScaleY( srcCHt, _cf ) ); |
94 | 0 | } |
95 | 0 | } |
96 | | |
97 | | inline Size recalcSize( const ChromaFormat _cf, const ComponentID srcCId, const ComponentID dstCId, const Size& size ) |
98 | 0 | { |
99 | 0 | if( toChannelType( srcCId ) == toChannelType( dstCId ) ) |
100 | 0 | { |
101 | 0 | return size; |
102 | 0 | } |
103 | 0 | else if( isLuma( srcCId ) && isChroma( dstCId ) ) |
104 | 0 | { |
105 | 0 | return Size( size.width >> getComponentScaleX( dstCId, _cf ), size.height >> getComponentScaleY( dstCId, _cf ) ); |
106 | 0 | } |
107 | 0 | else |
108 | 0 | { |
109 | 0 | return Size( size.width << getComponentScaleX( srcCId, _cf ), size.height << getComponentScaleY( srcCId, _cf ) ); |
110 | 0 | } |
111 | 0 | } |
112 | | |
113 | | inline Size recalcSize( const ChromaFormat _cf, const ChannelType srcCHt, const ChannelType dstCHt, const Size& size ) |
114 | 0 | { |
115 | 0 | if( srcCHt == dstCHt ) |
116 | 0 | { |
117 | 0 | return size; |
118 | 0 | } |
119 | 0 | else if( isLuma( srcCHt ) && isChroma( dstCHt ) ) |
120 | 0 | { |
121 | 0 | return Size( size.width >> getChannelTypeScaleX( dstCHt, _cf ), size.height >> getChannelTypeScaleY( dstCHt, _cf ) ); |
122 | 0 | } |
123 | 0 | else |
124 | 0 | { |
125 | 0 | return Size( size.width << getChannelTypeScaleX( srcCHt, _cf ), size.height << getChannelTypeScaleY( srcCHt, _cf ) ); |
126 | 0 | } |
127 | 0 | } |
128 | | |
129 | | // --------------------------------------------------------------------------- |
130 | | // block definition |
131 | | // --------------------------------------------------------------------------- |
132 | | |
133 | | struct CompArea : public Area |
134 | | { |
135 | 0 | CompArea() : Area(), chromaFormat(NUM_CHROMA_FORMAT), compID(MAX_NUM_TBLOCKS) { } |
136 | 0 | CompArea(const ComponentID _compID, const ChromaFormat _cf, const Area& _area, const bool isLuma = false) : Area(_area), chromaFormat(_cf), compID(_compID) { if (isLuma) xRecalcLumaToChroma(); } |
137 | 0 | CompArea(const ComponentID _compID, const ChromaFormat _cf, const Position& _pos, const Size& _size, const bool isLuma = false) : Area(_pos, _size), chromaFormat(_cf), compID(_compID) { if (isLuma) xRecalcLumaToChroma(); } |
138 | 0 | CompArea(const ComponentID _compID, const ChromaFormat _cf, const uint32_t _x, const uint32_t _y, const uint32_t _w, const uint32_t _h, const bool isLuma = false) : Area(_x, _y, _w, _h), chromaFormat(_cf), compID(_compID) { if (isLuma) xRecalcLumaToChroma(); } |
139 | | |
140 | | ChromaFormat chromaFormat; |
141 | | ComponentID compID; |
142 | | |
143 | | Position chromaPos() const; |
144 | | Position lumaPos() const; |
145 | | |
146 | | Size chromaSize() const; |
147 | | Size lumaSize() const; |
148 | | |
149 | | Position compPos( const ComponentID compID ) const; |
150 | | Position chanPos( const ChannelType chType ) const; |
151 | | |
152 | 0 | Position topLeftComp (const ComponentID _compID) const { return recalcPosition(chromaFormat, compID, _compID, *this); } |
153 | 0 | Position topRightComp (const ComponentID _compID) const { return recalcPosition(chromaFormat, compID, _compID, { (PosType) (x + width - 1), y }); } |
154 | 0 | Position bottomLeftComp (const ComponentID _compID) const { return recalcPosition(chromaFormat, compID, _compID, { x , (PosType) (y + height - 1 )}); } |
155 | 0 | Position bottomRightComp(const ComponentID _compID) const { return recalcPosition(chromaFormat, compID, _compID, { (PosType) (x + width - 1), (PosType) (y + height - 1 )}); } |
156 | | |
157 | 0 | bool valid() const { return chromaFormat < NUM_CHROMA_FORMAT && compID < MAX_NUM_TBLOCKS && width != 0 && height != 0; } |
158 | | |
159 | | const bool operator==(const CompArea& other) const |
160 | 0 | { |
161 | 0 | if (chromaFormat != other.chromaFormat) return false; |
162 | 0 | if (compID != other.compID) return false; |
163 | | |
164 | 0 | return Position::operator==(other) && Size::operator==(other); |
165 | 0 | } |
166 | | |
167 | 0 | const bool operator!=(const CompArea& other) const { return !(operator==(other)); } |
168 | | |
169 | 0 | void repositionTo (const Position& newPos) { Position::repositionTo(newPos); } |
170 | 0 | void positionRelativeTo(const CompArea& origCompArea) { Position::relativeTo(origCompArea); } |
171 | | |
172 | | private: |
173 | | |
174 | | void xRecalcLumaToChroma(); |
175 | | }; |
176 | | |
177 | | inline CompArea clipArea(const CompArea& compArea, const Area& boundingBox) |
178 | 0 | { |
179 | 0 | return CompArea(compArea.compID, compArea.chromaFormat, clipArea((const Area&) compArea, boundingBox)); |
180 | 0 | } |
181 | | |
182 | | // --------------------------------------------------------------------------- |
183 | | // unit definition |
184 | | // --------------------------------------------------------------------------- |
185 | | |
186 | | typedef static_vector<CompArea, MAX_NUM_TBLOCKS> UnitBlocksType; |
187 | | |
188 | | struct UnitArea |
189 | | { |
190 | | ChromaFormat chromaFormat; |
191 | | UnitBlocksType blocks; |
192 | | |
193 | 0 | UnitArea() : chromaFormat(NUM_CHROMA_FORMAT) { } |
194 | | UnitArea(const ChromaFormat _chromaFormat); |
195 | | UnitArea(const ChromaFormat _chromaFormat, const Area& area); |
196 | | UnitArea(const ChromaFormat _chromaFormat, const CompArea& blkY); |
197 | | UnitArea(const ChromaFormat _chromaFormat, CompArea&& blkY); |
198 | | UnitArea(const ChromaFormat _chromaFormat, const CompArea & blkY, const CompArea& blkCb, const CompArea& blkCr); |
199 | | UnitArea(const ChromaFormat _chromaFormat, CompArea&& blkY, CompArea&& blkCb, CompArea&& blkCr); |
200 | 0 | CompArea& Y() { return blocks[COMP_Y]; } |
201 | 0 | const CompArea& Y() const { return blocks[COMP_Y]; } |
202 | 0 | CompArea& Cb() { return blocks[COMP_Cb]; } |
203 | 0 | const CompArea& Cb() const { return blocks[COMP_Cb]; } |
204 | 0 | CompArea& Cr() { return blocks[COMP_Cr]; } |
205 | 0 | const CompArea& Cr() const { return blocks[COMP_Cr]; } |
206 | | |
207 | 0 | CompArea& block(const ComponentID comp) { return blocks[comp]; } |
208 | 0 | const CompArea& block(const ComponentID comp) const { return blocks[comp]; } |
209 | | |
210 | | bool contains(const UnitArea& other) const; |
211 | | bool contains(const UnitArea& other, const ChannelType chType) const; |
212 | | |
213 | 0 | CompArea& operator[]( const int n ) { return blocks[n]; } |
214 | 0 | const CompArea& operator[]( const int n ) const { return blocks[n]; } |
215 | | |
216 | | const bool operator==(const UnitArea& other) const |
217 | 0 | { |
218 | 0 | if (chromaFormat != other.chromaFormat) return false; |
219 | 0 | if (blocks.size() != other.blocks.size()) return false; |
220 | | |
221 | 0 | for (uint32_t i = 0; i < blocks.size(); i++) |
222 | 0 | { |
223 | 0 | if (blocks[i] != other.blocks[i]) return false; |
224 | 0 | } |
225 | | |
226 | 0 | return true; |
227 | 0 | } |
228 | | |
229 | | void repositionTo(const UnitArea& unit); |
230 | | |
231 | 0 | const bool operator!=(const UnitArea& other) const { return !(*this == other); } |
232 | | |
233 | 0 | const Position& lumaPos () const { return Y(); } |
234 | 0 | const Size& lumaSize() const { return Y(); } |
235 | | |
236 | 0 | const Position& chromaPos () const { return Cb(); } |
237 | 0 | const Size& chromaSize() const { return Cb(); } |
238 | | |
239 | | const UnitArea singleComp(const ComponentID compID) const; |
240 | | const UnitArea singleChan(const ChannelType chType) const; |
241 | | |
242 | 0 | const SizeType lwidth() const { return Y().width; } /*! luma width */ |
243 | 0 | const SizeType lheight() const { return Y().height; } /*! luma height */ |
244 | | |
245 | 0 | const PosType lx() const { return Y().x; } /*! luma x-pos */ |
246 | 0 | const PosType ly() const { return Y().y; } /*! luma y-pos */ |
247 | | |
248 | 0 | bool valid() const { return chromaFormat != NUM_CHROMA_FORMAT && blocks.size() > 0; } |
249 | | }; |
250 | | |
251 | | inline UnitArea clipArea(const UnitArea& area, const UnitArea& boundingBox) |
252 | 0 | { |
253 | 0 | UnitArea ret(area.chromaFormat); |
254 | |
|
255 | 0 | for (uint32_t i = 0; i < area.blocks.size(); i++) |
256 | 0 | { |
257 | 0 | ret.blocks.push_back(clipArea(area.blocks[i], boundingBox.blocks[i])); |
258 | 0 | } |
259 | |
|
260 | 0 | return ret; |
261 | 0 | } |
262 | | |
263 | | struct UnitAreaRelative : public UnitArea |
264 | | { |
265 | | UnitAreaRelative(const UnitArea& origUnit, const UnitArea& unit) |
266 | 0 | { |
267 | 0 | *((UnitArea*)this) = unit; |
268 | 0 | for(uint32_t i = 0; i < blocks.size(); i++) |
269 | 0 | { |
270 | 0 | blocks[i].positionRelativeTo(origUnit.blocks[i]); |
271 | 0 | } |
272 | 0 | } |
273 | | }; |
274 | | |
275 | | // --------------------------------------------------------------------------- |
276 | | // coding unit |
277 | | // --------------------------------------------------------------------------- |
278 | | |
279 | | } // namespace vvenc |
280 | | |
281 | | #define __IN_UNIT_H__ |
282 | | #include "Buffer.h" |
283 | | #undef __IN_UNIT_H__ |
284 | | |
285 | | namespace vvenc { |
286 | | |
287 | | struct TransformUnit; |
288 | | class CodingStructure; |
289 | | |
290 | | |
291 | | // --------------------------------------------------------------------------- |
292 | | // prediction unit |
293 | | // --------------------------------------------------------------------------- |
294 | | |
295 | | using MergeIdxPair = std::array<int8_t, 2>; |
296 | | |
297 | | struct IntraPredictionData |
298 | | { |
299 | | uint8_t intraDir[MAX_NUM_CH]; |
300 | | uint8_t multiRefIdx; |
301 | | bool mipTransposedFlag; |
302 | | }; |
303 | | |
304 | | struct InterPredictionData |
305 | | { |
306 | 0 | InterPredictionData() : mvdL0SubPu(nullptr) {} |
307 | | |
308 | | bool mergeFlag; |
309 | | bool ciip; |
310 | | bool mvRefine; |
311 | | bool mmvdMergeFlag; |
312 | | MmvdIdx mmvdMergeIdx; |
313 | | uint8_t mergeIdx; |
314 | | uint8_t geoSplitDir; |
315 | | MergeIdxPair |
316 | | geoMergeIdx; |
317 | | uint8_t interDir; |
318 | | uint8_t mcControl; // mmvd(bio), luma/chroma |
319 | | MergeType mergeType; |
320 | | Mv* mvdL0SubPu; |
321 | | |
322 | | uint8_t mvpIdx [NUM_REF_PIC_LIST_01]; |
323 | | uint8_t mvpNum [NUM_REF_PIC_LIST_01]; |
324 | | Mv mvd [NUM_REF_PIC_LIST_01][3]; |
325 | | Mv mv [NUM_REF_PIC_LIST_01][3]; |
326 | | int16_t refIdx [NUM_REF_PIC_LIST_01]; |
327 | | |
328 | 0 | bool mccNoBdof () const { return ( mcControl & 1 ) == 1; } |
329 | 0 | bool mccNoChroma () const { return ( mcControl >> 1 ) == 1; } |
330 | 0 | bool mccNoLuma () const { return ( mcControl > 3 ); } |
331 | | }; |
332 | | |
333 | | |
334 | | |
335 | | struct CodingUnit : public UnitArea, public IntraPredictionData, public InterPredictionData |
336 | | { |
337 | | CodingStructure* cs; |
338 | | Slice* slice; |
339 | | ChannelType chType; |
340 | | |
341 | | PredMode predMode; |
342 | | |
343 | | uint8_t depth; // number of all splits, applied with generalized splits |
344 | | uint8_t qtDepth; // number of applied quad-splits, before switching to the multi-type-tree (mtt) |
345 | | // a triple split would increase the mtDepth by 1, but the qtDepth by 2 in the first and last part and by 1 in the middle part (because of the 1-2-1 split proportions) |
346 | | uint8_t btDepth; // number of applied binary splits, after switching to the mtt (or it's equivalent) |
347 | | uint8_t mtDepth; // the actual number of splits after switching to mtt (equals btDepth if only binary splits are allowed) |
348 | | int8_t chromaQpAdj; |
349 | | int8_t qp; |
350 | | SplitSeries splitSeries; |
351 | | TreeType treeType; |
352 | | ModeType modeType; |
353 | | ModeTypeSeries modeTypeSeries; |
354 | | bool skip; |
355 | | bool mmvdSkip; |
356 | | bool colorTransform; |
357 | | bool geo; |
358 | | bool rootCbf; |
359 | | bool mipFlag; |
360 | | bool affine; |
361 | | uint8_t affineType; |
362 | | uint8_t imv; |
363 | | uint8_t sbtInfo; |
364 | | uint8_t mtsFlag; |
365 | | uint8_t lfnstIdx; |
366 | | uint8_t BcwIdx; |
367 | | int8_t imvNumCand; |
368 | | uint8_t smvdMode; |
369 | | uint8_t ispMode; |
370 | | uint8_t bdpcmM[MAX_NUM_CH]; |
371 | | uint32_t tileIdx; |
372 | | |
373 | | // needed for fast imv mode decisions |
374 | | |
375 | 0 | CodingUnit() = default; |
376 | | CodingUnit(const UnitArea& unit); |
377 | | CodingUnit(const ChromaFormat _chromaFormat, const Area& area); |
378 | | |
379 | | void initData(); |
380 | | void initPuData(); |
381 | | |
382 | | CodingUnit& operator= ( const CodingUnit& other ); |
383 | | CodingUnit& operator= ( const InterPredictionData& other); |
384 | | CodingUnit& operator= ( const IntraPredictionData& other); |
385 | | CodingUnit& operator= ( const MotionInfo& mi); |
386 | | |
387 | | // for accessing motion information, which can have higher resolution than PUs (should always be used, when accessing neighboring motion information) |
388 | | const MotionInfo& getMotionInfo () const; |
389 | | const MotionInfo& getMotionInfo ( const Position& pos ) const; |
390 | | MotionBuf getMotionBuf (); |
391 | | CMotionBuf getMotionBuf () const; |
392 | | |
393 | | |
394 | | unsigned idx; |
395 | | CodingUnit* next; |
396 | | |
397 | | TransformUnit* firstTU; |
398 | | TransformUnit* lastTU; |
399 | | }; |
400 | | |
401 | | // --------------------------------------------------------------------------- |
402 | | // transform unit |
403 | | // --------------------------------------------------------------------------- |
404 | | |
405 | | struct TransformUnit : public UnitArea |
406 | | { |
407 | | CodingUnit* cu; |
408 | | CodingStructure* cs; |
409 | | ChannelType chType; |
410 | | int chromaAdj; |
411 | | uint8_t depth; |
412 | | bool noResidual; |
413 | | uint8_t jointCbCr; |
414 | | uint8_t mtsIdx [ MAX_NUM_TBLOCKS ]; |
415 | | uint8_t cbf [ MAX_NUM_TBLOCKS ]; |
416 | | int16_t lastPos [ MAX_NUM_TBLOCKS ]; |
417 | | |
418 | | |
419 | | unsigned idx; |
420 | | TransformUnit* next; |
421 | | TransformUnit* prev; |
422 | | |
423 | 0 | TransformUnit () = default; |
424 | | TransformUnit ( const UnitArea& unit ); |
425 | | TransformUnit ( const ChromaFormat _chromaFormat, const Area& area ); |
426 | | void initData (); |
427 | | void init ( TCoeffSig **coeffs ); |
428 | | |
429 | | TransformUnit& operator= ( const TransformUnit& other ); |
430 | | void copyComponentFrom ( const TransformUnit& other, const ComponentID compID ); |
431 | | void checkTuNoResidual ( unsigned idx ); |
432 | | int getTbAreaAfterCoefZeroOut ( ComponentID compID ) const; |
433 | | |
434 | 0 | CoeffSigBuf getCoeffs ( ComponentID id ) { return CoeffSigBuf(m_coeffs[id], blocks[id]); } |
435 | 0 | const CCoeffSigBuf getCoeffs ( ComponentID id ) const { return CCoeffSigBuf(m_coeffs[id], blocks[id]); } |
436 | | |
437 | | private: |
438 | | friend CodingStructure; |
439 | | TCoeffSig* m_coeffs[ MAX_NUM_TBLOCKS ]; |
440 | | }; |
441 | | |
442 | | // --------------------------------------------------------------------------- |
443 | | // Utility class for easy for-each like unit traversing |
444 | | // --------------------------------------------------------------------------- |
445 | | |
446 | | template<typename T> |
447 | | class UnitIterator |
448 | | { |
449 | | private: |
450 | | T* m_punit = nullptr; |
451 | | |
452 | | public: |
453 | 0 | explicit UnitIterator( T* _punit ) : m_punit( _punit ) {}Unexecuted instantiation: vvenc::UnitIterator<vvenc::TransformUnit>::UnitIterator(vvenc::TransformUnit*) Unexecuted instantiation: vvenc::UnitIterator<vvenc::CodingUnit>::UnitIterator(vvenc::CodingUnit*) Unexecuted instantiation: vvenc::UnitIterator<vvenc::TransformUnit const>::UnitIterator(vvenc::TransformUnit const*) |
454 | | |
455 | | using iterator_category = std::forward_iterator_tag; |
456 | | using value_type = T; |
457 | | using pointer = T*; |
458 | | using const_pointer = T const*; |
459 | | using reference = T&; |
460 | | using const_reference = T const&; |
461 | | using difference_type = ptrdiff_t; |
462 | | |
463 | 0 | reference operator*() { return *m_punit; }Unexecuted instantiation: vvenc::UnitIterator<vvenc::TransformUnit>::operator*() Unexecuted instantiation: vvenc::UnitIterator<vvenc::CodingUnit>::operator*() Unexecuted instantiation: vvenc::UnitIterator<vvenc::TransformUnit const>::operator*() |
464 | | const_reference operator*() const { return *m_punit; } |
465 | | pointer operator->() { return m_punit; } |
466 | | const_pointer operator->() const { return m_punit; } |
467 | | |
468 | 0 | UnitIterator<T>& operator++() { m_punit = m_punit->next; return *this; }Unexecuted instantiation: vvenc::UnitIterator<vvenc::TransformUnit>::operator++() Unexecuted instantiation: vvenc::UnitIterator<vvenc::CodingUnit>::operator++() Unexecuted instantiation: vvenc::UnitIterator<vvenc::TransformUnit const>::operator++() |
469 | | UnitIterator<T> operator++( int ) { auto x = *this; ++( *this ); return x; } |
470 | 0 | bool operator!=( const UnitIterator<T>& other ) const { return m_punit != other.m_punit; }Unexecuted instantiation: vvenc::UnitIterator<vvenc::TransformUnit>::operator!=(vvenc::UnitIterator<vvenc::TransformUnit> const&) const Unexecuted instantiation: vvenc::UnitIterator<vvenc::CodingUnit>::operator!=(vvenc::UnitIterator<vvenc::CodingUnit> const&) const Unexecuted instantiation: vvenc::UnitIterator<vvenc::TransformUnit const>::operator!=(vvenc::UnitIterator<vvenc::TransformUnit const> const&) const |
471 | | bool operator==( const UnitIterator<T>& other ) const { return m_punit == other.m_punit; } |
472 | | }; |
473 | | |
474 | | template<typename T> |
475 | | class UnitTraverser |
476 | | { |
477 | | private: |
478 | | T* m_begin; |
479 | | T* m_end; |
480 | | |
481 | | public: |
482 | | UnitTraverser( ) : m_begin( nullptr ), m_end( nullptr ) { } |
483 | 0 | UnitTraverser( T* _begin, T* _end ) : m_begin( _begin ), m_end( _end ) { }Unexecuted instantiation: vvenc::UnitTraverser<vvenc::CodingUnit>::UnitTraverser(vvenc::CodingUnit*, vvenc::CodingUnit*) Unexecuted instantiation: vvenc::UnitTraverser<vvenc::TransformUnit>::UnitTraverser(vvenc::TransformUnit*, vvenc::TransformUnit*) Unexecuted instantiation: vvenc::UnitTraverser<vvenc::CodingUnit const>::UnitTraverser(vvenc::CodingUnit const*, vvenc::CodingUnit const*) Unexecuted instantiation: vvenc::UnitTraverser<vvenc::TransformUnit const>::UnitTraverser(vvenc::TransformUnit const*, vvenc::TransformUnit const*) |
484 | | |
485 | | typedef T value_type; |
486 | | typedef size_t size_type; |
487 | | typedef T& reference; |
488 | | typedef T const& const_reference; |
489 | | typedef T* pointer; |
490 | | typedef T const* const_pointer; |
491 | | typedef UnitIterator<T> iterator; |
492 | | typedef UnitIterator<const T> const_iterator; |
493 | | |
494 | 0 | iterator begin() { return UnitIterator<T>( m_begin ); }Unexecuted instantiation: vvenc::UnitTraverser<vvenc::TransformUnit>::begin() Unexecuted instantiation: vvenc::UnitTraverser<vvenc::CodingUnit>::begin() Unexecuted instantiation: vvenc::UnitTraverser<vvenc::TransformUnit const>::begin() |
495 | | const_iterator begin() const { return UnitIterator<T>( m_begin ); } |
496 | | const_iterator cbegin() const { return UnitIterator<T>( m_begin ); } |
497 | 0 | iterator end() { return UnitIterator<T>( m_end ); }Unexecuted instantiation: vvenc::UnitTraverser<vvenc::TransformUnit>::end() Unexecuted instantiation: vvenc::UnitTraverser<vvenc::CodingUnit>::end() Unexecuted instantiation: vvenc::UnitTraverser<vvenc::TransformUnit const>::end() |
498 | | const_iterator end() const { return UnitIterator<T>( m_end ); } |
499 | | const_iterator cend() const { return UnitIterator<T>( m_end ); } |
500 | | }; |
501 | | |
502 | | typedef UnitTraverser<CodingUnit> CUTraverser; |
503 | | typedef UnitTraverser<TransformUnit> TUTraverser; |
504 | | |
505 | | typedef UnitTraverser<const CodingUnit> cCUTraverser; |
506 | | typedef UnitTraverser<const TransformUnit> cTUTraverser; |
507 | | |
508 | | } // namespace vvenc |
509 | | |
510 | | //! \} |
511 | | |