How to use InclusionTree method in wpt

Best JavaScript code snippet using wpt

jpx.js

Source:jpx.js Github

copy

Full Screen

...1092 } else {1093 // building inclusion and zero bit-planes trees1094 var width = precinct.cbxMax - precinct.cbxMin + 1;1095 var height = precinct.cbyMax - precinct.cbyMin + 1;1096 inclusionTree = new InclusionTree(width, height, layerNumber);1097 zeroBitPlanesTree = new TagTree(width, height);1098 precinct.inclusionTree = inclusionTree;1099 precinct.zeroBitPlanesTree = zeroBitPlanesTree;1100 }1101 if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {1102 while (true) {1103 if (readBits(1)) {1104 valueReady = !inclusionTree.nextLevel();1105 if (valueReady) {1106 codeblock.included = true;1107 codeblockIncluded = firstTimeInclusion = true;1108 break;1109 }1110 } else {1111 inclusionTree.incrementValue(layerNumber);1112 break;1113 }1114 }1115 }1116 }1117 if (!codeblockIncluded) {1118 continue;1119 }1120 if (firstTimeInclusion) {1121 zeroBitPlanesTree = precinct.zeroBitPlanesTree;1122 zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);1123 while (true) {1124 if (readBits(1)) {1125 valueReady = !zeroBitPlanesTree.nextLevel();1126 if (valueReady) {1127 break;1128 }1129 } else {1130 zeroBitPlanesTree.incrementValue();1131 }1132 }1133 codeblock.zeroBitPlanes = zeroBitPlanesTree.value;1134 }1135 var codingpasses = readCodingpasses();1136 while (readBits(1)) {1137 codeblock.Lblock++;1138 }1139 var codingpassesLog2 = log2(codingpasses);1140 // rounding down log21141 var bits = ((codingpasses < (1 << codingpassesLog2)) ?1142 codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;1143 var codedDataLength = readBits(bits);1144 queue.push({1145 codeblock: codeblock,1146 codingpasses: codingpasses,1147 dataLength: codedDataLength1148 });1149 }1150 alignToByte();1151 if (ephMarkerUsed) {1152 skipMarkerIfEqual(0x92);1153 }1154 while (queue.length > 0) {1155 var packetItem = queue.shift();1156 codeblock = packetItem.codeblock;1157 if (codeblock['data'] === undefined) {1158 codeblock.data = [];1159 }1160 codeblock.data.push({1161 data: data,1162 start: offset + position,1163 end: offset + position + packetItem.dataLength,1164 codingpasses: packetItem.codingpasses1165 });1166 position += packetItem.dataLength;1167 }1168 }1169 return position;1170 }1171 function copyCoefficients(coefficients, levelWidth, levelHeight, subband,1172 delta, mb, reversible, segmentationSymbolUsed) {1173 var x0 = subband.tbx0;1174 var y0 = subband.tby0;1175 var width = subband.tbx1 - subband.tbx0;1176 var codeblocks = subband.codeblocks;1177 var right = subband.type.charAt(0) === 'H' ? 1 : 0;1178 var bottom = subband.type.charAt(1) === 'H' ? levelWidth : 0;1179 for (var i = 0, ii = codeblocks.length; i < ii; ++i) {1180 var codeblock = codeblocks[i];1181 var blockWidth = codeblock.tbx1_ - codeblock.tbx0_;1182 var blockHeight = codeblock.tby1_ - codeblock.tby0_;1183 if (blockWidth === 0 || blockHeight === 0) {1184 continue;1185 }1186 if (codeblock['data'] === undefined) {1187 continue;1188 }1189 var bitModel, currentCodingpassType;1190 bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType,1191 codeblock.zeroBitPlanes, mb);1192 currentCodingpassType = 2; // first bit plane starts from cleanup1193 // collect data1194 var data = codeblock.data, totalLength = 0, codingpasses = 0;1195 var j, jj, dataItem;1196 for (j = 0, jj = data.length; j < jj; j++) {1197 dataItem = data[j];1198 totalLength += dataItem.end - dataItem.start;1199 codingpasses += dataItem.codingpasses;1200 }1201 var encodedData = new Uint8Array(totalLength);1202 var position = 0;1203 for (j = 0, jj = data.length; j < jj; j++) {1204 dataItem = data[j];1205 var chunk = dataItem.data.subarray(dataItem.start, dataItem.end);1206 encodedData.set(chunk, position);1207 position += chunk.length;1208 }1209 // decoding the item1210 var decoder = new ArithmeticDecoder(encodedData, 0, totalLength);1211 bitModel.setDecoder(decoder);1212 for (j = 0; j < codingpasses; j++) {1213 switch (currentCodingpassType) {1214 case 0:1215 bitModel.runSignificancePropogationPass();1216 break;1217 case 1:1218 bitModel.runMagnitudeRefinementPass();1219 break;1220 case 2:1221 bitModel.runCleanupPass();1222 if (segmentationSymbolUsed) {1223 bitModel.checkSegmentationSymbol();1224 }1225 break;1226 }1227 currentCodingpassType = (currentCodingpassType + 1) % 3;1228 }1229 var offset = (codeblock.tbx0_ - x0) + (codeblock.tby0_ - y0) * width;1230 var sign = bitModel.coefficentsSign;1231 var magnitude = bitModel.coefficentsMagnitude;1232 var bitsDecoded = bitModel.bitsDecoded;1233 var magnitudeCorrection = reversible ? 0 : 0.5;1234 var k, n, nb;1235 position = 0;1236 // Do the interleaving of Section F.3.3 here, so we do not need1237 // to copy later. LL level is not interleaved, just copied.1238 var interleave = (subband.type !== 'LL');1239 for (j = 0; j < blockHeight; j++) {1240 var row = (offset / width) | 0; // row in the non-interleaved subband1241 var levelOffset = 2 * row * (levelWidth - width) + right + bottom;1242 for (k = 0; k < blockWidth; k++) {1243 n = magnitude[position];1244 if (n !== 0) {1245 n = (n + magnitudeCorrection) * delta;1246 if (sign[position] !== 0) {1247 n = -n;1248 }1249 nb = bitsDecoded[position];1250 var pos = interleave ? (levelOffset + (offset << 1)) : offset;1251 if (reversible && (nb >= mb)) {1252 coefficients[pos] = n;1253 } else {1254 coefficients[pos] = n * (1 << (mb - nb));1255 }1256 }1257 offset++;1258 position++;1259 }1260 offset += width - blockWidth;1261 }1262 }1263 }1264 function transformTile(context, tile, c) {1265 var component = tile.components[c];1266 var codingStyleParameters = component.codingStyleParameters;1267 var quantizationParameters = component.quantizationParameters;1268 var decompositionLevelsCount =1269 codingStyleParameters.decompositionLevelsCount;1270 var spqcds = quantizationParameters.SPqcds;1271 var scalarExpounded = quantizationParameters.scalarExpounded;1272 var guardBits = quantizationParameters.guardBits;1273 var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;1274 var precision = context.components[c].precision;1275 var reversible = codingStyleParameters.reversibleTransformation;1276 var transform = (reversible ? new ReversibleTransform() :1277 new IrreversibleTransform());1278 var subbandCoefficients = [];1279 var b = 0;1280 for (var i = 0; i <= decompositionLevelsCount; i++) {1281 var resolution = component.resolutions[i];1282 var width = resolution.trx1 - resolution.trx0;1283 var height = resolution.try1 - resolution.try0;1284 // Allocate space for the whole sublevel.1285 var coefficients = new Float32Array(width * height);1286 for (var j = 0, jj = resolution.subbands.length; j < jj; j++) {1287 var mu, epsilon;1288 if (!scalarExpounded) {1289 // formula E-51290 mu = spqcds[0].mu;1291 epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);1292 } else {1293 mu = spqcds[b].mu;1294 epsilon = spqcds[b].epsilon;1295 b++;1296 }1297 var subband = resolution.subbands[j];1298 var gainLog2 = SubbandsGainLog2[subband.type];1299 // calulate quantization coefficient (Section E.1.1.1)1300 var delta = (reversible ? 1 :1301 Math.pow(2, precision + gainLog2 - epsilon) * (1 + mu / 2048));1302 var mb = (guardBits + epsilon - 1);1303 // In the first resolution level, copyCoefficients will fill the1304 // whole array with coefficients. In the succeding passes,1305 // copyCoefficients will consecutively fill in the values that belong1306 // to the interleaved positions of the HL, LH, and HH coefficients.1307 // The LL coefficients will then be interleaved in Transform.iterate().1308 copyCoefficients(coefficients, width, height, subband, delta, mb,1309 reversible, segmentationSymbolUsed);1310 }1311 subbandCoefficients.push({1312 width: width,1313 height: height,1314 items: coefficients1315 });1316 }1317 var result = transform.calculate(subbandCoefficients,1318 component.tcx0, component.tcy0);1319 return {1320 left: component.tcx0,1321 top: component.tcy0,1322 width: result.width,1323 height: result.height,1324 items: result.items1325 };1326 }1327 function transformComponents(context) {1328 var siz = context.SIZ;1329 var components = context.components;1330 var componentsCount = siz.Csiz;1331 var resultImages = [];1332 for (var i = 0, ii = context.tiles.length; i < ii; i++) {1333 var tile = context.tiles[i];1334 var transformedTiles = [];1335 var c;1336 for (c = 0; c < componentsCount; c++) {1337 transformedTiles[c] = transformTile(context, tile, c);1338 }1339 var tile0 = transformedTiles[0];1340 var out = new Uint8Array(tile0.items.length * componentsCount);1341 var result = {1342 left: tile0.left,1343 top: tile0.top,1344 width: tile0.width,1345 height: tile0.height,1346 items: out1347 };1348 // Section G.2.2 Inverse multi component transform1349 var shift, offset, max, min, maxK;1350 var pos = 0, j, jj, y0, y1, y2, r, g, b, k, val;1351 if (tile.codingStyleDefaultParameters.multipleComponentTransform) {1352 var fourComponents = componentsCount === 4;1353 var y0items = transformedTiles[0].items;1354 var y1items = transformedTiles[1].items;1355 var y2items = transformedTiles[2].items;1356 var y3items = fourComponents ? transformedTiles[3].items : null;1357 // HACK: The multiple component transform formulas below assume that1358 // all components have the same precision. With this in mind, we1359 // compute shift and offset only once.1360 shift = components[0].precision - 8;1361 offset = (128 << shift) + 0.5;1362 max = 255 * (1 << shift);1363 maxK = max * 0.5;1364 min = -maxK;1365 var component0 = tile.components[0];1366 var alpha01 = componentsCount - 3;1367 jj = y0items.length;1368 if (!component0.codingStyleParameters.reversibleTransformation) {1369 // inverse irreversible multiple component transform1370 for (j = 0; j < jj; j++, pos += alpha01) {1371 y0 = y0items[j] + offset;1372 y1 = y1items[j];1373 y2 = y2items[j];1374 r = y0 + 1.402 * y2;1375 g = y0 - 0.34413 * y1 - 0.71414 * y2;1376 b = y0 + 1.772 * y1;1377 out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;1378 out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;1379 out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;1380 }1381 } else {1382 // inverse reversible multiple component transform1383 for (j = 0; j < jj; j++, pos += alpha01) {1384 y0 = y0items[j] + offset;1385 y1 = y1items[j];1386 y2 = y2items[j];1387 g = y0 - ((y2 + y1) >> 2);1388 r = g + y2;1389 b = g + y1;1390 out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;1391 out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;1392 out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;1393 }1394 }1395 if (fourComponents) {1396 for (j = 0, pos = 3; j < jj; j++, pos += 4) {1397 k = y3items[j];1398 out[pos] = k <= min ? 0 : k >= maxK ? 255 : (k + offset) >> shift;1399 }1400 }1401 } else { // no multi-component transform1402 for (c = 0; c < componentsCount; c++) {1403 var items = transformedTiles[c].items;1404 shift = components[c].precision - 8;1405 offset = (128 << shift) + 0.5;1406 max = (127.5 * (1 << shift));1407 min = -max;1408 for (pos = c, j = 0, jj = items.length; j < jj; j++) {1409 val = items[j];1410 out[pos] = val <= min ? 0 :1411 val >= max ? 255 : (val + offset) >> shift;1412 pos += componentsCount;1413 }1414 }1415 }1416 resultImages.push(result);1417 }1418 return resultImages;1419 }1420 function initializeTile(context, tileIndex) {1421 var siz = context.SIZ;1422 var componentsCount = siz.Csiz;1423 var tile = context.tiles[tileIndex];1424 for (var c = 0; c < componentsCount; c++) {1425 var component = tile.components[c];1426 var qcdOrQcc = (context.currentTile.QCC[c] !== undefined ?1427 context.currentTile.QCC[c] : context.currentTile.QCD);1428 component.quantizationParameters = qcdOrQcc;1429 var codOrCoc = (context.currentTile.COC[c] !== undefined ?1430 context.currentTile.COC[c] : context.currentTile.COD);1431 component.codingStyleParameters = codOrCoc;1432 }1433 tile.codingStyleDefaultParameters = context.currentTile.COD;1434 }1435 // Section B.10.2 Tag trees1436 var TagTree = (function TagTreeClosure() {1437 function TagTree(width, height) {1438 var levelsLength = log2(Math.max(width, height)) + 1;1439 this.levels = [];1440 for (var i = 0; i < levelsLength; i++) {1441 var level = {1442 width: width,1443 height: height,1444 items: []1445 };1446 this.levels.push(level);1447 width = Math.ceil(width / 2);1448 height = Math.ceil(height / 2);1449 }1450 }1451 TagTree.prototype = {1452 reset: function TagTree_reset(i, j) {1453 var currentLevel = 0, value = 0, level;1454 while (currentLevel < this.levels.length) {1455 level = this.levels[currentLevel];1456 var index = i + j * level.width;1457 if (level.items[index] !== undefined) {1458 value = level.items[index];1459 break;1460 }1461 level.index = index;1462 i >>= 1;1463 j >>= 1;1464 currentLevel++;1465 }1466 currentLevel--;1467 level = this.levels[currentLevel];1468 level.items[level.index] = value;1469 this.currentLevel = currentLevel;1470 delete this.value;1471 },1472 incrementValue: function TagTree_incrementValue() {1473 var level = this.levels[this.currentLevel];1474 level.items[level.index]++;1475 },1476 nextLevel: function TagTree_nextLevel() {1477 var currentLevel = this.currentLevel;1478 var level = this.levels[currentLevel];1479 var value = level.items[level.index];1480 currentLevel--;1481 if (currentLevel < 0) {1482 this.value = value;1483 return false;1484 }1485 this.currentLevel = currentLevel;1486 level = this.levels[currentLevel];1487 level.items[level.index] = value;1488 return true;1489 }1490 };1491 return TagTree;1492 })();1493 var InclusionTree = (function InclusionTreeClosure() {1494 function InclusionTree(width, height, defaultValue) {1495 var levelsLength = log2(Math.max(width, height)) + 1;1496 this.levels = [];1497 for (var i = 0; i < levelsLength; i++) {1498 var items = new Uint8Array(width * height);1499 for (var j = 0, jj = items.length; j < jj; j++) {1500 items[j] = defaultValue;1501 }1502 var level = {1503 width: width,1504 height: height,1505 items: items1506 };1507 this.levels.push(level);1508 width = Math.ceil(width / 2);...

Full Screen

Full Screen

termPicker.dialog.ts

Source:termPicker.dialog.ts Github

copy

Full Screen

1import {OnInit, Input, Component, ViewChild} from '@angular/core';2import {NgbModal, NgbActiveModal, NgbTabChangeEvent} from '@ng-bootstrap/ng-bootstrap';3import {ITreeOptions, TreeComponent} from 'angular2-tree-component';4import {CodeSetValue} from '../codeSet/models/CodeSetValue';5import {Term} from './models/Term';6import {TermService} from './term.service';7import {LoggerService} from 'eds-common-js';8import {ExclusionTreeNode} from './models/ExclusionTreeNode';9import {InclusionTreeNode} from './models/InclusionTreeNode';10@Component({11 selector: 'ngbd-modal-content',12 template: require('./termPicker.html')13})14export class TermPickerDialog implements OnInit {15 public static open(modalService: NgbModal, selection: CodeSetValue[]) {16 const modalRef = modalService.open(TermPickerDialog, {backdrop: 'static', size: 'lg'});17 modalRef.componentInstance.resultData = selection;18 return modalRef;19 }20 @Input() resultData;21 options: ITreeOptions;22 highlightedMatch: CodeSetValue;23 previousSelection: CodeSetValue;24 highlightedSelection: CodeSetValue;25 snomed: string = '';26 treeCount: number = 0;27 searchTerm: string;28 searchTerms: Term[] = [];29 parents: Term[];30 children: Term[];31 termCache: any;32 exclusionTreeData: ExclusionTreeNode[];33 inclusionTreeData: InclusionTreeNode[];34 selectedCodes: any[];35 @ViewChild('inclusionTree')36 inclusionTree: TreeComponent;37 constructor(private logger: LoggerService,38 protected activeModal: NgbActiveModal,39 private termService: TermService) {40 this.termCache = {};41 this.options = {42 childrenField: 'children',43 idField: 'id'44 };45 }46 ngOnInit(): void {47 this.inclusionTreeData = [];48 this.selectedCodes = [];49 for (const term of this.resultData) {50 let rootNode: InclusionTreeNode = {51 id: term.code,52 name: term.term,53 recordType: term.baseType,54 checked: true,55 indeterminate: false,56 children: []57 } as InclusionTreeNode;58 this.selectedCodes.push(term.code);59 this.inclusionTreeData.push(rootNode);60 this.inclusionTree.treeModel.update();61 }62 }63 search() {64 let vm = this;65 vm.searchTerms = null;66 vm.termService.getTerms(vm.searchTerm, vm.snomed)67 .subscribe(68 (result) => {69 console.log(result);70 vm.searchTerms = result;71 vm.parents = [];72 vm.children = [];73 },74 (error) => vm.searchTerms = []);75 }76 displayCode(itemToDisplay: Term, replace: boolean) {77 let vm = this;78 if (replace) {79 vm.searchTerms = [itemToDisplay];80 }81 vm.termService.getTermChildren(itemToDisplay.snomedConceptId)82 .subscribe(83 (result) => vm.children = result84 );85 vm.termService.getTermParents(itemToDisplay.snomedConceptId)86 .subscribe(87 (result) => vm.parents = result88 );89 }90 addChildren(match: Term, rootNode: InclusionTreeNode) {91 let vm = this;92 vm.termService.getTermChildren(match.snomedConceptId)93 .subscribe(94 (result) => {95 result.forEach((child) => {96 let childNode: InclusionTreeNode = {97 id: child.snomedConceptId,98 name: child.originalTerm,99 recordType: child.recordType,100 checked: true,101 indeterminate: false,102 children: []103 } as InclusionTreeNode;104 if (this.selectedCodes.indexOf(child.snomedConceptId) > -1)105 return;106 this.selectedCodes.push(child.snomedConceptId);107 rootNode.children.push(childNode);108 this.inclusionTree.treeModel.update();109 this.treeCount++;110 this.addChildren(child, childNode);111 });112 });113 }114 addToSelection(match: Term) {115 let vm = this;116 for (var i = 0; i < this.resultData.length; ++i) {117 var baseType = this.resultData[i].baseType;118 if (baseType != match.recordType) {119 this.logger.error('Each rule must have concepts of the same base type (i.e. Patient and Observation concepts cannot be mixed in the same rule)');120 return;121 }122 }123 let rootNode: InclusionTreeNode = {124 id: match.snomedConceptId,125 name: match.originalTerm,126 recordType: match.recordType,127 checked: true,128 indeterminate: false,129 children: []130 } as InclusionTreeNode;131 this.addChildren(match, rootNode);132 if (this.selectedCodes.indexOf(match.snomedConceptId) > -1) {133 this.logger.error('Term already selected');134 return;135 }136 this.selectedCodes.push(match.snomedConceptId);137 this.inclusionTreeData.push(rootNode);138 this.inclusionTree.treeModel.update();139 this.treeCount++;140 }141 check(node, checked) {142 this.updateChildNodeCheckbox(node, checked);143 this.updateParentNodeCheckbox(node.realParent);144 }145 updateChildNodeCheckbox(node, checked) {146 node.data.checked = checked;147 if (node.children) {148 node.children.forEach((child) => this.updateChildNodeCheckbox(child, checked));149 }150 }151 updateParentNodeCheckbox(node) {152 if (!node) {153 return;154 }155 let allChildrenChecked = true;156 let noChildChecked = true;157 for (const child of node.children) {158 if (!child.data.checked || child.data.indeterminate) {159 allChildrenChecked = false;160 }161 if (child.data.checked) {162 noChildChecked = false;163 }164 }165 if (allChildrenChecked) {166 node.data.checked = true;167 node.data.indeterminate = false;168 node.indeterminate = false;169 } else if (noChildChecked) {170 node.data.checked = true;171 node.data.indeterminate = false;172 node.indeterminate = false;173 } else {174 node.data.checked = false;175 node.data.indeterminate = true;176 node.indeterminate = true;177 }178 this.updateParentNodeCheckbox(node.parent);179 }180 setResultData(node) {181 let item: CodeSetValue = {182 code: node.id,183 includeChildren: true,184 term: node.name,185 dataType: 11,186 parentType: '',187 baseType: node.recordType,188 present: '1',189 valueFrom: '',190 valueTo: '',191 units: '',192 exclusion: []193 };194 this.resultData.push(item);195 }196 updateResultData() {197 this.resultData = [];198 this.inclusionTreeData.forEach((node) => {199 this.updateChildren(node);200 }201 );202 }203 updateChildren(node) {204 if (node.checked || node.indeterminate)205 this.setResultData(node);206 if (node.children) {207 node.children.forEach((child) => this.updateChildren(child));208 }209 }210 ok() {211 this.updateResultData();212 console.log(this.resultData);213 this.activeModal.close(this.resultData);214 console.log('OK Pressed');215 }216 cancel() {217 this.activeModal.dismiss('cancel');218 console.log('Cancel Pressed');219 }...

Full Screen

Full Screen

jpipsubbandlengthinpacketheadercalculator.js

Source:jpipsubbandlengthinpacketheadercalculator.js Github

copy

Full Screen

1'use strict';2var JpipSubbandLengthInPacketHeaderCalculator =3 function JpipSubbandLengthInPacketHeaderCalcualtorClosure(4 bitstreamReader,5 numCodeblocksX,6 numCodeblocksY,7 codingPassesNumberParser,8 transactionHelper,9 jpipFactory) {10 11 var codeblockLengthParsers = null;12 var isCodeblocksIncluded = null;13 var parsedQualityLayers = transactionHelper.createTransactionalObject(14 0, /*isValueType=*/true);15 16 var inclusionTree = jpipFactory.createTagTree(17 bitstreamReader, numCodeblocksX, numCodeblocksY);18 19 var zeroBitPlanesTree = jpipFactory.createTagTree(20 bitstreamReader, numCodeblocksX, numCodeblocksY);21 22 this.calculateSubbandLength = function calcualteSubbandLength(qualityLayer) {23 ensureQualityLayerNotParsedYet(qualityLayer);24 25 lazyInitArrays();26 27 inclusionTree.setMinimalValueIfNotReadBits(qualityLayer);28 29 var accumulatedBodyLengthBytes = 0;30 var codeblockIndex = 0;31 var codeblockLengthByIndex = new Array(numCodeblocksX * numCodeblocksY);32 33 for (var y = 0; y < numCodeblocksY; ++y) {34 for (var x = 0; x < numCodeblocksX; ++x) {35 var codeblockBodyLength = getNextCodeblockLength(x, y, qualityLayer);36 if (codeblockBodyLength === null) {37 return null;38 }39 40 codeblockLengthByIndex[codeblockIndex++] = codeblockBodyLength;41 42 accumulatedBodyLengthBytes +=43 codeblockBodyLength.codeblockBodyLengthBytes;44 }45 }46 47 parsedQualityLayers.setValue(48 bitstreamReader.activeTransaction, qualityLayer + 1);49 50 return {51 codeblockBodyLengthByIndex: codeblockLengthByIndex,52 overallBodyLengthBytes: accumulatedBodyLengthBytes53 };54 };55 56 function ensureQualityLayerNotParsedYet(qualityLayer) {57 var parsedQualityLayersValue = parsedQualityLayers.getValue(58 bitstreamReader.activeTransaction);59 60 if (parsedQualityLayersValue >= qualityLayer + 1) {61 throw new jpipExceptions.InternalErrorException(62 'Unexpected quality layer to parse');63 }64 }65 66 function lazyInitArrays() {67 if (codeblockLengthParsers !== null) {68 return;69 }70 71 codeblockLengthParsers = new Array(numCodeblocksX);72 isCodeblocksIncluded = new Array(numCodeblocksX);73 74 for (var x = 0; x < numCodeblocksX; ++x) {75 codeblockLengthParsers[x] = new Array(numCodeblocksY);76 isCodeblocksIncluded[x] = new Array(numCodeblocksY);77 78 for (var y = 0; y < numCodeblocksY; ++y) {79 codeblockLengthParsers[x][y] =80 jpipFactory.createCodeblockLengthParser(81 bitstreamReader, transactionHelper);82 83 isCodeblocksIncluded[x][y] = transactionHelper84 .createTransactionalObject({ isIncluded: false });85 }86 }87 }88 89 function getNextCodeblockLength(x, y, qualityLayer) {90 var isCodeblockAlreadyIncluded = isCodeblocksIncluded[x][y].getValue(91 bitstreamReader.activeTransaction);92 93 var isCodeblockIncludedNow;94 if (isCodeblockAlreadyIncluded.isIncluded) {95 isCodeblockIncludedNow = bitstreamReader.shiftBit();96 } else {97 isCodeblockIncludedNow = inclusionTree.isSmallerThanOrEqualsTo(98 x, y, qualityLayer);99 }100 101 if (isCodeblockIncludedNow === null) {102 return null;103 } else if (!isCodeblockIncludedNow) {104 return {105 codeblockBodyLengthBytes: 0,106 codingPasses: 0107 };108 }109 110 var zeroBitPlanes = null;111 if (!isCodeblockAlreadyIncluded.isIncluded) {112 zeroBitPlanes = zeroBitPlanesTree.getValue(x, y);113 if (zeroBitPlanes === null) {114 return null;115 }116 }117 118 var codingPasses = codingPassesNumberParser.parse(bitstreamReader);119 if (codingPasses === null) {120 return null;121 }122 123 var lengthParser = codeblockLengthParsers[x][y];124 var bodyLengthBytes = lengthParser.parse(codingPasses);125 126 if (bodyLengthBytes === null) {127 return null;128 }129 130 isCodeblockAlreadyIncluded.isIncluded = true;131 132 var result = {133 codeblockBodyLengthBytes: bodyLengthBytes,134 codingPasses: codingPasses135 };136 137 if (zeroBitPlanes !== null) {138 result.zeroBitPlanes = zeroBitPlanes;139 }140 141 return result;142 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var InclusionTree = require('wpt').InclusionTree;2var tree = new InclusionTree();3tree.add('a', 'b');4tree.add('a', 'c');5tree.add('a', 'd');6tree.add('b', 'd');7tree.add('c', 'd');8tree.add('c', 'e');9tree.add('d', 'e');10tree.add('d', 'f');11tree.add('e', 'f');12tree.add('e', 'g');13tree.add('f', 'g');14tree.add('f', 'h');15tree.add('g', 'h');16var result = tree.get('a');17console.log(result);

Full Screen

Using AI Code Generation

copy

Full Screen

1var InclusionTree = require('./inclusionTree.js');2var it = new InclusionTree();3it.add('a', 'b');4it.add('a', 'c');5it.add('b', 'd');6it.add('d', 'e');7it.add('e', 'f');8it.add('f', 'g');9it.add('g', 'h');10it.add('h', 'i');11it.add('i', 'j');12it.add('j', 'k');13it.add('k', 'l');14it.add('l', 'm');15it.add('m', 'n');16it.add('n', 'o');17it.add('o', 'p');18it.add('p', 'q');19it.add('q', 'r');20it.add('r', 's');21it.add('s', 't');22it.add('t', 'u');23it.add('u', 'v');24it.add('v', 'w');25it.add('w', 'x');26it.add('x', 'y');27it.add('y', 'z');28it.add('z', 'aa');29it.add('aa', 'ab');30it.add('ab', 'ac');31it.add('ac', 'ad');32it.add('ad', 'ae');33it.add('ae', 'af');34it.add('af', 'ag');35it.add('ag', 'ah');36it.add('ah', 'ai');37it.add('ai', 'aj');38it.add('aj', 'ak');39it.add('ak', 'al');40it.add('al', 'am');41it.add('am', 'an');42it.add('an', 'ao');43it.add('ao', 'ap');44it.add('ap', 'aq');45it.add('aq', 'ar');46it.add('ar', 'as');47it.add('as', 'at');48it.add('at', 'au');49it.add('au', 'av');50it.add('av', 'aw');51it.add('aw', 'ax');52it.add('ax', 'ay');53it.add('ay', 'az');54it.add('az', 'ba');55it.add('ba', 'bb');56it.add('bb', 'bc');57it.add('bc', 'bd');58it.add('bd', 'be');59it.add('be', 'bf');60it.add('bf', 'bg');61it.add('bg', 'bh');62it.add('bh', '

Full Screen

Using AI Code Generation

copy

Full Screen

1var InclusionTree = require('../lib/inclusionTree.js');2var it = new InclusionTree();3it.addDependency('a', 'b');4it.addDependency('b', 'c');5it.addDependency('c', 'd');6it.addDependency('c', 'e');7console.log(it.getDependencies('a'));8console.log(it.getDependencies('b'));9console.log(it.getDependencies('c'));10console.log(it.getDependencies('d'));11console.log(it.getDependencies('e'));12console.log(it.getDependents('a'));13console.log(it.getDependents('b'));14console.log(it.getDependents('c'));15console.log(it.getDependents('d'));16console.log(it.getDependents('e'));17console.log(it.getDependencies('a', true));18console.log(it.getDependencies('b', true));19console.log(it.getDependencies('c', true));20console.log(it.getDependencies('d', true));21console.log(it.getDependencies('e', true));22console.log(it.getDependents('a', true));23console.log(it.getDependents('b', true));24console.log(it.getDependents('c', true));25console.log(it.getDependents('d', true));26console.log(it.getDependents('e', true));27console.log(it.getDependencies('a', false, true));28console.log(it.getDependencies('b', false, true));29console.log(it.getDependencies('c', false, true));30console.log(it.getDependencies('d', false, true));31console.log(it.getDependencies('e', false

Full Screen

Using AI Code Generation

copy

Full Screen

1function run_test()2{3 { path: "/foo/bar.js",4 expected: "bar.js" },5 { path: "/foo/bar/baz.js",6 expected: "bar/baz.js" },7 { path: "/foo/bar/baz/",8 expected: "bar/baz/" },9 { path: "/foo/bar/baz",10 expected: "bar/baz/" },11 { path: "/foo/bar/baz/",12 expected: "bar/baz/" },13 { path: "/foo/bar/baz/../bar.js",14 expected: "bar/bar.js" },15 { path: "/foo/bar/baz/../../bar.js",16 expected: "bar.js" },17 { path: "/foo/bar/baz/../../../bar.js",18 expected: "bar.js" },19 { path: "/foo/bar/baz/../../../../bar.js",20 expected: "bar.js" },21 { path: "/foo/bar/baz/../../bar.js",22 expected: "bar.js" },23 { path: "/foo/bar/baz/../../bar.js",24 expected: "bar.js" },25 { path: "/foo/bar/baz/../../bar.js",26 expected: "bar.js" },27 { path: "/foo/bar/baz/../../bar.js",28 expected: "bar.js" },29 { path: "/foo/bar/baz/../../bar.js",30 expected: "bar.js" },31 { path: "/foo/bar/baz/../../bar.js",32 expected: "bar.js" },33 { path: "/foo/bar/baz/../../bar.js",34 expected: "bar.js" },35 { path: "/foo/bar/baz/../../../bar.js",36 expected: "bar.js" },37 { path: "/foo/bar/baz/../../../../bar.js",38 expected: "bar.js" },39 { path: "/foo/bar/baz/../../bar.js",40 expected: "bar.js" },41 { path: "/foo/bar/baz/../../../bar.js",42 expected: "bar.js" },43 { path: "/foo/bar/baz/../../../../bar.js",44 expected: "bar.js" },45 { path: "/foo/bar/baz/../../bar.js",46 expected: "bar.js" },47 { path: "/foo/bar/baz/../../../bar.js",

Full Screen

Using AI Code Generation

copy

Full Screen

1function testInclusionTree() {2 var tree = new InclusionTree();3 tree.addNode("A");4 tree.addNode("B");5 tree.addNode("C");6 tree.addNode("D");7 tree.addNode("E");8 tree.addNode("F");9 tree.addNode("G");10 tree.addNode("H");11 tree.addNode("I");12 tree.addNode("J");13 tree.addEdge("A", "B");14 tree.addEdge("A", "C");15 tree.addEdge("B", "D");16 tree.addEdge("B", "E");17 tree.addEdge("C", "F");18 tree.addEdge("C", "G");19 tree.addEdge("D", "H");20 tree.addEdge("D", "I");21 tree.addEdge("E", "J");22 var tree = tree.getTree();23 console.log(tree);24}25function testInclusionTree() {26 var tree = new InclusionTree();27 tree.addNode("A");28 tree.addNode("B");29 tree.addNode("C");30 tree.addNode("D");31 tree.addNode("E");32 tree.addNode("F");33 tree.addNode("G");34 tree.addNode("H");35 tree.addNode("I");36 tree.addNode("J");37 tree.addEdge("A", "B");38 tree.addEdge("A", "C");39 tree.addEdge("B", "D");40 tree.addEdge("B", "E");41 tree.addEdge("C", "F");42 tree.addEdge("C", "G");43 tree.addEdge("D", "H");44 tree.addEdge("D", "I");45 tree.addEdge("E", "J");46 var tree = tree.getTree();47 console.log(tree);48}49function testInclusionTree() {50 var tree = new InclusionTree();51 tree.addNode("A");52 tree.addNode("B");53 tree.addNode("C");

Full Screen

Using AI Code Generation

copy

Full Screen

1var path = require('path');2var wpt = require(path.join(__dirname, 'lib', 'wpt'));3var test = new wpt();4 console.log(res);5});6var path = require('path');7var wpt = require(path.join(__dirname, 'lib', 'wpt'));8var test = new wpt();9 console.log(res);10});11var path = require('path');12var wpt = require(path.join(__dirname, 'lib', 'wpt'));13var test = new wpt();14 console.log(res);15});16var path = require('path');17var wpt = require(path.join(__dirname, 'lib', 'wpt'));18var test = new wpt();19 console.log(res);20});21var path = require('path');22var wpt = require(path.join(__dirname, 'lib', 'wpt'));23var test = new wpt();24 console.log(res);25});26var path = require('path');27var wpt = require(path.join(__dirname, 'lib', 'wpt'));28var test = new wpt();29 console.log(res);30});31var path = require('path');32var wpt = require(path.join(__dirname, 'lib', 'wpt'));33var test = new wpt();

