diff --git a/index.html b/index.html index f10031d..add3581 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,10 @@ + QR-over-GIF Transfer diff --git a/src/app/routes/sender.tsx b/src/app/routes/sender.tsx index 665bfc5..4c5b909 100644 --- a/src/app/routes/sender.tsx +++ b/src/app/routes/sender.tsx @@ -204,6 +204,7 @@ export function SenderPage() { mime = 'text/plain'; } else { if (!file) { setError('Please select a file.'); return; } + if (file.size > 8 * 1024 * 1024) { setError('File too large. Maximum size is 8 MB.'); return; } data = await file.arrayBuffer(); filename = file.name; mime = file.type || 'application/octet-stream'; @@ -307,7 +308,7 @@ export function SenderPage() { }, [gifResult, profileId, stats]); // ─── Compute warnings ────────────────────────────────────────────────────── - const showWarning = stats && stats.estimatedGifBytes > 5 * 1024 * 1024; + const showWarning = false; return (
@@ -407,18 +408,9 @@ export function SenderPage() { {stats.frameCount} Generations {stats.totalGenerations} - Estimated GIF size - {formatBytes(stats.estimatedGifBytes)} - Estimated throughput - - {estimateThroughput(stats.originalSize, stats.frameCount, profileId)} - + GIF size + {gifResult ? formatBytes(gifResult.gifData.byteLength) : '…'}
- {showWarning && ( -
- ⚠ Large GIF ({formatBytes(stats.estimatedGifBytes)}) — transfer may take several minutes. -
- )} )} diff --git a/src/core/protocol/constants.ts b/src/core/protocol/constants.ts index 42cf7fd..036af54 100644 --- a/src/core/protocol/constants.ts +++ b/src/core/protocol/constants.ts @@ -54,11 +54,11 @@ export enum Flags { /** QR profile identifiers. */ export enum ProfileId { - /** Robust profile: QR V31, ECC Q, K=24, R=12. */ + /** Robust profile: QR V20, ECC Q, K=16, R=16 (100% overhead, big modules). */ ROBUST = 0, - /** Balanced profile: QR V35, ECC M, K=24, R=8. */ + /** Balanced profile: QR V25, ECC Q, K=20, R=12 (60% overhead). */ BALANCED = 1, - /** Fast profile: QR V40, ECC M, K=32, R=8. */ + /** Fast profile: QR V35, ECC M, K=24, R=8 (33% overhead). */ FAST = 2, } @@ -86,28 +86,28 @@ export interface ProfileConfig { /** Lookup of all defined profiles by their ProfileId. */ export const PROFILES: Record = { [ProfileId.ROBUST]: { - qrVersion: 31, + qrVersion: 20, eccLevel: 'Q', - k: 24, - r: 12, + k: 16, + r: 16, frameDelay: 30, - maxPacketPayload: 1230, + maxPacketPayload: 450, }, [ProfileId.BALANCED]: { + qrVersion: 25, + eccLevel: 'Q', + k: 20, + r: 12, + frameDelay: 20, + maxPacketPayload: 683, + }, + [ProfileId.FAST]: { qrVersion: 35, eccLevel: 'M', k: 24, r: 8, - frameDelay: 20, - maxPacketPayload: 1770, - }, - [ProfileId.FAST]: { - qrVersion: 40, - eccLevel: 'M', - k: 32, - r: 8, frameDelay: 15, - maxPacketPayload: 2290, + maxPacketPayload: 1777, }, }; diff --git a/src/tests/complete.test.ts b/src/tests/complete.test.ts index 42e2197..bd086f9 100644 --- a/src/tests/complete.test.ts +++ b/src/tests/complete.test.ts @@ -46,9 +46,9 @@ describe('Constants', () => { expect(p.maxPacketPayload).toBeGreaterThan(100); } }); - it('Robust has highest overhead (K=24, R=12)', () => { - expect(PROFILES[ProfileId.ROBUST].k).toBe(24); - expect(PROFILES[ProfileId.ROBUST].r).toBe(12); + it('Robust has highest overhead (K=16, R=16)', () => { + expect(PROFILES[ProfileId.ROBUST].k).toBe(16); + expect(PROFILES[ProfileId.ROBUST].r).toBe(16); }); it('createSessionId returns a bigint', () => { const id = createSessionId();