libyuv
Version:
Bindings to libyuv, provides conversion utilities for in-memory YUV video frames
30 lines • 1.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const razmin_1 = require("razmin");
const chai_1 = require("chai");
const sha1 = require("node-sha1");
const libyuv = require(".");
razmin_1.describe(`libyuv`, () => {
razmin_1.describe(`.Version()`, it => {
it(`should return its version as a number`, () => {
chai_1.expect(typeof libyuv.Version() === 'number', 'version must be a number').to.be.true;
});
it(`should have a version number that makes sense`, () => {
chai_1.expect(libyuv.Version()).to.be.at.least(1763);
});
});
razmin_1.describe('.I420ToABGR()', it => {
it(`should successfully run a basic conversion`, () => {
let width = 50;
let height = 50;
let src = new Uint8Array(width * height * 1.5);
src.fill(0, 0, width * height * 1.5);
let dst = new Uint8Array(width * height * 4);
let retval = libyuv.I420ToABGR(src, width, src.subarray(width * height), width / 2, src.subarray(width * height + width * height / 4), width / 2, dst, width * 4, width, height);
chai_1.expect(retval).to.equal(0);
chai_1.expect(sha1(dst))
.to.equal('636d2d59094cc679862855a1c49a7ab87f7c54ae');
});
});
});
//# sourceMappingURL=basic.test.js.map