velxio/test/test-esp32-cam/autosearch
David Montero Crespo 36914e209c feat(webcam): universal compatibility — any webcam on any PC ✅
User goal: ESP32-CAM live preview that works with any webcam,
regardless of resolution, brand, or scene complexity. The previous
fixed-quality 0.28 was fragile (intermittent decode errors on
moving/textured scenes) and capped visual quality unnecessarily.

Two-layer fix; either alone is insufficient:

LAYER A — Bounded JPEG encoder (frontend, this repo)
  frontend/src/hooks/useWebcamFrames.ts:
    encodeBoundedJpeg() walks a quality ladder [0.6, 0.5, ..., 0.1]
    until the JPEG fits in MAX_FRAME_BYTES (23 000). If even q=0.1
    overshoots — extreme HD/4K scenes — falls back to a 240×180
    downscaled canvas at q=0.4. Guarantees every emitted frame fits
    the deliverable budget regardless of webcam hardware.

    The hook now exposes lastQualityUsed + lastDownscaled so UI can
    surface when auto-tuning kicks in.

  frontend/src/components/simulator/CameraToggle.tsx:
    Tooltip shows "(auto-tuned to q=0.X)" or "(auto-downscaled, q=0.X)"
    while streaming so users see what the encoder picked.

LAYER B — Multi-lap descriptor ring walker (qemu-lcgamboa, submodule)
  Bumps the QEMU per-frame deliverable cap from 8 KiB to ~32 KiB by
  letting the walker reset the descriptor ring up to 4 times per
  VSYNC. Submodule pointer bumped to eb8b7a5d.

Combined, the demo now supports:
  - Cheap 480p webcams: q=0.6, 5-10 KiB JPEGs, sharp
  - Logitech mid-range:  q=0.5-0.6, 8-15 KiB JPEGs, sharp
  - HD 1080p webcams:    q=0.4-0.6, 15-23 KiB JPEGs, sharp
  - 4K complex scenes:   downscaled, still readable

Documented as bug closure in:
  test/test-esp32-cam/autosearch/15_universal_webcam_compat.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 00:48:24 -03:00
..
00_overview.md feat: ESP32-CAM emulation with webcam frame bridge 2026-05-02 19:29:01 -03:00
01_state_of_the_art.md feat: ESP32-CAM emulation with webcam frame bridge 2026-05-02 19:29:01 -03:00
02_qemu_lcgamboa_audit.md feat: ESP32-CAM emulation with webcam frame bridge 2026-05-02 19:29:01 -03:00
03_browser_webcam_capture.md feat: ESP32-CAM emulation with webcam frame bridge 2026-05-02 19:29:01 -03:00
04_proposed_architecture.md feat: ESP32-CAM emulation with webcam frame bridge 2026-05-02 19:29:01 -03:00
05_open_questions.md feat: ESP32-CAM emulation with webcam frame bridge 2026-05-02 19:29:01 -03:00
06_existing_test_patterns.md feat: ESP32-CAM emulation with webcam frame bridge 2026-05-02 19:29:01 -03:00
07_ov2640_sccb_spec.md feat: ESP32-CAM emulation with webcam frame bridge 2026-05-02 19:29:01 -03:00
08_dvp_i2s_spec.md feat: ESP32-CAM emulation with webcam frame bridge 2026-05-02 19:29:01 -03:00
09_qemu_build_blueprint.md feat: ESP32-CAM emulation with webcam frame bridge 2026-05-02 19:29:01 -03:00
10_phase3_webcam_test.md feat: ESP32-CAM emulation with webcam frame bridge 2026-05-02 19:29:01 -03:00
11_blockers_resolved.md feat: ESP32-CAM emulation with webcam frame bridge 2026-05-02 19:29:01 -03:00
12_descriptor_walker_fix.md feat: ESP32-CAM emulation with webcam frame bridge 2026-05-02 19:29:01 -03:00
13_three_remaining_bugs.md docs(esp32-cam): three more bugs found in I2S device 2026-05-02 19:40:47 -03:00
14_complete_emulation.md feat(esp32-cam): real webcam emulation verified end-to-end ✅ 2026-05-02 22:05:37 -03:00
15_universal_webcam_compat.md feat(webcam): universal compatibility — any webcam on any PC ✅ 2026-05-03 00:48:24 -03:00