switch (mode) { case 0: Assert.assertTrue(topAvailable); predictVertical(residual, topLeftAvailable, topRightAvailable, topLeft, topLine, mbOffX, blkX, blkY, pixOut); break; case 1: Assert.assertTrue(leftAvailable); predictHorizontal(residual, topLeftAvailable, topLeft, leftRow, mbOffX, blkX, blkY, pixOut); break; break; case 3: Assert.assertTrue(topAvailable); predictDiagonalDownLeft(residual, topLeftAvailable, topAvailable, topRightAvailable, topLeft, topLine, mbOffX, blkX, blkY, pixOut); break; case 4: Assert.assertTrue(topAvailable && leftAvailable && topLeftAvailable); predictDiagonalDownRight(residual, topRightAvailable, topLeft, leftRow, topLine, mbOffX, blkX, blkY, pixOut); break; case 5: Assert.assertTrue(topAvailable && leftAvailable && topLeftAvailable); predictVerticalRight(residual, topRightAvailable, topLeft, leftRow, topLine, mbOffX, blkX, blkY, pixOut); break; case 6: Assert.assertTrue(topAvailable && leftAvailable && topLeftAvailable); predictHorizontalDown(residual, topRightAvailable, topLeft, leftRow, topLine, mbOffX, blkX, blkY, pixOut); break; case 7:
protected static SL parse(ByteBuffer input, IDescriptorFactory factory) { Assert.assertEquals(0x2, input.get() & 0xff); return new SL(); }
private List<Tuple._2<Atom, ByteBuffer>> doTheFix(SeekableByteChannel fi, MP4Edit edit) throws IOException { Atom moovAtom = getMoov(fi); Assert.assertNotNull(moovAtom); ByteBuffer moovBuffer = fetchBox(fi, moovAtom); MovieBox moovBox = (MovieBox) parseBox(moovBuffer); List<Tuple._2<Atom, ByteBuffer>> fragments = new LinkedList<Tuple._2<Atom, ByteBuffer>>(); if (BoxUtil.containsBox(moovBox, "mvex")) { List<Tuple._2<ByteBuffer, MovieFragmentBox>> temp = new LinkedList<Tuple._2<ByteBuffer, MovieFragmentBox>>(); for (Atom fragAtom : getFragments(fi)) { ByteBuffer fragBuffer = fetchBox(fi, fragAtom); fragments.add(Tuple._2(fragAtom, fragBuffer)); MovieFragmentBox fragBox = (MovieFragmentBox) parseBox(fragBuffer); fragBox.setMovie(moovBox); temp.add(Tuple._2(fragBuffer, fragBox)); } edit.applyToFragment(moovBox, Tuple._2_project1(temp).toArray(new MovieFragmentBox[0])); for (Tuple._2<ByteBuffer, ? extends Box> frag : temp) { if (!rewriteBox(frag.v0, frag.v1)) return null; } } else edit.apply(moovBox); if (!rewriteBox(moovBuffer, moovBox)) return null; fragments.add(Tuple._2(moovAtom, moovBuffer)); return fragments; }
private void outChunkIfNeeded(int entryNo) throws IOException { Assert.assertTrue(tgtChunkDurationUnit == Unit.FRAME || tgtChunkDurationUnit == Unit.SEC); if (tgtChunkDurationUnit == Unit.FRAME && curChunk.size() * tgtChunkDuration.getDen() == tgtChunkDuration.getNum()) { outChunk(entryNo); } else if (tgtChunkDurationUnit == Unit.SEC && chunkDuration > 0 && chunkDuration * tgtChunkDuration.getDen() >= tgtChunkDuration.getNum() * timescale) { outChunk(entryNo); } }
public static MTSPacket parsePacket(ByteBuffer buffer) { int marker = buffer.get() & 0xff; Assert.assertEquals(0x47, marker); int guidFlags = buffer.getShort(); int guid = (int) guidFlags & 0x1fff; int payloadStart = (guidFlags >> 14) & 0x1; int b0 = buffer.get() & 0xff; int counter = b0 & 0xf; if ((b0 & 0x20) != 0) { int taken = 0; taken = (buffer.get() & 0xff) + 1; NIOUtils.skip(buffer, taken - 1); } return new MTSPacket(guid, payloadStart == 1, ((b0 & 0x10) != 0) ? buffer : null); }
private void outChunkIfNeeded(int entryNo) throws IOException { Assert.assertTrue(tgtChunkDurationUnit == Unit.FRAME || tgtChunkDurationUnit == Unit.SEC); if (tgtChunkDurationUnit == Unit.FRAME && curChunk.size() * tgtChunkDuration.getDen() == tgtChunkDuration.getNum()) { outChunk(entryNo); } else if (tgtChunkDurationUnit == Unit.SEC && chunkDuration > 0 && chunkDuration * tgtChunkDuration.getDen() >= tgtChunkDuration.getNum() * timescale) { outChunk(entryNo); } }
@Override public void parse(ByteBuffer input) { NIOUtils.skip(input, 1); profile = input.get() & 0xff; profileCompat = input.get() & 0xff; level = input.get() & 0xff; int flags = input.get() & 0xff; nalLengthSize = (flags & 0x03) + 1; int nSPS = input.get() & 0x1f; // 3 bits reserved + 5 bits number of // sps for (int i = 0; i < nSPS; i++) { int spsSize = input.getShort(); Assert.assertEquals(0x27, input.get() & 0x3f); spsList.add(NIOUtils.read(input, spsSize - 1)); } int nPPS = input.get() & 0xff; for (int i = 0; i < nPPS; i++) { int ppsSize = input.getShort(); Assert.assertEquals(0x28, input.get() & 0x3f); ppsList.add(NIOUtils.read(input, ppsSize - 1)); } }
private void outChunkIfNeeded() throws IOException { Assert.assertTrue(tgtChunkDurationUnit == Unit.FRAME || tgtChunkDurationUnit == Unit.SEC); if (tgtChunkDurationUnit == Unit.FRAME && framesInCurChunk * tgtChunkDuration.getDen() == tgtChunkDuration.getNum()) { outChunk(); } else if (tgtChunkDurationUnit == Unit.SEC && chunkDuration > 0 && chunkDuration * tgtChunkDuration.getDen() >= tgtChunkDuration.getNum() * _timescale) { outChunk(); } }
@Override public void parse(ByteBuffer input) { NIOUtils.skip(input, 1); profile = input.get() & 0xff; profileCompat = input.get() & 0xff; level = input.get() & 0xff; int flags = input.get() & 0xff; nalLengthSize = (flags & 0x03) + 1; int nSPS = input.get() & 0x1f; // 3 bits reserved + 5 bits number of // sps for (int i = 0; i < nSPS; i++) { int spsSize = input.getShort(); Assert.assertEquals(0x27, input.get() & 0x3f); spsList.add(NIOUtils.read(input, spsSize - 1)); } int nPPS = input.get() & 0xff; for (int i = 0; i < nPPS; i++) { int ppsSize = input.getShort(); Assert.assertEquals(0x28, input.get() & 0x3f); ppsList.add(NIOUtils.read(input, ppsSize - 1)); } }
private void outChunkIfNeeded() throws IOException { Assert.assertTrue(tgtChunkDurationUnit == Unit.FRAME || tgtChunkDurationUnit == Unit.SEC); if (tgtChunkDurationUnit == Unit.FRAME && framesInCurChunk * tgtChunkDuration.getDen() == tgtChunkDuration.getNum()) { outChunk(); } else if (tgtChunkDurationUnit == Unit.SEC && chunkDuration > 0 && chunkDuration * tgtChunkDuration.getDen() >= tgtChunkDuration.getNum() * timescale) { outChunk(); } }
@Override public void parse(ByteBuffer input) { NIOUtils.skip(input, 1); profile = input.get() & 0xff; profileCompat = input.get() & 0xff; level = input.get() & 0xff; int flags = input.get() & 0xff; nalLengthSize = (flags & 0x03) + 1; int nSPS = input.get() & 0x1f; // 3 bits reserved + 5 bits number of // sps for (int i = 0; i < nSPS; i++) { int spsSize = input.getShort(); Assert.assertEquals(0x27, input.get() & 0x3f); spsList.add(NIOUtils.read(input, spsSize - 1)); } int nPPS = input.get() & 0xff; for (int i = 0; i < nPPS; i++) { int ppsSize = input.getShort(); Assert.assertEquals(0x28, input.get() & 0x3f); ppsList.add(NIOUtils.read(input, ppsSize - 1)); } }
private void outChunkIfNeeded() throws IOException { Assert.assertTrue(tgtChunkDurationUnit == Unit.FRAME || tgtChunkDurationUnit == Unit.SEC); if (tgtChunkDurationUnit == Unit.FRAME && framesInCurChunk * tgtChunkDuration.getDen() == tgtChunkDuration.getNum()) { outChunk(); } else if (tgtChunkDurationUnit == Unit.SEC && chunkDuration > 0 && chunkDuration * tgtChunkDuration.getDen() >= tgtChunkDuration.getNum() * timescale) { outChunk(); } }
Assert.assertEquals(0x47, tsPkt[0] & 0xff); int guidFlags = ((tsPkt[1] & 0xff) << 8) | (tsPkt[2] & 0xff); int guid = (int) guidFlags & 0x1fff;
PolygonWiggler.convertToInequalityConstraints(convexPolygon, Aineq, bineq, 0.0); Assert.assertTrue(MatrixFeatures.isEquals(Aineq, constraintToConvexRegion.Aineq, 1e-7)); Assert.assertTrue(MatrixFeatures.isEquals(bineq, constraintToConvexRegion.bineq, 1e-7)); PolygonWiggler.convertToInequalityConstraints(convexPolygon, Aineq, bineq, 0.02); Assert.assertTrue(MatrixFeatures.isEquals(Aineq, constraintToConvexRegion.Aineq, 1e-7)); Assert.assertTrue(MatrixFeatures.isEquals(bineq, constraintToConvexRegion.bineq, 1e-7)); CommonOps.multAdd(-1.0, Aineq, positionOffset, bineq); Assert.assertTrue(MatrixFeatures.isEquals(Aineq, constraintToConvexRegion.Aineq, 1e-7)); Assert.assertTrue(MatrixFeatures.isEquals(bineq, constraintToConvexRegion.bineq, 1e-7));
protected void analyseBuffer(ByteBuffer buf, long pos) { while (buf.hasRemaining()) { ByteBuffer tsBuf = NIOUtils.read(buf, 188); pos += 188; Assert.assertEquals(0x47, tsBuf.get() & 0xff); int guidFlags = ((tsBuf.get() & 0xff) << 8) | (tsBuf.get() & 0xff); int guid = (int) guidFlags & 0x1fff; for (int i = 0; i < indexer.indexers.length; i++) { if (guid == indexer.indexers[i].targetGuid) { int payloadStart = (guidFlags >> 14) & 0x1; int b0 = tsBuf.get() & 0xff; int counter = b0 & 0xf; if ((b0 & 0x20) != 0) { NIOUtils.skip(tsBuf, tsBuf.get() & 0xff); } indexer.indexers[i].analyseBuffer(tsBuf, pos - tsBuf.remaining()); } } } }
@ContinuousIntegrationTest(estimatedDuration = 0.0) @Test(timeout = 30000) public void testStandingWithPerfectTrackingAndAngularMomentum() { ICPOptimizationQPSolver solver = new ICPOptimizationQPSolver(10, false); solver.setCMPFeedbackConditions(10.0, true); solver.setFeedbackConditions(0.1, 3.0, 500.0); FrameVector2D icpError = new FrameVector2D(); FramePoint2D perfectCMP = new FramePoint2D(worldFrame, 0.05, 0.01); assertTrue(solver.compute(icpError, perfectCMP)); FrameVector2D cmpCoPDifference = new FrameVector2D(); FrameVector2D copFeedback = new FrameVector2D(); solver.getCMPFeedbackDifference(cmpCoPDifference); solver.getCoPFeedbackDifference(copFeedback); FrameVector2D cmpCoPDifferenceExpected = new FrameVector2D(); FrameVector2D copFeedbackExpected = new FrameVector2D(); Assert.assertTrue("The CoP feedback is wrong.", copFeedback.epsilonEquals(copFeedbackExpected, epsilon)); Assert.assertTrue("The CMP feedback is wrong.", cmpCoPDifference.epsilonEquals(cmpCoPDifferenceExpected, epsilon)); }
public void write(ByteBuffer buf) { ByteBuffer dup = buf.duplicate(); NIOUtils.skip(buf, 8); doWrite(buf); header.setBodySize(buf.position() - dup.position() - 8); Assert.assertEquals(header.headerSize(), 8); header.write(dup); }
footstepLocationExpected.add(icpError); Assert.assertTrue("The CoP feedback is wrong.", copFeedback.epsilonEquals(copFeedbackExpected, epsilon)); Assert.assertTrue("The CMP feedback is wrong.", cmpCoPDifference.epsilonEquals(cmpCoPDifferenceExpected, epsilon)); Assert.assertTrue("The footstep location solution is wrong.", footstepLocation.epsilonEquals(footstepLocationExpected, epsilon));
public void write(ByteBuffer buf) { ByteBuffer dup = buf.duplicate(); NIOUtils.skip(buf, 8); doWrite(buf); header.setBodySize(buf.position() - dup.position() - 8); Assert.assertEquals(header.headerSize(), 8); header.write(dup); }
@ContinuousIntegrationTest(estimatedDuration = 0.0) @Test(timeout = 30000) public void testStandingUnconstrained() { ICPOptimizationQPSolver solver = new ICPOptimizationQPSolver(10, false); solver.setFeedbackConditions(0.1, 3.0, 100000.0); FrameVector2D icpError = new FrameVector2D(worldFrame, 0.05, 0.10); FramePoint2D perfectCMP = new FramePoint2D(worldFrame, 0.05, 0.01); assertTrue(solver.compute(icpError, perfectCMP)); FrameVector2D cmpCoPDifference = new FrameVector2D(); FrameVector2D copFeedback = new FrameVector2D(); solver.getCMPFeedbackDifference(cmpCoPDifference); solver.getCoPFeedbackDifference(copFeedback); FrameVector2D cmpCoPDifferenceExpected = new FrameVector2D(); FrameVector2D copFeedbackExpected = new FrameVector2D(); copFeedbackExpected.set(icpError); copFeedbackExpected.scale(3.0); Assert.assertTrue("The CoP feedback is wrong.", copFeedback.epsilonEquals(copFeedbackExpected, epsilon)); Assert.assertTrue("The CMP feedback is wrong.", cmpCoPDifference.epsilonEquals(cmpCoPDifferenceExpected, epsilon)); }