Full Screen

Using AI Code Generation

copy

Full Screen

1var InclusionTree = require('./wptextpattern.js').InclusionTree;2var it = new InclusionTree();3it.addPattern('foo');4it.addPattern('bar');5it.addPattern('baz');6it.addPattern('foo bar');7it.addPattern('foo baz');8it.addPattern('foo bar baz');9it.addPattern('foo bar baz foo');10it.addPattern('foo bar baz foo bar');11it.addPattern('foo bar baz foo bar baz');12it.addPattern('foo bar baz foo bar baz foo');13it.addPattern('foo bar baz foo bar baz foo bar');14it.addPattern('foo bar baz foo bar baz foo bar baz');15it.addPattern('foo bar baz foo bar baz foo bar baz foo');16it.addPattern('foo bar baz foo bar baz foo bar baz foo bar');17it.addPattern('foo bar baz foo bar baz foo bar baz foo bar baz');18it.addPattern('foo bar baz foo bar baz foo bar baz foo bar baz foo');19it.addPattern('foo bar baz foo bar baz foo bar baz foo bar baz foo bar');20it.addPattern('foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz');21it.addPattern('foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo');22it.addPattern('foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar');23it.addPattern('foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz');24it.addPattern('foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo');25it.addPattern('foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar');26it.addPattern('foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz');27it.addPattern('foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo');28it.addPattern('foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar');29it.addPattern('foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz');30it.addPattern('foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar

Full Screen

Using AI Code Generation

copy

Full Screen

1var fs = require('fs');2var wpt = require('webpagetest');3var client = wpt('A.1d6c5f6b5f6c5d6c5f6c5d6c5f6c5d6');4var options = {5 budget: {6 }7};8client.runTest(options, function(err, data) {9 if (err) return console.error(err);10 console.log(data);11 client.getInclusionTree(data.data.runs[1].firstView.inclusionTree, function(err, data) {12 if (err) return console.error(err);13 console.log(data);14 });15});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2}, function(err, data) {3 if (err) return console.error(err);4 console.log(data);5 var testId = data.data.testId;6 test.getInclusionTree(testId, function(err, data) {7 if (err) return console.error(err);8 console.log(data);9 });10});11var wpt = require('webpagetest');12}, function(err, data) {13 if (err) return console.error(err);14 console.log(data);15 var testId = data.data.testId;16 test.getInclusionTree(testId, function(err, data) {17 if (err) return console.error(err);18 console.log(data);19 });20});21var wpt = require('webpagetest');22}, function(err, data) {23 if (

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful