mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-30 12:23:52 +02:00
Add video frame preprocessing to VideoEncodingConfig & VideoEncoderWrapper
This commit is contained in:
+9
-7
@@ -1120,14 +1120,16 @@ export type CropRectangle = {
|
||||
height: number;
|
||||
};
|
||||
|
||||
export const clampCropRectangle = (crop: CropRectangle, outerWidth: number, outerHeight: number) => {
|
||||
crop.left = Math.min(crop.left, outerWidth);
|
||||
crop.top = Math.min(crop.top, outerHeight);
|
||||
crop.width = Math.min(crop.width, outerWidth - crop.left);
|
||||
crop.height = Math.min(crop.height, outerHeight - crop.top);
|
||||
export const clampCropRectangle = (crop: CropRectangle, outerWidth: number, outerHeight: number): CropRectangle => {
|
||||
const left = Math.min(crop.left, outerWidth);
|
||||
const top = Math.min(crop.top, outerHeight);
|
||||
const width = Math.min(crop.width, outerWidth - left);
|
||||
const height = Math.min(crop.height, outerHeight - top);
|
||||
|
||||
assert(crop.width >= 0);
|
||||
assert(crop.height >= 0);
|
||||
assert(width >= 0);
|
||||
assert(height >= 0);
|
||||
|
||||
return { left, top, width, height };
|
||||
};
|
||||
|
||||
export const validateCropRectangle = (crop: CropRectangle, prefix: string) => {
|
||||
|
||||
Reference in New Issue
Block a user