| 43 | { |
| 44 | |
| 45 | vector4d<int> calcDiagScanOrder() |
| 46 | { |
| 47 | vector4d<int> DiagScanOrder; |
| 48 | for (unsigned log2BlockWidth = 0; log2BlockWidth < 4; log2BlockWidth++) |
| 49 | { |
| 50 | DiagScanOrder.push_back({}); |
| 51 | for (unsigned log2BlockHeight = 0; log2BlockHeight < 4; log2BlockHeight++) |
| 52 | { |
| 53 | DiagScanOrder[log2BlockWidth].push_back({}); |
| 54 | auto blkWidth = 1u << log2BlockWidth; |
| 55 | auto blkHeight = 1u << log2BlockHeight; |
| 56 | // 6.5.2 (24) |
| 57 | unsigned i = 0; |
| 58 | int x = 0; |
| 59 | int y = 0; |
| 60 | bool stopLoop = false; |
| 61 | while (!stopLoop) |
| 62 | { |
| 63 | while (y >= 0) |
| 64 | { |
| 65 | if (x < int(blkWidth) && y < int(blkHeight)) |
| 66 | { |
| 67 | DiagScanOrder[log2BlockWidth][log2BlockHeight].push_back({x, y}); |
| 68 | i++; |
| 69 | } |
| 70 | y--; |
| 71 | x++; |
| 72 | } |
| 73 | y = x; |
| 74 | x = 0; |
| 75 | if (i >= blkWidth * blkHeight) |
| 76 | stopLoop = true; |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | return DiagScanOrder; |
| 81 | } |
| 82 | |
| 83 | } // namespace |
| 84 | |