fix syntax
This commit is contained in:
@@ -40,67 +40,76 @@ $receiver(e => {
|
||||
});
|
||||
|
||||
// Wait for approval then capture
|
||||
var srgb_surf = null;
|
||||
var linear_surf = null;
|
||||
var jpeg_surf = null;
|
||||
var hd_surf = null;
|
||||
|
||||
function capture_test() {
|
||||
if (!approved) {
|
||||
$delay(capture_test, 0.1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
log.console("\nCapturing frame...");
|
||||
var surf = cam.capture();
|
||||
|
||||
|
||||
if (!surf) {
|
||||
log.console("No frame captured yet, retrying...");
|
||||
$delay(capture_test, 0.1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
log.console("\nCaptured surface:");
|
||||
log.console(" Size:", surf.width + "x" + surf.height);
|
||||
log.console(" Format:", surf.format);
|
||||
|
||||
|
||||
// Test various colorspace conversions
|
||||
log.console("\nTesting colorspace conversions:");
|
||||
|
||||
|
||||
// Convert to sRGB if not already
|
||||
var convert_srgb = function() {
|
||||
srgb_surf = surf.convert(surf.format, "srgb");
|
||||
log.console(" Converted to sRGB colorspace");
|
||||
} disruption {
|
||||
log.console(" sRGB conversion failed");
|
||||
}
|
||||
if (format.colorspace != "srgb") {
|
||||
try {
|
||||
var srgb_surf = surf.convert(surf.format, "srgb");
|
||||
log.console(" Converted to sRGB colorspace");
|
||||
} catch(e) {
|
||||
log.console(" sRGB conversion failed:", e.message);
|
||||
}
|
||||
convert_srgb();
|
||||
}
|
||||
|
||||
|
||||
// Convert to linear sRGB for processing
|
||||
try {
|
||||
var linear_surf = surf.convert("rgba8888", "srgb_linear");
|
||||
var convert_linear = function() {
|
||||
linear_surf = surf.convert("rgba8888", "srgb_linear");
|
||||
log.console(" Converted to linear sRGB (RGBA8888) for processing");
|
||||
} catch(e) {
|
||||
log.console(" Linear sRGB conversion failed:", e.message);
|
||||
} disruption {
|
||||
log.console(" Linear sRGB conversion failed");
|
||||
}
|
||||
|
||||
convert_linear();
|
||||
|
||||
// Convert to JPEG colorspace (common for compression)
|
||||
try {
|
||||
var jpeg_surf = surf.convert("rgb888", "jpeg");
|
||||
var convert_jpeg = function() {
|
||||
jpeg_surf = surf.convert("rgb888", "jpeg");
|
||||
log.console(" Converted to JPEG colorspace (RGB888) for compression");
|
||||
} catch(e) {
|
||||
log.console(" JPEG colorspace conversion failed:", e.message);
|
||||
} disruption {
|
||||
log.console(" JPEG colorspace conversion failed");
|
||||
}
|
||||
|
||||
convert_jpeg();
|
||||
|
||||
// If YUV format, try BT.709 (HD video standard)
|
||||
if (search(surf.format, "yuv") != null || search(surf.format, "yuy") != null) {
|
||||
try {
|
||||
var hd_surf = surf.convert(surf.format, "bt709_limited");
|
||||
log.console(" Converted to BT.709 limited (HD video standard)");
|
||||
} catch(e) {
|
||||
log.console(" BT.709 conversion failed:", e.message);
|
||||
}
|
||||
var convert_hd = function() {
|
||||
hd_surf = surf.convert(surf.format, "bt709_limited");
|
||||
log.console(" Converted to BT.709 limited (HD video standard)");
|
||||
} disruption {
|
||||
log.console(" BT.709 conversion failed");
|
||||
}
|
||||
|
||||
if (search(surf.format, "yuv") != null || search(surf.format, "yuy") != null) {
|
||||
convert_hd();
|
||||
}
|
||||
|
||||
log.console("\nTest complete!");
|
||||
$stop();
|
||||
}
|
||||
|
||||
// Start capture test after a short delay
|
||||
$delay(capture_test, 0.5);
|
||||
$delay(capture_test, 0.5);
|
||||
|
||||
Reference in New Issue
Block a user