cvm-rs: merge guac and jpeg libs together into one

doesn't really need to be two seperate libraries. also preperation for other funnies

the build script has been replaced with a much saner justfile which uses much saner "yarn workspace" invocations instead of blindly cding all over the place
This commit is contained in:
modeco80
2024-06-22 21:14:05 -04:00
parent 87a377a10f
commit b8ed177885
26 changed files with 246 additions and 414 deletions

View File

@@ -1,6 +1,6 @@
import { Size, Rect } from '@cvmts/shared';
import sharp from 'sharp';
import * as jpeg from '@cvmts/jpegturbo-rs';
import * as cvm from '@cvmts/cvm-rs';
// A good balance. TODO: Configurable?
let gJpegQuality = 35;
@@ -28,7 +28,7 @@ export class JPEGEncoder {
static async Encode(canvas: Buffer, displaySize: Size, rect: Rect): Promise<Buffer> {
let offset = (rect.y * displaySize.width + rect.x) * 4;
return jpeg.jpegEncode({
return cvm.jpegEncode({
width: rect.width,
height: rect.height,
stride: displaySize.width,
@@ -42,7 +42,7 @@ export class JPEGEncoder {
.raw()
.toBuffer({ resolveWithObject: true });
return jpeg.jpegEncode({
return cvm.jpegEncode({
width: kThumbnailSize.width,
height: kThumbnailSize.height,
stride: kThumbnailSize.width,