diff --git a/.github/workflows/nds.yml b/.github/workflows/nds.yml new file mode 100644 index 00000000..53e385e8 --- /dev/null +++ b/.github/workflows/nds.yml @@ -0,0 +1,175 @@ +name: Nintendo DS +on: + workflow_dispatch: + # Optional single-file CI request from the 1.2 integration branch. + # Ordinary code commits no longer create a build or failure email. + push: + branches: + - 'codex/nds-v1.2-integration' + - 'codex/nds-v1.2.1-test-20261030' + paths: + - '.github/ci-requests/nds.txt' + - 'cpymo-backends/nds/source/**' + - 'cpymo-backends/nds/VERSION' + - 'cpymo-tool/nds-converter/tests/**' + - '.github/workflows/nds.yml' + pull_request: + paths: + - 'cpymo/**' + - 'cpymo-backends/include/**' + - 'cpymo-backends/nds/**' + - 'cpymo-tool/nds-converter/**' + - '.github/workflows/nds.yml' +permissions: + contents: read +jobs: + build: + runs-on: ubuntu-latest + container: devkitpro/devkitarm:20260610 + steps: + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 + - name: Initialize required submodules + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + git submodule update --init stb endianness.h + - name: Verify bundled DS libraries; install only if absent + run: | + # This pinned image already included all five libraries when run + # 39704544801 passed. An unconditional pacman -Syu was touching + # pkg.devkitpro.org even with "nothing to do" and failing on HTTP 403. + # Preserve the known-good pinned SDK unless a dependency is missing. + if dkp-pacman -Q devkitARM libnds libfat-nds maxmod-nds calico ndstool >/dev/null 2>&1; then + echo "All DS/DSi build dependencies present in the pinned image; skipping network sync." + else + echo "Some pinned-image dependencies are absent; attempting SDK installation." + dkp-pacman -Syu --noconfirm --needed libnds libfat-nds maxmod-nds calico ndstool + fi + dkp-pacman -Q devkitARM libnds libfat-nds maxmod-nds calico ndstool + - name: Refresh four-language UI glyphs for v1.2.1 + run: python3 cpymo-backends/nds/tools/generate-ui-font.py + - name: Build original DS ROM + run: python3 cpymo-backends/nds/build.py + - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 + with: + name: CPyMO-for-NDS + path: cpymo-backends/nds/engine.nds + - name: Build DSi experimental ROM (separate output) + run: python3 cpymo-backends/nds/build.py --dsi-experiment + - name: Inspect experimental NDS header + run: | + python3 - <<'PY' + from pathlib import Path + rom = Path('cpymo-backends/nds/cpymo-dsi-experiment.nds').read_bytes() + print(f"ROM bytes={len(rom)}, unit code={rom[0x12]}, header size={int.from_bytes(rom[0x84:0x88], 'little'):#x}") + PY + - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 + with: + name: CPyMO-for-DSi-Experiment + path: cpymo-backends/nds/cpymo-dsi-experiment.nds + - name: Assemble official-background universal v1.2.1 test ROM + if: github.ref_name == 'codex/nds-v1.2.1-test-20261030' + run: | + mkdir -p out-v121 + python3 cpymo-backends/nds/tools/patch-rom-bg.py --rom cpymo-backends/nds/cpymo-dsi-experiment.nds --art cpymo-backends/nds/assets/nds-dual-bg.rgb555 --output out-v121/CPyMO-for-NDS-v1.2.1-test4.nds + python3 cpymo-backends/nds/tools/verify-release-artifact.py --rom out-v121/CPyMO-for-NDS-v1.2.1-test4.nds + sha256sum out-v121/CPyMO-for-NDS-v1.2.1-test4.nds > out-v121/SHA256SUMS.txt + - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 + if: github.ref_name == 'codex/nds-v1.2.1-test-20261030' + with: + name: CPyMO-NDS-v1.2.1-universal-TEST4 + path: out-v121/ + retention-days: 30 + if-no-files-found: error + converter: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 + - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 + with: + python-version: '3.12' + - run: python -m pip install -r cpymo-tool/nds-converter/requirements.txt + - name: Use hosted FFmpeg or pip wheel (no apt mirror dependency) + run: | + if command -v ffmpeg >/dev/null 2>&1; then + ffmpeg -version | head -n 1 + else + python -m pip install 'imageio-ffmpeg==0.6.0' + python - <<'PY' + import os + from pathlib import Path + import imageio_ffmpeg + link=Path(os.environ['RUNNER_TEMP'])/'ffmpeg' + link.symlink_to(imageio_ffmpeg.get_ffmpeg_exe()) + with open(os.environ['GITHUB_PATH'],'a',encoding='utf8') as stream: + stream.write(str(link.parent)+'\n') + print('CI FFmpeg wheel binary:',link.resolve()) + PY + fi + - run: python cpymo-backends/nds/tools/generate-ui-font.py + - run: python -m unittest discover -s cpymo-tool/nds-converter/tests -v + + portable-windows: + # Opt in explicitly: only runs when the CI request commit contains + # [portable]. All ordinary DS/DSi builds remain fast and unchanged. + if: github.event_name == 'push' && contains(github.event.head_commit.message, '[portable]') + # Linux apt/mirror availability must not hold the independent Windows + # frozen-worker proof hostage. Full converter suite is a separate gate. + needs: [build] + runs-on: windows-latest + steps: + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 + - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 + with: + python-version: '3.12' + - name: Install pinned portable build dependencies + run: python -m pip install -r cpymo-tool/nds-converter/requirements-build.txt + - name: Download exactly this workflow run's NTR ROM + uses: actions/download-artifact@v4 + with: + name: CPyMO-for-NDS + path: cpymo-backends/nds + - name: Locate video-capable Windows FFmpeg + shell: pwsh + run: | + $ff = (Get-Command ffmpeg.exe -ErrorAction SilentlyContinue).Source + if (-not $ff) { + choco install ffmpeg -y --no-progress + $ff = (Get-ChildItem 'C:\ProgramData\chocolatey\lib\ffmpeg\tools' -Recurse -Filter ffmpeg.exe -ErrorAction SilentlyContinue | Select-Object -First 1).FullName + } + if (-not $ff) { throw 'No FFmpeg found on Windows runner' } + & $ff -version + "NDS_BUILD_FFMPEG=$ff" >> $env:GITHUB_ENV + - name: Build PyInstaller app with real video decoder + shell: pwsh + run: | + python cpymo-tool/nds-converter/build_portable.py --ffmpeg "$env:NDS_BUILD_FFMPEG" --output cpymo-portable + - name: Test actual frozen worker with MP4/NVL1 conversion and paired ROM + shell: pwsh + run: | + python cpymo-tool/nds-converter/tests/smoke_windows_portable.py --portable cpymo-portable --ffmpeg "$env:NDS_BUILD_FFMPEG" + - name: Include development-only release limitations + shell: pwsh + run: | + Copy-Item cpymo-tool/nds-converter/README.md cpymo-portable/转换助手说明.md + @' + CPyMO 1.2 Windows portable - INTEGRATION BUILD ONLY. + Video-enabled FFmpeg is included. The frozen worker was smoke-tested + with ordinary MP4 -> NVL1 and original files were not modified. + GUI window and NTR/DSi performance still need device testing. + NOT A PUBLIC RELEASE. Collect matching FFmpeg third-party licenses, + corresponding source and redistribution notices before distributing. + Do not overwrite the save folder of an existing game. + '@ | Set-Content -Path cpymo-portable/开发版说明.txt -Encoding UTF8 + - name: Upload tested Windows portable candidate for review + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 + with: + name: CPyMO-1.2-Windows-Portable-VIDEO-REVIEW-NOT-RELEASE + path: | + cpymo-portable/app/Converter/ + cpymo-portable/cpymo-nds.nds + cpymo-portable/VERSION.json + cpymo-portable/BUILD-COMMAND.json + cpymo-portable/helper-build.log + cpymo-portable/转换助手说明.md + cpymo-portable/开发版说明.txt + retention-days: 14 diff --git a/cpymo-backends/nds/.gitattributes b/cpymo-backends/nds/.gitattributes new file mode 100644 index 00000000..29a4d2ed --- /dev/null +++ b/cpymo-backends/nds/.gitattributes @@ -0,0 +1,4 @@ +* text=auto eol=lf +decoder/** -whitespace +licenses/** -whitespace +LICENSE* -whitespace diff --git a/cpymo-backends/nds/.gitignore b/cpymo-backends/nds/.gitignore new file mode 100644 index 00000000..7468bc29 --- /dev/null +++ b/cpymo-backends/nds/.gitignore @@ -0,0 +1,5 @@ +/build/ +/build-records/ +/*.elf +/*.nds +/*.map diff --git a/cpymo-backends/nds/CREDITS.md b/cpymo-backends/nds/CREDITS.md new file mode 100644 index 00000000..588e1427 --- /dev/null +++ b/cpymo-backends/nds/CREDITS.md @@ -0,0 +1,12 @@ +# 作者与许可 + +NDS 平台移植:千岚之夏 + +PyMO:chen_xin_ming 及贡献者。 +CPyMO:Seng Jik(GitHub: Strrationalism)及上游贡献者。 +上游项目与完整作者名单:https://github.com/Strrationalism/CPyMO + +引擎、NDS 后端及 ARM7 背光服务:AGPL-3.0-or-later;转换工具:MIT。 +Fusion Pixel、GNU Unifont 字形子集及其他依赖保留原许可,见 licenses。 + +游戏原作、汉化、原有移植署名保持定稿内容;本更新包不附游戏素材。 diff --git a/cpymo-backends/nds/DUALSCREEN-1.2.md b/cpymo-backends/nds/DUALSCREEN-1.2.md new file mode 100644 index 00000000..0d9ce848 --- /dev/null +++ b/cpymo-backends/nds/DUALSCREEN-1.2.md @@ -0,0 +1,139 @@ +# CPyMO NDS / DSi 1.2 · reversible 3DS-inspired dual-screen prototype + +Base: `codex/nds-v1.2-video-foundation`; official R7 / `nds-v1.1.0` releases remain untouched. This feature belongs in 1.2 only after real NTR and TWL hardware acceptance. + +## Modes + +- **Classic (default):** unchanged R7 single-picture play on the main LCD; the other LCD shows the existing localized control/clock panel. Existing A, B, X, Y, START, SELECT and L behavior is retained. +- **Enhanced dual-screen (opt-in):** the physical **upper LCD** displays the scene (background, sprites and scene effects), the physical **lower LCD** displays the in-game dialogue box and text, or the core UI menu while open. The renderer partitions existing `cpymo_backend_image_draw_type` categories at the backend boundary, matching the *behavioral* principle of upstream CPyMO 3DS. Original 3DS code was not copied. +- **Switch:** while playing, press **L + SELECT** to toggle classic/enhanced without exiting the story, restarting, or rewriting script assets. The old quick-load remains on SELECT alone; L alone swaps LCDs in classic mode and does not invert the mandatory top/bottom roles in enhanced mode. Y still hides/unhides the auxiliary LCD; a hidden lower LCD temporarily uses classic dialogue rendering on the visible main LCD, so game text remains readable. Re-enable Y to restore enhanced layout. +- **Saved preference:** `/save/nds-dualscreen-mode.txt` contains `1` (enhanced) or `0` (classic). Absent/invalid content means classic. This is separate from core game save slots and R7's `nds-ui.cfg`; no core or asset format changes. Failed preference write leaves gameplay functional. + +## Implementation + +- Main renderer keeps the existing framebuffer and VRAM bank owners. The top scene is drawn and DMA-published first. With enhanced mode enabled, the same RAM framebuffer is cleared, and only CPyMO's lower-screen dialogue/menu draw types are rendered before publishing to the pre-existing sub-screen VRAM. This deliberately avoids allocating another 256×192×RGB555 heap buffer. +- The low-level NDS image, rectangle and text drawing entrypoints filter by CPyMO draw types, keeping base-image caching and audio service logic independent. The dialogue's baseline shifts upward to bring the original name/textbox into the lower LCD's useful area. The core's game scripts are unchanged. +- Existing 3DS reference has a 400×240 upper and 320×240 lower screen; **DSi has 256×192 on both**. Therefore do not assume 3DS offsets/zoom/texture sizing will directly match; a local 20%-height dialogue target is provisional, to be tuned only after physical display results. +- Classic auxiliary help and minute-clock updates are suppressed while enhanced mode owns the lower screen. Y hide and mode changes trigger a complete redraw to avoid orphaned dialogue / old help panel pixels. +- All interactions remain in the established CPyMO main loop; no new libnds VRAM mapping, IRQ/FIFO ownership, ARM7 services, or exclusive video GPU use is introduced. + +## Real-hardware acceptance — not yet run + +Use a converted **existing** PyMO game, ideally the previously accepted 30 MB dual-card fixture or a known NVL1 demo. Test one play session: + +1. Start with **classic** (delete `save/nds-dualscreen-mode.txt` only if an earlier prototype enabled dual; no other saves must be deleted). Confirm original scene, controls, time and launcher appearance. +2. While a normal name + dialogue box is visible, press **L+SELECT**. Upper: scene/characters without dialogue. Lower: the current name/dialogue box and text. Press A to advance and check multi-line dialogue/auto text. +3. Press **X** to open the CPyMO menu. Confirm menu content and controls remain usable on the lower LCD; press B to return. Check menus, choices, speaker names and scene transitions. +4. Press **L+SELECT** again. Confirm classic restores immediately, dialogue returns to original main LCD, lower help panel returns and SELECT standalone still quick-loads. +5. Turn enhanced on, then press **Y** to hide the auxiliary screen. The top LCD should still show the dialogue in temporary classic mode; press Y again to restore enhanced lower dialogue. Confirm ordinary **L** still swaps screens in classic and does not swap top/bottom enhanced roles. +6. Close and reopen the *same game*. Confirm the previously selected mode persisted. Restart test with both an original NTR build and DSi TWL build, and with the game stored in `sd:` or `fat:` according to the confirmed *directional* storage limitations. +7. Run `#movie` both in classic and enhanced. Check video is still visible, after EOF or B skip the game returns to the original chosen dual/classic mode with music intact. **FVDS remains I/O preflight only**, not playback. + +**Do not ship 1.2 on CI success alone.** Any UI alignment, speaker box placement, menu functionality or performance regressions on NTR 4 MiB must be fixed first. The established stable R7 visual layout is the unchanged rollback. + +## Deferred larger 1.2 goal: FVDS actual playback + +The user's private video research established sequential j1 video compaction versus NVL1 on ordinary NTR, but only FVDS **read-only** path has been verified through CPyMO on DSi. 1.2 still needs licensed or original FVDS frame decoding (including texture/GX and RAM constraints) and 47,605 Hz stereo ADPCM audio integration while preserving the CPyMO Calico/Maxmod ARM7, libfat double-volume behavior, lid suspend/resume, B skip and script return. The FastVideoDS repository has no clear source redistribution license; do not copy its player implementation into AGPL CPyMO pending authorization. + +Both major features are separately gated; neither may silently replace the classic visual-novel experience. + +## Follow-up: actual DSi hardware feedback and corrected three-mode touch model (2026-10-22) + +The user physically tested the first dual-screen build on DSi TWL: the split screen's baseline works and the movie's **B skip** returns successfully. The earlier user accepted seven-video batch reached EOF, so this separate B-skip test closes that specific input path in DSi mode. The first enhanced layout, however, was visually too bare and needs further polish relative to the actual 3DS behavioral reference. + +**Updated user-approved L cycling:** every standalone **L** press cycles through three physical LCD assignments: + +| State | Main gameplay | Secondary display | Lower-LCD touch semantics | +| --- | --- | --- | --- | +| 0 (default) | Classic game on upper LCD | Original control+clock panel below | Entire lower panel acts as virtual **A**; NEVER project touch to upper menu coordinates, even while a core menu is open | +| 1 | Classic game on lower LCD | Original control+clock panel above | **Full PyMO coordinate projection** from physical lower LCD, including normal dialogues, choices and in-game menus | +| 2 | Enhanced split | Background/characters on upper LCD; dialogue or engine menus below | Tap narrative dialogue to advance (**A**); project physical lower touches to genuine menu coordinates when the core UI is drawn below | + +The next L after state 2 returns to state 0; no more awkward **L+SELECT** chord. Single SELECT retains quick-load. Single Y retains hide/reveal of the auxiliary display and the temporary single-screen legibility policy. A transition explicitly resets auxiliary hide so the newly active LCD is visible. Classic upper or lower uses the exact original rendering, not a duplicated enhanced composition. + +The per-game `save/nds-dualscreen-mode.txt` now stores `NDSDISPLAY2 0`, `NDSDISPLAY2 1`, or `NDSDISPLAY2 2`, retaining backward compatibility: the previous one-byte `1` means the prior prototype's enhanced split (now state 2). No core save slots, game config, cache formats, or users' R7 installations are changed. Localized auxiliary help now says L cycles display modes. + +**Accept only after next real-device trial**, specifically all six transitions 0→1→2→0 and menu coordinate interaction in state 1/state 2. The existing simple enhanced dialogue layout is a first step rather than an accepted final 3DS-like screen composition. Determine text box safe area, choice routing, legibility and save menu UI from the DSi real hardware before release. B skip and audiovisual playback should be regressions in all three states. + +## Unreleased visual/layout and choice routing refinement + +The first three-mode test binary was intentionally **not** hardware-tested at the user's request. The following changes have since been implemented only in this experimental branch: + +- **Persistent scene when menus open:** previous enhanced routing could blank the top LCD as soon as a CPyMO menu became active, since a UI draw pass does not emit normal background/character categories. The enhanced top path now explicitly draws the scene while the lower LCD owns the actual UI/menu draw types. +- **Story choices on the touchable lower screen:** story `cpymo_select_img` objects use `cpymo_backend_image_draw_type_sel_img`. When those choices are active, they now render on the lower LCD, and that lower touch surface supplies real PyMO coordinates. Outside menus/choices, lower touch remains a full-size **A** action, not a falsely projected cursor. Classic lower-game keeps precise touch coordinates; classic upper-game keeps full-panel A. +- **More legible lower-screen composition:** a native RGB555 muted background, restrained border and dialogue accents sit under the game's original textbox, speaker label and text; UI/choices use less decorative space. This is deliberately different from a stretched second copy of the top screen and uses the existing framebuffer and VRAM owners. +- **Correct per-game preference serialization:** fixed escaped newline handling for `NDSDISPLAY2 0/1/2`, allowing the saved three-mode preference to reload properly; the one-byte first-prototype `1` retains its enhanced-mode migration rule. +- **Build verification:** the NDS/DSi and converter workflow passed on the visual/layout change commit `ff9b450a7b10093d24c2fe0f7c5cfa5ff2e0d21d`. The later preference-only patch ran converter tests successfully, while the DS build job could not reach compilation because the upstream devkitPro package index returned HTTP 403. A green previous build does **not** replace physical dual-screen acceptance. + +Next hardware test remains deferred until combined with a meaningful FVDS decoder/audio development milestone. Test the choice hitboxes, X menu transitions, L three-mode cycle, save preference persistence, original audio/video path and B-skip before qualifying 1.2. + + +## Visual refinement — CPyMO 3DS behavior verified against original code (2026-10-22) + +The user requested that enhanced mode **look intentional and near the original 3DS implementation**, not merely satisfy the two-screen functionality. On reading the actual upstream `cpymo-backends/3ds/main.c`, `cpymo_backend_image.c` and `cpymo_backend_text.c`, the precise relevant behavior is: +- The 3DS scene uses the top screen while the **game's own message box, name box and say text** render on the lower screen, with a vertical offset derived from the original gameconfig and message-box dimensions (original 3DS top-margin formula uses a logical `+16`). +- **In CPyMO UI mode, top gets `ui_bg` and bottom gets `ui_element` / `ui_element_bg`**, not the entire interface background on the lower screen. NDS previously misrouted `ui_bg` to bottom and forced the storyline scene on top, so this has now been corrected to use 3DS's real categories. +- 3DS defaults to enhanced in the upstream implementation but NDS **intentionally remains classic by default** with L cycling classic-top → classic-bottom → enhanced; the user explicitly requested retaining these three choices. +- The original 3DS normal-story rendering actually keeps `sel_img` on top, whereas NDS intentionally routes story choices below for direct touchscreen selection. This is a **documented practical NDS improvement**, not presented as a verbatim 3DS clone. + +1. New `dual-layout-nds.h` computes a game-resolution-aware lower-screen vertical offset from the original message artwork height, the name box font height and name-box origin. Dialogue is anchored around **14 physical pixels** below the top of NDS's 192px screen, instead of the old arbitrary **20% logical-height** position. When artwork is too tall, the helper deliberately leaves its original position intact rather than increasing clipping. The same shift applies to game dialogue artwork, translucent fallback rectangle, speaker name and dialogue text. +2. Enhanced lower screen now has an understated native RGB555 dusk gradient and a compact, localizable footer with `A / 轻触:继续` in narrative mode, rendered **under** the game's own textbox. Choice/menu modes do not draw the narrative footer, keeping the lower screen free for direct touch targets. +3. Native `cpymo_engine_draw` is now allowed to draw the menu's authored background on the upper display, while low-level draw-type dispatch sends the interactive elements to the lower display. This matches the upstream 3DS split more precisely than the first prototype. `nds_dual_force_scene` was removed as dead state. +4. Added `test_nds_dual_layout.py`: compiles the actual layout header with host GCC and checks geometry for multiple original game resolutions, letterboxing, with or without name labels, adjusted name origins and oversized authored dialog assets. + +**The actual NDS visual output remains unverified on hardware.** The next visual acceptance must inspect a game with a real namebox/messagebox, a game without custom assets, multiple-line names/text, an X settings/backlog menu, script choices, L mode cycling, touch targets, Y hide/reveal, return to library and game switching. Do not state "3DS-quality visuals accepted" merely because the source composition and CI build succeeded. + +Plan remaining hardware sessions as **roughly 2–3 concentrated rounds**, not a fixed guaranteed number: (1) 3DS-inspired visual/UI layout checkpoint; (2) actual FVDS decoded video/audio/skip checkpoint once it exists; (3) optionally final candidate regression on both TWL DSi and NTR DS mode. Any hardware-only discrepancy or video decoder performance issue may require another focused round. Stable R7 remains untouched. + + +## Authentic visual captures — hardware review path (opt-in, unreleased) + +The user explicitly rejected AI-generated concept art as a proxy for the actual CPyMO interface. Only genuine program-rendered images should be presented as UI evidence. + +A new optional **NDSPIX1** capture facility provides this without bundling an emulator, inventing a scene or introducing a second runtime framebuffer: +- In the selected game's existing `save/` folder, the tester creates an empty `nds-visual-capture.flag` file **before launching the game**. Without the file, no frame captures, no additional SD writes and no extra framebuffer allocation occur. +- While the game is in **enhanced dual-screen mode**, the first actual dialogue redraw and the first actual core UI/menu redraw each generate one `nds-capture-dialogue.ndsraw` or `nds-capture-menu.ndsraw`. Each file contains a 16-byte `NDSPIX1` header and exactly two 256×192 RGB555 screen buffers in **physical upper, then lower screen** order. The saved pixels are the real buffers used for VRAM presentation, not high-resolution art or speculative reconstructions. +- The source ROM exports actual top/bottom pixels on the ARM9. The local host script `python cpymo-backends/nds/tools/nds-capture-to-png.py ` produces `-top.png` and `-bottom.png` at **exact native 256×192** resolution, standard-library only, without scaling, borders or decorative changes. +- Capture is **opt-in, diagnostic only**. Each capture writes ~192 KiB to SD and may momentarily pause the game; disable it for performance/sound/video timing tests. It does not capture NVL1/FVDS movie decoding, and cannot prove 3DS visual fidelity without comparing actual CPyMO 3DS runtime evidence. +- Separate SDK-independent regression tests compile and exercise the production C writer with synthetic RGB555 *test vectors* and check the exact raw format + PNG conversion. Those synthetic buffers are **never presented as screenshots of CPyMO gameplay**. +- The current environment has no accessible running DS emulator. **No actual 1.2 enhanced-mode image has yet been captured**, and nothing in this toolchain should be described as an authentic visual preview until the raw pixel dump comes from the physical DSi or from a running emulator. + +This capture feature will be folded into the user's already-planned first concentrated UI/visual acceptance round; no separate immediate hardware testing is requested. Stable R7 is not changed. + + +## Source-executed lower-LCD visual preview (without game art) + +The user asked for visual proof when an untested 1.2 UI change is made and explicitly prohibited AI image generation. The lower-LCD RGB555 backdrop has therefore been extracted from `main.c` into **the exact same production** `source/dual-canvas-nds.h` static C function used at runtime. `main.c` calls it before rendering the game's original namebox, textbox, glyphs, choices and menu. + +`python cpymo-backends/nds/tools/nds-dual-canvas-preview.py --output ` builds that actual C function with a normal GCC host compiler, executes it for dialogue/menu/idle states, and converts its RGB555 buffers into three native 256×192 PNG images using the existing checked `nds-capture-to-png.py` logic. The separate SDK-free UI CI uploads these files as a visual artifact only at a manually requested checkpoint. + +**Accurate scope:** the three PNGs show ONLY the screen's underlying gradient, accents and dialogue footer band, *not* the user's actual PyMO game textbox, Chinese font glyphs or character sprite. They are exact source-executed backdrop pixels but emphatically **not NDS game screenshots**, and may not be labeled or presented as complete enhanced-screen visuals. The complete result still requires the user's or emulator's first real `NDSPIX1` capture from the actual game. This design preserves an honest source-driven visual preview now while deferring full visual acceptance to the already-planned concentrated device round. + +## 2026-10-22 — one-session NDSPIX1 physical display evidence for the three-mode trial + +The opt-in `nds-visual-capture.flag` now collects **four** first-occurrence, +pixel-exact physical screen pairs during game redraws: + +| Kind | Output (.ndsraw, in the same save directory) | Trigger | +| --- | --- | --- | +| 1 | `nds-capture-dialogue.ndsraw` | Enhanced split: original visible dialogue | +| 2 | `nds-capture-menu.ndsraw` | Enhanced split: core UI/menu | +| 3 | `nds-capture-choice.ndsraw` | Enhanced split: active story choices (priority over lingering dialogue) | +| 4 | `nds-capture-classic-lower.ndsraw` | Classic lower: visible dialogue, physical upper help panel and lower game frame | + +The latter explicitly writes **sub VRAM as physical TOP and main framebuffer as +physical BOTTOM**, since `lcdSwap()` reverses their physical assignments. +Enhanced captures still write the published main scene TOP and actual +lower UI BOTTOM. Every file remains one `NDSPIX1` header plus two native +256x192 RGB555 buffers; the converter accepts all four kinds without +rescaling. The C exporter and PNG converter have expanded synthetic +round-trip regression tests. These fixtures are **not** gameplay screenshots. + +This enables comparison of layout and touch target position within one +optional DSi session; no capture occurs without the explicit flag. Each +192-KiB snapshot is an intentional synchronous FAT diagnostic and may cause +momentary pauses, so remove the flag during performance/audio measurements. +A missing state will not fabricate an image. Neither the two previously +compiled ROMs nor any user's saves or stable R7 binaries are modified by +this source-level change. Rebuild and then verify true captures on hardware; +do not claim actual 3DS-equivalent quality from synthetic tests. diff --git a/cpymo-backends/nds/FVDS-PLAYER-1.2.md b/cpymo-backends/nds/FVDS-PLAYER-1.2.md new file mode 100644 index 00000000..48d9f006 --- /dev/null +++ b/cpymo-backends/nds/FVDS-PLAYER-1.2.md @@ -0,0 +1,61 @@ +# FVDS 1.2 — incremental playable pipeline (development contract) + +Status: **compressed FVDS video is not decoded yet**, and no FVDS audio is currently routed to the NDS ARM7 mixer. This document marks the next hardware-integration seam, not a user-facing video player. + +## Work completed + +- `fvds-stream-nds.[ch]`: bounded file/header/index reader, sequential video/audio packets, seek and exact boundary validation. +- `fvds-adpcm-nds.[ch]`: independently implemented, tested fixed 264-byte left/right block -> 256 stereo frames PCM16 decoder. Original 159-second user sample was decoded on a host and matched the independent audio reference. +- `fvds-stage-nds.[ch]`: **new allocation-free one-frame producer**. A caller-owned struct provides a 512-byte compressed-video transfer buffer, 264-byte compressed audio block and 1024-byte interleaved PCM buffer. Each `nds_fvds_stage_step` invokes video-begin(PTS), sequential video chunks, video-end, and PCM callbacks, polling for B skip / lid/power between chunks. The codec output pointer is valid *only during a synchronous callback*. On skip/error the current packet seeks to its valid end boundary before returning; EOF is distinct. +- `test_fvds_stage.py`: independently compiles the production C source under GCC with sanitizer and tests 12-fps timestamps, three frames, 47 stereo pairs, 12,032 PCM frames, skip during frame 2, callback failure and malformed compressed audio. +- Existing standard-C host WAV tool remains for audio validation and cannot overwrite source inputs, including same inode via a symlink. + +## What is deliberately NOT done + +The new stage does **not** decode a video frame, display RGB555 pixels, play sound, modify CPyMO `#movie`, claim GX/VRAM, reconfigure Maxmod/Calico ARM7 or take ownership of FAT and DMA. It only creates a testable streaming point where dedicated consumers can later be attached. That distinction prevents a false 1.2 release claim. + +## Next meaningful milestones + +1. **Video:** design and implement a licensed or independently authored bitstream/IDCT/motion-compensation consumer of the stage's compressed chunks, with a bounded frame/reference allocation budget for **NTR 4 MiB** and a separately measured TWL path. Compare decoded RGB555 checksums and visual frames with the existing reference samples before touching NDS GPU resources. +2. **Audio:** define a ring-buffer consumer of the stage PCM callback. It needs 47,605 Hz stereo timing, explicit pause and restoration of background music, and compatibility with CPyMO's *existing* Maxmod/Calico service. A host success is not a real hardware acceptance. +3. **Display:** acquire/release graphics through a scoped lease. In classic-top, classic-bottom and enhanced modes, the movie must temporarily own only the documented buffers; on EOF, skip, malformed input, lid close or user exit, release everything and redraw original mode with no stale VRAM. +4. **Real-device gates:** one private DSpico/NDSi-TWL and R4/NTR pass for all three display modes, B skip, audio/BGM continuity, keyframe seek, and long-video memory/latency. UI/layout and ROM banner attribution remain subject to AKMenu-Next hardware review. + +The stage's video callbacks **must** be backed by a real frame decoder before the test mode is advertised as full FVDS playback. Avoid copying FastVideoDSPlayer sources while source redistribution/license status remains unresolved. + +Builds are requested explicitly via the existing `.github/ci-requests/...` mechanism; push-triggered per-commit CI is intentionally disabled. + + +## 2026-10-22: coded picture metadata + bounded PCM producer/consumer + +To reduce the risk of mixing video decoder and ARM7/Maxmod ownership, two further self-contained units are implemented in this branch: + +1. **Picture-type precondition, not a decoder** — `fvds-picture-prefix-nds.h` reads the high bit of the little-endian first video word as I/P metadata. The container stream now labels its current indexed keyframe; `fvds-stage-nds.c` rejects a P picture in an indexed I position *before delivering any compressed frame content*. These are independently derived bitstream checks, and cannot reconstruct DCT coefficients, motion vectors, or pixels. The private j1 159-second sample was inspected offline: exactly **8 indexed I pictures** at frames 0, 251, 502, 753, 1004, 1255, 1506 and 1757, and **1900 P pictures** in the other positions; none contradicted the key index. No private payload is committed. +2. **47,605-Hz stereo PCM queue, not a hardware player** — `fvds-pcm-queue-nds.[ch]` provides a caller-owned, single-thread ring with bounded occupancy, all-or-nothing 16-bit stereo writes, read wraparound, silence on underflow, overload refusal and counters. It has **no direct DMA, ARM7, Maxmod, synchronization or cache-coherence management**. A separate host test uses the *production FVDS stage* to decode 47 synthetic ADPCM pairs over three 12-fps frames and drains at exact integer-rational 47,605 Hz; a capacity of 8,192 stereo frames (32,768 bytes) absorbs frame-block scheduling variation with no underrun in that synthetic scenario. This 32-KiB budget is provisional until a real DS/DSi PCM audio sink is integrated and measured. + +The important distinction remains: video data callbacks receive **compressed** chunks, not RGB555 pixels. A completed full FVDS 1.2 player still needs an independently implemented video bitstream decoder, sound output using an explicit resource owner, and verified restoration of original display/BGM on skip, EOF and failure. This new queue is not IPC-safe without an explicit synchronization layer. + +All added code is original and contains no copied FastVideoDSPlayer implementation. New synthesized tests are shipped in the public GitHub repository; the user's original video samples remain private. + + +### Timing and first video-header findings on the private 159-second j1 sample + +An independent, offline simulation based only on per-frame ADPCM block counts in the user's own FVDS sample (not uploaded to the repository) found: + +- 1,908 pictures at 12 fps, with 8 indexed I pictures and 1,900 P pictures. The I-picture header begins with an MSB-first picture-type bit and six-bit quantizer. A sample first word `0x3c0f` in little-endian storage yields **quantizer = 30**, consistent with the research encoding setting. +- The 1,908 packets have 961 frames with **15** stereo ADPCM pairs and 947 with **16** pairs, for **7,569,152 stereo PCM frames** at 47,605 Hz. Exact 159-second nominal demand is **7,569,195** PCM frames: source capacity ends just **43 samples (~0.903 ms)** earlier than ideal, a normal short tail suitable for guarded EOF silence. +- **Naïve queue policy:** decode each picture's audio, then immediately drain that picture interval from an 8,192-stereo-frame ring. This causes a measured **255 silent-sample underflow** in the sample sequence (127 on frame 0, 127 on frame 1, 1 later). Therefore **simple same-picture push/drain is not acceptable** as the final live scheduler, even when video/picture decoder is fast. +- **One-picture audio lookahead:** prime from the first **two** compressed picture packets before starting presentation, then continually decode one future packet before consuming the next presentation interval (with A/V frame staging coordinated). With 8,192 stereo frames (32 KiB) of buffer, the whole 159-second schedule has **no overflow**, peak occupancy **7,934 stereo frames** (~31 KiB), and the **only underflow is the 43-sample EOF shortfall**. That must be padded with silence at natural EOF, not misdiagnosed as a stream failure. This is a deterministic **host simulation** of sample budgets, not a performance benchmark or an ARM7-tested implementation. + +The live video decoder must therefore preserve at least one picture of compressed/audio lookahead without displaying a frame early, while the audio transport uses `nds_fvds_pcm_target()`/`nds_fvds_pcm_interval()` (rational sample clock) and never substitutes arbitrary silent priming for real samples. Maintaining the ring headroom also constrains decoder scheduling on NTR 4 MiB. The video image bitstream beyond picture flag + intra quantizer is still undecoded. + + +## 2026-10-22 — real FVDS picture elementary bitstream I/O + +- New original `fvds-bits-nds.[ch]`: an allocation-free, bounded **16-bit little-endian storage / MSB-first bit-consumption** reader. FVDS video cannot use a generic bytewise MSB-first reader: its first two stored bytes `0f 3c` represent word `0x3c0f`, hence I flag `0` and quantizer `30`. The reader pulls only 512 bytes at a time, supports 1..16-bit reads across chunk boundaries, and refuses odd lengths, oversize pictures, truncated FAT reads or reads past the video region. +- `fvds-picture-source-nds.h` connects this reader to the existing `nds_fvds_stream` VIDEO portion of an active frame packet, preserving the separate ADPCM boundary. It explicitly forbids concurrently using `nds_fvds_stage_step` for the same packet. Padding and any unconsumed video bytes may be discarded before audio consumption, but the adapter never reads ADPCM as compressed picture bits. +- `test_fvds_bits.py` compiles the production C source with GCC/UBSan, verifies word-order, 512-byte crossings and underfilled/malformed sources. `test_fvds_picture_source.py` compiles the real container reader + elementary reader and processes a 516-byte synthetic I-frame followed by the original valid stereo-ADPCM pairs; the test verifies all three container packets and reaches clean EOF without audio-boundary loss. +- A first synthetic fixture in the adapter test incorrectly expected zero at word index 1 although it had not consumed its leading bit. The error was narrowed to an exact word assertion, the fixture was corrected, **no production C reader change was needed**, and the SDK-independent host suite finally passed: [FVDS Host Audio Tools #39701191274](https://github.com/Blueteemo/CPyMO/actions/runs/39701191274). The preceding two failing host checks were a **test-fixture error**, not a confirmed movie decoder or ARM9 malfunction. +- This establishes elementary bit access but **DOES NOT reconstruct VLC coefficient blocks, DCT/IDCT, motion vectors, reference surfaces or RGB555 frames**. No displayed video, ROM build, ARM7 output, or DSi real hardware assertion follows from it. Existing default converter behavior and NVL1 playable fallback remain unchanged. + +Next work: independently parse the actual I-frame VLC 4×4 coefficient syntax into a bounded per-block representation, then implement an independently authored reconstruction pipeline with memory/performance measurements under NTR 4 MiB before coupling to CPyMO's graphics ownership. Avoid lifting unlicensed decoder source into AGPL code. diff --git a/cpymo-backends/nds/FVDS-STREAM-1.2.md b/cpymo-backends/nds/FVDS-STREAM-1.2.md new file mode 100644 index 00000000..a5ec19ba --- /dev/null +++ b/cpymo-backends/nds/FVDS-STREAM-1.2.md @@ -0,0 +1,23 @@ +# FVDS stream core — CPyMO 1.2 integration milestone + +Branch `codex/nds-v1.2-fvds-stream-core` derives from the hardware-validated R7-derived video foundation. It contains a **cleanly authored, read-only standard-C packet reader** (not a video decoder). It does not import or relicense FastVideoDS player/encoder code, copy copyrighted media or assume real hardware decode is functional. + +## Implemented API + +- `source/fvds-stream-nds.h/.c`: open/validate FVDS header and monotonic keyframe index; bound frame/audio packet sizes, check data against file boundaries; read separate video/audio chunks sequentially into caller-owned buffers; finish/skip current packet and reposition by keyframe index; reject trailing bytes when reached EOF. It uses existing `stdio.h` device paths and does **not** allocate heap buffers, change ARM7, FIFO, IRQ, DMA, VRAM, Maxmod, LCD state or game saves. +- `cpymo-tool/nds-converter/tests/test_fvds_stream.py`: compiles this same C reader on a host with GCC and passes synthetic three-frame samples into it. Exercises valid frame-by-frame reads, keyframe seek, misordered header index, malformed video alignment and trailing-packet bytes. The original `fvds_inspect.py` remains a separate, stricter host preflight tool. +- Private **host-only**, memory-sanitized test on original user handoff media: j1 159 seconds (1908 frames, 12,935,012 payload bytes, FNV1a32 56159179); 1 second (12, 66,248, D7819B62); 3 seconds (36, 176,072, 2898659E). All matched the user's prior NDSi TWL *read-only* logs. A separate seek to keyframe index 2 correctly resumed at frame 502. **No ROM/hardware streaming test for the new API yet**. + +## Resource and release boundaries + +FVDS stream I/O is **not connected to CPyMO `#movie` playback** and provides **no decoded RGB555 frames or audible ADPCM**. Merely compiling this source and passing host corpus checks does not fulfill the 1.2 FVDS movie feature. + +Next contract for a real player: + +1. Design an original decoder that consumes `nds_fvds_read_video` without copying unlicensed FastVideoDS source. Video is a 256×192 DCT/motion-compensated stream; validate pixel reconstruction and output bandwidth on NTR 4 MiB before betting on TWL-only RAM. Keyframe seek must reset all motion/reference state. +2. Integrate original compatible FVDS stereo ADPCM playback at **47,605 Hz**, with Calico/Maxmod ownership explicitly resolved; do not assume existing mono 22,050 Hz NVA1 can play FVDS audio or that a header edit is enough. +3. Coordinate dual-screen graphics. The existing CPyMO bitmap renderer owns VRAM A/C; the reference FVDS player requires its own GX/VRAM/memory and ARM7 audio infrastructure. The chosen decoder must not silently clobber these. A bounded, fully-restoring resource lease needs real NTR/TWL hardware tests. +4. Integrate `#movie` lifecycle with B-skip, natural EOF, malformed/unreadable resource, lid close/open, clean return to script/BGM and screen mode persistence. Leave ordinary converter defaults and released R7 intact. +5. Once fully verified, merge into the common 1.2 integration branch alongside classic/lower-game/enhanced dual-screen. No premature 1.2 tag, no release to end users. + +Licensing: FastVideoDSPlayer issue #15 requesting licensing is still open at review; its permission must not be assumed. Public CPyMO code here contains no player/encoder implementation from that repository. diff --git a/cpymo-backends/nds/LICENSE-CPyMO-AGPL.txt b/cpymo-backends/nds/LICENSE-CPyMO-AGPL.txt new file mode 100644 index 00000000..be3f7b28 --- /dev/null +++ b/cpymo-backends/nds/LICENSE-CPyMO-AGPL.txt @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git "a/cpymo-backends/nds/R4\345\256\211\350\243\205\346\225\231\347\250\213.md" "b/cpymo-backends/nds/R4\345\256\211\350\243\205\346\225\231\347\250\213.md" new file mode 100644 index 00000000..08c96c44 --- /dev/null +++ "b/cpymo-backends/nds/R4\345\256\211\350\243\205\346\225\231\347\250\213.md" @@ -0,0 +1,56 @@ +# R4 安装教程 + +适用普通 DS / DS Lite、能正常启动的 FAT/DLDI 烧录卡。请先备份 TF 卡存档。 +保留现有 R4 内核,不需要为了本引擎格式化卡片。 + +## 已有转换好的游戏 + +1. 将配套包内的 `cpymo-nds.nds` 放到 TF 卡根目录。 +2. 游戏目录应为 `pymo/games/游戏名/gameconfig.txt`,同一层有 + `script` 和 `nds-cache`。避免套上两层 `pymo` 或额外的安装包文件夹。 +3. 同一引擎可读取多个游戏,启动后在游戏列表选择。 +4. 在电脑安全弹出 TF 卡,装回 R4,在 R4 菜单运行 `cpymo-nds.nds`。 + +例如: + +```text +TF卡根目录/ + cpymo-nds.nds + pymo/ + games/ + GameOne/ + gameconfig.txt + script/ + nds-cache/ + save/ +``` + +更新引擎只需更新根目录的 ROM。现有 NDS 缓存、游戏和存档可继续使用。 +转换器输出的新空 `save` 不要覆盖自己的存档;不要默认导入 S60/安卓存档。 + +## 转换自己的游戏 + +1. 在 Windows 电脑完整解压配套包,不要只取出转换助手 EXE。 +2. 双击“启动转换助手.bat”,选择原游戏 ZIP/APK 或含 gameconfig 的文件夹。 +3. 若包内有多个平台版本,在列表中选择一个;一般优先 S60v3。 +4. 选择保存位置,点击“开始转换”。无需另装 Python 或 FFmpeg。 +5. 转换结束打开结果目录,先看“安装必读”和“转换结果.json”的警告,再按上节放卡。 + +输入支持 S60v3/S60v5/安卓的 PyMO 数据结构,不是任意安卓游戏。 +源包、定稿脚本、汉化和署名不改。视频从新输出省略,播放指令安全略过。 +缺失音频可能静音,缺字可以按明确选项显示方框;警告保存在转换记录中。 +目前音频缓存优先保证流畅,游戏安装体积可能明显增大。 + +## 操作 + +A/触控确认或继续;X菜单;菜单内B返回/取消,剧情中按住B隐藏文字。 +Y开关辅助屏,L交换上下屏;辅助触屏关闭时第一次触控仅唤醒。 +R按设置快进;START快速保存到标准存档1,SELECT快速读取标准存档1。 +合盖暂停并静音,开盖继续。字号和已读变灰按游戏分别保存。 + +游戏内 X → 设置 → “立绘特效(全局)”可关闭立绘渐变与移动,切换时直接显示最终状态; +对全部游戏生效。背景转场、透明遮罩保留,读图所需时间仍存在。 + +“需要转换”通常表示误选了原始包,或目录层级/缓存不完整;先检查转换记录和布局。 +FAT错误先检查卡片是否能正常读写、R4内核和文件是否完整。模拟器成功不等于所有卡都兼容。 +反馈时提供引擎版本、游戏来源平台、主机/卡型号和复现步骤;存档先自行保留备份。 diff --git a/cpymo-backends/nds/README.md b/cpymo-backends/nds/README.md new file mode 100644 index 00000000..c44ceca5 --- /dev/null +++ b/cpymo-backends/nds/README.md @@ -0,0 +1,81 @@ +# CPyMO for Nintendo DS 1.3.0 + +支持普通 DS / DS Lite 的 4 MiB NTR 模式,也支持在兼容启动环境下的 DSi/TWL 模式;同一份通用 `.nds` 根据启动模式自动适配。DS/NTR 需要 FAT/DLDI Slot-1 存储;不要求 DSi 软破。 +NDS 平台移植:千岚之夏;CPyMO:Seng Jik 及贡献者;PyMO:chen_xin_ming 及贡献者。 +引擎与后端为 AGPL-3.0-or-later,独立转换器为 MIT,第三方许可见 CREDITS.md、licenses/ 和转换器 fonts/。 + +当前发行说明:[1.3.0 变化与分发说明](RELEASE-NOTES-1.3.0.md);构建及发布门槛:[检查清单](RELEASE-CHECKLIST-1.3.0.md)。旧候选记录作为历史保留。 + +## 安装与更新 + +发行包提供独立 `cpymo-nds.nds`、Windows 免安装转换助手和 Apple Silicon Mac ARM64 原生 `.app`,不附游戏。 +先在电脑上用 `cpymo-tool/nds-converter` 转换自己的 S60v3 / S60v5 / Android PyMO 数据, +再将转换结果中的 `cpymo-nds.nds` 和 `pymo/games/<游戏目录>` 复制到 TF 根目录。 +保留 R4 内核,已有游戏更新前保留自己的 `save/`,不要用转换结果的空存档目录覆盖。 +从 1.2.0 更新到 1.3.0,已转换的游戏数据和存档无需重建,通常只需替换 `.nds`。想增加视频或重新优化旧缓存时,应从原游戏数据转换到新目录,**不要覆盖已有 `save/`**。格式 6 的新缓存不可配更旧引擎。 + +| 按键 | 作用 | +|---|---| +| A / 触控 | 确认、继续;游戏资料库轻触两次可启动 | +| X | 游戏正文菜单;游戏资料库打开界面语言选择(标题阶段不对应游戏菜单) | +| B | 返回、取消;剧情中按住隐藏文字;脚本选择界面遵循游戏取消设置 | +| Y | 游戏中隐藏/唤回辅助屏;游戏资料库打开主题设置 | +| L | 游戏显示模式循环:上屏游戏 → 下屏游戏 → 增强双屏 | +| R | 按游戏快进策略跳读 | +| START / SELECT | 游戏正文快速保存/读取标准存档1;在资料库按 START 启动选中游戏 | +| 合盖 / 开盖 | 暂停静音 / 恢复 | + +辅助屏隐藏且位于触控屏时,首次触控只唤醒。字号、已读变灰按游戏保存,立绘特效开关是全局设置。 +关闭立绘特效可跳过立绘渐变、移动和清除动效,仍保留背景转场与透明遮罩,资源加载仍需时间。 +列表、简介和系统标题使用内置原生点阵字体;旧游戏缓存中的标题图不会覆盖新的列表字体。 +角色名按可见字形居中。时钟位于列表下屏右上角;游戏中平时在副屏,打开 X 菜单后只在菜单左上角显示。 + +## 1.3.0 主题、音频与双屏细节 + +- 主题设置使用经典默认蓝色、按主机设置自动读取的固件色,以及原版 Nintendo DS 的 16 色选择。选中游戏时都有一致的 2 像素标识;四语言的文字对比度与主题色经过单独调校。 +- “自动”主题在启动和切换主题时缓存固件配色,避免因绘制列表反复读取固件设置造成迟滞。主题偏好保存于 `/pymo/nds-theme.cfg`。 +- 游戏从正文菜单确认“重新开始”后,辅助屏恢复标题菜单指引;进入正文后自动切回操作指南。在增强双屏模式中标题画面仍按游戏原版排版,不切割标题菜单素材。 +- 对原《水仙1》《水仙2》标题菜单高亮图片的 Alpha 混合改为四舍五入,减轻浅色边缘灰边,不要求重新转换游戏缓存。 +- 音频默认在混音后采用保守的约 +1.5 dB 目标增益,并通过峰值限幅降低数字削波风险。原游戏音量滑块与主机硬件音量保持独立,声音大小与录音素材、烧录设备仍有关。 + +- **NDS 程序及配套转换器图标焕新**:NDS 保留完整方形构图,Windows/macOS 为同源圆角配套游戏转换器图标;macOS 改善图标显示比例。 + +## 四语界面与错误页 + +语言顺序和保存编号为:0 自动、1 简体中文、2 繁體中文、3 English、4 日本語。 +首次正常进入启动器默认简体中文;手动选择保存在 `/pymo/nds-language.cfg`。 +自动模式检测主机固件语言,而非 R4 内核语言:支持日语、英语、中文,其余及无效值回退简中。 +FAT 初始化失败时尚不能读卡上的设置,因此错误页使用固件语言及中文回退,保留原始错误码。 +ROM 内置错误字库不依赖 TF 卡。界面语言不改变游戏脚本、标题、简介或原署名。 + +## 数据与性能边界 + +配套转换器默认精简重复原媒体,无损压缩语音及适合压缩的图像缓存;BGM/音效保持 PCM。 +这里的“无损”针对已生成的 NDS RGB555 / 22050 Hz 单声道缓存,不代表原图原音频不经缩放或重采样。 +资源别名去重和两位十六进制分目录减少重复文件及单目录密度。缓存格式6,仍读取旧格式1~5。 +脚本、汉化内容、署名和存档格式保留,原始游戏包不修改。 +转换助手默认将可识别的普通视频转换为 NVL1;也可选择压缩音轨的 NVA1,或主动跳过视频。原始游戏视频与脚本不改。转换后的视频兼容性取决于片源与运行环境,不保证所有游戏及烧录卡的全片流畅播放。 +缺失资源、缺字和待运行检查的指令写入转换报告。加密/打包脚本需要另行导入,不保证任意 PyMO 游戏全兼容。 + +## 构建 + +```sh +git submodule update --init stb endianness.h +export DEVKITPRO=/opt/devkitpro +python3 cpymo-backends/nds/build.py +``` + +PowerShell 设置 `$env:DEVKITPRO='C:/devkitPro'`,在仓库根运行同一 Python 命令。 +Python 3.10+。验证环境:devkitARM r68 / GCC16.1、Calico1.2.0、libnds2.0.2、 +libfat-nds2.1.0-4(现代 libdvm FAT 兼容接口)、Maxmod2.1.0、ndstool2.3.1。 +输出 `engine.nds`,命令和诊断保存在 `build-records/`。编译字符串中的源/SDK路径归一化,避免嵌入私人路径。 +`VERSION` 与 `release.json` 保持一致,与上游全平台版本号独立。 +ARM9/ARM7 均使用 Calico specs;不要改用默认 ARM7,自定义服务负责背光、合盖和音频恢复。 + +## 验证范围 + +此前未正式发布的 1.2.1 候选测试阶段,用户已反馈主题、辅助屏与双屏交互;最后一项默认主题竖线微调经主机测试、真实 ROM 编译和 SHA-256 校验,不再要求重复 NDS 实机视觉测试。正式 Windows/macOS 打包件独立做跨平台审计与图标视觉复核。 +上一代 1.1.0 ROM 曾与用户 Wood R4 短测程序逐字节一致,用户确认“已测,正常”。 +stock melonDS 1.1 普通 DS / 4 MiB 的19项界面、语言、持久化、错误页及时钟检查及5项标题字形像素对比通过。 +这不代表四游戏全剧情、所有烧录卡或固件认证。合盖恢复有用户实机反馈;历史带调度修正的模拟器检查不能替代原版模拟器认证。 +完整游戏、用户存档、SDK 和模拟器镜像不属于本源码贡献。 diff --git a/cpymo-backends/nds/RELEASE-CHECKLIST-1.3.0.md b/cpymo-backends/nds/RELEASE-CHECKLIST-1.3.0.md new file mode 100644 index 00000000..487a2b5c --- /dev/null +++ b/cpymo-backends/nds/RELEASE-CHECKLIST-1.3.0.md @@ -0,0 +1,35 @@ +# CPyMO for NDS 1.3.0 release checklist + +The 1.2.1 candidate was never formally released. Version 1.3.0 retains its approved behavior and artwork, and requires real new builds; old artifacts must not be renamed into this release. Publication status is recorded after validation, outside the frozen source commit. + +## Fixed baseline and version sources + +- [x] Approved runtime baseline 77a9af300631f2e313e95cc88bec857f2eae8e3c retained; existing main homepage integrated without changing runtime code. +- [x] NDS VERSION and release.json unified at 1.3.0. Build-generated CPYMO_NDS_VERSION and six Banner titles consume these actual sources. +- [x] Converter release_info.py, GUI footer, frozen job metadata, Mac Bundle fields and package VERSION.json consume the shared release metadata. +- [x] NDS full-square artwork uses the user-accepted warm-grey-brown frame, native 24/32/64px resources and mild small-icon detail enhancement. User reported successful visual hardware testing on 2026-11-06; candidate ROM SHA-256 d1eed5c919d01724f5c48eef4bb952f8c4fa0ab886504943cf8be0788cc15623. +- [x] Mac native Bundle route with 80% uniform transparent padding and Windows outputs unchanged. +- [x] Cache format 6 and existing supported cache/save compatibility retained; no theme/clock/audio/game-logic changes. +- [x] Current package names and workflow artifact references target 1.3.0, with formal user-facing text and no RC suffix. + +## Build and acceptance gates + +- [ ] Freeze one final source SHA; normally push the candidate branch and build all four distributions from that SHA. +- [ ] Full regression, icon checks and both native frozen converter tests pass; record actual counts and job/attempt results. +- [ ] Actual ROM contains compiled runtime 1.3.0 and six 1.3.0 Banner titles; CRC, NTR/TWL header and approved resources pass. +- [ ] Boot the new ROM in an emulator and capture an existing version display showing 1.3.0, or prove final ROM byte-identical to the already captured and hardware-accepted visual candidate; no new UI or extra hardware retest. +- [ ] Final CI Mac package: actual Finder/Dock, 1.3.0 version, window, normal exit/reopen, arm64 and strict ad-hoc signature pass. +- [ ] Actual Windows icon payloads, all Mac ICNS frames, ROM copies, source tree/submodules, FFmpeg source/configuration/licenses and new SHA256SUMS agree. +- [ ] Formal file layout passes a final real-file audit without changing ROM, EXE, .app, FFmpeg or icon payloads after acceptance. + +## Publication and contribution + +- [ ] Synchronize main without losing concurrent changes, tag the accepted source as nds-v1.3.0 and publish CPyMO for NDS 1.3.0 (not Draft/Prerelease). +- [ ] Read back public Release metadata, final asset sizes/digests, tag target and download links. Preserve historical releases. +- [ ] After the Release exists, update the fork homepage and actual 1.3.0 links; homepage-only commit may follow the tag. +- [ ] Update existing upstream PR #60 source and description, retaining the upstream generic root README; no replacement PR, force push or self-merge. +- [ ] Archive final files, audits, emulator/native version evidence and publication receipt at stable shared links. + +Mac remains Apple Silicon native with an ad-hoc signature, without Developer ID signing or Apple notarization. Do not disable system security. The historical approximately 64-second first-window wait remains undiagnosed; do not claim a startup speed fix. + +Historical evidence: [1.2.1 final candidate receipt](https://chatgpt.com/space/page_0870f359e4348191a58b3ae7bbf32ae5). Historical 1.2.1 documents remain unchanged; current entry is [1.3.0 release notes](RELEASE-NOTES-1.3.0.md). diff --git a/cpymo-backends/nds/RELEASE-NOTES-1.3.0.md b/cpymo-backends/nds/RELEASE-NOTES-1.3.0.md new file mode 100644 index 00000000..4c9fc137 --- /dev/null +++ b/cpymo-backends/nds/RELEASE-NOTES-1.3.0.md @@ -0,0 +1,36 @@ +# CPyMO for NDS 1.3.0 + +**维护更新:界面主题、双屏辅助指南、选中高亮、音频输出,以及 NDS 程序及配套转换器图标焕新。** + +## 本次更新 + +- 新增原版 Nintendo DS/DS Lite 固件的 16 种主题颜色,支持“默认”经典配色与“自动”跟随主机设置。自动模式的 RGB555 配色在载入和设置时缓存,避免反复读取主机固件影响游戏列表操作响应。 +- 统一 2 像素选中竖线,默认深蓝版采用最终校准的蓝青色;彩色主题采用清晰的浅色主文字与柔和的主题强调文字。修正“默认/自动”选项的居中。 +- 从游戏资料库按 **START** 可启动游戏;菜单脚注和多语言辅助说明按最终版更新。 +- 游戏内确认“重新开始”时恢复标题阶段的辅助屏指引,进入正文后再次自动切换;三种显示模式仍可通过 **L** 切换。原游戏标题菜单图像与脚本不改动。 +- 修复《水仙1》《水仙2》标题菜单选中高亮的 RGB555 Alpha 混合取整问题,无需重新转换原游戏资源。 +- 音频增加约 **+1.5 dB** 的保守目标增益,峰值保护避免 PCM 输出数字削波;BGM、语音、音效和视频音轨共用保护逻辑,不改变游戏配置或硬件音量。听感仍因录音响度和主机而异。 +- **NDS 程序及配套转换器图标焕新。** 采用同源的用户提供插画:NDS 保留完整方形构图,搭配柔和细边框,小图轮廓更清楚,加载画面的图标也更细腻;Windows/macOS 的**配套游戏转换器**采用平滑圆角版本。macOS 同时改善图标显示比例。两款桌面工具为配套游戏转换器。 + +## 兼容、升级与下载 + +1. 继续使用同一个自动识别 DS/NTR、DSi/TWL 的通用 `cpymo-nds.nds`;已有可运行的 1.2.0 游戏缓存与存档可以保留,通常只需更新 ROM。请勿覆盖已有游戏目录及 save 数据。 +2. Windows 转换器提供免安装 ZIP;Apple Silicon Mac 提供 ARM64 原生 `.app`(未经 Apple Developer ID 签名、公证)。Intel Mac/Linux 可使用适配环境下的源码工具;不提供 Intel Mac 的预编译版。 +3. 转换器接收 PyMO 游戏 **ZIP/已解压文件夹**;Android PyMO 游戏数据可转换,但不把 APK 安装包作为直接输入。NVL1 视频仍为默认,可选 NVA1 或跳过视频。发行包**不包含任何游戏文件**。 +4. 音频增益、主题配色仅属于 NDS 移植后端;不改变上游通用 CPyMO 的行为。 + +## 1.3.0 桌面转换器维护 + +补回 1.2 维护版已经提供、但在 1.3 首发源码整合时遗漏的三处界面修补:进度条仅在识别或转换任务运行时显示;游戏版本列表按候选数量调整高度,超过三项才显示滚动条;视频选项宽度随窗口伸展。同时恢复对应回归检查,并在 Windows 冻结程序验收中检查实际控件状态。 + +版本号继续为 **1.3.0**,不改变转换算法、NDS ROM、游戏数据或存档。`nds-v1.3.0` 标签已按用户决定同步到通过验收的维护提交 `ef8b427c6a4092c717e90f571b57d6a212e5e7dd`,自动生成源码与当前发行包实现一致;命名源码 ZIP 还包含构建所需子模块源码。首发提交与原标签对象保留在历史验收记录中,当前构建与校验记录以发行页为准。 + +## 法律、作者与验证 + +NDS 移植:**千岚之夏(Blueteemo)**;CPyMO:Seng Jik 与贡献者;PyMO:chen_xin_ming 与贡献者。引擎/后端为 AGPL-3.0-or-later,独立转换器为 MIT;Fusion Pixel、GNU Unifont 及 FFmpeg 的对应来源与许可证随源码和打包发行。桌面图标源自 PyMO 原图案的 AI 辅助高清衍生设计,保留原作者声明与 MIT 许可证,不暗示 PyMO 原作者参与或认可本次发布。 + +发行时应提供同一构建的 ROM、Windows 版、macOS ARM64 版、源码与 SHA-256 清单。macOS 首次运行可能触发 Gatekeeper:请验证下载来源与 SHA-256,按 Apple 系统设置中的官方流程处理;不要关闭 SIP 或全局 Gatekeeper。 + +程序与配套转换器实际版本统一为 **1.3.0**,由同一份源码重新构建。此前未正式发布的 1.2.1 候选记录保留为研究历史。正式文件、实际 SHA-256 及构建验收记录以 [1.3.0 发行页](https://github.com/Blueteemo/CPyMO/releases/tag/nds-v1.3.0) 和随附清单为准。 + +[项目仓库](https://github.com/Blueteemo/CPyMO) · [NDS 后端说明](https://github.com/Blueteemo/CPyMO/tree/main/cpymo-backends/nds) · [上游 PR #60](https://github.com/Strrationalism/CPyMO/pull/60) diff --git a/cpymo-backends/nds/VALIDATION-UI.md b/cpymo-backends/nds/VALIDATION-UI.md new file mode 100644 index 00000000..ce1c07ed --- /dev/null +++ b/cpymo-backends/nds/VALIDATION-UI.md @@ -0,0 +1,26 @@ +# NDS 1.1.0 UI validation (2026-10-20) + +- Four UI languages: Simplified Chinese, Traditional Chinese, English, Japanese. +- Visible order: Auto, 简体中文, 繁體中文, English, 日本語. Saved IDs directly follow this order: 0=Auto, 1=CHS, 2=CHT, 3=EN, 4=JA. No legacy-ID remapping, as explicitly requested. +- First normal boot defaults to CHS. Saved choices persist. Auto recognizes firmware Japanese/English/Chinese; unsupported/invalid firmware falls back to CHS. Before FAT, firmware/fallback works from ROM-only glyphs. +- Final version string and banner: 1.1.0. ROM: 807936 bytes, SHA256 `af39d5c905e4fee2281e6138818416f42e533e8f306074af007599db80f88c45`. +- 19 final-ROM tests passed on stock melonDS 1.1, ordinary DS 4 MiB: language UI order/cycling, four-language menus/settings/save-load, saved CHT/JA/EN and Auto, first boot and automatic language fallbacks, three FAT error locales, game/menu clock switching, midnight/invalid RTC, and four-game library header updates. +- Library lower-screen title contains only the translated Select a game text; X language help is only in the footer. All four title variants match the approved native Fusion 12px glyphs exactly (five pixel checks including Auto). The legacy 13px title path and the visible language diagnostics entry are removed. SELECT on About does nothing; B returns. +- ROM-only fallback contains 584 glyphs in 12/16px sizes. Added languages affect engine UI only, not scripts or game metadata. +- Clock is shown once in gameplay: auxiliary normally, menu panel while X menu is open. L/Y and minute updates preserve this rule. Child settings/save pages keep their existing layout and auxiliary clock. +- User confirmed the final title-fixed 1.1.0 short test on their Wood R4: "已测,正常" (2026-10-20). The release rebuild is byte-identical to that ROM. This is not full-route/all-flashcart certification. +- Local test records and screenshots are retained outside the repository. No user game media, saves or runtime binaries belong in a source PR. + + +## Release integration checks + +- Fresh build in the PR integration tree: all 55 objects rebuilt; ROM hash identical to the accepted artifact above. +- Five Python converter regression tests, including actual worker defaults, video omission, source/script preservation, packed masks, archive traversal and integrity checks. +- Fresh Windows portable build includes matching root/embedded ROM, audio-only FFmpeg, LZ4 and rebuilt native lossless encoder. +- Real frozen GUI default conversions of synthetic S60v3/S60v5/Android nested archives pass with PATH restricted to Windows System32, no external Python/FFmpeg. Actual jobs use cache_only=true and audio_lossless=voice. +- All three fresh outputs boot on stock melonDS 1.1 in DS/4 MiB mode: images and audio work, movie instructions skip, no allocation/I/O/glyph errors. Test images are removed after completion. +- Existing 1.0 caches remain readable; save formats/paths and original scripts are unchanged. New compressed caches require 1.1. +- Video decoding is still experimental source code; the public converter omits videos. Default BGM/SE are PCM. No universal compatibility claim. +- NDS-only contribution: upstream root README, global version and other backends are not modified. No game data or user saves are distributed. + +FAT failures render the diagnostic/error code above and recovery hints below using ROM-only glyphs; historical duplicate-frame display was intentional mirroring. Firmware detection reads Calico/libnds g_envUserSettings / PersonalData, never the R4 menu language or firmware writes. Stored manual settings can only be read after FAT succeeds. diff --git a/cpymo-backends/nds/VALIDATION.md b/cpymo-backends/nds/VALIDATION.md new file mode 100644 index 00000000..b903232c --- /dev/null +++ b/cpymo-backends/nds/VALIDATION.md @@ -0,0 +1,71 @@ +# NDS 1.0.0 validation + +This release is based on upstream core 5a746bc72a4a8c127e0aee7deb20bf415c385ae2 +and the user-accepted 0.5.6.3 NDS baseline. No platform tier is assigned here. + +Local build: devkitARM r68 / GCC16.1, Calico1.2.0, libnds2.0.2, +libfat-nds2.1.0-4 (libdvm), Maxmod2.1.0, ndstool2.3.1. +The ROM is 710656 bytes. The portable helper embeds the identical ROM and +release metadata; output copies are checked by SHA-256. +An independent complete source snapshot built in a different directory with +the same SDK produces the identical ROM SHA-256 after source-path normalization. + +The local headless frontend uses the unmodified official melonDS1.1 core, +direct boot, DLDI-patched FAT storage, and DS MainRAMMask=0x3fffff (4MiB). +Checks include the early startup frames/library, FAT failure, dialogue, +B/X/Y/L/touch controls, per-game read-text dimming, native fonts, +standard slot1 save/load, and audio playback. Malformed or absent video +caches are skipped and the script continues into normal dialogue/audio. + +Both complete existing Narcissu1/2 converted datasets were reused for focused +startup/dialogue/menu/save/load checks. Both passed with zero allocation +failures, I/O failures, missing glyphs and raw image loads. Test-modified saves +were restored byte-for-byte; no complete game-data copy was created. +These checks do not certify all chapters or unrelated PyMO games. + +The frozen Windows helper was run with PATH containing only Windows System32 +and without PYTHONPATH/PYTHONHOME. GUI selection/conversion and nested bundles +containing S60v3, S60v5 and Android synthetic inputs passed. Original archive +hashes and script bytes were preserved, input saves excluded, videos omitted +with audit records, and all output ROM hashes matched. An actual converted +synthetic game then displayed Chinese, played PCM audio and skipped its video +command in stock DS-mode melonDS. The bundled FFmpeg additionally decoded a +real MP3 from the existing game dataset. + +Reproducible converter regression checks (synthetic fixtures, no game assets): + +```sh +python -m pip install -r cpymo-tool/nds-converter/requirements.txt +python -m unittest discover -s cpymo-tool/nds-converter/tests -v +``` + +FFmpeg must be on PATH, or set NDS_TEST_FFMPEG to the audio-only executable. +Tests verify all three input platforms, packed S60v3 backgrounds, nested ZIP/APK +selection, unsafe-path rejection, video omission, source/script preservation, +detection of corrupted generated audio, and packed/loose uppercase Symbian +_MASK transparency. Four synthetic unit tests are provided. + +The user gave final acceptance on an R4 with Wood kernel on 2026-10-11. +The accepted pre-release was listfont-r3 (SHA256 +`e453644899cf6020f3098e7c229f1cf2f3b874494553a83e5715261fb012b262`). +Version 1.0.0 promotes the same engine implementation with release metadata +updated. Lid mute/resume was tested on +hardware during baseline development; historical automated lid +tests used a separately documented emulator scheduling fix. Stock melonDS +checks must not be presented as new hardware or stock-emulator lid certification. + +Known first-release limit: 22050Hz mono PCM16 and retained original non-video +media increase installed game size. Video, compression and DSi enhancements +remain separate later work. Conversion audits are not compatibility guarantees. +The root README and upstream all-platform version are unchanged. + +## Final pre-release fixes + +List rows use each game own native Fusion Pixel 12px dialogue glyphs and +advances, ignoring stale title bitmap styles. Actual-card metadata/fonts +reproduced the older Narcissu title style; list and title-as-dialogue pixels +match exactly for three games across selection, refresh and About return. +Global character-effects OFF and cross-game/reboot persistence have separate +synthetic coverage. The portable EXE also verifies uppercase packed/loose +mask alpha pixels and input preservation. User feedback includes Narcissu1/2 +and Haruka play checks; it is not a new all-route certification. diff --git a/cpymo-backends/nds/VERSION b/cpymo-backends/nds/VERSION new file mode 100644 index 00000000..f0bb29e7 --- /dev/null +++ b/cpymo-backends/nds/VERSION @@ -0,0 +1 @@ +1.3.0 diff --git a/cpymo-backends/nds/arm7/main.c b/cpymo-backends/nds/arm7/main.c new file mode 100644 index 00000000..5947923b --- /dev/null +++ b/cpymo-backends/nds/arm7/main.c @@ -0,0 +1,39 @@ +/* CPyMO NDS ARM7 services; AGPL-3.0-or-later. + Uses Calico 1.2.0 public APIs and preserves the standard service priorities. */ +#include +#include +#include +#include +#include +#include +#include + +static Mailbox backlight_mailbox; +static u32 backlight_slots[4]; +static Thread backlight_thread; +static u64 backlight_stack[128]; +static int backlight_worker(void* arg){ + (void)arg; + for(;;){ + /* PXI mailbox receives the already decoded immediate value. */ + unsigned lights=mailboxRecv(&backlight_mailbox)&12; + /* Calico PMIC functions require the caller to hold the shared SPI lock. + Keep read/modify/write together and preserve audio, LED and power bits. */ + spiLock();u8 control=pmicReadRegister(PmicReg_Control); + bool ok=pmicWriteRegister(PmicReg_Control,(control&~12)|lights); + u8 actual=pmicReadRegister(PmicReg_Control);spiUnlock(); + pxiReply(PxiChannel_User0,ok?(actual&12):0x100); + } + return 0; +} +int main(void){ + envReadNvramSettings();keypadStartExtServer(); + lcdSetIrqMask(DISPSTAT_IE_VBLANK|DISPSTAT_IE_HBLANK|DISPSTAT_IE_VCOUNT,DISPSTAT_IE_VBLANK); + irqEnable(IRQ_VBLANK);rtcInit();rtcSyncTime();pmInit();blkInit(); + touchInit();touchStartServer(80,28);soundStartServer(12);micStartServer(4);wlmgrStartServer(20);mmInstall(29); + mailboxPrepare(&backlight_mailbox,backlight_slots,4); + threadPrepare(&backlight_thread,backlight_worker,0,backlight_stack+128,26);threadStart(&backlight_thread); + pxiSetMailbox(PxiChannel_User0,&backlight_mailbox); + while(pmMainLoop())threadWaitForVBlank(); + return 0; +} diff --git a/cpymo-backends/nds/assets/ICON-ORIGIN.md b/cpymo-backends/nds/assets/ICON-ORIGIN.md new file mode 100644 index 00000000..c4d967bd --- /dev/null +++ b/cpymo-backends/nds/assets/ICON-ORIGIN.md @@ -0,0 +1,24 @@ +# NDS 图标来源与处理 + +## 1.3.0 已通过用户实机视觉验收的方案 + +沿用整幅方形插画构图,增加 1 原生像素暖灰棕边框(RGB555 14/12/10,对应显示 RGB 115/98/82)。画面等比例缩入边框内部,不裁切、不增加圆角。32×32 菜单图标保持最多 15 种不透明 RGB555 颜色,并为透明索引 0 留位;24×24 默认列表占位符、64×64 加载页图标独立从高清图派生,避免将低色 32×32 图放大。24/32 像素采用轻度细节增强,64 像素保留平滑缩小效果。 + +当前测试源原件以 `icon-source-square.png` 保存,1254×1254 RGB,文件 SHA-256 `f3bb25e8d37c8c8201969c8a59d629983544786c80903c5c27de848ffe532312`,RGBA 像素 SHA-256 `7e157efd3272febbd8431f70e9e9fdd80fa13fecd3ef83d0299ba489210b5c10`。此文件为本地下载目录中用于本轮预览、并在用户授权选择方案后采用的方形图;文件身份与下列历史记录不同,分别保留,不能冒称同一文件。 + +生成入口:`../tools/build_nds_icons.py`。派生参数、各实际输出哈希记录于 `NDS-ICON-MANIFEST.json`。只读检查入口 `../tools/verify_nds_icons.py` 可对真实 ROM 检查 Banner 与三档内部像素数组;桌面转换器的批准母稿、Windows 图标和 Mac 派生规则不变。游戏自带封面/图标不被默认占位符覆盖。 + +用户于 2026-11-06 完成实机观察,反馈「效果不错,可以继续推进之前的进度了」。验收测试 ROM SHA-256 为 `d1eed5c919d01724f5c48eef4bb952f8c4fa0ab886504943cf8be0788cc15623`,源码为 `46e0aad00df00b9c3c505960b5cb88d49dd0f91a`。这条记录来自用户反馈,不冒称代理独立观察了真实硬件;正式配套构建与发行验收仍按 1.3.0 检查清单执行。 + +## 历史:1.2.1 无边框图标 + +本版 NDS 系统菜单 Banner、启动页及默认占位图标使用用户提供并批准的原始方形插画,不增加圆角或文字,不覆盖游戏各自的封面/图标。 + +原始文件:a_close_up_anime_style_illustration_soft_warm_s(1).png +原始 PNG SHA-256:c5144d0bc49afdbccb3ce336cbedfecf130eb50574e4df7de35c048db34b9c38 + +高质量缩小后量化为 32×32、15 种不透明 RGB555 颜色。assets/icon.png、assets/icon.bmp 与 source/app-icon.h 对应相同的 1024 个像素;四角保留完整画面。桌面转换器则采用同一原画的平滑圆角版,这是平台适配而不是三个游戏客户端。 + +图案母题来自 PyMO 的少女、黄色吉祥物及手柄;高清插画由用户提供,是 AI 辅助衍生画面,不代表原角色独立原创或原作者背书。保留 PyMO 原项目的作者声明和 MIT 许可,详见 ../../../cpymo-tool/nds-converter/assets/ICON-ATTRIBUTION.txt 与 PYMO-ORIGINAL-MIT-LICENSE.txt。 + +此前简化像素图标已被取代,不作为本版备用图标另行分发;不重写既有 Git 历史。 diff --git a/cpymo-backends/nds/assets/NDS-ICON-MANIFEST.json b/cpymo-backends/nds/assets/NDS-ICON-MANIFEST.json new file mode 100644 index 00000000..db6a73fc --- /dev/null +++ b/cpymo-backends/nds/assets/NDS-ICON-MANIFEST.json @@ -0,0 +1,83 @@ +{ + "source": "icon-source-square.png", + "source_sha256": "f3bb25e8d37c8c8201969c8a59d629983544786c80903c5c27de848ffe532312", + "source_rgba_sha256": "7e157efd3272febbd8431f70e9e9fdd80fa13fecd3ef83d0299ba489210b5c10", + "source_size": [ + 1254, + 1254 + ], + "border_rgb555": [ + 14, + 12, + 10 + ], + "border_rgb": [ + 115, + 98, + 82 + ], + "border_pixels": 1, + "uniform_scale": true, + "crop_or_corner_mask": false, + "resampling": "LANCZOS", + "small_detail_filter": { + "sizes": [ + 24, + 32 + ], + "radius": 0.55, + "percent": 80, + "threshold": 2 + }, + "banner_quantization": { + "art_colors": 14, + "border_color": 1, + "method": "MEDIANCUT", + "kmeans": 8, + "dither": "NONE", + "transparent_palette_index": 0, + "actual_opaque_colors": 15 + }, + "runtime_sizes": [ + 24, + 32, + 64 + ], + "outputs": { + "assets/icon.png": { + "bytes": 1235, + "sha256": "0d2b51eeb6b91003ac7388de3f5b13515386cfc5f66b5c4cb33bf337b215accb", + "size": [ + 32, + 32 + ], + "rgb_sha256": "797ee3db1666439bf37f294126d12c2b0f74be11701b7bdd0426e887a892aeb7" + }, + "assets/icon-small.png": { + "bytes": 1029, + "sha256": "9b5abf947a232e54c876892167f24a14d30157f63d5a240bd0ef28477aa96967", + "size": [ + 24, + 24 + ], + "rgb_sha256": "180bb6238baf17f485b5928b3746fdef89a47408881786d627844c8b715fbb43" + }, + "assets/icon-splash.png": { + "bytes": 5504, + "sha256": "d3d4b3f27a3870807ac59d36f0b66992e9f650d5334ad0aae26e7dc44eb23840", + "size": [ + 64, + 64 + ], + "rgb_sha256": "7f1dbd49e38fb04c9fa4a87a98f08236afcd20005b66ee9f7141b1a2cb58ade7" + }, + "assets/icon.bmp": { + "bytes": 2102, + "sha256": "4b465cfef21b3a38e782035f9c1f88dc45011c3d0232764dabfaa33b38eb73b0" + }, + "source/app-icon.h": { + "bytes": 34803, + "sha256": "0080fa33b53a6ddc4e0cd4f714a57ddee300f611169c3168dff370ff3bff92cc" + } + } +} diff --git a/cpymo-backends/nds/assets/icon-small.png b/cpymo-backends/nds/assets/icon-small.png new file mode 100644 index 00000000..970b9d51 Binary files /dev/null and b/cpymo-backends/nds/assets/icon-small.png differ diff --git a/cpymo-backends/nds/assets/icon-source-square.png b/cpymo-backends/nds/assets/icon-source-square.png new file mode 100644 index 00000000..6b79e1ac Binary files /dev/null and b/cpymo-backends/nds/assets/icon-source-square.png differ diff --git a/cpymo-backends/nds/assets/icon-splash.png b/cpymo-backends/nds/assets/icon-splash.png new file mode 100644 index 00000000..f0d88e91 Binary files /dev/null and b/cpymo-backends/nds/assets/icon-splash.png differ diff --git a/cpymo-backends/nds/assets/icon.bmp b/cpymo-backends/nds/assets/icon.bmp new file mode 100644 index 00000000..2d43bc63 Binary files /dev/null and b/cpymo-backends/nds/assets/icon.bmp differ diff --git a/cpymo-backends/nds/assets/icon.png b/cpymo-backends/nds/assets/icon.png new file mode 100644 index 00000000..5ded12b7 Binary files /dev/null and b/cpymo-backends/nds/assets/icon.png differ diff --git a/cpymo-backends/nds/assets/nds-dual-bg.rgb555 b/cpymo-backends/nds/assets/nds-dual-bg.rgb555 new file mode 100644 index 00000000..81911f4a Binary files /dev/null and b/cpymo-backends/nds/assets/nds-dual-bg.rgb555 differ diff --git a/cpymo-backends/nds/build.py b/cpymo-backends/nds/build.py new file mode 100644 index 00000000..294e6af4 --- /dev/null +++ b/cpymo-backends/nds/build.py @@ -0,0 +1,81 @@ +"""Build the native DS backend using the pinned devkitPro SDK; Python 3.10+.""" +from pathlib import Path +import subprocess, json, hashlib, os, sys +from rom_banner import patch_nds_banner_titles +experiment = sys.argv[1:] == ['--dsi-experiment'] +if sys.argv[1:] and not experiment: + raise SystemExit('usage: build.py [--dsi-experiment]') +project=Path(__file__).resolve().parent +sdk=Path(os.environ['DEVKITPRO']).resolve() +exe='.exe' if os.name=='nt' else '' +engine=project +build=engine/('build-dsi-experiment' if experiment else 'build') +build.mkdir(exist_ok=True) +core=project.parents[1] +prefix_flags=[] +for path,replacement in [(core,'.'),(sdk,'/opt/devkitpro')]: + for spelling in sorted({str(path),path.as_posix()}): + prefix_flags.append(f'-ffile-prefix-map={spelling}={replacement}') +record=engine/('build-records-dsi-experiment' if experiment else 'build-records') +record.mkdir(parents=True,exist_ok=True) +# Regenerate the self-contained ROM bitmap UI font before compiling. +# Every released locale must draw new engine-owned menu labels even for +# legacy converted games whose per-title cache lacks these glyphs. +subprocess.run([sys.executable,str(engine/'tools/generate-ui-font.py')],check=True) +release=json.loads((engine/'release.json').read_text(encoding='utf8')) +assert (engine/'VERSION').read_text().strip()==release['version'], 'VERSION/release.json mismatch' +(build/'release-version.h').write_text('#define CPYMO_NDS_VERSION '+json.dumps(release['version'])+'\n',encoding='ascii') +commands=[] +with (record/'native-windows-build.log').open('w',encoding='utf-8') as log: + def run(args): + args=list(map(str,args));commands.append(args) + log.write(json.dumps(args)+'\n');log.flush() + try: + subprocess.run(args,cwd=build,stdout=log,stderr=subprocess.STDOUT,check=True) + except subprocess.CalledProcessError: + # CI previously emitted only the Python traceback; show the actual GCC + # diagnostics while retaining the full reproducible build record on disk. + log.flush() + lines=(record/'native-windows-build.log').read_text(encoding='utf-8',errors='replace').splitlines() + print('NDS compiler/linker failure — last 90 build-log lines:',file=sys.stderr) + errors=[i for i,line in enumerate(lines) if ('error:' in line or 'undefined reference' in line or 'fatal error:' in line)] + for i in errors[:15]: + print('\\n'.join(lines[max(0,i-3):min(len(lines),i+3)]),file=sys.stderr) + print('\\n'.join(lines[-25:]),file=sys.stderr) + raise + gcc=sdk/('devkitARM/bin/arm-none-eabi-gcc'+exe) + flags=[*prefix_flags,'-D__NDS__','-DARM9','-std=gnu11','-g','-Wall','-O2','-DHAVE_CONFIG_H','-DDISABLE_MOVIE','-DDISABLE_FFMPEG_AUDIO','-DENABLE_TEXT_EXTRACT','-DSTREAMING_LOAD_IMAGE','-ffunction-sections','-fdata-sections','-march=armv5te','-mtune=arm946e-s','-marm'] + if experiment: + flags.append('-DCPYMO_DSI_MEMORY_LAYOUT') + for inc in [sdk/'calico/include',sdk/'libnds/include',engine/'include',build,engine/'decoder',core/'cpymo',core/'cpymo-backends/include',core/'stb']: + flags+=['-I'+str(inc)] + objects=[] + local_sources={p.name for p in (engine/'source').glob('*.c')} + for folder in [engine/'source',engine/'decoder',core/'cpymo']: + for source in sorted(folder.glob('*.c')): + if source.name=='cpymo_audio.c':continue + if folder==core/'cpymo' and source.name in local_sources:continue + obj=build/(source.stem+'.o');objects.append(obj) + run([gcc,*flags,'-MMD','-MP','-MF',obj.with_suffix('.d'),'-c',source,'-o',obj]) + wraps='-Wl,--wrap=malloc,--wrap=calloc,--wrap=realloc,--wrap=stbi_load_from_callbacks,--wrap=cpymo_assetloader_load_bg_image,--wrap=cpymo_assetloader_load_chara_image,--wrap=cpymo_assetloader_load_system_image,--wrap=cpymo_movie_play,--wrap=cpymo_localization_get,--wrap=cpymo_rmenu_enter,--wrap=cpymo_ui_enter,--wrap=cpymo_charas_wait' + if (engine/'source/masktrans-nds.h').exists():wraps+=',--wrap=cpymo_assetloader_load_system_masktrans' + elf=engine/('engine-dsi-experiment.elf' if experiment else 'engine.elf') + run([gcc,'-L'+str(sdk/'calico/lib'),'-L'+str(sdk/'libnds/lib'),'-specs='+str(sdk/'calico/share/ds9.specs'),'-g','-march=armv5te','-mtune=arm946e-s','-marm','-Wl,-Map,engine.map',wraps,*objects,'-lmm9','-lfat','-lnds9','-lm','-lcalico_ds9','-o',elf]) + icon=engine/'assets/icon.bmp' + arm7=sdk/'calico/bin/ds7_maine.elf' + if (engine/'arm7/main.c').exists(): + arm7=engine/('arm7-dsi-experiment.elf' if experiment else 'arm7.elf') + run([gcc,*prefix_flags,'-D__NDS__','-DARM7','-std=gnu11','-g','-Wall','-O2','-ffunction-sections','-fdata-sections','-march=armv4t','-mtune=arm7tdmi','-mthumb','-I'+str(sdk/'calico/include'),'-I'+str(sdk/'libnds/include'),'-c',engine/'arm7/main.c','-o',build/'arm7-main.o']) + run([gcc,'-L'+str(sdk/'calico/lib'),'-L'+str(sdk/'libnds/lib'),'-specs='+str(sdk/'calico/share/ds7.specs'),'-g','-march=armv4t','-mtune=arm7tdmi','-mthumb',build/'arm7-main.o','-lmm7','-lcalico_ds7','-lm','-o',arm7]) + version=(engine/'VERSION').read_text().strip() if (engine/'VERSION').exists() else '0.5.0-test' + rom=engine/('cpymo-dsi-experiment.nds' if experiment else 'engine.nds') + # ndstool's -b parser handles one-byte characters, not UTF-8 text. + # Generate a safe ASCII banner first; then write the desired UTF-16LE + # attribution and refresh the banner CRC16 in the finished ROM. + run([sdk/('tools/bin/ndstool'+exe),'-c',rom,'-9',elf,'-7',arm7,'-b',icon if icon.exists() else sdk/'calico/share/nds-icon.bmp',f'CPyMO for NDS;{version};NDS port' if icon.exists() else 'engine;built with devkitARM;http://devkitpro.org']) + if icon.exists(): + patch_nds_banner_titles(rom,('CPyMO for NDS',version,'千岚之夏')) + run([sdk/('devkitARM/bin/arm-none-eabi-size'+exe),elf]) +(record/'native-windows-build-commands.json').write_text(json.dumps(commands,indent=2),encoding='utf-8') +rom=engine/('cpymo-dsi-experiment.nds' if experiment else 'engine.nds') +print(json.dumps({'experiment':experiment,'bytes':rom.stat().st_size,'sha256':hashlib.sha256(rom.read_bytes()).hexdigest(),'objects_rebuilt':len(objects)})) diff --git a/cpymo-backends/nds/decoder/COPYING b/cpymo-backends/nds/decoder/COPYING new file mode 100644 index 00000000..d60c31a9 --- /dev/null +++ b/cpymo-backends/nds/decoder/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/cpymo-backends/nds/decoder/D.dat b/cpymo-backends/nds/decoder/D.dat new file mode 100644 index 00000000..317db3be --- /dev/null +++ b/cpymo-backends/nds/decoder/D.dat @@ -0,0 +1,606 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * These are the coefficients for the subband synthesis window. This is a + * reordered version of Table B.3 from ISO/IEC 11172-3. + * + * Every value is parameterized so that shift optimizations can be made at + * compile-time. For example, every value can be right-shifted 12 bits to + * minimize multiply instruction times without any loss of accuracy. + */ + + { PRESHIFT(0x00000000) /* 0.000000000 */, /* 0 */ + -PRESHIFT(0x0001d000) /* -0.000442505 */, + PRESHIFT(0x000d5000) /* 0.003250122 */, + -PRESHIFT(0x001cb000) /* -0.007003784 */, + PRESHIFT(0x007f5000) /* 0.031082153 */, + -PRESHIFT(0x01421000) /* -0.078628540 */, + PRESHIFT(0x019ae000) /* 0.100311279 */, + -PRESHIFT(0x09271000) /* -0.572036743 */, + PRESHIFT(0x1251e000) /* 1.144989014 */, + PRESHIFT(0x09271000) /* 0.572036743 */, + PRESHIFT(0x019ae000) /* 0.100311279 */, + PRESHIFT(0x01421000) /* 0.078628540 */, + PRESHIFT(0x007f5000) /* 0.031082153 */, + PRESHIFT(0x001cb000) /* 0.007003784 */, + PRESHIFT(0x000d5000) /* 0.003250122 */, + PRESHIFT(0x0001d000) /* 0.000442505 */, + + PRESHIFT(0x00000000) /* 0.000000000 */, + -PRESHIFT(0x0001d000) /* -0.000442505 */, + PRESHIFT(0x000d5000) /* 0.003250122 */, + -PRESHIFT(0x001cb000) /* -0.007003784 */, + PRESHIFT(0x007f5000) /* 0.031082153 */, + -PRESHIFT(0x01421000) /* -0.078628540 */, + PRESHIFT(0x019ae000) /* 0.100311279 */, + -PRESHIFT(0x09271000) /* -0.572036743 */, + PRESHIFT(0x1251e000) /* 1.144989014 */, + PRESHIFT(0x09271000) /* 0.572036743 */, + PRESHIFT(0x019ae000) /* 0.100311279 */, + PRESHIFT(0x01421000) /* 0.078628540 */, + PRESHIFT(0x007f5000) /* 0.031082153 */, + PRESHIFT(0x001cb000) /* 0.007003784 */, + PRESHIFT(0x000d5000) /* 0.003250122 */, + PRESHIFT(0x0001d000) /* 0.000442505 */ }, + + { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 1 */ + -PRESHIFT(0x0001f000) /* -0.000473022 */, + PRESHIFT(0x000da000) /* 0.003326416 */, + -PRESHIFT(0x00207000) /* -0.007919312 */, + PRESHIFT(0x007d0000) /* 0.030517578 */, + -PRESHIFT(0x0158d000) /* -0.084182739 */, + PRESHIFT(0x01747000) /* 0.090927124 */, + -PRESHIFT(0x099a8000) /* -0.600219727 */, + PRESHIFT(0x124f0000) /* 1.144287109 */, + PRESHIFT(0x08b38000) /* 0.543823242 */, + PRESHIFT(0x01bde000) /* 0.108856201 */, + PRESHIFT(0x012b4000) /* 0.073059082 */, + PRESHIFT(0x0080f000) /* 0.031478882 */, + PRESHIFT(0x00191000) /* 0.006118774 */, + PRESHIFT(0x000d0000) /* 0.003173828 */, + PRESHIFT(0x0001a000) /* 0.000396729 */, + + -PRESHIFT(0x00001000) /* -0.000015259 */, + -PRESHIFT(0x0001f000) /* -0.000473022 */, + PRESHIFT(0x000da000) /* 0.003326416 */, + -PRESHIFT(0x00207000) /* -0.007919312 */, + PRESHIFT(0x007d0000) /* 0.030517578 */, + -PRESHIFT(0x0158d000) /* -0.084182739 */, + PRESHIFT(0x01747000) /* 0.090927124 */, + -PRESHIFT(0x099a8000) /* -0.600219727 */, + PRESHIFT(0x124f0000) /* 1.144287109 */, + PRESHIFT(0x08b38000) /* 0.543823242 */, + PRESHIFT(0x01bde000) /* 0.108856201 */, + PRESHIFT(0x012b4000) /* 0.073059082 */, + PRESHIFT(0x0080f000) /* 0.031478882 */, + PRESHIFT(0x00191000) /* 0.006118774 */, + PRESHIFT(0x000d0000) /* 0.003173828 */, + PRESHIFT(0x0001a000) /* 0.000396729 */ }, + + { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 2 */ + -PRESHIFT(0x00023000) /* -0.000534058 */, + PRESHIFT(0x000de000) /* 0.003387451 */, + -PRESHIFT(0x00245000) /* -0.008865356 */, + PRESHIFT(0x007a0000) /* 0.029785156 */, + -PRESHIFT(0x016f7000) /* -0.089706421 */, + PRESHIFT(0x014a8000) /* 0.080688477 */, + -PRESHIFT(0x0a0d8000) /* -0.628295898 */, + PRESHIFT(0x12468000) /* 1.142211914 */, + PRESHIFT(0x083ff000) /* 0.515609741 */, + PRESHIFT(0x01dd8000) /* 0.116577148 */, + PRESHIFT(0x01149000) /* 0.067520142 */, + PRESHIFT(0x00820000) /* 0.031738281 */, + PRESHIFT(0x0015b000) /* 0.005294800 */, + PRESHIFT(0x000ca000) /* 0.003082275 */, + PRESHIFT(0x00018000) /* 0.000366211 */, + + -PRESHIFT(0x00001000) /* -0.000015259 */, + -PRESHIFT(0x00023000) /* -0.000534058 */, + PRESHIFT(0x000de000) /* 0.003387451 */, + -PRESHIFT(0x00245000) /* -0.008865356 */, + PRESHIFT(0x007a0000) /* 0.029785156 */, + -PRESHIFT(0x016f7000) /* -0.089706421 */, + PRESHIFT(0x014a8000) /* 0.080688477 */, + -PRESHIFT(0x0a0d8000) /* -0.628295898 */, + PRESHIFT(0x12468000) /* 1.142211914 */, + PRESHIFT(0x083ff000) /* 0.515609741 */, + PRESHIFT(0x01dd8000) /* 0.116577148 */, + PRESHIFT(0x01149000) /* 0.067520142 */, + PRESHIFT(0x00820000) /* 0.031738281 */, + PRESHIFT(0x0015b000) /* 0.005294800 */, + PRESHIFT(0x000ca000) /* 0.003082275 */, + PRESHIFT(0x00018000) /* 0.000366211 */ }, + + { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 3 */ + -PRESHIFT(0x00026000) /* -0.000579834 */, + PRESHIFT(0x000e1000) /* 0.003433228 */, + -PRESHIFT(0x00285000) /* -0.009841919 */, + PRESHIFT(0x00765000) /* 0.028884888 */, + -PRESHIFT(0x0185d000) /* -0.095169067 */, + PRESHIFT(0x011d1000) /* 0.069595337 */, + -PRESHIFT(0x0a7fe000) /* -0.656219482 */, + PRESHIFT(0x12386000) /* 1.138763428 */, + PRESHIFT(0x07ccb000) /* 0.487472534 */, + PRESHIFT(0x01f9c000) /* 0.123474121 */, + PRESHIFT(0x00fdf000) /* 0.061996460 */, + PRESHIFT(0x00827000) /* 0.031845093 */, + PRESHIFT(0x00126000) /* 0.004486084 */, + PRESHIFT(0x000c4000) /* 0.002990723 */, + PRESHIFT(0x00015000) /* 0.000320435 */, + + -PRESHIFT(0x00001000) /* -0.000015259 */, + -PRESHIFT(0x00026000) /* -0.000579834 */, + PRESHIFT(0x000e1000) /* 0.003433228 */, + -PRESHIFT(0x00285000) /* -0.009841919 */, + PRESHIFT(0x00765000) /* 0.028884888 */, + -PRESHIFT(0x0185d000) /* -0.095169067 */, + PRESHIFT(0x011d1000) /* 0.069595337 */, + -PRESHIFT(0x0a7fe000) /* -0.656219482 */, + PRESHIFT(0x12386000) /* 1.138763428 */, + PRESHIFT(0x07ccb000) /* 0.487472534 */, + PRESHIFT(0x01f9c000) /* 0.123474121 */, + PRESHIFT(0x00fdf000) /* 0.061996460 */, + PRESHIFT(0x00827000) /* 0.031845093 */, + PRESHIFT(0x00126000) /* 0.004486084 */, + PRESHIFT(0x000c4000) /* 0.002990723 */, + PRESHIFT(0x00015000) /* 0.000320435 */ }, + + { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 4 */ + -PRESHIFT(0x00029000) /* -0.000625610 */, + PRESHIFT(0x000e3000) /* 0.003463745 */, + -PRESHIFT(0x002c7000) /* -0.010848999 */, + PRESHIFT(0x0071e000) /* 0.027801514 */, + -PRESHIFT(0x019bd000) /* -0.100540161 */, + PRESHIFT(0x00ec0000) /* 0.057617187 */, + -PRESHIFT(0x0af15000) /* -0.683914185 */, + PRESHIFT(0x12249000) /* 1.133926392 */, + PRESHIFT(0x075a0000) /* 0.459472656 */, + PRESHIFT(0x0212c000) /* 0.129577637 */, + PRESHIFT(0x00e79000) /* 0.056533813 */, + PRESHIFT(0x00825000) /* 0.031814575 */, + PRESHIFT(0x000f4000) /* 0.003723145 */, + PRESHIFT(0x000be000) /* 0.002899170 */, + PRESHIFT(0x00013000) /* 0.000289917 */, + + -PRESHIFT(0x00001000) /* -0.000015259 */, + -PRESHIFT(0x00029000) /* -0.000625610 */, + PRESHIFT(0x000e3000) /* 0.003463745 */, + -PRESHIFT(0x002c7000) /* -0.010848999 */, + PRESHIFT(0x0071e000) /* 0.027801514 */, + -PRESHIFT(0x019bd000) /* -0.100540161 */, + PRESHIFT(0x00ec0000) /* 0.057617187 */, + -PRESHIFT(0x0af15000) /* -0.683914185 */, + PRESHIFT(0x12249000) /* 1.133926392 */, + PRESHIFT(0x075a0000) /* 0.459472656 */, + PRESHIFT(0x0212c000) /* 0.129577637 */, + PRESHIFT(0x00e79000) /* 0.056533813 */, + PRESHIFT(0x00825000) /* 0.031814575 */, + PRESHIFT(0x000f4000) /* 0.003723145 */, + PRESHIFT(0x000be000) /* 0.002899170 */, + PRESHIFT(0x00013000) /* 0.000289917 */ }, + + { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 5 */ + -PRESHIFT(0x0002d000) /* -0.000686646 */, + PRESHIFT(0x000e4000) /* 0.003479004 */, + -PRESHIFT(0x0030b000) /* -0.011886597 */, + PRESHIFT(0x006cb000) /* 0.026535034 */, + -PRESHIFT(0x01b17000) /* -0.105819702 */, + PRESHIFT(0x00b77000) /* 0.044784546 */, + -PRESHIFT(0x0b619000) /* -0.711318970 */, + PRESHIFT(0x120b4000) /* 1.127746582 */, + PRESHIFT(0x06e81000) /* 0.431655884 */, + PRESHIFT(0x02288000) /* 0.134887695 */, + PRESHIFT(0x00d17000) /* 0.051132202 */, + PRESHIFT(0x0081b000) /* 0.031661987 */, + PRESHIFT(0x000c5000) /* 0.003005981 */, + PRESHIFT(0x000b7000) /* 0.002792358 */, + PRESHIFT(0x00011000) /* 0.000259399 */, + + -PRESHIFT(0x00001000) /* -0.000015259 */, + -PRESHIFT(0x0002d000) /* -0.000686646 */, + PRESHIFT(0x000e4000) /* 0.003479004 */, + -PRESHIFT(0x0030b000) /* -0.011886597 */, + PRESHIFT(0x006cb000) /* 0.026535034 */, + -PRESHIFT(0x01b17000) /* -0.105819702 */, + PRESHIFT(0x00b77000) /* 0.044784546 */, + -PRESHIFT(0x0b619000) /* -0.711318970 */, + PRESHIFT(0x120b4000) /* 1.127746582 */, + PRESHIFT(0x06e81000) /* 0.431655884 */, + PRESHIFT(0x02288000) /* 0.134887695 */, + PRESHIFT(0x00d17000) /* 0.051132202 */, + PRESHIFT(0x0081b000) /* 0.031661987 */, + PRESHIFT(0x000c5000) /* 0.003005981 */, + PRESHIFT(0x000b7000) /* 0.002792358 */, + PRESHIFT(0x00011000) /* 0.000259399 */ }, + + { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 6 */ + -PRESHIFT(0x00031000) /* -0.000747681 */, + PRESHIFT(0x000e4000) /* 0.003479004 */, + -PRESHIFT(0x00350000) /* -0.012939453 */, + PRESHIFT(0x0066c000) /* 0.025085449 */, + -PRESHIFT(0x01c67000) /* -0.110946655 */, + PRESHIFT(0x007f5000) /* 0.031082153 */, + -PRESHIFT(0x0bd06000) /* -0.738372803 */, + PRESHIFT(0x11ec7000) /* 1.120223999 */, + PRESHIFT(0x06772000) /* 0.404083252 */, + PRESHIFT(0x023b3000) /* 0.139450073 */, + PRESHIFT(0x00bbc000) /* 0.045837402 */, + PRESHIFT(0x00809000) /* 0.031387329 */, + PRESHIFT(0x00099000) /* 0.002334595 */, + PRESHIFT(0x000b0000) /* 0.002685547 */, + PRESHIFT(0x00010000) /* 0.000244141 */, + + -PRESHIFT(0x00001000) /* -0.000015259 */, + -PRESHIFT(0x00031000) /* -0.000747681 */, + PRESHIFT(0x000e4000) /* 0.003479004 */, + -PRESHIFT(0x00350000) /* -0.012939453 */, + PRESHIFT(0x0066c000) /* 0.025085449 */, + -PRESHIFT(0x01c67000) /* -0.110946655 */, + PRESHIFT(0x007f5000) /* 0.031082153 */, + -PRESHIFT(0x0bd06000) /* -0.738372803 */, + PRESHIFT(0x11ec7000) /* 1.120223999 */, + PRESHIFT(0x06772000) /* 0.404083252 */, + PRESHIFT(0x023b3000) /* 0.139450073 */, + PRESHIFT(0x00bbc000) /* 0.045837402 */, + PRESHIFT(0x00809000) /* 0.031387329 */, + PRESHIFT(0x00099000) /* 0.002334595 */, + PRESHIFT(0x000b0000) /* 0.002685547 */, + PRESHIFT(0x00010000) /* 0.000244141 */ }, + + { -PRESHIFT(0x00002000) /* -0.000030518 */, /* 7 */ + -PRESHIFT(0x00035000) /* -0.000808716 */, + PRESHIFT(0x000e3000) /* 0.003463745 */, + -PRESHIFT(0x00397000) /* -0.014022827 */, + PRESHIFT(0x005ff000) /* 0.023422241 */, + -PRESHIFT(0x01dad000) /* -0.115921021 */, + PRESHIFT(0x0043a000) /* 0.016510010 */, + -PRESHIFT(0x0c3d9000) /* -0.765029907 */, + PRESHIFT(0x11c83000) /* 1.111373901 */, + PRESHIFT(0x06076000) /* 0.376800537 */, + PRESHIFT(0x024ad000) /* 0.143264771 */, + PRESHIFT(0x00a67000) /* 0.040634155 */, + PRESHIFT(0x007f0000) /* 0.031005859 */, + PRESHIFT(0x0006f000) /* 0.001693726 */, + PRESHIFT(0x000a9000) /* 0.002578735 */, + PRESHIFT(0x0000e000) /* 0.000213623 */, + + -PRESHIFT(0x00002000) /* -0.000030518 */, + -PRESHIFT(0x00035000) /* -0.000808716 */, + PRESHIFT(0x000e3000) /* 0.003463745 */, + -PRESHIFT(0x00397000) /* -0.014022827 */, + PRESHIFT(0x005ff000) /* 0.023422241 */, + -PRESHIFT(0x01dad000) /* -0.115921021 */, + PRESHIFT(0x0043a000) /* 0.016510010 */, + -PRESHIFT(0x0c3d9000) /* -0.765029907 */, + PRESHIFT(0x11c83000) /* 1.111373901 */, + PRESHIFT(0x06076000) /* 0.376800537 */, + PRESHIFT(0x024ad000) /* 0.143264771 */, + PRESHIFT(0x00a67000) /* 0.040634155 */, + PRESHIFT(0x007f0000) /* 0.031005859 */, + PRESHIFT(0x0006f000) /* 0.001693726 */, + PRESHIFT(0x000a9000) /* 0.002578735 */, + PRESHIFT(0x0000e000) /* 0.000213623 */ }, + + { -PRESHIFT(0x00002000) /* -0.000030518 */, /* 8 */ + -PRESHIFT(0x0003a000) /* -0.000885010 */, + PRESHIFT(0x000e0000) /* 0.003417969 */, + -PRESHIFT(0x003df000) /* -0.015121460 */, + PRESHIFT(0x00586000) /* 0.021575928 */, + -PRESHIFT(0x01ee6000) /* -0.120697021 */, + PRESHIFT(0x00046000) /* 0.001068115 */, + -PRESHIFT(0x0ca8d000) /* -0.791213989 */, + PRESHIFT(0x119e9000) /* 1.101211548 */, + PRESHIFT(0x05991000) /* 0.349868774 */, + PRESHIFT(0x02578000) /* 0.146362305 */, + PRESHIFT(0x0091a000) /* 0.035552979 */, + PRESHIFT(0x007d1000) /* 0.030532837 */, + PRESHIFT(0x00048000) /* 0.001098633 */, + PRESHIFT(0x000a1000) /* 0.002456665 */, + PRESHIFT(0x0000d000) /* 0.000198364 */, + + -PRESHIFT(0x00002000) /* -0.000030518 */, + -PRESHIFT(0x0003a000) /* -0.000885010 */, + PRESHIFT(0x000e0000) /* 0.003417969 */, + -PRESHIFT(0x003df000) /* -0.015121460 */, + PRESHIFT(0x00586000) /* 0.021575928 */, + -PRESHIFT(0x01ee6000) /* -0.120697021 */, + PRESHIFT(0x00046000) /* 0.001068115 */, + -PRESHIFT(0x0ca8d000) /* -0.791213989 */, + PRESHIFT(0x119e9000) /* 1.101211548 */, + PRESHIFT(0x05991000) /* 0.349868774 */, + PRESHIFT(0x02578000) /* 0.146362305 */, + PRESHIFT(0x0091a000) /* 0.035552979 */, + PRESHIFT(0x007d1000) /* 0.030532837 */, + PRESHIFT(0x00048000) /* 0.001098633 */, + PRESHIFT(0x000a1000) /* 0.002456665 */, + PRESHIFT(0x0000d000) /* 0.000198364 */ }, + + { -PRESHIFT(0x00002000) /* -0.000030518 */, /* 9 */ + -PRESHIFT(0x0003f000) /* -0.000961304 */, + PRESHIFT(0x000dd000) /* 0.003372192 */, + -PRESHIFT(0x00428000) /* -0.016235352 */, + PRESHIFT(0x00500000) /* 0.019531250 */, + -PRESHIFT(0x02011000) /* -0.125259399 */, + -PRESHIFT(0x003e6000) /* -0.015228271 */, + -PRESHIFT(0x0d11e000) /* -0.816864014 */, + PRESHIFT(0x116fc000) /* 1.089782715 */, + PRESHIFT(0x052c5000) /* 0.323318481 */, + PRESHIFT(0x02616000) /* 0.148773193 */, + PRESHIFT(0x007d6000) /* 0.030609131 */, + PRESHIFT(0x007aa000) /* 0.029937744 */, + PRESHIFT(0x00024000) /* 0.000549316 */, + PRESHIFT(0x0009a000) /* 0.002349854 */, + PRESHIFT(0x0000b000) /* 0.000167847 */, + + -PRESHIFT(0x00002000) /* -0.000030518 */, + -PRESHIFT(0x0003f000) /* -0.000961304 */, + PRESHIFT(0x000dd000) /* 0.003372192 */, + -PRESHIFT(0x00428000) /* -0.016235352 */, + PRESHIFT(0x00500000) /* 0.019531250 */, + -PRESHIFT(0x02011000) /* -0.125259399 */, + -PRESHIFT(0x003e6000) /* -0.015228271 */, + -PRESHIFT(0x0d11e000) /* -0.816864014 */, + PRESHIFT(0x116fc000) /* 1.089782715 */, + PRESHIFT(0x052c5000) /* 0.323318481 */, + PRESHIFT(0x02616000) /* 0.148773193 */, + PRESHIFT(0x007d6000) /* 0.030609131 */, + PRESHIFT(0x007aa000) /* 0.029937744 */, + PRESHIFT(0x00024000) /* 0.000549316 */, + PRESHIFT(0x0009a000) /* 0.002349854 */, + PRESHIFT(0x0000b000) /* 0.000167847 */ }, + + { -PRESHIFT(0x00002000) /* -0.000030518 */, /* 10 */ + -PRESHIFT(0x00044000) /* -0.001037598 */, + PRESHIFT(0x000d7000) /* 0.003280640 */, + -PRESHIFT(0x00471000) /* -0.017349243 */, + PRESHIFT(0x0046b000) /* 0.017257690 */, + -PRESHIFT(0x0212b000) /* -0.129562378 */, + -PRESHIFT(0x0084a000) /* -0.032379150 */, + -PRESHIFT(0x0d78a000) /* -0.841949463 */, + PRESHIFT(0x113be000) /* 1.077117920 */, + PRESHIFT(0x04c16000) /* 0.297210693 */, + PRESHIFT(0x02687000) /* 0.150497437 */, + PRESHIFT(0x0069c000) /* 0.025817871 */, + PRESHIFT(0x0077f000) /* 0.029281616 */, + PRESHIFT(0x00002000) /* 0.000030518 */, + PRESHIFT(0x00093000) /* 0.002243042 */, + PRESHIFT(0x0000a000) /* 0.000152588 */, + + -PRESHIFT(0x00002000) /* -0.000030518 */, + -PRESHIFT(0x00044000) /* -0.001037598 */, + PRESHIFT(0x000d7000) /* 0.003280640 */, + -PRESHIFT(0x00471000) /* -0.017349243 */, + PRESHIFT(0x0046b000) /* 0.017257690 */, + -PRESHIFT(0x0212b000) /* -0.129562378 */, + -PRESHIFT(0x0084a000) /* -0.032379150 */, + -PRESHIFT(0x0d78a000) /* -0.841949463 */, + PRESHIFT(0x113be000) /* 1.077117920 */, + PRESHIFT(0x04c16000) /* 0.297210693 */, + PRESHIFT(0x02687000) /* 0.150497437 */, + PRESHIFT(0x0069c000) /* 0.025817871 */, + PRESHIFT(0x0077f000) /* 0.029281616 */, + PRESHIFT(0x00002000) /* 0.000030518 */, + PRESHIFT(0x00093000) /* 0.002243042 */, + PRESHIFT(0x0000a000) /* 0.000152588 */ }, + + { -PRESHIFT(0x00003000) /* -0.000045776 */, /* 11 */ + -PRESHIFT(0x00049000) /* -0.001113892 */, + PRESHIFT(0x000d0000) /* 0.003173828 */, + -PRESHIFT(0x004ba000) /* -0.018463135 */, + PRESHIFT(0x003ca000) /* 0.014801025 */, + -PRESHIFT(0x02233000) /* -0.133590698 */, + -PRESHIFT(0x00ce4000) /* -0.050354004 */, + -PRESHIFT(0x0ddca000) /* -0.866363525 */, + PRESHIFT(0x1102f000) /* 1.063217163 */, + PRESHIFT(0x04587000) /* 0.271591187 */, + PRESHIFT(0x026cf000) /* 0.151596069 */, + PRESHIFT(0x0056c000) /* 0.021179199 */, + PRESHIFT(0x0074e000) /* 0.028533936 */, + -PRESHIFT(0x0001d000) /* -0.000442505 */, + PRESHIFT(0x0008b000) /* 0.002120972 */, + PRESHIFT(0x00009000) /* 0.000137329 */, + + -PRESHIFT(0x00003000) /* -0.000045776 */, + -PRESHIFT(0x00049000) /* -0.001113892 */, + PRESHIFT(0x000d0000) /* 0.003173828 */, + -PRESHIFT(0x004ba000) /* -0.018463135 */, + PRESHIFT(0x003ca000) /* 0.014801025 */, + -PRESHIFT(0x02233000) /* -0.133590698 */, + -PRESHIFT(0x00ce4000) /* -0.050354004 */, + -PRESHIFT(0x0ddca000) /* -0.866363525 */, + PRESHIFT(0x1102f000) /* 1.063217163 */, + PRESHIFT(0x04587000) /* 0.271591187 */, + PRESHIFT(0x026cf000) /* 0.151596069 */, + PRESHIFT(0x0056c000) /* 0.021179199 */, + PRESHIFT(0x0074e000) /* 0.028533936 */, + -PRESHIFT(0x0001d000) /* -0.000442505 */, + PRESHIFT(0x0008b000) /* 0.002120972 */, + PRESHIFT(0x00009000) /* 0.000137329 */ }, + + { -PRESHIFT(0x00003000) /* -0.000045776 */, /* 12 */ + -PRESHIFT(0x0004f000) /* -0.001205444 */, + PRESHIFT(0x000c8000) /* 0.003051758 */, + -PRESHIFT(0x00503000) /* -0.019577026 */, + PRESHIFT(0x0031a000) /* 0.012115479 */, + -PRESHIFT(0x02326000) /* -0.137298584 */, + -PRESHIFT(0x011b5000) /* -0.069168091 */, + -PRESHIFT(0x0e3dd000) /* -0.890090942 */, + PRESHIFT(0x10c54000) /* 1.048156738 */, + PRESHIFT(0x03f1b000) /* 0.246505737 */, + PRESHIFT(0x026ee000) /* 0.152069092 */, + PRESHIFT(0x00447000) /* 0.016708374 */, + PRESHIFT(0x00719000) /* 0.027725220 */, + -PRESHIFT(0x00039000) /* -0.000869751 */, + PRESHIFT(0x00084000) /* 0.002014160 */, + PRESHIFT(0x00008000) /* 0.000122070 */, + + -PRESHIFT(0x00003000) /* -0.000045776 */, + -PRESHIFT(0x0004f000) /* -0.001205444 */, + PRESHIFT(0x000c8000) /* 0.003051758 */, + -PRESHIFT(0x00503000) /* -0.019577026 */, + PRESHIFT(0x0031a000) /* 0.012115479 */, + -PRESHIFT(0x02326000) /* -0.137298584 */, + -PRESHIFT(0x011b5000) /* -0.069168091 */, + -PRESHIFT(0x0e3dd000) /* -0.890090942 */, + PRESHIFT(0x10c54000) /* 1.048156738 */, + PRESHIFT(0x03f1b000) /* 0.246505737 */, + PRESHIFT(0x026ee000) /* 0.152069092 */, + PRESHIFT(0x00447000) /* 0.016708374 */, + PRESHIFT(0x00719000) /* 0.027725220 */, + -PRESHIFT(0x00039000) /* -0.000869751 */, + PRESHIFT(0x00084000) /* 0.002014160 */, + PRESHIFT(0x00008000) /* 0.000122070 */ }, + + { -PRESHIFT(0x00004000) /* -0.000061035 */, /* 13 */ + -PRESHIFT(0x00055000) /* -0.001296997 */, + PRESHIFT(0x000bd000) /* 0.002883911 */, + -PRESHIFT(0x0054c000) /* -0.020690918 */, + PRESHIFT(0x0025d000) /* 0.009231567 */, + -PRESHIFT(0x02403000) /* -0.140670776 */, + -PRESHIFT(0x016ba000) /* -0.088775635 */, + -PRESHIFT(0x0e9be000) /* -0.913055420 */, + PRESHIFT(0x1082d000) /* 1.031936646 */, + PRESHIFT(0x038d4000) /* 0.221984863 */, + PRESHIFT(0x026e7000) /* 0.151962280 */, + PRESHIFT(0x0032e000) /* 0.012420654 */, + PRESHIFT(0x006df000) /* 0.026840210 */, + -PRESHIFT(0x00053000) /* -0.001266479 */, + PRESHIFT(0x0007d000) /* 0.001907349 */, + PRESHIFT(0x00007000) /* 0.000106812 */, + + -PRESHIFT(0x00004000) /* -0.000061035 */, + -PRESHIFT(0x00055000) /* -0.001296997 */, + PRESHIFT(0x000bd000) /* 0.002883911 */, + -PRESHIFT(0x0054c000) /* -0.020690918 */, + PRESHIFT(0x0025d000) /* 0.009231567 */, + -PRESHIFT(0x02403000) /* -0.140670776 */, + -PRESHIFT(0x016ba000) /* -0.088775635 */, + -PRESHIFT(0x0e9be000) /* -0.913055420 */, + PRESHIFT(0x1082d000) /* 1.031936646 */, + PRESHIFT(0x038d4000) /* 0.221984863 */, + PRESHIFT(0x026e7000) /* 0.151962280 */, + PRESHIFT(0x0032e000) /* 0.012420654 */, + PRESHIFT(0x006df000) /* 0.026840210 */, + -PRESHIFT(0x00053000) /* -0.001266479 */, + PRESHIFT(0x0007d000) /* 0.001907349 */, + PRESHIFT(0x00007000) /* 0.000106812 */ }, + + { -PRESHIFT(0x00004000) /* -0.000061035 */, /* 14 */ + -PRESHIFT(0x0005b000) /* -0.001388550 */, + PRESHIFT(0x000b1000) /* 0.002700806 */, + -PRESHIFT(0x00594000) /* -0.021789551 */, + PRESHIFT(0x00192000) /* 0.006134033 */, + -PRESHIFT(0x024c8000) /* -0.143676758 */, + -PRESHIFT(0x01bf2000) /* -0.109161377 */, + -PRESHIFT(0x0ef69000) /* -0.935195923 */, + PRESHIFT(0x103be000) /* 1.014617920 */, + PRESHIFT(0x032b4000) /* 0.198059082 */, + PRESHIFT(0x026bc000) /* 0.151306152 */, + PRESHIFT(0x00221000) /* 0.008316040 */, + PRESHIFT(0x006a2000) /* 0.025909424 */, + -PRESHIFT(0x0006a000) /* -0.001617432 */, + PRESHIFT(0x00075000) /* 0.001785278 */, + PRESHIFT(0x00007000) /* 0.000106812 */, + + -PRESHIFT(0x00004000) /* -0.000061035 */, + -PRESHIFT(0x0005b000) /* -0.001388550 */, + PRESHIFT(0x000b1000) /* 0.002700806 */, + -PRESHIFT(0x00594000) /* -0.021789551 */, + PRESHIFT(0x00192000) /* 0.006134033 */, + -PRESHIFT(0x024c8000) /* -0.143676758 */, + -PRESHIFT(0x01bf2000) /* -0.109161377 */, + -PRESHIFT(0x0ef69000) /* -0.935195923 */, + PRESHIFT(0x103be000) /* 1.014617920 */, + PRESHIFT(0x032b4000) /* 0.198059082 */, + PRESHIFT(0x026bc000) /* 0.151306152 */, + PRESHIFT(0x00221000) /* 0.008316040 */, + PRESHIFT(0x006a2000) /* 0.025909424 */, + -PRESHIFT(0x0006a000) /* -0.001617432 */, + PRESHIFT(0x00075000) /* 0.001785278 */, + PRESHIFT(0x00007000) /* 0.000106812 */ }, + + { -PRESHIFT(0x00005000) /* -0.000076294 */, /* 15 */ + -PRESHIFT(0x00061000) /* -0.001480103 */, + PRESHIFT(0x000a3000) /* 0.002487183 */, + -PRESHIFT(0x005da000) /* -0.022857666 */, + PRESHIFT(0x000b9000) /* 0.002822876 */, + -PRESHIFT(0x02571000) /* -0.146255493 */, + -PRESHIFT(0x0215c000) /* -0.130310059 */, + -PRESHIFT(0x0f4dc000) /* -0.956481934 */, + PRESHIFT(0x0ff0a000) /* 0.996246338 */, + PRESHIFT(0x02cbf000) /* 0.174789429 */, + PRESHIFT(0x0266e000) /* 0.150115967 */, + PRESHIFT(0x00120000) /* 0.004394531 */, + PRESHIFT(0x00662000) /* 0.024932861 */, + -PRESHIFT(0x0007f000) /* -0.001937866 */, + PRESHIFT(0x0006f000) /* 0.001693726 */, + PRESHIFT(0x00006000) /* 0.000091553 */, + + -PRESHIFT(0x00005000) /* -0.000076294 */, + -PRESHIFT(0x00061000) /* -0.001480103 */, + PRESHIFT(0x000a3000) /* 0.002487183 */, + -PRESHIFT(0x005da000) /* -0.022857666 */, + PRESHIFT(0x000b9000) /* 0.002822876 */, + -PRESHIFT(0x02571000) /* -0.146255493 */, + -PRESHIFT(0x0215c000) /* -0.130310059 */, + -PRESHIFT(0x0f4dc000) /* -0.956481934 */, + PRESHIFT(0x0ff0a000) /* 0.996246338 */, + PRESHIFT(0x02cbf000) /* 0.174789429 */, + PRESHIFT(0x0266e000) /* 0.150115967 */, + PRESHIFT(0x00120000) /* 0.004394531 */, + PRESHIFT(0x00662000) /* 0.024932861 */, + -PRESHIFT(0x0007f000) /* -0.001937866 */, + PRESHIFT(0x0006f000) /* 0.001693726 */, + PRESHIFT(0x00006000) /* 0.000091553 */ }, + + { -PRESHIFT(0x00005000) /* -0.000076294 */, /* 16 */ + -PRESHIFT(0x00068000) /* -0.001586914 */, + PRESHIFT(0x00092000) /* 0.002227783 */, + -PRESHIFT(0x0061f000) /* -0.023910522 */, + -PRESHIFT(0x0002d000) /* -0.000686646 */, + -PRESHIFT(0x025ff000) /* -0.148422241 */, + -PRESHIFT(0x026f7000) /* -0.152206421 */, + -PRESHIFT(0x0fa13000) /* -0.976852417 */, + PRESHIFT(0x0fa13000) /* 0.976852417 */, + PRESHIFT(0x026f7000) /* 0.152206421 */, + PRESHIFT(0x025ff000) /* 0.148422241 */, + PRESHIFT(0x0002d000) /* 0.000686646 */, + PRESHIFT(0x0061f000) /* 0.023910522 */, + -PRESHIFT(0x00092000) /* -0.002227783 */, + PRESHIFT(0x00068000) /* 0.001586914 */, + PRESHIFT(0x00005000) /* 0.000076294 */, + + -PRESHIFT(0x00005000) /* -0.000076294 */, + -PRESHIFT(0x00068000) /* -0.001586914 */, + PRESHIFT(0x00092000) /* 0.002227783 */, + -PRESHIFT(0x0061f000) /* -0.023910522 */, + -PRESHIFT(0x0002d000) /* -0.000686646 */, + -PRESHIFT(0x025ff000) /* -0.148422241 */, + -PRESHIFT(0x026f7000) /* -0.152206421 */, + -PRESHIFT(0x0fa13000) /* -0.976852417 */, + PRESHIFT(0x0fa13000) /* 0.976852417 */, + PRESHIFT(0x026f7000) /* 0.152206421 */, + PRESHIFT(0x025ff000) /* 0.148422241 */, + PRESHIFT(0x0002d000) /* 0.000686646 */, + PRESHIFT(0x0061f000) /* 0.023910522 */, + -PRESHIFT(0x00092000) /* -0.002227783 */, + PRESHIFT(0x00068000) /* 0.001586914 */, + PRESHIFT(0x00005000) /* 0.000076294 */ } diff --git a/cpymo-backends/nds/decoder/NOTICE.md b/cpymo-backends/nds/decoder/NOTICE.md new file mode 100644 index 00000000..5ac5a482 --- /dev/null +++ b/cpymo-backends/nds/decoder/NOTICE.md @@ -0,0 +1,13 @@ +# libmad for CPyMO NDS + +Upstream: devkitPro/libogc, libmad directory (Underbit Technologies libmad 0.15.0 beta). +https://github.com/devkitPro/libogc/tree/master/libmad + +Original source copyright notices and GPL version 2 or later terms are retained. +COPYING contains GPL-2.0 text obtained from https://raw.githubusercontent.com/sezero/libmad/master/COPYING after the GNU site returned HTTP 403. + +Original source identities and URLs: source-manifest.json (Git blob SHA1 and SHA256). + +Local NDS changes: global.h selects the existing FPM_ARM implementation instead of FPM_PPC; config.h enables newlib's assert.h and libmad's built-in OPT_SPEED/OPT_SSO synthesis option; gctypes.h is an NDS type compatibility shim. No codec mathematics or tables were rewritten. Build selects ARM instructions for the decoder's multiply assembly. The unrelated libogc mp3player.c is not included. + +NDS streaming integration is in ../source/audio-nds.c. This is a source integration, not installation of a precompiled or legacy toolchain. diff --git a/cpymo-backends/nds/decoder/README.md b/cpymo-backends/nds/decoder/README.md new file mode 100644 index 00000000..91c0d651 --- /dev/null +++ b/cpymo-backends/nds/decoder/README.md @@ -0,0 +1,6 @@ +# MPEG audio decoder + +Vendored libmad fixed-point decoder, Underbit Technologies, Inc., GPL-2.0-or-later. +See COPYING and each source header. The NDS compatibility config/type shims are +included here. This decoder is a fallback for legacy source media; converted +game audio uses the PCM cache path. Keep all notices with corresponding source. diff --git a/cpymo-backends/nds/decoder/bit.c b/cpymo-backends/nds/decoder/bit.c new file mode 100644 index 00000000..5ee3a3a7 --- /dev/null +++ b/cpymo-backends/nds/decoder/bit.c @@ -0,0 +1,236 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif + +# include "global.h" + +# ifdef HAVE_LIMITS_H +# include +# else +# define CHAR_BIT 8 +# endif + +# include "bit.h" + +/* + * This is the lookup table for computing the CRC-check word. + * As described in section 2.4.3.1 and depicted in Figure A.9 + * of ISO/IEC 11172-3, the generator polynomial is: + * + * G(X) = X^16 + X^15 + X^2 + 1 + */ +static +u16 const crc_table[256] = { + 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011, + 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022, + 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072, + 0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041, + 0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2, + 0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1, + 0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1, + 0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082, + + 0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192, + 0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1, + 0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1, + 0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2, + 0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151, + 0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162, + 0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132, + 0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101, + + 0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312, + 0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321, + 0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371, + 0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342, + 0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1, + 0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2, + 0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2, + 0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381, + + 0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291, + 0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2, + 0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2, + 0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1, + 0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252, + 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261, + 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231, + 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202 +}; + +# define CRC_POLY 0x8005 + +/* + * NAME: bit->init() + * DESCRIPTION: initialize bit pointer struct + */ +void mad_bit_init(struct mad_bitptr *bitptr, u8 const *byte) +{ + bitptr->byte = byte; + bitptr->cache = 0; + bitptr->left = CHAR_BIT; +} + +/* + * NAME: bit->length() + * DESCRIPTION: return number of bits between start and end points + */ +u32 mad_bit_length(struct mad_bitptr const *begin, + struct mad_bitptr const *end) +{ + return begin->left + + CHAR_BIT * (end->byte - (begin->byte + 1)) + (CHAR_BIT - end->left); +} + +/* + * NAME: bit->nextbyte() + * DESCRIPTION: return pointer to next unprocessed byte + */ +u8 const *mad_bit_nextbyte(struct mad_bitptr const *bitptr) +{ + return bitptr->left == CHAR_BIT ? bitptr->byte : bitptr->byte + 1; +} + +/* + * NAME: bit->skip() + * DESCRIPTION: advance bit pointer + */ +void mad_bit_skip(struct mad_bitptr *bitptr, u32 len) +{ + bitptr->byte += len / CHAR_BIT; + bitptr->left -= len % CHAR_BIT; + + if (bitptr->left > CHAR_BIT) { + bitptr->byte++; + bitptr->left += CHAR_BIT; + } + + if (bitptr->left < CHAR_BIT) + bitptr->cache = *bitptr->byte; +} + +/* + * NAME: bit->read() + * DESCRIPTION: read an arbitrary number of bits and return their UIMSBF value + */ +u32 mad_bit_read(struct mad_bitptr *bitptr, u32 len) +{ + register u32 value; + + if (bitptr->left == CHAR_BIT) + bitptr->cache = *bitptr->byte; + + if (len < bitptr->left) { + value = (bitptr->cache & ((1 << bitptr->left) - 1)) >> + (bitptr->left - len); + bitptr->left -= len; + + return value; + } + + /* remaining bits in current byte */ + + value = bitptr->cache & ((1 << bitptr->left) - 1); + len -= bitptr->left; + + bitptr->byte++; + bitptr->left = CHAR_BIT; + + /* more bytes */ + + while (len >= CHAR_BIT) { + value = (value << CHAR_BIT) | *bitptr->byte++; + len -= CHAR_BIT; + } + + if (len > 0) { + bitptr->cache = *bitptr->byte; + + value = (value << len) | (bitptr->cache >> (CHAR_BIT - len)); + bitptr->left -= len; + } + + return value; +} + +# if 0 +/* + * NAME: bit->write() + * DESCRIPTION: write an arbitrary number of bits + */ +void mad_bit_write(struct mad_bitptr *bitptr, u32 len, + u32 value) +{ + u8 *ptr; + + ptr = (u8 *) bitptr->byte; + + /* ... */ +} +# endif + +/* + * NAME: bit->crc() + * DESCRIPTION: compute CRC-check word + */ +u16 mad_bit_crc(struct mad_bitptr bitptr, u32 len, + u16 init) +{ + register u32 crc; + + for (crc = init; len >= 32; len -= 32) { + register u32 data; + + data = mad_bit_read(&bitptr, 32); + + crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 24)) & 0xff]; + crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 16)) & 0xff]; + crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 8)) & 0xff]; + crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 0)) & 0xff]; + } + + switch (len / 8) { + case 3: crc = (crc << 8) ^ + crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; + case 2: crc = (crc << 8) ^ + crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; + case 1: crc = (crc << 8) ^ + crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; + + len %= 8; + + case 0: break; + } + + while (len--) { + register u32 msb; + + msb = mad_bit_read(&bitptr, 1) ^ (crc >> 15); + + crc <<= 1; + if (msb & 1) + crc ^= CRC_POLY; + } + + return crc & 0xffff; +} diff --git a/cpymo-backends/nds/decoder/bit.h b/cpymo-backends/nds/decoder/bit.h new file mode 100644 index 00000000..495adb9b --- /dev/null +++ b/cpymo-backends/nds/decoder/bit.h @@ -0,0 +1,48 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifndef LIBMAD_BIT_H +# define LIBMAD_BIT_H + +#include + +struct mad_bitptr { + u8 const *byte; + u16 cache; + u16 left; +}; + +void mad_bit_init(struct mad_bitptr *, u8 const *); + +# define mad_bit_finish(bitptr) /* nothing */ + +u32 mad_bit_length(struct mad_bitptr const *, + struct mad_bitptr const *); + +# define mad_bit_bitsleft(bitptr) ((bitptr)->left) +u8 const *mad_bit_nextbyte(struct mad_bitptr const *); + +void mad_bit_skip(struct mad_bitptr *, u32); +u32 mad_bit_read(struct mad_bitptr *, u32); +void mad_bit_write(struct mad_bitptr *, u32, u32); + +u16 mad_bit_crc(struct mad_bitptr, u32, u16); + +# endif diff --git a/cpymo-backends/nds/decoder/config.h b/cpymo-backends/nds/decoder/config.h new file mode 100644 index 00000000..8d8774af --- /dev/null +++ b/cpymo-backends/nds/decoder/config.h @@ -0,0 +1,132 @@ +/* config.h. Generated by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to enable diagnostic debugging support. */ +/* #undef DEBUG */ + +/* Define to enable experimental code. */ +/* #undef EXPERIMENTAL */ + +/* Define to 1 if you have the header file. */ +/* CPyMO NDS: newlib provides assert.h. */ +#define HAVE_ASSERT_H 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the `fcntl' function. */ +//#define HAVE_FCNTL 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `fork' function. */ +//#define HAVE_FORK 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define if your MIPS CPU supports a 2-operand MADD16 instruction. */ +/* #undef HAVE_MADD16_ASM */ + +/* Define if your MIPS CPU supports a 2-operand MADD instruction. */ +/* #undef HAVE_MADD_ASM */ + +/* Define to 1 if you have the header file. */ +//#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `pipe' function. */ +//#define HAVE_PIPE 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have that is POSIX.1 compatible. */ +//#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `waitpid' function. */ +//#define HAVE_WAITPID 1 + +/* Define to disable debugging assertions. */ +/* #undef NDEBUG */ + +/* Define to optimize for accuracy over speed. */ +/* #undef OPT_ACCURACY */ + +/* Define to optimize for speed over accuracy. */ +/* CPyMO NDS: use libmad's built-in fixed-point speed/synthesis optimization. */ +#define OPT_SPEED 1 + +/* Define to enable a fast subband synthesis approximation optimization. */ +/* #undef OPT_SSO */ + +/* Define to influence a strict interpretation of the ISO/IEC standards, even + if this is in opposition with best accepted practices. */ +/* #undef OPT_STRICT */ + +/* Name of package */ +#define PACKAGE "libmad" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "support@underbit.com" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "MPEG Audio Decoder" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "MPEG Audio Decoder 0.15.0b" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libmad" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.15.0b" + +/* The size of a `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of a `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of a `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "0.15.0b" + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define as `__inline' if that's what the C compiler calls it, or to nothing + if it is not supported. */ +/* #undef inline */ + +/* Define to `int' if does not define. */ +/* #undef pid_t */ diff --git a/cpymo-backends/nds/decoder/decoder.c b/cpymo-backends/nds/decoder/decoder.c new file mode 100644 index 00000000..4861aa3c --- /dev/null +++ b/cpymo-backends/nds/decoder/decoder.c @@ -0,0 +1,581 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif + +# include "global.h" + +# ifdef HAVE_SYS_TYPES_H +# include +# endif + +# ifdef HAVE_SYS_WAIT_H +# include +# endif + +# ifdef HAVE_UNISTD_H +# include +# endif + +# ifdef HAVE_FCNTL_H +# include +# endif + +# include + +# ifdef HAVE_ERRNO_H +# include +# endif + +# include "stream.h" +# include "frame.h" +# include "synth.h" +# include "decoder.h" + +/* + * NAME: decoder->init() + * DESCRIPTION: initialize a decoder object with callback routines + */ +void mad_decoder_init(struct mad_decoder *decoder, void *data, + enum mad_flow (*input_func)(void *, + struct mad_stream *), + enum mad_flow (*header_func)(void *, + struct mad_header const *), + enum mad_flow (*filter_func)(void *, + struct mad_stream const *, + struct mad_frame *), + enum mad_flow (*output_func)(void *, + struct mad_header const *, + struct mad_pcm *), + enum mad_flow (*error_func)(void *, + struct mad_stream *, + struct mad_frame *), + enum mad_flow (*message_func)(void *, + void *, u32 *)) +{ + decoder->mode = -1; + + decoder->options = 0; + + decoder->async.pid = 0; + decoder->async.in = -1; + decoder->async.out = -1; + + decoder->sync = 0; + + decoder->cb_data = data; + + decoder->input_func = input_func; + decoder->header_func = header_func; + decoder->filter_func = filter_func; + decoder->output_func = output_func; + decoder->error_func = error_func; + decoder->message_func = message_func; +} + +s32 mad_decoder_finish(struct mad_decoder *decoder) +{ +# if defined(USE_ASYNC) + if (decoder->mode == MAD_DECODER_MODE_ASYNC && decoder->async.pid) { + pid_t pid; + s32 status; + + close(decoder->async.in); + + do + pid = waitpid(decoder->async.pid, &status, 0); + while (pid == -1 && errno == EINTR); + + decoder->mode = -1; + + close(decoder->async.out); + + decoder->async.pid = 0; + decoder->async.in = -1; + decoder->async.out = -1; + + if (pid == -1) + return -1; + + return (!WIFEXITED(status) || WEXITSTATUS(status)) ? -1 : 0; + } +# endif + + return 0; +} + +# if defined(USE_ASYNC) +static +enum mad_flow send_io(s32 fd, void const *data, size_t len) +{ + s8 const *ptr = data; + ssize_t count; + + while (len) { + do + count = write(fd, ptr, len); + while (count == -1 && errno == EINTR); + + if (count == -1) + return MAD_FLOW_BREAK; + + len -= count; + ptr += count; + } + + return MAD_FLOW_CONTINUE; +} + +static +enum mad_flow receive_io(s32 fd, void *buffer, size_t len) +{ + s8 *ptr = buffer; + ssize_t count; + + while (len) { + do + count = read(fd, ptr, len); + while (count == -1 && errno == EINTR); + + if (count == -1) + return (errno == EAGAIN) ? MAD_FLOW_IGNORE : MAD_FLOW_BREAK; + else if (count == 0) + return MAD_FLOW_STOP; + + len -= count; + ptr += count; + } + + return MAD_FLOW_CONTINUE; +} + +static +enum mad_flow receive_io_blocking(s32 fd, void *buffer, size_t len) +{ + s32 flags, blocking; + enum mad_flow result; + + flags = fcntl(fd, F_GETFL); + if (flags == -1) + return MAD_FLOW_BREAK; + + blocking = flags & ~O_NONBLOCK; + + if (blocking != flags && + fcntl(fd, F_SETFL, blocking) == -1) + return MAD_FLOW_BREAK; + + result = receive_io(fd, buffer, len); + + if (flags != blocking && + fcntl(fd, F_SETFL, flags) == -1) + return MAD_FLOW_BREAK; + + return result; +} + +static +enum mad_flow send(s32 fd, void const *message, u32 size) +{ + enum mad_flow result; + + /* send size */ + + result = send_io(fd, &size, sizeof(size)); + + /* send message */ + + if (result == MAD_FLOW_CONTINUE) + result = send_io(fd, message, size); + + return result; +} + +static +enum mad_flow receive(s32 fd, void **message, u32 *size) +{ + enum mad_flow result; + u32 actual; + + if (*message == 0) + *size = 0; + + /* receive size */ + + result = receive_io(fd, &actual, sizeof(actual)); + + /* receive message */ + + if (result == MAD_FLOW_CONTINUE) { + if (actual > *size) + actual -= *size; + else { + *size = actual; + actual = 0; + } + + if (*size > 0) { + if (*message == 0) { + *message = malloc(*size); + if (*message == 0) + return MAD_FLOW_BREAK; + } + + result = receive_io_blocking(fd, *message, *size); + } + + /* throw away remainder of message */ + + while (actual && result == MAD_FLOW_CONTINUE) { + s8 sink[256]; + u32 len; + + len = actual > sizeof(sink) ? sizeof(sink) : actual; + + result = receive_io_blocking(fd, sink, len); + + actual -= len; + } + } + + return result; +} + +static +enum mad_flow check_message(struct mad_decoder *decoder) +{ + enum mad_flow result; + void *message = 0; + u32 size; + + result = receive(decoder->async.in, &message, &size); + + if (result == MAD_FLOW_CONTINUE) { + if (decoder->message_func == 0) + size = 0; + else { + result = decoder->message_func(decoder->cb_data, message, &size); + + if (result == MAD_FLOW_IGNORE || + result == MAD_FLOW_BREAK) + size = 0; + } + + if (send(decoder->async.out, message, size) != MAD_FLOW_CONTINUE) + result = MAD_FLOW_BREAK; + } + + if (message) + free(message); + + return result; +} +# endif + +static +enum mad_flow error_default(void *data, struct mad_stream *stream, + struct mad_frame *frame) +{ + s32 *bad_last_frame = data; + + switch (stream->error) { + case MAD_ERROR_BADCRC: + if (*bad_last_frame) + mad_frame_mute(frame); + else + *bad_last_frame = 1; + + return MAD_FLOW_IGNORE; + + default: + return MAD_FLOW_CONTINUE; + } +} + +static +s32 run_sync(struct mad_decoder *decoder) +{ + enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); + void *error_data; + s32 bad_last_frame = 0; + struct mad_stream *stream; + struct mad_frame *frame; + struct mad_synth *synth; + s32 result = 0; + + if (decoder->input_func == 0) + return 0; + + if (decoder->error_func) { + error_func = decoder->error_func; + error_data = decoder->cb_data; + } + else { + error_func = error_default; + error_data = &bad_last_frame; + } + + stream = &decoder->sync->stream; + frame = &decoder->sync->frame; + synth = &decoder->sync->synth; + + mad_stream_init(stream); + mad_frame_init(frame); + mad_synth_init(synth); + + mad_stream_options(stream, decoder->options); + + do { + switch (decoder->input_func(decoder->cb_data, stream)) { + case MAD_FLOW_STOP: + goto done; + case MAD_FLOW_BREAK: + goto fail; + case MAD_FLOW_IGNORE: + continue; + case MAD_FLOW_CONTINUE: + break; + } + + while (1) { +# if defined(USE_ASYNC) + if (decoder->mode == MAD_DECODER_MODE_ASYNC) { + switch (check_message(decoder)) { + case MAD_FLOW_IGNORE: + case MAD_FLOW_CONTINUE: + break; + case MAD_FLOW_BREAK: + goto fail; + case MAD_FLOW_STOP: + goto done; + } + } +# endif + + if (decoder->header_func) { + if (mad_header_decode(&frame->header, stream) == -1) { + if (!MAD_RECOVERABLE(stream->error)) + break; + + switch (error_func(error_data, stream, frame)) { + case MAD_FLOW_STOP: + goto done; + case MAD_FLOW_BREAK: + goto fail; + case MAD_FLOW_IGNORE: + case MAD_FLOW_CONTINUE: + default: + continue; + } + } + + switch (decoder->header_func(decoder->cb_data, &frame->header)) { + case MAD_FLOW_STOP: + goto done; + case MAD_FLOW_BREAK: + goto fail; + case MAD_FLOW_IGNORE: + continue; + case MAD_FLOW_CONTINUE: + break; + } + } + + if (mad_frame_decode(frame, stream) == -1) { + if (!MAD_RECOVERABLE(stream->error)) + break; + + switch (error_func(error_data, stream, frame)) { + case MAD_FLOW_STOP: + goto done; + case MAD_FLOW_BREAK: + goto fail; + case MAD_FLOW_IGNORE: + break; + case MAD_FLOW_CONTINUE: + default: + continue; + } + } + else + bad_last_frame = 0; + + if (decoder->filter_func) { + switch (decoder->filter_func(decoder->cb_data, stream, frame)) { + case MAD_FLOW_STOP: + goto done; + case MAD_FLOW_BREAK: + goto fail; + case MAD_FLOW_IGNORE: + continue; + case MAD_FLOW_CONTINUE: + break; + } + } + + mad_synth_frame(synth, frame); + + if (decoder->output_func) { + switch (decoder->output_func(decoder->cb_data, + &frame->header, &synth->pcm)) { + case MAD_FLOW_STOP: + goto done; + case MAD_FLOW_BREAK: + goto fail; + case MAD_FLOW_IGNORE: + case MAD_FLOW_CONTINUE: + break; + } + } + } + } + while (stream->error == MAD_ERROR_BUFLEN); + + fail: + result = -1; + + done: + mad_synth_finish(synth); + mad_frame_finish(frame); + mad_stream_finish(stream); + + return result; +} + +# if defined(USE_ASYNC) +static +s32 run_async(struct mad_decoder *decoder) +{ + pid_t pid; + s32 ptoc[2], ctop[2], flags; + + if (pipe(ptoc) == -1) + return -1; + + if (pipe(ctop) == -1) { + close(ptoc[0]); + close(ptoc[1]); + return -1; + } + + flags = fcntl(ptoc[0], F_GETFL); + if (flags == -1 || + fcntl(ptoc[0], F_SETFL, flags | O_NONBLOCK) == -1) { + close(ctop[0]); + close(ctop[1]); + close(ptoc[0]); + close(ptoc[1]); + return -1; + } + + pid = fork(); + if (pid == -1) { + close(ctop[0]); + close(ctop[1]); + close(ptoc[0]); + close(ptoc[1]); + return -1; + } + + decoder->async.pid = pid; + + if (pid) { + /* parent */ + + close(ptoc[0]); + close(ctop[1]); + + decoder->async.in = ctop[0]; + decoder->async.out = ptoc[1]; + + return 0; + } + + /* child */ + + close(ptoc[1]); + close(ctop[0]); + + decoder->async.in = ptoc[0]; + decoder->async.out = ctop[1]; + + _exit(run_sync(decoder)); + + /* not reached */ + return -1; +} +# endif + +/* + * NAME: decoder->run() + * DESCRIPTION: run the decoder thread either synchronously or asynchronously + */ +s32 mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode) +{ + s32 result; + s32 (*run)(struct mad_decoder *) = 0; + + switch (decoder->mode = mode) { + case MAD_DECODER_MODE_SYNC: + run = run_sync; + break; + + case MAD_DECODER_MODE_ASYNC: +# if defined(USE_ASYNC) + run = run_async; +# endif + break; + } + + if (run == 0) + return -1; + + decoder->sync = malloc(sizeof(*decoder->sync)); + if (decoder->sync == 0) + return -1; + + result = run(decoder); + + free(decoder->sync); + decoder->sync = 0; + + return result; +} + +/* + * NAME: decoder->message() + * DESCRIPTION: send a message to and receive a reply from the decoder process + */ +s32 mad_decoder_message(struct mad_decoder *decoder, + void *message, u32 *len) +{ +# if defined(USE_ASYNC) + if (decoder->mode != MAD_DECODER_MODE_ASYNC || + send(decoder->async.out, message, *len) != MAD_FLOW_CONTINUE || + receive(decoder->async.in, &message, len) != MAD_FLOW_CONTINUE) + return -1; + + return 0; +# else + return -1; +# endif +} diff --git a/cpymo-backends/nds/decoder/decoder.h b/cpymo-backends/nds/decoder/decoder.h new file mode 100644 index 00000000..61893546 --- /dev/null +++ b/cpymo-backends/nds/decoder/decoder.h @@ -0,0 +1,91 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifndef LIBMAD_DECODER_H +# define LIBMAD_DECODER_H + +# include +# include "stream.h" +# include "frame.h" +# include "synth.h" + +enum mad_decoder_mode { + MAD_DECODER_MODE_SYNC = 0, + MAD_DECODER_MODE_ASYNC +}; + +enum mad_flow { + MAD_FLOW_CONTINUE = 0x0000, /* continue normally */ + MAD_FLOW_STOP = 0x0010, /* stop decoding normally */ + MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */ + MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */ +}; + +struct mad_decoder { + enum mad_decoder_mode mode; + + s32 options; + + struct { + s32 pid; + s32 in; + s32 out; + } async; + + struct { + struct mad_stream stream; + struct mad_frame frame; + struct mad_synth synth; + } *sync; + + void *cb_data; + + enum mad_flow (*input_func)(void *, struct mad_stream *); + enum mad_flow (*header_func)(void *, struct mad_header const *); + enum mad_flow (*filter_func)(void *, + struct mad_stream const *, struct mad_frame *); + enum mad_flow (*output_func)(void *, + struct mad_header const *, struct mad_pcm *); + enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); + enum mad_flow (*message_func)(void *, void *, u32 *); +}; + +void mad_decoder_init(struct mad_decoder *, void *, + enum mad_flow (*)(void *, struct mad_stream *), + enum mad_flow (*)(void *, struct mad_header const *), + enum mad_flow (*)(void *, + struct mad_stream const *, + struct mad_frame *), + enum mad_flow (*)(void *, + struct mad_header const *, + struct mad_pcm *), + enum mad_flow (*)(void *, + struct mad_stream *, + struct mad_frame *), + enum mad_flow (*)(void *, void *, u32 *)); +s32 mad_decoder_finish(struct mad_decoder *); + +# define mad_decoder_options(decoder, opts) \ + ((void) ((decoder)->options = (opts))) + +s32 mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode); +s32 mad_decoder_message(struct mad_decoder *, void *, u32 *); + +# endif diff --git a/cpymo-backends/nds/decoder/fixed.c b/cpymo-backends/nds/decoder/fixed.c new file mode 100644 index 00000000..8fe5f217 --- /dev/null +++ b/cpymo-backends/nds/decoder/fixed.c @@ -0,0 +1,80 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif + +# include "global.h" + +# include "fixed.h" + +/* + * NAME: fixed->abs() + * DESCRIPTION: return absolute value of a fixed-point number + */ +mad_fixed_t mad_f_abs(mad_fixed_t x) +{ + return x < 0 ? -x : x; +} + +/* + * NAME: fixed->div() + * DESCRIPTION: perform division using fixed-point math + */ +mad_fixed_t mad_f_div(mad_fixed_t x, mad_fixed_t y) +{ + mad_fixed_t q, r; + u32 bits; + + q = mad_f_abs(x / y); + + if (x < 0) { + x = -x; + y = -y; + } + + r = x % y; + + if (y < 0) { + x = -x; + y = -y; + } + + if (q > mad_f_intpart(MAD_F_MAX) && + !(q == -mad_f_intpart(MAD_F_MIN) && r == 0 && (x < 0) != (y < 0))) + return 0; + + for (bits = MAD_F_FRACBITS; bits && r; --bits) { + q <<= 1, r <<= 1; + if (r >= y) + r -= y, ++q; + } + + /* round */ + if (2 * r >= y) + ++q; + + /* fix sign */ + if ((x < 0) != (y < 0)) + q = -q; + + return q << bits; +} diff --git a/cpymo-backends/nds/decoder/fixed.h b/cpymo-backends/nds/decoder/fixed.h new file mode 100644 index 00000000..f71d2ec6 --- /dev/null +++ b/cpymo-backends/nds/decoder/fixed.h @@ -0,0 +1,485 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifndef LIBMAD_FIXED_H +# define LIBMAD_FIXED_H + +#include + +# if SIZEOF_INT >= 4 +typedef s32 mad_fixed_t; + +typedef s32 mad_fixed64hi_t; +typedef u32 mad_fixed64lo_t; +# else +typedef s32 mad_fixed_t; + +typedef s32 mad_fixed64hi_t; +typedef u32 mad_fixed64lo_t; +# endif + +# if defined(_MSC_VER) +# define mad_fixed64_t signed __int64 +# elif 1 || defined(__GNUC__) +# define mad_fixed64_t signed long long +# endif + +# if defined(FPM_FLOAT) +typedef double mad_sample_t; +# else +typedef mad_fixed_t mad_sample_t; +# endif + +/* + * Fixed-point format: 0xABBBBBBB + * A == whole part (sign + 3 bits) + * B == fractional part (28 bits) + * + * Values are signed two's complement, so the effective range is: + * 0x80000000 to 0x7fffffff + * -8.0 to +7.9999999962747097015380859375 + * + * The smallest representable value is: + * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9) + * + * 28 bits of fractional accuracy represent about + * 8.6 digits of decimal accuracy. + * + * Fixed-point numbers can be added or subtracted as normal + * integers, but multiplication requires shifting the 64-bit result + * from 56 fractional bits back to 28 (and rounding.) + * + * Changing the definition of MAD_F_FRACBITS is only partially + * supported, and must be done with care. + */ + +# define MAD_F_FRACBITS 28 + +# if MAD_F_FRACBITS == 28 +# define MAD_F(x) ((mad_fixed_t) (x##L)) +# else +# if MAD_F_FRACBITS < 28 +# warning "MAD_F_FRACBITS < 28" +# define MAD_F(x) ((mad_fixed_t) \ + (((x##L) + \ + (1L << (28 - MAD_F_FRACBITS - 1))) >> \ + (28 - MAD_F_FRACBITS))) +# elif MAD_F_FRACBITS > 28 +# error "MAD_F_FRACBITS > 28 not currently supported" +# define MAD_F(x) ((mad_fixed_t) \ + ((x##L) << (MAD_F_FRACBITS - 28))) +# endif +# endif + +# define MAD_F_MIN ((mad_fixed_t) -0x80000000L) +# define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL) + +# define MAD_F_ONE MAD_F(0x10000000) + +# define mad_f_tofixed(x) ((mad_fixed_t) \ + ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5)) +# define mad_f_todouble(x) ((double) \ + ((x) / (double) (1L << MAD_F_FRACBITS))) + +# define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS) +# define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1)) + /* (x should be positive) */ + +# define mad_f_fromint(x) ((x) << MAD_F_FRACBITS) + +# define mad_f_add(x, y) ((x) + (y)) +# define mad_f_sub(x, y) ((x) - (y)) + +# if defined(FPM_FLOAT) +# error "FPM_FLOAT not yet supported" + +# undef MAD_F +# define MAD_F(x) mad_f_todouble(x) + +# define mad_f_mul(x, y) ((x) * (y)) +# define mad_f_scale64 + +# undef ASO_ZEROCHECK + +# elif defined(FPM_64BIT) + +/* + * This version should be the most accurate if 64-bit types are supported by + * the compiler, although it may not be the most efficient. + */ +# if defined(OPT_ACCURACY) +# define mad_f_mul(x, y) \ + ((mad_fixed_t) \ + ((((mad_fixed64_t) (x) * (y)) + \ + (1L << (MAD_F_SCALEBITS - 1))) >> MAD_F_SCALEBITS)) +# else +# define mad_f_mul(x, y) \ + ((mad_fixed_t) (((mad_fixed64_t) (x) * (y)) >> MAD_F_SCALEBITS)) +# endif + +# define MAD_F_SCALEBITS MAD_F_FRACBITS + +/* --- Intel --------------------------------------------------------------- */ + +# elif defined(FPM_INTEL) + +# if defined(_MSC_VER) +# pragma warning(push) +# pragma warning(disable: 4035) /* no return value */ +static __forceinline +mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) +{ + enum { + fracbits = MAD_F_FRACBITS + }; + + __asm { + mov eax, x + imul y + shrd eax, edx, fracbits + } + + /* implicit return of eax */ +} +# pragma warning(pop) + +# define mad_f_mul mad_f_mul_inline +# define mad_f_scale64 +# else +/* + * This Intel version is fast and accurate; the disposition of the least + * significant bit depends on OPT_ACCURACY via mad_f_scale64(). + */ +# define MAD_F_MLX(hi, lo, x, y) \ + asm ("imull %3" \ + : "=a" (lo), "=d" (hi) \ + : "%a" (x), "rm" (y) \ + : "cc") + +# if defined(OPT_ACCURACY) +/* + * This gives best accuracy but is not very fast. + */ +# define MAD_F_MLA(hi, lo, x, y) \ + ({ mad_fixed64hi_t __hi; \ + mad_fixed64lo_t __lo; \ + MAD_F_MLX(__hi, __lo, (x), (y)); \ + asm ("addl %2,%0\n\t" \ + "adcl %3,%1" \ + : "=rm" (lo), "=rm" (hi) \ + : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \ + : "cc"); \ + }) +# endif /* OPT_ACCURACY */ + +# if defined(OPT_ACCURACY) +/* + * Surprisingly, this is faster than SHRD followed by ADC. + */ +# define mad_f_scale64(hi, lo) \ + ({ mad_fixed64hi_t __hi_; \ + mad_fixed64lo_t __lo_; \ + mad_fixed_t __result; \ + asm ("addl %4,%2\n\t" \ + "adcl %5,%3" \ + : "=rm" (__lo_), "=rm" (__hi_) \ + : "0" (lo), "1" (hi), \ + "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ + : "cc"); \ + asm ("shrdl %3,%2,%1" \ + : "=rm" (__result) \ + : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ + : "cc"); \ + __result; \ + }) +# else +# define mad_f_scale64(hi, lo) \ + ({ mad_fixed_t __result; \ + asm ("shrdl %3,%2,%1" \ + : "=rm" (__result) \ + : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ + : "cc"); \ + __result; \ + }) +# endif /* OPT_ACCURACY */ + +# define MAD_F_SCALEBITS MAD_F_FRACBITS +# endif + +/* --- ARM ----------------------------------------------------------------- */ + +# elif defined(FPM_ARM) + +/* + * This ARM V4 version is as accurate as FPM_64BIT but much faster. The + * least significant bit is properly rounded at no CPU cycle cost! + */ +# if 1 +/* + * This is faster than the default implementation via MAD_F_MLX() and + * mad_f_scale64(). + */ +# define mad_f_mul(x, y) \ + ({ mad_fixed64hi_t __hi; \ + mad_fixed64lo_t __lo; \ + mad_fixed_t __result; \ + asm ("smull %0, %1, %3, %4\n\t" \ + "movs %0, %0, lsr %5\n\t" \ + "adc %2, %0, %1, lsl %6" \ + : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ + : "%r" (x), "r" (y), \ + "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ + : "cc"); \ + __result; \ + }) +# endif + +# define MAD_F_MLX(hi, lo, x, y) \ + asm ("smull %0, %1, %2, %3" \ + : "=&r" (lo), "=&r" (hi) \ + : "%r" (x), "r" (y)) + +# define MAD_F_MLA(hi, lo, x, y) \ + asm ("smlal %0, %1, %2, %3" \ + : "+r" (lo), "+r" (hi) \ + : "%r" (x), "r" (y)) + +# define MAD_F_MLN(hi, lo) \ + asm ("rsbs %0, %2, #0\n\t" \ + "rsc %1, %3, #0" \ + : "=r" (lo), "=r" (hi) \ + : "0" (lo), "1" (hi) \ + : "cc") + +# define mad_f_scale64(hi, lo) \ + ({ mad_fixed_t __result; \ + asm ("movs %0, %1, lsr %3\n\t" \ + "adc %0, %0, %2, lsl %4" \ + : "=&r" (__result) \ + : "r" (lo), "r" (hi), \ + "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ + : "cc"); \ + __result; \ + }) + +# define MAD_F_SCALEBITS MAD_F_FRACBITS + +/* --- MIPS ---------------------------------------------------------------- */ + +# elif defined(FPM_MIPS) + +/* + * This MIPS version is fast and accurate; the disposition of the least + * significant bit depends on OPT_ACCURACY via mad_f_scale64(). + */ +# define MAD_F_MLX(hi, lo, x, y) \ + asm ("mult %2,%3" \ + : "=l" (lo), "=h" (hi) \ + : "%r" (x), "r" (y)) + +# if defined(HAVE_MADD_ASM) +# define MAD_F_MLA(hi, lo, x, y) \ + asm ("madd %2,%3" \ + : "+l" (lo), "+h" (hi) \ + : "%r" (x), "r" (y)) +# elif defined(HAVE_MADD16_ASM) +/* + * This loses significant accuracy due to the 16-bit integer limit in the + * multiply/accumulate instruction. + */ +# define MAD_F_ML0(hi, lo, x, y) \ + asm ("mult %2,%3" \ + : "=l" (lo), "=h" (hi) \ + : "%r" ((x) >> 12), "r" ((y) >> 16)) +# define MAD_F_MLA(hi, lo, x, y) \ + asm ("madd16 %2,%3" \ + : "+l" (lo), "+h" (hi) \ + : "%r" ((x) >> 12), "r" ((y) >> 16)) +# define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo)) +# endif + +# if defined(OPT_SPEED) +# define mad_f_scale64(hi, lo) \ + ((mad_fixed_t) ((hi) << (32 - MAD_F_SCALEBITS))) +# define MAD_F_SCALEBITS MAD_F_FRACBITS +# endif + +/* --- SPARC --------------------------------------------------------------- */ + +# elif defined(FPM_SPARC) + +/* + * This SPARC V8 version is fast and accurate; the disposition of the least + * significant bit depends on OPT_ACCURACY via mad_f_scale64(). + */ +# define MAD_F_MLX(hi, lo, x, y) \ + asm ("smul %2, %3, %0\n\t" \ + "rd %%y, %1" \ + : "=r" (lo), "=r" (hi) \ + : "%r" (x), "rI" (y)) + +/* --- PowerPC ------------------------------------------------------------- */ + +# elif defined(FPM_PPC) + +/* + * This PowerPC version is fast and accurate; the disposition of the least + * significant bit depends on OPT_ACCURACY via mad_f_scale64(). + */ +# define MAD_F_MLX(hi, lo, x, y) \ + do { \ + asm ("mullw %0,%1,%2" \ + : "=r" (lo) \ + : "%r" (x), "r" (y)); \ + asm ("mulhw %0,%1,%2" \ + : "=r" (hi) \ + : "%r" (x), "r" (y)); \ + } \ + while (0) + +# if defined(OPT_ACCURACY) +/* + * This gives best accuracy but is not very fast. + */ +# define MAD_F_MLA(hi, lo, x, y) \ + ({ mad_fixed64hi_t __hi; \ + mad_fixed64lo_t __lo; \ + MAD_F_MLX(__hi, __lo, (x), (y)); \ + asm ("addc %0,%2,%3\n\t" \ + "adde %1,%4,%5" \ + : "=r" (lo), "=r" (hi) \ + : "%r" (lo), "r" (__lo), \ + "%r" (hi), "r" (__hi) \ + : "xer"); \ + }) +# endif + +# if defined(OPT_ACCURACY) +/* + * This is slower than the truncating version below it. + */ +# define mad_f_scale64(hi, lo) \ + ({ mad_fixed_t __result, __round; \ + asm ("rotrwi %0,%1,%2" \ + : "=r" (__result) \ + : "r" (lo), "i" (MAD_F_SCALEBITS)); \ + asm ("extrwi %0,%1,1,0" \ + : "=r" (__round) \ + : "r" (__result)); \ + asm ("insrwi %0,%1,%2,0" \ + : "+r" (__result) \ + : "r" (hi), "i" (MAD_F_SCALEBITS)); \ + asm ("add %0,%1,%2" \ + : "=r" (__result) \ + : "%r" (__result), "r" (__round)); \ + __result; \ + }) +# else +# define mad_f_scale64(hi, lo) \ + ({ mad_fixed_t __result; \ + asm ("rotrwi %0,%1,%2" \ + : "=r" (__result) \ + : "r" (lo), "i" (MAD_F_SCALEBITS)); \ + asm ("insrwi %0,%1,%2,0" \ + : "+r" (__result) \ + : "r" (hi), "i" (MAD_F_SCALEBITS)); \ + __result; \ + }) +# endif + +# define MAD_F_SCALEBITS MAD_F_FRACBITS + +/* --- Default ------------------------------------------------------------- */ + +# elif defined(FPM_DEFAULT) + +/* + * This version is the most portable but it loses significant accuracy. + * Furthermore, accuracy is biased against the second argument, so care + * should be taken when ordering operands. + * + * The scale factors are constant as this is not used with SSO. + * + * Pre-rounding is required to stay within the limits of compliance. + */ +# if defined(OPT_SPEED) +# define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16)) +# else +# define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \ + (((y) + (1L << 15)) >> 16)) +# endif + +/* ------------------------------------------------------------------------- */ + +# else +# error "no FPM selected" +# endif + +/* default implementations */ + +# if !defined(mad_f_mul) +# define mad_f_mul(x, y) \ + ({ mad_fixed64hi_t __hi; \ + mad_fixed64lo_t __lo; \ + MAD_F_MLX(__hi, __lo, (x), (y)); \ + mad_f_scale64(__hi, __lo); \ + }) +# endif + +# if !defined(MAD_F_MLA) +# define MAD_F_ML0(hi, lo, x, y) ((lo) = mad_f_mul((x), (y))) +# define MAD_F_MLA(hi, lo, x, y) ((lo) += mad_f_mul((x), (y))) +# define MAD_F_MLN(hi, lo) ((lo) = -(lo)) +# define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) +# endif + +# if !defined(MAD_F_ML0) +# define MAD_F_ML0(hi, lo, x, y) MAD_F_MLX((hi), (lo), (x), (y)) +# endif + +# if !defined(MAD_F_MLN) +# define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi)) +# endif + +# if !defined(MAD_F_MLZ) +# define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo)) +# endif + +# if !defined(mad_f_scale64) +# if defined(OPT_ACCURACY) +# define mad_f_scale64(hi, lo) \ + ((((mad_fixed_t) \ + (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \ + ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1) +# else +# define mad_f_scale64(hi, lo) \ + ((mad_fixed_t) \ + (((hi) << (32 - MAD_F_SCALEBITS)) | \ + ((lo) >> MAD_F_SCALEBITS))) +# endif +# define MAD_F_SCALEBITS MAD_F_FRACBITS +# endif + +/* C routines */ + +mad_fixed_t mad_f_abs(mad_fixed_t); +mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t); + +# endif diff --git a/cpymo-backends/nds/decoder/frame.c b/cpymo-backends/nds/decoder/frame.c new file mode 100644 index 00000000..2d3b5fc0 --- /dev/null +++ b/cpymo-backends/nds/decoder/frame.c @@ -0,0 +1,501 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif + +# include "global.h" + +# include + +# include "bit.h" +# include "stream.h" +# include "frame.h" +# include "timer.h" +# include "layer12.h" +# include "layer3.h" + +static +u32 const bitrate_table[5][15] = { + /* MPEG-1 */ + { 0, 32000, 64000, 96000, 128000, 160000, 192000, 224000, /* Layer I */ + 256000, 288000, 320000, 352000, 384000, 416000, 448000 }, + { 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer II */ + 128000, 160000, 192000, 224000, 256000, 320000, 384000 }, + { 0, 32000, 40000, 48000, 56000, 64000, 80000, 96000, /* Layer III */ + 112000, 128000, 160000, 192000, 224000, 256000, 320000 }, + + /* MPEG-2 LSF */ + { 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer I */ + 128000, 144000, 160000, 176000, 192000, 224000, 256000 }, + { 0, 8000, 16000, 24000, 32000, 40000, 48000, 56000, /* Layers */ + 64000, 80000, 96000, 112000, 128000, 144000, 160000 } /* II & III */ +}; + +static +u32 const samplerate_table[3] = { 44100, 48000, 32000 }; + +static +int (*const decoder_table[3])(struct mad_stream *, struct mad_frame *) = { + mad_layer_I, + mad_layer_II, + mad_layer_III +}; + +/* + * NAME: header->init() + * DESCRIPTION: initialize header struct + */ +void mad_header_init(struct mad_header *header) +{ + header->layer = 0; + header->mode = 0; + header->mode_extension = 0; + header->emphasis = 0; + + header->bitrate = 0; + header->samplerate = 0; + + header->crc_check = 0; + header->crc_target = 0; + + header->flags = 0; + header->private_bits = 0; + + header->duration = mad_timer_zero; +} + +/* + * NAME: frame->init() + * DESCRIPTION: initialize frame struct + */ +void mad_frame_init(struct mad_frame *frame) +{ + mad_header_init(&frame->header); + + frame->options = 0; + + frame->overlap = 0; + mad_frame_mute(frame); +} + +/* + * NAME: frame->finish() + * DESCRIPTION: deallocate any dynamic memory associated with frame + */ +void mad_frame_finish(struct mad_frame *frame) +{ + mad_header_finish(&frame->header); + + if (frame->overlap) { + free(frame->overlap); + frame->overlap = 0; + } +} + +/* + * NAME: decode_header() + * DESCRIPTION: read header data and following CRC word + */ +static +s32 decode_header(struct mad_header *header, struct mad_stream *stream) +{ + u32 index; + + header->flags = 0; + header->private_bits = 0; + + /* header() */ + + /* syncword */ + mad_bit_skip(&stream->ptr, 11); + + /* MPEG 2.5 indicator (really part of syncword) */ + if (mad_bit_read(&stream->ptr, 1) == 0) + header->flags |= MAD_FLAG_MPEG_2_5_EXT; + + /* ID */ + if (mad_bit_read(&stream->ptr, 1) == 0) + header->flags |= MAD_FLAG_LSF_EXT; + else if (header->flags & MAD_FLAG_MPEG_2_5_EXT) { + stream->error = MAD_ERROR_LOSTSYNC; + return -1; + } + + /* layer */ + header->layer = 4 - mad_bit_read(&stream->ptr, 2); + + if (header->layer == 4) { + stream->error = MAD_ERROR_BADLAYER; + return -1; + } + + /* protection_bit */ + if (mad_bit_read(&stream->ptr, 1) == 0) { + header->flags |= MAD_FLAG_PROTECTION; + header->crc_check = mad_bit_crc(stream->ptr, 16, 0xffff); + } + + /* bitrate_index */ + index = mad_bit_read(&stream->ptr, 4); + + if (index == 15) { + stream->error = MAD_ERROR_BADBITRATE; + return -1; + } + + if (header->flags & MAD_FLAG_LSF_EXT) + header->bitrate = bitrate_table[3 + (header->layer >> 1)][index]; + else + header->bitrate = bitrate_table[header->layer - 1][index]; + + /* sampling_frequency */ + index = mad_bit_read(&stream->ptr, 2); + + if (index == 3) { + stream->error = MAD_ERROR_BADSAMPLERATE; + return -1; + } + + header->samplerate = samplerate_table[index]; + + if (header->flags & MAD_FLAG_LSF_EXT) { + header->samplerate /= 2; + + if (header->flags & MAD_FLAG_MPEG_2_5_EXT) + header->samplerate /= 2; + } + + /* padding_bit */ + if (mad_bit_read(&stream->ptr, 1)) + header->flags |= MAD_FLAG_PADDING; + + /* private_bit */ + if (mad_bit_read(&stream->ptr, 1)) + header->private_bits |= MAD_PRIVATE_HEADER; + + /* mode */ + header->mode = 3 - mad_bit_read(&stream->ptr, 2); + + /* mode_extension */ + header->mode_extension = mad_bit_read(&stream->ptr, 2); + + /* copyright */ + if (mad_bit_read(&stream->ptr, 1)) + header->flags |= MAD_FLAG_COPYRIGHT; + + /* original/copy */ + if (mad_bit_read(&stream->ptr, 1)) + header->flags |= MAD_FLAG_ORIGINAL; + + /* emphasis */ + header->emphasis = mad_bit_read(&stream->ptr, 2); + +# if defined(OPT_STRICT) + /* + * ISO/IEC 11172-3 says this is a reserved emphasis value, but + * streams exist which use it anyway. Since the value is not important + * to the decoder proper, we allow it unless OPT_STRICT is defined. + */ + if (header->emphasis == MAD_EMPHASIS_RESERVED) { + stream->error = MAD_ERROR_BADEMPHASIS; + return -1; + } +# endif + + /* error_check() */ + + /* crc_check */ + if (header->flags & MAD_FLAG_PROTECTION) + header->crc_target = mad_bit_read(&stream->ptr, 16); + + return 0; +} + +/* + * NAME: free_bitrate() + * DESCRIPTION: attempt to discover the bitstream's free bitrate + */ +static +s32 free_bitrate(struct mad_stream *stream, struct mad_header const *header) +{ + struct mad_bitptr keep_ptr; + u32 rate = 0; + u32 pad_slot, slots_per_frame; + u8 const *ptr = 0; + + keep_ptr = stream->ptr; + + pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0; + slots_per_frame = (header->layer == MAD_LAYER_III && + (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144; + + while (mad_stream_sync(stream) == 0) { + struct mad_stream peek_stream; + struct mad_header peek_header; + + peek_stream = *stream; + peek_header = *header; + + if (decode_header(&peek_header, &peek_stream) == 0 && + peek_header.layer == header->layer && + peek_header.samplerate == header->samplerate) { + u32 N; + + ptr = mad_bit_nextbyte(&stream->ptr); + + N = ptr - stream->this_frame; + + if (header->layer == MAD_LAYER_I) { + rate = (u32) header->samplerate * + (N - 4 * pad_slot + 4) / 48 / 1000; + } + else { + rate = (u32) header->samplerate * + (N - pad_slot + 1) / slots_per_frame / 1000; + } + + if (rate >= 8) + break; + } + + mad_bit_skip(&stream->ptr, 8); + } + + stream->ptr = keep_ptr; + + if (rate < 8 || (header->layer == MAD_LAYER_III && rate > 640)) { + stream->error = MAD_ERROR_LOSTSYNC; + return -1; + } + + stream->freerate = rate * 1000; + + return 0; +} + +/* + * NAME: header->decode() + * DESCRIPTION: read the next frame header from the stream + */ +s32 mad_header_decode(struct mad_header *header, struct mad_stream *stream) +{ + register u8 const *ptr, *end; + u32 pad_slot, N; + + ptr = stream->next_frame; + end = stream->bufend; + + if (ptr == 0) { + stream->error = MAD_ERROR_BUFPTR; + goto fail; + } + + /* stream skip */ + if (stream->skiplen) { + if (!stream->sync) + ptr = stream->this_frame; + + if (end - ptr < stream->skiplen) { + stream->skiplen -= end - ptr; + stream->next_frame = end; + + stream->error = MAD_ERROR_BUFLEN; + goto fail; + } + + ptr += stream->skiplen; + stream->skiplen = 0; + + stream->sync = 1; + } + + sync: + /* synchronize */ + if (stream->sync) { + if (end - ptr < MAD_BUFFER_GUARD) { + stream->next_frame = ptr; + + stream->error = MAD_ERROR_BUFLEN; + goto fail; + } + else if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) { + /* mark point where frame sync word was expected */ + stream->this_frame = ptr; + stream->next_frame = ptr + 1; + + stream->error = MAD_ERROR_LOSTSYNC; + goto fail; + } + } + else { + mad_bit_init(&stream->ptr, ptr); + + if (mad_stream_sync(stream) == -1) { + if (end - stream->next_frame >= MAD_BUFFER_GUARD) + stream->next_frame = end - MAD_BUFFER_GUARD; + + stream->error = MAD_ERROR_BUFLEN; + goto fail; + } + + ptr = mad_bit_nextbyte(&stream->ptr); + } + + /* begin processing */ + stream->this_frame = ptr; + stream->next_frame = ptr + 1; /* possibly bogus sync word */ + + mad_bit_init(&stream->ptr, stream->this_frame); + + if (decode_header(header, stream) == -1) + goto fail; + + /* calculate frame duration */ + mad_timer_set(&header->duration, 0, + 32 * MAD_NSBSAMPLES(header), header->samplerate); + + /* calculate free bit rate */ + if (header->bitrate == 0) { + if ((stream->freerate == 0 || !stream->sync) && + free_bitrate(stream, header) == -1) + goto fail; + + header->bitrate = stream->freerate; + header->flags |= MAD_FLAG_FREEFORMAT; + } + + /* calculate beginning of next frame */ + pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0; + + if (header->layer == MAD_LAYER_I) + N = ((12 * header->bitrate / header->samplerate) + pad_slot) * 4; + else { + u32 slots_per_frame; + + slots_per_frame = (header->layer == MAD_LAYER_III && + (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144; + + N = (slots_per_frame * header->bitrate / header->samplerate) + pad_slot; + } + + /* verify there is enough data left in buffer to decode this frame */ + if (N + MAD_BUFFER_GUARD > end - stream->this_frame) { + stream->next_frame = stream->this_frame; + + stream->error = MAD_ERROR_BUFLEN; + goto fail; + } + + stream->next_frame = stream->this_frame + N; + + if (!stream->sync) { + /* check that a valid frame header follows this frame */ + + ptr = stream->next_frame; + if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) { + ptr = stream->next_frame = stream->this_frame + 1; + goto sync; + } + + stream->sync = 1; + } + + header->flags |= MAD_FLAG_INCOMPLETE; + + return 0; + + fail: + stream->sync = 0; + + return -1; +} + +/* + * NAME: frame->decode() + * DESCRIPTION: decode a single frame from a bitstream + */ +s32 mad_frame_decode(struct mad_frame *frame, struct mad_stream *stream) +{ + frame->options = stream->options; + + /* header() */ + /* error_check() */ + + if (!(frame->header.flags & MAD_FLAG_INCOMPLETE) && + mad_header_decode(&frame->header, stream) == -1) + goto fail; + + /* audio_data() */ + + frame->header.flags &= ~MAD_FLAG_INCOMPLETE; + + if (decoder_table[frame->header.layer - 1](stream, frame) == -1) { + if (!MAD_RECOVERABLE(stream->error)) + stream->next_frame = stream->this_frame; + + goto fail; + } + + /* ancillary_data() */ + + if (frame->header.layer != MAD_LAYER_III) { + struct mad_bitptr next_frame; + + mad_bit_init(&next_frame, stream->next_frame); + + stream->anc_ptr = stream->ptr; + stream->anc_bitlen = mad_bit_length(&stream->ptr, &next_frame); + + mad_bit_finish(&next_frame); + } + + return 0; + + fail: + stream->anc_bitlen = 0; + return -1; +} + +/* + * NAME: frame->mute() + * DESCRIPTION: zero all subband values so the frame becomes silent + */ +void mad_frame_mute(struct mad_frame *frame) +{ + u32 s, sb; + + for (s = 0; s < 36; ++s) { + for (sb = 0; sb < 32; ++sb) { + frame->sbsample[0][s][sb] = + frame->sbsample[1][s][sb] = 0; + } + } + + if (frame->overlap) { + for (s = 0; s < 18; ++s) { + for (sb = 0; sb < 32; ++sb) { + (*frame->overlap)[0][sb][s] = + (*frame->overlap)[1][sb][s] = 0; + } + } + } +} diff --git a/cpymo-backends/nds/decoder/frame.h b/cpymo-backends/nds/decoder/frame.h new file mode 100644 index 00000000..47627078 --- /dev/null +++ b/cpymo-backends/nds/decoder/frame.h @@ -0,0 +1,118 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifndef LIBMAD_FRAME_H +# define LIBMAD_FRAME_H + +# include +# include "fixed.h" +# include "timer.h" +# include "stream.h" + +enum mad_layer { + MAD_LAYER_I = 1, /* Layer I */ + MAD_LAYER_II = 2, /* Layer II */ + MAD_LAYER_III = 3 /* Layer III */ +}; + +enum mad_mode { + MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */ + MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */ + MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */ + MAD_MODE_STEREO = 3 /* normal LR stereo */ +}; + +enum mad_emphasis { + MAD_EMPHASIS_NONE = 0, /* no emphasis */ + MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */ + MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */ + MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */ +}; + +struct mad_header { + enum mad_layer layer; /* audio layer (1, 2, or 3) */ + enum mad_mode mode; /* channel mode (see above) */ + s32 mode_extension; /* additional mode info */ + enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ + + u32 bitrate; /* stream bitrate (bps) */ + u32 samplerate; /* sampling frequency (Hz) */ + + u16 crc_check; /* frame CRC accumulator */ + u16 crc_target; /* final target CRC checksum */ + + s32 flags; /* flags (see below) */ + s32 private_bits; /* private bits (see below) */ + + mad_timer_t duration; /* audio playing time of frame */ +}; + +struct mad_frame { + struct mad_header header; /* MPEG audio header */ + + s32 options; /* decoding options (from stream) */ + + mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */ + mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */ +}; + +# define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1) +# define MAD_NSBSAMPLES(header) \ + ((header)->layer == MAD_LAYER_I ? 12 : \ + (((header)->layer == MAD_LAYER_III && \ + ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36)) + +enum { + MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */ + MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */ + + MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */ + MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */ + MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */ + MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */ + + MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */ + MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */ + MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */ + + MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */ + MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */ + MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */ +}; + +enum { + MAD_PRIVATE_HEADER = 0x0100, /* header private bit */ + MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */ +}; + +void mad_header_init(struct mad_header *); + +# define mad_header_finish(header) /* nothing */ + +s32 mad_header_decode(struct mad_header *, struct mad_stream *); + +void mad_frame_init(struct mad_frame *); +void mad_frame_finish(struct mad_frame *); + +s32 mad_frame_decode(struct mad_frame *, struct mad_stream *); + +void mad_frame_mute(struct mad_frame *); + +# endif diff --git a/cpymo-backends/nds/decoder/gctypes.h b/cpymo-backends/nds/decoder/gctypes.h new file mode 100644 index 00000000..eef17308 --- /dev/null +++ b/cpymo-backends/nds/decoder/gctypes.h @@ -0,0 +1,5 @@ +/* CPyMO NDS portability shim for devkitPro libogc's fixed-point libmad. */ +#ifndef CPYMO_LIBMAD_GCTYPES_H +#define CPYMO_LIBMAD_GCTYPES_H +#include +#endif diff --git a/cpymo-backends/nds/decoder/global.h b/cpymo-backends/nds/decoder/global.h new file mode 100644 index 00000000..383245a5 --- /dev/null +++ b/cpymo-backends/nds/decoder/global.h @@ -0,0 +1,59 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifndef LIBMAD_GLOBAL_H +# define LIBMAD_GLOBAL_H + +/* CPyMO NDS: use the decoder's existing ARM multiply implementation. */ +# define FPM_ARM +/* conditional debugging */ + +# if defined(DEBUG) && defined(NDEBUG) +# error "cannot define both DEBUG and NDEBUG" +# endif + +# if defined(DEBUG) +# include +# endif + +/* conditional features */ + +# if defined(OPT_SPEED) && defined(OPT_ACCURACY) +# error "cannot optimize for both speed and accuracy" +# endif + +# if defined(OPT_SPEED) && !defined(OPT_SSO) +# define OPT_SSO +# endif + +# if defined(HAVE_UNISTD_H) && defined(HAVE_WAITPID) && \ + defined(HAVE_FCNTL) && defined(HAVE_PIPE) && defined(HAVE_FORK) +# define USE_ASYNC +# endif + +# if !defined(HAVE_ASSERT_H) +# if defined(NDEBUG) +# define assert(x) /* nothing */ +# else +# define assert(x) do { if (!(x)) abort(); } while (0) +# endif +# endif + +# endif diff --git a/cpymo-backends/nds/decoder/huffman.c b/cpymo-backends/nds/decoder/huffman.c new file mode 100644 index 00000000..0fc3022f --- /dev/null +++ b/cpymo-backends/nds/decoder/huffman.c @@ -0,0 +1,3097 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif + +# include "global.h" + +# include "huffman.h" + +/* + * These are the Huffman code words for Layer III. + * The data for these tables are derived from Table B.7 of ISO/IEC 11172-3. + * + * These tables support decoding up to 4 Huffman code bits at a time. + */ + +# if defined(__GNUC__) +# define PTR(offs, bits) { ptr: { 0, bits, offs } } +# define V(v, w, x, y, hlen) { value: { 1, hlen, v, w, x, y } } +# else +# define PTR(offs, bits) { { 0, bits, offs } } +# define V(v, w, x, y, hlen) { { 1, hlen, (v << 0) | (w << 1) | \ + (x << 2) | (y << 3) } } +# endif + +static +union huffquad const hufftabA[] = { + /* 0000 */ PTR(16, 2), + /* 0001 */ PTR(20, 2), + /* 0010 */ PTR(24, 1), + /* 0011 */ PTR(26, 1), + /* 0100 */ V(0, 0, 1, 0, 4), + /* 0101 */ V(0, 0, 0, 1, 4), + /* 0110 */ V(0, 1, 0, 0, 4), + /* 0111 */ V(1, 0, 0, 0, 4), + /* 1000 */ V(0, 0, 0, 0, 1), + /* 1001 */ V(0, 0, 0, 0, 1), + /* 1010 */ V(0, 0, 0, 0, 1), + /* 1011 */ V(0, 0, 0, 0, 1), + /* 1100 */ V(0, 0, 0, 0, 1), + /* 1101 */ V(0, 0, 0, 0, 1), + /* 1110 */ V(0, 0, 0, 0, 1), + /* 1111 */ V(0, 0, 0, 0, 1), + + /* 0000 ... */ + /* 00 */ V(1, 0, 1, 1, 2), /* 16 */ + /* 01 */ V(1, 1, 1, 1, 2), + /* 10 */ V(1, 1, 0, 1, 2), + /* 11 */ V(1, 1, 1, 0, 2), + + /* 0001 ... */ + /* 00 */ V(0, 1, 1, 1, 2), /* 20 */ + /* 01 */ V(0, 1, 0, 1, 2), + /* 10 */ V(1, 0, 0, 1, 1), + /* 11 */ V(1, 0, 0, 1, 1), + + /* 0010 ... */ + /* 0 */ V(0, 1, 1, 0, 1), /* 24 */ + /* 1 */ V(0, 0, 1, 1, 1), + + /* 0011 ... */ + /* 0 */ V(1, 0, 1, 0, 1), /* 26 */ + /* 1 */ V(1, 1, 0, 0, 1) +}; + +static +union huffquad const hufftabB[] = { + /* 0000 */ V(1, 1, 1, 1, 4), + /* 0001 */ V(1, 1, 1, 0, 4), + /* 0010 */ V(1, 1, 0, 1, 4), + /* 0011 */ V(1, 1, 0, 0, 4), + /* 0100 */ V(1, 0, 1, 1, 4), + /* 0101 */ V(1, 0, 1, 0, 4), + /* 0110 */ V(1, 0, 0, 1, 4), + /* 0111 */ V(1, 0, 0, 0, 4), + /* 1000 */ V(0, 1, 1, 1, 4), + /* 1001 */ V(0, 1, 1, 0, 4), + /* 1010 */ V(0, 1, 0, 1, 4), + /* 1011 */ V(0, 1, 0, 0, 4), + /* 1100 */ V(0, 0, 1, 1, 4), + /* 1101 */ V(0, 0, 1, 0, 4), + /* 1110 */ V(0, 0, 0, 1, 4), + /* 1111 */ V(0, 0, 0, 0, 4) +}; + +# undef V +# undef PTR + +# if defined(__GNUC__) +# define PTR(offs, bits) { ptr: { 0, bits, offs } } +# define V(x, y, hlen) { value: { 1, hlen, x, y } } +# else +# define PTR(offs, bits) { { 0, bits, offs } } +# define V(x, y, hlen) { { 1, hlen, (x << 0) | (y << 4) } } +# endif + +static +union huffpair const hufftab0[] = { + /* */ V(0, 0, 0) +}; + +static +union huffpair const hufftab1[] = { + /* 000 */ V(1, 1, 3), + /* 001 */ V(0, 1, 3), + /* 010 */ V(1, 0, 2), + /* 011 */ V(1, 0, 2), + /* 100 */ V(0, 0, 1), + /* 101 */ V(0, 0, 1), + /* 110 */ V(0, 0, 1), + /* 111 */ V(0, 0, 1) +}; + +static +union huffpair const hufftab2[] = { + /* 000 */ PTR(8, 3), + /* 001 */ V(1, 1, 3), + /* 010 */ V(0, 1, 3), + /* 011 */ V(1, 0, 3), + /* 100 */ V(0, 0, 1), + /* 101 */ V(0, 0, 1), + /* 110 */ V(0, 0, 1), + /* 111 */ V(0, 0, 1), + + /* 000 ... */ + /* 000 */ V(2, 2, 3), /* 8 */ + /* 001 */ V(0, 2, 3), + /* 010 */ V(1, 2, 2), + /* 011 */ V(1, 2, 2), + /* 100 */ V(2, 1, 2), + /* 101 */ V(2, 1, 2), + /* 110 */ V(2, 0, 2), + /* 111 */ V(2, 0, 2) +}; + +static +union huffpair const hufftab3[] = { + /* 000 */ PTR(8, 3), + /* 001 */ V(1, 0, 3), + /* 010 */ V(1, 1, 2), + /* 011 */ V(1, 1, 2), + /* 100 */ V(0, 1, 2), + /* 101 */ V(0, 1, 2), + /* 110 */ V(0, 0, 2), + /* 111 */ V(0, 0, 2), + + /* 000 ... */ + /* 000 */ V(2, 2, 3), /* 8 */ + /* 001 */ V(0, 2, 3), + /* 010 */ V(1, 2, 2), + /* 011 */ V(1, 2, 2), + /* 100 */ V(2, 1, 2), + /* 101 */ V(2, 1, 2), + /* 110 */ V(2, 0, 2), + /* 111 */ V(2, 0, 2) +}; + +static +union huffpair const hufftab5[] = { + /* 000 */ PTR(8, 4), + /* 001 */ V(1, 1, 3), + /* 010 */ V(0, 1, 3), + /* 011 */ V(1, 0, 3), + /* 100 */ V(0, 0, 1), + /* 101 */ V(0, 0, 1), + /* 110 */ V(0, 0, 1), + /* 111 */ V(0, 0, 1), + + /* 000 ... */ + /* 0000 */ PTR(24, 1), /* 8 */ + /* 0001 */ V(3, 2, 4), + /* 0010 */ V(3, 1, 3), + /* 0011 */ V(3, 1, 3), + /* 0100 */ V(1, 3, 4), + /* 0101 */ V(0, 3, 4), + /* 0110 */ V(3, 0, 4), + /* 0111 */ V(2, 2, 4), + /* 1000 */ V(1, 2, 3), + /* 1001 */ V(1, 2, 3), + /* 1010 */ V(2, 1, 3), + /* 1011 */ V(2, 1, 3), + /* 1100 */ V(0, 2, 3), + /* 1101 */ V(0, 2, 3), + /* 1110 */ V(2, 0, 3), + /* 1111 */ V(2, 0, 3), + + /* 000 0000 ... */ + /* 0 */ V(3, 3, 1), /* 24 */ + /* 1 */ V(2, 3, 1) +}; + +static +union huffpair const hufftab6[] = { + /* 0000 */ PTR(16, 3), + /* 0001 */ PTR(24, 1), + /* 0010 */ PTR(26, 1), + /* 0011 */ V(1, 2, 4), + /* 0100 */ V(2, 1, 4), + /* 0101 */ V(2, 0, 4), + /* 0110 */ V(0, 1, 3), + /* 0111 */ V(0, 1, 3), + /* 1000 */ V(1, 1, 2), + /* 1001 */ V(1, 1, 2), + /* 1010 */ V(1, 1, 2), + /* 1011 */ V(1, 1, 2), + /* 1100 */ V(1, 0, 3), + /* 1101 */ V(1, 0, 3), + /* 1110 */ V(0, 0, 3), + /* 1111 */ V(0, 0, 3), + + /* 0000 ... */ + /* 000 */ V(3, 3, 3), /* 16 */ + /* 001 */ V(0, 3, 3), + /* 010 */ V(2, 3, 2), + /* 011 */ V(2, 3, 2), + /* 100 */ V(3, 2, 2), + /* 101 */ V(3, 2, 2), + /* 110 */ V(3, 0, 2), + /* 111 */ V(3, 0, 2), + + /* 0001 ... */ + /* 0 */ V(1, 3, 1), /* 24 */ + /* 1 */ V(3, 1, 1), + + /* 0010 ... */ + /* 0 */ V(2, 2, 1), /* 26 */ + /* 1 */ V(0, 2, 1) +}; + +static +union huffpair const hufftab7[] = { + /* 0000 */ PTR(16, 4), + /* 0001 */ PTR(32, 4), + /* 0010 */ PTR(48, 2), + /* 0011 */ V(1, 1, 4), + /* 0100 */ V(0, 1, 3), + /* 0101 */ V(0, 1, 3), + /* 0110 */ V(1, 0, 3), + /* 0111 */ V(1, 0, 3), + /* 1000 */ V(0, 0, 1), + /* 1001 */ V(0, 0, 1), + /* 1010 */ V(0, 0, 1), + /* 1011 */ V(0, 0, 1), + /* 1100 */ V(0, 0, 1), + /* 1101 */ V(0, 0, 1), + /* 1110 */ V(0, 0, 1), + /* 1111 */ V(0, 0, 1), + + /* 0000 ... */ + /* 0000 */ PTR(52, 2), /* 16 */ + /* 0001 */ PTR(56, 1), + /* 0010 */ PTR(58, 1), + /* 0011 */ V(1, 5, 4), + /* 0100 */ V(5, 1, 4), + /* 0101 */ PTR(60, 1), + /* 0110 */ V(5, 0, 4), + /* 0111 */ PTR(62, 1), + /* 1000 */ V(2, 4, 4), + /* 1001 */ V(4, 2, 4), + /* 1010 */ V(1, 4, 3), + /* 1011 */ V(1, 4, 3), + /* 1100 */ V(4, 1, 3), + /* 1101 */ V(4, 1, 3), + /* 1110 */ V(4, 0, 3), + /* 1111 */ V(4, 0, 3), + + /* 0001 ... */ + /* 0000 */ V(0, 4, 4), /* 32 */ + /* 0001 */ V(2, 3, 4), + /* 0010 */ V(3, 2, 4), + /* 0011 */ V(0, 3, 4), + /* 0100 */ V(1, 3, 3), + /* 0101 */ V(1, 3, 3), + /* 0110 */ V(3, 1, 3), + /* 0111 */ V(3, 1, 3), + /* 1000 */ V(3, 0, 3), + /* 1001 */ V(3, 0, 3), + /* 1010 */ V(2, 2, 3), + /* 1011 */ V(2, 2, 3), + /* 1100 */ V(1, 2, 2), + /* 1101 */ V(1, 2, 2), + /* 1110 */ V(1, 2, 2), + /* 1111 */ V(1, 2, 2), + + /* 0010 ... */ + /* 00 */ V(2, 1, 1), /* 48 */ + /* 01 */ V(2, 1, 1), + /* 10 */ V(0, 2, 2), + /* 11 */ V(2, 0, 2), + + /* 0000 0000 ... */ + /* 00 */ V(5, 5, 2), /* 52 */ + /* 01 */ V(4, 5, 2), + /* 10 */ V(5, 4, 2), + /* 11 */ V(5, 3, 2), + + /* 0000 0001 ... */ + /* 0 */ V(3, 5, 1), /* 56 */ + /* 1 */ V(4, 4, 1), + + /* 0000 0010 ... */ + /* 0 */ V(2, 5, 1), /* 58 */ + /* 1 */ V(5, 2, 1), + + /* 0000 0101 ... */ + /* 0 */ V(0, 5, 1), /* 60 */ + /* 1 */ V(3, 4, 1), + + /* 0000 0111 ... */ + /* 0 */ V(4, 3, 1), /* 62 */ + /* 1 */ V(3, 3, 1) +}; + +# if 0 +/* this version saves 8 entries (16 bytes) at the expense of + an extra lookup in 4 out of 36 cases */ +static +union huffpair const hufftab8[] = { + /* 0000 */ PTR(16, 4), + /* 0001 */ PTR(32, 2), + /* 0010 */ V(1, 2, 4), + /* 0011 */ V(2, 1, 4), + /* 0100 */ V(1, 1, 2), + /* 0101 */ V(1, 1, 2), + /* 0110 */ V(1, 1, 2), + /* 0111 */ V(1, 1, 2), + /* 1000 */ V(0, 1, 3), + /* 1001 */ V(0, 1, 3), + /* 1010 */ V(1, 0, 3), + /* 1011 */ V(1, 0, 3), + /* 1100 */ V(0, 0, 2), + /* 1101 */ V(0, 0, 2), + /* 1110 */ V(0, 0, 2), + /* 1111 */ V(0, 0, 2), + + /* 0000 ... */ + /* 0000 */ PTR(36, 3), /* 16 */ + /* 0001 */ PTR(44, 2), + /* 0010 */ PTR(48, 1), + /* 0011 */ V(1, 5, 4), + /* 0100 */ V(5, 1, 4), + /* 0101 */ PTR(50, 1), + /* 0110 */ PTR(52, 1), + /* 0111 */ V(2, 4, 4), + /* 1000 */ V(4, 2, 4), + /* 1001 */ V(1, 4, 4), + /* 1010 */ V(4, 1, 3), + /* 1011 */ V(4, 1, 3), + /* 1100 */ V(0, 4, 4), + /* 1101 */ V(4, 0, 4), + /* 1110 */ V(2, 3, 4), + /* 1111 */ V(3, 2, 4), + + /* 0001 ... */ + /* 00 */ PTR(54, 2), /* 32 */ + /* 01 */ V(2, 2, 2), + /* 10 */ V(0, 2, 2), + /* 11 */ V(2, 0, 2), + + /* 0000 0000 ... */ + /* 000 */ V(5, 5, 3), /* 36 */ + /* 001 */ V(5, 4, 3), + /* 010 */ V(4, 5, 2), + /* 011 */ V(4, 5, 2), + /* 100 */ V(5, 3, 1), + /* 101 */ V(5, 3, 1), + /* 110 */ V(5, 3, 1), + /* 111 */ V(5, 3, 1), + + /* 0000 0001 ... */ + /* 00 */ V(3, 5, 2), /* 44 */ + /* 01 */ V(4, 4, 2), + /* 10 */ V(2, 5, 1), + /* 11 */ V(2, 5, 1), + + /* 0000 0010 ... */ + /* 0 */ V(5, 2, 1), /* 48 */ + /* 1 */ V(0, 5, 1), + + /* 0000 0101 ... */ + /* 0 */ V(3, 4, 1), /* 50 */ + /* 1 */ V(4, 3, 1), + + /* 0000 0110 ... */ + /* 0 */ V(5, 0, 1), /* 52 */ + /* 1 */ V(3, 3, 1), + + /* 0001 00 ... */ + /* 00 */ V(1, 3, 2), /* 54 */ + /* 01 */ V(3, 1, 2), + /* 10 */ V(0, 3, 2), + /* 11 */ V(3, 0, 2), +}; +# else +static +union huffpair const hufftab8[] = { + /* 0000 */ PTR(16, 4), + /* 0001 */ PTR(32, 4), + /* 0010 */ V(1, 2, 4), + /* 0011 */ V(2, 1, 4), + /* 0100 */ V(1, 1, 2), + /* 0101 */ V(1, 1, 2), + /* 0110 */ V(1, 1, 2), + /* 0111 */ V(1, 1, 2), + /* 1000 */ V(0, 1, 3), + /* 1001 */ V(0, 1, 3), + /* 1010 */ V(1, 0, 3), + /* 1011 */ V(1, 0, 3), + /* 1100 */ V(0, 0, 2), + /* 1101 */ V(0, 0, 2), + /* 1110 */ V(0, 0, 2), + /* 1111 */ V(0, 0, 2), + + /* 0000 ... */ + /* 0000 */ PTR(48, 3), /* 16 */ + /* 0001 */ PTR(56, 2), + /* 0010 */ PTR(60, 1), + /* 0011 */ V(1, 5, 4), + /* 0100 */ V(5, 1, 4), + /* 0101 */ PTR(62, 1), + /* 0110 */ PTR(64, 1), + /* 0111 */ V(2, 4, 4), + /* 1000 */ V(4, 2, 4), + /* 1001 */ V(1, 4, 4), + /* 1010 */ V(4, 1, 3), + /* 1011 */ V(4, 1, 3), + /* 1100 */ V(0, 4, 4), + /* 1101 */ V(4, 0, 4), + /* 1110 */ V(2, 3, 4), + /* 1111 */ V(3, 2, 4), + + /* 0001 ... */ + /* 0000 */ V(1, 3, 4), /* 32 */ + /* 0001 */ V(3, 1, 4), + /* 0010 */ V(0, 3, 4), + /* 0011 */ V(3, 0, 4), + /* 0100 */ V(2, 2, 2), + /* 0101 */ V(2, 2, 2), + /* 0110 */ V(2, 2, 2), + /* 0111 */ V(2, 2, 2), + /* 1000 */ V(0, 2, 2), + /* 1001 */ V(0, 2, 2), + /* 1010 */ V(0, 2, 2), + /* 1011 */ V(0, 2, 2), + /* 1100 */ V(2, 0, 2), + /* 1101 */ V(2, 0, 2), + /* 1110 */ V(2, 0, 2), + /* 1111 */ V(2, 0, 2), + + /* 0000 0000 ... */ + /* 000 */ V(5, 5, 3), /* 48 */ + /* 001 */ V(5, 4, 3), + /* 010 */ V(4, 5, 2), + /* 011 */ V(4, 5, 2), + /* 100 */ V(5, 3, 1), + /* 101 */ V(5, 3, 1), + /* 110 */ V(5, 3, 1), + /* 111 */ V(5, 3, 1), + + /* 0000 0001 ... */ + /* 00 */ V(3, 5, 2), /* 56 */ + /* 01 */ V(4, 4, 2), + /* 10 */ V(2, 5, 1), + /* 11 */ V(2, 5, 1), + + /* 0000 0010 ... */ + /* 0 */ V(5, 2, 1), /* 60 */ + /* 1 */ V(0, 5, 1), + + /* 0000 0101 ... */ + /* 0 */ V(3, 4, 1), /* 62 */ + /* 1 */ V(4, 3, 1), + + /* 0000 0110 ... */ + /* 0 */ V(5, 0, 1), /* 64 */ + /* 1 */ V(3, 3, 1) +}; +# endif + +static +union huffpair const hufftab9[] = { + /* 0000 */ PTR(16, 4), + /* 0001 */ PTR(32, 3), + /* 0010 */ PTR(40, 2), + /* 0011 */ PTR(44, 2), + /* 0100 */ PTR(48, 1), + /* 0101 */ V(1, 2, 4), + /* 0110 */ V(2, 1, 4), + /* 0111 */ V(2, 0, 4), + /* 1000 */ V(1, 1, 3), + /* 1001 */ V(1, 1, 3), + /* 1010 */ V(0, 1, 3), + /* 1011 */ V(0, 1, 3), + /* 1100 */ V(1, 0, 3), + /* 1101 */ V(1, 0, 3), + /* 1110 */ V(0, 0, 3), + /* 1111 */ V(0, 0, 3), + + /* 0000 ... */ + /* 0000 */ PTR(50, 1), /* 16 */ + /* 0001 */ V(3, 5, 4), + /* 0010 */ V(5, 3, 4), + /* 0011 */ PTR(52, 1), + /* 0100 */ V(4, 4, 4), + /* 0101 */ V(2, 5, 4), + /* 0110 */ V(5, 2, 4), + /* 0111 */ V(1, 5, 4), + /* 1000 */ V(5, 1, 3), + /* 1001 */ V(5, 1, 3), + /* 1010 */ V(3, 4, 3), + /* 1011 */ V(3, 4, 3), + /* 1100 */ V(4, 3, 3), + /* 1101 */ V(4, 3, 3), + /* 1110 */ V(5, 0, 4), + /* 1111 */ V(0, 4, 4), + + /* 0001 ... */ + /* 000 */ V(2, 4, 3), /* 32 */ + /* 001 */ V(4, 2, 3), + /* 010 */ V(3, 3, 3), + /* 011 */ V(4, 0, 3), + /* 100 */ V(1, 4, 2), + /* 101 */ V(1, 4, 2), + /* 110 */ V(4, 1, 2), + /* 111 */ V(4, 1, 2), + + /* 0010 ... */ + /* 00 */ V(2, 3, 2), /* 40 */ + /* 01 */ V(3, 2, 2), + /* 10 */ V(1, 3, 1), + /* 11 */ V(1, 3, 1), + + /* 0011 ... */ + /* 00 */ V(3, 1, 1), /* 44 */ + /* 01 */ V(3, 1, 1), + /* 10 */ V(0, 3, 2), + /* 11 */ V(3, 0, 2), + + /* 0100 ... */ + /* 0 */ V(2, 2, 1), /* 48 */ + /* 1 */ V(0, 2, 1), + + /* 0000 0000 ... */ + /* 0 */ V(5, 5, 1), /* 50 */ + /* 1 */ V(4, 5, 1), + + /* 0000 0011 ... */ + /* 0 */ V(5, 4, 1), /* 52 */ + /* 1 */ V(0, 5, 1) +}; + +static +union huffpair const hufftab10[] = { + /* 0000 */ PTR(16, 4), + /* 0001 */ PTR(32, 4), + /* 0010 */ PTR(48, 2), + /* 0011 */ V(1, 1, 4), + /* 0100 */ V(0, 1, 3), + /* 0101 */ V(0, 1, 3), + /* 0110 */ V(1, 0, 3), + /* 0111 */ V(1, 0, 3), + /* 1000 */ V(0, 0, 1), + /* 1001 */ V(0, 0, 1), + /* 1010 */ V(0, 0, 1), + /* 1011 */ V(0, 0, 1), + /* 1100 */ V(0, 0, 1), + /* 1101 */ V(0, 0, 1), + /* 1110 */ V(0, 0, 1), + /* 1111 */ V(0, 0, 1), + + /* 0000 ... */ + /* 0000 */ PTR(52, 3), /* 16 */ + /* 0001 */ PTR(60, 2), + /* 0010 */ PTR(64, 3), + /* 0011 */ PTR(72, 1), + /* 0100 */ PTR(74, 2), + /* 0101 */ PTR(78, 2), + /* 0110 */ PTR(82, 2), + /* 0111 */ V(1, 7, 4), + /* 1000 */ V(7, 1, 4), + /* 1001 */ PTR(86, 1), + /* 1010 */ PTR(88, 2), + /* 1011 */ PTR(92, 2), + /* 1100 */ V(1, 6, 4), + /* 1101 */ V(6, 1, 4), + /* 1110 */ V(6, 0, 4), + /* 1111 */ PTR(96, 1), + + /* 0001 ... */ + /* 0000 */ PTR(98, 1), /* 32 */ + /* 0001 */ PTR(100, 1), + /* 0010 */ V(1, 4, 4), + /* 0011 */ V(4, 1, 4), + /* 0100 */ V(4, 0, 4), + /* 0101 */ V(2, 3, 4), + /* 0110 */ V(3, 2, 4), + /* 0111 */ V(0, 3, 4), + /* 1000 */ V(1, 3, 3), + /* 1001 */ V(1, 3, 3), + /* 1010 */ V(3, 1, 3), + /* 1011 */ V(3, 1, 3), + /* 1100 */ V(3, 0, 3), + /* 1101 */ V(3, 0, 3), + /* 1110 */ V(2, 2, 3), + /* 1111 */ V(2, 2, 3), + + /* 0010 ... */ + /* 00 */ V(1, 2, 2), /* 48 */ + /* 01 */ V(2, 1, 2), + /* 10 */ V(0, 2, 2), + /* 11 */ V(2, 0, 2), + + /* 0000 0000 ... */ + /* 000 */ V(7, 7, 3), /* 52 */ + /* 001 */ V(6, 7, 3), + /* 010 */ V(7, 6, 3), + /* 011 */ V(5, 7, 3), + /* 100 */ V(7, 5, 3), + /* 101 */ V(6, 6, 3), + /* 110 */ V(4, 7, 2), + /* 111 */ V(4, 7, 2), + + /* 0000 0001 ... */ + /* 00 */ V(7, 4, 2), /* 60 */ + /* 01 */ V(5, 6, 2), + /* 10 */ V(6, 5, 2), + /* 11 */ V(3, 7, 2), + + /* 0000 0010 ... */ + /* 000 */ V(7, 3, 2), /* 64 */ + /* 001 */ V(7, 3, 2), + /* 010 */ V(4, 6, 2), + /* 011 */ V(4, 6, 2), + /* 100 */ V(5, 5, 3), + /* 101 */ V(5, 4, 3), + /* 110 */ V(6, 3, 2), + /* 111 */ V(6, 3, 2), + + /* 0000 0011 ... */ + /* 0 */ V(2, 7, 1), /* 72 */ + /* 1 */ V(7, 2, 1), + + /* 0000 0100 ... */ + /* 00 */ V(6, 4, 2), /* 74 */ + /* 01 */ V(0, 7, 2), + /* 10 */ V(7, 0, 1), + /* 11 */ V(7, 0, 1), + + /* 0000 0101 ... */ + /* 00 */ V(6, 2, 1), /* 78 */ + /* 01 */ V(6, 2, 1), + /* 10 */ V(4, 5, 2), + /* 11 */ V(3, 5, 2), + + /* 0000 0110 ... */ + /* 00 */ V(0, 6, 1), /* 82 */ + /* 01 */ V(0, 6, 1), + /* 10 */ V(5, 3, 2), + /* 11 */ V(4, 4, 2), + + /* 0000 1001 ... */ + /* 0 */ V(3, 6, 1), /* 86 */ + /* 1 */ V(2, 6, 1), + + /* 0000 1010 ... */ + /* 00 */ V(2, 5, 2), /* 88 */ + /* 01 */ V(5, 2, 2), + /* 10 */ V(1, 5, 1), + /* 11 */ V(1, 5, 1), + + /* 0000 1011 ... */ + /* 00 */ V(5, 1, 1), /* 92 */ + /* 01 */ V(5, 1, 1), + /* 10 */ V(3, 4, 2), + /* 11 */ V(4, 3, 2), + + /* 0000 1111 ... */ + /* 0 */ V(0, 5, 1), /* 96 */ + /* 1 */ V(5, 0, 1), + + /* 0001 0000 ... */ + /* 0 */ V(2, 4, 1), /* 98 */ + /* 1 */ V(4, 2, 1), + + /* 0001 0001 ... */ + /* 0 */ V(3, 3, 1), /* 100 */ + /* 1 */ V(0, 4, 1) +}; + +static +union huffpair const hufftab11[] = { + /* 0000 */ PTR(16, 4), + /* 0001 */ PTR(32, 4), + /* 0010 */ PTR(48, 4), + /* 0011 */ PTR(64, 3), + /* 0100 */ V(1, 2, 4), + /* 0101 */ PTR(72, 1), + /* 0110 */ V(1, 1, 3), + /* 0111 */ V(1, 1, 3), + /* 1000 */ V(0, 1, 3), + /* 1001 */ V(0, 1, 3), + /* 1010 */ V(1, 0, 3), + /* 1011 */ V(1, 0, 3), + /* 1100 */ V(0, 0, 2), + /* 1101 */ V(0, 0, 2), + /* 1110 */ V(0, 0, 2), + /* 1111 */ V(0, 0, 2), + + /* 0000 ... */ + /* 0000 */ PTR(74, 2), /* 16 */ + /* 0001 */ PTR(78, 3), + /* 0010 */ PTR(86, 2), + /* 0011 */ PTR(90, 1), + /* 0100 */ PTR(92, 2), + /* 0101 */ V(2, 7, 4), + /* 0110 */ V(7, 2, 4), + /* 0111 */ PTR(96, 1), + /* 1000 */ V(7, 1, 3), + /* 1001 */ V(7, 1, 3), + /* 1010 */ V(1, 7, 4), + /* 1011 */ V(7, 0, 4), + /* 1100 */ V(3, 6, 4), + /* 1101 */ V(6, 3, 4), + /* 1110 */ V(6, 0, 4), + /* 1111 */ PTR(98, 1), + + /* 0001 ... */ + /* 0000 */ PTR(100, 1), /* 32 */ + /* 0001 */ V(1, 5, 4), + /* 0010 */ V(6, 2, 3), + /* 0011 */ V(6, 2, 3), + /* 0100 */ V(2, 6, 4), + /* 0101 */ V(0, 6, 4), + /* 0110 */ V(1, 6, 3), + /* 0111 */ V(1, 6, 3), + /* 1000 */ V(6, 1, 3), + /* 1001 */ V(6, 1, 3), + /* 1010 */ V(5, 1, 4), + /* 1011 */ V(3, 4, 4), + /* 1100 */ V(5, 0, 4), + /* 1101 */ PTR(102, 1), + /* 1110 */ V(2, 4, 4), + /* 1111 */ V(4, 2, 4), + + /* 0010 ... */ + /* 0000 */ V(1, 4, 4), /* 48 */ + /* 0001 */ V(4, 1, 4), + /* 0010 */ V(0, 4, 4), + /* 0011 */ V(4, 0, 4), + /* 0100 */ V(2, 3, 3), + /* 0101 */ V(2, 3, 3), + /* 0110 */ V(3, 2, 3), + /* 0111 */ V(3, 2, 3), + /* 1000 */ V(1, 3, 2), + /* 1001 */ V(1, 3, 2), + /* 1010 */ V(1, 3, 2), + /* 1011 */ V(1, 3, 2), + /* 1100 */ V(3, 1, 2), + /* 1101 */ V(3, 1, 2), + /* 1110 */ V(3, 1, 2), + /* 1111 */ V(3, 1, 2), + + /* 0011 ... */ + /* 000 */ V(0, 3, 3), /* 64 */ + /* 001 */ V(3, 0, 3), + /* 010 */ V(2, 2, 2), + /* 011 */ V(2, 2, 2), + /* 100 */ V(2, 1, 1), + /* 101 */ V(2, 1, 1), + /* 110 */ V(2, 1, 1), + /* 111 */ V(2, 1, 1), + + /* 0101 ... */ + /* 0 */ V(0, 2, 1), /* 72 */ + /* 1 */ V(2, 0, 1), + + /* 0000 0000 ... */ + /* 00 */ V(7, 7, 2), /* 74 */ + /* 01 */ V(6, 7, 2), + /* 10 */ V(7, 6, 2), + /* 11 */ V(7, 5, 2), + + /* 0000 0001 ... */ + /* 000 */ V(6, 6, 2), /* 78 */ + /* 001 */ V(6, 6, 2), + /* 010 */ V(4, 7, 2), + /* 011 */ V(4, 7, 2), + /* 100 */ V(7, 4, 2), + /* 101 */ V(7, 4, 2), + /* 110 */ V(5, 7, 3), + /* 111 */ V(5, 5, 3), + + /* 0000 0010 ... */ + /* 00 */ V(5, 6, 2), /* 86 */ + /* 01 */ V(6, 5, 2), + /* 10 */ V(3, 7, 1), + /* 11 */ V(3, 7, 1), + + /* 0000 0011 ... */ + /* 0 */ V(7, 3, 1), /* 90 */ + /* 1 */ V(4, 6, 1), + + /* 0000 0100 ... */ + /* 00 */ V(4, 5, 2), /* 92 */ + /* 01 */ V(5, 4, 2), + /* 10 */ V(3, 5, 2), + /* 11 */ V(5, 3, 2), + + /* 0000 0111 ... */ + /* 0 */ V(6, 4, 1), /* 96 */ + /* 1 */ V(0, 7, 1), + + /* 0000 1111 ... */ + /* 0 */ V(4, 4, 1), /* 98 */ + /* 1 */ V(2, 5, 1), + + /* 0001 0000 ... */ + /* 0 */ V(5, 2, 1), /* 100 */ + /* 1 */ V(0, 5, 1), + + /* 0001 1101 ... */ + /* 0 */ V(4, 3, 1), /* 102 */ + /* 1 */ V(3, 3, 1) +}; + +static +union huffpair const hufftab12[] = { + /* 0000 */ PTR(16, 4), + /* 0001 */ PTR(32, 4), + /* 0010 */ PTR(48, 4), + /* 0011 */ PTR(64, 2), + /* 0100 */ PTR(68, 3), + /* 0101 */ PTR(76, 1), + /* 0110 */ V(1, 2, 4), + /* 0111 */ V(2, 1, 4), + /* 1000 */ PTR(78, 1), + /* 1001 */ V(0, 0, 4), + /* 1010 */ V(1, 1, 3), + /* 1011 */ V(1, 1, 3), + /* 1100 */ V(0, 1, 3), + /* 1101 */ V(0, 1, 3), + /* 1110 */ V(1, 0, 3), + /* 1111 */ V(1, 0, 3), + + /* 0000 ... */ + /* 0000 */ PTR(80, 2), /* 16 */ + /* 0001 */ PTR(84, 1), + /* 0010 */ PTR(86, 1), + /* 0011 */ PTR(88, 1), + /* 0100 */ V(5, 6, 4), + /* 0101 */ V(3, 7, 4), + /* 0110 */ PTR(90, 1), + /* 0111 */ V(2, 7, 4), + /* 1000 */ V(7, 2, 4), + /* 1001 */ V(4, 6, 4), + /* 1010 */ V(6, 4, 4), + /* 1011 */ V(1, 7, 4), + /* 1100 */ V(7, 1, 4), + /* 1101 */ PTR(92, 1), + /* 1110 */ V(3, 6, 4), + /* 1111 */ V(6, 3, 4), + + /* 0001 ... */ + /* 0000 */ V(4, 5, 4), /* 32 */ + /* 0001 */ V(5, 4, 4), + /* 0010 */ V(4, 4, 4), + /* 0011 */ PTR(94, 1), + /* 0100 */ V(2, 6, 3), + /* 0101 */ V(2, 6, 3), + /* 0110 */ V(6, 2, 3), + /* 0111 */ V(6, 2, 3), + /* 1000 */ V(6, 1, 3), + /* 1001 */ V(6, 1, 3), + /* 1010 */ V(1, 6, 4), + /* 1011 */ V(6, 0, 4), + /* 1100 */ V(3, 5, 4), + /* 1101 */ V(5, 3, 4), + /* 1110 */ V(2, 5, 4), + /* 1111 */ V(5, 2, 4), + + /* 0010 ... */ + /* 0000 */ V(1, 5, 3), /* 48 */ + /* 0001 */ V(1, 5, 3), + /* 0010 */ V(5, 1, 3), + /* 0011 */ V(5, 1, 3), + /* 0100 */ V(3, 4, 3), + /* 0101 */ V(3, 4, 3), + /* 0110 */ V(4, 3, 3), + /* 0111 */ V(4, 3, 3), + /* 1000 */ V(5, 0, 4), + /* 1001 */ V(0, 4, 4), + /* 1010 */ V(2, 4, 3), + /* 1011 */ V(2, 4, 3), + /* 1100 */ V(4, 2, 3), + /* 1101 */ V(4, 2, 3), + /* 1110 */ V(1, 4, 3), + /* 1111 */ V(1, 4, 3), + + /* 0011 ... */ + /* 00 */ V(3, 3, 2), /* 64 */ + /* 01 */ V(4, 1, 2), + /* 10 */ V(2, 3, 2), + /* 11 */ V(3, 2, 2), + + /* 0100 ... */ + /* 000 */ V(4, 0, 3), /* 68 */ + /* 001 */ V(0, 3, 3), + /* 010 */ V(3, 0, 2), + /* 011 */ V(3, 0, 2), + /* 100 */ V(1, 3, 1), + /* 101 */ V(1, 3, 1), + /* 110 */ V(1, 3, 1), + /* 111 */ V(1, 3, 1), + + /* 0101 ... */ + /* 0 */ V(3, 1, 1), /* 76 */ + /* 1 */ V(2, 2, 1), + + /* 1000 ... */ + /* 0 */ V(0, 2, 1), /* 78 */ + /* 1 */ V(2, 0, 1), + + /* 0000 0000 ... */ + /* 00 */ V(7, 7, 2), /* 80 */ + /* 01 */ V(6, 7, 2), + /* 10 */ V(7, 6, 1), + /* 11 */ V(7, 6, 1), + + /* 0000 0001 ... */ + /* 0 */ V(5, 7, 1), /* 84 */ + /* 1 */ V(7, 5, 1), + + /* 0000 0010 ... */ + /* 0 */ V(6, 6, 1), /* 86 */ + /* 1 */ V(4, 7, 1), + + /* 0000 0011 ... */ + /* 0 */ V(7, 4, 1), /* 88 */ + /* 1 */ V(6, 5, 1), + + /* 0000 0110 ... */ + /* 0 */ V(7, 3, 1), /* 90 */ + /* 1 */ V(5, 5, 1), + + /* 0000 1101 ... */ + /* 0 */ V(0, 7, 1), /* 92 */ + /* 1 */ V(7, 0, 1), + + /* 0001 0011 ... */ + /* 0 */ V(0, 6, 1), /* 94 */ + /* 1 */ V(0, 5, 1) +}; + +static +union huffpair const hufftab13[] = { + /* 0000 */ PTR(16, 4), + /* 0001 */ PTR(32, 4), + /* 0010 */ PTR(48, 4), + /* 0011 */ PTR(64, 2), + /* 0100 */ V(1, 1, 4), + /* 0101 */ V(0, 1, 4), + /* 0110 */ V(1, 0, 3), + /* 0111 */ V(1, 0, 3), + /* 1000 */ V(0, 0, 1), + /* 1001 */ V(0, 0, 1), + /* 1010 */ V(0, 0, 1), + /* 1011 */ V(0, 0, 1), + /* 1100 */ V(0, 0, 1), + /* 1101 */ V(0, 0, 1), + /* 1110 */ V(0, 0, 1), + /* 1111 */ V(0, 0, 1), + + /* 0000 ... */ + /* 0000 */ PTR(68, 4), /* 16 */ + /* 0001 */ PTR(84, 4), + /* 0010 */ PTR(100, 4), + /* 0011 */ PTR(116, 4), + /* 0100 */ PTR(132, 4), + /* 0101 */ PTR(148, 4), + /* 0110 */ PTR(164, 3), + /* 0111 */ PTR(172, 3), + /* 1000 */ PTR(180, 3), + /* 1001 */ PTR(188, 3), + /* 1010 */ PTR(196, 3), + /* 1011 */ PTR(204, 3), + /* 1100 */ PTR(212, 1), + /* 1101 */ PTR(214, 2), + /* 1110 */ PTR(218, 3), + /* 1111 */ PTR(226, 1), + + /* 0001 ... */ + /* 0000 */ PTR(228, 2), /* 32 */ + /* 0001 */ PTR(232, 2), + /* 0010 */ PTR(236, 2), + /* 0011 */ PTR(240, 2), + /* 0100 */ V(8, 1, 4), + /* 0101 */ PTR(244, 1), + /* 0110 */ PTR(246, 1), + /* 0111 */ PTR(248, 1), + /* 1000 */ PTR(250, 2), + /* 1001 */ PTR(254, 1), + /* 1010 */ V(1, 5, 4), + /* 1011 */ V(5, 1, 4), + /* 1100 */ PTR(256, 1), + /* 1101 */ PTR(258, 1), + /* 1110 */ PTR(260, 1), + /* 1111 */ V(1, 4, 4), + + /* 0010 ... */ + /* 0000 */ V(4, 1, 3), /* 48 */ + /* 0001 */ V(4, 1, 3), + /* 0010 */ V(0, 4, 4), + /* 0011 */ V(4, 0, 4), + /* 0100 */ V(2, 3, 4), + /* 0101 */ V(3, 2, 4), + /* 0110 */ V(1, 3, 3), + /* 0111 */ V(1, 3, 3), + /* 1000 */ V(3, 1, 3), + /* 1001 */ V(3, 1, 3), + /* 1010 */ V(0, 3, 3), + /* 1011 */ V(0, 3, 3), + /* 1100 */ V(3, 0, 3), + /* 1101 */ V(3, 0, 3), + /* 1110 */ V(2, 2, 3), + /* 1111 */ V(2, 2, 3), + + /* 0011 ... */ + /* 00 */ V(1, 2, 2), /* 64 */ + /* 01 */ V(2, 1, 2), + /* 10 */ V(0, 2, 2), + /* 11 */ V(2, 0, 2), + + /* 0000 0000 ... */ + /* 0000 */ PTR(262, 4), /* 68 */ + /* 0001 */ PTR(278, 4), + /* 0010 */ PTR(294, 4), + /* 0011 */ PTR(310, 3), + /* 0100 */ PTR(318, 2), + /* 0101 */ PTR(322, 2), + /* 0110 */ PTR(326, 3), + /* 0111 */ PTR(334, 2), + /* 1000 */ PTR(338, 1), + /* 1001 */ PTR(340, 2), + /* 1010 */ PTR(344, 2), + /* 1011 */ PTR(348, 2), + /* 1100 */ PTR(352, 2), + /* 1101 */ PTR(356, 2), + /* 1110 */ V(1, 15, 4), + /* 1111 */ V(15, 1, 4), + + /* 0000 0001 ... */ + /* 0000 */ V(15, 0, 4), /* 84 */ + /* 0001 */ PTR(360, 1), + /* 0010 */ PTR(362, 1), + /* 0011 */ PTR(364, 1), + /* 0100 */ V(14, 2, 4), + /* 0101 */ PTR(366, 1), + /* 0110 */ V(1, 14, 4), + /* 0111 */ V(14, 1, 4), + /* 1000 */ PTR(368, 1), + /* 1001 */ PTR(370, 1), + /* 1010 */ PTR(372, 1), + /* 1011 */ PTR(374, 1), + /* 1100 */ PTR(376, 1), + /* 1101 */ PTR(378, 1), + /* 1110 */ V(12, 6, 4), + /* 1111 */ V(3, 13, 4), + + /* 0000 0010 ... */ + /* 0000 */ PTR(380, 1), /* 100 */ + /* 0001 */ V(2, 13, 4), + /* 0010 */ V(13, 2, 4), + /* 0011 */ V(1, 13, 4), + /* 0100 */ V(11, 7, 4), + /* 0101 */ PTR(382, 1), + /* 0110 */ PTR(384, 1), + /* 0111 */ V(12, 3, 4), + /* 1000 */ PTR(386, 1), + /* 1001 */ V(4, 11, 4), + /* 1010 */ V(13, 1, 3), + /* 1011 */ V(13, 1, 3), + /* 1100 */ V(0, 13, 4), + /* 1101 */ V(13, 0, 4), + /* 1110 */ V(8, 10, 4), + /* 1111 */ V(10, 8, 4), + + /* 0000 0011 ... */ + /* 0000 */ V(4, 12, 4), /* 116 */ + /* 0001 */ V(12, 4, 4), + /* 0010 */ V(6, 11, 4), + /* 0011 */ V(11, 6, 4), + /* 0100 */ V(3, 12, 3), + /* 0101 */ V(3, 12, 3), + /* 0110 */ V(2, 12, 3), + /* 0111 */ V(2, 12, 3), + /* 1000 */ V(12, 2, 3), + /* 1001 */ V(12, 2, 3), + /* 1010 */ V(5, 11, 3), + /* 1011 */ V(5, 11, 3), + /* 1100 */ V(11, 5, 4), + /* 1101 */ V(8, 9, 4), + /* 1110 */ V(1, 12, 3), + /* 1111 */ V(1, 12, 3), + + /* 0000 0100 ... */ + /* 0000 */ V(12, 1, 3), /* 132 */ + /* 0001 */ V(12, 1, 3), + /* 0010 */ V(9, 8, 4), + /* 0011 */ V(0, 12, 4), + /* 0100 */ V(12, 0, 3), + /* 0101 */ V(12, 0, 3), + /* 0110 */ V(11, 4, 4), + /* 0111 */ V(6, 10, 4), + /* 1000 */ V(10, 6, 4), + /* 1001 */ V(7, 9, 4), + /* 1010 */ V(3, 11, 3), + /* 1011 */ V(3, 11, 3), + /* 1100 */ V(11, 3, 3), + /* 1101 */ V(11, 3, 3), + /* 1110 */ V(8, 8, 4), + /* 1111 */ V(5, 10, 4), + + /* 0000 0101 ... */ + /* 0000 */ V(2, 11, 3), /* 148 */ + /* 0001 */ V(2, 11, 3), + /* 0010 */ V(10, 5, 4), + /* 0011 */ V(6, 9, 4), + /* 0100 */ V(10, 4, 3), + /* 0101 */ V(10, 4, 3), + /* 0110 */ V(7, 8, 4), + /* 0111 */ V(8, 7, 4), + /* 1000 */ V(9, 4, 3), + /* 1001 */ V(9, 4, 3), + /* 1010 */ V(7, 7, 4), + /* 1011 */ V(7, 6, 4), + /* 1100 */ V(11, 2, 2), + /* 1101 */ V(11, 2, 2), + /* 1110 */ V(11, 2, 2), + /* 1111 */ V(11, 2, 2), + + /* 0000 0110 ... */ + /* 000 */ V(1, 11, 2), /* 164 */ + /* 001 */ V(1, 11, 2), + /* 010 */ V(11, 1, 2), + /* 011 */ V(11, 1, 2), + /* 100 */ V(0, 11, 3), + /* 101 */ V(11, 0, 3), + /* 110 */ V(9, 6, 3), + /* 111 */ V(4, 10, 3), + + /* 0000 0111 ... */ + /* 000 */ V(3, 10, 3), /* 172 */ + /* 001 */ V(10, 3, 3), + /* 010 */ V(5, 9, 3), + /* 011 */ V(9, 5, 3), + /* 100 */ V(2, 10, 2), + /* 101 */ V(2, 10, 2), + /* 110 */ V(10, 2, 2), + /* 111 */ V(10, 2, 2), + + /* 0000 1000 ... */ + /* 000 */ V(1, 10, 2), /* 180 */ + /* 001 */ V(1, 10, 2), + /* 010 */ V(10, 1, 2), + /* 011 */ V(10, 1, 2), + /* 100 */ V(0, 10, 3), + /* 101 */ V(6, 8, 3), + /* 110 */ V(10, 0, 2), + /* 111 */ V(10, 0, 2), + + /* 0000 1001 ... */ + /* 000 */ V(8, 6, 3), /* 188 */ + /* 001 */ V(4, 9, 3), + /* 010 */ V(9, 3, 2), + /* 011 */ V(9, 3, 2), + /* 100 */ V(3, 9, 3), + /* 101 */ V(5, 8, 3), + /* 110 */ V(8, 5, 3), + /* 111 */ V(6, 7, 3), + + /* 0000 1010 ... */ + /* 000 */ V(2, 9, 2), /* 196 */ + /* 001 */ V(2, 9, 2), + /* 010 */ V(9, 2, 2), + /* 011 */ V(9, 2, 2), + /* 100 */ V(5, 7, 3), + /* 101 */ V(7, 5, 3), + /* 110 */ V(3, 8, 2), + /* 111 */ V(3, 8, 2), + + /* 0000 1011 ... */ + /* 000 */ V(8, 3, 2), /* 204 */ + /* 001 */ V(8, 3, 2), + /* 010 */ V(6, 6, 3), + /* 011 */ V(4, 7, 3), + /* 100 */ V(7, 4, 3), + /* 101 */ V(5, 6, 3), + /* 110 */ V(6, 5, 3), + /* 111 */ V(7, 3, 3), + + /* 0000 1100 ... */ + /* 0 */ V(1, 9, 1), /* 212 */ + /* 1 */ V(9, 1, 1), + + /* 0000 1101 ... */ + /* 00 */ V(0, 9, 2), /* 214 */ + /* 01 */ V(9, 0, 2), + /* 10 */ V(4, 8, 2), + /* 11 */ V(8, 4, 2), + + /* 0000 1110 ... */ + /* 000 */ V(7, 2, 2), /* 218 */ + /* 001 */ V(7, 2, 2), + /* 010 */ V(4, 6, 3), + /* 011 */ V(6, 4, 3), + /* 100 */ V(2, 8, 1), + /* 101 */ V(2, 8, 1), + /* 110 */ V(2, 8, 1), + /* 111 */ V(2, 8, 1), + + /* 0000 1111 ... */ + /* 0 */ V(8, 2, 1), /* 226 */ + /* 1 */ V(1, 8, 1), + + /* 0001 0000 ... */ + /* 00 */ V(3, 7, 2), /* 228 */ + /* 01 */ V(2, 7, 2), + /* 10 */ V(1, 7, 1), + /* 11 */ V(1, 7, 1), + + /* 0001 0001 ... */ + /* 00 */ V(7, 1, 1), /* 232 */ + /* 01 */ V(7, 1, 1), + /* 10 */ V(5, 5, 2), + /* 11 */ V(0, 7, 2), + + /* 0001 0010 ... */ + /* 00 */ V(7, 0, 2), /* 236 */ + /* 01 */ V(3, 6, 2), + /* 10 */ V(6, 3, 2), + /* 11 */ V(4, 5, 2), + + /* 0001 0011 ... */ + /* 00 */ V(5, 4, 2), /* 240 */ + /* 01 */ V(2, 6, 2), + /* 10 */ V(6, 2, 2), + /* 11 */ V(3, 5, 2), + + /* 0001 0101 ... */ + /* 0 */ V(0, 8, 1), /* 244 */ + /* 1 */ V(8, 0, 1), + + /* 0001 0110 ... */ + /* 0 */ V(1, 6, 1), /* 246 */ + /* 1 */ V(6, 1, 1), + + /* 0001 0111 ... */ + /* 0 */ V(0, 6, 1), /* 248 */ + /* 1 */ V(6, 0, 1), + + /* 0001 1000 ... */ + /* 00 */ V(5, 3, 2), /* 250 */ + /* 01 */ V(4, 4, 2), + /* 10 */ V(2, 5, 1), + /* 11 */ V(2, 5, 1), + + /* 0001 1001 ... */ + /* 0 */ V(5, 2, 1), /* 254 */ + /* 1 */ V(0, 5, 1), + + /* 0001 1100 ... */ + /* 0 */ V(3, 4, 1), /* 256 */ + /* 1 */ V(4, 3, 1), + + /* 0001 1101 ... */ + /* 0 */ V(5, 0, 1), /* 258 */ + /* 1 */ V(2, 4, 1), + + /* 0001 1110 ... */ + /* 0 */ V(4, 2, 1), /* 260 */ + /* 1 */ V(3, 3, 1), + + /* 0000 0000 0000 ... */ + /* 0000 */ PTR(388, 3), /* 262 */ + /* 0001 */ V(15, 15, 4), + /* 0010 */ V(14, 15, 4), + /* 0011 */ V(13, 15, 4), + /* 0100 */ V(14, 14, 4), + /* 0101 */ V(12, 15, 4), + /* 0110 */ V(13, 14, 4), + /* 0111 */ V(11, 15, 4), + /* 1000 */ V(15, 11, 4), + /* 1001 */ V(12, 14, 4), + /* 1010 */ V(13, 12, 4), + /* 1011 */ PTR(396, 1), + /* 1100 */ V(14, 12, 3), + /* 1101 */ V(14, 12, 3), + /* 1110 */ V(13, 13, 3), + /* 1111 */ V(13, 13, 3), + + /* 0000 0000 0001 ... */ + /* 0000 */ V(15, 10, 4), /* 278 */ + /* 0001 */ V(12, 13, 4), + /* 0010 */ V(11, 14, 3), + /* 0011 */ V(11, 14, 3), + /* 0100 */ V(14, 11, 3), + /* 0101 */ V(14, 11, 3), + /* 0110 */ V(9, 15, 3), + /* 0111 */ V(9, 15, 3), + /* 1000 */ V(15, 9, 3), + /* 1001 */ V(15, 9, 3), + /* 1010 */ V(14, 10, 3), + /* 1011 */ V(14, 10, 3), + /* 1100 */ V(11, 13, 3), + /* 1101 */ V(11, 13, 3), + /* 1110 */ V(13, 11, 3), + /* 1111 */ V(13, 11, 3), + + /* 0000 0000 0010 ... */ + /* 0000 */ V(8, 15, 3), /* 294 */ + /* 0001 */ V(8, 15, 3), + /* 0010 */ V(15, 8, 3), + /* 0011 */ V(15, 8, 3), + /* 0100 */ V(12, 12, 3), + /* 0101 */ V(12, 12, 3), + /* 0110 */ V(10, 14, 4), + /* 0111 */ V(9, 14, 4), + /* 1000 */ V(8, 14, 3), + /* 1001 */ V(8, 14, 3), + /* 1010 */ V(7, 15, 4), + /* 1011 */ V(7, 14, 4), + /* 1100 */ V(15, 7, 2), + /* 1101 */ V(15, 7, 2), + /* 1110 */ V(15, 7, 2), + /* 1111 */ V(15, 7, 2), + + /* 0000 0000 0011 ... */ + /* 000 */ V(13, 10, 2), /* 310 */ + /* 001 */ V(13, 10, 2), + /* 010 */ V(10, 13, 3), + /* 011 */ V(11, 12, 3), + /* 100 */ V(12, 11, 3), + /* 101 */ V(15, 6, 3), + /* 110 */ V(6, 15, 2), + /* 111 */ V(6, 15, 2), + + /* 0000 0000 0100 ... */ + /* 00 */ V(14, 8, 2), /* 318 */ + /* 01 */ V(5, 15, 2), + /* 10 */ V(9, 13, 2), + /* 11 */ V(13, 9, 2), + + /* 0000 0000 0101 ... */ + /* 00 */ V(15, 5, 2), /* 322 */ + /* 01 */ V(14, 7, 2), + /* 10 */ V(10, 12, 2), + /* 11 */ V(11, 11, 2), + + /* 0000 0000 0110 ... */ + /* 000 */ V(4, 15, 2), /* 326 */ + /* 001 */ V(4, 15, 2), + /* 010 */ V(15, 4, 2), + /* 011 */ V(15, 4, 2), + /* 100 */ V(12, 10, 3), + /* 101 */ V(14, 6, 3), + /* 110 */ V(15, 3, 2), + /* 111 */ V(15, 3, 2), + + /* 0000 0000 0111 ... */ + /* 00 */ V(3, 15, 1), /* 334 */ + /* 01 */ V(3, 15, 1), + /* 10 */ V(8, 13, 2), + /* 11 */ V(13, 8, 2), + + /* 0000 0000 1000 ... */ + /* 0 */ V(2, 15, 1), /* 338 */ + /* 1 */ V(15, 2, 1), + + /* 0000 0000 1001 ... */ + /* 00 */ V(6, 14, 2), /* 340 */ + /* 01 */ V(9, 12, 2), + /* 10 */ V(0, 15, 1), + /* 11 */ V(0, 15, 1), + + /* 0000 0000 1010 ... */ + /* 00 */ V(12, 9, 2), /* 344 */ + /* 01 */ V(5, 14, 2), + /* 10 */ V(10, 11, 1), + /* 11 */ V(10, 11, 1), + + /* 0000 0000 1011 ... */ + /* 00 */ V(7, 13, 2), /* 348 */ + /* 01 */ V(13, 7, 2), + /* 10 */ V(4, 14, 1), + /* 11 */ V(4, 14, 1), + + /* 0000 0000 1100 ... */ + /* 00 */ V(12, 8, 2), /* 352 */ + /* 01 */ V(13, 6, 2), + /* 10 */ V(3, 14, 1), + /* 11 */ V(3, 14, 1), + + /* 0000 0000 1101 ... */ + /* 00 */ V(11, 9, 1), /* 356 */ + /* 01 */ V(11, 9, 1), + /* 10 */ V(9, 11, 2), + /* 11 */ V(10, 10, 2), + + /* 0000 0001 0001 ... */ + /* 0 */ V(11, 10, 1), /* 360 */ + /* 1 */ V(14, 5, 1), + + /* 0000 0001 0010 ... */ + /* 0 */ V(14, 4, 1), /* 362 */ + /* 1 */ V(8, 12, 1), + + /* 0000 0001 0011 ... */ + /* 0 */ V(6, 13, 1), /* 364 */ + /* 1 */ V(14, 3, 1), + + /* 0000 0001 0101 ... */ + /* 0 */ V(2, 14, 1), /* 366 */ + /* 1 */ V(0, 14, 1), + + /* 0000 0001 1000 ... */ + /* 0 */ V(14, 0, 1), /* 368 */ + /* 1 */ V(5, 13, 1), + + /* 0000 0001 1001 ... */ + /* 0 */ V(13, 5, 1), /* 370 */ + /* 1 */ V(7, 12, 1), + + /* 0000 0001 1010 ... */ + /* 0 */ V(12, 7, 1), /* 372 */ + /* 1 */ V(4, 13, 1), + + /* 0000 0001 1011 ... */ + /* 0 */ V(8, 11, 1), /* 374 */ + /* 1 */ V(11, 8, 1), + + /* 0000 0001 1100 ... */ + /* 0 */ V(13, 4, 1), /* 376 */ + /* 1 */ V(9, 10, 1), + + /* 0000 0001 1101 ... */ + /* 0 */ V(10, 9, 1), /* 378 */ + /* 1 */ V(6, 12, 1), + + /* 0000 0010 0000 ... */ + /* 0 */ V(13, 3, 1), /* 380 */ + /* 1 */ V(7, 11, 1), + + /* 0000 0010 0101 ... */ + /* 0 */ V(5, 12, 1), /* 382 */ + /* 1 */ V(12, 5, 1), + + /* 0000 0010 0110 ... */ + /* 0 */ V(9, 9, 1), /* 384 */ + /* 1 */ V(7, 10, 1), + + /* 0000 0010 1000 ... */ + /* 0 */ V(10, 7, 1), /* 386 */ + /* 1 */ V(9, 7, 1), + + /* 0000 0000 0000 0000 ... */ + /* 000 */ V(15, 14, 3), /* 388 */ + /* 001 */ V(15, 12, 3), + /* 010 */ V(15, 13, 2), + /* 011 */ V(15, 13, 2), + /* 100 */ V(14, 13, 1), + /* 101 */ V(14, 13, 1), + /* 110 */ V(14, 13, 1), + /* 111 */ V(14, 13, 1), + + /* 0000 0000 0000 1011 ... */ + /* 0 */ V(10, 15, 1), /* 396 */ + /* 1 */ V(14, 9, 1) +}; + +static +union huffpair const hufftab15[] = { + /* 0000 */ PTR(16, 4), + /* 0001 */ PTR(32, 4), + /* 0010 */ PTR(48, 4), + /* 0011 */ PTR(64, 4), + /* 0100 */ PTR(80, 4), + /* 0101 */ PTR(96, 3), + /* 0110 */ PTR(104, 3), + /* 0111 */ PTR(112, 2), + /* 1000 */ PTR(116, 1), + /* 1001 */ PTR(118, 1), + /* 1010 */ V(1, 1, 3), + /* 1011 */ V(1, 1, 3), + /* 1100 */ V(0, 1, 4), + /* 1101 */ V(1, 0, 4), + /* 1110 */ V(0, 0, 3), + /* 1111 */ V(0, 0, 3), + + /* 0000 ... */ + /* 0000 */ PTR(120, 4), /* 16 */ + /* 0001 */ PTR(136, 4), + /* 0010 */ PTR(152, 4), + /* 0011 */ PTR(168, 4), + /* 0100 */ PTR(184, 4), + /* 0101 */ PTR(200, 3), + /* 0110 */ PTR(208, 3), + /* 0111 */ PTR(216, 4), + /* 1000 */ PTR(232, 3), + /* 1001 */ PTR(240, 3), + /* 1010 */ PTR(248, 3), + /* 1011 */ PTR(256, 3), + /* 1100 */ PTR(264, 2), + /* 1101 */ PTR(268, 3), + /* 1110 */ PTR(276, 3), + /* 1111 */ PTR(284, 2), + + /* 0001 ... */ + /* 0000 */ PTR(288, 2), /* 32 */ + /* 0001 */ PTR(292, 2), + /* 0010 */ PTR(296, 2), + /* 0011 */ PTR(300, 2), + /* 0100 */ PTR(304, 2), + /* 0101 */ PTR(308, 2), + /* 0110 */ PTR(312, 2), + /* 0111 */ PTR(316, 2), + /* 1000 */ PTR(320, 1), + /* 1001 */ PTR(322, 1), + /* 1010 */ PTR(324, 1), + /* 1011 */ PTR(326, 2), + /* 1100 */ PTR(330, 1), + /* 1101 */ PTR(332, 1), + /* 1110 */ PTR(334, 2), + /* 1111 */ PTR(338, 1), + + /* 0010 ... */ + /* 0000 */ PTR(340, 1), /* 48 */ + /* 0001 */ PTR(342, 1), + /* 0010 */ V(9, 1, 4), + /* 0011 */ PTR(344, 1), + /* 0100 */ PTR(346, 1), + /* 0101 */ PTR(348, 1), + /* 0110 */ PTR(350, 1), + /* 0111 */ PTR(352, 1), + /* 1000 */ V(2, 8, 4), + /* 1001 */ V(8, 2, 4), + /* 1010 */ V(1, 8, 4), + /* 1011 */ V(8, 1, 4), + /* 1100 */ PTR(354, 1), + /* 1101 */ PTR(356, 1), + /* 1110 */ PTR(358, 1), + /* 1111 */ PTR(360, 1), + + /* 0011 ... */ + /* 0000 */ V(2, 7, 4), /* 64 */ + /* 0001 */ V(7, 2, 4), + /* 0010 */ V(6, 4, 4), + /* 0011 */ V(1, 7, 4), + /* 0100 */ V(5, 5, 4), + /* 0101 */ V(7, 1, 4), + /* 0110 */ PTR(362, 1), + /* 0111 */ V(3, 6, 4), + /* 1000 */ V(6, 3, 4), + /* 1001 */ V(4, 5, 4), + /* 1010 */ V(5, 4, 4), + /* 1011 */ V(2, 6, 4), + /* 1100 */ V(6, 2, 4), + /* 1101 */ V(1, 6, 4), + /* 1110 */ PTR(364, 1), + /* 1111 */ V(3, 5, 4), + + /* 0100 ... */ + /* 0000 */ V(6, 1, 3), /* 80 */ + /* 0001 */ V(6, 1, 3), + /* 0010 */ V(5, 3, 4), + /* 0011 */ V(4, 4, 4), + /* 0100 */ V(2, 5, 3), + /* 0101 */ V(2, 5, 3), + /* 0110 */ V(5, 2, 3), + /* 0111 */ V(5, 2, 3), + /* 1000 */ V(1, 5, 3), + /* 1001 */ V(1, 5, 3), + /* 1010 */ V(5, 1, 3), + /* 1011 */ V(5, 1, 3), + /* 1100 */ V(0, 5, 4), + /* 1101 */ V(5, 0, 4), + /* 1110 */ V(3, 4, 3), + /* 1111 */ V(3, 4, 3), + + /* 0101 ... */ + /* 000 */ V(4, 3, 3), /* 96 */ + /* 001 */ V(2, 4, 3), + /* 010 */ V(4, 2, 3), + /* 011 */ V(3, 3, 3), + /* 100 */ V(4, 1, 2), + /* 101 */ V(4, 1, 2), + /* 110 */ V(1, 4, 3), + /* 111 */ V(0, 4, 3), + + /* 0110 ... */ + /* 000 */ V(2, 3, 2), /* 104 */ + /* 001 */ V(2, 3, 2), + /* 010 */ V(3, 2, 2), + /* 011 */ V(3, 2, 2), + /* 100 */ V(4, 0, 3), + /* 101 */ V(0, 3, 3), + /* 110 */ V(1, 3, 2), + /* 111 */ V(1, 3, 2), + + /* 0111 ... */ + /* 00 */ V(3, 1, 2), /* 112 */ + /* 01 */ V(3, 0, 2), + /* 10 */ V(2, 2, 1), + /* 11 */ V(2, 2, 1), + + /* 1000 ... */ + /* 0 */ V(1, 2, 1), /* 116 */ + /* 1 */ V(2, 1, 1), + + /* 1001 ... */ + /* 0 */ V(0, 2, 1), /* 118 */ + /* 1 */ V(2, 0, 1), + + /* 0000 0000 ... */ + /* 0000 */ PTR(366, 1), /* 120 */ + /* 0001 */ PTR(368, 1), + /* 0010 */ V(14, 14, 4), + /* 0011 */ PTR(370, 1), + /* 0100 */ PTR(372, 1), + /* 0101 */ PTR(374, 1), + /* 0110 */ V(15, 11, 4), + /* 0111 */ PTR(376, 1), + /* 1000 */ V(13, 13, 4), + /* 1001 */ V(10, 15, 4), + /* 1010 */ V(15, 10, 4), + /* 1011 */ V(11, 14, 4), + /* 1100 */ V(14, 11, 4), + /* 1101 */ V(12, 13, 4), + /* 1110 */ V(13, 12, 4), + /* 1111 */ V(9, 15, 4), + + /* 0000 0001 ... */ + /* 0000 */ V(15, 9, 4), /* 136 */ + /* 0001 */ V(14, 10, 4), + /* 0010 */ V(11, 13, 4), + /* 0011 */ V(13, 11, 4), + /* 0100 */ V(8, 15, 4), + /* 0101 */ V(15, 8, 4), + /* 0110 */ V(12, 12, 4), + /* 0111 */ V(9, 14, 4), + /* 1000 */ V(14, 9, 4), + /* 1001 */ V(7, 15, 4), + /* 1010 */ V(15, 7, 4), + /* 1011 */ V(10, 13, 4), + /* 1100 */ V(13, 10, 4), + /* 1101 */ V(11, 12, 4), + /* 1110 */ V(6, 15, 4), + /* 1111 */ PTR(378, 1), + + /* 0000 0010 ... */ + /* 0000 */ V(12, 11, 3), /* 152 */ + /* 0001 */ V(12, 11, 3), + /* 0010 */ V(15, 6, 3), + /* 0011 */ V(15, 6, 3), + /* 0100 */ V(8, 14, 4), + /* 0101 */ V(14, 8, 4), + /* 0110 */ V(5, 15, 4), + /* 0111 */ V(9, 13, 4), + /* 1000 */ V(15, 5, 3), + /* 1001 */ V(15, 5, 3), + /* 1010 */ V(7, 14, 3), + /* 1011 */ V(7, 14, 3), + /* 1100 */ V(14, 7, 3), + /* 1101 */ V(14, 7, 3), + /* 1110 */ V(10, 12, 3), + /* 1111 */ V(10, 12, 3), + + /* 0000 0011 ... */ + /* 0000 */ V(12, 10, 3), /* 168 */ + /* 0001 */ V(12, 10, 3), + /* 0010 */ V(11, 11, 3), + /* 0011 */ V(11, 11, 3), + /* 0100 */ V(13, 9, 4), + /* 0101 */ V(8, 13, 4), + /* 0110 */ V(4, 15, 3), + /* 0111 */ V(4, 15, 3), + /* 1000 */ V(15, 4, 3), + /* 1001 */ V(15, 4, 3), + /* 1010 */ V(3, 15, 3), + /* 1011 */ V(3, 15, 3), + /* 1100 */ V(15, 3, 3), + /* 1101 */ V(15, 3, 3), + /* 1110 */ V(13, 8, 3), + /* 1111 */ V(13, 8, 3), + + /* 0000 0100 ... */ + /* 0000 */ V(14, 6, 3), /* 184 */ + /* 0001 */ V(14, 6, 3), + /* 0010 */ V(2, 15, 3), + /* 0011 */ V(2, 15, 3), + /* 0100 */ V(15, 2, 3), + /* 0101 */ V(15, 2, 3), + /* 0110 */ V(6, 14, 4), + /* 0111 */ V(15, 0, 4), + /* 1000 */ V(1, 15, 3), + /* 1001 */ V(1, 15, 3), + /* 1010 */ V(15, 1, 3), + /* 1011 */ V(15, 1, 3), + /* 1100 */ V(9, 12, 3), + /* 1101 */ V(9, 12, 3), + /* 1110 */ V(12, 9, 3), + /* 1111 */ V(12, 9, 3), + + /* 0000 0101 ... */ + /* 000 */ V(5, 14, 3), /* 200 */ + /* 001 */ V(10, 11, 3), + /* 010 */ V(11, 10, 3), + /* 011 */ V(14, 5, 3), + /* 100 */ V(7, 13, 3), + /* 101 */ V(13, 7, 3), + /* 110 */ V(4, 14, 3), + /* 111 */ V(14, 4, 3), + + /* 0000 0110 ... */ + /* 000 */ V(8, 12, 3), /* 208 */ + /* 001 */ V(12, 8, 3), + /* 010 */ V(3, 14, 3), + /* 011 */ V(6, 13, 3), + /* 100 */ V(13, 6, 3), + /* 101 */ V(14, 3, 3), + /* 110 */ V(9, 11, 3), + /* 111 */ V(11, 9, 3), + + /* 0000 0111 ... */ + /* 0000 */ V(2, 14, 3), /* 216 */ + /* 0001 */ V(2, 14, 3), + /* 0010 */ V(10, 10, 3), + /* 0011 */ V(10, 10, 3), + /* 0100 */ V(14, 2, 3), + /* 0101 */ V(14, 2, 3), + /* 0110 */ V(1, 14, 3), + /* 0111 */ V(1, 14, 3), + /* 1000 */ V(14, 1, 3), + /* 1001 */ V(14, 1, 3), + /* 1010 */ V(0, 14, 4), + /* 1011 */ V(14, 0, 4), + /* 1100 */ V(5, 13, 3), + /* 1101 */ V(5, 13, 3), + /* 1110 */ V(13, 5, 3), + /* 1111 */ V(13, 5, 3), + + /* 0000 1000 ... */ + /* 000 */ V(7, 12, 3), /* 232 */ + /* 001 */ V(12, 7, 3), + /* 010 */ V(4, 13, 3), + /* 011 */ V(8, 11, 3), + /* 100 */ V(13, 4, 2), + /* 101 */ V(13, 4, 2), + /* 110 */ V(11, 8, 3), + /* 111 */ V(9, 10, 3), + + /* 0000 1001 ... */ + /* 000 */ V(10, 9, 3), /* 240 */ + /* 001 */ V(6, 12, 3), + /* 010 */ V(12, 6, 3), + /* 011 */ V(3, 13, 3), + /* 100 */ V(13, 3, 2), + /* 101 */ V(13, 3, 2), + /* 110 */ V(13, 2, 2), + /* 111 */ V(13, 2, 2), + + /* 0000 1010 ... */ + /* 000 */ V(2, 13, 3), /* 248 */ + /* 001 */ V(0, 13, 3), + /* 010 */ V(1, 13, 2), + /* 011 */ V(1, 13, 2), + /* 100 */ V(7, 11, 2), + /* 101 */ V(7, 11, 2), + /* 110 */ V(11, 7, 2), + /* 111 */ V(11, 7, 2), + + /* 0000 1011 ... */ + /* 000 */ V(13, 1, 2), /* 256 */ + /* 001 */ V(13, 1, 2), + /* 010 */ V(5, 12, 3), + /* 011 */ V(13, 0, 3), + /* 100 */ V(12, 5, 2), + /* 101 */ V(12, 5, 2), + /* 110 */ V(8, 10, 2), + /* 111 */ V(8, 10, 2), + + /* 0000 1100 ... */ + /* 00 */ V(10, 8, 2), /* 264 */ + /* 01 */ V(4, 12, 2), + /* 10 */ V(12, 4, 2), + /* 11 */ V(6, 11, 2), + + /* 0000 1101 ... */ + /* 000 */ V(11, 6, 2), /* 268 */ + /* 001 */ V(11, 6, 2), + /* 010 */ V(9, 9, 3), + /* 011 */ V(0, 12, 3), + /* 100 */ V(3, 12, 2), + /* 101 */ V(3, 12, 2), + /* 110 */ V(12, 3, 2), + /* 111 */ V(12, 3, 2), + + /* 0000 1110 ... */ + /* 000 */ V(7, 10, 2), /* 276 */ + /* 001 */ V(7, 10, 2), + /* 010 */ V(10, 7, 2), + /* 011 */ V(10, 7, 2), + /* 100 */ V(10, 6, 2), + /* 101 */ V(10, 6, 2), + /* 110 */ V(12, 0, 3), + /* 111 */ V(0, 11, 3), + + /* 0000 1111 ... */ + /* 00 */ V(12, 2, 1), /* 284 */ + /* 01 */ V(12, 2, 1), + /* 10 */ V(2, 12, 2), + /* 11 */ V(5, 11, 2), + + /* 0001 0000 ... */ + /* 00 */ V(11, 5, 2), /* 288 */ + /* 01 */ V(1, 12, 2), + /* 10 */ V(8, 9, 2), + /* 11 */ V(9, 8, 2), + + /* 0001 0001 ... */ + /* 00 */ V(12, 1, 2), /* 292 */ + /* 01 */ V(4, 11, 2), + /* 10 */ V(11, 4, 2), + /* 11 */ V(6, 10, 2), + + /* 0001 0010 ... */ + /* 00 */ V(3, 11, 2), /* 296 */ + /* 01 */ V(7, 9, 2), + /* 10 */ V(11, 3, 1), + /* 11 */ V(11, 3, 1), + + /* 0001 0011 ... */ + /* 00 */ V(9, 7, 2), /* 300 */ + /* 01 */ V(8, 8, 2), + /* 10 */ V(2, 11, 2), + /* 11 */ V(5, 10, 2), + + /* 0001 0100 ... */ + /* 00 */ V(11, 2, 1), /* 304 */ + /* 01 */ V(11, 2, 1), + /* 10 */ V(10, 5, 2), + /* 11 */ V(1, 11, 2), + + /* 0001 0101 ... */ + /* 00 */ V(11, 1, 1), /* 308 */ + /* 01 */ V(11, 1, 1), + /* 10 */ V(11, 0, 2), + /* 11 */ V(6, 9, 2), + + /* 0001 0110 ... */ + /* 00 */ V(9, 6, 2), /* 312 */ + /* 01 */ V(4, 10, 2), + /* 10 */ V(10, 4, 2), + /* 11 */ V(7, 8, 2), + + /* 0001 0111 ... */ + /* 00 */ V(8, 7, 2), /* 316 */ + /* 01 */ V(3, 10, 2), + /* 10 */ V(10, 3, 1), + /* 11 */ V(10, 3, 1), + + /* 0001 1000 ... */ + /* 0 */ V(5, 9, 1), /* 320 */ + /* 1 */ V(9, 5, 1), + + /* 0001 1001 ... */ + /* 0 */ V(2, 10, 1), /* 322 */ + /* 1 */ V(10, 2, 1), + + /* 0001 1010 ... */ + /* 0 */ V(1, 10, 1), /* 324 */ + /* 1 */ V(10, 1, 1), + + /* 0001 1011 ... */ + /* 00 */ V(0, 10, 2), /* 326 */ + /* 01 */ V(10, 0, 2), + /* 10 */ V(6, 8, 1), + /* 11 */ V(6, 8, 1), + + /* 0001 1100 ... */ + /* 0 */ V(8, 6, 1), /* 330 */ + /* 1 */ V(4, 9, 1), + + /* 0001 1101 ... */ + /* 0 */ V(9, 4, 1), /* 332 */ + /* 1 */ V(3, 9, 1), + + /* 0001 1110 ... */ + /* 00 */ V(9, 3, 1), /* 334 */ + /* 01 */ V(9, 3, 1), + /* 10 */ V(7, 7, 2), + /* 11 */ V(0, 9, 2), + + /* 0001 1111 ... */ + /* 0 */ V(5, 8, 1), /* 338 */ + /* 1 */ V(8, 5, 1), + + /* 0010 0000 ... */ + /* 0 */ V(2, 9, 1), /* 340 */ + /* 1 */ V(6, 7, 1), + + /* 0010 0001 ... */ + /* 0 */ V(7, 6, 1), /* 342 */ + /* 1 */ V(9, 2, 1), + + /* 0010 0011 ... */ + /* 0 */ V(1, 9, 1), /* 344 */ + /* 1 */ V(9, 0, 1), + + /* 0010 0100 ... */ + /* 0 */ V(4, 8, 1), /* 346 */ + /* 1 */ V(8, 4, 1), + + /* 0010 0101 ... */ + /* 0 */ V(5, 7, 1), /* 348 */ + /* 1 */ V(7, 5, 1), + + /* 0010 0110 ... */ + /* 0 */ V(3, 8, 1), /* 350 */ + /* 1 */ V(8, 3, 1), + + /* 0010 0111 ... */ + /* 0 */ V(6, 6, 1), /* 352 */ + /* 1 */ V(4, 7, 1), + + /* 0010 1100 ... */ + /* 0 */ V(7, 4, 1), /* 354 */ + /* 1 */ V(0, 8, 1), + + /* 0010 1101 ... */ + /* 0 */ V(8, 0, 1), /* 356 */ + /* 1 */ V(5, 6, 1), + + /* 0010 1110 ... */ + /* 0 */ V(6, 5, 1), /* 358 */ + /* 1 */ V(3, 7, 1), + + /* 0010 1111 ... */ + /* 0 */ V(7, 3, 1), /* 360 */ + /* 1 */ V(4, 6, 1), + + /* 0011 0110 ... */ + /* 0 */ V(0, 7, 1), /* 362 */ + /* 1 */ V(7, 0, 1), + + /* 0011 1110 ... */ + /* 0 */ V(0, 6, 1), /* 364 */ + /* 1 */ V(6, 0, 1), + + /* 0000 0000 0000 ... */ + /* 0 */ V(15, 15, 1), /* 366 */ + /* 1 */ V(14, 15, 1), + + /* 0000 0000 0001 ... */ + /* 0 */ V(15, 14, 1), /* 368 */ + /* 1 */ V(13, 15, 1), + + /* 0000 0000 0011 ... */ + /* 0 */ V(15, 13, 1), /* 370 */ + /* 1 */ V(12, 15, 1), + + /* 0000 0000 0100 ... */ + /* 0 */ V(15, 12, 1), /* 372 */ + /* 1 */ V(13, 14, 1), + + /* 0000 0000 0101 ... */ + /* 0 */ V(14, 13, 1), /* 374 */ + /* 1 */ V(11, 15, 1), + + /* 0000 0000 0111 ... */ + /* 0 */ V(12, 14, 1), /* 376 */ + /* 1 */ V(14, 12, 1), + + /* 0000 0001 1111 ... */ + /* 0 */ V(10, 14, 1), /* 378 */ + /* 1 */ V(0, 15, 1) +}; + +static +union huffpair const hufftab16[] = { + /* 0000 */ PTR(16, 4), + /* 0001 */ PTR(32, 4), + /* 0010 */ PTR(48, 4), + /* 0011 */ PTR(64, 2), + /* 0100 */ V(1, 1, 4), + /* 0101 */ V(0, 1, 4), + /* 0110 */ V(1, 0, 3), + /* 0111 */ V(1, 0, 3), + /* 1000 */ V(0, 0, 1), + /* 1001 */ V(0, 0, 1), + /* 1010 */ V(0, 0, 1), + /* 1011 */ V(0, 0, 1), + /* 1100 */ V(0, 0, 1), + /* 1101 */ V(0, 0, 1), + /* 1110 */ V(0, 0, 1), + /* 1111 */ V(0, 0, 1), + + /* 0000 ... */ + /* 0000 */ PTR(68, 3), /* 16 */ + /* 0001 */ PTR(76, 3), + /* 0010 */ PTR(84, 2), + /* 0011 */ V(15, 15, 4), + /* 0100 */ PTR(88, 2), + /* 0101 */ PTR(92, 1), + /* 0110 */ PTR(94, 4), + /* 0111 */ V(15, 2, 4), + /* 1000 */ PTR(110, 1), + /* 1001 */ V(1, 15, 4), + /* 1010 */ V(15, 1, 4), + /* 1011 */ PTR(112, 4), + /* 1100 */ PTR(128, 4), + /* 1101 */ PTR(144, 4), + /* 1110 */ PTR(160, 4), + /* 1111 */ PTR(176, 4), + + /* 0001 ... */ + /* 0000 */ PTR(192, 4), /* 32 */ + /* 0001 */ PTR(208, 3), + /* 0010 */ PTR(216, 3), + /* 0011 */ PTR(224, 3), + /* 0100 */ PTR(232, 3), + /* 0101 */ PTR(240, 3), + /* 0110 */ PTR(248, 3), + /* 0111 */ PTR(256, 3), + /* 1000 */ PTR(264, 2), + /* 1001 */ PTR(268, 2), + /* 1010 */ PTR(272, 1), + /* 1011 */ PTR(274, 2), + /* 1100 */ PTR(278, 2), + /* 1101 */ PTR(282, 1), + /* 1110 */ V(5, 1, 4), + /* 1111 */ PTR(284, 1), + + /* 0010 ... */ + /* 0000 */ PTR(286, 1), /* 48 */ + /* 0001 */ PTR(288, 1), + /* 0010 */ PTR(290, 1), + /* 0011 */ V(1, 4, 4), + /* 0100 */ V(4, 1, 4), + /* 0101 */ PTR(292, 1), + /* 0110 */ V(2, 3, 4), + /* 0111 */ V(3, 2, 4), + /* 1000 */ V(1, 3, 3), + /* 1001 */ V(1, 3, 3), + /* 1010 */ V(3, 1, 3), + /* 1011 */ V(3, 1, 3), + /* 1100 */ V(0, 3, 4), + /* 1101 */ V(3, 0, 4), + /* 1110 */ V(2, 2, 3), + /* 1111 */ V(2, 2, 3), + + /* 0011 ... */ + /* 00 */ V(1, 2, 2), /* 64 */ + /* 01 */ V(2, 1, 2), + /* 10 */ V(0, 2, 2), + /* 11 */ V(2, 0, 2), + + /* 0000 0000 ... */ + /* 000 */ V(14, 15, 3), /* 68 */ + /* 001 */ V(15, 14, 3), + /* 010 */ V(13, 15, 3), + /* 011 */ V(15, 13, 3), + /* 100 */ V(12, 15, 3), + /* 101 */ V(15, 12, 3), + /* 110 */ V(11, 15, 3), + /* 111 */ V(15, 11, 3), + + /* 0000 0001 ... */ + /* 000 */ V(10, 15, 2), /* 76 */ + /* 001 */ V(10, 15, 2), + /* 010 */ V(15, 10, 3), + /* 011 */ V(9, 15, 3), + /* 100 */ V(15, 9, 3), + /* 101 */ V(15, 8, 3), + /* 110 */ V(8, 15, 2), + /* 111 */ V(8, 15, 2), + + /* 0000 0010 ... */ + /* 00 */ V(7, 15, 2), /* 84 */ + /* 01 */ V(15, 7, 2), + /* 10 */ V(6, 15, 2), + /* 11 */ V(15, 6, 2), + + /* 0000 0100 ... */ + /* 00 */ V(5, 15, 2), /* 88 */ + /* 01 */ V(15, 5, 2), + /* 10 */ V(4, 15, 1), + /* 11 */ V(4, 15, 1), + + /* 0000 0101 ... */ + /* 0 */ V(15, 4, 1), /* 92 */ + /* 1 */ V(15, 3, 1), + + /* 0000 0110 ... */ + /* 0000 */ V(15, 0, 1), /* 94 */ + /* 0001 */ V(15, 0, 1), + /* 0010 */ V(15, 0, 1), + /* 0011 */ V(15, 0, 1), + /* 0100 */ V(15, 0, 1), + /* 0101 */ V(15, 0, 1), + /* 0110 */ V(15, 0, 1), + /* 0111 */ V(15, 0, 1), + /* 1000 */ V(3, 15, 2), + /* 1001 */ V(3, 15, 2), + /* 1010 */ V(3, 15, 2), + /* 1011 */ V(3, 15, 2), + /* 1100 */ PTR(294, 4), + /* 1101 */ PTR(310, 3), + /* 1110 */ PTR(318, 3), + /* 1111 */ PTR(326, 3), + + /* 0000 1000 ... */ + /* 0 */ V(2, 15, 1), /* 110 */ + /* 1 */ V(0, 15, 1), + + /* 0000 1011 ... */ + /* 0000 */ PTR(334, 2), /* 112 */ + /* 0001 */ PTR(338, 2), + /* 0010 */ PTR(342, 2), + /* 0011 */ PTR(346, 1), + /* 0100 */ PTR(348, 2), + /* 0101 */ PTR(352, 2), + /* 0110 */ PTR(356, 1), + /* 0111 */ PTR(358, 2), + /* 1000 */ PTR(362, 2), + /* 1001 */ PTR(366, 2), + /* 1010 */ PTR(370, 2), + /* 1011 */ V(14, 3, 4), + /* 1100 */ PTR(374, 1), + /* 1101 */ PTR(376, 1), + /* 1110 */ PTR(378, 1), + /* 1111 */ PTR(380, 1), + + /* 0000 1100 ... */ + /* 0000 */ PTR(382, 1), /* 128 */ + /* 0001 */ PTR(384, 1), + /* 0010 */ PTR(386, 1), + /* 0011 */ V(0, 13, 4), + /* 0100 */ PTR(388, 1), + /* 0101 */ PTR(390, 1), + /* 0110 */ PTR(392, 1), + /* 0111 */ V(3, 12, 4), + /* 1000 */ PTR(394, 1), + /* 1001 */ V(1, 12, 4), + /* 1010 */ V(12, 0, 4), + /* 1011 */ PTR(396, 1), + /* 1100 */ V(14, 2, 3), + /* 1101 */ V(14, 2, 3), + /* 1110 */ V(2, 14, 4), + /* 1111 */ V(1, 14, 4), + + /* 0000 1101 ... */ + /* 0000 */ V(13, 3, 4), /* 144 */ + /* 0001 */ V(2, 13, 4), + /* 0010 */ V(13, 2, 4), + /* 0011 */ V(13, 1, 4), + /* 0100 */ V(3, 11, 4), + /* 0101 */ PTR(398, 1), + /* 0110 */ V(1, 13, 3), + /* 0111 */ V(1, 13, 3), + /* 1000 */ V(12, 4, 4), + /* 1001 */ V(6, 11, 4), + /* 1010 */ V(12, 3, 4), + /* 1011 */ V(10, 7, 4), + /* 1100 */ V(2, 12, 3), + /* 1101 */ V(2, 12, 3), + /* 1110 */ V(12, 2, 4), + /* 1111 */ V(11, 5, 4), + + /* 0000 1110 ... */ + /* 0000 */ V(12, 1, 4), /* 160 */ + /* 0001 */ V(0, 12, 4), + /* 0010 */ V(4, 11, 4), + /* 0011 */ V(11, 4, 4), + /* 0100 */ V(6, 10, 4), + /* 0101 */ V(10, 6, 4), + /* 0110 */ V(11, 3, 3), + /* 0111 */ V(11, 3, 3), + /* 1000 */ V(5, 10, 4), + /* 1001 */ V(10, 5, 4), + /* 1010 */ V(2, 11, 3), + /* 1011 */ V(2, 11, 3), + /* 1100 */ V(11, 2, 3), + /* 1101 */ V(11, 2, 3), + /* 1110 */ V(1, 11, 3), + /* 1111 */ V(1, 11, 3), + + /* 0000 1111 ... */ + /* 0000 */ V(11, 1, 3), /* 176 */ + /* 0001 */ V(11, 1, 3), + /* 0010 */ V(0, 11, 4), + /* 0011 */ V(11, 0, 4), + /* 0100 */ V(6, 9, 4), + /* 0101 */ V(9, 6, 4), + /* 0110 */ V(4, 10, 4), + /* 0111 */ V(10, 4, 4), + /* 1000 */ V(7, 8, 4), + /* 1001 */ V(8, 7, 4), + /* 1010 */ V(10, 3, 3), + /* 1011 */ V(10, 3, 3), + /* 1100 */ V(3, 10, 4), + /* 1101 */ V(5, 9, 4), + /* 1110 */ V(2, 10, 3), + /* 1111 */ V(2, 10, 3), + + /* 0001 0000 ... */ + /* 0000 */ V(9, 5, 4), /* 192 */ + /* 0001 */ V(6, 8, 4), + /* 0010 */ V(10, 1, 3), + /* 0011 */ V(10, 1, 3), + /* 0100 */ V(8, 6, 4), + /* 0101 */ V(7, 7, 4), + /* 0110 */ V(9, 4, 3), + /* 0111 */ V(9, 4, 3), + /* 1000 */ V(4, 9, 4), + /* 1001 */ V(5, 7, 4), + /* 1010 */ V(6, 7, 3), + /* 1011 */ V(6, 7, 3), + /* 1100 */ V(10, 2, 2), + /* 1101 */ V(10, 2, 2), + /* 1110 */ V(10, 2, 2), + /* 1111 */ V(10, 2, 2), + + /* 0001 0001 ... */ + /* 000 */ V(1, 10, 2), /* 208 */ + /* 001 */ V(1, 10, 2), + /* 010 */ V(0, 10, 3), + /* 011 */ V(10, 0, 3), + /* 100 */ V(3, 9, 3), + /* 101 */ V(9, 3, 3), + /* 110 */ V(5, 8, 3), + /* 111 */ V(8, 5, 3), + + /* 0001 0010 ... */ + /* 000 */ V(2, 9, 2), /* 216 */ + /* 001 */ V(2, 9, 2), + /* 010 */ V(9, 2, 2), + /* 011 */ V(9, 2, 2), + /* 100 */ V(7, 6, 3), + /* 101 */ V(0, 9, 3), + /* 110 */ V(1, 9, 2), + /* 111 */ V(1, 9, 2), + + /* 0001 0011 ... */ + /* 000 */ V(9, 1, 2), /* 224 */ + /* 001 */ V(9, 1, 2), + /* 010 */ V(9, 0, 3), + /* 011 */ V(4, 8, 3), + /* 100 */ V(8, 4, 3), + /* 101 */ V(7, 5, 3), + /* 110 */ V(3, 8, 3), + /* 111 */ V(8, 3, 3), + + /* 0001 0100 ... */ + /* 000 */ V(6, 6, 3), /* 232 */ + /* 001 */ V(2, 8, 3), + /* 010 */ V(8, 2, 2), + /* 011 */ V(8, 2, 2), + /* 100 */ V(4, 7, 3), + /* 101 */ V(7, 4, 3), + /* 110 */ V(1, 8, 2), + /* 111 */ V(1, 8, 2), + + /* 0001 0101 ... */ + /* 000 */ V(8, 1, 2), /* 240 */ + /* 001 */ V(8, 1, 2), + /* 010 */ V(8, 0, 2), + /* 011 */ V(8, 0, 2), + /* 100 */ V(0, 8, 3), + /* 101 */ V(5, 6, 3), + /* 110 */ V(3, 7, 2), + /* 111 */ V(3, 7, 2), + + /* 0001 0110 ... */ + /* 000 */ V(7, 3, 2), /* 248 */ + /* 001 */ V(7, 3, 2), + /* 010 */ V(6, 5, 3), + /* 011 */ V(4, 6, 3), + /* 100 */ V(2, 7, 2), + /* 101 */ V(2, 7, 2), + /* 110 */ V(7, 2, 2), + /* 111 */ V(7, 2, 2), + + /* 0001 0111 ... */ + /* 000 */ V(6, 4, 3), /* 256 */ + /* 001 */ V(5, 5, 3), + /* 010 */ V(0, 7, 2), + /* 011 */ V(0, 7, 2), + /* 100 */ V(1, 7, 1), + /* 101 */ V(1, 7, 1), + /* 110 */ V(1, 7, 1), + /* 111 */ V(1, 7, 1), + + /* 0001 1000 ... */ + /* 00 */ V(7, 1, 1), /* 264 */ + /* 01 */ V(7, 1, 1), + /* 10 */ V(7, 0, 2), + /* 11 */ V(3, 6, 2), + + /* 0001 1001 ... */ + /* 00 */ V(6, 3, 2), /* 268 */ + /* 01 */ V(4, 5, 2), + /* 10 */ V(5, 4, 2), + /* 11 */ V(2, 6, 2), + + /* 0001 1010 ... */ + /* 0 */ V(6, 2, 1), /* 272 */ + /* 1 */ V(1, 6, 1), + + /* 0001 1011 ... */ + /* 00 */ V(6, 1, 1), /* 274 */ + /* 01 */ V(6, 1, 1), + /* 10 */ V(0, 6, 2), + /* 11 */ V(6, 0, 2), + + /* 0001 1100 ... */ + /* 00 */ V(5, 3, 1), /* 278 */ + /* 01 */ V(5, 3, 1), + /* 10 */ V(3, 5, 2), + /* 11 */ V(4, 4, 2), + + /* 0001 1101 ... */ + /* 0 */ V(2, 5, 1), /* 282 */ + /* 1 */ V(5, 2, 1), + + /* 0001 1111 ... */ + /* 0 */ V(1, 5, 1), /* 284 */ + /* 1 */ V(0, 5, 1), + + /* 0010 0000 ... */ + /* 0 */ V(3, 4, 1), /* 286 */ + /* 1 */ V(4, 3, 1), + + /* 0010 0001 ... */ + /* 0 */ V(5, 0, 1), /* 288 */ + /* 1 */ V(2, 4, 1), + + /* 0010 0010 ... */ + /* 0 */ V(4, 2, 1), /* 290 */ + /* 1 */ V(3, 3, 1), + + /* 0010 0101 ... */ + /* 0 */ V(0, 4, 1), /* 292 */ + /* 1 */ V(4, 0, 1), + + /* 0000 0110 1100 ... */ + /* 0000 */ V(12, 14, 4), /* 294 */ + /* 0001 */ PTR(400, 1), + /* 0010 */ V(13, 14, 3), + /* 0011 */ V(13, 14, 3), + /* 0100 */ V(14, 9, 3), + /* 0101 */ V(14, 9, 3), + /* 0110 */ V(14, 10, 4), + /* 0111 */ V(13, 9, 4), + /* 1000 */ V(14, 14, 2), + /* 1001 */ V(14, 14, 2), + /* 1010 */ V(14, 14, 2), + /* 1011 */ V(14, 14, 2), + /* 1100 */ V(14, 13, 3), + /* 1101 */ V(14, 13, 3), + /* 1110 */ V(14, 11, 3), + /* 1111 */ V(14, 11, 3), + + /* 0000 0110 1101 ... */ + /* 000 */ V(11, 14, 2), /* 310 */ + /* 001 */ V(11, 14, 2), + /* 010 */ V(12, 13, 2), + /* 011 */ V(12, 13, 2), + /* 100 */ V(13, 12, 3), + /* 101 */ V(13, 11, 3), + /* 110 */ V(10, 14, 2), + /* 111 */ V(10, 14, 2), + + /* 0000 0110 1110 ... */ + /* 000 */ V(12, 12, 2), /* 318 */ + /* 001 */ V(12, 12, 2), + /* 010 */ V(10, 13, 3), + /* 011 */ V(13, 10, 3), + /* 100 */ V(7, 14, 3), + /* 101 */ V(10, 12, 3), + /* 110 */ V(12, 10, 2), + /* 111 */ V(12, 10, 2), + + /* 0000 0110 1111 ... */ + /* 000 */ V(12, 9, 3), /* 326 */ + /* 001 */ V(7, 13, 3), + /* 010 */ V(5, 14, 2), + /* 011 */ V(5, 14, 2), + /* 100 */ V(11, 13, 1), + /* 101 */ V(11, 13, 1), + /* 110 */ V(11, 13, 1), + /* 111 */ V(11, 13, 1), + + /* 0000 1011 0000 ... */ + /* 00 */ V(9, 14, 1), /* 334 */ + /* 01 */ V(9, 14, 1), + /* 10 */ V(11, 12, 2), + /* 11 */ V(12, 11, 2), + + /* 0000 1011 0001 ... */ + /* 00 */ V(8, 14, 2), /* 338 */ + /* 01 */ V(14, 8, 2), + /* 10 */ V(9, 13, 2), + /* 11 */ V(14, 7, 2), + + /* 0000 1011 0010 ... */ + /* 00 */ V(11, 11, 2), /* 342 */ + /* 01 */ V(8, 13, 2), + /* 10 */ V(13, 8, 2), + /* 11 */ V(6, 14, 2), + + /* 0000 1011 0011 ... */ + /* 0 */ V(14, 6, 1), /* 346 */ + /* 1 */ V(9, 12, 1), + + /* 0000 1011 0100 ... */ + /* 00 */ V(10, 11, 2), /* 348 */ + /* 01 */ V(11, 10, 2), + /* 10 */ V(14, 5, 2), + /* 11 */ V(13, 7, 2), + + /* 0000 1011 0101 ... */ + /* 00 */ V(4, 14, 1), /* 352 */ + /* 01 */ V(4, 14, 1), + /* 10 */ V(14, 4, 2), + /* 11 */ V(8, 12, 2), + + /* 0000 1011 0110 ... */ + /* 0 */ V(12, 8, 1), /* 356 */ + /* 1 */ V(3, 14, 1), + + /* 0000 1011 0111 ... */ + /* 00 */ V(6, 13, 1), /* 358 */ + /* 01 */ V(6, 13, 1), + /* 10 */ V(13, 6, 2), + /* 11 */ V(9, 11, 2), + + /* 0000 1011 1000 ... */ + /* 00 */ V(11, 9, 2), /* 362 */ + /* 01 */ V(10, 10, 2), + /* 10 */ V(14, 1, 1), + /* 11 */ V(14, 1, 1), + + /* 0000 1011 1001 ... */ + /* 00 */ V(13, 4, 1), /* 366 */ + /* 01 */ V(13, 4, 1), + /* 10 */ V(11, 8, 2), + /* 11 */ V(10, 9, 2), + + /* 0000 1011 1010 ... */ + /* 00 */ V(7, 11, 1), /* 370 */ + /* 01 */ V(7, 11, 1), + /* 10 */ V(11, 7, 2), + /* 11 */ V(13, 0, 2), + + /* 0000 1011 1100 ... */ + /* 0 */ V(0, 14, 1), /* 374 */ + /* 1 */ V(14, 0, 1), + + /* 0000 1011 1101 ... */ + /* 0 */ V(5, 13, 1), /* 376 */ + /* 1 */ V(13, 5, 1), + + /* 0000 1011 1110 ... */ + /* 0 */ V(7, 12, 1), /* 378 */ + /* 1 */ V(12, 7, 1), + + /* 0000 1011 1111 ... */ + /* 0 */ V(4, 13, 1), /* 380 */ + /* 1 */ V(8, 11, 1), + + /* 0000 1100 0000 ... */ + /* 0 */ V(9, 10, 1), /* 382 */ + /* 1 */ V(6, 12, 1), + + /* 0000 1100 0001 ... */ + /* 0 */ V(12, 6, 1), /* 384 */ + /* 1 */ V(3, 13, 1), + + /* 0000 1100 0010 ... */ + /* 0 */ V(5, 12, 1), /* 386 */ + /* 1 */ V(12, 5, 1), + + /* 0000 1100 0100 ... */ + /* 0 */ V(8, 10, 1), /* 388 */ + /* 1 */ V(10, 8, 1), + + /* 0000 1100 0101 ... */ + /* 0 */ V(9, 9, 1), /* 390 */ + /* 1 */ V(4, 12, 1), + + /* 0000 1100 0110 ... */ + /* 0 */ V(11, 6, 1), /* 392 */ + /* 1 */ V(7, 10, 1), + + /* 0000 1100 1000 ... */ + /* 0 */ V(5, 11, 1), /* 394 */ + /* 1 */ V(8, 9, 1), + + /* 0000 1100 1011 ... */ + /* 0 */ V(9, 8, 1), /* 396 */ + /* 1 */ V(7, 9, 1), + + /* 0000 1101 0101 ... */ + /* 0 */ V(9, 7, 1), /* 398 */ + /* 1 */ V(8, 8, 1), + + /* 0000 0110 1100 0001 ... */ + /* 0 */ V(14, 12, 1), /* 400 */ + /* 1 */ V(13, 13, 1) +}; + +static +union huffpair const hufftab24[] = { + /* 0000 */ PTR(16, 4), + /* 0001 */ PTR(32, 4), + /* 0010 */ PTR(48, 4), + /* 0011 */ V(15, 15, 4), + /* 0100 */ PTR(64, 4), + /* 0101 */ PTR(80, 4), + /* 0110 */ PTR(96, 4), + /* 0111 */ PTR(112, 4), + /* 1000 */ PTR(128, 4), + /* 1001 */ PTR(144, 4), + /* 1010 */ PTR(160, 3), + /* 1011 */ PTR(168, 2), + /* 1100 */ V(1, 1, 4), + /* 1101 */ V(0, 1, 4), + /* 1110 */ V(1, 0, 4), + /* 1111 */ V(0, 0, 4), + + /* 0000 ... */ + /* 0000 */ V(14, 15, 4), /* 16 */ + /* 0001 */ V(15, 14, 4), + /* 0010 */ V(13, 15, 4), + /* 0011 */ V(15, 13, 4), + /* 0100 */ V(12, 15, 4), + /* 0101 */ V(15, 12, 4), + /* 0110 */ V(11, 15, 4), + /* 0111 */ V(15, 11, 4), + /* 1000 */ V(15, 10, 3), + /* 1001 */ V(15, 10, 3), + /* 1010 */ V(10, 15, 4), + /* 1011 */ V(9, 15, 4), + /* 1100 */ V(15, 9, 3), + /* 1101 */ V(15, 9, 3), + /* 1110 */ V(15, 8, 3), + /* 1111 */ V(15, 8, 3), + + /* 0001 ... */ + /* 0000 */ V(8, 15, 4), /* 32 */ + /* 0001 */ V(7, 15, 4), + /* 0010 */ V(15, 7, 3), + /* 0011 */ V(15, 7, 3), + /* 0100 */ V(6, 15, 3), + /* 0101 */ V(6, 15, 3), + /* 0110 */ V(15, 6, 3), + /* 0111 */ V(15, 6, 3), + /* 1000 */ V(5, 15, 3), + /* 1001 */ V(5, 15, 3), + /* 1010 */ V(15, 5, 3), + /* 1011 */ V(15, 5, 3), + /* 1100 */ V(4, 15, 3), + /* 1101 */ V(4, 15, 3), + /* 1110 */ V(15, 4, 3), + /* 1111 */ V(15, 4, 3), + + /* 0010 ... */ + /* 0000 */ V(3, 15, 3), /* 48 */ + /* 0001 */ V(3, 15, 3), + /* 0010 */ V(15, 3, 3), + /* 0011 */ V(15, 3, 3), + /* 0100 */ V(2, 15, 3), + /* 0101 */ V(2, 15, 3), + /* 0110 */ V(15, 2, 3), + /* 0111 */ V(15, 2, 3), + /* 1000 */ V(15, 1, 3), + /* 1001 */ V(15, 1, 3), + /* 1010 */ V(1, 15, 4), + /* 1011 */ V(15, 0, 4), + /* 1100 */ PTR(172, 3), + /* 1101 */ PTR(180, 3), + /* 1110 */ PTR(188, 3), + /* 1111 */ PTR(196, 3), + + /* 0100 ... */ + /* 0000 */ PTR(204, 4), /* 64 */ + /* 0001 */ PTR(220, 3), + /* 0010 */ PTR(228, 3), + /* 0011 */ PTR(236, 3), + /* 0100 */ PTR(244, 2), + /* 0101 */ PTR(248, 2), + /* 0110 */ PTR(252, 2), + /* 0111 */ PTR(256, 2), + /* 1000 */ PTR(260, 2), + /* 1001 */ PTR(264, 2), + /* 1010 */ PTR(268, 2), + /* 1011 */ PTR(272, 2), + /* 1100 */ PTR(276, 2), + /* 1101 */ PTR(280, 3), + /* 1110 */ PTR(288, 2), + /* 1111 */ PTR(292, 2), + + /* 0101 ... */ + /* 0000 */ PTR(296, 2), /* 80 */ + /* 0001 */ PTR(300, 3), + /* 0010 */ PTR(308, 2), + /* 0011 */ PTR(312, 3), + /* 0100 */ PTR(320, 1), + /* 0101 */ PTR(322, 2), + /* 0110 */ PTR(326, 2), + /* 0111 */ PTR(330, 1), + /* 1000 */ PTR(332, 2), + /* 1001 */ PTR(336, 1), + /* 1010 */ PTR(338, 1), + /* 1011 */ PTR(340, 1), + /* 1100 */ PTR(342, 1), + /* 1101 */ PTR(344, 1), + /* 1110 */ PTR(346, 1), + /* 1111 */ PTR(348, 1), + + /* 0110 ... */ + /* 0000 */ PTR(350, 1), /* 96 */ + /* 0001 */ PTR(352, 1), + /* 0010 */ PTR(354, 1), + /* 0011 */ PTR(356, 1), + /* 0100 */ PTR(358, 1), + /* 0101 */ PTR(360, 1), + /* 0110 */ PTR(362, 1), + /* 0111 */ PTR(364, 1), + /* 1000 */ PTR(366, 1), + /* 1001 */ PTR(368, 1), + /* 1010 */ PTR(370, 2), + /* 1011 */ PTR(374, 1), + /* 1100 */ PTR(376, 2), + /* 1101 */ V(7, 3, 4), + /* 1110 */ PTR(380, 1), + /* 1111 */ V(7, 2, 4), + + /* 0111 ... */ + /* 0000 */ V(4, 6, 4), /* 112 */ + /* 0001 */ V(6, 4, 4), + /* 0010 */ V(5, 5, 4), + /* 0011 */ V(7, 1, 4), + /* 0100 */ V(3, 6, 4), + /* 0101 */ V(6, 3, 4), + /* 0110 */ V(4, 5, 4), + /* 0111 */ V(5, 4, 4), + /* 1000 */ V(2, 6, 4), + /* 1001 */ V(6, 2, 4), + /* 1010 */ V(1, 6, 4), + /* 1011 */ V(6, 1, 4), + /* 1100 */ PTR(382, 1), + /* 1101 */ V(3, 5, 4), + /* 1110 */ V(5, 3, 4), + /* 1111 */ V(4, 4, 4), + + /* 1000 ... */ + /* 0000 */ V(2, 5, 4), /* 128 */ + /* 0001 */ V(5, 2, 4), + /* 0010 */ V(1, 5, 4), + /* 0011 */ PTR(384, 1), + /* 0100 */ V(5, 1, 3), + /* 0101 */ V(5, 1, 3), + /* 0110 */ V(3, 4, 4), + /* 0111 */ V(4, 3, 4), + /* 1000 */ V(2, 4, 3), + /* 1001 */ V(2, 4, 3), + /* 1010 */ V(4, 2, 3), + /* 1011 */ V(4, 2, 3), + /* 1100 */ V(3, 3, 3), + /* 1101 */ V(3, 3, 3), + /* 1110 */ V(1, 4, 3), + /* 1111 */ V(1, 4, 3), + + /* 1001 ... */ + /* 0000 */ V(4, 1, 3), /* 144 */ + /* 0001 */ V(4, 1, 3), + /* 0010 */ V(0, 4, 4), + /* 0011 */ V(4, 0, 4), + /* 0100 */ V(2, 3, 3), + /* 0101 */ V(2, 3, 3), + /* 0110 */ V(3, 2, 3), + /* 0111 */ V(3, 2, 3), + /* 1000 */ V(1, 3, 2), + /* 1001 */ V(1, 3, 2), + /* 1010 */ V(1, 3, 2), + /* 1011 */ V(1, 3, 2), + /* 1100 */ V(3, 1, 2), + /* 1101 */ V(3, 1, 2), + /* 1110 */ V(3, 1, 2), + /* 1111 */ V(3, 1, 2), + + /* 1010 ... */ + /* 000 */ V(0, 3, 3), /* 160 */ + /* 001 */ V(3, 0, 3), + /* 010 */ V(2, 2, 2), + /* 011 */ V(2, 2, 2), + /* 100 */ V(1, 2, 1), + /* 101 */ V(1, 2, 1), + /* 110 */ V(1, 2, 1), + /* 111 */ V(1, 2, 1), + + /* 1011 ... */ + /* 00 */ V(2, 1, 1), /* 168 */ + /* 01 */ V(2, 1, 1), + /* 10 */ V(0, 2, 2), + /* 11 */ V(2, 0, 2), + + /* 0010 1100 ... */ + /* 000 */ V(0, 15, 1), /* 172 */ + /* 001 */ V(0, 15, 1), + /* 010 */ V(0, 15, 1), + /* 011 */ V(0, 15, 1), + /* 100 */ V(14, 14, 3), + /* 101 */ V(13, 14, 3), + /* 110 */ V(14, 13, 3), + /* 111 */ V(12, 14, 3), + + /* 0010 1101 ... */ + /* 000 */ V(14, 12, 3), /* 180 */ + /* 001 */ V(13, 13, 3), + /* 010 */ V(11, 14, 3), + /* 011 */ V(14, 11, 3), + /* 100 */ V(12, 13, 3), + /* 101 */ V(13, 12, 3), + /* 110 */ V(10, 14, 3), + /* 111 */ V(14, 10, 3), + + /* 0010 1110 ... */ + /* 000 */ V(11, 13, 3), /* 188 */ + /* 001 */ V(13, 11, 3), + /* 010 */ V(12, 12, 3), + /* 011 */ V(9, 14, 3), + /* 100 */ V(14, 9, 3), + /* 101 */ V(10, 13, 3), + /* 110 */ V(13, 10, 3), + /* 111 */ V(11, 12, 3), + + /* 0010 1111 ... */ + /* 000 */ V(12, 11, 3), /* 196 */ + /* 001 */ V(8, 14, 3), + /* 010 */ V(14, 8, 3), + /* 011 */ V(9, 13, 3), + /* 100 */ V(13, 9, 3), + /* 101 */ V(7, 14, 3), + /* 110 */ V(14, 7, 3), + /* 111 */ V(10, 12, 3), + + /* 0100 0000 ... */ + /* 0000 */ V(12, 10, 3), /* 204 */ + /* 0001 */ V(12, 10, 3), + /* 0010 */ V(11, 11, 3), + /* 0011 */ V(11, 11, 3), + /* 0100 */ V(8, 13, 3), + /* 0101 */ V(8, 13, 3), + /* 0110 */ V(13, 8, 3), + /* 0111 */ V(13, 8, 3), + /* 1000 */ V(0, 14, 4), + /* 1001 */ V(14, 0, 4), + /* 1010 */ V(0, 13, 3), + /* 1011 */ V(0, 13, 3), + /* 1100 */ V(14, 6, 2), + /* 1101 */ V(14, 6, 2), + /* 1110 */ V(14, 6, 2), + /* 1111 */ V(14, 6, 2), + + /* 0100 0001 ... */ + /* 000 */ V(6, 14, 3), /* 220 */ + /* 001 */ V(9, 12, 3), + /* 010 */ V(12, 9, 2), + /* 011 */ V(12, 9, 2), + /* 100 */ V(5, 14, 2), + /* 101 */ V(5, 14, 2), + /* 110 */ V(11, 10, 2), + /* 111 */ V(11, 10, 2), + + /* 0100 0010 ... */ + /* 000 */ V(14, 5, 2), /* 228 */ + /* 001 */ V(14, 5, 2), + /* 010 */ V(10, 11, 3), + /* 011 */ V(7, 13, 3), + /* 100 */ V(13, 7, 2), + /* 101 */ V(13, 7, 2), + /* 110 */ V(14, 4, 2), + /* 111 */ V(14, 4, 2), + + /* 0100 0011 ... */ + /* 000 */ V(8, 12, 2), /* 236 */ + /* 001 */ V(8, 12, 2), + /* 010 */ V(12, 8, 2), + /* 011 */ V(12, 8, 2), + /* 100 */ V(4, 14, 3), + /* 101 */ V(2, 14, 3), + /* 110 */ V(3, 14, 2), + /* 111 */ V(3, 14, 2), + + /* 0100 0100 ... */ + /* 00 */ V(6, 13, 2), /* 244 */ + /* 01 */ V(13, 6, 2), + /* 10 */ V(14, 3, 2), + /* 11 */ V(9, 11, 2), + + /* 0100 0101 ... */ + /* 00 */ V(11, 9, 2), /* 248 */ + /* 01 */ V(10, 10, 2), + /* 10 */ V(14, 2, 2), + /* 11 */ V(1, 14, 2), + + /* 0100 0110 ... */ + /* 00 */ V(14, 1, 2), /* 252 */ + /* 01 */ V(5, 13, 2), + /* 10 */ V(13, 5, 2), + /* 11 */ V(7, 12, 2), + + /* 0100 0111 ... */ + /* 00 */ V(12, 7, 2), /* 256 */ + /* 01 */ V(4, 13, 2), + /* 10 */ V(8, 11, 2), + /* 11 */ V(11, 8, 2), + + /* 0100 1000 ... */ + /* 00 */ V(13, 4, 2), /* 260 */ + /* 01 */ V(9, 10, 2), + /* 10 */ V(10, 9, 2), + /* 11 */ V(6, 12, 2), + + /* 0100 1001 ... */ + /* 00 */ V(12, 6, 2), /* 264 */ + /* 01 */ V(3, 13, 2), + /* 10 */ V(13, 3, 2), + /* 11 */ V(2, 13, 2), + + /* 0100 1010 ... */ + /* 00 */ V(13, 2, 2), /* 268 */ + /* 01 */ V(1, 13, 2), + /* 10 */ V(7, 11, 2), + /* 11 */ V(11, 7, 2), + + /* 0100 1011 ... */ + /* 00 */ V(13, 1, 2), /* 272 */ + /* 01 */ V(5, 12, 2), + /* 10 */ V(12, 5, 2), + /* 11 */ V(8, 10, 2), + + /* 0100 1100 ... */ + /* 00 */ V(10, 8, 2), /* 276 */ + /* 01 */ V(9, 9, 2), + /* 10 */ V(4, 12, 2), + /* 11 */ V(12, 4, 2), + + /* 0100 1101 ... */ + /* 000 */ V(6, 11, 2), /* 280 */ + /* 001 */ V(6, 11, 2), + /* 010 */ V(11, 6, 2), + /* 011 */ V(11, 6, 2), + /* 100 */ V(13, 0, 3), + /* 101 */ V(0, 12, 3), + /* 110 */ V(3, 12, 2), + /* 111 */ V(3, 12, 2), + + /* 0100 1110 ... */ + /* 00 */ V(12, 3, 2), /* 288 */ + /* 01 */ V(7, 10, 2), + /* 10 */ V(10, 7, 2), + /* 11 */ V(2, 12, 2), + + /* 0100 1111 ... */ + /* 00 */ V(12, 2, 2), /* 292 */ + /* 01 */ V(5, 11, 2), + /* 10 */ V(11, 5, 2), + /* 11 */ V(1, 12, 2), + + /* 0101 0000 ... */ + /* 00 */ V(8, 9, 2), /* 296 */ + /* 01 */ V(9, 8, 2), + /* 10 */ V(12, 1, 2), + /* 11 */ V(4, 11, 2), + + /* 0101 0001 ... */ + /* 000 */ V(12, 0, 3), /* 300 */ + /* 001 */ V(0, 11, 3), + /* 010 */ V(3, 11, 2), + /* 011 */ V(3, 11, 2), + /* 100 */ V(11, 0, 3), + /* 101 */ V(0, 10, 3), + /* 110 */ V(1, 10, 2), + /* 111 */ V(1, 10, 2), + + /* 0101 0010 ... */ + /* 00 */ V(11, 4, 1), /* 308 */ + /* 01 */ V(11, 4, 1), + /* 10 */ V(6, 10, 2), + /* 11 */ V(10, 6, 2), + + /* 0101 0011 ... */ + /* 000 */ V(7, 9, 2), /* 312 */ + /* 001 */ V(7, 9, 2), + /* 010 */ V(9, 7, 2), + /* 011 */ V(9, 7, 2), + /* 100 */ V(10, 0, 3), + /* 101 */ V(0, 9, 3), + /* 110 */ V(9, 0, 2), + /* 111 */ V(9, 0, 2), + + /* 0101 0100 ... */ + /* 0 */ V(11, 3, 1), /* 320 */ + /* 1 */ V(8, 8, 1), + + /* 0101 0101 ... */ + /* 00 */ V(2, 11, 2), /* 322 */ + /* 01 */ V(5, 10, 2), + /* 10 */ V(11, 2, 1), + /* 11 */ V(11, 2, 1), + + /* 0101 0110 ... */ + /* 00 */ V(10, 5, 2), /* 326 */ + /* 01 */ V(1, 11, 2), + /* 10 */ V(11, 1, 2), + /* 11 */ V(6, 9, 2), + + /* 0101 0111 ... */ + /* 0 */ V(9, 6, 1), /* 330 */ + /* 1 */ V(10, 4, 1), + + /* 0101 1000 ... */ + /* 00 */ V(4, 10, 2), /* 332 */ + /* 01 */ V(7, 8, 2), + /* 10 */ V(8, 7, 1), + /* 11 */ V(8, 7, 1), + + /* 0101 1001 ... */ + /* 0 */ V(3, 10, 1), /* 336 */ + /* 1 */ V(10, 3, 1), + + /* 0101 1010 ... */ + /* 0 */ V(5, 9, 1), /* 338 */ + /* 1 */ V(9, 5, 1), + + /* 0101 1011 ... */ + /* 0 */ V(2, 10, 1), /* 340 */ + /* 1 */ V(10, 2, 1), + + /* 0101 1100 ... */ + /* 0 */ V(10, 1, 1), /* 342 */ + /* 1 */ V(6, 8, 1), + + /* 0101 1101 ... */ + /* 0 */ V(8, 6, 1), /* 344 */ + /* 1 */ V(7, 7, 1), + + /* 0101 1110 ... */ + /* 0 */ V(4, 9, 1), /* 346 */ + /* 1 */ V(9, 4, 1), + + /* 0101 1111 ... */ + /* 0 */ V(3, 9, 1), /* 348 */ + /* 1 */ V(9, 3, 1), + + /* 0110 0000 ... */ + /* 0 */ V(5, 8, 1), /* 350 */ + /* 1 */ V(8, 5, 1), + + /* 0110 0001 ... */ + /* 0 */ V(2, 9, 1), /* 352 */ + /* 1 */ V(6, 7, 1), + + /* 0110 0010 ... */ + /* 0 */ V(7, 6, 1), /* 354 */ + /* 1 */ V(9, 2, 1), + + /* 0110 0011 ... */ + /* 0 */ V(1, 9, 1), /* 356 */ + /* 1 */ V(9, 1, 1), + + /* 0110 0100 ... */ + /* 0 */ V(4, 8, 1), /* 358 */ + /* 1 */ V(8, 4, 1), + + /* 0110 0101 ... */ + /* 0 */ V(5, 7, 1), /* 360 */ + /* 1 */ V(7, 5, 1), + + /* 0110 0110 ... */ + /* 0 */ V(3, 8, 1), /* 362 */ + /* 1 */ V(8, 3, 1), + + /* 0110 0111 ... */ + /* 0 */ V(6, 6, 1), /* 364 */ + /* 1 */ V(2, 8, 1), + + /* 0110 1000 ... */ + /* 0 */ V(8, 2, 1), /* 366 */ + /* 1 */ V(1, 8, 1), + + /* 0110 1001 ... */ + /* 0 */ V(4, 7, 1), /* 368 */ + /* 1 */ V(7, 4, 1), + + /* 0110 1010 ... */ + /* 00 */ V(8, 1, 1), /* 370 */ + /* 01 */ V(8, 1, 1), + /* 10 */ V(0, 8, 2), + /* 11 */ V(8, 0, 2), + + /* 0110 1011 ... */ + /* 0 */ V(5, 6, 1), /* 374 */ + /* 1 */ V(6, 5, 1), + + /* 0110 1100 ... */ + /* 00 */ V(1, 7, 1), /* 376 */ + /* 01 */ V(1, 7, 1), + /* 10 */ V(0, 7, 2), + /* 11 */ V(7, 0, 2), + + /* 0110 1110 ... */ + /* 0 */ V(3, 7, 1), /* 380 */ + /* 1 */ V(2, 7, 1), + + /* 0111 1100 ... */ + /* 0 */ V(0, 6, 1), /* 382 */ + /* 1 */ V(6, 0, 1), + + /* 1000 0011 ... */ + /* 0 */ V(0, 5, 1), /* 384 */ + /* 1 */ V(5, 0, 1) +}; + +# undef V +# undef PTR + +/* external tables */ + +union huffquad const *const mad_huff_quad_table[2] = { hufftabA, hufftabB }; + +struct hufftable const mad_huff_pair_table[32] = { + /* 0 */ { hufftab0, 0, 0 }, + /* 1 */ { hufftab1, 0, 3 }, + /* 2 */ { hufftab2, 0, 3 }, + /* 3 */ { hufftab3, 0, 3 }, + /* 4 */ { 0 /* not used */ }, + /* 5 */ { hufftab5, 0, 3 }, + /* 6 */ { hufftab6, 0, 4 }, + /* 7 */ { hufftab7, 0, 4 }, + /* 8 */ { hufftab8, 0, 4 }, + /* 9 */ { hufftab9, 0, 4 }, + /* 10 */ { hufftab10, 0, 4 }, + /* 11 */ { hufftab11, 0, 4 }, + /* 12 */ { hufftab12, 0, 4 }, + /* 13 */ { hufftab13, 0, 4 }, + /* 14 */ { 0 /* not used */ }, + /* 15 */ { hufftab15, 0, 4 }, + /* 16 */ { hufftab16, 1, 4 }, + /* 17 */ { hufftab16, 2, 4 }, + /* 18 */ { hufftab16, 3, 4 }, + /* 19 */ { hufftab16, 4, 4 }, + /* 20 */ { hufftab16, 6, 4 }, + /* 21 */ { hufftab16, 8, 4 }, + /* 22 */ { hufftab16, 10, 4 }, + /* 23 */ { hufftab16, 13, 4 }, + /* 24 */ { hufftab24, 4, 4 }, + /* 25 */ { hufftab24, 5, 4 }, + /* 26 */ { hufftab24, 6, 4 }, + /* 27 */ { hufftab24, 7, 4 }, + /* 28 */ { hufftab24, 8, 4 }, + /* 29 */ { hufftab24, 9, 4 }, + /* 30 */ { hufftab24, 11, 4 }, + /* 31 */ { hufftab24, 13, 4 } +}; diff --git a/cpymo-backends/nds/decoder/huffman.h b/cpymo-backends/nds/decoder/huffman.h new file mode 100644 index 00000000..188dd397 --- /dev/null +++ b/cpymo-backends/nds/decoder/huffman.h @@ -0,0 +1,67 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifndef LIBMAD_HUFFMAN_H +# define LIBMAD_HUFFMAN_H + +#include + +union huffquad { + struct { + u16 final : 1; + u16 bits : 3; + u16 offset : 12; + } ptr; + struct { + u16 final : 1; + u16 hlen : 3; + u16 v : 1; + u16 w : 1; + u16 x : 1; + u16 y : 1; + } value; + u16 final : 1; +}; + +union huffpair { + struct { + u16 final : 1; + u16 bits : 3; + u16 offset : 12; + } ptr; + struct { + u16 final : 1; + u16 hlen : 3; + u16 x : 4; + u16 y : 4; + } value; + u16 final : 1; +}; + +struct hufftable { + union huffpair const *table; + u16 linbits; + u16 startbits; +}; + +extern union huffquad const *const mad_huff_quad_table[2]; +extern struct hufftable const mad_huff_pair_table[32]; + +# endif diff --git a/cpymo-backends/nds/decoder/imdct_s.dat b/cpymo-backends/nds/decoder/imdct_s.dat new file mode 100644 index 00000000..66d846ce --- /dev/null +++ b/cpymo-backends/nds/decoder/imdct_s.dat @@ -0,0 +1,61 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + /* 0 */ { MAD_F(0x09bd7ca0) /* 0.608761429 */, + -MAD_F(0x0ec835e8) /* -0.923879533 */, + -MAD_F(0x0216a2a2) /* -0.130526192 */, + MAD_F(0x0fdcf549) /* 0.991444861 */, + -MAD_F(0x061f78aa) /* -0.382683432 */, + -MAD_F(0x0cb19346) /* -0.793353340 */ }, + + /* 6 */ { -MAD_F(0x0cb19346) /* -0.793353340 */, + MAD_F(0x061f78aa) /* 0.382683432 */, + MAD_F(0x0fdcf549) /* 0.991444861 */, + MAD_F(0x0216a2a2) /* 0.130526192 */, + -MAD_F(0x0ec835e8) /* -0.923879533 */, + -MAD_F(0x09bd7ca0) /* -0.608761429 */ }, + + /* 1 */ { MAD_F(0x061f78aa) /* 0.382683432 */, + -MAD_F(0x0ec835e8) /* -0.923879533 */, + MAD_F(0x0ec835e8) /* 0.923879533 */, + -MAD_F(0x061f78aa) /* -0.382683432 */, + -MAD_F(0x061f78aa) /* -0.382683432 */, + MAD_F(0x0ec835e8) /* 0.923879533 */ }, + + /* 7 */ { -MAD_F(0x0ec835e8) /* -0.923879533 */, + -MAD_F(0x061f78aa) /* -0.382683432 */, + MAD_F(0x061f78aa) /* 0.382683432 */, + MAD_F(0x0ec835e8) /* 0.923879533 */, + MAD_F(0x0ec835e8) /* 0.923879533 */, + MAD_F(0x061f78aa) /* 0.382683432 */ }, + + /* 2 */ { MAD_F(0x0216a2a2) /* 0.130526192 */, + -MAD_F(0x061f78aa) /* -0.382683432 */, + MAD_F(0x09bd7ca0) /* 0.608761429 */, + -MAD_F(0x0cb19346) /* -0.793353340 */, + MAD_F(0x0ec835e8) /* 0.923879533 */, + -MAD_F(0x0fdcf549) /* -0.991444861 */ }, + + /* 8 */ { -MAD_F(0x0fdcf549) /* -0.991444861 */, + -MAD_F(0x0ec835e8) /* -0.923879533 */, + -MAD_F(0x0cb19346) /* -0.793353340 */, + -MAD_F(0x09bd7ca0) /* -0.608761429 */, + -MAD_F(0x061f78aa) /* -0.382683432 */, + -MAD_F(0x0216a2a2) /* -0.130526192 */ } diff --git a/cpymo-backends/nds/decoder/layer12.c b/cpymo-backends/nds/decoder/layer12.c new file mode 100644 index 00000000..07f1fa4e --- /dev/null +++ b/cpymo-backends/nds/decoder/layer12.c @@ -0,0 +1,509 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif + +# include "global.h" + +# ifdef HAVE_LIMITS_H +# include +# else +# define CHAR_BIT 8 +# endif + +# include "fixed.h" +# include "bit.h" +# include "stream.h" +# include "frame.h" +# include "layer12.h" + +/* + * scalefactor table + * used in both Layer I and Layer II decoding + */ +static +mad_fixed_t const sf_table[64] = { +# include "sf_table.dat" +}; + +/* --- Layer I ------------------------------------------------------------- */ + +/* linear scaling table */ +static +mad_fixed_t const linear_table[14] = { + MAD_F(0x15555555), /* 2^2 / (2^2 - 1) == 1.33333333333333 */ + MAD_F(0x12492492), /* 2^3 / (2^3 - 1) == 1.14285714285714 */ + MAD_F(0x11111111), /* 2^4 / (2^4 - 1) == 1.06666666666667 */ + MAD_F(0x10842108), /* 2^5 / (2^5 - 1) == 1.03225806451613 */ + MAD_F(0x10410410), /* 2^6 / (2^6 - 1) == 1.01587301587302 */ + MAD_F(0x10204081), /* 2^7 / (2^7 - 1) == 1.00787401574803 */ + MAD_F(0x10101010), /* 2^8 / (2^8 - 1) == 1.00392156862745 */ + MAD_F(0x10080402), /* 2^9 / (2^9 - 1) == 1.00195694716243 */ + MAD_F(0x10040100), /* 2^10 / (2^10 - 1) == 1.00097751710655 */ + MAD_F(0x10020040), /* 2^11 / (2^11 - 1) == 1.00048851978505 */ + MAD_F(0x10010010), /* 2^12 / (2^12 - 1) == 1.00024420024420 */ + MAD_F(0x10008004), /* 2^13 / (2^13 - 1) == 1.00012208521548 */ + MAD_F(0x10004001), /* 2^14 / (2^14 - 1) == 1.00006103888177 */ + MAD_F(0x10002000) /* 2^15 / (2^15 - 1) == 1.00003051850948 */ +}; + +/* + * NAME: I_sample() + * DESCRIPTION: decode one requantized Layer I sample from a bitstream + */ +static +mad_fixed_t I_sample(struct mad_bitptr *ptr, u32 nb) +{ + mad_fixed_t sample; + + sample = mad_bit_read(ptr, nb); + + /* invert most significant bit, extend sign, then scale to fixed format */ + + sample ^= 1 << (nb - 1); + sample |= -(sample & (1 << (nb - 1))); + + sample <<= MAD_F_FRACBITS - (nb - 1); + + /* requantize the sample */ + + /* s'' = (2^nb / (2^nb - 1)) * (s''' + 2^(-nb + 1)) */ + + sample += MAD_F_ONE >> (nb - 1); + + return mad_f_mul(sample, linear_table[nb - 2]); + + /* s' = factor * s'' */ + /* (to be performed by caller) */ +} + +/* + * NAME: layer->I() + * DESCRIPTION: decode a single Layer I frame + */ +int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame) +{ + struct mad_header *header = &frame->header; + u32 nch, bound, ch, s, sb, nb; + u8 allocation[2][32], scalefactor[2][32]; + + nch = MAD_NCHANNELS(header); + + bound = 32; + if (header->mode == MAD_MODE_JOINT_STEREO) { + header->flags |= MAD_FLAG_I_STEREO; + bound = 4 + header->mode_extension * 4; + } + + /* check CRC word */ + + if (header->flags & MAD_FLAG_PROTECTION) { + header->crc_check = + mad_bit_crc(stream->ptr, 4 * (bound * nch + (32 - bound)), + header->crc_check); + + if (header->crc_check != header->crc_target && + !(frame->options & MAD_OPTION_IGNORECRC)) { + stream->error = MAD_ERROR_BADCRC; + return -1; + } + } + + /* decode bit allocations */ + + for (sb = 0; sb < bound; ++sb) { + for (ch = 0; ch < nch; ++ch) { + nb = mad_bit_read(&stream->ptr, 4); + + if (nb == 15) { + stream->error = MAD_ERROR_BADBITALLOC; + return -1; + } + + allocation[ch][sb] = nb ? nb + 1 : 0; + } + } + + for (sb = bound; sb < 32; ++sb) { + nb = mad_bit_read(&stream->ptr, 4); + + if (nb == 15) { + stream->error = MAD_ERROR_BADBITALLOC; + return -1; + } + + allocation[0][sb] = + allocation[1][sb] = nb ? nb + 1 : 0; + } + + /* decode scalefactors */ + + for (sb = 0; sb < 32; ++sb) { + for (ch = 0; ch < nch; ++ch) { + if (allocation[ch][sb]) { + scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6); + +# if defined(OPT_STRICT) + /* + * Scalefactor index 63 does not appear in Table B.1 of + * ISO/IEC 11172-3. Nonetheless, other implementations accept it, + * so we only reject it if OPT_STRICT is defined. + */ + if (scalefactor[ch][sb] == 63) { + stream->error = MAD_ERROR_BADSCALEFACTOR; + return -1; + } +# endif + } + } + } + + /* decode samples */ + + for (s = 0; s < 12; ++s) { + for (sb = 0; sb < bound; ++sb) { + for (ch = 0; ch < nch; ++ch) { + nb = allocation[ch][sb]; + frame->sbsample[ch][s][sb] = nb ? + mad_f_mul(I_sample(&stream->ptr, nb), + sf_table[scalefactor[ch][sb]]) : 0; + } + } + + for (sb = bound; sb < 32; ++sb) { + if ((nb = allocation[0][sb])) { + mad_fixed_t sample; + + sample = I_sample(&stream->ptr, nb); + + for (ch = 0; ch < nch; ++ch) { + frame->sbsample[ch][s][sb] = + mad_f_mul(sample, sf_table[scalefactor[ch][sb]]); + } + } + else { + for (ch = 0; ch < nch; ++ch) + frame->sbsample[ch][s][sb] = 0; + } + } + } + + return 0; +} + +/* --- Layer II ------------------------------------------------------------ */ + +/* possible quantization per subband table */ +static +struct { + u32 sblimit; + u8 const offsets[30]; +} const sbquant_table[5] = { + /* ISO/IEC 11172-3 Table B.2a */ + { 27, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 0 */ + 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0 } }, + /* ISO/IEC 11172-3 Table B.2b */ + { 30, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 1 */ + 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0 } }, + /* ISO/IEC 11172-3 Table B.2c */ + { 8, { 5, 5, 2, 2, 2, 2, 2, 2 } }, /* 2 */ + /* ISO/IEC 11172-3 Table B.2d */ + { 12, { 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } }, /* 3 */ + /* ISO/IEC 13818-3 Table B.1 */ + { 30, { 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, /* 4 */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } } +}; + +/* bit allocation table */ +static +struct { + u16 nbal; + u16 offset; +} const bitalloc_table[8] = { + { 2, 0 }, /* 0 */ + { 2, 3 }, /* 1 */ + { 3, 3 }, /* 2 */ + { 3, 1 }, /* 3 */ + { 4, 2 }, /* 4 */ + { 4, 3 }, /* 5 */ + { 4, 4 }, /* 6 */ + { 4, 5 } /* 7 */ +}; + +/* offsets into quantization class table */ +static +u8 const offset_table[6][15] = { + { 0, 1, 16 }, /* 0 */ + { 0, 1, 2, 3, 4, 5, 16 }, /* 1 */ + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, /* 2 */ + { 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, /* 3 */ + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16 }, /* 4 */ + { 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 } /* 5 */ +}; + +/* quantization class table */ +static +struct quantclass { + u16 nlevels; + u8 group; + u8 bits; + mad_fixed_t C; + mad_fixed_t D; +} const qc_table[17] = { +# include "qc_table.dat" +}; + +/* + * NAME: II_samples() + * DESCRIPTION: decode three requantized Layer II samples from a bitstream + */ +static +void II_samples(struct mad_bitptr *ptr, + struct quantclass const *quantclass, + mad_fixed_t output[3]) +{ + u32 nb, s, sample[3]; + + if ((nb = quantclass->group)) { + u32 c, nlevels; + + /* degrouping */ + c = mad_bit_read(ptr, quantclass->bits); + nlevels = quantclass->nlevels; + + for (s = 0; s < 3; ++s) { + sample[s] = c % nlevels; + c /= nlevels; + } + } + else { + nb = quantclass->bits; + + for (s = 0; s < 3; ++s) + sample[s] = mad_bit_read(ptr, nb); + } + + for (s = 0; s < 3; ++s) { + mad_fixed_t requantized; + + /* invert most significant bit, extend sign, then scale to fixed format */ + + requantized = sample[s] ^ (1 << (nb - 1)); + requantized |= -(requantized & (1 << (nb - 1))); + + requantized <<= MAD_F_FRACBITS - (nb - 1); + + /* requantize the sample */ + + /* s'' = C * (s''' + D) */ + + output[s] = mad_f_mul(requantized + quantclass->D, quantclass->C); + + /* s' = factor * s'' */ + /* (to be performed by caller) */ + } +} + +/* + * NAME: layer->II() + * DESCRIPTION: decode a single Layer II frame + */ +int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) +{ + struct mad_header *header = &frame->header; + struct mad_bitptr start; + u32 index, sblimit, nbal, nch, bound, gr, ch, s, sb; + u8 const *offsets; + u8 allocation[2][32], scfsi[2][32], scalefactor[2][32][3]; + mad_fixed_t samples[3]; + + nch = MAD_NCHANNELS(header); + + if (header->flags & MAD_FLAG_LSF_EXT) + index = 4; + else { + switch (nch == 2 ? header->bitrate / 2 : header->bitrate) { + case 32000: + case 48000: + index = (header->samplerate == 32000) ? 3 : 2; + break; + + case 56000: + case 64000: + case 80000: + index = 0; + break; + + default: + index = (header->samplerate == 48000) ? 0 : 1; + } + } + + sblimit = sbquant_table[index].sblimit; + offsets = sbquant_table[index].offsets; + + bound = 32; + if (header->mode == MAD_MODE_JOINT_STEREO) { + header->flags |= MAD_FLAG_I_STEREO; + bound = 4 + header->mode_extension * 4; + } + + if (bound > sblimit) + bound = sblimit; + + start = stream->ptr; + + /* decode bit allocations */ + + for (sb = 0; sb < bound; ++sb) { + nbal = bitalloc_table[offsets[sb]].nbal; + + for (ch = 0; ch < nch; ++ch) + allocation[ch][sb] = mad_bit_read(&stream->ptr, nbal); + } + + for (sb = bound; sb < sblimit; ++sb) { + nbal = bitalloc_table[offsets[sb]].nbal; + + allocation[0][sb] = + allocation[1][sb] = mad_bit_read(&stream->ptr, nbal); + } + + /* decode scalefactor selection info */ + + for (sb = 0; sb < sblimit; ++sb) { + for (ch = 0; ch < nch; ++ch) { + if (allocation[ch][sb]) + scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2); + } + } + + /* check CRC word */ + + if (header->flags & MAD_FLAG_PROTECTION) { + header->crc_check = + mad_bit_crc(start, mad_bit_length(&start, &stream->ptr), + header->crc_check); + + if (header->crc_check != header->crc_target && + !(frame->options & MAD_OPTION_IGNORECRC)) { + stream->error = MAD_ERROR_BADCRC; + return -1; + } + } + + /* decode scalefactors */ + + for (sb = 0; sb < sblimit; ++sb) { + for (ch = 0; ch < nch; ++ch) { + if (allocation[ch][sb]) { + scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6); + + switch (scfsi[ch][sb]) { + case 2: + scalefactor[ch][sb][2] = + scalefactor[ch][sb][1] = + scalefactor[ch][sb][0]; + break; + + case 0: + scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6); + /* fall through */ + + case 1: + case 3: + scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6); + } + + if (scfsi[ch][sb] & 1) + scalefactor[ch][sb][1] = scalefactor[ch][sb][scfsi[ch][sb] - 1]; + +# if defined(OPT_STRICT) + /* + * Scalefactor index 63 does not appear in Table B.1 of + * ISO/IEC 11172-3. Nonetheless, other implementations accept it, + * so we only reject it if OPT_STRICT is defined. + */ + if (scalefactor[ch][sb][0] == 63 || + scalefactor[ch][sb][1] == 63 || + scalefactor[ch][sb][2] == 63) { + stream->error = MAD_ERROR_BADSCALEFACTOR; + return -1; + } +# endif + } + } + } + + /* decode samples */ + + for (gr = 0; gr < 12; ++gr) { + for (sb = 0; sb < bound; ++sb) { + for (ch = 0; ch < nch; ++ch) { + if ((index = allocation[ch][sb])) { + index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1]; + + II_samples(&stream->ptr, &qc_table[index], samples); + + for (s = 0; s < 3; ++s) { + frame->sbsample[ch][3 * gr + s][sb] = + mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]); + } + } + else { + for (s = 0; s < 3; ++s) + frame->sbsample[ch][3 * gr + s][sb] = 0; + } + } + } + + for (sb = bound; sb < sblimit; ++sb) { + if ((index = allocation[0][sb])) { + index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1]; + + II_samples(&stream->ptr, &qc_table[index], samples); + + for (ch = 0; ch < nch; ++ch) { + for (s = 0; s < 3; ++s) { + frame->sbsample[ch][3 * gr + s][sb] = + mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]); + } + } + } + else { + for (ch = 0; ch < nch; ++ch) { + for (s = 0; s < 3; ++s) + frame->sbsample[ch][3 * gr + s][sb] = 0; + } + } + } + + for (ch = 0; ch < nch; ++ch) { + for (s = 0; s < 3; ++s) { + for (sb = sblimit; sb < 32; ++sb) + frame->sbsample[ch][3 * gr + s][sb] = 0; + } + } + } + + return 0; +} diff --git a/cpymo-backends/nds/decoder/layer12.h b/cpymo-backends/nds/decoder/layer12.h new file mode 100644 index 00000000..e924ca13 --- /dev/null +++ b/cpymo-backends/nds/decoder/layer12.h @@ -0,0 +1,30 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifndef LIBMAD_LAYER12_H +# define LIBMAD_LAYER12_H + +# include "stream.h" +# include "frame.h" + +int mad_layer_I(struct mad_stream *, struct mad_frame *); +int mad_layer_II(struct mad_stream *, struct mad_frame *); + +# endif diff --git a/cpymo-backends/nds/decoder/layer3.c b/cpymo-backends/nds/decoder/layer3.c new file mode 100644 index 00000000..3462cc48 --- /dev/null +++ b/cpymo-backends/nds/decoder/layer3.c @@ -0,0 +1,2497 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif + +# include "global.h" + +# include +# include + +# ifdef HAVE_ASSERT_H +# include +# endif + +#include + +# include "fixed.h" +# include "bit.h" +# include "stream.h" +# include "frame.h" +# include "huffman.h" +# include "layer3.h" + +/* --- Layer III ----------------------------------------------------------- */ + +enum { + count1table_select = 0x01, + scalefac_scale = 0x02, + preflag = 0x04, + mixed_block_flag = 0x08 +}; + +enum { + I_STEREO = 0x1, + MS_STEREO = 0x2 +}; + +struct sideinfo { + u32 main_data_begin; + u32 private_bits; + + u8 scfsi[2]; + + struct granule { + struct channel { + /* from side info */ + u16 part2_3_length; + u16 big_values; + u16 global_gain; + u16 scalefac_compress; + + u8 flags; + u8 block_type; + u8 table_select[3]; + u8 subblock_gain[3]; + u8 region0_count; + u8 region1_count; + + /* from main_data */ + u8 scalefac[39]; /* scalefac_l and/or scalefac_s */ + } ch[2]; + } gr[2]; +}; + +/* + * scalefactor bit lengths + * derived from section 2.4.2.7 of ISO/IEC 11172-3 + */ +static +struct { + u8 slen1; + u8 slen2; +} const sflen_table[16] = { + { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 }, + { 3, 0 }, { 1, 1 }, { 1, 2 }, { 1, 3 }, + { 2, 1 }, { 2, 2 }, { 2, 3 }, { 3, 1 }, + { 3, 2 }, { 3, 3 }, { 4, 2 }, { 4, 3 } +}; + +/* + * number of LSF scalefactor band values + * derived from section 2.4.3.2 of ISO/IEC 13818-3 + */ +static +u8 const nsfb_table[6][3][4] = { + { { 6, 5, 5, 5 }, + { 9, 9, 9, 9 }, + { 6, 9, 9, 9 } }, + + { { 6, 5, 7, 3 }, + { 9, 9, 12, 6 }, + { 6, 9, 12, 6 } }, + + { { 11, 10, 0, 0 }, + { 18, 18, 0, 0 }, + { 15, 18, 0, 0 } }, + + { { 7, 7, 7, 0 }, + { 12, 12, 12, 0 }, + { 6, 15, 12, 0 } }, + + { { 6, 6, 6, 3 }, + { 12, 9, 9, 6 }, + { 6, 12, 9, 6 } }, + + { { 8, 8, 5, 0 }, + { 15, 12, 9, 0 }, + { 6, 18, 9, 0 } } +}; + +/* + * MPEG-1 scalefactor band widths + * derived from Table B.8 of ISO/IEC 11172-3 + */ +static +u8 const sfb_48000_long[] = { + 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 10, + 12, 16, 18, 22, 28, 34, 40, 46, 54, 54, 192 +}; + +static +u8 const sfb_44100_long[] = { + 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10, + 12, 16, 20, 24, 28, 34, 42, 50, 54, 76, 158 +}; + +static +u8 const sfb_32000_long[] = { + 4, 4, 4, 4, 4, 4, 6, 6, 8, 10, 12, + 16, 20, 24, 30, 38, 46, 56, 68, 84, 102, 26 +}; + +static +u8 const sfb_48000_short[] = { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, + 6, 6, 6, 6, 6, 10, 10, 10, 12, 12, 12, 14, 14, + 14, 16, 16, 16, 20, 20, 20, 26, 26, 26, 66, 66, 66 +}; + +static +u8 const sfb_44100_short[] = { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, + 6, 6, 8, 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, + 14, 18, 18, 18, 22, 22, 22, 30, 30, 30, 56, 56, 56 +}; + +static +u8 const sfb_32000_short[] = { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, + 6, 6, 8, 8, 8, 12, 12, 12, 16, 16, 16, 20, 20, + 20, 26, 26, 26, 34, 34, 34, 42, 42, 42, 12, 12, 12 +}; + +static +u8 const sfb_48000_mixed[] = { + /* long */ 4, 4, 4, 4, 4, 4, 6, 6, + /* short */ 4, 4, 4, 6, 6, 6, 6, 6, 6, 10, + 10, 10, 12, 12, 12, 14, 14, 14, 16, 16, + 16, 20, 20, 20, 26, 26, 26, 66, 66, 66 +}; + +static +u8 const sfb_44100_mixed[] = { + /* long */ 4, 4, 4, 4, 4, 4, 6, 6, + /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 10, + 10, 10, 12, 12, 12, 14, 14, 14, 18, 18, + 18, 22, 22, 22, 30, 30, 30, 56, 56, 56 +}; + +static +u8 const sfb_32000_mixed[] = { + /* long */ 4, 4, 4, 4, 4, 4, 6, 6, + /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 12, + 12, 12, 16, 16, 16, 20, 20, 20, 26, 26, + 26, 34, 34, 34, 42, 42, 42, 12, 12, 12 +}; + +/* + * MPEG-2 scalefactor band widths + * derived from Table B.2 of ISO/IEC 13818-3 + */ +static +u8 const sfb_24000_long[] = { + 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, + 18, 22, 26, 32, 38, 46, 54, 62, 70, 76, 36 +}; + +static +u8 const sfb_22050_long[] = { + 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, + 20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54 +}; + +# define sfb_16000_long sfb_22050_long + +static +u8 const sfb_24000_short[] = { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, + 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18, + 18, 24, 24, 24, 32, 32, 32, 44, 44, 44, 12, 12, 12 +}; + +static +u8 const sfb_22050_short[] = { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, + 6, 6, 8, 8, 8, 10, 10, 10, 14, 14, 14, 18, 18, + 18, 26, 26, 26, 32, 32, 32, 42, 42, 42, 18, 18, 18 +}; + +static +u8 const sfb_16000_short[] = { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, + 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18, + 18, 24, 24, 24, 30, 30, 30, 40, 40, 40, 18, 18, 18 +}; + +static +u8 const sfb_24000_mixed[] = { + /* long */ 6, 6, 6, 6, 6, 6, + /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12, + 12, 12, 14, 14, 14, 18, 18, 18, 24, 24, + 24, 32, 32, 32, 44, 44, 44, 12, 12, 12 +}; + +static +u8 const sfb_22050_mixed[] = { + /* long */ 6, 6, 6, 6, 6, 6, + /* short */ 6, 6, 6, 6, 6, 6, 8, 8, 8, 10, + 10, 10, 14, 14, 14, 18, 18, 18, 26, 26, + 26, 32, 32, 32, 42, 42, 42, 18, 18, 18 +}; + +static +u8 const sfb_16000_mixed[] = { + /* long */ 6, 6, 6, 6, 6, 6, + /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12, + 12, 12, 14, 14, 14, 18, 18, 18, 24, 24, + 24, 30, 30, 30, 40, 40, 40, 18, 18, 18 +}; + +/* + * MPEG 2.5 scalefactor band widths + * derived from public sources + */ +# define sfb_12000_long sfb_16000_long +# define sfb_11025_long sfb_12000_long + +static +u8 const sfb_8000_long[] = { + 12, 12, 12, 12, 12, 12, 16, 20, 24, 28, 32, + 40, 48, 56, 64, 76, 90, 2, 2, 2, 2, 2 +}; + +# define sfb_12000_short sfb_16000_short +# define sfb_11025_short sfb_12000_short + +static +u8 const sfb_8000_short[] = { + 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 16, + 16, 16, 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36, + 36, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26 +}; + +# define sfb_12000_mixed sfb_16000_mixed +# define sfb_11025_mixed sfb_12000_mixed + +/* the 8000 Hz short block scalefactor bands do not break after + the first 36 frequency lines, so this is probably wrong */ +static +u8 const sfb_8000_mixed[] = { + /* long */ 12, 12, 12, + /* short */ 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16, + 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36, 36, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26 +}; + +static +struct { + u8 const *l; + u8 const *s; + u8 const *m; +} const sfbwidth_table[9] = { + { sfb_48000_long, sfb_48000_short, sfb_48000_mixed }, + { sfb_44100_long, sfb_44100_short, sfb_44100_mixed }, + { sfb_32000_long, sfb_32000_short, sfb_32000_mixed }, + { sfb_24000_long, sfb_24000_short, sfb_24000_mixed }, + { sfb_22050_long, sfb_22050_short, sfb_22050_mixed }, + { sfb_16000_long, sfb_16000_short, sfb_16000_mixed }, + { sfb_12000_long, sfb_12000_short, sfb_12000_mixed }, + { sfb_11025_long, sfb_11025_short, sfb_11025_mixed }, + { sfb_8000_long, sfb_8000_short, sfb_8000_mixed } +}; + +/* + * scalefactor band preemphasis (used only when preflag is set) + * derived from Table B.6 of ISO/IEC 11172-3 + */ +static +u8 const pretab[22] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0 +}; + +/* + * table for requantization + * + * rq_table[x].mantissa * 2^(rq_table[x].exponent) = x^(4/3) + */ +static +struct fixedfloat { + u32 mantissa : 27; + u16 exponent : 5; +} const rq_table[8207] = { +# include "rq_table.dat" +}; + +/* + * fractional powers of two + * used for requantization and joint stereo decoding + * + * root_table[3 + x] = 2^(x/4) + */ +static +mad_fixed_t const root_table[7] = { + MAD_F(0x09837f05) /* 2^(-3/4) == 0.59460355750136 */, + MAD_F(0x0b504f33) /* 2^(-2/4) == 0.70710678118655 */, + MAD_F(0x0d744fcd) /* 2^(-1/4) == 0.84089641525371 */, + MAD_F(0x10000000) /* 2^( 0/4) == 1.00000000000000 */, + MAD_F(0x1306fe0a) /* 2^(+1/4) == 1.18920711500272 */, + MAD_F(0x16a09e66) /* 2^(+2/4) == 1.41421356237310 */, + MAD_F(0x1ae89f99) /* 2^(+3/4) == 1.68179283050743 */ +}; + +/* + * coefficients for aliasing reduction + * derived from Table B.9 of ISO/IEC 11172-3 + * + * c[] = { -0.6, -0.535, -0.33, -0.185, -0.095, -0.041, -0.0142, -0.0037 } + * cs[i] = 1 / sqrt(1 + c[i]^2) + * ca[i] = c[i] / sqrt(1 + c[i]^2) + */ +static +mad_fixed_t const cs[8] = { + +MAD_F(0x0db84a81) /* +0.857492926 */, +MAD_F(0x0e1b9d7f) /* +0.881741997 */, + +MAD_F(0x0f31adcf) /* +0.949628649 */, +MAD_F(0x0fbba815) /* +0.983314592 */, + +MAD_F(0x0feda417) /* +0.995517816 */, +MAD_F(0x0ffc8fc8) /* +0.999160558 */, + +MAD_F(0x0fff964c) /* +0.999899195 */, +MAD_F(0x0ffff8d3) /* +0.999993155 */ +}; + +static +mad_fixed_t const ca[8] = { + -MAD_F(0x083b5fe7) /* -0.514495755 */, -MAD_F(0x078c36d2) /* -0.471731969 */, + -MAD_F(0x05039814) /* -0.313377454 */, -MAD_F(0x02e91dd1) /* -0.181913200 */, + -MAD_F(0x0183603a) /* -0.094574193 */, -MAD_F(0x00a7cb87) /* -0.040965583 */, + -MAD_F(0x003a2847) /* -0.014198569 */, -MAD_F(0x000f27b4) /* -0.003699975 */ +}; + +/* + * IMDCT coefficients for short blocks + * derived from section 2.4.3.4.10.2 of ISO/IEC 11172-3 + * + * imdct_s[i/even][k] = cos((PI / 24) * (2 * (i / 2) + 7) * (2 * k + 1)) + * imdct_s[i /odd][k] = cos((PI / 24) * (2 * (6 + (i-1)/2) + 7) * (2 * k + 1)) + */ +static +mad_fixed_t const imdct_s[6][6] = { +# include "imdct_s.dat" +}; + +# if !defined(ASO_IMDCT) +/* + * windowing coefficients for long blocks + * derived from section 2.4.3.4.10.3 of ISO/IEC 11172-3 + * + * window_l[i] = sin((PI / 36) * (i + 1/2)) + */ +static +mad_fixed_t const window_l[36] = { + MAD_F(0x00b2aa3e) /* 0.043619387 */, MAD_F(0x0216a2a2) /* 0.130526192 */, + MAD_F(0x03768962) /* 0.216439614 */, MAD_F(0x04cfb0e2) /* 0.300705800 */, + MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x07635284) /* 0.461748613 */, + MAD_F(0x0898c779) /* 0.537299608 */, MAD_F(0x09bd7ca0) /* 0.608761429 */, + MAD_F(0x0acf37ad) /* 0.675590208 */, MAD_F(0x0bcbe352) /* 0.737277337 */, + MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x0d7e8807) /* 0.843391446 */, + + MAD_F(0x0e313245) /* 0.887010833 */, MAD_F(0x0ec835e8) /* 0.923879533 */, + MAD_F(0x0f426cb5) /* 0.953716951 */, MAD_F(0x0f9ee890) /* 0.976296007 */, + MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ffc19fd) /* 0.999048222 */, + MAD_F(0x0ffc19fd) /* 0.999048222 */, MAD_F(0x0fdcf549) /* 0.991444861 */, + MAD_F(0x0f9ee890) /* 0.976296007 */, MAD_F(0x0f426cb5) /* 0.953716951 */, + MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0e313245) /* 0.887010833 */, + + MAD_F(0x0d7e8807) /* 0.843391446 */, MAD_F(0x0cb19346) /* 0.793353340 */, + MAD_F(0x0bcbe352) /* 0.737277337 */, MAD_F(0x0acf37ad) /* 0.675590208 */, + MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0898c779) /* 0.537299608 */, + MAD_F(0x07635284) /* 0.461748613 */, MAD_F(0x061f78aa) /* 0.382683432 */, + MAD_F(0x04cfb0e2) /* 0.300705800 */, MAD_F(0x03768962) /* 0.216439614 */, + MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x00b2aa3e) /* 0.043619387 */, +}; +# endif /* ASO_IMDCT */ + +/* + * windowing coefficients for short blocks + * derived from section 2.4.3.4.10.3 of ISO/IEC 11172-3 + * + * window_s[i] = sin((PI / 12) * (i + 1/2)) + */ +static +mad_fixed_t const window_s[12] = { + MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x061f78aa) /* 0.382683432 */, + MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0cb19346) /* 0.793353340 */, + MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0fdcf549) /* 0.991444861 */, + MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ec835e8) /* 0.923879533 */, + MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x09bd7ca0) /* 0.608761429 */, + MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x0216a2a2) /* 0.130526192 */, +}; + +/* + * coefficients for intensity stereo processing + * derived from section 2.4.3.4.9.3 of ISO/IEC 11172-3 + * + * is_ratio[i] = tan(i * (PI / 12)) + * is_table[i] = is_ratio[i] / (1 + is_ratio[i]) + */ +static +mad_fixed_t const is_table[7] = { + MAD_F(0x00000000) /* 0.000000000 */, + MAD_F(0x0361962f) /* 0.211324865 */, + MAD_F(0x05db3d74) /* 0.366025404 */, + MAD_F(0x08000000) /* 0.500000000 */, + MAD_F(0x0a24c28c) /* 0.633974596 */, + MAD_F(0x0c9e69d1) /* 0.788675135 */, + MAD_F(0x10000000) /* 1.000000000 */ +}; + +/* + * coefficients for LSF intensity stereo processing + * derived from section 2.4.3.2 of ISO/IEC 13818-3 + * + * is_lsf_table[0][i] = (1 / sqrt(sqrt(2)))^(i + 1) + * is_lsf_table[1][i] = (1 / sqrt(2)) ^(i + 1) + */ +static +mad_fixed_t const is_lsf_table[2][15] = { + { + MAD_F(0x0d744fcd) /* 0.840896415 */, + MAD_F(0x0b504f33) /* 0.707106781 */, + MAD_F(0x09837f05) /* 0.594603558 */, + MAD_F(0x08000000) /* 0.500000000 */, + MAD_F(0x06ba27e6) /* 0.420448208 */, + MAD_F(0x05a8279a) /* 0.353553391 */, + MAD_F(0x04c1bf83) /* 0.297301779 */, + MAD_F(0x04000000) /* 0.250000000 */, + MAD_F(0x035d13f3) /* 0.210224104 */, + MAD_F(0x02d413cd) /* 0.176776695 */, + MAD_F(0x0260dfc1) /* 0.148650889 */, + MAD_F(0x02000000) /* 0.125000000 */, + MAD_F(0x01ae89fa) /* 0.105112052 */, + MAD_F(0x016a09e6) /* 0.088388348 */, + MAD_F(0x01306fe1) /* 0.074325445 */ + }, { + MAD_F(0x0b504f33) /* 0.707106781 */, + MAD_F(0x08000000) /* 0.500000000 */, + MAD_F(0x05a8279a) /* 0.353553391 */, + MAD_F(0x04000000) /* 0.250000000 */, + MAD_F(0x02d413cd) /* 0.176776695 */, + MAD_F(0x02000000) /* 0.125000000 */, + MAD_F(0x016a09e6) /* 0.088388348 */, + MAD_F(0x01000000) /* 0.062500000 */, + MAD_F(0x00b504f3) /* 0.044194174 */, + MAD_F(0x00800000) /* 0.031250000 */, + MAD_F(0x005a827a) /* 0.022097087 */, + MAD_F(0x00400000) /* 0.015625000 */, + MAD_F(0x002d413d) /* 0.011048543 */, + MAD_F(0x00200000) /* 0.007812500 */, + MAD_F(0x0016a09e) /* 0.005524272 */ + } +}; + +/* + * NAME: III_sideinfo() + * DESCRIPTION: decode frame side information from a bitstream + */ +static +enum mad_error III_sideinfo(struct mad_bitptr *ptr, u32 nch, + s32 lsf, struct sideinfo *si, + u32 *data_bitlen, + u32 *priv_bitlen) +{ + u32 ngr, gr, ch, i; + enum mad_error result = MAD_ERROR_NONE; + + *data_bitlen = 0; + *priv_bitlen = lsf ? ((nch == 1) ? 1 : 2) : ((nch == 1) ? 5 : 3); + + si->main_data_begin = mad_bit_read(ptr, lsf ? 8 : 9); + si->private_bits = mad_bit_read(ptr, *priv_bitlen); + + ngr = 1; + if (!lsf) { + ngr = 2; + + for (ch = 0; ch < nch; ++ch) + si->scfsi[ch] = mad_bit_read(ptr, 4); + } + + for (gr = 0; gr < ngr; ++gr) { + struct granule *granule = &si->gr[gr]; + + for (ch = 0; ch < nch; ++ch) { + struct channel *channel = &granule->ch[ch]; + + channel->part2_3_length = mad_bit_read(ptr, 12); + channel->big_values = mad_bit_read(ptr, 9); + channel->global_gain = mad_bit_read(ptr, 8); + channel->scalefac_compress = mad_bit_read(ptr, lsf ? 9 : 4); + + *data_bitlen += channel->part2_3_length; + + if (channel->big_values > 288 && result == 0) + result = MAD_ERROR_BADBIGVALUES; + + channel->flags = 0; + + /* window_switching_flag */ + if (mad_bit_read(ptr, 1)) { + channel->block_type = mad_bit_read(ptr, 2); + + if (channel->block_type == 0 && result == 0) + result = MAD_ERROR_BADBLOCKTYPE; + + if (!lsf && channel->block_type == 2 && si->scfsi[ch] && result == 0) + result = MAD_ERROR_BADSCFSI; + + channel->region0_count = 7; + channel->region1_count = 36; + + if (mad_bit_read(ptr, 1)) + channel->flags |= mixed_block_flag; + else if (channel->block_type == 2) + channel->region0_count = 8; + + for (i = 0; i < 2; ++i) + channel->table_select[i] = mad_bit_read(ptr, 5); + +# if defined(DEBUG) + channel->table_select[2] = 4; /* not used */ +# endif + + for (i = 0; i < 3; ++i) + channel->subblock_gain[i] = mad_bit_read(ptr, 3); + } + else { + channel->block_type = 0; + + for (i = 0; i < 3; ++i) + channel->table_select[i] = mad_bit_read(ptr, 5); + + channel->region0_count = mad_bit_read(ptr, 4); + channel->region1_count = mad_bit_read(ptr, 3); + } + + /* [preflag,] scalefac_scale, count1table_select */ + channel->flags |= mad_bit_read(ptr, lsf ? 2 : 3); + } + } + + return result; +} + +/* + * NAME: III_scalefactors_lsf() + * DESCRIPTION: decode channel scalefactors for LSF from a bitstream + */ +static +u32 III_scalefactors_lsf(struct mad_bitptr *ptr, + struct channel *channel, + struct channel *gr1ch, s32 mode_extension) +{ + struct mad_bitptr start; + u32 scalefac_compress, index, slen[4], part, n, i; + u8 const *nsfb; + + start = *ptr; + + scalefac_compress = channel->scalefac_compress; + index = (channel->block_type == 2) ? + ((channel->flags & mixed_block_flag) ? 2 : 1) : 0; + + if (!((mode_extension & I_STEREO) && gr1ch)) { + if (scalefac_compress < 400) { + slen[0] = (scalefac_compress >> 4) / 5; + slen[1] = (scalefac_compress >> 4) % 5; + slen[2] = (scalefac_compress % 16) >> 2; + slen[3] = scalefac_compress % 4; + + nsfb = nsfb_table[0][index]; + } + else if (scalefac_compress < 500) { + scalefac_compress -= 400; + + slen[0] = (scalefac_compress >> 2) / 5; + slen[1] = (scalefac_compress >> 2) % 5; + slen[2] = scalefac_compress % 4; + slen[3] = 0; + + nsfb = nsfb_table[1][index]; + } + else { + scalefac_compress -= 500; + + slen[0] = scalefac_compress / 3; + slen[1] = scalefac_compress % 3; + slen[2] = 0; + slen[3] = 0; + + channel->flags |= preflag; + + nsfb = nsfb_table[2][index]; + } + + n = 0; + for (part = 0; part < 4; ++part) { + for (i = 0; i < nsfb[part]; ++i) + channel->scalefac[n++] = mad_bit_read(ptr, slen[part]); + } + + while (n < 39) + channel->scalefac[n++] = 0; + } + else { /* (mode_extension & I_STEREO) && gr1ch (i.e. ch == 1) */ + scalefac_compress >>= 1; + + if (scalefac_compress < 180) { + slen[0] = scalefac_compress / 36; + slen[1] = (scalefac_compress % 36) / 6; + slen[2] = (scalefac_compress % 36) % 6; + slen[3] = 0; + + nsfb = nsfb_table[3][index]; + } + else if (scalefac_compress < 244) { + scalefac_compress -= 180; + + slen[0] = (scalefac_compress % 64) >> 4; + slen[1] = (scalefac_compress % 16) >> 2; + slen[2] = scalefac_compress % 4; + slen[3] = 0; + + nsfb = nsfb_table[4][index]; + } + else { + scalefac_compress -= 244; + + slen[0] = scalefac_compress / 3; + slen[1] = scalefac_compress % 3; + slen[2] = 0; + slen[3] = 0; + + nsfb = nsfb_table[5][index]; + } + + n = 0; + for (part = 0; part < 4; ++part) { + u32 max, is_pos; + + max = (1 << slen[part]) - 1; + + for (i = 0; i < nsfb[part]; ++i) { + is_pos = mad_bit_read(ptr, slen[part]); + + channel->scalefac[n] = is_pos; + gr1ch->scalefac[n++] = (is_pos == max); + } + } + + while (n < 39) { + channel->scalefac[n] = 0; + gr1ch->scalefac[n++] = 0; /* apparently not illegal */ + } + } + + return mad_bit_length(&start, ptr); +} + +/* + * NAME: III_scalefactors() + * DESCRIPTION: decode channel scalefactors of one granule from a bitstream + */ +static +u32 III_scalefactors(struct mad_bitptr *ptr, struct channel *channel, + struct channel const *gr0ch, u32 scfsi) +{ + struct mad_bitptr start; + u32 slen1, slen2, sfbi; + + start = *ptr; + + slen1 = sflen_table[channel->scalefac_compress].slen1; + slen2 = sflen_table[channel->scalefac_compress].slen2; + + if (channel->block_type == 2) { + u32 nsfb; + + sfbi = 0; + + nsfb = (channel->flags & mixed_block_flag) ? 8 + 3 * 3 : 6 * 3; + while (nsfb--) + channel->scalefac[sfbi++] = mad_bit_read(ptr, slen1); + + nsfb = 6 * 3; + while (nsfb--) + channel->scalefac[sfbi++] = mad_bit_read(ptr, slen2); + + nsfb = 1 * 3; + while (nsfb--) + channel->scalefac[sfbi++] = 0; + } + else { /* channel->block_type != 2 */ + if (scfsi & 0x8) { + for (sfbi = 0; sfbi < 6; ++sfbi) + channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; + } + else { + for (sfbi = 0; sfbi < 6; ++sfbi) + channel->scalefac[sfbi] = mad_bit_read(ptr, slen1); + } + + if (scfsi & 0x4) { + for (sfbi = 6; sfbi < 11; ++sfbi) + channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; + } + else { + for (sfbi = 6; sfbi < 11; ++sfbi) + channel->scalefac[sfbi] = mad_bit_read(ptr, slen1); + } + + if (scfsi & 0x2) { + for (sfbi = 11; sfbi < 16; ++sfbi) + channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; + } + else { + for (sfbi = 11; sfbi < 16; ++sfbi) + channel->scalefac[sfbi] = mad_bit_read(ptr, slen2); + } + + if (scfsi & 0x1) { + for (sfbi = 16; sfbi < 21; ++sfbi) + channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; + } + else { + for (sfbi = 16; sfbi < 21; ++sfbi) + channel->scalefac[sfbi] = mad_bit_read(ptr, slen2); + } + + channel->scalefac[21] = 0; + } + + return mad_bit_length(&start, ptr); +} + +/* + * The Layer III formula for requantization and scaling is defined by + * section 2.4.3.4.7.1 of ISO/IEC 11172-3, as follows: + * + * long blocks: + * xr[i] = sign(is[i]) * abs(is[i])^(4/3) * + * 2^((1/4) * (global_gain - 210)) * + * 2^-(scalefac_multiplier * + * (scalefac_l[sfb] + preflag * pretab[sfb])) + * + * short blocks: + * xr[i] = sign(is[i]) * abs(is[i])^(4/3) * + * 2^((1/4) * (global_gain - 210 - 8 * subblock_gain[w])) * + * 2^-(scalefac_multiplier * scalefac_s[sfb][w]) + * + * where: + * scalefac_multiplier = (scalefac_scale + 1) / 2 + * + * The routines III_exponents() and III_requantize() facilitate this + * calculation. + */ + +/* + * NAME: III_exponents() + * DESCRIPTION: calculate scalefactor exponents + */ +static +void III_exponents(struct channel const *channel, + u8 const *sfbwidth, s32 exponents[39]) +{ + s32 gain; + u32 scalefac_multiplier, sfbi; + + gain = (s32) channel->global_gain - 210; + scalefac_multiplier = (channel->flags & scalefac_scale) ? 2 : 1; + + if (channel->block_type == 2) { + u32 l; + s32 gain0, gain1, gain2; + + sfbi = l = 0; + + if (channel->flags & mixed_block_flag) { + u32 premask; + + premask = (channel->flags & preflag) ? ~0 : 0; + + /* long block subbands 0-1 */ + + while (l < 36) { + exponents[sfbi] = gain - + (s32) ((channel->scalefac[sfbi] + (pretab[sfbi] & premask)) << + scalefac_multiplier); + + l += sfbwidth[sfbi++]; + } + } + + /* this is probably wrong for 8000 Hz short/mixed blocks */ + + gain0 = gain - 8 * (s32) channel->subblock_gain[0]; + gain1 = gain - 8 * (s32) channel->subblock_gain[1]; + gain2 = gain - 8 * (s32) channel->subblock_gain[2]; + + while (l < 576) { + exponents[sfbi + 0] = gain0 - + (s32) (channel->scalefac[sfbi + 0] << scalefac_multiplier); + exponents[sfbi + 1] = gain1 - + (s32) (channel->scalefac[sfbi + 1] << scalefac_multiplier); + exponents[sfbi + 2] = gain2 - + (s32) (channel->scalefac[sfbi + 2] << scalefac_multiplier); + + l += 3 * sfbwidth[sfbi]; + sfbi += 3; + } + } + else { /* channel->block_type != 2 */ + if (channel->flags & preflag) { + for (sfbi = 0; sfbi < 22; ++sfbi) { + exponents[sfbi] = gain - + (s32) ((channel->scalefac[sfbi] + pretab[sfbi]) << + scalefac_multiplier); + } + } + else { + for (sfbi = 0; sfbi < 22; ++sfbi) { + exponents[sfbi] = gain - + (s32) (channel->scalefac[sfbi] << scalefac_multiplier); + } + } + } +} + +/* + * NAME: III_requantize() + * DESCRIPTION: requantize one (positive) value + */ +static +mad_fixed_t III_requantize(u32 value, s32 exp) +{ + mad_fixed_t requantized; + s32 frac; + struct fixedfloat const *power; + + frac = exp % 4; /* assumes sign(frac) == sign(exp) */ + exp /= 4; + + power = &rq_table[value]; + requantized = power->mantissa; + exp += power->exponent; + + if (exp < 0) { + if (-exp >= sizeof(mad_fixed_t) * CHAR_BIT) { + /* underflow */ + requantized = 0; + } + else { + requantized += 1L << (-exp - 1); + requantized >>= -exp; + } + } + else { + if (exp >= 5) { + /* overflow */ +# if defined(DEBUG) + fprintf(stderr, "requantize overflow (%f * 2^%d)\n", + mad_f_todouble(requantized), exp); +# endif + requantized = MAD_F_MAX; + } + else + requantized <<= exp; + } + + return frac ? mad_f_mul(requantized, root_table[3 + frac]) : requantized; +} + +/* we must take care that sz >= bits and sz < sizeof(long) lest bits == 0 */ +# define MASK(cache, sz, bits) \ + (((cache) >> ((sz) - (bits))) & ((1 << (bits)) - 1)) +# define MASK1BIT(cache, sz) \ + ((cache) & (1 << ((sz) - 1))) + +/* + * NAME: III_huffdecode() + * DESCRIPTION: decode Huffman code words of one channel of one granule + */ +static +enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xr[576], + struct channel *channel, + u8 const *sfbwidth, + u32 part2_length) +{ + s32 exponents[39], exp; + s32 const *expptr; + struct mad_bitptr peek; + s32 bits_left, cachesz; + register mad_fixed_t *xrptr; + mad_fixed_t const *sfbound; + register u32 bitcache; + + bits_left = (signed) channel->part2_3_length - (signed) part2_length; + if (bits_left < 0) + return MAD_ERROR_BADPART3LEN; + + III_exponents(channel, sfbwidth, exponents); + + peek = *ptr; + mad_bit_skip(ptr, bits_left); + + /* align bit reads to byte boundaries */ + cachesz = mad_bit_bitsleft(&peek); + cachesz += ((32 - 1 - 24) + (24 - cachesz)) & ~7; + + bitcache = mad_bit_read(&peek, cachesz); + bits_left -= cachesz; + + xrptr = &xr[0]; + + /* big_values */ + { + u32 region, rcount; + struct hufftable const *entry; + union huffpair const *table; + u32 linbits, startbits, big_values, reqhits; + mad_fixed_t reqcache[16]; + + sfbound = xrptr + *sfbwidth++; + rcount = channel->region0_count + 1; + + entry = &mad_huff_pair_table[channel->table_select[region = 0]]; + table = entry->table; + linbits = entry->linbits; + startbits = entry->startbits; + + if (table == 0) + return MAD_ERROR_BADHUFFTABLE; + + expptr = &exponents[0]; + exp = *expptr++; + reqhits = 0; + + big_values = channel->big_values; + + while (big_values-- && cachesz + bits_left > 0) { + union huffpair const *pair; + u32 clumpsz, value; + register mad_fixed_t requantized; + + if (xrptr == sfbound) { + sfbound += *sfbwidth++; + + /* change table if region boundary */ + + if (--rcount == 0) { + if (region == 0) + rcount = channel->region1_count + 1; + else + rcount = 0; /* all remaining */ + + entry = &mad_huff_pair_table[channel->table_select[++region]]; + table = entry->table; + linbits = entry->linbits; + startbits = entry->startbits; + + if (table == 0) + return MAD_ERROR_BADHUFFTABLE; + } + + if (exp != *expptr) { + exp = *expptr; + reqhits = 0; + } + + ++expptr; + } + + if (cachesz < 21) { + u32 bits; + + bits = ((32 - 1 - 21) + (21 - cachesz)) & ~7; + bitcache = (bitcache << bits) | mad_bit_read(&peek, bits); + cachesz += bits; + bits_left -= bits; + } + + /* hcod (0..19) */ + + clumpsz = startbits; + pair = &table[MASK(bitcache, cachesz, clumpsz)]; + + while (!pair->final) { + cachesz -= clumpsz; + + clumpsz = pair->ptr.bits; + pair = &table[pair->ptr.offset + MASK(bitcache, cachesz, clumpsz)]; + } + + cachesz -= pair->value.hlen; + + if (linbits) { + /* x (0..14) */ + + value = pair->value.x; + + switch (value) { + case 0: + xrptr[0] = 0; + break; + + case 15: + if (cachesz < linbits + 2) { + bitcache = (bitcache << 16) | mad_bit_read(&peek, 16); + cachesz += 16; + bits_left -= 16; + } + + value += MASK(bitcache, cachesz, linbits); + cachesz -= linbits; + + requantized = III_requantize(value, exp); + goto x_final; + + default: + if (reqhits & (1 << value)) + requantized = reqcache[value]; + else { + reqhits |= (1 << value); + requantized = reqcache[value] = III_requantize(value, exp); + } + + x_final: + xrptr[0] = MASK1BIT(bitcache, cachesz--) ? + -requantized : requantized; + } + + /* y (0..14) */ + + value = pair->value.y; + + switch (value) { + case 0: + xrptr[1] = 0; + break; + + case 15: + if (cachesz < linbits + 1) { + bitcache = (bitcache << 16) | mad_bit_read(&peek, 16); + cachesz += 16; + bits_left -= 16; + } + + value += MASK(bitcache, cachesz, linbits); + cachesz -= linbits; + + requantized = III_requantize(value, exp); + goto y_final; + + default: + if (reqhits & (1 << value)) + requantized = reqcache[value]; + else { + reqhits |= (1 << value); + requantized = reqcache[value] = III_requantize(value, exp); + } + + y_final: + xrptr[1] = MASK1BIT(bitcache, cachesz--) ? + -requantized : requantized; + } + } + else { + /* x (0..1) */ + + value = pair->value.x; + + if (value == 0) + xrptr[0] = 0; + else { + if (reqhits & (1 << value)) + requantized = reqcache[value]; + else { + reqhits |= (1 << value); + requantized = reqcache[value] = III_requantize(value, exp); + } + + xrptr[0] = MASK1BIT(bitcache, cachesz--) ? + -requantized : requantized; + } + + /* y (0..1) */ + + value = pair->value.y; + + if (value == 0) + xrptr[1] = 0; + else { + if (reqhits & (1 << value)) + requantized = reqcache[value]; + else { + reqhits |= (1 << value); + requantized = reqcache[value] = III_requantize(value, exp); + } + + xrptr[1] = MASK1BIT(bitcache, cachesz--) ? + -requantized : requantized; + } + } + + xrptr += 2; + } + } + + if (cachesz + bits_left < 0) + return MAD_ERROR_BADHUFFDATA; /* big_values overrun */ + + /* count1 */ + { + union huffquad const *table; + register mad_fixed_t requantized; + + table = mad_huff_quad_table[channel->flags & count1table_select]; + + requantized = III_requantize(1, exp); + + while (cachesz + bits_left > 0 && xrptr <= &xr[572]) { + union huffquad const *quad; + + /* hcod (1..6) */ + + if (cachesz < 10) { + bitcache = (bitcache << 16) | mad_bit_read(&peek, 16); + cachesz += 16; + bits_left -= 16; + } + + quad = &table[MASK(bitcache, cachesz, 4)]; + + /* quad tables guaranteed to have at most one extra lookup */ + if (!quad->final) { + cachesz -= 4; + + quad = &table[quad->ptr.offset + + MASK(bitcache, cachesz, quad->ptr.bits)]; + } + + cachesz -= quad->value.hlen; + + if (xrptr == sfbound) { + sfbound += *sfbwidth++; + + if (exp != *expptr) { + exp = *expptr; + requantized = III_requantize(1, exp); + } + + ++expptr; + } + + /* v (0..1) */ + + xrptr[0] = quad->value.v ? + (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; + + /* w (0..1) */ + + xrptr[1] = quad->value.w ? + (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; + + xrptr += 2; + + if (xrptr == sfbound) { + sfbound += *sfbwidth++; + + if (exp != *expptr) { + exp = *expptr; + requantized = III_requantize(1, exp); + } + + ++expptr; + } + + /* x (0..1) */ + + xrptr[0] = quad->value.x ? + (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; + + /* y (0..1) */ + + xrptr[1] = quad->value.y ? + (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; + + xrptr += 2; + } + + if (cachesz + bits_left < 0) { +# if 0 && defined(DEBUG) + fprintf(stderr, "huffman count1 overrun (%d bits)\n", + -(cachesz + bits_left)); +# endif + + /* technically the bitstream is misformatted, but apparently + some encoders are just a bit sloppy with stuffing bits */ + + xrptr -= 4; + } + } + + assert(-bits_left <= MAD_BUFFER_GUARD * CHAR_BIT); + +# if 0 && defined(DEBUG) + if (bits_left < 0) + fprintf(stderr, "read %d bits too many\n", -bits_left); + else if (cachesz + bits_left > 0) + fprintf(stderr, "%d stuffing bits\n", cachesz + bits_left); +# endif + + /* rzero */ + while (xrptr < &xr[576]) { + xrptr[0] = 0; + xrptr[1] = 0; + + xrptr += 2; + } + + return MAD_ERROR_NONE; +} + +# undef MASK +# undef MASK1BIT + +/* + * NAME: III_reorder() + * DESCRIPTION: reorder frequency lines of a short block into subband order + */ +static +void III_reorder(mad_fixed_t xr[576], struct channel const *channel, + u8 const sfbwidth[39]) +{ + mad_fixed_t tmp[32][3][6]; + u32 sb, l, f, w, sbw[3], sw[3]; + + /* this is probably wrong for 8000 Hz mixed blocks */ + + sb = 0; + if (channel->flags & mixed_block_flag) { + sb = 2; + + l = 0; + while (l < 36) + l += *sfbwidth++; + } + + for (w = 0; w < 3; ++w) { + sbw[w] = sb; + sw[w] = 0; + } + + f = *sfbwidth++; + w = 0; + + for (l = 18 * sb; l < 576; ++l) { + if (f-- == 0) { + f = *sfbwidth++ - 1; + w = (w + 1) % 3; + } + + tmp[sbw[w]][w][sw[w]++] = xr[l]; + + if (sw[w] == 6) { + sw[w] = 0; + ++sbw[w]; + } + } + + memcpy(&xr[18 * sb], &tmp[sb], (576 - 18 * sb) * sizeof(mad_fixed_t)); +} + +/* + * NAME: III_stereo() + * DESCRIPTION: perform joint stereo processing on a granule + */ +static +enum mad_error III_stereo(mad_fixed_t xr[2][576], + struct granule const *granule, + struct mad_header *header, + u8 const *sfbwidth) +{ + s16 modes[39]; + u32 sfbi, l, n, i; + + if (granule->ch[0].block_type != + granule->ch[1].block_type || + (granule->ch[0].flags & mixed_block_flag) != + (granule->ch[1].flags & mixed_block_flag)) + return MAD_ERROR_BADSTEREO; + + for (i = 0; i < 39; ++i) + modes[i] = header->mode_extension; + + /* intensity stereo */ + + if (header->mode_extension & I_STEREO) { + struct channel const *right_ch = &granule->ch[1]; + mad_fixed_t const *right_xr = xr[1]; + u32 is_pos; + + header->flags |= MAD_FLAG_I_STEREO; + + /* first determine which scalefactor bands are to be processed */ + + if (right_ch->block_type == 2) { + u32 lower, start, max, bound[3], w; + + lower = start = max = bound[0] = bound[1] = bound[2] = 0; + + sfbi = l = 0; + + if (right_ch->flags & mixed_block_flag) { + while (l < 36) { + n = sfbwidth[sfbi++]; + + for (i = 0; i < n; ++i) { + if (right_xr[i]) { + lower = sfbi; + break; + } + } + + right_xr += n; + l += n; + } + + start = sfbi; + } + + w = 0; + while (l < 576) { + n = sfbwidth[sfbi++]; + + for (i = 0; i < n; ++i) { + if (right_xr[i]) { + max = bound[w] = sfbi; + break; + } + } + + right_xr += n; + l += n; + w = (w + 1) % 3; + } + + if (max) + lower = start; + + /* long blocks */ + + for (i = 0; i < lower; ++i) + modes[i] = header->mode_extension & ~I_STEREO; + + /* short blocks */ + + w = 0; + for (i = start; i < max; ++i) { + if (i < bound[w]) + modes[i] = header->mode_extension & ~I_STEREO; + + w = (w + 1) % 3; + } + } + else { /* right_ch->block_type != 2 */ + u32 bound; + + bound = 0; + for (sfbi = l = 0; l < 576; l += n) { + n = sfbwidth[sfbi++]; + + for (i = 0; i < n; ++i) { + if (right_xr[i]) { + bound = sfbi; + break; + } + } + + right_xr += n; + } + + for (i = 0; i < bound; ++i) + modes[i] = header->mode_extension & ~I_STEREO; + } + + /* now do the actual processing */ + + if (header->flags & MAD_FLAG_LSF_EXT) { + u8 const *illegal_pos = granule[1].ch[1].scalefac; + mad_fixed_t const *lsf_scale; + + /* intensity_scale */ + lsf_scale = is_lsf_table[right_ch->scalefac_compress & 0x1]; + + for (sfbi = l = 0; l < 576; ++sfbi, l += n) { + n = sfbwidth[sfbi]; + + if (!(modes[sfbi] & I_STEREO)) + continue; + + if (illegal_pos[sfbi]) { + modes[sfbi] &= ~I_STEREO; + continue; + } + + is_pos = right_ch->scalefac[sfbi]; + + for (i = 0; i < n; ++i) { + register mad_fixed_t left; + + left = xr[0][l + i]; + + if (is_pos == 0) + xr[1][l + i] = left; + else { + register mad_fixed_t opposite; + + opposite = mad_f_mul(left, lsf_scale[(is_pos - 1) / 2]); + + if (is_pos & 1) { + xr[0][l + i] = opposite; + xr[1][l + i] = left; + } + else + xr[1][l + i] = opposite; + } + } + } + } + else { /* !(header->flags & MAD_FLAG_LSF_EXT) */ + for (sfbi = l = 0; l < 576; ++sfbi, l += n) { + n = sfbwidth[sfbi]; + + if (!(modes[sfbi] & I_STEREO)) + continue; + + is_pos = right_ch->scalefac[sfbi]; + + if (is_pos >= 7) { /* illegal intensity position */ + modes[sfbi] &= ~I_STEREO; + continue; + } + + for (i = 0; i < n; ++i) { + register mad_fixed_t left; + + left = xr[0][l + i]; + + xr[0][l + i] = mad_f_mul(left, is_table[ is_pos]); + xr[1][l + i] = mad_f_mul(left, is_table[6 - is_pos]); + } + } + } + } + + /* middle/side stereo */ + + if (header->mode_extension & MS_STEREO) { + register mad_fixed_t invsqrt2; + + header->flags |= MAD_FLAG_MS_STEREO; + + invsqrt2 = root_table[3 + -2]; + + for (sfbi = l = 0; l < 576; ++sfbi, l += n) { + n = sfbwidth[sfbi]; + + if (modes[sfbi] != MS_STEREO) + continue; + + for (i = 0; i < n; ++i) { + register mad_fixed_t m, s; + + m = xr[0][l + i]; + s = xr[1][l + i]; + + xr[0][l + i] = mad_f_mul(m + s, invsqrt2); /* l = (m + s) / sqrt(2) */ + xr[1][l + i] = mad_f_mul(m - s, invsqrt2); /* r = (m - s) / sqrt(2) */ + } + } + } + + return MAD_ERROR_NONE; +} + +/* + * NAME: III_aliasreduce() + * DESCRIPTION: perform frequency line alias reduction + */ +static +void III_aliasreduce(mad_fixed_t xr[576], s32 lines) +{ + mad_fixed_t const *bound; + s32 i; + + bound = &xr[lines]; + for (xr += 18; xr < bound; xr += 18) { + for (i = 0; i < 8; ++i) { + register mad_fixed_t a, b; + register mad_fixed64hi_t hi; + register mad_fixed64lo_t lo; + + a = xr[-1 - i]; + b = xr[ i]; + +# if defined(ASO_ZEROCHECK) + if (a | b) { +# endif + MAD_F_ML0(hi, lo, a, cs[i]); + MAD_F_MLA(hi, lo, -b, ca[i]); + + xr[-1 - i] = MAD_F_MLZ(hi, lo); + + MAD_F_ML0(hi, lo, b, cs[i]); + MAD_F_MLA(hi, lo, a, ca[i]); + + xr[ i] = MAD_F_MLZ(hi, lo); +# if defined(ASO_ZEROCHECK) + } +# endif + } + } +} + +# if defined(ASO_IMDCT) +void III_imdct_l(mad_fixed_t const [18], mad_fixed_t [36], u32); +# else +/* + * NAME: imdct36 + * DESCRIPTION: perform X[18]->x[36] IMDCT + */ +static inline +void imdct36(mad_fixed_t const X[18], mad_fixed_t x[36]) +{ + mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7; + mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15; + register mad_fixed64hi_t hi; + register mad_fixed64lo_t lo; + + MAD_F_ML0(hi, lo, X[4], MAD_F(0x0ec835e8)); + MAD_F_MLA(hi, lo, X[13], MAD_F(0x061f78aa)); + + t6 = MAD_F_MLZ(hi, lo); + + MAD_F_MLA(hi, lo, (t14 = X[1] - X[10]), -MAD_F(0x061f78aa)); + MAD_F_MLA(hi, lo, (t15 = X[7] + X[16]), -MAD_F(0x0ec835e8)); + + t0 = MAD_F_MLZ(hi, lo); + + MAD_F_MLA(hi, lo, (t8 = X[0] - X[11] - X[12]), MAD_F(0x0216a2a2)); + MAD_F_MLA(hi, lo, (t9 = X[2] - X[9] - X[14]), MAD_F(0x09bd7ca0)); + MAD_F_MLA(hi, lo, (t10 = X[3] - X[8] - X[15]), -MAD_F(0x0cb19346)); + MAD_F_MLA(hi, lo, (t11 = X[5] - X[6] - X[17]), -MAD_F(0x0fdcf549)); + + x[7] = MAD_F_MLZ(hi, lo); + x[10] = -x[7]; + + MAD_F_ML0(hi, lo, t8, -MAD_F(0x0cb19346)); + MAD_F_MLA(hi, lo, t9, MAD_F(0x0fdcf549)); + MAD_F_MLA(hi, lo, t10, MAD_F(0x0216a2a2)); + MAD_F_MLA(hi, lo, t11, -MAD_F(0x09bd7ca0)); + + x[19] = x[34] = MAD_F_MLZ(hi, lo) - t0; + + t12 = X[0] - X[3] + X[8] - X[11] - X[12] + X[15]; + t13 = X[2] + X[5] - X[6] - X[9] - X[14] - X[17]; + + MAD_F_ML0(hi, lo, t12, -MAD_F(0x0ec835e8)); + MAD_F_MLA(hi, lo, t13, MAD_F(0x061f78aa)); + + x[22] = x[31] = MAD_F_MLZ(hi, lo) + t0; + + MAD_F_ML0(hi, lo, X[1], -MAD_F(0x09bd7ca0)); + MAD_F_MLA(hi, lo, X[7], MAD_F(0x0216a2a2)); + MAD_F_MLA(hi, lo, X[10], -MAD_F(0x0fdcf549)); + MAD_F_MLA(hi, lo, X[16], MAD_F(0x0cb19346)); + + t1 = MAD_F_MLZ(hi, lo) + t6; + + MAD_F_ML0(hi, lo, X[0], MAD_F(0x03768962)); + MAD_F_MLA(hi, lo, X[2], MAD_F(0x0e313245)); + MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0ffc19fd)); + MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0acf37ad)); + MAD_F_MLA(hi, lo, X[6], MAD_F(0x04cfb0e2)); + MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0898c779)); + MAD_F_MLA(hi, lo, X[9], MAD_F(0x0d7e8807)); + MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f426cb5)); + MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0bcbe352)); + MAD_F_MLA(hi, lo, X[14], MAD_F(0x00b2aa3e)); + MAD_F_MLA(hi, lo, X[15], -MAD_F(0x07635284)); + MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0f9ee890)); + + x[6] = MAD_F_MLZ(hi, lo) + t1; + x[11] = -x[6]; + + MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f426cb5)); + MAD_F_MLA(hi, lo, X[2], -MAD_F(0x00b2aa3e)); + MAD_F_MLA(hi, lo, X[3], MAD_F(0x0898c779)); + MAD_F_MLA(hi, lo, X[5], MAD_F(0x0f9ee890)); + MAD_F_MLA(hi, lo, X[6], MAD_F(0x0acf37ad)); + MAD_F_MLA(hi, lo, X[8], -MAD_F(0x07635284)); + MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0e313245)); + MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0bcbe352)); + MAD_F_MLA(hi, lo, X[12], -MAD_F(0x03768962)); + MAD_F_MLA(hi, lo, X[14], MAD_F(0x0d7e8807)); + MAD_F_MLA(hi, lo, X[15], MAD_F(0x0ffc19fd)); + MAD_F_MLA(hi, lo, X[17], MAD_F(0x04cfb0e2)); + + x[23] = x[30] = MAD_F_MLZ(hi, lo) + t1; + + MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0bcbe352)); + MAD_F_MLA(hi, lo, X[2], MAD_F(0x0d7e8807)); + MAD_F_MLA(hi, lo, X[3], -MAD_F(0x07635284)); + MAD_F_MLA(hi, lo, X[5], MAD_F(0x04cfb0e2)); + MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f9ee890)); + MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0ffc19fd)); + MAD_F_MLA(hi, lo, X[9], -MAD_F(0x00b2aa3e)); + MAD_F_MLA(hi, lo, X[11], MAD_F(0x03768962)); + MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0f426cb5)); + MAD_F_MLA(hi, lo, X[14], MAD_F(0x0e313245)); + MAD_F_MLA(hi, lo, X[15], MAD_F(0x0898c779)); + MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0acf37ad)); + + x[18] = x[35] = MAD_F_MLZ(hi, lo) - t1; + + MAD_F_ML0(hi, lo, X[4], MAD_F(0x061f78aa)); + MAD_F_MLA(hi, lo, X[13], -MAD_F(0x0ec835e8)); + + t7 = MAD_F_MLZ(hi, lo); + + MAD_F_MLA(hi, lo, X[1], -MAD_F(0x0cb19346)); + MAD_F_MLA(hi, lo, X[7], MAD_F(0x0fdcf549)); + MAD_F_MLA(hi, lo, X[10], MAD_F(0x0216a2a2)); + MAD_F_MLA(hi, lo, X[16], -MAD_F(0x09bd7ca0)); + + t2 = MAD_F_MLZ(hi, lo); + + MAD_F_MLA(hi, lo, X[0], MAD_F(0x04cfb0e2)); + MAD_F_MLA(hi, lo, X[2], MAD_F(0x0ffc19fd)); + MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0d7e8807)); + MAD_F_MLA(hi, lo, X[5], MAD_F(0x03768962)); + MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0bcbe352)); + MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0e313245)); + MAD_F_MLA(hi, lo, X[9], MAD_F(0x07635284)); + MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0acf37ad)); + MAD_F_MLA(hi, lo, X[12], MAD_F(0x0f9ee890)); + MAD_F_MLA(hi, lo, X[14], MAD_F(0x0898c779)); + MAD_F_MLA(hi, lo, X[15], MAD_F(0x00b2aa3e)); + MAD_F_MLA(hi, lo, X[17], MAD_F(0x0f426cb5)); + + x[5] = MAD_F_MLZ(hi, lo); + x[12] = -x[5]; + + MAD_F_ML0(hi, lo, X[0], MAD_F(0x0acf37ad)); + MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0898c779)); + MAD_F_MLA(hi, lo, X[3], MAD_F(0x0e313245)); + MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0f426cb5)); + MAD_F_MLA(hi, lo, X[6], -MAD_F(0x03768962)); + MAD_F_MLA(hi, lo, X[8], MAD_F(0x00b2aa3e)); + MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0ffc19fd)); + MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f9ee890)); + MAD_F_MLA(hi, lo, X[12], -MAD_F(0x04cfb0e2)); + MAD_F_MLA(hi, lo, X[14], MAD_F(0x07635284)); + MAD_F_MLA(hi, lo, X[15], MAD_F(0x0d7e8807)); + MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0bcbe352)); + + x[0] = MAD_F_MLZ(hi, lo) + t2; + x[17] = -x[0]; + + MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f9ee890)); + MAD_F_MLA(hi, lo, X[2], -MAD_F(0x07635284)); + MAD_F_MLA(hi, lo, X[3], -MAD_F(0x00b2aa3e)); + MAD_F_MLA(hi, lo, X[5], MAD_F(0x0bcbe352)); + MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f426cb5)); + MAD_F_MLA(hi, lo, X[8], MAD_F(0x0d7e8807)); + MAD_F_MLA(hi, lo, X[9], MAD_F(0x0898c779)); + MAD_F_MLA(hi, lo, X[11], -MAD_F(0x04cfb0e2)); + MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0acf37ad)); + MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0ffc19fd)); + MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0e313245)); + MAD_F_MLA(hi, lo, X[17], -MAD_F(0x03768962)); + + x[24] = x[29] = MAD_F_MLZ(hi, lo) + t2; + + MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0216a2a2)); + MAD_F_MLA(hi, lo, X[7], -MAD_F(0x09bd7ca0)); + MAD_F_MLA(hi, lo, X[10], MAD_F(0x0cb19346)); + MAD_F_MLA(hi, lo, X[16], MAD_F(0x0fdcf549)); + + t3 = MAD_F_MLZ(hi, lo) + t7; + + MAD_F_ML0(hi, lo, X[0], MAD_F(0x00b2aa3e)); + MAD_F_MLA(hi, lo, X[2], MAD_F(0x03768962)); + MAD_F_MLA(hi, lo, X[3], -MAD_F(0x04cfb0e2)); + MAD_F_MLA(hi, lo, X[5], -MAD_F(0x07635284)); + MAD_F_MLA(hi, lo, X[6], MAD_F(0x0898c779)); + MAD_F_MLA(hi, lo, X[8], MAD_F(0x0acf37ad)); + MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0bcbe352)); + MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0d7e8807)); + MAD_F_MLA(hi, lo, X[12], MAD_F(0x0e313245)); + MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f426cb5)); + MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0f9ee890)); + MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0ffc19fd)); + + x[8] = MAD_F_MLZ(hi, lo) + t3; + x[9] = -x[8]; + + MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0e313245)); + MAD_F_MLA(hi, lo, X[2], MAD_F(0x0bcbe352)); + MAD_F_MLA(hi, lo, X[3], MAD_F(0x0f9ee890)); + MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0898c779)); + MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0ffc19fd)); + MAD_F_MLA(hi, lo, X[8], MAD_F(0x04cfb0e2)); + MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f426cb5)); + MAD_F_MLA(hi, lo, X[11], -MAD_F(0x00b2aa3e)); + MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0d7e8807)); + MAD_F_MLA(hi, lo, X[14], -MAD_F(0x03768962)); + MAD_F_MLA(hi, lo, X[15], MAD_F(0x0acf37ad)); + MAD_F_MLA(hi, lo, X[17], MAD_F(0x07635284)); + + x[21] = x[32] = MAD_F_MLZ(hi, lo) + t3; + + MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0d7e8807)); + MAD_F_MLA(hi, lo, X[2], MAD_F(0x0f426cb5)); + MAD_F_MLA(hi, lo, X[3], MAD_F(0x0acf37ad)); + MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0ffc19fd)); + MAD_F_MLA(hi, lo, X[6], -MAD_F(0x07635284)); + MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f9ee890)); + MAD_F_MLA(hi, lo, X[9], MAD_F(0x03768962)); + MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0e313245)); + MAD_F_MLA(hi, lo, X[12], MAD_F(0x00b2aa3e)); + MAD_F_MLA(hi, lo, X[14], MAD_F(0x0bcbe352)); + MAD_F_MLA(hi, lo, X[15], -MAD_F(0x04cfb0e2)); + MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0898c779)); + + x[20] = x[33] = MAD_F_MLZ(hi, lo) - t3; + + MAD_F_ML0(hi, lo, t14, -MAD_F(0x0ec835e8)); + MAD_F_MLA(hi, lo, t15, MAD_F(0x061f78aa)); + + t4 = MAD_F_MLZ(hi, lo) - t7; + + MAD_F_ML0(hi, lo, t12, MAD_F(0x061f78aa)); + MAD_F_MLA(hi, lo, t13, MAD_F(0x0ec835e8)); + + x[4] = MAD_F_MLZ(hi, lo) + t4; + x[13] = -x[4]; + + MAD_F_ML0(hi, lo, t8, MAD_F(0x09bd7ca0)); + MAD_F_MLA(hi, lo, t9, -MAD_F(0x0216a2a2)); + MAD_F_MLA(hi, lo, t10, MAD_F(0x0fdcf549)); + MAD_F_MLA(hi, lo, t11, -MAD_F(0x0cb19346)); + + x[1] = MAD_F_MLZ(hi, lo) + t4; + x[16] = -x[1]; + + MAD_F_ML0(hi, lo, t8, -MAD_F(0x0fdcf549)); + MAD_F_MLA(hi, lo, t9, -MAD_F(0x0cb19346)); + MAD_F_MLA(hi, lo, t10, -MAD_F(0x09bd7ca0)); + MAD_F_MLA(hi, lo, t11, -MAD_F(0x0216a2a2)); + + x[25] = x[28] = MAD_F_MLZ(hi, lo) + t4; + + MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0fdcf549)); + MAD_F_MLA(hi, lo, X[7], -MAD_F(0x0cb19346)); + MAD_F_MLA(hi, lo, X[10], -MAD_F(0x09bd7ca0)); + MAD_F_MLA(hi, lo, X[16], -MAD_F(0x0216a2a2)); + + t5 = MAD_F_MLZ(hi, lo) - t6; + + MAD_F_ML0(hi, lo, X[0], MAD_F(0x0898c779)); + MAD_F_MLA(hi, lo, X[2], MAD_F(0x04cfb0e2)); + MAD_F_MLA(hi, lo, X[3], MAD_F(0x0bcbe352)); + MAD_F_MLA(hi, lo, X[5], MAD_F(0x00b2aa3e)); + MAD_F_MLA(hi, lo, X[6], MAD_F(0x0e313245)); + MAD_F_MLA(hi, lo, X[8], -MAD_F(0x03768962)); + MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f9ee890)); + MAD_F_MLA(hi, lo, X[11], -MAD_F(0x07635284)); + MAD_F_MLA(hi, lo, X[12], MAD_F(0x0ffc19fd)); + MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0acf37ad)); + MAD_F_MLA(hi, lo, X[15], MAD_F(0x0f426cb5)); + MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0d7e8807)); + + x[2] = MAD_F_MLZ(hi, lo) + t5; + x[15] = -x[2]; + + MAD_F_ML0(hi, lo, X[0], MAD_F(0x07635284)); + MAD_F_MLA(hi, lo, X[2], MAD_F(0x0acf37ad)); + MAD_F_MLA(hi, lo, X[3], MAD_F(0x03768962)); + MAD_F_MLA(hi, lo, X[5], MAD_F(0x0d7e8807)); + MAD_F_MLA(hi, lo, X[6], -MAD_F(0x00b2aa3e)); + MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f426cb5)); + MAD_F_MLA(hi, lo, X[9], -MAD_F(0x04cfb0e2)); + MAD_F_MLA(hi, lo, X[11], MAD_F(0x0ffc19fd)); + MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0898c779)); + MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f9ee890)); + MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0bcbe352)); + MAD_F_MLA(hi, lo, X[17], MAD_F(0x0e313245)); + + x[3] = MAD_F_MLZ(hi, lo) + t5; + x[14] = -x[3]; + + MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0ffc19fd)); + MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0f9ee890)); + MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0f426cb5)); + MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0e313245)); + MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0d7e8807)); + MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0bcbe352)); + MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0acf37ad)); + MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0898c779)); + MAD_F_MLA(hi, lo, X[12], -MAD_F(0x07635284)); + MAD_F_MLA(hi, lo, X[14], -MAD_F(0x04cfb0e2)); + MAD_F_MLA(hi, lo, X[15], -MAD_F(0x03768962)); + MAD_F_MLA(hi, lo, X[17], -MAD_F(0x00b2aa3e)); + + x[26] = x[27] = MAD_F_MLZ(hi, lo) + t5; +} + +/* + * NAME: III_imdct_l() + * DESCRIPTION: perform IMDCT and windowing for long blocks + */ +static +void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36], + u32 block_type) +{ + u32 i; + + /* IMDCT */ + + imdct36(X, z); + + /* windowing */ + + switch (block_type) { + case 0: /* normal window */ +# if defined(ASO_INTERLEAVE1) + { + register mad_fixed_t tmp1, tmp2; + + tmp1 = window_l[0]; + tmp2 = window_l[1]; + + for (i = 0; i < 34; i += 2) { + z[i + 0] = mad_f_mul(z[i + 0], tmp1); + tmp1 = window_l[i + 2]; + z[i + 1] = mad_f_mul(z[i + 1], tmp2); + tmp2 = window_l[i + 3]; + } + + z[34] = mad_f_mul(z[34], tmp1); + z[35] = mad_f_mul(z[35], tmp2); + } +# elif defined(ASO_INTERLEAVE2) + { + register mad_fixed_t tmp1, tmp2; + + tmp1 = z[0]; + tmp2 = window_l[0]; + + for (i = 0; i < 35; ++i) { + z[i] = mad_f_mul(tmp1, tmp2); + tmp1 = z[i + 1]; + tmp2 = window_l[i + 1]; + } + + z[35] = mad_f_mul(tmp1, tmp2); + } +# elif 1 + for (i = 0; i < 36; i += 4) { + z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]); + z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]); + z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]); + z[i + 3] = mad_f_mul(z[i + 3], window_l[i + 3]); + } +# else + for (i = 0; i < 36; ++i) z[i] = mad_f_mul(z[i], window_l[i]); +# endif + break; + + case 1: /* start block */ + for (i = 0; i < 18; ++i) z[i] = mad_f_mul(z[i], window_l[i]); + /* (i = 18; i < 24; ++i) z[i] unchanged */ + for (i = 24; i < 30; ++i) z[i] = mad_f_mul(z[i], window_s[i - 18]); + for (i = 30; i < 36; ++i) z[i] = 0; + break; + + case 3: /* stop block */ + for (i = 0; i < 6; ++i) z[i] = 0; + for (i = 6; i < 12; ++i) z[i] = mad_f_mul(z[i], window_s[i - 6]); + /* (i = 12; i < 18; ++i) z[i] unchanged */ + for (i = 18; i < 36; ++i) z[i] = mad_f_mul(z[i], window_l[i]); + break; + } +} +# endif /* ASO_IMDCT */ + +/* + * NAME: III_imdct_s() + * DESCRIPTION: perform IMDCT and windowing for short blocks + */ +static +void III_imdct_s(mad_fixed_t const X[18], mad_fixed_t z[36]) +{ + mad_fixed_t y[36], *yptr; + mad_fixed_t const *wptr; + s32 w, i; + register mad_fixed64hi_t hi; + register mad_fixed64lo_t lo; + + /* IMDCT */ + + yptr = &y[0]; + + for (w = 0; w < 3; ++w) { + register mad_fixed_t const (*s)[6]; + + s = imdct_s; + + for (i = 0; i < 3; ++i) { + MAD_F_ML0(hi, lo, X[0], (*s)[0]); + MAD_F_MLA(hi, lo, X[1], (*s)[1]); + MAD_F_MLA(hi, lo, X[2], (*s)[2]); + MAD_F_MLA(hi, lo, X[3], (*s)[3]); + MAD_F_MLA(hi, lo, X[4], (*s)[4]); + MAD_F_MLA(hi, lo, X[5], (*s)[5]); + + yptr[i + 0] = MAD_F_MLZ(hi, lo); + yptr[5 - i] = -yptr[i + 0]; + + ++s; + + MAD_F_ML0(hi, lo, X[0], (*s)[0]); + MAD_F_MLA(hi, lo, X[1], (*s)[1]); + MAD_F_MLA(hi, lo, X[2], (*s)[2]); + MAD_F_MLA(hi, lo, X[3], (*s)[3]); + MAD_F_MLA(hi, lo, X[4], (*s)[4]); + MAD_F_MLA(hi, lo, X[5], (*s)[5]); + + yptr[ i + 6] = MAD_F_MLZ(hi, lo); + yptr[11 - i] = yptr[i + 6]; + + ++s; + } + + yptr += 12; + X += 6; + } + + /* windowing, overlapping and concatenation */ + + yptr = &y[0]; + wptr = &window_s[0]; + + for (i = 0; i < 6; ++i) { + z[i + 0] = 0; + z[i + 6] = mad_f_mul(yptr[ 0 + 0], wptr[0]); + + MAD_F_ML0(hi, lo, yptr[ 0 + 6], wptr[6]); + MAD_F_MLA(hi, lo, yptr[12 + 0], wptr[0]); + + z[i + 12] = MAD_F_MLZ(hi, lo); + + MAD_F_ML0(hi, lo, yptr[12 + 6], wptr[6]); + MAD_F_MLA(hi, lo, yptr[24 + 0], wptr[0]); + + z[i + 18] = MAD_F_MLZ(hi, lo); + + z[i + 24] = mad_f_mul(yptr[24 + 6], wptr[6]); + z[i + 30] = 0; + + ++yptr; + ++wptr; + } +} + +/* + * NAME: III_overlap() + * DESCRIPTION: perform overlap-add of windowed IMDCT outputs + */ +static +void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], + mad_fixed_t sample[18][32], u32 sb) +{ + u32 i; + +# if defined(ASO_INTERLEAVE2) + { + register mad_fixed_t tmp1, tmp2; + + tmp1 = overlap[0]; + tmp2 = overlap[1]; + + for (i = 0; i < 16; i += 2) { + sample[i + 0][sb] = output[i + 0 + 0] + tmp1; + overlap[i + 0] = output[i + 0 + 18]; + tmp1 = overlap[i + 2]; + + sample[i + 1][sb] = output[i + 1 + 0] + tmp2; + overlap[i + 1] = output[i + 1 + 18]; + tmp2 = overlap[i + 3]; + } + + sample[16][sb] = output[16 + 0] + tmp1; + overlap[16] = output[16 + 18]; + sample[17][sb] = output[17 + 0] + tmp2; + overlap[17] = output[17 + 18]; + } +# elif 0 + for (i = 0; i < 18; i += 2) { + sample[i + 0][sb] = output[i + 0 + 0] + overlap[i + 0]; + overlap[i + 0] = output[i + 0 + 18]; + + sample[i + 1][sb] = output[i + 1 + 0] + overlap[i + 1]; + overlap[i + 1] = output[i + 1 + 18]; + } +# else + for (i = 0; i < 18; ++i) { + sample[i][sb] = output[i + 0] + overlap[i]; + overlap[i] = output[i + 18]; + } +# endif +} + +/* + * NAME: III_overlap_z() + * DESCRIPTION: perform "overlap-add" of zero IMDCT outputs + */ +static inline +void III_overlap_z(mad_fixed_t overlap[18], + mad_fixed_t sample[18][32], u32 sb) +{ + u32 i; + +# if defined(ASO_INTERLEAVE2) + { + register mad_fixed_t tmp1, tmp2; + + tmp1 = overlap[0]; + tmp2 = overlap[1]; + + for (i = 0; i < 16; i += 2) { + sample[i + 0][sb] = tmp1; + overlap[i + 0] = 0; + tmp1 = overlap[i + 2]; + + sample[i + 1][sb] = tmp2; + overlap[i + 1] = 0; + tmp2 = overlap[i + 3]; + } + + sample[16][sb] = tmp1; + overlap[16] = 0; + sample[17][sb] = tmp2; + overlap[17] = 0; + } +# else + for (i = 0; i < 18; ++i) { + sample[i][sb] = overlap[i]; + overlap[i] = 0; + } +# endif +} + +/* + * NAME: III_freqinver() + * DESCRIPTION: perform subband frequency inversion for odd sample lines + */ +static +void III_freqinver(mad_fixed_t sample[18][32], u32 sb) +{ + u32 i; + +# if 1 || defined(ASO_INTERLEAVE1) || defined(ASO_INTERLEAVE2) + { + register mad_fixed_t tmp1, tmp2; + + tmp1 = sample[1][sb]; + tmp2 = sample[3][sb]; + + for (i = 1; i < 13; i += 4) { + sample[i + 0][sb] = -tmp1; + tmp1 = sample[i + 4][sb]; + sample[i + 2][sb] = -tmp2; + tmp2 = sample[i + 6][sb]; + } + + sample[13][sb] = -tmp1; + tmp1 = sample[17][sb]; + sample[15][sb] = -tmp2; + sample[17][sb] = -tmp1; + } +# else + for (i = 1; i < 18; i += 2) + sample[i][sb] = -sample[i][sb]; +# endif +} + +/* + * NAME: III_decode() + * DESCRIPTION: decode frame main_data + */ +static +enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, + struct sideinfo *si, u32 nch) +{ + struct mad_header *header = &frame->header; + u32 sfreqi, ngr, gr; + + { + u32 sfreq; + + sfreq = header->samplerate; + if (header->flags & MAD_FLAG_MPEG_2_5_EXT) + sfreq *= 2; + + /* 48000 => 0, 44100 => 1, 32000 => 2, + 24000 => 3, 22050 => 4, 16000 => 5 */ + sfreqi = ((sfreq >> 7) & 0x000f) + + ((sfreq >> 15) & 0x0001) - 8; + + if (header->flags & MAD_FLAG_MPEG_2_5_EXT) + sfreqi += 3; + } + + /* scalefactors, Huffman decoding, requantization */ + + ngr = (header->flags & MAD_FLAG_LSF_EXT) ? 1 : 2; + + for (gr = 0; gr < ngr; ++gr) { + struct granule *granule = &si->gr[gr]; + u8 const *sfbwidth[2]; + mad_fixed_t xr[2][576]; + u32 ch; + enum mad_error error; + + for (ch = 0; ch < nch; ++ch) { + struct channel *channel = &granule->ch[ch]; + u32 part2_length; + + sfbwidth[ch] = sfbwidth_table[sfreqi].l; + if (channel->block_type == 2) { + sfbwidth[ch] = (channel->flags & mixed_block_flag) ? + sfbwidth_table[sfreqi].m : sfbwidth_table[sfreqi].s; + } + + if (header->flags & MAD_FLAG_LSF_EXT) { + part2_length = III_scalefactors_lsf(ptr, channel, + ch == 0 ? 0 : &si->gr[1].ch[1], + header->mode_extension); + } + else { + part2_length = III_scalefactors(ptr, channel, &si->gr[0].ch[ch], + gr == 0 ? 0 : si->scfsi[ch]); + } + + error = III_huffdecode(ptr, xr[ch], channel, sfbwidth[ch], part2_length); + if (error) + return error; + } + + /* joint stereo processing */ + + if (header->mode == MAD_MODE_JOINT_STEREO && header->mode_extension) { + error = III_stereo(xr, granule, header, sfbwidth[0]); + if (error) + return error; + } + + /* reordering, alias reduction, IMDCT, overlap-add, frequency inversion */ + + for (ch = 0; ch < nch; ++ch) { + struct channel const *channel = &granule->ch[ch]; + mad_fixed_t (*sample)[32] = &frame->sbsample[ch][18 * gr]; + u32 sb, l, i, sblimit; + mad_fixed_t output[36]; + + if (channel->block_type == 2) { + III_reorder(xr[ch], channel, sfbwidth[ch]); + +# if !defined(OPT_STRICT) + /* + * According to ISO/IEC 11172-3, "Alias reduction is not applied for + * granules with block_type == 2 (short block)." However, other + * sources suggest alias reduction should indeed be performed on the + * lower two subbands of mixed blocks. Most other implementations do + * this, so by default we will too. + */ + if (channel->flags & mixed_block_flag) + III_aliasreduce(xr[ch], 36); +# endif + } + else + III_aliasreduce(xr[ch], 576); + + l = 0; + + /* subbands 0-1 */ + + if (channel->block_type != 2 || (channel->flags & mixed_block_flag)) { + u32 block_type; + + block_type = channel->block_type; + if (channel->flags & mixed_block_flag) + block_type = 0; + + /* long blocks */ + for (sb = 0; sb < 2; ++sb, l += 18) { + III_imdct_l(&xr[ch][l], output, block_type); + III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); + } + } + else { + /* short blocks */ + for (sb = 0; sb < 2; ++sb, l += 18) { + III_imdct_s(&xr[ch][l], output); + III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); + } + } + + III_freqinver(sample, 1); + + /* (nonzero) subbands 2-31 */ + + i = 576; + while (i > 36 && xr[ch][i - 1] == 0) + --i; + + sblimit = 32 - (576 - i) / 18; + + if (channel->block_type != 2) { + /* long blocks */ + for (sb = 2; sb < sblimit; ++sb, l += 18) { + III_imdct_l(&xr[ch][l], output, channel->block_type); + III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); + + if (sb & 1) + III_freqinver(sample, sb); + } + } + else { + /* short blocks */ + for (sb = 2; sb < sblimit; ++sb, l += 18) { + III_imdct_s(&xr[ch][l], output); + III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); + + if (sb & 1) + III_freqinver(sample, sb); + } + } + + /* remaining (zero) subbands */ + + for (sb = sblimit; sb < 32; ++sb) { + III_overlap_z((*frame->overlap)[ch][sb], sample, sb); + + if (sb & 1) + III_freqinver(sample, sb); + } + } + } + + return MAD_ERROR_NONE; +} + +/* + * NAME: layer->III() + * DESCRIPTION: decode a single Layer III frame + */ +int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) +{ + struct mad_header *header = &frame->header; + u32 nch, priv_bitlen, next_md_begin = 0; + u32 si_len, data_bitlen, md_len; + u32 frame_space, frame_used, frame_free; + struct mad_bitptr ptr; + struct sideinfo si; + enum mad_error error; + s32 result = 0; + + /* allocate Layer III dynamic structures */ + + if (stream->main_data == 0) { + stream->main_data = malloc(MAD_BUFFER_MDLEN); + if (stream->main_data == 0) { + stream->error = MAD_ERROR_NOMEM; + return -1; + } + } + + if (frame->overlap == 0) { + frame->overlap = calloc(2 * 32 * 18, sizeof(mad_fixed_t)); + if (frame->overlap == 0) { + stream->error = MAD_ERROR_NOMEM; + return -1; + } + } + + nch = MAD_NCHANNELS(header); + si_len = (header->flags & MAD_FLAG_LSF_EXT) ? + (nch == 1 ? 9 : 17) : (nch == 1 ? 17 : 32); + + /* check frame sanity */ + + if (stream->next_frame - mad_bit_nextbyte(&stream->ptr) < + (s32) si_len) { + stream->error = MAD_ERROR_BADFRAMELEN; + stream->md_len = 0; + return -1; + } + + /* check CRC word */ + + if (header->flags & MAD_FLAG_PROTECTION) { + header->crc_check = + mad_bit_crc(stream->ptr, si_len * CHAR_BIT, header->crc_check); + + if (header->crc_check != header->crc_target && + !(frame->options & MAD_OPTION_IGNORECRC)) { + stream->error = MAD_ERROR_BADCRC; + result = -1; + } + } + + /* decode frame side information */ + + error = III_sideinfo(&stream->ptr, nch, header->flags & MAD_FLAG_LSF_EXT, + &si, &data_bitlen, &priv_bitlen); + if (error && result == 0) { + stream->error = error; + result = -1; + } + + header->flags |= priv_bitlen; + header->private_bits |= si.private_bits; + + /* find main_data of next frame */ + + { + struct mad_bitptr peek; + u32 header; + + mad_bit_init(&peek, stream->next_frame); + + header = mad_bit_read(&peek, 32); + if ((header & 0xffe60000L) /* syncword | layer */ == 0xffe20000L) { + if (!(header & 0x00010000L)) /* protection_bit */ + mad_bit_skip(&peek, 16); /* crc_check */ + + next_md_begin = + mad_bit_read(&peek, (header & 0x00080000L) /* ID */ ? 9 : 8); + } + + mad_bit_finish(&peek); + } + + /* find main_data of this frame */ + + frame_space = stream->next_frame - mad_bit_nextbyte(&stream->ptr); + + if (next_md_begin > si.main_data_begin + frame_space) + next_md_begin = 0; + + md_len = si.main_data_begin + frame_space - next_md_begin; + + frame_used = 0; + + if (si.main_data_begin == 0) { + ptr = stream->ptr; + stream->md_len = 0; + + frame_used = md_len; + } + else { + if (si.main_data_begin > stream->md_len) { + if (result == 0) { + stream->error = MAD_ERROR_BADDATAPTR; + result = -1; + } + } + else { + mad_bit_init(&ptr, + *stream->main_data + stream->md_len - si.main_data_begin); + + if (md_len > si.main_data_begin) { + assert(stream->md_len + md_len - + si.main_data_begin <= MAD_BUFFER_MDLEN); + + memcpy(*stream->main_data + stream->md_len, + mad_bit_nextbyte(&stream->ptr), + frame_used = md_len - si.main_data_begin); + stream->md_len += frame_used; + } + } + } + + frame_free = frame_space - frame_used; + + /* decode main_data */ + + if (result == 0) { + error = III_decode(&ptr, frame, &si, nch); + if (error) { + stream->error = error; + result = -1; + } + + /* designate ancillary bits */ + + stream->anc_ptr = ptr; + stream->anc_bitlen = md_len * CHAR_BIT - data_bitlen; + } + +# if 0 && defined(DEBUG) + fprintf(stderr, + "main_data_begin:%u, md_len:%u, frame_free:%u, " + "data_bitlen:%u, anc_bitlen: %u\n", + si.main_data_begin, md_len, frame_free, + data_bitlen, stream->anc_bitlen); +# endif + + /* preload main_data buffer with up to 511 bytes for next frame(s) */ + + if (frame_free >= next_md_begin) { + memcpy(*stream->main_data, + stream->next_frame - next_md_begin, next_md_begin); + stream->md_len = next_md_begin; + } + else { + if (md_len < si.main_data_begin) { + u32 extra; + + extra = si.main_data_begin - md_len; + if (extra + frame_free > next_md_begin) + extra = next_md_begin - frame_free; + + if (extra < stream->md_len) { + memmove(*stream->main_data, + *stream->main_data + stream->md_len - extra, extra); + stream->md_len = extra; + } + } + else + stream->md_len = 0; + + memcpy(*stream->main_data + stream->md_len, + stream->next_frame - frame_free, frame_free); + stream->md_len += frame_free; + } + + return result; +} diff --git a/cpymo-backends/nds/decoder/layer3.h b/cpymo-backends/nds/decoder/layer3.h new file mode 100644 index 00000000..3e11bdec --- /dev/null +++ b/cpymo-backends/nds/decoder/layer3.h @@ -0,0 +1,29 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifndef LIBMAD_LAYER3_H +# define LIBMAD_LAYER3_H + +# include "stream.h" +# include "frame.h" + +int mad_layer_III(struct mad_stream *, struct mad_frame *); + +# endif diff --git a/cpymo-backends/nds/decoder/qc_table.dat b/cpymo-backends/nds/decoder/qc_table.dat new file mode 100644 index 00000000..05da0f2e --- /dev/null +++ b/cpymo-backends/nds/decoder/qc_table.dat @@ -0,0 +1,76 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * These are the Layer II classes of quantization. + * The table is derived from Table B.4 of ISO/IEC 11172-3. + */ + + { 3, 2, 5, + MAD_F(0x15555555) /* 1.33333333333 => 1.33333333209, e 0.00000000124 */, + MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ }, + { 5, 3, 7, + MAD_F(0x1999999a) /* 1.60000000000 => 1.60000000149, e -0.00000000149 */, + MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ }, + { 7, 0, 3, + MAD_F(0x12492492) /* 1.14285714286 => 1.14285714179, e 0.00000000107 */, + MAD_F(0x04000000) /* 0.25000000000 => 0.25000000000, e 0.00000000000 */ }, + { 9, 4, 10, + MAD_F(0x1c71c71c) /* 1.77777777777 => 1.77777777612, e 0.00000000165 */, + MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ }, + { 15, 0, 4, + MAD_F(0x11111111) /* 1.06666666666 => 1.06666666642, e 0.00000000024 */, + MAD_F(0x02000000) /* 0.12500000000 => 0.12500000000, e 0.00000000000 */ }, + { 31, 0, 5, + MAD_F(0x10842108) /* 1.03225806452 => 1.03225806355, e 0.00000000097 */, + MAD_F(0x01000000) /* 0.06250000000 => 0.06250000000, e 0.00000000000 */ }, + { 63, 0, 6, + MAD_F(0x10410410) /* 1.01587301587 => 1.01587301493, e 0.00000000094 */, + MAD_F(0x00800000) /* 0.03125000000 => 0.03125000000, e 0.00000000000 */ }, + { 127, 0, 7, + MAD_F(0x10204081) /* 1.00787401575 => 1.00787401572, e 0.00000000003 */, + MAD_F(0x00400000) /* 0.01562500000 => 0.01562500000, e 0.00000000000 */ }, + { 255, 0, 8, + MAD_F(0x10101010) /* 1.00392156863 => 1.00392156839, e 0.00000000024 */, + MAD_F(0x00200000) /* 0.00781250000 => 0.00781250000, e 0.00000000000 */ }, + { 511, 0, 9, + MAD_F(0x10080402) /* 1.00195694716 => 1.00195694715, e 0.00000000001 */, + MAD_F(0x00100000) /* 0.00390625000 => 0.00390625000, e 0.00000000000 */ }, + { 1023, 0, 10, + MAD_F(0x10040100) /* 1.00097751711 => 1.00097751617, e 0.00000000094 */, + MAD_F(0x00080000) /* 0.00195312500 => 0.00195312500, e 0.00000000000 */ }, + { 2047, 0, 11, + MAD_F(0x10020040) /* 1.00048851979 => 1.00048851967, e 0.00000000012 */, + MAD_F(0x00040000) /* 0.00097656250 => 0.00097656250, e 0.00000000000 */ }, + { 4095, 0, 12, + MAD_F(0x10010010) /* 1.00024420024 => 1.00024420023, e 0.00000000001 */, + MAD_F(0x00020000) /* 0.00048828125 => 0.00048828125, e 0.00000000000 */ }, + { 8191, 0, 13, + MAD_F(0x10008004) /* 1.00012208522 => 1.00012208521, e 0.00000000001 */, + MAD_F(0x00010000) /* 0.00024414063 => 0.00024414062, e 0.00000000000 */ }, + { 16383, 0, 14, + MAD_F(0x10004001) /* 1.00006103888 => 1.00006103888, e -0.00000000000 */, + MAD_F(0x00008000) /* 0.00012207031 => 0.00012207031, e -0.00000000000 */ }, + { 32767, 0, 15, + MAD_F(0x10002000) /* 1.00003051851 => 1.00003051758, e 0.00000000093 */, + MAD_F(0x00004000) /* 0.00006103516 => 0.00006103516, e 0.00000000000 */ }, + { 65535, 0, 16, + MAD_F(0x10001000) /* 1.00001525902 => 1.00001525879, e 0.00000000023 */, + MAD_F(0x00002000) /* 0.00003051758 => 0.00003051758, e 0.00000000000 */ } diff --git a/cpymo-backends/nds/decoder/rq_table.dat b/cpymo-backends/nds/decoder/rq_table.dat new file mode 100644 index 00000000..d6b9802b --- /dev/null +++ b/cpymo-backends/nds/decoder/rq_table.dat @@ -0,0 +1,8746 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * This is the lookup table used to compute x^(4/3) for Layer III + * requantization. To maintain the best possible accuracy, the value is + * stored as a normalized mantissa with exponent. The requantization + * algorithm recombines these parts with appropriate scaling. + */ + + /* 0 */ { MAD_F(0x00000000) /* 0.000000000 */, 0 }, + /* 1 */ { MAD_F(0x04000000) /* 0.250000000 */, 2 }, + /* 2 */ { MAD_F(0x050a28be) /* 0.314980262 */, 3 }, + /* 3 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 4 }, + /* 4 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 4 }, + /* 5 */ { MAD_F(0x04466275) /* 0.267183742 */, 5 }, + /* 6 */ { MAD_F(0x05738c72) /* 0.340710111 */, 5 }, + /* 7 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 5 }, + /* 8 */ { MAD_F(0x04000000) /* 0.250000000 */, 6 }, + /* 9 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 6 }, + /* 10 */ { MAD_F(0x0562d694) /* 0.336630420 */, 6 }, + /* 11 */ { MAD_F(0x061dae96) /* 0.382246578 */, 6 }, + /* 12 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 6 }, + /* 13 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 6 }, + /* 14 */ { MAD_F(0x0437be65) /* 0.263609310 */, 7 }, + /* 15 */ { MAD_F(0x049fc824) /* 0.289009227 */, 7 }, + + /* 16 */ { MAD_F(0x050a28be) /* 0.314980262 */, 7 }, + /* 17 */ { MAD_F(0x0576c6f5) /* 0.341498336 */, 7 }, + /* 18 */ { MAD_F(0x05e58c0b) /* 0.368541759 */, 7 }, + /* 19 */ { MAD_F(0x06566361) /* 0.396090870 */, 7 }, + /* 20 */ { MAD_F(0x06c93a2e) /* 0.424127753 */, 7 }, + /* 21 */ { MAD_F(0x073dff3e) /* 0.452635998 */, 7 }, + /* 22 */ { MAD_F(0x07b4a2bc) /* 0.481600510 */, 7 }, + /* 23 */ { MAD_F(0x04168b05) /* 0.255503674 */, 8 }, + /* 24 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 8 }, + /* 25 */ { MAD_F(0x04919b6a) /* 0.285548607 */, 8 }, + /* 26 */ { MAD_F(0x04d065fb) /* 0.300878507 */, 8 }, + /* 27 */ { MAD_F(0x05100000) /* 0.316406250 */, 8 }, + /* 28 */ { MAD_F(0x05506451) /* 0.332126919 */, 8 }, + /* 29 */ { MAD_F(0x05918e15) /* 0.348035890 */, 8 }, + /* 30 */ { MAD_F(0x05d378bb) /* 0.364128809 */, 8 }, + /* 31 */ { MAD_F(0x06161ff3) /* 0.380401563 */, 8 }, + + /* 32 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 8 }, + /* 33 */ { MAD_F(0x069d9400) /* 0.413471222 */, 8 }, + /* 34 */ { MAD_F(0x06e2594c) /* 0.430260942 */, 8 }, + /* 35 */ { MAD_F(0x0727cc11) /* 0.447216097 */, 8 }, + /* 36 */ { MAD_F(0x076de8fc) /* 0.464333519 */, 8 }, + /* 37 */ { MAD_F(0x07b4ace3) /* 0.481610189 */, 8 }, + /* 38 */ { MAD_F(0x07fc14bf) /* 0.499043224 */, 8 }, + /* 39 */ { MAD_F(0x04220ed7) /* 0.258314934 */, 9 }, + /* 40 */ { MAD_F(0x04466275) /* 0.267183742 */, 9 }, + /* 41 */ { MAD_F(0x046b03e7) /* 0.276126771 */, 9 }, + /* 42 */ { MAD_F(0x048ff1e8) /* 0.285142811 */, 9 }, + /* 43 */ { MAD_F(0x04b52b3f) /* 0.294230696 */, 9 }, + /* 44 */ { MAD_F(0x04daaec0) /* 0.303389310 */, 9 }, + /* 45 */ { MAD_F(0x05007b49) /* 0.312617576 */, 9 }, + /* 46 */ { MAD_F(0x05268fc6) /* 0.321914457 */, 9 }, + /* 47 */ { MAD_F(0x054ceb2a) /* 0.331278957 */, 9 }, + + /* 48 */ { MAD_F(0x05738c72) /* 0.340710111 */, 9 }, + /* 49 */ { MAD_F(0x059a72a5) /* 0.350206992 */, 9 }, + /* 50 */ { MAD_F(0x05c19cd3) /* 0.359768701 */, 9 }, + /* 51 */ { MAD_F(0x05e90a12) /* 0.369394372 */, 9 }, + /* 52 */ { MAD_F(0x0610b982) /* 0.379083164 */, 9 }, + /* 53 */ { MAD_F(0x0638aa48) /* 0.388834268 */, 9 }, + /* 54 */ { MAD_F(0x0660db91) /* 0.398646895 */, 9 }, + /* 55 */ { MAD_F(0x06894c90) /* 0.408520284 */, 9 }, + /* 56 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 9 }, + /* 57 */ { MAD_F(0x06daeaa1) /* 0.428446415 */, 9 }, + /* 58 */ { MAD_F(0x07041636) /* 0.438497744 */, 9 }, + /* 59 */ { MAD_F(0x072d7e8b) /* 0.448607009 */, 9 }, + /* 60 */ { MAD_F(0x075722ef) /* 0.458773552 */, 9 }, + /* 61 */ { MAD_F(0x078102b8) /* 0.468996735 */, 9 }, + /* 62 */ { MAD_F(0x07ab1d3e) /* 0.479275937 */, 9 }, + /* 63 */ { MAD_F(0x07d571e0) /* 0.489610555 */, 9 }, + + /* 64 */ { MAD_F(0x04000000) /* 0.250000000 */, 10 }, + /* 65 */ { MAD_F(0x04156381) /* 0.255221850 */, 10 }, + /* 66 */ { MAD_F(0x042ae32a) /* 0.260470548 */, 10 }, + /* 67 */ { MAD_F(0x04407eb1) /* 0.265745823 */, 10 }, + /* 68 */ { MAD_F(0x045635cf) /* 0.271047409 */, 10 }, + /* 69 */ { MAD_F(0x046c083e) /* 0.276375048 */, 10 }, + /* 70 */ { MAD_F(0x0481f5bb) /* 0.281728487 */, 10 }, + /* 71 */ { MAD_F(0x0497fe03) /* 0.287107481 */, 10 }, + /* 72 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 10 }, + /* 73 */ { MAD_F(0x04c45df6) /* 0.297941173 */, 10 }, + /* 74 */ { MAD_F(0x04dab524) /* 0.303395408 */, 10 }, + /* 75 */ { MAD_F(0x04f12624) /* 0.308874267 */, 10 }, + /* 76 */ { MAD_F(0x0507b0bc) /* 0.314377532 */, 10 }, + /* 77 */ { MAD_F(0x051e54b1) /* 0.319904987 */, 10 }, + /* 78 */ { MAD_F(0x053511cb) /* 0.325456423 */, 10 }, + /* 79 */ { MAD_F(0x054be7d4) /* 0.331031635 */, 10 }, + + /* 80 */ { MAD_F(0x0562d694) /* 0.336630420 */, 10 }, + /* 81 */ { MAD_F(0x0579ddd8) /* 0.342252584 */, 10 }, + /* 82 */ { MAD_F(0x0590fd6c) /* 0.347897931 */, 10 }, + /* 83 */ { MAD_F(0x05a8351c) /* 0.353566275 */, 10 }, + /* 84 */ { MAD_F(0x05bf84b8) /* 0.359257429 */, 10 }, + /* 85 */ { MAD_F(0x05d6ec0e) /* 0.364971213 */, 10 }, + /* 86 */ { MAD_F(0x05ee6aef) /* 0.370707448 */, 10 }, + /* 87 */ { MAD_F(0x0606012b) /* 0.376465960 */, 10 }, + /* 88 */ { MAD_F(0x061dae96) /* 0.382246578 */, 10 }, + /* 89 */ { MAD_F(0x06357302) /* 0.388049134 */, 10 }, + /* 90 */ { MAD_F(0x064d4e43) /* 0.393873464 */, 10 }, + /* 91 */ { MAD_F(0x0665402d) /* 0.399719406 */, 10 }, + /* 92 */ { MAD_F(0x067d4896) /* 0.405586801 */, 10 }, + /* 93 */ { MAD_F(0x06956753) /* 0.411475493 */, 10 }, + /* 94 */ { MAD_F(0x06ad9c3d) /* 0.417385331 */, 10 }, + /* 95 */ { MAD_F(0x06c5e72b) /* 0.423316162 */, 10 }, + + /* 96 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 10 }, + /* 97 */ { MAD_F(0x06f6be73) /* 0.435240221 */, 10 }, + /* 98 */ { MAD_F(0x070f4a80) /* 0.441233161 */, 10 }, + /* 99 */ { MAD_F(0x0727ebf7) /* 0.447246519 */, 10 }, + /* 100 */ { MAD_F(0x0740a2b2) /* 0.453280160 */, 10 }, + /* 101 */ { MAD_F(0x07596e8d) /* 0.459333946 */, 10 }, + /* 102 */ { MAD_F(0x07724f64) /* 0.465407744 */, 10 }, + /* 103 */ { MAD_F(0x078b4514) /* 0.471501425 */, 10 }, + /* 104 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 10 }, + /* 105 */ { MAD_F(0x07bd6e75) /* 0.483747918 */, 10 }, + /* 106 */ { MAD_F(0x07d6a1e2) /* 0.489900479 */, 10 }, + /* 107 */ { MAD_F(0x07efe9a1) /* 0.496072418 */, 10 }, + /* 108 */ { MAD_F(0x0404a2c9) /* 0.251131807 */, 11 }, + /* 109 */ { MAD_F(0x04115aca) /* 0.254236974 */, 11 }, + /* 110 */ { MAD_F(0x041e1cc4) /* 0.257351652 */, 11 }, + /* 111 */ { MAD_F(0x042ae8a7) /* 0.260475783 */, 11 }, + + /* 112 */ { MAD_F(0x0437be65) /* 0.263609310 */, 11 }, + /* 113 */ { MAD_F(0x04449dee) /* 0.266752177 */, 11 }, + /* 114 */ { MAD_F(0x04518733) /* 0.269904329 */, 11 }, + /* 115 */ { MAD_F(0x045e7a26) /* 0.273065710 */, 11 }, + /* 116 */ { MAD_F(0x046b76b9) /* 0.276236269 */, 11 }, + /* 117 */ { MAD_F(0x04787cdc) /* 0.279415952 */, 11 }, + /* 118 */ { MAD_F(0x04858c83) /* 0.282604707 */, 11 }, + /* 119 */ { MAD_F(0x0492a59f) /* 0.285802482 */, 11 }, + /* 120 */ { MAD_F(0x049fc824) /* 0.289009227 */, 11 }, + /* 121 */ { MAD_F(0x04acf402) /* 0.292224893 */, 11 }, + /* 122 */ { MAD_F(0x04ba292e) /* 0.295449429 */, 11 }, + /* 123 */ { MAD_F(0x04c7679a) /* 0.298682788 */, 11 }, + /* 124 */ { MAD_F(0x04d4af3a) /* 0.301924921 */, 11 }, + /* 125 */ { MAD_F(0x04e20000) /* 0.305175781 */, 11 }, + /* 126 */ { MAD_F(0x04ef59e0) /* 0.308435322 */, 11 }, + /* 127 */ { MAD_F(0x04fcbcce) /* 0.311703498 */, 11 }, + + /* 128 */ { MAD_F(0x050a28be) /* 0.314980262 */, 11 }, + /* 129 */ { MAD_F(0x05179da4) /* 0.318265572 */, 11 }, + /* 130 */ { MAD_F(0x05251b73) /* 0.321559381 */, 11 }, + /* 131 */ { MAD_F(0x0532a220) /* 0.324861647 */, 11 }, + /* 132 */ { MAD_F(0x054031a0) /* 0.328172327 */, 11 }, + /* 133 */ { MAD_F(0x054dc9e7) /* 0.331491377 */, 11 }, + /* 134 */ { MAD_F(0x055b6ae9) /* 0.334818756 */, 11 }, + /* 135 */ { MAD_F(0x0569149c) /* 0.338154423 */, 11 }, + /* 136 */ { MAD_F(0x0576c6f5) /* 0.341498336 */, 11 }, + /* 137 */ { MAD_F(0x058481e9) /* 0.344850455 */, 11 }, + /* 138 */ { MAD_F(0x0592456d) /* 0.348210741 */, 11 }, + /* 139 */ { MAD_F(0x05a01176) /* 0.351579152 */, 11 }, + /* 140 */ { MAD_F(0x05ade5fa) /* 0.354955651 */, 11 }, + /* 141 */ { MAD_F(0x05bbc2ef) /* 0.358340200 */, 11 }, + /* 142 */ { MAD_F(0x05c9a84a) /* 0.361732758 */, 11 }, + /* 143 */ { MAD_F(0x05d79601) /* 0.365133291 */, 11 }, + + /* 144 */ { MAD_F(0x05e58c0b) /* 0.368541759 */, 11 }, + /* 145 */ { MAD_F(0x05f38a5d) /* 0.371958126 */, 11 }, + /* 146 */ { MAD_F(0x060190ee) /* 0.375382356 */, 11 }, + /* 147 */ { MAD_F(0x060f9fb3) /* 0.378814413 */, 11 }, + /* 148 */ { MAD_F(0x061db6a5) /* 0.382254261 */, 11 }, + /* 149 */ { MAD_F(0x062bd5b8) /* 0.385701865 */, 11 }, + /* 150 */ { MAD_F(0x0639fce4) /* 0.389157191 */, 11 }, + /* 151 */ { MAD_F(0x06482c1f) /* 0.392620204 */, 11 }, + /* 152 */ { MAD_F(0x06566361) /* 0.396090870 */, 11 }, + /* 153 */ { MAD_F(0x0664a2a0) /* 0.399569155 */, 11 }, + /* 154 */ { MAD_F(0x0672e9d4) /* 0.403055027 */, 11 }, + /* 155 */ { MAD_F(0x068138f3) /* 0.406548452 */, 11 }, + /* 156 */ { MAD_F(0x068f8ff5) /* 0.410049398 */, 11 }, + /* 157 */ { MAD_F(0x069deed1) /* 0.413557833 */, 11 }, + /* 158 */ { MAD_F(0x06ac557f) /* 0.417073724 */, 11 }, + /* 159 */ { MAD_F(0x06bac3f6) /* 0.420597041 */, 11 }, + + /* 160 */ { MAD_F(0x06c93a2e) /* 0.424127753 */, 11 }, + /* 161 */ { MAD_F(0x06d7b81f) /* 0.427665827 */, 11 }, + /* 162 */ { MAD_F(0x06e63dc0) /* 0.431211234 */, 11 }, + /* 163 */ { MAD_F(0x06f4cb09) /* 0.434763944 */, 11 }, + /* 164 */ { MAD_F(0x07035ff3) /* 0.438323927 */, 11 }, + /* 165 */ { MAD_F(0x0711fc75) /* 0.441891153 */, 11 }, + /* 166 */ { MAD_F(0x0720a087) /* 0.445465593 */, 11 }, + /* 167 */ { MAD_F(0x072f4c22) /* 0.449047217 */, 11 }, + /* 168 */ { MAD_F(0x073dff3e) /* 0.452635998 */, 11 }, + /* 169 */ { MAD_F(0x074cb9d3) /* 0.456231906 */, 11 }, + /* 170 */ { MAD_F(0x075b7bdb) /* 0.459834914 */, 11 }, + /* 171 */ { MAD_F(0x076a454c) /* 0.463444993 */, 11 }, + /* 172 */ { MAD_F(0x07791620) /* 0.467062117 */, 11 }, + /* 173 */ { MAD_F(0x0787ee50) /* 0.470686258 */, 11 }, + /* 174 */ { MAD_F(0x0796cdd4) /* 0.474317388 */, 11 }, + /* 175 */ { MAD_F(0x07a5b4a5) /* 0.477955481 */, 11 }, + + /* 176 */ { MAD_F(0x07b4a2bc) /* 0.481600510 */, 11 }, + /* 177 */ { MAD_F(0x07c39812) /* 0.485252449 */, 11 }, + /* 178 */ { MAD_F(0x07d294a0) /* 0.488911273 */, 11 }, + /* 179 */ { MAD_F(0x07e1985f) /* 0.492576954 */, 11 }, + /* 180 */ { MAD_F(0x07f0a348) /* 0.496249468 */, 11 }, + /* 181 */ { MAD_F(0x07ffb554) /* 0.499928790 */, 11 }, + /* 182 */ { MAD_F(0x0407673f) /* 0.251807447 */, 12 }, + /* 183 */ { MAD_F(0x040ef75e) /* 0.253653877 */, 12 }, + /* 184 */ { MAD_F(0x04168b05) /* 0.255503674 */, 12 }, + /* 185 */ { MAD_F(0x041e2230) /* 0.257356825 */, 12 }, + /* 186 */ { MAD_F(0x0425bcdd) /* 0.259213318 */, 12 }, + /* 187 */ { MAD_F(0x042d5b07) /* 0.261073141 */, 12 }, + /* 188 */ { MAD_F(0x0434fcad) /* 0.262936282 */, 12 }, + /* 189 */ { MAD_F(0x043ca1c9) /* 0.264802730 */, 12 }, + /* 190 */ { MAD_F(0x04444a5a) /* 0.266672472 */, 12 }, + /* 191 */ { MAD_F(0x044bf65d) /* 0.268545497 */, 12 }, + + /* 192 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 12 }, + /* 193 */ { MAD_F(0x045b58a9) /* 0.272301352 */, 12 }, + /* 194 */ { MAD_F(0x04630eed) /* 0.274184158 */, 12 }, + /* 195 */ { MAD_F(0x046ac896) /* 0.276070203 */, 12 }, + /* 196 */ { MAD_F(0x047285a2) /* 0.277959474 */, 12 }, + /* 197 */ { MAD_F(0x047a460c) /* 0.279851960 */, 12 }, + /* 198 */ { MAD_F(0x048209d3) /* 0.281747652 */, 12 }, + /* 199 */ { MAD_F(0x0489d0f4) /* 0.283646538 */, 12 }, + /* 200 */ { MAD_F(0x04919b6a) /* 0.285548607 */, 12 }, + /* 201 */ { MAD_F(0x04996935) /* 0.287453849 */, 12 }, + /* 202 */ { MAD_F(0x04a13a50) /* 0.289362253 */, 12 }, + /* 203 */ { MAD_F(0x04a90eba) /* 0.291273810 */, 12 }, + /* 204 */ { MAD_F(0x04b0e66e) /* 0.293188507 */, 12 }, + /* 205 */ { MAD_F(0x04b8c16c) /* 0.295106336 */, 12 }, + /* 206 */ { MAD_F(0x04c09faf) /* 0.297027285 */, 12 }, + /* 207 */ { MAD_F(0x04c88135) /* 0.298951346 */, 12 }, + + /* 208 */ { MAD_F(0x04d065fb) /* 0.300878507 */, 12 }, + /* 209 */ { MAD_F(0x04d84dff) /* 0.302808759 */, 12 }, + /* 210 */ { MAD_F(0x04e0393e) /* 0.304742092 */, 12 }, + /* 211 */ { MAD_F(0x04e827b6) /* 0.306678497 */, 12 }, + /* 212 */ { MAD_F(0x04f01963) /* 0.308617963 */, 12 }, + /* 213 */ { MAD_F(0x04f80e44) /* 0.310560480 */, 12 }, + /* 214 */ { MAD_F(0x05000655) /* 0.312506041 */, 12 }, + /* 215 */ { MAD_F(0x05080195) /* 0.314454634 */, 12 }, + /* 216 */ { MAD_F(0x05100000) /* 0.316406250 */, 12 }, + /* 217 */ { MAD_F(0x05180194) /* 0.318360880 */, 12 }, + /* 218 */ { MAD_F(0x0520064f) /* 0.320318516 */, 12 }, + /* 219 */ { MAD_F(0x05280e2d) /* 0.322279147 */, 12 }, + /* 220 */ { MAD_F(0x0530192e) /* 0.324242764 */, 12 }, + /* 221 */ { MAD_F(0x0538274e) /* 0.326209359 */, 12 }, + /* 222 */ { MAD_F(0x0540388a) /* 0.328178922 */, 12 }, + /* 223 */ { MAD_F(0x05484ce2) /* 0.330151445 */, 12 }, + + /* 224 */ { MAD_F(0x05506451) /* 0.332126919 */, 12 }, + /* 225 */ { MAD_F(0x05587ed5) /* 0.334105334 */, 12 }, + /* 226 */ { MAD_F(0x05609c6e) /* 0.336086683 */, 12 }, + /* 227 */ { MAD_F(0x0568bd17) /* 0.338070956 */, 12 }, + /* 228 */ { MAD_F(0x0570e0cf) /* 0.340058145 */, 12 }, + /* 229 */ { MAD_F(0x05790793) /* 0.342048241 */, 12 }, + /* 230 */ { MAD_F(0x05813162) /* 0.344041237 */, 12 }, + /* 231 */ { MAD_F(0x05895e39) /* 0.346037122 */, 12 }, + /* 232 */ { MAD_F(0x05918e15) /* 0.348035890 */, 12 }, + /* 233 */ { MAD_F(0x0599c0f4) /* 0.350037532 */, 12 }, + /* 234 */ { MAD_F(0x05a1f6d5) /* 0.352042040 */, 12 }, + /* 235 */ { MAD_F(0x05aa2fb5) /* 0.354049405 */, 12 }, + /* 236 */ { MAD_F(0x05b26b92) /* 0.356059619 */, 12 }, + /* 237 */ { MAD_F(0x05baaa69) /* 0.358072674 */, 12 }, + /* 238 */ { MAD_F(0x05c2ec39) /* 0.360088563 */, 12 }, + /* 239 */ { MAD_F(0x05cb3100) /* 0.362107278 */, 12 }, + + /* 240 */ { MAD_F(0x05d378bb) /* 0.364128809 */, 12 }, + /* 241 */ { MAD_F(0x05dbc368) /* 0.366153151 */, 12 }, + /* 242 */ { MAD_F(0x05e41105) /* 0.368180294 */, 12 }, + /* 243 */ { MAD_F(0x05ec6190) /* 0.370210231 */, 12 }, + /* 244 */ { MAD_F(0x05f4b507) /* 0.372242955 */, 12 }, + /* 245 */ { MAD_F(0x05fd0b68) /* 0.374278458 */, 12 }, + /* 246 */ { MAD_F(0x060564b1) /* 0.376316732 */, 12 }, + /* 247 */ { MAD_F(0x060dc0e0) /* 0.378357769 */, 12 }, + /* 248 */ { MAD_F(0x06161ff3) /* 0.380401563 */, 12 }, + /* 249 */ { MAD_F(0x061e81e8) /* 0.382448106 */, 12 }, + /* 250 */ { MAD_F(0x0626e6bc) /* 0.384497391 */, 12 }, + /* 251 */ { MAD_F(0x062f4e6f) /* 0.386549409 */, 12 }, + /* 252 */ { MAD_F(0x0637b8fd) /* 0.388604155 */, 12 }, + /* 253 */ { MAD_F(0x06402666) /* 0.390661620 */, 12 }, + /* 254 */ { MAD_F(0x064896a7) /* 0.392721798 */, 12 }, + /* 255 */ { MAD_F(0x065109be) /* 0.394784681 */, 12 }, + + /* 256 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 12 }, + /* 257 */ { MAD_F(0x0661f867) /* 0.398918536 */, 12 }, + /* 258 */ { MAD_F(0x066a73f5) /* 0.400989493 */, 12 }, + /* 259 */ { MAD_F(0x0672f252) /* 0.403063128 */, 12 }, + /* 260 */ { MAD_F(0x067b737c) /* 0.405139433 */, 12 }, + /* 261 */ { MAD_F(0x0683f771) /* 0.407218402 */, 12 }, + /* 262 */ { MAD_F(0x068c7e2f) /* 0.409300027 */, 12 }, + /* 263 */ { MAD_F(0x069507b5) /* 0.411384303 */, 12 }, + /* 264 */ { MAD_F(0x069d9400) /* 0.413471222 */, 12 }, + /* 265 */ { MAD_F(0x06a6230f) /* 0.415560778 */, 12 }, + /* 266 */ { MAD_F(0x06aeb4e0) /* 0.417652964 */, 12 }, + /* 267 */ { MAD_F(0x06b74971) /* 0.419747773 */, 12 }, + /* 268 */ { MAD_F(0x06bfe0c0) /* 0.421845199 */, 12 }, + /* 269 */ { MAD_F(0x06c87acc) /* 0.423945235 */, 12 }, + /* 270 */ { MAD_F(0x06d11794) /* 0.426047876 */, 12 }, + /* 271 */ { MAD_F(0x06d9b714) /* 0.428153114 */, 12 }, + + /* 272 */ { MAD_F(0x06e2594c) /* 0.430260942 */, 12 }, + /* 273 */ { MAD_F(0x06eafe3a) /* 0.432371356 */, 12 }, + /* 274 */ { MAD_F(0x06f3a5dc) /* 0.434484348 */, 12 }, + /* 275 */ { MAD_F(0x06fc5030) /* 0.436599912 */, 12 }, + /* 276 */ { MAD_F(0x0704fd35) /* 0.438718042 */, 12 }, + /* 277 */ { MAD_F(0x070dacea) /* 0.440838732 */, 12 }, + /* 278 */ { MAD_F(0x07165f4b) /* 0.442961975 */, 12 }, + /* 279 */ { MAD_F(0x071f1459) /* 0.445087765 */, 12 }, + /* 280 */ { MAD_F(0x0727cc11) /* 0.447216097 */, 12 }, + /* 281 */ { MAD_F(0x07308671) /* 0.449346964 */, 12 }, + /* 282 */ { MAD_F(0x07394378) /* 0.451480360 */, 12 }, + /* 283 */ { MAD_F(0x07420325) /* 0.453616280 */, 12 }, + /* 284 */ { MAD_F(0x074ac575) /* 0.455754717 */, 12 }, + /* 285 */ { MAD_F(0x07538a67) /* 0.457895665 */, 12 }, + /* 286 */ { MAD_F(0x075c51fa) /* 0.460039119 */, 12 }, + /* 287 */ { MAD_F(0x07651c2c) /* 0.462185072 */, 12 }, + + /* 288 */ { MAD_F(0x076de8fc) /* 0.464333519 */, 12 }, + /* 289 */ { MAD_F(0x0776b867) /* 0.466484455 */, 12 }, + /* 290 */ { MAD_F(0x077f8a6d) /* 0.468637872 */, 12 }, + /* 291 */ { MAD_F(0x07885f0b) /* 0.470793767 */, 12 }, + /* 292 */ { MAD_F(0x07913641) /* 0.472952132 */, 12 }, + /* 293 */ { MAD_F(0x079a100c) /* 0.475112962 */, 12 }, + /* 294 */ { MAD_F(0x07a2ec6c) /* 0.477276252 */, 12 }, + /* 295 */ { MAD_F(0x07abcb5f) /* 0.479441997 */, 12 }, + /* 296 */ { MAD_F(0x07b4ace3) /* 0.481610189 */, 12 }, + /* 297 */ { MAD_F(0x07bd90f6) /* 0.483780825 */, 12 }, + /* 298 */ { MAD_F(0x07c67798) /* 0.485953899 */, 12 }, + /* 299 */ { MAD_F(0x07cf60c7) /* 0.488129404 */, 12 }, + /* 300 */ { MAD_F(0x07d84c81) /* 0.490307336 */, 12 }, + /* 301 */ { MAD_F(0x07e13ac5) /* 0.492487690 */, 12 }, + /* 302 */ { MAD_F(0x07ea2b92) /* 0.494670459 */, 12 }, + /* 303 */ { MAD_F(0x07f31ee6) /* 0.496855639 */, 12 }, + + /* 304 */ { MAD_F(0x07fc14bf) /* 0.499043224 */, 12 }, + /* 305 */ { MAD_F(0x0402868e) /* 0.250616605 */, 13 }, + /* 306 */ { MAD_F(0x040703ff) /* 0.251712795 */, 13 }, + /* 307 */ { MAD_F(0x040b82b0) /* 0.252810180 */, 13 }, + /* 308 */ { MAD_F(0x041002a1) /* 0.253908756 */, 13 }, + /* 309 */ { MAD_F(0x041483d1) /* 0.255008523 */, 13 }, + /* 310 */ { MAD_F(0x04190640) /* 0.256109476 */, 13 }, + /* 311 */ { MAD_F(0x041d89ed) /* 0.257211614 */, 13 }, + /* 312 */ { MAD_F(0x04220ed7) /* 0.258314934 */, 13 }, + /* 313 */ { MAD_F(0x042694fe) /* 0.259419433 */, 13 }, + /* 314 */ { MAD_F(0x042b1c60) /* 0.260525110 */, 13 }, + /* 315 */ { MAD_F(0x042fa4fe) /* 0.261631960 */, 13 }, + /* 316 */ { MAD_F(0x04342ed7) /* 0.262739982 */, 13 }, + /* 317 */ { MAD_F(0x0438b9e9) /* 0.263849174 */, 13 }, + /* 318 */ { MAD_F(0x043d4635) /* 0.264959533 */, 13 }, + /* 319 */ { MAD_F(0x0441d3b9) /* 0.266071056 */, 13 }, + + /* 320 */ { MAD_F(0x04466275) /* 0.267183742 */, 13 }, + /* 321 */ { MAD_F(0x044af269) /* 0.268297587 */, 13 }, + /* 322 */ { MAD_F(0x044f8393) /* 0.269412589 */, 13 }, + /* 323 */ { MAD_F(0x045415f3) /* 0.270528746 */, 13 }, + /* 324 */ { MAD_F(0x0458a989) /* 0.271646056 */, 13 }, + /* 325 */ { MAD_F(0x045d3e53) /* 0.272764515 */, 13 }, + /* 326 */ { MAD_F(0x0461d451) /* 0.273884123 */, 13 }, + /* 327 */ { MAD_F(0x04666b83) /* 0.275004875 */, 13 }, + /* 328 */ { MAD_F(0x046b03e7) /* 0.276126771 */, 13 }, + /* 329 */ { MAD_F(0x046f9d7e) /* 0.277249808 */, 13 }, + /* 330 */ { MAD_F(0x04743847) /* 0.278373983 */, 13 }, + /* 331 */ { MAD_F(0x0478d440) /* 0.279499294 */, 13 }, + /* 332 */ { MAD_F(0x047d716a) /* 0.280625739 */, 13 }, + /* 333 */ { MAD_F(0x04820fc3) /* 0.281753315 */, 13 }, + /* 334 */ { MAD_F(0x0486af4c) /* 0.282882021 */, 13 }, + /* 335 */ { MAD_F(0x048b5003) /* 0.284011853 */, 13 }, + + /* 336 */ { MAD_F(0x048ff1e8) /* 0.285142811 */, 13 }, + /* 337 */ { MAD_F(0x049494fb) /* 0.286274891 */, 13 }, + /* 338 */ { MAD_F(0x0499393a) /* 0.287408091 */, 13 }, + /* 339 */ { MAD_F(0x049ddea5) /* 0.288542409 */, 13 }, + /* 340 */ { MAD_F(0x04a2853c) /* 0.289677844 */, 13 }, + /* 341 */ { MAD_F(0x04a72cfe) /* 0.290814392 */, 13 }, + /* 342 */ { MAD_F(0x04abd5ea) /* 0.291952051 */, 13 }, + /* 343 */ { MAD_F(0x04b08000) /* 0.293090820 */, 13 }, + /* 344 */ { MAD_F(0x04b52b3f) /* 0.294230696 */, 13 }, + /* 345 */ { MAD_F(0x04b9d7a7) /* 0.295371678 */, 13 }, + /* 346 */ { MAD_F(0x04be8537) /* 0.296513762 */, 13 }, + /* 347 */ { MAD_F(0x04c333ee) /* 0.297656947 */, 13 }, + /* 348 */ { MAD_F(0x04c7e3cc) /* 0.298801231 */, 13 }, + /* 349 */ { MAD_F(0x04cc94d1) /* 0.299946611 */, 13 }, + /* 350 */ { MAD_F(0x04d146fb) /* 0.301093085 */, 13 }, + /* 351 */ { MAD_F(0x04d5fa4b) /* 0.302240653 */, 13 }, + + /* 352 */ { MAD_F(0x04daaec0) /* 0.303389310 */, 13 }, + /* 353 */ { MAD_F(0x04df6458) /* 0.304539056 */, 13 }, + /* 354 */ { MAD_F(0x04e41b14) /* 0.305689888 */, 13 }, + /* 355 */ { MAD_F(0x04e8d2f3) /* 0.306841804 */, 13 }, + /* 356 */ { MAD_F(0x04ed8bf5) /* 0.307994802 */, 13 }, + /* 357 */ { MAD_F(0x04f24618) /* 0.309148880 */, 13 }, + /* 358 */ { MAD_F(0x04f7015d) /* 0.310304037 */, 13 }, + /* 359 */ { MAD_F(0x04fbbdc3) /* 0.311460269 */, 13 }, + /* 360 */ { MAD_F(0x05007b49) /* 0.312617576 */, 13 }, + /* 361 */ { MAD_F(0x050539ef) /* 0.313775954 */, 13 }, + /* 362 */ { MAD_F(0x0509f9b4) /* 0.314935403 */, 13 }, + /* 363 */ { MAD_F(0x050eba98) /* 0.316095920 */, 13 }, + /* 364 */ { MAD_F(0x05137c9a) /* 0.317257503 */, 13 }, + /* 365 */ { MAD_F(0x05183fba) /* 0.318420150 */, 13 }, + /* 366 */ { MAD_F(0x051d03f7) /* 0.319583859 */, 13 }, + /* 367 */ { MAD_F(0x0521c950) /* 0.320748629 */, 13 }, + + /* 368 */ { MAD_F(0x05268fc6) /* 0.321914457 */, 13 }, + /* 369 */ { MAD_F(0x052b5757) /* 0.323081342 */, 13 }, + /* 370 */ { MAD_F(0x05302003) /* 0.324249281 */, 13 }, + /* 371 */ { MAD_F(0x0534e9ca) /* 0.325418273 */, 13 }, + /* 372 */ { MAD_F(0x0539b4ab) /* 0.326588316 */, 13 }, + /* 373 */ { MAD_F(0x053e80a6) /* 0.327759407 */, 13 }, + /* 374 */ { MAD_F(0x05434db9) /* 0.328931546 */, 13 }, + /* 375 */ { MAD_F(0x05481be5) /* 0.330104730 */, 13 }, + /* 376 */ { MAD_F(0x054ceb2a) /* 0.331278957 */, 13 }, + /* 377 */ { MAD_F(0x0551bb85) /* 0.332454225 */, 13 }, + /* 378 */ { MAD_F(0x05568cf8) /* 0.333630533 */, 13 }, + /* 379 */ { MAD_F(0x055b5f81) /* 0.334807879 */, 13 }, + /* 380 */ { MAD_F(0x05603321) /* 0.335986261 */, 13 }, + /* 381 */ { MAD_F(0x056507d6) /* 0.337165677 */, 13 }, + /* 382 */ { MAD_F(0x0569dda0) /* 0.338346125 */, 13 }, + /* 383 */ { MAD_F(0x056eb47f) /* 0.339527604 */, 13 }, + + /* 384 */ { MAD_F(0x05738c72) /* 0.340710111 */, 13 }, + /* 385 */ { MAD_F(0x05786578) /* 0.341893646 */, 13 }, + /* 386 */ { MAD_F(0x057d3f92) /* 0.343078205 */, 13 }, + /* 387 */ { MAD_F(0x05821abf) /* 0.344263788 */, 13 }, + /* 388 */ { MAD_F(0x0586f6fd) /* 0.345450393 */, 13 }, + /* 389 */ { MAD_F(0x058bd44e) /* 0.346638017 */, 13 }, + /* 390 */ { MAD_F(0x0590b2b0) /* 0.347826659 */, 13 }, + /* 391 */ { MAD_F(0x05959222) /* 0.349016318 */, 13 }, + /* 392 */ { MAD_F(0x059a72a5) /* 0.350206992 */, 13 }, + /* 393 */ { MAD_F(0x059f5438) /* 0.351398678 */, 13 }, + /* 394 */ { MAD_F(0x05a436da) /* 0.352591376 */, 13 }, + /* 395 */ { MAD_F(0x05a91a8c) /* 0.353785083 */, 13 }, + /* 396 */ { MAD_F(0x05adff4c) /* 0.354979798 */, 13 }, + /* 397 */ { MAD_F(0x05b2e51a) /* 0.356175519 */, 13 }, + /* 398 */ { MAD_F(0x05b7cbf5) /* 0.357372244 */, 13 }, + /* 399 */ { MAD_F(0x05bcb3de) /* 0.358569972 */, 13 }, + + /* 400 */ { MAD_F(0x05c19cd3) /* 0.359768701 */, 13 }, + /* 401 */ { MAD_F(0x05c686d5) /* 0.360968429 */, 13 }, + /* 402 */ { MAD_F(0x05cb71e2) /* 0.362169156 */, 13 }, + /* 403 */ { MAD_F(0x05d05dfb) /* 0.363370878 */, 13 }, + /* 404 */ { MAD_F(0x05d54b1f) /* 0.364573594 */, 13 }, + /* 405 */ { MAD_F(0x05da394d) /* 0.365777304 */, 13 }, + /* 406 */ { MAD_F(0x05df2885) /* 0.366982004 */, 13 }, + /* 407 */ { MAD_F(0x05e418c7) /* 0.368187694 */, 13 }, + /* 408 */ { MAD_F(0x05e90a12) /* 0.369394372 */, 13 }, + /* 409 */ { MAD_F(0x05edfc66) /* 0.370602036 */, 13 }, + /* 410 */ { MAD_F(0x05f2efc2) /* 0.371810684 */, 13 }, + /* 411 */ { MAD_F(0x05f7e426) /* 0.373020316 */, 13 }, + /* 412 */ { MAD_F(0x05fcd992) /* 0.374230929 */, 13 }, + /* 413 */ { MAD_F(0x0601d004) /* 0.375442522 */, 13 }, + /* 414 */ { MAD_F(0x0606c77d) /* 0.376655093 */, 13 }, + /* 415 */ { MAD_F(0x060bbffd) /* 0.377868641 */, 13 }, + + /* 416 */ { MAD_F(0x0610b982) /* 0.379083164 */, 13 }, + /* 417 */ { MAD_F(0x0615b40c) /* 0.380298661 */, 13 }, + /* 418 */ { MAD_F(0x061aaf9c) /* 0.381515130 */, 13 }, + /* 419 */ { MAD_F(0x061fac2f) /* 0.382732569 */, 13 }, + /* 420 */ { MAD_F(0x0624a9c7) /* 0.383950977 */, 13 }, + /* 421 */ { MAD_F(0x0629a863) /* 0.385170352 */, 13 }, + /* 422 */ { MAD_F(0x062ea802) /* 0.386390694 */, 13 }, + /* 423 */ { MAD_F(0x0633a8a3) /* 0.387611999 */, 13 }, + /* 424 */ { MAD_F(0x0638aa48) /* 0.388834268 */, 13 }, + /* 425 */ { MAD_F(0x063dacee) /* 0.390057497 */, 13 }, + /* 426 */ { MAD_F(0x0642b096) /* 0.391281687 */, 13 }, + /* 427 */ { MAD_F(0x0647b53f) /* 0.392506834 */, 13 }, + /* 428 */ { MAD_F(0x064cbae9) /* 0.393732939 */, 13 }, + /* 429 */ { MAD_F(0x0651c193) /* 0.394959999 */, 13 }, + /* 430 */ { MAD_F(0x0656c93d) /* 0.396188012 */, 13 }, + /* 431 */ { MAD_F(0x065bd1e7) /* 0.397416978 */, 13 }, + + /* 432 */ { MAD_F(0x0660db91) /* 0.398646895 */, 13 }, + /* 433 */ { MAD_F(0x0665e639) /* 0.399877761 */, 13 }, + /* 434 */ { MAD_F(0x066af1df) /* 0.401109575 */, 13 }, + /* 435 */ { MAD_F(0x066ffe84) /* 0.402342335 */, 13 }, + /* 436 */ { MAD_F(0x06750c26) /* 0.403576041 */, 13 }, + /* 437 */ { MAD_F(0x067a1ac6) /* 0.404810690 */, 13 }, + /* 438 */ { MAD_F(0x067f2a62) /* 0.406046281 */, 13 }, + /* 439 */ { MAD_F(0x06843afb) /* 0.407282813 */, 13 }, + /* 440 */ { MAD_F(0x06894c90) /* 0.408520284 */, 13 }, + /* 441 */ { MAD_F(0x068e5f21) /* 0.409758693 */, 13 }, + /* 442 */ { MAD_F(0x069372ae) /* 0.410998038 */, 13 }, + /* 443 */ { MAD_F(0x06988735) /* 0.412238319 */, 13 }, + /* 444 */ { MAD_F(0x069d9cb7) /* 0.413479532 */, 13 }, + /* 445 */ { MAD_F(0x06a2b333) /* 0.414721679 */, 13 }, + /* 446 */ { MAD_F(0x06a7caa9) /* 0.415964756 */, 13 }, + /* 447 */ { MAD_F(0x06ace318) /* 0.417208762 */, 13 }, + + /* 448 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 13 }, + /* 449 */ { MAD_F(0x06b716e2) /* 0.419699557 */, 13 }, + /* 450 */ { MAD_F(0x06bc323b) /* 0.420946343 */, 13 }, + /* 451 */ { MAD_F(0x06c14e8d) /* 0.422194054 */, 13 }, + /* 452 */ { MAD_F(0x06c66bd6) /* 0.423442686 */, 13 }, + /* 453 */ { MAD_F(0x06cb8a17) /* 0.424692240 */, 13 }, + /* 454 */ { MAD_F(0x06d0a94e) /* 0.425942714 */, 13 }, + /* 455 */ { MAD_F(0x06d5c97c) /* 0.427194106 */, 13 }, + /* 456 */ { MAD_F(0x06daeaa1) /* 0.428446415 */, 13 }, + /* 457 */ { MAD_F(0x06e00cbb) /* 0.429699640 */, 13 }, + /* 458 */ { MAD_F(0x06e52fca) /* 0.430953779 */, 13 }, + /* 459 */ { MAD_F(0x06ea53cf) /* 0.432208832 */, 13 }, + /* 460 */ { MAD_F(0x06ef78c8) /* 0.433464796 */, 13 }, + /* 461 */ { MAD_F(0x06f49eb6) /* 0.434721671 */, 13 }, + /* 462 */ { MAD_F(0x06f9c597) /* 0.435979455 */, 13 }, + /* 463 */ { MAD_F(0x06feed6d) /* 0.437238146 */, 13 }, + + /* 464 */ { MAD_F(0x07041636) /* 0.438497744 */, 13 }, + /* 465 */ { MAD_F(0x07093ff2) /* 0.439758248 */, 13 }, + /* 466 */ { MAD_F(0x070e6aa0) /* 0.441019655 */, 13 }, + /* 467 */ { MAD_F(0x07139641) /* 0.442281965 */, 13 }, + /* 468 */ { MAD_F(0x0718c2d3) /* 0.443545176 */, 13 }, + /* 469 */ { MAD_F(0x071df058) /* 0.444809288 */, 13 }, + /* 470 */ { MAD_F(0x07231ecd) /* 0.446074298 */, 13 }, + /* 471 */ { MAD_F(0x07284e34) /* 0.447340205 */, 13 }, + /* 472 */ { MAD_F(0x072d7e8b) /* 0.448607009 */, 13 }, + /* 473 */ { MAD_F(0x0732afd2) /* 0.449874708 */, 13 }, + /* 474 */ { MAD_F(0x0737e209) /* 0.451143300 */, 13 }, + /* 475 */ { MAD_F(0x073d1530) /* 0.452412785 */, 13 }, + /* 476 */ { MAD_F(0x07424946) /* 0.453683161 */, 13 }, + /* 477 */ { MAD_F(0x07477e4b) /* 0.454954427 */, 13 }, + /* 478 */ { MAD_F(0x074cb43e) /* 0.456226581 */, 13 }, + /* 479 */ { MAD_F(0x0751eb20) /* 0.457499623 */, 13 }, + + /* 480 */ { MAD_F(0x075722ef) /* 0.458773552 */, 13 }, + /* 481 */ { MAD_F(0x075c5bac) /* 0.460048365 */, 13 }, + /* 482 */ { MAD_F(0x07619557) /* 0.461324062 */, 13 }, + /* 483 */ { MAD_F(0x0766cfee) /* 0.462600642 */, 13 }, + /* 484 */ { MAD_F(0x076c0b72) /* 0.463878102 */, 13 }, + /* 485 */ { MAD_F(0x077147e2) /* 0.465156443 */, 13 }, + /* 486 */ { MAD_F(0x0776853e) /* 0.466435663 */, 13 }, + /* 487 */ { MAD_F(0x077bc385) /* 0.467715761 */, 13 }, + /* 488 */ { MAD_F(0x078102b8) /* 0.468996735 */, 13 }, + /* 489 */ { MAD_F(0x078642d6) /* 0.470278584 */, 13 }, + /* 490 */ { MAD_F(0x078b83de) /* 0.471561307 */, 13 }, + /* 491 */ { MAD_F(0x0790c5d1) /* 0.472844904 */, 13 }, + /* 492 */ { MAD_F(0x079608ae) /* 0.474129372 */, 13 }, + /* 493 */ { MAD_F(0x079b4c74) /* 0.475414710 */, 13 }, + /* 494 */ { MAD_F(0x07a09124) /* 0.476700918 */, 13 }, + /* 495 */ { MAD_F(0x07a5d6bd) /* 0.477987994 */, 13 }, + + /* 496 */ { MAD_F(0x07ab1d3e) /* 0.479275937 */, 13 }, + /* 497 */ { MAD_F(0x07b064a8) /* 0.480564746 */, 13 }, + /* 498 */ { MAD_F(0x07b5acfb) /* 0.481854420 */, 13 }, + /* 499 */ { MAD_F(0x07baf635) /* 0.483144957 */, 13 }, + /* 500 */ { MAD_F(0x07c04056) /* 0.484436356 */, 13 }, + /* 501 */ { MAD_F(0x07c58b5f) /* 0.485728617 */, 13 }, + /* 502 */ { MAD_F(0x07cad74e) /* 0.487021738 */, 13 }, + /* 503 */ { MAD_F(0x07d02424) /* 0.488315717 */, 13 }, + /* 504 */ { MAD_F(0x07d571e0) /* 0.489610555 */, 13 }, + /* 505 */ { MAD_F(0x07dac083) /* 0.490906249 */, 13 }, + /* 506 */ { MAD_F(0x07e0100a) /* 0.492202799 */, 13 }, + /* 507 */ { MAD_F(0x07e56078) /* 0.493500203 */, 13 }, + /* 508 */ { MAD_F(0x07eab1ca) /* 0.494798460 */, 13 }, + /* 509 */ { MAD_F(0x07f00401) /* 0.496097570 */, 13 }, + /* 510 */ { MAD_F(0x07f5571d) /* 0.497397530 */, 13 }, + /* 511 */ { MAD_F(0x07faab1c) /* 0.498698341 */, 13 }, + + /* 512 */ { MAD_F(0x04000000) /* 0.250000000 */, 14 }, + /* 513 */ { MAD_F(0x0402aae3) /* 0.250651254 */, 14 }, + /* 514 */ { MAD_F(0x04055638) /* 0.251302930 */, 14 }, + /* 515 */ { MAD_F(0x040801ff) /* 0.251955030 */, 14 }, + /* 516 */ { MAD_F(0x040aae37) /* 0.252607552 */, 14 }, + /* 517 */ { MAD_F(0x040d5ae0) /* 0.253260495 */, 14 }, + /* 518 */ { MAD_F(0x041007fa) /* 0.253913860 */, 14 }, + /* 519 */ { MAD_F(0x0412b586) /* 0.254567645 */, 14 }, + /* 520 */ { MAD_F(0x04156381) /* 0.255221850 */, 14 }, + /* 521 */ { MAD_F(0x041811ee) /* 0.255876475 */, 14 }, + /* 522 */ { MAD_F(0x041ac0cb) /* 0.256531518 */, 14 }, + /* 523 */ { MAD_F(0x041d7018) /* 0.257186980 */, 14 }, + /* 524 */ { MAD_F(0x04201fd5) /* 0.257842860 */, 14 }, + /* 525 */ { MAD_F(0x0422d003) /* 0.258499157 */, 14 }, + /* 526 */ { MAD_F(0x042580a0) /* 0.259155872 */, 14 }, + /* 527 */ { MAD_F(0x042831ad) /* 0.259813002 */, 14 }, + + /* 528 */ { MAD_F(0x042ae32a) /* 0.260470548 */, 14 }, + /* 529 */ { MAD_F(0x042d9516) /* 0.261128510 */, 14 }, + /* 530 */ { MAD_F(0x04304772) /* 0.261786886 */, 14 }, + /* 531 */ { MAD_F(0x0432fa3d) /* 0.262445676 */, 14 }, + /* 532 */ { MAD_F(0x0435ad76) /* 0.263104880 */, 14 }, + /* 533 */ { MAD_F(0x0438611f) /* 0.263764497 */, 14 }, + /* 534 */ { MAD_F(0x043b1536) /* 0.264424527 */, 14 }, + /* 535 */ { MAD_F(0x043dc9bc) /* 0.265084969 */, 14 }, + /* 536 */ { MAD_F(0x04407eb1) /* 0.265745823 */, 14 }, + /* 537 */ { MAD_F(0x04433414) /* 0.266407088 */, 14 }, + /* 538 */ { MAD_F(0x0445e9e5) /* 0.267068763 */, 14 }, + /* 539 */ { MAD_F(0x0448a024) /* 0.267730848 */, 14 }, + /* 540 */ { MAD_F(0x044b56d1) /* 0.268393343 */, 14 }, + /* 541 */ { MAD_F(0x044e0dec) /* 0.269056248 */, 14 }, + /* 542 */ { MAD_F(0x0450c575) /* 0.269719560 */, 14 }, + /* 543 */ { MAD_F(0x04537d6b) /* 0.270383281 */, 14 }, + + /* 544 */ { MAD_F(0x045635cf) /* 0.271047409 */, 14 }, + /* 545 */ { MAD_F(0x0458ee9f) /* 0.271711944 */, 14 }, + /* 546 */ { MAD_F(0x045ba7dd) /* 0.272376886 */, 14 }, + /* 547 */ { MAD_F(0x045e6188) /* 0.273042234 */, 14 }, + /* 548 */ { MAD_F(0x04611ba0) /* 0.273707988 */, 14 }, + /* 549 */ { MAD_F(0x0463d625) /* 0.274374147 */, 14 }, + /* 550 */ { MAD_F(0x04669116) /* 0.275040710 */, 14 }, + /* 551 */ { MAD_F(0x04694c74) /* 0.275707677 */, 14 }, + /* 552 */ { MAD_F(0x046c083e) /* 0.276375048 */, 14 }, + /* 553 */ { MAD_F(0x046ec474) /* 0.277042822 */, 14 }, + /* 554 */ { MAD_F(0x04718116) /* 0.277710999 */, 14 }, + /* 555 */ { MAD_F(0x04743e25) /* 0.278379578 */, 14 }, + /* 556 */ { MAD_F(0x0476fb9f) /* 0.279048558 */, 14 }, + /* 557 */ { MAD_F(0x0479b984) /* 0.279717940 */, 14 }, + /* 558 */ { MAD_F(0x047c77d6) /* 0.280387722 */, 14 }, + /* 559 */ { MAD_F(0x047f3693) /* 0.281057905 */, 14 }, + + /* 560 */ { MAD_F(0x0481f5bb) /* 0.281728487 */, 14 }, + /* 561 */ { MAD_F(0x0484b54e) /* 0.282399469 */, 14 }, + /* 562 */ { MAD_F(0x0487754c) /* 0.283070849 */, 14 }, + /* 563 */ { MAD_F(0x048a35b6) /* 0.283742628 */, 14 }, + /* 564 */ { MAD_F(0x048cf68a) /* 0.284414805 */, 14 }, + /* 565 */ { MAD_F(0x048fb7c8) /* 0.285087379 */, 14 }, + /* 566 */ { MAD_F(0x04927972) /* 0.285760350 */, 14 }, + /* 567 */ { MAD_F(0x04953b85) /* 0.286433717 */, 14 }, + /* 568 */ { MAD_F(0x0497fe03) /* 0.287107481 */, 14 }, + /* 569 */ { MAD_F(0x049ac0eb) /* 0.287781640 */, 14 }, + /* 570 */ { MAD_F(0x049d843e) /* 0.288456194 */, 14 }, + /* 571 */ { MAD_F(0x04a047fa) /* 0.289131142 */, 14 }, + /* 572 */ { MAD_F(0x04a30c20) /* 0.289806485 */, 14 }, + /* 573 */ { MAD_F(0x04a5d0af) /* 0.290482221 */, 14 }, + /* 574 */ { MAD_F(0x04a895a8) /* 0.291158351 */, 14 }, + /* 575 */ { MAD_F(0x04ab5b0b) /* 0.291834873 */, 14 }, + + /* 576 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 14 }, + /* 577 */ { MAD_F(0x04b0e70c) /* 0.293189094 */, 14 }, + /* 578 */ { MAD_F(0x04b3adaa) /* 0.293866792 */, 14 }, + /* 579 */ { MAD_F(0x04b674b1) /* 0.294544881 */, 14 }, + /* 580 */ { MAD_F(0x04b93c21) /* 0.295223360 */, 14 }, + /* 581 */ { MAD_F(0x04bc03fa) /* 0.295902229 */, 14 }, + /* 582 */ { MAD_F(0x04becc3b) /* 0.296581488 */, 14 }, + /* 583 */ { MAD_F(0x04c194e4) /* 0.297261136 */, 14 }, + /* 584 */ { MAD_F(0x04c45df6) /* 0.297941173 */, 14 }, + /* 585 */ { MAD_F(0x04c72771) /* 0.298621598 */, 14 }, + /* 586 */ { MAD_F(0x04c9f153) /* 0.299302411 */, 14 }, + /* 587 */ { MAD_F(0x04ccbb9d) /* 0.299983611 */, 14 }, + /* 588 */ { MAD_F(0x04cf864f) /* 0.300665198 */, 14 }, + /* 589 */ { MAD_F(0x04d25169) /* 0.301347172 */, 14 }, + /* 590 */ { MAD_F(0x04d51ceb) /* 0.302029532 */, 14 }, + /* 591 */ { MAD_F(0x04d7e8d4) /* 0.302712277 */, 14 }, + + /* 592 */ { MAD_F(0x04dab524) /* 0.303395408 */, 14 }, + /* 593 */ { MAD_F(0x04dd81dc) /* 0.304078923 */, 14 }, + /* 594 */ { MAD_F(0x04e04efb) /* 0.304762823 */, 14 }, + /* 595 */ { MAD_F(0x04e31c81) /* 0.305447106 */, 14 }, + /* 596 */ { MAD_F(0x04e5ea6e) /* 0.306131773 */, 14 }, + /* 597 */ { MAD_F(0x04e8b8c2) /* 0.306816823 */, 14 }, + /* 598 */ { MAD_F(0x04eb877c) /* 0.307502256 */, 14 }, + /* 599 */ { MAD_F(0x04ee569d) /* 0.308188071 */, 14 }, + /* 600 */ { MAD_F(0x04f12624) /* 0.308874267 */, 14 }, + /* 601 */ { MAD_F(0x04f3f612) /* 0.309560845 */, 14 }, + /* 602 */ { MAD_F(0x04f6c666) /* 0.310247804 */, 14 }, + /* 603 */ { MAD_F(0x04f99721) /* 0.310935143 */, 14 }, + /* 604 */ { MAD_F(0x04fc6841) /* 0.311622862 */, 14 }, + /* 605 */ { MAD_F(0x04ff39c7) /* 0.312310961 */, 14 }, + /* 606 */ { MAD_F(0x05020bb3) /* 0.312999439 */, 14 }, + /* 607 */ { MAD_F(0x0504de05) /* 0.313688296 */, 14 }, + + /* 608 */ { MAD_F(0x0507b0bc) /* 0.314377532 */, 14 }, + /* 609 */ { MAD_F(0x050a83d8) /* 0.315067145 */, 14 }, + /* 610 */ { MAD_F(0x050d575b) /* 0.315757136 */, 14 }, + /* 611 */ { MAD_F(0x05102b42) /* 0.316447504 */, 14 }, + /* 612 */ { MAD_F(0x0512ff8e) /* 0.317138249 */, 14 }, + /* 613 */ { MAD_F(0x0515d440) /* 0.317829370 */, 14 }, + /* 614 */ { MAD_F(0x0518a956) /* 0.318520867 */, 14 }, + /* 615 */ { MAD_F(0x051b7ed1) /* 0.319212739 */, 14 }, + /* 616 */ { MAD_F(0x051e54b1) /* 0.319904987 */, 14 }, + /* 617 */ { MAD_F(0x05212af5) /* 0.320597609 */, 14 }, + /* 618 */ { MAD_F(0x0524019e) /* 0.321290606 */, 14 }, + /* 619 */ { MAD_F(0x0526d8ab) /* 0.321983976 */, 14 }, + /* 620 */ { MAD_F(0x0529b01d) /* 0.322677720 */, 14 }, + /* 621 */ { MAD_F(0x052c87f2) /* 0.323371837 */, 14 }, + /* 622 */ { MAD_F(0x052f602c) /* 0.324066327 */, 14 }, + /* 623 */ { MAD_F(0x053238ca) /* 0.324761189 */, 14 }, + + /* 624 */ { MAD_F(0x053511cb) /* 0.325456423 */, 14 }, + /* 625 */ { MAD_F(0x0537eb30) /* 0.326152028 */, 14 }, + /* 626 */ { MAD_F(0x053ac4f9) /* 0.326848005 */, 14 }, + /* 627 */ { MAD_F(0x053d9f25) /* 0.327544352 */, 14 }, + /* 628 */ { MAD_F(0x054079b5) /* 0.328241070 */, 14 }, + /* 629 */ { MAD_F(0x054354a8) /* 0.328938157 */, 14 }, + /* 630 */ { MAD_F(0x05462ffe) /* 0.329635614 */, 14 }, + /* 631 */ { MAD_F(0x05490bb7) /* 0.330333440 */, 14 }, + /* 632 */ { MAD_F(0x054be7d4) /* 0.331031635 */, 14 }, + /* 633 */ { MAD_F(0x054ec453) /* 0.331730198 */, 14 }, + /* 634 */ { MAD_F(0x0551a134) /* 0.332429129 */, 14 }, + /* 635 */ { MAD_F(0x05547e79) /* 0.333128427 */, 14 }, + /* 636 */ { MAD_F(0x05575c20) /* 0.333828093 */, 14 }, + /* 637 */ { MAD_F(0x055a3a2a) /* 0.334528126 */, 14 }, + /* 638 */ { MAD_F(0x055d1896) /* 0.335228525 */, 14 }, + /* 639 */ { MAD_F(0x055ff764) /* 0.335929290 */, 14 }, + + /* 640 */ { MAD_F(0x0562d694) /* 0.336630420 */, 14 }, + /* 641 */ { MAD_F(0x0565b627) /* 0.337331916 */, 14 }, + /* 642 */ { MAD_F(0x0568961b) /* 0.338033777 */, 14 }, + /* 643 */ { MAD_F(0x056b7671) /* 0.338736002 */, 14 }, + /* 644 */ { MAD_F(0x056e5729) /* 0.339438592 */, 14 }, + /* 645 */ { MAD_F(0x05713843) /* 0.340141545 */, 14 }, + /* 646 */ { MAD_F(0x057419be) /* 0.340844862 */, 14 }, + /* 647 */ { MAD_F(0x0576fb9a) /* 0.341548541 */, 14 }, + /* 648 */ { MAD_F(0x0579ddd8) /* 0.342252584 */, 14 }, + /* 649 */ { MAD_F(0x057cc077) /* 0.342956988 */, 14 }, + /* 650 */ { MAD_F(0x057fa378) /* 0.343661754 */, 14 }, + /* 651 */ { MAD_F(0x058286d9) /* 0.344366882 */, 14 }, + /* 652 */ { MAD_F(0x05856a9b) /* 0.345072371 */, 14 }, + /* 653 */ { MAD_F(0x05884ebe) /* 0.345778221 */, 14 }, + /* 654 */ { MAD_F(0x058b3342) /* 0.346484431 */, 14 }, + /* 655 */ { MAD_F(0x058e1827) /* 0.347191002 */, 14 }, + + /* 656 */ { MAD_F(0x0590fd6c) /* 0.347897931 */, 14 }, + /* 657 */ { MAD_F(0x0593e311) /* 0.348605221 */, 14 }, + /* 658 */ { MAD_F(0x0596c917) /* 0.349312869 */, 14 }, + /* 659 */ { MAD_F(0x0599af7d) /* 0.350020876 */, 14 }, + /* 660 */ { MAD_F(0x059c9643) /* 0.350729240 */, 14 }, + /* 661 */ { MAD_F(0x059f7d6a) /* 0.351437963 */, 14 }, + /* 662 */ { MAD_F(0x05a264f0) /* 0.352147044 */, 14 }, + /* 663 */ { MAD_F(0x05a54cd6) /* 0.352856481 */, 14 }, + /* 664 */ { MAD_F(0x05a8351c) /* 0.353566275 */, 14 }, + /* 665 */ { MAD_F(0x05ab1dc2) /* 0.354276426 */, 14 }, + /* 666 */ { MAD_F(0x05ae06c7) /* 0.354986932 */, 14 }, + /* 667 */ { MAD_F(0x05b0f02b) /* 0.355697795 */, 14 }, + /* 668 */ { MAD_F(0x05b3d9f0) /* 0.356409012 */, 14 }, + /* 669 */ { MAD_F(0x05b6c413) /* 0.357120585 */, 14 }, + /* 670 */ { MAD_F(0x05b9ae95) /* 0.357832512 */, 14 }, + /* 671 */ { MAD_F(0x05bc9977) /* 0.358544794 */, 14 }, + + /* 672 */ { MAD_F(0x05bf84b8) /* 0.359257429 */, 14 }, + /* 673 */ { MAD_F(0x05c27057) /* 0.359970419 */, 14 }, + /* 674 */ { MAD_F(0x05c55c56) /* 0.360683761 */, 14 }, + /* 675 */ { MAD_F(0x05c848b3) /* 0.361397456 */, 14 }, + /* 676 */ { MAD_F(0x05cb356e) /* 0.362111504 */, 14 }, + /* 677 */ { MAD_F(0x05ce2289) /* 0.362825904 */, 14 }, + /* 678 */ { MAD_F(0x05d11001) /* 0.363540655 */, 14 }, + /* 679 */ { MAD_F(0x05d3fdd8) /* 0.364255759 */, 14 }, + /* 680 */ { MAD_F(0x05d6ec0e) /* 0.364971213 */, 14 }, + /* 681 */ { MAD_F(0x05d9daa1) /* 0.365687018 */, 14 }, + /* 682 */ { MAD_F(0x05dcc993) /* 0.366403174 */, 14 }, + /* 683 */ { MAD_F(0x05dfb8e2) /* 0.367119680 */, 14 }, + /* 684 */ { MAD_F(0x05e2a890) /* 0.367836535 */, 14 }, + /* 685 */ { MAD_F(0x05e5989b) /* 0.368553740 */, 14 }, + /* 686 */ { MAD_F(0x05e88904) /* 0.369271294 */, 14 }, + /* 687 */ { MAD_F(0x05eb79cb) /* 0.369989197 */, 14 }, + + /* 688 */ { MAD_F(0x05ee6aef) /* 0.370707448 */, 14 }, + /* 689 */ { MAD_F(0x05f15c70) /* 0.371426047 */, 14 }, + /* 690 */ { MAD_F(0x05f44e4f) /* 0.372144994 */, 14 }, + /* 691 */ { MAD_F(0x05f7408b) /* 0.372864289 */, 14 }, + /* 692 */ { MAD_F(0x05fa3324) /* 0.373583930 */, 14 }, + /* 693 */ { MAD_F(0x05fd261b) /* 0.374303918 */, 14 }, + /* 694 */ { MAD_F(0x0600196e) /* 0.375024253 */, 14 }, + /* 695 */ { MAD_F(0x06030d1e) /* 0.375744934 */, 14 }, + /* 696 */ { MAD_F(0x0606012b) /* 0.376465960 */, 14 }, + /* 697 */ { MAD_F(0x0608f595) /* 0.377187332 */, 14 }, + /* 698 */ { MAD_F(0x060bea5c) /* 0.377909049 */, 14 }, + /* 699 */ { MAD_F(0x060edf7f) /* 0.378631110 */, 14 }, + /* 700 */ { MAD_F(0x0611d4fe) /* 0.379353516 */, 14 }, + /* 701 */ { MAD_F(0x0614cada) /* 0.380076266 */, 14 }, + /* 702 */ { MAD_F(0x0617c112) /* 0.380799360 */, 14 }, + /* 703 */ { MAD_F(0x061ab7a6) /* 0.381522798 */, 14 }, + + /* 704 */ { MAD_F(0x061dae96) /* 0.382246578 */, 14 }, + /* 705 */ { MAD_F(0x0620a5e3) /* 0.382970701 */, 14 }, + /* 706 */ { MAD_F(0x06239d8b) /* 0.383695167 */, 14 }, + /* 707 */ { MAD_F(0x0626958f) /* 0.384419975 */, 14 }, + /* 708 */ { MAD_F(0x06298def) /* 0.385145124 */, 14 }, + /* 709 */ { MAD_F(0x062c86aa) /* 0.385870615 */, 14 }, + /* 710 */ { MAD_F(0x062f7fc1) /* 0.386596448 */, 14 }, + /* 711 */ { MAD_F(0x06327934) /* 0.387322621 */, 14 }, + /* 712 */ { MAD_F(0x06357302) /* 0.388049134 */, 14 }, + /* 713 */ { MAD_F(0x06386d2b) /* 0.388775988 */, 14 }, + /* 714 */ { MAD_F(0x063b67b0) /* 0.389503182 */, 14 }, + /* 715 */ { MAD_F(0x063e6290) /* 0.390230715 */, 14 }, + /* 716 */ { MAD_F(0x06415dcb) /* 0.390958588 */, 14 }, + /* 717 */ { MAD_F(0x06445960) /* 0.391686799 */, 14 }, + /* 718 */ { MAD_F(0x06475551) /* 0.392415349 */, 14 }, + /* 719 */ { MAD_F(0x064a519c) /* 0.393144238 */, 14 }, + + /* 720 */ { MAD_F(0x064d4e43) /* 0.393873464 */, 14 }, + /* 721 */ { MAD_F(0x06504b44) /* 0.394603028 */, 14 }, + /* 722 */ { MAD_F(0x0653489f) /* 0.395332930 */, 14 }, + /* 723 */ { MAD_F(0x06564655) /* 0.396063168 */, 14 }, + /* 724 */ { MAD_F(0x06594465) /* 0.396793743 */, 14 }, + /* 725 */ { MAD_F(0x065c42d0) /* 0.397524655 */, 14 }, + /* 726 */ { MAD_F(0x065f4195) /* 0.398255903 */, 14 }, + /* 727 */ { MAD_F(0x066240b4) /* 0.398987487 */, 14 }, + /* 728 */ { MAD_F(0x0665402d) /* 0.399719406 */, 14 }, + /* 729 */ { MAD_F(0x06684000) /* 0.400451660 */, 14 }, + /* 730 */ { MAD_F(0x066b402d) /* 0.401184249 */, 14 }, + /* 731 */ { MAD_F(0x066e40b3) /* 0.401917173 */, 14 }, + /* 732 */ { MAD_F(0x06714194) /* 0.402650431 */, 14 }, + /* 733 */ { MAD_F(0x067442ce) /* 0.403384024 */, 14 }, + /* 734 */ { MAD_F(0x06774462) /* 0.404117949 */, 14 }, + /* 735 */ { MAD_F(0x067a464f) /* 0.404852209 */, 14 }, + + /* 736 */ { MAD_F(0x067d4896) /* 0.405586801 */, 14 }, + /* 737 */ { MAD_F(0x06804b36) /* 0.406321726 */, 14 }, + /* 738 */ { MAD_F(0x06834e2f) /* 0.407056983 */, 14 }, + /* 739 */ { MAD_F(0x06865181) /* 0.407792573 */, 14 }, + /* 740 */ { MAD_F(0x0689552c) /* 0.408528495 */, 14 }, + /* 741 */ { MAD_F(0x068c5931) /* 0.409264748 */, 14 }, + /* 742 */ { MAD_F(0x068f5d8e) /* 0.410001332 */, 14 }, + /* 743 */ { MAD_F(0x06926245) /* 0.410738247 */, 14 }, + /* 744 */ { MAD_F(0x06956753) /* 0.411475493 */, 14 }, + /* 745 */ { MAD_F(0x06986cbb) /* 0.412213070 */, 14 }, + /* 746 */ { MAD_F(0x069b727b) /* 0.412950976 */, 14 }, + /* 747 */ { MAD_F(0x069e7894) /* 0.413689213 */, 14 }, + /* 748 */ { MAD_F(0x06a17f05) /* 0.414427779 */, 14 }, + /* 749 */ { MAD_F(0x06a485cf) /* 0.415166674 */, 14 }, + /* 750 */ { MAD_F(0x06a78cf1) /* 0.415905897 */, 14 }, + /* 751 */ { MAD_F(0x06aa946b) /* 0.416645450 */, 14 }, + + /* 752 */ { MAD_F(0x06ad9c3d) /* 0.417385331 */, 14 }, + /* 753 */ { MAD_F(0x06b0a468) /* 0.418125540 */, 14 }, + /* 754 */ { MAD_F(0x06b3acea) /* 0.418866076 */, 14 }, + /* 755 */ { MAD_F(0x06b6b5c4) /* 0.419606940 */, 14 }, + /* 756 */ { MAD_F(0x06b9bef6) /* 0.420348132 */, 14 }, + /* 757 */ { MAD_F(0x06bcc880) /* 0.421089650 */, 14 }, + /* 758 */ { MAD_F(0x06bfd261) /* 0.421831494 */, 14 }, + /* 759 */ { MAD_F(0x06c2dc9a) /* 0.422573665 */, 14 }, + /* 760 */ { MAD_F(0x06c5e72b) /* 0.423316162 */, 14 }, + /* 761 */ { MAD_F(0x06c8f213) /* 0.424058985 */, 14 }, + /* 762 */ { MAD_F(0x06cbfd52) /* 0.424802133 */, 14 }, + /* 763 */ { MAD_F(0x06cf08e9) /* 0.425545607 */, 14 }, + /* 764 */ { MAD_F(0x06d214d7) /* 0.426289405 */, 14 }, + /* 765 */ { MAD_F(0x06d5211c) /* 0.427033528 */, 14 }, + /* 766 */ { MAD_F(0x06d82db8) /* 0.427777975 */, 14 }, + /* 767 */ { MAD_F(0x06db3aaa) /* 0.428522746 */, 14 }, + + /* 768 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 14 }, + /* 769 */ { MAD_F(0x06e15595) /* 0.430013259 */, 14 }, + /* 770 */ { MAD_F(0x06e4638d) /* 0.430759001 */, 14 }, + /* 771 */ { MAD_F(0x06e771db) /* 0.431505065 */, 14 }, + /* 772 */ { MAD_F(0x06ea807f) /* 0.432251452 */, 14 }, + /* 773 */ { MAD_F(0x06ed8f7b) /* 0.432998162 */, 14 }, + /* 774 */ { MAD_F(0x06f09ecc) /* 0.433745193 */, 14 }, + /* 775 */ { MAD_F(0x06f3ae75) /* 0.434492546 */, 14 }, + /* 776 */ { MAD_F(0x06f6be73) /* 0.435240221 */, 14 }, + /* 777 */ { MAD_F(0x06f9cec8) /* 0.435988217 */, 14 }, + /* 778 */ { MAD_F(0x06fcdf72) /* 0.436736534 */, 14 }, + /* 779 */ { MAD_F(0x06fff073) /* 0.437485172 */, 14 }, + /* 780 */ { MAD_F(0x070301ca) /* 0.438234130 */, 14 }, + /* 781 */ { MAD_F(0x07061377) /* 0.438983408 */, 14 }, + /* 782 */ { MAD_F(0x0709257a) /* 0.439733006 */, 14 }, + /* 783 */ { MAD_F(0x070c37d2) /* 0.440482924 */, 14 }, + + /* 784 */ { MAD_F(0x070f4a80) /* 0.441233161 */, 14 }, + /* 785 */ { MAD_F(0x07125d84) /* 0.441983717 */, 14 }, + /* 786 */ { MAD_F(0x071570de) /* 0.442734592 */, 14 }, + /* 787 */ { MAD_F(0x0718848d) /* 0.443485785 */, 14 }, + /* 788 */ { MAD_F(0x071b9891) /* 0.444237296 */, 14 }, + /* 789 */ { MAD_F(0x071eaceb) /* 0.444989126 */, 14 }, + /* 790 */ { MAD_F(0x0721c19a) /* 0.445741273 */, 14 }, + /* 791 */ { MAD_F(0x0724d69e) /* 0.446493738 */, 14 }, + /* 792 */ { MAD_F(0x0727ebf7) /* 0.447246519 */, 14 }, + /* 793 */ { MAD_F(0x072b01a6) /* 0.447999618 */, 14 }, + /* 794 */ { MAD_F(0x072e17a9) /* 0.448753033 */, 14 }, + /* 795 */ { MAD_F(0x07312e01) /* 0.449506765 */, 14 }, + /* 796 */ { MAD_F(0x073444ae) /* 0.450260813 */, 14 }, + /* 797 */ { MAD_F(0x07375bb0) /* 0.451015176 */, 14 }, + /* 798 */ { MAD_F(0x073a7307) /* 0.451769856 */, 14 }, + /* 799 */ { MAD_F(0x073d8ab2) /* 0.452524850 */, 14 }, + + /* 800 */ { MAD_F(0x0740a2b2) /* 0.453280160 */, 14 }, + /* 801 */ { MAD_F(0x0743bb06) /* 0.454035784 */, 14 }, + /* 802 */ { MAD_F(0x0746d3af) /* 0.454791723 */, 14 }, + /* 803 */ { MAD_F(0x0749ecac) /* 0.455547976 */, 14 }, + /* 804 */ { MAD_F(0x074d05fe) /* 0.456304543 */, 14 }, + /* 805 */ { MAD_F(0x07501fa3) /* 0.457061423 */, 14 }, + /* 806 */ { MAD_F(0x0753399d) /* 0.457818618 */, 14 }, + /* 807 */ { MAD_F(0x075653eb) /* 0.458576125 */, 14 }, + /* 808 */ { MAD_F(0x07596e8d) /* 0.459333946 */, 14 }, + /* 809 */ { MAD_F(0x075c8983) /* 0.460092079 */, 14 }, + /* 810 */ { MAD_F(0x075fa4cc) /* 0.460850524 */, 14 }, + /* 811 */ { MAD_F(0x0762c06a) /* 0.461609282 */, 14 }, + /* 812 */ { MAD_F(0x0765dc5b) /* 0.462368352 */, 14 }, + /* 813 */ { MAD_F(0x0768f8a0) /* 0.463127733 */, 14 }, + /* 814 */ { MAD_F(0x076c1538) /* 0.463887426 */, 14 }, + /* 815 */ { MAD_F(0x076f3224) /* 0.464647430 */, 14 }, + + /* 816 */ { MAD_F(0x07724f64) /* 0.465407744 */, 14 }, + /* 817 */ { MAD_F(0x07756cf7) /* 0.466168370 */, 14 }, + /* 818 */ { MAD_F(0x07788add) /* 0.466929306 */, 14 }, + /* 819 */ { MAD_F(0x077ba916) /* 0.467690552 */, 14 }, + /* 820 */ { MAD_F(0x077ec7a3) /* 0.468452108 */, 14 }, + /* 821 */ { MAD_F(0x0781e683) /* 0.469213973 */, 14 }, + /* 822 */ { MAD_F(0x078505b5) /* 0.469976148 */, 14 }, + /* 823 */ { MAD_F(0x0788253b) /* 0.470738632 */, 14 }, + /* 824 */ { MAD_F(0x078b4514) /* 0.471501425 */, 14 }, + /* 825 */ { MAD_F(0x078e653f) /* 0.472264527 */, 14 }, + /* 826 */ { MAD_F(0x079185be) /* 0.473027937 */, 14 }, + /* 827 */ { MAD_F(0x0794a68f) /* 0.473791655 */, 14 }, + /* 828 */ { MAD_F(0x0797c7b2) /* 0.474555681 */, 14 }, + /* 829 */ { MAD_F(0x079ae929) /* 0.475320014 */, 14 }, + /* 830 */ { MAD_F(0x079e0af1) /* 0.476084655 */, 14 }, + /* 831 */ { MAD_F(0x07a12d0c) /* 0.476849603 */, 14 }, + + /* 832 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 14 }, + /* 833 */ { MAD_F(0x07a7723a) /* 0.478380420 */, 14 }, + /* 834 */ { MAD_F(0x07aa954c) /* 0.479146288 */, 14 }, + /* 835 */ { MAD_F(0x07adb8b0) /* 0.479912463 */, 14 }, + /* 836 */ { MAD_F(0x07b0dc67) /* 0.480678943 */, 14 }, + /* 837 */ { MAD_F(0x07b4006f) /* 0.481445729 */, 14 }, + /* 838 */ { MAD_F(0x07b724ca) /* 0.482212820 */, 14 }, + /* 839 */ { MAD_F(0x07ba4976) /* 0.482980216 */, 14 }, + /* 840 */ { MAD_F(0x07bd6e75) /* 0.483747918 */, 14 }, + /* 841 */ { MAD_F(0x07c093c5) /* 0.484515924 */, 14 }, + /* 842 */ { MAD_F(0x07c3b967) /* 0.485284235 */, 14 }, + /* 843 */ { MAD_F(0x07c6df5a) /* 0.486052849 */, 14 }, + /* 844 */ { MAD_F(0x07ca059f) /* 0.486821768 */, 14 }, + /* 845 */ { MAD_F(0x07cd2c36) /* 0.487590991 */, 14 }, + /* 846 */ { MAD_F(0x07d0531e) /* 0.488360517 */, 14 }, + /* 847 */ { MAD_F(0x07d37a57) /* 0.489130346 */, 14 }, + + /* 848 */ { MAD_F(0x07d6a1e2) /* 0.489900479 */, 14 }, + /* 849 */ { MAD_F(0x07d9c9be) /* 0.490670914 */, 14 }, + /* 850 */ { MAD_F(0x07dcf1ec) /* 0.491441651 */, 14 }, + /* 851 */ { MAD_F(0x07e01a6a) /* 0.492212691 */, 14 }, + /* 852 */ { MAD_F(0x07e3433a) /* 0.492984033 */, 14 }, + /* 853 */ { MAD_F(0x07e66c5a) /* 0.493755677 */, 14 }, + /* 854 */ { MAD_F(0x07e995cc) /* 0.494527623 */, 14 }, + /* 855 */ { MAD_F(0x07ecbf8e) /* 0.495299870 */, 14 }, + /* 856 */ { MAD_F(0x07efe9a1) /* 0.496072418 */, 14 }, + /* 857 */ { MAD_F(0x07f31405) /* 0.496845266 */, 14 }, + /* 858 */ { MAD_F(0x07f63eba) /* 0.497618416 */, 14 }, + /* 859 */ { MAD_F(0x07f969c0) /* 0.498391866 */, 14 }, + /* 860 */ { MAD_F(0x07fc9516) /* 0.499165616 */, 14 }, + /* 861 */ { MAD_F(0x07ffc0bc) /* 0.499939666 */, 14 }, + /* 862 */ { MAD_F(0x04017659) /* 0.250357008 */, 15 }, + /* 863 */ { MAD_F(0x04030c7d) /* 0.250744333 */, 15 }, + + /* 864 */ { MAD_F(0x0404a2c9) /* 0.251131807 */, 15 }, + /* 865 */ { MAD_F(0x0406393d) /* 0.251519431 */, 15 }, + /* 866 */ { MAD_F(0x0407cfd9) /* 0.251907204 */, 15 }, + /* 867 */ { MAD_F(0x0409669d) /* 0.252295127 */, 15 }, + /* 868 */ { MAD_F(0x040afd89) /* 0.252683198 */, 15 }, + /* 869 */ { MAD_F(0x040c949e) /* 0.253071419 */, 15 }, + /* 870 */ { MAD_F(0x040e2bda) /* 0.253459789 */, 15 }, + /* 871 */ { MAD_F(0x040fc33e) /* 0.253848307 */, 15 }, + /* 872 */ { MAD_F(0x04115aca) /* 0.254236974 */, 15 }, + /* 873 */ { MAD_F(0x0412f27e) /* 0.254625790 */, 15 }, + /* 874 */ { MAD_F(0x04148a5a) /* 0.255014755 */, 15 }, + /* 875 */ { MAD_F(0x0416225d) /* 0.255403867 */, 15 }, + /* 876 */ { MAD_F(0x0417ba89) /* 0.255793128 */, 15 }, + /* 877 */ { MAD_F(0x041952dc) /* 0.256182537 */, 15 }, + /* 878 */ { MAD_F(0x041aeb57) /* 0.256572095 */, 15 }, + /* 879 */ { MAD_F(0x041c83fa) /* 0.256961800 */, 15 }, + + /* 880 */ { MAD_F(0x041e1cc4) /* 0.257351652 */, 15 }, + /* 881 */ { MAD_F(0x041fb5b6) /* 0.257741653 */, 15 }, + /* 882 */ { MAD_F(0x04214ed0) /* 0.258131801 */, 15 }, + /* 883 */ { MAD_F(0x0422e811) /* 0.258522097 */, 15 }, + /* 884 */ { MAD_F(0x04248179) /* 0.258912540 */, 15 }, + /* 885 */ { MAD_F(0x04261b0a) /* 0.259303130 */, 15 }, + /* 886 */ { MAD_F(0x0427b4c2) /* 0.259693868 */, 15 }, + /* 887 */ { MAD_F(0x04294ea1) /* 0.260084752 */, 15 }, + /* 888 */ { MAD_F(0x042ae8a7) /* 0.260475783 */, 15 }, + /* 889 */ { MAD_F(0x042c82d6) /* 0.260866961 */, 15 }, + /* 890 */ { MAD_F(0x042e1d2b) /* 0.261258286 */, 15 }, + /* 891 */ { MAD_F(0x042fb7a8) /* 0.261649758 */, 15 }, + /* 892 */ { MAD_F(0x0431524c) /* 0.262041376 */, 15 }, + /* 893 */ { MAD_F(0x0432ed17) /* 0.262433140 */, 15 }, + /* 894 */ { MAD_F(0x0434880a) /* 0.262825051 */, 15 }, + /* 895 */ { MAD_F(0x04362324) /* 0.263217107 */, 15 }, + + /* 896 */ { MAD_F(0x0437be65) /* 0.263609310 */, 15 }, + /* 897 */ { MAD_F(0x043959cd) /* 0.264001659 */, 15 }, + /* 898 */ { MAD_F(0x043af55d) /* 0.264394153 */, 15 }, + /* 899 */ { MAD_F(0x043c9113) /* 0.264786794 */, 15 }, + /* 900 */ { MAD_F(0x043e2cf1) /* 0.265179580 */, 15 }, + /* 901 */ { MAD_F(0x043fc8f6) /* 0.265572511 */, 15 }, + /* 902 */ { MAD_F(0x04416522) /* 0.265965588 */, 15 }, + /* 903 */ { MAD_F(0x04430174) /* 0.266358810 */, 15 }, + /* 904 */ { MAD_F(0x04449dee) /* 0.266752177 */, 15 }, + /* 905 */ { MAD_F(0x04463a8f) /* 0.267145689 */, 15 }, + /* 906 */ { MAD_F(0x0447d756) /* 0.267539347 */, 15 }, + /* 907 */ { MAD_F(0x04497445) /* 0.267933149 */, 15 }, + /* 908 */ { MAD_F(0x044b115a) /* 0.268327096 */, 15 }, + /* 909 */ { MAD_F(0x044cae96) /* 0.268721187 */, 15 }, + /* 910 */ { MAD_F(0x044e4bf9) /* 0.269115423 */, 15 }, + /* 911 */ { MAD_F(0x044fe983) /* 0.269509804 */, 15 }, + + /* 912 */ { MAD_F(0x04518733) /* 0.269904329 */, 15 }, + /* 913 */ { MAD_F(0x0453250a) /* 0.270298998 */, 15 }, + /* 914 */ { MAD_F(0x0454c308) /* 0.270693811 */, 15 }, + /* 915 */ { MAD_F(0x0456612d) /* 0.271088768 */, 15 }, + /* 916 */ { MAD_F(0x0457ff78) /* 0.271483869 */, 15 }, + /* 917 */ { MAD_F(0x04599dea) /* 0.271879114 */, 15 }, + /* 918 */ { MAD_F(0x045b3c82) /* 0.272274503 */, 15 }, + /* 919 */ { MAD_F(0x045cdb41) /* 0.272670035 */, 15 }, + /* 920 */ { MAD_F(0x045e7a26) /* 0.273065710 */, 15 }, + /* 921 */ { MAD_F(0x04601932) /* 0.273461530 */, 15 }, + /* 922 */ { MAD_F(0x0461b864) /* 0.273857492 */, 15 }, + /* 923 */ { MAD_F(0x046357bd) /* 0.274253597 */, 15 }, + /* 924 */ { MAD_F(0x0464f73c) /* 0.274649846 */, 15 }, + /* 925 */ { MAD_F(0x046696e2) /* 0.275046238 */, 15 }, + /* 926 */ { MAD_F(0x046836ae) /* 0.275442772 */, 15 }, + /* 927 */ { MAD_F(0x0469d6a0) /* 0.275839449 */, 15 }, + + /* 928 */ { MAD_F(0x046b76b9) /* 0.276236269 */, 15 }, + /* 929 */ { MAD_F(0x046d16f7) /* 0.276633232 */, 15 }, + /* 930 */ { MAD_F(0x046eb75c) /* 0.277030337 */, 15 }, + /* 931 */ { MAD_F(0x047057e8) /* 0.277427584 */, 15 }, + /* 932 */ { MAD_F(0x0471f899) /* 0.277824973 */, 15 }, + /* 933 */ { MAD_F(0x04739971) /* 0.278222505 */, 15 }, + /* 934 */ { MAD_F(0x04753a6f) /* 0.278620179 */, 15 }, + /* 935 */ { MAD_F(0x0476db92) /* 0.279017995 */, 15 }, + /* 936 */ { MAD_F(0x04787cdc) /* 0.279415952 */, 15 }, + /* 937 */ { MAD_F(0x047a1e4c) /* 0.279814051 */, 15 }, + /* 938 */ { MAD_F(0x047bbfe2) /* 0.280212292 */, 15 }, + /* 939 */ { MAD_F(0x047d619e) /* 0.280610675 */, 15 }, + /* 940 */ { MAD_F(0x047f0380) /* 0.281009199 */, 15 }, + /* 941 */ { MAD_F(0x0480a588) /* 0.281407864 */, 15 }, + /* 942 */ { MAD_F(0x048247b6) /* 0.281806670 */, 15 }, + /* 943 */ { MAD_F(0x0483ea0a) /* 0.282205618 */, 15 }, + + /* 944 */ { MAD_F(0x04858c83) /* 0.282604707 */, 15 }, + /* 945 */ { MAD_F(0x04872f22) /* 0.283003936 */, 15 }, + /* 946 */ { MAD_F(0x0488d1e8) /* 0.283403307 */, 15 }, + /* 947 */ { MAD_F(0x048a74d3) /* 0.283802818 */, 15 }, + /* 948 */ { MAD_F(0x048c17e3) /* 0.284202470 */, 15 }, + /* 949 */ { MAD_F(0x048dbb1a) /* 0.284602263 */, 15 }, + /* 950 */ { MAD_F(0x048f5e76) /* 0.285002195 */, 15 }, + /* 951 */ { MAD_F(0x049101f8) /* 0.285402269 */, 15 }, + /* 952 */ { MAD_F(0x0492a59f) /* 0.285802482 */, 15 }, + /* 953 */ { MAD_F(0x0494496c) /* 0.286202836 */, 15 }, + /* 954 */ { MAD_F(0x0495ed5f) /* 0.286603329 */, 15 }, + /* 955 */ { MAD_F(0x04979177) /* 0.287003963 */, 15 }, + /* 956 */ { MAD_F(0x049935b5) /* 0.287404737 */, 15 }, + /* 957 */ { MAD_F(0x049ada19) /* 0.287805650 */, 15 }, + /* 958 */ { MAD_F(0x049c7ea1) /* 0.288206703 */, 15 }, + /* 959 */ { MAD_F(0x049e2350) /* 0.288607895 */, 15 }, + + /* 960 */ { MAD_F(0x049fc824) /* 0.289009227 */, 15 }, + /* 961 */ { MAD_F(0x04a16d1d) /* 0.289410699 */, 15 }, + /* 962 */ { MAD_F(0x04a3123b) /* 0.289812309 */, 15 }, + /* 963 */ { MAD_F(0x04a4b77f) /* 0.290214059 */, 15 }, + /* 964 */ { MAD_F(0x04a65ce8) /* 0.290615948 */, 15 }, + /* 965 */ { MAD_F(0x04a80277) /* 0.291017976 */, 15 }, + /* 966 */ { MAD_F(0x04a9a82b) /* 0.291420143 */, 15 }, + /* 967 */ { MAD_F(0x04ab4e04) /* 0.291822449 */, 15 }, + /* 968 */ { MAD_F(0x04acf402) /* 0.292224893 */, 15 }, + /* 969 */ { MAD_F(0x04ae9a26) /* 0.292627476 */, 15 }, + /* 970 */ { MAD_F(0x04b0406e) /* 0.293030197 */, 15 }, + /* 971 */ { MAD_F(0x04b1e6dc) /* 0.293433057 */, 15 }, + /* 972 */ { MAD_F(0x04b38d6f) /* 0.293836055 */, 15 }, + /* 973 */ { MAD_F(0x04b53427) /* 0.294239192 */, 15 }, + /* 974 */ { MAD_F(0x04b6db05) /* 0.294642466 */, 15 }, + /* 975 */ { MAD_F(0x04b88207) /* 0.295045879 */, 15 }, + + /* 976 */ { MAD_F(0x04ba292e) /* 0.295449429 */, 15 }, + /* 977 */ { MAD_F(0x04bbd07a) /* 0.295853118 */, 15 }, + /* 978 */ { MAD_F(0x04bd77ec) /* 0.296256944 */, 15 }, + /* 979 */ { MAD_F(0x04bf1f82) /* 0.296660907 */, 15 }, + /* 980 */ { MAD_F(0x04c0c73d) /* 0.297065009 */, 15 }, + /* 981 */ { MAD_F(0x04c26f1d) /* 0.297469248 */, 15 }, + /* 982 */ { MAD_F(0x04c41722) /* 0.297873624 */, 15 }, + /* 983 */ { MAD_F(0x04c5bf4c) /* 0.298278137 */, 15 }, + /* 984 */ { MAD_F(0x04c7679a) /* 0.298682788 */, 15 }, + /* 985 */ { MAD_F(0x04c9100d) /* 0.299087576 */, 15 }, + /* 986 */ { MAD_F(0x04cab8a6) /* 0.299492500 */, 15 }, + /* 987 */ { MAD_F(0x04cc6163) /* 0.299897562 */, 15 }, + /* 988 */ { MAD_F(0x04ce0a44) /* 0.300302761 */, 15 }, + /* 989 */ { MAD_F(0x04cfb34b) /* 0.300708096 */, 15 }, + /* 990 */ { MAD_F(0x04d15c76) /* 0.301113568 */, 15 }, + /* 991 */ { MAD_F(0x04d305c5) /* 0.301519176 */, 15 }, + + /* 992 */ { MAD_F(0x04d4af3a) /* 0.301924921 */, 15 }, + /* 993 */ { MAD_F(0x04d658d2) /* 0.302330802 */, 15 }, + /* 994 */ { MAD_F(0x04d80290) /* 0.302736820 */, 15 }, + /* 995 */ { MAD_F(0x04d9ac72) /* 0.303142973 */, 15 }, + /* 996 */ { MAD_F(0x04db5679) /* 0.303549263 */, 15 }, + /* 997 */ { MAD_F(0x04dd00a4) /* 0.303955689 */, 15 }, + /* 998 */ { MAD_F(0x04deaaf3) /* 0.304362251 */, 15 }, + /* 999 */ { MAD_F(0x04e05567) /* 0.304768948 */, 15 }, + /* 1000 */ { MAD_F(0x04e20000) /* 0.305175781 */, 15 }, + /* 1001 */ { MAD_F(0x04e3aabd) /* 0.305582750 */, 15 }, + /* 1002 */ { MAD_F(0x04e5559e) /* 0.305989854 */, 15 }, + /* 1003 */ { MAD_F(0x04e700a3) /* 0.306397094 */, 15 }, + /* 1004 */ { MAD_F(0x04e8abcd) /* 0.306804470 */, 15 }, + /* 1005 */ { MAD_F(0x04ea571c) /* 0.307211980 */, 15 }, + /* 1006 */ { MAD_F(0x04ec028e) /* 0.307619626 */, 15 }, + /* 1007 */ { MAD_F(0x04edae25) /* 0.308027406 */, 15 }, + + /* 1008 */ { MAD_F(0x04ef59e0) /* 0.308435322 */, 15 }, + /* 1009 */ { MAD_F(0x04f105bf) /* 0.308843373 */, 15 }, + /* 1010 */ { MAD_F(0x04f2b1c3) /* 0.309251558 */, 15 }, + /* 1011 */ { MAD_F(0x04f45dea) /* 0.309659879 */, 15 }, + /* 1012 */ { MAD_F(0x04f60a36) /* 0.310068333 */, 15 }, + /* 1013 */ { MAD_F(0x04f7b6a6) /* 0.310476923 */, 15 }, + /* 1014 */ { MAD_F(0x04f9633a) /* 0.310885647 */, 15 }, + /* 1015 */ { MAD_F(0x04fb0ff2) /* 0.311294505 */, 15 }, + /* 1016 */ { MAD_F(0x04fcbcce) /* 0.311703498 */, 15 }, + /* 1017 */ { MAD_F(0x04fe69ce) /* 0.312112625 */, 15 }, + /* 1018 */ { MAD_F(0x050016f3) /* 0.312521885 */, 15 }, + /* 1019 */ { MAD_F(0x0501c43b) /* 0.312931280 */, 15 }, + /* 1020 */ { MAD_F(0x050371a7) /* 0.313340809 */, 15 }, + /* 1021 */ { MAD_F(0x05051f37) /* 0.313750472 */, 15 }, + /* 1022 */ { MAD_F(0x0506cceb) /* 0.314160269 */, 15 }, + /* 1023 */ { MAD_F(0x05087ac2) /* 0.314570199 */, 15 }, + + /* 1024 */ { MAD_F(0x050a28be) /* 0.314980262 */, 15 }, + /* 1025 */ { MAD_F(0x050bd6de) /* 0.315390460 */, 15 }, + /* 1026 */ { MAD_F(0x050d8521) /* 0.315800790 */, 15 }, + /* 1027 */ { MAD_F(0x050f3388) /* 0.316211255 */, 15 }, + /* 1028 */ { MAD_F(0x0510e213) /* 0.316621852 */, 15 }, + /* 1029 */ { MAD_F(0x051290c2) /* 0.317032582 */, 15 }, + /* 1030 */ { MAD_F(0x05143f94) /* 0.317443446 */, 15 }, + /* 1031 */ { MAD_F(0x0515ee8a) /* 0.317854442 */, 15 }, + /* 1032 */ { MAD_F(0x05179da4) /* 0.318265572 */, 15 }, + /* 1033 */ { MAD_F(0x05194ce1) /* 0.318676834 */, 15 }, + /* 1034 */ { MAD_F(0x051afc42) /* 0.319088229 */, 15 }, + /* 1035 */ { MAD_F(0x051cabc7) /* 0.319499756 */, 15 }, + /* 1036 */ { MAD_F(0x051e5b6f) /* 0.319911417 */, 15 }, + /* 1037 */ { MAD_F(0x05200b3a) /* 0.320323209 */, 15 }, + /* 1038 */ { MAD_F(0x0521bb2a) /* 0.320735134 */, 15 }, + /* 1039 */ { MAD_F(0x05236b3d) /* 0.321147192 */, 15 }, + + /* 1040 */ { MAD_F(0x05251b73) /* 0.321559381 */, 15 }, + /* 1041 */ { MAD_F(0x0526cbcd) /* 0.321971703 */, 15 }, + /* 1042 */ { MAD_F(0x05287c4a) /* 0.322384156 */, 15 }, + /* 1043 */ { MAD_F(0x052a2cea) /* 0.322796742 */, 15 }, + /* 1044 */ { MAD_F(0x052bddae) /* 0.323209460 */, 15 }, + /* 1045 */ { MAD_F(0x052d8e96) /* 0.323622309 */, 15 }, + /* 1046 */ { MAD_F(0x052f3fa1) /* 0.324035290 */, 15 }, + /* 1047 */ { MAD_F(0x0530f0cf) /* 0.324448403 */, 15 }, + /* 1048 */ { MAD_F(0x0532a220) /* 0.324861647 */, 15 }, + /* 1049 */ { MAD_F(0x05345395) /* 0.325275023 */, 15 }, + /* 1050 */ { MAD_F(0x0536052d) /* 0.325688530 */, 15 }, + /* 1051 */ { MAD_F(0x0537b6e8) /* 0.326102168 */, 15 }, + /* 1052 */ { MAD_F(0x053968c6) /* 0.326515938 */, 15 }, + /* 1053 */ { MAD_F(0x053b1ac8) /* 0.326929839 */, 15 }, + /* 1054 */ { MAD_F(0x053ccced) /* 0.327343870 */, 15 }, + /* 1055 */ { MAD_F(0x053e7f35) /* 0.327758033 */, 15 }, + + /* 1056 */ { MAD_F(0x054031a0) /* 0.328172327 */, 15 }, + /* 1057 */ { MAD_F(0x0541e42e) /* 0.328586751 */, 15 }, + /* 1058 */ { MAD_F(0x054396df) /* 0.329001306 */, 15 }, + /* 1059 */ { MAD_F(0x054549b4) /* 0.329415992 */, 15 }, + /* 1060 */ { MAD_F(0x0546fcab) /* 0.329830808 */, 15 }, + /* 1061 */ { MAD_F(0x0548afc6) /* 0.330245755 */, 15 }, + /* 1062 */ { MAD_F(0x054a6303) /* 0.330660832 */, 15 }, + /* 1063 */ { MAD_F(0x054c1663) /* 0.331076039 */, 15 }, + /* 1064 */ { MAD_F(0x054dc9e7) /* 0.331491377 */, 15 }, + /* 1065 */ { MAD_F(0x054f7d8d) /* 0.331906845 */, 15 }, + /* 1066 */ { MAD_F(0x05513156) /* 0.332322443 */, 15 }, + /* 1067 */ { MAD_F(0x0552e542) /* 0.332738170 */, 15 }, + /* 1068 */ { MAD_F(0x05549951) /* 0.333154028 */, 15 }, + /* 1069 */ { MAD_F(0x05564d83) /* 0.333570016 */, 15 }, + /* 1070 */ { MAD_F(0x055801d8) /* 0.333986133 */, 15 }, + /* 1071 */ { MAD_F(0x0559b64f) /* 0.334402380 */, 15 }, + + /* 1072 */ { MAD_F(0x055b6ae9) /* 0.334818756 */, 15 }, + /* 1073 */ { MAD_F(0x055d1fa6) /* 0.335235262 */, 15 }, + /* 1074 */ { MAD_F(0x055ed486) /* 0.335651898 */, 15 }, + /* 1075 */ { MAD_F(0x05608988) /* 0.336068662 */, 15 }, + /* 1076 */ { MAD_F(0x05623ead) /* 0.336485556 */, 15 }, + /* 1077 */ { MAD_F(0x0563f3f5) /* 0.336902579 */, 15 }, + /* 1078 */ { MAD_F(0x0565a960) /* 0.337319732 */, 15 }, + /* 1079 */ { MAD_F(0x05675eed) /* 0.337737013 */, 15 }, + /* 1080 */ { MAD_F(0x0569149c) /* 0.338154423 */, 15 }, + /* 1081 */ { MAD_F(0x056aca6f) /* 0.338571962 */, 15 }, + /* 1082 */ { MAD_F(0x056c8064) /* 0.338989630 */, 15 }, + /* 1083 */ { MAD_F(0x056e367b) /* 0.339407426 */, 15 }, + /* 1084 */ { MAD_F(0x056fecb5) /* 0.339825351 */, 15 }, + /* 1085 */ { MAD_F(0x0571a311) /* 0.340243405 */, 15 }, + /* 1086 */ { MAD_F(0x05735990) /* 0.340661587 */, 15 }, + /* 1087 */ { MAD_F(0x05751032) /* 0.341079898 */, 15 }, + + /* 1088 */ { MAD_F(0x0576c6f5) /* 0.341498336 */, 15 }, + /* 1089 */ { MAD_F(0x05787ddc) /* 0.341916903 */, 15 }, + /* 1090 */ { MAD_F(0x057a34e4) /* 0.342335598 */, 15 }, + /* 1091 */ { MAD_F(0x057bec0f) /* 0.342754421 */, 15 }, + /* 1092 */ { MAD_F(0x057da35d) /* 0.343173373 */, 15 }, + /* 1093 */ { MAD_F(0x057f5acc) /* 0.343592452 */, 15 }, + /* 1094 */ { MAD_F(0x0581125e) /* 0.344011659 */, 15 }, + /* 1095 */ { MAD_F(0x0582ca12) /* 0.344430993 */, 15 }, + /* 1096 */ { MAD_F(0x058481e9) /* 0.344850455 */, 15 }, + /* 1097 */ { MAD_F(0x058639e2) /* 0.345270045 */, 15 }, + /* 1098 */ { MAD_F(0x0587f1fd) /* 0.345689763 */, 15 }, + /* 1099 */ { MAD_F(0x0589aa3a) /* 0.346109608 */, 15 }, + /* 1100 */ { MAD_F(0x058b629a) /* 0.346529580 */, 15 }, + /* 1101 */ { MAD_F(0x058d1b1b) /* 0.346949679 */, 15 }, + /* 1102 */ { MAD_F(0x058ed3bf) /* 0.347369906 */, 15 }, + /* 1103 */ { MAD_F(0x05908c85) /* 0.347790260 */, 15 }, + + /* 1104 */ { MAD_F(0x0592456d) /* 0.348210741 */, 15 }, + /* 1105 */ { MAD_F(0x0593fe77) /* 0.348631348 */, 15 }, + /* 1106 */ { MAD_F(0x0595b7a3) /* 0.349052083 */, 15 }, + /* 1107 */ { MAD_F(0x059770f1) /* 0.349472945 */, 15 }, + /* 1108 */ { MAD_F(0x05992a61) /* 0.349893933 */, 15 }, + /* 1109 */ { MAD_F(0x059ae3f3) /* 0.350315048 */, 15 }, + /* 1110 */ { MAD_F(0x059c9da8) /* 0.350736290 */, 15 }, + /* 1111 */ { MAD_F(0x059e577e) /* 0.351157658 */, 15 }, + /* 1112 */ { MAD_F(0x05a01176) /* 0.351579152 */, 15 }, + /* 1113 */ { MAD_F(0x05a1cb90) /* 0.352000773 */, 15 }, + /* 1114 */ { MAD_F(0x05a385cc) /* 0.352422520 */, 15 }, + /* 1115 */ { MAD_F(0x05a5402a) /* 0.352844394 */, 15 }, + /* 1116 */ { MAD_F(0x05a6faa9) /* 0.353266393 */, 15 }, + /* 1117 */ { MAD_F(0x05a8b54b) /* 0.353688519 */, 15 }, + /* 1118 */ { MAD_F(0x05aa700e) /* 0.354110771 */, 15 }, + /* 1119 */ { MAD_F(0x05ac2af3) /* 0.354533148 */, 15 }, + + /* 1120 */ { MAD_F(0x05ade5fa) /* 0.354955651 */, 15 }, + /* 1121 */ { MAD_F(0x05afa123) /* 0.355378281 */, 15 }, + /* 1122 */ { MAD_F(0x05b15c6d) /* 0.355801035 */, 15 }, + /* 1123 */ { MAD_F(0x05b317d9) /* 0.356223916 */, 15 }, + /* 1124 */ { MAD_F(0x05b4d367) /* 0.356646922 */, 15 }, + /* 1125 */ { MAD_F(0x05b68f16) /* 0.357070053 */, 15 }, + /* 1126 */ { MAD_F(0x05b84ae7) /* 0.357493310 */, 15 }, + /* 1127 */ { MAD_F(0x05ba06da) /* 0.357916692 */, 15 }, + /* 1128 */ { MAD_F(0x05bbc2ef) /* 0.358340200 */, 15 }, + /* 1129 */ { MAD_F(0x05bd7f25) /* 0.358763832 */, 15 }, + /* 1130 */ { MAD_F(0x05bf3b7c) /* 0.359187590 */, 15 }, + /* 1131 */ { MAD_F(0x05c0f7f5) /* 0.359611472 */, 15 }, + /* 1132 */ { MAD_F(0x05c2b490) /* 0.360035480 */, 15 }, + /* 1133 */ { MAD_F(0x05c4714c) /* 0.360459613 */, 15 }, + /* 1134 */ { MAD_F(0x05c62e2a) /* 0.360883870 */, 15 }, + /* 1135 */ { MAD_F(0x05c7eb29) /* 0.361308252 */, 15 }, + + /* 1136 */ { MAD_F(0x05c9a84a) /* 0.361732758 */, 15 }, + /* 1137 */ { MAD_F(0x05cb658c) /* 0.362157390 */, 15 }, + /* 1138 */ { MAD_F(0x05cd22ef) /* 0.362582145 */, 15 }, + /* 1139 */ { MAD_F(0x05cee074) /* 0.363007026 */, 15 }, + /* 1140 */ { MAD_F(0x05d09e1b) /* 0.363432030 */, 15 }, + /* 1141 */ { MAD_F(0x05d25be2) /* 0.363857159 */, 15 }, + /* 1142 */ { MAD_F(0x05d419cb) /* 0.364282412 */, 15 }, + /* 1143 */ { MAD_F(0x05d5d7d5) /* 0.364707789 */, 15 }, + /* 1144 */ { MAD_F(0x05d79601) /* 0.365133291 */, 15 }, + /* 1145 */ { MAD_F(0x05d9544e) /* 0.365558916 */, 15 }, + /* 1146 */ { MAD_F(0x05db12bc) /* 0.365984665 */, 15 }, + /* 1147 */ { MAD_F(0x05dcd14c) /* 0.366410538 */, 15 }, + /* 1148 */ { MAD_F(0x05de8ffc) /* 0.366836535 */, 15 }, + /* 1149 */ { MAD_F(0x05e04ece) /* 0.367262655 */, 15 }, + /* 1150 */ { MAD_F(0x05e20dc1) /* 0.367688900 */, 15 }, + /* 1151 */ { MAD_F(0x05e3ccd5) /* 0.368115267 */, 15 }, + + /* 1152 */ { MAD_F(0x05e58c0b) /* 0.368541759 */, 15 }, + /* 1153 */ { MAD_F(0x05e74b61) /* 0.368968373 */, 15 }, + /* 1154 */ { MAD_F(0x05e90ad9) /* 0.369395111 */, 15 }, + /* 1155 */ { MAD_F(0x05eaca72) /* 0.369821973 */, 15 }, + /* 1156 */ { MAD_F(0x05ec8a2b) /* 0.370248957 */, 15 }, + /* 1157 */ { MAD_F(0x05ee4a06) /* 0.370676065 */, 15 }, + /* 1158 */ { MAD_F(0x05f00a02) /* 0.371103295 */, 15 }, + /* 1159 */ { MAD_F(0x05f1ca1f) /* 0.371530649 */, 15 }, + /* 1160 */ { MAD_F(0x05f38a5d) /* 0.371958126 */, 15 }, + /* 1161 */ { MAD_F(0x05f54abc) /* 0.372385725 */, 15 }, + /* 1162 */ { MAD_F(0x05f70b3c) /* 0.372813448 */, 15 }, + /* 1163 */ { MAD_F(0x05f8cbdc) /* 0.373241292 */, 15 }, + /* 1164 */ { MAD_F(0x05fa8c9e) /* 0.373669260 */, 15 }, + /* 1165 */ { MAD_F(0x05fc4d81) /* 0.374097350 */, 15 }, + /* 1166 */ { MAD_F(0x05fe0e84) /* 0.374525563 */, 15 }, + /* 1167 */ { MAD_F(0x05ffcfa8) /* 0.374953898 */, 15 }, + + /* 1168 */ { MAD_F(0x060190ee) /* 0.375382356 */, 15 }, + /* 1169 */ { MAD_F(0x06035254) /* 0.375810936 */, 15 }, + /* 1170 */ { MAD_F(0x060513da) /* 0.376239638 */, 15 }, + /* 1171 */ { MAD_F(0x0606d582) /* 0.376668462 */, 15 }, + /* 1172 */ { MAD_F(0x0608974a) /* 0.377097408 */, 15 }, + /* 1173 */ { MAD_F(0x060a5934) /* 0.377526476 */, 15 }, + /* 1174 */ { MAD_F(0x060c1b3d) /* 0.377955667 */, 15 }, + /* 1175 */ { MAD_F(0x060ddd68) /* 0.378384979 */, 15 }, + /* 1176 */ { MAD_F(0x060f9fb3) /* 0.378814413 */, 15 }, + /* 1177 */ { MAD_F(0x0611621f) /* 0.379243968 */, 15 }, + /* 1178 */ { MAD_F(0x061324ac) /* 0.379673646 */, 15 }, + /* 1179 */ { MAD_F(0x0614e759) /* 0.380103444 */, 15 }, + /* 1180 */ { MAD_F(0x0616aa27) /* 0.380533365 */, 15 }, + /* 1181 */ { MAD_F(0x06186d16) /* 0.380963407 */, 15 }, + /* 1182 */ { MAD_F(0x061a3025) /* 0.381393570 */, 15 }, + /* 1183 */ { MAD_F(0x061bf354) /* 0.381823855 */, 15 }, + + /* 1184 */ { MAD_F(0x061db6a5) /* 0.382254261 */, 15 }, + /* 1185 */ { MAD_F(0x061f7a15) /* 0.382684788 */, 15 }, + /* 1186 */ { MAD_F(0x06213da7) /* 0.383115436 */, 15 }, + /* 1187 */ { MAD_F(0x06230158) /* 0.383546205 */, 15 }, + /* 1188 */ { MAD_F(0x0624c52a) /* 0.383977096 */, 15 }, + /* 1189 */ { MAD_F(0x0626891d) /* 0.384408107 */, 15 }, + /* 1190 */ { MAD_F(0x06284d30) /* 0.384839239 */, 15 }, + /* 1191 */ { MAD_F(0x062a1164) /* 0.385270492 */, 15 }, + /* 1192 */ { MAD_F(0x062bd5b8) /* 0.385701865 */, 15 }, + /* 1193 */ { MAD_F(0x062d9a2c) /* 0.386133359 */, 15 }, + /* 1194 */ { MAD_F(0x062f5ec1) /* 0.386564974 */, 15 }, + /* 1195 */ { MAD_F(0x06312376) /* 0.386996709 */, 15 }, + /* 1196 */ { MAD_F(0x0632e84b) /* 0.387428565 */, 15 }, + /* 1197 */ { MAD_F(0x0634ad41) /* 0.387860541 */, 15 }, + /* 1198 */ { MAD_F(0x06367257) /* 0.388292637 */, 15 }, + /* 1199 */ { MAD_F(0x0638378d) /* 0.388724854 */, 15 }, + + /* 1200 */ { MAD_F(0x0639fce4) /* 0.389157191 */, 15 }, + /* 1201 */ { MAD_F(0x063bc25b) /* 0.389589648 */, 15 }, + /* 1202 */ { MAD_F(0x063d87f2) /* 0.390022225 */, 15 }, + /* 1203 */ { MAD_F(0x063f4da9) /* 0.390454922 */, 15 }, + /* 1204 */ { MAD_F(0x06411380) /* 0.390887739 */, 15 }, + /* 1205 */ { MAD_F(0x0642d978) /* 0.391320675 */, 15 }, + /* 1206 */ { MAD_F(0x06449f8f) /* 0.391753732 */, 15 }, + /* 1207 */ { MAD_F(0x064665c7) /* 0.392186908 */, 15 }, + /* 1208 */ { MAD_F(0x06482c1f) /* 0.392620204 */, 15 }, + /* 1209 */ { MAD_F(0x0649f297) /* 0.393053619 */, 15 }, + /* 1210 */ { MAD_F(0x064bb92f) /* 0.393487154 */, 15 }, + /* 1211 */ { MAD_F(0x064d7fe8) /* 0.393920808 */, 15 }, + /* 1212 */ { MAD_F(0x064f46c0) /* 0.394354582 */, 15 }, + /* 1213 */ { MAD_F(0x06510db8) /* 0.394788475 */, 15 }, + /* 1214 */ { MAD_F(0x0652d4d0) /* 0.395222488 */, 15 }, + /* 1215 */ { MAD_F(0x06549c09) /* 0.395656619 */, 15 }, + + /* 1216 */ { MAD_F(0x06566361) /* 0.396090870 */, 15 }, + /* 1217 */ { MAD_F(0x06582ad9) /* 0.396525239 */, 15 }, + /* 1218 */ { MAD_F(0x0659f271) /* 0.396959728 */, 15 }, + /* 1219 */ { MAD_F(0x065bba29) /* 0.397394336 */, 15 }, + /* 1220 */ { MAD_F(0x065d8201) /* 0.397829062 */, 15 }, + /* 1221 */ { MAD_F(0x065f49f9) /* 0.398263907 */, 15 }, + /* 1222 */ { MAD_F(0x06611211) /* 0.398698871 */, 15 }, + /* 1223 */ { MAD_F(0x0662da49) /* 0.399133954 */, 15 }, + /* 1224 */ { MAD_F(0x0664a2a0) /* 0.399569155 */, 15 }, + /* 1225 */ { MAD_F(0x06666b17) /* 0.400004475 */, 15 }, + /* 1226 */ { MAD_F(0x066833ae) /* 0.400439913 */, 15 }, + /* 1227 */ { MAD_F(0x0669fc65) /* 0.400875470 */, 15 }, + /* 1228 */ { MAD_F(0x066bc53c) /* 0.401311145 */, 15 }, + /* 1229 */ { MAD_F(0x066d8e32) /* 0.401746938 */, 15 }, + /* 1230 */ { MAD_F(0x066f5748) /* 0.402182850 */, 15 }, + /* 1231 */ { MAD_F(0x0671207e) /* 0.402618879 */, 15 }, + + /* 1232 */ { MAD_F(0x0672e9d4) /* 0.403055027 */, 15 }, + /* 1233 */ { MAD_F(0x0674b349) /* 0.403491293 */, 15 }, + /* 1234 */ { MAD_F(0x06767cde) /* 0.403927676 */, 15 }, + /* 1235 */ { MAD_F(0x06784692) /* 0.404364178 */, 15 }, + /* 1236 */ { MAD_F(0x067a1066) /* 0.404800797 */, 15 }, + /* 1237 */ { MAD_F(0x067bda5a) /* 0.405237535 */, 15 }, + /* 1238 */ { MAD_F(0x067da46d) /* 0.405674390 */, 15 }, + /* 1239 */ { MAD_F(0x067f6ea0) /* 0.406111362 */, 15 }, + /* 1240 */ { MAD_F(0x068138f3) /* 0.406548452 */, 15 }, + /* 1241 */ { MAD_F(0x06830365) /* 0.406985660 */, 15 }, + /* 1242 */ { MAD_F(0x0684cdf6) /* 0.407422985 */, 15 }, + /* 1243 */ { MAD_F(0x068698a8) /* 0.407860427 */, 15 }, + /* 1244 */ { MAD_F(0x06886378) /* 0.408297987 */, 15 }, + /* 1245 */ { MAD_F(0x068a2e68) /* 0.408735664 */, 15 }, + /* 1246 */ { MAD_F(0x068bf978) /* 0.409173458 */, 15 }, + /* 1247 */ { MAD_F(0x068dc4a7) /* 0.409611370 */, 15 }, + + /* 1248 */ { MAD_F(0x068f8ff5) /* 0.410049398 */, 15 }, + /* 1249 */ { MAD_F(0x06915b63) /* 0.410487544 */, 15 }, + /* 1250 */ { MAD_F(0x069326f0) /* 0.410925806 */, 15 }, + /* 1251 */ { MAD_F(0x0694f29c) /* 0.411364185 */, 15 }, + /* 1252 */ { MAD_F(0x0696be68) /* 0.411802681 */, 15 }, + /* 1253 */ { MAD_F(0x06988a54) /* 0.412241294 */, 15 }, + /* 1254 */ { MAD_F(0x069a565e) /* 0.412680024 */, 15 }, + /* 1255 */ { MAD_F(0x069c2288) /* 0.413118870 */, 15 }, + /* 1256 */ { MAD_F(0x069deed1) /* 0.413557833 */, 15 }, + /* 1257 */ { MAD_F(0x069fbb3a) /* 0.413996912 */, 15 }, + /* 1258 */ { MAD_F(0x06a187c1) /* 0.414436108 */, 15 }, + /* 1259 */ { MAD_F(0x06a35468) /* 0.414875420 */, 15 }, + /* 1260 */ { MAD_F(0x06a5212f) /* 0.415314849 */, 15 }, + /* 1261 */ { MAD_F(0x06a6ee14) /* 0.415754393 */, 15 }, + /* 1262 */ { MAD_F(0x06a8bb18) /* 0.416194054 */, 15 }, + /* 1263 */ { MAD_F(0x06aa883c) /* 0.416633831 */, 15 }, + + /* 1264 */ { MAD_F(0x06ac557f) /* 0.417073724 */, 15 }, + /* 1265 */ { MAD_F(0x06ae22e1) /* 0.417513734 */, 15 }, + /* 1266 */ { MAD_F(0x06aff062) /* 0.417953859 */, 15 }, + /* 1267 */ { MAD_F(0x06b1be03) /* 0.418394100 */, 15 }, + /* 1268 */ { MAD_F(0x06b38bc2) /* 0.418834457 */, 15 }, + /* 1269 */ { MAD_F(0x06b559a1) /* 0.419274929 */, 15 }, + /* 1270 */ { MAD_F(0x06b7279e) /* 0.419715518 */, 15 }, + /* 1271 */ { MAD_F(0x06b8f5bb) /* 0.420156222 */, 15 }, + /* 1272 */ { MAD_F(0x06bac3f6) /* 0.420597041 */, 15 }, + /* 1273 */ { MAD_F(0x06bc9251) /* 0.421037977 */, 15 }, + /* 1274 */ { MAD_F(0x06be60cb) /* 0.421479027 */, 15 }, + /* 1275 */ { MAD_F(0x06c02f63) /* 0.421920193 */, 15 }, + /* 1276 */ { MAD_F(0x06c1fe1b) /* 0.422361475 */, 15 }, + /* 1277 */ { MAD_F(0x06c3ccf1) /* 0.422802871 */, 15 }, + /* 1278 */ { MAD_F(0x06c59be7) /* 0.423244383 */, 15 }, + /* 1279 */ { MAD_F(0x06c76afb) /* 0.423686010 */, 15 }, + + /* 1280 */ { MAD_F(0x06c93a2e) /* 0.424127753 */, 15 }, + /* 1281 */ { MAD_F(0x06cb0981) /* 0.424569610 */, 15 }, + /* 1282 */ { MAD_F(0x06ccd8f2) /* 0.425011582 */, 15 }, + /* 1283 */ { MAD_F(0x06cea881) /* 0.425453669 */, 15 }, + /* 1284 */ { MAD_F(0x06d07830) /* 0.425895871 */, 15 }, + /* 1285 */ { MAD_F(0x06d247fe) /* 0.426338188 */, 15 }, + /* 1286 */ { MAD_F(0x06d417ea) /* 0.426780620 */, 15 }, + /* 1287 */ { MAD_F(0x06d5e7f5) /* 0.427223166 */, 15 }, + /* 1288 */ { MAD_F(0x06d7b81f) /* 0.427665827 */, 15 }, + /* 1289 */ { MAD_F(0x06d98868) /* 0.428108603 */, 15 }, + /* 1290 */ { MAD_F(0x06db58cf) /* 0.428551493 */, 15 }, + /* 1291 */ { MAD_F(0x06dd2955) /* 0.428994497 */, 15 }, + /* 1292 */ { MAD_F(0x06def9fa) /* 0.429437616 */, 15 }, + /* 1293 */ { MAD_F(0x06e0cabe) /* 0.429880849 */, 15 }, + /* 1294 */ { MAD_F(0x06e29ba0) /* 0.430324197 */, 15 }, + /* 1295 */ { MAD_F(0x06e46ca1) /* 0.430767659 */, 15 }, + + /* 1296 */ { MAD_F(0x06e63dc0) /* 0.431211234 */, 15 }, + /* 1297 */ { MAD_F(0x06e80efe) /* 0.431654924 */, 15 }, + /* 1298 */ { MAD_F(0x06e9e05b) /* 0.432098728 */, 15 }, + /* 1299 */ { MAD_F(0x06ebb1d6) /* 0.432542647 */, 15 }, + /* 1300 */ { MAD_F(0x06ed8370) /* 0.432986678 */, 15 }, + /* 1301 */ { MAD_F(0x06ef5529) /* 0.433430824 */, 15 }, + /* 1302 */ { MAD_F(0x06f12700) /* 0.433875084 */, 15 }, + /* 1303 */ { MAD_F(0x06f2f8f5) /* 0.434319457 */, 15 }, + /* 1304 */ { MAD_F(0x06f4cb09) /* 0.434763944 */, 15 }, + /* 1305 */ { MAD_F(0x06f69d3c) /* 0.435208545 */, 15 }, + /* 1306 */ { MAD_F(0x06f86f8d) /* 0.435653259 */, 15 }, + /* 1307 */ { MAD_F(0x06fa41fd) /* 0.436098087 */, 15 }, + /* 1308 */ { MAD_F(0x06fc148b) /* 0.436543029 */, 15 }, + /* 1309 */ { MAD_F(0x06fde737) /* 0.436988083 */, 15 }, + /* 1310 */ { MAD_F(0x06ffba02) /* 0.437433251 */, 15 }, + /* 1311 */ { MAD_F(0x07018ceb) /* 0.437878533 */, 15 }, + + /* 1312 */ { MAD_F(0x07035ff3) /* 0.438323927 */, 15 }, + /* 1313 */ { MAD_F(0x07053319) /* 0.438769435 */, 15 }, + /* 1314 */ { MAD_F(0x0707065d) /* 0.439215056 */, 15 }, + /* 1315 */ { MAD_F(0x0708d9c0) /* 0.439660790 */, 15 }, + /* 1316 */ { MAD_F(0x070aad41) /* 0.440106636 */, 15 }, + /* 1317 */ { MAD_F(0x070c80e1) /* 0.440552596 */, 15 }, + /* 1318 */ { MAD_F(0x070e549f) /* 0.440998669 */, 15 }, + /* 1319 */ { MAD_F(0x0710287b) /* 0.441444855 */, 15 }, + /* 1320 */ { MAD_F(0x0711fc75) /* 0.441891153 */, 15 }, + /* 1321 */ { MAD_F(0x0713d08d) /* 0.442337564 */, 15 }, + /* 1322 */ { MAD_F(0x0715a4c4) /* 0.442784088 */, 15 }, + /* 1323 */ { MAD_F(0x07177919) /* 0.443230724 */, 15 }, + /* 1324 */ { MAD_F(0x07194d8c) /* 0.443677473 */, 15 }, + /* 1325 */ { MAD_F(0x071b221e) /* 0.444124334 */, 15 }, + /* 1326 */ { MAD_F(0x071cf6ce) /* 0.444571308 */, 15 }, + /* 1327 */ { MAD_F(0x071ecb9b) /* 0.445018394 */, 15 }, + + /* 1328 */ { MAD_F(0x0720a087) /* 0.445465593 */, 15 }, + /* 1329 */ { MAD_F(0x07227591) /* 0.445912903 */, 15 }, + /* 1330 */ { MAD_F(0x07244ab9) /* 0.446360326 */, 15 }, + /* 1331 */ { MAD_F(0x07262000) /* 0.446807861 */, 15 }, + /* 1332 */ { MAD_F(0x0727f564) /* 0.447255509 */, 15 }, + /* 1333 */ { MAD_F(0x0729cae7) /* 0.447703268 */, 15 }, + /* 1334 */ { MAD_F(0x072ba087) /* 0.448151139 */, 15 }, + /* 1335 */ { MAD_F(0x072d7646) /* 0.448599122 */, 15 }, + /* 1336 */ { MAD_F(0x072f4c22) /* 0.449047217 */, 15 }, + /* 1337 */ { MAD_F(0x0731221d) /* 0.449495424 */, 15 }, + /* 1338 */ { MAD_F(0x0732f835) /* 0.449943742 */, 15 }, + /* 1339 */ { MAD_F(0x0734ce6c) /* 0.450392173 */, 15 }, + /* 1340 */ { MAD_F(0x0736a4c1) /* 0.450840715 */, 15 }, + /* 1341 */ { MAD_F(0x07387b33) /* 0.451289368 */, 15 }, + /* 1342 */ { MAD_F(0x073a51c4) /* 0.451738133 */, 15 }, + /* 1343 */ { MAD_F(0x073c2872) /* 0.452187010 */, 15 }, + + /* 1344 */ { MAD_F(0x073dff3e) /* 0.452635998 */, 15 }, + /* 1345 */ { MAD_F(0x073fd628) /* 0.453085097 */, 15 }, + /* 1346 */ { MAD_F(0x0741ad30) /* 0.453534308 */, 15 }, + /* 1347 */ { MAD_F(0x07438456) /* 0.453983630 */, 15 }, + /* 1348 */ { MAD_F(0x07455b9a) /* 0.454433063 */, 15 }, + /* 1349 */ { MAD_F(0x074732fc) /* 0.454882607 */, 15 }, + /* 1350 */ { MAD_F(0x07490a7b) /* 0.455332262 */, 15 }, + /* 1351 */ { MAD_F(0x074ae218) /* 0.455782029 */, 15 }, + /* 1352 */ { MAD_F(0x074cb9d3) /* 0.456231906 */, 15 }, + /* 1353 */ { MAD_F(0x074e91ac) /* 0.456681894 */, 15 }, + /* 1354 */ { MAD_F(0x075069a3) /* 0.457131993 */, 15 }, + /* 1355 */ { MAD_F(0x075241b7) /* 0.457582203 */, 15 }, + /* 1356 */ { MAD_F(0x075419e9) /* 0.458032524 */, 15 }, + /* 1357 */ { MAD_F(0x0755f239) /* 0.458482956 */, 15 }, + /* 1358 */ { MAD_F(0x0757caa7) /* 0.458933498 */, 15 }, + /* 1359 */ { MAD_F(0x0759a332) /* 0.459384151 */, 15 }, + + /* 1360 */ { MAD_F(0x075b7bdb) /* 0.459834914 */, 15 }, + /* 1361 */ { MAD_F(0x075d54a1) /* 0.460285788 */, 15 }, + /* 1362 */ { MAD_F(0x075f2d85) /* 0.460736772 */, 15 }, + /* 1363 */ { MAD_F(0x07610687) /* 0.461187867 */, 15 }, + /* 1364 */ { MAD_F(0x0762dfa6) /* 0.461639071 */, 15 }, + /* 1365 */ { MAD_F(0x0764b8e3) /* 0.462090387 */, 15 }, + /* 1366 */ { MAD_F(0x0766923e) /* 0.462541812 */, 15 }, + /* 1367 */ { MAD_F(0x07686bb6) /* 0.462993348 */, 15 }, + /* 1368 */ { MAD_F(0x076a454c) /* 0.463444993 */, 15 }, + /* 1369 */ { MAD_F(0x076c1eff) /* 0.463896749 */, 15 }, + /* 1370 */ { MAD_F(0x076df8d0) /* 0.464348615 */, 15 }, + /* 1371 */ { MAD_F(0x076fd2be) /* 0.464800591 */, 15 }, + /* 1372 */ { MAD_F(0x0771acca) /* 0.465252676 */, 15 }, + /* 1373 */ { MAD_F(0x077386f3) /* 0.465704872 */, 15 }, + /* 1374 */ { MAD_F(0x0775613a) /* 0.466157177 */, 15 }, + /* 1375 */ { MAD_F(0x07773b9e) /* 0.466609592 */, 15 }, + + /* 1376 */ { MAD_F(0x07791620) /* 0.467062117 */, 15 }, + /* 1377 */ { MAD_F(0x077af0bf) /* 0.467514751 */, 15 }, + /* 1378 */ { MAD_F(0x077ccb7c) /* 0.467967495 */, 15 }, + /* 1379 */ { MAD_F(0x077ea656) /* 0.468420349 */, 15 }, + /* 1380 */ { MAD_F(0x0780814d) /* 0.468873312 */, 15 }, + /* 1381 */ { MAD_F(0x07825c62) /* 0.469326384 */, 15 }, + /* 1382 */ { MAD_F(0x07843794) /* 0.469779566 */, 15 }, + /* 1383 */ { MAD_F(0x078612e3) /* 0.470232857 */, 15 }, + /* 1384 */ { MAD_F(0x0787ee50) /* 0.470686258 */, 15 }, + /* 1385 */ { MAD_F(0x0789c9da) /* 0.471139767 */, 15 }, + /* 1386 */ { MAD_F(0x078ba581) /* 0.471593386 */, 15 }, + /* 1387 */ { MAD_F(0x078d8146) /* 0.472047114 */, 15 }, + /* 1388 */ { MAD_F(0x078f5d28) /* 0.472500951 */, 15 }, + /* 1389 */ { MAD_F(0x07913927) /* 0.472954896 */, 15 }, + /* 1390 */ { MAD_F(0x07931543) /* 0.473408951 */, 15 }, + /* 1391 */ { MAD_F(0x0794f17d) /* 0.473863115 */, 15 }, + + /* 1392 */ { MAD_F(0x0796cdd4) /* 0.474317388 */, 15 }, + /* 1393 */ { MAD_F(0x0798aa48) /* 0.474771769 */, 15 }, + /* 1394 */ { MAD_F(0x079a86d9) /* 0.475226259 */, 15 }, + /* 1395 */ { MAD_F(0x079c6388) /* 0.475680858 */, 15 }, + /* 1396 */ { MAD_F(0x079e4053) /* 0.476135565 */, 15 }, + /* 1397 */ { MAD_F(0x07a01d3c) /* 0.476590381 */, 15 }, + /* 1398 */ { MAD_F(0x07a1fa42) /* 0.477045306 */, 15 }, + /* 1399 */ { MAD_F(0x07a3d765) /* 0.477500339 */, 15 }, + /* 1400 */ { MAD_F(0x07a5b4a5) /* 0.477955481 */, 15 }, + /* 1401 */ { MAD_F(0x07a79202) /* 0.478410731 */, 15 }, + /* 1402 */ { MAD_F(0x07a96f7d) /* 0.478866089 */, 15 }, + /* 1403 */ { MAD_F(0x07ab4d14) /* 0.479321555 */, 15 }, + /* 1404 */ { MAD_F(0x07ad2ac8) /* 0.479777130 */, 15 }, + /* 1405 */ { MAD_F(0x07af089a) /* 0.480232813 */, 15 }, + /* 1406 */ { MAD_F(0x07b0e688) /* 0.480688604 */, 15 }, + /* 1407 */ { MAD_F(0x07b2c494) /* 0.481144503 */, 15 }, + + /* 1408 */ { MAD_F(0x07b4a2bc) /* 0.481600510 */, 15 }, + /* 1409 */ { MAD_F(0x07b68102) /* 0.482056625 */, 15 }, + /* 1410 */ { MAD_F(0x07b85f64) /* 0.482512848 */, 15 }, + /* 1411 */ { MAD_F(0x07ba3de4) /* 0.482969179 */, 15 }, + /* 1412 */ { MAD_F(0x07bc1c80) /* 0.483425618 */, 15 }, + /* 1413 */ { MAD_F(0x07bdfb39) /* 0.483882164 */, 15 }, + /* 1414 */ { MAD_F(0x07bfda0f) /* 0.484338818 */, 15 }, + /* 1415 */ { MAD_F(0x07c1b902) /* 0.484795580 */, 15 }, + /* 1416 */ { MAD_F(0x07c39812) /* 0.485252449 */, 15 }, + /* 1417 */ { MAD_F(0x07c5773f) /* 0.485709426 */, 15 }, + /* 1418 */ { MAD_F(0x07c75689) /* 0.486166511 */, 15 }, + /* 1419 */ { MAD_F(0x07c935ef) /* 0.486623703 */, 15 }, + /* 1420 */ { MAD_F(0x07cb1573) /* 0.487081002 */, 15 }, + /* 1421 */ { MAD_F(0x07ccf513) /* 0.487538409 */, 15 }, + /* 1422 */ { MAD_F(0x07ced4d0) /* 0.487995923 */, 15 }, + /* 1423 */ { MAD_F(0x07d0b4aa) /* 0.488453544 */, 15 }, + + /* 1424 */ { MAD_F(0x07d294a0) /* 0.488911273 */, 15 }, + /* 1425 */ { MAD_F(0x07d474b3) /* 0.489369108 */, 15 }, + /* 1426 */ { MAD_F(0x07d654e4) /* 0.489827051 */, 15 }, + /* 1427 */ { MAD_F(0x07d83530) /* 0.490285101 */, 15 }, + /* 1428 */ { MAD_F(0x07da159a) /* 0.490743258 */, 15 }, + /* 1429 */ { MAD_F(0x07dbf620) /* 0.491201522 */, 15 }, + /* 1430 */ { MAD_F(0x07ddd6c3) /* 0.491659892 */, 15 }, + /* 1431 */ { MAD_F(0x07dfb783) /* 0.492118370 */, 15 }, + /* 1432 */ { MAD_F(0x07e1985f) /* 0.492576954 */, 15 }, + /* 1433 */ { MAD_F(0x07e37958) /* 0.493035645 */, 15 }, + /* 1434 */ { MAD_F(0x07e55a6e) /* 0.493494443 */, 15 }, + /* 1435 */ { MAD_F(0x07e73ba0) /* 0.493953348 */, 15 }, + /* 1436 */ { MAD_F(0x07e91cef) /* 0.494412359 */, 15 }, + /* 1437 */ { MAD_F(0x07eafe5a) /* 0.494871476 */, 15 }, + /* 1438 */ { MAD_F(0x07ecdfe2) /* 0.495330701 */, 15 }, + /* 1439 */ { MAD_F(0x07eec187) /* 0.495790031 */, 15 }, + + /* 1440 */ { MAD_F(0x07f0a348) /* 0.496249468 */, 15 }, + /* 1441 */ { MAD_F(0x07f28526) /* 0.496709012 */, 15 }, + /* 1442 */ { MAD_F(0x07f46720) /* 0.497168662 */, 15 }, + /* 1443 */ { MAD_F(0x07f64937) /* 0.497628418 */, 15 }, + /* 1444 */ { MAD_F(0x07f82b6a) /* 0.498088280 */, 15 }, + /* 1445 */ { MAD_F(0x07fa0dba) /* 0.498548248 */, 15 }, + /* 1446 */ { MAD_F(0x07fbf026) /* 0.499008323 */, 15 }, + /* 1447 */ { MAD_F(0x07fdd2af) /* 0.499468503 */, 15 }, + /* 1448 */ { MAD_F(0x07ffb554) /* 0.499928790 */, 15 }, + /* 1449 */ { MAD_F(0x0400cc0b) /* 0.250194591 */, 16 }, + /* 1450 */ { MAD_F(0x0401bd7a) /* 0.250424840 */, 16 }, + /* 1451 */ { MAD_F(0x0402aef7) /* 0.250655143 */, 16 }, + /* 1452 */ { MAD_F(0x0403a083) /* 0.250885498 */, 16 }, + /* 1453 */ { MAD_F(0x0404921c) /* 0.251115906 */, 16 }, + /* 1454 */ { MAD_F(0x040583c4) /* 0.251346367 */, 16 }, + /* 1455 */ { MAD_F(0x0406757a) /* 0.251576880 */, 16 }, + + /* 1456 */ { MAD_F(0x0407673f) /* 0.251807447 */, 16 }, + /* 1457 */ { MAD_F(0x04085911) /* 0.252038066 */, 16 }, + /* 1458 */ { MAD_F(0x04094af1) /* 0.252268738 */, 16 }, + /* 1459 */ { MAD_F(0x040a3ce0) /* 0.252499463 */, 16 }, + /* 1460 */ { MAD_F(0x040b2edd) /* 0.252730240 */, 16 }, + /* 1461 */ { MAD_F(0x040c20e8) /* 0.252961071 */, 16 }, + /* 1462 */ { MAD_F(0x040d1301) /* 0.253191953 */, 16 }, + /* 1463 */ { MAD_F(0x040e0529) /* 0.253422889 */, 16 }, + /* 1464 */ { MAD_F(0x040ef75e) /* 0.253653877 */, 16 }, + /* 1465 */ { MAD_F(0x040fe9a1) /* 0.253884918 */, 16 }, + /* 1466 */ { MAD_F(0x0410dbf3) /* 0.254116011 */, 16 }, + /* 1467 */ { MAD_F(0x0411ce53) /* 0.254347157 */, 16 }, + /* 1468 */ { MAD_F(0x0412c0c1) /* 0.254578356 */, 16 }, + /* 1469 */ { MAD_F(0x0413b33d) /* 0.254809606 */, 16 }, + /* 1470 */ { MAD_F(0x0414a5c7) /* 0.255040910 */, 16 }, + /* 1471 */ { MAD_F(0x0415985f) /* 0.255272266 */, 16 }, + + /* 1472 */ { MAD_F(0x04168b05) /* 0.255503674 */, 16 }, + /* 1473 */ { MAD_F(0x04177db9) /* 0.255735135 */, 16 }, + /* 1474 */ { MAD_F(0x0418707c) /* 0.255966648 */, 16 }, + /* 1475 */ { MAD_F(0x0419634c) /* 0.256198213 */, 16 }, + /* 1476 */ { MAD_F(0x041a562a) /* 0.256429831 */, 16 }, + /* 1477 */ { MAD_F(0x041b4917) /* 0.256661501 */, 16 }, + /* 1478 */ { MAD_F(0x041c3c11) /* 0.256893223 */, 16 }, + /* 1479 */ { MAD_F(0x041d2f1a) /* 0.257124998 */, 16 }, + /* 1480 */ { MAD_F(0x041e2230) /* 0.257356825 */, 16 }, + /* 1481 */ { MAD_F(0x041f1555) /* 0.257588704 */, 16 }, + /* 1482 */ { MAD_F(0x04200888) /* 0.257820635 */, 16 }, + /* 1483 */ { MAD_F(0x0420fbc8) /* 0.258052619 */, 16 }, + /* 1484 */ { MAD_F(0x0421ef17) /* 0.258284654 */, 16 }, + /* 1485 */ { MAD_F(0x0422e273) /* 0.258516742 */, 16 }, + /* 1486 */ { MAD_F(0x0423d5de) /* 0.258748882 */, 16 }, + /* 1487 */ { MAD_F(0x0424c956) /* 0.258981074 */, 16 }, + + /* 1488 */ { MAD_F(0x0425bcdd) /* 0.259213318 */, 16 }, + /* 1489 */ { MAD_F(0x0426b071) /* 0.259445614 */, 16 }, + /* 1490 */ { MAD_F(0x0427a414) /* 0.259677962 */, 16 }, + /* 1491 */ { MAD_F(0x042897c4) /* 0.259910362 */, 16 }, + /* 1492 */ { MAD_F(0x04298b83) /* 0.260142814 */, 16 }, + /* 1493 */ { MAD_F(0x042a7f4f) /* 0.260375318 */, 16 }, + /* 1494 */ { MAD_F(0x042b7329) /* 0.260607874 */, 16 }, + /* 1495 */ { MAD_F(0x042c6711) /* 0.260840481 */, 16 }, + /* 1496 */ { MAD_F(0x042d5b07) /* 0.261073141 */, 16 }, + /* 1497 */ { MAD_F(0x042e4f0b) /* 0.261305852 */, 16 }, + /* 1498 */ { MAD_F(0x042f431d) /* 0.261538616 */, 16 }, + /* 1499 */ { MAD_F(0x0430373d) /* 0.261771431 */, 16 }, + /* 1500 */ { MAD_F(0x04312b6b) /* 0.262004297 */, 16 }, + /* 1501 */ { MAD_F(0x04321fa6) /* 0.262237216 */, 16 }, + /* 1502 */ { MAD_F(0x043313f0) /* 0.262470186 */, 16 }, + /* 1503 */ { MAD_F(0x04340847) /* 0.262703208 */, 16 }, + + /* 1504 */ { MAD_F(0x0434fcad) /* 0.262936282 */, 16 }, + /* 1505 */ { MAD_F(0x0435f120) /* 0.263169407 */, 16 }, + /* 1506 */ { MAD_F(0x0436e5a1) /* 0.263402584 */, 16 }, + /* 1507 */ { MAD_F(0x0437da2f) /* 0.263635813 */, 16 }, + /* 1508 */ { MAD_F(0x0438cecc) /* 0.263869093 */, 16 }, + /* 1509 */ { MAD_F(0x0439c377) /* 0.264102425 */, 16 }, + /* 1510 */ { MAD_F(0x043ab82f) /* 0.264335808 */, 16 }, + /* 1511 */ { MAD_F(0x043bacf5) /* 0.264569243 */, 16 }, + /* 1512 */ { MAD_F(0x043ca1c9) /* 0.264802730 */, 16 }, + /* 1513 */ { MAD_F(0x043d96ab) /* 0.265036267 */, 16 }, + /* 1514 */ { MAD_F(0x043e8b9b) /* 0.265269857 */, 16 }, + /* 1515 */ { MAD_F(0x043f8098) /* 0.265503498 */, 16 }, + /* 1516 */ { MAD_F(0x044075a3) /* 0.265737190 */, 16 }, + /* 1517 */ { MAD_F(0x04416abc) /* 0.265970933 */, 16 }, + /* 1518 */ { MAD_F(0x04425fe3) /* 0.266204728 */, 16 }, + /* 1519 */ { MAD_F(0x04435518) /* 0.266438574 */, 16 }, + + /* 1520 */ { MAD_F(0x04444a5a) /* 0.266672472 */, 16 }, + /* 1521 */ { MAD_F(0x04453fab) /* 0.266906421 */, 16 }, + /* 1522 */ { MAD_F(0x04463508) /* 0.267140421 */, 16 }, + /* 1523 */ { MAD_F(0x04472a74) /* 0.267374472 */, 16 }, + /* 1524 */ { MAD_F(0x04481fee) /* 0.267608575 */, 16 }, + /* 1525 */ { MAD_F(0x04491575) /* 0.267842729 */, 16 }, + /* 1526 */ { MAD_F(0x044a0b0a) /* 0.268076934 */, 16 }, + /* 1527 */ { MAD_F(0x044b00ac) /* 0.268311190 */, 16 }, + /* 1528 */ { MAD_F(0x044bf65d) /* 0.268545497 */, 16 }, + /* 1529 */ { MAD_F(0x044cec1b) /* 0.268779856 */, 16 }, + /* 1530 */ { MAD_F(0x044de1e7) /* 0.269014265 */, 16 }, + /* 1531 */ { MAD_F(0x044ed7c0) /* 0.269248726 */, 16 }, + /* 1532 */ { MAD_F(0x044fcda8) /* 0.269483238 */, 16 }, + /* 1533 */ { MAD_F(0x0450c39c) /* 0.269717800 */, 16 }, + /* 1534 */ { MAD_F(0x0451b99f) /* 0.269952414 */, 16 }, + /* 1535 */ { MAD_F(0x0452afaf) /* 0.270187079 */, 16 }, + + /* 1536 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 16 }, + /* 1537 */ { MAD_F(0x04549bf9) /* 0.270656561 */, 16 }, + /* 1538 */ { MAD_F(0x04559232) /* 0.270891379 */, 16 }, + /* 1539 */ { MAD_F(0x04568879) /* 0.271126247 */, 16 }, + /* 1540 */ { MAD_F(0x04577ece) /* 0.271361166 */, 16 }, + /* 1541 */ { MAD_F(0x04587530) /* 0.271596136 */, 16 }, + /* 1542 */ { MAD_F(0x04596ba0) /* 0.271831157 */, 16 }, + /* 1543 */ { MAD_F(0x045a621e) /* 0.272066229 */, 16 }, + /* 1544 */ { MAD_F(0x045b58a9) /* 0.272301352 */, 16 }, + /* 1545 */ { MAD_F(0x045c4f42) /* 0.272536525 */, 16 }, + /* 1546 */ { MAD_F(0x045d45e9) /* 0.272771749 */, 16 }, + /* 1547 */ { MAD_F(0x045e3c9d) /* 0.273007024 */, 16 }, + /* 1548 */ { MAD_F(0x045f335e) /* 0.273242350 */, 16 }, + /* 1549 */ { MAD_F(0x04602a2e) /* 0.273477726 */, 16 }, + /* 1550 */ { MAD_F(0x0461210b) /* 0.273713153 */, 16 }, + /* 1551 */ { MAD_F(0x046217f5) /* 0.273948630 */, 16 }, + + /* 1552 */ { MAD_F(0x04630eed) /* 0.274184158 */, 16 }, + /* 1553 */ { MAD_F(0x046405f3) /* 0.274419737 */, 16 }, + /* 1554 */ { MAD_F(0x0464fd06) /* 0.274655366 */, 16 }, + /* 1555 */ { MAD_F(0x0465f427) /* 0.274891046 */, 16 }, + /* 1556 */ { MAD_F(0x0466eb55) /* 0.275126776 */, 16 }, + /* 1557 */ { MAD_F(0x0467e291) /* 0.275362557 */, 16 }, + /* 1558 */ { MAD_F(0x0468d9db) /* 0.275598389 */, 16 }, + /* 1559 */ { MAD_F(0x0469d132) /* 0.275834270 */, 16 }, + /* 1560 */ { MAD_F(0x046ac896) /* 0.276070203 */, 16 }, + /* 1561 */ { MAD_F(0x046bc009) /* 0.276306185 */, 16 }, + /* 1562 */ { MAD_F(0x046cb788) /* 0.276542218 */, 16 }, + /* 1563 */ { MAD_F(0x046daf15) /* 0.276778302 */, 16 }, + /* 1564 */ { MAD_F(0x046ea6b0) /* 0.277014435 */, 16 }, + /* 1565 */ { MAD_F(0x046f9e58) /* 0.277250619 */, 16 }, + /* 1566 */ { MAD_F(0x0470960e) /* 0.277486854 */, 16 }, + /* 1567 */ { MAD_F(0x04718dd1) /* 0.277723139 */, 16 }, + + /* 1568 */ { MAD_F(0x047285a2) /* 0.277959474 */, 16 }, + /* 1569 */ { MAD_F(0x04737d80) /* 0.278195859 */, 16 }, + /* 1570 */ { MAD_F(0x0474756c) /* 0.278432294 */, 16 }, + /* 1571 */ { MAD_F(0x04756d65) /* 0.278668780 */, 16 }, + /* 1572 */ { MAD_F(0x0476656b) /* 0.278905316 */, 16 }, + /* 1573 */ { MAD_F(0x04775d7f) /* 0.279141902 */, 16 }, + /* 1574 */ { MAD_F(0x047855a1) /* 0.279378538 */, 16 }, + /* 1575 */ { MAD_F(0x04794dd0) /* 0.279615224 */, 16 }, + /* 1576 */ { MAD_F(0x047a460c) /* 0.279851960 */, 16 }, + /* 1577 */ { MAD_F(0x047b3e56) /* 0.280088747 */, 16 }, + /* 1578 */ { MAD_F(0x047c36ae) /* 0.280325583 */, 16 }, + /* 1579 */ { MAD_F(0x047d2f12) /* 0.280562470 */, 16 }, + /* 1580 */ { MAD_F(0x047e2784) /* 0.280799406 */, 16 }, + /* 1581 */ { MAD_F(0x047f2004) /* 0.281036393 */, 16 }, + /* 1582 */ { MAD_F(0x04801891) /* 0.281273429 */, 16 }, + /* 1583 */ { MAD_F(0x0481112b) /* 0.281510516 */, 16 }, + + /* 1584 */ { MAD_F(0x048209d3) /* 0.281747652 */, 16 }, + /* 1585 */ { MAD_F(0x04830288) /* 0.281984838 */, 16 }, + /* 1586 */ { MAD_F(0x0483fb4b) /* 0.282222075 */, 16 }, + /* 1587 */ { MAD_F(0x0484f41b) /* 0.282459361 */, 16 }, + /* 1588 */ { MAD_F(0x0485ecf8) /* 0.282696697 */, 16 }, + /* 1589 */ { MAD_F(0x0486e5e3) /* 0.282934082 */, 16 }, + /* 1590 */ { MAD_F(0x0487dedb) /* 0.283171518 */, 16 }, + /* 1591 */ { MAD_F(0x0488d7e1) /* 0.283409003 */, 16 }, + /* 1592 */ { MAD_F(0x0489d0f4) /* 0.283646538 */, 16 }, + /* 1593 */ { MAD_F(0x048aca14) /* 0.283884123 */, 16 }, + /* 1594 */ { MAD_F(0x048bc341) /* 0.284121757 */, 16 }, + /* 1595 */ { MAD_F(0x048cbc7c) /* 0.284359441 */, 16 }, + /* 1596 */ { MAD_F(0x048db5c4) /* 0.284597175 */, 16 }, + /* 1597 */ { MAD_F(0x048eaf1a) /* 0.284834959 */, 16 }, + /* 1598 */ { MAD_F(0x048fa87d) /* 0.285072792 */, 16 }, + /* 1599 */ { MAD_F(0x0490a1ed) /* 0.285310675 */, 16 }, + + /* 1600 */ { MAD_F(0x04919b6a) /* 0.285548607 */, 16 }, + /* 1601 */ { MAD_F(0x049294f5) /* 0.285786589 */, 16 }, + /* 1602 */ { MAD_F(0x04938e8d) /* 0.286024621 */, 16 }, + /* 1603 */ { MAD_F(0x04948833) /* 0.286262702 */, 16 }, + /* 1604 */ { MAD_F(0x049581e5) /* 0.286500832 */, 16 }, + /* 1605 */ { MAD_F(0x04967ba5) /* 0.286739012 */, 16 }, + /* 1606 */ { MAD_F(0x04977573) /* 0.286977242 */, 16 }, + /* 1607 */ { MAD_F(0x04986f4d) /* 0.287215521 */, 16 }, + /* 1608 */ { MAD_F(0x04996935) /* 0.287453849 */, 16 }, + /* 1609 */ { MAD_F(0x049a632a) /* 0.287692227 */, 16 }, + /* 1610 */ { MAD_F(0x049b5d2c) /* 0.287930654 */, 16 }, + /* 1611 */ { MAD_F(0x049c573c) /* 0.288169131 */, 16 }, + /* 1612 */ { MAD_F(0x049d5159) /* 0.288407657 */, 16 }, + /* 1613 */ { MAD_F(0x049e4b83) /* 0.288646232 */, 16 }, + /* 1614 */ { MAD_F(0x049f45ba) /* 0.288884857 */, 16 }, + /* 1615 */ { MAD_F(0x04a03ffe) /* 0.289123530 */, 16 }, + + /* 1616 */ { MAD_F(0x04a13a50) /* 0.289362253 */, 16 }, + /* 1617 */ { MAD_F(0x04a234af) /* 0.289601026 */, 16 }, + /* 1618 */ { MAD_F(0x04a32f1b) /* 0.289839847 */, 16 }, + /* 1619 */ { MAD_F(0x04a42995) /* 0.290078718 */, 16 }, + /* 1620 */ { MAD_F(0x04a5241b) /* 0.290317638 */, 16 }, + /* 1621 */ { MAD_F(0x04a61eaf) /* 0.290556607 */, 16 }, + /* 1622 */ { MAD_F(0x04a71950) /* 0.290795626 */, 16 }, + /* 1623 */ { MAD_F(0x04a813fe) /* 0.291034693 */, 16 }, + /* 1624 */ { MAD_F(0x04a90eba) /* 0.291273810 */, 16 }, + /* 1625 */ { MAD_F(0x04aa0982) /* 0.291512975 */, 16 }, + /* 1626 */ { MAD_F(0x04ab0458) /* 0.291752190 */, 16 }, + /* 1627 */ { MAD_F(0x04abff3b) /* 0.291991453 */, 16 }, + /* 1628 */ { MAD_F(0x04acfa2b) /* 0.292230766 */, 16 }, + /* 1629 */ { MAD_F(0x04adf528) /* 0.292470128 */, 16 }, + /* 1630 */ { MAD_F(0x04aef032) /* 0.292709539 */, 16 }, + /* 1631 */ { MAD_F(0x04afeb4a) /* 0.292948998 */, 16 }, + + /* 1632 */ { MAD_F(0x04b0e66e) /* 0.293188507 */, 16 }, + /* 1633 */ { MAD_F(0x04b1e1a0) /* 0.293428065 */, 16 }, + /* 1634 */ { MAD_F(0x04b2dcdf) /* 0.293667671 */, 16 }, + /* 1635 */ { MAD_F(0x04b3d82b) /* 0.293907326 */, 16 }, + /* 1636 */ { MAD_F(0x04b4d384) /* 0.294147031 */, 16 }, + /* 1637 */ { MAD_F(0x04b5ceea) /* 0.294386784 */, 16 }, + /* 1638 */ { MAD_F(0x04b6ca5e) /* 0.294626585 */, 16 }, + /* 1639 */ { MAD_F(0x04b7c5de) /* 0.294866436 */, 16 }, + /* 1640 */ { MAD_F(0x04b8c16c) /* 0.295106336 */, 16 }, + /* 1641 */ { MAD_F(0x04b9bd06) /* 0.295346284 */, 16 }, + /* 1642 */ { MAD_F(0x04bab8ae) /* 0.295586281 */, 16 }, + /* 1643 */ { MAD_F(0x04bbb463) /* 0.295826327 */, 16 }, + /* 1644 */ { MAD_F(0x04bcb024) /* 0.296066421 */, 16 }, + /* 1645 */ { MAD_F(0x04bdabf3) /* 0.296306564 */, 16 }, + /* 1646 */ { MAD_F(0x04bea7cf) /* 0.296546756 */, 16 }, + /* 1647 */ { MAD_F(0x04bfa3b8) /* 0.296786996 */, 16 }, + + /* 1648 */ { MAD_F(0x04c09faf) /* 0.297027285 */, 16 }, + /* 1649 */ { MAD_F(0x04c19bb2) /* 0.297267623 */, 16 }, + /* 1650 */ { MAD_F(0x04c297c2) /* 0.297508009 */, 16 }, + /* 1651 */ { MAD_F(0x04c393df) /* 0.297748444 */, 16 }, + /* 1652 */ { MAD_F(0x04c49009) /* 0.297988927 */, 16 }, + /* 1653 */ { MAD_F(0x04c58c41) /* 0.298229459 */, 16 }, + /* 1654 */ { MAD_F(0x04c68885) /* 0.298470039 */, 16 }, + /* 1655 */ { MAD_F(0x04c784d6) /* 0.298710668 */, 16 }, + /* 1656 */ { MAD_F(0x04c88135) /* 0.298951346 */, 16 }, + /* 1657 */ { MAD_F(0x04c97da0) /* 0.299192071 */, 16 }, + /* 1658 */ { MAD_F(0x04ca7a18) /* 0.299432846 */, 16 }, + /* 1659 */ { MAD_F(0x04cb769e) /* 0.299673668 */, 16 }, + /* 1660 */ { MAD_F(0x04cc7330) /* 0.299914539 */, 16 }, + /* 1661 */ { MAD_F(0x04cd6fcf) /* 0.300155459 */, 16 }, + /* 1662 */ { MAD_F(0x04ce6c7b) /* 0.300396426 */, 16 }, + /* 1663 */ { MAD_F(0x04cf6935) /* 0.300637443 */, 16 }, + + /* 1664 */ { MAD_F(0x04d065fb) /* 0.300878507 */, 16 }, + /* 1665 */ { MAD_F(0x04d162ce) /* 0.301119620 */, 16 }, + /* 1666 */ { MAD_F(0x04d25fae) /* 0.301360781 */, 16 }, + /* 1667 */ { MAD_F(0x04d35c9b) /* 0.301601990 */, 16 }, + /* 1668 */ { MAD_F(0x04d45995) /* 0.301843247 */, 16 }, + /* 1669 */ { MAD_F(0x04d5569c) /* 0.302084553 */, 16 }, + /* 1670 */ { MAD_F(0x04d653b0) /* 0.302325907 */, 16 }, + /* 1671 */ { MAD_F(0x04d750d1) /* 0.302567309 */, 16 }, + /* 1672 */ { MAD_F(0x04d84dff) /* 0.302808759 */, 16 }, + /* 1673 */ { MAD_F(0x04d94b3a) /* 0.303050257 */, 16 }, + /* 1674 */ { MAD_F(0x04da4881) /* 0.303291804 */, 16 }, + /* 1675 */ { MAD_F(0x04db45d6) /* 0.303533399 */, 16 }, + /* 1676 */ { MAD_F(0x04dc4337) /* 0.303775041 */, 16 }, + /* 1677 */ { MAD_F(0x04dd40a6) /* 0.304016732 */, 16 }, + /* 1678 */ { MAD_F(0x04de3e21) /* 0.304258471 */, 16 }, + /* 1679 */ { MAD_F(0x04df3ba9) /* 0.304500257 */, 16 }, + + /* 1680 */ { MAD_F(0x04e0393e) /* 0.304742092 */, 16 }, + /* 1681 */ { MAD_F(0x04e136e0) /* 0.304983975 */, 16 }, + /* 1682 */ { MAD_F(0x04e2348f) /* 0.305225906 */, 16 }, + /* 1683 */ { MAD_F(0x04e3324b) /* 0.305467885 */, 16 }, + /* 1684 */ { MAD_F(0x04e43013) /* 0.305709911 */, 16 }, + /* 1685 */ { MAD_F(0x04e52de9) /* 0.305951986 */, 16 }, + /* 1686 */ { MAD_F(0x04e62bcb) /* 0.306194108 */, 16 }, + /* 1687 */ { MAD_F(0x04e729ba) /* 0.306436279 */, 16 }, + /* 1688 */ { MAD_F(0x04e827b6) /* 0.306678497 */, 16 }, + /* 1689 */ { MAD_F(0x04e925bf) /* 0.306920763 */, 16 }, + /* 1690 */ { MAD_F(0x04ea23d4) /* 0.307163077 */, 16 }, + /* 1691 */ { MAD_F(0x04eb21f7) /* 0.307405438 */, 16 }, + /* 1692 */ { MAD_F(0x04ec2026) /* 0.307647848 */, 16 }, + /* 1693 */ { MAD_F(0x04ed1e62) /* 0.307890305 */, 16 }, + /* 1694 */ { MAD_F(0x04ee1cab) /* 0.308132810 */, 16 }, + /* 1695 */ { MAD_F(0x04ef1b01) /* 0.308375362 */, 16 }, + + /* 1696 */ { MAD_F(0x04f01963) /* 0.308617963 */, 16 }, + /* 1697 */ { MAD_F(0x04f117d3) /* 0.308860611 */, 16 }, + /* 1698 */ { MAD_F(0x04f2164f) /* 0.309103306 */, 16 }, + /* 1699 */ { MAD_F(0x04f314d8) /* 0.309346050 */, 16 }, + /* 1700 */ { MAD_F(0x04f4136d) /* 0.309588841 */, 16 }, + /* 1701 */ { MAD_F(0x04f51210) /* 0.309831679 */, 16 }, + /* 1702 */ { MAD_F(0x04f610bf) /* 0.310074565 */, 16 }, + /* 1703 */ { MAD_F(0x04f70f7b) /* 0.310317499 */, 16 }, + /* 1704 */ { MAD_F(0x04f80e44) /* 0.310560480 */, 16 }, + /* 1705 */ { MAD_F(0x04f90d19) /* 0.310803509 */, 16 }, + /* 1706 */ { MAD_F(0x04fa0bfc) /* 0.311046586 */, 16 }, + /* 1707 */ { MAD_F(0x04fb0aeb) /* 0.311289710 */, 16 }, + /* 1708 */ { MAD_F(0x04fc09e7) /* 0.311532881 */, 16 }, + /* 1709 */ { MAD_F(0x04fd08ef) /* 0.311776100 */, 16 }, + /* 1710 */ { MAD_F(0x04fe0805) /* 0.312019366 */, 16 }, + /* 1711 */ { MAD_F(0x04ff0727) /* 0.312262680 */, 16 }, + + /* 1712 */ { MAD_F(0x05000655) /* 0.312506041 */, 16 }, + /* 1713 */ { MAD_F(0x05010591) /* 0.312749449 */, 16 }, + /* 1714 */ { MAD_F(0x050204d9) /* 0.312992905 */, 16 }, + /* 1715 */ { MAD_F(0x0503042e) /* 0.313236408 */, 16 }, + /* 1716 */ { MAD_F(0x0504038f) /* 0.313479959 */, 16 }, + /* 1717 */ { MAD_F(0x050502fe) /* 0.313723556 */, 16 }, + /* 1718 */ { MAD_F(0x05060279) /* 0.313967202 */, 16 }, + /* 1719 */ { MAD_F(0x05070200) /* 0.314210894 */, 16 }, + /* 1720 */ { MAD_F(0x05080195) /* 0.314454634 */, 16 }, + /* 1721 */ { MAD_F(0x05090136) /* 0.314698420 */, 16 }, + /* 1722 */ { MAD_F(0x050a00e3) /* 0.314942255 */, 16 }, + /* 1723 */ { MAD_F(0x050b009e) /* 0.315186136 */, 16 }, + /* 1724 */ { MAD_F(0x050c0065) /* 0.315430064 */, 16 }, + /* 1725 */ { MAD_F(0x050d0039) /* 0.315674040 */, 16 }, + /* 1726 */ { MAD_F(0x050e0019) /* 0.315918063 */, 16 }, + /* 1727 */ { MAD_F(0x050f0006) /* 0.316162133 */, 16 }, + + /* 1728 */ { MAD_F(0x05100000) /* 0.316406250 */, 16 }, + /* 1729 */ { MAD_F(0x05110006) /* 0.316650414 */, 16 }, + /* 1730 */ { MAD_F(0x05120019) /* 0.316894625 */, 16 }, + /* 1731 */ { MAD_F(0x05130039) /* 0.317138884 */, 16 }, + /* 1732 */ { MAD_F(0x05140065) /* 0.317383189 */, 16 }, + /* 1733 */ { MAD_F(0x0515009e) /* 0.317627541 */, 16 }, + /* 1734 */ { MAD_F(0x051600e3) /* 0.317871941 */, 16 }, + /* 1735 */ { MAD_F(0x05170135) /* 0.318116387 */, 16 }, + /* 1736 */ { MAD_F(0x05180194) /* 0.318360880 */, 16 }, + /* 1737 */ { MAD_F(0x051901ff) /* 0.318605421 */, 16 }, + /* 1738 */ { MAD_F(0x051a0277) /* 0.318850008 */, 16 }, + /* 1739 */ { MAD_F(0x051b02fc) /* 0.319094642 */, 16 }, + /* 1740 */ { MAD_F(0x051c038d) /* 0.319339323 */, 16 }, + /* 1741 */ { MAD_F(0x051d042a) /* 0.319584051 */, 16 }, + /* 1742 */ { MAD_F(0x051e04d4) /* 0.319828826 */, 16 }, + /* 1743 */ { MAD_F(0x051f058b) /* 0.320073647 */, 16 }, + + /* 1744 */ { MAD_F(0x0520064f) /* 0.320318516 */, 16 }, + /* 1745 */ { MAD_F(0x0521071f) /* 0.320563431 */, 16 }, + /* 1746 */ { MAD_F(0x052207fb) /* 0.320808393 */, 16 }, + /* 1747 */ { MAD_F(0x052308e4) /* 0.321053402 */, 16 }, + /* 1748 */ { MAD_F(0x052409da) /* 0.321298457 */, 16 }, + /* 1749 */ { MAD_F(0x05250adc) /* 0.321543560 */, 16 }, + /* 1750 */ { MAD_F(0x05260bea) /* 0.321788709 */, 16 }, + /* 1751 */ { MAD_F(0x05270d06) /* 0.322033904 */, 16 }, + /* 1752 */ { MAD_F(0x05280e2d) /* 0.322279147 */, 16 }, + /* 1753 */ { MAD_F(0x05290f62) /* 0.322524436 */, 16 }, + /* 1754 */ { MAD_F(0x052a10a3) /* 0.322769771 */, 16 }, + /* 1755 */ { MAD_F(0x052b11f0) /* 0.323015154 */, 16 }, + /* 1756 */ { MAD_F(0x052c134a) /* 0.323260583 */, 16 }, + /* 1757 */ { MAD_F(0x052d14b0) /* 0.323506058 */, 16 }, + /* 1758 */ { MAD_F(0x052e1623) /* 0.323751580 */, 16 }, + /* 1759 */ { MAD_F(0x052f17a2) /* 0.323997149 */, 16 }, + + /* 1760 */ { MAD_F(0x0530192e) /* 0.324242764 */, 16 }, + /* 1761 */ { MAD_F(0x05311ac6) /* 0.324488426 */, 16 }, + /* 1762 */ { MAD_F(0x05321c6b) /* 0.324734134 */, 16 }, + /* 1763 */ { MAD_F(0x05331e1c) /* 0.324979889 */, 16 }, + /* 1764 */ { MAD_F(0x05341fda) /* 0.325225690 */, 16 }, + /* 1765 */ { MAD_F(0x053521a4) /* 0.325471538 */, 16 }, + /* 1766 */ { MAD_F(0x0536237b) /* 0.325717432 */, 16 }, + /* 1767 */ { MAD_F(0x0537255e) /* 0.325963372 */, 16 }, + /* 1768 */ { MAD_F(0x0538274e) /* 0.326209359 */, 16 }, + /* 1769 */ { MAD_F(0x0539294a) /* 0.326455392 */, 16 }, + /* 1770 */ { MAD_F(0x053a2b52) /* 0.326701472 */, 16 }, + /* 1771 */ { MAD_F(0x053b2d67) /* 0.326947598 */, 16 }, + /* 1772 */ { MAD_F(0x053c2f89) /* 0.327193770 */, 16 }, + /* 1773 */ { MAD_F(0x053d31b6) /* 0.327439989 */, 16 }, + /* 1774 */ { MAD_F(0x053e33f1) /* 0.327686254 */, 16 }, + /* 1775 */ { MAD_F(0x053f3637) /* 0.327932565 */, 16 }, + + /* 1776 */ { MAD_F(0x0540388a) /* 0.328178922 */, 16 }, + /* 1777 */ { MAD_F(0x05413aea) /* 0.328425326 */, 16 }, + /* 1778 */ { MAD_F(0x05423d56) /* 0.328671776 */, 16 }, + /* 1779 */ { MAD_F(0x05433fce) /* 0.328918272 */, 16 }, + /* 1780 */ { MAD_F(0x05444253) /* 0.329164814 */, 16 }, + /* 1781 */ { MAD_F(0x054544e4) /* 0.329411403 */, 16 }, + /* 1782 */ { MAD_F(0x05464781) /* 0.329658038 */, 16 }, + /* 1783 */ { MAD_F(0x05474a2b) /* 0.329904718 */, 16 }, + /* 1784 */ { MAD_F(0x05484ce2) /* 0.330151445 */, 16 }, + /* 1785 */ { MAD_F(0x05494fa4) /* 0.330398218 */, 16 }, + /* 1786 */ { MAD_F(0x054a5273) /* 0.330645037 */, 16 }, + /* 1787 */ { MAD_F(0x054b554e) /* 0.330891903 */, 16 }, + /* 1788 */ { MAD_F(0x054c5836) /* 0.331138814 */, 16 }, + /* 1789 */ { MAD_F(0x054d5b2a) /* 0.331385771 */, 16 }, + /* 1790 */ { MAD_F(0x054e5e2b) /* 0.331632774 */, 16 }, + /* 1791 */ { MAD_F(0x054f6138) /* 0.331879824 */, 16 }, + + /* 1792 */ { MAD_F(0x05506451) /* 0.332126919 */, 16 }, + /* 1793 */ { MAD_F(0x05516776) /* 0.332374060 */, 16 }, + /* 1794 */ { MAD_F(0x05526aa8) /* 0.332621247 */, 16 }, + /* 1795 */ { MAD_F(0x05536de6) /* 0.332868480 */, 16 }, + /* 1796 */ { MAD_F(0x05547131) /* 0.333115759 */, 16 }, + /* 1797 */ { MAD_F(0x05557487) /* 0.333363084 */, 16 }, + /* 1798 */ { MAD_F(0x055677ea) /* 0.333610455 */, 16 }, + /* 1799 */ { MAD_F(0x05577b5a) /* 0.333857872 */, 16 }, + /* 1800 */ { MAD_F(0x05587ed5) /* 0.334105334 */, 16 }, + /* 1801 */ { MAD_F(0x0559825e) /* 0.334352843 */, 16 }, + /* 1802 */ { MAD_F(0x055a85f2) /* 0.334600397 */, 16 }, + /* 1803 */ { MAD_F(0x055b8992) /* 0.334847997 */, 16 }, + /* 1804 */ { MAD_F(0x055c8d3f) /* 0.335095642 */, 16 }, + /* 1805 */ { MAD_F(0x055d90f9) /* 0.335343334 */, 16 }, + /* 1806 */ { MAD_F(0x055e94be) /* 0.335591071 */, 16 }, + /* 1807 */ { MAD_F(0x055f9890) /* 0.335838854 */, 16 }, + + /* 1808 */ { MAD_F(0x05609c6e) /* 0.336086683 */, 16 }, + /* 1809 */ { MAD_F(0x0561a058) /* 0.336334557 */, 16 }, + /* 1810 */ { MAD_F(0x0562a44f) /* 0.336582477 */, 16 }, + /* 1811 */ { MAD_F(0x0563a851) /* 0.336830443 */, 16 }, + /* 1812 */ { MAD_F(0x0564ac60) /* 0.337078454 */, 16 }, + /* 1813 */ { MAD_F(0x0565b07c) /* 0.337326511 */, 16 }, + /* 1814 */ { MAD_F(0x0566b4a3) /* 0.337574614 */, 16 }, + /* 1815 */ { MAD_F(0x0567b8d7) /* 0.337822762 */, 16 }, + /* 1816 */ { MAD_F(0x0568bd17) /* 0.338070956 */, 16 }, + /* 1817 */ { MAD_F(0x0569c163) /* 0.338319195 */, 16 }, + /* 1818 */ { MAD_F(0x056ac5bc) /* 0.338567480 */, 16 }, + /* 1819 */ { MAD_F(0x056bca20) /* 0.338815811 */, 16 }, + /* 1820 */ { MAD_F(0x056cce91) /* 0.339064186 */, 16 }, + /* 1821 */ { MAD_F(0x056dd30e) /* 0.339312608 */, 16 }, + /* 1822 */ { MAD_F(0x056ed798) /* 0.339561075 */, 16 }, + /* 1823 */ { MAD_F(0x056fdc2d) /* 0.339809587 */, 16 }, + + /* 1824 */ { MAD_F(0x0570e0cf) /* 0.340058145 */, 16 }, + /* 1825 */ { MAD_F(0x0571e57d) /* 0.340306748 */, 16 }, + /* 1826 */ { MAD_F(0x0572ea37) /* 0.340555397 */, 16 }, + /* 1827 */ { MAD_F(0x0573eefd) /* 0.340804091 */, 16 }, + /* 1828 */ { MAD_F(0x0574f3d0) /* 0.341052830 */, 16 }, + /* 1829 */ { MAD_F(0x0575f8ae) /* 0.341301615 */, 16 }, + /* 1830 */ { MAD_F(0x0576fd99) /* 0.341550445 */, 16 }, + /* 1831 */ { MAD_F(0x05780290) /* 0.341799321 */, 16 }, + /* 1832 */ { MAD_F(0x05790793) /* 0.342048241 */, 16 }, + /* 1833 */ { MAD_F(0x057a0ca3) /* 0.342297207 */, 16 }, + /* 1834 */ { MAD_F(0x057b11be) /* 0.342546219 */, 16 }, + /* 1835 */ { MAD_F(0x057c16e6) /* 0.342795275 */, 16 }, + /* 1836 */ { MAD_F(0x057d1c1a) /* 0.343044377 */, 16 }, + /* 1837 */ { MAD_F(0x057e2159) /* 0.343293524 */, 16 }, + /* 1838 */ { MAD_F(0x057f26a6) /* 0.343542717 */, 16 }, + /* 1839 */ { MAD_F(0x05802bfe) /* 0.343791954 */, 16 }, + + /* 1840 */ { MAD_F(0x05813162) /* 0.344041237 */, 16 }, + /* 1841 */ { MAD_F(0x058236d2) /* 0.344290564 */, 16 }, + /* 1842 */ { MAD_F(0x05833c4f) /* 0.344539937 */, 16 }, + /* 1843 */ { MAD_F(0x058441d8) /* 0.344789356 */, 16 }, + /* 1844 */ { MAD_F(0x0585476c) /* 0.345038819 */, 16 }, + /* 1845 */ { MAD_F(0x05864d0d) /* 0.345288327 */, 16 }, + /* 1846 */ { MAD_F(0x058752ba) /* 0.345537880 */, 16 }, + /* 1847 */ { MAD_F(0x05885873) /* 0.345787479 */, 16 }, + /* 1848 */ { MAD_F(0x05895e39) /* 0.346037122 */, 16 }, + /* 1849 */ { MAD_F(0x058a640a) /* 0.346286811 */, 16 }, + /* 1850 */ { MAD_F(0x058b69e7) /* 0.346536545 */, 16 }, + /* 1851 */ { MAD_F(0x058c6fd1) /* 0.346786323 */, 16 }, + /* 1852 */ { MAD_F(0x058d75c6) /* 0.347036147 */, 16 }, + /* 1853 */ { MAD_F(0x058e7bc8) /* 0.347286015 */, 16 }, + /* 1854 */ { MAD_F(0x058f81d5) /* 0.347535929 */, 16 }, + /* 1855 */ { MAD_F(0x059087ef) /* 0.347785887 */, 16 }, + + /* 1856 */ { MAD_F(0x05918e15) /* 0.348035890 */, 16 }, + /* 1857 */ { MAD_F(0x05929447) /* 0.348285939 */, 16 }, + /* 1858 */ { MAD_F(0x05939a84) /* 0.348536032 */, 16 }, + /* 1859 */ { MAD_F(0x0594a0ce) /* 0.348786170 */, 16 }, + /* 1860 */ { MAD_F(0x0595a724) /* 0.349036353 */, 16 }, + /* 1861 */ { MAD_F(0x0596ad86) /* 0.349286580 */, 16 }, + /* 1862 */ { MAD_F(0x0597b3f4) /* 0.349536853 */, 16 }, + /* 1863 */ { MAD_F(0x0598ba6e) /* 0.349787170 */, 16 }, + /* 1864 */ { MAD_F(0x0599c0f4) /* 0.350037532 */, 16 }, + /* 1865 */ { MAD_F(0x059ac786) /* 0.350287939 */, 16 }, + /* 1866 */ { MAD_F(0x059bce25) /* 0.350538391 */, 16 }, + /* 1867 */ { MAD_F(0x059cd4cf) /* 0.350788887 */, 16 }, + /* 1868 */ { MAD_F(0x059ddb85) /* 0.351039428 */, 16 }, + /* 1869 */ { MAD_F(0x059ee247) /* 0.351290014 */, 16 }, + /* 1870 */ { MAD_F(0x059fe915) /* 0.351540645 */, 16 }, + /* 1871 */ { MAD_F(0x05a0efef) /* 0.351791320 */, 16 }, + + /* 1872 */ { MAD_F(0x05a1f6d5) /* 0.352042040 */, 16 }, + /* 1873 */ { MAD_F(0x05a2fdc7) /* 0.352292804 */, 16 }, + /* 1874 */ { MAD_F(0x05a404c5) /* 0.352543613 */, 16 }, + /* 1875 */ { MAD_F(0x05a50bcf) /* 0.352794467 */, 16 }, + /* 1876 */ { MAD_F(0x05a612e5) /* 0.353045365 */, 16 }, + /* 1877 */ { MAD_F(0x05a71a07) /* 0.353296308 */, 16 }, + /* 1878 */ { MAD_F(0x05a82135) /* 0.353547296 */, 16 }, + /* 1879 */ { MAD_F(0x05a9286f) /* 0.353798328 */, 16 }, + /* 1880 */ { MAD_F(0x05aa2fb5) /* 0.354049405 */, 16 }, + /* 1881 */ { MAD_F(0x05ab3707) /* 0.354300526 */, 16 }, + /* 1882 */ { MAD_F(0x05ac3e65) /* 0.354551691 */, 16 }, + /* 1883 */ { MAD_F(0x05ad45ce) /* 0.354802901 */, 16 }, + /* 1884 */ { MAD_F(0x05ae4d44) /* 0.355054156 */, 16 }, + /* 1885 */ { MAD_F(0x05af54c6) /* 0.355305455 */, 16 }, + /* 1886 */ { MAD_F(0x05b05c53) /* 0.355556799 */, 16 }, + /* 1887 */ { MAD_F(0x05b163ed) /* 0.355808187 */, 16 }, + + /* 1888 */ { MAD_F(0x05b26b92) /* 0.356059619 */, 16 }, + /* 1889 */ { MAD_F(0x05b37343) /* 0.356311096 */, 16 }, + /* 1890 */ { MAD_F(0x05b47b00) /* 0.356562617 */, 16 }, + /* 1891 */ { MAD_F(0x05b582c9) /* 0.356814182 */, 16 }, + /* 1892 */ { MAD_F(0x05b68a9e) /* 0.357065792 */, 16 }, + /* 1893 */ { MAD_F(0x05b7927f) /* 0.357317446 */, 16 }, + /* 1894 */ { MAD_F(0x05b89a6c) /* 0.357569145 */, 16 }, + /* 1895 */ { MAD_F(0x05b9a265) /* 0.357820887 */, 16 }, + /* 1896 */ { MAD_F(0x05baaa69) /* 0.358072674 */, 16 }, + /* 1897 */ { MAD_F(0x05bbb27a) /* 0.358324506 */, 16 }, + /* 1898 */ { MAD_F(0x05bcba96) /* 0.358576381 */, 16 }, + /* 1899 */ { MAD_F(0x05bdc2be) /* 0.358828301 */, 16 }, + /* 1900 */ { MAD_F(0x05becaf2) /* 0.359080265 */, 16 }, + /* 1901 */ { MAD_F(0x05bfd332) /* 0.359332273 */, 16 }, + /* 1902 */ { MAD_F(0x05c0db7e) /* 0.359584326 */, 16 }, + /* 1903 */ { MAD_F(0x05c1e3d6) /* 0.359836423 */, 16 }, + + /* 1904 */ { MAD_F(0x05c2ec39) /* 0.360088563 */, 16 }, + /* 1905 */ { MAD_F(0x05c3f4a9) /* 0.360340748 */, 16 }, + /* 1906 */ { MAD_F(0x05c4fd24) /* 0.360592977 */, 16 }, + /* 1907 */ { MAD_F(0x05c605ab) /* 0.360845251 */, 16 }, + /* 1908 */ { MAD_F(0x05c70e3e) /* 0.361097568 */, 16 }, + /* 1909 */ { MAD_F(0x05c816dd) /* 0.361349929 */, 16 }, + /* 1910 */ { MAD_F(0x05c91f87) /* 0.361602335 */, 16 }, + /* 1911 */ { MAD_F(0x05ca283e) /* 0.361854784 */, 16 }, + /* 1912 */ { MAD_F(0x05cb3100) /* 0.362107278 */, 16 }, + /* 1913 */ { MAD_F(0x05cc39ce) /* 0.362359815 */, 16 }, + /* 1914 */ { MAD_F(0x05cd42a8) /* 0.362612397 */, 16 }, + /* 1915 */ { MAD_F(0x05ce4b8d) /* 0.362865022 */, 16 }, + /* 1916 */ { MAD_F(0x05cf547f) /* 0.363117692 */, 16 }, + /* 1917 */ { MAD_F(0x05d05d7c) /* 0.363370405 */, 16 }, + /* 1918 */ { MAD_F(0x05d16685) /* 0.363623163 */, 16 }, + /* 1919 */ { MAD_F(0x05d26f9a) /* 0.363875964 */, 16 }, + + /* 1920 */ { MAD_F(0x05d378bb) /* 0.364128809 */, 16 }, + /* 1921 */ { MAD_F(0x05d481e7) /* 0.364381698 */, 16 }, + /* 1922 */ { MAD_F(0x05d58b1f) /* 0.364634632 */, 16 }, + /* 1923 */ { MAD_F(0x05d69463) /* 0.364887608 */, 16 }, + /* 1924 */ { MAD_F(0x05d79db3) /* 0.365140629 */, 16 }, + /* 1925 */ { MAD_F(0x05d8a70f) /* 0.365393694 */, 16 }, + /* 1926 */ { MAD_F(0x05d9b076) /* 0.365646802 */, 16 }, + /* 1927 */ { MAD_F(0x05dab9e9) /* 0.365899955 */, 16 }, + /* 1928 */ { MAD_F(0x05dbc368) /* 0.366153151 */, 16 }, + /* 1929 */ { MAD_F(0x05dcccf2) /* 0.366406390 */, 16 }, + /* 1930 */ { MAD_F(0x05ddd689) /* 0.366659674 */, 16 }, + /* 1931 */ { MAD_F(0x05dee02b) /* 0.366913001 */, 16 }, + /* 1932 */ { MAD_F(0x05dfe9d8) /* 0.367166372 */, 16 }, + /* 1933 */ { MAD_F(0x05e0f392) /* 0.367419787 */, 16 }, + /* 1934 */ { MAD_F(0x05e1fd57) /* 0.367673246 */, 16 }, + /* 1935 */ { MAD_F(0x05e30728) /* 0.367926748 */, 16 }, + + /* 1936 */ { MAD_F(0x05e41105) /* 0.368180294 */, 16 }, + /* 1937 */ { MAD_F(0x05e51aed) /* 0.368433883 */, 16 }, + /* 1938 */ { MAD_F(0x05e624e1) /* 0.368687517 */, 16 }, + /* 1939 */ { MAD_F(0x05e72ee1) /* 0.368941193 */, 16 }, + /* 1940 */ { MAD_F(0x05e838ed) /* 0.369194914 */, 16 }, + /* 1941 */ { MAD_F(0x05e94304) /* 0.369448678 */, 16 }, + /* 1942 */ { MAD_F(0x05ea4d27) /* 0.369702485 */, 16 }, + /* 1943 */ { MAD_F(0x05eb5756) /* 0.369956336 */, 16 }, + /* 1944 */ { MAD_F(0x05ec6190) /* 0.370210231 */, 16 }, + /* 1945 */ { MAD_F(0x05ed6bd6) /* 0.370464169 */, 16 }, + /* 1946 */ { MAD_F(0x05ee7628) /* 0.370718151 */, 16 }, + /* 1947 */ { MAD_F(0x05ef8085) /* 0.370972177 */, 16 }, + /* 1948 */ { MAD_F(0x05f08aee) /* 0.371226245 */, 16 }, + /* 1949 */ { MAD_F(0x05f19563) /* 0.371480358 */, 16 }, + /* 1950 */ { MAD_F(0x05f29fe3) /* 0.371734513 */, 16 }, + /* 1951 */ { MAD_F(0x05f3aa6f) /* 0.371988712 */, 16 }, + + /* 1952 */ { MAD_F(0x05f4b507) /* 0.372242955 */, 16 }, + /* 1953 */ { MAD_F(0x05f5bfab) /* 0.372497241 */, 16 }, + /* 1954 */ { MAD_F(0x05f6ca5a) /* 0.372751570 */, 16 }, + /* 1955 */ { MAD_F(0x05f7d514) /* 0.373005943 */, 16 }, + /* 1956 */ { MAD_F(0x05f8dfdb) /* 0.373260359 */, 16 }, + /* 1957 */ { MAD_F(0x05f9eaad) /* 0.373514819 */, 16 }, + /* 1958 */ { MAD_F(0x05faf58a) /* 0.373769322 */, 16 }, + /* 1959 */ { MAD_F(0x05fc0073) /* 0.374023868 */, 16 }, + /* 1960 */ { MAD_F(0x05fd0b68) /* 0.374278458 */, 16 }, + /* 1961 */ { MAD_F(0x05fe1669) /* 0.374533091 */, 16 }, + /* 1962 */ { MAD_F(0x05ff2175) /* 0.374787767 */, 16 }, + /* 1963 */ { MAD_F(0x06002c8d) /* 0.375042486 */, 16 }, + /* 1964 */ { MAD_F(0x060137b0) /* 0.375297249 */, 16 }, + /* 1965 */ { MAD_F(0x060242df) /* 0.375552055 */, 16 }, + /* 1966 */ { MAD_F(0x06034e19) /* 0.375806904 */, 16 }, + /* 1967 */ { MAD_F(0x0604595f) /* 0.376061796 */, 16 }, + + /* 1968 */ { MAD_F(0x060564b1) /* 0.376316732 */, 16 }, + /* 1969 */ { MAD_F(0x0606700f) /* 0.376571710 */, 16 }, + /* 1970 */ { MAD_F(0x06077b77) /* 0.376826732 */, 16 }, + /* 1971 */ { MAD_F(0x060886ec) /* 0.377081797 */, 16 }, + /* 1972 */ { MAD_F(0x0609926c) /* 0.377336905 */, 16 }, + /* 1973 */ { MAD_F(0x060a9df8) /* 0.377592057 */, 16 }, + /* 1974 */ { MAD_F(0x060ba98f) /* 0.377847251 */, 16 }, + /* 1975 */ { MAD_F(0x060cb532) /* 0.378102489 */, 16 }, + /* 1976 */ { MAD_F(0x060dc0e0) /* 0.378357769 */, 16 }, + /* 1977 */ { MAD_F(0x060ecc9a) /* 0.378613093 */, 16 }, + /* 1978 */ { MAD_F(0x060fd860) /* 0.378868460 */, 16 }, + /* 1979 */ { MAD_F(0x0610e431) /* 0.379123870 */, 16 }, + /* 1980 */ { MAD_F(0x0611f00d) /* 0.379379322 */, 16 }, + /* 1981 */ { MAD_F(0x0612fbf5) /* 0.379634818 */, 16 }, + /* 1982 */ { MAD_F(0x061407e9) /* 0.379890357 */, 16 }, + /* 1983 */ { MAD_F(0x061513e8) /* 0.380145939 */, 16 }, + + /* 1984 */ { MAD_F(0x06161ff3) /* 0.380401563 */, 16 }, + /* 1985 */ { MAD_F(0x06172c09) /* 0.380657231 */, 16 }, + /* 1986 */ { MAD_F(0x0618382b) /* 0.380912942 */, 16 }, + /* 1987 */ { MAD_F(0x06194458) /* 0.381168695 */, 16 }, + /* 1988 */ { MAD_F(0x061a5091) /* 0.381424492 */, 16 }, + /* 1989 */ { MAD_F(0x061b5cd5) /* 0.381680331 */, 16 }, + /* 1990 */ { MAD_F(0x061c6925) /* 0.381936213 */, 16 }, + /* 1991 */ { MAD_F(0x061d7581) /* 0.382192138 */, 16 }, + /* 1992 */ { MAD_F(0x061e81e8) /* 0.382448106 */, 16 }, + /* 1993 */ { MAD_F(0x061f8e5a) /* 0.382704117 */, 16 }, + /* 1994 */ { MAD_F(0x06209ad8) /* 0.382960171 */, 16 }, + /* 1995 */ { MAD_F(0x0621a761) /* 0.383216267 */, 16 }, + /* 1996 */ { MAD_F(0x0622b3f6) /* 0.383472406 */, 16 }, + /* 1997 */ { MAD_F(0x0623c096) /* 0.383728588 */, 16 }, + /* 1998 */ { MAD_F(0x0624cd42) /* 0.383984813 */, 16 }, + /* 1999 */ { MAD_F(0x0625d9f9) /* 0.384241080 */, 16 }, + + /* 2000 */ { MAD_F(0x0626e6bc) /* 0.384497391 */, 16 }, + /* 2001 */ { MAD_F(0x0627f38a) /* 0.384753744 */, 16 }, + /* 2002 */ { MAD_F(0x06290064) /* 0.385010139 */, 16 }, + /* 2003 */ { MAD_F(0x062a0d49) /* 0.385266578 */, 16 }, + /* 2004 */ { MAD_F(0x062b1a3a) /* 0.385523059 */, 16 }, + /* 2005 */ { MAD_F(0x062c2736) /* 0.385779582 */, 16 }, + /* 2006 */ { MAD_F(0x062d343d) /* 0.386036149 */, 16 }, + /* 2007 */ { MAD_F(0x062e4150) /* 0.386292758 */, 16 }, + /* 2008 */ { MAD_F(0x062f4e6f) /* 0.386549409 */, 16 }, + /* 2009 */ { MAD_F(0x06305b99) /* 0.386806104 */, 16 }, + /* 2010 */ { MAD_F(0x063168ce) /* 0.387062840 */, 16 }, + /* 2011 */ { MAD_F(0x0632760f) /* 0.387319620 */, 16 }, + /* 2012 */ { MAD_F(0x0633835b) /* 0.387576442 */, 16 }, + /* 2013 */ { MAD_F(0x063490b2) /* 0.387833306 */, 16 }, + /* 2014 */ { MAD_F(0x06359e15) /* 0.388090213 */, 16 }, + /* 2015 */ { MAD_F(0x0636ab83) /* 0.388347163 */, 16 }, + + /* 2016 */ { MAD_F(0x0637b8fd) /* 0.388604155 */, 16 }, + /* 2017 */ { MAD_F(0x0638c682) /* 0.388861190 */, 16 }, + /* 2018 */ { MAD_F(0x0639d413) /* 0.389118267 */, 16 }, + /* 2019 */ { MAD_F(0x063ae1af) /* 0.389375386 */, 16 }, + /* 2020 */ { MAD_F(0x063bef56) /* 0.389632548 */, 16 }, + /* 2021 */ { MAD_F(0x063cfd09) /* 0.389889752 */, 16 }, + /* 2022 */ { MAD_F(0x063e0ac7) /* 0.390146999 */, 16 }, + /* 2023 */ { MAD_F(0x063f1891) /* 0.390404289 */, 16 }, + /* 2024 */ { MAD_F(0x06402666) /* 0.390661620 */, 16 }, + /* 2025 */ { MAD_F(0x06413446) /* 0.390918994 */, 16 }, + /* 2026 */ { MAD_F(0x06424232) /* 0.391176411 */, 16 }, + /* 2027 */ { MAD_F(0x06435029) /* 0.391433869 */, 16 }, + /* 2028 */ { MAD_F(0x06445e2b) /* 0.391691371 */, 16 }, + /* 2029 */ { MAD_F(0x06456c39) /* 0.391948914 */, 16 }, + /* 2030 */ { MAD_F(0x06467a52) /* 0.392206500 */, 16 }, + /* 2031 */ { MAD_F(0x06478877) /* 0.392464128 */, 16 }, + + /* 2032 */ { MAD_F(0x064896a7) /* 0.392721798 */, 16 }, + /* 2033 */ { MAD_F(0x0649a4e2) /* 0.392979511 */, 16 }, + /* 2034 */ { MAD_F(0x064ab328) /* 0.393237266 */, 16 }, + /* 2035 */ { MAD_F(0x064bc17a) /* 0.393495063 */, 16 }, + /* 2036 */ { MAD_F(0x064ccfd8) /* 0.393752902 */, 16 }, + /* 2037 */ { MAD_F(0x064dde40) /* 0.394010784 */, 16 }, + /* 2038 */ { MAD_F(0x064eecb4) /* 0.394268707 */, 16 }, + /* 2039 */ { MAD_F(0x064ffb33) /* 0.394526673 */, 16 }, + /* 2040 */ { MAD_F(0x065109be) /* 0.394784681 */, 16 }, + /* 2041 */ { MAD_F(0x06521854) /* 0.395042732 */, 16 }, + /* 2042 */ { MAD_F(0x065326f5) /* 0.395300824 */, 16 }, + /* 2043 */ { MAD_F(0x065435a1) /* 0.395558959 */, 16 }, + /* 2044 */ { MAD_F(0x06554459) /* 0.395817135 */, 16 }, + /* 2045 */ { MAD_F(0x0656531c) /* 0.396075354 */, 16 }, + /* 2046 */ { MAD_F(0x065761ea) /* 0.396333615 */, 16 }, + /* 2047 */ { MAD_F(0x065870c4) /* 0.396591918 */, 16 }, + + /* 2048 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 16 }, + /* 2049 */ { MAD_F(0x065a8e99) /* 0.397108650 */, 16 }, + /* 2050 */ { MAD_F(0x065b9d95) /* 0.397367079 */, 16 }, + /* 2051 */ { MAD_F(0x065cac9c) /* 0.397625550 */, 16 }, + /* 2052 */ { MAD_F(0x065dbbae) /* 0.397884063 */, 16 }, + /* 2053 */ { MAD_F(0x065ecacb) /* 0.398142619 */, 16 }, + /* 2054 */ { MAD_F(0x065fd9f4) /* 0.398401216 */, 16 }, + /* 2055 */ { MAD_F(0x0660e928) /* 0.398659855 */, 16 }, + /* 2056 */ { MAD_F(0x0661f867) /* 0.398918536 */, 16 }, + /* 2057 */ { MAD_F(0x066307b1) /* 0.399177259 */, 16 }, + /* 2058 */ { MAD_F(0x06641707) /* 0.399436024 */, 16 }, + /* 2059 */ { MAD_F(0x06652668) /* 0.399694831 */, 16 }, + /* 2060 */ { MAD_F(0x066635d4) /* 0.399953679 */, 16 }, + /* 2061 */ { MAD_F(0x0667454c) /* 0.400212570 */, 16 }, + /* 2062 */ { MAD_F(0x066854ce) /* 0.400471503 */, 16 }, + /* 2063 */ { MAD_F(0x0669645c) /* 0.400730477 */, 16 }, + + /* 2064 */ { MAD_F(0x066a73f5) /* 0.400989493 */, 16 }, + /* 2065 */ { MAD_F(0x066b839a) /* 0.401248551 */, 16 }, + /* 2066 */ { MAD_F(0x066c9349) /* 0.401507651 */, 16 }, + /* 2067 */ { MAD_F(0x066da304) /* 0.401766793 */, 16 }, + /* 2068 */ { MAD_F(0x066eb2ca) /* 0.402025976 */, 16 }, + /* 2069 */ { MAD_F(0x066fc29b) /* 0.402285202 */, 16 }, + /* 2070 */ { MAD_F(0x0670d278) /* 0.402544469 */, 16 }, + /* 2071 */ { MAD_F(0x0671e25f) /* 0.402803777 */, 16 }, + /* 2072 */ { MAD_F(0x0672f252) /* 0.403063128 */, 16 }, + /* 2073 */ { MAD_F(0x06740250) /* 0.403322520 */, 16 }, + /* 2074 */ { MAD_F(0x0675125a) /* 0.403581954 */, 16 }, + /* 2075 */ { MAD_F(0x0676226e) /* 0.403841430 */, 16 }, + /* 2076 */ { MAD_F(0x0677328e) /* 0.404100947 */, 16 }, + /* 2077 */ { MAD_F(0x067842b9) /* 0.404360506 */, 16 }, + /* 2078 */ { MAD_F(0x067952ef) /* 0.404620107 */, 16 }, + /* 2079 */ { MAD_F(0x067a6330) /* 0.404879749 */, 16 }, + + /* 2080 */ { MAD_F(0x067b737c) /* 0.405139433 */, 16 }, + /* 2081 */ { MAD_F(0x067c83d4) /* 0.405399159 */, 16 }, + /* 2082 */ { MAD_F(0x067d9436) /* 0.405658926 */, 16 }, + /* 2083 */ { MAD_F(0x067ea4a4) /* 0.405918735 */, 16 }, + /* 2084 */ { MAD_F(0x067fb51d) /* 0.406178585 */, 16 }, + /* 2085 */ { MAD_F(0x0680c5a2) /* 0.406438477 */, 16 }, + /* 2086 */ { MAD_F(0x0681d631) /* 0.406698410 */, 16 }, + /* 2087 */ { MAD_F(0x0682e6cb) /* 0.406958385 */, 16 }, + /* 2088 */ { MAD_F(0x0683f771) /* 0.407218402 */, 16 }, + /* 2089 */ { MAD_F(0x06850822) /* 0.407478460 */, 16 }, + /* 2090 */ { MAD_F(0x068618de) /* 0.407738559 */, 16 }, + /* 2091 */ { MAD_F(0x068729a5) /* 0.407998700 */, 16 }, + /* 2092 */ { MAD_F(0x06883a77) /* 0.408258883 */, 16 }, + /* 2093 */ { MAD_F(0x06894b55) /* 0.408519107 */, 16 }, + /* 2094 */ { MAD_F(0x068a5c3d) /* 0.408779372 */, 16 }, + /* 2095 */ { MAD_F(0x068b6d31) /* 0.409039679 */, 16 }, + + /* 2096 */ { MAD_F(0x068c7e2f) /* 0.409300027 */, 16 }, + /* 2097 */ { MAD_F(0x068d8f39) /* 0.409560417 */, 16 }, + /* 2098 */ { MAD_F(0x068ea04e) /* 0.409820848 */, 16 }, + /* 2099 */ { MAD_F(0x068fb16e) /* 0.410081321 */, 16 }, + /* 2100 */ { MAD_F(0x0690c299) /* 0.410341834 */, 16 }, + /* 2101 */ { MAD_F(0x0691d3cf) /* 0.410602390 */, 16 }, + /* 2102 */ { MAD_F(0x0692e511) /* 0.410862986 */, 16 }, + /* 2103 */ { MAD_F(0x0693f65d) /* 0.411123624 */, 16 }, + /* 2104 */ { MAD_F(0x069507b5) /* 0.411384303 */, 16 }, + /* 2105 */ { MAD_F(0x06961917) /* 0.411645024 */, 16 }, + /* 2106 */ { MAD_F(0x06972a85) /* 0.411905785 */, 16 }, + /* 2107 */ { MAD_F(0x06983bfe) /* 0.412166588 */, 16 }, + /* 2108 */ { MAD_F(0x06994d82) /* 0.412427433 */, 16 }, + /* 2109 */ { MAD_F(0x069a5f11) /* 0.412688318 */, 16 }, + /* 2110 */ { MAD_F(0x069b70ab) /* 0.412949245 */, 16 }, + /* 2111 */ { MAD_F(0x069c8250) /* 0.413210213 */, 16 }, + + /* 2112 */ { MAD_F(0x069d9400) /* 0.413471222 */, 16 }, + /* 2113 */ { MAD_F(0x069ea5bb) /* 0.413732273 */, 16 }, + /* 2114 */ { MAD_F(0x069fb781) /* 0.413993364 */, 16 }, + /* 2115 */ { MAD_F(0x06a0c953) /* 0.414254497 */, 16 }, + /* 2116 */ { MAD_F(0x06a1db2f) /* 0.414515671 */, 16 }, + /* 2117 */ { MAD_F(0x06a2ed16) /* 0.414776886 */, 16 }, + /* 2118 */ { MAD_F(0x06a3ff09) /* 0.415038142 */, 16 }, + /* 2119 */ { MAD_F(0x06a51106) /* 0.415299440 */, 16 }, + /* 2120 */ { MAD_F(0x06a6230f) /* 0.415560778 */, 16 }, + /* 2121 */ { MAD_F(0x06a73522) /* 0.415822157 */, 16 }, + /* 2122 */ { MAD_F(0x06a84741) /* 0.416083578 */, 16 }, + /* 2123 */ { MAD_F(0x06a9596a) /* 0.416345040 */, 16 }, + /* 2124 */ { MAD_F(0x06aa6b9f) /* 0.416606542 */, 16 }, + /* 2125 */ { MAD_F(0x06ab7ddf) /* 0.416868086 */, 16 }, + /* 2126 */ { MAD_F(0x06ac9029) /* 0.417129671 */, 16 }, + /* 2127 */ { MAD_F(0x06ada27f) /* 0.417391297 */, 16 }, + + /* 2128 */ { MAD_F(0x06aeb4e0) /* 0.417652964 */, 16 }, + /* 2129 */ { MAD_F(0x06afc74b) /* 0.417914672 */, 16 }, + /* 2130 */ { MAD_F(0x06b0d9c2) /* 0.418176420 */, 16 }, + /* 2131 */ { MAD_F(0x06b1ec43) /* 0.418438210 */, 16 }, + /* 2132 */ { MAD_F(0x06b2fed0) /* 0.418700041 */, 16 }, + /* 2133 */ { MAD_F(0x06b41168) /* 0.418961912 */, 16 }, + /* 2134 */ { MAD_F(0x06b5240a) /* 0.419223825 */, 16 }, + /* 2135 */ { MAD_F(0x06b636b8) /* 0.419485778 */, 16 }, + /* 2136 */ { MAD_F(0x06b74971) /* 0.419747773 */, 16 }, + /* 2137 */ { MAD_F(0x06b85c34) /* 0.420009808 */, 16 }, + /* 2138 */ { MAD_F(0x06b96f03) /* 0.420271884 */, 16 }, + /* 2139 */ { MAD_F(0x06ba81dc) /* 0.420534001 */, 16 }, + /* 2140 */ { MAD_F(0x06bb94c1) /* 0.420796159 */, 16 }, + /* 2141 */ { MAD_F(0x06bca7b0) /* 0.421058358 */, 16 }, + /* 2142 */ { MAD_F(0x06bdbaaa) /* 0.421320597 */, 16 }, + /* 2143 */ { MAD_F(0x06becdb0) /* 0.421582878 */, 16 }, + + /* 2144 */ { MAD_F(0x06bfe0c0) /* 0.421845199 */, 16 }, + /* 2145 */ { MAD_F(0x06c0f3db) /* 0.422107561 */, 16 }, + /* 2146 */ { MAD_F(0x06c20702) /* 0.422369964 */, 16 }, + /* 2147 */ { MAD_F(0x06c31a33) /* 0.422632407 */, 16 }, + /* 2148 */ { MAD_F(0x06c42d6f) /* 0.422894891 */, 16 }, + /* 2149 */ { MAD_F(0x06c540b6) /* 0.423157416 */, 16 }, + /* 2150 */ { MAD_F(0x06c65408) /* 0.423419982 */, 16 }, + /* 2151 */ { MAD_F(0x06c76765) /* 0.423682588 */, 16 }, + /* 2152 */ { MAD_F(0x06c87acc) /* 0.423945235 */, 16 }, + /* 2153 */ { MAD_F(0x06c98e3f) /* 0.424207923 */, 16 }, + /* 2154 */ { MAD_F(0x06caa1bd) /* 0.424470652 */, 16 }, + /* 2155 */ { MAD_F(0x06cbb545) /* 0.424733421 */, 16 }, + /* 2156 */ { MAD_F(0x06ccc8d9) /* 0.424996230 */, 16 }, + /* 2157 */ { MAD_F(0x06cddc77) /* 0.425259081 */, 16 }, + /* 2158 */ { MAD_F(0x06cef020) /* 0.425521972 */, 16 }, + /* 2159 */ { MAD_F(0x06d003d4) /* 0.425784903 */, 16 }, + + /* 2160 */ { MAD_F(0x06d11794) /* 0.426047876 */, 16 }, + /* 2161 */ { MAD_F(0x06d22b5e) /* 0.426310889 */, 16 }, + /* 2162 */ { MAD_F(0x06d33f32) /* 0.426573942 */, 16 }, + /* 2163 */ { MAD_F(0x06d45312) /* 0.426837036 */, 16 }, + /* 2164 */ { MAD_F(0x06d566fd) /* 0.427100170 */, 16 }, + /* 2165 */ { MAD_F(0x06d67af2) /* 0.427363345 */, 16 }, + /* 2166 */ { MAD_F(0x06d78ef3) /* 0.427626561 */, 16 }, + /* 2167 */ { MAD_F(0x06d8a2fe) /* 0.427889817 */, 16 }, + /* 2168 */ { MAD_F(0x06d9b714) /* 0.428153114 */, 16 }, + /* 2169 */ { MAD_F(0x06dacb35) /* 0.428416451 */, 16 }, + /* 2170 */ { MAD_F(0x06dbdf61) /* 0.428679828 */, 16 }, + /* 2171 */ { MAD_F(0x06dcf398) /* 0.428943246 */, 16 }, + /* 2172 */ { MAD_F(0x06de07d9) /* 0.429206704 */, 16 }, + /* 2173 */ { MAD_F(0x06df1c26) /* 0.429470203 */, 16 }, + /* 2174 */ { MAD_F(0x06e0307d) /* 0.429733743 */, 16 }, + /* 2175 */ { MAD_F(0x06e144df) /* 0.429997322 */, 16 }, + + /* 2176 */ { MAD_F(0x06e2594c) /* 0.430260942 */, 16 }, + /* 2177 */ { MAD_F(0x06e36dc4) /* 0.430524603 */, 16 }, + /* 2178 */ { MAD_F(0x06e48246) /* 0.430788304 */, 16 }, + /* 2179 */ { MAD_F(0x06e596d4) /* 0.431052045 */, 16 }, + /* 2180 */ { MAD_F(0x06e6ab6c) /* 0.431315826 */, 16 }, + /* 2181 */ { MAD_F(0x06e7c00f) /* 0.431579648 */, 16 }, + /* 2182 */ { MAD_F(0x06e8d4bd) /* 0.431843511 */, 16 }, + /* 2183 */ { MAD_F(0x06e9e976) /* 0.432107413 */, 16 }, + /* 2184 */ { MAD_F(0x06eafe3a) /* 0.432371356 */, 16 }, + /* 2185 */ { MAD_F(0x06ec1308) /* 0.432635339 */, 16 }, + /* 2186 */ { MAD_F(0x06ed27e2) /* 0.432899362 */, 16 }, + /* 2187 */ { MAD_F(0x06ee3cc6) /* 0.433163426 */, 16 }, + /* 2188 */ { MAD_F(0x06ef51b4) /* 0.433427530 */, 16 }, + /* 2189 */ { MAD_F(0x06f066ae) /* 0.433691674 */, 16 }, + /* 2190 */ { MAD_F(0x06f17bb3) /* 0.433955859 */, 16 }, + /* 2191 */ { MAD_F(0x06f290c2) /* 0.434220083 */, 16 }, + + /* 2192 */ { MAD_F(0x06f3a5dc) /* 0.434484348 */, 16 }, + /* 2193 */ { MAD_F(0x06f4bb01) /* 0.434748653 */, 16 }, + /* 2194 */ { MAD_F(0x06f5d030) /* 0.435012998 */, 16 }, + /* 2195 */ { MAD_F(0x06f6e56b) /* 0.435277383 */, 16 }, + /* 2196 */ { MAD_F(0x06f7fab0) /* 0.435541809 */, 16 }, + /* 2197 */ { MAD_F(0x06f91000) /* 0.435806274 */, 16 }, + /* 2198 */ { MAD_F(0x06fa255a) /* 0.436070780 */, 16 }, + /* 2199 */ { MAD_F(0x06fb3ac0) /* 0.436335326 */, 16 }, + /* 2200 */ { MAD_F(0x06fc5030) /* 0.436599912 */, 16 }, + /* 2201 */ { MAD_F(0x06fd65ab) /* 0.436864538 */, 16 }, + /* 2202 */ { MAD_F(0x06fe7b31) /* 0.437129204 */, 16 }, + /* 2203 */ { MAD_F(0x06ff90c2) /* 0.437393910 */, 16 }, + /* 2204 */ { MAD_F(0x0700a65d) /* 0.437658657 */, 16 }, + /* 2205 */ { MAD_F(0x0701bc03) /* 0.437923443 */, 16 }, + /* 2206 */ { MAD_F(0x0702d1b4) /* 0.438188269 */, 16 }, + /* 2207 */ { MAD_F(0x0703e76f) /* 0.438453136 */, 16 }, + + /* 2208 */ { MAD_F(0x0704fd35) /* 0.438718042 */, 16 }, + /* 2209 */ { MAD_F(0x07061306) /* 0.438982988 */, 16 }, + /* 2210 */ { MAD_F(0x070728e2) /* 0.439247975 */, 16 }, + /* 2211 */ { MAD_F(0x07083ec9) /* 0.439513001 */, 16 }, + /* 2212 */ { MAD_F(0x070954ba) /* 0.439778067 */, 16 }, + /* 2213 */ { MAD_F(0x070a6ab6) /* 0.440043173 */, 16 }, + /* 2214 */ { MAD_F(0x070b80bc) /* 0.440308320 */, 16 }, + /* 2215 */ { MAD_F(0x070c96ce) /* 0.440573506 */, 16 }, + /* 2216 */ { MAD_F(0x070dacea) /* 0.440838732 */, 16 }, + /* 2217 */ { MAD_F(0x070ec310) /* 0.441103997 */, 16 }, + /* 2218 */ { MAD_F(0x070fd942) /* 0.441369303 */, 16 }, + /* 2219 */ { MAD_F(0x0710ef7e) /* 0.441634649 */, 16 }, + /* 2220 */ { MAD_F(0x071205c5) /* 0.441900034 */, 16 }, + /* 2221 */ { MAD_F(0x07131c17) /* 0.442165460 */, 16 }, + /* 2222 */ { MAD_F(0x07143273) /* 0.442430925 */, 16 }, + /* 2223 */ { MAD_F(0x071548da) /* 0.442696430 */, 16 }, + + /* 2224 */ { MAD_F(0x07165f4b) /* 0.442961975 */, 16 }, + /* 2225 */ { MAD_F(0x071775c8) /* 0.443227559 */, 16 }, + /* 2226 */ { MAD_F(0x07188c4f) /* 0.443493184 */, 16 }, + /* 2227 */ { MAD_F(0x0719a2e0) /* 0.443758848 */, 16 }, + /* 2228 */ { MAD_F(0x071ab97d) /* 0.444024552 */, 16 }, + /* 2229 */ { MAD_F(0x071bd024) /* 0.444290296 */, 16 }, + /* 2230 */ { MAD_F(0x071ce6d6) /* 0.444556079 */, 16 }, + /* 2231 */ { MAD_F(0x071dfd92) /* 0.444821902 */, 16 }, + /* 2232 */ { MAD_F(0x071f1459) /* 0.445087765 */, 16 }, + /* 2233 */ { MAD_F(0x07202b2b) /* 0.445353668 */, 16 }, + /* 2234 */ { MAD_F(0x07214207) /* 0.445619610 */, 16 }, + /* 2235 */ { MAD_F(0x072258ee) /* 0.445885592 */, 16 }, + /* 2236 */ { MAD_F(0x07236fe0) /* 0.446151614 */, 16 }, + /* 2237 */ { MAD_F(0x072486dc) /* 0.446417675 */, 16 }, + /* 2238 */ { MAD_F(0x07259de3) /* 0.446683776 */, 16 }, + /* 2239 */ { MAD_F(0x0726b4f4) /* 0.446949917 */, 16 }, + + /* 2240 */ { MAD_F(0x0727cc11) /* 0.447216097 */, 16 }, + /* 2241 */ { MAD_F(0x0728e338) /* 0.447482317 */, 16 }, + /* 2242 */ { MAD_F(0x0729fa69) /* 0.447748576 */, 16 }, + /* 2243 */ { MAD_F(0x072b11a5) /* 0.448014875 */, 16 }, + /* 2244 */ { MAD_F(0x072c28ec) /* 0.448281214 */, 16 }, + /* 2245 */ { MAD_F(0x072d403d) /* 0.448547592 */, 16 }, + /* 2246 */ { MAD_F(0x072e5799) /* 0.448814010 */, 16 }, + /* 2247 */ { MAD_F(0x072f6f00) /* 0.449080467 */, 16 }, + /* 2248 */ { MAD_F(0x07308671) /* 0.449346964 */, 16 }, + /* 2249 */ { MAD_F(0x07319ded) /* 0.449613501 */, 16 }, + /* 2250 */ { MAD_F(0x0732b573) /* 0.449880076 */, 16 }, + /* 2251 */ { MAD_F(0x0733cd04) /* 0.450146692 */, 16 }, + /* 2252 */ { MAD_F(0x0734e4a0) /* 0.450413347 */, 16 }, + /* 2253 */ { MAD_F(0x0735fc46) /* 0.450680041 */, 16 }, + /* 2254 */ { MAD_F(0x073713f7) /* 0.450946775 */, 16 }, + /* 2255 */ { MAD_F(0x07382bb2) /* 0.451213548 */, 16 }, + + /* 2256 */ { MAD_F(0x07394378) /* 0.451480360 */, 16 }, + /* 2257 */ { MAD_F(0x073a5b49) /* 0.451747213 */, 16 }, + /* 2258 */ { MAD_F(0x073b7324) /* 0.452014104 */, 16 }, + /* 2259 */ { MAD_F(0x073c8b0a) /* 0.452281035 */, 16 }, + /* 2260 */ { MAD_F(0x073da2fa) /* 0.452548005 */, 16 }, + /* 2261 */ { MAD_F(0x073ebaf5) /* 0.452815015 */, 16 }, + /* 2262 */ { MAD_F(0x073fd2fa) /* 0.453082064 */, 16 }, + /* 2263 */ { MAD_F(0x0740eb0a) /* 0.453349152 */, 16 }, + /* 2264 */ { MAD_F(0x07420325) /* 0.453616280 */, 16 }, + /* 2265 */ { MAD_F(0x07431b4a) /* 0.453883447 */, 16 }, + /* 2266 */ { MAD_F(0x0744337a) /* 0.454150653 */, 16 }, + /* 2267 */ { MAD_F(0x07454bb4) /* 0.454417899 */, 16 }, + /* 2268 */ { MAD_F(0x074663f8) /* 0.454685184 */, 16 }, + /* 2269 */ { MAD_F(0x07477c48) /* 0.454952508 */, 16 }, + /* 2270 */ { MAD_F(0x074894a2) /* 0.455219872 */, 16 }, + /* 2271 */ { MAD_F(0x0749ad06) /* 0.455487275 */, 16 }, + + /* 2272 */ { MAD_F(0x074ac575) /* 0.455754717 */, 16 }, + /* 2273 */ { MAD_F(0x074bddee) /* 0.456022198 */, 16 }, + /* 2274 */ { MAD_F(0x074cf672) /* 0.456289719 */, 16 }, + /* 2275 */ { MAD_F(0x074e0f01) /* 0.456557278 */, 16 }, + /* 2276 */ { MAD_F(0x074f279a) /* 0.456824877 */, 16 }, + /* 2277 */ { MAD_F(0x0750403e) /* 0.457092516 */, 16 }, + /* 2278 */ { MAD_F(0x075158ec) /* 0.457360193 */, 16 }, + /* 2279 */ { MAD_F(0x075271a4) /* 0.457627909 */, 16 }, + /* 2280 */ { MAD_F(0x07538a67) /* 0.457895665 */, 16 }, + /* 2281 */ { MAD_F(0x0754a335) /* 0.458163460 */, 16 }, + /* 2282 */ { MAD_F(0x0755bc0d) /* 0.458431294 */, 16 }, + /* 2283 */ { MAD_F(0x0756d4f0) /* 0.458699167 */, 16 }, + /* 2284 */ { MAD_F(0x0757eddd) /* 0.458967079 */, 16 }, + /* 2285 */ { MAD_F(0x075906d5) /* 0.459235030 */, 16 }, + /* 2286 */ { MAD_F(0x075a1fd7) /* 0.459503021 */, 16 }, + /* 2287 */ { MAD_F(0x075b38e3) /* 0.459771050 */, 16 }, + + /* 2288 */ { MAD_F(0x075c51fa) /* 0.460039119 */, 16 }, + /* 2289 */ { MAD_F(0x075d6b1c) /* 0.460307226 */, 16 }, + /* 2290 */ { MAD_F(0x075e8448) /* 0.460575373 */, 16 }, + /* 2291 */ { MAD_F(0x075f9d7f) /* 0.460843559 */, 16 }, + /* 2292 */ { MAD_F(0x0760b6c0) /* 0.461111783 */, 16 }, + /* 2293 */ { MAD_F(0x0761d00b) /* 0.461380047 */, 16 }, + /* 2294 */ { MAD_F(0x0762e961) /* 0.461648350 */, 16 }, + /* 2295 */ { MAD_F(0x076402c1) /* 0.461916691 */, 16 }, + /* 2296 */ { MAD_F(0x07651c2c) /* 0.462185072 */, 16 }, + /* 2297 */ { MAD_F(0x076635a2) /* 0.462453492 */, 16 }, + /* 2298 */ { MAD_F(0x07674f22) /* 0.462721950 */, 16 }, + /* 2299 */ { MAD_F(0x076868ac) /* 0.462990448 */, 16 }, + /* 2300 */ { MAD_F(0x07698240) /* 0.463258984 */, 16 }, + /* 2301 */ { MAD_F(0x076a9be0) /* 0.463527560 */, 16 }, + /* 2302 */ { MAD_F(0x076bb589) /* 0.463796174 */, 16 }, + /* 2303 */ { MAD_F(0x076ccf3d) /* 0.464064827 */, 16 }, + + /* 2304 */ { MAD_F(0x076de8fc) /* 0.464333519 */, 16 }, + /* 2305 */ { MAD_F(0x076f02c5) /* 0.464602250 */, 16 }, + /* 2306 */ { MAD_F(0x07701c98) /* 0.464871020 */, 16 }, + /* 2307 */ { MAD_F(0x07713676) /* 0.465139829 */, 16 }, + /* 2308 */ { MAD_F(0x0772505e) /* 0.465408676 */, 16 }, + /* 2309 */ { MAD_F(0x07736a51) /* 0.465677563 */, 16 }, + /* 2310 */ { MAD_F(0x0774844e) /* 0.465946488 */, 16 }, + /* 2311 */ { MAD_F(0x07759e55) /* 0.466215452 */, 16 }, + /* 2312 */ { MAD_F(0x0776b867) /* 0.466484455 */, 16 }, + /* 2313 */ { MAD_F(0x0777d283) /* 0.466753496 */, 16 }, + /* 2314 */ { MAD_F(0x0778ecaa) /* 0.467022577 */, 16 }, + /* 2315 */ { MAD_F(0x077a06db) /* 0.467291696 */, 16 }, + /* 2316 */ { MAD_F(0x077b2117) /* 0.467560854 */, 16 }, + /* 2317 */ { MAD_F(0x077c3b5d) /* 0.467830050 */, 16 }, + /* 2318 */ { MAD_F(0x077d55ad) /* 0.468099285 */, 16 }, + /* 2319 */ { MAD_F(0x077e7008) /* 0.468368560 */, 16 }, + + /* 2320 */ { MAD_F(0x077f8a6d) /* 0.468637872 */, 16 }, + /* 2321 */ { MAD_F(0x0780a4dc) /* 0.468907224 */, 16 }, + /* 2322 */ { MAD_F(0x0781bf56) /* 0.469176614 */, 16 }, + /* 2323 */ { MAD_F(0x0782d9da) /* 0.469446043 */, 16 }, + /* 2324 */ { MAD_F(0x0783f469) /* 0.469715510 */, 16 }, + /* 2325 */ { MAD_F(0x07850f02) /* 0.469985016 */, 16 }, + /* 2326 */ { MAD_F(0x078629a5) /* 0.470254561 */, 16 }, + /* 2327 */ { MAD_F(0x07874453) /* 0.470524145 */, 16 }, + /* 2328 */ { MAD_F(0x07885f0b) /* 0.470793767 */, 16 }, + /* 2329 */ { MAD_F(0x078979ce) /* 0.471063427 */, 16 }, + /* 2330 */ { MAD_F(0x078a949a) /* 0.471333126 */, 16 }, + /* 2331 */ { MAD_F(0x078baf72) /* 0.471602864 */, 16 }, + /* 2332 */ { MAD_F(0x078cca53) /* 0.471872641 */, 16 }, + /* 2333 */ { MAD_F(0x078de53f) /* 0.472142456 */, 16 }, + /* 2334 */ { MAD_F(0x078f0035) /* 0.472412309 */, 16 }, + /* 2335 */ { MAD_F(0x07901b36) /* 0.472682201 */, 16 }, + + /* 2336 */ { MAD_F(0x07913641) /* 0.472952132 */, 16 }, + /* 2337 */ { MAD_F(0x07925156) /* 0.473222101 */, 16 }, + /* 2338 */ { MAD_F(0x07936c76) /* 0.473492108 */, 16 }, + /* 2339 */ { MAD_F(0x079487a0) /* 0.473762155 */, 16 }, + /* 2340 */ { MAD_F(0x0795a2d4) /* 0.474032239 */, 16 }, + /* 2341 */ { MAD_F(0x0796be13) /* 0.474302362 */, 16 }, + /* 2342 */ { MAD_F(0x0797d95c) /* 0.474572524 */, 16 }, + /* 2343 */ { MAD_F(0x0798f4af) /* 0.474842724 */, 16 }, + /* 2344 */ { MAD_F(0x079a100c) /* 0.475112962 */, 16 }, + /* 2345 */ { MAD_F(0x079b2b74) /* 0.475383239 */, 16 }, + /* 2346 */ { MAD_F(0x079c46e7) /* 0.475653554 */, 16 }, + /* 2347 */ { MAD_F(0x079d6263) /* 0.475923908 */, 16 }, + /* 2348 */ { MAD_F(0x079e7dea) /* 0.476194300 */, 16 }, + /* 2349 */ { MAD_F(0x079f997b) /* 0.476464731 */, 16 }, + /* 2350 */ { MAD_F(0x07a0b516) /* 0.476735200 */, 16 }, + /* 2351 */ { MAD_F(0x07a1d0bc) /* 0.477005707 */, 16 }, + + /* 2352 */ { MAD_F(0x07a2ec6c) /* 0.477276252 */, 16 }, + /* 2353 */ { MAD_F(0x07a40827) /* 0.477546836 */, 16 }, + /* 2354 */ { MAD_F(0x07a523eb) /* 0.477817459 */, 16 }, + /* 2355 */ { MAD_F(0x07a63fba) /* 0.478088119 */, 16 }, + /* 2356 */ { MAD_F(0x07a75b93) /* 0.478358818 */, 16 }, + /* 2357 */ { MAD_F(0x07a87777) /* 0.478629555 */, 16 }, + /* 2358 */ { MAD_F(0x07a99364) /* 0.478900331 */, 16 }, + /* 2359 */ { MAD_F(0x07aaaf5c) /* 0.479171145 */, 16 }, + /* 2360 */ { MAD_F(0x07abcb5f) /* 0.479441997 */, 16 }, + /* 2361 */ { MAD_F(0x07ace76b) /* 0.479712887 */, 16 }, + /* 2362 */ { MAD_F(0x07ae0382) /* 0.479983816 */, 16 }, + /* 2363 */ { MAD_F(0x07af1fa3) /* 0.480254782 */, 16 }, + /* 2364 */ { MAD_F(0x07b03bcf) /* 0.480525787 */, 16 }, + /* 2365 */ { MAD_F(0x07b15804) /* 0.480796831 */, 16 }, + /* 2366 */ { MAD_F(0x07b27444) /* 0.481067912 */, 16 }, + /* 2367 */ { MAD_F(0x07b3908e) /* 0.481339032 */, 16 }, + + /* 2368 */ { MAD_F(0x07b4ace3) /* 0.481610189 */, 16 }, + /* 2369 */ { MAD_F(0x07b5c941) /* 0.481881385 */, 16 }, + /* 2370 */ { MAD_F(0x07b6e5aa) /* 0.482152620 */, 16 }, + /* 2371 */ { MAD_F(0x07b8021d) /* 0.482423892 */, 16 }, + /* 2372 */ { MAD_F(0x07b91e9b) /* 0.482695202 */, 16 }, + /* 2373 */ { MAD_F(0x07ba3b22) /* 0.482966551 */, 16 }, + /* 2374 */ { MAD_F(0x07bb57b4) /* 0.483237938 */, 16 }, + /* 2375 */ { MAD_F(0x07bc7450) /* 0.483509362 */, 16 }, + /* 2376 */ { MAD_F(0x07bd90f6) /* 0.483780825 */, 16 }, + /* 2377 */ { MAD_F(0x07beada7) /* 0.484052326 */, 16 }, + /* 2378 */ { MAD_F(0x07bfca61) /* 0.484323865 */, 16 }, + /* 2379 */ { MAD_F(0x07c0e726) /* 0.484595443 */, 16 }, + /* 2380 */ { MAD_F(0x07c203f5) /* 0.484867058 */, 16 }, + /* 2381 */ { MAD_F(0x07c320cf) /* 0.485138711 */, 16 }, + /* 2382 */ { MAD_F(0x07c43db2) /* 0.485410402 */, 16 }, + /* 2383 */ { MAD_F(0x07c55aa0) /* 0.485682131 */, 16 }, + + /* 2384 */ { MAD_F(0x07c67798) /* 0.485953899 */, 16 }, + /* 2385 */ { MAD_F(0x07c7949a) /* 0.486225704 */, 16 }, + /* 2386 */ { MAD_F(0x07c8b1a7) /* 0.486497547 */, 16 }, + /* 2387 */ { MAD_F(0x07c9cebd) /* 0.486769429 */, 16 }, + /* 2388 */ { MAD_F(0x07caebde) /* 0.487041348 */, 16 }, + /* 2389 */ { MAD_F(0x07cc0909) /* 0.487313305 */, 16 }, + /* 2390 */ { MAD_F(0x07cd263e) /* 0.487585300 */, 16 }, + /* 2391 */ { MAD_F(0x07ce437d) /* 0.487857333 */, 16 }, + /* 2392 */ { MAD_F(0x07cf60c7) /* 0.488129404 */, 16 }, + /* 2393 */ { MAD_F(0x07d07e1b) /* 0.488401513 */, 16 }, + /* 2394 */ { MAD_F(0x07d19b79) /* 0.488673660 */, 16 }, + /* 2395 */ { MAD_F(0x07d2b8e1) /* 0.488945845 */, 16 }, + /* 2396 */ { MAD_F(0x07d3d653) /* 0.489218067 */, 16 }, + /* 2397 */ { MAD_F(0x07d4f3cf) /* 0.489490328 */, 16 }, + /* 2398 */ { MAD_F(0x07d61156) /* 0.489762626 */, 16 }, + /* 2399 */ { MAD_F(0x07d72ee6) /* 0.490034962 */, 16 }, + + /* 2400 */ { MAD_F(0x07d84c81) /* 0.490307336 */, 16 }, + /* 2401 */ { MAD_F(0x07d96a26) /* 0.490579748 */, 16 }, + /* 2402 */ { MAD_F(0x07da87d5) /* 0.490852198 */, 16 }, + /* 2403 */ { MAD_F(0x07dba58f) /* 0.491124686 */, 16 }, + /* 2404 */ { MAD_F(0x07dcc352) /* 0.491397211 */, 16 }, + /* 2405 */ { MAD_F(0x07dde120) /* 0.491669774 */, 16 }, + /* 2406 */ { MAD_F(0x07defef7) /* 0.491942375 */, 16 }, + /* 2407 */ { MAD_F(0x07e01cd9) /* 0.492215014 */, 16 }, + /* 2408 */ { MAD_F(0x07e13ac5) /* 0.492487690 */, 16 }, + /* 2409 */ { MAD_F(0x07e258bc) /* 0.492760404 */, 16 }, + /* 2410 */ { MAD_F(0x07e376bc) /* 0.493033156 */, 16 }, + /* 2411 */ { MAD_F(0x07e494c6) /* 0.493305946 */, 16 }, + /* 2412 */ { MAD_F(0x07e5b2db) /* 0.493578773 */, 16 }, + /* 2413 */ { MAD_F(0x07e6d0f9) /* 0.493851638 */, 16 }, + /* 2414 */ { MAD_F(0x07e7ef22) /* 0.494124541 */, 16 }, + /* 2415 */ { MAD_F(0x07e90d55) /* 0.494397481 */, 16 }, + + /* 2416 */ { MAD_F(0x07ea2b92) /* 0.494670459 */, 16 }, + /* 2417 */ { MAD_F(0x07eb49d9) /* 0.494943475 */, 16 }, + /* 2418 */ { MAD_F(0x07ec682a) /* 0.495216529 */, 16 }, + /* 2419 */ { MAD_F(0x07ed8686) /* 0.495489620 */, 16 }, + /* 2420 */ { MAD_F(0x07eea4eb) /* 0.495762748 */, 16 }, + /* 2421 */ { MAD_F(0x07efc35b) /* 0.496035915 */, 16 }, + /* 2422 */ { MAD_F(0x07f0e1d4) /* 0.496309119 */, 16 }, + /* 2423 */ { MAD_F(0x07f20058) /* 0.496582360 */, 16 }, + /* 2424 */ { MAD_F(0x07f31ee6) /* 0.496855639 */, 16 }, + /* 2425 */ { MAD_F(0x07f43d7e) /* 0.497128956 */, 16 }, + /* 2426 */ { MAD_F(0x07f55c20) /* 0.497402310 */, 16 }, + /* 2427 */ { MAD_F(0x07f67acc) /* 0.497675702 */, 16 }, + /* 2428 */ { MAD_F(0x07f79982) /* 0.497949132 */, 16 }, + /* 2429 */ { MAD_F(0x07f8b842) /* 0.498222598 */, 16 }, + /* 2430 */ { MAD_F(0x07f9d70c) /* 0.498496103 */, 16 }, + /* 2431 */ { MAD_F(0x07faf5e1) /* 0.498769645 */, 16 }, + + /* 2432 */ { MAD_F(0x07fc14bf) /* 0.499043224 */, 16 }, + /* 2433 */ { MAD_F(0x07fd33a8) /* 0.499316841 */, 16 }, + /* 2434 */ { MAD_F(0x07fe529a) /* 0.499590496 */, 16 }, + /* 2435 */ { MAD_F(0x07ff7197) /* 0.499864188 */, 16 }, + /* 2436 */ { MAD_F(0x0400484f) /* 0.250068959 */, 17 }, + /* 2437 */ { MAD_F(0x0400d7d7) /* 0.250205842 */, 17 }, + /* 2438 */ { MAD_F(0x04016764) /* 0.250342744 */, 17 }, + /* 2439 */ { MAD_F(0x0401f6f7) /* 0.250479665 */, 17 }, + /* 2440 */ { MAD_F(0x0402868e) /* 0.250616605 */, 17 }, + /* 2441 */ { MAD_F(0x0403162b) /* 0.250753563 */, 17 }, + /* 2442 */ { MAD_F(0x0403a5cc) /* 0.250890540 */, 17 }, + /* 2443 */ { MAD_F(0x04043573) /* 0.251027536 */, 17 }, + /* 2444 */ { MAD_F(0x0404c51e) /* 0.251164550 */, 17 }, + /* 2445 */ { MAD_F(0x040554cf) /* 0.251301583 */, 17 }, + /* 2446 */ { MAD_F(0x0405e484) /* 0.251438635 */, 17 }, + /* 2447 */ { MAD_F(0x0406743f) /* 0.251575706 */, 17 }, + + /* 2448 */ { MAD_F(0x040703ff) /* 0.251712795 */, 17 }, + /* 2449 */ { MAD_F(0x040793c3) /* 0.251849903 */, 17 }, + /* 2450 */ { MAD_F(0x0408238d) /* 0.251987029 */, 17 }, + /* 2451 */ { MAD_F(0x0408b35b) /* 0.252124174 */, 17 }, + /* 2452 */ { MAD_F(0x0409432f) /* 0.252261338 */, 17 }, + /* 2453 */ { MAD_F(0x0409d308) /* 0.252398520 */, 17 }, + /* 2454 */ { MAD_F(0x040a62e5) /* 0.252535721 */, 17 }, + /* 2455 */ { MAD_F(0x040af2c8) /* 0.252672941 */, 17 }, + /* 2456 */ { MAD_F(0x040b82b0) /* 0.252810180 */, 17 }, + /* 2457 */ { MAD_F(0x040c129c) /* 0.252947436 */, 17 }, + /* 2458 */ { MAD_F(0x040ca28e) /* 0.253084712 */, 17 }, + /* 2459 */ { MAD_F(0x040d3284) /* 0.253222006 */, 17 }, + /* 2460 */ { MAD_F(0x040dc280) /* 0.253359319 */, 17 }, + /* 2461 */ { MAD_F(0x040e5281) /* 0.253496651 */, 17 }, + /* 2462 */ { MAD_F(0x040ee286) /* 0.253634001 */, 17 }, + /* 2463 */ { MAD_F(0x040f7291) /* 0.253771369 */, 17 }, + + /* 2464 */ { MAD_F(0x041002a1) /* 0.253908756 */, 17 }, + /* 2465 */ { MAD_F(0x041092b5) /* 0.254046162 */, 17 }, + /* 2466 */ { MAD_F(0x041122cf) /* 0.254183587 */, 17 }, + /* 2467 */ { MAD_F(0x0411b2ed) /* 0.254321030 */, 17 }, + /* 2468 */ { MAD_F(0x04124311) /* 0.254458491 */, 17 }, + /* 2469 */ { MAD_F(0x0412d339) /* 0.254595971 */, 17 }, + /* 2470 */ { MAD_F(0x04136367) /* 0.254733470 */, 17 }, + /* 2471 */ { MAD_F(0x0413f399) /* 0.254870987 */, 17 }, + /* 2472 */ { MAD_F(0x041483d1) /* 0.255008523 */, 17 }, + /* 2473 */ { MAD_F(0x0415140d) /* 0.255146077 */, 17 }, + /* 2474 */ { MAD_F(0x0415a44f) /* 0.255283650 */, 17 }, + /* 2475 */ { MAD_F(0x04163495) /* 0.255421241 */, 17 }, + /* 2476 */ { MAD_F(0x0416c4e1) /* 0.255558851 */, 17 }, + /* 2477 */ { MAD_F(0x04175531) /* 0.255696480 */, 17 }, + /* 2478 */ { MAD_F(0x0417e586) /* 0.255834127 */, 17 }, + /* 2479 */ { MAD_F(0x041875e1) /* 0.255971792 */, 17 }, + + /* 2480 */ { MAD_F(0x04190640) /* 0.256109476 */, 17 }, + /* 2481 */ { MAD_F(0x041996a4) /* 0.256247179 */, 17 }, + /* 2482 */ { MAD_F(0x041a270d) /* 0.256384900 */, 17 }, + /* 2483 */ { MAD_F(0x041ab77b) /* 0.256522639 */, 17 }, + /* 2484 */ { MAD_F(0x041b47ef) /* 0.256660397 */, 17 }, + /* 2485 */ { MAD_F(0x041bd867) /* 0.256798174 */, 17 }, + /* 2486 */ { MAD_F(0x041c68e4) /* 0.256935969 */, 17 }, + /* 2487 */ { MAD_F(0x041cf966) /* 0.257073782 */, 17 }, + /* 2488 */ { MAD_F(0x041d89ed) /* 0.257211614 */, 17 }, + /* 2489 */ { MAD_F(0x041e1a79) /* 0.257349465 */, 17 }, + /* 2490 */ { MAD_F(0x041eab0a) /* 0.257487334 */, 17 }, + /* 2491 */ { MAD_F(0x041f3b9f) /* 0.257625221 */, 17 }, + /* 2492 */ { MAD_F(0x041fcc3a) /* 0.257763127 */, 17 }, + /* 2493 */ { MAD_F(0x04205cda) /* 0.257901051 */, 17 }, + /* 2494 */ { MAD_F(0x0420ed7f) /* 0.258038994 */, 17 }, + /* 2495 */ { MAD_F(0x04217e28) /* 0.258176955 */, 17 }, + + /* 2496 */ { MAD_F(0x04220ed7) /* 0.258314934 */, 17 }, + /* 2497 */ { MAD_F(0x04229f8a) /* 0.258452932 */, 17 }, + /* 2498 */ { MAD_F(0x04233043) /* 0.258590948 */, 17 }, + /* 2499 */ { MAD_F(0x0423c100) /* 0.258728983 */, 17 }, + /* 2500 */ { MAD_F(0x042451c3) /* 0.258867036 */, 17 }, + /* 2501 */ { MAD_F(0x0424e28a) /* 0.259005108 */, 17 }, + /* 2502 */ { MAD_F(0x04257356) /* 0.259143198 */, 17 }, + /* 2503 */ { MAD_F(0x04260428) /* 0.259281307 */, 17 }, + /* 2504 */ { MAD_F(0x042694fe) /* 0.259419433 */, 17 }, + /* 2505 */ { MAD_F(0x042725d9) /* 0.259557579 */, 17 }, + /* 2506 */ { MAD_F(0x0427b6b9) /* 0.259695742 */, 17 }, + /* 2507 */ { MAD_F(0x0428479e) /* 0.259833924 */, 17 }, + /* 2508 */ { MAD_F(0x0428d888) /* 0.259972124 */, 17 }, + /* 2509 */ { MAD_F(0x04296976) /* 0.260110343 */, 17 }, + /* 2510 */ { MAD_F(0x0429fa6a) /* 0.260248580 */, 17 }, + /* 2511 */ { MAD_F(0x042a8b63) /* 0.260386836 */, 17 }, + + /* 2512 */ { MAD_F(0x042b1c60) /* 0.260525110 */, 17 }, + /* 2513 */ { MAD_F(0x042bad63) /* 0.260663402 */, 17 }, + /* 2514 */ { MAD_F(0x042c3e6a) /* 0.260801712 */, 17 }, + /* 2515 */ { MAD_F(0x042ccf77) /* 0.260940041 */, 17 }, + /* 2516 */ { MAD_F(0x042d6088) /* 0.261078388 */, 17 }, + /* 2517 */ { MAD_F(0x042df19e) /* 0.261216754 */, 17 }, + /* 2518 */ { MAD_F(0x042e82b9) /* 0.261355137 */, 17 }, + /* 2519 */ { MAD_F(0x042f13d9) /* 0.261493540 */, 17 }, + /* 2520 */ { MAD_F(0x042fa4fe) /* 0.261631960 */, 17 }, + /* 2521 */ { MAD_F(0x04303628) /* 0.261770399 */, 17 }, + /* 2522 */ { MAD_F(0x0430c757) /* 0.261908856 */, 17 }, + /* 2523 */ { MAD_F(0x0431588b) /* 0.262047331 */, 17 }, + /* 2524 */ { MAD_F(0x0431e9c3) /* 0.262185825 */, 17 }, + /* 2525 */ { MAD_F(0x04327b01) /* 0.262324337 */, 17 }, + /* 2526 */ { MAD_F(0x04330c43) /* 0.262462867 */, 17 }, + /* 2527 */ { MAD_F(0x04339d8a) /* 0.262601416 */, 17 }, + + /* 2528 */ { MAD_F(0x04342ed7) /* 0.262739982 */, 17 }, + /* 2529 */ { MAD_F(0x0434c028) /* 0.262878568 */, 17 }, + /* 2530 */ { MAD_F(0x0435517e) /* 0.263017171 */, 17 }, + /* 2531 */ { MAD_F(0x0435e2d9) /* 0.263155792 */, 17 }, + /* 2532 */ { MAD_F(0x04367439) /* 0.263294432 */, 17 }, + /* 2533 */ { MAD_F(0x0437059e) /* 0.263433090 */, 17 }, + /* 2534 */ { MAD_F(0x04379707) /* 0.263571767 */, 17 }, + /* 2535 */ { MAD_F(0x04382876) /* 0.263710461 */, 17 }, + /* 2536 */ { MAD_F(0x0438b9e9) /* 0.263849174 */, 17 }, + /* 2537 */ { MAD_F(0x04394b61) /* 0.263987905 */, 17 }, + /* 2538 */ { MAD_F(0x0439dcdf) /* 0.264126655 */, 17 }, + /* 2539 */ { MAD_F(0x043a6e61) /* 0.264265422 */, 17 }, + /* 2540 */ { MAD_F(0x043affe8) /* 0.264404208 */, 17 }, + /* 2541 */ { MAD_F(0x043b9174) /* 0.264543012 */, 17 }, + /* 2542 */ { MAD_F(0x043c2305) /* 0.264681834 */, 17 }, + /* 2543 */ { MAD_F(0x043cb49a) /* 0.264820674 */, 17 }, + + /* 2544 */ { MAD_F(0x043d4635) /* 0.264959533 */, 17 }, + /* 2545 */ { MAD_F(0x043dd7d4) /* 0.265098410 */, 17 }, + /* 2546 */ { MAD_F(0x043e6979) /* 0.265237305 */, 17 }, + /* 2547 */ { MAD_F(0x043efb22) /* 0.265376218 */, 17 }, + /* 2548 */ { MAD_F(0x043f8cd0) /* 0.265515149 */, 17 }, + /* 2549 */ { MAD_F(0x04401e83) /* 0.265654099 */, 17 }, + /* 2550 */ { MAD_F(0x0440b03b) /* 0.265793066 */, 17 }, + /* 2551 */ { MAD_F(0x044141f7) /* 0.265932052 */, 17 }, + /* 2552 */ { MAD_F(0x0441d3b9) /* 0.266071056 */, 17 }, + /* 2553 */ { MAD_F(0x04426580) /* 0.266210078 */, 17 }, + /* 2554 */ { MAD_F(0x0442f74b) /* 0.266349119 */, 17 }, + /* 2555 */ { MAD_F(0x0443891b) /* 0.266488177 */, 17 }, + /* 2556 */ { MAD_F(0x04441af0) /* 0.266627254 */, 17 }, + /* 2557 */ { MAD_F(0x0444acca) /* 0.266766349 */, 17 }, + /* 2558 */ { MAD_F(0x04453ea9) /* 0.266905462 */, 17 }, + /* 2559 */ { MAD_F(0x0445d08d) /* 0.267044593 */, 17 }, + + /* 2560 */ { MAD_F(0x04466275) /* 0.267183742 */, 17 }, + /* 2561 */ { MAD_F(0x0446f463) /* 0.267322909 */, 17 }, + /* 2562 */ { MAD_F(0x04478655) /* 0.267462094 */, 17 }, + /* 2563 */ { MAD_F(0x0448184c) /* 0.267601298 */, 17 }, + /* 2564 */ { MAD_F(0x0448aa48) /* 0.267740519 */, 17 }, + /* 2565 */ { MAD_F(0x04493c49) /* 0.267879759 */, 17 }, + /* 2566 */ { MAD_F(0x0449ce4f) /* 0.268019017 */, 17 }, + /* 2567 */ { MAD_F(0x044a6059) /* 0.268158293 */, 17 }, + /* 2568 */ { MAD_F(0x044af269) /* 0.268297587 */, 17 }, + /* 2569 */ { MAD_F(0x044b847d) /* 0.268436899 */, 17 }, + /* 2570 */ { MAD_F(0x044c1696) /* 0.268576229 */, 17 }, + /* 2571 */ { MAD_F(0x044ca8b4) /* 0.268715577 */, 17 }, + /* 2572 */ { MAD_F(0x044d3ad7) /* 0.268854943 */, 17 }, + /* 2573 */ { MAD_F(0x044dccff) /* 0.268994328 */, 17 }, + /* 2574 */ { MAD_F(0x044e5f2b) /* 0.269133730 */, 17 }, + /* 2575 */ { MAD_F(0x044ef15d) /* 0.269273150 */, 17 }, + + /* 2576 */ { MAD_F(0x044f8393) /* 0.269412589 */, 17 }, + /* 2577 */ { MAD_F(0x045015ce) /* 0.269552045 */, 17 }, + /* 2578 */ { MAD_F(0x0450a80e) /* 0.269691520 */, 17 }, + /* 2579 */ { MAD_F(0x04513a53) /* 0.269831013 */, 17 }, + /* 2580 */ { MAD_F(0x0451cc9c) /* 0.269970523 */, 17 }, + /* 2581 */ { MAD_F(0x04525eeb) /* 0.270110052 */, 17 }, + /* 2582 */ { MAD_F(0x0452f13e) /* 0.270249599 */, 17 }, + /* 2583 */ { MAD_F(0x04538396) /* 0.270389163 */, 17 }, + /* 2584 */ { MAD_F(0x045415f3) /* 0.270528746 */, 17 }, + /* 2585 */ { MAD_F(0x0454a855) /* 0.270668347 */, 17 }, + /* 2586 */ { MAD_F(0x04553abb) /* 0.270807965 */, 17 }, + /* 2587 */ { MAD_F(0x0455cd27) /* 0.270947602 */, 17 }, + /* 2588 */ { MAD_F(0x04565f97) /* 0.271087257 */, 17 }, + /* 2589 */ { MAD_F(0x0456f20c) /* 0.271226930 */, 17 }, + /* 2590 */ { MAD_F(0x04578486) /* 0.271366620 */, 17 }, + /* 2591 */ { MAD_F(0x04581705) /* 0.271506329 */, 17 }, + + /* 2592 */ { MAD_F(0x0458a989) /* 0.271646056 */, 17 }, + /* 2593 */ { MAD_F(0x04593c11) /* 0.271785800 */, 17 }, + /* 2594 */ { MAD_F(0x0459ce9e) /* 0.271925563 */, 17 }, + /* 2595 */ { MAD_F(0x045a6130) /* 0.272065343 */, 17 }, + /* 2596 */ { MAD_F(0x045af3c7) /* 0.272205142 */, 17 }, + /* 2597 */ { MAD_F(0x045b8663) /* 0.272344958 */, 17 }, + /* 2598 */ { MAD_F(0x045c1903) /* 0.272484793 */, 17 }, + /* 2599 */ { MAD_F(0x045caba9) /* 0.272624645 */, 17 }, + /* 2600 */ { MAD_F(0x045d3e53) /* 0.272764515 */, 17 }, + /* 2601 */ { MAD_F(0x045dd102) /* 0.272904403 */, 17 }, + /* 2602 */ { MAD_F(0x045e63b6) /* 0.273044310 */, 17 }, + /* 2603 */ { MAD_F(0x045ef66e) /* 0.273184234 */, 17 }, + /* 2604 */ { MAD_F(0x045f892b) /* 0.273324176 */, 17 }, + /* 2605 */ { MAD_F(0x04601bee) /* 0.273464136 */, 17 }, + /* 2606 */ { MAD_F(0x0460aeb5) /* 0.273604113 */, 17 }, + /* 2607 */ { MAD_F(0x04614180) /* 0.273744109 */, 17 }, + + /* 2608 */ { MAD_F(0x0461d451) /* 0.273884123 */, 17 }, + /* 2609 */ { MAD_F(0x04626727) /* 0.274024154 */, 17 }, + /* 2610 */ { MAD_F(0x0462fa01) /* 0.274164204 */, 17 }, + /* 2611 */ { MAD_F(0x04638ce0) /* 0.274304271 */, 17 }, + /* 2612 */ { MAD_F(0x04641fc4) /* 0.274444356 */, 17 }, + /* 2613 */ { MAD_F(0x0464b2ac) /* 0.274584459 */, 17 }, + /* 2614 */ { MAD_F(0x0465459a) /* 0.274724580 */, 17 }, + /* 2615 */ { MAD_F(0x0465d88c) /* 0.274864719 */, 17 }, + /* 2616 */ { MAD_F(0x04666b83) /* 0.275004875 */, 17 }, + /* 2617 */ { MAD_F(0x0466fe7f) /* 0.275145050 */, 17 }, + /* 2618 */ { MAD_F(0x0467917f) /* 0.275285242 */, 17 }, + /* 2619 */ { MAD_F(0x04682485) /* 0.275425452 */, 17 }, + /* 2620 */ { MAD_F(0x0468b78f) /* 0.275565681 */, 17 }, + /* 2621 */ { MAD_F(0x04694a9e) /* 0.275705926 */, 17 }, + /* 2622 */ { MAD_F(0x0469ddb2) /* 0.275846190 */, 17 }, + /* 2623 */ { MAD_F(0x046a70ca) /* 0.275986472 */, 17 }, + + /* 2624 */ { MAD_F(0x046b03e7) /* 0.276126771 */, 17 }, + /* 2625 */ { MAD_F(0x046b970a) /* 0.276267088 */, 17 }, + /* 2626 */ { MAD_F(0x046c2a31) /* 0.276407423 */, 17 }, + /* 2627 */ { MAD_F(0x046cbd5c) /* 0.276547776 */, 17 }, + /* 2628 */ { MAD_F(0x046d508d) /* 0.276688147 */, 17 }, + /* 2629 */ { MAD_F(0x046de3c2) /* 0.276828535 */, 17 }, + /* 2630 */ { MAD_F(0x046e76fc) /* 0.276968942 */, 17 }, + /* 2631 */ { MAD_F(0x046f0a3b) /* 0.277109366 */, 17 }, + /* 2632 */ { MAD_F(0x046f9d7e) /* 0.277249808 */, 17 }, + /* 2633 */ { MAD_F(0x047030c7) /* 0.277390267 */, 17 }, + /* 2634 */ { MAD_F(0x0470c414) /* 0.277530745 */, 17 }, + /* 2635 */ { MAD_F(0x04715766) /* 0.277671240 */, 17 }, + /* 2636 */ { MAD_F(0x0471eabc) /* 0.277811753 */, 17 }, + /* 2637 */ { MAD_F(0x04727e18) /* 0.277952284 */, 17 }, + /* 2638 */ { MAD_F(0x04731178) /* 0.278092832 */, 17 }, + /* 2639 */ { MAD_F(0x0473a4dd) /* 0.278233399 */, 17 }, + + /* 2640 */ { MAD_F(0x04743847) /* 0.278373983 */, 17 }, + /* 2641 */ { MAD_F(0x0474cbb5) /* 0.278514584 */, 17 }, + /* 2642 */ { MAD_F(0x04755f29) /* 0.278655204 */, 17 }, + /* 2643 */ { MAD_F(0x0475f2a1) /* 0.278795841 */, 17 }, + /* 2644 */ { MAD_F(0x0476861d) /* 0.278936496 */, 17 }, + /* 2645 */ { MAD_F(0x0477199f) /* 0.279077169 */, 17 }, + /* 2646 */ { MAD_F(0x0477ad25) /* 0.279217860 */, 17 }, + /* 2647 */ { MAD_F(0x047840b0) /* 0.279358568 */, 17 }, + /* 2648 */ { MAD_F(0x0478d440) /* 0.279499294 */, 17 }, + /* 2649 */ { MAD_F(0x047967d5) /* 0.279640037 */, 17 }, + /* 2650 */ { MAD_F(0x0479fb6e) /* 0.279780799 */, 17 }, + /* 2651 */ { MAD_F(0x047a8f0c) /* 0.279921578 */, 17 }, + /* 2652 */ { MAD_F(0x047b22af) /* 0.280062375 */, 17 }, + /* 2653 */ { MAD_F(0x047bb657) /* 0.280203189 */, 17 }, + /* 2654 */ { MAD_F(0x047c4a03) /* 0.280344021 */, 17 }, + /* 2655 */ { MAD_F(0x047cddb4) /* 0.280484871 */, 17 }, + + /* 2656 */ { MAD_F(0x047d716a) /* 0.280625739 */, 17 }, + /* 2657 */ { MAD_F(0x047e0524) /* 0.280766624 */, 17 }, + /* 2658 */ { MAD_F(0x047e98e4) /* 0.280907527 */, 17 }, + /* 2659 */ { MAD_F(0x047f2ca8) /* 0.281048447 */, 17 }, + /* 2660 */ { MAD_F(0x047fc071) /* 0.281189385 */, 17 }, + /* 2661 */ { MAD_F(0x0480543e) /* 0.281330341 */, 17 }, + /* 2662 */ { MAD_F(0x0480e811) /* 0.281471315 */, 17 }, + /* 2663 */ { MAD_F(0x04817be8) /* 0.281612306 */, 17 }, + /* 2664 */ { MAD_F(0x04820fc3) /* 0.281753315 */, 17 }, + /* 2665 */ { MAD_F(0x0482a3a4) /* 0.281894341 */, 17 }, + /* 2666 */ { MAD_F(0x04833789) /* 0.282035386 */, 17 }, + /* 2667 */ { MAD_F(0x0483cb73) /* 0.282176447 */, 17 }, + /* 2668 */ { MAD_F(0x04845f62) /* 0.282317527 */, 17 }, + /* 2669 */ { MAD_F(0x0484f355) /* 0.282458624 */, 17 }, + /* 2670 */ { MAD_F(0x0485874d) /* 0.282599738 */, 17 }, + /* 2671 */ { MAD_F(0x04861b4a) /* 0.282740871 */, 17 }, + + /* 2672 */ { MAD_F(0x0486af4c) /* 0.282882021 */, 17 }, + /* 2673 */ { MAD_F(0x04874352) /* 0.283023188 */, 17 }, + /* 2674 */ { MAD_F(0x0487d75d) /* 0.283164373 */, 17 }, + /* 2675 */ { MAD_F(0x04886b6d) /* 0.283305576 */, 17 }, + /* 2676 */ { MAD_F(0x0488ff82) /* 0.283446796 */, 17 }, + /* 2677 */ { MAD_F(0x0489939b) /* 0.283588034 */, 17 }, + /* 2678 */ { MAD_F(0x048a27b9) /* 0.283729290 */, 17 }, + /* 2679 */ { MAD_F(0x048abbdc) /* 0.283870563 */, 17 }, + /* 2680 */ { MAD_F(0x048b5003) /* 0.284011853 */, 17 }, + /* 2681 */ { MAD_F(0x048be42f) /* 0.284153161 */, 17 }, + /* 2682 */ { MAD_F(0x048c7860) /* 0.284294487 */, 17 }, + /* 2683 */ { MAD_F(0x048d0c96) /* 0.284435831 */, 17 }, + /* 2684 */ { MAD_F(0x048da0d0) /* 0.284577192 */, 17 }, + /* 2685 */ { MAD_F(0x048e350f) /* 0.284718570 */, 17 }, + /* 2686 */ { MAD_F(0x048ec953) /* 0.284859966 */, 17 }, + /* 2687 */ { MAD_F(0x048f5d9b) /* 0.285001380 */, 17 }, + + /* 2688 */ { MAD_F(0x048ff1e8) /* 0.285142811 */, 17 }, + /* 2689 */ { MAD_F(0x0490863a) /* 0.285284259 */, 17 }, + /* 2690 */ { MAD_F(0x04911a91) /* 0.285425726 */, 17 }, + /* 2691 */ { MAD_F(0x0491aeec) /* 0.285567209 */, 17 }, + /* 2692 */ { MAD_F(0x0492434c) /* 0.285708711 */, 17 }, + /* 2693 */ { MAD_F(0x0492d7b0) /* 0.285850229 */, 17 }, + /* 2694 */ { MAD_F(0x04936c1a) /* 0.285991766 */, 17 }, + /* 2695 */ { MAD_F(0x04940088) /* 0.286133319 */, 17 }, + /* 2696 */ { MAD_F(0x049494fb) /* 0.286274891 */, 17 }, + /* 2697 */ { MAD_F(0x04952972) /* 0.286416480 */, 17 }, + /* 2698 */ { MAD_F(0x0495bdee) /* 0.286558086 */, 17 }, + /* 2699 */ { MAD_F(0x0496526f) /* 0.286699710 */, 17 }, + /* 2700 */ { MAD_F(0x0496e6f5) /* 0.286841351 */, 17 }, + /* 2701 */ { MAD_F(0x04977b7f) /* 0.286983010 */, 17 }, + /* 2702 */ { MAD_F(0x0498100e) /* 0.287124686 */, 17 }, + /* 2703 */ { MAD_F(0x0498a4a1) /* 0.287266380 */, 17 }, + + /* 2704 */ { MAD_F(0x0499393a) /* 0.287408091 */, 17 }, + /* 2705 */ { MAD_F(0x0499cdd7) /* 0.287549820 */, 17 }, + /* 2706 */ { MAD_F(0x049a6278) /* 0.287691566 */, 17 }, + /* 2707 */ { MAD_F(0x049af71f) /* 0.287833330 */, 17 }, + /* 2708 */ { MAD_F(0x049b8bca) /* 0.287975111 */, 17 }, + /* 2709 */ { MAD_F(0x049c207a) /* 0.288116909 */, 17 }, + /* 2710 */ { MAD_F(0x049cb52e) /* 0.288258725 */, 17 }, + /* 2711 */ { MAD_F(0x049d49e7) /* 0.288400559 */, 17 }, + /* 2712 */ { MAD_F(0x049ddea5) /* 0.288542409 */, 17 }, + /* 2713 */ { MAD_F(0x049e7367) /* 0.288684278 */, 17 }, + /* 2714 */ { MAD_F(0x049f082f) /* 0.288826163 */, 17 }, + /* 2715 */ { MAD_F(0x049f9cfa) /* 0.288968067 */, 17 }, + /* 2716 */ { MAD_F(0x04a031cb) /* 0.289109987 */, 17 }, + /* 2717 */ { MAD_F(0x04a0c6a0) /* 0.289251925 */, 17 }, + /* 2718 */ { MAD_F(0x04a15b7a) /* 0.289393881 */, 17 }, + /* 2719 */ { MAD_F(0x04a1f059) /* 0.289535854 */, 17 }, + + /* 2720 */ { MAD_F(0x04a2853c) /* 0.289677844 */, 17 }, + /* 2721 */ { MAD_F(0x04a31a24) /* 0.289819851 */, 17 }, + /* 2722 */ { MAD_F(0x04a3af10) /* 0.289961876 */, 17 }, + /* 2723 */ { MAD_F(0x04a44401) /* 0.290103919 */, 17 }, + /* 2724 */ { MAD_F(0x04a4d8f7) /* 0.290245979 */, 17 }, + /* 2725 */ { MAD_F(0x04a56df2) /* 0.290388056 */, 17 }, + /* 2726 */ { MAD_F(0x04a602f1) /* 0.290530150 */, 17 }, + /* 2727 */ { MAD_F(0x04a697f5) /* 0.290672262 */, 17 }, + /* 2728 */ { MAD_F(0x04a72cfe) /* 0.290814392 */, 17 }, + /* 2729 */ { MAD_F(0x04a7c20b) /* 0.290956538 */, 17 }, + /* 2730 */ { MAD_F(0x04a8571d) /* 0.291098703 */, 17 }, + /* 2731 */ { MAD_F(0x04a8ec33) /* 0.291240884 */, 17 }, + /* 2732 */ { MAD_F(0x04a9814e) /* 0.291383083 */, 17 }, + /* 2733 */ { MAD_F(0x04aa166e) /* 0.291525299 */, 17 }, + /* 2734 */ { MAD_F(0x04aaab93) /* 0.291667532 */, 17 }, + /* 2735 */ { MAD_F(0x04ab40bc) /* 0.291809783 */, 17 }, + + /* 2736 */ { MAD_F(0x04abd5ea) /* 0.291952051 */, 17 }, + /* 2737 */ { MAD_F(0x04ac6b1c) /* 0.292094337 */, 17 }, + /* 2738 */ { MAD_F(0x04ad0053) /* 0.292236640 */, 17 }, + /* 2739 */ { MAD_F(0x04ad958f) /* 0.292378960 */, 17 }, + /* 2740 */ { MAD_F(0x04ae2ad0) /* 0.292521297 */, 17 }, + /* 2741 */ { MAD_F(0x04aec015) /* 0.292663652 */, 17 }, + /* 2742 */ { MAD_F(0x04af555e) /* 0.292806024 */, 17 }, + /* 2743 */ { MAD_F(0x04afeaad) /* 0.292948414 */, 17 }, + /* 2744 */ { MAD_F(0x04b08000) /* 0.293090820 */, 17 }, + /* 2745 */ { MAD_F(0x04b11557) /* 0.293233244 */, 17 }, + /* 2746 */ { MAD_F(0x04b1aab4) /* 0.293375686 */, 17 }, + /* 2747 */ { MAD_F(0x04b24015) /* 0.293518144 */, 17 }, + /* 2748 */ { MAD_F(0x04b2d57a) /* 0.293660620 */, 17 }, + /* 2749 */ { MAD_F(0x04b36ae4) /* 0.293803113 */, 17 }, + /* 2750 */ { MAD_F(0x04b40053) /* 0.293945624 */, 17 }, + /* 2751 */ { MAD_F(0x04b495c7) /* 0.294088151 */, 17 }, + + /* 2752 */ { MAD_F(0x04b52b3f) /* 0.294230696 */, 17 }, + /* 2753 */ { MAD_F(0x04b5c0bc) /* 0.294373259 */, 17 }, + /* 2754 */ { MAD_F(0x04b6563d) /* 0.294515838 */, 17 }, + /* 2755 */ { MAD_F(0x04b6ebc3) /* 0.294658435 */, 17 }, + /* 2756 */ { MAD_F(0x04b7814e) /* 0.294801049 */, 17 }, + /* 2757 */ { MAD_F(0x04b816dd) /* 0.294943680 */, 17 }, + /* 2758 */ { MAD_F(0x04b8ac71) /* 0.295086329 */, 17 }, + /* 2759 */ { MAD_F(0x04b9420a) /* 0.295228995 */, 17 }, + /* 2760 */ { MAD_F(0x04b9d7a7) /* 0.295371678 */, 17 }, + /* 2761 */ { MAD_F(0x04ba6d49) /* 0.295514378 */, 17 }, + /* 2762 */ { MAD_F(0x04bb02ef) /* 0.295657095 */, 17 }, + /* 2763 */ { MAD_F(0x04bb989a) /* 0.295799830 */, 17 }, + /* 2764 */ { MAD_F(0x04bc2e4a) /* 0.295942582 */, 17 }, + /* 2765 */ { MAD_F(0x04bcc3fe) /* 0.296085351 */, 17 }, + /* 2766 */ { MAD_F(0x04bd59b7) /* 0.296228138 */, 17 }, + /* 2767 */ { MAD_F(0x04bdef74) /* 0.296370941 */, 17 }, + + /* 2768 */ { MAD_F(0x04be8537) /* 0.296513762 */, 17 }, + /* 2769 */ { MAD_F(0x04bf1afd) /* 0.296656600 */, 17 }, + /* 2770 */ { MAD_F(0x04bfb0c9) /* 0.296799455 */, 17 }, + /* 2771 */ { MAD_F(0x04c04699) /* 0.296942327 */, 17 }, + /* 2772 */ { MAD_F(0x04c0dc6d) /* 0.297085217 */, 17 }, + /* 2773 */ { MAD_F(0x04c17247) /* 0.297228124 */, 17 }, + /* 2774 */ { MAD_F(0x04c20824) /* 0.297371048 */, 17 }, + /* 2775 */ { MAD_F(0x04c29e07) /* 0.297513989 */, 17 }, + /* 2776 */ { MAD_F(0x04c333ee) /* 0.297656947 */, 17 }, + /* 2777 */ { MAD_F(0x04c3c9da) /* 0.297799922 */, 17 }, + /* 2778 */ { MAD_F(0x04c45fca) /* 0.297942915 */, 17 }, + /* 2779 */ { MAD_F(0x04c4f5bf) /* 0.298085925 */, 17 }, + /* 2780 */ { MAD_F(0x04c58bb8) /* 0.298228951 */, 17 }, + /* 2781 */ { MAD_F(0x04c621b6) /* 0.298371996 */, 17 }, + /* 2782 */ { MAD_F(0x04c6b7b9) /* 0.298515057 */, 17 }, + /* 2783 */ { MAD_F(0x04c74dc0) /* 0.298658135 */, 17 }, + + /* 2784 */ { MAD_F(0x04c7e3cc) /* 0.298801231 */, 17 }, + /* 2785 */ { MAD_F(0x04c879dd) /* 0.298944343 */, 17 }, + /* 2786 */ { MAD_F(0x04c90ff2) /* 0.299087473 */, 17 }, + /* 2787 */ { MAD_F(0x04c9a60c) /* 0.299230620 */, 17 }, + /* 2788 */ { MAD_F(0x04ca3c2a) /* 0.299373784 */, 17 }, + /* 2789 */ { MAD_F(0x04cad24d) /* 0.299516965 */, 17 }, + /* 2790 */ { MAD_F(0x04cb6874) /* 0.299660163 */, 17 }, + /* 2791 */ { MAD_F(0x04cbfea0) /* 0.299803378 */, 17 }, + /* 2792 */ { MAD_F(0x04cc94d1) /* 0.299946611 */, 17 }, + /* 2793 */ { MAD_F(0x04cd2b06) /* 0.300089860 */, 17 }, + /* 2794 */ { MAD_F(0x04cdc140) /* 0.300233127 */, 17 }, + /* 2795 */ { MAD_F(0x04ce577f) /* 0.300376411 */, 17 }, + /* 2796 */ { MAD_F(0x04ceedc2) /* 0.300519711 */, 17 }, + /* 2797 */ { MAD_F(0x04cf8409) /* 0.300663029 */, 17 }, + /* 2798 */ { MAD_F(0x04d01a55) /* 0.300806364 */, 17 }, + /* 2799 */ { MAD_F(0x04d0b0a6) /* 0.300949716 */, 17 }, + + /* 2800 */ { MAD_F(0x04d146fb) /* 0.301093085 */, 17 }, + /* 2801 */ { MAD_F(0x04d1dd55) /* 0.301236472 */, 17 }, + /* 2802 */ { MAD_F(0x04d273b4) /* 0.301379875 */, 17 }, + /* 2803 */ { MAD_F(0x04d30a17) /* 0.301523295 */, 17 }, + /* 2804 */ { MAD_F(0x04d3a07f) /* 0.301666733 */, 17 }, + /* 2805 */ { MAD_F(0x04d436eb) /* 0.301810187 */, 17 }, + /* 2806 */ { MAD_F(0x04d4cd5c) /* 0.301953659 */, 17 }, + /* 2807 */ { MAD_F(0x04d563d1) /* 0.302097147 */, 17 }, + /* 2808 */ { MAD_F(0x04d5fa4b) /* 0.302240653 */, 17 }, + /* 2809 */ { MAD_F(0x04d690ca) /* 0.302384175 */, 17 }, + /* 2810 */ { MAD_F(0x04d7274d) /* 0.302527715 */, 17 }, + /* 2811 */ { MAD_F(0x04d7bdd5) /* 0.302671271 */, 17 }, + /* 2812 */ { MAD_F(0x04d85461) /* 0.302814845 */, 17 }, + /* 2813 */ { MAD_F(0x04d8eaf2) /* 0.302958436 */, 17 }, + /* 2814 */ { MAD_F(0x04d98187) /* 0.303102044 */, 17 }, + /* 2815 */ { MAD_F(0x04da1821) /* 0.303245668 */, 17 }, + + /* 2816 */ { MAD_F(0x04daaec0) /* 0.303389310 */, 17 }, + /* 2817 */ { MAD_F(0x04db4563) /* 0.303532969 */, 17 }, + /* 2818 */ { MAD_F(0x04dbdc0a) /* 0.303676645 */, 17 }, + /* 2819 */ { MAD_F(0x04dc72b7) /* 0.303820337 */, 17 }, + /* 2820 */ { MAD_F(0x04dd0967) /* 0.303964047 */, 17 }, + /* 2821 */ { MAD_F(0x04dda01d) /* 0.304107774 */, 17 }, + /* 2822 */ { MAD_F(0x04de36d7) /* 0.304251517 */, 17 }, + /* 2823 */ { MAD_F(0x04decd95) /* 0.304395278 */, 17 }, + /* 2824 */ { MAD_F(0x04df6458) /* 0.304539056 */, 17 }, + /* 2825 */ { MAD_F(0x04dffb20) /* 0.304682850 */, 17 }, + /* 2826 */ { MAD_F(0x04e091ec) /* 0.304826662 */, 17 }, + /* 2827 */ { MAD_F(0x04e128bc) /* 0.304970491 */, 17 }, + /* 2828 */ { MAD_F(0x04e1bf92) /* 0.305114336 */, 17 }, + /* 2829 */ { MAD_F(0x04e2566b) /* 0.305258199 */, 17 }, + /* 2830 */ { MAD_F(0x04e2ed4a) /* 0.305402078 */, 17 }, + /* 2831 */ { MAD_F(0x04e3842d) /* 0.305545974 */, 17 }, + + /* 2832 */ { MAD_F(0x04e41b14) /* 0.305689888 */, 17 }, + /* 2833 */ { MAD_F(0x04e4b200) /* 0.305833818 */, 17 }, + /* 2834 */ { MAD_F(0x04e548f1) /* 0.305977765 */, 17 }, + /* 2835 */ { MAD_F(0x04e5dfe6) /* 0.306121729 */, 17 }, + /* 2836 */ { MAD_F(0x04e676df) /* 0.306265710 */, 17 }, + /* 2837 */ { MAD_F(0x04e70dde) /* 0.306409708 */, 17 }, + /* 2838 */ { MAD_F(0x04e7a4e0) /* 0.306553723 */, 17 }, + /* 2839 */ { MAD_F(0x04e83be7) /* 0.306697755 */, 17 }, + /* 2840 */ { MAD_F(0x04e8d2f3) /* 0.306841804 */, 17 }, + /* 2841 */ { MAD_F(0x04e96a04) /* 0.306985869 */, 17 }, + /* 2842 */ { MAD_F(0x04ea0118) /* 0.307129952 */, 17 }, + /* 2843 */ { MAD_F(0x04ea9832) /* 0.307274051 */, 17 }, + /* 2844 */ { MAD_F(0x04eb2f50) /* 0.307418168 */, 17 }, + /* 2845 */ { MAD_F(0x04ebc672) /* 0.307562301 */, 17 }, + /* 2846 */ { MAD_F(0x04ec5d99) /* 0.307706451 */, 17 }, + /* 2847 */ { MAD_F(0x04ecf4c5) /* 0.307850618 */, 17 }, + + /* 2848 */ { MAD_F(0x04ed8bf5) /* 0.307994802 */, 17 }, + /* 2849 */ { MAD_F(0x04ee2329) /* 0.308139003 */, 17 }, + /* 2850 */ { MAD_F(0x04eeba63) /* 0.308283220 */, 17 }, + /* 2851 */ { MAD_F(0x04ef51a0) /* 0.308427455 */, 17 }, + /* 2852 */ { MAD_F(0x04efe8e2) /* 0.308571706 */, 17 }, + /* 2853 */ { MAD_F(0x04f08029) /* 0.308715974 */, 17 }, + /* 2854 */ { MAD_F(0x04f11774) /* 0.308860260 */, 17 }, + /* 2855 */ { MAD_F(0x04f1aec4) /* 0.309004561 */, 17 }, + /* 2856 */ { MAD_F(0x04f24618) /* 0.309148880 */, 17 }, + /* 2857 */ { MAD_F(0x04f2dd71) /* 0.309293216 */, 17 }, + /* 2858 */ { MAD_F(0x04f374cf) /* 0.309437568 */, 17 }, + /* 2859 */ { MAD_F(0x04f40c30) /* 0.309581938 */, 17 }, + /* 2860 */ { MAD_F(0x04f4a397) /* 0.309726324 */, 17 }, + /* 2861 */ { MAD_F(0x04f53b02) /* 0.309870727 */, 17 }, + /* 2862 */ { MAD_F(0x04f5d271) /* 0.310015147 */, 17 }, + /* 2863 */ { MAD_F(0x04f669e5) /* 0.310159583 */, 17 }, + + /* 2864 */ { MAD_F(0x04f7015d) /* 0.310304037 */, 17 }, + /* 2865 */ { MAD_F(0x04f798da) /* 0.310448507 */, 17 }, + /* 2866 */ { MAD_F(0x04f8305c) /* 0.310592994 */, 17 }, + /* 2867 */ { MAD_F(0x04f8c7e2) /* 0.310737498 */, 17 }, + /* 2868 */ { MAD_F(0x04f95f6c) /* 0.310882018 */, 17 }, + /* 2869 */ { MAD_F(0x04f9f6fb) /* 0.311026556 */, 17 }, + /* 2870 */ { MAD_F(0x04fa8e8f) /* 0.311171110 */, 17 }, + /* 2871 */ { MAD_F(0x04fb2627) /* 0.311315681 */, 17 }, + /* 2872 */ { MAD_F(0x04fbbdc3) /* 0.311460269 */, 17 }, + /* 2873 */ { MAD_F(0x04fc5564) /* 0.311604874 */, 17 }, + /* 2874 */ { MAD_F(0x04fced0a) /* 0.311749495 */, 17 }, + /* 2875 */ { MAD_F(0x04fd84b4) /* 0.311894133 */, 17 }, + /* 2876 */ { MAD_F(0x04fe1c62) /* 0.312038788 */, 17 }, + /* 2877 */ { MAD_F(0x04feb415) /* 0.312183460 */, 17 }, + /* 2878 */ { MAD_F(0x04ff4bcd) /* 0.312328148 */, 17 }, + /* 2879 */ { MAD_F(0x04ffe389) /* 0.312472854 */, 17 }, + + /* 2880 */ { MAD_F(0x05007b49) /* 0.312617576 */, 17 }, + /* 2881 */ { MAD_F(0x0501130e) /* 0.312762314 */, 17 }, + /* 2882 */ { MAD_F(0x0501aad8) /* 0.312907070 */, 17 }, + /* 2883 */ { MAD_F(0x050242a6) /* 0.313051842 */, 17 }, + /* 2884 */ { MAD_F(0x0502da78) /* 0.313196631 */, 17 }, + /* 2885 */ { MAD_F(0x0503724f) /* 0.313341437 */, 17 }, + /* 2886 */ { MAD_F(0x05040a2b) /* 0.313486259 */, 17 }, + /* 2887 */ { MAD_F(0x0504a20b) /* 0.313631098 */, 17 }, + /* 2888 */ { MAD_F(0x050539ef) /* 0.313775954 */, 17 }, + /* 2889 */ { MAD_F(0x0505d1d8) /* 0.313920827 */, 17 }, + /* 2890 */ { MAD_F(0x050669c5) /* 0.314065716 */, 17 }, + /* 2891 */ { MAD_F(0x050701b7) /* 0.314210622 */, 17 }, + /* 2892 */ { MAD_F(0x050799ae) /* 0.314355545 */, 17 }, + /* 2893 */ { MAD_F(0x050831a9) /* 0.314500484 */, 17 }, + /* 2894 */ { MAD_F(0x0508c9a8) /* 0.314645440 */, 17 }, + /* 2895 */ { MAD_F(0x050961ac) /* 0.314790413 */, 17 }, + + /* 2896 */ { MAD_F(0x0509f9b4) /* 0.314935403 */, 17 }, + /* 2897 */ { MAD_F(0x050a91c1) /* 0.315080409 */, 17 }, + /* 2898 */ { MAD_F(0x050b29d2) /* 0.315225432 */, 17 }, + /* 2899 */ { MAD_F(0x050bc1e8) /* 0.315370472 */, 17 }, + /* 2900 */ { MAD_F(0x050c5a02) /* 0.315515528 */, 17 }, + /* 2901 */ { MAD_F(0x050cf221) /* 0.315660601 */, 17 }, + /* 2902 */ { MAD_F(0x050d8a44) /* 0.315805690 */, 17 }, + /* 2903 */ { MAD_F(0x050e226c) /* 0.315950797 */, 17 }, + /* 2904 */ { MAD_F(0x050eba98) /* 0.316095920 */, 17 }, + /* 2905 */ { MAD_F(0x050f52c9) /* 0.316241059 */, 17 }, + /* 2906 */ { MAD_F(0x050feafe) /* 0.316386216 */, 17 }, + /* 2907 */ { MAD_F(0x05108337) /* 0.316531388 */, 17 }, + /* 2908 */ { MAD_F(0x05111b75) /* 0.316676578 */, 17 }, + /* 2909 */ { MAD_F(0x0511b3b8) /* 0.316821784 */, 17 }, + /* 2910 */ { MAD_F(0x05124bff) /* 0.316967007 */, 17 }, + /* 2911 */ { MAD_F(0x0512e44a) /* 0.317112247 */, 17 }, + + /* 2912 */ { MAD_F(0x05137c9a) /* 0.317257503 */, 17 }, + /* 2913 */ { MAD_F(0x051414ee) /* 0.317402775 */, 17 }, + /* 2914 */ { MAD_F(0x0514ad47) /* 0.317548065 */, 17 }, + /* 2915 */ { MAD_F(0x051545a5) /* 0.317693371 */, 17 }, + /* 2916 */ { MAD_F(0x0515de06) /* 0.317838693 */, 17 }, + /* 2917 */ { MAD_F(0x0516766d) /* 0.317984033 */, 17 }, + /* 2918 */ { MAD_F(0x05170ed7) /* 0.318129388 */, 17 }, + /* 2919 */ { MAD_F(0x0517a746) /* 0.318274761 */, 17 }, + /* 2920 */ { MAD_F(0x05183fba) /* 0.318420150 */, 17 }, + /* 2921 */ { MAD_F(0x0518d832) /* 0.318565555 */, 17 }, + /* 2922 */ { MAD_F(0x051970ae) /* 0.318710978 */, 17 }, + /* 2923 */ { MAD_F(0x051a092f) /* 0.318856416 */, 17 }, + /* 2924 */ { MAD_F(0x051aa1b5) /* 0.319001872 */, 17 }, + /* 2925 */ { MAD_F(0x051b3a3f) /* 0.319147344 */, 17 }, + /* 2926 */ { MAD_F(0x051bd2cd) /* 0.319292832 */, 17 }, + /* 2927 */ { MAD_F(0x051c6b60) /* 0.319438338 */, 17 }, + + /* 2928 */ { MAD_F(0x051d03f7) /* 0.319583859 */, 17 }, + /* 2929 */ { MAD_F(0x051d9c92) /* 0.319729398 */, 17 }, + /* 2930 */ { MAD_F(0x051e3532) /* 0.319874952 */, 17 }, + /* 2931 */ { MAD_F(0x051ecdd7) /* 0.320020524 */, 17 }, + /* 2932 */ { MAD_F(0x051f6680) /* 0.320166112 */, 17 }, + /* 2933 */ { MAD_F(0x051fff2d) /* 0.320311716 */, 17 }, + /* 2934 */ { MAD_F(0x052097df) /* 0.320457337 */, 17 }, + /* 2935 */ { MAD_F(0x05213095) /* 0.320602975 */, 17 }, + /* 2936 */ { MAD_F(0x0521c950) /* 0.320748629 */, 17 }, + /* 2937 */ { MAD_F(0x0522620f) /* 0.320894300 */, 17 }, + /* 2938 */ { MAD_F(0x0522fad3) /* 0.321039987 */, 17 }, + /* 2939 */ { MAD_F(0x0523939b) /* 0.321185691 */, 17 }, + /* 2940 */ { MAD_F(0x05242c68) /* 0.321331411 */, 17 }, + /* 2941 */ { MAD_F(0x0524c538) /* 0.321477148 */, 17 }, + /* 2942 */ { MAD_F(0x05255e0e) /* 0.321622901 */, 17 }, + /* 2943 */ { MAD_F(0x0525f6e8) /* 0.321768671 */, 17 }, + + /* 2944 */ { MAD_F(0x05268fc6) /* 0.321914457 */, 17 }, + /* 2945 */ { MAD_F(0x052728a9) /* 0.322060260 */, 17 }, + /* 2946 */ { MAD_F(0x0527c190) /* 0.322206079 */, 17 }, + /* 2947 */ { MAD_F(0x05285a7b) /* 0.322351915 */, 17 }, + /* 2948 */ { MAD_F(0x0528f36b) /* 0.322497768 */, 17 }, + /* 2949 */ { MAD_F(0x05298c5f) /* 0.322643636 */, 17 }, + /* 2950 */ { MAD_F(0x052a2558) /* 0.322789522 */, 17 }, + /* 2951 */ { MAD_F(0x052abe55) /* 0.322935424 */, 17 }, + /* 2952 */ { MAD_F(0x052b5757) /* 0.323081342 */, 17 }, + /* 2953 */ { MAD_F(0x052bf05d) /* 0.323227277 */, 17 }, + /* 2954 */ { MAD_F(0x052c8968) /* 0.323373228 */, 17 }, + /* 2955 */ { MAD_F(0x052d2277) /* 0.323519196 */, 17 }, + /* 2956 */ { MAD_F(0x052dbb8a) /* 0.323665180 */, 17 }, + /* 2957 */ { MAD_F(0x052e54a2) /* 0.323811180 */, 17 }, + /* 2958 */ { MAD_F(0x052eedbe) /* 0.323957197 */, 17 }, + /* 2959 */ { MAD_F(0x052f86de) /* 0.324103231 */, 17 }, + + /* 2960 */ { MAD_F(0x05302003) /* 0.324249281 */, 17 }, + /* 2961 */ { MAD_F(0x0530b92d) /* 0.324395347 */, 17 }, + /* 2962 */ { MAD_F(0x0531525b) /* 0.324541430 */, 17 }, + /* 2963 */ { MAD_F(0x0531eb8d) /* 0.324687530 */, 17 }, + /* 2964 */ { MAD_F(0x053284c4) /* 0.324833646 */, 17 }, + /* 2965 */ { MAD_F(0x05331dff) /* 0.324979778 */, 17 }, + /* 2966 */ { MAD_F(0x0533b73e) /* 0.325125926 */, 17 }, + /* 2967 */ { MAD_F(0x05345082) /* 0.325272091 */, 17 }, + /* 2968 */ { MAD_F(0x0534e9ca) /* 0.325418273 */, 17 }, + /* 2969 */ { MAD_F(0x05358317) /* 0.325564471 */, 17 }, + /* 2970 */ { MAD_F(0x05361c68) /* 0.325710685 */, 17 }, + /* 2971 */ { MAD_F(0x0536b5be) /* 0.325856916 */, 17 }, + /* 2972 */ { MAD_F(0x05374f17) /* 0.326003163 */, 17 }, + /* 2973 */ { MAD_F(0x0537e876) /* 0.326149427 */, 17 }, + /* 2974 */ { MAD_F(0x053881d9) /* 0.326295707 */, 17 }, + /* 2975 */ { MAD_F(0x05391b40) /* 0.326442003 */, 17 }, + + /* 2976 */ { MAD_F(0x0539b4ab) /* 0.326588316 */, 17 }, + /* 2977 */ { MAD_F(0x053a4e1b) /* 0.326734645 */, 17 }, + /* 2978 */ { MAD_F(0x053ae78f) /* 0.326880990 */, 17 }, + /* 2979 */ { MAD_F(0x053b8108) /* 0.327027352 */, 17 }, + /* 2980 */ { MAD_F(0x053c1a85) /* 0.327173730 */, 17 }, + /* 2981 */ { MAD_F(0x053cb407) /* 0.327320125 */, 17 }, + /* 2982 */ { MAD_F(0x053d4d8d) /* 0.327466536 */, 17 }, + /* 2983 */ { MAD_F(0x053de717) /* 0.327612963 */, 17 }, + /* 2984 */ { MAD_F(0x053e80a6) /* 0.327759407 */, 17 }, + /* 2985 */ { MAD_F(0x053f1a39) /* 0.327905867 */, 17 }, + /* 2986 */ { MAD_F(0x053fb3d0) /* 0.328052344 */, 17 }, + /* 2987 */ { MAD_F(0x05404d6c) /* 0.328198837 */, 17 }, + /* 2988 */ { MAD_F(0x0540e70c) /* 0.328345346 */, 17 }, + /* 2989 */ { MAD_F(0x054180b1) /* 0.328491871 */, 17 }, + /* 2990 */ { MAD_F(0x05421a5a) /* 0.328638413 */, 17 }, + /* 2991 */ { MAD_F(0x0542b407) /* 0.328784971 */, 17 }, + + /* 2992 */ { MAD_F(0x05434db9) /* 0.328931546 */, 17 }, + /* 2993 */ { MAD_F(0x0543e76f) /* 0.329078137 */, 17 }, + /* 2994 */ { MAD_F(0x0544812a) /* 0.329224744 */, 17 }, + /* 2995 */ { MAD_F(0x05451ae9) /* 0.329371367 */, 17 }, + /* 2996 */ { MAD_F(0x0545b4ac) /* 0.329518007 */, 17 }, + /* 2997 */ { MAD_F(0x05464e74) /* 0.329664663 */, 17 }, + /* 2998 */ { MAD_F(0x0546e840) /* 0.329811336 */, 17 }, + /* 2999 */ { MAD_F(0x05478211) /* 0.329958024 */, 17 }, + /* 3000 */ { MAD_F(0x05481be5) /* 0.330104730 */, 17 }, + /* 3001 */ { MAD_F(0x0548b5bf) /* 0.330251451 */, 17 }, + /* 3002 */ { MAD_F(0x05494f9c) /* 0.330398189 */, 17 }, + /* 3003 */ { MAD_F(0x0549e97e) /* 0.330544943 */, 17 }, + /* 3004 */ { MAD_F(0x054a8364) /* 0.330691713 */, 17 }, + /* 3005 */ { MAD_F(0x054b1d4f) /* 0.330838499 */, 17 }, + /* 3006 */ { MAD_F(0x054bb73e) /* 0.330985302 */, 17 }, + /* 3007 */ { MAD_F(0x054c5132) /* 0.331132121 */, 17 }, + + /* 3008 */ { MAD_F(0x054ceb2a) /* 0.331278957 */, 17 }, + /* 3009 */ { MAD_F(0x054d8526) /* 0.331425808 */, 17 }, + /* 3010 */ { MAD_F(0x054e1f26) /* 0.331572676 */, 17 }, + /* 3011 */ { MAD_F(0x054eb92b) /* 0.331719560 */, 17 }, + /* 3012 */ { MAD_F(0x054f5334) /* 0.331866461 */, 17 }, + /* 3013 */ { MAD_F(0x054fed42) /* 0.332013377 */, 17 }, + /* 3014 */ { MAD_F(0x05508754) /* 0.332160310 */, 17 }, + /* 3015 */ { MAD_F(0x0551216b) /* 0.332307260 */, 17 }, + /* 3016 */ { MAD_F(0x0551bb85) /* 0.332454225 */, 17 }, + /* 3017 */ { MAD_F(0x055255a4) /* 0.332601207 */, 17 }, + /* 3018 */ { MAD_F(0x0552efc8) /* 0.332748205 */, 17 }, + /* 3019 */ { MAD_F(0x055389f0) /* 0.332895219 */, 17 }, + /* 3020 */ { MAD_F(0x0554241c) /* 0.333042249 */, 17 }, + /* 3021 */ { MAD_F(0x0554be4c) /* 0.333189296 */, 17 }, + /* 3022 */ { MAD_F(0x05555881) /* 0.333336359 */, 17 }, + /* 3023 */ { MAD_F(0x0555f2ba) /* 0.333483438 */, 17 }, + + /* 3024 */ { MAD_F(0x05568cf8) /* 0.333630533 */, 17 }, + /* 3025 */ { MAD_F(0x0557273a) /* 0.333777645 */, 17 }, + /* 3026 */ { MAD_F(0x0557c180) /* 0.333924772 */, 17 }, + /* 3027 */ { MAD_F(0x05585bcb) /* 0.334071916 */, 17 }, + /* 3028 */ { MAD_F(0x0558f61a) /* 0.334219076 */, 17 }, + /* 3029 */ { MAD_F(0x0559906d) /* 0.334366253 */, 17 }, + /* 3030 */ { MAD_F(0x055a2ac5) /* 0.334513445 */, 17 }, + /* 3031 */ { MAD_F(0x055ac521) /* 0.334660654 */, 17 }, + /* 3032 */ { MAD_F(0x055b5f81) /* 0.334807879 */, 17 }, + /* 3033 */ { MAD_F(0x055bf9e6) /* 0.334955120 */, 17 }, + /* 3034 */ { MAD_F(0x055c944f) /* 0.335102377 */, 17 }, + /* 3035 */ { MAD_F(0x055d2ebd) /* 0.335249651 */, 17 }, + /* 3036 */ { MAD_F(0x055dc92e) /* 0.335396941 */, 17 }, + /* 3037 */ { MAD_F(0x055e63a5) /* 0.335544246 */, 17 }, + /* 3038 */ { MAD_F(0x055efe1f) /* 0.335691568 */, 17 }, + /* 3039 */ { MAD_F(0x055f989e) /* 0.335838906 */, 17 }, + + /* 3040 */ { MAD_F(0x05603321) /* 0.335986261 */, 17 }, + /* 3041 */ { MAD_F(0x0560cda8) /* 0.336133631 */, 17 }, + /* 3042 */ { MAD_F(0x05616834) /* 0.336281018 */, 17 }, + /* 3043 */ { MAD_F(0x056202c4) /* 0.336428421 */, 17 }, + /* 3044 */ { MAD_F(0x05629d59) /* 0.336575840 */, 17 }, + /* 3045 */ { MAD_F(0x056337f2) /* 0.336723275 */, 17 }, + /* 3046 */ { MAD_F(0x0563d28f) /* 0.336870726 */, 17 }, + /* 3047 */ { MAD_F(0x05646d30) /* 0.337018193 */, 17 }, + /* 3048 */ { MAD_F(0x056507d6) /* 0.337165677 */, 17 }, + /* 3049 */ { MAD_F(0x0565a280) /* 0.337313176 */, 17 }, + /* 3050 */ { MAD_F(0x05663d2f) /* 0.337460692 */, 17 }, + /* 3051 */ { MAD_F(0x0566d7e1) /* 0.337608224 */, 17 }, + /* 3052 */ { MAD_F(0x05677298) /* 0.337755772 */, 17 }, + /* 3053 */ { MAD_F(0x05680d54) /* 0.337903336 */, 17 }, + /* 3054 */ { MAD_F(0x0568a814) /* 0.338050916 */, 17 }, + /* 3055 */ { MAD_F(0x056942d8) /* 0.338198513 */, 17 }, + + /* 3056 */ { MAD_F(0x0569dda0) /* 0.338346125 */, 17 }, + /* 3057 */ { MAD_F(0x056a786d) /* 0.338493753 */, 17 }, + /* 3058 */ { MAD_F(0x056b133e) /* 0.338641398 */, 17 }, + /* 3059 */ { MAD_F(0x056bae13) /* 0.338789059 */, 17 }, + /* 3060 */ { MAD_F(0x056c48ed) /* 0.338936736 */, 17 }, + /* 3061 */ { MAD_F(0x056ce3cb) /* 0.339084429 */, 17 }, + /* 3062 */ { MAD_F(0x056d7ead) /* 0.339232138 */, 17 }, + /* 3063 */ { MAD_F(0x056e1994) /* 0.339379863 */, 17 }, + /* 3064 */ { MAD_F(0x056eb47f) /* 0.339527604 */, 17 }, + /* 3065 */ { MAD_F(0x056f4f6e) /* 0.339675361 */, 17 }, + /* 3066 */ { MAD_F(0x056fea62) /* 0.339823134 */, 17 }, + /* 3067 */ { MAD_F(0x0570855a) /* 0.339970924 */, 17 }, + /* 3068 */ { MAD_F(0x05712056) /* 0.340118729 */, 17 }, + /* 3069 */ { MAD_F(0x0571bb56) /* 0.340266550 */, 17 }, + /* 3070 */ { MAD_F(0x0572565b) /* 0.340414388 */, 17 }, + /* 3071 */ { MAD_F(0x0572f164) /* 0.340562242 */, 17 }, + + /* 3072 */ { MAD_F(0x05738c72) /* 0.340710111 */, 17 }, + /* 3073 */ { MAD_F(0x05742784) /* 0.340857997 */, 17 }, + /* 3074 */ { MAD_F(0x0574c29a) /* 0.341005899 */, 17 }, + /* 3075 */ { MAD_F(0x05755db4) /* 0.341153816 */, 17 }, + /* 3076 */ { MAD_F(0x0575f8d3) /* 0.341301750 */, 17 }, + /* 3077 */ { MAD_F(0x057693f6) /* 0.341449700 */, 17 }, + /* 3078 */ { MAD_F(0x05772f1d) /* 0.341597666 */, 17 }, + /* 3079 */ { MAD_F(0x0577ca49) /* 0.341745648 */, 17 }, + /* 3080 */ { MAD_F(0x05786578) /* 0.341893646 */, 17 }, + /* 3081 */ { MAD_F(0x057900ad) /* 0.342041659 */, 17 }, + /* 3082 */ { MAD_F(0x05799be5) /* 0.342189689 */, 17 }, + /* 3083 */ { MAD_F(0x057a3722) /* 0.342337735 */, 17 }, + /* 3084 */ { MAD_F(0x057ad263) /* 0.342485797 */, 17 }, + /* 3085 */ { MAD_F(0x057b6da8) /* 0.342633875 */, 17 }, + /* 3086 */ { MAD_F(0x057c08f2) /* 0.342781969 */, 17 }, + /* 3087 */ { MAD_F(0x057ca440) /* 0.342930079 */, 17 }, + + /* 3088 */ { MAD_F(0x057d3f92) /* 0.343078205 */, 17 }, + /* 3089 */ { MAD_F(0x057ddae9) /* 0.343226347 */, 17 }, + /* 3090 */ { MAD_F(0x057e7644) /* 0.343374505 */, 17 }, + /* 3091 */ { MAD_F(0x057f11a3) /* 0.343522679 */, 17 }, + /* 3092 */ { MAD_F(0x057fad06) /* 0.343670869 */, 17 }, + /* 3093 */ { MAD_F(0x0580486e) /* 0.343819075 */, 17 }, + /* 3094 */ { MAD_F(0x0580e3da) /* 0.343967296 */, 17 }, + /* 3095 */ { MAD_F(0x05817f4a) /* 0.344115534 */, 17 }, + /* 3096 */ { MAD_F(0x05821abf) /* 0.344263788 */, 17 }, + /* 3097 */ { MAD_F(0x0582b638) /* 0.344412058 */, 17 }, + /* 3098 */ { MAD_F(0x058351b5) /* 0.344560343 */, 17 }, + /* 3099 */ { MAD_F(0x0583ed36) /* 0.344708645 */, 17 }, + /* 3100 */ { MAD_F(0x058488bc) /* 0.344856963 */, 17 }, + /* 3101 */ { MAD_F(0x05852446) /* 0.345005296 */, 17 }, + /* 3102 */ { MAD_F(0x0585bfd4) /* 0.345153646 */, 17 }, + /* 3103 */ { MAD_F(0x05865b67) /* 0.345302011 */, 17 }, + + /* 3104 */ { MAD_F(0x0586f6fd) /* 0.345450393 */, 17 }, + /* 3105 */ { MAD_F(0x05879298) /* 0.345598790 */, 17 }, + /* 3106 */ { MAD_F(0x05882e38) /* 0.345747203 */, 17 }, + /* 3107 */ { MAD_F(0x0588c9dc) /* 0.345895632 */, 17 }, + /* 3108 */ { MAD_F(0x05896583) /* 0.346044077 */, 17 }, + /* 3109 */ { MAD_F(0x058a0130) /* 0.346192538 */, 17 }, + /* 3110 */ { MAD_F(0x058a9ce0) /* 0.346341015 */, 17 }, + /* 3111 */ { MAD_F(0x058b3895) /* 0.346489508 */, 17 }, + /* 3112 */ { MAD_F(0x058bd44e) /* 0.346638017 */, 17 }, + /* 3113 */ { MAD_F(0x058c700b) /* 0.346786542 */, 17 }, + /* 3114 */ { MAD_F(0x058d0bcd) /* 0.346935082 */, 17 }, + /* 3115 */ { MAD_F(0x058da793) /* 0.347083639 */, 17 }, + /* 3116 */ { MAD_F(0x058e435d) /* 0.347232211 */, 17 }, + /* 3117 */ { MAD_F(0x058edf2b) /* 0.347380799 */, 17 }, + /* 3118 */ { MAD_F(0x058f7afe) /* 0.347529403 */, 17 }, + /* 3119 */ { MAD_F(0x059016d5) /* 0.347678023 */, 17 }, + + /* 3120 */ { MAD_F(0x0590b2b0) /* 0.347826659 */, 17 }, + /* 3121 */ { MAD_F(0x05914e8f) /* 0.347975311 */, 17 }, + /* 3122 */ { MAD_F(0x0591ea73) /* 0.348123979 */, 17 }, + /* 3123 */ { MAD_F(0x0592865b) /* 0.348272662 */, 17 }, + /* 3124 */ { MAD_F(0x05932247) /* 0.348421362 */, 17 }, + /* 3125 */ { MAD_F(0x0593be37) /* 0.348570077 */, 17 }, + /* 3126 */ { MAD_F(0x05945a2c) /* 0.348718808 */, 17 }, + /* 3127 */ { MAD_F(0x0594f625) /* 0.348867555 */, 17 }, + /* 3128 */ { MAD_F(0x05959222) /* 0.349016318 */, 17 }, + /* 3129 */ { MAD_F(0x05962e24) /* 0.349165097 */, 17 }, + /* 3130 */ { MAD_F(0x0596ca2a) /* 0.349313892 */, 17 }, + /* 3131 */ { MAD_F(0x05976634) /* 0.349462702 */, 17 }, + /* 3132 */ { MAD_F(0x05980242) /* 0.349611528 */, 17 }, + /* 3133 */ { MAD_F(0x05989e54) /* 0.349760370 */, 17 }, + /* 3134 */ { MAD_F(0x05993a6b) /* 0.349909228 */, 17 }, + /* 3135 */ { MAD_F(0x0599d686) /* 0.350058102 */, 17 }, + + /* 3136 */ { MAD_F(0x059a72a5) /* 0.350206992 */, 17 }, + /* 3137 */ { MAD_F(0x059b0ec9) /* 0.350355897 */, 17 }, + /* 3138 */ { MAD_F(0x059baaf1) /* 0.350504818 */, 17 }, + /* 3139 */ { MAD_F(0x059c471d) /* 0.350653756 */, 17 }, + /* 3140 */ { MAD_F(0x059ce34d) /* 0.350802708 */, 17 }, + /* 3141 */ { MAD_F(0x059d7f81) /* 0.350951677 */, 17 }, + /* 3142 */ { MAD_F(0x059e1bba) /* 0.351100662 */, 17 }, + /* 3143 */ { MAD_F(0x059eb7f7) /* 0.351249662 */, 17 }, + /* 3144 */ { MAD_F(0x059f5438) /* 0.351398678 */, 17 }, + /* 3145 */ { MAD_F(0x059ff07e) /* 0.351547710 */, 17 }, + /* 3146 */ { MAD_F(0x05a08cc7) /* 0.351696758 */, 17 }, + /* 3147 */ { MAD_F(0x05a12915) /* 0.351845821 */, 17 }, + /* 3148 */ { MAD_F(0x05a1c567) /* 0.351994901 */, 17 }, + /* 3149 */ { MAD_F(0x05a261be) /* 0.352143996 */, 17 }, + /* 3150 */ { MAD_F(0x05a2fe18) /* 0.352293107 */, 17 }, + /* 3151 */ { MAD_F(0x05a39a77) /* 0.352442233 */, 17 }, + + /* 3152 */ { MAD_F(0x05a436da) /* 0.352591376 */, 17 }, + /* 3153 */ { MAD_F(0x05a4d342) /* 0.352740534 */, 17 }, + /* 3154 */ { MAD_F(0x05a56fad) /* 0.352889708 */, 17 }, + /* 3155 */ { MAD_F(0x05a60c1d) /* 0.353038898 */, 17 }, + /* 3156 */ { MAD_F(0x05a6a891) /* 0.353188103 */, 17 }, + /* 3157 */ { MAD_F(0x05a7450a) /* 0.353337325 */, 17 }, + /* 3158 */ { MAD_F(0x05a7e186) /* 0.353486562 */, 17 }, + /* 3159 */ { MAD_F(0x05a87e07) /* 0.353635814 */, 17 }, + /* 3160 */ { MAD_F(0x05a91a8c) /* 0.353785083 */, 17 }, + /* 3161 */ { MAD_F(0x05a9b715) /* 0.353934367 */, 17 }, + /* 3162 */ { MAD_F(0x05aa53a2) /* 0.354083667 */, 17 }, + /* 3163 */ { MAD_F(0x05aaf034) /* 0.354232983 */, 17 }, + /* 3164 */ { MAD_F(0x05ab8cca) /* 0.354382314 */, 17 }, + /* 3165 */ { MAD_F(0x05ac2964) /* 0.354531662 */, 17 }, + /* 3166 */ { MAD_F(0x05acc602) /* 0.354681025 */, 17 }, + /* 3167 */ { MAD_F(0x05ad62a5) /* 0.354830403 */, 17 }, + + /* 3168 */ { MAD_F(0x05adff4c) /* 0.354979798 */, 17 }, + /* 3169 */ { MAD_F(0x05ae9bf7) /* 0.355129208 */, 17 }, + /* 3170 */ { MAD_F(0x05af38a6) /* 0.355278634 */, 17 }, + /* 3171 */ { MAD_F(0x05afd559) /* 0.355428075 */, 17 }, + /* 3172 */ { MAD_F(0x05b07211) /* 0.355577533 */, 17 }, + /* 3173 */ { MAD_F(0x05b10ecd) /* 0.355727006 */, 17 }, + /* 3174 */ { MAD_F(0x05b1ab8d) /* 0.355876494 */, 17 }, + /* 3175 */ { MAD_F(0x05b24851) /* 0.356025999 */, 17 }, + /* 3176 */ { MAD_F(0x05b2e51a) /* 0.356175519 */, 17 }, + /* 3177 */ { MAD_F(0x05b381e6) /* 0.356325054 */, 17 }, + /* 3178 */ { MAD_F(0x05b41eb7) /* 0.356474606 */, 17 }, + /* 3179 */ { MAD_F(0x05b4bb8c) /* 0.356624173 */, 17 }, + /* 3180 */ { MAD_F(0x05b55866) /* 0.356773756 */, 17 }, + /* 3181 */ { MAD_F(0x05b5f543) /* 0.356923354 */, 17 }, + /* 3182 */ { MAD_F(0x05b69225) /* 0.357072969 */, 17 }, + /* 3183 */ { MAD_F(0x05b72f0b) /* 0.357222598 */, 17 }, + + /* 3184 */ { MAD_F(0x05b7cbf5) /* 0.357372244 */, 17 }, + /* 3185 */ { MAD_F(0x05b868e3) /* 0.357521905 */, 17 }, + /* 3186 */ { MAD_F(0x05b905d6) /* 0.357671582 */, 17 }, + /* 3187 */ { MAD_F(0x05b9a2cd) /* 0.357821275 */, 17 }, + /* 3188 */ { MAD_F(0x05ba3fc8) /* 0.357970983 */, 17 }, + /* 3189 */ { MAD_F(0x05badcc7) /* 0.358120707 */, 17 }, + /* 3190 */ { MAD_F(0x05bb79ca) /* 0.358270446 */, 17 }, + /* 3191 */ { MAD_F(0x05bc16d2) /* 0.358420201 */, 17 }, + /* 3192 */ { MAD_F(0x05bcb3de) /* 0.358569972 */, 17 }, + /* 3193 */ { MAD_F(0x05bd50ee) /* 0.358719758 */, 17 }, + /* 3194 */ { MAD_F(0x05bdee02) /* 0.358869560 */, 17 }, + /* 3195 */ { MAD_F(0x05be8b1a) /* 0.359019378 */, 17 }, + /* 3196 */ { MAD_F(0x05bf2837) /* 0.359169211 */, 17 }, + /* 3197 */ { MAD_F(0x05bfc558) /* 0.359319060 */, 17 }, + /* 3198 */ { MAD_F(0x05c0627d) /* 0.359468925 */, 17 }, + /* 3199 */ { MAD_F(0x05c0ffa6) /* 0.359618805 */, 17 }, + + /* 3200 */ { MAD_F(0x05c19cd3) /* 0.359768701 */, 17 }, + /* 3201 */ { MAD_F(0x05c23a05) /* 0.359918612 */, 17 }, + /* 3202 */ { MAD_F(0x05c2d73a) /* 0.360068540 */, 17 }, + /* 3203 */ { MAD_F(0x05c37474) /* 0.360218482 */, 17 }, + /* 3204 */ { MAD_F(0x05c411b2) /* 0.360368440 */, 17 }, + /* 3205 */ { MAD_F(0x05c4aef5) /* 0.360518414 */, 17 }, + /* 3206 */ { MAD_F(0x05c54c3b) /* 0.360668404 */, 17 }, + /* 3207 */ { MAD_F(0x05c5e986) /* 0.360818409 */, 17 }, + /* 3208 */ { MAD_F(0x05c686d5) /* 0.360968429 */, 17 }, + /* 3209 */ { MAD_F(0x05c72428) /* 0.361118466 */, 17 }, + /* 3210 */ { MAD_F(0x05c7c17f) /* 0.361268517 */, 17 }, + /* 3211 */ { MAD_F(0x05c85eda) /* 0.361418585 */, 17 }, + /* 3212 */ { MAD_F(0x05c8fc3a) /* 0.361568668 */, 17 }, + /* 3213 */ { MAD_F(0x05c9999e) /* 0.361718766 */, 17 }, + /* 3214 */ { MAD_F(0x05ca3706) /* 0.361868881 */, 17 }, + /* 3215 */ { MAD_F(0x05cad472) /* 0.362019010 */, 17 }, + + /* 3216 */ { MAD_F(0x05cb71e2) /* 0.362169156 */, 17 }, + /* 3217 */ { MAD_F(0x05cc0f57) /* 0.362319316 */, 17 }, + /* 3218 */ { MAD_F(0x05ccaccf) /* 0.362469493 */, 17 }, + /* 3219 */ { MAD_F(0x05cd4a4c) /* 0.362619685 */, 17 }, + /* 3220 */ { MAD_F(0x05cde7cd) /* 0.362769892 */, 17 }, + /* 3221 */ { MAD_F(0x05ce8552) /* 0.362920115 */, 17 }, + /* 3222 */ { MAD_F(0x05cf22dc) /* 0.363070354 */, 17 }, + /* 3223 */ { MAD_F(0x05cfc069) /* 0.363220608 */, 17 }, + /* 3224 */ { MAD_F(0x05d05dfb) /* 0.363370878 */, 17 }, + /* 3225 */ { MAD_F(0x05d0fb91) /* 0.363521163 */, 17 }, + /* 3226 */ { MAD_F(0x05d1992b) /* 0.363671464 */, 17 }, + /* 3227 */ { MAD_F(0x05d236c9) /* 0.363821780 */, 17 }, + /* 3228 */ { MAD_F(0x05d2d46c) /* 0.363972112 */, 17 }, + /* 3229 */ { MAD_F(0x05d37212) /* 0.364122459 */, 17 }, + /* 3230 */ { MAD_F(0x05d40fbd) /* 0.364272822 */, 17 }, + /* 3231 */ { MAD_F(0x05d4ad6c) /* 0.364423200 */, 17 }, + + /* 3232 */ { MAD_F(0x05d54b1f) /* 0.364573594 */, 17 }, + /* 3233 */ { MAD_F(0x05d5e8d6) /* 0.364724004 */, 17 }, + /* 3234 */ { MAD_F(0x05d68691) /* 0.364874429 */, 17 }, + /* 3235 */ { MAD_F(0x05d72451) /* 0.365024869 */, 17 }, + /* 3236 */ { MAD_F(0x05d7c215) /* 0.365175325 */, 17 }, + /* 3237 */ { MAD_F(0x05d85fdc) /* 0.365325796 */, 17 }, + /* 3238 */ { MAD_F(0x05d8fda8) /* 0.365476283 */, 17 }, + /* 3239 */ { MAD_F(0x05d99b79) /* 0.365626786 */, 17 }, + /* 3240 */ { MAD_F(0x05da394d) /* 0.365777304 */, 17 }, + /* 3241 */ { MAD_F(0x05dad726) /* 0.365927837 */, 17 }, + /* 3242 */ { MAD_F(0x05db7502) /* 0.366078386 */, 17 }, + /* 3243 */ { MAD_F(0x05dc12e3) /* 0.366228950 */, 17 }, + /* 3244 */ { MAD_F(0x05dcb0c8) /* 0.366379530 */, 17 }, + /* 3245 */ { MAD_F(0x05dd4eb1) /* 0.366530125 */, 17 }, + /* 3246 */ { MAD_F(0x05ddec9e) /* 0.366680736 */, 17 }, + /* 3247 */ { MAD_F(0x05de8a90) /* 0.366831362 */, 17 }, + + /* 3248 */ { MAD_F(0x05df2885) /* 0.366982004 */, 17 }, + /* 3249 */ { MAD_F(0x05dfc67f) /* 0.367132661 */, 17 }, + /* 3250 */ { MAD_F(0x05e0647d) /* 0.367283334 */, 17 }, + /* 3251 */ { MAD_F(0x05e1027f) /* 0.367434022 */, 17 }, + /* 3252 */ { MAD_F(0x05e1a085) /* 0.367584725 */, 17 }, + /* 3253 */ { MAD_F(0x05e23e8f) /* 0.367735444 */, 17 }, + /* 3254 */ { MAD_F(0x05e2dc9e) /* 0.367886179 */, 17 }, + /* 3255 */ { MAD_F(0x05e37ab0) /* 0.368036929 */, 17 }, + /* 3256 */ { MAD_F(0x05e418c7) /* 0.368187694 */, 17 }, + /* 3257 */ { MAD_F(0x05e4b6e2) /* 0.368338475 */, 17 }, + /* 3258 */ { MAD_F(0x05e55501) /* 0.368489271 */, 17 }, + /* 3259 */ { MAD_F(0x05e5f324) /* 0.368640082 */, 17 }, + /* 3260 */ { MAD_F(0x05e6914c) /* 0.368790909 */, 17 }, + /* 3261 */ { MAD_F(0x05e72f77) /* 0.368941752 */, 17 }, + /* 3262 */ { MAD_F(0x05e7cda7) /* 0.369092610 */, 17 }, + /* 3263 */ { MAD_F(0x05e86bda) /* 0.369243483 */, 17 }, + + /* 3264 */ { MAD_F(0x05e90a12) /* 0.369394372 */, 17 }, + /* 3265 */ { MAD_F(0x05e9a84e) /* 0.369545276 */, 17 }, + /* 3266 */ { MAD_F(0x05ea468e) /* 0.369696195 */, 17 }, + /* 3267 */ { MAD_F(0x05eae4d3) /* 0.369847130 */, 17 }, + /* 3268 */ { MAD_F(0x05eb831b) /* 0.369998080 */, 17 }, + /* 3269 */ { MAD_F(0x05ec2168) /* 0.370149046 */, 17 }, + /* 3270 */ { MAD_F(0x05ecbfb8) /* 0.370300027 */, 17 }, + /* 3271 */ { MAD_F(0x05ed5e0d) /* 0.370451024 */, 17 }, + /* 3272 */ { MAD_F(0x05edfc66) /* 0.370602036 */, 17 }, + /* 3273 */ { MAD_F(0x05ee9ac3) /* 0.370753063 */, 17 }, + /* 3274 */ { MAD_F(0x05ef3924) /* 0.370904105 */, 17 }, + /* 3275 */ { MAD_F(0x05efd78a) /* 0.371055163 */, 17 }, + /* 3276 */ { MAD_F(0x05f075f3) /* 0.371206237 */, 17 }, + /* 3277 */ { MAD_F(0x05f11461) /* 0.371357326 */, 17 }, + /* 3278 */ { MAD_F(0x05f1b2d3) /* 0.371508430 */, 17 }, + /* 3279 */ { MAD_F(0x05f25148) /* 0.371659549 */, 17 }, + + /* 3280 */ { MAD_F(0x05f2efc2) /* 0.371810684 */, 17 }, + /* 3281 */ { MAD_F(0x05f38e40) /* 0.371961834 */, 17 }, + /* 3282 */ { MAD_F(0x05f42cc3) /* 0.372113000 */, 17 }, + /* 3283 */ { MAD_F(0x05f4cb49) /* 0.372264181 */, 17 }, + /* 3284 */ { MAD_F(0x05f569d3) /* 0.372415377 */, 17 }, + /* 3285 */ { MAD_F(0x05f60862) /* 0.372566589 */, 17 }, + /* 3286 */ { MAD_F(0x05f6a6f5) /* 0.372717816 */, 17 }, + /* 3287 */ { MAD_F(0x05f7458b) /* 0.372869058 */, 17 }, + /* 3288 */ { MAD_F(0x05f7e426) /* 0.373020316 */, 17 }, + /* 3289 */ { MAD_F(0x05f882c5) /* 0.373171589 */, 17 }, + /* 3290 */ { MAD_F(0x05f92169) /* 0.373322877 */, 17 }, + /* 3291 */ { MAD_F(0x05f9c010) /* 0.373474181 */, 17 }, + /* 3292 */ { MAD_F(0x05fa5ebb) /* 0.373625500 */, 17 }, + /* 3293 */ { MAD_F(0x05fafd6b) /* 0.373776834 */, 17 }, + /* 3294 */ { MAD_F(0x05fb9c1e) /* 0.373928184 */, 17 }, + /* 3295 */ { MAD_F(0x05fc3ad6) /* 0.374079549 */, 17 }, + + /* 3296 */ { MAD_F(0x05fcd992) /* 0.374230929 */, 17 }, + /* 3297 */ { MAD_F(0x05fd7852) /* 0.374382325 */, 17 }, + /* 3298 */ { MAD_F(0x05fe1716) /* 0.374533735 */, 17 }, + /* 3299 */ { MAD_F(0x05feb5de) /* 0.374685162 */, 17 }, + /* 3300 */ { MAD_F(0x05ff54aa) /* 0.374836603 */, 17 }, + /* 3301 */ { MAD_F(0x05fff37b) /* 0.374988060 */, 17 }, + /* 3302 */ { MAD_F(0x0600924f) /* 0.375139532 */, 17 }, + /* 3303 */ { MAD_F(0x06013128) /* 0.375291019 */, 17 }, + /* 3304 */ { MAD_F(0x0601d004) /* 0.375442522 */, 17 }, + /* 3305 */ { MAD_F(0x06026ee5) /* 0.375594040 */, 17 }, + /* 3306 */ { MAD_F(0x06030dca) /* 0.375745573 */, 17 }, + /* 3307 */ { MAD_F(0x0603acb3) /* 0.375897122 */, 17 }, + /* 3308 */ { MAD_F(0x06044ba0) /* 0.376048685 */, 17 }, + /* 3309 */ { MAD_F(0x0604ea91) /* 0.376200265 */, 17 }, + /* 3310 */ { MAD_F(0x06058987) /* 0.376351859 */, 17 }, + /* 3311 */ { MAD_F(0x06062880) /* 0.376503468 */, 17 }, + + /* 3312 */ { MAD_F(0x0606c77d) /* 0.376655093 */, 17 }, + /* 3313 */ { MAD_F(0x0607667f) /* 0.376806733 */, 17 }, + /* 3314 */ { MAD_F(0x06080585) /* 0.376958389 */, 17 }, + /* 3315 */ { MAD_F(0x0608a48f) /* 0.377110059 */, 17 }, + /* 3316 */ { MAD_F(0x0609439c) /* 0.377261745 */, 17 }, + /* 3317 */ { MAD_F(0x0609e2ae) /* 0.377413446 */, 17 }, + /* 3318 */ { MAD_F(0x060a81c4) /* 0.377565163 */, 17 }, + /* 3319 */ { MAD_F(0x060b20df) /* 0.377716894 */, 17 }, + /* 3320 */ { MAD_F(0x060bbffd) /* 0.377868641 */, 17 }, + /* 3321 */ { MAD_F(0x060c5f1f) /* 0.378020403 */, 17 }, + /* 3322 */ { MAD_F(0x060cfe46) /* 0.378172181 */, 17 }, + /* 3323 */ { MAD_F(0x060d9d70) /* 0.378323973 */, 17 }, + /* 3324 */ { MAD_F(0x060e3c9f) /* 0.378475781 */, 17 }, + /* 3325 */ { MAD_F(0x060edbd1) /* 0.378627604 */, 17 }, + /* 3326 */ { MAD_F(0x060f7b08) /* 0.378779442 */, 17 }, + /* 3327 */ { MAD_F(0x06101a43) /* 0.378931296 */, 17 }, + + /* 3328 */ { MAD_F(0x0610b982) /* 0.379083164 */, 17 }, + /* 3329 */ { MAD_F(0x061158c5) /* 0.379235048 */, 17 }, + /* 3330 */ { MAD_F(0x0611f80c) /* 0.379386947 */, 17 }, + /* 3331 */ { MAD_F(0x06129757) /* 0.379538862 */, 17 }, + /* 3332 */ { MAD_F(0x061336a6) /* 0.379690791 */, 17 }, + /* 3333 */ { MAD_F(0x0613d5fa) /* 0.379842736 */, 17 }, + /* 3334 */ { MAD_F(0x06147551) /* 0.379994696 */, 17 }, + /* 3335 */ { MAD_F(0x061514ad) /* 0.380146671 */, 17 }, + /* 3336 */ { MAD_F(0x0615b40c) /* 0.380298661 */, 17 }, + /* 3337 */ { MAD_F(0x06165370) /* 0.380450666 */, 17 }, + /* 3338 */ { MAD_F(0x0616f2d8) /* 0.380602687 */, 17 }, + /* 3339 */ { MAD_F(0x06179243) /* 0.380754723 */, 17 }, + /* 3340 */ { MAD_F(0x061831b3) /* 0.380906774 */, 17 }, + /* 3341 */ { MAD_F(0x0618d127) /* 0.381058840 */, 17 }, + /* 3342 */ { MAD_F(0x0619709f) /* 0.381210921 */, 17 }, + /* 3343 */ { MAD_F(0x061a101b) /* 0.381363018 */, 17 }, + + /* 3344 */ { MAD_F(0x061aaf9c) /* 0.381515130 */, 17 }, + /* 3345 */ { MAD_F(0x061b4f20) /* 0.381667257 */, 17 }, + /* 3346 */ { MAD_F(0x061beea8) /* 0.381819399 */, 17 }, + /* 3347 */ { MAD_F(0x061c8e34) /* 0.381971556 */, 17 }, + /* 3348 */ { MAD_F(0x061d2dc5) /* 0.382123728 */, 17 }, + /* 3349 */ { MAD_F(0x061dcd59) /* 0.382275916 */, 17 }, + /* 3350 */ { MAD_F(0x061e6cf2) /* 0.382428118 */, 17 }, + /* 3351 */ { MAD_F(0x061f0c8f) /* 0.382580336 */, 17 }, + /* 3352 */ { MAD_F(0x061fac2f) /* 0.382732569 */, 17 }, + /* 3353 */ { MAD_F(0x06204bd4) /* 0.382884817 */, 17 }, + /* 3354 */ { MAD_F(0x0620eb7d) /* 0.383037080 */, 17 }, + /* 3355 */ { MAD_F(0x06218b2a) /* 0.383189358 */, 17 }, + /* 3356 */ { MAD_F(0x06222adb) /* 0.383341652 */, 17 }, + /* 3357 */ { MAD_F(0x0622ca90) /* 0.383493960 */, 17 }, + /* 3358 */ { MAD_F(0x06236a49) /* 0.383646284 */, 17 }, + /* 3359 */ { MAD_F(0x06240a06) /* 0.383798623 */, 17 }, + + /* 3360 */ { MAD_F(0x0624a9c7) /* 0.383950977 */, 17 }, + /* 3361 */ { MAD_F(0x0625498d) /* 0.384103346 */, 17 }, + /* 3362 */ { MAD_F(0x0625e956) /* 0.384255730 */, 17 }, + /* 3363 */ { MAD_F(0x06268923) /* 0.384408129 */, 17 }, + /* 3364 */ { MAD_F(0x062728f5) /* 0.384560544 */, 17 }, + /* 3365 */ { MAD_F(0x0627c8ca) /* 0.384712973 */, 17 }, + /* 3366 */ { MAD_F(0x062868a4) /* 0.384865418 */, 17 }, + /* 3367 */ { MAD_F(0x06290881) /* 0.385017878 */, 17 }, + /* 3368 */ { MAD_F(0x0629a863) /* 0.385170352 */, 17 }, + /* 3369 */ { MAD_F(0x062a4849) /* 0.385322842 */, 17 }, + /* 3370 */ { MAD_F(0x062ae832) /* 0.385475347 */, 17 }, + /* 3371 */ { MAD_F(0x062b8820) /* 0.385627867 */, 17 }, + /* 3372 */ { MAD_F(0x062c2812) /* 0.385780402 */, 17 }, + /* 3373 */ { MAD_F(0x062cc808) /* 0.385932953 */, 17 }, + /* 3374 */ { MAD_F(0x062d6802) /* 0.386085518 */, 17 }, + /* 3375 */ { MAD_F(0x062e0800) /* 0.386238098 */, 17 }, + + /* 3376 */ { MAD_F(0x062ea802) /* 0.386390694 */, 17 }, + /* 3377 */ { MAD_F(0x062f4808) /* 0.386543304 */, 17 }, + /* 3378 */ { MAD_F(0x062fe812) /* 0.386695930 */, 17 }, + /* 3379 */ { MAD_F(0x06308820) /* 0.386848570 */, 17 }, + /* 3380 */ { MAD_F(0x06312832) /* 0.387001226 */, 17 }, + /* 3381 */ { MAD_F(0x0631c849) /* 0.387153897 */, 17 }, + /* 3382 */ { MAD_F(0x06326863) /* 0.387306582 */, 17 }, + /* 3383 */ { MAD_F(0x06330881) /* 0.387459283 */, 17 }, + /* 3384 */ { MAD_F(0x0633a8a3) /* 0.387611999 */, 17 }, + /* 3385 */ { MAD_F(0x063448ca) /* 0.387764730 */, 17 }, + /* 3386 */ { MAD_F(0x0634e8f4) /* 0.387917476 */, 17 }, + /* 3387 */ { MAD_F(0x06358923) /* 0.388070237 */, 17 }, + /* 3388 */ { MAD_F(0x06362955) /* 0.388223013 */, 17 }, + /* 3389 */ { MAD_F(0x0636c98c) /* 0.388375804 */, 17 }, + /* 3390 */ { MAD_F(0x063769c6) /* 0.388528610 */, 17 }, + /* 3391 */ { MAD_F(0x06380a05) /* 0.388681431 */, 17 }, + + /* 3392 */ { MAD_F(0x0638aa48) /* 0.388834268 */, 17 }, + /* 3393 */ { MAD_F(0x06394a8e) /* 0.388987119 */, 17 }, + /* 3394 */ { MAD_F(0x0639ead9) /* 0.389139985 */, 17 }, + /* 3395 */ { MAD_F(0x063a8b28) /* 0.389292866 */, 17 }, + /* 3396 */ { MAD_F(0x063b2b7b) /* 0.389445762 */, 17 }, + /* 3397 */ { MAD_F(0x063bcbd1) /* 0.389598674 */, 17 }, + /* 3398 */ { MAD_F(0x063c6c2c) /* 0.389751600 */, 17 }, + /* 3399 */ { MAD_F(0x063d0c8b) /* 0.389904541 */, 17 }, + /* 3400 */ { MAD_F(0x063dacee) /* 0.390057497 */, 17 }, + /* 3401 */ { MAD_F(0x063e4d55) /* 0.390210468 */, 17 }, + /* 3402 */ { MAD_F(0x063eedc0) /* 0.390363455 */, 17 }, + /* 3403 */ { MAD_F(0x063f8e2f) /* 0.390516456 */, 17 }, + /* 3404 */ { MAD_F(0x06402ea2) /* 0.390669472 */, 17 }, + /* 3405 */ { MAD_F(0x0640cf19) /* 0.390822503 */, 17 }, + /* 3406 */ { MAD_F(0x06416f94) /* 0.390975549 */, 17 }, + /* 3407 */ { MAD_F(0x06421013) /* 0.391128611 */, 17 }, + + /* 3408 */ { MAD_F(0x0642b096) /* 0.391281687 */, 17 }, + /* 3409 */ { MAD_F(0x0643511d) /* 0.391434778 */, 17 }, + /* 3410 */ { MAD_F(0x0643f1a8) /* 0.391587884 */, 17 }, + /* 3411 */ { MAD_F(0x06449237) /* 0.391741005 */, 17 }, + /* 3412 */ { MAD_F(0x064532ca) /* 0.391894141 */, 17 }, + /* 3413 */ { MAD_F(0x0645d361) /* 0.392047292 */, 17 }, + /* 3414 */ { MAD_F(0x064673fc) /* 0.392200458 */, 17 }, + /* 3415 */ { MAD_F(0x0647149c) /* 0.392353638 */, 17 }, + /* 3416 */ { MAD_F(0x0647b53f) /* 0.392506834 */, 17 }, + /* 3417 */ { MAD_F(0x064855e6) /* 0.392660045 */, 17 }, + /* 3418 */ { MAD_F(0x0648f691) /* 0.392813271 */, 17 }, + /* 3419 */ { MAD_F(0x06499740) /* 0.392966511 */, 17 }, + /* 3420 */ { MAD_F(0x064a37f4) /* 0.393119767 */, 17 }, + /* 3421 */ { MAD_F(0x064ad8ab) /* 0.393273038 */, 17 }, + /* 3422 */ { MAD_F(0x064b7966) /* 0.393426323 */, 17 }, + /* 3423 */ { MAD_F(0x064c1a25) /* 0.393579623 */, 17 }, + + /* 3424 */ { MAD_F(0x064cbae9) /* 0.393732939 */, 17 }, + /* 3425 */ { MAD_F(0x064d5bb0) /* 0.393886269 */, 17 }, + /* 3426 */ { MAD_F(0x064dfc7b) /* 0.394039614 */, 17 }, + /* 3427 */ { MAD_F(0x064e9d4b) /* 0.394192974 */, 17 }, + /* 3428 */ { MAD_F(0x064f3e1e) /* 0.394346349 */, 17 }, + /* 3429 */ { MAD_F(0x064fdef5) /* 0.394499739 */, 17 }, + /* 3430 */ { MAD_F(0x06507fd0) /* 0.394653144 */, 17 }, + /* 3431 */ { MAD_F(0x065120b0) /* 0.394806564 */, 17 }, + /* 3432 */ { MAD_F(0x0651c193) /* 0.394959999 */, 17 }, + /* 3433 */ { MAD_F(0x0652627a) /* 0.395113448 */, 17 }, + /* 3434 */ { MAD_F(0x06530366) /* 0.395266913 */, 17 }, + /* 3435 */ { MAD_F(0x0653a455) /* 0.395420392 */, 17 }, + /* 3436 */ { MAD_F(0x06544548) /* 0.395573886 */, 17 }, + /* 3437 */ { MAD_F(0x0654e640) /* 0.395727395 */, 17 }, + /* 3438 */ { MAD_F(0x0655873b) /* 0.395880919 */, 17 }, + /* 3439 */ { MAD_F(0x0656283a) /* 0.396034458 */, 17 }, + + /* 3440 */ { MAD_F(0x0656c93d) /* 0.396188012 */, 17 }, + /* 3441 */ { MAD_F(0x06576a45) /* 0.396341581 */, 17 }, + /* 3442 */ { MAD_F(0x06580b50) /* 0.396495164 */, 17 }, + /* 3443 */ { MAD_F(0x0658ac5f) /* 0.396648763 */, 17 }, + /* 3444 */ { MAD_F(0x06594d73) /* 0.396802376 */, 17 }, + /* 3445 */ { MAD_F(0x0659ee8a) /* 0.396956004 */, 17 }, + /* 3446 */ { MAD_F(0x065a8fa5) /* 0.397109647 */, 17 }, + /* 3447 */ { MAD_F(0x065b30c4) /* 0.397263305 */, 17 }, + /* 3448 */ { MAD_F(0x065bd1e7) /* 0.397416978 */, 17 }, + /* 3449 */ { MAD_F(0x065c730f) /* 0.397570666 */, 17 }, + /* 3450 */ { MAD_F(0x065d143a) /* 0.397724368 */, 17 }, + /* 3451 */ { MAD_F(0x065db569) /* 0.397878085 */, 17 }, + /* 3452 */ { MAD_F(0x065e569c) /* 0.398031818 */, 17 }, + /* 3453 */ { MAD_F(0x065ef7d3) /* 0.398185565 */, 17 }, + /* 3454 */ { MAD_F(0x065f990e) /* 0.398339326 */, 17 }, + /* 3455 */ { MAD_F(0x06603a4e) /* 0.398493103 */, 17 }, + + /* 3456 */ { MAD_F(0x0660db91) /* 0.398646895 */, 17 }, + /* 3457 */ { MAD_F(0x06617cd8) /* 0.398800701 */, 17 }, + /* 3458 */ { MAD_F(0x06621e23) /* 0.398954522 */, 17 }, + /* 3459 */ { MAD_F(0x0662bf72) /* 0.399108358 */, 17 }, + /* 3460 */ { MAD_F(0x066360c5) /* 0.399262209 */, 17 }, + /* 3461 */ { MAD_F(0x0664021c) /* 0.399416075 */, 17 }, + /* 3462 */ { MAD_F(0x0664a377) /* 0.399569955 */, 17 }, + /* 3463 */ { MAD_F(0x066544d6) /* 0.399723851 */, 17 }, + /* 3464 */ { MAD_F(0x0665e639) /* 0.399877761 */, 17 }, + /* 3465 */ { MAD_F(0x066687a0) /* 0.400031686 */, 17 }, + /* 3466 */ { MAD_F(0x0667290b) /* 0.400185625 */, 17 }, + /* 3467 */ { MAD_F(0x0667ca79) /* 0.400339580 */, 17 }, + /* 3468 */ { MAD_F(0x06686bec) /* 0.400493549 */, 17 }, + /* 3469 */ { MAD_F(0x06690d63) /* 0.400647534 */, 17 }, + /* 3470 */ { MAD_F(0x0669aede) /* 0.400801533 */, 17 }, + /* 3471 */ { MAD_F(0x066a505d) /* 0.400955546 */, 17 }, + + /* 3472 */ { MAD_F(0x066af1df) /* 0.401109575 */, 17 }, + /* 3473 */ { MAD_F(0x066b9366) /* 0.401263618 */, 17 }, + /* 3474 */ { MAD_F(0x066c34f1) /* 0.401417676 */, 17 }, + /* 3475 */ { MAD_F(0x066cd67f) /* 0.401571749 */, 17 }, + /* 3476 */ { MAD_F(0x066d7812) /* 0.401725837 */, 17 }, + /* 3477 */ { MAD_F(0x066e19a9) /* 0.401879939 */, 17 }, + /* 3478 */ { MAD_F(0x066ebb43) /* 0.402034056 */, 17 }, + /* 3479 */ { MAD_F(0x066f5ce2) /* 0.402188188 */, 17 }, + /* 3480 */ { MAD_F(0x066ffe84) /* 0.402342335 */, 17 }, + /* 3481 */ { MAD_F(0x0670a02a) /* 0.402496497 */, 17 }, + /* 3482 */ { MAD_F(0x067141d5) /* 0.402650673 */, 17 }, + /* 3483 */ { MAD_F(0x0671e383) /* 0.402804864 */, 17 }, + /* 3484 */ { MAD_F(0x06728535) /* 0.402959070 */, 17 }, + /* 3485 */ { MAD_F(0x067326ec) /* 0.403113291 */, 17 }, + /* 3486 */ { MAD_F(0x0673c8a6) /* 0.403267526 */, 17 }, + /* 3487 */ { MAD_F(0x06746a64) /* 0.403421776 */, 17 }, + + /* 3488 */ { MAD_F(0x06750c26) /* 0.403576041 */, 17 }, + /* 3489 */ { MAD_F(0x0675adec) /* 0.403730320 */, 17 }, + /* 3490 */ { MAD_F(0x06764fb6) /* 0.403884615 */, 17 }, + /* 3491 */ { MAD_F(0x0676f184) /* 0.404038924 */, 17 }, + /* 3492 */ { MAD_F(0x06779356) /* 0.404193247 */, 17 }, + /* 3493 */ { MAD_F(0x0678352c) /* 0.404347586 */, 17 }, + /* 3494 */ { MAD_F(0x0678d706) /* 0.404501939 */, 17 }, + /* 3495 */ { MAD_F(0x067978e4) /* 0.404656307 */, 17 }, + /* 3496 */ { MAD_F(0x067a1ac6) /* 0.404810690 */, 17 }, + /* 3497 */ { MAD_F(0x067abcac) /* 0.404965087 */, 17 }, + /* 3498 */ { MAD_F(0x067b5e95) /* 0.405119499 */, 17 }, + /* 3499 */ { MAD_F(0x067c0083) /* 0.405273926 */, 17 }, + /* 3500 */ { MAD_F(0x067ca275) /* 0.405428368 */, 17 }, + /* 3501 */ { MAD_F(0x067d446a) /* 0.405582824 */, 17 }, + /* 3502 */ { MAD_F(0x067de664) /* 0.405737295 */, 17 }, + /* 3503 */ { MAD_F(0x067e8861) /* 0.405891781 */, 17 }, + + /* 3504 */ { MAD_F(0x067f2a62) /* 0.406046281 */, 17 }, + /* 3505 */ { MAD_F(0x067fcc68) /* 0.406200796 */, 17 }, + /* 3506 */ { MAD_F(0x06806e71) /* 0.406355326 */, 17 }, + /* 3507 */ { MAD_F(0x0681107e) /* 0.406509870 */, 17 }, + /* 3508 */ { MAD_F(0x0681b28f) /* 0.406664429 */, 17 }, + /* 3509 */ { MAD_F(0x068254a4) /* 0.406819003 */, 17 }, + /* 3510 */ { MAD_F(0x0682f6bd) /* 0.406973592 */, 17 }, + /* 3511 */ { MAD_F(0x068398da) /* 0.407128195 */, 17 }, + /* 3512 */ { MAD_F(0x06843afb) /* 0.407282813 */, 17 }, + /* 3513 */ { MAD_F(0x0684dd20) /* 0.407437445 */, 17 }, + /* 3514 */ { MAD_F(0x06857f49) /* 0.407592093 */, 17 }, + /* 3515 */ { MAD_F(0x06862176) /* 0.407746754 */, 17 }, + /* 3516 */ { MAD_F(0x0686c3a6) /* 0.407901431 */, 17 }, + /* 3517 */ { MAD_F(0x068765db) /* 0.408056122 */, 17 }, + /* 3518 */ { MAD_F(0x06880814) /* 0.408210828 */, 17 }, + /* 3519 */ { MAD_F(0x0688aa50) /* 0.408365549 */, 17 }, + + /* 3520 */ { MAD_F(0x06894c90) /* 0.408520284 */, 17 }, + /* 3521 */ { MAD_F(0x0689eed5) /* 0.408675034 */, 17 }, + /* 3522 */ { MAD_F(0x068a911d) /* 0.408829798 */, 17 }, + /* 3523 */ { MAD_F(0x068b3369) /* 0.408984577 */, 17 }, + /* 3524 */ { MAD_F(0x068bd5b9) /* 0.409139371 */, 17 }, + /* 3525 */ { MAD_F(0x068c780e) /* 0.409294180 */, 17 }, + /* 3526 */ { MAD_F(0x068d1a66) /* 0.409449003 */, 17 }, + /* 3527 */ { MAD_F(0x068dbcc1) /* 0.409603840 */, 17 }, + /* 3528 */ { MAD_F(0x068e5f21) /* 0.409758693 */, 17 }, + /* 3529 */ { MAD_F(0x068f0185) /* 0.409913560 */, 17 }, + /* 3530 */ { MAD_F(0x068fa3ed) /* 0.410068441 */, 17 }, + /* 3531 */ { MAD_F(0x06904658) /* 0.410223338 */, 17 }, + /* 3532 */ { MAD_F(0x0690e8c8) /* 0.410378249 */, 17 }, + /* 3533 */ { MAD_F(0x06918b3c) /* 0.410533174 */, 17 }, + /* 3534 */ { MAD_F(0x06922db3) /* 0.410688114 */, 17 }, + /* 3535 */ { MAD_F(0x0692d02e) /* 0.410843069 */, 17 }, + + /* 3536 */ { MAD_F(0x069372ae) /* 0.410998038 */, 17 }, + /* 3537 */ { MAD_F(0x06941531) /* 0.411153022 */, 17 }, + /* 3538 */ { MAD_F(0x0694b7b8) /* 0.411308021 */, 17 }, + /* 3539 */ { MAD_F(0x06955a43) /* 0.411463034 */, 17 }, + /* 3540 */ { MAD_F(0x0695fcd2) /* 0.411618062 */, 17 }, + /* 3541 */ { MAD_F(0x06969f65) /* 0.411773104 */, 17 }, + /* 3542 */ { MAD_F(0x069741fb) /* 0.411928161 */, 17 }, + /* 3543 */ { MAD_F(0x0697e496) /* 0.412083232 */, 17 }, + /* 3544 */ { MAD_F(0x06988735) /* 0.412238319 */, 17 }, + /* 3545 */ { MAD_F(0x069929d7) /* 0.412393419 */, 17 }, + /* 3546 */ { MAD_F(0x0699cc7e) /* 0.412548535 */, 17 }, + /* 3547 */ { MAD_F(0x069a6f28) /* 0.412703664 */, 17 }, + /* 3548 */ { MAD_F(0x069b11d6) /* 0.412858809 */, 17 }, + /* 3549 */ { MAD_F(0x069bb489) /* 0.413013968 */, 17 }, + /* 3550 */ { MAD_F(0x069c573f) /* 0.413169142 */, 17 }, + /* 3551 */ { MAD_F(0x069cf9f9) /* 0.413324330 */, 17 }, + + /* 3552 */ { MAD_F(0x069d9cb7) /* 0.413479532 */, 17 }, + /* 3553 */ { MAD_F(0x069e3f78) /* 0.413634750 */, 17 }, + /* 3554 */ { MAD_F(0x069ee23e) /* 0.413789982 */, 17 }, + /* 3555 */ { MAD_F(0x069f8508) /* 0.413945228 */, 17 }, + /* 3556 */ { MAD_F(0x06a027d5) /* 0.414100489 */, 17 }, + /* 3557 */ { MAD_F(0x06a0caa7) /* 0.414255765 */, 17 }, + /* 3558 */ { MAD_F(0x06a16d7c) /* 0.414411055 */, 17 }, + /* 3559 */ { MAD_F(0x06a21055) /* 0.414566359 */, 17 }, + /* 3560 */ { MAD_F(0x06a2b333) /* 0.414721679 */, 17 }, + /* 3561 */ { MAD_F(0x06a35614) /* 0.414877012 */, 17 }, + /* 3562 */ { MAD_F(0x06a3f8f9) /* 0.415032361 */, 17 }, + /* 3563 */ { MAD_F(0x06a49be2) /* 0.415187723 */, 17 }, + /* 3564 */ { MAD_F(0x06a53ece) /* 0.415343101 */, 17 }, + /* 3565 */ { MAD_F(0x06a5e1bf) /* 0.415498493 */, 17 }, + /* 3566 */ { MAD_F(0x06a684b4) /* 0.415653899 */, 17 }, + /* 3567 */ { MAD_F(0x06a727ac) /* 0.415809320 */, 17 }, + + /* 3568 */ { MAD_F(0x06a7caa9) /* 0.415964756 */, 17 }, + /* 3569 */ { MAD_F(0x06a86da9) /* 0.416120206 */, 17 }, + /* 3570 */ { MAD_F(0x06a910ad) /* 0.416275670 */, 17 }, + /* 3571 */ { MAD_F(0x06a9b3b5) /* 0.416431149 */, 17 }, + /* 3572 */ { MAD_F(0x06aa56c1) /* 0.416586643 */, 17 }, + /* 3573 */ { MAD_F(0x06aaf9d1) /* 0.416742151 */, 17 }, + /* 3574 */ { MAD_F(0x06ab9ce5) /* 0.416897673 */, 17 }, + /* 3575 */ { MAD_F(0x06ac3ffc) /* 0.417053210 */, 17 }, + /* 3576 */ { MAD_F(0x06ace318) /* 0.417208762 */, 17 }, + /* 3577 */ { MAD_F(0x06ad8637) /* 0.417364328 */, 17 }, + /* 3578 */ { MAD_F(0x06ae295b) /* 0.417519909 */, 17 }, + /* 3579 */ { MAD_F(0x06aecc82) /* 0.417675504 */, 17 }, + /* 3580 */ { MAD_F(0x06af6fad) /* 0.417831113 */, 17 }, + /* 3581 */ { MAD_F(0x06b012dc) /* 0.417986737 */, 17 }, + /* 3582 */ { MAD_F(0x06b0b60f) /* 0.418142376 */, 17 }, + /* 3583 */ { MAD_F(0x06b15946) /* 0.418298029 */, 17 }, + + /* 3584 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 17 }, + /* 3585 */ { MAD_F(0x06b29fbf) /* 0.418609378 */, 17 }, + /* 3586 */ { MAD_F(0x06b34302) /* 0.418765075 */, 17 }, + /* 3587 */ { MAD_F(0x06b3e648) /* 0.418920786 */, 17 }, + /* 3588 */ { MAD_F(0x06b48992) /* 0.419076511 */, 17 }, + /* 3589 */ { MAD_F(0x06b52ce0) /* 0.419232251 */, 17 }, + /* 3590 */ { MAD_F(0x06b5d032) /* 0.419388005 */, 17 }, + /* 3591 */ { MAD_F(0x06b67388) /* 0.419543774 */, 17 }, + /* 3592 */ { MAD_F(0x06b716e2) /* 0.419699557 */, 17 }, + /* 3593 */ { MAD_F(0x06b7ba3f) /* 0.419855355 */, 17 }, + /* 3594 */ { MAD_F(0x06b85da1) /* 0.420011167 */, 17 }, + /* 3595 */ { MAD_F(0x06b90106) /* 0.420166994 */, 17 }, + /* 3596 */ { MAD_F(0x06b9a470) /* 0.420322835 */, 17 }, + /* 3597 */ { MAD_F(0x06ba47dd) /* 0.420478690 */, 17 }, + /* 3598 */ { MAD_F(0x06baeb4e) /* 0.420634560 */, 17 }, + /* 3599 */ { MAD_F(0x06bb8ec3) /* 0.420790445 */, 17 }, + + /* 3600 */ { MAD_F(0x06bc323b) /* 0.420946343 */, 17 }, + /* 3601 */ { MAD_F(0x06bcd5b8) /* 0.421102257 */, 17 }, + /* 3602 */ { MAD_F(0x06bd7939) /* 0.421258184 */, 17 }, + /* 3603 */ { MAD_F(0x06be1cbd) /* 0.421414127 */, 17 }, + /* 3604 */ { MAD_F(0x06bec045) /* 0.421570083 */, 17 }, + /* 3605 */ { MAD_F(0x06bf63d1) /* 0.421726054 */, 17 }, + /* 3606 */ { MAD_F(0x06c00761) /* 0.421882040 */, 17 }, + /* 3607 */ { MAD_F(0x06c0aaf5) /* 0.422038039 */, 17 }, + /* 3608 */ { MAD_F(0x06c14e8d) /* 0.422194054 */, 17 }, + /* 3609 */ { MAD_F(0x06c1f229) /* 0.422350082 */, 17 }, + /* 3610 */ { MAD_F(0x06c295c8) /* 0.422506125 */, 17 }, + /* 3611 */ { MAD_F(0x06c3396c) /* 0.422662183 */, 17 }, + /* 3612 */ { MAD_F(0x06c3dd13) /* 0.422818255 */, 17 }, + /* 3613 */ { MAD_F(0x06c480be) /* 0.422974341 */, 17 }, + /* 3614 */ { MAD_F(0x06c5246d) /* 0.423130442 */, 17 }, + /* 3615 */ { MAD_F(0x06c5c820) /* 0.423286557 */, 17 }, + + /* 3616 */ { MAD_F(0x06c66bd6) /* 0.423442686 */, 17 }, + /* 3617 */ { MAD_F(0x06c70f91) /* 0.423598830 */, 17 }, + /* 3618 */ { MAD_F(0x06c7b34f) /* 0.423754988 */, 17 }, + /* 3619 */ { MAD_F(0x06c85712) /* 0.423911161 */, 17 }, + /* 3620 */ { MAD_F(0x06c8fad8) /* 0.424067348 */, 17 }, + /* 3621 */ { MAD_F(0x06c99ea2) /* 0.424223550 */, 17 }, + /* 3622 */ { MAD_F(0x06ca4270) /* 0.424379765 */, 17 }, + /* 3623 */ { MAD_F(0x06cae641) /* 0.424535996 */, 17 }, + /* 3624 */ { MAD_F(0x06cb8a17) /* 0.424692240 */, 17 }, + /* 3625 */ { MAD_F(0x06cc2df0) /* 0.424848499 */, 17 }, + /* 3626 */ { MAD_F(0x06ccd1ce) /* 0.425004772 */, 17 }, + /* 3627 */ { MAD_F(0x06cd75af) /* 0.425161060 */, 17 }, + /* 3628 */ { MAD_F(0x06ce1994) /* 0.425317362 */, 17 }, + /* 3629 */ { MAD_F(0x06cebd7d) /* 0.425473678 */, 17 }, + /* 3630 */ { MAD_F(0x06cf6169) /* 0.425630009 */, 17 }, + /* 3631 */ { MAD_F(0x06d0055a) /* 0.425786354 */, 17 }, + + /* 3632 */ { MAD_F(0x06d0a94e) /* 0.425942714 */, 17 }, + /* 3633 */ { MAD_F(0x06d14d47) /* 0.426099088 */, 17 }, + /* 3634 */ { MAD_F(0x06d1f143) /* 0.426255476 */, 17 }, + /* 3635 */ { MAD_F(0x06d29543) /* 0.426411878 */, 17 }, + /* 3636 */ { MAD_F(0x06d33947) /* 0.426568295 */, 17 }, + /* 3637 */ { MAD_F(0x06d3dd4e) /* 0.426724726 */, 17 }, + /* 3638 */ { MAD_F(0x06d4815a) /* 0.426881172 */, 17 }, + /* 3639 */ { MAD_F(0x06d52569) /* 0.427037632 */, 17 }, + /* 3640 */ { MAD_F(0x06d5c97c) /* 0.427194106 */, 17 }, + /* 3641 */ { MAD_F(0x06d66d93) /* 0.427350594 */, 17 }, + /* 3642 */ { MAD_F(0x06d711ae) /* 0.427507097 */, 17 }, + /* 3643 */ { MAD_F(0x06d7b5cd) /* 0.427663614 */, 17 }, + /* 3644 */ { MAD_F(0x06d859f0) /* 0.427820146 */, 17 }, + /* 3645 */ { MAD_F(0x06d8fe16) /* 0.427976692 */, 17 }, + /* 3646 */ { MAD_F(0x06d9a240) /* 0.428133252 */, 17 }, + /* 3647 */ { MAD_F(0x06da466f) /* 0.428289826 */, 17 }, + + /* 3648 */ { MAD_F(0x06daeaa1) /* 0.428446415 */, 17 }, + /* 3649 */ { MAD_F(0x06db8ed6) /* 0.428603018 */, 17 }, + /* 3650 */ { MAD_F(0x06dc3310) /* 0.428759635 */, 17 }, + /* 3651 */ { MAD_F(0x06dcd74d) /* 0.428916267 */, 17 }, + /* 3652 */ { MAD_F(0x06dd7b8f) /* 0.429072913 */, 17 }, + /* 3653 */ { MAD_F(0x06de1fd4) /* 0.429229573 */, 17 }, + /* 3654 */ { MAD_F(0x06dec41d) /* 0.429386248 */, 17 }, + /* 3655 */ { MAD_F(0x06df686a) /* 0.429542937 */, 17 }, + /* 3656 */ { MAD_F(0x06e00cbb) /* 0.429699640 */, 17 }, + /* 3657 */ { MAD_F(0x06e0b10f) /* 0.429856357 */, 17 }, + /* 3658 */ { MAD_F(0x06e15567) /* 0.430013089 */, 17 }, + /* 3659 */ { MAD_F(0x06e1f9c4) /* 0.430169835 */, 17 }, + /* 3660 */ { MAD_F(0x06e29e24) /* 0.430326595 */, 17 }, + /* 3661 */ { MAD_F(0x06e34287) /* 0.430483370 */, 17 }, + /* 3662 */ { MAD_F(0x06e3e6ef) /* 0.430640159 */, 17 }, + /* 3663 */ { MAD_F(0x06e48b5b) /* 0.430796962 */, 17 }, + + /* 3664 */ { MAD_F(0x06e52fca) /* 0.430953779 */, 17 }, + /* 3665 */ { MAD_F(0x06e5d43d) /* 0.431110611 */, 17 }, + /* 3666 */ { MAD_F(0x06e678b4) /* 0.431267457 */, 17 }, + /* 3667 */ { MAD_F(0x06e71d2f) /* 0.431424317 */, 17 }, + /* 3668 */ { MAD_F(0x06e7c1ae) /* 0.431581192 */, 17 }, + /* 3669 */ { MAD_F(0x06e86630) /* 0.431738080 */, 17 }, + /* 3670 */ { MAD_F(0x06e90ab7) /* 0.431894983 */, 17 }, + /* 3671 */ { MAD_F(0x06e9af41) /* 0.432051900 */, 17 }, + /* 3672 */ { MAD_F(0x06ea53cf) /* 0.432208832 */, 17 }, + /* 3673 */ { MAD_F(0x06eaf860) /* 0.432365778 */, 17 }, + /* 3674 */ { MAD_F(0x06eb9cf6) /* 0.432522737 */, 17 }, + /* 3675 */ { MAD_F(0x06ec418f) /* 0.432679712 */, 17 }, + /* 3676 */ { MAD_F(0x06ece62d) /* 0.432836700 */, 17 }, + /* 3677 */ { MAD_F(0x06ed8ace) /* 0.432993703 */, 17 }, + /* 3678 */ { MAD_F(0x06ee2f73) /* 0.433150720 */, 17 }, + /* 3679 */ { MAD_F(0x06eed41b) /* 0.433307751 */, 17 }, + + /* 3680 */ { MAD_F(0x06ef78c8) /* 0.433464796 */, 17 }, + /* 3681 */ { MAD_F(0x06f01d78) /* 0.433621856 */, 17 }, + /* 3682 */ { MAD_F(0x06f0c22c) /* 0.433778929 */, 17 }, + /* 3683 */ { MAD_F(0x06f166e4) /* 0.433936017 */, 17 }, + /* 3684 */ { MAD_F(0x06f20ba0) /* 0.434093120 */, 17 }, + /* 3685 */ { MAD_F(0x06f2b060) /* 0.434250236 */, 17 }, + /* 3686 */ { MAD_F(0x06f35523) /* 0.434407367 */, 17 }, + /* 3687 */ { MAD_F(0x06f3f9eb) /* 0.434564512 */, 17 }, + /* 3688 */ { MAD_F(0x06f49eb6) /* 0.434721671 */, 17 }, + /* 3689 */ { MAD_F(0x06f54385) /* 0.434878844 */, 17 }, + /* 3690 */ { MAD_F(0x06f5e857) /* 0.435036032 */, 17 }, + /* 3691 */ { MAD_F(0x06f68d2e) /* 0.435193233 */, 17 }, + /* 3692 */ { MAD_F(0x06f73208) /* 0.435350449 */, 17 }, + /* 3693 */ { MAD_F(0x06f7d6e6) /* 0.435507679 */, 17 }, + /* 3694 */ { MAD_F(0x06f87bc8) /* 0.435664924 */, 17 }, + /* 3695 */ { MAD_F(0x06f920ae) /* 0.435822182 */, 17 }, + + /* 3696 */ { MAD_F(0x06f9c597) /* 0.435979455 */, 17 }, + /* 3697 */ { MAD_F(0x06fa6a85) /* 0.436136741 */, 17 }, + /* 3698 */ { MAD_F(0x06fb0f76) /* 0.436294042 */, 17 }, + /* 3699 */ { MAD_F(0x06fbb46b) /* 0.436451358 */, 17 }, + /* 3700 */ { MAD_F(0x06fc5964) /* 0.436608687 */, 17 }, + /* 3701 */ { MAD_F(0x06fcfe60) /* 0.436766031 */, 17 }, + /* 3702 */ { MAD_F(0x06fda361) /* 0.436923388 */, 17 }, + /* 3703 */ { MAD_F(0x06fe4865) /* 0.437080760 */, 17 }, + /* 3704 */ { MAD_F(0x06feed6d) /* 0.437238146 */, 17 }, + /* 3705 */ { MAD_F(0x06ff9279) /* 0.437395547 */, 17 }, + /* 3706 */ { MAD_F(0x07003788) /* 0.437552961 */, 17 }, + /* 3707 */ { MAD_F(0x0700dc9c) /* 0.437710389 */, 17 }, + /* 3708 */ { MAD_F(0x070181b3) /* 0.437867832 */, 17 }, + /* 3709 */ { MAD_F(0x070226ce) /* 0.438025289 */, 17 }, + /* 3710 */ { MAD_F(0x0702cbed) /* 0.438182760 */, 17 }, + /* 3711 */ { MAD_F(0x0703710f) /* 0.438340245 */, 17 }, + + /* 3712 */ { MAD_F(0x07041636) /* 0.438497744 */, 17 }, + /* 3713 */ { MAD_F(0x0704bb60) /* 0.438655258 */, 17 }, + /* 3714 */ { MAD_F(0x0705608e) /* 0.438812785 */, 17 }, + /* 3715 */ { MAD_F(0x070605c0) /* 0.438970327 */, 17 }, + /* 3716 */ { MAD_F(0x0706aaf5) /* 0.439127883 */, 17 }, + /* 3717 */ { MAD_F(0x0707502f) /* 0.439285453 */, 17 }, + /* 3718 */ { MAD_F(0x0707f56c) /* 0.439443037 */, 17 }, + /* 3719 */ { MAD_F(0x07089aad) /* 0.439600635 */, 17 }, + /* 3720 */ { MAD_F(0x07093ff2) /* 0.439758248 */, 17 }, + /* 3721 */ { MAD_F(0x0709e53a) /* 0.439915874 */, 17 }, + /* 3722 */ { MAD_F(0x070a8a86) /* 0.440073515 */, 17 }, + /* 3723 */ { MAD_F(0x070b2fd7) /* 0.440231170 */, 17 }, + /* 3724 */ { MAD_F(0x070bd52a) /* 0.440388839 */, 17 }, + /* 3725 */ { MAD_F(0x070c7a82) /* 0.440546522 */, 17 }, + /* 3726 */ { MAD_F(0x070d1fde) /* 0.440704219 */, 17 }, + /* 3727 */ { MAD_F(0x070dc53d) /* 0.440861930 */, 17 }, + + /* 3728 */ { MAD_F(0x070e6aa0) /* 0.441019655 */, 17 }, + /* 3729 */ { MAD_F(0x070f1007) /* 0.441177395 */, 17 }, + /* 3730 */ { MAD_F(0x070fb571) /* 0.441335148 */, 17 }, + /* 3731 */ { MAD_F(0x07105ae0) /* 0.441492916 */, 17 }, + /* 3732 */ { MAD_F(0x07110052) /* 0.441650697 */, 17 }, + /* 3733 */ { MAD_F(0x0711a5c8) /* 0.441808493 */, 17 }, + /* 3734 */ { MAD_F(0x07124b42) /* 0.441966303 */, 17 }, + /* 3735 */ { MAD_F(0x0712f0bf) /* 0.442124127 */, 17 }, + /* 3736 */ { MAD_F(0x07139641) /* 0.442281965 */, 17 }, + /* 3737 */ { MAD_F(0x07143bc6) /* 0.442439817 */, 17 }, + /* 3738 */ { MAD_F(0x0714e14f) /* 0.442597683 */, 17 }, + /* 3739 */ { MAD_F(0x071586db) /* 0.442755564 */, 17 }, + /* 3740 */ { MAD_F(0x07162c6c) /* 0.442913458 */, 17 }, + /* 3741 */ { MAD_F(0x0716d200) /* 0.443071366 */, 17 }, + /* 3742 */ { MAD_F(0x07177798) /* 0.443229289 */, 17 }, + /* 3743 */ { MAD_F(0x07181d34) /* 0.443387226 */, 17 }, + + /* 3744 */ { MAD_F(0x0718c2d3) /* 0.443545176 */, 17 }, + /* 3745 */ { MAD_F(0x07196877) /* 0.443703141 */, 17 }, + /* 3746 */ { MAD_F(0x071a0e1e) /* 0.443861120 */, 17 }, + /* 3747 */ { MAD_F(0x071ab3c9) /* 0.444019113 */, 17 }, + /* 3748 */ { MAD_F(0x071b5977) /* 0.444177119 */, 17 }, + /* 3749 */ { MAD_F(0x071bff2a) /* 0.444335140 */, 17 }, + /* 3750 */ { MAD_F(0x071ca4e0) /* 0.444493175 */, 17 }, + /* 3751 */ { MAD_F(0x071d4a9a) /* 0.444651224 */, 17 }, + /* 3752 */ { MAD_F(0x071df058) /* 0.444809288 */, 17 }, + /* 3753 */ { MAD_F(0x071e9619) /* 0.444967365 */, 17 }, + /* 3754 */ { MAD_F(0x071f3bde) /* 0.445125456 */, 17 }, + /* 3755 */ { MAD_F(0x071fe1a8) /* 0.445283561 */, 17 }, + /* 3756 */ { MAD_F(0x07208774) /* 0.445441680 */, 17 }, + /* 3757 */ { MAD_F(0x07212d45) /* 0.445599814 */, 17 }, + /* 3758 */ { MAD_F(0x0721d319) /* 0.445757961 */, 17 }, + /* 3759 */ { MAD_F(0x072278f1) /* 0.445916122 */, 17 }, + + /* 3760 */ { MAD_F(0x07231ecd) /* 0.446074298 */, 17 }, + /* 3761 */ { MAD_F(0x0723c4ad) /* 0.446232487 */, 17 }, + /* 3762 */ { MAD_F(0x07246a90) /* 0.446390690 */, 17 }, + /* 3763 */ { MAD_F(0x07251077) /* 0.446548908 */, 17 }, + /* 3764 */ { MAD_F(0x0725b662) /* 0.446707139 */, 17 }, + /* 3765 */ { MAD_F(0x07265c51) /* 0.446865385 */, 17 }, + /* 3766 */ { MAD_F(0x07270244) /* 0.447023644 */, 17 }, + /* 3767 */ { MAD_F(0x0727a83a) /* 0.447181918 */, 17 }, + /* 3768 */ { MAD_F(0x07284e34) /* 0.447340205 */, 17 }, + /* 3769 */ { MAD_F(0x0728f431) /* 0.447498507 */, 17 }, + /* 3770 */ { MAD_F(0x07299a33) /* 0.447656822 */, 17 }, + /* 3771 */ { MAD_F(0x072a4038) /* 0.447815152 */, 17 }, + /* 3772 */ { MAD_F(0x072ae641) /* 0.447973495 */, 17 }, + /* 3773 */ { MAD_F(0x072b8c4e) /* 0.448131853 */, 17 }, + /* 3774 */ { MAD_F(0x072c325e) /* 0.448290224 */, 17 }, + /* 3775 */ { MAD_F(0x072cd873) /* 0.448448609 */, 17 }, + + /* 3776 */ { MAD_F(0x072d7e8b) /* 0.448607009 */, 17 }, + /* 3777 */ { MAD_F(0x072e24a7) /* 0.448765422 */, 17 }, + /* 3778 */ { MAD_F(0x072ecac6) /* 0.448923850 */, 17 }, + /* 3779 */ { MAD_F(0x072f70e9) /* 0.449082291 */, 17 }, + /* 3780 */ { MAD_F(0x07301710) /* 0.449240746 */, 17 }, + /* 3781 */ { MAD_F(0x0730bd3b) /* 0.449399216 */, 17 }, + /* 3782 */ { MAD_F(0x0731636a) /* 0.449557699 */, 17 }, + /* 3783 */ { MAD_F(0x0732099c) /* 0.449716196 */, 17 }, + /* 3784 */ { MAD_F(0x0732afd2) /* 0.449874708 */, 17 }, + /* 3785 */ { MAD_F(0x0733560c) /* 0.450033233 */, 17 }, + /* 3786 */ { MAD_F(0x0733fc49) /* 0.450191772 */, 17 }, + /* 3787 */ { MAD_F(0x0734a28b) /* 0.450350325 */, 17 }, + /* 3788 */ { MAD_F(0x073548d0) /* 0.450508892 */, 17 }, + /* 3789 */ { MAD_F(0x0735ef18) /* 0.450667473 */, 17 }, + /* 3790 */ { MAD_F(0x07369565) /* 0.450826068 */, 17 }, + /* 3791 */ { MAD_F(0x07373bb5) /* 0.450984677 */, 17 }, + + /* 3792 */ { MAD_F(0x0737e209) /* 0.451143300 */, 17 }, + /* 3793 */ { MAD_F(0x07388861) /* 0.451301937 */, 17 }, + /* 3794 */ { MAD_F(0x07392ebc) /* 0.451460588 */, 17 }, + /* 3795 */ { MAD_F(0x0739d51c) /* 0.451619252 */, 17 }, + /* 3796 */ { MAD_F(0x073a7b7f) /* 0.451777931 */, 17 }, + /* 3797 */ { MAD_F(0x073b21e5) /* 0.451936623 */, 17 }, + /* 3798 */ { MAD_F(0x073bc850) /* 0.452095330 */, 17 }, + /* 3799 */ { MAD_F(0x073c6ebe) /* 0.452254050 */, 17 }, + /* 3800 */ { MAD_F(0x073d1530) /* 0.452412785 */, 17 }, + /* 3801 */ { MAD_F(0x073dbba6) /* 0.452571533 */, 17 }, + /* 3802 */ { MAD_F(0x073e621f) /* 0.452730295 */, 17 }, + /* 3803 */ { MAD_F(0x073f089c) /* 0.452889071 */, 17 }, + /* 3804 */ { MAD_F(0x073faf1d) /* 0.453047861 */, 17 }, + /* 3805 */ { MAD_F(0x074055a2) /* 0.453206665 */, 17 }, + /* 3806 */ { MAD_F(0x0740fc2a) /* 0.453365483 */, 17 }, + /* 3807 */ { MAD_F(0x0741a2b6) /* 0.453524315 */, 17 }, + + /* 3808 */ { MAD_F(0x07424946) /* 0.453683161 */, 17 }, + /* 3809 */ { MAD_F(0x0742efd9) /* 0.453842020 */, 17 }, + /* 3810 */ { MAD_F(0x07439671) /* 0.454000894 */, 17 }, + /* 3811 */ { MAD_F(0x07443d0c) /* 0.454159781 */, 17 }, + /* 3812 */ { MAD_F(0x0744e3aa) /* 0.454318683 */, 17 }, + /* 3813 */ { MAD_F(0x07458a4d) /* 0.454477598 */, 17 }, + /* 3814 */ { MAD_F(0x074630f3) /* 0.454636527 */, 17 }, + /* 3815 */ { MAD_F(0x0746d79d) /* 0.454795470 */, 17 }, + /* 3816 */ { MAD_F(0x07477e4b) /* 0.454954427 */, 17 }, + /* 3817 */ { MAD_F(0x074824fc) /* 0.455113397 */, 17 }, + /* 3818 */ { MAD_F(0x0748cbb1) /* 0.455272382 */, 17 }, + /* 3819 */ { MAD_F(0x0749726a) /* 0.455431381 */, 17 }, + /* 3820 */ { MAD_F(0x074a1927) /* 0.455590393 */, 17 }, + /* 3821 */ { MAD_F(0x074abfe7) /* 0.455749419 */, 17 }, + /* 3822 */ { MAD_F(0x074b66ab) /* 0.455908459 */, 17 }, + /* 3823 */ { MAD_F(0x074c0d73) /* 0.456067513 */, 17 }, + + /* 3824 */ { MAD_F(0x074cb43e) /* 0.456226581 */, 17 }, + /* 3825 */ { MAD_F(0x074d5b0d) /* 0.456385663 */, 17 }, + /* 3826 */ { MAD_F(0x074e01e0) /* 0.456544759 */, 17 }, + /* 3827 */ { MAD_F(0x074ea8b7) /* 0.456703868 */, 17 }, + /* 3828 */ { MAD_F(0x074f4f91) /* 0.456862992 */, 17 }, + /* 3829 */ { MAD_F(0x074ff66f) /* 0.457022129 */, 17 }, + /* 3830 */ { MAD_F(0x07509d51) /* 0.457181280 */, 17 }, + /* 3831 */ { MAD_F(0x07514437) /* 0.457340445 */, 17 }, + /* 3832 */ { MAD_F(0x0751eb20) /* 0.457499623 */, 17 }, + /* 3833 */ { MAD_F(0x0752920d) /* 0.457658816 */, 17 }, + /* 3834 */ { MAD_F(0x075338fd) /* 0.457818022 */, 17 }, + /* 3835 */ { MAD_F(0x0753dff2) /* 0.457977243 */, 17 }, + /* 3836 */ { MAD_F(0x075486ea) /* 0.458136477 */, 17 }, + /* 3837 */ { MAD_F(0x07552de6) /* 0.458295725 */, 17 }, + /* 3838 */ { MAD_F(0x0755d4e5) /* 0.458454987 */, 17 }, + /* 3839 */ { MAD_F(0x07567be8) /* 0.458614262 */, 17 }, + + /* 3840 */ { MAD_F(0x075722ef) /* 0.458773552 */, 17 }, + /* 3841 */ { MAD_F(0x0757c9fa) /* 0.458932855 */, 17 }, + /* 3842 */ { MAD_F(0x07587108) /* 0.459092172 */, 17 }, + /* 3843 */ { MAD_F(0x0759181a) /* 0.459251503 */, 17 }, + /* 3844 */ { MAD_F(0x0759bf30) /* 0.459410848 */, 17 }, + /* 3845 */ { MAD_F(0x075a664a) /* 0.459570206 */, 17 }, + /* 3846 */ { MAD_F(0x075b0d67) /* 0.459729579 */, 17 }, + /* 3847 */ { MAD_F(0x075bb488) /* 0.459888965 */, 17 }, + /* 3848 */ { MAD_F(0x075c5bac) /* 0.460048365 */, 17 }, + /* 3849 */ { MAD_F(0x075d02d5) /* 0.460207779 */, 17 }, + /* 3850 */ { MAD_F(0x075daa01) /* 0.460367206 */, 17 }, + /* 3851 */ { MAD_F(0x075e5130) /* 0.460526648 */, 17 }, + /* 3852 */ { MAD_F(0x075ef864) /* 0.460686103 */, 17 }, + /* 3853 */ { MAD_F(0x075f9f9b) /* 0.460845572 */, 17 }, + /* 3854 */ { MAD_F(0x076046d6) /* 0.461005055 */, 17 }, + /* 3855 */ { MAD_F(0x0760ee14) /* 0.461164552 */, 17 }, + + /* 3856 */ { MAD_F(0x07619557) /* 0.461324062 */, 17 }, + /* 3857 */ { MAD_F(0x07623c9d) /* 0.461483586 */, 17 }, + /* 3858 */ { MAD_F(0x0762e3e6) /* 0.461643124 */, 17 }, + /* 3859 */ { MAD_F(0x07638b34) /* 0.461802676 */, 17 }, + /* 3860 */ { MAD_F(0x07643285) /* 0.461962242 */, 17 }, + /* 3861 */ { MAD_F(0x0764d9d9) /* 0.462121821 */, 17 }, + /* 3862 */ { MAD_F(0x07658132) /* 0.462281414 */, 17 }, + /* 3863 */ { MAD_F(0x0766288e) /* 0.462441021 */, 17 }, + /* 3864 */ { MAD_F(0x0766cfee) /* 0.462600642 */, 17 }, + /* 3865 */ { MAD_F(0x07677751) /* 0.462760276 */, 17 }, + /* 3866 */ { MAD_F(0x07681eb9) /* 0.462919924 */, 17 }, + /* 3867 */ { MAD_F(0x0768c624) /* 0.463079586 */, 17 }, + /* 3868 */ { MAD_F(0x07696d92) /* 0.463239262 */, 17 }, + /* 3869 */ { MAD_F(0x076a1505) /* 0.463398951 */, 17 }, + /* 3870 */ { MAD_F(0x076abc7b) /* 0.463558655 */, 17 }, + /* 3871 */ { MAD_F(0x076b63f4) /* 0.463718372 */, 17 }, + + /* 3872 */ { MAD_F(0x076c0b72) /* 0.463878102 */, 17 }, + /* 3873 */ { MAD_F(0x076cb2f3) /* 0.464037847 */, 17 }, + /* 3874 */ { MAD_F(0x076d5a78) /* 0.464197605 */, 17 }, + /* 3875 */ { MAD_F(0x076e0200) /* 0.464357377 */, 17 }, + /* 3876 */ { MAD_F(0x076ea98c) /* 0.464517163 */, 17 }, + /* 3877 */ { MAD_F(0x076f511c) /* 0.464676962 */, 17 }, + /* 3878 */ { MAD_F(0x076ff8b0) /* 0.464836776 */, 17 }, + /* 3879 */ { MAD_F(0x0770a047) /* 0.464996603 */, 17 }, + /* 3880 */ { MAD_F(0x077147e2) /* 0.465156443 */, 17 }, + /* 3881 */ { MAD_F(0x0771ef80) /* 0.465316298 */, 17 }, + /* 3882 */ { MAD_F(0x07729723) /* 0.465476166 */, 17 }, + /* 3883 */ { MAD_F(0x07733ec9) /* 0.465636048 */, 17 }, + /* 3884 */ { MAD_F(0x0773e672) /* 0.465795943 */, 17 }, + /* 3885 */ { MAD_F(0x07748e20) /* 0.465955853 */, 17 }, + /* 3886 */ { MAD_F(0x077535d1) /* 0.466115776 */, 17 }, + /* 3887 */ { MAD_F(0x0775dd85) /* 0.466275713 */, 17 }, + + /* 3888 */ { MAD_F(0x0776853e) /* 0.466435663 */, 17 }, + /* 3889 */ { MAD_F(0x07772cfa) /* 0.466595627 */, 17 }, + /* 3890 */ { MAD_F(0x0777d4ba) /* 0.466755605 */, 17 }, + /* 3891 */ { MAD_F(0x07787c7d) /* 0.466915597 */, 17 }, + /* 3892 */ { MAD_F(0x07792444) /* 0.467075602 */, 17 }, + /* 3893 */ { MAD_F(0x0779cc0f) /* 0.467235621 */, 17 }, + /* 3894 */ { MAD_F(0x077a73dd) /* 0.467395654 */, 17 }, + /* 3895 */ { MAD_F(0x077b1baf) /* 0.467555701 */, 17 }, + /* 3896 */ { MAD_F(0x077bc385) /* 0.467715761 */, 17 }, + /* 3897 */ { MAD_F(0x077c6b5f) /* 0.467875835 */, 17 }, + /* 3898 */ { MAD_F(0x077d133c) /* 0.468035922 */, 17 }, + /* 3899 */ { MAD_F(0x077dbb1d) /* 0.468196023 */, 17 }, + /* 3900 */ { MAD_F(0x077e6301) /* 0.468356138 */, 17 }, + /* 3901 */ { MAD_F(0x077f0ae9) /* 0.468516267 */, 17 }, + /* 3902 */ { MAD_F(0x077fb2d5) /* 0.468676409 */, 17 }, + /* 3903 */ { MAD_F(0x07805ac5) /* 0.468836565 */, 17 }, + + /* 3904 */ { MAD_F(0x078102b8) /* 0.468996735 */, 17 }, + /* 3905 */ { MAD_F(0x0781aaaf) /* 0.469156918 */, 17 }, + /* 3906 */ { MAD_F(0x078252aa) /* 0.469317115 */, 17 }, + /* 3907 */ { MAD_F(0x0782faa8) /* 0.469477326 */, 17 }, + /* 3908 */ { MAD_F(0x0783a2aa) /* 0.469637550 */, 17 }, + /* 3909 */ { MAD_F(0x07844aaf) /* 0.469797788 */, 17 }, + /* 3910 */ { MAD_F(0x0784f2b8) /* 0.469958040 */, 17 }, + /* 3911 */ { MAD_F(0x07859ac5) /* 0.470118305 */, 17 }, + /* 3912 */ { MAD_F(0x078642d6) /* 0.470278584 */, 17 }, + /* 3913 */ { MAD_F(0x0786eaea) /* 0.470438877 */, 17 }, + /* 3914 */ { MAD_F(0x07879302) /* 0.470599183 */, 17 }, + /* 3915 */ { MAD_F(0x07883b1e) /* 0.470759503 */, 17 }, + /* 3916 */ { MAD_F(0x0788e33d) /* 0.470919836 */, 17 }, + /* 3917 */ { MAD_F(0x07898b60) /* 0.471080184 */, 17 }, + /* 3918 */ { MAD_F(0x078a3386) /* 0.471240545 */, 17 }, + /* 3919 */ { MAD_F(0x078adbb0) /* 0.471400919 */, 17 }, + + /* 3920 */ { MAD_F(0x078b83de) /* 0.471561307 */, 17 }, + /* 3921 */ { MAD_F(0x078c2c10) /* 0.471721709 */, 17 }, + /* 3922 */ { MAD_F(0x078cd445) /* 0.471882125 */, 17 }, + /* 3923 */ { MAD_F(0x078d7c7e) /* 0.472042554 */, 17 }, + /* 3924 */ { MAD_F(0x078e24ba) /* 0.472202996 */, 17 }, + /* 3925 */ { MAD_F(0x078eccfb) /* 0.472363453 */, 17 }, + /* 3926 */ { MAD_F(0x078f753e) /* 0.472523923 */, 17 }, + /* 3927 */ { MAD_F(0x07901d86) /* 0.472684406 */, 17 }, + /* 3928 */ { MAD_F(0x0790c5d1) /* 0.472844904 */, 17 }, + /* 3929 */ { MAD_F(0x07916e20) /* 0.473005414 */, 17 }, + /* 3930 */ { MAD_F(0x07921672) /* 0.473165939 */, 17 }, + /* 3931 */ { MAD_F(0x0792bec8) /* 0.473326477 */, 17 }, + /* 3932 */ { MAD_F(0x07936722) /* 0.473487029 */, 17 }, + /* 3933 */ { MAD_F(0x07940f80) /* 0.473647594 */, 17 }, + /* 3934 */ { MAD_F(0x0794b7e1) /* 0.473808173 */, 17 }, + /* 3935 */ { MAD_F(0x07956045) /* 0.473968765 */, 17 }, + + /* 3936 */ { MAD_F(0x079608ae) /* 0.474129372 */, 17 }, + /* 3937 */ { MAD_F(0x0796b11a) /* 0.474289991 */, 17 }, + /* 3938 */ { MAD_F(0x0797598a) /* 0.474450625 */, 17 }, + /* 3939 */ { MAD_F(0x079801fd) /* 0.474611272 */, 17 }, + /* 3940 */ { MAD_F(0x0798aa74) /* 0.474771932 */, 17 }, + /* 3941 */ { MAD_F(0x079952ee) /* 0.474932606 */, 17 }, + /* 3942 */ { MAD_F(0x0799fb6d) /* 0.475093294 */, 17 }, + /* 3943 */ { MAD_F(0x079aa3ef) /* 0.475253995 */, 17 }, + /* 3944 */ { MAD_F(0x079b4c74) /* 0.475414710 */, 17 }, + /* 3945 */ { MAD_F(0x079bf4fd) /* 0.475575439 */, 17 }, + /* 3946 */ { MAD_F(0x079c9d8a) /* 0.475736181 */, 17 }, + /* 3947 */ { MAD_F(0x079d461b) /* 0.475896936 */, 17 }, + /* 3948 */ { MAD_F(0x079deeaf) /* 0.476057705 */, 17 }, + /* 3949 */ { MAD_F(0x079e9747) /* 0.476218488 */, 17 }, + /* 3950 */ { MAD_F(0x079f3fe2) /* 0.476379285 */, 17 }, + /* 3951 */ { MAD_F(0x079fe881) /* 0.476540095 */, 17 }, + + /* 3952 */ { MAD_F(0x07a09124) /* 0.476700918 */, 17 }, + /* 3953 */ { MAD_F(0x07a139ca) /* 0.476861755 */, 17 }, + /* 3954 */ { MAD_F(0x07a1e274) /* 0.477022606 */, 17 }, + /* 3955 */ { MAD_F(0x07a28b22) /* 0.477183470 */, 17 }, + /* 3956 */ { MAD_F(0x07a333d3) /* 0.477344348 */, 17 }, + /* 3957 */ { MAD_F(0x07a3dc88) /* 0.477505239 */, 17 }, + /* 3958 */ { MAD_F(0x07a48541) /* 0.477666144 */, 17 }, + /* 3959 */ { MAD_F(0x07a52dfd) /* 0.477827062 */, 17 }, + /* 3960 */ { MAD_F(0x07a5d6bd) /* 0.477987994 */, 17 }, + /* 3961 */ { MAD_F(0x07a67f80) /* 0.478148940 */, 17 }, + /* 3962 */ { MAD_F(0x07a72847) /* 0.478309899 */, 17 }, + /* 3963 */ { MAD_F(0x07a7d112) /* 0.478470871 */, 17 }, + /* 3964 */ { MAD_F(0x07a879e1) /* 0.478631857 */, 17 }, + /* 3965 */ { MAD_F(0x07a922b3) /* 0.478792857 */, 17 }, + /* 3966 */ { MAD_F(0x07a9cb88) /* 0.478953870 */, 17 }, + /* 3967 */ { MAD_F(0x07aa7462) /* 0.479114897 */, 17 }, + + /* 3968 */ { MAD_F(0x07ab1d3e) /* 0.479275937 */, 17 }, + /* 3969 */ { MAD_F(0x07abc61f) /* 0.479436991 */, 17 }, + /* 3970 */ { MAD_F(0x07ac6f03) /* 0.479598058 */, 17 }, + /* 3971 */ { MAD_F(0x07ad17eb) /* 0.479759139 */, 17 }, + /* 3972 */ { MAD_F(0x07adc0d6) /* 0.479920233 */, 17 }, + /* 3973 */ { MAD_F(0x07ae69c6) /* 0.480081341 */, 17 }, + /* 3974 */ { MAD_F(0x07af12b8) /* 0.480242463 */, 17 }, + /* 3975 */ { MAD_F(0x07afbbaf) /* 0.480403598 */, 17 }, + /* 3976 */ { MAD_F(0x07b064a8) /* 0.480564746 */, 17 }, + /* 3977 */ { MAD_F(0x07b10da6) /* 0.480725908 */, 17 }, + /* 3978 */ { MAD_F(0x07b1b6a7) /* 0.480887083 */, 17 }, + /* 3979 */ { MAD_F(0x07b25fac) /* 0.481048272 */, 17 }, + /* 3980 */ { MAD_F(0x07b308b5) /* 0.481209475 */, 17 }, + /* 3981 */ { MAD_F(0x07b3b1c1) /* 0.481370691 */, 17 }, + /* 3982 */ { MAD_F(0x07b45ad0) /* 0.481531920 */, 17 }, + /* 3983 */ { MAD_F(0x07b503e4) /* 0.481693163 */, 17 }, + + /* 3984 */ { MAD_F(0x07b5acfb) /* 0.481854420 */, 17 }, + /* 3985 */ { MAD_F(0x07b65615) /* 0.482015690 */, 17 }, + /* 3986 */ { MAD_F(0x07b6ff33) /* 0.482176973 */, 17 }, + /* 3987 */ { MAD_F(0x07b7a855) /* 0.482338270 */, 17 }, + /* 3988 */ { MAD_F(0x07b8517b) /* 0.482499580 */, 17 }, + /* 3989 */ { MAD_F(0x07b8faa4) /* 0.482660904 */, 17 }, + /* 3990 */ { MAD_F(0x07b9a3d0) /* 0.482822242 */, 17 }, + /* 3991 */ { MAD_F(0x07ba4d01) /* 0.482983592 */, 17 }, + /* 3992 */ { MAD_F(0x07baf635) /* 0.483144957 */, 17 }, + /* 3993 */ { MAD_F(0x07bb9f6c) /* 0.483306335 */, 17 }, + /* 3994 */ { MAD_F(0x07bc48a7) /* 0.483467726 */, 17 }, + /* 3995 */ { MAD_F(0x07bcf1e6) /* 0.483629131 */, 17 }, + /* 3996 */ { MAD_F(0x07bd9b28) /* 0.483790549 */, 17 }, + /* 3997 */ { MAD_F(0x07be446e) /* 0.483951980 */, 17 }, + /* 3998 */ { MAD_F(0x07beedb8) /* 0.484113426 */, 17 }, + /* 3999 */ { MAD_F(0x07bf9705) /* 0.484274884 */, 17 }, + + /* 4000 */ { MAD_F(0x07c04056) /* 0.484436356 */, 17 }, + /* 4001 */ { MAD_F(0x07c0e9aa) /* 0.484597842 */, 17 }, + /* 4002 */ { MAD_F(0x07c19302) /* 0.484759341 */, 17 }, + /* 4003 */ { MAD_F(0x07c23c5e) /* 0.484920853 */, 17 }, + /* 4004 */ { MAD_F(0x07c2e5bd) /* 0.485082379 */, 17 }, + /* 4005 */ { MAD_F(0x07c38f20) /* 0.485243918 */, 17 }, + /* 4006 */ { MAD_F(0x07c43887) /* 0.485405471 */, 17 }, + /* 4007 */ { MAD_F(0x07c4e1f1) /* 0.485567037 */, 17 }, + /* 4008 */ { MAD_F(0x07c58b5f) /* 0.485728617 */, 17 }, + /* 4009 */ { MAD_F(0x07c634d0) /* 0.485890210 */, 17 }, + /* 4010 */ { MAD_F(0x07c6de45) /* 0.486051817 */, 17 }, + /* 4011 */ { MAD_F(0x07c787bd) /* 0.486213436 */, 17 }, + /* 4012 */ { MAD_F(0x07c83139) /* 0.486375070 */, 17 }, + /* 4013 */ { MAD_F(0x07c8dab9) /* 0.486536717 */, 17 }, + /* 4014 */ { MAD_F(0x07c9843c) /* 0.486698377 */, 17 }, + /* 4015 */ { MAD_F(0x07ca2dc3) /* 0.486860051 */, 17 }, + + /* 4016 */ { MAD_F(0x07cad74e) /* 0.487021738 */, 17 }, + /* 4017 */ { MAD_F(0x07cb80dc) /* 0.487183438 */, 17 }, + /* 4018 */ { MAD_F(0x07cc2a6e) /* 0.487345152 */, 17 }, + /* 4019 */ { MAD_F(0x07ccd403) /* 0.487506879 */, 17 }, + /* 4020 */ { MAD_F(0x07cd7d9c) /* 0.487668620 */, 17 }, + /* 4021 */ { MAD_F(0x07ce2739) /* 0.487830374 */, 17 }, + /* 4022 */ { MAD_F(0x07ced0d9) /* 0.487992142 */, 17 }, + /* 4023 */ { MAD_F(0x07cf7a7d) /* 0.488153923 */, 17 }, + /* 4024 */ { MAD_F(0x07d02424) /* 0.488315717 */, 17 }, + /* 4025 */ { MAD_F(0x07d0cdcf) /* 0.488477525 */, 17 }, + /* 4026 */ { MAD_F(0x07d1777e) /* 0.488639346 */, 17 }, + /* 4027 */ { MAD_F(0x07d22130) /* 0.488801181 */, 17 }, + /* 4028 */ { MAD_F(0x07d2cae5) /* 0.488963029 */, 17 }, + /* 4029 */ { MAD_F(0x07d3749f) /* 0.489124890 */, 17 }, + /* 4030 */ { MAD_F(0x07d41e5c) /* 0.489286765 */, 17 }, + /* 4031 */ { MAD_F(0x07d4c81c) /* 0.489448653 */, 17 }, + + /* 4032 */ { MAD_F(0x07d571e0) /* 0.489610555 */, 17 }, + /* 4033 */ { MAD_F(0x07d61ba8) /* 0.489772470 */, 17 }, + /* 4034 */ { MAD_F(0x07d6c573) /* 0.489934398 */, 17 }, + /* 4035 */ { MAD_F(0x07d76f42) /* 0.490096340 */, 17 }, + /* 4036 */ { MAD_F(0x07d81915) /* 0.490258295 */, 17 }, + /* 4037 */ { MAD_F(0x07d8c2eb) /* 0.490420263 */, 17 }, + /* 4038 */ { MAD_F(0x07d96cc4) /* 0.490582245 */, 17 }, + /* 4039 */ { MAD_F(0x07da16a2) /* 0.490744240 */, 17 }, + /* 4040 */ { MAD_F(0x07dac083) /* 0.490906249 */, 17 }, + /* 4041 */ { MAD_F(0x07db6a67) /* 0.491068271 */, 17 }, + /* 4042 */ { MAD_F(0x07dc144f) /* 0.491230306 */, 17 }, + /* 4043 */ { MAD_F(0x07dcbe3b) /* 0.491392355 */, 17 }, + /* 4044 */ { MAD_F(0x07dd682a) /* 0.491554417 */, 17 }, + /* 4045 */ { MAD_F(0x07de121d) /* 0.491716492 */, 17 }, + /* 4046 */ { MAD_F(0x07debc13) /* 0.491878581 */, 17 }, + /* 4047 */ { MAD_F(0x07df660d) /* 0.492040683 */, 17 }, + + /* 4048 */ { MAD_F(0x07e0100a) /* 0.492202799 */, 17 }, + /* 4049 */ { MAD_F(0x07e0ba0c) /* 0.492364928 */, 17 }, + /* 4050 */ { MAD_F(0x07e16410) /* 0.492527070 */, 17 }, + /* 4051 */ { MAD_F(0x07e20e19) /* 0.492689225 */, 17 }, + /* 4052 */ { MAD_F(0x07e2b824) /* 0.492851394 */, 17 }, + /* 4053 */ { MAD_F(0x07e36234) /* 0.493013576 */, 17 }, + /* 4054 */ { MAD_F(0x07e40c47) /* 0.493175772 */, 17 }, + /* 4055 */ { MAD_F(0x07e4b65e) /* 0.493337981 */, 17 }, + /* 4056 */ { MAD_F(0x07e56078) /* 0.493500203 */, 17 }, + /* 4057 */ { MAD_F(0x07e60a95) /* 0.493662438 */, 17 }, + /* 4058 */ { MAD_F(0x07e6b4b7) /* 0.493824687 */, 17 }, + /* 4059 */ { MAD_F(0x07e75edc) /* 0.493986949 */, 17 }, + /* 4060 */ { MAD_F(0x07e80904) /* 0.494149225 */, 17 }, + /* 4061 */ { MAD_F(0x07e8b330) /* 0.494311514 */, 17 }, + /* 4062 */ { MAD_F(0x07e95d60) /* 0.494473816 */, 17 }, + /* 4063 */ { MAD_F(0x07ea0793) /* 0.494636131 */, 17 }, + + /* 4064 */ { MAD_F(0x07eab1ca) /* 0.494798460 */, 17 }, + /* 4065 */ { MAD_F(0x07eb5c04) /* 0.494960802 */, 17 }, + /* 4066 */ { MAD_F(0x07ec0642) /* 0.495123158 */, 17 }, + /* 4067 */ { MAD_F(0x07ecb084) /* 0.495285526 */, 17 }, + /* 4068 */ { MAD_F(0x07ed5ac9) /* 0.495447908 */, 17 }, + /* 4069 */ { MAD_F(0x07ee0512) /* 0.495610304 */, 17 }, + /* 4070 */ { MAD_F(0x07eeaf5e) /* 0.495772712 */, 17 }, + /* 4071 */ { MAD_F(0x07ef59ae) /* 0.495935134 */, 17 }, + /* 4072 */ { MAD_F(0x07f00401) /* 0.496097570 */, 17 }, + /* 4073 */ { MAD_F(0x07f0ae58) /* 0.496260018 */, 17 }, + /* 4074 */ { MAD_F(0x07f158b3) /* 0.496422480 */, 17 }, + /* 4075 */ { MAD_F(0x07f20311) /* 0.496584955 */, 17 }, + /* 4076 */ { MAD_F(0x07f2ad72) /* 0.496747444 */, 17 }, + /* 4077 */ { MAD_F(0x07f357d8) /* 0.496909945 */, 17 }, + /* 4078 */ { MAD_F(0x07f40240) /* 0.497072460 */, 17 }, + /* 4079 */ { MAD_F(0x07f4acad) /* 0.497234989 */, 17 }, + + /* 4080 */ { MAD_F(0x07f5571d) /* 0.497397530 */, 17 }, + /* 4081 */ { MAD_F(0x07f60190) /* 0.497560085 */, 17 }, + /* 4082 */ { MAD_F(0x07f6ac07) /* 0.497722653 */, 17 }, + /* 4083 */ { MAD_F(0x07f75682) /* 0.497885235 */, 17 }, + /* 4084 */ { MAD_F(0x07f80100) /* 0.498047829 */, 17 }, + /* 4085 */ { MAD_F(0x07f8ab82) /* 0.498210437 */, 17 }, + /* 4086 */ { MAD_F(0x07f95607) /* 0.498373058 */, 17 }, + /* 4087 */ { MAD_F(0x07fa0090) /* 0.498535693 */, 17 }, + /* 4088 */ { MAD_F(0x07faab1c) /* 0.498698341 */, 17 }, + /* 4089 */ { MAD_F(0x07fb55ac) /* 0.498861002 */, 17 }, + /* 4090 */ { MAD_F(0x07fc0040) /* 0.499023676 */, 17 }, + /* 4091 */ { MAD_F(0x07fcaad7) /* 0.499186364 */, 17 }, + /* 4092 */ { MAD_F(0x07fd5572) /* 0.499349064 */, 17 }, + /* 4093 */ { MAD_F(0x07fe0010) /* 0.499511778 */, 17 }, + /* 4094 */ { MAD_F(0x07feaab2) /* 0.499674506 */, 17 }, + /* 4095 */ { MAD_F(0x07ff5557) /* 0.499837246 */, 17 }, + + /* 4096 */ { MAD_F(0x04000000) /* 0.250000000 */, 18 }, + /* 4097 */ { MAD_F(0x04005556) /* 0.250081384 */, 18 }, + /* 4098 */ { MAD_F(0x0400aaae) /* 0.250162774 */, 18 }, + /* 4099 */ { MAD_F(0x04010008) /* 0.250244170 */, 18 }, + /* 4100 */ { MAD_F(0x04015563) /* 0.250325574 */, 18 }, + /* 4101 */ { MAD_F(0x0401aac1) /* 0.250406984 */, 18 }, + /* 4102 */ { MAD_F(0x04020020) /* 0.250488400 */, 18 }, + /* 4103 */ { MAD_F(0x04025581) /* 0.250569824 */, 18 }, + /* 4104 */ { MAD_F(0x0402aae3) /* 0.250651254 */, 18 }, + /* 4105 */ { MAD_F(0x04030048) /* 0.250732690 */, 18 }, + /* 4106 */ { MAD_F(0x040355ae) /* 0.250814133 */, 18 }, + /* 4107 */ { MAD_F(0x0403ab16) /* 0.250895583 */, 18 }, + /* 4108 */ { MAD_F(0x04040080) /* 0.250977039 */, 18 }, + /* 4109 */ { MAD_F(0x040455eb) /* 0.251058502 */, 18 }, + /* 4110 */ { MAD_F(0x0404ab59) /* 0.251139971 */, 18 }, + /* 4111 */ { MAD_F(0x040500c8) /* 0.251221448 */, 18 }, + + /* 4112 */ { MAD_F(0x04055638) /* 0.251302930 */, 18 }, + /* 4113 */ { MAD_F(0x0405abab) /* 0.251384420 */, 18 }, + /* 4114 */ { MAD_F(0x0406011f) /* 0.251465916 */, 18 }, + /* 4115 */ { MAD_F(0x04065696) /* 0.251547418 */, 18 }, + /* 4116 */ { MAD_F(0x0406ac0e) /* 0.251628927 */, 18 }, + /* 4117 */ { MAD_F(0x04070187) /* 0.251710443 */, 18 }, + /* 4118 */ { MAD_F(0x04075703) /* 0.251791965 */, 18 }, + /* 4119 */ { MAD_F(0x0407ac80) /* 0.251873494 */, 18 }, + /* 4120 */ { MAD_F(0x040801ff) /* 0.251955030 */, 18 }, + /* 4121 */ { MAD_F(0x04085780) /* 0.252036572 */, 18 }, + /* 4122 */ { MAD_F(0x0408ad02) /* 0.252118121 */, 18 }, + /* 4123 */ { MAD_F(0x04090287) /* 0.252199676 */, 18 }, + /* 4124 */ { MAD_F(0x0409580d) /* 0.252281238 */, 18 }, + /* 4125 */ { MAD_F(0x0409ad95) /* 0.252362807 */, 18 }, + /* 4126 */ { MAD_F(0x040a031e) /* 0.252444382 */, 18 }, + /* 4127 */ { MAD_F(0x040a58aa) /* 0.252525963 */, 18 }, + + /* 4128 */ { MAD_F(0x040aae37) /* 0.252607552 */, 18 }, + /* 4129 */ { MAD_F(0x040b03c6) /* 0.252689147 */, 18 }, + /* 4130 */ { MAD_F(0x040b5957) /* 0.252770748 */, 18 }, + /* 4131 */ { MAD_F(0x040baee9) /* 0.252852356 */, 18 }, + /* 4132 */ { MAD_F(0x040c047e) /* 0.252933971 */, 18 }, + /* 4133 */ { MAD_F(0x040c5a14) /* 0.253015592 */, 18 }, + /* 4134 */ { MAD_F(0x040cafab) /* 0.253097220 */, 18 }, + /* 4135 */ { MAD_F(0x040d0545) /* 0.253178854 */, 18 }, + /* 4136 */ { MAD_F(0x040d5ae0) /* 0.253260495 */, 18 }, + /* 4137 */ { MAD_F(0x040db07d) /* 0.253342143 */, 18 }, + /* 4138 */ { MAD_F(0x040e061c) /* 0.253423797 */, 18 }, + /* 4139 */ { MAD_F(0x040e5bbd) /* 0.253505457 */, 18 }, + /* 4140 */ { MAD_F(0x040eb15f) /* 0.253587125 */, 18 }, + /* 4141 */ { MAD_F(0x040f0703) /* 0.253668799 */, 18 }, + /* 4142 */ { MAD_F(0x040f5ca9) /* 0.253750479 */, 18 }, + /* 4143 */ { MAD_F(0x040fb251) /* 0.253832166 */, 18 }, + + /* 4144 */ { MAD_F(0x041007fa) /* 0.253913860 */, 18 }, + /* 4145 */ { MAD_F(0x04105da6) /* 0.253995560 */, 18 }, + /* 4146 */ { MAD_F(0x0410b353) /* 0.254077266 */, 18 }, + /* 4147 */ { MAD_F(0x04110901) /* 0.254158980 */, 18 }, + /* 4148 */ { MAD_F(0x04115eb2) /* 0.254240700 */, 18 }, + /* 4149 */ { MAD_F(0x0411b464) /* 0.254322426 */, 18 }, + /* 4150 */ { MAD_F(0x04120a18) /* 0.254404159 */, 18 }, + /* 4151 */ { MAD_F(0x04125fce) /* 0.254485899 */, 18 }, + /* 4152 */ { MAD_F(0x0412b586) /* 0.254567645 */, 18 }, + /* 4153 */ { MAD_F(0x04130b3f) /* 0.254649397 */, 18 }, + /* 4154 */ { MAD_F(0x041360fa) /* 0.254731157 */, 18 }, + /* 4155 */ { MAD_F(0x0413b6b7) /* 0.254812922 */, 18 }, + /* 4156 */ { MAD_F(0x04140c75) /* 0.254894695 */, 18 }, + /* 4157 */ { MAD_F(0x04146236) /* 0.254976474 */, 18 }, + /* 4158 */ { MAD_F(0x0414b7f8) /* 0.255058259 */, 18 }, + /* 4159 */ { MAD_F(0x04150dbc) /* 0.255140051 */, 18 }, + + /* 4160 */ { MAD_F(0x04156381) /* 0.255221850 */, 18 }, + /* 4161 */ { MAD_F(0x0415b949) /* 0.255303655 */, 18 }, + /* 4162 */ { MAD_F(0x04160f12) /* 0.255385467 */, 18 }, + /* 4163 */ { MAD_F(0x041664dd) /* 0.255467285 */, 18 }, + /* 4164 */ { MAD_F(0x0416baaa) /* 0.255549110 */, 18 }, + /* 4165 */ { MAD_F(0x04171078) /* 0.255630941 */, 18 }, + /* 4166 */ { MAD_F(0x04176648) /* 0.255712779 */, 18 }, + /* 4167 */ { MAD_F(0x0417bc1a) /* 0.255794624 */, 18 }, + /* 4168 */ { MAD_F(0x041811ee) /* 0.255876475 */, 18 }, + /* 4169 */ { MAD_F(0x041867c3) /* 0.255958332 */, 18 }, + /* 4170 */ { MAD_F(0x0418bd9b) /* 0.256040196 */, 18 }, + /* 4171 */ { MAD_F(0x04191374) /* 0.256122067 */, 18 }, + /* 4172 */ { MAD_F(0x0419694e) /* 0.256203944 */, 18 }, + /* 4173 */ { MAD_F(0x0419bf2b) /* 0.256285828 */, 18 }, + /* 4174 */ { MAD_F(0x041a1509) /* 0.256367718 */, 18 }, + /* 4175 */ { MAD_F(0x041a6ae9) /* 0.256449615 */, 18 }, + + /* 4176 */ { MAD_F(0x041ac0cb) /* 0.256531518 */, 18 }, + /* 4177 */ { MAD_F(0x041b16ae) /* 0.256613428 */, 18 }, + /* 4178 */ { MAD_F(0x041b6c94) /* 0.256695344 */, 18 }, + /* 4179 */ { MAD_F(0x041bc27b) /* 0.256777267 */, 18 }, + /* 4180 */ { MAD_F(0x041c1863) /* 0.256859197 */, 18 }, + /* 4181 */ { MAD_F(0x041c6e4e) /* 0.256941133 */, 18 }, + /* 4182 */ { MAD_F(0x041cc43a) /* 0.257023076 */, 18 }, + /* 4183 */ { MAD_F(0x041d1a28) /* 0.257105025 */, 18 }, + /* 4184 */ { MAD_F(0x041d7018) /* 0.257186980 */, 18 }, + /* 4185 */ { MAD_F(0x041dc60a) /* 0.257268942 */, 18 }, + /* 4186 */ { MAD_F(0x041e1bfd) /* 0.257350911 */, 18 }, + /* 4187 */ { MAD_F(0x041e71f2) /* 0.257432886 */, 18 }, + /* 4188 */ { MAD_F(0x041ec7e9) /* 0.257514868 */, 18 }, + /* 4189 */ { MAD_F(0x041f1de1) /* 0.257596856 */, 18 }, + /* 4190 */ { MAD_F(0x041f73dc) /* 0.257678851 */, 18 }, + /* 4191 */ { MAD_F(0x041fc9d8) /* 0.257760852 */, 18 }, + + /* 4192 */ { MAD_F(0x04201fd5) /* 0.257842860 */, 18 }, + /* 4193 */ { MAD_F(0x042075d5) /* 0.257924875 */, 18 }, + /* 4194 */ { MAD_F(0x0420cbd6) /* 0.258006895 */, 18 }, + /* 4195 */ { MAD_F(0x042121d9) /* 0.258088923 */, 18 }, + /* 4196 */ { MAD_F(0x042177de) /* 0.258170957 */, 18 }, + /* 4197 */ { MAD_F(0x0421cde5) /* 0.258252997 */, 18 }, + /* 4198 */ { MAD_F(0x042223ed) /* 0.258335044 */, 18 }, + /* 4199 */ { MAD_F(0x042279f7) /* 0.258417097 */, 18 }, + /* 4200 */ { MAD_F(0x0422d003) /* 0.258499157 */, 18 }, + /* 4201 */ { MAD_F(0x04232611) /* 0.258581224 */, 18 }, + /* 4202 */ { MAD_F(0x04237c20) /* 0.258663297 */, 18 }, + /* 4203 */ { MAD_F(0x0423d231) /* 0.258745376 */, 18 }, + /* 4204 */ { MAD_F(0x04242844) /* 0.258827462 */, 18 }, + /* 4205 */ { MAD_F(0x04247e58) /* 0.258909555 */, 18 }, + /* 4206 */ { MAD_F(0x0424d46e) /* 0.258991654 */, 18 }, + /* 4207 */ { MAD_F(0x04252a87) /* 0.259073760 */, 18 }, + + /* 4208 */ { MAD_F(0x042580a0) /* 0.259155872 */, 18 }, + /* 4209 */ { MAD_F(0x0425d6bc) /* 0.259237990 */, 18 }, + /* 4210 */ { MAD_F(0x04262cd9) /* 0.259320115 */, 18 }, + /* 4211 */ { MAD_F(0x042682f8) /* 0.259402247 */, 18 }, + /* 4212 */ { MAD_F(0x0426d919) /* 0.259484385 */, 18 }, + /* 4213 */ { MAD_F(0x04272f3b) /* 0.259566529 */, 18 }, + /* 4214 */ { MAD_F(0x04278560) /* 0.259648680 */, 18 }, + /* 4215 */ { MAD_F(0x0427db86) /* 0.259730838 */, 18 }, + /* 4216 */ { MAD_F(0x042831ad) /* 0.259813002 */, 18 }, + /* 4217 */ { MAD_F(0x042887d7) /* 0.259895173 */, 18 }, + /* 4218 */ { MAD_F(0x0428de02) /* 0.259977350 */, 18 }, + /* 4219 */ { MAD_F(0x0429342f) /* 0.260059533 */, 18 }, + /* 4220 */ { MAD_F(0x04298a5e) /* 0.260141723 */, 18 }, + /* 4221 */ { MAD_F(0x0429e08e) /* 0.260223920 */, 18 }, + /* 4222 */ { MAD_F(0x042a36c0) /* 0.260306123 */, 18 }, + /* 4223 */ { MAD_F(0x042a8cf4) /* 0.260388332 */, 18 }, + + /* 4224 */ { MAD_F(0x042ae32a) /* 0.260470548 */, 18 }, + /* 4225 */ { MAD_F(0x042b3962) /* 0.260552771 */, 18 }, + /* 4226 */ { MAD_F(0x042b8f9b) /* 0.260635000 */, 18 }, + /* 4227 */ { MAD_F(0x042be5d6) /* 0.260717235 */, 18 }, + /* 4228 */ { MAD_F(0x042c3c12) /* 0.260799477 */, 18 }, + /* 4229 */ { MAD_F(0x042c9251) /* 0.260881725 */, 18 }, + /* 4230 */ { MAD_F(0x042ce891) /* 0.260963980 */, 18 }, + /* 4231 */ { MAD_F(0x042d3ed3) /* 0.261046242 */, 18 }, + /* 4232 */ { MAD_F(0x042d9516) /* 0.261128510 */, 18 }, + /* 4233 */ { MAD_F(0x042deb5c) /* 0.261210784 */, 18 }, + /* 4234 */ { MAD_F(0x042e41a3) /* 0.261293065 */, 18 }, + /* 4235 */ { MAD_F(0x042e97ec) /* 0.261375352 */, 18 }, + /* 4236 */ { MAD_F(0x042eee36) /* 0.261457646 */, 18 }, + /* 4237 */ { MAD_F(0x042f4482) /* 0.261539946 */, 18 }, + /* 4238 */ { MAD_F(0x042f9ad1) /* 0.261622253 */, 18 }, + /* 4239 */ { MAD_F(0x042ff120) /* 0.261704566 */, 18 }, + + /* 4240 */ { MAD_F(0x04304772) /* 0.261786886 */, 18 }, + /* 4241 */ { MAD_F(0x04309dc5) /* 0.261869212 */, 18 }, + /* 4242 */ { MAD_F(0x0430f41a) /* 0.261951545 */, 18 }, + /* 4243 */ { MAD_F(0x04314a71) /* 0.262033884 */, 18 }, + /* 4244 */ { MAD_F(0x0431a0c9) /* 0.262116229 */, 18 }, + /* 4245 */ { MAD_F(0x0431f723) /* 0.262198581 */, 18 }, + /* 4246 */ { MAD_F(0x04324d7f) /* 0.262280940 */, 18 }, + /* 4247 */ { MAD_F(0x0432a3dd) /* 0.262363305 */, 18 }, + /* 4248 */ { MAD_F(0x0432fa3d) /* 0.262445676 */, 18 }, + /* 4249 */ { MAD_F(0x0433509e) /* 0.262528054 */, 18 }, + /* 4250 */ { MAD_F(0x0433a701) /* 0.262610438 */, 18 }, + /* 4251 */ { MAD_F(0x0433fd65) /* 0.262692829 */, 18 }, + /* 4252 */ { MAD_F(0x043453cc) /* 0.262775227 */, 18 }, + /* 4253 */ { MAD_F(0x0434aa34) /* 0.262857630 */, 18 }, + /* 4254 */ { MAD_F(0x0435009d) /* 0.262940040 */, 18 }, + /* 4255 */ { MAD_F(0x04355709) /* 0.263022457 */, 18 }, + + /* 4256 */ { MAD_F(0x0435ad76) /* 0.263104880 */, 18 }, + /* 4257 */ { MAD_F(0x043603e5) /* 0.263187310 */, 18 }, + /* 4258 */ { MAD_F(0x04365a56) /* 0.263269746 */, 18 }, + /* 4259 */ { MAD_F(0x0436b0c9) /* 0.263352188 */, 18 }, + /* 4260 */ { MAD_F(0x0437073d) /* 0.263434637 */, 18 }, + /* 4261 */ { MAD_F(0x04375db3) /* 0.263517093 */, 18 }, + /* 4262 */ { MAD_F(0x0437b42a) /* 0.263599554 */, 18 }, + /* 4263 */ { MAD_F(0x04380aa4) /* 0.263682023 */, 18 }, + /* 4264 */ { MAD_F(0x0438611f) /* 0.263764497 */, 18 }, + /* 4265 */ { MAD_F(0x0438b79c) /* 0.263846979 */, 18 }, + /* 4266 */ { MAD_F(0x04390e1a) /* 0.263929466 */, 18 }, + /* 4267 */ { MAD_F(0x0439649b) /* 0.264011960 */, 18 }, + /* 4268 */ { MAD_F(0x0439bb1d) /* 0.264094461 */, 18 }, + /* 4269 */ { MAD_F(0x043a11a1) /* 0.264176968 */, 18 }, + /* 4270 */ { MAD_F(0x043a6826) /* 0.264259481 */, 18 }, + /* 4271 */ { MAD_F(0x043abead) /* 0.264342001 */, 18 }, + + /* 4272 */ { MAD_F(0x043b1536) /* 0.264424527 */, 18 }, + /* 4273 */ { MAD_F(0x043b6bc1) /* 0.264507060 */, 18 }, + /* 4274 */ { MAD_F(0x043bc24d) /* 0.264589599 */, 18 }, + /* 4275 */ { MAD_F(0x043c18dc) /* 0.264672145 */, 18 }, + /* 4276 */ { MAD_F(0x043c6f6c) /* 0.264754697 */, 18 }, + /* 4277 */ { MAD_F(0x043cc5fd) /* 0.264837255 */, 18 }, + /* 4278 */ { MAD_F(0x043d1c91) /* 0.264919820 */, 18 }, + /* 4279 */ { MAD_F(0x043d7326) /* 0.265002392 */, 18 }, + /* 4280 */ { MAD_F(0x043dc9bc) /* 0.265084969 */, 18 }, + /* 4281 */ { MAD_F(0x043e2055) /* 0.265167554 */, 18 }, + /* 4282 */ { MAD_F(0x043e76ef) /* 0.265250144 */, 18 }, + /* 4283 */ { MAD_F(0x043ecd8b) /* 0.265332741 */, 18 }, + /* 4284 */ { MAD_F(0x043f2429) /* 0.265415345 */, 18 }, + /* 4285 */ { MAD_F(0x043f7ac8) /* 0.265497955 */, 18 }, + /* 4286 */ { MAD_F(0x043fd169) /* 0.265580571 */, 18 }, + /* 4287 */ { MAD_F(0x0440280c) /* 0.265663194 */, 18 }, + + /* 4288 */ { MAD_F(0x04407eb1) /* 0.265745823 */, 18 }, + /* 4289 */ { MAD_F(0x0440d557) /* 0.265828459 */, 18 }, + /* 4290 */ { MAD_F(0x04412bff) /* 0.265911101 */, 18 }, + /* 4291 */ { MAD_F(0x044182a9) /* 0.265993749 */, 18 }, + /* 4292 */ { MAD_F(0x0441d955) /* 0.266076404 */, 18 }, + /* 4293 */ { MAD_F(0x04423002) /* 0.266159065 */, 18 }, + /* 4294 */ { MAD_F(0x044286b1) /* 0.266241733 */, 18 }, + /* 4295 */ { MAD_F(0x0442dd61) /* 0.266324407 */, 18 }, + /* 4296 */ { MAD_F(0x04433414) /* 0.266407088 */, 18 }, + /* 4297 */ { MAD_F(0x04438ac8) /* 0.266489775 */, 18 }, + /* 4298 */ { MAD_F(0x0443e17e) /* 0.266572468 */, 18 }, + /* 4299 */ { MAD_F(0x04443835) /* 0.266655168 */, 18 }, + /* 4300 */ { MAD_F(0x04448eef) /* 0.266737874 */, 18 }, + /* 4301 */ { MAD_F(0x0444e5aa) /* 0.266820587 */, 18 }, + /* 4302 */ { MAD_F(0x04453c66) /* 0.266903306 */, 18 }, + /* 4303 */ { MAD_F(0x04459325) /* 0.266986031 */, 18 }, + + /* 4304 */ { MAD_F(0x0445e9e5) /* 0.267068763 */, 18 }, + /* 4305 */ { MAD_F(0x044640a7) /* 0.267151501 */, 18 }, + /* 4306 */ { MAD_F(0x0446976a) /* 0.267234246 */, 18 }, + /* 4307 */ { MAD_F(0x0446ee30) /* 0.267316997 */, 18 }, + /* 4308 */ { MAD_F(0x044744f7) /* 0.267399755 */, 18 }, + /* 4309 */ { MAD_F(0x04479bc0) /* 0.267482518 */, 18 }, + /* 4310 */ { MAD_F(0x0447f28a) /* 0.267565289 */, 18 }, + /* 4311 */ { MAD_F(0x04484956) /* 0.267648065 */, 18 }, + /* 4312 */ { MAD_F(0x0448a024) /* 0.267730848 */, 18 }, + /* 4313 */ { MAD_F(0x0448f6f4) /* 0.267813638 */, 18 }, + /* 4314 */ { MAD_F(0x04494dc5) /* 0.267896434 */, 18 }, + /* 4315 */ { MAD_F(0x0449a498) /* 0.267979236 */, 18 }, + /* 4316 */ { MAD_F(0x0449fb6d) /* 0.268062045 */, 18 }, + /* 4317 */ { MAD_F(0x044a5243) /* 0.268144860 */, 18 }, + /* 4318 */ { MAD_F(0x044aa91c) /* 0.268227681 */, 18 }, + /* 4319 */ { MAD_F(0x044afff6) /* 0.268310509 */, 18 }, + + /* 4320 */ { MAD_F(0x044b56d1) /* 0.268393343 */, 18 }, + /* 4321 */ { MAD_F(0x044badaf) /* 0.268476184 */, 18 }, + /* 4322 */ { MAD_F(0x044c048e) /* 0.268559031 */, 18 }, + /* 4323 */ { MAD_F(0x044c5b6f) /* 0.268641885 */, 18 }, + /* 4324 */ { MAD_F(0x044cb251) /* 0.268724744 */, 18 }, + /* 4325 */ { MAD_F(0x044d0935) /* 0.268807611 */, 18 }, + /* 4326 */ { MAD_F(0x044d601b) /* 0.268890483 */, 18 }, + /* 4327 */ { MAD_F(0x044db703) /* 0.268973362 */, 18 }, + /* 4328 */ { MAD_F(0x044e0dec) /* 0.269056248 */, 18 }, + /* 4329 */ { MAD_F(0x044e64d7) /* 0.269139139 */, 18 }, + /* 4330 */ { MAD_F(0x044ebbc4) /* 0.269222037 */, 18 }, + /* 4331 */ { MAD_F(0x044f12b3) /* 0.269304942 */, 18 }, + /* 4332 */ { MAD_F(0x044f69a3) /* 0.269387853 */, 18 }, + /* 4333 */ { MAD_F(0x044fc095) /* 0.269470770 */, 18 }, + /* 4334 */ { MAD_F(0x04501788) /* 0.269553694 */, 18 }, + /* 4335 */ { MAD_F(0x04506e7e) /* 0.269636624 */, 18 }, + + /* 4336 */ { MAD_F(0x0450c575) /* 0.269719560 */, 18 }, + /* 4337 */ { MAD_F(0x04511c6e) /* 0.269802503 */, 18 }, + /* 4338 */ { MAD_F(0x04517368) /* 0.269885452 */, 18 }, + /* 4339 */ { MAD_F(0x0451ca64) /* 0.269968408 */, 18 }, + /* 4340 */ { MAD_F(0x04522162) /* 0.270051370 */, 18 }, + /* 4341 */ { MAD_F(0x04527862) /* 0.270134338 */, 18 }, + /* 4342 */ { MAD_F(0x0452cf63) /* 0.270217312 */, 18 }, + /* 4343 */ { MAD_F(0x04532666) /* 0.270300293 */, 18 }, + /* 4344 */ { MAD_F(0x04537d6b) /* 0.270383281 */, 18 }, + /* 4345 */ { MAD_F(0x0453d472) /* 0.270466275 */, 18 }, + /* 4346 */ { MAD_F(0x04542b7a) /* 0.270549275 */, 18 }, + /* 4347 */ { MAD_F(0x04548284) /* 0.270632281 */, 18 }, + /* 4348 */ { MAD_F(0x0454d98f) /* 0.270715294 */, 18 }, + /* 4349 */ { MAD_F(0x0455309c) /* 0.270798313 */, 18 }, + /* 4350 */ { MAD_F(0x045587ab) /* 0.270881339 */, 18 }, + /* 4351 */ { MAD_F(0x0455debc) /* 0.270964371 */, 18 }, + + /* 4352 */ { MAD_F(0x045635cf) /* 0.271047409 */, 18 }, + /* 4353 */ { MAD_F(0x04568ce3) /* 0.271130454 */, 18 }, + /* 4354 */ { MAD_F(0x0456e3f9) /* 0.271213505 */, 18 }, + /* 4355 */ { MAD_F(0x04573b10) /* 0.271296562 */, 18 }, + /* 4356 */ { MAD_F(0x04579229) /* 0.271379626 */, 18 }, + /* 4357 */ { MAD_F(0x0457e944) /* 0.271462696 */, 18 }, + /* 4358 */ { MAD_F(0x04584061) /* 0.271545772 */, 18 }, + /* 4359 */ { MAD_F(0x0458977f) /* 0.271628855 */, 18 }, + /* 4360 */ { MAD_F(0x0458ee9f) /* 0.271711944 */, 18 }, + /* 4361 */ { MAD_F(0x045945c1) /* 0.271795040 */, 18 }, + /* 4362 */ { MAD_F(0x04599ce5) /* 0.271878142 */, 18 }, + /* 4363 */ { MAD_F(0x0459f40a) /* 0.271961250 */, 18 }, + /* 4364 */ { MAD_F(0x045a4b31) /* 0.272044365 */, 18 }, + /* 4365 */ { MAD_F(0x045aa259) /* 0.272127486 */, 18 }, + /* 4366 */ { MAD_F(0x045af984) /* 0.272210613 */, 18 }, + /* 4367 */ { MAD_F(0x045b50b0) /* 0.272293746 */, 18 }, + + /* 4368 */ { MAD_F(0x045ba7dd) /* 0.272376886 */, 18 }, + /* 4369 */ { MAD_F(0x045bff0d) /* 0.272460033 */, 18 }, + /* 4370 */ { MAD_F(0x045c563e) /* 0.272543185 */, 18 }, + /* 4371 */ { MAD_F(0x045cad71) /* 0.272626344 */, 18 }, + /* 4372 */ { MAD_F(0x045d04a5) /* 0.272709510 */, 18 }, + /* 4373 */ { MAD_F(0x045d5bdc) /* 0.272792681 */, 18 }, + /* 4374 */ { MAD_F(0x045db313) /* 0.272875859 */, 18 }, + /* 4375 */ { MAD_F(0x045e0a4d) /* 0.272959044 */, 18 }, + /* 4376 */ { MAD_F(0x045e6188) /* 0.273042234 */, 18 }, + /* 4377 */ { MAD_F(0x045eb8c5) /* 0.273125431 */, 18 }, + /* 4378 */ { MAD_F(0x045f1004) /* 0.273208635 */, 18 }, + /* 4379 */ { MAD_F(0x045f6745) /* 0.273291844 */, 18 }, + /* 4380 */ { MAD_F(0x045fbe87) /* 0.273375060 */, 18 }, + /* 4381 */ { MAD_F(0x046015cb) /* 0.273458283 */, 18 }, + /* 4382 */ { MAD_F(0x04606d10) /* 0.273541511 */, 18 }, + /* 4383 */ { MAD_F(0x0460c457) /* 0.273624747 */, 18 }, + + /* 4384 */ { MAD_F(0x04611ba0) /* 0.273707988 */, 18 }, + /* 4385 */ { MAD_F(0x046172eb) /* 0.273791236 */, 18 }, + /* 4386 */ { MAD_F(0x0461ca37) /* 0.273874490 */, 18 }, + /* 4387 */ { MAD_F(0x04622185) /* 0.273957750 */, 18 }, + /* 4388 */ { MAD_F(0x046278d5) /* 0.274041017 */, 18 }, + /* 4389 */ { MAD_F(0x0462d026) /* 0.274124290 */, 18 }, + /* 4390 */ { MAD_F(0x0463277a) /* 0.274207569 */, 18 }, + /* 4391 */ { MAD_F(0x04637ece) /* 0.274290855 */, 18 }, + /* 4392 */ { MAD_F(0x0463d625) /* 0.274374147 */, 18 }, + /* 4393 */ { MAD_F(0x04642d7d) /* 0.274457445 */, 18 }, + /* 4394 */ { MAD_F(0x046484d7) /* 0.274540749 */, 18 }, + /* 4395 */ { MAD_F(0x0464dc33) /* 0.274624060 */, 18 }, + /* 4396 */ { MAD_F(0x04653390) /* 0.274707378 */, 18 }, + /* 4397 */ { MAD_F(0x04658aef) /* 0.274790701 */, 18 }, + /* 4398 */ { MAD_F(0x0465e250) /* 0.274874031 */, 18 }, + /* 4399 */ { MAD_F(0x046639b2) /* 0.274957367 */, 18 }, + + /* 4400 */ { MAD_F(0x04669116) /* 0.275040710 */, 18 }, + /* 4401 */ { MAD_F(0x0466e87c) /* 0.275124059 */, 18 }, + /* 4402 */ { MAD_F(0x04673fe3) /* 0.275207414 */, 18 }, + /* 4403 */ { MAD_F(0x0467974d) /* 0.275290775 */, 18 }, + /* 4404 */ { MAD_F(0x0467eeb7) /* 0.275374143 */, 18 }, + /* 4405 */ { MAD_F(0x04684624) /* 0.275457517 */, 18 }, + /* 4406 */ { MAD_F(0x04689d92) /* 0.275540897 */, 18 }, + /* 4407 */ { MAD_F(0x0468f502) /* 0.275624284 */, 18 }, + /* 4408 */ { MAD_F(0x04694c74) /* 0.275707677 */, 18 }, + /* 4409 */ { MAD_F(0x0469a3e7) /* 0.275791076 */, 18 }, + /* 4410 */ { MAD_F(0x0469fb5c) /* 0.275874482 */, 18 }, + /* 4411 */ { MAD_F(0x046a52d3) /* 0.275957894 */, 18 }, + /* 4412 */ { MAD_F(0x046aaa4b) /* 0.276041312 */, 18 }, + /* 4413 */ { MAD_F(0x046b01c5) /* 0.276124737 */, 18 }, + /* 4414 */ { MAD_F(0x046b5941) /* 0.276208167 */, 18 }, + /* 4415 */ { MAD_F(0x046bb0bf) /* 0.276291605 */, 18 }, + + /* 4416 */ { MAD_F(0x046c083e) /* 0.276375048 */, 18 }, + /* 4417 */ { MAD_F(0x046c5fbf) /* 0.276458498 */, 18 }, + /* 4418 */ { MAD_F(0x046cb741) /* 0.276541954 */, 18 }, + /* 4419 */ { MAD_F(0x046d0ec5) /* 0.276625416 */, 18 }, + /* 4420 */ { MAD_F(0x046d664b) /* 0.276708885 */, 18 }, + /* 4421 */ { MAD_F(0x046dbdd3) /* 0.276792360 */, 18 }, + /* 4422 */ { MAD_F(0x046e155c) /* 0.276875841 */, 18 }, + /* 4423 */ { MAD_F(0x046e6ce7) /* 0.276959328 */, 18 }, + /* 4424 */ { MAD_F(0x046ec474) /* 0.277042822 */, 18 }, + /* 4425 */ { MAD_F(0x046f1c02) /* 0.277126322 */, 18 }, + /* 4426 */ { MAD_F(0x046f7392) /* 0.277209829 */, 18 }, + /* 4427 */ { MAD_F(0x046fcb24) /* 0.277293341 */, 18 }, + /* 4428 */ { MAD_F(0x047022b8) /* 0.277376860 */, 18 }, + /* 4429 */ { MAD_F(0x04707a4d) /* 0.277460385 */, 18 }, + /* 4430 */ { MAD_F(0x0470d1e4) /* 0.277543917 */, 18 }, + /* 4431 */ { MAD_F(0x0471297c) /* 0.277627455 */, 18 }, + + /* 4432 */ { MAD_F(0x04718116) /* 0.277710999 */, 18 }, + /* 4433 */ { MAD_F(0x0471d8b2) /* 0.277794549 */, 18 }, + /* 4434 */ { MAD_F(0x04723050) /* 0.277878106 */, 18 }, + /* 4435 */ { MAD_F(0x047287ef) /* 0.277961669 */, 18 }, + /* 4436 */ { MAD_F(0x0472df90) /* 0.278045238 */, 18 }, + /* 4437 */ { MAD_F(0x04733733) /* 0.278128813 */, 18 }, + /* 4438 */ { MAD_F(0x04738ed7) /* 0.278212395 */, 18 }, + /* 4439 */ { MAD_F(0x0473e67d) /* 0.278295983 */, 18 }, + /* 4440 */ { MAD_F(0x04743e25) /* 0.278379578 */, 18 }, + /* 4441 */ { MAD_F(0x047495ce) /* 0.278463178 */, 18 }, + /* 4442 */ { MAD_F(0x0474ed79) /* 0.278546785 */, 18 }, + /* 4443 */ { MAD_F(0x04754526) /* 0.278630398 */, 18 }, + /* 4444 */ { MAD_F(0x04759cd4) /* 0.278714018 */, 18 }, + /* 4445 */ { MAD_F(0x0475f484) /* 0.278797643 */, 18 }, + /* 4446 */ { MAD_F(0x04764c36) /* 0.278881275 */, 18 }, + /* 4447 */ { MAD_F(0x0476a3ea) /* 0.278964914 */, 18 }, + + /* 4448 */ { MAD_F(0x0476fb9f) /* 0.279048558 */, 18 }, + /* 4449 */ { MAD_F(0x04775356) /* 0.279132209 */, 18 }, + /* 4450 */ { MAD_F(0x0477ab0e) /* 0.279215866 */, 18 }, + /* 4451 */ { MAD_F(0x047802c8) /* 0.279299529 */, 18 }, + /* 4452 */ { MAD_F(0x04785a84) /* 0.279383199 */, 18 }, + /* 4453 */ { MAD_F(0x0478b242) /* 0.279466875 */, 18 }, + /* 4454 */ { MAD_F(0x04790a01) /* 0.279550557 */, 18 }, + /* 4455 */ { MAD_F(0x047961c2) /* 0.279634245 */, 18 }, + /* 4456 */ { MAD_F(0x0479b984) /* 0.279717940 */, 18 }, + /* 4457 */ { MAD_F(0x047a1149) /* 0.279801641 */, 18 }, + /* 4458 */ { MAD_F(0x047a690f) /* 0.279885348 */, 18 }, + /* 4459 */ { MAD_F(0x047ac0d6) /* 0.279969061 */, 18 }, + /* 4460 */ { MAD_F(0x047b18a0) /* 0.280052781 */, 18 }, + /* 4461 */ { MAD_F(0x047b706b) /* 0.280136507 */, 18 }, + /* 4462 */ { MAD_F(0x047bc837) /* 0.280220239 */, 18 }, + /* 4463 */ { MAD_F(0x047c2006) /* 0.280303978 */, 18 }, + + /* 4464 */ { MAD_F(0x047c77d6) /* 0.280387722 */, 18 }, + /* 4465 */ { MAD_F(0x047ccfa8) /* 0.280471473 */, 18 }, + /* 4466 */ { MAD_F(0x047d277b) /* 0.280555230 */, 18 }, + /* 4467 */ { MAD_F(0x047d7f50) /* 0.280638994 */, 18 }, + /* 4468 */ { MAD_F(0x047dd727) /* 0.280722764 */, 18 }, + /* 4469 */ { MAD_F(0x047e2eff) /* 0.280806540 */, 18 }, + /* 4470 */ { MAD_F(0x047e86d9) /* 0.280890322 */, 18 }, + /* 4471 */ { MAD_F(0x047edeb5) /* 0.280974110 */, 18 }, + /* 4472 */ { MAD_F(0x047f3693) /* 0.281057905 */, 18 }, + /* 4473 */ { MAD_F(0x047f8e72) /* 0.281141706 */, 18 }, + /* 4474 */ { MAD_F(0x047fe653) /* 0.281225513 */, 18 }, + /* 4475 */ { MAD_F(0x04803e35) /* 0.281309326 */, 18 }, + /* 4476 */ { MAD_F(0x04809619) /* 0.281393146 */, 18 }, + /* 4477 */ { MAD_F(0x0480edff) /* 0.281476972 */, 18 }, + /* 4478 */ { MAD_F(0x048145e7) /* 0.281560804 */, 18 }, + /* 4479 */ { MAD_F(0x04819dd0) /* 0.281644643 */, 18 }, + + /* 4480 */ { MAD_F(0x0481f5bb) /* 0.281728487 */, 18 }, + /* 4481 */ { MAD_F(0x04824da7) /* 0.281812338 */, 18 }, + /* 4482 */ { MAD_F(0x0482a595) /* 0.281896195 */, 18 }, + /* 4483 */ { MAD_F(0x0482fd85) /* 0.281980059 */, 18 }, + /* 4484 */ { MAD_F(0x04835577) /* 0.282063928 */, 18 }, + /* 4485 */ { MAD_F(0x0483ad6a) /* 0.282147804 */, 18 }, + /* 4486 */ { MAD_F(0x0484055f) /* 0.282231686 */, 18 }, + /* 4487 */ { MAD_F(0x04845d56) /* 0.282315574 */, 18 }, + /* 4488 */ { MAD_F(0x0484b54e) /* 0.282399469 */, 18 }, + /* 4489 */ { MAD_F(0x04850d48) /* 0.282483370 */, 18 }, + /* 4490 */ { MAD_F(0x04856544) /* 0.282567277 */, 18 }, + /* 4491 */ { MAD_F(0x0485bd41) /* 0.282651190 */, 18 }, + /* 4492 */ { MAD_F(0x04861540) /* 0.282735109 */, 18 }, + /* 4493 */ { MAD_F(0x04866d40) /* 0.282819035 */, 18 }, + /* 4494 */ { MAD_F(0x0486c543) /* 0.282902967 */, 18 }, + /* 4495 */ { MAD_F(0x04871d47) /* 0.282986905 */, 18 }, + + /* 4496 */ { MAD_F(0x0487754c) /* 0.283070849 */, 18 }, + /* 4497 */ { MAD_F(0x0487cd54) /* 0.283154800 */, 18 }, + /* 4498 */ { MAD_F(0x0488255d) /* 0.283238757 */, 18 }, + /* 4499 */ { MAD_F(0x04887d67) /* 0.283322720 */, 18 }, + /* 4500 */ { MAD_F(0x0488d574) /* 0.283406689 */, 18 }, + /* 4501 */ { MAD_F(0x04892d82) /* 0.283490665 */, 18 }, + /* 4502 */ { MAD_F(0x04898591) /* 0.283574646 */, 18 }, + /* 4503 */ { MAD_F(0x0489dda3) /* 0.283658634 */, 18 }, + /* 4504 */ { MAD_F(0x048a35b6) /* 0.283742628 */, 18 }, + /* 4505 */ { MAD_F(0x048a8dca) /* 0.283826629 */, 18 }, + /* 4506 */ { MAD_F(0x048ae5e1) /* 0.283910635 */, 18 }, + /* 4507 */ { MAD_F(0x048b3df9) /* 0.283994648 */, 18 }, + /* 4508 */ { MAD_F(0x048b9612) /* 0.284078667 */, 18 }, + /* 4509 */ { MAD_F(0x048bee2e) /* 0.284162692 */, 18 }, + /* 4510 */ { MAD_F(0x048c464b) /* 0.284246723 */, 18 }, + /* 4511 */ { MAD_F(0x048c9e69) /* 0.284330761 */, 18 }, + + /* 4512 */ { MAD_F(0x048cf68a) /* 0.284414805 */, 18 }, + /* 4513 */ { MAD_F(0x048d4eac) /* 0.284498855 */, 18 }, + /* 4514 */ { MAD_F(0x048da6cf) /* 0.284582911 */, 18 }, + /* 4515 */ { MAD_F(0x048dfef5) /* 0.284666974 */, 18 }, + /* 4516 */ { MAD_F(0x048e571c) /* 0.284751042 */, 18 }, + /* 4517 */ { MAD_F(0x048eaf44) /* 0.284835117 */, 18 }, + /* 4518 */ { MAD_F(0x048f076f) /* 0.284919198 */, 18 }, + /* 4519 */ { MAD_F(0x048f5f9b) /* 0.285003285 */, 18 }, + /* 4520 */ { MAD_F(0x048fb7c8) /* 0.285087379 */, 18 }, + /* 4521 */ { MAD_F(0x04900ff8) /* 0.285171479 */, 18 }, + /* 4522 */ { MAD_F(0x04906829) /* 0.285255584 */, 18 }, + /* 4523 */ { MAD_F(0x0490c05b) /* 0.285339697 */, 18 }, + /* 4524 */ { MAD_F(0x04911890) /* 0.285423815 */, 18 }, + /* 4525 */ { MAD_F(0x049170c6) /* 0.285507939 */, 18 }, + /* 4526 */ { MAD_F(0x0491c8fd) /* 0.285592070 */, 18 }, + /* 4527 */ { MAD_F(0x04922137) /* 0.285676207 */, 18 }, + + /* 4528 */ { MAD_F(0x04927972) /* 0.285760350 */, 18 }, + /* 4529 */ { MAD_F(0x0492d1ae) /* 0.285844499 */, 18 }, + /* 4530 */ { MAD_F(0x049329ed) /* 0.285928655 */, 18 }, + /* 4531 */ { MAD_F(0x0493822c) /* 0.286012816 */, 18 }, + /* 4532 */ { MAD_F(0x0493da6e) /* 0.286096984 */, 18 }, + /* 4533 */ { MAD_F(0x049432b1) /* 0.286181158 */, 18 }, + /* 4534 */ { MAD_F(0x04948af6) /* 0.286265338 */, 18 }, + /* 4535 */ { MAD_F(0x0494e33d) /* 0.286349525 */, 18 }, + /* 4536 */ { MAD_F(0x04953b85) /* 0.286433717 */, 18 }, + /* 4537 */ { MAD_F(0x049593cf) /* 0.286517916 */, 18 }, + /* 4538 */ { MAD_F(0x0495ec1b) /* 0.286602121 */, 18 }, + /* 4539 */ { MAD_F(0x04964468) /* 0.286686332 */, 18 }, + /* 4540 */ { MAD_F(0x04969cb7) /* 0.286770550 */, 18 }, + /* 4541 */ { MAD_F(0x0496f508) /* 0.286854773 */, 18 }, + /* 4542 */ { MAD_F(0x04974d5a) /* 0.286939003 */, 18 }, + /* 4543 */ { MAD_F(0x0497a5ae) /* 0.287023239 */, 18 }, + + /* 4544 */ { MAD_F(0x0497fe03) /* 0.287107481 */, 18 }, + /* 4545 */ { MAD_F(0x0498565a) /* 0.287191729 */, 18 }, + /* 4546 */ { MAD_F(0x0498aeb3) /* 0.287275983 */, 18 }, + /* 4547 */ { MAD_F(0x0499070e) /* 0.287360244 */, 18 }, + /* 4548 */ { MAD_F(0x04995f6a) /* 0.287444511 */, 18 }, + /* 4549 */ { MAD_F(0x0499b7c8) /* 0.287528784 */, 18 }, + /* 4550 */ { MAD_F(0x049a1027) /* 0.287613063 */, 18 }, + /* 4551 */ { MAD_F(0x049a6889) /* 0.287697348 */, 18 }, + /* 4552 */ { MAD_F(0x049ac0eb) /* 0.287781640 */, 18 }, + /* 4553 */ { MAD_F(0x049b1950) /* 0.287865937 */, 18 }, + /* 4554 */ { MAD_F(0x049b71b6) /* 0.287950241 */, 18 }, + /* 4555 */ { MAD_F(0x049bca1e) /* 0.288034551 */, 18 }, + /* 4556 */ { MAD_F(0x049c2287) /* 0.288118867 */, 18 }, + /* 4557 */ { MAD_F(0x049c7af2) /* 0.288203190 */, 18 }, + /* 4558 */ { MAD_F(0x049cd35f) /* 0.288287518 */, 18 }, + /* 4559 */ { MAD_F(0x049d2bce) /* 0.288371853 */, 18 }, + + /* 4560 */ { MAD_F(0x049d843e) /* 0.288456194 */, 18 }, + /* 4561 */ { MAD_F(0x049ddcaf) /* 0.288540541 */, 18 }, + /* 4562 */ { MAD_F(0x049e3523) /* 0.288624894 */, 18 }, + /* 4563 */ { MAD_F(0x049e8d98) /* 0.288709253 */, 18 }, + /* 4564 */ { MAD_F(0x049ee60e) /* 0.288793619 */, 18 }, + /* 4565 */ { MAD_F(0x049f3e87) /* 0.288877990 */, 18 }, + /* 4566 */ { MAD_F(0x049f9701) /* 0.288962368 */, 18 }, + /* 4567 */ { MAD_F(0x049fef7c) /* 0.289046752 */, 18 }, + /* 4568 */ { MAD_F(0x04a047fa) /* 0.289131142 */, 18 }, + /* 4569 */ { MAD_F(0x04a0a079) /* 0.289215538 */, 18 }, + /* 4570 */ { MAD_F(0x04a0f8f9) /* 0.289299941 */, 18 }, + /* 4571 */ { MAD_F(0x04a1517c) /* 0.289384349 */, 18 }, + /* 4572 */ { MAD_F(0x04a1a9ff) /* 0.289468764 */, 18 }, + /* 4573 */ { MAD_F(0x04a20285) /* 0.289553185 */, 18 }, + /* 4574 */ { MAD_F(0x04a25b0c) /* 0.289637612 */, 18 }, + /* 4575 */ { MAD_F(0x04a2b395) /* 0.289722045 */, 18 }, + + /* 4576 */ { MAD_F(0x04a30c20) /* 0.289806485 */, 18 }, + /* 4577 */ { MAD_F(0x04a364ac) /* 0.289890930 */, 18 }, + /* 4578 */ { MAD_F(0x04a3bd3a) /* 0.289975382 */, 18 }, + /* 4579 */ { MAD_F(0x04a415c9) /* 0.290059840 */, 18 }, + /* 4580 */ { MAD_F(0x04a46e5a) /* 0.290144304 */, 18 }, + /* 4581 */ { MAD_F(0x04a4c6ed) /* 0.290228774 */, 18 }, + /* 4582 */ { MAD_F(0x04a51f81) /* 0.290313250 */, 18 }, + /* 4583 */ { MAD_F(0x04a57818) /* 0.290397733 */, 18 }, + /* 4584 */ { MAD_F(0x04a5d0af) /* 0.290482221 */, 18 }, + /* 4585 */ { MAD_F(0x04a62949) /* 0.290566716 */, 18 }, + /* 4586 */ { MAD_F(0x04a681e4) /* 0.290651217 */, 18 }, + /* 4587 */ { MAD_F(0x04a6da80) /* 0.290735724 */, 18 }, + /* 4588 */ { MAD_F(0x04a7331f) /* 0.290820237 */, 18 }, + /* 4589 */ { MAD_F(0x04a78bbf) /* 0.290904756 */, 18 }, + /* 4590 */ { MAD_F(0x04a7e460) /* 0.290989281 */, 18 }, + /* 4591 */ { MAD_F(0x04a83d03) /* 0.291073813 */, 18 }, + + /* 4592 */ { MAD_F(0x04a895a8) /* 0.291158351 */, 18 }, + /* 4593 */ { MAD_F(0x04a8ee4f) /* 0.291242894 */, 18 }, + /* 4594 */ { MAD_F(0x04a946f7) /* 0.291327444 */, 18 }, + /* 4595 */ { MAD_F(0x04a99fa1) /* 0.291412001 */, 18 }, + /* 4596 */ { MAD_F(0x04a9f84c) /* 0.291496563 */, 18 }, + /* 4597 */ { MAD_F(0x04aa50fa) /* 0.291581131 */, 18 }, + /* 4598 */ { MAD_F(0x04aaa9a8) /* 0.291665706 */, 18 }, + /* 4599 */ { MAD_F(0x04ab0259) /* 0.291750286 */, 18 }, + /* 4600 */ { MAD_F(0x04ab5b0b) /* 0.291834873 */, 18 }, + /* 4601 */ { MAD_F(0x04abb3bf) /* 0.291919466 */, 18 }, + /* 4602 */ { MAD_F(0x04ac0c74) /* 0.292004065 */, 18 }, + /* 4603 */ { MAD_F(0x04ac652b) /* 0.292088670 */, 18 }, + /* 4604 */ { MAD_F(0x04acbde4) /* 0.292173281 */, 18 }, + /* 4605 */ { MAD_F(0x04ad169e) /* 0.292257899 */, 18 }, + /* 4606 */ { MAD_F(0x04ad6f5a) /* 0.292342522 */, 18 }, + /* 4607 */ { MAD_F(0x04adc818) /* 0.292427152 */, 18 }, + + /* 4608 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 18 }, + /* 4609 */ { MAD_F(0x04ae7998) /* 0.292596430 */, 18 }, + /* 4610 */ { MAD_F(0x04aed25a) /* 0.292681078 */, 18 }, + /* 4611 */ { MAD_F(0x04af2b1e) /* 0.292765732 */, 18 }, + /* 4612 */ { MAD_F(0x04af83e4) /* 0.292850392 */, 18 }, + /* 4613 */ { MAD_F(0x04afdcac) /* 0.292935058 */, 18 }, + /* 4614 */ { MAD_F(0x04b03575) /* 0.293019731 */, 18 }, + /* 4615 */ { MAD_F(0x04b08e40) /* 0.293104409 */, 18 }, + /* 4616 */ { MAD_F(0x04b0e70c) /* 0.293189094 */, 18 }, + /* 4617 */ { MAD_F(0x04b13fda) /* 0.293273785 */, 18 }, + /* 4618 */ { MAD_F(0x04b198aa) /* 0.293358482 */, 18 }, + /* 4619 */ { MAD_F(0x04b1f17b) /* 0.293443185 */, 18 }, + /* 4620 */ { MAD_F(0x04b24a4e) /* 0.293527894 */, 18 }, + /* 4621 */ { MAD_F(0x04b2a322) /* 0.293612609 */, 18 }, + /* 4622 */ { MAD_F(0x04b2fbf9) /* 0.293697331 */, 18 }, + /* 4623 */ { MAD_F(0x04b354d1) /* 0.293782058 */, 18 }, + + /* 4624 */ { MAD_F(0x04b3adaa) /* 0.293866792 */, 18 }, + /* 4625 */ { MAD_F(0x04b40685) /* 0.293951532 */, 18 }, + /* 4626 */ { MAD_F(0x04b45f62) /* 0.294036278 */, 18 }, + /* 4627 */ { MAD_F(0x04b4b840) /* 0.294121029 */, 18 }, + /* 4628 */ { MAD_F(0x04b51120) /* 0.294205788 */, 18 }, + /* 4629 */ { MAD_F(0x04b56a02) /* 0.294290552 */, 18 }, + /* 4630 */ { MAD_F(0x04b5c2e6) /* 0.294375322 */, 18 }, + /* 4631 */ { MAD_F(0x04b61bcb) /* 0.294460098 */, 18 }, + /* 4632 */ { MAD_F(0x04b674b1) /* 0.294544881 */, 18 }, + /* 4633 */ { MAD_F(0x04b6cd99) /* 0.294629669 */, 18 }, + /* 4634 */ { MAD_F(0x04b72683) /* 0.294714464 */, 18 }, + /* 4635 */ { MAD_F(0x04b77f6f) /* 0.294799265 */, 18 }, + /* 4636 */ { MAD_F(0x04b7d85c) /* 0.294884072 */, 18 }, + /* 4637 */ { MAD_F(0x04b8314b) /* 0.294968885 */, 18 }, + /* 4638 */ { MAD_F(0x04b88a3b) /* 0.295053704 */, 18 }, + /* 4639 */ { MAD_F(0x04b8e32d) /* 0.295138529 */, 18 }, + + /* 4640 */ { MAD_F(0x04b93c21) /* 0.295223360 */, 18 }, + /* 4641 */ { MAD_F(0x04b99516) /* 0.295308197 */, 18 }, + /* 4642 */ { MAD_F(0x04b9ee0d) /* 0.295393041 */, 18 }, + /* 4643 */ { MAD_F(0x04ba4706) /* 0.295477890 */, 18 }, + /* 4644 */ { MAD_F(0x04baa000) /* 0.295562746 */, 18 }, + /* 4645 */ { MAD_F(0x04baf8fc) /* 0.295647608 */, 18 }, + /* 4646 */ { MAD_F(0x04bb51fa) /* 0.295732476 */, 18 }, + /* 4647 */ { MAD_F(0x04bbaaf9) /* 0.295817349 */, 18 }, + /* 4648 */ { MAD_F(0x04bc03fa) /* 0.295902229 */, 18 }, + /* 4649 */ { MAD_F(0x04bc5cfc) /* 0.295987115 */, 18 }, + /* 4650 */ { MAD_F(0x04bcb600) /* 0.296072008 */, 18 }, + /* 4651 */ { MAD_F(0x04bd0f06) /* 0.296156906 */, 18 }, + /* 4652 */ { MAD_F(0x04bd680d) /* 0.296241810 */, 18 }, + /* 4653 */ { MAD_F(0x04bdc116) /* 0.296326721 */, 18 }, + /* 4654 */ { MAD_F(0x04be1a21) /* 0.296411637 */, 18 }, + /* 4655 */ { MAD_F(0x04be732d) /* 0.296496560 */, 18 }, + + /* 4656 */ { MAD_F(0x04becc3b) /* 0.296581488 */, 18 }, + /* 4657 */ { MAD_F(0x04bf254a) /* 0.296666423 */, 18 }, + /* 4658 */ { MAD_F(0x04bf7e5b) /* 0.296751364 */, 18 }, + /* 4659 */ { MAD_F(0x04bfd76e) /* 0.296836311 */, 18 }, + /* 4660 */ { MAD_F(0x04c03083) /* 0.296921264 */, 18 }, + /* 4661 */ { MAD_F(0x04c08999) /* 0.297006223 */, 18 }, + /* 4662 */ { MAD_F(0x04c0e2b0) /* 0.297091188 */, 18 }, + /* 4663 */ { MAD_F(0x04c13bca) /* 0.297176159 */, 18 }, + /* 4664 */ { MAD_F(0x04c194e4) /* 0.297261136 */, 18 }, + /* 4665 */ { MAD_F(0x04c1ee01) /* 0.297346120 */, 18 }, + /* 4666 */ { MAD_F(0x04c2471f) /* 0.297431109 */, 18 }, + /* 4667 */ { MAD_F(0x04c2a03f) /* 0.297516105 */, 18 }, + /* 4668 */ { MAD_F(0x04c2f960) /* 0.297601106 */, 18 }, + /* 4669 */ { MAD_F(0x04c35283) /* 0.297686114 */, 18 }, + /* 4670 */ { MAD_F(0x04c3aba8) /* 0.297771128 */, 18 }, + /* 4671 */ { MAD_F(0x04c404ce) /* 0.297856147 */, 18 }, + + /* 4672 */ { MAD_F(0x04c45df6) /* 0.297941173 */, 18 }, + /* 4673 */ { MAD_F(0x04c4b720) /* 0.298026205 */, 18 }, + /* 4674 */ { MAD_F(0x04c5104b) /* 0.298111243 */, 18 }, + /* 4675 */ { MAD_F(0x04c56978) /* 0.298196287 */, 18 }, + /* 4676 */ { MAD_F(0x04c5c2a7) /* 0.298281337 */, 18 }, + /* 4677 */ { MAD_F(0x04c61bd7) /* 0.298366393 */, 18 }, + /* 4678 */ { MAD_F(0x04c67508) /* 0.298451456 */, 18 }, + /* 4679 */ { MAD_F(0x04c6ce3c) /* 0.298536524 */, 18 }, + /* 4680 */ { MAD_F(0x04c72771) /* 0.298621598 */, 18 }, + /* 4681 */ { MAD_F(0x04c780a7) /* 0.298706679 */, 18 }, + /* 4682 */ { MAD_F(0x04c7d9df) /* 0.298791765 */, 18 }, + /* 4683 */ { MAD_F(0x04c83319) /* 0.298876858 */, 18 }, + /* 4684 */ { MAD_F(0x04c88c55) /* 0.298961956 */, 18 }, + /* 4685 */ { MAD_F(0x04c8e592) /* 0.299047061 */, 18 }, + /* 4686 */ { MAD_F(0x04c93ed1) /* 0.299132172 */, 18 }, + /* 4687 */ { MAD_F(0x04c99811) /* 0.299217288 */, 18 }, + + /* 4688 */ { MAD_F(0x04c9f153) /* 0.299302411 */, 18 }, + /* 4689 */ { MAD_F(0x04ca4a97) /* 0.299387540 */, 18 }, + /* 4690 */ { MAD_F(0x04caa3dc) /* 0.299472675 */, 18 }, + /* 4691 */ { MAD_F(0x04cafd23) /* 0.299557816 */, 18 }, + /* 4692 */ { MAD_F(0x04cb566b) /* 0.299642963 */, 18 }, + /* 4693 */ { MAD_F(0x04cbafb5) /* 0.299728116 */, 18 }, + /* 4694 */ { MAD_F(0x04cc0901) /* 0.299813275 */, 18 }, + /* 4695 */ { MAD_F(0x04cc624e) /* 0.299898440 */, 18 }, + /* 4696 */ { MAD_F(0x04ccbb9d) /* 0.299983611 */, 18 }, + /* 4697 */ { MAD_F(0x04cd14ee) /* 0.300068789 */, 18 }, + /* 4698 */ { MAD_F(0x04cd6e40) /* 0.300153972 */, 18 }, + /* 4699 */ { MAD_F(0x04cdc794) /* 0.300239161 */, 18 }, + /* 4700 */ { MAD_F(0x04ce20e9) /* 0.300324357 */, 18 }, + /* 4701 */ { MAD_F(0x04ce7a40) /* 0.300409558 */, 18 }, + /* 4702 */ { MAD_F(0x04ced399) /* 0.300494765 */, 18 }, + /* 4703 */ { MAD_F(0x04cf2cf3) /* 0.300579979 */, 18 }, + + /* 4704 */ { MAD_F(0x04cf864f) /* 0.300665198 */, 18 }, + /* 4705 */ { MAD_F(0x04cfdfad) /* 0.300750424 */, 18 }, + /* 4706 */ { MAD_F(0x04d0390c) /* 0.300835656 */, 18 }, + /* 4707 */ { MAD_F(0x04d0926d) /* 0.300920893 */, 18 }, + /* 4708 */ { MAD_F(0x04d0ebcf) /* 0.301006137 */, 18 }, + /* 4709 */ { MAD_F(0x04d14533) /* 0.301091387 */, 18 }, + /* 4710 */ { MAD_F(0x04d19e99) /* 0.301176643 */, 18 }, + /* 4711 */ { MAD_F(0x04d1f800) /* 0.301261904 */, 18 }, + /* 4712 */ { MAD_F(0x04d25169) /* 0.301347172 */, 18 }, + /* 4713 */ { MAD_F(0x04d2aad4) /* 0.301432446 */, 18 }, + /* 4714 */ { MAD_F(0x04d30440) /* 0.301517726 */, 18 }, + /* 4715 */ { MAD_F(0x04d35dae) /* 0.301603012 */, 18 }, + /* 4716 */ { MAD_F(0x04d3b71d) /* 0.301688304 */, 18 }, + /* 4717 */ { MAD_F(0x04d4108e) /* 0.301773602 */, 18 }, + /* 4718 */ { MAD_F(0x04d46a01) /* 0.301858906 */, 18 }, + /* 4719 */ { MAD_F(0x04d4c375) /* 0.301944216 */, 18 }, + + /* 4720 */ { MAD_F(0x04d51ceb) /* 0.302029532 */, 18 }, + /* 4721 */ { MAD_F(0x04d57662) /* 0.302114854 */, 18 }, + /* 4722 */ { MAD_F(0x04d5cfdb) /* 0.302200182 */, 18 }, + /* 4723 */ { MAD_F(0x04d62956) /* 0.302285516 */, 18 }, + /* 4724 */ { MAD_F(0x04d682d2) /* 0.302370856 */, 18 }, + /* 4725 */ { MAD_F(0x04d6dc50) /* 0.302456203 */, 18 }, + /* 4726 */ { MAD_F(0x04d735d0) /* 0.302541555 */, 18 }, + /* 4727 */ { MAD_F(0x04d78f51) /* 0.302626913 */, 18 }, + /* 4728 */ { MAD_F(0x04d7e8d4) /* 0.302712277 */, 18 }, + /* 4729 */ { MAD_F(0x04d84258) /* 0.302797648 */, 18 }, + /* 4730 */ { MAD_F(0x04d89bde) /* 0.302883024 */, 18 }, + /* 4731 */ { MAD_F(0x04d8f566) /* 0.302968406 */, 18 }, + /* 4732 */ { MAD_F(0x04d94eef) /* 0.303053794 */, 18 }, + /* 4733 */ { MAD_F(0x04d9a87a) /* 0.303139189 */, 18 }, + /* 4734 */ { MAD_F(0x04da0207) /* 0.303224589 */, 18 }, + /* 4735 */ { MAD_F(0x04da5b95) /* 0.303309995 */, 18 }, + + /* 4736 */ { MAD_F(0x04dab524) /* 0.303395408 */, 18 }, + /* 4737 */ { MAD_F(0x04db0eb6) /* 0.303480826 */, 18 }, + /* 4738 */ { MAD_F(0x04db6849) /* 0.303566251 */, 18 }, + /* 4739 */ { MAD_F(0x04dbc1dd) /* 0.303651681 */, 18 }, + /* 4740 */ { MAD_F(0x04dc1b73) /* 0.303737117 */, 18 }, + /* 4741 */ { MAD_F(0x04dc750b) /* 0.303822560 */, 18 }, + /* 4742 */ { MAD_F(0x04dccea5) /* 0.303908008 */, 18 }, + /* 4743 */ { MAD_F(0x04dd2840) /* 0.303993463 */, 18 }, + /* 4744 */ { MAD_F(0x04dd81dc) /* 0.304078923 */, 18 }, + /* 4745 */ { MAD_F(0x04dddb7a) /* 0.304164390 */, 18 }, + /* 4746 */ { MAD_F(0x04de351a) /* 0.304249862 */, 18 }, + /* 4747 */ { MAD_F(0x04de8ebc) /* 0.304335340 */, 18 }, + /* 4748 */ { MAD_F(0x04dee85f) /* 0.304420825 */, 18 }, + /* 4749 */ { MAD_F(0x04df4203) /* 0.304506315 */, 18 }, + /* 4750 */ { MAD_F(0x04df9baa) /* 0.304591812 */, 18 }, + /* 4751 */ { MAD_F(0x04dff552) /* 0.304677314 */, 18 }, + + /* 4752 */ { MAD_F(0x04e04efb) /* 0.304762823 */, 18 }, + /* 4753 */ { MAD_F(0x04e0a8a6) /* 0.304848337 */, 18 }, + /* 4754 */ { MAD_F(0x04e10253) /* 0.304933858 */, 18 }, + /* 4755 */ { MAD_F(0x04e15c01) /* 0.305019384 */, 18 }, + /* 4756 */ { MAD_F(0x04e1b5b1) /* 0.305104917 */, 18 }, + /* 4757 */ { MAD_F(0x04e20f63) /* 0.305190455 */, 18 }, + /* 4758 */ { MAD_F(0x04e26916) /* 0.305275999 */, 18 }, + /* 4759 */ { MAD_F(0x04e2c2cb) /* 0.305361550 */, 18 }, + /* 4760 */ { MAD_F(0x04e31c81) /* 0.305447106 */, 18 }, + /* 4761 */ { MAD_F(0x04e37639) /* 0.305532669 */, 18 }, + /* 4762 */ { MAD_F(0x04e3cff3) /* 0.305618237 */, 18 }, + /* 4763 */ { MAD_F(0x04e429ae) /* 0.305703811 */, 18 }, + /* 4764 */ { MAD_F(0x04e4836b) /* 0.305789392 */, 18 }, + /* 4765 */ { MAD_F(0x04e4dd29) /* 0.305874978 */, 18 }, + /* 4766 */ { MAD_F(0x04e536e9) /* 0.305960571 */, 18 }, + /* 4767 */ { MAD_F(0x04e590ab) /* 0.306046169 */, 18 }, + + /* 4768 */ { MAD_F(0x04e5ea6e) /* 0.306131773 */, 18 }, + /* 4769 */ { MAD_F(0x04e64433) /* 0.306217383 */, 18 }, + /* 4770 */ { MAD_F(0x04e69df9) /* 0.306303000 */, 18 }, + /* 4771 */ { MAD_F(0x04e6f7c1) /* 0.306388622 */, 18 }, + /* 4772 */ { MAD_F(0x04e7518b) /* 0.306474250 */, 18 }, + /* 4773 */ { MAD_F(0x04e7ab56) /* 0.306559885 */, 18 }, + /* 4774 */ { MAD_F(0x04e80523) /* 0.306645525 */, 18 }, + /* 4775 */ { MAD_F(0x04e85ef2) /* 0.306731171 */, 18 }, + /* 4776 */ { MAD_F(0x04e8b8c2) /* 0.306816823 */, 18 }, + /* 4777 */ { MAD_F(0x04e91293) /* 0.306902481 */, 18 }, + /* 4778 */ { MAD_F(0x04e96c67) /* 0.306988145 */, 18 }, + /* 4779 */ { MAD_F(0x04e9c63b) /* 0.307073816 */, 18 }, + /* 4780 */ { MAD_F(0x04ea2012) /* 0.307159492 */, 18 }, + /* 4781 */ { MAD_F(0x04ea79ea) /* 0.307245174 */, 18 }, + /* 4782 */ { MAD_F(0x04ead3c4) /* 0.307330862 */, 18 }, + /* 4783 */ { MAD_F(0x04eb2d9f) /* 0.307416556 */, 18 }, + + /* 4784 */ { MAD_F(0x04eb877c) /* 0.307502256 */, 18 }, + /* 4785 */ { MAD_F(0x04ebe15b) /* 0.307587962 */, 18 }, + /* 4786 */ { MAD_F(0x04ec3b3b) /* 0.307673674 */, 18 }, + /* 4787 */ { MAD_F(0x04ec951c) /* 0.307759392 */, 18 }, + /* 4788 */ { MAD_F(0x04ecef00) /* 0.307845115 */, 18 }, + /* 4789 */ { MAD_F(0x04ed48e5) /* 0.307930845 */, 18 }, + /* 4790 */ { MAD_F(0x04eda2cb) /* 0.308016581 */, 18 }, + /* 4791 */ { MAD_F(0x04edfcb3) /* 0.308102323 */, 18 }, + /* 4792 */ { MAD_F(0x04ee569d) /* 0.308188071 */, 18 }, + /* 4793 */ { MAD_F(0x04eeb088) /* 0.308273824 */, 18 }, + /* 4794 */ { MAD_F(0x04ef0a75) /* 0.308359584 */, 18 }, + /* 4795 */ { MAD_F(0x04ef6464) /* 0.308445350 */, 18 }, + /* 4796 */ { MAD_F(0x04efbe54) /* 0.308531121 */, 18 }, + /* 4797 */ { MAD_F(0x04f01846) /* 0.308616899 */, 18 }, + /* 4798 */ { MAD_F(0x04f07239) /* 0.308702682 */, 18 }, + /* 4799 */ { MAD_F(0x04f0cc2e) /* 0.308788472 */, 18 }, + + /* 4800 */ { MAD_F(0x04f12624) /* 0.308874267 */, 18 }, + /* 4801 */ { MAD_F(0x04f1801d) /* 0.308960068 */, 18 }, + /* 4802 */ { MAD_F(0x04f1da16) /* 0.309045876 */, 18 }, + /* 4803 */ { MAD_F(0x04f23412) /* 0.309131689 */, 18 }, + /* 4804 */ { MAD_F(0x04f28e0f) /* 0.309217508 */, 18 }, + /* 4805 */ { MAD_F(0x04f2e80d) /* 0.309303334 */, 18 }, + /* 4806 */ { MAD_F(0x04f3420d) /* 0.309389165 */, 18 }, + /* 4807 */ { MAD_F(0x04f39c0f) /* 0.309475002 */, 18 }, + /* 4808 */ { MAD_F(0x04f3f612) /* 0.309560845 */, 18 }, + /* 4809 */ { MAD_F(0x04f45017) /* 0.309646694 */, 18 }, + /* 4810 */ { MAD_F(0x04f4aa1e) /* 0.309732549 */, 18 }, + /* 4811 */ { MAD_F(0x04f50426) /* 0.309818410 */, 18 }, + /* 4812 */ { MAD_F(0x04f55e30) /* 0.309904277 */, 18 }, + /* 4813 */ { MAD_F(0x04f5b83b) /* 0.309990150 */, 18 }, + /* 4814 */ { MAD_F(0x04f61248) /* 0.310076028 */, 18 }, + /* 4815 */ { MAD_F(0x04f66c56) /* 0.310161913 */, 18 }, + + /* 4816 */ { MAD_F(0x04f6c666) /* 0.310247804 */, 18 }, + /* 4817 */ { MAD_F(0x04f72078) /* 0.310333700 */, 18 }, + /* 4818 */ { MAD_F(0x04f77a8b) /* 0.310419603 */, 18 }, + /* 4819 */ { MAD_F(0x04f7d4a0) /* 0.310505511 */, 18 }, + /* 4820 */ { MAD_F(0x04f82eb7) /* 0.310591426 */, 18 }, + /* 4821 */ { MAD_F(0x04f888cf) /* 0.310677346 */, 18 }, + /* 4822 */ { MAD_F(0x04f8e2e9) /* 0.310763272 */, 18 }, + /* 4823 */ { MAD_F(0x04f93d04) /* 0.310849205 */, 18 }, + /* 4824 */ { MAD_F(0x04f99721) /* 0.310935143 */, 18 }, + /* 4825 */ { MAD_F(0x04f9f13f) /* 0.311021087 */, 18 }, + /* 4826 */ { MAD_F(0x04fa4b5f) /* 0.311107037 */, 18 }, + /* 4827 */ { MAD_F(0x04faa581) /* 0.311192993 */, 18 }, + /* 4828 */ { MAD_F(0x04faffa4) /* 0.311278955 */, 18 }, + /* 4829 */ { MAD_F(0x04fb59c9) /* 0.311364923 */, 18 }, + /* 4830 */ { MAD_F(0x04fbb3ef) /* 0.311450897 */, 18 }, + /* 4831 */ { MAD_F(0x04fc0e17) /* 0.311536877 */, 18 }, + + /* 4832 */ { MAD_F(0x04fc6841) /* 0.311622862 */, 18 }, + /* 4833 */ { MAD_F(0x04fcc26c) /* 0.311708854 */, 18 }, + /* 4834 */ { MAD_F(0x04fd1c99) /* 0.311794851 */, 18 }, + /* 4835 */ { MAD_F(0x04fd76c7) /* 0.311880855 */, 18 }, + /* 4836 */ { MAD_F(0x04fdd0f7) /* 0.311966864 */, 18 }, + /* 4837 */ { MAD_F(0x04fe2b29) /* 0.312052880 */, 18 }, + /* 4838 */ { MAD_F(0x04fe855c) /* 0.312138901 */, 18 }, + /* 4839 */ { MAD_F(0x04fedf91) /* 0.312224928 */, 18 }, + /* 4840 */ { MAD_F(0x04ff39c7) /* 0.312310961 */, 18 }, + /* 4841 */ { MAD_F(0x04ff93ff) /* 0.312397000 */, 18 }, + /* 4842 */ { MAD_F(0x04ffee38) /* 0.312483045 */, 18 }, + /* 4843 */ { MAD_F(0x05004874) /* 0.312569096 */, 18 }, + /* 4844 */ { MAD_F(0x0500a2b0) /* 0.312655153 */, 18 }, + /* 4845 */ { MAD_F(0x0500fcef) /* 0.312741216 */, 18 }, + /* 4846 */ { MAD_F(0x0501572e) /* 0.312827284 */, 18 }, + /* 4847 */ { MAD_F(0x0501b170) /* 0.312913359 */, 18 }, + + /* 4848 */ { MAD_F(0x05020bb3) /* 0.312999439 */, 18 }, + /* 4849 */ { MAD_F(0x050265f8) /* 0.313085526 */, 18 }, + /* 4850 */ { MAD_F(0x0502c03e) /* 0.313171618 */, 18 }, + /* 4851 */ { MAD_F(0x05031a86) /* 0.313257716 */, 18 }, + /* 4852 */ { MAD_F(0x050374cf) /* 0.313343820 */, 18 }, + /* 4853 */ { MAD_F(0x0503cf1a) /* 0.313429931 */, 18 }, + /* 4854 */ { MAD_F(0x05042967) /* 0.313516047 */, 18 }, + /* 4855 */ { MAD_F(0x050483b5) /* 0.313602168 */, 18 }, + /* 4856 */ { MAD_F(0x0504de05) /* 0.313688296 */, 18 }, + /* 4857 */ { MAD_F(0x05053856) /* 0.313774430 */, 18 }, + /* 4858 */ { MAD_F(0x050592a9) /* 0.313860570 */, 18 }, + /* 4859 */ { MAD_F(0x0505ecfd) /* 0.313946715 */, 18 }, + /* 4860 */ { MAD_F(0x05064754) /* 0.314032867 */, 18 }, + /* 4861 */ { MAD_F(0x0506a1ab) /* 0.314119024 */, 18 }, + /* 4862 */ { MAD_F(0x0506fc04) /* 0.314205187 */, 18 }, + /* 4863 */ { MAD_F(0x0507565f) /* 0.314291357 */, 18 }, + + /* 4864 */ { MAD_F(0x0507b0bc) /* 0.314377532 */, 18 }, + /* 4865 */ { MAD_F(0x05080b1a) /* 0.314463713 */, 18 }, + /* 4866 */ { MAD_F(0x05086579) /* 0.314549900 */, 18 }, + /* 4867 */ { MAD_F(0x0508bfdb) /* 0.314636092 */, 18 }, + /* 4868 */ { MAD_F(0x05091a3d) /* 0.314722291 */, 18 }, + /* 4869 */ { MAD_F(0x050974a2) /* 0.314808496 */, 18 }, + /* 4870 */ { MAD_F(0x0509cf08) /* 0.314894706 */, 18 }, + /* 4871 */ { MAD_F(0x050a296f) /* 0.314980923 */, 18 }, + /* 4872 */ { MAD_F(0x050a83d8) /* 0.315067145 */, 18 }, + /* 4873 */ { MAD_F(0x050ade43) /* 0.315153373 */, 18 }, + /* 4874 */ { MAD_F(0x050b38af) /* 0.315239607 */, 18 }, + /* 4875 */ { MAD_F(0x050b931d) /* 0.315325847 */, 18 }, + /* 4876 */ { MAD_F(0x050bed8d) /* 0.315412093 */, 18 }, + /* 4877 */ { MAD_F(0x050c47fe) /* 0.315498345 */, 18 }, + /* 4878 */ { MAD_F(0x050ca271) /* 0.315584603 */, 18 }, + /* 4879 */ { MAD_F(0x050cfce5) /* 0.315670866 */, 18 }, + + /* 4880 */ { MAD_F(0x050d575b) /* 0.315757136 */, 18 }, + /* 4881 */ { MAD_F(0x050db1d2) /* 0.315843411 */, 18 }, + /* 4882 */ { MAD_F(0x050e0c4b) /* 0.315929693 */, 18 }, + /* 4883 */ { MAD_F(0x050e66c5) /* 0.316015980 */, 18 }, + /* 4884 */ { MAD_F(0x050ec141) /* 0.316102273 */, 18 }, + /* 4885 */ { MAD_F(0x050f1bbf) /* 0.316188572 */, 18 }, + /* 4886 */ { MAD_F(0x050f763e) /* 0.316274877 */, 18 }, + /* 4887 */ { MAD_F(0x050fd0bf) /* 0.316361187 */, 18 }, + /* 4888 */ { MAD_F(0x05102b42) /* 0.316447504 */, 18 }, + /* 4889 */ { MAD_F(0x051085c6) /* 0.316533826 */, 18 }, + /* 4890 */ { MAD_F(0x0510e04b) /* 0.316620155 */, 18 }, + /* 4891 */ { MAD_F(0x05113ad3) /* 0.316706489 */, 18 }, + /* 4892 */ { MAD_F(0x0511955b) /* 0.316792829 */, 18 }, + /* 4893 */ { MAD_F(0x0511efe6) /* 0.316879175 */, 18 }, + /* 4894 */ { MAD_F(0x05124a72) /* 0.316965527 */, 18 }, + /* 4895 */ { MAD_F(0x0512a4ff) /* 0.317051885 */, 18 }, + + /* 4896 */ { MAD_F(0x0512ff8e) /* 0.317138249 */, 18 }, + /* 4897 */ { MAD_F(0x05135a1f) /* 0.317224618 */, 18 }, + /* 4898 */ { MAD_F(0x0513b4b1) /* 0.317310994 */, 18 }, + /* 4899 */ { MAD_F(0x05140f45) /* 0.317397375 */, 18 }, + /* 4900 */ { MAD_F(0x051469da) /* 0.317483762 */, 18 }, + /* 4901 */ { MAD_F(0x0514c471) /* 0.317570155 */, 18 }, + /* 4902 */ { MAD_F(0x05151f0a) /* 0.317656554 */, 18 }, + /* 4903 */ { MAD_F(0x051579a4) /* 0.317742959 */, 18 }, + /* 4904 */ { MAD_F(0x0515d440) /* 0.317829370 */, 18 }, + /* 4905 */ { MAD_F(0x05162edd) /* 0.317915786 */, 18 }, + /* 4906 */ { MAD_F(0x0516897c) /* 0.318002209 */, 18 }, + /* 4907 */ { MAD_F(0x0516e41c) /* 0.318088637 */, 18 }, + /* 4908 */ { MAD_F(0x05173ebe) /* 0.318175071 */, 18 }, + /* 4909 */ { MAD_F(0x05179962) /* 0.318261511 */, 18 }, + /* 4910 */ { MAD_F(0x0517f407) /* 0.318347957 */, 18 }, + /* 4911 */ { MAD_F(0x05184eae) /* 0.318434409 */, 18 }, + + /* 4912 */ { MAD_F(0x0518a956) /* 0.318520867 */, 18 }, + /* 4913 */ { MAD_F(0x05190400) /* 0.318607330 */, 18 }, + /* 4914 */ { MAD_F(0x05195eab) /* 0.318693800 */, 18 }, + /* 4915 */ { MAD_F(0x0519b958) /* 0.318780275 */, 18 }, + /* 4916 */ { MAD_F(0x051a1407) /* 0.318866756 */, 18 }, + /* 4917 */ { MAD_F(0x051a6eb7) /* 0.318953243 */, 18 }, + /* 4918 */ { MAD_F(0x051ac969) /* 0.319039736 */, 18 }, + /* 4919 */ { MAD_F(0x051b241c) /* 0.319126235 */, 18 }, + /* 4920 */ { MAD_F(0x051b7ed1) /* 0.319212739 */, 18 }, + /* 4921 */ { MAD_F(0x051bd987) /* 0.319299250 */, 18 }, + /* 4922 */ { MAD_F(0x051c3440) /* 0.319385766 */, 18 }, + /* 4923 */ { MAD_F(0x051c8ef9) /* 0.319472288 */, 18 }, + /* 4924 */ { MAD_F(0x051ce9b4) /* 0.319558816 */, 18 }, + /* 4925 */ { MAD_F(0x051d4471) /* 0.319645350 */, 18 }, + /* 4926 */ { MAD_F(0x051d9f2f) /* 0.319731890 */, 18 }, + /* 4927 */ { MAD_F(0x051df9ef) /* 0.319818435 */, 18 }, + + /* 4928 */ { MAD_F(0x051e54b1) /* 0.319904987 */, 18 }, + /* 4929 */ { MAD_F(0x051eaf74) /* 0.319991544 */, 18 }, + /* 4930 */ { MAD_F(0x051f0a38) /* 0.320078107 */, 18 }, + /* 4931 */ { MAD_F(0x051f64ff) /* 0.320164676 */, 18 }, + /* 4932 */ { MAD_F(0x051fbfc6) /* 0.320251251 */, 18 }, + /* 4933 */ { MAD_F(0x05201a90) /* 0.320337832 */, 18 }, + /* 4934 */ { MAD_F(0x0520755b) /* 0.320424419 */, 18 }, + /* 4935 */ { MAD_F(0x0520d027) /* 0.320511011 */, 18 }, + /* 4936 */ { MAD_F(0x05212af5) /* 0.320597609 */, 18 }, + /* 4937 */ { MAD_F(0x052185c5) /* 0.320684213 */, 18 }, + /* 4938 */ { MAD_F(0x0521e096) /* 0.320770823 */, 18 }, + /* 4939 */ { MAD_F(0x05223b69) /* 0.320857439 */, 18 }, + /* 4940 */ { MAD_F(0x0522963d) /* 0.320944061 */, 18 }, + /* 4941 */ { MAD_F(0x0522f113) /* 0.321030688 */, 18 }, + /* 4942 */ { MAD_F(0x05234bea) /* 0.321117322 */, 18 }, + /* 4943 */ { MAD_F(0x0523a6c3) /* 0.321203961 */, 18 }, + + /* 4944 */ { MAD_F(0x0524019e) /* 0.321290606 */, 18 }, + /* 4945 */ { MAD_F(0x05245c7a) /* 0.321377257 */, 18 }, + /* 4946 */ { MAD_F(0x0524b758) /* 0.321463913 */, 18 }, + /* 4947 */ { MAD_F(0x05251237) /* 0.321550576 */, 18 }, + /* 4948 */ { MAD_F(0x05256d18) /* 0.321637244 */, 18 }, + /* 4949 */ { MAD_F(0x0525c7fb) /* 0.321723919 */, 18 }, + /* 4950 */ { MAD_F(0x052622df) /* 0.321810599 */, 18 }, + /* 4951 */ { MAD_F(0x05267dc4) /* 0.321897285 */, 18 }, + /* 4952 */ { MAD_F(0x0526d8ab) /* 0.321983976 */, 18 }, + /* 4953 */ { MAD_F(0x05273394) /* 0.322070674 */, 18 }, + /* 4954 */ { MAD_F(0x05278e7e) /* 0.322157377 */, 18 }, + /* 4955 */ { MAD_F(0x0527e96a) /* 0.322244087 */, 18 }, + /* 4956 */ { MAD_F(0x05284457) /* 0.322330802 */, 18 }, + /* 4957 */ { MAD_F(0x05289f46) /* 0.322417523 */, 18 }, + /* 4958 */ { MAD_F(0x0528fa37) /* 0.322504249 */, 18 }, + /* 4959 */ { MAD_F(0x05295529) /* 0.322590982 */, 18 }, + + /* 4960 */ { MAD_F(0x0529b01d) /* 0.322677720 */, 18 }, + /* 4961 */ { MAD_F(0x052a0b12) /* 0.322764465 */, 18 }, + /* 4962 */ { MAD_F(0x052a6609) /* 0.322851215 */, 18 }, + /* 4963 */ { MAD_F(0x052ac101) /* 0.322937971 */, 18 }, + /* 4964 */ { MAD_F(0x052b1bfb) /* 0.323024732 */, 18 }, + /* 4965 */ { MAD_F(0x052b76f7) /* 0.323111500 */, 18 }, + /* 4966 */ { MAD_F(0x052bd1f4) /* 0.323198273 */, 18 }, + /* 4967 */ { MAD_F(0x052c2cf2) /* 0.323285052 */, 18 }, + /* 4968 */ { MAD_F(0x052c87f2) /* 0.323371837 */, 18 }, + /* 4969 */ { MAD_F(0x052ce2f4) /* 0.323458628 */, 18 }, + /* 4970 */ { MAD_F(0x052d3df7) /* 0.323545425 */, 18 }, + /* 4971 */ { MAD_F(0x052d98fc) /* 0.323632227 */, 18 }, + /* 4972 */ { MAD_F(0x052df403) /* 0.323719036 */, 18 }, + /* 4973 */ { MAD_F(0x052e4f0b) /* 0.323805850 */, 18 }, + /* 4974 */ { MAD_F(0x052eaa14) /* 0.323892670 */, 18 }, + /* 4975 */ { MAD_F(0x052f051f) /* 0.323979496 */, 18 }, + + /* 4976 */ { MAD_F(0x052f602c) /* 0.324066327 */, 18 }, + /* 4977 */ { MAD_F(0x052fbb3a) /* 0.324153165 */, 18 }, + /* 4978 */ { MAD_F(0x0530164a) /* 0.324240008 */, 18 }, + /* 4979 */ { MAD_F(0x0530715b) /* 0.324326857 */, 18 }, + /* 4980 */ { MAD_F(0x0530cc6e) /* 0.324413712 */, 18 }, + /* 4981 */ { MAD_F(0x05312783) /* 0.324500572 */, 18 }, + /* 4982 */ { MAD_F(0x05318299) /* 0.324587439 */, 18 }, + /* 4983 */ { MAD_F(0x0531ddb0) /* 0.324674311 */, 18 }, + /* 4984 */ { MAD_F(0x053238ca) /* 0.324761189 */, 18 }, + /* 4985 */ { MAD_F(0x053293e4) /* 0.324848073 */, 18 }, + /* 4986 */ { MAD_F(0x0532ef01) /* 0.324934963 */, 18 }, + /* 4987 */ { MAD_F(0x05334a1e) /* 0.325021858 */, 18 }, + /* 4988 */ { MAD_F(0x0533a53e) /* 0.325108760 */, 18 }, + /* 4989 */ { MAD_F(0x0534005f) /* 0.325195667 */, 18 }, + /* 4990 */ { MAD_F(0x05345b81) /* 0.325282580 */, 18 }, + /* 4991 */ { MAD_F(0x0534b6a5) /* 0.325369498 */, 18 }, + + /* 4992 */ { MAD_F(0x053511cb) /* 0.325456423 */, 18 }, + /* 4993 */ { MAD_F(0x05356cf2) /* 0.325543353 */, 18 }, + /* 4994 */ { MAD_F(0x0535c81b) /* 0.325630290 */, 18 }, + /* 4995 */ { MAD_F(0x05362345) /* 0.325717232 */, 18 }, + /* 4996 */ { MAD_F(0x05367e71) /* 0.325804179 */, 18 }, + /* 4997 */ { MAD_F(0x0536d99f) /* 0.325891133 */, 18 }, + /* 4998 */ { MAD_F(0x053734ce) /* 0.325978092 */, 18 }, + /* 4999 */ { MAD_F(0x05378ffe) /* 0.326065057 */, 18 }, + /* 5000 */ { MAD_F(0x0537eb30) /* 0.326152028 */, 18 }, + /* 5001 */ { MAD_F(0x05384664) /* 0.326239005 */, 18 }, + /* 5002 */ { MAD_F(0x0538a199) /* 0.326325988 */, 18 }, + /* 5003 */ { MAD_F(0x0538fcd0) /* 0.326412976 */, 18 }, + /* 5004 */ { MAD_F(0x05395808) /* 0.326499970 */, 18 }, + /* 5005 */ { MAD_F(0x0539b342) /* 0.326586970 */, 18 }, + /* 5006 */ { MAD_F(0x053a0e7d) /* 0.326673976 */, 18 }, + /* 5007 */ { MAD_F(0x053a69ba) /* 0.326760988 */, 18 }, + + /* 5008 */ { MAD_F(0x053ac4f9) /* 0.326848005 */, 18 }, + /* 5009 */ { MAD_F(0x053b2039) /* 0.326935028 */, 18 }, + /* 5010 */ { MAD_F(0x053b7b7b) /* 0.327022057 */, 18 }, + /* 5011 */ { MAD_F(0x053bd6be) /* 0.327109092 */, 18 }, + /* 5012 */ { MAD_F(0x053c3203) /* 0.327196132 */, 18 }, + /* 5013 */ { MAD_F(0x053c8d49) /* 0.327283178 */, 18 }, + /* 5014 */ { MAD_F(0x053ce891) /* 0.327370231 */, 18 }, + /* 5015 */ { MAD_F(0x053d43da) /* 0.327457288 */, 18 }, + /* 5016 */ { MAD_F(0x053d9f25) /* 0.327544352 */, 18 }, + /* 5017 */ { MAD_F(0x053dfa72) /* 0.327631421 */, 18 }, + /* 5018 */ { MAD_F(0x053e55c0) /* 0.327718497 */, 18 }, + /* 5019 */ { MAD_F(0x053eb10f) /* 0.327805578 */, 18 }, + /* 5020 */ { MAD_F(0x053f0c61) /* 0.327892665 */, 18 }, + /* 5021 */ { MAD_F(0x053f67b3) /* 0.327979757 */, 18 }, + /* 5022 */ { MAD_F(0x053fc308) /* 0.328066855 */, 18 }, + /* 5023 */ { MAD_F(0x05401e5e) /* 0.328153960 */, 18 }, + + /* 5024 */ { MAD_F(0x054079b5) /* 0.328241070 */, 18 }, + /* 5025 */ { MAD_F(0x0540d50e) /* 0.328328185 */, 18 }, + /* 5026 */ { MAD_F(0x05413068) /* 0.328415307 */, 18 }, + /* 5027 */ { MAD_F(0x05418bc4) /* 0.328502434 */, 18 }, + /* 5028 */ { MAD_F(0x0541e722) /* 0.328589567 */, 18 }, + /* 5029 */ { MAD_F(0x05424281) /* 0.328676706 */, 18 }, + /* 5030 */ { MAD_F(0x05429de2) /* 0.328763850 */, 18 }, + /* 5031 */ { MAD_F(0x0542f944) /* 0.328851001 */, 18 }, + /* 5032 */ { MAD_F(0x054354a8) /* 0.328938157 */, 18 }, + /* 5033 */ { MAD_F(0x0543b00d) /* 0.329025319 */, 18 }, + /* 5034 */ { MAD_F(0x05440b74) /* 0.329112486 */, 18 }, + /* 5035 */ { MAD_F(0x054466dd) /* 0.329199660 */, 18 }, + /* 5036 */ { MAD_F(0x0544c247) /* 0.329286839 */, 18 }, + /* 5037 */ { MAD_F(0x05451db2) /* 0.329374024 */, 18 }, + /* 5038 */ { MAD_F(0x0545791f) /* 0.329461215 */, 18 }, + /* 5039 */ { MAD_F(0x0545d48e) /* 0.329548411 */, 18 }, + + /* 5040 */ { MAD_F(0x05462ffe) /* 0.329635614 */, 18 }, + /* 5041 */ { MAD_F(0x05468b70) /* 0.329722822 */, 18 }, + /* 5042 */ { MAD_F(0x0546e6e3) /* 0.329810036 */, 18 }, + /* 5043 */ { MAD_F(0x05474258) /* 0.329897255 */, 18 }, + /* 5044 */ { MAD_F(0x05479dce) /* 0.329984481 */, 18 }, + /* 5045 */ { MAD_F(0x0547f946) /* 0.330071712 */, 18 }, + /* 5046 */ { MAD_F(0x054854c0) /* 0.330158949 */, 18 }, + /* 5047 */ { MAD_F(0x0548b03b) /* 0.330246191 */, 18 }, + /* 5048 */ { MAD_F(0x05490bb7) /* 0.330333440 */, 18 }, + /* 5049 */ { MAD_F(0x05496735) /* 0.330420694 */, 18 }, + /* 5050 */ { MAD_F(0x0549c2b5) /* 0.330507954 */, 18 }, + /* 5051 */ { MAD_F(0x054a1e36) /* 0.330595220 */, 18 }, + /* 5052 */ { MAD_F(0x054a79b9) /* 0.330682491 */, 18 }, + /* 5053 */ { MAD_F(0x054ad53d) /* 0.330769768 */, 18 }, + /* 5054 */ { MAD_F(0x054b30c3) /* 0.330857051 */, 18 }, + /* 5055 */ { MAD_F(0x054b8c4b) /* 0.330944340 */, 18 }, + + /* 5056 */ { MAD_F(0x054be7d4) /* 0.331031635 */, 18 }, + /* 5057 */ { MAD_F(0x054c435e) /* 0.331118935 */, 18 }, + /* 5058 */ { MAD_F(0x054c9eea) /* 0.331206241 */, 18 }, + /* 5059 */ { MAD_F(0x054cfa78) /* 0.331293553 */, 18 }, + /* 5060 */ { MAD_F(0x054d5607) /* 0.331380870 */, 18 }, + /* 5061 */ { MAD_F(0x054db197) /* 0.331468193 */, 18 }, + /* 5062 */ { MAD_F(0x054e0d2a) /* 0.331555522 */, 18 }, + /* 5063 */ { MAD_F(0x054e68bd) /* 0.331642857 */, 18 }, + /* 5064 */ { MAD_F(0x054ec453) /* 0.331730198 */, 18 }, + /* 5065 */ { MAD_F(0x054f1fe9) /* 0.331817544 */, 18 }, + /* 5066 */ { MAD_F(0x054f7b82) /* 0.331904896 */, 18 }, + /* 5067 */ { MAD_F(0x054fd71c) /* 0.331992254 */, 18 }, + /* 5068 */ { MAD_F(0x055032b7) /* 0.332079617 */, 18 }, + /* 5069 */ { MAD_F(0x05508e54) /* 0.332166986 */, 18 }, + /* 5070 */ { MAD_F(0x0550e9f3) /* 0.332254361 */, 18 }, + /* 5071 */ { MAD_F(0x05514593) /* 0.332341742 */, 18 }, + + /* 5072 */ { MAD_F(0x0551a134) /* 0.332429129 */, 18 }, + /* 5073 */ { MAD_F(0x0551fcd8) /* 0.332516521 */, 18 }, + /* 5074 */ { MAD_F(0x0552587c) /* 0.332603919 */, 18 }, + /* 5075 */ { MAD_F(0x0552b423) /* 0.332691323 */, 18 }, + /* 5076 */ { MAD_F(0x05530fca) /* 0.332778732 */, 18 }, + /* 5077 */ { MAD_F(0x05536b74) /* 0.332866147 */, 18 }, + /* 5078 */ { MAD_F(0x0553c71f) /* 0.332953568 */, 18 }, + /* 5079 */ { MAD_F(0x055422cb) /* 0.333040995 */, 18 }, + /* 5080 */ { MAD_F(0x05547e79) /* 0.333128427 */, 18 }, + /* 5081 */ { MAD_F(0x0554da29) /* 0.333215865 */, 18 }, + /* 5082 */ { MAD_F(0x055535da) /* 0.333303309 */, 18 }, + /* 5083 */ { MAD_F(0x0555918c) /* 0.333390759 */, 18 }, + /* 5084 */ { MAD_F(0x0555ed40) /* 0.333478214 */, 18 }, + /* 5085 */ { MAD_F(0x055648f6) /* 0.333565675 */, 18 }, + /* 5086 */ { MAD_F(0x0556a4ad) /* 0.333653142 */, 18 }, + /* 5087 */ { MAD_F(0x05570066) /* 0.333740615 */, 18 }, + + /* 5088 */ { MAD_F(0x05575c20) /* 0.333828093 */, 18 }, + /* 5089 */ { MAD_F(0x0557b7dc) /* 0.333915577 */, 18 }, + /* 5090 */ { MAD_F(0x05581399) /* 0.334003067 */, 18 }, + /* 5091 */ { MAD_F(0x05586f58) /* 0.334090562 */, 18 }, + /* 5092 */ { MAD_F(0x0558cb19) /* 0.334178063 */, 18 }, + /* 5093 */ { MAD_F(0x055926db) /* 0.334265570 */, 18 }, + /* 5094 */ { MAD_F(0x0559829e) /* 0.334353083 */, 18 }, + /* 5095 */ { MAD_F(0x0559de63) /* 0.334440601 */, 18 }, + /* 5096 */ { MAD_F(0x055a3a2a) /* 0.334528126 */, 18 }, + /* 5097 */ { MAD_F(0x055a95f2) /* 0.334615655 */, 18 }, + /* 5098 */ { MAD_F(0x055af1bb) /* 0.334703191 */, 18 }, + /* 5099 */ { MAD_F(0x055b4d87) /* 0.334790732 */, 18 }, + /* 5100 */ { MAD_F(0x055ba953) /* 0.334878279 */, 18 }, + /* 5101 */ { MAD_F(0x055c0522) /* 0.334965832 */, 18 }, + /* 5102 */ { MAD_F(0x055c60f1) /* 0.335053391 */, 18 }, + /* 5103 */ { MAD_F(0x055cbcc3) /* 0.335140955 */, 18 }, + + /* 5104 */ { MAD_F(0x055d1896) /* 0.335228525 */, 18 }, + /* 5105 */ { MAD_F(0x055d746a) /* 0.335316100 */, 18 }, + /* 5106 */ { MAD_F(0x055dd040) /* 0.335403682 */, 18 }, + /* 5107 */ { MAD_F(0x055e2c17) /* 0.335491269 */, 18 }, + /* 5108 */ { MAD_F(0x055e87f0) /* 0.335578861 */, 18 }, + /* 5109 */ { MAD_F(0x055ee3cb) /* 0.335666460 */, 18 }, + /* 5110 */ { MAD_F(0x055f3fa7) /* 0.335754064 */, 18 }, + /* 5111 */ { MAD_F(0x055f9b85) /* 0.335841674 */, 18 }, + /* 5112 */ { MAD_F(0x055ff764) /* 0.335929290 */, 18 }, + /* 5113 */ { MAD_F(0x05605344) /* 0.336016911 */, 18 }, + /* 5114 */ { MAD_F(0x0560af27) /* 0.336104538 */, 18 }, + /* 5115 */ { MAD_F(0x05610b0a) /* 0.336192171 */, 18 }, + /* 5116 */ { MAD_F(0x056166f0) /* 0.336279809 */, 18 }, + /* 5117 */ { MAD_F(0x0561c2d7) /* 0.336367453 */, 18 }, + /* 5118 */ { MAD_F(0x05621ebf) /* 0.336455103 */, 18 }, + /* 5119 */ { MAD_F(0x05627aa9) /* 0.336542759 */, 18 }, + + /* 5120 */ { MAD_F(0x0562d694) /* 0.336630420 */, 18 }, + /* 5121 */ { MAD_F(0x05633281) /* 0.336718087 */, 18 }, + /* 5122 */ { MAD_F(0x05638e70) /* 0.336805760 */, 18 }, + /* 5123 */ { MAD_F(0x0563ea60) /* 0.336893439 */, 18 }, + /* 5124 */ { MAD_F(0x05644651) /* 0.336981123 */, 18 }, + /* 5125 */ { MAD_F(0x0564a244) /* 0.337068813 */, 18 }, + /* 5126 */ { MAD_F(0x0564fe39) /* 0.337156508 */, 18 }, + /* 5127 */ { MAD_F(0x05655a2f) /* 0.337244209 */, 18 }, + /* 5128 */ { MAD_F(0x0565b627) /* 0.337331916 */, 18 }, + /* 5129 */ { MAD_F(0x05661220) /* 0.337419629 */, 18 }, + /* 5130 */ { MAD_F(0x05666e1a) /* 0.337507347 */, 18 }, + /* 5131 */ { MAD_F(0x0566ca17) /* 0.337595071 */, 18 }, + /* 5132 */ { MAD_F(0x05672614) /* 0.337682801 */, 18 }, + /* 5133 */ { MAD_F(0x05678214) /* 0.337770537 */, 18 }, + /* 5134 */ { MAD_F(0x0567de15) /* 0.337858278 */, 18 }, + /* 5135 */ { MAD_F(0x05683a17) /* 0.337946025 */, 18 }, + + /* 5136 */ { MAD_F(0x0568961b) /* 0.338033777 */, 18 }, + /* 5137 */ { MAD_F(0x0568f220) /* 0.338121535 */, 18 }, + /* 5138 */ { MAD_F(0x05694e27) /* 0.338209299 */, 18 }, + /* 5139 */ { MAD_F(0x0569aa30) /* 0.338297069 */, 18 }, + /* 5140 */ { MAD_F(0x056a063a) /* 0.338384844 */, 18 }, + /* 5141 */ { MAD_F(0x056a6245) /* 0.338472625 */, 18 }, + /* 5142 */ { MAD_F(0x056abe52) /* 0.338560412 */, 18 }, + /* 5143 */ { MAD_F(0x056b1a61) /* 0.338648204 */, 18 }, + /* 5144 */ { MAD_F(0x056b7671) /* 0.338736002 */, 18 }, + /* 5145 */ { MAD_F(0x056bd283) /* 0.338823806 */, 18 }, + /* 5146 */ { MAD_F(0x056c2e96) /* 0.338911616 */, 18 }, + /* 5147 */ { MAD_F(0x056c8aab) /* 0.338999431 */, 18 }, + /* 5148 */ { MAD_F(0x056ce6c1) /* 0.339087252 */, 18 }, + /* 5149 */ { MAD_F(0x056d42d9) /* 0.339175078 */, 18 }, + /* 5150 */ { MAD_F(0x056d9ef2) /* 0.339262910 */, 18 }, + /* 5151 */ { MAD_F(0x056dfb0d) /* 0.339350748 */, 18 }, + + /* 5152 */ { MAD_F(0x056e5729) /* 0.339438592 */, 18 }, + /* 5153 */ { MAD_F(0x056eb347) /* 0.339526441 */, 18 }, + /* 5154 */ { MAD_F(0x056f0f66) /* 0.339614296 */, 18 }, + /* 5155 */ { MAD_F(0x056f6b87) /* 0.339702157 */, 18 }, + /* 5156 */ { MAD_F(0x056fc7aa) /* 0.339790023 */, 18 }, + /* 5157 */ { MAD_F(0x057023cd) /* 0.339877895 */, 18 }, + /* 5158 */ { MAD_F(0x05707ff3) /* 0.339965773 */, 18 }, + /* 5159 */ { MAD_F(0x0570dc1a) /* 0.340053656 */, 18 }, + /* 5160 */ { MAD_F(0x05713843) /* 0.340141545 */, 18 }, + /* 5161 */ { MAD_F(0x0571946d) /* 0.340229440 */, 18 }, + /* 5162 */ { MAD_F(0x0571f098) /* 0.340317340 */, 18 }, + /* 5163 */ { MAD_F(0x05724cc5) /* 0.340405246 */, 18 }, + /* 5164 */ { MAD_F(0x0572a8f4) /* 0.340493158 */, 18 }, + /* 5165 */ { MAD_F(0x05730524) /* 0.340581075 */, 18 }, + /* 5166 */ { MAD_F(0x05736156) /* 0.340668999 */, 18 }, + /* 5167 */ { MAD_F(0x0573bd89) /* 0.340756927 */, 18 }, + + /* 5168 */ { MAD_F(0x057419be) /* 0.340844862 */, 18 }, + /* 5169 */ { MAD_F(0x057475f4) /* 0.340932802 */, 18 }, + /* 5170 */ { MAD_F(0x0574d22c) /* 0.341020748 */, 18 }, + /* 5171 */ { MAD_F(0x05752e65) /* 0.341108699 */, 18 }, + /* 5172 */ { MAD_F(0x05758aa0) /* 0.341196656 */, 18 }, + /* 5173 */ { MAD_F(0x0575e6dc) /* 0.341284619 */, 18 }, + /* 5174 */ { MAD_F(0x0576431a) /* 0.341372587 */, 18 }, + /* 5175 */ { MAD_F(0x05769f59) /* 0.341460562 */, 18 }, + /* 5176 */ { MAD_F(0x0576fb9a) /* 0.341548541 */, 18 }, + /* 5177 */ { MAD_F(0x057757dd) /* 0.341636527 */, 18 }, + /* 5178 */ { MAD_F(0x0577b421) /* 0.341724518 */, 18 }, + /* 5179 */ { MAD_F(0x05781066) /* 0.341812515 */, 18 }, + /* 5180 */ { MAD_F(0x05786cad) /* 0.341900517 */, 18 }, + /* 5181 */ { MAD_F(0x0578c8f5) /* 0.341988525 */, 18 }, + /* 5182 */ { MAD_F(0x0579253f) /* 0.342076539 */, 18 }, + /* 5183 */ { MAD_F(0x0579818b) /* 0.342164558 */, 18 }, + + /* 5184 */ { MAD_F(0x0579ddd8) /* 0.342252584 */, 18 }, + /* 5185 */ { MAD_F(0x057a3a27) /* 0.342340614 */, 18 }, + /* 5186 */ { MAD_F(0x057a9677) /* 0.342428651 */, 18 }, + /* 5187 */ { MAD_F(0x057af2c8) /* 0.342516693 */, 18 }, + /* 5188 */ { MAD_F(0x057b4f1c) /* 0.342604741 */, 18 }, + /* 5189 */ { MAD_F(0x057bab70) /* 0.342692794 */, 18 }, + /* 5190 */ { MAD_F(0x057c07c6) /* 0.342780853 */, 18 }, + /* 5191 */ { MAD_F(0x057c641e) /* 0.342868918 */, 18 }, + /* 5192 */ { MAD_F(0x057cc077) /* 0.342956988 */, 18 }, + /* 5193 */ { MAD_F(0x057d1cd2) /* 0.343045064 */, 18 }, + /* 5194 */ { MAD_F(0x057d792e) /* 0.343133146 */, 18 }, + /* 5195 */ { MAD_F(0x057dd58c) /* 0.343221233 */, 18 }, + /* 5196 */ { MAD_F(0x057e31eb) /* 0.343309326 */, 18 }, + /* 5197 */ { MAD_F(0x057e8e4c) /* 0.343397425 */, 18 }, + /* 5198 */ { MAD_F(0x057eeaae) /* 0.343485529 */, 18 }, + /* 5199 */ { MAD_F(0x057f4712) /* 0.343573639 */, 18 }, + + /* 5200 */ { MAD_F(0x057fa378) /* 0.343661754 */, 18 }, + /* 5201 */ { MAD_F(0x057fffde) /* 0.343749876 */, 18 }, + /* 5202 */ { MAD_F(0x05805c47) /* 0.343838003 */, 18 }, + /* 5203 */ { MAD_F(0x0580b8b1) /* 0.343926135 */, 18 }, + /* 5204 */ { MAD_F(0x0581151c) /* 0.344014273 */, 18 }, + /* 5205 */ { MAD_F(0x05817189) /* 0.344102417 */, 18 }, + /* 5206 */ { MAD_F(0x0581cdf7) /* 0.344190566 */, 18 }, + /* 5207 */ { MAD_F(0x05822a67) /* 0.344278722 */, 18 }, + /* 5208 */ { MAD_F(0x058286d9) /* 0.344366882 */, 18 }, + /* 5209 */ { MAD_F(0x0582e34c) /* 0.344455049 */, 18 }, + /* 5210 */ { MAD_F(0x05833fc0) /* 0.344543221 */, 18 }, + /* 5211 */ { MAD_F(0x05839c36) /* 0.344631398 */, 18 }, + /* 5212 */ { MAD_F(0x0583f8ae) /* 0.344719582 */, 18 }, + /* 5213 */ { MAD_F(0x05845527) /* 0.344807771 */, 18 }, + /* 5214 */ { MAD_F(0x0584b1a1) /* 0.344895965 */, 18 }, + /* 5215 */ { MAD_F(0x05850e1e) /* 0.344984165 */, 18 }, + + /* 5216 */ { MAD_F(0x05856a9b) /* 0.345072371 */, 18 }, + /* 5217 */ { MAD_F(0x0585c71a) /* 0.345160583 */, 18 }, + /* 5218 */ { MAD_F(0x0586239b) /* 0.345248800 */, 18 }, + /* 5219 */ { MAD_F(0x0586801d) /* 0.345337023 */, 18 }, + /* 5220 */ { MAD_F(0x0586dca1) /* 0.345425251 */, 18 }, + /* 5221 */ { MAD_F(0x05873926) /* 0.345513485 */, 18 }, + /* 5222 */ { MAD_F(0x058795ac) /* 0.345601725 */, 18 }, + /* 5223 */ { MAD_F(0x0587f235) /* 0.345689970 */, 18 }, + /* 5224 */ { MAD_F(0x05884ebe) /* 0.345778221 */, 18 }, + /* 5225 */ { MAD_F(0x0588ab49) /* 0.345866478 */, 18 }, + /* 5226 */ { MAD_F(0x058907d6) /* 0.345954740 */, 18 }, + /* 5227 */ { MAD_F(0x05896464) /* 0.346043008 */, 18 }, + /* 5228 */ { MAD_F(0x0589c0f4) /* 0.346131281 */, 18 }, + /* 5229 */ { MAD_F(0x058a1d85) /* 0.346219560 */, 18 }, + /* 5230 */ { MAD_F(0x058a7a18) /* 0.346307845 */, 18 }, + /* 5231 */ { MAD_F(0x058ad6ac) /* 0.346396135 */, 18 }, + + /* 5232 */ { MAD_F(0x058b3342) /* 0.346484431 */, 18 }, + /* 5233 */ { MAD_F(0x058b8fd9) /* 0.346572733 */, 18 }, + /* 5234 */ { MAD_F(0x058bec72) /* 0.346661040 */, 18 }, + /* 5235 */ { MAD_F(0x058c490c) /* 0.346749353 */, 18 }, + /* 5236 */ { MAD_F(0x058ca5a8) /* 0.346837671 */, 18 }, + /* 5237 */ { MAD_F(0x058d0246) /* 0.346925996 */, 18 }, + /* 5238 */ { MAD_F(0x058d5ee4) /* 0.347014325 */, 18 }, + /* 5239 */ { MAD_F(0x058dbb85) /* 0.347102661 */, 18 }, + /* 5240 */ { MAD_F(0x058e1827) /* 0.347191002 */, 18 }, + /* 5241 */ { MAD_F(0x058e74ca) /* 0.347279348 */, 18 }, + /* 5242 */ { MAD_F(0x058ed16f) /* 0.347367700 */, 18 }, + /* 5243 */ { MAD_F(0x058f2e15) /* 0.347456058 */, 18 }, + /* 5244 */ { MAD_F(0x058f8abd) /* 0.347544422 */, 18 }, + /* 5245 */ { MAD_F(0x058fe766) /* 0.347632791 */, 18 }, + /* 5246 */ { MAD_F(0x05904411) /* 0.347721165 */, 18 }, + /* 5247 */ { MAD_F(0x0590a0be) /* 0.347809546 */, 18 }, + + /* 5248 */ { MAD_F(0x0590fd6c) /* 0.347897931 */, 18 }, + /* 5249 */ { MAD_F(0x05915a1b) /* 0.347986323 */, 18 }, + /* 5250 */ { MAD_F(0x0591b6cc) /* 0.348074720 */, 18 }, + /* 5251 */ { MAD_F(0x0592137e) /* 0.348163123 */, 18 }, + /* 5252 */ { MAD_F(0x05927032) /* 0.348251531 */, 18 }, + /* 5253 */ { MAD_F(0x0592cce8) /* 0.348339945 */, 18 }, + /* 5254 */ { MAD_F(0x0593299f) /* 0.348428365 */, 18 }, + /* 5255 */ { MAD_F(0x05938657) /* 0.348516790 */, 18 }, + /* 5256 */ { MAD_F(0x0593e311) /* 0.348605221 */, 18 }, + /* 5257 */ { MAD_F(0x05943fcd) /* 0.348693657 */, 18 }, + /* 5258 */ { MAD_F(0x05949c8a) /* 0.348782099 */, 18 }, + /* 5259 */ { MAD_F(0x0594f948) /* 0.348870547 */, 18 }, + /* 5260 */ { MAD_F(0x05955608) /* 0.348959000 */, 18 }, + /* 5261 */ { MAD_F(0x0595b2ca) /* 0.349047459 */, 18 }, + /* 5262 */ { MAD_F(0x05960f8c) /* 0.349135923 */, 18 }, + /* 5263 */ { MAD_F(0x05966c51) /* 0.349224393 */, 18 }, + + /* 5264 */ { MAD_F(0x0596c917) /* 0.349312869 */, 18 }, + /* 5265 */ { MAD_F(0x059725de) /* 0.349401350 */, 18 }, + /* 5266 */ { MAD_F(0x059782a7) /* 0.349489837 */, 18 }, + /* 5267 */ { MAD_F(0x0597df72) /* 0.349578329 */, 18 }, + /* 5268 */ { MAD_F(0x05983c3e) /* 0.349666827 */, 18 }, + /* 5269 */ { MAD_F(0x0598990c) /* 0.349755331 */, 18 }, + /* 5270 */ { MAD_F(0x0598f5db) /* 0.349843840 */, 18 }, + /* 5271 */ { MAD_F(0x059952ab) /* 0.349932355 */, 18 }, + /* 5272 */ { MAD_F(0x0599af7d) /* 0.350020876 */, 18 }, + /* 5273 */ { MAD_F(0x059a0c51) /* 0.350109402 */, 18 }, + /* 5274 */ { MAD_F(0x059a6926) /* 0.350197933 */, 18 }, + /* 5275 */ { MAD_F(0x059ac5fc) /* 0.350286470 */, 18 }, + /* 5276 */ { MAD_F(0x059b22d4) /* 0.350375013 */, 18 }, + /* 5277 */ { MAD_F(0x059b7fae) /* 0.350463562 */, 18 }, + /* 5278 */ { MAD_F(0x059bdc89) /* 0.350552116 */, 18 }, + /* 5279 */ { MAD_F(0x059c3965) /* 0.350640675 */, 18 }, + + /* 5280 */ { MAD_F(0x059c9643) /* 0.350729240 */, 18 }, + /* 5281 */ { MAD_F(0x059cf323) /* 0.350817811 */, 18 }, + /* 5282 */ { MAD_F(0x059d5004) /* 0.350906388 */, 18 }, + /* 5283 */ { MAD_F(0x059dace6) /* 0.350994970 */, 18 }, + /* 5284 */ { MAD_F(0x059e09cb) /* 0.351083557 */, 18 }, + /* 5285 */ { MAD_F(0x059e66b0) /* 0.351172150 */, 18 }, + /* 5286 */ { MAD_F(0x059ec397) /* 0.351260749 */, 18 }, + /* 5287 */ { MAD_F(0x059f2080) /* 0.351349353 */, 18 }, + /* 5288 */ { MAD_F(0x059f7d6a) /* 0.351437963 */, 18 }, + /* 5289 */ { MAD_F(0x059fda55) /* 0.351526579 */, 18 }, + /* 5290 */ { MAD_F(0x05a03742) /* 0.351615200 */, 18 }, + /* 5291 */ { MAD_F(0x05a09431) /* 0.351703827 */, 18 }, + /* 5292 */ { MAD_F(0x05a0f121) /* 0.351792459 */, 18 }, + /* 5293 */ { MAD_F(0x05a14e12) /* 0.351881097 */, 18 }, + /* 5294 */ { MAD_F(0x05a1ab05) /* 0.351969740 */, 18 }, + /* 5295 */ { MAD_F(0x05a207fa) /* 0.352058389 */, 18 }, + + /* 5296 */ { MAD_F(0x05a264f0) /* 0.352147044 */, 18 }, + /* 5297 */ { MAD_F(0x05a2c1e7) /* 0.352235704 */, 18 }, + /* 5298 */ { MAD_F(0x05a31ee1) /* 0.352324369 */, 18 }, + /* 5299 */ { MAD_F(0x05a37bdb) /* 0.352413041 */, 18 }, + /* 5300 */ { MAD_F(0x05a3d8d7) /* 0.352501718 */, 18 }, + /* 5301 */ { MAD_F(0x05a435d5) /* 0.352590400 */, 18 }, + /* 5302 */ { MAD_F(0x05a492d4) /* 0.352679088 */, 18 }, + /* 5303 */ { MAD_F(0x05a4efd4) /* 0.352767782 */, 18 }, + /* 5304 */ { MAD_F(0x05a54cd6) /* 0.352856481 */, 18 }, + /* 5305 */ { MAD_F(0x05a5a9da) /* 0.352945186 */, 18 }, + /* 5306 */ { MAD_F(0x05a606df) /* 0.353033896 */, 18 }, + /* 5307 */ { MAD_F(0x05a663e5) /* 0.353122612 */, 18 }, + /* 5308 */ { MAD_F(0x05a6c0ed) /* 0.353211333 */, 18 }, + /* 5309 */ { MAD_F(0x05a71df7) /* 0.353300061 */, 18 }, + /* 5310 */ { MAD_F(0x05a77b02) /* 0.353388793 */, 18 }, + /* 5311 */ { MAD_F(0x05a7d80e) /* 0.353477531 */, 18 }, + + /* 5312 */ { MAD_F(0x05a8351c) /* 0.353566275 */, 18 }, + /* 5313 */ { MAD_F(0x05a8922c) /* 0.353655024 */, 18 }, + /* 5314 */ { MAD_F(0x05a8ef3c) /* 0.353743779 */, 18 }, + /* 5315 */ { MAD_F(0x05a94c4f) /* 0.353832540 */, 18 }, + /* 5316 */ { MAD_F(0x05a9a963) /* 0.353921306 */, 18 }, + /* 5317 */ { MAD_F(0x05aa0678) /* 0.354010077 */, 18 }, + /* 5318 */ { MAD_F(0x05aa638f) /* 0.354098855 */, 18 }, + /* 5319 */ { MAD_F(0x05aac0a8) /* 0.354187637 */, 18 }, + /* 5320 */ { MAD_F(0x05ab1dc2) /* 0.354276426 */, 18 }, + /* 5321 */ { MAD_F(0x05ab7add) /* 0.354365220 */, 18 }, + /* 5322 */ { MAD_F(0x05abd7fa) /* 0.354454019 */, 18 }, + /* 5323 */ { MAD_F(0x05ac3518) /* 0.354542824 */, 18 }, + /* 5324 */ { MAD_F(0x05ac9238) /* 0.354631635 */, 18 }, + /* 5325 */ { MAD_F(0x05acef5a) /* 0.354720451 */, 18 }, + /* 5326 */ { MAD_F(0x05ad4c7d) /* 0.354809272 */, 18 }, + /* 5327 */ { MAD_F(0x05ada9a1) /* 0.354898100 */, 18 }, + + /* 5328 */ { MAD_F(0x05ae06c7) /* 0.354986932 */, 18 }, + /* 5329 */ { MAD_F(0x05ae63ee) /* 0.355075771 */, 18 }, + /* 5330 */ { MAD_F(0x05aec117) /* 0.355164615 */, 18 }, + /* 5331 */ { MAD_F(0x05af1e41) /* 0.355253464 */, 18 }, + /* 5332 */ { MAD_F(0x05af7b6d) /* 0.355342319 */, 18 }, + /* 5333 */ { MAD_F(0x05afd89b) /* 0.355431180 */, 18 }, + /* 5334 */ { MAD_F(0x05b035c9) /* 0.355520046 */, 18 }, + /* 5335 */ { MAD_F(0x05b092fa) /* 0.355608917 */, 18 }, + /* 5336 */ { MAD_F(0x05b0f02b) /* 0.355697795 */, 18 }, + /* 5337 */ { MAD_F(0x05b14d5f) /* 0.355786677 */, 18 }, + /* 5338 */ { MAD_F(0x05b1aa94) /* 0.355875566 */, 18 }, + /* 5339 */ { MAD_F(0x05b207ca) /* 0.355964460 */, 18 }, + /* 5340 */ { MAD_F(0x05b26502) /* 0.356053359 */, 18 }, + /* 5341 */ { MAD_F(0x05b2c23b) /* 0.356142264 */, 18 }, + /* 5342 */ { MAD_F(0x05b31f76) /* 0.356231175 */, 18 }, + /* 5343 */ { MAD_F(0x05b37cb2) /* 0.356320091 */, 18 }, + + /* 5344 */ { MAD_F(0x05b3d9f0) /* 0.356409012 */, 18 }, + /* 5345 */ { MAD_F(0x05b4372f) /* 0.356497940 */, 18 }, + /* 5346 */ { MAD_F(0x05b4946f) /* 0.356586872 */, 18 }, + /* 5347 */ { MAD_F(0x05b4f1b2) /* 0.356675811 */, 18 }, + /* 5348 */ { MAD_F(0x05b54ef5) /* 0.356764754 */, 18 }, + /* 5349 */ { MAD_F(0x05b5ac3a) /* 0.356853704 */, 18 }, + /* 5350 */ { MAD_F(0x05b60981) /* 0.356942659 */, 18 }, + /* 5351 */ { MAD_F(0x05b666c9) /* 0.357031619 */, 18 }, + /* 5352 */ { MAD_F(0x05b6c413) /* 0.357120585 */, 18 }, + /* 5353 */ { MAD_F(0x05b7215e) /* 0.357209557 */, 18 }, + /* 5354 */ { MAD_F(0x05b77eab) /* 0.357298534 */, 18 }, + /* 5355 */ { MAD_F(0x05b7dbf9) /* 0.357387516 */, 18 }, + /* 5356 */ { MAD_F(0x05b83948) /* 0.357476504 */, 18 }, + /* 5357 */ { MAD_F(0x05b89699) /* 0.357565498 */, 18 }, + /* 5358 */ { MAD_F(0x05b8f3ec) /* 0.357654497 */, 18 }, + /* 5359 */ { MAD_F(0x05b95140) /* 0.357743502 */, 18 }, + + /* 5360 */ { MAD_F(0x05b9ae95) /* 0.357832512 */, 18 }, + /* 5361 */ { MAD_F(0x05ba0bec) /* 0.357921528 */, 18 }, + /* 5362 */ { MAD_F(0x05ba6945) /* 0.358010550 */, 18 }, + /* 5363 */ { MAD_F(0x05bac69f) /* 0.358099576 */, 18 }, + /* 5364 */ { MAD_F(0x05bb23fa) /* 0.358188609 */, 18 }, + /* 5365 */ { MAD_F(0x05bb8157) /* 0.358277647 */, 18 }, + /* 5366 */ { MAD_F(0x05bbdeb6) /* 0.358366690 */, 18 }, + /* 5367 */ { MAD_F(0x05bc3c16) /* 0.358455739 */, 18 }, + /* 5368 */ { MAD_F(0x05bc9977) /* 0.358544794 */, 18 }, + /* 5369 */ { MAD_F(0x05bcf6da) /* 0.358633854 */, 18 }, + /* 5370 */ { MAD_F(0x05bd543e) /* 0.358722920 */, 18 }, + /* 5371 */ { MAD_F(0x05bdb1a4) /* 0.358811991 */, 18 }, + /* 5372 */ { MAD_F(0x05be0f0b) /* 0.358901067 */, 18 }, + /* 5373 */ { MAD_F(0x05be6c74) /* 0.358990150 */, 18 }, + /* 5374 */ { MAD_F(0x05bec9df) /* 0.359079237 */, 18 }, + /* 5375 */ { MAD_F(0x05bf274a) /* 0.359168331 */, 18 }, + + /* 5376 */ { MAD_F(0x05bf84b8) /* 0.359257429 */, 18 }, + /* 5377 */ { MAD_F(0x05bfe226) /* 0.359346534 */, 18 }, + /* 5378 */ { MAD_F(0x05c03f97) /* 0.359435644 */, 18 }, + /* 5379 */ { MAD_F(0x05c09d08) /* 0.359524759 */, 18 }, + /* 5380 */ { MAD_F(0x05c0fa7c) /* 0.359613880 */, 18 }, + /* 5381 */ { MAD_F(0x05c157f0) /* 0.359703006 */, 18 }, + /* 5382 */ { MAD_F(0x05c1b566) /* 0.359792138 */, 18 }, + /* 5383 */ { MAD_F(0x05c212de) /* 0.359881276 */, 18 }, + /* 5384 */ { MAD_F(0x05c27057) /* 0.359970419 */, 18 }, + /* 5385 */ { MAD_F(0x05c2cdd2) /* 0.360059567 */, 18 }, + /* 5386 */ { MAD_F(0x05c32b4e) /* 0.360148721 */, 18 }, + /* 5387 */ { MAD_F(0x05c388cb) /* 0.360237881 */, 18 }, + /* 5388 */ { MAD_F(0x05c3e64b) /* 0.360327046 */, 18 }, + /* 5389 */ { MAD_F(0x05c443cb) /* 0.360416216 */, 18 }, + /* 5390 */ { MAD_F(0x05c4a14d) /* 0.360505392 */, 18 }, + /* 5391 */ { MAD_F(0x05c4fed1) /* 0.360594574 */, 18 }, + + /* 5392 */ { MAD_F(0x05c55c56) /* 0.360683761 */, 18 }, + /* 5393 */ { MAD_F(0x05c5b9dc) /* 0.360772953 */, 18 }, + /* 5394 */ { MAD_F(0x05c61764) /* 0.360862152 */, 18 }, + /* 5395 */ { MAD_F(0x05c674ed) /* 0.360951355 */, 18 }, + /* 5396 */ { MAD_F(0x05c6d278) /* 0.361040564 */, 18 }, + /* 5397 */ { MAD_F(0x05c73005) /* 0.361129779 */, 18 }, + /* 5398 */ { MAD_F(0x05c78d93) /* 0.361218999 */, 18 }, + /* 5399 */ { MAD_F(0x05c7eb22) /* 0.361308225 */, 18 }, + /* 5400 */ { MAD_F(0x05c848b3) /* 0.361397456 */, 18 }, + /* 5401 */ { MAD_F(0x05c8a645) /* 0.361486693 */, 18 }, + /* 5402 */ { MAD_F(0x05c903d9) /* 0.361575935 */, 18 }, + /* 5403 */ { MAD_F(0x05c9616e) /* 0.361665183 */, 18 }, + /* 5404 */ { MAD_F(0x05c9bf05) /* 0.361754436 */, 18 }, + /* 5405 */ { MAD_F(0x05ca1c9d) /* 0.361843695 */, 18 }, + /* 5406 */ { MAD_F(0x05ca7a37) /* 0.361932959 */, 18 }, + /* 5407 */ { MAD_F(0x05cad7d2) /* 0.362022229 */, 18 }, + + /* 5408 */ { MAD_F(0x05cb356e) /* 0.362111504 */, 18 }, + /* 5409 */ { MAD_F(0x05cb930d) /* 0.362200785 */, 18 }, + /* 5410 */ { MAD_F(0x05cbf0ac) /* 0.362290071 */, 18 }, + /* 5411 */ { MAD_F(0x05cc4e4d) /* 0.362379362 */, 18 }, + /* 5412 */ { MAD_F(0x05ccabf0) /* 0.362468660 */, 18 }, + /* 5413 */ { MAD_F(0x05cd0994) /* 0.362557962 */, 18 }, + /* 5414 */ { MAD_F(0x05cd6739) /* 0.362647271 */, 18 }, + /* 5415 */ { MAD_F(0x05cdc4e0) /* 0.362736584 */, 18 }, + /* 5416 */ { MAD_F(0x05ce2289) /* 0.362825904 */, 18 }, + /* 5417 */ { MAD_F(0x05ce8033) /* 0.362915228 */, 18 }, + /* 5418 */ { MAD_F(0x05ceddde) /* 0.363004559 */, 18 }, + /* 5419 */ { MAD_F(0x05cf3b8b) /* 0.363093894 */, 18 }, + /* 5420 */ { MAD_F(0x05cf9939) /* 0.363183236 */, 18 }, + /* 5421 */ { MAD_F(0x05cff6e9) /* 0.363272582 */, 18 }, + /* 5422 */ { MAD_F(0x05d0549a) /* 0.363361935 */, 18 }, + /* 5423 */ { MAD_F(0x05d0b24d) /* 0.363451292 */, 18 }, + + /* 5424 */ { MAD_F(0x05d11001) /* 0.363540655 */, 18 }, + /* 5425 */ { MAD_F(0x05d16db7) /* 0.363630024 */, 18 }, + /* 5426 */ { MAD_F(0x05d1cb6e) /* 0.363719398 */, 18 }, + /* 5427 */ { MAD_F(0x05d22927) /* 0.363808778 */, 18 }, + /* 5428 */ { MAD_F(0x05d286e1) /* 0.363898163 */, 18 }, + /* 5429 */ { MAD_F(0x05d2e49d) /* 0.363987554 */, 18 }, + /* 5430 */ { MAD_F(0x05d3425a) /* 0.364076950 */, 18 }, + /* 5431 */ { MAD_F(0x05d3a018) /* 0.364166352 */, 18 }, + /* 5432 */ { MAD_F(0x05d3fdd8) /* 0.364255759 */, 18 }, + /* 5433 */ { MAD_F(0x05d45b9a) /* 0.364345171 */, 18 }, + /* 5434 */ { MAD_F(0x05d4b95d) /* 0.364434589 */, 18 }, + /* 5435 */ { MAD_F(0x05d51721) /* 0.364524013 */, 18 }, + /* 5436 */ { MAD_F(0x05d574e7) /* 0.364613442 */, 18 }, + /* 5437 */ { MAD_F(0x05d5d2af) /* 0.364702877 */, 18 }, + /* 5438 */ { MAD_F(0x05d63078) /* 0.364792317 */, 18 }, + /* 5439 */ { MAD_F(0x05d68e42) /* 0.364881762 */, 18 }, + + /* 5440 */ { MAD_F(0x05d6ec0e) /* 0.364971213 */, 18 }, + /* 5441 */ { MAD_F(0x05d749db) /* 0.365060669 */, 18 }, + /* 5442 */ { MAD_F(0x05d7a7aa) /* 0.365150131 */, 18 }, + /* 5443 */ { MAD_F(0x05d8057a) /* 0.365239599 */, 18 }, + /* 5444 */ { MAD_F(0x05d8634c) /* 0.365329072 */, 18 }, + /* 5445 */ { MAD_F(0x05d8c11f) /* 0.365418550 */, 18 }, + /* 5446 */ { MAD_F(0x05d91ef4) /* 0.365508034 */, 18 }, + /* 5447 */ { MAD_F(0x05d97cca) /* 0.365597523 */, 18 }, + /* 5448 */ { MAD_F(0x05d9daa1) /* 0.365687018 */, 18 }, + /* 5449 */ { MAD_F(0x05da387a) /* 0.365776518 */, 18 }, + /* 5450 */ { MAD_F(0x05da9655) /* 0.365866024 */, 18 }, + /* 5451 */ { MAD_F(0x05daf431) /* 0.365955536 */, 18 }, + /* 5452 */ { MAD_F(0x05db520e) /* 0.366045052 */, 18 }, + /* 5453 */ { MAD_F(0x05dbafed) /* 0.366134574 */, 18 }, + /* 5454 */ { MAD_F(0x05dc0dce) /* 0.366224102 */, 18 }, + /* 5455 */ { MAD_F(0x05dc6baf) /* 0.366313635 */, 18 }, + + /* 5456 */ { MAD_F(0x05dcc993) /* 0.366403174 */, 18 }, + /* 5457 */ { MAD_F(0x05dd2778) /* 0.366492718 */, 18 }, + /* 5458 */ { MAD_F(0x05dd855e) /* 0.366582267 */, 18 }, + /* 5459 */ { MAD_F(0x05dde346) /* 0.366671822 */, 18 }, + /* 5460 */ { MAD_F(0x05de412f) /* 0.366761383 */, 18 }, + /* 5461 */ { MAD_F(0x05de9f1a) /* 0.366850949 */, 18 }, + /* 5462 */ { MAD_F(0x05defd06) /* 0.366940520 */, 18 }, + /* 5463 */ { MAD_F(0x05df5af3) /* 0.367030097 */, 18 }, + /* 5464 */ { MAD_F(0x05dfb8e2) /* 0.367119680 */, 18 }, + /* 5465 */ { MAD_F(0x05e016d3) /* 0.367209267 */, 18 }, + /* 5466 */ { MAD_F(0x05e074c5) /* 0.367298861 */, 18 }, + /* 5467 */ { MAD_F(0x05e0d2b8) /* 0.367388459 */, 18 }, + /* 5468 */ { MAD_F(0x05e130ad) /* 0.367478064 */, 18 }, + /* 5469 */ { MAD_F(0x05e18ea4) /* 0.367567673 */, 18 }, + /* 5470 */ { MAD_F(0x05e1ec9c) /* 0.367657288 */, 18 }, + /* 5471 */ { MAD_F(0x05e24a95) /* 0.367746909 */, 18 }, + + /* 5472 */ { MAD_F(0x05e2a890) /* 0.367836535 */, 18 }, + /* 5473 */ { MAD_F(0x05e3068c) /* 0.367926167 */, 18 }, + /* 5474 */ { MAD_F(0x05e3648a) /* 0.368015804 */, 18 }, + /* 5475 */ { MAD_F(0x05e3c289) /* 0.368105446 */, 18 }, + /* 5476 */ { MAD_F(0x05e4208a) /* 0.368195094 */, 18 }, + /* 5477 */ { MAD_F(0x05e47e8c) /* 0.368284747 */, 18 }, + /* 5478 */ { MAD_F(0x05e4dc8f) /* 0.368374406 */, 18 }, + /* 5479 */ { MAD_F(0x05e53a94) /* 0.368464070 */, 18 }, + /* 5480 */ { MAD_F(0x05e5989b) /* 0.368553740 */, 18 }, + /* 5481 */ { MAD_F(0x05e5f6a3) /* 0.368643415 */, 18 }, + /* 5482 */ { MAD_F(0x05e654ac) /* 0.368733096 */, 18 }, + /* 5483 */ { MAD_F(0x05e6b2b7) /* 0.368822782 */, 18 }, + /* 5484 */ { MAD_F(0x05e710c4) /* 0.368912473 */, 18 }, + /* 5485 */ { MAD_F(0x05e76ed2) /* 0.369002170 */, 18 }, + /* 5486 */ { MAD_F(0x05e7cce1) /* 0.369091873 */, 18 }, + /* 5487 */ { MAD_F(0x05e82af2) /* 0.369181581 */, 18 }, + + /* 5488 */ { MAD_F(0x05e88904) /* 0.369271294 */, 18 }, + /* 5489 */ { MAD_F(0x05e8e718) /* 0.369361013 */, 18 }, + /* 5490 */ { MAD_F(0x05e9452d) /* 0.369450737 */, 18 }, + /* 5491 */ { MAD_F(0x05e9a343) /* 0.369540467 */, 18 }, + /* 5492 */ { MAD_F(0x05ea015c) /* 0.369630202 */, 18 }, + /* 5493 */ { MAD_F(0x05ea5f75) /* 0.369719942 */, 18 }, + /* 5494 */ { MAD_F(0x05eabd90) /* 0.369809688 */, 18 }, + /* 5495 */ { MAD_F(0x05eb1bad) /* 0.369899440 */, 18 }, + /* 5496 */ { MAD_F(0x05eb79cb) /* 0.369989197 */, 18 }, + /* 5497 */ { MAD_F(0x05ebd7ea) /* 0.370078959 */, 18 }, + /* 5498 */ { MAD_F(0x05ec360b) /* 0.370168727 */, 18 }, + /* 5499 */ { MAD_F(0x05ec942d) /* 0.370258500 */, 18 }, + /* 5500 */ { MAD_F(0x05ecf251) /* 0.370348279 */, 18 }, + /* 5501 */ { MAD_F(0x05ed5076) /* 0.370438063 */, 18 }, + /* 5502 */ { MAD_F(0x05edae9d) /* 0.370527853 */, 18 }, + /* 5503 */ { MAD_F(0x05ee0cc5) /* 0.370617648 */, 18 }, + + /* 5504 */ { MAD_F(0x05ee6aef) /* 0.370707448 */, 18 }, + /* 5505 */ { MAD_F(0x05eec91a) /* 0.370797254 */, 18 }, + /* 5506 */ { MAD_F(0x05ef2746) /* 0.370887065 */, 18 }, + /* 5507 */ { MAD_F(0x05ef8574) /* 0.370976882 */, 18 }, + /* 5508 */ { MAD_F(0x05efe3a4) /* 0.371066704 */, 18 }, + /* 5509 */ { MAD_F(0x05f041d5) /* 0.371156532 */, 18 }, + /* 5510 */ { MAD_F(0x05f0a007) /* 0.371246365 */, 18 }, + /* 5511 */ { MAD_F(0x05f0fe3b) /* 0.371336203 */, 18 }, + /* 5512 */ { MAD_F(0x05f15c70) /* 0.371426047 */, 18 }, + /* 5513 */ { MAD_F(0x05f1baa7) /* 0.371515897 */, 18 }, + /* 5514 */ { MAD_F(0x05f218df) /* 0.371605751 */, 18 }, + /* 5515 */ { MAD_F(0x05f27719) /* 0.371695612 */, 18 }, + /* 5516 */ { MAD_F(0x05f2d554) /* 0.371785477 */, 18 }, + /* 5517 */ { MAD_F(0x05f33390) /* 0.371875348 */, 18 }, + /* 5518 */ { MAD_F(0x05f391cf) /* 0.371965225 */, 18 }, + /* 5519 */ { MAD_F(0x05f3f00e) /* 0.372055107 */, 18 }, + + /* 5520 */ { MAD_F(0x05f44e4f) /* 0.372144994 */, 18 }, + /* 5521 */ { MAD_F(0x05f4ac91) /* 0.372234887 */, 18 }, + /* 5522 */ { MAD_F(0x05f50ad5) /* 0.372324785 */, 18 }, + /* 5523 */ { MAD_F(0x05f5691b) /* 0.372414689 */, 18 }, + /* 5524 */ { MAD_F(0x05f5c761) /* 0.372504598 */, 18 }, + /* 5525 */ { MAD_F(0x05f625aa) /* 0.372594513 */, 18 }, + /* 5526 */ { MAD_F(0x05f683f3) /* 0.372684433 */, 18 }, + /* 5527 */ { MAD_F(0x05f6e23f) /* 0.372774358 */, 18 }, + /* 5528 */ { MAD_F(0x05f7408b) /* 0.372864289 */, 18 }, + /* 5529 */ { MAD_F(0x05f79ed9) /* 0.372954225 */, 18 }, + /* 5530 */ { MAD_F(0x05f7fd29) /* 0.373044167 */, 18 }, + /* 5531 */ { MAD_F(0x05f85b7a) /* 0.373134114 */, 18 }, + /* 5532 */ { MAD_F(0x05f8b9cc) /* 0.373224066 */, 18 }, + /* 5533 */ { MAD_F(0x05f91820) /* 0.373314024 */, 18 }, + /* 5534 */ { MAD_F(0x05f97675) /* 0.373403987 */, 18 }, + /* 5535 */ { MAD_F(0x05f9d4cc) /* 0.373493956 */, 18 }, + + /* 5536 */ { MAD_F(0x05fa3324) /* 0.373583930 */, 18 }, + /* 5537 */ { MAD_F(0x05fa917e) /* 0.373673910 */, 18 }, + /* 5538 */ { MAD_F(0x05faefd9) /* 0.373763895 */, 18 }, + /* 5539 */ { MAD_F(0x05fb4e36) /* 0.373853885 */, 18 }, + /* 5540 */ { MAD_F(0x05fbac94) /* 0.373943881 */, 18 }, + /* 5541 */ { MAD_F(0x05fc0af3) /* 0.374033882 */, 18 }, + /* 5542 */ { MAD_F(0x05fc6954) /* 0.374123889 */, 18 }, + /* 5543 */ { MAD_F(0x05fcc7b7) /* 0.374213901 */, 18 }, + /* 5544 */ { MAD_F(0x05fd261b) /* 0.374303918 */, 18 }, + /* 5545 */ { MAD_F(0x05fd8480) /* 0.374393941 */, 18 }, + /* 5546 */ { MAD_F(0x05fde2e7) /* 0.374483970 */, 18 }, + /* 5547 */ { MAD_F(0x05fe414f) /* 0.374574003 */, 18 }, + /* 5548 */ { MAD_F(0x05fe9fb9) /* 0.374664042 */, 18 }, + /* 5549 */ { MAD_F(0x05fefe24) /* 0.374754087 */, 18 }, + /* 5550 */ { MAD_F(0x05ff5c91) /* 0.374844137 */, 18 }, + /* 5551 */ { MAD_F(0x05ffbaff) /* 0.374934192 */, 18 }, + + /* 5552 */ { MAD_F(0x0600196e) /* 0.375024253 */, 18 }, + /* 5553 */ { MAD_F(0x060077df) /* 0.375114319 */, 18 }, + /* 5554 */ { MAD_F(0x0600d651) /* 0.375204391 */, 18 }, + /* 5555 */ { MAD_F(0x060134c5) /* 0.375294468 */, 18 }, + /* 5556 */ { MAD_F(0x0601933b) /* 0.375384550 */, 18 }, + /* 5557 */ { MAD_F(0x0601f1b1) /* 0.375474638 */, 18 }, + /* 5558 */ { MAD_F(0x0602502a) /* 0.375564731 */, 18 }, + /* 5559 */ { MAD_F(0x0602aea3) /* 0.375654830 */, 18 }, + /* 5560 */ { MAD_F(0x06030d1e) /* 0.375744934 */, 18 }, + /* 5561 */ { MAD_F(0x06036b9b) /* 0.375835043 */, 18 }, + /* 5562 */ { MAD_F(0x0603ca19) /* 0.375925158 */, 18 }, + /* 5563 */ { MAD_F(0x06042898) /* 0.376015278 */, 18 }, + /* 5564 */ { MAD_F(0x06048719) /* 0.376105404 */, 18 }, + /* 5565 */ { MAD_F(0x0604e59c) /* 0.376195535 */, 18 }, + /* 5566 */ { MAD_F(0x0605441f) /* 0.376285671 */, 18 }, + /* 5567 */ { MAD_F(0x0605a2a5) /* 0.376375813 */, 18 }, + + /* 5568 */ { MAD_F(0x0606012b) /* 0.376465960 */, 18 }, + /* 5569 */ { MAD_F(0x06065fb4) /* 0.376556113 */, 18 }, + /* 5570 */ { MAD_F(0x0606be3d) /* 0.376646271 */, 18 }, + /* 5571 */ { MAD_F(0x06071cc8) /* 0.376736434 */, 18 }, + /* 5572 */ { MAD_F(0x06077b55) /* 0.376826603 */, 18 }, + /* 5573 */ { MAD_F(0x0607d9e3) /* 0.376916777 */, 18 }, + /* 5574 */ { MAD_F(0x06083872) /* 0.377006957 */, 18 }, + /* 5575 */ { MAD_F(0x06089703) /* 0.377097141 */, 18 }, + /* 5576 */ { MAD_F(0x0608f595) /* 0.377187332 */, 18 }, + /* 5577 */ { MAD_F(0x06095429) /* 0.377277528 */, 18 }, + /* 5578 */ { MAD_F(0x0609b2be) /* 0.377367729 */, 18 }, + /* 5579 */ { MAD_F(0x060a1155) /* 0.377457935 */, 18 }, + /* 5580 */ { MAD_F(0x060a6fed) /* 0.377548147 */, 18 }, + /* 5581 */ { MAD_F(0x060ace86) /* 0.377638364 */, 18 }, + /* 5582 */ { MAD_F(0x060b2d21) /* 0.377728587 */, 18 }, + /* 5583 */ { MAD_F(0x060b8bbe) /* 0.377818815 */, 18 }, + + /* 5584 */ { MAD_F(0x060bea5c) /* 0.377909049 */, 18 }, + /* 5585 */ { MAD_F(0x060c48fb) /* 0.377999288 */, 18 }, + /* 5586 */ { MAD_F(0x060ca79c) /* 0.378089532 */, 18 }, + /* 5587 */ { MAD_F(0x060d063e) /* 0.378179781 */, 18 }, + /* 5588 */ { MAD_F(0x060d64e1) /* 0.378270036 */, 18 }, + /* 5589 */ { MAD_F(0x060dc387) /* 0.378360297 */, 18 }, + /* 5590 */ { MAD_F(0x060e222d) /* 0.378450563 */, 18 }, + /* 5591 */ { MAD_F(0x060e80d5) /* 0.378540834 */, 18 }, + /* 5592 */ { MAD_F(0x060edf7f) /* 0.378631110 */, 18 }, + /* 5593 */ { MAD_F(0x060f3e29) /* 0.378721392 */, 18 }, + /* 5594 */ { MAD_F(0x060f9cd6) /* 0.378811680 */, 18 }, + /* 5595 */ { MAD_F(0x060ffb83) /* 0.378901972 */, 18 }, + /* 5596 */ { MAD_F(0x06105a33) /* 0.378992270 */, 18 }, + /* 5597 */ { MAD_F(0x0610b8e3) /* 0.379082574 */, 18 }, + /* 5598 */ { MAD_F(0x06111795) /* 0.379172883 */, 18 }, + /* 5599 */ { MAD_F(0x06117649) /* 0.379263197 */, 18 }, + + /* 5600 */ { MAD_F(0x0611d4fe) /* 0.379353516 */, 18 }, + /* 5601 */ { MAD_F(0x061233b4) /* 0.379443841 */, 18 }, + /* 5602 */ { MAD_F(0x0612926c) /* 0.379534172 */, 18 }, + /* 5603 */ { MAD_F(0x0612f125) /* 0.379624507 */, 18 }, + /* 5604 */ { MAD_F(0x06134fe0) /* 0.379714848 */, 18 }, + /* 5605 */ { MAD_F(0x0613ae9c) /* 0.379805195 */, 18 }, + /* 5606 */ { MAD_F(0x06140d5a) /* 0.379895547 */, 18 }, + /* 5607 */ { MAD_F(0x06146c19) /* 0.379985904 */, 18 }, + /* 5608 */ { MAD_F(0x0614cada) /* 0.380076266 */, 18 }, + /* 5609 */ { MAD_F(0x0615299c) /* 0.380166634 */, 18 }, + /* 5610 */ { MAD_F(0x0615885f) /* 0.380257008 */, 18 }, + /* 5611 */ { MAD_F(0x0615e724) /* 0.380347386 */, 18 }, + /* 5612 */ { MAD_F(0x061645ea) /* 0.380437770 */, 18 }, + /* 5613 */ { MAD_F(0x0616a4b2) /* 0.380528160 */, 18 }, + /* 5614 */ { MAD_F(0x0617037b) /* 0.380618555 */, 18 }, + /* 5615 */ { MAD_F(0x06176246) /* 0.380708955 */, 18 }, + + /* 5616 */ { MAD_F(0x0617c112) /* 0.380799360 */, 18 }, + /* 5617 */ { MAD_F(0x06181fdf) /* 0.380889771 */, 18 }, + /* 5618 */ { MAD_F(0x06187eae) /* 0.380980187 */, 18 }, + /* 5619 */ { MAD_F(0x0618dd7e) /* 0.381070609 */, 18 }, + /* 5620 */ { MAD_F(0x06193c50) /* 0.381161036 */, 18 }, + /* 5621 */ { MAD_F(0x06199b24) /* 0.381251468 */, 18 }, + /* 5622 */ { MAD_F(0x0619f9f8) /* 0.381341906 */, 18 }, + /* 5623 */ { MAD_F(0x061a58ce) /* 0.381432349 */, 18 }, + /* 5624 */ { MAD_F(0x061ab7a6) /* 0.381522798 */, 18 }, + /* 5625 */ { MAD_F(0x061b167f) /* 0.381613251 */, 18 }, + /* 5626 */ { MAD_F(0x061b7559) /* 0.381703711 */, 18 }, + /* 5627 */ { MAD_F(0x061bd435) /* 0.381794175 */, 18 }, + /* 5628 */ { MAD_F(0x061c3313) /* 0.381884645 */, 18 }, + /* 5629 */ { MAD_F(0x061c91f1) /* 0.381975120 */, 18 }, + /* 5630 */ { MAD_F(0x061cf0d2) /* 0.382065601 */, 18 }, + /* 5631 */ { MAD_F(0x061d4fb3) /* 0.382156087 */, 18 }, + + /* 5632 */ { MAD_F(0x061dae96) /* 0.382246578 */, 18 }, + /* 5633 */ { MAD_F(0x061e0d7b) /* 0.382337075 */, 18 }, + /* 5634 */ { MAD_F(0x061e6c61) /* 0.382427577 */, 18 }, + /* 5635 */ { MAD_F(0x061ecb48) /* 0.382518084 */, 18 }, + /* 5636 */ { MAD_F(0x061f2a31) /* 0.382608597 */, 18 }, + /* 5637 */ { MAD_F(0x061f891b) /* 0.382699115 */, 18 }, + /* 5638 */ { MAD_F(0x061fe807) /* 0.382789638 */, 18 }, + /* 5639 */ { MAD_F(0x062046f4) /* 0.382880167 */, 18 }, + /* 5640 */ { MAD_F(0x0620a5e3) /* 0.382970701 */, 18 }, + /* 5641 */ { MAD_F(0x062104d3) /* 0.383061241 */, 18 }, + /* 5642 */ { MAD_F(0x062163c4) /* 0.383151786 */, 18 }, + /* 5643 */ { MAD_F(0x0621c2b7) /* 0.383242336 */, 18 }, + /* 5644 */ { MAD_F(0x062221ab) /* 0.383332891 */, 18 }, + /* 5645 */ { MAD_F(0x062280a1) /* 0.383423452 */, 18 }, + /* 5646 */ { MAD_F(0x0622df98) /* 0.383514018 */, 18 }, + /* 5647 */ { MAD_F(0x06233e91) /* 0.383604590 */, 18 }, + + /* 5648 */ { MAD_F(0x06239d8b) /* 0.383695167 */, 18 }, + /* 5649 */ { MAD_F(0x0623fc86) /* 0.383785749 */, 18 }, + /* 5650 */ { MAD_F(0x06245b83) /* 0.383876337 */, 18 }, + /* 5651 */ { MAD_F(0x0624ba82) /* 0.383966930 */, 18 }, + /* 5652 */ { MAD_F(0x06251981) /* 0.384057528 */, 18 }, + /* 5653 */ { MAD_F(0x06257883) /* 0.384148132 */, 18 }, + /* 5654 */ { MAD_F(0x0625d785) /* 0.384238741 */, 18 }, + /* 5655 */ { MAD_F(0x06263689) /* 0.384329355 */, 18 }, + /* 5656 */ { MAD_F(0x0626958f) /* 0.384419975 */, 18 }, + /* 5657 */ { MAD_F(0x0626f496) /* 0.384510600 */, 18 }, + /* 5658 */ { MAD_F(0x0627539e) /* 0.384601230 */, 18 }, + /* 5659 */ { MAD_F(0x0627b2a8) /* 0.384691866 */, 18 }, + /* 5660 */ { MAD_F(0x062811b3) /* 0.384782507 */, 18 }, + /* 5661 */ { MAD_F(0x062870c0) /* 0.384873153 */, 18 }, + /* 5662 */ { MAD_F(0x0628cfce) /* 0.384963805 */, 18 }, + /* 5663 */ { MAD_F(0x06292ede) /* 0.385054462 */, 18 }, + + /* 5664 */ { MAD_F(0x06298def) /* 0.385145124 */, 18 }, + /* 5665 */ { MAD_F(0x0629ed01) /* 0.385235792 */, 18 }, + /* 5666 */ { MAD_F(0x062a4c15) /* 0.385326465 */, 18 }, + /* 5667 */ { MAD_F(0x062aab2a) /* 0.385417143 */, 18 }, + /* 5668 */ { MAD_F(0x062b0a41) /* 0.385507827 */, 18 }, + /* 5669 */ { MAD_F(0x062b6959) /* 0.385598516 */, 18 }, + /* 5670 */ { MAD_F(0x062bc873) /* 0.385689211 */, 18 }, + /* 5671 */ { MAD_F(0x062c278e) /* 0.385779910 */, 18 }, + /* 5672 */ { MAD_F(0x062c86aa) /* 0.385870615 */, 18 }, + /* 5673 */ { MAD_F(0x062ce5c8) /* 0.385961326 */, 18 }, + /* 5674 */ { MAD_F(0x062d44e8) /* 0.386052041 */, 18 }, + /* 5675 */ { MAD_F(0x062da408) /* 0.386142762 */, 18 }, + /* 5676 */ { MAD_F(0x062e032a) /* 0.386233489 */, 18 }, + /* 5677 */ { MAD_F(0x062e624e) /* 0.386324221 */, 18 }, + /* 5678 */ { MAD_F(0x062ec173) /* 0.386414958 */, 18 }, + /* 5679 */ { MAD_F(0x062f209a) /* 0.386505700 */, 18 }, + + /* 5680 */ { MAD_F(0x062f7fc1) /* 0.386596448 */, 18 }, + /* 5681 */ { MAD_F(0x062fdeeb) /* 0.386687201 */, 18 }, + /* 5682 */ { MAD_F(0x06303e16) /* 0.386777959 */, 18 }, + /* 5683 */ { MAD_F(0x06309d42) /* 0.386868723 */, 18 }, + /* 5684 */ { MAD_F(0x0630fc6f) /* 0.386959492 */, 18 }, + /* 5685 */ { MAD_F(0x06315b9e) /* 0.387050266 */, 18 }, + /* 5686 */ { MAD_F(0x0631bacf) /* 0.387141045 */, 18 }, + /* 5687 */ { MAD_F(0x06321a01) /* 0.387231830 */, 18 }, + /* 5688 */ { MAD_F(0x06327934) /* 0.387322621 */, 18 }, + /* 5689 */ { MAD_F(0x0632d869) /* 0.387413416 */, 18 }, + /* 5690 */ { MAD_F(0x0633379f) /* 0.387504217 */, 18 }, + /* 5691 */ { MAD_F(0x063396d7) /* 0.387595023 */, 18 }, + /* 5692 */ { MAD_F(0x0633f610) /* 0.387685835 */, 18 }, + /* 5693 */ { MAD_F(0x0634554a) /* 0.387776652 */, 18 }, + /* 5694 */ { MAD_F(0x0634b486) /* 0.387867474 */, 18 }, + /* 5695 */ { MAD_F(0x063513c3) /* 0.387958301 */, 18 }, + + /* 5696 */ { MAD_F(0x06357302) /* 0.388049134 */, 18 }, + /* 5697 */ { MAD_F(0x0635d242) /* 0.388139972 */, 18 }, + /* 5698 */ { MAD_F(0x06363184) /* 0.388230816 */, 18 }, + /* 5699 */ { MAD_F(0x063690c7) /* 0.388321665 */, 18 }, + /* 5700 */ { MAD_F(0x0636f00b) /* 0.388412519 */, 18 }, + /* 5701 */ { MAD_F(0x06374f51) /* 0.388503378 */, 18 }, + /* 5702 */ { MAD_F(0x0637ae99) /* 0.388594243 */, 18 }, + /* 5703 */ { MAD_F(0x06380de1) /* 0.388685113 */, 18 }, + /* 5704 */ { MAD_F(0x06386d2b) /* 0.388775988 */, 18 }, + /* 5705 */ { MAD_F(0x0638cc77) /* 0.388866869 */, 18 }, + /* 5706 */ { MAD_F(0x06392bc4) /* 0.388957755 */, 18 }, + /* 5707 */ { MAD_F(0x06398b12) /* 0.389048646 */, 18 }, + /* 5708 */ { MAD_F(0x0639ea62) /* 0.389139542 */, 18 }, + /* 5709 */ { MAD_F(0x063a49b4) /* 0.389230444 */, 18 }, + /* 5710 */ { MAD_F(0x063aa906) /* 0.389321352 */, 18 }, + /* 5711 */ { MAD_F(0x063b085a) /* 0.389412264 */, 18 }, + + /* 5712 */ { MAD_F(0x063b67b0) /* 0.389503182 */, 18 }, + /* 5713 */ { MAD_F(0x063bc707) /* 0.389594105 */, 18 }, + /* 5714 */ { MAD_F(0x063c265f) /* 0.389685033 */, 18 }, + /* 5715 */ { MAD_F(0x063c85b9) /* 0.389775967 */, 18 }, + /* 5716 */ { MAD_F(0x063ce514) /* 0.389866906 */, 18 }, + /* 5717 */ { MAD_F(0x063d4471) /* 0.389957850 */, 18 }, + /* 5718 */ { MAD_F(0x063da3cf) /* 0.390048800 */, 18 }, + /* 5719 */ { MAD_F(0x063e032f) /* 0.390139755 */, 18 }, + /* 5720 */ { MAD_F(0x063e6290) /* 0.390230715 */, 18 }, + /* 5721 */ { MAD_F(0x063ec1f2) /* 0.390321681 */, 18 }, + /* 5722 */ { MAD_F(0x063f2156) /* 0.390412651 */, 18 }, + /* 5723 */ { MAD_F(0x063f80bb) /* 0.390503628 */, 18 }, + /* 5724 */ { MAD_F(0x063fe022) /* 0.390594609 */, 18 }, + /* 5725 */ { MAD_F(0x06403f8a) /* 0.390685596 */, 18 }, + /* 5726 */ { MAD_F(0x06409ef3) /* 0.390776588 */, 18 }, + /* 5727 */ { MAD_F(0x0640fe5e) /* 0.390867585 */, 18 }, + + /* 5728 */ { MAD_F(0x06415dcb) /* 0.390958588 */, 18 }, + /* 5729 */ { MAD_F(0x0641bd38) /* 0.391049596 */, 18 }, + /* 5730 */ { MAD_F(0x06421ca7) /* 0.391140609 */, 18 }, + /* 5731 */ { MAD_F(0x06427c18) /* 0.391231627 */, 18 }, + /* 5732 */ { MAD_F(0x0642db8a) /* 0.391322651 */, 18 }, + /* 5733 */ { MAD_F(0x06433afd) /* 0.391413680 */, 18 }, + /* 5734 */ { MAD_F(0x06439a72) /* 0.391504714 */, 18 }, + /* 5735 */ { MAD_F(0x0643f9e9) /* 0.391595754 */, 18 }, + /* 5736 */ { MAD_F(0x06445960) /* 0.391686799 */, 18 }, + /* 5737 */ { MAD_F(0x0644b8d9) /* 0.391777849 */, 18 }, + /* 5738 */ { MAD_F(0x06451854) /* 0.391868905 */, 18 }, + /* 5739 */ { MAD_F(0x064577d0) /* 0.391959966 */, 18 }, + /* 5740 */ { MAD_F(0x0645d74d) /* 0.392051032 */, 18 }, + /* 5741 */ { MAD_F(0x064636cc) /* 0.392142103 */, 18 }, + /* 5742 */ { MAD_F(0x0646964c) /* 0.392233180 */, 18 }, + /* 5743 */ { MAD_F(0x0646f5ce) /* 0.392324262 */, 18 }, + + /* 5744 */ { MAD_F(0x06475551) /* 0.392415349 */, 18 }, + /* 5745 */ { MAD_F(0x0647b4d5) /* 0.392506442 */, 18 }, + /* 5746 */ { MAD_F(0x0648145b) /* 0.392597540 */, 18 }, + /* 5747 */ { MAD_F(0x064873e3) /* 0.392688643 */, 18 }, + /* 5748 */ { MAD_F(0x0648d36b) /* 0.392779751 */, 18 }, + /* 5749 */ { MAD_F(0x064932f6) /* 0.392870865 */, 18 }, + /* 5750 */ { MAD_F(0x06499281) /* 0.392961984 */, 18 }, + /* 5751 */ { MAD_F(0x0649f20e) /* 0.393053108 */, 18 }, + /* 5752 */ { MAD_F(0x064a519c) /* 0.393144238 */, 18 }, + /* 5753 */ { MAD_F(0x064ab12c) /* 0.393235372 */, 18 }, + /* 5754 */ { MAD_F(0x064b10be) /* 0.393326513 */, 18 }, + /* 5755 */ { MAD_F(0x064b7050) /* 0.393417658 */, 18 }, + /* 5756 */ { MAD_F(0x064bcfe4) /* 0.393508809 */, 18 }, + /* 5757 */ { MAD_F(0x064c2f7a) /* 0.393599965 */, 18 }, + /* 5758 */ { MAD_F(0x064c8f11) /* 0.393691126 */, 18 }, + /* 5759 */ { MAD_F(0x064ceea9) /* 0.393782292 */, 18 }, + + /* 5760 */ { MAD_F(0x064d4e43) /* 0.393873464 */, 18 }, + /* 5761 */ { MAD_F(0x064dadde) /* 0.393964641 */, 18 }, + /* 5762 */ { MAD_F(0x064e0d7a) /* 0.394055823 */, 18 }, + /* 5763 */ { MAD_F(0x064e6d18) /* 0.394147011 */, 18 }, + /* 5764 */ { MAD_F(0x064eccb8) /* 0.394238204 */, 18 }, + /* 5765 */ { MAD_F(0x064f2c59) /* 0.394329402 */, 18 }, + /* 5766 */ { MAD_F(0x064f8bfb) /* 0.394420605 */, 18 }, + /* 5767 */ { MAD_F(0x064feb9e) /* 0.394511814 */, 18 }, + /* 5768 */ { MAD_F(0x06504b44) /* 0.394603028 */, 18 }, + /* 5769 */ { MAD_F(0x0650aaea) /* 0.394694247 */, 18 }, + /* 5770 */ { MAD_F(0x06510a92) /* 0.394785472 */, 18 }, + /* 5771 */ { MAD_F(0x06516a3b) /* 0.394876702 */, 18 }, + /* 5772 */ { MAD_F(0x0651c9e6) /* 0.394967937 */, 18 }, + /* 5773 */ { MAD_F(0x06522992) /* 0.395059177 */, 18 }, + /* 5774 */ { MAD_F(0x06528940) /* 0.395150423 */, 18 }, + /* 5775 */ { MAD_F(0x0652e8ef) /* 0.395241673 */, 18 }, + + /* 5776 */ { MAD_F(0x0653489f) /* 0.395332930 */, 18 }, + /* 5777 */ { MAD_F(0x0653a851) /* 0.395424191 */, 18 }, + /* 5778 */ { MAD_F(0x06540804) /* 0.395515458 */, 18 }, + /* 5779 */ { MAD_F(0x065467b9) /* 0.395606730 */, 18 }, + /* 5780 */ { MAD_F(0x0654c76f) /* 0.395698007 */, 18 }, + /* 5781 */ { MAD_F(0x06552726) /* 0.395789289 */, 18 }, + /* 5782 */ { MAD_F(0x065586df) /* 0.395880577 */, 18 }, + /* 5783 */ { MAD_F(0x0655e699) /* 0.395971870 */, 18 }, + /* 5784 */ { MAD_F(0x06564655) /* 0.396063168 */, 18 }, + /* 5785 */ { MAD_F(0x0656a612) /* 0.396154472 */, 18 }, + /* 5786 */ { MAD_F(0x065705d0) /* 0.396245780 */, 18 }, + /* 5787 */ { MAD_F(0x06576590) /* 0.396337094 */, 18 }, + /* 5788 */ { MAD_F(0x0657c552) /* 0.396428414 */, 18 }, + /* 5789 */ { MAD_F(0x06582514) /* 0.396519738 */, 18 }, + /* 5790 */ { MAD_F(0x065884d9) /* 0.396611068 */, 18 }, + /* 5791 */ { MAD_F(0x0658e49e) /* 0.396702403 */, 18 }, + + /* 5792 */ { MAD_F(0x06594465) /* 0.396793743 */, 18 }, + /* 5793 */ { MAD_F(0x0659a42e) /* 0.396885089 */, 18 }, + /* 5794 */ { MAD_F(0x065a03f7) /* 0.396976440 */, 18 }, + /* 5795 */ { MAD_F(0x065a63c3) /* 0.397067796 */, 18 }, + /* 5796 */ { MAD_F(0x065ac38f) /* 0.397159157 */, 18 }, + /* 5797 */ { MAD_F(0x065b235d) /* 0.397250524 */, 18 }, + /* 5798 */ { MAD_F(0x065b832d) /* 0.397341896 */, 18 }, + /* 5799 */ { MAD_F(0x065be2fe) /* 0.397433273 */, 18 }, + /* 5800 */ { MAD_F(0x065c42d0) /* 0.397524655 */, 18 }, + /* 5801 */ { MAD_F(0x065ca2a3) /* 0.397616043 */, 18 }, + /* 5802 */ { MAD_F(0x065d0279) /* 0.397707436 */, 18 }, + /* 5803 */ { MAD_F(0x065d624f) /* 0.397798834 */, 18 }, + /* 5804 */ { MAD_F(0x065dc227) /* 0.397890237 */, 18 }, + /* 5805 */ { MAD_F(0x065e2200) /* 0.397981646 */, 18 }, + /* 5806 */ { MAD_F(0x065e81db) /* 0.398073059 */, 18 }, + /* 5807 */ { MAD_F(0x065ee1b7) /* 0.398164479 */, 18 }, + + /* 5808 */ { MAD_F(0x065f4195) /* 0.398255903 */, 18 }, + /* 5809 */ { MAD_F(0x065fa174) /* 0.398347333 */, 18 }, + /* 5810 */ { MAD_F(0x06600154) /* 0.398438767 */, 18 }, + /* 5811 */ { MAD_F(0x06606136) /* 0.398530207 */, 18 }, + /* 5812 */ { MAD_F(0x0660c119) /* 0.398621653 */, 18 }, + /* 5813 */ { MAD_F(0x066120fd) /* 0.398713103 */, 18 }, + /* 5814 */ { MAD_F(0x066180e3) /* 0.398804559 */, 18 }, + /* 5815 */ { MAD_F(0x0661e0cb) /* 0.398896020 */, 18 }, + /* 5816 */ { MAD_F(0x066240b4) /* 0.398987487 */, 18 }, + /* 5817 */ { MAD_F(0x0662a09e) /* 0.399078958 */, 18 }, + /* 5818 */ { MAD_F(0x06630089) /* 0.399170435 */, 18 }, + /* 5819 */ { MAD_F(0x06636077) /* 0.399261917 */, 18 }, + /* 5820 */ { MAD_F(0x0663c065) /* 0.399353404 */, 18 }, + /* 5821 */ { MAD_F(0x06642055) /* 0.399444897 */, 18 }, + /* 5822 */ { MAD_F(0x06648046) /* 0.399536395 */, 18 }, + /* 5823 */ { MAD_F(0x0664e039) /* 0.399627898 */, 18 }, + + /* 5824 */ { MAD_F(0x0665402d) /* 0.399719406 */, 18 }, + /* 5825 */ { MAD_F(0x0665a022) /* 0.399810919 */, 18 }, + /* 5826 */ { MAD_F(0x06660019) /* 0.399902438 */, 18 }, + /* 5827 */ { MAD_F(0x06666011) /* 0.399993962 */, 18 }, + /* 5828 */ { MAD_F(0x0666c00b) /* 0.400085491 */, 18 }, + /* 5829 */ { MAD_F(0x06672006) /* 0.400177026 */, 18 }, + /* 5830 */ { MAD_F(0x06678003) /* 0.400268565 */, 18 }, + /* 5831 */ { MAD_F(0x0667e000) /* 0.400360110 */, 18 }, + /* 5832 */ { MAD_F(0x06684000) /* 0.400451660 */, 18 }, + /* 5833 */ { MAD_F(0x0668a000) /* 0.400543216 */, 18 }, + /* 5834 */ { MAD_F(0x06690003) /* 0.400634776 */, 18 }, + /* 5835 */ { MAD_F(0x06696006) /* 0.400726342 */, 18 }, + /* 5836 */ { MAD_F(0x0669c00b) /* 0.400817913 */, 18 }, + /* 5837 */ { MAD_F(0x066a2011) /* 0.400909489 */, 18 }, + /* 5838 */ { MAD_F(0x066a8019) /* 0.401001071 */, 18 }, + /* 5839 */ { MAD_F(0x066ae022) /* 0.401092657 */, 18 }, + + /* 5840 */ { MAD_F(0x066b402d) /* 0.401184249 */, 18 }, + /* 5841 */ { MAD_F(0x066ba039) /* 0.401275847 */, 18 }, + /* 5842 */ { MAD_F(0x066c0046) /* 0.401367449 */, 18 }, + /* 5843 */ { MAD_F(0x066c6055) /* 0.401459057 */, 18 }, + /* 5844 */ { MAD_F(0x066cc065) /* 0.401550670 */, 18 }, + /* 5845 */ { MAD_F(0x066d2076) /* 0.401642288 */, 18 }, + /* 5846 */ { MAD_F(0x066d8089) /* 0.401733911 */, 18 }, + /* 5847 */ { MAD_F(0x066de09e) /* 0.401825540 */, 18 }, + /* 5848 */ { MAD_F(0x066e40b3) /* 0.401917173 */, 18 }, + /* 5849 */ { MAD_F(0x066ea0cb) /* 0.402008812 */, 18 }, + /* 5850 */ { MAD_F(0x066f00e3) /* 0.402100457 */, 18 }, + /* 5851 */ { MAD_F(0x066f60fd) /* 0.402192106 */, 18 }, + /* 5852 */ { MAD_F(0x066fc118) /* 0.402283761 */, 18 }, + /* 5853 */ { MAD_F(0x06702135) /* 0.402375420 */, 18 }, + /* 5854 */ { MAD_F(0x06708153) /* 0.402467086 */, 18 }, + /* 5855 */ { MAD_F(0x0670e173) /* 0.402558756 */, 18 }, + + /* 5856 */ { MAD_F(0x06714194) /* 0.402650431 */, 18 }, + /* 5857 */ { MAD_F(0x0671a1b6) /* 0.402742112 */, 18 }, + /* 5858 */ { MAD_F(0x067201da) /* 0.402833798 */, 18 }, + /* 5859 */ { MAD_F(0x067261ff) /* 0.402925489 */, 18 }, + /* 5860 */ { MAD_F(0x0672c226) /* 0.403017186 */, 18 }, + /* 5861 */ { MAD_F(0x0673224e) /* 0.403108887 */, 18 }, + /* 5862 */ { MAD_F(0x06738277) /* 0.403200594 */, 18 }, + /* 5863 */ { MAD_F(0x0673e2a2) /* 0.403292306 */, 18 }, + /* 5864 */ { MAD_F(0x067442ce) /* 0.403384024 */, 18 }, + /* 5865 */ { MAD_F(0x0674a2fc) /* 0.403475746 */, 18 }, + /* 5866 */ { MAD_F(0x0675032b) /* 0.403567474 */, 18 }, + /* 5867 */ { MAD_F(0x0675635b) /* 0.403659207 */, 18 }, + /* 5868 */ { MAD_F(0x0675c38d) /* 0.403750945 */, 18 }, + /* 5869 */ { MAD_F(0x067623c0) /* 0.403842688 */, 18 }, + /* 5870 */ { MAD_F(0x067683f4) /* 0.403934437 */, 18 }, + /* 5871 */ { MAD_F(0x0676e42a) /* 0.404026190 */, 18 }, + + /* 5872 */ { MAD_F(0x06774462) /* 0.404117949 */, 18 }, + /* 5873 */ { MAD_F(0x0677a49b) /* 0.404209714 */, 18 }, + /* 5874 */ { MAD_F(0x067804d5) /* 0.404301483 */, 18 }, + /* 5875 */ { MAD_F(0x06786510) /* 0.404393258 */, 18 }, + /* 5876 */ { MAD_F(0x0678c54d) /* 0.404485037 */, 18 }, + /* 5877 */ { MAD_F(0x0679258c) /* 0.404576822 */, 18 }, + /* 5878 */ { MAD_F(0x067985cb) /* 0.404668613 */, 18 }, + /* 5879 */ { MAD_F(0x0679e60c) /* 0.404760408 */, 18 }, + /* 5880 */ { MAD_F(0x067a464f) /* 0.404852209 */, 18 }, + /* 5881 */ { MAD_F(0x067aa693) /* 0.404944014 */, 18 }, + /* 5882 */ { MAD_F(0x067b06d8) /* 0.405035825 */, 18 }, + /* 5883 */ { MAD_F(0x067b671f) /* 0.405127642 */, 18 }, + /* 5884 */ { MAD_F(0x067bc767) /* 0.405219463 */, 18 }, + /* 5885 */ { MAD_F(0x067c27b1) /* 0.405311290 */, 18 }, + /* 5886 */ { MAD_F(0x067c87fc) /* 0.405403122 */, 18 }, + /* 5887 */ { MAD_F(0x067ce848) /* 0.405494959 */, 18 }, + + /* 5888 */ { MAD_F(0x067d4896) /* 0.405586801 */, 18 }, + /* 5889 */ { MAD_F(0x067da8e5) /* 0.405678648 */, 18 }, + /* 5890 */ { MAD_F(0x067e0935) /* 0.405770501 */, 18 }, + /* 5891 */ { MAD_F(0x067e6987) /* 0.405862359 */, 18 }, + /* 5892 */ { MAD_F(0x067ec9da) /* 0.405954222 */, 18 }, + /* 5893 */ { MAD_F(0x067f2a2f) /* 0.406046090 */, 18 }, + /* 5894 */ { MAD_F(0x067f8a85) /* 0.406137963 */, 18 }, + /* 5895 */ { MAD_F(0x067feadd) /* 0.406229842 */, 18 }, + /* 5896 */ { MAD_F(0x06804b36) /* 0.406321726 */, 18 }, + /* 5897 */ { MAD_F(0x0680ab90) /* 0.406413615 */, 18 }, + /* 5898 */ { MAD_F(0x06810beb) /* 0.406505509 */, 18 }, + /* 5899 */ { MAD_F(0x06816c49) /* 0.406597408 */, 18 }, + /* 5900 */ { MAD_F(0x0681cca7) /* 0.406689313 */, 18 }, + /* 5901 */ { MAD_F(0x06822d07) /* 0.406781223 */, 18 }, + /* 5902 */ { MAD_F(0x06828d68) /* 0.406873138 */, 18 }, + /* 5903 */ { MAD_F(0x0682edcb) /* 0.406965058 */, 18 }, + + /* 5904 */ { MAD_F(0x06834e2f) /* 0.407056983 */, 18 }, + /* 5905 */ { MAD_F(0x0683ae94) /* 0.407148914 */, 18 }, + /* 5906 */ { MAD_F(0x06840efb) /* 0.407240850 */, 18 }, + /* 5907 */ { MAD_F(0x06846f63) /* 0.407332791 */, 18 }, + /* 5908 */ { MAD_F(0x0684cfcd) /* 0.407424737 */, 18 }, + /* 5909 */ { MAD_F(0x06853038) /* 0.407516688 */, 18 }, + /* 5910 */ { MAD_F(0x068590a4) /* 0.407608645 */, 18 }, + /* 5911 */ { MAD_F(0x0685f112) /* 0.407700606 */, 18 }, + /* 5912 */ { MAD_F(0x06865181) /* 0.407792573 */, 18 }, + /* 5913 */ { MAD_F(0x0686b1f2) /* 0.407884545 */, 18 }, + /* 5914 */ { MAD_F(0x06871264) /* 0.407976522 */, 18 }, + /* 5915 */ { MAD_F(0x068772d7) /* 0.408068505 */, 18 }, + /* 5916 */ { MAD_F(0x0687d34c) /* 0.408160492 */, 18 }, + /* 5917 */ { MAD_F(0x068833c2) /* 0.408252485 */, 18 }, + /* 5918 */ { MAD_F(0x06889439) /* 0.408344483 */, 18 }, + /* 5919 */ { MAD_F(0x0688f4b2) /* 0.408436486 */, 18 }, + + /* 5920 */ { MAD_F(0x0689552c) /* 0.408528495 */, 18 }, + /* 5921 */ { MAD_F(0x0689b5a8) /* 0.408620508 */, 18 }, + /* 5922 */ { MAD_F(0x068a1625) /* 0.408712527 */, 18 }, + /* 5923 */ { MAD_F(0x068a76a4) /* 0.408804551 */, 18 }, + /* 5924 */ { MAD_F(0x068ad724) /* 0.408896580 */, 18 }, + /* 5925 */ { MAD_F(0x068b37a5) /* 0.408988614 */, 18 }, + /* 5926 */ { MAD_F(0x068b9827) /* 0.409080653 */, 18 }, + /* 5927 */ { MAD_F(0x068bf8ac) /* 0.409172698 */, 18 }, + /* 5928 */ { MAD_F(0x068c5931) /* 0.409264748 */, 18 }, + /* 5929 */ { MAD_F(0x068cb9b8) /* 0.409356803 */, 18 }, + /* 5930 */ { MAD_F(0x068d1a40) /* 0.409448863 */, 18 }, + /* 5931 */ { MAD_F(0x068d7aca) /* 0.409540928 */, 18 }, + /* 5932 */ { MAD_F(0x068ddb54) /* 0.409632999 */, 18 }, + /* 5933 */ { MAD_F(0x068e3be1) /* 0.409725074 */, 18 }, + /* 5934 */ { MAD_F(0x068e9c6f) /* 0.409817155 */, 18 }, + /* 5935 */ { MAD_F(0x068efcfe) /* 0.409909241 */, 18 }, + + /* 5936 */ { MAD_F(0x068f5d8e) /* 0.410001332 */, 18 }, + /* 5937 */ { MAD_F(0x068fbe20) /* 0.410093428 */, 18 }, + /* 5938 */ { MAD_F(0x06901eb4) /* 0.410185530 */, 18 }, + /* 5939 */ { MAD_F(0x06907f48) /* 0.410277637 */, 18 }, + /* 5940 */ { MAD_F(0x0690dfde) /* 0.410369748 */, 18 }, + /* 5941 */ { MAD_F(0x06914076) /* 0.410461865 */, 18 }, + /* 5942 */ { MAD_F(0x0691a10f) /* 0.410553988 */, 18 }, + /* 5943 */ { MAD_F(0x069201a9) /* 0.410646115 */, 18 }, + /* 5944 */ { MAD_F(0x06926245) /* 0.410738247 */, 18 }, + /* 5945 */ { MAD_F(0x0692c2e2) /* 0.410830385 */, 18 }, + /* 5946 */ { MAD_F(0x06932380) /* 0.410922528 */, 18 }, + /* 5947 */ { MAD_F(0x06938420) /* 0.411014676 */, 18 }, + /* 5948 */ { MAD_F(0x0693e4c1) /* 0.411106829 */, 18 }, + /* 5949 */ { MAD_F(0x06944563) /* 0.411198987 */, 18 }, + /* 5950 */ { MAD_F(0x0694a607) /* 0.411291151 */, 18 }, + /* 5951 */ { MAD_F(0x069506ad) /* 0.411383320 */, 18 }, + + /* 5952 */ { MAD_F(0x06956753) /* 0.411475493 */, 18 }, + /* 5953 */ { MAD_F(0x0695c7fc) /* 0.411567672 */, 18 }, + /* 5954 */ { MAD_F(0x069628a5) /* 0.411659857 */, 18 }, + /* 5955 */ { MAD_F(0x06968950) /* 0.411752046 */, 18 }, + /* 5956 */ { MAD_F(0x0696e9fc) /* 0.411844240 */, 18 }, + /* 5957 */ { MAD_F(0x06974aaa) /* 0.411936440 */, 18 }, + /* 5958 */ { MAD_F(0x0697ab59) /* 0.412028645 */, 18 }, + /* 5959 */ { MAD_F(0x06980c09) /* 0.412120855 */, 18 }, + /* 5960 */ { MAD_F(0x06986cbb) /* 0.412213070 */, 18 }, + /* 5961 */ { MAD_F(0x0698cd6e) /* 0.412305290 */, 18 }, + /* 5962 */ { MAD_F(0x06992e23) /* 0.412397516 */, 18 }, + /* 5963 */ { MAD_F(0x06998ed9) /* 0.412489746 */, 18 }, + /* 5964 */ { MAD_F(0x0699ef90) /* 0.412581982 */, 18 }, + /* 5965 */ { MAD_F(0x069a5049) /* 0.412674223 */, 18 }, + /* 5966 */ { MAD_F(0x069ab103) /* 0.412766469 */, 18 }, + /* 5967 */ { MAD_F(0x069b11bf) /* 0.412858720 */, 18 }, + + /* 5968 */ { MAD_F(0x069b727b) /* 0.412950976 */, 18 }, + /* 5969 */ { MAD_F(0x069bd33a) /* 0.413043238 */, 18 }, + /* 5970 */ { MAD_F(0x069c33f9) /* 0.413135505 */, 18 }, + /* 5971 */ { MAD_F(0x069c94ba) /* 0.413227776 */, 18 }, + /* 5972 */ { MAD_F(0x069cf57d) /* 0.413320053 */, 18 }, + /* 5973 */ { MAD_F(0x069d5641) /* 0.413412335 */, 18 }, + /* 5974 */ { MAD_F(0x069db706) /* 0.413504623 */, 18 }, + /* 5975 */ { MAD_F(0x069e17cc) /* 0.413596915 */, 18 }, + /* 5976 */ { MAD_F(0x069e7894) /* 0.413689213 */, 18 }, + /* 5977 */ { MAD_F(0x069ed95e) /* 0.413781515 */, 18 }, + /* 5978 */ { MAD_F(0x069f3a28) /* 0.413873823 */, 18 }, + /* 5979 */ { MAD_F(0x069f9af4) /* 0.413966136 */, 18 }, + /* 5980 */ { MAD_F(0x069ffbc2) /* 0.414058454 */, 18 }, + /* 5981 */ { MAD_F(0x06a05c91) /* 0.414150778 */, 18 }, + /* 5982 */ { MAD_F(0x06a0bd61) /* 0.414243106 */, 18 }, + /* 5983 */ { MAD_F(0x06a11e32) /* 0.414335440 */, 18 }, + + /* 5984 */ { MAD_F(0x06a17f05) /* 0.414427779 */, 18 }, + /* 5985 */ { MAD_F(0x06a1dfda) /* 0.414520122 */, 18 }, + /* 5986 */ { MAD_F(0x06a240b0) /* 0.414612471 */, 18 }, + /* 5987 */ { MAD_F(0x06a2a187) /* 0.414704826 */, 18 }, + /* 5988 */ { MAD_F(0x06a3025f) /* 0.414797185 */, 18 }, + /* 5989 */ { MAD_F(0x06a36339) /* 0.414889549 */, 18 }, + /* 5990 */ { MAD_F(0x06a3c414) /* 0.414981919 */, 18 }, + /* 5991 */ { MAD_F(0x06a424f1) /* 0.415074294 */, 18 }, + /* 5992 */ { MAD_F(0x06a485cf) /* 0.415166674 */, 18 }, + /* 5993 */ { MAD_F(0x06a4e6ae) /* 0.415259059 */, 18 }, + /* 5994 */ { MAD_F(0x06a5478f) /* 0.415351449 */, 18 }, + /* 5995 */ { MAD_F(0x06a5a871) /* 0.415443844 */, 18 }, + /* 5996 */ { MAD_F(0x06a60955) /* 0.415536244 */, 18 }, + /* 5997 */ { MAD_F(0x06a66a3a) /* 0.415628650 */, 18 }, + /* 5998 */ { MAD_F(0x06a6cb20) /* 0.415721061 */, 18 }, + /* 5999 */ { MAD_F(0x06a72c08) /* 0.415813476 */, 18 }, + + /* 6000 */ { MAD_F(0x06a78cf1) /* 0.415905897 */, 18 }, + /* 6001 */ { MAD_F(0x06a7eddb) /* 0.415998324 */, 18 }, + /* 6002 */ { MAD_F(0x06a84ec7) /* 0.416090755 */, 18 }, + /* 6003 */ { MAD_F(0x06a8afb4) /* 0.416183191 */, 18 }, + /* 6004 */ { MAD_F(0x06a910a3) /* 0.416275633 */, 18 }, + /* 6005 */ { MAD_F(0x06a97193) /* 0.416368079 */, 18 }, + /* 6006 */ { MAD_F(0x06a9d284) /* 0.416460531 */, 18 }, + /* 6007 */ { MAD_F(0x06aa3377) /* 0.416552988 */, 18 }, + /* 6008 */ { MAD_F(0x06aa946b) /* 0.416645450 */, 18 }, + /* 6009 */ { MAD_F(0x06aaf561) /* 0.416737917 */, 18 }, + /* 6010 */ { MAD_F(0x06ab5657) /* 0.416830389 */, 18 }, + /* 6011 */ { MAD_F(0x06abb750) /* 0.416922867 */, 18 }, + /* 6012 */ { MAD_F(0x06ac1849) /* 0.417015349 */, 18 }, + /* 6013 */ { MAD_F(0x06ac7944) /* 0.417107837 */, 18 }, + /* 6014 */ { MAD_F(0x06acda41) /* 0.417200330 */, 18 }, + /* 6015 */ { MAD_F(0x06ad3b3e) /* 0.417292828 */, 18 }, + + /* 6016 */ { MAD_F(0x06ad9c3d) /* 0.417385331 */, 18 }, + /* 6017 */ { MAD_F(0x06adfd3e) /* 0.417477839 */, 18 }, + /* 6018 */ { MAD_F(0x06ae5e40) /* 0.417570352 */, 18 }, + /* 6019 */ { MAD_F(0x06aebf43) /* 0.417662871 */, 18 }, + /* 6020 */ { MAD_F(0x06af2047) /* 0.417755394 */, 18 }, + /* 6021 */ { MAD_F(0x06af814d) /* 0.417847923 */, 18 }, + /* 6022 */ { MAD_F(0x06afe255) /* 0.417940457 */, 18 }, + /* 6023 */ { MAD_F(0x06b0435e) /* 0.418032996 */, 18 }, + /* 6024 */ { MAD_F(0x06b0a468) /* 0.418125540 */, 18 }, + /* 6025 */ { MAD_F(0x06b10573) /* 0.418218089 */, 18 }, + /* 6026 */ { MAD_F(0x06b16680) /* 0.418310643 */, 18 }, + /* 6027 */ { MAD_F(0x06b1c78e) /* 0.418403203 */, 18 }, + /* 6028 */ { MAD_F(0x06b2289e) /* 0.418495767 */, 18 }, + /* 6029 */ { MAD_F(0x06b289af) /* 0.418588337 */, 18 }, + /* 6030 */ { MAD_F(0x06b2eac1) /* 0.418680911 */, 18 }, + /* 6031 */ { MAD_F(0x06b34bd5) /* 0.418773491 */, 18 }, + + /* 6032 */ { MAD_F(0x06b3acea) /* 0.418866076 */, 18 }, + /* 6033 */ { MAD_F(0x06b40e00) /* 0.418958666 */, 18 }, + /* 6034 */ { MAD_F(0x06b46f18) /* 0.419051262 */, 18 }, + /* 6035 */ { MAD_F(0x06b4d031) /* 0.419143862 */, 18 }, + /* 6036 */ { MAD_F(0x06b5314c) /* 0.419236467 */, 18 }, + /* 6037 */ { MAD_F(0x06b59268) /* 0.419329078 */, 18 }, + /* 6038 */ { MAD_F(0x06b5f385) /* 0.419421694 */, 18 }, + /* 6039 */ { MAD_F(0x06b654a4) /* 0.419514314 */, 18 }, + /* 6040 */ { MAD_F(0x06b6b5c4) /* 0.419606940 */, 18 }, + /* 6041 */ { MAD_F(0x06b716e6) /* 0.419699571 */, 18 }, + /* 6042 */ { MAD_F(0x06b77808) /* 0.419792208 */, 18 }, + /* 6043 */ { MAD_F(0x06b7d92d) /* 0.419884849 */, 18 }, + /* 6044 */ { MAD_F(0x06b83a52) /* 0.419977495 */, 18 }, + /* 6045 */ { MAD_F(0x06b89b79) /* 0.420070147 */, 18 }, + /* 6046 */ { MAD_F(0x06b8fca1) /* 0.420162803 */, 18 }, + /* 6047 */ { MAD_F(0x06b95dcb) /* 0.420255465 */, 18 }, + + /* 6048 */ { MAD_F(0x06b9bef6) /* 0.420348132 */, 18 }, + /* 6049 */ { MAD_F(0x06ba2023) /* 0.420440803 */, 18 }, + /* 6050 */ { MAD_F(0x06ba8150) /* 0.420533481 */, 18 }, + /* 6051 */ { MAD_F(0x06bae280) /* 0.420626163 */, 18 }, + /* 6052 */ { MAD_F(0x06bb43b0) /* 0.420718850 */, 18 }, + /* 6053 */ { MAD_F(0x06bba4e2) /* 0.420811542 */, 18 }, + /* 6054 */ { MAD_F(0x06bc0615) /* 0.420904240 */, 18 }, + /* 6055 */ { MAD_F(0x06bc674a) /* 0.420996942 */, 18 }, + /* 6056 */ { MAD_F(0x06bcc880) /* 0.421089650 */, 18 }, + /* 6057 */ { MAD_F(0x06bd29b7) /* 0.421182362 */, 18 }, + /* 6058 */ { MAD_F(0x06bd8af0) /* 0.421275080 */, 18 }, + /* 6059 */ { MAD_F(0x06bdec2a) /* 0.421367803 */, 18 }, + /* 6060 */ { MAD_F(0x06be4d66) /* 0.421460531 */, 18 }, + /* 6061 */ { MAD_F(0x06beaea3) /* 0.421553264 */, 18 }, + /* 6062 */ { MAD_F(0x06bf0fe1) /* 0.421646003 */, 18 }, + /* 6063 */ { MAD_F(0x06bf7120) /* 0.421738746 */, 18 }, + + /* 6064 */ { MAD_F(0x06bfd261) /* 0.421831494 */, 18 }, + /* 6065 */ { MAD_F(0x06c033a4) /* 0.421924248 */, 18 }, + /* 6066 */ { MAD_F(0x06c094e7) /* 0.422017007 */, 18 }, + /* 6067 */ { MAD_F(0x06c0f62c) /* 0.422109770 */, 18 }, + /* 6068 */ { MAD_F(0x06c15773) /* 0.422202539 */, 18 }, + /* 6069 */ { MAD_F(0x06c1b8bb) /* 0.422295313 */, 18 }, + /* 6070 */ { MAD_F(0x06c21a04) /* 0.422388092 */, 18 }, + /* 6071 */ { MAD_F(0x06c27b4e) /* 0.422480876 */, 18 }, + /* 6072 */ { MAD_F(0x06c2dc9a) /* 0.422573665 */, 18 }, + /* 6073 */ { MAD_F(0x06c33de8) /* 0.422666460 */, 18 }, + /* 6074 */ { MAD_F(0x06c39f36) /* 0.422759259 */, 18 }, + /* 6075 */ { MAD_F(0x06c40086) /* 0.422852064 */, 18 }, + /* 6076 */ { MAD_F(0x06c461d8) /* 0.422944873 */, 18 }, + /* 6077 */ { MAD_F(0x06c4c32a) /* 0.423037688 */, 18 }, + /* 6078 */ { MAD_F(0x06c5247f) /* 0.423130508 */, 18 }, + /* 6079 */ { MAD_F(0x06c585d4) /* 0.423223333 */, 18 }, + + /* 6080 */ { MAD_F(0x06c5e72b) /* 0.423316162 */, 18 }, + /* 6081 */ { MAD_F(0x06c64883) /* 0.423408997 */, 18 }, + /* 6082 */ { MAD_F(0x06c6a9dd) /* 0.423501838 */, 18 }, + /* 6083 */ { MAD_F(0x06c70b38) /* 0.423594683 */, 18 }, + /* 6084 */ { MAD_F(0x06c76c94) /* 0.423687533 */, 18 }, + /* 6085 */ { MAD_F(0x06c7cdf2) /* 0.423780389 */, 18 }, + /* 6086 */ { MAD_F(0x06c82f51) /* 0.423873249 */, 18 }, + /* 6087 */ { MAD_F(0x06c890b1) /* 0.423966115 */, 18 }, + /* 6088 */ { MAD_F(0x06c8f213) /* 0.424058985 */, 18 }, + /* 6089 */ { MAD_F(0x06c95376) /* 0.424151861 */, 18 }, + /* 6090 */ { MAD_F(0x06c9b4da) /* 0.424244742 */, 18 }, + /* 6091 */ { MAD_F(0x06ca1640) /* 0.424337628 */, 18 }, + /* 6092 */ { MAD_F(0x06ca77a8) /* 0.424430519 */, 18 }, + /* 6093 */ { MAD_F(0x06cad910) /* 0.424523415 */, 18 }, + /* 6094 */ { MAD_F(0x06cb3a7a) /* 0.424616316 */, 18 }, + /* 6095 */ { MAD_F(0x06cb9be5) /* 0.424709222 */, 18 }, + + /* 6096 */ { MAD_F(0x06cbfd52) /* 0.424802133 */, 18 }, + /* 6097 */ { MAD_F(0x06cc5ec0) /* 0.424895050 */, 18 }, + /* 6098 */ { MAD_F(0x06ccc030) /* 0.424987971 */, 18 }, + /* 6099 */ { MAD_F(0x06cd21a0) /* 0.425080898 */, 18 }, + /* 6100 */ { MAD_F(0x06cd8313) /* 0.425173829 */, 18 }, + /* 6101 */ { MAD_F(0x06cde486) /* 0.425266766 */, 18 }, + /* 6102 */ { MAD_F(0x06ce45fb) /* 0.425359708 */, 18 }, + /* 6103 */ { MAD_F(0x06cea771) /* 0.425452655 */, 18 }, + /* 6104 */ { MAD_F(0x06cf08e9) /* 0.425545607 */, 18 }, + /* 6105 */ { MAD_F(0x06cf6a62) /* 0.425638564 */, 18 }, + /* 6106 */ { MAD_F(0x06cfcbdc) /* 0.425731526 */, 18 }, + /* 6107 */ { MAD_F(0x06d02d58) /* 0.425824493 */, 18 }, + /* 6108 */ { MAD_F(0x06d08ed5) /* 0.425917465 */, 18 }, + /* 6109 */ { MAD_F(0x06d0f053) /* 0.426010443 */, 18 }, + /* 6110 */ { MAD_F(0x06d151d3) /* 0.426103425 */, 18 }, + /* 6111 */ { MAD_F(0x06d1b354) /* 0.426196412 */, 18 }, + + /* 6112 */ { MAD_F(0x06d214d7) /* 0.426289405 */, 18 }, + /* 6113 */ { MAD_F(0x06d2765a) /* 0.426382403 */, 18 }, + /* 6114 */ { MAD_F(0x06d2d7e0) /* 0.426475405 */, 18 }, + /* 6115 */ { MAD_F(0x06d33966) /* 0.426568413 */, 18 }, + /* 6116 */ { MAD_F(0x06d39aee) /* 0.426661426 */, 18 }, + /* 6117 */ { MAD_F(0x06d3fc77) /* 0.426754444 */, 18 }, + /* 6118 */ { MAD_F(0x06d45e02) /* 0.426847467 */, 18 }, + /* 6119 */ { MAD_F(0x06d4bf8e) /* 0.426940495 */, 18 }, + /* 6120 */ { MAD_F(0x06d5211c) /* 0.427033528 */, 18 }, + /* 6121 */ { MAD_F(0x06d582aa) /* 0.427126566 */, 18 }, + /* 6122 */ { MAD_F(0x06d5e43a) /* 0.427219609 */, 18 }, + /* 6123 */ { MAD_F(0x06d645cc) /* 0.427312657 */, 18 }, + /* 6124 */ { MAD_F(0x06d6a75f) /* 0.427405711 */, 18 }, + /* 6125 */ { MAD_F(0x06d708f3) /* 0.427498769 */, 18 }, + /* 6126 */ { MAD_F(0x06d76a88) /* 0.427591833 */, 18 }, + /* 6127 */ { MAD_F(0x06d7cc1f) /* 0.427684901 */, 18 }, + + /* 6128 */ { MAD_F(0x06d82db8) /* 0.427777975 */, 18 }, + /* 6129 */ { MAD_F(0x06d88f51) /* 0.427871054 */, 18 }, + /* 6130 */ { MAD_F(0x06d8f0ec) /* 0.427964137 */, 18 }, + /* 6131 */ { MAD_F(0x06d95288) /* 0.428057226 */, 18 }, + /* 6132 */ { MAD_F(0x06d9b426) /* 0.428150320 */, 18 }, + /* 6133 */ { MAD_F(0x06da15c5) /* 0.428243419 */, 18 }, + /* 6134 */ { MAD_F(0x06da7766) /* 0.428336523 */, 18 }, + /* 6135 */ { MAD_F(0x06dad907) /* 0.428429632 */, 18 }, + /* 6136 */ { MAD_F(0x06db3aaa) /* 0.428522746 */, 18 }, + /* 6137 */ { MAD_F(0x06db9c4f) /* 0.428615865 */, 18 }, + /* 6138 */ { MAD_F(0x06dbfdf5) /* 0.428708989 */, 18 }, + /* 6139 */ { MAD_F(0x06dc5f9c) /* 0.428802119 */, 18 }, + /* 6140 */ { MAD_F(0x06dcc145) /* 0.428895253 */, 18 }, + /* 6141 */ { MAD_F(0x06dd22ee) /* 0.428988392 */, 18 }, + /* 6142 */ { MAD_F(0x06dd849a) /* 0.429081537 */, 18 }, + /* 6143 */ { MAD_F(0x06dde646) /* 0.429174686 */, 18 }, + + /* 6144 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 18 }, + /* 6145 */ { MAD_F(0x06dea9a4) /* 0.429361001 */, 18 }, + /* 6146 */ { MAD_F(0x06df0b54) /* 0.429454165 */, 18 }, + /* 6147 */ { MAD_F(0x06df6d06) /* 0.429547335 */, 18 }, + /* 6148 */ { MAD_F(0x06dfceba) /* 0.429640510 */, 18 }, + /* 6149 */ { MAD_F(0x06e0306f) /* 0.429733690 */, 18 }, + /* 6150 */ { MAD_F(0x06e09225) /* 0.429826874 */, 18 }, + /* 6151 */ { MAD_F(0x06e0f3dc) /* 0.429920064 */, 18 }, + /* 6152 */ { MAD_F(0x06e15595) /* 0.430013259 */, 18 }, + /* 6153 */ { MAD_F(0x06e1b74f) /* 0.430106459 */, 18 }, + /* 6154 */ { MAD_F(0x06e2190b) /* 0.430199664 */, 18 }, + /* 6155 */ { MAD_F(0x06e27ac8) /* 0.430292875 */, 18 }, + /* 6156 */ { MAD_F(0x06e2dc86) /* 0.430386090 */, 18 }, + /* 6157 */ { MAD_F(0x06e33e46) /* 0.430479310 */, 18 }, + /* 6158 */ { MAD_F(0x06e3a007) /* 0.430572535 */, 18 }, + /* 6159 */ { MAD_F(0x06e401c9) /* 0.430665765 */, 18 }, + + /* 6160 */ { MAD_F(0x06e4638d) /* 0.430759001 */, 18 }, + /* 6161 */ { MAD_F(0x06e4c552) /* 0.430852241 */, 18 }, + /* 6162 */ { MAD_F(0x06e52718) /* 0.430945487 */, 18 }, + /* 6163 */ { MAD_F(0x06e588e0) /* 0.431038737 */, 18 }, + /* 6164 */ { MAD_F(0x06e5eaa9) /* 0.431131993 */, 18 }, + /* 6165 */ { MAD_F(0x06e64c73) /* 0.431225253 */, 18 }, + /* 6166 */ { MAD_F(0x06e6ae3f) /* 0.431318519 */, 18 }, + /* 6167 */ { MAD_F(0x06e7100c) /* 0.431411790 */, 18 }, + /* 6168 */ { MAD_F(0x06e771db) /* 0.431505065 */, 18 }, + /* 6169 */ { MAD_F(0x06e7d3ab) /* 0.431598346 */, 18 }, + /* 6170 */ { MAD_F(0x06e8357c) /* 0.431691632 */, 18 }, + /* 6171 */ { MAD_F(0x06e8974e) /* 0.431784923 */, 18 }, + /* 6172 */ { MAD_F(0x06e8f922) /* 0.431878218 */, 18 }, + /* 6173 */ { MAD_F(0x06e95af8) /* 0.431971519 */, 18 }, + /* 6174 */ { MAD_F(0x06e9bcce) /* 0.432064825 */, 18 }, + /* 6175 */ { MAD_F(0x06ea1ea6) /* 0.432158136 */, 18 }, + + /* 6176 */ { MAD_F(0x06ea807f) /* 0.432251452 */, 18 }, + /* 6177 */ { MAD_F(0x06eae25a) /* 0.432344773 */, 18 }, + /* 6178 */ { MAD_F(0x06eb4436) /* 0.432438099 */, 18 }, + /* 6179 */ { MAD_F(0x06eba614) /* 0.432531431 */, 18 }, + /* 6180 */ { MAD_F(0x06ec07f2) /* 0.432624767 */, 18 }, + /* 6181 */ { MAD_F(0x06ec69d2) /* 0.432718108 */, 18 }, + /* 6182 */ { MAD_F(0x06eccbb4) /* 0.432811454 */, 18 }, + /* 6183 */ { MAD_F(0x06ed2d97) /* 0.432904805 */, 18 }, + /* 6184 */ { MAD_F(0x06ed8f7b) /* 0.432998162 */, 18 }, + /* 6185 */ { MAD_F(0x06edf160) /* 0.433091523 */, 18 }, + /* 6186 */ { MAD_F(0x06ee5347) /* 0.433184889 */, 18 }, + /* 6187 */ { MAD_F(0x06eeb52f) /* 0.433278261 */, 18 }, + /* 6188 */ { MAD_F(0x06ef1719) /* 0.433371637 */, 18 }, + /* 6189 */ { MAD_F(0x06ef7904) /* 0.433465019 */, 18 }, + /* 6190 */ { MAD_F(0x06efdaf0) /* 0.433558405 */, 18 }, + /* 6191 */ { MAD_F(0x06f03cde) /* 0.433651797 */, 18 }, + + /* 6192 */ { MAD_F(0x06f09ecc) /* 0.433745193 */, 18 }, + /* 6193 */ { MAD_F(0x06f100bd) /* 0.433838595 */, 18 }, + /* 6194 */ { MAD_F(0x06f162ae) /* 0.433932001 */, 18 }, + /* 6195 */ { MAD_F(0x06f1c4a1) /* 0.434025413 */, 18 }, + /* 6196 */ { MAD_F(0x06f22696) /* 0.434118830 */, 18 }, + /* 6197 */ { MAD_F(0x06f2888b) /* 0.434212251 */, 18 }, + /* 6198 */ { MAD_F(0x06f2ea82) /* 0.434305678 */, 18 }, + /* 6199 */ { MAD_F(0x06f34c7b) /* 0.434399110 */, 18 }, + /* 6200 */ { MAD_F(0x06f3ae75) /* 0.434492546 */, 18 }, + /* 6201 */ { MAD_F(0x06f41070) /* 0.434585988 */, 18 }, + /* 6202 */ { MAD_F(0x06f4726c) /* 0.434679435 */, 18 }, + /* 6203 */ { MAD_F(0x06f4d46a) /* 0.434772887 */, 18 }, + /* 6204 */ { MAD_F(0x06f53669) /* 0.434866344 */, 18 }, + /* 6205 */ { MAD_F(0x06f59869) /* 0.434959806 */, 18 }, + /* 6206 */ { MAD_F(0x06f5fa6b) /* 0.435053272 */, 18 }, + /* 6207 */ { MAD_F(0x06f65c6e) /* 0.435146744 */, 18 }, + + /* 6208 */ { MAD_F(0x06f6be73) /* 0.435240221 */, 18 }, + /* 6209 */ { MAD_F(0x06f72079) /* 0.435333703 */, 18 }, + /* 6210 */ { MAD_F(0x06f78280) /* 0.435427190 */, 18 }, + /* 6211 */ { MAD_F(0x06f7e489) /* 0.435520682 */, 18 }, + /* 6212 */ { MAD_F(0x06f84693) /* 0.435614179 */, 18 }, + /* 6213 */ { MAD_F(0x06f8a89e) /* 0.435707681 */, 18 }, + /* 6214 */ { MAD_F(0x06f90aaa) /* 0.435801188 */, 18 }, + /* 6215 */ { MAD_F(0x06f96cb8) /* 0.435894700 */, 18 }, + /* 6216 */ { MAD_F(0x06f9cec8) /* 0.435988217 */, 18 }, + /* 6217 */ { MAD_F(0x06fa30d8) /* 0.436081739 */, 18 }, + /* 6218 */ { MAD_F(0x06fa92ea) /* 0.436175266 */, 18 }, + /* 6219 */ { MAD_F(0x06faf4fe) /* 0.436268799 */, 18 }, + /* 6220 */ { MAD_F(0x06fb5712) /* 0.436362336 */, 18 }, + /* 6221 */ { MAD_F(0x06fbb928) /* 0.436455878 */, 18 }, + /* 6222 */ { MAD_F(0x06fc1b40) /* 0.436549425 */, 18 }, + /* 6223 */ { MAD_F(0x06fc7d58) /* 0.436642977 */, 18 }, + + /* 6224 */ { MAD_F(0x06fcdf72) /* 0.436736534 */, 18 }, + /* 6225 */ { MAD_F(0x06fd418e) /* 0.436830096 */, 18 }, + /* 6226 */ { MAD_F(0x06fda3ab) /* 0.436923664 */, 18 }, + /* 6227 */ { MAD_F(0x06fe05c9) /* 0.437017236 */, 18 }, + /* 6228 */ { MAD_F(0x06fe67e8) /* 0.437110813 */, 18 }, + /* 6229 */ { MAD_F(0x06feca09) /* 0.437204395 */, 18 }, + /* 6230 */ { MAD_F(0x06ff2c2b) /* 0.437297982 */, 18 }, + /* 6231 */ { MAD_F(0x06ff8e4f) /* 0.437391575 */, 18 }, + /* 6232 */ { MAD_F(0x06fff073) /* 0.437485172 */, 18 }, + /* 6233 */ { MAD_F(0x0700529a) /* 0.437578774 */, 18 }, + /* 6234 */ { MAD_F(0x0700b4c1) /* 0.437672381 */, 18 }, + /* 6235 */ { MAD_F(0x070116ea) /* 0.437765994 */, 18 }, + /* 6236 */ { MAD_F(0x07017914) /* 0.437859611 */, 18 }, + /* 6237 */ { MAD_F(0x0701db40) /* 0.437953233 */, 18 }, + /* 6238 */ { MAD_F(0x07023d6c) /* 0.438046860 */, 18 }, + /* 6239 */ { MAD_F(0x07029f9b) /* 0.438140493 */, 18 }, + + /* 6240 */ { MAD_F(0x070301ca) /* 0.438234130 */, 18 }, + /* 6241 */ { MAD_F(0x070363fb) /* 0.438327772 */, 18 }, + /* 6242 */ { MAD_F(0x0703c62d) /* 0.438421419 */, 18 }, + /* 6243 */ { MAD_F(0x07042861) /* 0.438515072 */, 18 }, + /* 6244 */ { MAD_F(0x07048a96) /* 0.438608729 */, 18 }, + /* 6245 */ { MAD_F(0x0704eccc) /* 0.438702391 */, 18 }, + /* 6246 */ { MAD_F(0x07054f04) /* 0.438796059 */, 18 }, + /* 6247 */ { MAD_F(0x0705b13d) /* 0.438889731 */, 18 }, + /* 6248 */ { MAD_F(0x07061377) /* 0.438983408 */, 18 }, + /* 6249 */ { MAD_F(0x070675b3) /* 0.439077090 */, 18 }, + /* 6250 */ { MAD_F(0x0706d7f0) /* 0.439170778 */, 18 }, + /* 6251 */ { MAD_F(0x07073a2e) /* 0.439264470 */, 18 }, + /* 6252 */ { MAD_F(0x07079c6e) /* 0.439358167 */, 18 }, + /* 6253 */ { MAD_F(0x0707feaf) /* 0.439451869 */, 18 }, + /* 6254 */ { MAD_F(0x070860f1) /* 0.439545577 */, 18 }, + /* 6255 */ { MAD_F(0x0708c335) /* 0.439639289 */, 18 }, + + /* 6256 */ { MAD_F(0x0709257a) /* 0.439733006 */, 18 }, + /* 6257 */ { MAD_F(0x070987c0) /* 0.439826728 */, 18 }, + /* 6258 */ { MAD_F(0x0709ea08) /* 0.439920456 */, 18 }, + /* 6259 */ { MAD_F(0x070a4c51) /* 0.440014188 */, 18 }, + /* 6260 */ { MAD_F(0x070aae9b) /* 0.440107925 */, 18 }, + /* 6261 */ { MAD_F(0x070b10e7) /* 0.440201667 */, 18 }, + /* 6262 */ { MAD_F(0x070b7334) /* 0.440295414 */, 18 }, + /* 6263 */ { MAD_F(0x070bd583) /* 0.440389167 */, 18 }, + /* 6264 */ { MAD_F(0x070c37d2) /* 0.440482924 */, 18 }, + /* 6265 */ { MAD_F(0x070c9a23) /* 0.440576686 */, 18 }, + /* 6266 */ { MAD_F(0x070cfc76) /* 0.440670453 */, 18 }, + /* 6267 */ { MAD_F(0x070d5eca) /* 0.440764225 */, 18 }, + /* 6268 */ { MAD_F(0x070dc11f) /* 0.440858002 */, 18 }, + /* 6269 */ { MAD_F(0x070e2375) /* 0.440951784 */, 18 }, + /* 6270 */ { MAD_F(0x070e85cd) /* 0.441045572 */, 18 }, + /* 6271 */ { MAD_F(0x070ee826) /* 0.441139364 */, 18 }, + + /* 6272 */ { MAD_F(0x070f4a80) /* 0.441233161 */, 18 }, + /* 6273 */ { MAD_F(0x070facdc) /* 0.441326963 */, 18 }, + /* 6274 */ { MAD_F(0x07100f39) /* 0.441420770 */, 18 }, + /* 6275 */ { MAD_F(0x07107198) /* 0.441514582 */, 18 }, + /* 6276 */ { MAD_F(0x0710d3f8) /* 0.441608399 */, 18 }, + /* 6277 */ { MAD_F(0x07113659) /* 0.441702221 */, 18 }, + /* 6278 */ { MAD_F(0x071198bb) /* 0.441796048 */, 18 }, + /* 6279 */ { MAD_F(0x0711fb1f) /* 0.441889880 */, 18 }, + /* 6280 */ { MAD_F(0x07125d84) /* 0.441983717 */, 18 }, + /* 6281 */ { MAD_F(0x0712bfeb) /* 0.442077559 */, 18 }, + /* 6282 */ { MAD_F(0x07132253) /* 0.442171406 */, 18 }, + /* 6283 */ { MAD_F(0x071384bc) /* 0.442265257 */, 18 }, + /* 6284 */ { MAD_F(0x0713e726) /* 0.442359114 */, 18 }, + /* 6285 */ { MAD_F(0x07144992) /* 0.442452976 */, 18 }, + /* 6286 */ { MAD_F(0x0714abff) /* 0.442546843 */, 18 }, + /* 6287 */ { MAD_F(0x07150e6e) /* 0.442640715 */, 18 }, + + /* 6288 */ { MAD_F(0x071570de) /* 0.442734592 */, 18 }, + /* 6289 */ { MAD_F(0x0715d34f) /* 0.442828473 */, 18 }, + /* 6290 */ { MAD_F(0x071635c1) /* 0.442922360 */, 18 }, + /* 6291 */ { MAD_F(0x07169835) /* 0.443016252 */, 18 }, + /* 6292 */ { MAD_F(0x0716faaa) /* 0.443110148 */, 18 }, + /* 6293 */ { MAD_F(0x07175d21) /* 0.443204050 */, 18 }, + /* 6294 */ { MAD_F(0x0717bf99) /* 0.443297957 */, 18 }, + /* 6295 */ { MAD_F(0x07182212) /* 0.443391868 */, 18 }, + /* 6296 */ { MAD_F(0x0718848d) /* 0.443485785 */, 18 }, + /* 6297 */ { MAD_F(0x0718e709) /* 0.443579706 */, 18 }, + /* 6298 */ { MAD_F(0x07194986) /* 0.443673633 */, 18 }, + /* 6299 */ { MAD_F(0x0719ac04) /* 0.443767564 */, 18 }, + /* 6300 */ { MAD_F(0x071a0e84) /* 0.443861501 */, 18 }, + /* 6301 */ { MAD_F(0x071a7105) /* 0.443955442 */, 18 }, + /* 6302 */ { MAD_F(0x071ad388) /* 0.444049389 */, 18 }, + /* 6303 */ { MAD_F(0x071b360c) /* 0.444143340 */, 18 }, + + /* 6304 */ { MAD_F(0x071b9891) /* 0.444237296 */, 18 }, + /* 6305 */ { MAD_F(0x071bfb18) /* 0.444331258 */, 18 }, + /* 6306 */ { MAD_F(0x071c5d9f) /* 0.444425224 */, 18 }, + /* 6307 */ { MAD_F(0x071cc029) /* 0.444519195 */, 18 }, + /* 6308 */ { MAD_F(0x071d22b3) /* 0.444613171 */, 18 }, + /* 6309 */ { MAD_F(0x071d853f) /* 0.444707153 */, 18 }, + /* 6310 */ { MAD_F(0x071de7cc) /* 0.444801139 */, 18 }, + /* 6311 */ { MAD_F(0x071e4a5b) /* 0.444895130 */, 18 }, + /* 6312 */ { MAD_F(0x071eaceb) /* 0.444989126 */, 18 }, + /* 6313 */ { MAD_F(0x071f0f7c) /* 0.445083127 */, 18 }, + /* 6314 */ { MAD_F(0x071f720e) /* 0.445177133 */, 18 }, + /* 6315 */ { MAD_F(0x071fd4a2) /* 0.445271144 */, 18 }, + /* 6316 */ { MAD_F(0x07203737) /* 0.445365160 */, 18 }, + /* 6317 */ { MAD_F(0x072099ce) /* 0.445459181 */, 18 }, + /* 6318 */ { MAD_F(0x0720fc66) /* 0.445553206 */, 18 }, + /* 6319 */ { MAD_F(0x07215eff) /* 0.445647237 */, 18 }, + + /* 6320 */ { MAD_F(0x0721c19a) /* 0.445741273 */, 18 }, + /* 6321 */ { MAD_F(0x07222436) /* 0.445835314 */, 18 }, + /* 6322 */ { MAD_F(0x072286d3) /* 0.445929359 */, 18 }, + /* 6323 */ { MAD_F(0x0722e971) /* 0.446023410 */, 18 }, + /* 6324 */ { MAD_F(0x07234c11) /* 0.446117466 */, 18 }, + /* 6325 */ { MAD_F(0x0723aeb2) /* 0.446211526 */, 18 }, + /* 6326 */ { MAD_F(0x07241155) /* 0.446305592 */, 18 }, + /* 6327 */ { MAD_F(0x072473f9) /* 0.446399662 */, 18 }, + /* 6328 */ { MAD_F(0x0724d69e) /* 0.446493738 */, 18 }, + /* 6329 */ { MAD_F(0x07253944) /* 0.446587818 */, 18 }, + /* 6330 */ { MAD_F(0x07259bec) /* 0.446681903 */, 18 }, + /* 6331 */ { MAD_F(0x0725fe95) /* 0.446775994 */, 18 }, + /* 6332 */ { MAD_F(0x07266140) /* 0.446870089 */, 18 }, + /* 6333 */ { MAD_F(0x0726c3ec) /* 0.446964189 */, 18 }, + /* 6334 */ { MAD_F(0x07272699) /* 0.447058294 */, 18 }, + /* 6335 */ { MAD_F(0x07278947) /* 0.447152404 */, 18 }, + + /* 6336 */ { MAD_F(0x0727ebf7) /* 0.447246519 */, 18 }, + /* 6337 */ { MAD_F(0x07284ea8) /* 0.447340639 */, 18 }, + /* 6338 */ { MAD_F(0x0728b15b) /* 0.447434764 */, 18 }, + /* 6339 */ { MAD_F(0x0729140f) /* 0.447528894 */, 18 }, + /* 6340 */ { MAD_F(0x072976c4) /* 0.447623029 */, 18 }, + /* 6341 */ { MAD_F(0x0729d97a) /* 0.447717169 */, 18 }, + /* 6342 */ { MAD_F(0x072a3c32) /* 0.447811314 */, 18 }, + /* 6343 */ { MAD_F(0x072a9eeb) /* 0.447905463 */, 18 }, + /* 6344 */ { MAD_F(0x072b01a6) /* 0.447999618 */, 18 }, + /* 6345 */ { MAD_F(0x072b6461) /* 0.448093778 */, 18 }, + /* 6346 */ { MAD_F(0x072bc71e) /* 0.448187942 */, 18 }, + /* 6347 */ { MAD_F(0x072c29dd) /* 0.448282112 */, 18 }, + /* 6348 */ { MAD_F(0x072c8c9d) /* 0.448376286 */, 18 }, + /* 6349 */ { MAD_F(0x072cef5e) /* 0.448470466 */, 18 }, + /* 6350 */ { MAD_F(0x072d5220) /* 0.448564650 */, 18 }, + /* 6351 */ { MAD_F(0x072db4e4) /* 0.448658839 */, 18 }, + + /* 6352 */ { MAD_F(0x072e17a9) /* 0.448753033 */, 18 }, + /* 6353 */ { MAD_F(0x072e7a6f) /* 0.448847233 */, 18 }, + /* 6354 */ { MAD_F(0x072edd37) /* 0.448941437 */, 18 }, + /* 6355 */ { MAD_F(0x072f4000) /* 0.449035646 */, 18 }, + /* 6356 */ { MAD_F(0x072fa2ca) /* 0.449129860 */, 18 }, + /* 6357 */ { MAD_F(0x07300596) /* 0.449224079 */, 18 }, + /* 6358 */ { MAD_F(0x07306863) /* 0.449318303 */, 18 }, + /* 6359 */ { MAD_F(0x0730cb32) /* 0.449412531 */, 18 }, + /* 6360 */ { MAD_F(0x07312e01) /* 0.449506765 */, 18 }, + /* 6361 */ { MAD_F(0x073190d2) /* 0.449601004 */, 18 }, + /* 6362 */ { MAD_F(0x0731f3a5) /* 0.449695247 */, 18 }, + /* 6363 */ { MAD_F(0x07325678) /* 0.449789496 */, 18 }, + /* 6364 */ { MAD_F(0x0732b94d) /* 0.449883749 */, 18 }, + /* 6365 */ { MAD_F(0x07331c23) /* 0.449978008 */, 18 }, + /* 6366 */ { MAD_F(0x07337efb) /* 0.450072271 */, 18 }, + /* 6367 */ { MAD_F(0x0733e1d4) /* 0.450166540 */, 18 }, + + /* 6368 */ { MAD_F(0x073444ae) /* 0.450260813 */, 18 }, + /* 6369 */ { MAD_F(0x0734a78a) /* 0.450355091 */, 18 }, + /* 6370 */ { MAD_F(0x07350a67) /* 0.450449374 */, 18 }, + /* 6371 */ { MAD_F(0x07356d45) /* 0.450543662 */, 18 }, + /* 6372 */ { MAD_F(0x0735d025) /* 0.450637955 */, 18 }, + /* 6373 */ { MAD_F(0x07363306) /* 0.450732253 */, 18 }, + /* 6374 */ { MAD_F(0x073695e8) /* 0.450826556 */, 18 }, + /* 6375 */ { MAD_F(0x0736f8cb) /* 0.450920864 */, 18 }, + /* 6376 */ { MAD_F(0x07375bb0) /* 0.451015176 */, 18 }, + /* 6377 */ { MAD_F(0x0737be96) /* 0.451109494 */, 18 }, + /* 6378 */ { MAD_F(0x0738217e) /* 0.451203817 */, 18 }, + /* 6379 */ { MAD_F(0x07388467) /* 0.451298144 */, 18 }, + /* 6380 */ { MAD_F(0x0738e751) /* 0.451392477 */, 18 }, + /* 6381 */ { MAD_F(0x07394a3d) /* 0.451486814 */, 18 }, + /* 6382 */ { MAD_F(0x0739ad29) /* 0.451581156 */, 18 }, + /* 6383 */ { MAD_F(0x073a1017) /* 0.451675503 */, 18 }, + + /* 6384 */ { MAD_F(0x073a7307) /* 0.451769856 */, 18 }, + /* 6385 */ { MAD_F(0x073ad5f8) /* 0.451864213 */, 18 }, + /* 6386 */ { MAD_F(0x073b38ea) /* 0.451958575 */, 18 }, + /* 6387 */ { MAD_F(0x073b9bdd) /* 0.452052942 */, 18 }, + /* 6388 */ { MAD_F(0x073bfed2) /* 0.452147313 */, 18 }, + /* 6389 */ { MAD_F(0x073c61c8) /* 0.452241690 */, 18 }, + /* 6390 */ { MAD_F(0x073cc4bf) /* 0.452336072 */, 18 }, + /* 6391 */ { MAD_F(0x073d27b8) /* 0.452430458 */, 18 }, + /* 6392 */ { MAD_F(0x073d8ab2) /* 0.452524850 */, 18 }, + /* 6393 */ { MAD_F(0x073dedae) /* 0.452619246 */, 18 }, + /* 6394 */ { MAD_F(0x073e50aa) /* 0.452713648 */, 18 }, + /* 6395 */ { MAD_F(0x073eb3a8) /* 0.452808054 */, 18 }, + /* 6396 */ { MAD_F(0x073f16a8) /* 0.452902465 */, 18 }, + /* 6397 */ { MAD_F(0x073f79a8) /* 0.452996882 */, 18 }, + /* 6398 */ { MAD_F(0x073fdcaa) /* 0.453091303 */, 18 }, + /* 6399 */ { MAD_F(0x07403fad) /* 0.453185729 */, 18 }, + + /* 6400 */ { MAD_F(0x0740a2b2) /* 0.453280160 */, 18 }, + /* 6401 */ { MAD_F(0x074105b8) /* 0.453374595 */, 18 }, + /* 6402 */ { MAD_F(0x074168bf) /* 0.453469036 */, 18 }, + /* 6403 */ { MAD_F(0x0741cbc8) /* 0.453563482 */, 18 }, + /* 6404 */ { MAD_F(0x07422ed2) /* 0.453657932 */, 18 }, + /* 6405 */ { MAD_F(0x074291dd) /* 0.453752388 */, 18 }, + /* 6406 */ { MAD_F(0x0742f4e9) /* 0.453846848 */, 18 }, + /* 6407 */ { MAD_F(0x074357f7) /* 0.453941314 */, 18 }, + /* 6408 */ { MAD_F(0x0743bb06) /* 0.454035784 */, 18 }, + /* 6409 */ { MAD_F(0x07441e17) /* 0.454130259 */, 18 }, + /* 6410 */ { MAD_F(0x07448129) /* 0.454224739 */, 18 }, + /* 6411 */ { MAD_F(0x0744e43c) /* 0.454319224 */, 18 }, + /* 6412 */ { MAD_F(0x07454750) /* 0.454413714 */, 18 }, + /* 6413 */ { MAD_F(0x0745aa66) /* 0.454508209 */, 18 }, + /* 6414 */ { MAD_F(0x07460d7d) /* 0.454602708 */, 18 }, + /* 6415 */ { MAD_F(0x07467095) /* 0.454697213 */, 18 }, + + /* 6416 */ { MAD_F(0x0746d3af) /* 0.454791723 */, 18 }, + /* 6417 */ { MAD_F(0x074736ca) /* 0.454886237 */, 18 }, + /* 6418 */ { MAD_F(0x074799e7) /* 0.454980756 */, 18 }, + /* 6419 */ { MAD_F(0x0747fd04) /* 0.455075281 */, 18 }, + /* 6420 */ { MAD_F(0x07486023) /* 0.455169810 */, 18 }, + /* 6421 */ { MAD_F(0x0748c344) /* 0.455264344 */, 18 }, + /* 6422 */ { MAD_F(0x07492665) /* 0.455358883 */, 18 }, + /* 6423 */ { MAD_F(0x07498988) /* 0.455453427 */, 18 }, + /* 6424 */ { MAD_F(0x0749ecac) /* 0.455547976 */, 18 }, + /* 6425 */ { MAD_F(0x074a4fd2) /* 0.455642529 */, 18 }, + /* 6426 */ { MAD_F(0x074ab2f9) /* 0.455737088 */, 18 }, + /* 6427 */ { MAD_F(0x074b1621) /* 0.455831652 */, 18 }, + /* 6428 */ { MAD_F(0x074b794b) /* 0.455926220 */, 18 }, + /* 6429 */ { MAD_F(0x074bdc75) /* 0.456020793 */, 18 }, + /* 6430 */ { MAD_F(0x074c3fa1) /* 0.456115372 */, 18 }, + /* 6431 */ { MAD_F(0x074ca2cf) /* 0.456209955 */, 18 }, + + /* 6432 */ { MAD_F(0x074d05fe) /* 0.456304543 */, 18 }, + /* 6433 */ { MAD_F(0x074d692e) /* 0.456399136 */, 18 }, + /* 6434 */ { MAD_F(0x074dcc5f) /* 0.456493733 */, 18 }, + /* 6435 */ { MAD_F(0x074e2f92) /* 0.456588336 */, 18 }, + /* 6436 */ { MAD_F(0x074e92c6) /* 0.456682944 */, 18 }, + /* 6437 */ { MAD_F(0x074ef5fb) /* 0.456777556 */, 18 }, + /* 6438 */ { MAD_F(0x074f5932) /* 0.456872174 */, 18 }, + /* 6439 */ { MAD_F(0x074fbc6a) /* 0.456966796 */, 18 }, + /* 6440 */ { MAD_F(0x07501fa3) /* 0.457061423 */, 18 }, + /* 6441 */ { MAD_F(0x075082de) /* 0.457156056 */, 18 }, + /* 6442 */ { MAD_F(0x0750e61a) /* 0.457250693 */, 18 }, + /* 6443 */ { MAD_F(0x07514957) /* 0.457345335 */, 18 }, + /* 6444 */ { MAD_F(0x0751ac96) /* 0.457439981 */, 18 }, + /* 6445 */ { MAD_F(0x07520fd6) /* 0.457534633 */, 18 }, + /* 6446 */ { MAD_F(0x07527317) /* 0.457629290 */, 18 }, + /* 6447 */ { MAD_F(0x0752d659) /* 0.457723951 */, 18 }, + + /* 6448 */ { MAD_F(0x0753399d) /* 0.457818618 */, 18 }, + /* 6449 */ { MAD_F(0x07539ce2) /* 0.457913289 */, 18 }, + /* 6450 */ { MAD_F(0x07540029) /* 0.458007965 */, 18 }, + /* 6451 */ { MAD_F(0x07546371) /* 0.458102646 */, 18 }, + /* 6452 */ { MAD_F(0x0754c6ba) /* 0.458197332 */, 18 }, + /* 6453 */ { MAD_F(0x07552a04) /* 0.458292023 */, 18 }, + /* 6454 */ { MAD_F(0x07558d50) /* 0.458386719 */, 18 }, + /* 6455 */ { MAD_F(0x0755f09d) /* 0.458481420 */, 18 }, + /* 6456 */ { MAD_F(0x075653eb) /* 0.458576125 */, 18 }, + /* 6457 */ { MAD_F(0x0756b73b) /* 0.458670836 */, 18 }, + /* 6458 */ { MAD_F(0x07571a8c) /* 0.458765551 */, 18 }, + /* 6459 */ { MAD_F(0x07577dde) /* 0.458860271 */, 18 }, + /* 6460 */ { MAD_F(0x0757e131) /* 0.458954996 */, 18 }, + /* 6461 */ { MAD_F(0x07584486) /* 0.459049726 */, 18 }, + /* 6462 */ { MAD_F(0x0758a7dd) /* 0.459144461 */, 18 }, + /* 6463 */ { MAD_F(0x07590b34) /* 0.459239201 */, 18 }, + + /* 6464 */ { MAD_F(0x07596e8d) /* 0.459333946 */, 18 }, + /* 6465 */ { MAD_F(0x0759d1e7) /* 0.459428695 */, 18 }, + /* 6466 */ { MAD_F(0x075a3542) /* 0.459523450 */, 18 }, + /* 6467 */ { MAD_F(0x075a989f) /* 0.459618209 */, 18 }, + /* 6468 */ { MAD_F(0x075afbfd) /* 0.459712973 */, 18 }, + /* 6469 */ { MAD_F(0x075b5f5d) /* 0.459807742 */, 18 }, + /* 6470 */ { MAD_F(0x075bc2bd) /* 0.459902516 */, 18 }, + /* 6471 */ { MAD_F(0x075c261f) /* 0.459997295 */, 18 }, + /* 6472 */ { MAD_F(0x075c8983) /* 0.460092079 */, 18 }, + /* 6473 */ { MAD_F(0x075cece7) /* 0.460186867 */, 18 }, + /* 6474 */ { MAD_F(0x075d504d) /* 0.460281661 */, 18 }, + /* 6475 */ { MAD_F(0x075db3b5) /* 0.460376459 */, 18 }, + /* 6476 */ { MAD_F(0x075e171d) /* 0.460471262 */, 18 }, + /* 6477 */ { MAD_F(0x075e7a87) /* 0.460566071 */, 18 }, + /* 6478 */ { MAD_F(0x075eddf2) /* 0.460660884 */, 18 }, + /* 6479 */ { MAD_F(0x075f415f) /* 0.460755701 */, 18 }, + + /* 6480 */ { MAD_F(0x075fa4cc) /* 0.460850524 */, 18 }, + /* 6481 */ { MAD_F(0x0760083b) /* 0.460945352 */, 18 }, + /* 6482 */ { MAD_F(0x07606bac) /* 0.461040184 */, 18 }, + /* 6483 */ { MAD_F(0x0760cf1e) /* 0.461135022 */, 18 }, + /* 6484 */ { MAD_F(0x07613291) /* 0.461229864 */, 18 }, + /* 6485 */ { MAD_F(0x07619605) /* 0.461324711 */, 18 }, + /* 6486 */ { MAD_F(0x0761f97b) /* 0.461419563 */, 18 }, + /* 6487 */ { MAD_F(0x07625cf2) /* 0.461514420 */, 18 }, + /* 6488 */ { MAD_F(0x0762c06a) /* 0.461609282 */, 18 }, + /* 6489 */ { MAD_F(0x076323e3) /* 0.461704149 */, 18 }, + /* 6490 */ { MAD_F(0x0763875e) /* 0.461799020 */, 18 }, + /* 6491 */ { MAD_F(0x0763eadb) /* 0.461893897 */, 18 }, + /* 6492 */ { MAD_F(0x07644e58) /* 0.461988778 */, 18 }, + /* 6493 */ { MAD_F(0x0764b1d7) /* 0.462083664 */, 18 }, + /* 6494 */ { MAD_F(0x07651557) /* 0.462178555 */, 18 }, + /* 6495 */ { MAD_F(0x076578d8) /* 0.462273451 */, 18 }, + + /* 6496 */ { MAD_F(0x0765dc5b) /* 0.462368352 */, 18 }, + /* 6497 */ { MAD_F(0x07663fdf) /* 0.462463257 */, 18 }, + /* 6498 */ { MAD_F(0x0766a364) /* 0.462558168 */, 18 }, + /* 6499 */ { MAD_F(0x076706eb) /* 0.462653083 */, 18 }, + /* 6500 */ { MAD_F(0x07676a73) /* 0.462748003 */, 18 }, + /* 6501 */ { MAD_F(0x0767cdfc) /* 0.462842928 */, 18 }, + /* 6502 */ { MAD_F(0x07683187) /* 0.462937858 */, 18 }, + /* 6503 */ { MAD_F(0x07689513) /* 0.463032793 */, 18 }, + /* 6504 */ { MAD_F(0x0768f8a0) /* 0.463127733 */, 18 }, + /* 6505 */ { MAD_F(0x07695c2e) /* 0.463222678 */, 18 }, + /* 6506 */ { MAD_F(0x0769bfbe) /* 0.463317627 */, 18 }, + /* 6507 */ { MAD_F(0x076a234f) /* 0.463412581 */, 18 }, + /* 6508 */ { MAD_F(0x076a86e2) /* 0.463507540 */, 18 }, + /* 6509 */ { MAD_F(0x076aea75) /* 0.463602504 */, 18 }, + /* 6510 */ { MAD_F(0x076b4e0a) /* 0.463697473 */, 18 }, + /* 6511 */ { MAD_F(0x076bb1a1) /* 0.463792447 */, 18 }, + + /* 6512 */ { MAD_F(0x076c1538) /* 0.463887426 */, 18 }, + /* 6513 */ { MAD_F(0x076c78d1) /* 0.463982409 */, 18 }, + /* 6514 */ { MAD_F(0x076cdc6c) /* 0.464077398 */, 18 }, + /* 6515 */ { MAD_F(0x076d4007) /* 0.464172391 */, 18 }, + /* 6516 */ { MAD_F(0x076da3a4) /* 0.464267389 */, 18 }, + /* 6517 */ { MAD_F(0x076e0742) /* 0.464362392 */, 18 }, + /* 6518 */ { MAD_F(0x076e6ae2) /* 0.464457399 */, 18 }, + /* 6519 */ { MAD_F(0x076ece82) /* 0.464552412 */, 18 }, + /* 6520 */ { MAD_F(0x076f3224) /* 0.464647430 */, 18 }, + /* 6521 */ { MAD_F(0x076f95c8) /* 0.464742452 */, 18 }, + /* 6522 */ { MAD_F(0x076ff96c) /* 0.464837479 */, 18 }, + /* 6523 */ { MAD_F(0x07705d12) /* 0.464932511 */, 18 }, + /* 6524 */ { MAD_F(0x0770c0ba) /* 0.465027548 */, 18 }, + /* 6525 */ { MAD_F(0x07712462) /* 0.465122590 */, 18 }, + /* 6526 */ { MAD_F(0x0771880c) /* 0.465217637 */, 18 }, + /* 6527 */ { MAD_F(0x0771ebb7) /* 0.465312688 */, 18 }, + + /* 6528 */ { MAD_F(0x07724f64) /* 0.465407744 */, 18 }, + /* 6529 */ { MAD_F(0x0772b312) /* 0.465502806 */, 18 }, + /* 6530 */ { MAD_F(0x077316c1) /* 0.465597872 */, 18 }, + /* 6531 */ { MAD_F(0x07737a71) /* 0.465692943 */, 18 }, + /* 6532 */ { MAD_F(0x0773de23) /* 0.465788018 */, 18 }, + /* 6533 */ { MAD_F(0x077441d6) /* 0.465883099 */, 18 }, + /* 6534 */ { MAD_F(0x0774a58a) /* 0.465978184 */, 18 }, + /* 6535 */ { MAD_F(0x07750940) /* 0.466073275 */, 18 }, + /* 6536 */ { MAD_F(0x07756cf7) /* 0.466168370 */, 18 }, + /* 6537 */ { MAD_F(0x0775d0af) /* 0.466263470 */, 18 }, + /* 6538 */ { MAD_F(0x07763468) /* 0.466358575 */, 18 }, + /* 6539 */ { MAD_F(0x07769823) /* 0.466453684 */, 18 }, + /* 6540 */ { MAD_F(0x0776fbdf) /* 0.466548799 */, 18 }, + /* 6541 */ { MAD_F(0x07775f9d) /* 0.466643918 */, 18 }, + /* 6542 */ { MAD_F(0x0777c35c) /* 0.466739043 */, 18 }, + /* 6543 */ { MAD_F(0x0778271c) /* 0.466834172 */, 18 }, + + /* 6544 */ { MAD_F(0x07788add) /* 0.466929306 */, 18 }, + /* 6545 */ { MAD_F(0x0778ee9f) /* 0.467024445 */, 18 }, + /* 6546 */ { MAD_F(0x07795263) /* 0.467119588 */, 18 }, + /* 6547 */ { MAD_F(0x0779b629) /* 0.467214737 */, 18 }, + /* 6548 */ { MAD_F(0x077a19ef) /* 0.467309890 */, 18 }, + /* 6549 */ { MAD_F(0x077a7db7) /* 0.467405048 */, 18 }, + /* 6550 */ { MAD_F(0x077ae180) /* 0.467500211 */, 18 }, + /* 6551 */ { MAD_F(0x077b454b) /* 0.467595379 */, 18 }, + /* 6552 */ { MAD_F(0x077ba916) /* 0.467690552 */, 18 }, + /* 6553 */ { MAD_F(0x077c0ce3) /* 0.467785729 */, 18 }, + /* 6554 */ { MAD_F(0x077c70b2) /* 0.467880912 */, 18 }, + /* 6555 */ { MAD_F(0x077cd481) /* 0.467976099 */, 18 }, + /* 6556 */ { MAD_F(0x077d3852) /* 0.468071291 */, 18 }, + /* 6557 */ { MAD_F(0x077d9c24) /* 0.468166488 */, 18 }, + /* 6558 */ { MAD_F(0x077dfff8) /* 0.468261690 */, 18 }, + /* 6559 */ { MAD_F(0x077e63cd) /* 0.468356896 */, 18 }, + + /* 6560 */ { MAD_F(0x077ec7a3) /* 0.468452108 */, 18 }, + /* 6561 */ { MAD_F(0x077f2b7a) /* 0.468547324 */, 18 }, + /* 6562 */ { MAD_F(0x077f8f53) /* 0.468642545 */, 18 }, + /* 6563 */ { MAD_F(0x077ff32d) /* 0.468737771 */, 18 }, + /* 6564 */ { MAD_F(0x07805708) /* 0.468833002 */, 18 }, + /* 6565 */ { MAD_F(0x0780bae5) /* 0.468928237 */, 18 }, + /* 6566 */ { MAD_F(0x07811ec3) /* 0.469023478 */, 18 }, + /* 6567 */ { MAD_F(0x078182a2) /* 0.469118723 */, 18 }, + /* 6568 */ { MAD_F(0x0781e683) /* 0.469213973 */, 18 }, + /* 6569 */ { MAD_F(0x07824a64) /* 0.469309228 */, 18 }, + /* 6570 */ { MAD_F(0x0782ae47) /* 0.469404488 */, 18 }, + /* 6571 */ { MAD_F(0x0783122c) /* 0.469499752 */, 18 }, + /* 6572 */ { MAD_F(0x07837612) /* 0.469595022 */, 18 }, + /* 6573 */ { MAD_F(0x0783d9f9) /* 0.469690296 */, 18 }, + /* 6574 */ { MAD_F(0x07843de1) /* 0.469785575 */, 18 }, + /* 6575 */ { MAD_F(0x0784a1ca) /* 0.469880859 */, 18 }, + + /* 6576 */ { MAD_F(0x078505b5) /* 0.469976148 */, 18 }, + /* 6577 */ { MAD_F(0x078569a2) /* 0.470071442 */, 18 }, + /* 6578 */ { MAD_F(0x0785cd8f) /* 0.470166740 */, 18 }, + /* 6579 */ { MAD_F(0x0786317e) /* 0.470262043 */, 18 }, + /* 6580 */ { MAD_F(0x0786956e) /* 0.470357351 */, 18 }, + /* 6581 */ { MAD_F(0x0786f95f) /* 0.470452664 */, 18 }, + /* 6582 */ { MAD_F(0x07875d52) /* 0.470547982 */, 18 }, + /* 6583 */ { MAD_F(0x0787c146) /* 0.470643305 */, 18 }, + /* 6584 */ { MAD_F(0x0788253b) /* 0.470738632 */, 18 }, + /* 6585 */ { MAD_F(0x07888932) /* 0.470833964 */, 18 }, + /* 6586 */ { MAD_F(0x0788ed2a) /* 0.470929301 */, 18 }, + /* 6587 */ { MAD_F(0x07895123) /* 0.471024643 */, 18 }, + /* 6588 */ { MAD_F(0x0789b51d) /* 0.471119990 */, 18 }, + /* 6589 */ { MAD_F(0x078a1919) /* 0.471215341 */, 18 }, + /* 6590 */ { MAD_F(0x078a7d16) /* 0.471310698 */, 18 }, + /* 6591 */ { MAD_F(0x078ae114) /* 0.471406059 */, 18 }, + + /* 6592 */ { MAD_F(0x078b4514) /* 0.471501425 */, 18 }, + /* 6593 */ { MAD_F(0x078ba915) /* 0.471596796 */, 18 }, + /* 6594 */ { MAD_F(0x078c0d17) /* 0.471692171 */, 18 }, + /* 6595 */ { MAD_F(0x078c711a) /* 0.471787552 */, 18 }, + /* 6596 */ { MAD_F(0x078cd51f) /* 0.471882937 */, 18 }, + /* 6597 */ { MAD_F(0x078d3925) /* 0.471978327 */, 18 }, + /* 6598 */ { MAD_F(0x078d9d2d) /* 0.472073722 */, 18 }, + /* 6599 */ { MAD_F(0x078e0135) /* 0.472169122 */, 18 }, + /* 6600 */ { MAD_F(0x078e653f) /* 0.472264527 */, 18 }, + /* 6601 */ { MAD_F(0x078ec94b) /* 0.472359936 */, 18 }, + /* 6602 */ { MAD_F(0x078f2d57) /* 0.472455350 */, 18 }, + /* 6603 */ { MAD_F(0x078f9165) /* 0.472550769 */, 18 }, + /* 6604 */ { MAD_F(0x078ff574) /* 0.472646193 */, 18 }, + /* 6605 */ { MAD_F(0x07905985) /* 0.472741622 */, 18 }, + /* 6606 */ { MAD_F(0x0790bd96) /* 0.472837055 */, 18 }, + /* 6607 */ { MAD_F(0x079121a9) /* 0.472932493 */, 18 }, + + /* 6608 */ { MAD_F(0x079185be) /* 0.473027937 */, 18 }, + /* 6609 */ { MAD_F(0x0791e9d3) /* 0.473123384 */, 18 }, + /* 6610 */ { MAD_F(0x07924dea) /* 0.473218837 */, 18 }, + /* 6611 */ { MAD_F(0x0792b202) /* 0.473314295 */, 18 }, + /* 6612 */ { MAD_F(0x0793161c) /* 0.473409757 */, 18 }, + /* 6613 */ { MAD_F(0x07937a37) /* 0.473505224 */, 18 }, + /* 6614 */ { MAD_F(0x0793de53) /* 0.473600696 */, 18 }, + /* 6615 */ { MAD_F(0x07944270) /* 0.473696173 */, 18 }, + /* 6616 */ { MAD_F(0x0794a68f) /* 0.473791655 */, 18 }, + /* 6617 */ { MAD_F(0x07950aaf) /* 0.473887141 */, 18 }, + /* 6618 */ { MAD_F(0x07956ed0) /* 0.473982632 */, 18 }, + /* 6619 */ { MAD_F(0x0795d2f2) /* 0.474078128 */, 18 }, + /* 6620 */ { MAD_F(0x07963716) /* 0.474173629 */, 18 }, + /* 6621 */ { MAD_F(0x07969b3b) /* 0.474269135 */, 18 }, + /* 6622 */ { MAD_F(0x0796ff62) /* 0.474364645 */, 18 }, + /* 6623 */ { MAD_F(0x07976389) /* 0.474460161 */, 18 }, + + /* 6624 */ { MAD_F(0x0797c7b2) /* 0.474555681 */, 18 }, + /* 6625 */ { MAD_F(0x07982bdd) /* 0.474651205 */, 18 }, + /* 6626 */ { MAD_F(0x07989008) /* 0.474746735 */, 18 }, + /* 6627 */ { MAD_F(0x0798f435) /* 0.474842270 */, 18 }, + /* 6628 */ { MAD_F(0x07995863) /* 0.474937809 */, 18 }, + /* 6629 */ { MAD_F(0x0799bc92) /* 0.475033353 */, 18 }, + /* 6630 */ { MAD_F(0x079a20c3) /* 0.475128902 */, 18 }, + /* 6631 */ { MAD_F(0x079a84f5) /* 0.475224456 */, 18 }, + /* 6632 */ { MAD_F(0x079ae929) /* 0.475320014 */, 18 }, + /* 6633 */ { MAD_F(0x079b4d5d) /* 0.475415578 */, 18 }, + /* 6634 */ { MAD_F(0x079bb193) /* 0.475511146 */, 18 }, + /* 6635 */ { MAD_F(0x079c15ca) /* 0.475606719 */, 18 }, + /* 6636 */ { MAD_F(0x079c7a03) /* 0.475702296 */, 18 }, + /* 6637 */ { MAD_F(0x079cde3c) /* 0.475797879 */, 18 }, + /* 6638 */ { MAD_F(0x079d4277) /* 0.475893466 */, 18 }, + /* 6639 */ { MAD_F(0x079da6b4) /* 0.475989058 */, 18 }, + + /* 6640 */ { MAD_F(0x079e0af1) /* 0.476084655 */, 18 }, + /* 6641 */ { MAD_F(0x079e6f30) /* 0.476180257 */, 18 }, + /* 6642 */ { MAD_F(0x079ed370) /* 0.476275863 */, 18 }, + /* 6643 */ { MAD_F(0x079f37b2) /* 0.476371475 */, 18 }, + /* 6644 */ { MAD_F(0x079f9bf5) /* 0.476467091 */, 18 }, + /* 6645 */ { MAD_F(0x07a00039) /* 0.476562712 */, 18 }, + /* 6646 */ { MAD_F(0x07a0647e) /* 0.476658338 */, 18 }, + /* 6647 */ { MAD_F(0x07a0c8c5) /* 0.476753968 */, 18 }, + /* 6648 */ { MAD_F(0x07a12d0c) /* 0.476849603 */, 18 }, + /* 6649 */ { MAD_F(0x07a19156) /* 0.476945243 */, 18 }, + /* 6650 */ { MAD_F(0x07a1f5a0) /* 0.477040888 */, 18 }, + /* 6651 */ { MAD_F(0x07a259ec) /* 0.477136538 */, 18 }, + /* 6652 */ { MAD_F(0x07a2be39) /* 0.477232193 */, 18 }, + /* 6653 */ { MAD_F(0x07a32287) /* 0.477327852 */, 18 }, + /* 6654 */ { MAD_F(0x07a386d7) /* 0.477423516 */, 18 }, + /* 6655 */ { MAD_F(0x07a3eb28) /* 0.477519185 */, 18 }, + + /* 6656 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 18 }, + /* 6657 */ { MAD_F(0x07a4b3ce) /* 0.477710537 */, 18 }, + /* 6658 */ { MAD_F(0x07a51822) /* 0.477806220 */, 18 }, + /* 6659 */ { MAD_F(0x07a57c78) /* 0.477901908 */, 18 }, + /* 6660 */ { MAD_F(0x07a5e0d0) /* 0.477997601 */, 18 }, + /* 6661 */ { MAD_F(0x07a64528) /* 0.478093299 */, 18 }, + /* 6662 */ { MAD_F(0x07a6a982) /* 0.478189001 */, 18 }, + /* 6663 */ { MAD_F(0x07a70ddd) /* 0.478284708 */, 18 }, + /* 6664 */ { MAD_F(0x07a7723a) /* 0.478380420 */, 18 }, + /* 6665 */ { MAD_F(0x07a7d698) /* 0.478476137 */, 18 }, + /* 6666 */ { MAD_F(0x07a83af7) /* 0.478571858 */, 18 }, + /* 6667 */ { MAD_F(0x07a89f57) /* 0.478667585 */, 18 }, + /* 6668 */ { MAD_F(0x07a903b9) /* 0.478763316 */, 18 }, + /* 6669 */ { MAD_F(0x07a9681c) /* 0.478859052 */, 18 }, + /* 6670 */ { MAD_F(0x07a9cc80) /* 0.478954793 */, 18 }, + /* 6671 */ { MAD_F(0x07aa30e5) /* 0.479050538 */, 18 }, + + /* 6672 */ { MAD_F(0x07aa954c) /* 0.479146288 */, 18 }, + /* 6673 */ { MAD_F(0x07aaf9b4) /* 0.479242043 */, 18 }, + /* 6674 */ { MAD_F(0x07ab5e1e) /* 0.479337803 */, 18 }, + /* 6675 */ { MAD_F(0x07abc288) /* 0.479433568 */, 18 }, + /* 6676 */ { MAD_F(0x07ac26f4) /* 0.479529337 */, 18 }, + /* 6677 */ { MAD_F(0x07ac8b61) /* 0.479625111 */, 18 }, + /* 6678 */ { MAD_F(0x07acefd0) /* 0.479720890 */, 18 }, + /* 6679 */ { MAD_F(0x07ad543f) /* 0.479816674 */, 18 }, + /* 6680 */ { MAD_F(0x07adb8b0) /* 0.479912463 */, 18 }, + /* 6681 */ { MAD_F(0x07ae1d23) /* 0.480008256 */, 18 }, + /* 6682 */ { MAD_F(0x07ae8196) /* 0.480104054 */, 18 }, + /* 6683 */ { MAD_F(0x07aee60b) /* 0.480199857 */, 18 }, + /* 6684 */ { MAD_F(0x07af4a81) /* 0.480295664 */, 18 }, + /* 6685 */ { MAD_F(0x07afaef9) /* 0.480391477 */, 18 }, + /* 6686 */ { MAD_F(0x07b01372) /* 0.480487294 */, 18 }, + /* 6687 */ { MAD_F(0x07b077ec) /* 0.480583116 */, 18 }, + + /* 6688 */ { MAD_F(0x07b0dc67) /* 0.480678943 */, 18 }, + /* 6689 */ { MAD_F(0x07b140e4) /* 0.480774774 */, 18 }, + /* 6690 */ { MAD_F(0x07b1a561) /* 0.480870611 */, 18 }, + /* 6691 */ { MAD_F(0x07b209e1) /* 0.480966452 */, 18 }, + /* 6692 */ { MAD_F(0x07b26e61) /* 0.481062298 */, 18 }, + /* 6693 */ { MAD_F(0x07b2d2e3) /* 0.481158148 */, 18 }, + /* 6694 */ { MAD_F(0x07b33766) /* 0.481254004 */, 18 }, + /* 6695 */ { MAD_F(0x07b39bea) /* 0.481349864 */, 18 }, + /* 6696 */ { MAD_F(0x07b4006f) /* 0.481445729 */, 18 }, + /* 6697 */ { MAD_F(0x07b464f6) /* 0.481541598 */, 18 }, + /* 6698 */ { MAD_F(0x07b4c97e) /* 0.481637473 */, 18 }, + /* 6699 */ { MAD_F(0x07b52e08) /* 0.481733352 */, 18 }, + /* 6700 */ { MAD_F(0x07b59292) /* 0.481829236 */, 18 }, + /* 6701 */ { MAD_F(0x07b5f71e) /* 0.481925125 */, 18 }, + /* 6702 */ { MAD_F(0x07b65bac) /* 0.482021019 */, 18 }, + /* 6703 */ { MAD_F(0x07b6c03a) /* 0.482116917 */, 18 }, + + /* 6704 */ { MAD_F(0x07b724ca) /* 0.482212820 */, 18 }, + /* 6705 */ { MAD_F(0x07b7895b) /* 0.482308728 */, 18 }, + /* 6706 */ { MAD_F(0x07b7eded) /* 0.482404640 */, 18 }, + /* 6707 */ { MAD_F(0x07b85281) /* 0.482500558 */, 18 }, + /* 6708 */ { MAD_F(0x07b8b716) /* 0.482596480 */, 18 }, + /* 6709 */ { MAD_F(0x07b91bac) /* 0.482692407 */, 18 }, + /* 6710 */ { MAD_F(0x07b98044) /* 0.482788339 */, 18 }, + /* 6711 */ { MAD_F(0x07b9e4dc) /* 0.482884275 */, 18 }, + /* 6712 */ { MAD_F(0x07ba4976) /* 0.482980216 */, 18 }, + /* 6713 */ { MAD_F(0x07baae12) /* 0.483076162 */, 18 }, + /* 6714 */ { MAD_F(0x07bb12ae) /* 0.483172113 */, 18 }, + /* 6715 */ { MAD_F(0x07bb774c) /* 0.483268069 */, 18 }, + /* 6716 */ { MAD_F(0x07bbdbeb) /* 0.483364029 */, 18 }, + /* 6717 */ { MAD_F(0x07bc408c) /* 0.483459994 */, 18 }, + /* 6718 */ { MAD_F(0x07bca52d) /* 0.483555964 */, 18 }, + /* 6719 */ { MAD_F(0x07bd09d0) /* 0.483651939 */, 18 }, + + /* 6720 */ { MAD_F(0x07bd6e75) /* 0.483747918 */, 18 }, + /* 6721 */ { MAD_F(0x07bdd31a) /* 0.483843902 */, 18 }, + /* 6722 */ { MAD_F(0x07be37c1) /* 0.483939891 */, 18 }, + /* 6723 */ { MAD_F(0x07be9c69) /* 0.484035885 */, 18 }, + /* 6724 */ { MAD_F(0x07bf0113) /* 0.484131883 */, 18 }, + /* 6725 */ { MAD_F(0x07bf65bd) /* 0.484227886 */, 18 }, + /* 6726 */ { MAD_F(0x07bfca69) /* 0.484323894 */, 18 }, + /* 6727 */ { MAD_F(0x07c02f16) /* 0.484419907 */, 18 }, + /* 6728 */ { MAD_F(0x07c093c5) /* 0.484515924 */, 18 }, + /* 6729 */ { MAD_F(0x07c0f875) /* 0.484611946 */, 18 }, + /* 6730 */ { MAD_F(0x07c15d26) /* 0.484707973 */, 18 }, + /* 6731 */ { MAD_F(0x07c1c1d8) /* 0.484804005 */, 18 }, + /* 6732 */ { MAD_F(0x07c2268b) /* 0.484900041 */, 18 }, + /* 6733 */ { MAD_F(0x07c28b40) /* 0.484996083 */, 18 }, + /* 6734 */ { MAD_F(0x07c2eff6) /* 0.485092128 */, 18 }, + /* 6735 */ { MAD_F(0x07c354ae) /* 0.485188179 */, 18 }, + + /* 6736 */ { MAD_F(0x07c3b967) /* 0.485284235 */, 18 }, + /* 6737 */ { MAD_F(0x07c41e21) /* 0.485380295 */, 18 }, + /* 6738 */ { MAD_F(0x07c482dc) /* 0.485476360 */, 18 }, + /* 6739 */ { MAD_F(0x07c4e798) /* 0.485572430 */, 18 }, + /* 6740 */ { MAD_F(0x07c54c56) /* 0.485668504 */, 18 }, + /* 6741 */ { MAD_F(0x07c5b115) /* 0.485764583 */, 18 }, + /* 6742 */ { MAD_F(0x07c615d6) /* 0.485860667 */, 18 }, + /* 6743 */ { MAD_F(0x07c67a97) /* 0.485956756 */, 18 }, + /* 6744 */ { MAD_F(0x07c6df5a) /* 0.486052849 */, 18 }, + /* 6745 */ { MAD_F(0x07c7441e) /* 0.486148948 */, 18 }, + /* 6746 */ { MAD_F(0x07c7a8e4) /* 0.486245051 */, 18 }, + /* 6747 */ { MAD_F(0x07c80daa) /* 0.486341158 */, 18 }, + /* 6748 */ { MAD_F(0x07c87272) /* 0.486437271 */, 18 }, + /* 6749 */ { MAD_F(0x07c8d73c) /* 0.486533388 */, 18 }, + /* 6750 */ { MAD_F(0x07c93c06) /* 0.486629510 */, 18 }, + /* 6751 */ { MAD_F(0x07c9a0d2) /* 0.486725637 */, 18 }, + + /* 6752 */ { MAD_F(0x07ca059f) /* 0.486821768 */, 18 }, + /* 6753 */ { MAD_F(0x07ca6a6d) /* 0.486917905 */, 18 }, + /* 6754 */ { MAD_F(0x07cacf3d) /* 0.487014045 */, 18 }, + /* 6755 */ { MAD_F(0x07cb340e) /* 0.487110191 */, 18 }, + /* 6756 */ { MAD_F(0x07cb98e0) /* 0.487206342 */, 18 }, + /* 6757 */ { MAD_F(0x07cbfdb4) /* 0.487302497 */, 18 }, + /* 6758 */ { MAD_F(0x07cc6288) /* 0.487398657 */, 18 }, + /* 6759 */ { MAD_F(0x07ccc75e) /* 0.487494821 */, 18 }, + /* 6760 */ { MAD_F(0x07cd2c36) /* 0.487590991 */, 18 }, + /* 6761 */ { MAD_F(0x07cd910e) /* 0.487687165 */, 18 }, + /* 6762 */ { MAD_F(0x07cdf5e8) /* 0.487783344 */, 18 }, + /* 6763 */ { MAD_F(0x07ce5ac3) /* 0.487879528 */, 18 }, + /* 6764 */ { MAD_F(0x07cebfa0) /* 0.487975716 */, 18 }, + /* 6765 */ { MAD_F(0x07cf247d) /* 0.488071909 */, 18 }, + /* 6766 */ { MAD_F(0x07cf895c) /* 0.488168107 */, 18 }, + /* 6767 */ { MAD_F(0x07cfee3c) /* 0.488264310 */, 18 }, + + /* 6768 */ { MAD_F(0x07d0531e) /* 0.488360517 */, 18 }, + /* 6769 */ { MAD_F(0x07d0b801) /* 0.488456729 */, 18 }, + /* 6770 */ { MAD_F(0x07d11ce5) /* 0.488552946 */, 18 }, + /* 6771 */ { MAD_F(0x07d181ca) /* 0.488649167 */, 18 }, + /* 6772 */ { MAD_F(0x07d1e6b0) /* 0.488745394 */, 18 }, + /* 6773 */ { MAD_F(0x07d24b98) /* 0.488841625 */, 18 }, + /* 6774 */ { MAD_F(0x07d2b081) /* 0.488937860 */, 18 }, + /* 6775 */ { MAD_F(0x07d3156c) /* 0.489034101 */, 18 }, + /* 6776 */ { MAD_F(0x07d37a57) /* 0.489130346 */, 18 }, + /* 6777 */ { MAD_F(0x07d3df44) /* 0.489226596 */, 18 }, + /* 6778 */ { MAD_F(0x07d44432) /* 0.489322851 */, 18 }, + /* 6779 */ { MAD_F(0x07d4a922) /* 0.489419110 */, 18 }, + /* 6780 */ { MAD_F(0x07d50e13) /* 0.489515375 */, 18 }, + /* 6781 */ { MAD_F(0x07d57305) /* 0.489611643 */, 18 }, + /* 6782 */ { MAD_F(0x07d5d7f8) /* 0.489707917 */, 18 }, + /* 6783 */ { MAD_F(0x07d63cec) /* 0.489804195 */, 18 }, + + /* 6784 */ { MAD_F(0x07d6a1e2) /* 0.489900479 */, 18 }, + /* 6785 */ { MAD_F(0x07d706d9) /* 0.489996766 */, 18 }, + /* 6786 */ { MAD_F(0x07d76bd2) /* 0.490093059 */, 18 }, + /* 6787 */ { MAD_F(0x07d7d0cb) /* 0.490189356 */, 18 }, + /* 6788 */ { MAD_F(0x07d835c6) /* 0.490285658 */, 18 }, + /* 6789 */ { MAD_F(0x07d89ac2) /* 0.490381965 */, 18 }, + /* 6790 */ { MAD_F(0x07d8ffc0) /* 0.490478277 */, 18 }, + /* 6791 */ { MAD_F(0x07d964be) /* 0.490574593 */, 18 }, + /* 6792 */ { MAD_F(0x07d9c9be) /* 0.490670914 */, 18 }, + /* 6793 */ { MAD_F(0x07da2ebf) /* 0.490767239 */, 18 }, + /* 6794 */ { MAD_F(0x07da93c2) /* 0.490863570 */, 18 }, + /* 6795 */ { MAD_F(0x07daf8c6) /* 0.490959905 */, 18 }, + /* 6796 */ { MAD_F(0x07db5dcb) /* 0.491056245 */, 18 }, + /* 6797 */ { MAD_F(0x07dbc2d1) /* 0.491152589 */, 18 }, + /* 6798 */ { MAD_F(0x07dc27d9) /* 0.491248939 */, 18 }, + /* 6799 */ { MAD_F(0x07dc8ce1) /* 0.491345293 */, 18 }, + + /* 6800 */ { MAD_F(0x07dcf1ec) /* 0.491441651 */, 18 }, + /* 6801 */ { MAD_F(0x07dd56f7) /* 0.491538015 */, 18 }, + /* 6802 */ { MAD_F(0x07ddbc04) /* 0.491634383 */, 18 }, + /* 6803 */ { MAD_F(0x07de2111) /* 0.491730756 */, 18 }, + /* 6804 */ { MAD_F(0x07de8621) /* 0.491827134 */, 18 }, + /* 6805 */ { MAD_F(0x07deeb31) /* 0.491923516 */, 18 }, + /* 6806 */ { MAD_F(0x07df5043) /* 0.492019903 */, 18 }, + /* 6807 */ { MAD_F(0x07dfb556) /* 0.492116295 */, 18 }, + /* 6808 */ { MAD_F(0x07e01a6a) /* 0.492212691 */, 18 }, + /* 6809 */ { MAD_F(0x07e07f80) /* 0.492309093 */, 18 }, + /* 6810 */ { MAD_F(0x07e0e496) /* 0.492405499 */, 18 }, + /* 6811 */ { MAD_F(0x07e149ae) /* 0.492501909 */, 18 }, + /* 6812 */ { MAD_F(0x07e1aec8) /* 0.492598325 */, 18 }, + /* 6813 */ { MAD_F(0x07e213e2) /* 0.492694745 */, 18 }, + /* 6814 */ { MAD_F(0x07e278fe) /* 0.492791170 */, 18 }, + /* 6815 */ { MAD_F(0x07e2de1b) /* 0.492887599 */, 18 }, + + /* 6816 */ { MAD_F(0x07e3433a) /* 0.492984033 */, 18 }, + /* 6817 */ { MAD_F(0x07e3a859) /* 0.493080472 */, 18 }, + /* 6818 */ { MAD_F(0x07e40d7a) /* 0.493176916 */, 18 }, + /* 6819 */ { MAD_F(0x07e4729c) /* 0.493273365 */, 18 }, + /* 6820 */ { MAD_F(0x07e4d7c0) /* 0.493369818 */, 18 }, + /* 6821 */ { MAD_F(0x07e53ce4) /* 0.493466275 */, 18 }, + /* 6822 */ { MAD_F(0x07e5a20a) /* 0.493562738 */, 18 }, + /* 6823 */ { MAD_F(0x07e60732) /* 0.493659205 */, 18 }, + /* 6824 */ { MAD_F(0x07e66c5a) /* 0.493755677 */, 18 }, + /* 6825 */ { MAD_F(0x07e6d184) /* 0.493852154 */, 18 }, + /* 6826 */ { MAD_F(0x07e736af) /* 0.493948635 */, 18 }, + /* 6827 */ { MAD_F(0x07e79bdb) /* 0.494045122 */, 18 }, + /* 6828 */ { MAD_F(0x07e80109) /* 0.494141612 */, 18 }, + /* 6829 */ { MAD_F(0x07e86638) /* 0.494238108 */, 18 }, + /* 6830 */ { MAD_F(0x07e8cb68) /* 0.494334608 */, 18 }, + /* 6831 */ { MAD_F(0x07e93099) /* 0.494431113 */, 18 }, + + /* 6832 */ { MAD_F(0x07e995cc) /* 0.494527623 */, 18 }, + /* 6833 */ { MAD_F(0x07e9fb00) /* 0.494624137 */, 18 }, + /* 6834 */ { MAD_F(0x07ea6035) /* 0.494720656 */, 18 }, + /* 6835 */ { MAD_F(0x07eac56b) /* 0.494817180 */, 18 }, + /* 6836 */ { MAD_F(0x07eb2aa3) /* 0.494913709 */, 18 }, + /* 6837 */ { MAD_F(0x07eb8fdc) /* 0.495010242 */, 18 }, + /* 6838 */ { MAD_F(0x07ebf516) /* 0.495106780 */, 18 }, + /* 6839 */ { MAD_F(0x07ec5a51) /* 0.495203322 */, 18 }, + /* 6840 */ { MAD_F(0x07ecbf8e) /* 0.495299870 */, 18 }, + /* 6841 */ { MAD_F(0x07ed24cc) /* 0.495396422 */, 18 }, + /* 6842 */ { MAD_F(0x07ed8a0b) /* 0.495492978 */, 18 }, + /* 6843 */ { MAD_F(0x07edef4c) /* 0.495589540 */, 18 }, + /* 6844 */ { MAD_F(0x07ee548e) /* 0.495686106 */, 18 }, + /* 6845 */ { MAD_F(0x07eeb9d1) /* 0.495782677 */, 18 }, + /* 6846 */ { MAD_F(0x07ef1f15) /* 0.495879252 */, 18 }, + /* 6847 */ { MAD_F(0x07ef845b) /* 0.495975833 */, 18 }, + + /* 6848 */ { MAD_F(0x07efe9a1) /* 0.496072418 */, 18 }, + /* 6849 */ { MAD_F(0x07f04ee9) /* 0.496169007 */, 18 }, + /* 6850 */ { MAD_F(0x07f0b433) /* 0.496265602 */, 18 }, + /* 6851 */ { MAD_F(0x07f1197d) /* 0.496362201 */, 18 }, + /* 6852 */ { MAD_F(0x07f17ec9) /* 0.496458804 */, 18 }, + /* 6853 */ { MAD_F(0x07f1e416) /* 0.496555413 */, 18 }, + /* 6854 */ { MAD_F(0x07f24965) /* 0.496652026 */, 18 }, + /* 6855 */ { MAD_F(0x07f2aeb5) /* 0.496748644 */, 18 }, + /* 6856 */ { MAD_F(0x07f31405) /* 0.496845266 */, 18 }, + /* 6857 */ { MAD_F(0x07f37958) /* 0.496941894 */, 18 }, + /* 6858 */ { MAD_F(0x07f3deab) /* 0.497038526 */, 18 }, + /* 6859 */ { MAD_F(0x07f44400) /* 0.497135162 */, 18 }, + /* 6860 */ { MAD_F(0x07f4a956) /* 0.497231804 */, 18 }, + /* 6861 */ { MAD_F(0x07f50ead) /* 0.497328450 */, 18 }, + /* 6862 */ { MAD_F(0x07f57405) /* 0.497425100 */, 18 }, + /* 6863 */ { MAD_F(0x07f5d95f) /* 0.497521756 */, 18 }, + + /* 6864 */ { MAD_F(0x07f63eba) /* 0.497618416 */, 18 }, + /* 6865 */ { MAD_F(0x07f6a416) /* 0.497715081 */, 18 }, + /* 6866 */ { MAD_F(0x07f70974) /* 0.497811750 */, 18 }, + /* 6867 */ { MAD_F(0x07f76ed3) /* 0.497908425 */, 18 }, + /* 6868 */ { MAD_F(0x07f7d433) /* 0.498005103 */, 18 }, + /* 6869 */ { MAD_F(0x07f83994) /* 0.498101787 */, 18 }, + /* 6870 */ { MAD_F(0x07f89ef7) /* 0.498198475 */, 18 }, + /* 6871 */ { MAD_F(0x07f9045a) /* 0.498295168 */, 18 }, + /* 6872 */ { MAD_F(0x07f969c0) /* 0.498391866 */, 18 }, + /* 6873 */ { MAD_F(0x07f9cf26) /* 0.498488568 */, 18 }, + /* 6874 */ { MAD_F(0x07fa348e) /* 0.498585275 */, 18 }, + /* 6875 */ { MAD_F(0x07fa99f6) /* 0.498681987 */, 18 }, + /* 6876 */ { MAD_F(0x07faff60) /* 0.498778704 */, 18 }, + /* 6877 */ { MAD_F(0x07fb64cc) /* 0.498875425 */, 18 }, + /* 6878 */ { MAD_F(0x07fbca38) /* 0.498972150 */, 18 }, + /* 6879 */ { MAD_F(0x07fc2fa6) /* 0.499068881 */, 18 }, + + /* 6880 */ { MAD_F(0x07fc9516) /* 0.499165616 */, 18 }, + /* 6881 */ { MAD_F(0x07fcfa86) /* 0.499262356 */, 18 }, + /* 6882 */ { MAD_F(0x07fd5ff8) /* 0.499359101 */, 18 }, + /* 6883 */ { MAD_F(0x07fdc56b) /* 0.499455850 */, 18 }, + /* 6884 */ { MAD_F(0x07fe2adf) /* 0.499552604 */, 18 }, + /* 6885 */ { MAD_F(0x07fe9054) /* 0.499649362 */, 18 }, + /* 6886 */ { MAD_F(0x07fef5cb) /* 0.499746126 */, 18 }, + /* 6887 */ { MAD_F(0x07ff5b43) /* 0.499842894 */, 18 }, + /* 6888 */ { MAD_F(0x07ffc0bc) /* 0.499939666 */, 18 }, + /* 6889 */ { MAD_F(0x0400131b) /* 0.250018222 */, 19 }, + /* 6890 */ { MAD_F(0x040045d9) /* 0.250066613 */, 19 }, + /* 6891 */ { MAD_F(0x04007897) /* 0.250115006 */, 19 }, + /* 6892 */ { MAD_F(0x0400ab57) /* 0.250163402 */, 19 }, + /* 6893 */ { MAD_F(0x0400de16) /* 0.250211800 */, 19 }, + /* 6894 */ { MAD_F(0x040110d7) /* 0.250260200 */, 19 }, + /* 6895 */ { MAD_F(0x04014398) /* 0.250308603 */, 19 }, + + /* 6896 */ { MAD_F(0x04017659) /* 0.250357008 */, 19 }, + /* 6897 */ { MAD_F(0x0401a91c) /* 0.250405415 */, 19 }, + /* 6898 */ { MAD_F(0x0401dbdf) /* 0.250453825 */, 19 }, + /* 6899 */ { MAD_F(0x04020ea2) /* 0.250502237 */, 19 }, + /* 6900 */ { MAD_F(0x04024166) /* 0.250550652 */, 19 }, + /* 6901 */ { MAD_F(0x0402742b) /* 0.250599068 */, 19 }, + /* 6902 */ { MAD_F(0x0402a6f0) /* 0.250647488 */, 19 }, + /* 6903 */ { MAD_F(0x0402d9b6) /* 0.250695909 */, 19 }, + /* 6904 */ { MAD_F(0x04030c7d) /* 0.250744333 */, 19 }, + /* 6905 */ { MAD_F(0x04033f44) /* 0.250792759 */, 19 }, + /* 6906 */ { MAD_F(0x0403720c) /* 0.250841187 */, 19 }, + /* 6907 */ { MAD_F(0x0403a4d5) /* 0.250889618 */, 19 }, + /* 6908 */ { MAD_F(0x0403d79e) /* 0.250938051 */, 19 }, + /* 6909 */ { MAD_F(0x04040a68) /* 0.250986487 */, 19 }, + /* 6910 */ { MAD_F(0x04043d32) /* 0.251034924 */, 19 }, + /* 6911 */ { MAD_F(0x04046ffd) /* 0.251083365 */, 19 }, + + /* 6912 */ { MAD_F(0x0404a2c9) /* 0.251131807 */, 19 }, + /* 6913 */ { MAD_F(0x0404d595) /* 0.251180252 */, 19 }, + /* 6914 */ { MAD_F(0x04050862) /* 0.251228699 */, 19 }, + /* 6915 */ { MAD_F(0x04053b30) /* 0.251277148 */, 19 }, + /* 6916 */ { MAD_F(0x04056dfe) /* 0.251325600 */, 19 }, + /* 6917 */ { MAD_F(0x0405a0cd) /* 0.251374054 */, 19 }, + /* 6918 */ { MAD_F(0x0405d39c) /* 0.251422511 */, 19 }, + /* 6919 */ { MAD_F(0x0406066c) /* 0.251470970 */, 19 }, + /* 6920 */ { MAD_F(0x0406393d) /* 0.251519431 */, 19 }, + /* 6921 */ { MAD_F(0x04066c0e) /* 0.251567894 */, 19 }, + /* 6922 */ { MAD_F(0x04069ee0) /* 0.251616360 */, 19 }, + /* 6923 */ { MAD_F(0x0406d1b3) /* 0.251664828 */, 19 }, + /* 6924 */ { MAD_F(0x04070486) /* 0.251713299 */, 19 }, + /* 6925 */ { MAD_F(0x0407375a) /* 0.251761772 */, 19 }, + /* 6926 */ { MAD_F(0x04076a2e) /* 0.251810247 */, 19 }, + /* 6927 */ { MAD_F(0x04079d03) /* 0.251858724 */, 19 }, + + /* 6928 */ { MAD_F(0x0407cfd9) /* 0.251907204 */, 19 }, + /* 6929 */ { MAD_F(0x040802af) /* 0.251955686 */, 19 }, + /* 6930 */ { MAD_F(0x04083586) /* 0.252004171 */, 19 }, + /* 6931 */ { MAD_F(0x0408685e) /* 0.252052658 */, 19 }, + /* 6932 */ { MAD_F(0x04089b36) /* 0.252101147 */, 19 }, + /* 6933 */ { MAD_F(0x0408ce0f) /* 0.252149638 */, 19 }, + /* 6934 */ { MAD_F(0x040900e8) /* 0.252198132 */, 19 }, + /* 6935 */ { MAD_F(0x040933c2) /* 0.252246628 */, 19 }, + /* 6936 */ { MAD_F(0x0409669d) /* 0.252295127 */, 19 }, + /* 6937 */ { MAD_F(0x04099978) /* 0.252343627 */, 19 }, + /* 6938 */ { MAD_F(0x0409cc54) /* 0.252392131 */, 19 }, + /* 6939 */ { MAD_F(0x0409ff31) /* 0.252440636 */, 19 }, + /* 6940 */ { MAD_F(0x040a320e) /* 0.252489144 */, 19 }, + /* 6941 */ { MAD_F(0x040a64ec) /* 0.252537654 */, 19 }, + /* 6942 */ { MAD_F(0x040a97cb) /* 0.252586166 */, 19 }, + /* 6943 */ { MAD_F(0x040acaaa) /* 0.252634681 */, 19 }, + + /* 6944 */ { MAD_F(0x040afd89) /* 0.252683198 */, 19 }, + /* 6945 */ { MAD_F(0x040b306a) /* 0.252731718 */, 19 }, + /* 6946 */ { MAD_F(0x040b634b) /* 0.252780240 */, 19 }, + /* 6947 */ { MAD_F(0x040b962c) /* 0.252828764 */, 19 }, + /* 6948 */ { MAD_F(0x040bc90e) /* 0.252877290 */, 19 }, + /* 6949 */ { MAD_F(0x040bfbf1) /* 0.252925819 */, 19 }, + /* 6950 */ { MAD_F(0x040c2ed5) /* 0.252974350 */, 19 }, + /* 6951 */ { MAD_F(0x040c61b9) /* 0.253022883 */, 19 }, + /* 6952 */ { MAD_F(0x040c949e) /* 0.253071419 */, 19 }, + /* 6953 */ { MAD_F(0x040cc783) /* 0.253119957 */, 19 }, + /* 6954 */ { MAD_F(0x040cfa69) /* 0.253168498 */, 19 }, + /* 6955 */ { MAD_F(0x040d2d4f) /* 0.253217040 */, 19 }, + /* 6956 */ { MAD_F(0x040d6037) /* 0.253265585 */, 19 }, + /* 6957 */ { MAD_F(0x040d931e) /* 0.253314133 */, 19 }, + /* 6958 */ { MAD_F(0x040dc607) /* 0.253362682 */, 19 }, + /* 6959 */ { MAD_F(0x040df8f0) /* 0.253411234 */, 19 }, + + /* 6960 */ { MAD_F(0x040e2bda) /* 0.253459789 */, 19 }, + /* 6961 */ { MAD_F(0x040e5ec4) /* 0.253508345 */, 19 }, + /* 6962 */ { MAD_F(0x040e91af) /* 0.253556904 */, 19 }, + /* 6963 */ { MAD_F(0x040ec49b) /* 0.253605466 */, 19 }, + /* 6964 */ { MAD_F(0x040ef787) /* 0.253654029 */, 19 }, + /* 6965 */ { MAD_F(0x040f2a74) /* 0.253702595 */, 19 }, + /* 6966 */ { MAD_F(0x040f5d61) /* 0.253751164 */, 19 }, + /* 6967 */ { MAD_F(0x040f904f) /* 0.253799734 */, 19 }, + /* 6968 */ { MAD_F(0x040fc33e) /* 0.253848307 */, 19 }, + /* 6969 */ { MAD_F(0x040ff62d) /* 0.253896883 */, 19 }, + /* 6970 */ { MAD_F(0x0410291d) /* 0.253945460 */, 19 }, + /* 6971 */ { MAD_F(0x04105c0e) /* 0.253994040 */, 19 }, + /* 6972 */ { MAD_F(0x04108eff) /* 0.254042622 */, 19 }, + /* 6973 */ { MAD_F(0x0410c1f1) /* 0.254091207 */, 19 }, + /* 6974 */ { MAD_F(0x0410f4e3) /* 0.254139794 */, 19 }, + /* 6975 */ { MAD_F(0x041127d6) /* 0.254188383 */, 19 }, + + /* 6976 */ { MAD_F(0x04115aca) /* 0.254236974 */, 19 }, + /* 6977 */ { MAD_F(0x04118dbe) /* 0.254285568 */, 19 }, + /* 6978 */ { MAD_F(0x0411c0b3) /* 0.254334165 */, 19 }, + /* 6979 */ { MAD_F(0x0411f3a9) /* 0.254382763 */, 19 }, + /* 6980 */ { MAD_F(0x0412269f) /* 0.254431364 */, 19 }, + /* 6981 */ { MAD_F(0x04125996) /* 0.254479967 */, 19 }, + /* 6982 */ { MAD_F(0x04128c8d) /* 0.254528572 */, 19 }, + /* 6983 */ { MAD_F(0x0412bf85) /* 0.254577180 */, 19 }, + /* 6984 */ { MAD_F(0x0412f27e) /* 0.254625790 */, 19 }, + /* 6985 */ { MAD_F(0x04132577) /* 0.254674403 */, 19 }, + /* 6986 */ { MAD_F(0x04135871) /* 0.254723017 */, 19 }, + /* 6987 */ { MAD_F(0x04138b6c) /* 0.254771635 */, 19 }, + /* 6988 */ { MAD_F(0x0413be67) /* 0.254820254 */, 19 }, + /* 6989 */ { MAD_F(0x0413f163) /* 0.254868876 */, 19 }, + /* 6990 */ { MAD_F(0x0414245f) /* 0.254917500 */, 19 }, + /* 6991 */ { MAD_F(0x0414575c) /* 0.254966126 */, 19 }, + + /* 6992 */ { MAD_F(0x04148a5a) /* 0.255014755 */, 19 }, + /* 6993 */ { MAD_F(0x0414bd58) /* 0.255063386 */, 19 }, + /* 6994 */ { MAD_F(0x0414f057) /* 0.255112019 */, 19 }, + /* 6995 */ { MAD_F(0x04152356) /* 0.255160655 */, 19 }, + /* 6996 */ { MAD_F(0x04155657) /* 0.255209292 */, 19 }, + /* 6997 */ { MAD_F(0x04158957) /* 0.255257933 */, 19 }, + /* 6998 */ { MAD_F(0x0415bc59) /* 0.255306575 */, 19 }, + /* 6999 */ { MAD_F(0x0415ef5b) /* 0.255355220 */, 19 }, + /* 7000 */ { MAD_F(0x0416225d) /* 0.255403867 */, 19 }, + /* 7001 */ { MAD_F(0x04165561) /* 0.255452517 */, 19 }, + /* 7002 */ { MAD_F(0x04168864) /* 0.255501169 */, 19 }, + /* 7003 */ { MAD_F(0x0416bb69) /* 0.255549823 */, 19 }, + /* 7004 */ { MAD_F(0x0416ee6e) /* 0.255598479 */, 19 }, + /* 7005 */ { MAD_F(0x04172174) /* 0.255647138 */, 19 }, + /* 7006 */ { MAD_F(0x0417547a) /* 0.255695799 */, 19 }, + /* 7007 */ { MAD_F(0x04178781) /* 0.255744463 */, 19 }, + + /* 7008 */ { MAD_F(0x0417ba89) /* 0.255793128 */, 19 }, + /* 7009 */ { MAD_F(0x0417ed91) /* 0.255841796 */, 19 }, + /* 7010 */ { MAD_F(0x0418209a) /* 0.255890467 */, 19 }, + /* 7011 */ { MAD_F(0x041853a3) /* 0.255939139 */, 19 }, + /* 7012 */ { MAD_F(0x041886ad) /* 0.255987814 */, 19 }, + /* 7013 */ { MAD_F(0x0418b9b8) /* 0.256036492 */, 19 }, + /* 7014 */ { MAD_F(0x0418ecc3) /* 0.256085171 */, 19 }, + /* 7015 */ { MAD_F(0x04191fcf) /* 0.256133853 */, 19 }, + /* 7016 */ { MAD_F(0x041952dc) /* 0.256182537 */, 19 }, + /* 7017 */ { MAD_F(0x041985e9) /* 0.256231224 */, 19 }, + /* 7018 */ { MAD_F(0x0419b8f7) /* 0.256279913 */, 19 }, + /* 7019 */ { MAD_F(0x0419ec05) /* 0.256328604 */, 19 }, + /* 7020 */ { MAD_F(0x041a1f15) /* 0.256377297 */, 19 }, + /* 7021 */ { MAD_F(0x041a5224) /* 0.256425993 */, 19 }, + /* 7022 */ { MAD_F(0x041a8534) /* 0.256474691 */, 19 }, + /* 7023 */ { MAD_F(0x041ab845) /* 0.256523392 */, 19 }, + + /* 7024 */ { MAD_F(0x041aeb57) /* 0.256572095 */, 19 }, + /* 7025 */ { MAD_F(0x041b1e69) /* 0.256620800 */, 19 }, + /* 7026 */ { MAD_F(0x041b517c) /* 0.256669507 */, 19 }, + /* 7027 */ { MAD_F(0x041b848f) /* 0.256718217 */, 19 }, + /* 7028 */ { MAD_F(0x041bb7a3) /* 0.256766929 */, 19 }, + /* 7029 */ { MAD_F(0x041beab8) /* 0.256815643 */, 19 }, + /* 7030 */ { MAD_F(0x041c1dcd) /* 0.256864359 */, 19 }, + /* 7031 */ { MAD_F(0x041c50e3) /* 0.256913078 */, 19 }, + /* 7032 */ { MAD_F(0x041c83fa) /* 0.256961800 */, 19 }, + /* 7033 */ { MAD_F(0x041cb711) /* 0.257010523 */, 19 }, + /* 7034 */ { MAD_F(0x041cea28) /* 0.257059249 */, 19 }, + /* 7035 */ { MAD_F(0x041d1d41) /* 0.257107977 */, 19 }, + /* 7036 */ { MAD_F(0x041d505a) /* 0.257156708 */, 19 }, + /* 7037 */ { MAD_F(0x041d8373) /* 0.257205440 */, 19 }, + /* 7038 */ { MAD_F(0x041db68e) /* 0.257254175 */, 19 }, + /* 7039 */ { MAD_F(0x041de9a8) /* 0.257302913 */, 19 }, + + /* 7040 */ { MAD_F(0x041e1cc4) /* 0.257351652 */, 19 }, + /* 7041 */ { MAD_F(0x041e4fe0) /* 0.257400394 */, 19 }, + /* 7042 */ { MAD_F(0x041e82fd) /* 0.257449139 */, 19 }, + /* 7043 */ { MAD_F(0x041eb61a) /* 0.257497885 */, 19 }, + /* 7044 */ { MAD_F(0x041ee938) /* 0.257546634 */, 19 }, + /* 7045 */ { MAD_F(0x041f1c57) /* 0.257595386 */, 19 }, + /* 7046 */ { MAD_F(0x041f4f76) /* 0.257644139 */, 19 }, + /* 7047 */ { MAD_F(0x041f8296) /* 0.257692895 */, 19 }, + /* 7048 */ { MAD_F(0x041fb5b6) /* 0.257741653 */, 19 }, + /* 7049 */ { MAD_F(0x041fe8d7) /* 0.257790414 */, 19 }, + /* 7050 */ { MAD_F(0x04201bf9) /* 0.257839176 */, 19 }, + /* 7051 */ { MAD_F(0x04204f1b) /* 0.257887941 */, 19 }, + /* 7052 */ { MAD_F(0x0420823e) /* 0.257936709 */, 19 }, + /* 7053 */ { MAD_F(0x0420b561) /* 0.257985478 */, 19 }, + /* 7054 */ { MAD_F(0x0420e885) /* 0.258034250 */, 19 }, + /* 7055 */ { MAD_F(0x04211baa) /* 0.258083025 */, 19 }, + + /* 7056 */ { MAD_F(0x04214ed0) /* 0.258131801 */, 19 }, + /* 7057 */ { MAD_F(0x042181f6) /* 0.258180580 */, 19 }, + /* 7058 */ { MAD_F(0x0421b51c) /* 0.258229361 */, 19 }, + /* 7059 */ { MAD_F(0x0421e843) /* 0.258278145 */, 19 }, + /* 7060 */ { MAD_F(0x04221b6b) /* 0.258326931 */, 19 }, + /* 7061 */ { MAD_F(0x04224e94) /* 0.258375719 */, 19 }, + /* 7062 */ { MAD_F(0x042281bd) /* 0.258424509 */, 19 }, + /* 7063 */ { MAD_F(0x0422b4e6) /* 0.258473302 */, 19 }, + /* 7064 */ { MAD_F(0x0422e811) /* 0.258522097 */, 19 }, + /* 7065 */ { MAD_F(0x04231b3c) /* 0.258570894 */, 19 }, + /* 7066 */ { MAD_F(0x04234e67) /* 0.258619694 */, 19 }, + /* 7067 */ { MAD_F(0x04238193) /* 0.258668496 */, 19 }, + /* 7068 */ { MAD_F(0x0423b4c0) /* 0.258717300 */, 19 }, + /* 7069 */ { MAD_F(0x0423e7ee) /* 0.258766106 */, 19 }, + /* 7070 */ { MAD_F(0x04241b1c) /* 0.258814915 */, 19 }, + /* 7071 */ { MAD_F(0x04244e4a) /* 0.258863726 */, 19 }, + + /* 7072 */ { MAD_F(0x04248179) /* 0.258912540 */, 19 }, + /* 7073 */ { MAD_F(0x0424b4a9) /* 0.258961356 */, 19 }, + /* 7074 */ { MAD_F(0x0424e7da) /* 0.259010174 */, 19 }, + /* 7075 */ { MAD_F(0x04251b0b) /* 0.259058994 */, 19 }, + /* 7076 */ { MAD_F(0x04254e3d) /* 0.259107817 */, 19 }, + /* 7077 */ { MAD_F(0x0425816f) /* 0.259156642 */, 19 }, + /* 7078 */ { MAD_F(0x0425b4a2) /* 0.259205469 */, 19 }, + /* 7079 */ { MAD_F(0x0425e7d6) /* 0.259254298 */, 19 }, + /* 7080 */ { MAD_F(0x04261b0a) /* 0.259303130 */, 19 }, + /* 7081 */ { MAD_F(0x04264e3f) /* 0.259351964 */, 19 }, + /* 7082 */ { MAD_F(0x04268174) /* 0.259400801 */, 19 }, + /* 7083 */ { MAD_F(0x0426b4aa) /* 0.259449639 */, 19 }, + /* 7084 */ { MAD_F(0x0426e7e1) /* 0.259498480 */, 19 }, + /* 7085 */ { MAD_F(0x04271b18) /* 0.259547324 */, 19 }, + /* 7086 */ { MAD_F(0x04274e50) /* 0.259596169 */, 19 }, + /* 7087 */ { MAD_F(0x04278188) /* 0.259645017 */, 19 }, + + /* 7088 */ { MAD_F(0x0427b4c2) /* 0.259693868 */, 19 }, + /* 7089 */ { MAD_F(0x0427e7fb) /* 0.259742720 */, 19 }, + /* 7090 */ { MAD_F(0x04281b36) /* 0.259791575 */, 19 }, + /* 7091 */ { MAD_F(0x04284e71) /* 0.259840432 */, 19 }, + /* 7092 */ { MAD_F(0x042881ac) /* 0.259889291 */, 19 }, + /* 7093 */ { MAD_F(0x0428b4e8) /* 0.259938153 */, 19 }, + /* 7094 */ { MAD_F(0x0428e825) /* 0.259987017 */, 19 }, + /* 7095 */ { MAD_F(0x04291b63) /* 0.260035883 */, 19 }, + /* 7096 */ { MAD_F(0x04294ea1) /* 0.260084752 */, 19 }, + /* 7097 */ { MAD_F(0x042981df) /* 0.260133623 */, 19 }, + /* 7098 */ { MAD_F(0x0429b51f) /* 0.260182496 */, 19 }, + /* 7099 */ { MAD_F(0x0429e85f) /* 0.260231372 */, 19 }, + /* 7100 */ { MAD_F(0x042a1b9f) /* 0.260280249 */, 19 }, + /* 7101 */ { MAD_F(0x042a4ee0) /* 0.260329129 */, 19 }, + /* 7102 */ { MAD_F(0x042a8222) /* 0.260378012 */, 19 }, + /* 7103 */ { MAD_F(0x042ab564) /* 0.260426896 */, 19 }, + + /* 7104 */ { MAD_F(0x042ae8a7) /* 0.260475783 */, 19 }, + /* 7105 */ { MAD_F(0x042b1beb) /* 0.260524673 */, 19 }, + /* 7106 */ { MAD_F(0x042b4f2f) /* 0.260573564 */, 19 }, + /* 7107 */ { MAD_F(0x042b8274) /* 0.260622458 */, 19 }, + /* 7108 */ { MAD_F(0x042bb5ba) /* 0.260671354 */, 19 }, + /* 7109 */ { MAD_F(0x042be900) /* 0.260720252 */, 19 }, + /* 7110 */ { MAD_F(0x042c1c46) /* 0.260769153 */, 19 }, + /* 7111 */ { MAD_F(0x042c4f8e) /* 0.260818056 */, 19 }, + /* 7112 */ { MAD_F(0x042c82d6) /* 0.260866961 */, 19 }, + /* 7113 */ { MAD_F(0x042cb61e) /* 0.260915869 */, 19 }, + /* 7114 */ { MAD_F(0x042ce967) /* 0.260964779 */, 19 }, + /* 7115 */ { MAD_F(0x042d1cb1) /* 0.261013691 */, 19 }, + /* 7116 */ { MAD_F(0x042d4ffb) /* 0.261062606 */, 19 }, + /* 7117 */ { MAD_F(0x042d8346) /* 0.261111522 */, 19 }, + /* 7118 */ { MAD_F(0x042db692) /* 0.261160441 */, 19 }, + /* 7119 */ { MAD_F(0x042de9de) /* 0.261209363 */, 19 }, + + /* 7120 */ { MAD_F(0x042e1d2b) /* 0.261258286 */, 19 }, + /* 7121 */ { MAD_F(0x042e5078) /* 0.261307212 */, 19 }, + /* 7122 */ { MAD_F(0x042e83c6) /* 0.261356140 */, 19 }, + /* 7123 */ { MAD_F(0x042eb715) /* 0.261405071 */, 19 }, + /* 7124 */ { MAD_F(0x042eea64) /* 0.261454004 */, 19 }, + /* 7125 */ { MAD_F(0x042f1db4) /* 0.261502939 */, 19 }, + /* 7126 */ { MAD_F(0x042f5105) /* 0.261551876 */, 19 }, + /* 7127 */ { MAD_F(0x042f8456) /* 0.261600816 */, 19 }, + /* 7128 */ { MAD_F(0x042fb7a8) /* 0.261649758 */, 19 }, + /* 7129 */ { MAD_F(0x042feafa) /* 0.261698702 */, 19 }, + /* 7130 */ { MAD_F(0x04301e4d) /* 0.261747649 */, 19 }, + /* 7131 */ { MAD_F(0x043051a1) /* 0.261796597 */, 19 }, + /* 7132 */ { MAD_F(0x043084f5) /* 0.261845548 */, 19 }, + /* 7133 */ { MAD_F(0x0430b84a) /* 0.261894502 */, 19 }, + /* 7134 */ { MAD_F(0x0430eb9f) /* 0.261943458 */, 19 }, + /* 7135 */ { MAD_F(0x04311ef5) /* 0.261992416 */, 19 }, + + /* 7136 */ { MAD_F(0x0431524c) /* 0.262041376 */, 19 }, + /* 7137 */ { MAD_F(0x043185a3) /* 0.262090338 */, 19 }, + /* 7138 */ { MAD_F(0x0431b8fb) /* 0.262139303 */, 19 }, + /* 7139 */ { MAD_F(0x0431ec54) /* 0.262188270 */, 19 }, + /* 7140 */ { MAD_F(0x04321fad) /* 0.262237240 */, 19 }, + /* 7141 */ { MAD_F(0x04325306) /* 0.262286211 */, 19 }, + /* 7142 */ { MAD_F(0x04328661) /* 0.262335185 */, 19 }, + /* 7143 */ { MAD_F(0x0432b9bc) /* 0.262384162 */, 19 }, + /* 7144 */ { MAD_F(0x0432ed17) /* 0.262433140 */, 19 }, + /* 7145 */ { MAD_F(0x04332074) /* 0.262482121 */, 19 }, + /* 7146 */ { MAD_F(0x043353d0) /* 0.262531104 */, 19 }, + /* 7147 */ { MAD_F(0x0433872e) /* 0.262580089 */, 19 }, + /* 7148 */ { MAD_F(0x0433ba8c) /* 0.262629077 */, 19 }, + /* 7149 */ { MAD_F(0x0433edea) /* 0.262678067 */, 19 }, + /* 7150 */ { MAD_F(0x0434214a) /* 0.262727059 */, 19 }, + /* 7151 */ { MAD_F(0x043454aa) /* 0.262776054 */, 19 }, + + /* 7152 */ { MAD_F(0x0434880a) /* 0.262825051 */, 19 }, + /* 7153 */ { MAD_F(0x0434bb6b) /* 0.262874050 */, 19 }, + /* 7154 */ { MAD_F(0x0434eecd) /* 0.262923051 */, 19 }, + /* 7155 */ { MAD_F(0x0435222f) /* 0.262972055 */, 19 }, + /* 7156 */ { MAD_F(0x04355592) /* 0.263021061 */, 19 }, + /* 7157 */ { MAD_F(0x043588f6) /* 0.263070069 */, 19 }, + /* 7158 */ { MAD_F(0x0435bc5a) /* 0.263119079 */, 19 }, + /* 7159 */ { MAD_F(0x0435efbf) /* 0.263168092 */, 19 }, + /* 7160 */ { MAD_F(0x04362324) /* 0.263217107 */, 19 }, + /* 7161 */ { MAD_F(0x0436568a) /* 0.263266125 */, 19 }, + /* 7162 */ { MAD_F(0x043689f1) /* 0.263315144 */, 19 }, + /* 7163 */ { MAD_F(0x0436bd58) /* 0.263364166 */, 19 }, + /* 7164 */ { MAD_F(0x0436f0c0) /* 0.263413191 */, 19 }, + /* 7165 */ { MAD_F(0x04372428) /* 0.263462217 */, 19 }, + /* 7166 */ { MAD_F(0x04375791) /* 0.263511246 */, 19 }, + /* 7167 */ { MAD_F(0x04378afb) /* 0.263560277 */, 19 }, + + /* 7168 */ { MAD_F(0x0437be65) /* 0.263609310 */, 19 }, + /* 7169 */ { MAD_F(0x0437f1d0) /* 0.263658346 */, 19 }, + /* 7170 */ { MAD_F(0x0438253c) /* 0.263707384 */, 19 }, + /* 7171 */ { MAD_F(0x043858a8) /* 0.263756424 */, 19 }, + /* 7172 */ { MAD_F(0x04388c14) /* 0.263805466 */, 19 }, + /* 7173 */ { MAD_F(0x0438bf82) /* 0.263854511 */, 19 }, + /* 7174 */ { MAD_F(0x0438f2f0) /* 0.263903558 */, 19 }, + /* 7175 */ { MAD_F(0x0439265e) /* 0.263952607 */, 19 }, + /* 7176 */ { MAD_F(0x043959cd) /* 0.264001659 */, 19 }, + /* 7177 */ { MAD_F(0x04398d3d) /* 0.264050713 */, 19 }, + /* 7178 */ { MAD_F(0x0439c0ae) /* 0.264099769 */, 19 }, + /* 7179 */ { MAD_F(0x0439f41f) /* 0.264148827 */, 19 }, + /* 7180 */ { MAD_F(0x043a2790) /* 0.264197888 */, 19 }, + /* 7181 */ { MAD_F(0x043a5b02) /* 0.264246951 */, 19 }, + /* 7182 */ { MAD_F(0x043a8e75) /* 0.264296016 */, 19 }, + /* 7183 */ { MAD_F(0x043ac1e9) /* 0.264345084 */, 19 }, + + /* 7184 */ { MAD_F(0x043af55d) /* 0.264394153 */, 19 }, + /* 7185 */ { MAD_F(0x043b28d2) /* 0.264443225 */, 19 }, + /* 7186 */ { MAD_F(0x043b5c47) /* 0.264492300 */, 19 }, + /* 7187 */ { MAD_F(0x043b8fbd) /* 0.264541376 */, 19 }, + /* 7188 */ { MAD_F(0x043bc333) /* 0.264590455 */, 19 }, + /* 7189 */ { MAD_F(0x043bf6aa) /* 0.264639536 */, 19 }, + /* 7190 */ { MAD_F(0x043c2a22) /* 0.264688620 */, 19 }, + /* 7191 */ { MAD_F(0x043c5d9a) /* 0.264737706 */, 19 }, + /* 7192 */ { MAD_F(0x043c9113) /* 0.264786794 */, 19 }, + /* 7193 */ { MAD_F(0x043cc48d) /* 0.264835884 */, 19 }, + /* 7194 */ { MAD_F(0x043cf807) /* 0.264884976 */, 19 }, + /* 7195 */ { MAD_F(0x043d2b82) /* 0.264934071 */, 19 }, + /* 7196 */ { MAD_F(0x043d5efd) /* 0.264983168 */, 19 }, + /* 7197 */ { MAD_F(0x043d9279) /* 0.265032268 */, 19 }, + /* 7198 */ { MAD_F(0x043dc5f6) /* 0.265081369 */, 19 }, + /* 7199 */ { MAD_F(0x043df973) /* 0.265130473 */, 19 }, + + /* 7200 */ { MAD_F(0x043e2cf1) /* 0.265179580 */, 19 }, + /* 7201 */ { MAD_F(0x043e6070) /* 0.265228688 */, 19 }, + /* 7202 */ { MAD_F(0x043e93ef) /* 0.265277799 */, 19 }, + /* 7203 */ { MAD_F(0x043ec76e) /* 0.265326912 */, 19 }, + /* 7204 */ { MAD_F(0x043efaef) /* 0.265376027 */, 19 }, + /* 7205 */ { MAD_F(0x043f2e6f) /* 0.265425145 */, 19 }, + /* 7206 */ { MAD_F(0x043f61f1) /* 0.265474264 */, 19 }, + /* 7207 */ { MAD_F(0x043f9573) /* 0.265523387 */, 19 }, + /* 7208 */ { MAD_F(0x043fc8f6) /* 0.265572511 */, 19 }, + /* 7209 */ { MAD_F(0x043ffc79) /* 0.265621638 */, 19 }, + /* 7210 */ { MAD_F(0x04402ffd) /* 0.265670766 */, 19 }, + /* 7211 */ { MAD_F(0x04406382) /* 0.265719898 */, 19 }, + /* 7212 */ { MAD_F(0x04409707) /* 0.265769031 */, 19 }, + /* 7213 */ { MAD_F(0x0440ca8d) /* 0.265818167 */, 19 }, + /* 7214 */ { MAD_F(0x0440fe13) /* 0.265867305 */, 19 }, + /* 7215 */ { MAD_F(0x0441319a) /* 0.265916445 */, 19 }, + + /* 7216 */ { MAD_F(0x04416522) /* 0.265965588 */, 19 }, + /* 7217 */ { MAD_F(0x044198aa) /* 0.266014732 */, 19 }, + /* 7218 */ { MAD_F(0x0441cc33) /* 0.266063880 */, 19 }, + /* 7219 */ { MAD_F(0x0441ffbc) /* 0.266113029 */, 19 }, + /* 7220 */ { MAD_F(0x04423346) /* 0.266162181 */, 19 }, + /* 7221 */ { MAD_F(0x044266d1) /* 0.266211334 */, 19 }, + /* 7222 */ { MAD_F(0x04429a5c) /* 0.266260491 */, 19 }, + /* 7223 */ { MAD_F(0x0442cde8) /* 0.266309649 */, 19 }, + /* 7224 */ { MAD_F(0x04430174) /* 0.266358810 */, 19 }, + /* 7225 */ { MAD_F(0x04433501) /* 0.266407973 */, 19 }, + /* 7226 */ { MAD_F(0x0443688f) /* 0.266457138 */, 19 }, + /* 7227 */ { MAD_F(0x04439c1d) /* 0.266506305 */, 19 }, + /* 7228 */ { MAD_F(0x0443cfac) /* 0.266555475 */, 19 }, + /* 7229 */ { MAD_F(0x0444033c) /* 0.266604647 */, 19 }, + /* 7230 */ { MAD_F(0x044436cc) /* 0.266653822 */, 19 }, + /* 7231 */ { MAD_F(0x04446a5d) /* 0.266702998 */, 19 }, + + /* 7232 */ { MAD_F(0x04449dee) /* 0.266752177 */, 19 }, + /* 7233 */ { MAD_F(0x0444d180) /* 0.266801358 */, 19 }, + /* 7234 */ { MAD_F(0x04450513) /* 0.266850541 */, 19 }, + /* 7235 */ { MAD_F(0x044538a6) /* 0.266899727 */, 19 }, + /* 7236 */ { MAD_F(0x04456c39) /* 0.266948915 */, 19 }, + /* 7237 */ { MAD_F(0x04459fce) /* 0.266998105 */, 19 }, + /* 7238 */ { MAD_F(0x0445d363) /* 0.267047298 */, 19 }, + /* 7239 */ { MAD_F(0x044606f8) /* 0.267096492 */, 19 }, + /* 7240 */ { MAD_F(0x04463a8f) /* 0.267145689 */, 19 }, + /* 7241 */ { MAD_F(0x04466e25) /* 0.267194888 */, 19 }, + /* 7242 */ { MAD_F(0x0446a1bd) /* 0.267244090 */, 19 }, + /* 7243 */ { MAD_F(0x0446d555) /* 0.267293294 */, 19 }, + /* 7244 */ { MAD_F(0x044708ee) /* 0.267342500 */, 19 }, + /* 7245 */ { MAD_F(0x04473c87) /* 0.267391708 */, 19 }, + /* 7246 */ { MAD_F(0x04477021) /* 0.267440919 */, 19 }, + /* 7247 */ { MAD_F(0x0447a3bb) /* 0.267490131 */, 19 }, + + /* 7248 */ { MAD_F(0x0447d756) /* 0.267539347 */, 19 }, + /* 7249 */ { MAD_F(0x04480af2) /* 0.267588564 */, 19 }, + /* 7250 */ { MAD_F(0x04483e8e) /* 0.267637783 */, 19 }, + /* 7251 */ { MAD_F(0x0448722b) /* 0.267687005 */, 19 }, + /* 7252 */ { MAD_F(0x0448a5c9) /* 0.267736229 */, 19 }, + /* 7253 */ { MAD_F(0x0448d967) /* 0.267785456 */, 19 }, + /* 7254 */ { MAD_F(0x04490d05) /* 0.267834685 */, 19 }, + /* 7255 */ { MAD_F(0x044940a5) /* 0.267883915 */, 19 }, + /* 7256 */ { MAD_F(0x04497445) /* 0.267933149 */, 19 }, + /* 7257 */ { MAD_F(0x0449a7e5) /* 0.267982384 */, 19 }, + /* 7258 */ { MAD_F(0x0449db86) /* 0.268031622 */, 19 }, + /* 7259 */ { MAD_F(0x044a0f28) /* 0.268080862 */, 19 }, + /* 7260 */ { MAD_F(0x044a42ca) /* 0.268130104 */, 19 }, + /* 7261 */ { MAD_F(0x044a766d) /* 0.268179349 */, 19 }, + /* 7262 */ { MAD_F(0x044aaa11) /* 0.268228595 */, 19 }, + /* 7263 */ { MAD_F(0x044addb5) /* 0.268277844 */, 19 }, + + /* 7264 */ { MAD_F(0x044b115a) /* 0.268327096 */, 19 }, + /* 7265 */ { MAD_F(0x044b44ff) /* 0.268376349 */, 19 }, + /* 7266 */ { MAD_F(0x044b78a5) /* 0.268425605 */, 19 }, + /* 7267 */ { MAD_F(0x044bac4c) /* 0.268474863 */, 19 }, + /* 7268 */ { MAD_F(0x044bdff3) /* 0.268524123 */, 19 }, + /* 7269 */ { MAD_F(0x044c139b) /* 0.268573386 */, 19 }, + /* 7270 */ { MAD_F(0x044c4743) /* 0.268622651 */, 19 }, + /* 7271 */ { MAD_F(0x044c7aec) /* 0.268671918 */, 19 }, + /* 7272 */ { MAD_F(0x044cae96) /* 0.268721187 */, 19 }, + /* 7273 */ { MAD_F(0x044ce240) /* 0.268770459 */, 19 }, + /* 7274 */ { MAD_F(0x044d15eb) /* 0.268819733 */, 19 }, + /* 7275 */ { MAD_F(0x044d4997) /* 0.268869009 */, 19 }, + /* 7276 */ { MAD_F(0x044d7d43) /* 0.268918287 */, 19 }, + /* 7277 */ { MAD_F(0x044db0ef) /* 0.268967568 */, 19 }, + /* 7278 */ { MAD_F(0x044de49d) /* 0.269016851 */, 19 }, + /* 7279 */ { MAD_F(0x044e184b) /* 0.269066136 */, 19 }, + + /* 7280 */ { MAD_F(0x044e4bf9) /* 0.269115423 */, 19 }, + /* 7281 */ { MAD_F(0x044e7fa8) /* 0.269164713 */, 19 }, + /* 7282 */ { MAD_F(0x044eb358) /* 0.269214005 */, 19 }, + /* 7283 */ { MAD_F(0x044ee708) /* 0.269263299 */, 19 }, + /* 7284 */ { MAD_F(0x044f1ab9) /* 0.269312595 */, 19 }, + /* 7285 */ { MAD_F(0x044f4e6b) /* 0.269361894 */, 19 }, + /* 7286 */ { MAD_F(0x044f821d) /* 0.269411195 */, 19 }, + /* 7287 */ { MAD_F(0x044fb5cf) /* 0.269460498 */, 19 }, + /* 7288 */ { MAD_F(0x044fe983) /* 0.269509804 */, 19 }, + /* 7289 */ { MAD_F(0x04501d37) /* 0.269559111 */, 19 }, + /* 7290 */ { MAD_F(0x045050eb) /* 0.269608421 */, 19 }, + /* 7291 */ { MAD_F(0x045084a0) /* 0.269657734 */, 19 }, + /* 7292 */ { MAD_F(0x0450b856) /* 0.269707048 */, 19 }, + /* 7293 */ { MAD_F(0x0450ec0d) /* 0.269756365 */, 19 }, + /* 7294 */ { MAD_F(0x04511fc4) /* 0.269805684 */, 19 }, + /* 7295 */ { MAD_F(0x0451537b) /* 0.269855005 */, 19 }, + + /* 7296 */ { MAD_F(0x04518733) /* 0.269904329 */, 19 }, + /* 7297 */ { MAD_F(0x0451baec) /* 0.269953654 */, 19 }, + /* 7298 */ { MAD_F(0x0451eea5) /* 0.270002982 */, 19 }, + /* 7299 */ { MAD_F(0x0452225f) /* 0.270052313 */, 19 }, + /* 7300 */ { MAD_F(0x0452561a) /* 0.270101645 */, 19 }, + /* 7301 */ { MAD_F(0x045289d5) /* 0.270150980 */, 19 }, + /* 7302 */ { MAD_F(0x0452bd91) /* 0.270200317 */, 19 }, + /* 7303 */ { MAD_F(0x0452f14d) /* 0.270249656 */, 19 }, + /* 7304 */ { MAD_F(0x0453250a) /* 0.270298998 */, 19 }, + /* 7305 */ { MAD_F(0x045358c8) /* 0.270348341 */, 19 }, + /* 7306 */ { MAD_F(0x04538c86) /* 0.270397687 */, 19 }, + /* 7307 */ { MAD_F(0x0453c045) /* 0.270447036 */, 19 }, + /* 7308 */ { MAD_F(0x0453f405) /* 0.270496386 */, 19 }, + /* 7309 */ { MAD_F(0x045427c5) /* 0.270545739 */, 19 }, + /* 7310 */ { MAD_F(0x04545b85) /* 0.270595094 */, 19 }, + /* 7311 */ { MAD_F(0x04548f46) /* 0.270644451 */, 19 }, + + /* 7312 */ { MAD_F(0x0454c308) /* 0.270693811 */, 19 }, + /* 7313 */ { MAD_F(0x0454f6cb) /* 0.270743173 */, 19 }, + /* 7314 */ { MAD_F(0x04552a8e) /* 0.270792537 */, 19 }, + /* 7315 */ { MAD_F(0x04555e51) /* 0.270841903 */, 19 }, + /* 7316 */ { MAD_F(0x04559216) /* 0.270891271 */, 19 }, + /* 7317 */ { MAD_F(0x0455c5db) /* 0.270940642 */, 19 }, + /* 7318 */ { MAD_F(0x0455f9a0) /* 0.270990015 */, 19 }, + /* 7319 */ { MAD_F(0x04562d66) /* 0.271039390 */, 19 }, + /* 7320 */ { MAD_F(0x0456612d) /* 0.271088768 */, 19 }, + /* 7321 */ { MAD_F(0x045694f4) /* 0.271138148 */, 19 }, + /* 7322 */ { MAD_F(0x0456c8bc) /* 0.271187530 */, 19 }, + /* 7323 */ { MAD_F(0x0456fc84) /* 0.271236914 */, 19 }, + /* 7324 */ { MAD_F(0x0457304e) /* 0.271286301 */, 19 }, + /* 7325 */ { MAD_F(0x04576417) /* 0.271335689 */, 19 }, + /* 7326 */ { MAD_F(0x045797e2) /* 0.271385080 */, 19 }, + /* 7327 */ { MAD_F(0x0457cbac) /* 0.271434474 */, 19 }, + + /* 7328 */ { MAD_F(0x0457ff78) /* 0.271483869 */, 19 }, + /* 7329 */ { MAD_F(0x04583344) /* 0.271533267 */, 19 }, + /* 7330 */ { MAD_F(0x04586711) /* 0.271582667 */, 19 }, + /* 7331 */ { MAD_F(0x04589ade) /* 0.271632069 */, 19 }, + /* 7332 */ { MAD_F(0x0458ceac) /* 0.271681474 */, 19 }, + /* 7333 */ { MAD_F(0x0459027b) /* 0.271730880 */, 19 }, + /* 7334 */ { MAD_F(0x0459364a) /* 0.271780289 */, 19 }, + /* 7335 */ { MAD_F(0x04596a19) /* 0.271829701 */, 19 }, + /* 7336 */ { MAD_F(0x04599dea) /* 0.271879114 */, 19 }, + /* 7337 */ { MAD_F(0x0459d1bb) /* 0.271928530 */, 19 }, + /* 7338 */ { MAD_F(0x045a058c) /* 0.271977948 */, 19 }, + /* 7339 */ { MAD_F(0x045a395e) /* 0.272027368 */, 19 }, + /* 7340 */ { MAD_F(0x045a6d31) /* 0.272076790 */, 19 }, + /* 7341 */ { MAD_F(0x045aa104) /* 0.272126215 */, 19 }, + /* 7342 */ { MAD_F(0x045ad4d8) /* 0.272175642 */, 19 }, + /* 7343 */ { MAD_F(0x045b08ad) /* 0.272225071 */, 19 }, + + /* 7344 */ { MAD_F(0x045b3c82) /* 0.272274503 */, 19 }, + /* 7345 */ { MAD_F(0x045b7058) /* 0.272323936 */, 19 }, + /* 7346 */ { MAD_F(0x045ba42e) /* 0.272373372 */, 19 }, + /* 7347 */ { MAD_F(0x045bd805) /* 0.272422810 */, 19 }, + /* 7348 */ { MAD_F(0x045c0bdd) /* 0.272472251 */, 19 }, + /* 7349 */ { MAD_F(0x045c3fb5) /* 0.272521693 */, 19 }, + /* 7350 */ { MAD_F(0x045c738e) /* 0.272571138 */, 19 }, + /* 7351 */ { MAD_F(0x045ca767) /* 0.272620585 */, 19 }, + /* 7352 */ { MAD_F(0x045cdb41) /* 0.272670035 */, 19 }, + /* 7353 */ { MAD_F(0x045d0f1b) /* 0.272719486 */, 19 }, + /* 7354 */ { MAD_F(0x045d42f7) /* 0.272768940 */, 19 }, + /* 7355 */ { MAD_F(0x045d76d2) /* 0.272818396 */, 19 }, + /* 7356 */ { MAD_F(0x045daaaf) /* 0.272867855 */, 19 }, + /* 7357 */ { MAD_F(0x045dde8c) /* 0.272917315 */, 19 }, + /* 7358 */ { MAD_F(0x045e1269) /* 0.272966778 */, 19 }, + /* 7359 */ { MAD_F(0x045e4647) /* 0.273016243 */, 19 }, + + /* 7360 */ { MAD_F(0x045e7a26) /* 0.273065710 */, 19 }, + /* 7361 */ { MAD_F(0x045eae06) /* 0.273115180 */, 19 }, + /* 7362 */ { MAD_F(0x045ee1e6) /* 0.273164652 */, 19 }, + /* 7363 */ { MAD_F(0x045f15c6) /* 0.273214126 */, 19 }, + /* 7364 */ { MAD_F(0x045f49a7) /* 0.273263602 */, 19 }, + /* 7365 */ { MAD_F(0x045f7d89) /* 0.273313081 */, 19 }, + /* 7366 */ { MAD_F(0x045fb16c) /* 0.273362561 */, 19 }, + /* 7367 */ { MAD_F(0x045fe54f) /* 0.273412044 */, 19 }, + /* 7368 */ { MAD_F(0x04601932) /* 0.273461530 */, 19 }, + /* 7369 */ { MAD_F(0x04604d16) /* 0.273511017 */, 19 }, + /* 7370 */ { MAD_F(0x046080fb) /* 0.273560507 */, 19 }, + /* 7371 */ { MAD_F(0x0460b4e1) /* 0.273609999 */, 19 }, + /* 7372 */ { MAD_F(0x0460e8c7) /* 0.273659493 */, 19 }, + /* 7373 */ { MAD_F(0x04611cad) /* 0.273708989 */, 19 }, + /* 7374 */ { MAD_F(0x04615094) /* 0.273758488 */, 19 }, + /* 7375 */ { MAD_F(0x0461847c) /* 0.273807989 */, 19 }, + + /* 7376 */ { MAD_F(0x0461b864) /* 0.273857492 */, 19 }, + /* 7377 */ { MAD_F(0x0461ec4d) /* 0.273906997 */, 19 }, + /* 7378 */ { MAD_F(0x04622037) /* 0.273956505 */, 19 }, + /* 7379 */ { MAD_F(0x04625421) /* 0.274006015 */, 19 }, + /* 7380 */ { MAD_F(0x0462880c) /* 0.274055527 */, 19 }, + /* 7381 */ { MAD_F(0x0462bbf7) /* 0.274105041 */, 19 }, + /* 7382 */ { MAD_F(0x0462efe3) /* 0.274154558 */, 19 }, + /* 7383 */ { MAD_F(0x046323d0) /* 0.274204076 */, 19 }, + /* 7384 */ { MAD_F(0x046357bd) /* 0.274253597 */, 19 }, + /* 7385 */ { MAD_F(0x04638bab) /* 0.274303121 */, 19 }, + /* 7386 */ { MAD_F(0x0463bf99) /* 0.274352646 */, 19 }, + /* 7387 */ { MAD_F(0x0463f388) /* 0.274402174 */, 19 }, + /* 7388 */ { MAD_F(0x04642778) /* 0.274451704 */, 19 }, + /* 7389 */ { MAD_F(0x04645b68) /* 0.274501236 */, 19 }, + /* 7390 */ { MAD_F(0x04648f59) /* 0.274550771 */, 19 }, + /* 7391 */ { MAD_F(0x0464c34a) /* 0.274600307 */, 19 }, + + /* 7392 */ { MAD_F(0x0464f73c) /* 0.274649846 */, 19 }, + /* 7393 */ { MAD_F(0x04652b2f) /* 0.274699387 */, 19 }, + /* 7394 */ { MAD_F(0x04655f22) /* 0.274748931 */, 19 }, + /* 7395 */ { MAD_F(0x04659316) /* 0.274798476 */, 19 }, + /* 7396 */ { MAD_F(0x0465c70a) /* 0.274848024 */, 19 }, + /* 7397 */ { MAD_F(0x0465faff) /* 0.274897574 */, 19 }, + /* 7398 */ { MAD_F(0x04662ef5) /* 0.274947126 */, 19 }, + /* 7399 */ { MAD_F(0x046662eb) /* 0.274996681 */, 19 }, + /* 7400 */ { MAD_F(0x046696e2) /* 0.275046238 */, 19 }, + /* 7401 */ { MAD_F(0x0466cad9) /* 0.275095797 */, 19 }, + /* 7402 */ { MAD_F(0x0466fed1) /* 0.275145358 */, 19 }, + /* 7403 */ { MAD_F(0x046732ca) /* 0.275194921 */, 19 }, + /* 7404 */ { MAD_F(0x046766c3) /* 0.275244487 */, 19 }, + /* 7405 */ { MAD_F(0x04679abd) /* 0.275294055 */, 19 }, + /* 7406 */ { MAD_F(0x0467ceb7) /* 0.275343625 */, 19 }, + /* 7407 */ { MAD_F(0x046802b2) /* 0.275393198 */, 19 }, + + /* 7408 */ { MAD_F(0x046836ae) /* 0.275442772 */, 19 }, + /* 7409 */ { MAD_F(0x04686aaa) /* 0.275492349 */, 19 }, + /* 7410 */ { MAD_F(0x04689ea7) /* 0.275541928 */, 19 }, + /* 7411 */ { MAD_F(0x0468d2a4) /* 0.275591509 */, 19 }, + /* 7412 */ { MAD_F(0x046906a2) /* 0.275641093 */, 19 }, + /* 7413 */ { MAD_F(0x04693aa1) /* 0.275690679 */, 19 }, + /* 7414 */ { MAD_F(0x04696ea0) /* 0.275740267 */, 19 }, + /* 7415 */ { MAD_F(0x0469a2a0) /* 0.275789857 */, 19 }, + /* 7416 */ { MAD_F(0x0469d6a0) /* 0.275839449 */, 19 }, + /* 7417 */ { MAD_F(0x046a0aa1) /* 0.275889044 */, 19 }, + /* 7418 */ { MAD_F(0x046a3ea3) /* 0.275938641 */, 19 }, + /* 7419 */ { MAD_F(0x046a72a5) /* 0.275988240 */, 19 }, + /* 7420 */ { MAD_F(0x046aa6a8) /* 0.276037842 */, 19 }, + /* 7421 */ { MAD_F(0x046adaab) /* 0.276087445 */, 19 }, + /* 7422 */ { MAD_F(0x046b0eaf) /* 0.276137051 */, 19 }, + /* 7423 */ { MAD_F(0x046b42b3) /* 0.276186659 */, 19 }, + + /* 7424 */ { MAD_F(0x046b76b9) /* 0.276236269 */, 19 }, + /* 7425 */ { MAD_F(0x046baabe) /* 0.276285882 */, 19 }, + /* 7426 */ { MAD_F(0x046bdec5) /* 0.276335497 */, 19 }, + /* 7427 */ { MAD_F(0x046c12cc) /* 0.276385113 */, 19 }, + /* 7428 */ { MAD_F(0x046c46d3) /* 0.276434733 */, 19 }, + /* 7429 */ { MAD_F(0x046c7adb) /* 0.276484354 */, 19 }, + /* 7430 */ { MAD_F(0x046caee4) /* 0.276533978 */, 19 }, + /* 7431 */ { MAD_F(0x046ce2ee) /* 0.276583604 */, 19 }, + /* 7432 */ { MAD_F(0x046d16f7) /* 0.276633232 */, 19 }, + /* 7433 */ { MAD_F(0x046d4b02) /* 0.276682862 */, 19 }, + /* 7434 */ { MAD_F(0x046d7f0d) /* 0.276732495 */, 19 }, + /* 7435 */ { MAD_F(0x046db319) /* 0.276782129 */, 19 }, + /* 7436 */ { MAD_F(0x046de725) /* 0.276831766 */, 19 }, + /* 7437 */ { MAD_F(0x046e1b32) /* 0.276881406 */, 19 }, + /* 7438 */ { MAD_F(0x046e4f40) /* 0.276931047 */, 19 }, + /* 7439 */ { MAD_F(0x046e834e) /* 0.276980691 */, 19 }, + + /* 7440 */ { MAD_F(0x046eb75c) /* 0.277030337 */, 19 }, + /* 7441 */ { MAD_F(0x046eeb6c) /* 0.277079985 */, 19 }, + /* 7442 */ { MAD_F(0x046f1f7c) /* 0.277129635 */, 19 }, + /* 7443 */ { MAD_F(0x046f538c) /* 0.277179288 */, 19 }, + /* 7444 */ { MAD_F(0x046f879d) /* 0.277228942 */, 19 }, + /* 7445 */ { MAD_F(0x046fbbaf) /* 0.277278600 */, 19 }, + /* 7446 */ { MAD_F(0x046fefc1) /* 0.277328259 */, 19 }, + /* 7447 */ { MAD_F(0x047023d4) /* 0.277377920 */, 19 }, + /* 7448 */ { MAD_F(0x047057e8) /* 0.277427584 */, 19 }, + /* 7449 */ { MAD_F(0x04708bfc) /* 0.277477250 */, 19 }, + /* 7450 */ { MAD_F(0x0470c011) /* 0.277526918 */, 19 }, + /* 7451 */ { MAD_F(0x0470f426) /* 0.277576588 */, 19 }, + /* 7452 */ { MAD_F(0x0471283c) /* 0.277626261 */, 19 }, + /* 7453 */ { MAD_F(0x04715c52) /* 0.277675936 */, 19 }, + /* 7454 */ { MAD_F(0x04719069) /* 0.277725613 */, 19 }, + /* 7455 */ { MAD_F(0x0471c481) /* 0.277775292 */, 19 }, + + /* 7456 */ { MAD_F(0x0471f899) /* 0.277824973 */, 19 }, + /* 7457 */ { MAD_F(0x04722cb2) /* 0.277874657 */, 19 }, + /* 7458 */ { MAD_F(0x047260cc) /* 0.277924343 */, 19 }, + /* 7459 */ { MAD_F(0x047294e6) /* 0.277974031 */, 19 }, + /* 7460 */ { MAD_F(0x0472c900) /* 0.278023722 */, 19 }, + /* 7461 */ { MAD_F(0x0472fd1b) /* 0.278073414 */, 19 }, + /* 7462 */ { MAD_F(0x04733137) /* 0.278123109 */, 19 }, + /* 7463 */ { MAD_F(0x04736554) /* 0.278172806 */, 19 }, + /* 7464 */ { MAD_F(0x04739971) /* 0.278222505 */, 19 }, + /* 7465 */ { MAD_F(0x0473cd8e) /* 0.278272207 */, 19 }, + /* 7466 */ { MAD_F(0x047401ad) /* 0.278321910 */, 19 }, + /* 7467 */ { MAD_F(0x047435cb) /* 0.278371616 */, 19 }, + /* 7468 */ { MAD_F(0x047469eb) /* 0.278421324 */, 19 }, + /* 7469 */ { MAD_F(0x04749e0b) /* 0.278471035 */, 19 }, + /* 7470 */ { MAD_F(0x0474d22c) /* 0.278520747 */, 19 }, + /* 7471 */ { MAD_F(0x0475064d) /* 0.278570462 */, 19 }, + + /* 7472 */ { MAD_F(0x04753a6f) /* 0.278620179 */, 19 }, + /* 7473 */ { MAD_F(0x04756e91) /* 0.278669898 */, 19 }, + /* 7474 */ { MAD_F(0x0475a2b4) /* 0.278719619 */, 19 }, + /* 7475 */ { MAD_F(0x0475d6d7) /* 0.278769343 */, 19 }, + /* 7476 */ { MAD_F(0x04760afc) /* 0.278819069 */, 19 }, + /* 7477 */ { MAD_F(0x04763f20) /* 0.278868797 */, 19 }, + /* 7478 */ { MAD_F(0x04767346) /* 0.278918527 */, 19 }, + /* 7479 */ { MAD_F(0x0476a76c) /* 0.278968260 */, 19 }, + /* 7480 */ { MAD_F(0x0476db92) /* 0.279017995 */, 19 }, + /* 7481 */ { MAD_F(0x04770fba) /* 0.279067731 */, 19 }, + /* 7482 */ { MAD_F(0x047743e1) /* 0.279117471 */, 19 }, + /* 7483 */ { MAD_F(0x0477780a) /* 0.279167212 */, 19 }, + /* 7484 */ { MAD_F(0x0477ac33) /* 0.279216956 */, 19 }, + /* 7485 */ { MAD_F(0x0477e05c) /* 0.279266701 */, 19 }, + /* 7486 */ { MAD_F(0x04781486) /* 0.279316449 */, 19 }, + /* 7487 */ { MAD_F(0x047848b1) /* 0.279366200 */, 19 }, + + /* 7488 */ { MAD_F(0x04787cdc) /* 0.279415952 */, 19 }, + /* 7489 */ { MAD_F(0x0478b108) /* 0.279465707 */, 19 }, + /* 7490 */ { MAD_F(0x0478e535) /* 0.279515464 */, 19 }, + /* 7491 */ { MAD_F(0x04791962) /* 0.279565223 */, 19 }, + /* 7492 */ { MAD_F(0x04794d8f) /* 0.279614984 */, 19 }, + /* 7493 */ { MAD_F(0x047981be) /* 0.279664748 */, 19 }, + /* 7494 */ { MAD_F(0x0479b5ed) /* 0.279714513 */, 19 }, + /* 7495 */ { MAD_F(0x0479ea1c) /* 0.279764281 */, 19 }, + /* 7496 */ { MAD_F(0x047a1e4c) /* 0.279814051 */, 19 }, + /* 7497 */ { MAD_F(0x047a527d) /* 0.279863824 */, 19 }, + /* 7498 */ { MAD_F(0x047a86ae) /* 0.279913598 */, 19 }, + /* 7499 */ { MAD_F(0x047abae0) /* 0.279963375 */, 19 }, + /* 7500 */ { MAD_F(0x047aef12) /* 0.280013154 */, 19 }, + /* 7501 */ { MAD_F(0x047b2346) /* 0.280062935 */, 19 }, + /* 7502 */ { MAD_F(0x047b5779) /* 0.280112719 */, 19 }, + /* 7503 */ { MAD_F(0x047b8bad) /* 0.280162504 */, 19 }, + + /* 7504 */ { MAD_F(0x047bbfe2) /* 0.280212292 */, 19 }, + /* 7505 */ { MAD_F(0x047bf418) /* 0.280262082 */, 19 }, + /* 7506 */ { MAD_F(0x047c284e) /* 0.280311875 */, 19 }, + /* 7507 */ { MAD_F(0x047c5c84) /* 0.280361669 */, 19 }, + /* 7508 */ { MAD_F(0x047c90bb) /* 0.280411466 */, 19 }, + /* 7509 */ { MAD_F(0x047cc4f3) /* 0.280461265 */, 19 }, + /* 7510 */ { MAD_F(0x047cf92c) /* 0.280511066 */, 19 }, + /* 7511 */ { MAD_F(0x047d2d65) /* 0.280560869 */, 19 }, + /* 7512 */ { MAD_F(0x047d619e) /* 0.280610675 */, 19 }, + /* 7513 */ { MAD_F(0x047d95d8) /* 0.280660483 */, 19 }, + /* 7514 */ { MAD_F(0x047dca13) /* 0.280710292 */, 19 }, + /* 7515 */ { MAD_F(0x047dfe4e) /* 0.280760105 */, 19 }, + /* 7516 */ { MAD_F(0x047e328a) /* 0.280809919 */, 19 }, + /* 7517 */ { MAD_F(0x047e66c7) /* 0.280859736 */, 19 }, + /* 7518 */ { MAD_F(0x047e9b04) /* 0.280909554 */, 19 }, + /* 7519 */ { MAD_F(0x047ecf42) /* 0.280959375 */, 19 }, + + /* 7520 */ { MAD_F(0x047f0380) /* 0.281009199 */, 19 }, + /* 7521 */ { MAD_F(0x047f37bf) /* 0.281059024 */, 19 }, + /* 7522 */ { MAD_F(0x047f6bff) /* 0.281108852 */, 19 }, + /* 7523 */ { MAD_F(0x047fa03f) /* 0.281158682 */, 19 }, + /* 7524 */ { MAD_F(0x047fd47f) /* 0.281208514 */, 19 }, + /* 7525 */ { MAD_F(0x048008c1) /* 0.281258348 */, 19 }, + /* 7526 */ { MAD_F(0x04803d02) /* 0.281308184 */, 19 }, + /* 7527 */ { MAD_F(0x04807145) /* 0.281358023 */, 19 }, + /* 7528 */ { MAD_F(0x0480a588) /* 0.281407864 */, 19 }, + /* 7529 */ { MAD_F(0x0480d9cc) /* 0.281457707 */, 19 }, + /* 7530 */ { MAD_F(0x04810e10) /* 0.281507552 */, 19 }, + /* 7531 */ { MAD_F(0x04814255) /* 0.281557400 */, 19 }, + /* 7532 */ { MAD_F(0x0481769a) /* 0.281607250 */, 19 }, + /* 7533 */ { MAD_F(0x0481aae0) /* 0.281657101 */, 19 }, + /* 7534 */ { MAD_F(0x0481df27) /* 0.281706956 */, 19 }, + /* 7535 */ { MAD_F(0x0482136e) /* 0.281756812 */, 19 }, + + /* 7536 */ { MAD_F(0x048247b6) /* 0.281806670 */, 19 }, + /* 7537 */ { MAD_F(0x04827bfe) /* 0.281856531 */, 19 }, + /* 7538 */ { MAD_F(0x0482b047) /* 0.281906394 */, 19 }, + /* 7539 */ { MAD_F(0x0482e491) /* 0.281956259 */, 19 }, + /* 7540 */ { MAD_F(0x048318db) /* 0.282006127 */, 19 }, + /* 7541 */ { MAD_F(0x04834d26) /* 0.282055996 */, 19 }, + /* 7542 */ { MAD_F(0x04838171) /* 0.282105868 */, 19 }, + /* 7543 */ { MAD_F(0x0483b5bd) /* 0.282155742 */, 19 }, + /* 7544 */ { MAD_F(0x0483ea0a) /* 0.282205618 */, 19 }, + /* 7545 */ { MAD_F(0x04841e57) /* 0.282255496 */, 19 }, + /* 7546 */ { MAD_F(0x048452a4) /* 0.282305377 */, 19 }, + /* 7547 */ { MAD_F(0x048486f3) /* 0.282355260 */, 19 }, + /* 7548 */ { MAD_F(0x0484bb42) /* 0.282405145 */, 19 }, + /* 7549 */ { MAD_F(0x0484ef91) /* 0.282455032 */, 19 }, + /* 7550 */ { MAD_F(0x048523e1) /* 0.282504921 */, 19 }, + /* 7551 */ { MAD_F(0x04855832) /* 0.282554813 */, 19 }, + + /* 7552 */ { MAD_F(0x04858c83) /* 0.282604707 */, 19 }, + /* 7553 */ { MAD_F(0x0485c0d5) /* 0.282654603 */, 19 }, + /* 7554 */ { MAD_F(0x0485f527) /* 0.282704501 */, 19 }, + /* 7555 */ { MAD_F(0x0486297a) /* 0.282754401 */, 19 }, + /* 7556 */ { MAD_F(0x04865dce) /* 0.282804304 */, 19 }, + /* 7557 */ { MAD_F(0x04869222) /* 0.282854209 */, 19 }, + /* 7558 */ { MAD_F(0x0486c677) /* 0.282904116 */, 19 }, + /* 7559 */ { MAD_F(0x0486facc) /* 0.282954025 */, 19 }, + /* 7560 */ { MAD_F(0x04872f22) /* 0.283003936 */, 19 }, + /* 7561 */ { MAD_F(0x04876379) /* 0.283053850 */, 19 }, + /* 7562 */ { MAD_F(0x048797d0) /* 0.283103766 */, 19 }, + /* 7563 */ { MAD_F(0x0487cc28) /* 0.283153684 */, 19 }, + /* 7564 */ { MAD_F(0x04880080) /* 0.283203604 */, 19 }, + /* 7565 */ { MAD_F(0x048834d9) /* 0.283253527 */, 19 }, + /* 7566 */ { MAD_F(0x04886933) /* 0.283303451 */, 19 }, + /* 7567 */ { MAD_F(0x04889d8d) /* 0.283353378 */, 19 }, + + /* 7568 */ { MAD_F(0x0488d1e8) /* 0.283403307 */, 19 }, + /* 7569 */ { MAD_F(0x04890643) /* 0.283453238 */, 19 }, + /* 7570 */ { MAD_F(0x04893a9f) /* 0.283503172 */, 19 }, + /* 7571 */ { MAD_F(0x04896efb) /* 0.283553107 */, 19 }, + /* 7572 */ { MAD_F(0x0489a358) /* 0.283603045 */, 19 }, + /* 7573 */ { MAD_F(0x0489d7b6) /* 0.283652985 */, 19 }, + /* 7574 */ { MAD_F(0x048a0c14) /* 0.283702927 */, 19 }, + /* 7575 */ { MAD_F(0x048a4073) /* 0.283752872 */, 19 }, + /* 7576 */ { MAD_F(0x048a74d3) /* 0.283802818 */, 19 }, + /* 7577 */ { MAD_F(0x048aa933) /* 0.283852767 */, 19 }, + /* 7578 */ { MAD_F(0x048add93) /* 0.283902718 */, 19 }, + /* 7579 */ { MAD_F(0x048b11f5) /* 0.283952671 */, 19 }, + /* 7580 */ { MAD_F(0x048b4656) /* 0.284002627 */, 19 }, + /* 7581 */ { MAD_F(0x048b7ab9) /* 0.284052584 */, 19 }, + /* 7582 */ { MAD_F(0x048baf1c) /* 0.284102544 */, 19 }, + /* 7583 */ { MAD_F(0x048be37f) /* 0.284152506 */, 19 }, + + /* 7584 */ { MAD_F(0x048c17e3) /* 0.284202470 */, 19 }, + /* 7585 */ { MAD_F(0x048c4c48) /* 0.284252436 */, 19 }, + /* 7586 */ { MAD_F(0x048c80ad) /* 0.284302405 */, 19 }, + /* 7587 */ { MAD_F(0x048cb513) /* 0.284352376 */, 19 }, + /* 7588 */ { MAD_F(0x048ce97a) /* 0.284402349 */, 19 }, + /* 7589 */ { MAD_F(0x048d1de1) /* 0.284452324 */, 19 }, + /* 7590 */ { MAD_F(0x048d5249) /* 0.284502301 */, 19 }, + /* 7591 */ { MAD_F(0x048d86b1) /* 0.284552281 */, 19 }, + /* 7592 */ { MAD_F(0x048dbb1a) /* 0.284602263 */, 19 }, + /* 7593 */ { MAD_F(0x048def83) /* 0.284652246 */, 19 }, + /* 7594 */ { MAD_F(0x048e23ed) /* 0.284702233 */, 19 }, + /* 7595 */ { MAD_F(0x048e5858) /* 0.284752221 */, 19 }, + /* 7596 */ { MAD_F(0x048e8cc3) /* 0.284802211 */, 19 }, + /* 7597 */ { MAD_F(0x048ec12f) /* 0.284852204 */, 19 }, + /* 7598 */ { MAD_F(0x048ef59b) /* 0.284902199 */, 19 }, + /* 7599 */ { MAD_F(0x048f2a08) /* 0.284952196 */, 19 }, + + /* 7600 */ { MAD_F(0x048f5e76) /* 0.285002195 */, 19 }, + /* 7601 */ { MAD_F(0x048f92e4) /* 0.285052197 */, 19 }, + /* 7602 */ { MAD_F(0x048fc753) /* 0.285102201 */, 19 }, + /* 7603 */ { MAD_F(0x048ffbc2) /* 0.285152206 */, 19 }, + /* 7604 */ { MAD_F(0x04903032) /* 0.285202214 */, 19 }, + /* 7605 */ { MAD_F(0x049064a3) /* 0.285252225 */, 19 }, + /* 7606 */ { MAD_F(0x04909914) /* 0.285302237 */, 19 }, + /* 7607 */ { MAD_F(0x0490cd86) /* 0.285352252 */, 19 }, + /* 7608 */ { MAD_F(0x049101f8) /* 0.285402269 */, 19 }, + /* 7609 */ { MAD_F(0x0491366b) /* 0.285452288 */, 19 }, + /* 7610 */ { MAD_F(0x04916ade) /* 0.285502309 */, 19 }, + /* 7611 */ { MAD_F(0x04919f52) /* 0.285552332 */, 19 }, + /* 7612 */ { MAD_F(0x0491d3c7) /* 0.285602358 */, 19 }, + /* 7613 */ { MAD_F(0x0492083c) /* 0.285652386 */, 19 }, + /* 7614 */ { MAD_F(0x04923cb2) /* 0.285702416 */, 19 }, + /* 7615 */ { MAD_F(0x04927128) /* 0.285752448 */, 19 }, + + /* 7616 */ { MAD_F(0x0492a59f) /* 0.285802482 */, 19 }, + /* 7617 */ { MAD_F(0x0492da17) /* 0.285852519 */, 19 }, + /* 7618 */ { MAD_F(0x04930e8f) /* 0.285902557 */, 19 }, + /* 7619 */ { MAD_F(0x04934308) /* 0.285952598 */, 19 }, + /* 7620 */ { MAD_F(0x04937781) /* 0.286002641 */, 19 }, + /* 7621 */ { MAD_F(0x0493abfb) /* 0.286052687 */, 19 }, + /* 7622 */ { MAD_F(0x0493e076) /* 0.286102734 */, 19 }, + /* 7623 */ { MAD_F(0x049414f1) /* 0.286152784 */, 19 }, + /* 7624 */ { MAD_F(0x0494496c) /* 0.286202836 */, 19 }, + /* 7625 */ { MAD_F(0x04947de9) /* 0.286252890 */, 19 }, + /* 7626 */ { MAD_F(0x0494b266) /* 0.286302946 */, 19 }, + /* 7627 */ { MAD_F(0x0494e6e3) /* 0.286353005 */, 19 }, + /* 7628 */ { MAD_F(0x04951b61) /* 0.286403065 */, 19 }, + /* 7629 */ { MAD_F(0x04954fe0) /* 0.286453128 */, 19 }, + /* 7630 */ { MAD_F(0x0495845f) /* 0.286503193 */, 19 }, + /* 7631 */ { MAD_F(0x0495b8df) /* 0.286553260 */, 19 }, + + /* 7632 */ { MAD_F(0x0495ed5f) /* 0.286603329 */, 19 }, + /* 7633 */ { MAD_F(0x049621e0) /* 0.286653401 */, 19 }, + /* 7634 */ { MAD_F(0x04965662) /* 0.286703475 */, 19 }, + /* 7635 */ { MAD_F(0x04968ae4) /* 0.286753551 */, 19 }, + /* 7636 */ { MAD_F(0x0496bf67) /* 0.286803629 */, 19 }, + /* 7637 */ { MAD_F(0x0496f3ea) /* 0.286853709 */, 19 }, + /* 7638 */ { MAD_F(0x0497286e) /* 0.286903792 */, 19 }, + /* 7639 */ { MAD_F(0x04975cf2) /* 0.286953876 */, 19 }, + /* 7640 */ { MAD_F(0x04979177) /* 0.287003963 */, 19 }, + /* 7641 */ { MAD_F(0x0497c5fd) /* 0.287054052 */, 19 }, + /* 7642 */ { MAD_F(0x0497fa83) /* 0.287104143 */, 19 }, + /* 7643 */ { MAD_F(0x04982f0a) /* 0.287154237 */, 19 }, + /* 7644 */ { MAD_F(0x04986392) /* 0.287204332 */, 19 }, + /* 7645 */ { MAD_F(0x0498981a) /* 0.287254430 */, 19 }, + /* 7646 */ { MAD_F(0x0498cca2) /* 0.287304530 */, 19 }, + /* 7647 */ { MAD_F(0x0499012c) /* 0.287354632 */, 19 }, + + /* 7648 */ { MAD_F(0x049935b5) /* 0.287404737 */, 19 }, + /* 7649 */ { MAD_F(0x04996a40) /* 0.287454843 */, 19 }, + /* 7650 */ { MAD_F(0x04999ecb) /* 0.287504952 */, 19 }, + /* 7651 */ { MAD_F(0x0499d356) /* 0.287555063 */, 19 }, + /* 7652 */ { MAD_F(0x049a07e2) /* 0.287605176 */, 19 }, + /* 7653 */ { MAD_F(0x049a3c6f) /* 0.287655291 */, 19 }, + /* 7654 */ { MAD_F(0x049a70fc) /* 0.287705409 */, 19 }, + /* 7655 */ { MAD_F(0x049aa58a) /* 0.287755528 */, 19 }, + /* 7656 */ { MAD_F(0x049ada19) /* 0.287805650 */, 19 }, + /* 7657 */ { MAD_F(0x049b0ea8) /* 0.287855774 */, 19 }, + /* 7658 */ { MAD_F(0x049b4337) /* 0.287905900 */, 19 }, + /* 7659 */ { MAD_F(0x049b77c8) /* 0.287956028 */, 19 }, + /* 7660 */ { MAD_F(0x049bac58) /* 0.288006159 */, 19 }, + /* 7661 */ { MAD_F(0x049be0ea) /* 0.288056292 */, 19 }, + /* 7662 */ { MAD_F(0x049c157c) /* 0.288106427 */, 19 }, + /* 7663 */ { MAD_F(0x049c4a0e) /* 0.288156564 */, 19 }, + + /* 7664 */ { MAD_F(0x049c7ea1) /* 0.288206703 */, 19 }, + /* 7665 */ { MAD_F(0x049cb335) /* 0.288256844 */, 19 }, + /* 7666 */ { MAD_F(0x049ce7ca) /* 0.288306988 */, 19 }, + /* 7667 */ { MAD_F(0x049d1c5e) /* 0.288357134 */, 19 }, + /* 7668 */ { MAD_F(0x049d50f4) /* 0.288407282 */, 19 }, + /* 7669 */ { MAD_F(0x049d858a) /* 0.288457432 */, 19 }, + /* 7670 */ { MAD_F(0x049dba21) /* 0.288507584 */, 19 }, + /* 7671 */ { MAD_F(0x049deeb8) /* 0.288557739 */, 19 }, + /* 7672 */ { MAD_F(0x049e2350) /* 0.288607895 */, 19 }, + /* 7673 */ { MAD_F(0x049e57e8) /* 0.288658054 */, 19 }, + /* 7674 */ { MAD_F(0x049e8c81) /* 0.288708215 */, 19 }, + /* 7675 */ { MAD_F(0x049ec11b) /* 0.288758379 */, 19 }, + /* 7676 */ { MAD_F(0x049ef5b5) /* 0.288808544 */, 19 }, + /* 7677 */ { MAD_F(0x049f2a50) /* 0.288858712 */, 19 }, + /* 7678 */ { MAD_F(0x049f5eeb) /* 0.288908881 */, 19 }, + /* 7679 */ { MAD_F(0x049f9387) /* 0.288959053 */, 19 }, + + /* 7680 */ { MAD_F(0x049fc824) /* 0.289009227 */, 19 }, + /* 7681 */ { MAD_F(0x049ffcc1) /* 0.289059404 */, 19 }, + /* 7682 */ { MAD_F(0x04a0315e) /* 0.289109582 */, 19 }, + /* 7683 */ { MAD_F(0x04a065fd) /* 0.289159763 */, 19 }, + /* 7684 */ { MAD_F(0x04a09a9b) /* 0.289209946 */, 19 }, + /* 7685 */ { MAD_F(0x04a0cf3b) /* 0.289260131 */, 19 }, + /* 7686 */ { MAD_F(0x04a103db) /* 0.289310318 */, 19 }, + /* 7687 */ { MAD_F(0x04a1387b) /* 0.289360507 */, 19 }, + /* 7688 */ { MAD_F(0x04a16d1d) /* 0.289410699 */, 19 }, + /* 7689 */ { MAD_F(0x04a1a1be) /* 0.289460893 */, 19 }, + /* 7690 */ { MAD_F(0x04a1d661) /* 0.289511088 */, 19 }, + /* 7691 */ { MAD_F(0x04a20b04) /* 0.289561287 */, 19 }, + /* 7692 */ { MAD_F(0x04a23fa7) /* 0.289611487 */, 19 }, + /* 7693 */ { MAD_F(0x04a2744b) /* 0.289661689 */, 19 }, + /* 7694 */ { MAD_F(0x04a2a8f0) /* 0.289711894 */, 19 }, + /* 7695 */ { MAD_F(0x04a2dd95) /* 0.289762101 */, 19 }, + + /* 7696 */ { MAD_F(0x04a3123b) /* 0.289812309 */, 19 }, + /* 7697 */ { MAD_F(0x04a346e2) /* 0.289862521 */, 19 }, + /* 7698 */ { MAD_F(0x04a37b89) /* 0.289912734 */, 19 }, + /* 7699 */ { MAD_F(0x04a3b030) /* 0.289962949 */, 19 }, + /* 7700 */ { MAD_F(0x04a3e4d8) /* 0.290013167 */, 19 }, + /* 7701 */ { MAD_F(0x04a41981) /* 0.290063387 */, 19 }, + /* 7702 */ { MAD_F(0x04a44e2b) /* 0.290113609 */, 19 }, + /* 7703 */ { MAD_F(0x04a482d5) /* 0.290163833 */, 19 }, + /* 7704 */ { MAD_F(0x04a4b77f) /* 0.290214059 */, 19 }, + /* 7705 */ { MAD_F(0x04a4ec2a) /* 0.290264288 */, 19 }, + /* 7706 */ { MAD_F(0x04a520d6) /* 0.290314519 */, 19 }, + /* 7707 */ { MAD_F(0x04a55582) /* 0.290364751 */, 19 }, + /* 7708 */ { MAD_F(0x04a58a2f) /* 0.290414986 */, 19 }, + /* 7709 */ { MAD_F(0x04a5bedd) /* 0.290465224 */, 19 }, + /* 7710 */ { MAD_F(0x04a5f38b) /* 0.290515463 */, 19 }, + /* 7711 */ { MAD_F(0x04a62839) /* 0.290565705 */, 19 }, + + /* 7712 */ { MAD_F(0x04a65ce8) /* 0.290615948 */, 19 }, + /* 7713 */ { MAD_F(0x04a69198) /* 0.290666194 */, 19 }, + /* 7714 */ { MAD_F(0x04a6c648) /* 0.290716442 */, 19 }, + /* 7715 */ { MAD_F(0x04a6faf9) /* 0.290766692 */, 19 }, + /* 7716 */ { MAD_F(0x04a72fab) /* 0.290816945 */, 19 }, + /* 7717 */ { MAD_F(0x04a7645d) /* 0.290867199 */, 19 }, + /* 7718 */ { MAD_F(0x04a79910) /* 0.290917456 */, 19 }, + /* 7719 */ { MAD_F(0x04a7cdc3) /* 0.290967715 */, 19 }, + /* 7720 */ { MAD_F(0x04a80277) /* 0.291017976 */, 19 }, + /* 7721 */ { MAD_F(0x04a8372b) /* 0.291068239 */, 19 }, + /* 7722 */ { MAD_F(0x04a86be0) /* 0.291118505 */, 19 }, + /* 7723 */ { MAD_F(0x04a8a096) /* 0.291168772 */, 19 }, + /* 7724 */ { MAD_F(0x04a8d54c) /* 0.291219042 */, 19 }, + /* 7725 */ { MAD_F(0x04a90a03) /* 0.291269314 */, 19 }, + /* 7726 */ { MAD_F(0x04a93eba) /* 0.291319588 */, 19 }, + /* 7727 */ { MAD_F(0x04a97372) /* 0.291369865 */, 19 }, + + /* 7728 */ { MAD_F(0x04a9a82b) /* 0.291420143 */, 19 }, + /* 7729 */ { MAD_F(0x04a9dce4) /* 0.291470424 */, 19 }, + /* 7730 */ { MAD_F(0x04aa119d) /* 0.291520706 */, 19 }, + /* 7731 */ { MAD_F(0x04aa4658) /* 0.291570991 */, 19 }, + /* 7732 */ { MAD_F(0x04aa7b13) /* 0.291621278 */, 19 }, + /* 7733 */ { MAD_F(0x04aaafce) /* 0.291671568 */, 19 }, + /* 7734 */ { MAD_F(0x04aae48a) /* 0.291721859 */, 19 }, + /* 7735 */ { MAD_F(0x04ab1947) /* 0.291772153 */, 19 }, + /* 7736 */ { MAD_F(0x04ab4e04) /* 0.291822449 */, 19 }, + /* 7737 */ { MAD_F(0x04ab82c2) /* 0.291872747 */, 19 }, + /* 7738 */ { MAD_F(0x04abb780) /* 0.291923047 */, 19 }, + /* 7739 */ { MAD_F(0x04abec3f) /* 0.291973349 */, 19 }, + /* 7740 */ { MAD_F(0x04ac20fe) /* 0.292023653 */, 19 }, + /* 7741 */ { MAD_F(0x04ac55be) /* 0.292073960 */, 19 }, + /* 7742 */ { MAD_F(0x04ac8a7f) /* 0.292124269 */, 19 }, + /* 7743 */ { MAD_F(0x04acbf40) /* 0.292174580 */, 19 }, + + /* 7744 */ { MAD_F(0x04acf402) /* 0.292224893 */, 19 }, + /* 7745 */ { MAD_F(0x04ad28c5) /* 0.292275208 */, 19 }, + /* 7746 */ { MAD_F(0x04ad5d88) /* 0.292325526 */, 19 }, + /* 7747 */ { MAD_F(0x04ad924b) /* 0.292375845 */, 19 }, + /* 7748 */ { MAD_F(0x04adc70f) /* 0.292426167 */, 19 }, + /* 7749 */ { MAD_F(0x04adfbd4) /* 0.292476491 */, 19 }, + /* 7750 */ { MAD_F(0x04ae3099) /* 0.292526817 */, 19 }, + /* 7751 */ { MAD_F(0x04ae655f) /* 0.292577145 */, 19 }, + /* 7752 */ { MAD_F(0x04ae9a26) /* 0.292627476 */, 19 }, + /* 7753 */ { MAD_F(0x04aeceed) /* 0.292677808 */, 19 }, + /* 7754 */ { MAD_F(0x04af03b4) /* 0.292728143 */, 19 }, + /* 7755 */ { MAD_F(0x04af387d) /* 0.292778480 */, 19 }, + /* 7756 */ { MAD_F(0x04af6d45) /* 0.292828819 */, 19 }, + /* 7757 */ { MAD_F(0x04afa20f) /* 0.292879160 */, 19 }, + /* 7758 */ { MAD_F(0x04afd6d9) /* 0.292929504 */, 19 }, + /* 7759 */ { MAD_F(0x04b00ba3) /* 0.292979849 */, 19 }, + + /* 7760 */ { MAD_F(0x04b0406e) /* 0.293030197 */, 19 }, + /* 7761 */ { MAD_F(0x04b0753a) /* 0.293080547 */, 19 }, + /* 7762 */ { MAD_F(0x04b0aa06) /* 0.293130899 */, 19 }, + /* 7763 */ { MAD_F(0x04b0ded3) /* 0.293181253 */, 19 }, + /* 7764 */ { MAD_F(0x04b113a1) /* 0.293231610 */, 19 }, + /* 7765 */ { MAD_F(0x04b1486f) /* 0.293281968 */, 19 }, + /* 7766 */ { MAD_F(0x04b17d3d) /* 0.293332329 */, 19 }, + /* 7767 */ { MAD_F(0x04b1b20c) /* 0.293382692 */, 19 }, + /* 7768 */ { MAD_F(0x04b1e6dc) /* 0.293433057 */, 19 }, + /* 7769 */ { MAD_F(0x04b21bad) /* 0.293483424 */, 19 }, + /* 7770 */ { MAD_F(0x04b2507d) /* 0.293533794 */, 19 }, + /* 7771 */ { MAD_F(0x04b2854f) /* 0.293584165 */, 19 }, + /* 7772 */ { MAD_F(0x04b2ba21) /* 0.293634539 */, 19 }, + /* 7773 */ { MAD_F(0x04b2eef4) /* 0.293684915 */, 19 }, + /* 7774 */ { MAD_F(0x04b323c7) /* 0.293735293 */, 19 }, + /* 7775 */ { MAD_F(0x04b3589b) /* 0.293785673 */, 19 }, + + /* 7776 */ { MAD_F(0x04b38d6f) /* 0.293836055 */, 19 }, + /* 7777 */ { MAD_F(0x04b3c244) /* 0.293886440 */, 19 }, + /* 7778 */ { MAD_F(0x04b3f71a) /* 0.293936826 */, 19 }, + /* 7779 */ { MAD_F(0x04b42bf0) /* 0.293987215 */, 19 }, + /* 7780 */ { MAD_F(0x04b460c7) /* 0.294037606 */, 19 }, + /* 7781 */ { MAD_F(0x04b4959e) /* 0.294087999 */, 19 }, + /* 7782 */ { MAD_F(0x04b4ca76) /* 0.294138395 */, 19 }, + /* 7783 */ { MAD_F(0x04b4ff4e) /* 0.294188792 */, 19 }, + /* 7784 */ { MAD_F(0x04b53427) /* 0.294239192 */, 19 }, + /* 7785 */ { MAD_F(0x04b56901) /* 0.294289593 */, 19 }, + /* 7786 */ { MAD_F(0x04b59ddb) /* 0.294339997 */, 19 }, + /* 7787 */ { MAD_F(0x04b5d2b6) /* 0.294390403 */, 19 }, + /* 7788 */ { MAD_F(0x04b60791) /* 0.294440812 */, 19 }, + /* 7789 */ { MAD_F(0x04b63c6d) /* 0.294491222 */, 19 }, + /* 7790 */ { MAD_F(0x04b6714a) /* 0.294541635 */, 19 }, + /* 7791 */ { MAD_F(0x04b6a627) /* 0.294592049 */, 19 }, + + /* 7792 */ { MAD_F(0x04b6db05) /* 0.294642466 */, 19 }, + /* 7793 */ { MAD_F(0x04b70fe3) /* 0.294692885 */, 19 }, + /* 7794 */ { MAD_F(0x04b744c2) /* 0.294743306 */, 19 }, + /* 7795 */ { MAD_F(0x04b779a1) /* 0.294793730 */, 19 }, + /* 7796 */ { MAD_F(0x04b7ae81) /* 0.294844155 */, 19 }, + /* 7797 */ { MAD_F(0x04b7e362) /* 0.294894583 */, 19 }, + /* 7798 */ { MAD_F(0x04b81843) /* 0.294945013 */, 19 }, + /* 7799 */ { MAD_F(0x04b84d24) /* 0.294995445 */, 19 }, + /* 7800 */ { MAD_F(0x04b88207) /* 0.295045879 */, 19 }, + /* 7801 */ { MAD_F(0x04b8b6ea) /* 0.295096315 */, 19 }, + /* 7802 */ { MAD_F(0x04b8ebcd) /* 0.295146753 */, 19 }, + /* 7803 */ { MAD_F(0x04b920b1) /* 0.295197194 */, 19 }, + /* 7804 */ { MAD_F(0x04b95596) /* 0.295247637 */, 19 }, + /* 7805 */ { MAD_F(0x04b98a7b) /* 0.295298082 */, 19 }, + /* 7806 */ { MAD_F(0x04b9bf61) /* 0.295348529 */, 19 }, + /* 7807 */ { MAD_F(0x04b9f447) /* 0.295398978 */, 19 }, + + /* 7808 */ { MAD_F(0x04ba292e) /* 0.295449429 */, 19 }, + /* 7809 */ { MAD_F(0x04ba5e16) /* 0.295499883 */, 19 }, + /* 7810 */ { MAD_F(0x04ba92fe) /* 0.295550338 */, 19 }, + /* 7811 */ { MAD_F(0x04bac7e6) /* 0.295600796 */, 19 }, + /* 7812 */ { MAD_F(0x04bafcd0) /* 0.295651256 */, 19 }, + /* 7813 */ { MAD_F(0x04bb31b9) /* 0.295701718 */, 19 }, + /* 7814 */ { MAD_F(0x04bb66a4) /* 0.295752183 */, 19 }, + /* 7815 */ { MAD_F(0x04bb9b8f) /* 0.295802649 */, 19 }, + /* 7816 */ { MAD_F(0x04bbd07a) /* 0.295853118 */, 19 }, + /* 7817 */ { MAD_F(0x04bc0566) /* 0.295903588 */, 19 }, + /* 7818 */ { MAD_F(0x04bc3a53) /* 0.295954061 */, 19 }, + /* 7819 */ { MAD_F(0x04bc6f40) /* 0.296004536 */, 19 }, + /* 7820 */ { MAD_F(0x04bca42e) /* 0.296055013 */, 19 }, + /* 7821 */ { MAD_F(0x04bcd91d) /* 0.296105493 */, 19 }, + /* 7822 */ { MAD_F(0x04bd0e0c) /* 0.296155974 */, 19 }, + /* 7823 */ { MAD_F(0x04bd42fb) /* 0.296206458 */, 19 }, + + /* 7824 */ { MAD_F(0x04bd77ec) /* 0.296256944 */, 19 }, + /* 7825 */ { MAD_F(0x04bdacdc) /* 0.296307432 */, 19 }, + /* 7826 */ { MAD_F(0x04bde1ce) /* 0.296357922 */, 19 }, + /* 7827 */ { MAD_F(0x04be16c0) /* 0.296408414 */, 19 }, + /* 7828 */ { MAD_F(0x04be4bb2) /* 0.296458908 */, 19 }, + /* 7829 */ { MAD_F(0x04be80a5) /* 0.296509405 */, 19 }, + /* 7830 */ { MAD_F(0x04beb599) /* 0.296559904 */, 19 }, + /* 7831 */ { MAD_F(0x04beea8d) /* 0.296610404 */, 19 }, + /* 7832 */ { MAD_F(0x04bf1f82) /* 0.296660907 */, 19 }, + /* 7833 */ { MAD_F(0x04bf5477) /* 0.296711413 */, 19 }, + /* 7834 */ { MAD_F(0x04bf896d) /* 0.296761920 */, 19 }, + /* 7835 */ { MAD_F(0x04bfbe64) /* 0.296812429 */, 19 }, + /* 7836 */ { MAD_F(0x04bff35b) /* 0.296862941 */, 19 }, + /* 7837 */ { MAD_F(0x04c02852) /* 0.296913455 */, 19 }, + /* 7838 */ { MAD_F(0x04c05d4b) /* 0.296963971 */, 19 }, + /* 7839 */ { MAD_F(0x04c09243) /* 0.297014489 */, 19 }, + + /* 7840 */ { MAD_F(0x04c0c73d) /* 0.297065009 */, 19 }, + /* 7841 */ { MAD_F(0x04c0fc37) /* 0.297115531 */, 19 }, + /* 7842 */ { MAD_F(0x04c13131) /* 0.297166056 */, 19 }, + /* 7843 */ { MAD_F(0x04c1662d) /* 0.297216582 */, 19 }, + /* 7844 */ { MAD_F(0x04c19b28) /* 0.297267111 */, 19 }, + /* 7845 */ { MAD_F(0x04c1d025) /* 0.297317642 */, 19 }, + /* 7846 */ { MAD_F(0x04c20521) /* 0.297368175 */, 19 }, + /* 7847 */ { MAD_F(0x04c23a1f) /* 0.297418710 */, 19 }, + /* 7848 */ { MAD_F(0x04c26f1d) /* 0.297469248 */, 19 }, + /* 7849 */ { MAD_F(0x04c2a41b) /* 0.297519787 */, 19 }, + /* 7850 */ { MAD_F(0x04c2d91b) /* 0.297570329 */, 19 }, + /* 7851 */ { MAD_F(0x04c30e1a) /* 0.297620873 */, 19 }, + /* 7852 */ { MAD_F(0x04c3431b) /* 0.297671418 */, 19 }, + /* 7853 */ { MAD_F(0x04c3781c) /* 0.297721967 */, 19 }, + /* 7854 */ { MAD_F(0x04c3ad1d) /* 0.297772517 */, 19 }, + /* 7855 */ { MAD_F(0x04c3e21f) /* 0.297823069 */, 19 }, + + /* 7856 */ { MAD_F(0x04c41722) /* 0.297873624 */, 19 }, + /* 7857 */ { MAD_F(0x04c44c25) /* 0.297924180 */, 19 }, + /* 7858 */ { MAD_F(0x04c48129) /* 0.297974739 */, 19 }, + /* 7859 */ { MAD_F(0x04c4b62d) /* 0.298025300 */, 19 }, + /* 7860 */ { MAD_F(0x04c4eb32) /* 0.298075863 */, 19 }, + /* 7861 */ { MAD_F(0x04c52038) /* 0.298126429 */, 19 }, + /* 7862 */ { MAD_F(0x04c5553e) /* 0.298176996 */, 19 }, + /* 7863 */ { MAD_F(0x04c58a44) /* 0.298227565 */, 19 }, + /* 7864 */ { MAD_F(0x04c5bf4c) /* 0.298278137 */, 19 }, + /* 7865 */ { MAD_F(0x04c5f453) /* 0.298328711 */, 19 }, + /* 7866 */ { MAD_F(0x04c6295c) /* 0.298379287 */, 19 }, + /* 7867 */ { MAD_F(0x04c65e65) /* 0.298429865 */, 19 }, + /* 7868 */ { MAD_F(0x04c6936e) /* 0.298480445 */, 19 }, + /* 7869 */ { MAD_F(0x04c6c878) /* 0.298531028 */, 19 }, + /* 7870 */ { MAD_F(0x04c6fd83) /* 0.298581612 */, 19 }, + /* 7871 */ { MAD_F(0x04c7328e) /* 0.298632199 */, 19 }, + + /* 7872 */ { MAD_F(0x04c7679a) /* 0.298682788 */, 19 }, + /* 7873 */ { MAD_F(0x04c79ca7) /* 0.298733379 */, 19 }, + /* 7874 */ { MAD_F(0x04c7d1b4) /* 0.298783972 */, 19 }, + /* 7875 */ { MAD_F(0x04c806c1) /* 0.298834567 */, 19 }, + /* 7876 */ { MAD_F(0x04c83bcf) /* 0.298885165 */, 19 }, + /* 7877 */ { MAD_F(0x04c870de) /* 0.298935764 */, 19 }, + /* 7878 */ { MAD_F(0x04c8a5ed) /* 0.298986366 */, 19 }, + /* 7879 */ { MAD_F(0x04c8dafd) /* 0.299036970 */, 19 }, + /* 7880 */ { MAD_F(0x04c9100d) /* 0.299087576 */, 19 }, + /* 7881 */ { MAD_F(0x04c9451e) /* 0.299138184 */, 19 }, + /* 7882 */ { MAD_F(0x04c97a30) /* 0.299188794 */, 19 }, + /* 7883 */ { MAD_F(0x04c9af42) /* 0.299239406 */, 19 }, + /* 7884 */ { MAD_F(0x04c9e455) /* 0.299290021 */, 19 }, + /* 7885 */ { MAD_F(0x04ca1968) /* 0.299340638 */, 19 }, + /* 7886 */ { MAD_F(0x04ca4e7c) /* 0.299391256 */, 19 }, + /* 7887 */ { MAD_F(0x04ca8391) /* 0.299441877 */, 19 }, + + /* 7888 */ { MAD_F(0x04cab8a6) /* 0.299492500 */, 19 }, + /* 7889 */ { MAD_F(0x04caedbb) /* 0.299543126 */, 19 }, + /* 7890 */ { MAD_F(0x04cb22d1) /* 0.299593753 */, 19 }, + /* 7891 */ { MAD_F(0x04cb57e8) /* 0.299644382 */, 19 }, + /* 7892 */ { MAD_F(0x04cb8d00) /* 0.299695014 */, 19 }, + /* 7893 */ { MAD_F(0x04cbc217) /* 0.299745648 */, 19 }, + /* 7894 */ { MAD_F(0x04cbf730) /* 0.299796284 */, 19 }, + /* 7895 */ { MAD_F(0x04cc2c49) /* 0.299846922 */, 19 }, + /* 7896 */ { MAD_F(0x04cc6163) /* 0.299897562 */, 19 }, + /* 7897 */ { MAD_F(0x04cc967d) /* 0.299948204 */, 19 }, + /* 7898 */ { MAD_F(0x04cccb98) /* 0.299998849 */, 19 }, + /* 7899 */ { MAD_F(0x04cd00b3) /* 0.300049495 */, 19 }, + /* 7900 */ { MAD_F(0x04cd35cf) /* 0.300100144 */, 19 }, + /* 7901 */ { MAD_F(0x04cd6aeb) /* 0.300150795 */, 19 }, + /* 7902 */ { MAD_F(0x04cda008) /* 0.300201448 */, 19 }, + /* 7903 */ { MAD_F(0x04cdd526) /* 0.300252103 */, 19 }, + + /* 7904 */ { MAD_F(0x04ce0a44) /* 0.300302761 */, 19 }, + /* 7905 */ { MAD_F(0x04ce3f63) /* 0.300353420 */, 19 }, + /* 7906 */ { MAD_F(0x04ce7482) /* 0.300404082 */, 19 }, + /* 7907 */ { MAD_F(0x04cea9a2) /* 0.300454745 */, 19 }, + /* 7908 */ { MAD_F(0x04cedec3) /* 0.300505411 */, 19 }, + /* 7909 */ { MAD_F(0x04cf13e4) /* 0.300556079 */, 19 }, + /* 7910 */ { MAD_F(0x04cf4906) /* 0.300606749 */, 19 }, + /* 7911 */ { MAD_F(0x04cf7e28) /* 0.300657421 */, 19 }, + /* 7912 */ { MAD_F(0x04cfb34b) /* 0.300708096 */, 19 }, + /* 7913 */ { MAD_F(0x04cfe86e) /* 0.300758772 */, 19 }, + /* 7914 */ { MAD_F(0x04d01d92) /* 0.300809451 */, 19 }, + /* 7915 */ { MAD_F(0x04d052b6) /* 0.300860132 */, 19 }, + /* 7916 */ { MAD_F(0x04d087db) /* 0.300910815 */, 19 }, + /* 7917 */ { MAD_F(0x04d0bd01) /* 0.300961500 */, 19 }, + /* 7918 */ { MAD_F(0x04d0f227) /* 0.301012187 */, 19 }, + /* 7919 */ { MAD_F(0x04d1274e) /* 0.301062876 */, 19 }, + + /* 7920 */ { MAD_F(0x04d15c76) /* 0.301113568 */, 19 }, + /* 7921 */ { MAD_F(0x04d1919e) /* 0.301164261 */, 19 }, + /* 7922 */ { MAD_F(0x04d1c6c6) /* 0.301214957 */, 19 }, + /* 7923 */ { MAD_F(0x04d1fbef) /* 0.301265655 */, 19 }, + /* 7924 */ { MAD_F(0x04d23119) /* 0.301316355 */, 19 }, + /* 7925 */ { MAD_F(0x04d26643) /* 0.301367057 */, 19 }, + /* 7926 */ { MAD_F(0x04d29b6e) /* 0.301417761 */, 19 }, + /* 7927 */ { MAD_F(0x04d2d099) /* 0.301468468 */, 19 }, + /* 7928 */ { MAD_F(0x04d305c5) /* 0.301519176 */, 19 }, + /* 7929 */ { MAD_F(0x04d33af2) /* 0.301569887 */, 19 }, + /* 7930 */ { MAD_F(0x04d3701f) /* 0.301620599 */, 19 }, + /* 7931 */ { MAD_F(0x04d3a54d) /* 0.301671314 */, 19 }, + /* 7932 */ { MAD_F(0x04d3da7b) /* 0.301722031 */, 19 }, + /* 7933 */ { MAD_F(0x04d40faa) /* 0.301772751 */, 19 }, + /* 7934 */ { MAD_F(0x04d444d9) /* 0.301823472 */, 19 }, + /* 7935 */ { MAD_F(0x04d47a09) /* 0.301874195 */, 19 }, + + /* 7936 */ { MAD_F(0x04d4af3a) /* 0.301924921 */, 19 }, + /* 7937 */ { MAD_F(0x04d4e46b) /* 0.301975649 */, 19 }, + /* 7938 */ { MAD_F(0x04d5199c) /* 0.302026378 */, 19 }, + /* 7939 */ { MAD_F(0x04d54ecf) /* 0.302077110 */, 19 }, + /* 7940 */ { MAD_F(0x04d58401) /* 0.302127845 */, 19 }, + /* 7941 */ { MAD_F(0x04d5b935) /* 0.302178581 */, 19 }, + /* 7942 */ { MAD_F(0x04d5ee69) /* 0.302229319 */, 19 }, + /* 7943 */ { MAD_F(0x04d6239d) /* 0.302280060 */, 19 }, + /* 7944 */ { MAD_F(0x04d658d2) /* 0.302330802 */, 19 }, + /* 7945 */ { MAD_F(0x04d68e08) /* 0.302381547 */, 19 }, + /* 7946 */ { MAD_F(0x04d6c33e) /* 0.302432294 */, 19 }, + /* 7947 */ { MAD_F(0x04d6f875) /* 0.302483043 */, 19 }, + /* 7948 */ { MAD_F(0x04d72dad) /* 0.302533794 */, 19 }, + /* 7949 */ { MAD_F(0x04d762e5) /* 0.302584547 */, 19 }, + /* 7950 */ { MAD_F(0x04d7981d) /* 0.302635303 */, 19 }, + /* 7951 */ { MAD_F(0x04d7cd56) /* 0.302686060 */, 19 }, + + /* 7952 */ { MAD_F(0x04d80290) /* 0.302736820 */, 19 }, + /* 7953 */ { MAD_F(0x04d837ca) /* 0.302787581 */, 19 }, + /* 7954 */ { MAD_F(0x04d86d05) /* 0.302838345 */, 19 }, + /* 7955 */ { MAD_F(0x04d8a240) /* 0.302889111 */, 19 }, + /* 7956 */ { MAD_F(0x04d8d77c) /* 0.302939879 */, 19 }, + /* 7957 */ { MAD_F(0x04d90cb9) /* 0.302990650 */, 19 }, + /* 7958 */ { MAD_F(0x04d941f6) /* 0.303041422 */, 19 }, + /* 7959 */ { MAD_F(0x04d97734) /* 0.303092197 */, 19 }, + /* 7960 */ { MAD_F(0x04d9ac72) /* 0.303142973 */, 19 }, + /* 7961 */ { MAD_F(0x04d9e1b1) /* 0.303193752 */, 19 }, + /* 7962 */ { MAD_F(0x04da16f0) /* 0.303244533 */, 19 }, + /* 7963 */ { MAD_F(0x04da4c30) /* 0.303295316 */, 19 }, + /* 7964 */ { MAD_F(0x04da8171) /* 0.303346101 */, 19 }, + /* 7965 */ { MAD_F(0x04dab6b2) /* 0.303396889 */, 19 }, + /* 7966 */ { MAD_F(0x04daebf4) /* 0.303447678 */, 19 }, + /* 7967 */ { MAD_F(0x04db2136) /* 0.303498469 */, 19 }, + + /* 7968 */ { MAD_F(0x04db5679) /* 0.303549263 */, 19 }, + /* 7969 */ { MAD_F(0x04db8bbc) /* 0.303600059 */, 19 }, + /* 7970 */ { MAD_F(0x04dbc100) /* 0.303650857 */, 19 }, + /* 7971 */ { MAD_F(0x04dbf644) /* 0.303701657 */, 19 }, + /* 7972 */ { MAD_F(0x04dc2b8a) /* 0.303752459 */, 19 }, + /* 7973 */ { MAD_F(0x04dc60cf) /* 0.303803263 */, 19 }, + /* 7974 */ { MAD_F(0x04dc9616) /* 0.303854070 */, 19 }, + /* 7975 */ { MAD_F(0x04dccb5c) /* 0.303904878 */, 19 }, + /* 7976 */ { MAD_F(0x04dd00a4) /* 0.303955689 */, 19 }, + /* 7977 */ { MAD_F(0x04dd35ec) /* 0.304006502 */, 19 }, + /* 7978 */ { MAD_F(0x04dd6b34) /* 0.304057317 */, 19 }, + /* 7979 */ { MAD_F(0x04dda07d) /* 0.304108134 */, 19 }, + /* 7980 */ { MAD_F(0x04ddd5c7) /* 0.304158953 */, 19 }, + /* 7981 */ { MAD_F(0x04de0b11) /* 0.304209774 */, 19 }, + /* 7982 */ { MAD_F(0x04de405c) /* 0.304260597 */, 19 }, + /* 7983 */ { MAD_F(0x04de75a7) /* 0.304311423 */, 19 }, + + /* 7984 */ { MAD_F(0x04deaaf3) /* 0.304362251 */, 19 }, + /* 7985 */ { MAD_F(0x04dee040) /* 0.304413080 */, 19 }, + /* 7986 */ { MAD_F(0x04df158d) /* 0.304463912 */, 19 }, + /* 7987 */ { MAD_F(0x04df4adb) /* 0.304514746 */, 19 }, + /* 7988 */ { MAD_F(0x04df8029) /* 0.304565582 */, 19 }, + /* 7989 */ { MAD_F(0x04dfb578) /* 0.304616421 */, 19 }, + /* 7990 */ { MAD_F(0x04dfeac7) /* 0.304667261 */, 19 }, + /* 7991 */ { MAD_F(0x04e02017) /* 0.304718103 */, 19 }, + /* 7992 */ { MAD_F(0x04e05567) /* 0.304768948 */, 19 }, + /* 7993 */ { MAD_F(0x04e08ab8) /* 0.304819795 */, 19 }, + /* 7994 */ { MAD_F(0x04e0c00a) /* 0.304870644 */, 19 }, + /* 7995 */ { MAD_F(0x04e0f55c) /* 0.304921495 */, 19 }, + /* 7996 */ { MAD_F(0x04e12aaf) /* 0.304972348 */, 19 }, + /* 7997 */ { MAD_F(0x04e16002) /* 0.305023203 */, 19 }, + /* 7998 */ { MAD_F(0x04e19556) /* 0.305074060 */, 19 }, + /* 7999 */ { MAD_F(0x04e1caab) /* 0.305124920 */, 19 }, + + /* 8000 */ { MAD_F(0x04e20000) /* 0.305175781 */, 19 }, + /* 8001 */ { MAD_F(0x04e23555) /* 0.305226645 */, 19 }, + /* 8002 */ { MAD_F(0x04e26aac) /* 0.305277511 */, 19 }, + /* 8003 */ { MAD_F(0x04e2a002) /* 0.305328379 */, 19 }, + /* 8004 */ { MAD_F(0x04e2d55a) /* 0.305379249 */, 19 }, + /* 8005 */ { MAD_F(0x04e30ab2) /* 0.305430121 */, 19 }, + /* 8006 */ { MAD_F(0x04e3400a) /* 0.305480995 */, 19 }, + /* 8007 */ { MAD_F(0x04e37563) /* 0.305531872 */, 19 }, + /* 8008 */ { MAD_F(0x04e3aabd) /* 0.305582750 */, 19 }, + /* 8009 */ { MAD_F(0x04e3e017) /* 0.305633631 */, 19 }, + /* 8010 */ { MAD_F(0x04e41572) /* 0.305684513 */, 19 }, + /* 8011 */ { MAD_F(0x04e44acd) /* 0.305735398 */, 19 }, + /* 8012 */ { MAD_F(0x04e48029) /* 0.305786285 */, 19 }, + /* 8013 */ { MAD_F(0x04e4b585) /* 0.305837174 */, 19 }, + /* 8014 */ { MAD_F(0x04e4eae2) /* 0.305888066 */, 19 }, + /* 8015 */ { MAD_F(0x04e52040) /* 0.305938959 */, 19 }, + + /* 8016 */ { MAD_F(0x04e5559e) /* 0.305989854 */, 19 }, + /* 8017 */ { MAD_F(0x04e58afd) /* 0.306040752 */, 19 }, + /* 8018 */ { MAD_F(0x04e5c05c) /* 0.306091652 */, 19 }, + /* 8019 */ { MAD_F(0x04e5f5bc) /* 0.306142554 */, 19 }, + /* 8020 */ { MAD_F(0x04e62b1c) /* 0.306193457 */, 19 }, + /* 8021 */ { MAD_F(0x04e6607d) /* 0.306244364 */, 19 }, + /* 8022 */ { MAD_F(0x04e695df) /* 0.306295272 */, 19 }, + /* 8023 */ { MAD_F(0x04e6cb41) /* 0.306346182 */, 19 }, + /* 8024 */ { MAD_F(0x04e700a3) /* 0.306397094 */, 19 }, + /* 8025 */ { MAD_F(0x04e73607) /* 0.306448009 */, 19 }, + /* 8026 */ { MAD_F(0x04e76b6b) /* 0.306498925 */, 19 }, + /* 8027 */ { MAD_F(0x04e7a0cf) /* 0.306549844 */, 19 }, + /* 8028 */ { MAD_F(0x04e7d634) /* 0.306600765 */, 19 }, + /* 8029 */ { MAD_F(0x04e80b99) /* 0.306651688 */, 19 }, + /* 8030 */ { MAD_F(0x04e84100) /* 0.306702613 */, 19 }, + /* 8031 */ { MAD_F(0x04e87666) /* 0.306753540 */, 19 }, + + /* 8032 */ { MAD_F(0x04e8abcd) /* 0.306804470 */, 19 }, + /* 8033 */ { MAD_F(0x04e8e135) /* 0.306855401 */, 19 }, + /* 8034 */ { MAD_F(0x04e9169e) /* 0.306906334 */, 19 }, + /* 8035 */ { MAD_F(0x04e94c07) /* 0.306957270 */, 19 }, + /* 8036 */ { MAD_F(0x04e98170) /* 0.307008208 */, 19 }, + /* 8037 */ { MAD_F(0x04e9b6da) /* 0.307059148 */, 19 }, + /* 8038 */ { MAD_F(0x04e9ec45) /* 0.307110090 */, 19 }, + /* 8039 */ { MAD_F(0x04ea21b0) /* 0.307161034 */, 19 }, + /* 8040 */ { MAD_F(0x04ea571c) /* 0.307211980 */, 19 }, + /* 8041 */ { MAD_F(0x04ea8c88) /* 0.307262928 */, 19 }, + /* 8042 */ { MAD_F(0x04eac1f5) /* 0.307313879 */, 19 }, + /* 8043 */ { MAD_F(0x04eaf762) /* 0.307364831 */, 19 }, + /* 8044 */ { MAD_F(0x04eb2cd0) /* 0.307415786 */, 19 }, + /* 8045 */ { MAD_F(0x04eb623f) /* 0.307466743 */, 19 }, + /* 8046 */ { MAD_F(0x04eb97ae) /* 0.307517702 */, 19 }, + /* 8047 */ { MAD_F(0x04ebcd1e) /* 0.307568663 */, 19 }, + + /* 8048 */ { MAD_F(0x04ec028e) /* 0.307619626 */, 19 }, + /* 8049 */ { MAD_F(0x04ec37ff) /* 0.307670591 */, 19 }, + /* 8050 */ { MAD_F(0x04ec6d71) /* 0.307721558 */, 19 }, + /* 8051 */ { MAD_F(0x04eca2e3) /* 0.307772528 */, 19 }, + /* 8052 */ { MAD_F(0x04ecd855) /* 0.307823499 */, 19 }, + /* 8053 */ { MAD_F(0x04ed0dc8) /* 0.307874473 */, 19 }, + /* 8054 */ { MAD_F(0x04ed433c) /* 0.307925449 */, 19 }, + /* 8055 */ { MAD_F(0x04ed78b0) /* 0.307976426 */, 19 }, + /* 8056 */ { MAD_F(0x04edae25) /* 0.308027406 */, 19 }, + /* 8057 */ { MAD_F(0x04ede39a) /* 0.308078389 */, 19 }, + /* 8058 */ { MAD_F(0x04ee1910) /* 0.308129373 */, 19 }, + /* 8059 */ { MAD_F(0x04ee4e87) /* 0.308180359 */, 19 }, + /* 8060 */ { MAD_F(0x04ee83fe) /* 0.308231347 */, 19 }, + /* 8061 */ { MAD_F(0x04eeb976) /* 0.308282338 */, 19 }, + /* 8062 */ { MAD_F(0x04eeeeee) /* 0.308333331 */, 19 }, + /* 8063 */ { MAD_F(0x04ef2467) /* 0.308384325 */, 19 }, + + /* 8064 */ { MAD_F(0x04ef59e0) /* 0.308435322 */, 19 }, + /* 8065 */ { MAD_F(0x04ef8f5a) /* 0.308486321 */, 19 }, + /* 8066 */ { MAD_F(0x04efc4d5) /* 0.308537322 */, 19 }, + /* 8067 */ { MAD_F(0x04effa50) /* 0.308588325 */, 19 }, + /* 8068 */ { MAD_F(0x04f02fcb) /* 0.308639331 */, 19 }, + /* 8069 */ { MAD_F(0x04f06547) /* 0.308690338 */, 19 }, + /* 8070 */ { MAD_F(0x04f09ac4) /* 0.308741348 */, 19 }, + /* 8071 */ { MAD_F(0x04f0d041) /* 0.308792359 */, 19 }, + /* 8072 */ { MAD_F(0x04f105bf) /* 0.308843373 */, 19 }, + /* 8073 */ { MAD_F(0x04f13b3e) /* 0.308894389 */, 19 }, + /* 8074 */ { MAD_F(0x04f170bd) /* 0.308945407 */, 19 }, + /* 8075 */ { MAD_F(0x04f1a63c) /* 0.308996427 */, 19 }, + /* 8076 */ { MAD_F(0x04f1dbbd) /* 0.309047449 */, 19 }, + /* 8077 */ { MAD_F(0x04f2113d) /* 0.309098473 */, 19 }, + /* 8078 */ { MAD_F(0x04f246bf) /* 0.309149499 */, 19 }, + /* 8079 */ { MAD_F(0x04f27c40) /* 0.309200528 */, 19 }, + + /* 8080 */ { MAD_F(0x04f2b1c3) /* 0.309251558 */, 19 }, + /* 8081 */ { MAD_F(0x04f2e746) /* 0.309302591 */, 19 }, + /* 8082 */ { MAD_F(0x04f31cc9) /* 0.309353626 */, 19 }, + /* 8083 */ { MAD_F(0x04f3524d) /* 0.309404663 */, 19 }, + /* 8084 */ { MAD_F(0x04f387d2) /* 0.309455702 */, 19 }, + /* 8085 */ { MAD_F(0x04f3bd57) /* 0.309506743 */, 19 }, + /* 8086 */ { MAD_F(0x04f3f2dd) /* 0.309557786 */, 19 }, + /* 8087 */ { MAD_F(0x04f42864) /* 0.309608831 */, 19 }, + /* 8088 */ { MAD_F(0x04f45dea) /* 0.309659879 */, 19 }, + /* 8089 */ { MAD_F(0x04f49372) /* 0.309710928 */, 19 }, + /* 8090 */ { MAD_F(0x04f4c8fa) /* 0.309761980 */, 19 }, + /* 8091 */ { MAD_F(0x04f4fe83) /* 0.309813033 */, 19 }, + /* 8092 */ { MAD_F(0x04f5340c) /* 0.309864089 */, 19 }, + /* 8093 */ { MAD_F(0x04f56996) /* 0.309915147 */, 19 }, + /* 8094 */ { MAD_F(0x04f59f20) /* 0.309966207 */, 19 }, + /* 8095 */ { MAD_F(0x04f5d4ab) /* 0.310017269 */, 19 }, + + /* 8096 */ { MAD_F(0x04f60a36) /* 0.310068333 */, 19 }, + /* 8097 */ { MAD_F(0x04f63fc2) /* 0.310119400 */, 19 }, + /* 8098 */ { MAD_F(0x04f6754f) /* 0.310170468 */, 19 }, + /* 8099 */ { MAD_F(0x04f6aadc) /* 0.310221539 */, 19 }, + /* 8100 */ { MAD_F(0x04f6e06a) /* 0.310272611 */, 19 }, + /* 8101 */ { MAD_F(0x04f715f8) /* 0.310323686 */, 19 }, + /* 8102 */ { MAD_F(0x04f74b87) /* 0.310374763 */, 19 }, + /* 8103 */ { MAD_F(0x04f78116) /* 0.310425842 */, 19 }, + /* 8104 */ { MAD_F(0x04f7b6a6) /* 0.310476923 */, 19 }, + /* 8105 */ { MAD_F(0x04f7ec37) /* 0.310528006 */, 19 }, + /* 8106 */ { MAD_F(0x04f821c8) /* 0.310579091 */, 19 }, + /* 8107 */ { MAD_F(0x04f85759) /* 0.310630179 */, 19 }, + /* 8108 */ { MAD_F(0x04f88cec) /* 0.310681268 */, 19 }, + /* 8109 */ { MAD_F(0x04f8c27e) /* 0.310732360 */, 19 }, + /* 8110 */ { MAD_F(0x04f8f812) /* 0.310783453 */, 19 }, + /* 8111 */ { MAD_F(0x04f92da6) /* 0.310834549 */, 19 }, + + /* 8112 */ { MAD_F(0x04f9633a) /* 0.310885647 */, 19 }, + /* 8113 */ { MAD_F(0x04f998cf) /* 0.310936747 */, 19 }, + /* 8114 */ { MAD_F(0x04f9ce65) /* 0.310987849 */, 19 }, + /* 8115 */ { MAD_F(0x04fa03fb) /* 0.311038953 */, 19 }, + /* 8116 */ { MAD_F(0x04fa3992) /* 0.311090059 */, 19 }, + /* 8117 */ { MAD_F(0x04fa6f29) /* 0.311141168 */, 19 }, + /* 8118 */ { MAD_F(0x04faa4c1) /* 0.311192278 */, 19 }, + /* 8119 */ { MAD_F(0x04fada59) /* 0.311243390 */, 19 }, + /* 8120 */ { MAD_F(0x04fb0ff2) /* 0.311294505 */, 19 }, + /* 8121 */ { MAD_F(0x04fb458c) /* 0.311345622 */, 19 }, + /* 8122 */ { MAD_F(0x04fb7b26) /* 0.311396741 */, 19 }, + /* 8123 */ { MAD_F(0x04fbb0c1) /* 0.311447862 */, 19 }, + /* 8124 */ { MAD_F(0x04fbe65c) /* 0.311498985 */, 19 }, + /* 8125 */ { MAD_F(0x04fc1bf8) /* 0.311550110 */, 19 }, + /* 8126 */ { MAD_F(0x04fc5194) /* 0.311601237 */, 19 }, + /* 8127 */ { MAD_F(0x04fc8731) /* 0.311652366 */, 19 }, + + /* 8128 */ { MAD_F(0x04fcbcce) /* 0.311703498 */, 19 }, + /* 8129 */ { MAD_F(0x04fcf26c) /* 0.311754631 */, 19 }, + /* 8130 */ { MAD_F(0x04fd280b) /* 0.311805767 */, 19 }, + /* 8131 */ { MAD_F(0x04fd5daa) /* 0.311856905 */, 19 }, + /* 8132 */ { MAD_F(0x04fd934a) /* 0.311908044 */, 19 }, + /* 8133 */ { MAD_F(0x04fdc8ea) /* 0.311959186 */, 19 }, + /* 8134 */ { MAD_F(0x04fdfe8b) /* 0.312010330 */, 19 }, + /* 8135 */ { MAD_F(0x04fe342c) /* 0.312061476 */, 19 }, + /* 8136 */ { MAD_F(0x04fe69ce) /* 0.312112625 */, 19 }, + /* 8137 */ { MAD_F(0x04fe9f71) /* 0.312163775 */, 19 }, + /* 8138 */ { MAD_F(0x04fed514) /* 0.312214927 */, 19 }, + /* 8139 */ { MAD_F(0x04ff0ab8) /* 0.312266082 */, 19 }, + /* 8140 */ { MAD_F(0x04ff405c) /* 0.312317238 */, 19 }, + /* 8141 */ { MAD_F(0x04ff7601) /* 0.312368397 */, 19 }, + /* 8142 */ { MAD_F(0x04ffaba6) /* 0.312419558 */, 19 }, + /* 8143 */ { MAD_F(0x04ffe14c) /* 0.312470720 */, 19 }, + + /* 8144 */ { MAD_F(0x050016f3) /* 0.312521885 */, 19 }, + /* 8145 */ { MAD_F(0x05004c9a) /* 0.312573052 */, 19 }, + /* 8146 */ { MAD_F(0x05008241) /* 0.312624222 */, 19 }, + /* 8147 */ { MAD_F(0x0500b7e9) /* 0.312675393 */, 19 }, + /* 8148 */ { MAD_F(0x0500ed92) /* 0.312726566 */, 19 }, + /* 8149 */ { MAD_F(0x0501233b) /* 0.312777742 */, 19 }, + /* 8150 */ { MAD_F(0x050158e5) /* 0.312828919 */, 19 }, + /* 8151 */ { MAD_F(0x05018e90) /* 0.312880099 */, 19 }, + /* 8152 */ { MAD_F(0x0501c43b) /* 0.312931280 */, 19 }, + /* 8153 */ { MAD_F(0x0501f9e6) /* 0.312982464 */, 19 }, + /* 8154 */ { MAD_F(0x05022f92) /* 0.313033650 */, 19 }, + /* 8155 */ { MAD_F(0x0502653f) /* 0.313084838 */, 19 }, + /* 8156 */ { MAD_F(0x05029aec) /* 0.313136028 */, 19 }, + /* 8157 */ { MAD_F(0x0502d09a) /* 0.313187220 */, 19 }, + /* 8158 */ { MAD_F(0x05030648) /* 0.313238414 */, 19 }, + /* 8159 */ { MAD_F(0x05033bf7) /* 0.313289611 */, 19 }, + + /* 8160 */ { MAD_F(0x050371a7) /* 0.313340809 */, 19 }, + /* 8161 */ { MAD_F(0x0503a757) /* 0.313392010 */, 19 }, + /* 8162 */ { MAD_F(0x0503dd07) /* 0.313443212 */, 19 }, + /* 8163 */ { MAD_F(0x050412b9) /* 0.313494417 */, 19 }, + /* 8164 */ { MAD_F(0x0504486a) /* 0.313545624 */, 19 }, + /* 8165 */ { MAD_F(0x05047e1d) /* 0.313596833 */, 19 }, + /* 8166 */ { MAD_F(0x0504b3cf) /* 0.313648044 */, 19 }, + /* 8167 */ { MAD_F(0x0504e983) /* 0.313699257 */, 19 }, + /* 8168 */ { MAD_F(0x05051f37) /* 0.313750472 */, 19 }, + /* 8169 */ { MAD_F(0x050554eb) /* 0.313801689 */, 19 }, + /* 8170 */ { MAD_F(0x05058aa0) /* 0.313852909 */, 19 }, + /* 8171 */ { MAD_F(0x0505c056) /* 0.313904130 */, 19 }, + /* 8172 */ { MAD_F(0x0505f60c) /* 0.313955354 */, 19 }, + /* 8173 */ { MAD_F(0x05062bc3) /* 0.314006579 */, 19 }, + /* 8174 */ { MAD_F(0x0506617a) /* 0.314057807 */, 19 }, + /* 8175 */ { MAD_F(0x05069732) /* 0.314109037 */, 19 }, + + /* 8176 */ { MAD_F(0x0506cceb) /* 0.314160269 */, 19 }, + /* 8177 */ { MAD_F(0x050702a4) /* 0.314211502 */, 19 }, + /* 8178 */ { MAD_F(0x0507385d) /* 0.314262739 */, 19 }, + /* 8179 */ { MAD_F(0x05076e17) /* 0.314313977 */, 19 }, + /* 8180 */ { MAD_F(0x0507a3d2) /* 0.314365217 */, 19 }, + /* 8181 */ { MAD_F(0x0507d98d) /* 0.314416459 */, 19 }, + /* 8182 */ { MAD_F(0x05080f49) /* 0.314467704 */, 19 }, + /* 8183 */ { MAD_F(0x05084506) /* 0.314518950 */, 19 }, + /* 8184 */ { MAD_F(0x05087ac2) /* 0.314570199 */, 19 }, + /* 8185 */ { MAD_F(0x0508b080) /* 0.314621449 */, 19 }, + /* 8186 */ { MAD_F(0x0508e63e) /* 0.314672702 */, 19 }, + /* 8187 */ { MAD_F(0x05091bfd) /* 0.314723957 */, 19 }, + /* 8188 */ { MAD_F(0x050951bc) /* 0.314775214 */, 19 }, + /* 8189 */ { MAD_F(0x0509877c) /* 0.314826473 */, 19 }, + /* 8190 */ { MAD_F(0x0509bd3c) /* 0.314877734 */, 19 }, + /* 8191 */ { MAD_F(0x0509f2fd) /* 0.314928997 */, 19 }, + + /* 8192 */ { MAD_F(0x050a28be) /* 0.314980262 */, 19 }, + /* 8193 */ { MAD_F(0x050a5e80) /* 0.315031530 */, 19 }, + /* 8194 */ { MAD_F(0x050a9443) /* 0.315082799 */, 19 }, + /* 8195 */ { MAD_F(0x050aca06) /* 0.315134071 */, 19 }, + /* 8196 */ { MAD_F(0x050affc9) /* 0.315185344 */, 19 }, + /* 8197 */ { MAD_F(0x050b358e) /* 0.315236620 */, 19 }, + /* 8198 */ { MAD_F(0x050b6b52) /* 0.315287898 */, 19 }, + /* 8199 */ { MAD_F(0x050ba118) /* 0.315339178 */, 19 }, + /* 8200 */ { MAD_F(0x050bd6de) /* 0.315390460 */, 19 }, + /* 8201 */ { MAD_F(0x050c0ca4) /* 0.315441744 */, 19 }, + /* 8202 */ { MAD_F(0x050c426b) /* 0.315493030 */, 19 }, + /* 8203 */ { MAD_F(0x050c7833) /* 0.315544318 */, 19 }, + /* 8204 */ { MAD_F(0x050cadfb) /* 0.315595608 */, 19 }, + /* 8205 */ { MAD_F(0x050ce3c4) /* 0.315646901 */, 19 }, + /* 8206 */ { MAD_F(0x050d198d) /* 0.315698195 */, 19 } diff --git a/cpymo-backends/nds/decoder/sf_table.dat b/cpymo-backends/nds/decoder/sf_table.dat new file mode 100644 index 00000000..ee94cb77 --- /dev/null +++ b/cpymo-backends/nds/decoder/sf_table.dat @@ -0,0 +1,105 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* + * These are the scalefactor values for Layer I and Layer II. + * The values are from Table B.1 of ISO/IEC 11172-3. + * + * There is some error introduced by the 32-bit fixed-point representation; + * the amount of error is shown. For 16-bit PCM output, this shouldn't be + * too much of a problem. + * + * Strictly speaking, Table B.1 has only 63 entries (0-62), thus a strict + * interpretation of ISO/IEC 11172-3 would suggest that a scalefactor index of + * 63 is invalid. However, for better compatibility with current practices, we + * add a 64th entry. + */ + + MAD_F(0x20000000), /* 2.000000000000 => 2.000000000000, e 0.000000000000 */ + MAD_F(0x1965fea5), /* 1.587401051968 => 1.587401051074, e 0.000000000894 */ + MAD_F(0x1428a2fa), /* 1.259921049895 => 1.259921051562, e -0.000000001667 */ + MAD_F(0x10000000), /* 1.000000000000 => 1.000000000000, e 0.000000000000 */ + MAD_F(0x0cb2ff53), /* 0.793700525984 => 0.793700527400, e -0.000000001416 */ + MAD_F(0x0a14517d), /* 0.629960524947 => 0.629960525781, e -0.000000000833 */ + MAD_F(0x08000000), /* 0.500000000000 => 0.500000000000, e 0.000000000000 */ + MAD_F(0x06597fa9), /* 0.396850262992 => 0.396850261837, e 0.000000001155 */ + + MAD_F(0x050a28be), /* 0.314980262474 => 0.314980261028, e 0.000000001446 */ + MAD_F(0x04000000), /* 0.250000000000 => 0.250000000000, e 0.000000000000 */ + MAD_F(0x032cbfd5), /* 0.198425131496 => 0.198425132781, e -0.000000001285 */ + MAD_F(0x0285145f), /* 0.157490131237 => 0.157490130514, e 0.000000000723 */ + MAD_F(0x02000000), /* 0.125000000000 => 0.125000000000, e 0.000000000000 */ + MAD_F(0x01965fea), /* 0.099212565748 => 0.099212564528, e 0.000000001220 */ + MAD_F(0x01428a30), /* 0.078745065618 => 0.078745067120, e -0.000000001501 */ + MAD_F(0x01000000), /* 0.062500000000 => 0.062500000000, e 0.000000000000 */ + + MAD_F(0x00cb2ff5), /* 0.049606282874 => 0.049606282264, e 0.000000000610 */ + MAD_F(0x00a14518), /* 0.039372532809 => 0.039372533560, e -0.000000000751 */ + MAD_F(0x00800000), /* 0.031250000000 => 0.031250000000, e 0.000000000000 */ + MAD_F(0x006597fb), /* 0.024803141437 => 0.024803142995, e -0.000000001558 */ + MAD_F(0x0050a28c), /* 0.019686266405 => 0.019686266780, e -0.000000000375 */ + MAD_F(0x00400000), /* 0.015625000000 => 0.015625000000, e 0.000000000000 */ + MAD_F(0x0032cbfd), /* 0.012401570719 => 0.012401569635, e 0.000000001084 */ + MAD_F(0x00285146), /* 0.009843133202 => 0.009843133390, e -0.000000000188 */ + + MAD_F(0x00200000), /* 0.007812500000 => 0.007812500000, e 0.000000000000 */ + MAD_F(0x001965ff), /* 0.006200785359 => 0.006200786680, e -0.000000001321 */ + MAD_F(0x001428a3), /* 0.004921566601 => 0.004921566695, e -0.000000000094 */ + MAD_F(0x00100000), /* 0.003906250000 => 0.003906250000, e 0.000000000000 */ + MAD_F(0x000cb2ff), /* 0.003100392680 => 0.003100391477, e 0.000000001202 */ + MAD_F(0x000a1451), /* 0.002460783301 => 0.002460781485, e 0.000000001816 */ + MAD_F(0x00080000), /* 0.001953125000 => 0.001953125000, e 0.000000000000 */ + MAD_F(0x00065980), /* 0.001550196340 => 0.001550197601, e -0.000000001262 */ + + MAD_F(0x00050a29), /* 0.001230391650 => 0.001230392605, e -0.000000000955 */ + MAD_F(0x00040000), /* 0.000976562500 => 0.000976562500, e 0.000000000000 */ + MAD_F(0x00032cc0), /* 0.000775098170 => 0.000775098801, e -0.000000000631 */ + MAD_F(0x00028514), /* 0.000615195825 => 0.000615194440, e 0.000000001385 */ + MAD_F(0x00020000), /* 0.000488281250 => 0.000488281250, e 0.000000000000 */ + MAD_F(0x00019660), /* 0.000387549085 => 0.000387549400, e -0.000000000315 */ + MAD_F(0x0001428a), /* 0.000307597913 => 0.000307597220, e 0.000000000693 */ + MAD_F(0x00010000), /* 0.000244140625 => 0.000244140625, e 0.000000000000 */ + + MAD_F(0x0000cb30), /* 0.000193774542 => 0.000193774700, e -0.000000000158 */ + MAD_F(0x0000a145), /* 0.000153798956 => 0.000153798610, e 0.000000000346 */ + MAD_F(0x00008000), /* 0.000122070313 => 0.000122070313, e 0.000000000000 */ + MAD_F(0x00006598), /* 0.000096887271 => 0.000096887350, e -0.000000000079 */ + MAD_F(0x000050a3), /* 0.000076899478 => 0.000076901168, e -0.000000001689 */ + MAD_F(0x00004000), /* 0.000061035156 => 0.000061035156, e 0.000000000000 */ + MAD_F(0x000032cc), /* 0.000048443636 => 0.000048443675, e -0.000000000039 */ + MAD_F(0x00002851), /* 0.000038449739 => 0.000038448721, e 0.000000001018 */ + + MAD_F(0x00002000), /* 0.000030517578 => 0.000030517578, e 0.000000000000 */ + MAD_F(0x00001966), /* 0.000024221818 => 0.000024221838, e -0.000000000020 */ + MAD_F(0x00001429), /* 0.000019224870 => 0.000019226223, e -0.000000001354 */ + MAD_F(0x00001000), /* 0.000015258789 => 0.000015258789, e -0.000000000000 */ + MAD_F(0x00000cb3), /* 0.000012110909 => 0.000012110919, e -0.000000000010 */ + MAD_F(0x00000a14), /* 0.000009612435 => 0.000009611249, e 0.000000001186 */ + MAD_F(0x00000800), /* 0.000007629395 => 0.000007629395, e -0.000000000000 */ + MAD_F(0x00000659), /* 0.000006055454 => 0.000006053597, e 0.000000001858 */ + + MAD_F(0x0000050a), /* 0.000004806217 => 0.000004805624, e 0.000000000593 */ + MAD_F(0x00000400), /* 0.000003814697 => 0.000003814697, e 0.000000000000 */ + MAD_F(0x0000032d), /* 0.000003027727 => 0.000003028661, e -0.000000000934 */ + MAD_F(0x00000285), /* 0.000002403109 => 0.000002402812, e 0.000000000296 */ + MAD_F(0x00000200), /* 0.000001907349 => 0.000001907349, e -0.000000000000 */ + MAD_F(0x00000196), /* 0.000001513864 => 0.000001512468, e 0.000000001396 */ + MAD_F(0x00000143), /* 0.000001201554 => 0.000001203269, e -0.000000001714 */ + MAD_F(0x00000000) /* this compatibility entry is not part of Table B.1 */ diff --git a/cpymo-backends/nds/decoder/source-manifest.json b/cpymo-backends/nds/decoder/source-manifest.json new file mode 100644 index 00000000..d8f3222b --- /dev/null +++ b/cpymo-backends/nds/decoder/source-manifest.json @@ -0,0 +1,176 @@ +[ + { + "file": "D.dat", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/D.dat", + "git_blob_sha1": "317db3bed162d2b098bde1d2753bed5b55bb1491", + "sha256": "9492e5caacf17f024a0517dc5e85749c04980ad469d2296fbea614d35a12cbff" + }, + { + "file": "bit.c", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/bit.c", + "git_blob_sha1": "5ee3a3a7e5e7474643ee8891119bedabb2174351", + "sha256": "1aa5c4a3524c9365e3b5c7a9e2dd778e35c7318c2438f43545a1d7a7f5d7e2ea" + }, + { + "file": "bit.h", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/bit.h", + "git_blob_sha1": "495adb9be130d09999d0ac8d0ea95c935510b5de", + "sha256": "4812147e1055ea9c5a524f49a9e49092a2ef1cace109c83143d2b99786a363f9" + }, + { + "file": "config.h", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/config.h", + "git_blob_sha1": "5870206bc8ed6b714d4d65baf1bb5248217a41c1", + "sha256": "7b6efcbd4e337614ee700e35b10d30d4b143be8856c9b9e17adc9a3a6f5e976c" + }, + { + "file": "decoder.c", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/decoder.c", + "git_blob_sha1": "4861aa3cc4741bdaf2390e3dc1f5e88fc1753b07", + "sha256": "ac10a739b386af19ac64669c837c2a072c2f5ba4175c6c9c385ae531864a4f49" + }, + { + "file": "decoder.h", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/decoder.h", + "git_blob_sha1": "618935467f35b170e050933ec54c7ae435061c67", + "sha256": "ecfd9321cedd0f681d55d14afda1dc698cccebd35a9800773399436e24b0c9bd" + }, + { + "file": "fixed.c", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/fixed.c", + "git_blob_sha1": "8fe5f217bb80817f53d9ab5196783f5309fca9a7", + "sha256": "059b82bde9d8b9074b36598e6667669f14fd99182c059e52366594e9a5ff56b2" + }, + { + "file": "fixed.h", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/fixed.h", + "git_blob_sha1": "f71d2ec6e149d2ee5be73f4ee4f5b6d6481206e5", + "sha256": "82bf26d8c6c9371e02eb0d0d1573d92eaee19641f928a99cf28650ea69add8a3" + }, + { + "file": "frame.c", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/frame.c", + "git_blob_sha1": "2d3b5fc0626e1ebd26c9d61b3eabc4a505e64490", + "sha256": "a84c292f8cc421de195552536a4d5ecc089045dbae7a36c5fe3ef4b8f619e156" + }, + { + "file": "frame.h", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/frame.h", + "git_blob_sha1": "476270780441bd3fd6574fec3e50c0ff636f201b", + "sha256": "370847b11c7d62abeee4ac93c63d991168dfcc8e9b62ce7edc29b3bc66138f3a" + }, + { + "file": "global.h", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/global.h", + "git_blob_sha1": "6bd2f2e814d9f7894d0b0f6d5db41a7212649f38", + "sha256": "cc9b1f349fb0c4e34c8ff79096ce5cd2fe8ff8e648fa945746e34b0e83725ca9" + }, + { + "file": "huffman.c", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/huffman.c", + "git_blob_sha1": "0fc3022ff7e0232d4b9f1f3b6959ac162dd21bc4", + "sha256": "553c45069d411773f28d639b8ede415a290374c15ee53c8415509ac99da0491a" + }, + { + "file": "huffman.h", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/huffman.h", + "git_blob_sha1": "188dd3973b0372b601b17ee23e93639da8ee2625", + "sha256": "48c45e1a9d6d0993a3f300720cb2615b06e5497ee6fb996159f3acf248b47e76" + }, + { + "file": "imdct_s.dat", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/imdct_s.dat", + "git_blob_sha1": "66d846ceb4021cff8474c9e77227e9ec9d2be2ff", + "sha256": "b6928015afe3942e905e48fe08c6670bb30114edb2c417c987bb7780a14ddadd" + }, + { + "file": "layer12.c", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/layer12.c", + "git_blob_sha1": "07f1fa4e8404a30c0fdc7cc7a2f91bbc15c8c820", + "sha256": "4898fa04a243c1d7a78fe544a2dec2256a89d6c064fbfedf84c271c3bf112aee" + }, + { + "file": "layer12.h", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/layer12.h", + "git_blob_sha1": "e924ca13cf1c54a73d61f85e8ccdd460c85246d2", + "sha256": "4177f53aa27d025d12d91e45ec294b3e67989341e2fa4fb9ecb00c45bd9cb96a" + }, + { + "file": "layer3.c", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/layer3.c", + "git_blob_sha1": "3462cc480ef119b28a66d3e8afb324fc859d6220", + "sha256": "bb0a846f19a9177b9d5108971e23a4813a1e334644990e8156c5a61fc95fa40e" + }, + { + "file": "layer3.h", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/layer3.h", + "git_blob_sha1": "3e11bdec906a8ce0180cd8ee8405c073ea07df8b", + "sha256": "b50b68601073c1d370256a9e9834dad0b853c180523014f0941092d42b6387c1" + }, + { + "file": "qc_table.dat", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/qc_table.dat", + "git_blob_sha1": "05da0f2eaedee2c2157d281747dbbfedbe816f0c", + "sha256": "19ec06cf38fe89cfa8fd142b94c2afd86444faf3972fb010fc97eb3ef55d3817" + }, + { + "file": "rq_table.dat", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/rq_table.dat", + "git_blob_sha1": "d6b9802be9dc98940caa4e1fa510b341a5af274d", + "sha256": "f99504206971febe5550d77ec786b934e7efac0210925930eb489bcbec1c473e" + }, + { + "file": "sf_table.dat", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/sf_table.dat", + "git_blob_sha1": "ee94cb77d78c711e8dc6c12ebaea5275f2c503a7", + "sha256": "130b072cf0c0e96275b0355a4174105bcdf69d70afdd5ae6ef3f7b8301db3385" + }, + { + "file": "stream.c", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/stream.c", + "git_blob_sha1": "da58e2cdc06fed4f1d0e412625f659a3fea89815", + "sha256": "9e5450bebfdf8c76fd07f081c873bbafd7cf4da6a10c4103e6a0a8edf8655aa5" + }, + { + "file": "stream.h", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/stream.h", + "git_blob_sha1": "78af4cb44ecd1527461a43b7a9699f8dc17fc53b", + "sha256": "d85e02818ab03d6727cf3008274dcbc2dc175a4e36848aa3cad783a05d5366d1" + }, + { + "file": "synth.c", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/synth.c", + "git_blob_sha1": "9f7a2a4da4aac760ec5757f339e6612a8979c149", + "sha256": "d91fc345e0b7427089445245c7d63b000d65f05d5c8ee0ad9ee41105483a5edb" + }, + { + "file": "synth.h", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/synth.h", + "git_blob_sha1": "5c67aeef3713e53ec67b6fbdbcfc488c3328aad5", + "sha256": "2a79f462f3859d2b7da18cb19e1e78a0f5ede70e3bfc7cd8239da58a724fc1be" + }, + { + "file": "timer.c", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/timer.c", + "git_blob_sha1": "6590e82926502eab4a42d2901f2596a719b97dcb", + "sha256": "4b4a059d989bbff31b74f4bc600ad67979468ac8745a4312469ca0b984a8c5d1" + }, + { + "file": "timer.h", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/timer.h", + "git_blob_sha1": "e891a4284e5c337f86de155a0591cacb6e3513af", + "sha256": "749d21a5c517688a7477b77f03bab31061e5761dee5786caea87c056870e29a8" + }, + { + "file": "version.c", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/version.c", + "git_blob_sha1": "40f9002e6d8ae1d74526b25b9c01652b685c115c", + "sha256": "4899a5aa70ab5343a71cce1b12da3b887d631fcc4fd58df6f51c4f4b59bc3ca4" + }, + { + "file": "version.h", + "url": "https://raw.githubusercontent.com/devkitPro/libogc/master/libmad/version.h", + "git_blob_sha1": "1c14a90e2711f046c98d1d167f6ecf366cd95269", + "sha256": "283811b8b5fcc59b218fe0bb2ca5abe1f5de2df2dfadc2a9464ff29b6786308e" + } +] \ No newline at end of file diff --git a/cpymo-backends/nds/decoder/stream.c b/cpymo-backends/nds/decoder/stream.c new file mode 100644 index 00000000..da58e2cd --- /dev/null +++ b/cpymo-backends/nds/decoder/stream.c @@ -0,0 +1,159 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif + +# include "global.h" + +# include + +# include "bit.h" +# include "stream.h" + +/* + * NAME: stream->init() + * DESCRIPTION: initialize stream struct + */ +void mad_stream_init(struct mad_stream *stream) +{ + stream->buffer = 0; + stream->bufend = 0; + stream->skiplen = 0; + + stream->sync = 0; + stream->freerate = 0; + + stream->this_frame = 0; + stream->next_frame = 0; + mad_bit_init(&stream->ptr, 0); + + mad_bit_init(&stream->anc_ptr, 0); + stream->anc_bitlen = 0; + + stream->main_data = 0; + stream->md_len = 0; + + stream->options = 0; + stream->error = MAD_ERROR_NONE; +} + +/* + * NAME: stream->finish() + * DESCRIPTION: deallocate any dynamic memory associated with stream + */ +void mad_stream_finish(struct mad_stream *stream) +{ + if (stream->main_data) { + free(stream->main_data); + stream->main_data = 0; + } + + mad_bit_finish(&stream->anc_ptr); + mad_bit_finish(&stream->ptr); +} + +/* + * NAME: stream->buffer() + * DESCRIPTION: set stream buffer pointers + */ +void mad_stream_buffer(struct mad_stream *stream, + u8 const *buffer, u32 length) +{ + stream->buffer = buffer; + stream->bufend = buffer + length; + + stream->this_frame = buffer; + stream->next_frame = buffer; + + stream->sync = 1; + + mad_bit_init(&stream->ptr, buffer); +} + +/* + * NAME: stream->skip() + * DESCRIPTION: arrange to skip bytes before the next frame + */ +void mad_stream_skip(struct mad_stream *stream, u32 length) +{ + stream->skiplen += length; +} + +/* + * NAME: stream->sync() + * DESCRIPTION: locate the next stream sync word + */ +s32 mad_stream_sync(struct mad_stream *stream) +{ + register u8 const *ptr, *end; + + ptr = mad_bit_nextbyte(&stream->ptr); + end = stream->bufend; + + while (ptr < end - 1 && + !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) + ++ptr; + + if (end - ptr < MAD_BUFFER_GUARD) + return -1; + + mad_bit_init(&stream->ptr, ptr); + + return 0; +} + +/* + * NAME: stream->errorstr() + * DESCRIPTION: return a string description of the current error condition + */ +char const *mad_stream_errorstr(struct mad_stream const *stream) +{ + switch (stream->error) { + case MAD_ERROR_NONE: return "no error"; + + case MAD_ERROR_BUFLEN: return "input buffer too small (or EOF)"; + case MAD_ERROR_BUFPTR: return "invalid (null) buffer pointer"; + + case MAD_ERROR_NOMEM: return "not enough memory"; + + case MAD_ERROR_LOSTSYNC: return "lost synchronization"; + case MAD_ERROR_BADLAYER: return "reserved header layer value"; + case MAD_ERROR_BADBITRATE: return "forbidden bitrate value"; + case MAD_ERROR_BADSAMPLERATE: return "reserved sample frequency value"; + case MAD_ERROR_BADEMPHASIS: return "reserved emphasis value"; + + case MAD_ERROR_BADCRC: return "CRC check failed"; + case MAD_ERROR_BADBITALLOC: return "forbidden bit allocation value"; + case MAD_ERROR_BADSCALEFACTOR: return "bad scalefactor index"; + case MAD_ERROR_BADFRAMELEN: return "bad frame length"; + case MAD_ERROR_BADBIGVALUES: return "bad big_values count"; + case MAD_ERROR_BADBLOCKTYPE: return "reserved block_type"; + case MAD_ERROR_BADSCFSI: return "bad scalefactor selection info"; + case MAD_ERROR_BADDATAPTR: return "bad main_data_begin pointer"; + case MAD_ERROR_BADPART3LEN: return "bad audio data length"; + case MAD_ERROR_BADHUFFTABLE: return "bad Huffman table select"; + case MAD_ERROR_BADHUFFDATA: return "Huffman data overrun"; + case MAD_ERROR_BADSTEREO: return "incompatible block_type for JS"; + } + + return 0; +} diff --git a/cpymo-backends/nds/decoder/stream.h b/cpymo-backends/nds/decoder/stream.h new file mode 100644 index 00000000..78af4cb4 --- /dev/null +++ b/cpymo-backends/nds/decoder/stream.h @@ -0,0 +1,107 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifndef LIBMAD_STREAM_H +# define LIBMAD_STREAM_H + +#include +# include "bit.h" + +# define MAD_BUFFER_GUARD 8 +# define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD) + +enum mad_error { + MAD_ERROR_NONE = 0x0000, /* no error */ + + MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */ + MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */ + + MAD_ERROR_NOMEM = 0x0031, /* not enough memory */ + + MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */ + MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */ + MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */ + MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */ + MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */ + + MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */ + MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */ + MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */ + MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */ + MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */ + MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */ + MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */ + MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */ + MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */ + MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */ + MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */ + MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */ +}; + +# define MAD_RECOVERABLE(error) ((error) & 0xff00) + +struct mad_stream { + u8 const *buffer; /* input bitstream buffer */ + u8 const *bufend; /* end of buffer */ + u32 skiplen; /* bytes to skip before next frame */ + + s32 sync; /* stream sync found */ + u32 freerate; /* free bitrate (fixed) */ + + u8 const *this_frame; /* start of current frame */ + u8 const *next_frame; /* start of next frame */ + struct mad_bitptr ptr; /* current processing bit pointer */ + + struct mad_bitptr anc_ptr; /* ancillary bits pointer */ + u32 anc_bitlen; /* number of ancillary bits */ + + u8 (*main_data)[MAD_BUFFER_MDLEN]; + /* Layer III main_data() */ + u32 md_len; /* bytes in main_data */ + + s32 options; /* decoding options (see below) */ + enum mad_error error; /* error code (see above) */ +}; + +enum { + MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */ + MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */ +# if 0 /* not yet implemented */ + MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */ + MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */ + MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */ +# endif +}; + +void mad_stream_init(struct mad_stream *); +void mad_stream_finish(struct mad_stream *); + +# define mad_stream_options(stream, opts) \ + ((void) ((stream)->options = (opts))) + +void mad_stream_buffer(struct mad_stream *, + u8 const *, u32); +void mad_stream_skip(struct mad_stream *, u32); + +s32 mad_stream_sync(struct mad_stream *); + +char const *mad_stream_errorstr(struct mad_stream const *); + +# endif diff --git a/cpymo-backends/nds/decoder/synth.c b/cpymo-backends/nds/decoder/synth.c new file mode 100644 index 00000000..9f7a2a4d --- /dev/null +++ b/cpymo-backends/nds/decoder/synth.c @@ -0,0 +1,856 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif + +# include "global.h" + +# include "fixed.h" +# include "frame.h" +# include "synth.h" + +/* + * NAME: synth->init() + * DESCRIPTION: initialize synth struct + */ +void mad_synth_init(struct mad_synth *synth) +{ + mad_synth_mute(synth); + + synth->phase = 0; + + synth->pcm.samplerate = 0; + synth->pcm.channels = 0; + synth->pcm.length = 0; +} + +/* + * NAME: synth->mute() + * DESCRIPTION: zero all polyphase filterbank values, resetting synthesis + */ +void mad_synth_mute(struct mad_synth *synth) +{ + u32 ch, s, v; + + for (ch = 0; ch < 2; ++ch) { + for (s = 0; s < 16; ++s) { + for (v = 0; v < 8; ++v) { + synth->filter[ch][0][0][s][v] = synth->filter[ch][0][1][s][v] = + synth->filter[ch][1][0][s][v] = synth->filter[ch][1][1][s][v] = 0; + } + } + } +} + +/* + * An optional optimization called here the Subband Synthesis Optimization + * (SSO) improves the performance of subband synthesis at the expense of + * accuracy. + * + * The idea is to simplify 32x32->64-bit multiplication to 32x32->32 such + * that extra scaling and rounding are not necessary. This often allows the + * compiler to use faster 32-bit multiply-accumulate instructions instead of + * explicit 64-bit multiply, shift, and add instructions. + * + * SSO works like this: a full 32x32->64-bit multiply of two mad_fixed_t + * values requires the result to be right-shifted 28 bits to be properly + * scaled to the same fixed-point format. Right shifts can be applied at any + * time to either operand or to the result, so the optimization involves + * careful placement of these shifts to minimize the loss of accuracy. + * + * First, a 14-bit shift is applied with rounding at compile-time to the D[] + * table of coefficients for the subband synthesis window. This only loses 2 + * bits of accuracy because the lower 12 bits are always zero. A second + * 12-bit shift occurs after the DCT calculation. This loses 12 bits of + * accuracy. Finally, a third 2-bit shift occurs just before the sample is + * saved in the PCM buffer. 14 + 12 + 2 == 28 bits. + */ + +/* FPM_DEFAULT without OPT_SSO will actually lose accuracy and performance */ + +# if defined(FPM_DEFAULT) && !defined(OPT_SSO) +# define OPT_SSO +# endif + +/* second SSO shift, with rounding */ + +# if defined(OPT_SSO) +# define SHIFT(x) (((x) + (1L << 11)) >> 12) +# else +# define SHIFT(x) (x) +# endif + +/* possible DCT speed optimization */ + +# if defined(OPT_SPEED) && defined(MAD_F_MLX) +# define OPT_DCTO +# define MUL(x, y) \ + ({ mad_fixed64hi_t hi; \ + mad_fixed64lo_t lo; \ + MAD_F_MLX(hi, lo, (x), (y)); \ + hi << (32 - MAD_F_SCALEBITS - 3); \ + }) +# else +# undef OPT_DCTO +# define MUL(x, y) mad_f_mul((x), (y)) +# endif + +/* + * NAME: dct32() + * DESCRIPTION: perform fast in[32]->out[32] DCT + */ +static +void dct32(mad_fixed_t const in[32], u32 slot, + mad_fixed_t lo[16][8], mad_fixed_t hi[16][8]) +{ + mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7; + mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15; + mad_fixed_t t16, t17, t18, t19, t20, t21, t22, t23; + mad_fixed_t t24, t25, t26, t27, t28, t29, t30, t31; + mad_fixed_t t32, t33, t34, t35, t36, t37, t38, t39; + mad_fixed_t t40, t41, t42, t43, t44, t45, t46, t47; + mad_fixed_t t48, t49, t50, t51, t52, t53, t54, t55; + mad_fixed_t t56, t57, t58, t59, t60, t61, t62, t63; + mad_fixed_t t64, t65, t66, t67, t68, t69, t70, t71; + mad_fixed_t t72, t73, t74, t75, t76, t77, t78, t79; + mad_fixed_t t80, t81, t82, t83, t84, t85, t86, t87; + mad_fixed_t t88, t89, t90, t91, t92, t93, t94, t95; + mad_fixed_t t96, t97, t98, t99, t100, t101, t102, t103; + mad_fixed_t t104, t105, t106, t107, t108, t109, t110, t111; + mad_fixed_t t112, t113, t114, t115, t116, t117, t118, t119; + mad_fixed_t t120, t121, t122, t123, t124, t125, t126, t127; + mad_fixed_t t128, t129, t130, t131, t132, t133, t134, t135; + mad_fixed_t t136, t137, t138, t139, t140, t141, t142, t143; + mad_fixed_t t144, t145, t146, t147, t148, t149, t150, t151; + mad_fixed_t t152, t153, t154, t155, t156, t157, t158, t159; + mad_fixed_t t160, t161, t162, t163, t164, t165, t166, t167; + mad_fixed_t t168, t169, t170, t171, t172, t173, t174, t175; + mad_fixed_t t176; + + /* costab[i] = cos(PI / (2 * 32) * i) */ + +# if defined(OPT_DCTO) +# define costab1 MAD_F(0x7fd8878e) +# define costab2 MAD_F(0x7f62368f) +# define costab3 MAD_F(0x7e9d55fc) +# define costab4 MAD_F(0x7d8a5f40) +# define costab5 MAD_F(0x7c29fbee) +# define costab6 MAD_F(0x7a7d055b) +# define costab7 MAD_F(0x78848414) +# define costab8 MAD_F(0x7641af3d) +# define costab9 MAD_F(0x73b5ebd1) +# define costab10 MAD_F(0x70e2cbc6) +# define costab11 MAD_F(0x6dca0d14) +# define costab12 MAD_F(0x6a6d98a4) +# define costab13 MAD_F(0x66cf8120) +# define costab14 MAD_F(0x62f201ac) +# define costab15 MAD_F(0x5ed77c8a) +# define costab16 MAD_F(0x5a82799a) +# define costab17 MAD_F(0x55f5a4d2) +# define costab18 MAD_F(0x5133cc94) +# define costab19 MAD_F(0x4c3fdff4) +# define costab20 MAD_F(0x471cece7) +# define costab21 MAD_F(0x41ce1e65) +# define costab22 MAD_F(0x3c56ba70) +# define costab23 MAD_F(0x36ba2014) +# define costab24 MAD_F(0x30fbc54d) +# define costab25 MAD_F(0x2b1f34eb) +# define costab26 MAD_F(0x25280c5e) +# define costab27 MAD_F(0x1f19f97b) +# define costab28 MAD_F(0x18f8b83c) +# define costab29 MAD_F(0x12c8106f) +# define costab30 MAD_F(0x0c8bd35e) +# define costab31 MAD_F(0x0647d97c) +# else +# define costab1 MAD_F(0x0ffb10f2) /* 0.998795456 */ +# define costab2 MAD_F(0x0fec46d2) /* 0.995184727 */ +# define costab3 MAD_F(0x0fd3aac0) /* 0.989176510 */ +# define costab4 MAD_F(0x0fb14be8) /* 0.980785280 */ +# define costab5 MAD_F(0x0f853f7e) /* 0.970031253 */ +# define costab6 MAD_F(0x0f4fa0ab) /* 0.956940336 */ +# define costab7 MAD_F(0x0f109082) /* 0.941544065 */ +# define costab8 MAD_F(0x0ec835e8) /* 0.923879533 */ +# define costab9 MAD_F(0x0e76bd7a) /* 0.903989293 */ +# define costab10 MAD_F(0x0e1c5979) /* 0.881921264 */ +# define costab11 MAD_F(0x0db941a3) /* 0.857728610 */ +# define costab12 MAD_F(0x0d4db315) /* 0.831469612 */ +# define costab13 MAD_F(0x0cd9f024) /* 0.803207531 */ +# define costab14 MAD_F(0x0c5e4036) /* 0.773010453 */ +# define costab15 MAD_F(0x0bdaef91) /* 0.740951125 */ +# define costab16 MAD_F(0x0b504f33) /* 0.707106781 */ +# define costab17 MAD_F(0x0abeb49a) /* 0.671558955 */ +# define costab18 MAD_F(0x0a267993) /* 0.634393284 */ +# define costab19 MAD_F(0x0987fbfe) /* 0.595699304 */ +# define costab20 MAD_F(0x08e39d9d) /* 0.555570233 */ +# define costab21 MAD_F(0x0839c3cd) /* 0.514102744 */ +# define costab22 MAD_F(0x078ad74e) /* 0.471396737 */ +# define costab23 MAD_F(0x06d74402) /* 0.427555093 */ +# define costab24 MAD_F(0x061f78aa) /* 0.382683432 */ +# define costab25 MAD_F(0x0563e69d) /* 0.336889853 */ +# define costab26 MAD_F(0x04a5018c) /* 0.290284677 */ +# define costab27 MAD_F(0x03e33f2f) /* 0.242980180 */ +# define costab28 MAD_F(0x031f1708) /* 0.195090322 */ +# define costab29 MAD_F(0x0259020e) /* 0.146730474 */ +# define costab30 MAD_F(0x01917a6c) /* 0.098017140 */ +# define costab31 MAD_F(0x00c8fb30) /* 0.049067674 */ +# endif + + t0 = in[0] + in[31]; t16 = MUL(in[0] - in[31], costab1); + t1 = in[15] + in[16]; t17 = MUL(in[15] - in[16], costab31); + + t41 = t16 + t17; + t59 = MUL(t16 - t17, costab2); + t33 = t0 + t1; + t50 = MUL(t0 - t1, costab2); + + t2 = in[7] + in[24]; t18 = MUL(in[7] - in[24], costab15); + t3 = in[8] + in[23]; t19 = MUL(in[8] - in[23], costab17); + + t42 = t18 + t19; + t60 = MUL(t18 - t19, costab30); + t34 = t2 + t3; + t51 = MUL(t2 - t3, costab30); + + t4 = in[3] + in[28]; t20 = MUL(in[3] - in[28], costab7); + t5 = in[12] + in[19]; t21 = MUL(in[12] - in[19], costab25); + + t43 = t20 + t21; + t61 = MUL(t20 - t21, costab14); + t35 = t4 + t5; + t52 = MUL(t4 - t5, costab14); + + t6 = in[4] + in[27]; t22 = MUL(in[4] - in[27], costab9); + t7 = in[11] + in[20]; t23 = MUL(in[11] - in[20], costab23); + + t44 = t22 + t23; + t62 = MUL(t22 - t23, costab18); + t36 = t6 + t7; + t53 = MUL(t6 - t7, costab18); + + t8 = in[1] + in[30]; t24 = MUL(in[1] - in[30], costab3); + t9 = in[14] + in[17]; t25 = MUL(in[14] - in[17], costab29); + + t45 = t24 + t25; + t63 = MUL(t24 - t25, costab6); + t37 = t8 + t9; + t54 = MUL(t8 - t9, costab6); + + t10 = in[6] + in[25]; t26 = MUL(in[6] - in[25], costab13); + t11 = in[9] + in[22]; t27 = MUL(in[9] - in[22], costab19); + + t46 = t26 + t27; + t64 = MUL(t26 - t27, costab26); + t38 = t10 + t11; + t55 = MUL(t10 - t11, costab26); + + t12 = in[2] + in[29]; t28 = MUL(in[2] - in[29], costab5); + t13 = in[13] + in[18]; t29 = MUL(in[13] - in[18], costab27); + + t47 = t28 + t29; + t65 = MUL(t28 - t29, costab10); + t39 = t12 + t13; + t56 = MUL(t12 - t13, costab10); + + t14 = in[5] + in[26]; t30 = MUL(in[5] - in[26], costab11); + t15 = in[10] + in[21]; t31 = MUL(in[10] - in[21], costab21); + + t48 = t30 + t31; + t66 = MUL(t30 - t31, costab22); + t40 = t14 + t15; + t57 = MUL(t14 - t15, costab22); + + t69 = t33 + t34; t89 = MUL(t33 - t34, costab4); + t70 = t35 + t36; t90 = MUL(t35 - t36, costab28); + t71 = t37 + t38; t91 = MUL(t37 - t38, costab12); + t72 = t39 + t40; t92 = MUL(t39 - t40, costab20); + t73 = t41 + t42; t94 = MUL(t41 - t42, costab4); + t74 = t43 + t44; t95 = MUL(t43 - t44, costab28); + t75 = t45 + t46; t96 = MUL(t45 - t46, costab12); + t76 = t47 + t48; t97 = MUL(t47 - t48, costab20); + + t78 = t50 + t51; t100 = MUL(t50 - t51, costab4); + t79 = t52 + t53; t101 = MUL(t52 - t53, costab28); + t80 = t54 + t55; t102 = MUL(t54 - t55, costab12); + t81 = t56 + t57; t103 = MUL(t56 - t57, costab20); + + t83 = t59 + t60; t106 = MUL(t59 - t60, costab4); + t84 = t61 + t62; t107 = MUL(t61 - t62, costab28); + t85 = t63 + t64; t108 = MUL(t63 - t64, costab12); + t86 = t65 + t66; t109 = MUL(t65 - t66, costab20); + + t113 = t69 + t70; + t114 = t71 + t72; + + /* 0 */ hi[15][slot] = SHIFT(t113 + t114); + /* 16 */ lo[ 0][slot] = SHIFT(MUL(t113 - t114, costab16)); + + t115 = t73 + t74; + t116 = t75 + t76; + + t32 = t115 + t116; + + /* 1 */ hi[14][slot] = SHIFT(t32); + + t118 = t78 + t79; + t119 = t80 + t81; + + t58 = t118 + t119; + + /* 2 */ hi[13][slot] = SHIFT(t58); + + t121 = t83 + t84; + t122 = t85 + t86; + + t67 = t121 + t122; + + t49 = (t67 * 2) - t32; + + /* 3 */ hi[12][slot] = SHIFT(t49); + + t125 = t89 + t90; + t126 = t91 + t92; + + t93 = t125 + t126; + + /* 4 */ hi[11][slot] = SHIFT(t93); + + t128 = t94 + t95; + t129 = t96 + t97; + + t98 = t128 + t129; + + t68 = (t98 * 2) - t49; + + /* 5 */ hi[10][slot] = SHIFT(t68); + + t132 = t100 + t101; + t133 = t102 + t103; + + t104 = t132 + t133; + + t82 = (t104 * 2) - t58; + + /* 6 */ hi[ 9][slot] = SHIFT(t82); + + t136 = t106 + t107; + t137 = t108 + t109; + + t110 = t136 + t137; + + t87 = (t110 * 2) - t67; + + t77 = (t87 * 2) - t68; + + /* 7 */ hi[ 8][slot] = SHIFT(t77); + + t141 = MUL(t69 - t70, costab8); + t142 = MUL(t71 - t72, costab24); + t143 = t141 + t142; + + /* 8 */ hi[ 7][slot] = SHIFT(t143); + /* 24 */ lo[ 8][slot] = + SHIFT((MUL(t141 - t142, costab16) * 2) - t143); + + t144 = MUL(t73 - t74, costab8); + t145 = MUL(t75 - t76, costab24); + t146 = t144 + t145; + + t88 = (t146 * 2) - t77; + + /* 9 */ hi[ 6][slot] = SHIFT(t88); + + t148 = MUL(t78 - t79, costab8); + t149 = MUL(t80 - t81, costab24); + t150 = t148 + t149; + + t105 = (t150 * 2) - t82; + + /* 10 */ hi[ 5][slot] = SHIFT(t105); + + t152 = MUL(t83 - t84, costab8); + t153 = MUL(t85 - t86, costab24); + t154 = t152 + t153; + + t111 = (t154 * 2) - t87; + + t99 = (t111 * 2) - t88; + + /* 11 */ hi[ 4][slot] = SHIFT(t99); + + t157 = MUL(t89 - t90, costab8); + t158 = MUL(t91 - t92, costab24); + t159 = t157 + t158; + + t127 = (t159 * 2) - t93; + + /* 12 */ hi[ 3][slot] = SHIFT(t127); + + t160 = (MUL(t125 - t126, costab16) * 2) - t127; + + /* 20 */ lo[ 4][slot] = SHIFT(t160); + /* 28 */ lo[12][slot] = + SHIFT((((MUL(t157 - t158, costab16) * 2) - t159) * 2) - t160); + + t161 = MUL(t94 - t95, costab8); + t162 = MUL(t96 - t97, costab24); + t163 = t161 + t162; + + t130 = (t163 * 2) - t98; + + t112 = (t130 * 2) - t99; + + /* 13 */ hi[ 2][slot] = SHIFT(t112); + + t164 = (MUL(t128 - t129, costab16) * 2) - t130; + + t166 = MUL(t100 - t101, costab8); + t167 = MUL(t102 - t103, costab24); + t168 = t166 + t167; + + t134 = (t168 * 2) - t104; + + t120 = (t134 * 2) - t105; + + /* 14 */ hi[ 1][slot] = SHIFT(t120); + + t135 = (MUL(t118 - t119, costab16) * 2) - t120; + + /* 18 */ lo[ 2][slot] = SHIFT(t135); + + t169 = (MUL(t132 - t133, costab16) * 2) - t134; + + t151 = (t169 * 2) - t135; + + /* 22 */ lo[ 6][slot] = SHIFT(t151); + + t170 = (((MUL(t148 - t149, costab16) * 2) - t150) * 2) - t151; + + /* 26 */ lo[10][slot] = SHIFT(t170); + /* 30 */ lo[14][slot] = + SHIFT((((((MUL(t166 - t167, costab16) * 2) - + t168) * 2) - t169) * 2) - t170); + + t171 = MUL(t106 - t107, costab8); + t172 = MUL(t108 - t109, costab24); + t173 = t171 + t172; + + t138 = (t173 * 2) - t110; + + t123 = (t138 * 2) - t111; + + t139 = (MUL(t121 - t122, costab16) * 2) - t123; + + t117 = (t123 * 2) - t112; + + /* 15 */ hi[ 0][slot] = SHIFT(t117); + + t124 = (MUL(t115 - t116, costab16) * 2) - t117; + + /* 17 */ lo[ 1][slot] = SHIFT(t124); + + t131 = (t139 * 2) - t124; + + /* 19 */ lo[ 3][slot] = SHIFT(t131); + + t140 = (t164 * 2) - t131; + + /* 21 */ lo[ 5][slot] = SHIFT(t140); + + t174 = (MUL(t136 - t137, costab16) * 2) - t138; + + t155 = (t174 * 2) - t139; + + t147 = (t155 * 2) - t140; + + /* 23 */ lo[ 7][slot] = SHIFT(t147); + + t156 = (((MUL(t144 - t145, costab16) * 2) - t146) * 2) - t147; + + /* 25 */ lo[ 9][slot] = SHIFT(t156); + + t175 = (((MUL(t152 - t153, costab16) * 2) - t154) * 2) - t155; + + t165 = (t175 * 2) - t156; + + /* 27 */ lo[11][slot] = SHIFT(t165); + + t176 = (((((MUL(t161 - t162, costab16) * 2) - + t163) * 2) - t164) * 2) - t165; + + /* 29 */ lo[13][slot] = SHIFT(t176); + /* 31 */ lo[15][slot] = + SHIFT((((((((MUL(t171 - t172, costab16) * 2) - + t173) * 2) - t174) * 2) - t175) * 2) - t176); + + /* + * Totals: + * 80 multiplies + * 80 additions + * 119 subtractions + * 49 shifts (not counting SSO) + */ +} + +# undef MUL +# undef SHIFT + +/* third SSO shift and/or D[] optimization preshift */ + +# if defined(OPT_SSO) +# if MAD_F_FRACBITS != 28 +# error "MAD_F_FRACBITS must be 28 to use OPT_SSO" +# endif +# define ML0(hi, lo, x, y) ((lo) = (x) * (y)) +# define MLA(hi, lo, x, y) ((lo) += (x) * (y)) +# define MLN(hi, lo) ((lo) = -(lo)) +# define MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) +# define SHIFT(x) ((x) >> 2) +# define PRESHIFT(x) ((MAD_F(x) + (1L << 13)) >> 14) +# else +# define ML0(hi, lo, x, y) MAD_F_ML0((hi), (lo), (x), (y)) +# define MLA(hi, lo, x, y) MAD_F_MLA((hi), (lo), (x), (y)) +# define MLN(hi, lo) MAD_F_MLN((hi), (lo)) +# define MLZ(hi, lo) MAD_F_MLZ((hi), (lo)) +# define SHIFT(x) (x) +# if defined(MAD_F_SCALEBITS) +# undef MAD_F_SCALEBITS +# define MAD_F_SCALEBITS (MAD_F_FRACBITS - 12) +# define PRESHIFT(x) (MAD_F(x) >> 12) +# else +# define PRESHIFT(x) MAD_F(x) +# endif +# endif + +static +mad_fixed_t const D[17][32] = { +# include "D.dat" +}; + +# if defined(ASO_SYNTH) +void synth_full(struct mad_synth *, struct mad_frame const *, + u32, u32); +# else +/* + * NAME: synth->full() + * DESCRIPTION: perform full frequency PCM synthesis + */ +static +void synth_full(struct mad_synth *synth, struct mad_frame const *frame, + u32 nch, u32 ns) +{ + u32 phase, ch, s, sb, pe, po; + mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8]; + mad_fixed_t const (*sbsample)[36][32]; + register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8]; + register mad_fixed_t const (*Dptr)[32], *ptr; + register mad_fixed64hi_t hi; + register mad_fixed64lo_t lo; + + for (ch = 0; ch < nch; ++ch) { + sbsample = (void*)(&frame->sbsample[ch]); + filter = &synth->filter[ch]; + phase = synth->phase; + pcm1 = synth->pcm.samples[ch]; + + for (s = 0; s < ns; ++s) { + dct32((*sbsample)[s], phase >> 1, + (*filter)[0][phase & 1], (*filter)[1][phase & 1]); + + pe = phase & ~1; + po = ((phase - 1) & 0xf) | 1; + + /* calculate 32 samples */ + + fe = &(*filter)[0][ phase & 1][0]; + fx = &(*filter)[0][~phase & 1][0]; + fo = &(*filter)[1][~phase & 1][0]; + + Dptr = &D[0]; + + ptr = *Dptr + po; + ML0(hi, lo, (*fx)[0], ptr[ 0]); + MLA(hi, lo, (*fx)[1], ptr[14]); + MLA(hi, lo, (*fx)[2], ptr[12]); + MLA(hi, lo, (*fx)[3], ptr[10]); + MLA(hi, lo, (*fx)[4], ptr[ 8]); + MLA(hi, lo, (*fx)[5], ptr[ 6]); + MLA(hi, lo, (*fx)[6], ptr[ 4]); + MLA(hi, lo, (*fx)[7], ptr[ 2]); + MLN(hi, lo); + + ptr = *Dptr + pe; + MLA(hi, lo, (*fe)[0], ptr[ 0]); + MLA(hi, lo, (*fe)[1], ptr[14]); + MLA(hi, lo, (*fe)[2], ptr[12]); + MLA(hi, lo, (*fe)[3], ptr[10]); + MLA(hi, lo, (*fe)[4], ptr[ 8]); + MLA(hi, lo, (*fe)[5], ptr[ 6]); + MLA(hi, lo, (*fe)[6], ptr[ 4]); + MLA(hi, lo, (*fe)[7], ptr[ 2]); + + *pcm1++ = SHIFT(MLZ(hi, lo)); + + pcm2 = pcm1 + 30; + + for (sb = 1; sb < 16; ++sb) { + ++fe; + ++Dptr; + + /* D[32 - sb][i] == -D[sb][31 - i] */ + + ptr = *Dptr + po; + ML0(hi, lo, (*fo)[0], ptr[ 0]); + MLA(hi, lo, (*fo)[1], ptr[14]); + MLA(hi, lo, (*fo)[2], ptr[12]); + MLA(hi, lo, (*fo)[3], ptr[10]); + MLA(hi, lo, (*fo)[4], ptr[ 8]); + MLA(hi, lo, (*fo)[5], ptr[ 6]); + MLA(hi, lo, (*fo)[6], ptr[ 4]); + MLA(hi, lo, (*fo)[7], ptr[ 2]); + MLN(hi, lo); + + ptr = *Dptr + pe; + MLA(hi, lo, (*fe)[7], ptr[ 2]); + MLA(hi, lo, (*fe)[6], ptr[ 4]); + MLA(hi, lo, (*fe)[5], ptr[ 6]); + MLA(hi, lo, (*fe)[4], ptr[ 8]); + MLA(hi, lo, (*fe)[3], ptr[10]); + MLA(hi, lo, (*fe)[2], ptr[12]); + MLA(hi, lo, (*fe)[1], ptr[14]); + MLA(hi, lo, (*fe)[0], ptr[ 0]); + + *pcm1++ = SHIFT(MLZ(hi, lo)); + + ptr = *Dptr - pe; + ML0(hi, lo, (*fe)[0], ptr[31 - 16]); + MLA(hi, lo, (*fe)[1], ptr[31 - 14]); + MLA(hi, lo, (*fe)[2], ptr[31 - 12]); + MLA(hi, lo, (*fe)[3], ptr[31 - 10]); + MLA(hi, lo, (*fe)[4], ptr[31 - 8]); + MLA(hi, lo, (*fe)[5], ptr[31 - 6]); + MLA(hi, lo, (*fe)[6], ptr[31 - 4]); + MLA(hi, lo, (*fe)[7], ptr[31 - 2]); + + ptr = *Dptr - po; + MLA(hi, lo, (*fo)[7], ptr[31 - 2]); + MLA(hi, lo, (*fo)[6], ptr[31 - 4]); + MLA(hi, lo, (*fo)[5], ptr[31 - 6]); + MLA(hi, lo, (*fo)[4], ptr[31 - 8]); + MLA(hi, lo, (*fo)[3], ptr[31 - 10]); + MLA(hi, lo, (*fo)[2], ptr[31 - 12]); + MLA(hi, lo, (*fo)[1], ptr[31 - 14]); + MLA(hi, lo, (*fo)[0], ptr[31 - 16]); + + *pcm2-- = SHIFT(MLZ(hi, lo)); + + ++fo; + } + + ++Dptr; + + ptr = *Dptr + po; + ML0(hi, lo, (*fo)[0], ptr[ 0]); + MLA(hi, lo, (*fo)[1], ptr[14]); + MLA(hi, lo, (*fo)[2], ptr[12]); + MLA(hi, lo, (*fo)[3], ptr[10]); + MLA(hi, lo, (*fo)[4], ptr[ 8]); + MLA(hi, lo, (*fo)[5], ptr[ 6]); + MLA(hi, lo, (*fo)[6], ptr[ 4]); + MLA(hi, lo, (*fo)[7], ptr[ 2]); + + *pcm1 = SHIFT(-MLZ(hi, lo)); + pcm1 += 16; + + phase = (phase + 1) % 16; + } + } +} +# endif + +/* + * NAME: synth->half() + * DESCRIPTION: perform half frequency PCM synthesis + */ +static +void synth_half(struct mad_synth *synth, struct mad_frame const *frame, + u32 nch, u32 ns) +{ + u32 phase, ch, s, sb, pe, po; + mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8]; + mad_fixed_t const (*sbsample)[36][32]; + register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8]; + register mad_fixed_t const (*Dptr)[32], *ptr; + register mad_fixed64hi_t hi; + register mad_fixed64lo_t lo; + + for (ch = 0; ch < nch; ++ch) { + sbsample = (void*)(&frame->sbsample[ch]); + filter = &synth->filter[ch]; + phase = synth->phase; + pcm1 = synth->pcm.samples[ch]; + + for (s = 0; s < ns; ++s) { + dct32((*sbsample)[s], phase >> 1, + (*filter)[0][phase & 1], (*filter)[1][phase & 1]); + + pe = phase & ~1; + po = ((phase - 1) & 0xf) | 1; + + /* calculate 16 samples */ + + fe = &(*filter)[0][ phase & 1][0]; + fx = &(*filter)[0][~phase & 1][0]; + fo = &(*filter)[1][~phase & 1][0]; + + Dptr = &D[0]; + + ptr = *Dptr + po; + ML0(hi, lo, (*fx)[0], ptr[ 0]); + MLA(hi, lo, (*fx)[1], ptr[14]); + MLA(hi, lo, (*fx)[2], ptr[12]); + MLA(hi, lo, (*fx)[3], ptr[10]); + MLA(hi, lo, (*fx)[4], ptr[ 8]); + MLA(hi, lo, (*fx)[5], ptr[ 6]); + MLA(hi, lo, (*fx)[6], ptr[ 4]); + MLA(hi, lo, (*fx)[7], ptr[ 2]); + MLN(hi, lo); + + ptr = *Dptr + pe; + MLA(hi, lo, (*fe)[0], ptr[ 0]); + MLA(hi, lo, (*fe)[1], ptr[14]); + MLA(hi, lo, (*fe)[2], ptr[12]); + MLA(hi, lo, (*fe)[3], ptr[10]); + MLA(hi, lo, (*fe)[4], ptr[ 8]); + MLA(hi, lo, (*fe)[5], ptr[ 6]); + MLA(hi, lo, (*fe)[6], ptr[ 4]); + MLA(hi, lo, (*fe)[7], ptr[ 2]); + + *pcm1++ = SHIFT(MLZ(hi, lo)); + + pcm2 = pcm1 + 14; + + for (sb = 1; sb < 16; ++sb) { + ++fe; + ++Dptr; + + /* D[32 - sb][i] == -D[sb][31 - i] */ + + if (!(sb & 1)) { + ptr = *Dptr + po; + ML0(hi, lo, (*fo)[0], ptr[ 0]); + MLA(hi, lo, (*fo)[1], ptr[14]); + MLA(hi, lo, (*fo)[2], ptr[12]); + MLA(hi, lo, (*fo)[3], ptr[10]); + MLA(hi, lo, (*fo)[4], ptr[ 8]); + MLA(hi, lo, (*fo)[5], ptr[ 6]); + MLA(hi, lo, (*fo)[6], ptr[ 4]); + MLA(hi, lo, (*fo)[7], ptr[ 2]); + MLN(hi, lo); + + ptr = *Dptr + pe; + MLA(hi, lo, (*fe)[7], ptr[ 2]); + MLA(hi, lo, (*fe)[6], ptr[ 4]); + MLA(hi, lo, (*fe)[5], ptr[ 6]); + MLA(hi, lo, (*fe)[4], ptr[ 8]); + MLA(hi, lo, (*fe)[3], ptr[10]); + MLA(hi, lo, (*fe)[2], ptr[12]); + MLA(hi, lo, (*fe)[1], ptr[14]); + MLA(hi, lo, (*fe)[0], ptr[ 0]); + + *pcm1++ = SHIFT(MLZ(hi, lo)); + + ptr = *Dptr - po; + ML0(hi, lo, (*fo)[7], ptr[31 - 2]); + MLA(hi, lo, (*fo)[6], ptr[31 - 4]); + MLA(hi, lo, (*fo)[5], ptr[31 - 6]); + MLA(hi, lo, (*fo)[4], ptr[31 - 8]); + MLA(hi, lo, (*fo)[3], ptr[31 - 10]); + MLA(hi, lo, (*fo)[2], ptr[31 - 12]); + MLA(hi, lo, (*fo)[1], ptr[31 - 14]); + MLA(hi, lo, (*fo)[0], ptr[31 - 16]); + + ptr = *Dptr - pe; + MLA(hi, lo, (*fe)[0], ptr[31 - 16]); + MLA(hi, lo, (*fe)[1], ptr[31 - 14]); + MLA(hi, lo, (*fe)[2], ptr[31 - 12]); + MLA(hi, lo, (*fe)[3], ptr[31 - 10]); + MLA(hi, lo, (*fe)[4], ptr[31 - 8]); + MLA(hi, lo, (*fe)[5], ptr[31 - 6]); + MLA(hi, lo, (*fe)[6], ptr[31 - 4]); + MLA(hi, lo, (*fe)[7], ptr[31 - 2]); + + *pcm2-- = SHIFT(MLZ(hi, lo)); + } + + ++fo; + } + + ++Dptr; + + ptr = *Dptr + po; + ML0(hi, lo, (*fo)[0], ptr[ 0]); + MLA(hi, lo, (*fo)[1], ptr[14]); + MLA(hi, lo, (*fo)[2], ptr[12]); + MLA(hi, lo, (*fo)[3], ptr[10]); + MLA(hi, lo, (*fo)[4], ptr[ 8]); + MLA(hi, lo, (*fo)[5], ptr[ 6]); + MLA(hi, lo, (*fo)[6], ptr[ 4]); + MLA(hi, lo, (*fo)[7], ptr[ 2]); + + *pcm1 = SHIFT(-MLZ(hi, lo)); + pcm1 += 8; + + phase = (phase + 1) % 16; + } + } +} + +/* + * NAME: synth->frame() + * DESCRIPTION: perform PCM synthesis of frame subband samples + */ +void mad_synth_frame(struct mad_synth *synth, struct mad_frame const *frame) +{ + u32 nch, ns; + void (*synth_frame)(struct mad_synth *, struct mad_frame const *, + u32, u32); + + nch = MAD_NCHANNELS(&frame->header); + ns = MAD_NSBSAMPLES(&frame->header); + + synth->pcm.samplerate = frame->header.samplerate; + synth->pcm.channels = nch; + synth->pcm.length = 32 * ns; + + synth_frame = synth_full; + + if (frame->options & MAD_OPTION_HALFSAMPLERATE) { + synth->pcm.samplerate /= 2; + synth->pcm.length /= 2; + + synth_frame = synth_half; + } + + synth_frame(synth, frame, nch, ns); + + synth->phase = (synth->phase + ns) % 16; +} diff --git a/cpymo-backends/nds/decoder/synth.h b/cpymo-backends/nds/decoder/synth.h new file mode 100644 index 00000000..5c67aeef --- /dev/null +++ b/cpymo-backends/nds/decoder/synth.h @@ -0,0 +1,69 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifndef LIBMAD_SYNTH_H +# define LIBMAD_SYNTH_H + +# include +# include "fixed.h" +# include "frame.h" + +struct mad_pcm { + u32 samplerate; /* sampling frequency (Hz) */ + u16 channels; /* number of channels */ + u16 length; /* number of samples per channel */ + mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */ +}; + +struct mad_synth { + mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */ + /* [ch][eo][peo][s][v] */ + + u32 phase; /* current processing phase */ + + struct mad_pcm pcm; /* PCM output */ +}; + +/* single channel PCM selector */ +enum { + MAD_PCM_CHANNEL_SINGLE = 0 +}; + +/* dual channel PCM selector */ +enum { + MAD_PCM_CHANNEL_DUAL_1 = 0, + MAD_PCM_CHANNEL_DUAL_2 = 1 +}; + +/* stereo PCM selector */ +enum { + MAD_PCM_CHANNEL_STEREO_LEFT = 0, + MAD_PCM_CHANNEL_STEREO_RIGHT = 1 +}; + +void mad_synth_init(struct mad_synth *); + +# define mad_synth_finish(synth) /* nothing */ + +void mad_synth_mute(struct mad_synth *); + +void mad_synth_frame(struct mad_synth *, struct mad_frame const *); + +# endif diff --git a/cpymo-backends/nds/decoder/timer.c b/cpymo-backends/nds/decoder/timer.c new file mode 100644 index 00000000..6590e829 --- /dev/null +++ b/cpymo-backends/nds/decoder/timer.c @@ -0,0 +1,485 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif + +# include "global.h" + +# include +# include + +# ifdef HAVE_ASSERT_H +# include +# endif + +# include "timer.h" + +mad_timer_t const mad_timer_zero = { 0, 0 }; + +/* + * NAME: timer->compare() + * DESCRIPTION: indicate relative order of two timers + */ +int mad_timer_compare(mad_timer_t timer1, mad_timer_t timer2) +{ + s32 diff; + + diff = timer1.seconds - timer2.seconds; + if (diff < 0) + return -1; + else if (diff > 0) + return +1; + + diff = timer1.fraction - timer2.fraction; + if (diff < 0) + return -1; + else if (diff > 0) + return +1; + + return 0; +} + +/* + * NAME: timer->negate() + * DESCRIPTION: invert the sign of a timer + */ +void mad_timer_negate(mad_timer_t *timer) +{ + timer->seconds = -timer->seconds; + + if (timer->fraction) { + timer->seconds -= 1; + timer->fraction = MAD_TIMER_RESOLUTION - timer->fraction; + } +} + +/* + * NAME: timer->abs() + * DESCRIPTION: return the absolute value of a timer + */ +mad_timer_t mad_timer_abs(mad_timer_t timer) +{ + if (timer.seconds < 0) + mad_timer_negate(&timer); + + return timer; +} + +/* + * NAME: reduce_timer() + * DESCRIPTION: carry timer fraction into seconds + */ +static +void reduce_timer(mad_timer_t *timer) +{ + timer->seconds += timer->fraction / MAD_TIMER_RESOLUTION; + timer->fraction %= MAD_TIMER_RESOLUTION; +} + +/* + * NAME: gcd() + * DESCRIPTION: compute greatest common denominator + */ +static +u32 gcd(u32 num1, u32 num2) +{ + u32 tmp; + + while (num2) { + tmp = num2; + num2 = num1 % num2; + num1 = tmp; + } + + return num1; +} + +/* + * NAME: reduce_rational() + * DESCRIPTION: convert rational expression to lowest terms + */ +static +void reduce_rational(u32 *numer, u32 *denom) +{ + u32 factor; + + factor = gcd(*numer, *denom); + + assert(factor != 0); + + *numer /= factor; + *denom /= factor; +} + +/* + * NAME: scale_rational() + * DESCRIPTION: solve numer/denom == ?/scale avoiding overflowing + */ +static +u32 scale_rational(u32 numer, u32 denom, + u32 scale) +{ + reduce_rational(&numer, &denom); + reduce_rational(&scale, &denom); + + assert(denom != 0); + + if (denom < scale) + return numer * (scale / denom) + numer * (scale % denom) / denom; + if (denom < numer) + return scale * (numer / denom) + scale * (numer % denom) / denom; + + return numer * scale / denom; +} + +/* + * NAME: timer->set() + * DESCRIPTION: set timer to specific (positive) value + */ +void mad_timer_set(mad_timer_t *timer, u32 seconds, + u32 numer, u32 denom) +{ + timer->seconds = seconds; + if (numer >= denom && denom > 0) { + timer->seconds += numer / denom; + numer %= denom; + } + + switch (denom) { + case 0: + case 1: + timer->fraction = 0; + break; + + case MAD_TIMER_RESOLUTION: + timer->fraction = numer; + break; + + case 1000: + timer->fraction = numer * (MAD_TIMER_RESOLUTION / 1000); + break; + + case 8000: + timer->fraction = numer * (MAD_TIMER_RESOLUTION / 8000); + break; + + case 11025: + timer->fraction = numer * (MAD_TIMER_RESOLUTION / 11025); + break; + + case 12000: + timer->fraction = numer * (MAD_TIMER_RESOLUTION / 12000); + break; + + case 16000: + timer->fraction = numer * (MAD_TIMER_RESOLUTION / 16000); + break; + + case 22050: + timer->fraction = numer * (MAD_TIMER_RESOLUTION / 22050); + break; + + case 24000: + timer->fraction = numer * (MAD_TIMER_RESOLUTION / 24000); + break; + + case 32000: + timer->fraction = numer * (MAD_TIMER_RESOLUTION / 32000); + break; + + case 44100: + timer->fraction = numer * (MAD_TIMER_RESOLUTION / 44100); + break; + + case 48000: + timer->fraction = numer * (MAD_TIMER_RESOLUTION / 48000); + break; + + default: + timer->fraction = scale_rational(numer, denom, MAD_TIMER_RESOLUTION); + break; + } + + if (timer->fraction >= MAD_TIMER_RESOLUTION) + reduce_timer(timer); +} + +/* + * NAME: timer->add() + * DESCRIPTION: add one timer to another + */ +void mad_timer_add(mad_timer_t *timer, mad_timer_t incr) +{ + timer->seconds += incr.seconds; + timer->fraction += incr.fraction; + + if (timer->fraction >= MAD_TIMER_RESOLUTION) + reduce_timer(timer); +} + +/* + * NAME: timer->multiply() + * DESCRIPTION: multiply a timer by a scalar value + */ +void mad_timer_multiply(mad_timer_t *timer, s32 scalar) +{ + mad_timer_t addend; + u32 factor; + + factor = scalar; + if (scalar < 0) { + factor = -scalar; + mad_timer_negate(timer); + } + + addend = *timer; + *timer = mad_timer_zero; + + while (factor) { + if (factor & 1) + mad_timer_add(timer, addend); + + mad_timer_add(&addend, addend); + factor >>= 1; + } +} + +/* + * NAME: timer->count() + * DESCRIPTION: return timer value in selected units + */ +s32 mad_timer_count(mad_timer_t timer, enum mad_units units) +{ + switch (units) { + case MAD_UNITS_HOURS: + return timer.seconds / 60 / 60; + + case MAD_UNITS_MINUTES: + return timer.seconds / 60; + + case MAD_UNITS_SECONDS: + return timer.seconds; + + case MAD_UNITS_DECISECONDS: + case MAD_UNITS_CENTISECONDS: + case MAD_UNITS_MILLISECONDS: + + case MAD_UNITS_8000_HZ: + case MAD_UNITS_11025_HZ: + case MAD_UNITS_12000_HZ: + case MAD_UNITS_16000_HZ: + case MAD_UNITS_22050_HZ: + case MAD_UNITS_24000_HZ: + case MAD_UNITS_32000_HZ: + case MAD_UNITS_44100_HZ: + case MAD_UNITS_48000_HZ: + + case MAD_UNITS_24_FPS: + case MAD_UNITS_25_FPS: + case MAD_UNITS_30_FPS: + case MAD_UNITS_48_FPS: + case MAD_UNITS_50_FPS: + case MAD_UNITS_60_FPS: + case MAD_UNITS_75_FPS: + return timer.seconds * (s32) units + + (s32) scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, + units); + + case MAD_UNITS_23_976_FPS: + case MAD_UNITS_24_975_FPS: + case MAD_UNITS_29_97_FPS: + case MAD_UNITS_47_952_FPS: + case MAD_UNITS_49_95_FPS: + case MAD_UNITS_59_94_FPS: + return (mad_timer_count(timer, -units) + 1) * 1000 / 1001; + } + + /* unsupported units */ + return 0; +} + +/* + * NAME: timer->fraction() + * DESCRIPTION: return fractional part of timer in arbitrary terms + */ +u32 mad_timer_fraction(mad_timer_t timer, u32 denom) +{ + timer = mad_timer_abs(timer); + + switch (denom) { + case 0: + return timer.fraction ? + MAD_TIMER_RESOLUTION / timer.fraction : MAD_TIMER_RESOLUTION + 1; + + case MAD_TIMER_RESOLUTION: + return timer.fraction; + + default: + return scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, denom); + } +} + +/* + * NAME: timer->string() + * DESCRIPTION: write a string representation of a timer using a template + */ +void mad_timer_string(mad_timer_t timer, + char *dest, char const *format, enum mad_units units, + enum mad_units fracunits, u32 subparts) +{ + u32 hours, minutes, seconds, sub; + u32 frac; + + timer = mad_timer_abs(timer); + + seconds = timer.seconds; + frac = sub = 0; + + switch (fracunits) { + case MAD_UNITS_HOURS: + case MAD_UNITS_MINUTES: + case MAD_UNITS_SECONDS: + break; + + case MAD_UNITS_DECISECONDS: + case MAD_UNITS_CENTISECONDS: + case MAD_UNITS_MILLISECONDS: + + case MAD_UNITS_8000_HZ: + case MAD_UNITS_11025_HZ: + case MAD_UNITS_12000_HZ: + case MAD_UNITS_16000_HZ: + case MAD_UNITS_22050_HZ: + case MAD_UNITS_24000_HZ: + case MAD_UNITS_32000_HZ: + case MAD_UNITS_44100_HZ: + case MAD_UNITS_48000_HZ: + + case MAD_UNITS_24_FPS: + case MAD_UNITS_25_FPS: + case MAD_UNITS_30_FPS: + case MAD_UNITS_48_FPS: + case MAD_UNITS_50_FPS: + case MAD_UNITS_60_FPS: + case MAD_UNITS_75_FPS: + { + u32 denom; + + denom = MAD_TIMER_RESOLUTION / fracunits; + + frac = timer.fraction / denom; + sub = scale_rational(timer.fraction % denom, denom, subparts); + } + break; + + case MAD_UNITS_23_976_FPS: + case MAD_UNITS_24_975_FPS: + case MAD_UNITS_29_97_FPS: + case MAD_UNITS_47_952_FPS: + case MAD_UNITS_49_95_FPS: + case MAD_UNITS_59_94_FPS: + /* drop-frame encoding */ + /* N.B. this is only well-defined for MAD_UNITS_29_97_FPS */ + { + u32 frame, cycle, d, m; + + frame = mad_timer_count(timer, fracunits); + + cycle = -fracunits * 60 * 10 - (10 - 1) * 2; + + d = frame / cycle; + m = frame % cycle; + frame += (10 - 1) * 2 * d; + if (m > 2) + frame += 2 * ((m - 2) / (cycle / 10)); + + frac = frame % -fracunits; + seconds = frame / -fracunits; + } + break; + } + + switch (units) { + case MAD_UNITS_HOURS: + minutes = seconds / 60; + hours = minutes / 60; + + sprintf(dest, format, + hours, + (u32) (minutes % 60), + (u32) (seconds % 60), + frac, sub); + break; + + case MAD_UNITS_MINUTES: + minutes = seconds / 60; + + sprintf(dest, format, + minutes, + (u32) (seconds % 60), + frac, sub); + break; + + case MAD_UNITS_SECONDS: + sprintf(dest, format, + seconds, + frac, sub); + break; + + case MAD_UNITS_23_976_FPS: + case MAD_UNITS_24_975_FPS: + case MAD_UNITS_29_97_FPS: + case MAD_UNITS_47_952_FPS: + case MAD_UNITS_49_95_FPS: + case MAD_UNITS_59_94_FPS: + if (fracunits < 0) { + /* not yet implemented */ + sub = 0; + } + + /* fall through */ + + case MAD_UNITS_DECISECONDS: + case MAD_UNITS_CENTISECONDS: + case MAD_UNITS_MILLISECONDS: + + case MAD_UNITS_8000_HZ: + case MAD_UNITS_11025_HZ: + case MAD_UNITS_12000_HZ: + case MAD_UNITS_16000_HZ: + case MAD_UNITS_22050_HZ: + case MAD_UNITS_24000_HZ: + case MAD_UNITS_32000_HZ: + case MAD_UNITS_44100_HZ: + case MAD_UNITS_48000_HZ: + + case MAD_UNITS_24_FPS: + case MAD_UNITS_25_FPS: + case MAD_UNITS_30_FPS: + case MAD_UNITS_48_FPS: + case MAD_UNITS_50_FPS: + case MAD_UNITS_60_FPS: + case MAD_UNITS_75_FPS: + sprintf(dest, format, mad_timer_count(timer, units), sub); + break; + } +} diff --git a/cpymo-backends/nds/decoder/timer.h b/cpymo-backends/nds/decoder/timer.h new file mode 100644 index 00000000..e891a428 --- /dev/null +++ b/cpymo-backends/nds/decoder/timer.h @@ -0,0 +1,101 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifndef LIBMAD_TIMER_H +# define LIBMAD_TIMER_H + +#include + +typedef struct { + s32 seconds; /* whole seconds */ + u32 fraction; /* 1/MAD_TIMER_RESOLUTION seconds */ +} mad_timer_t; + +extern mad_timer_t const mad_timer_zero; + +# define MAD_TIMER_RESOLUTION 352800000UL + +enum mad_units { + MAD_UNITS_HOURS = -2, + MAD_UNITS_MINUTES = -1, + MAD_UNITS_SECONDS = 0, + + /* metric units */ + + MAD_UNITS_DECISECONDS = 10, + MAD_UNITS_CENTISECONDS = 100, + MAD_UNITS_MILLISECONDS = 1000, + + /* audio sample units */ + + MAD_UNITS_8000_HZ = 8000, + MAD_UNITS_11025_HZ = 11025, + MAD_UNITS_12000_HZ = 12000, + + MAD_UNITS_16000_HZ = 16000, + MAD_UNITS_22050_HZ = 22050, + MAD_UNITS_24000_HZ = 24000, + + MAD_UNITS_32000_HZ = 32000, + MAD_UNITS_44100_HZ = 44100, + MAD_UNITS_48000_HZ = 48000, + + /* video frame/field units */ + + MAD_UNITS_24_FPS = 24, + MAD_UNITS_25_FPS = 25, + MAD_UNITS_30_FPS = 30, + MAD_UNITS_48_FPS = 48, + MAD_UNITS_50_FPS = 50, + MAD_UNITS_60_FPS = 60, + + /* CD audio frames */ + + MAD_UNITS_75_FPS = 75, + + /* video drop-frame units */ + + MAD_UNITS_23_976_FPS = -24, + MAD_UNITS_24_975_FPS = -25, + MAD_UNITS_29_97_FPS = -30, + MAD_UNITS_47_952_FPS = -48, + MAD_UNITS_49_95_FPS = -50, + MAD_UNITS_59_94_FPS = -60 +}; + +# define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero)) + +int mad_timer_compare(mad_timer_t, mad_timer_t); + +# define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero) + +void mad_timer_negate(mad_timer_t *); +mad_timer_t mad_timer_abs(mad_timer_t); + +void mad_timer_set(mad_timer_t *, u32, u32, u32); +void mad_timer_add(mad_timer_t *, mad_timer_t); +void mad_timer_multiply(mad_timer_t *, s32); + +s32 mad_timer_count(mad_timer_t, enum mad_units); +u32 mad_timer_fraction(mad_timer_t, u32); +void mad_timer_string(mad_timer_t, char *, char const *, + enum mad_units, enum mad_units, u32); + +# endif diff --git a/cpymo-backends/nds/decoder/version.c b/cpymo-backends/nds/decoder/version.c new file mode 100644 index 00000000..40f9002e --- /dev/null +++ b/cpymo-backends/nds/decoder/version.c @@ -0,0 +1,90 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif + +# include "global.h" + +# include "version.h" + +s8 const mad_version[] = "MPEG Audio Decoder " MAD_VERSION; +s8 const mad_copyright[] = "Copyright (C) " MAD_PUBLISHYEAR " " MAD_AUTHOR; +s8 const mad_author[] = MAD_AUTHOR " <" MAD_EMAIL ">"; + +s8 const mad_build[] = "" +# if defined(DEBUG) + "DEBUG " +# elif defined(NDEBUG) + "NDEBUG " +# endif + +# if defined(EXPERIMENTAL) + "EXPERIMENTAL " +# endif + +# if defined(FPM_64BIT) + "FPM_64BIT " +# elif defined(FPM_INTEL) + "FPM_INTEL " +# elif defined(FPM_ARM) + "FPM_ARM " +# elif defined(FPM_MIPS) + "FPM_MIPS " +# elif defined(FPM_SPARC) + "FPM_SPARC " +# elif defined(FPM_PPC) + "FPM_PPC " +# elif defined(FPM_DEFAULT) + "FPM_DEFAULT " +# endif + +# if defined(ASO_IMDCT) + "ASO_IMDCT " +# endif +# if defined(ASO_INTERLEAVE1) + "ASO_INTERLEAVE1 " +# endif +# if defined(ASO_INTERLEAVE2) + "ASO_INTERLEAVE2 " +# endif +# if defined(ASO_ZEROCHECK) + "ASO_ZEROCHECK " +# endif + +# if defined(OPT_SPEED) + "OPT_SPEED " +# elif defined(OPT_ACCURACY) + "OPT_ACCURACY " +# endif + +# if defined(OPT_SSO) + "OPT_SSO " +# endif + +# if defined(OPT_DCTO) /* never defined here */ + "OPT_DCTO " +# endif + +# if defined(OPT_STRICT) + "OPT_STRICT " +# endif +; diff --git a/cpymo-backends/nds/decoder/version.h b/cpymo-backends/nds/decoder/version.h new file mode 100644 index 00000000..1c14a90e --- /dev/null +++ b/cpymo-backends/nds/decoder/version.h @@ -0,0 +1,48 @@ +/* + * libmad - MPEG audio decoder library + * Copyright (C) 2000-2003 Underbit Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +# ifndef LIBMAD_VERSION_H +# define LIBMAD_VERSION_H + +#include + +# define MAD_VERSION_MAJOR 0 +# define MAD_VERSION_MINOR 15 +# define MAD_VERSION_PATCH 0 +# define MAD_VERSION_EXTRA " (beta)" + +# define MAD_VERSION_STRINGIZE(str) #str +# define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num) + +# define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ + MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ + MAD_VERSION_STRING(MAD_VERSION_PATCH) \ + MAD_VERSION_EXTRA + +# define MAD_PUBLISHYEAR "2000-2003" +# define MAD_AUTHOR "Underbit Technologies, Inc." +# define MAD_EMAIL "info@underbit.com" + +extern s8 const mad_version[]; +extern s8 const mad_copyright[]; +extern s8 const mad_author[]; +extern s8 const mad_build[]; + +# endif diff --git a/cpymo-backends/nds/licenses/Fusion-OFL.txt b/cpymo-backends/nds/licenses/Fusion-OFL.txt new file mode 100644 index 00000000..0427d1db --- /dev/null +++ b/cpymo-backends/nds/licenses/Fusion-OFL.txt @@ -0,0 +1,96 @@ +Fusion Pixel Font +https://github.com/TakWolf/fusion-pixel-font + +Copyright (c) 2022, TakWolf (https://takwolf.com). + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/cpymo-backends/nds/licenses/Fusion/LICENSES/ark-pixel/OFL.txt b/cpymo-backends/nds/licenses/Fusion/LICENSES/ark-pixel/OFL.txt new file mode 100644 index 00000000..264873a2 --- /dev/null +++ b/cpymo-backends/nds/licenses/Fusion/LICENSES/ark-pixel/OFL.txt @@ -0,0 +1,96 @@ +Ark Pixel Font +https://github.com/TakWolf/ark-pixel-font + +Copyright (c) 2021, TakWolf (https://takwolf.com). + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/cpymo-backends/nds/licenses/Fusion/LICENSES/cubic-11/OFL.txt b/cpymo-backends/nds/licenses/Fusion/LICENSES/cubic-11/OFL.txt new file mode 100644 index 00000000..4e863313 --- /dev/null +++ b/cpymo-backends/nds/licenses/Fusion/LICENSES/cubic-11/OFL.txt @@ -0,0 +1,108 @@ +[Cubic 11] +These fonts are free software. +Unlimited permission is granted to use, copy, and distribute them, with or without modification, either commercially or noncommercially. +THESE FONTS ARE PROVIDED "AS IS" WITHOUT WARRANTY. +此字型是免費的。 +無論您是否進行對本字型進行商業或非商業性修改,均可無限制地使用,複製和分發它們。 +本字型的衍生品之授權必須與此字型相同,且不作任何擔保。 +[JF Dot M+H 12] +Copyright(c) 2005 M+ FONTS PROJECT +[M+ BITMAP FONTS] +Copyright (C) 2002-2004 COZ +These fonts are free software. +Unlimited permission is granted to use, copy, and distribute it, with or without modification, either commercially and noncommercially. +THESE FONTS ARE PROVIDED "AS IS" WITHOUT WARRANTY. +これらのフォントはフリー(自由な)ソフトウエアです。 +あらゆる改変の有無に関わらず、また商業的な利用であっても、自由にご利用、複製、再配布することができますが、全て無保証とさせていただきます。 + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/cpymo-backends/nds/licenses/Fusion/LICENSES/galmuri/LICENSE.txt b/cpymo-backends/nds/licenses/Fusion/LICENSES/galmuri/LICENSE.txt new file mode 100644 index 00000000..ae34182f --- /dev/null +++ b/cpymo-backends/nds/licenses/Fusion/LICENSES/galmuri/LICENSE.txt @@ -0,0 +1,93 @@ +Copyright (c) 2019–2025 Lee Minseo (quiple@quiple.dev) + +This font software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/cpymo-backends/nds/licenses/Fusion/OFL.txt b/cpymo-backends/nds/licenses/Fusion/OFL.txt new file mode 100644 index 00000000..0427d1db --- /dev/null +++ b/cpymo-backends/nds/licenses/Fusion/OFL.txt @@ -0,0 +1,96 @@ +Fusion Pixel Font +https://github.com/TakWolf/fusion-pixel-font + +Copyright (c) 2022, TakWolf (https://takwolf.com). + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/cpymo-backends/nds/licenses/Noto-NOTICE.txt b/cpymo-backends/nds/licenses/Noto-NOTICE.txt new file mode 100644 index 00000000..febf09a2 --- /dev/null +++ b/cpymo-backends/nds/licenses/Noto-NOTICE.txt @@ -0,0 +1,6 @@ +CPyMO DS Glyphs +Raster subset derived from Noto Sans CJK SC; SIL OFL 1.1. +Source: https://github.com/notofonts/noto-cjk/tree/main/Sans/OTF/SimplifiedChinese + +Version 2.004;hotconv 1.0.118;makeotfexe 2.5.65603 +© 2014-2021 Adobe (http://www.adobe.com/). diff --git a/cpymo-backends/nds/licenses/Noto-OFL.txt b/cpymo-backends/nds/licenses/Noto-OFL.txt new file mode 100644 index 00000000..d952d62c --- /dev/null +++ b/cpymo-backends/nds/licenses/Noto-OFL.txt @@ -0,0 +1,92 @@ +This Font Software is licensed under the SIL Open Font License, +Version 1.1. + +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font +creation efforts of academic and linguistic communities, and to +provide a free and open framework in which fonts may be shared and +improved in partnership with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply to +any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software +components as distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, +deleting, or substituting -- in part or in whole -- any of the +components of the Original Version, by changing formats or by porting +the Font Software to a new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, +modify, redistribute, and sell modified and unmodified copies of the +Font Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, in +Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the +corresponding Copyright Holder. This restriction only applies to the +primary font name as presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created using +the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/cpymo-backends/nds/licenses/Unifont/COPYING b/cpymo-backends/nds/licenses/Unifont/COPYING new file mode 100644 index 00000000..d9c5a106 --- /dev/null +++ b/cpymo-backends/nds/licenses/Unifont/COPYING @@ -0,0 +1,953 @@ + +License for all non-font source code in this package: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, see . + + + +License for font/plane00/jiskan16-plane00.hex and +font/plane02/jiskan16-plane02.hex: + + These two files are in the Public Domain. They were created + from Public Domain BDF font files jiskan16-2004-1.bdf and + jiskan16-2000-2.bdf. + + +License for font files except the jiskan16 files mentioned above +are dual-licensed under the SIL Open Font License version 1.1, +and under this GNU license: + + All glyphs are released under the GNU General Public License + (GPL) version 2 or (at your option) a later version, with the + GNU font embedding exception: + + ** GPL v2.0 license with font embedding exception: + + As a special exception, if you create a document which + uses this font, and embed this font or unaltered portions + of this font into the document, this font does not by + itself cause the resulting document to be covered by + the GNU General Public License. This exception does not + however invalidate any other reasons why the document + might be covered by the GNU General Public License. + If you modify this font, you may extend this exception + to your version of the font, but you are not obligated + to do so. If you do not wish to do so, delete this + exception statement from your version. + +The SIL Open Font License is in the separate file "OFL-1.1.txt" +in the Unifont distribution, and is also available with a FAQ at +http://scripts.sil.org/OFL. The license is copied below: + + ----------------------------------------------------------- + SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 + ----------------------------------------------------------- + + PREAMBLE + The goals of the Open Font License (OFL) are to stimulate worldwide + development of collaborative font projects, to support the font creation + efforts of academic and linguistic communities, and to provide a free and + open framework in which fonts may be shared and improved in partnership + with others. + + The OFL allows the licensed fonts to be used, studied, modified and + redistributed freely as long as they are not sold by themselves. The + fonts, including any derivative works, can be bundled, embedded, + redistributed and/or sold with any software provided that any reserved + names are not used by derivative works. The fonts and derivatives, + however, cannot be released under any other type of license. The + requirement for fonts to remain under this license does not apply + to any document created using the fonts or their derivatives. + + DEFINITIONS + "Font Software" refers to the set of files released by the Copyright + Holder(s) under this license and clearly marked as such. This may + include source files, build scripts and documentation. + + "Reserved Font Name" refers to any names specified as such after the + copyright statement(s). + + "Original Version" refers to the collection of Font Software components as + distributed by the Copyright Holder(s). + + "Modified Version" refers to any derivative made by adding to, deleting, + or substituting -- in part or in whole -- any of the components of the + Original Version, by changing formats or by porting the Font Software to a + new environment. + + "Author" refers to any designer, engineer, programmer, technical + writer or other person who contributed to the Font Software. + + PERMISSION & CONDITIONS + Permission is hereby granted, free of charge, to any person obtaining + a copy of the Font Software, to use, study, copy, merge, embed, modify, + redistribute, and sell modified and unmodified copies of the Font + Software, subject to the following conditions: + + 1) Neither the Font Software nor any of its individual components, + in Original or Modified Versions, may be sold by itself. + + 2) Original or Modified Versions of the Font Software may be bundled, + redistributed and/or sold with any software, provided that each copy + contains the above copyright notice and this license. These can be + included either as stand-alone text files, human-readable headers or + in the appropriate machine-readable metadata fields within text or + binary files as long as those fields can be easily viewed by the user. + + 3) No Modified Version of the Font Software may use the Reserved Font + Name(s) unless explicit written permission is granted by the corresponding + Copyright Holder. This restriction only applies to the primary font name as + presented to the users. + + 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font + Software shall not be used to promote, endorse or advertise any + Modified Version, except to acknowledge the contribution(s) of the + Copyright Holder(s) and the Author(s) or with their explicit written + permission. + + 5) The Font Software, modified or unmodified, in part or in whole, + must be distributed entirely under this license, and must not be + distributed under any other license. The requirement for fonts to + remain under this license does not apply to any document created + using the Font Software. + + TERMINATION + This license becomes null and void if any of the above conditions are + not met. + + DISCLAIMER + THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT + OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE + COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL + DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM + OTHER DEALINGS IN THE FONT SOFTWARE. + + +============================================================================== + +License for doc/unifont.*: + + The files doc/unifont.* are released under the following terms: + + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.3 or + any later version published by the Free Software Foundation; with no + Invariant Sections, with no Front-Cover Texts and no Back-Cover Texts. + + +GPL version 2 and GFDL version 1.3 are included below. + + +============================================================================== + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see + . + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + +============================================================================== + + + GNU Free Documentation License + Version 1.3, 3 November 2008 + + + Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +0. PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +functional and useful document "free" in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. + +This License is a kind of "copyleft", which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + + +1. APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The "Document", below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as "you". You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. + +A "Modified Version" of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A "Secondary Section" is a named appendix or a front-matter section of +the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall +subject (or to related matters) and contains nothing that could fall +directly within that overall subject. (Thus, if the Document is in +part a textbook of mathematics, a Secondary Section may not explain +any mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The "Invariant Sections" are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. + +The "Cover Texts" are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. + +A "Transparent" copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not "Transparent" is called "Opaque". + +Examples of suitable formats for Transparent copies include plain +ASCII without markup, Texinfo input format, LaTeX input format, SGML +or XML using a publicly available DTD, and standard-conforming simple +HTML, PostScript or PDF designed for human modification. Examples of +transparent image formats include PNG, XCF and JPG. Opaque formats +include proprietary formats that can be read and edited only by +proprietary word processors, SGML or XML for which the DTD and/or +processing tools are not generally available, and the +machine-generated HTML, PostScript or PDF produced by some word +processors for output purposes only. + +The "Title Page" means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, "Title Page" means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. + +The "publisher" means any person or entity that distributes copies of +the Document to the public. + +A section "Entitled XYZ" means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as "Acknowledgements", +"Dedications", "Endorsements", or "History".) To "Preserve the Title" +of such a section when you modify the Document means that it remains a +section "Entitled XYZ" according to this definition. + +The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. + +2. VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no +other conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. + + +3. COPYING IN QUANTITY + +If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document's license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to +give them a chance to provide you with an updated version of the +Document. + + +4. MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +A. Use in the Title Page (and on the covers, if any) a title distinct + from that of the Document, and from those of previous versions + (which should, if there were any, be listed in the History section + of the Document). You may use the same title as a previous version + if the original publisher of that version gives permission. +B. List on the Title Page, as authors, one or more persons or entities + responsible for authorship of the modifications in the Modified + Version, together with at least five of the principal authors of the + Document (all of its principal authors, if it has fewer than five), + unless they release you from this requirement. +C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. +D. Preserve all the copyright notices of the Document. +E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. +F. Include, immediately after the copyright notices, a license notice + giving the public permission to use the Modified Version under the + terms of this License, in the form shown in the Addendum below. +G. Preserve in that license notice the full lists of Invariant Sections + and required Cover Texts given in the Document's license notice. +H. Include an unaltered copy of this License. +I. Preserve the section Entitled "History", Preserve its Title, and add + to it an item stating at least the title, year, new authors, and + publisher of the Modified Version as given on the Title Page. If + there is no section Entitled "History" in the Document, create one + stating the title, year, authors, and publisher of the Document as + given on its Title Page, then add an item describing the Modified + Version as stated in the previous sentence. +J. Preserve the network location, if any, given in the Document for + public access to a Transparent copy of the Document, and likewise + the network locations given in the Document for previous versions + it was based on. These may be placed in the "History" section. + You may omit a network location for a work that was published at + least four years before the Document itself, or if the original + publisher of the version it refers to gives permission. +K. For any section Entitled "Acknowledgements" or "Dedications", + Preserve the Title of the section, and preserve in the section all + the substance and tone of each of the contributor acknowledgements + and/or dedications given therein. +L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section titles. +M. Delete any section Entitled "Endorsements". Such a section + may not be included in the Modified Version. +N. Do not retitle any existing section to be Entitled "Endorsements" + or to conflict in title with any Invariant Section. +O. Preserve any Warranty Disclaimers. + +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section Entitled "Endorsements", provided it contains +nothing but endorsements of your Modified Version by various +parties--for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. + + +5. COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections Entitled "History" +in the various original documents, forming one section Entitled +"History"; likewise combine any sections Entitled "Acknowledgements", +and any sections Entitled "Dedications". You must delete all sections +Entitled "Endorsements". + + +6. COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other +documents released under this License, and replace the individual +copies of this License in the various documents with a single copy +that is included in the collection, provided that you follow the rules +of this License for verbatim copying of each of the documents in all +other respects. + +You may extract a single document from such a collection, and +distribute it individually under this License, provided you insert a +copy of this License into the extracted document, and follow this +License in all other respects regarding verbatim copying of that +document. + + +7. AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an "aggregate" if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation's users beyond what the individual works permit. +When the Document is included in an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document's Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. + + +8. TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. + +If a section in the Document is Entitled "Acknowledgements", +"Dedications", or "History", the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. + + +9. TERMINATION + +You may not copy, modify, sublicense, or distribute the Document +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense, or distribute it is void, and +will automatically terminate your rights under this License. + +However, if you cease all violation of this License, then your license +from a particular copyright holder is reinstated (a) provisionally, +unless and until the copyright holder explicitly and finally +terminates your license, and (b) permanently, if the copyright holder +fails to notify you of the violation by some reasonable means prior to +60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, receipt of a copy of some or all of the same material does +not give you any rights to use it. + + +10. FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions of the +GNU Free Documentation License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in +detail to address new problems or concerns. See +http://www.gnu.org/copyleft/. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License "or any later version" applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. If the Document +specifies that a proxy can decide which future versions of this +License can be used, that proxy's public statement of acceptance of a +version permanently authorizes you to choose that version for the +Document. + +11. RELICENSING + +"Massive Multiauthor Collaboration Site" (or "MMC Site") means any +World Wide Web server that publishes copyrightable works and also +provides prominent facilities for anybody to edit those works. A +public wiki that anybody can edit is an example of such a server. A +"Massive Multiauthor Collaboration" (or "MMC") contained in the site +means any set of copyrightable works thus published on the MMC site. + +"CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 +license published by Creative Commons Corporation, a not-for-profit +corporation with a principal place of business in San Francisco, +California, as well as future copyleft versions of that license +published by that same organization. + +"Incorporate" means to publish or republish a Document, in whole or in +part, as part of another Document. + +An MMC is "eligible for relicensing" if it is licensed under this +License, and if all works that were first published under this License +somewhere other than this MMC, and subsequently incorporated in whole or +in part into the MMC, (1) had no cover texts or invariant sections, and +(2) were thus incorporated prior to November 1, 2008. + +The operator of an MMC Site may republish an MMC contained in the site +under CC-BY-SA on the same site at any time before August 1, 2009, +provided the MMC is eligible for relicensing. + + +ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + + Copyright (c) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.3 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. + A copy of the license is included in the section entitled "GNU + Free Documentation License". + +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the "with...Texts." line with this: + + with the Invariant Sections being LIST THEIR TITLES, with the + Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. + +If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. + +============================================================================== + diff --git a/cpymo-backends/nds/licenses/Unifont/LICENSE.txt b/cpymo-backends/nds/licenses/Unifont/LICENSE.txt new file mode 100644 index 00000000..60be3b66 --- /dev/null +++ b/cpymo-backends/nds/licenses/Unifont/LICENSE.txt @@ -0,0 +1,476 @@ +LICENSE +------- +The source code for everything except the compiled fonts in this current +release is licensed as follows: + + License for this current distribution of program source + files (i.e., everything except the fonts) is released under + the terms of the GNU General Public License version 2, + or (at your option) a later version. + + See the section below for a copy of the GNU General Public License + version 2. + +The license for the compiled fonts is covered by the SIL Open Font License +version 1.1 and by the above GPL terms with the GNU font embedding exception, +as follows: + + As a special exception, if you create a document which uses this font, + and embed this font or unaltered portions of this font into the document, + this font does not by itself cause the resulting document to be covered + by the GNU General Public License. This exception does not however + invalidate any other reasons why the document might be covered by the + GNU General Public License. If you modify this font, you may extend + this exception to your version of the font, but you are not obligated + to do so. If you do not wish to do so, delete this exception statement + from your version. + +See "http://www.gnu.org/licenses/gpl-faq.html#FontException" and +"https://scripts.sil.org/OFL" for more details. + + +GPL VERSION 2 +------------- + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + + + +SIL Open Font License version 1.1 +--------------------------------- +Copyright (c) , (), +with Reserved Font Name . +Copyright (c) , (), +with Reserved Font Name . +Copyright (c) , (). + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + diff --git a/cpymo-backends/nds/licenses/Unifont/OFL-1.1.txt b/cpymo-backends/nds/licenses/Unifont/OFL-1.1.txt new file mode 100644 index 00000000..94339e0f --- /dev/null +++ b/cpymo-backends/nds/licenses/Unifont/OFL-1.1.txt @@ -0,0 +1,90 @@ +The SIL Open Font License version 1.1 is copied below, and is also +available with a FAQ at http://scripts.sil.org/OFL. + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/cpymo-backends/nds/licenses/Unifont/README b/cpymo-backends/nds/licenses/Unifont/README new file mode 100644 index 00000000..3c0b0d85 --- /dev/null +++ b/cpymo-backends/nds/licenses/Unifont/README @@ -0,0 +1,621 @@ + +OVERVIEW +-------- +GNU Unifont is an official GNU package. It is a dual-width +bitmap font, 16 pixels tall by 8 or 16 pixels wide. Experimental +use of 24 and 32 pixel wide glyphs is also supported by some +utility programs; consult the man pages and texinfo documentation. +Unifont is designed to provide coverage for all of Unicode Plane 0, +the Basic Multilingual Plane (BMP). + +GNU Unifont has a glyph for each visible code point in the +Unicode Basic Multilingual Plane (Plane 0) and some glyphs +in the Supplemental Multilingual Plane (Plane 1). This version +also includes many glyphs in Michael Everson's ConScript +Unicode Registry (CSUR). + +Unifont only provides a single glyph for each character, making it +impossible to handle any language properly that needs context-dependent +character shaping. It is supplied in the form of a hex file, with +a converter to convert it to BDF. See http://czyborra.com/unifont/ +or http://unifoundry.com/unifont.html for more information. The +BDF font is converted to PCF, and the hex file is converted to a +TrueType font. + +This is the unifoundry.com collection of utilities for GNU Unifont, +assembled by Paul Hardy with the encouragement of the font's creator, +Roman Czyborra. This archive contains the following directories +and files: + + ChangeLog Log of changes made to each GNU release + COPYING Full text of GPL version 2 + doc Documentation in Texinfo format + doxygen Documentation in doxygen format (html/index.html and + unifont-doxy.pdf) + font The font source file with scripts for building + hangul Standalone font sources to build hangul-syllables.hex + INSTALL Instructions for font and software installation + Makefile The "make" file + man Unix man pages + NEWS Summary of what's new with each GNU release + README This file + src Source programs, in Perl and C + +The "font/precompiled" directory contains prebuilt font-related files: + + coverage.txt Percentage coverage of Plane 0 scripts + + unifont-.hex Hex string source of glyphs to build + Unifont + unifont-.bdf.gz BDF version of Unifont + unifont-.pcf.gz PCF version of Unifont + unifont-.ttf TrueType version of Unifont + + unifont_jp-.* Version of Unifont with Japanese glyphs + mapped from Plane 1 and Plane 2 of the + JIS X 0213 standard to Unicode. The + TrueType version includes those Unicode + Plane 2 glyphs that appear in JIS X 0213. + + unifont_sample-.hex Hex string source of all Plane 0 glyphs + (except those for U+FFFE and U+FFFF), + including nonprinting and PUA glyphs, + with combining circles + unifont_sample-.bdf.gz BDF font version of the above .hex file + unifont_sample-.ttf SBIT font version of the above .hex file + + unifont_csur-.* Fonts containing Plane 0 Unifont glyphs + plus glyphs for Michael Everson's + ConScript Unicode Registry (CSUR) for + the Plane 0 Private Use Area + + unifont_upper-.* Fonts containing glyphs from Unicode + Plane 1 through Plane 14, inclusive + + unifont_upper_csur-.* Fonts containing glyphs from Unifont + Upper plus glyphs from Michael Everson's + ConScript Unicode Registry (CSUR) that + are in the Private Use Area in Plane 15 + + Unifont-APL8x16-.psf.gz Monospace console font for using APL + (GNU APL, etc.) in single-user mode. + + unifont-.bmp The entire Plane 0 Unifont font with + combining circles, built from the files + font/plane00/*.hex, showing combining + circles + +The directory that was originally named "font/hexsrc" has been renamed +to "font/plane00" now that Unifont supports glyphs beyond Plane 0. Higher +plane glyphs appear in "font/plane01" through "font/plane0F". Currently +there is no "font/plane10" directory (the highest Unicode plane is Plane 17, +or 0x10). + +This release incorporates all glyph errata issued by The Unicode Consortium +from Unicode 1.0 errata to the latest. + + +BUILDING +-------- +See the "INSTALL" file in this directory for building instructions. + + +PRIVATE USE AREA (PUA) +---------------------- +The "pua.hex" file contains a four-digit hexadecimal representation of +each code point, rendered as white on black. The new program "hexgen.c" +generated these glyphs. A four-digit hexadecimal code point is suggested +as one possible rendering of PUA glyphs in The Unicode Standard, Version +5.0, Section 5.3. Another possible rendering suggested in that same +section is a pencil glyph. A pencil glyph was used originally in Unifont +Version 5.1. + +The glyphs in "pua.hex" are not compiled into the final font. To do +so, modify font/Makefile by adding "pua.hex" to the list of hex source +files. Alternatively, someone could use their own pua.hex file for +various Private Use Area assignments. + +To use these glyphs in the PUA, use the command + + make BUILDFONT=1 PUA=plane00/pua.hex + +The glyphs in font/plane00/hangul/hangul-base.hex begin at 0xE000, +and so can also be used as PUA glyphs. To use these glyphs in the +PUA, use the command + + make BUILDFONT=1 PUA=plane00/hangul/hangul-base.hex + +The unifont_all-$(VERSION).hex will contain Unicode Plane 0 PUA +glyphs from Michael Everson's ConScript Unicode Registry (CSUR) +plus Rebecca Bettencourt's Under CSUR (UCSUR) additions. + + +src/ AUTHORS +------------ +Roman Czyborra wrote all the Perl files in the src directory except +"hex2sfd", "hexkinya", "unifontchojung", "unifontksx", "unihex2png", +and "unipng2hex". + +In the case of "johab2ucs2", Jungshik Shin wrote the orignial version; +he then gave it to Roman. Paul Hardy made further changes to "johab2ucs2". + +Roman originally named the "src/hexbraille" script as simply "braille". +Paul Hardy thought there was too great a chance of a name conflict with +other utilities, and so renamed it. + +Luis Alejandro Gonzalez Miranda wrote the original "hex2sfd" Perl +script, as well as a "howto-build.sh" shell script that Paul Hardy +converted into "./font/ttfsrc/Makefile". + +Paul Hardy wrote "unifontchojung" and "unifontksx" for extracting subsets +of Hangul glyphs, as an aid in creating a new Hangul Syllables block. + +Andrew Miller wrote "hexkinya". He also wrote "unihex2png" and "unipng2hex" +based upon Paul Hardy's "unihex2bmp" and "unibmp2hex" programs. Last but not +least, he wrote the "unifont-viewer" Perl script to graphically view a Unifont +hex file dynamically. + +David Corbett contributed the font/unipatch-hex.awk script, used +to replace glyphs in an existing Unifont .hex file with new glyphs. +This script is used to replace Chinese variation ideographs with +Japanese versions for the "unifont_jp*" font files. He also wrote +src/hexrotate to simplify rotating some glyphs such as Mongolian, +which can be written vertically or horizontally. + +Paul Hardy wrote all the C programs except for hex2otf.c, which +何志翔 (He Zhixiang) contributed. + + +Unifont AUTHORS +--------------- +Roman Czyborra created the original GNU Unifont, including the +.hex format. For greater detail, see the HISTORY section below. + +David Starner aggregated many glyphs contributed by others and +incorporated these into pre-2004 Unifont releases. + +Qianqian Fang began his Wen Quan Yi font in 2004, by which +time work on Unifont had stopped. Most of the almost 30,000 +CJK ideographs in Unifont versions 5.1 and later were taken +from Wen Quan Yi with permission of Qianqian Fang. The glyphs +in "./font/plane00/wqy-cjk.hex" are for the most part Qianqian +Fang's Unibit and Wen Quan Yi glyphs. + +Paul Hardy drew most of the newly-drawn glyphs added to the BMP +from the Unifont 5.1 release to the present release. This includes +the 11,172 glyphs in the Hangul Syllables block, plus approximately +10,000 additional glyphs scattered throughout the BMP. + +Andrew Miller drew the glyphs added to Unicode 6.3.0. + +For full details of software changes after Unicode 6.3.0, higher +Unicode planes, and the Private Use Area glyphs, etc., see the +ChangeLog file. + + +LICENSE +------- +The source code for everything except the compiled fonts in this current +release is licensed as follows: + + License for this current distribution of program source + files (i.e., everything except the fonts) is released under + the terms of the GNU General Public License version 2, + or (at your option) a later version. + +GPL version 2 is contained in the "COPYING" file in the main source +directory for this package. If your received this source without +a copy of GPL version 2, you can download a copy from GNU's website +at http://www.gnu.org/licenses/gpl-2.0.html. + +The license for the compiled fonts is covered by the above GPL terms +with the GNU font embedding exception, as follows: + + As a special exception, if you create a document which uses this font, + and embed this font or unaltered portions of this font into the document, + this font does not by itself cause the resulting document to be covered + by the GNU General Public License. This exception does not however + invalidate any other reasons why the document might be covered by the + GNU General Public License. If you modify this font, you may extend + this exception to your version of the font, but you are not obligated + to do so. If you do not wish to do so, delete this exception statement + from your version. + +See "http://www.gnu.org/licenses/gpl-faq.html#FontException" for more details. + + +CHANGES IN VERSION 6.3 +---------------------- +Version 6.3 reflects all glyph changes and errata published in Unicode +6.3.0. In preparation for releasing this version, Paul Hardy obtained +a hard copy of the errata published in Unicode Version 1.1, not yet +available on Unicode's website. All previously published errata have +been incorporated. This is a complete replacement for all previous +releases. + +The following code points in previously published errata were examined +and found to be correct: + + Unicode 1.1: U+717F, U+773E, U+809C, U+8480, U+908E + +Andrew Miller drew the 5 new additions to the Unicode 6.3.0 Basic +Multilingual Plane in the initial Unifont 6.3 release. + +The latest Unifont 6.3 release includes these glyph changes by Paul Hardy: + + - Armenian -- several glyphs were redrawn based upon feedback from + native speakers (U+0530..U+058F). + + - CJK Radicals Supplement -- several glyphs were redrawn to better match + their representations in The Unicode Standard code charts: + U+2E9F, U+2EA9, U+2EAC, U+2EAE, U+2EC0, U+2EDE, U+2EE7, and U+2EED. + + - Capricorn sign (U+2651) -- this was redrawn to an alternate form that + better fit in an 8 by 16 pixel grid. + + - Dashes -- changed to distguish better between different dash types + (a two horizontal pixel difference is the minimum to easily distinguish + a difference between two glyphs): + * Hyphen (U+002D) and Soft Hyphen (U+00AD) are now 4 pixels wide + * En Dash (U+2012) is now 6 pixels wide + * Em Dash (U+2013) is now 8 pixels wide + + - Control Pictures: + * Centered text for C1 Controls U+0089 ("HTJ"), U+0095 ("MW"), + and U+009E ("PM") + * Copied glyphs from U+0000..U+001F to U+2400..u+241F and erased + surrounding borders; earlier, some glyphs in U+0000..U+001F had + their text re-centered so this carries that change forward + + - Arrows -- General Re-alignment + * Aligned most single vertical arrow strokes with the 5th column, + counting from the left, to align with the center of the "w" glyph + (U+0077) + * Aligned most single horizontal arrow strokes with the 7th row, + counting from the bottom, to align with the horizontal stroke in + the "e" glyph (U+0065); this follows the convention of Donald Knuth's + fonts in TeX, as illustrated in The TeXbook + * Modified the following ranges per the above two re-alignments: + o U+2190..U+21FF Arrows + o U+27F0..U+27FF Supplemental Arrows -- A + o U+2900..U+297F Supplemental Arrows -- B + o U+2B00..U+2BFF Miscellaneous Symbols and Arrows + + - Modified the following additional Miscellaneous Technical glyphs + * Scan lines for old 9-line character terminals: + o U+23BA Line 1, horizontal line across row 1 (counting from the top) + o U+23BB Line 3, horizontal line across row 5 (counting from the top) + o U+23BC Line 7, horizontal line across row 12 (counting from the top) + o U+23BD Line 9, horizontal line across row 16 (counting from the top) + * U+23CE Return Symbol: shortened to match Latin capital height + * U+23AF Horizontal Line Extension: aligned on 7th row, counting + from the bottom + * U+23D0 Vertical Line Extension: aligned on 5th column, counting + from the left + * U+23DA Ground Symbol: aligned with Vertical Line Extension (U+23D0) + * U+23DB Fuse Symbol: algined with Horizontal Line Extension (U+23AF) + * U+23EC Black Down-pointing Double Triangle: moved down one row to + match Latin capital height + + - Swapped U+FE17 and U+FE18, which had been reversed + + - hangul/ directory -- updated "hangul-generation.html" to match the + latest version at http://unifoundry.com/hangul/hangul-generation.html + +Five new utility programs have also been added: + + - unifontpic - creates a bitmapped graphics (.bmp) file of the entire + Basic Multilingual Plane (Plane 0), by default in a 256-by-256 + glyph grid for ease of printing, and optionally in a 16-by-4096 glyph + grid for easier scrolling on a screen, for software that can handle + a .bmp file with over 64k pixel rows (not all software can). The + 256-by-256 glyph grid can be scaled to print on a piece of paper + approximately 3 feet by 3 feet (or one meter by one meter). Written + by Paul Hardy. + + - unigencircles - adds dashed combining circles to unifont.hex glyphs + for code points that are in "font/ttfsrc/combining.txt" but not in + "font/plane00/nonprinting.hex". Written by Paul Hardy. + + - unigenwidth - creates an implementation of the POSIX functions + wcwidth() and wcswidth() as specified in IEEE 1003.1-2008, Vol. 2: + System Interfaces, Issue 7, pages 2251 and 2241, respectively. + Plane 0 widths are determined by reading the current Unifont glyphs. + All higher planes, 0x01 through 0x10, are calculated without regard + to Unifont glyphs. This can be modified in the future if Unifont + glyphs extend beyond Plane 0. Written by Paul Hardy. + + - unihex2png - converts a unifont.hex-format file into a Portable + Network Graphics (PNG) file for editing with a wider rane of graphics + editors than the original unihex2bmp allowed. Written by Andrew + Miller, based upon the unihex2bmp source code. Introduced in + Version 6.3.20131215. + + - unipng2hex - converts a PNG graphics file created by unihex2png + back into a unifont.hex-format file. Written by Andrew Miller, + based upon the unibmp2hex source code. Introduced in Version + 6.3.20131215. + +The last two program additions, unihex2png and unipng2hex, also support +glyph heights of 24 and 32 pixels in addition to Unifont's original +height of 16 pixels. hex2bdf and hexdraw have also been modified to +support these alternate glyph heights. This capability has not been +tested extensively, and for now is considered experimental. + + +CHANGES IN VERSION 6.2 +---------------------- +After release of version 5.1 of Unifont, it was learned that the +replacement glyphs used in Hangul Syllables, although free to use, +could never be licensed under any version of GPL. For that reason, +Paul Hardy created a set of Hangul Syllables from scratch with the +oversight of some native Koreans. This was done using the files that +appear in the "hangul/" directory. For a detailed discussion of the +process, see + + http://unifoundry.com/hangul/hangul-generation.html + +The new font was released as Unifont 6.2, with representation of +all glyphs in the Unicode 6.2 BMP. As a result of replacing the +Hangul Syllables block, this was the first release that provided +GPLv2+ coverage (with a font embedding exception) for the entire +package. + +The Unicode Consortium released Unicode Version 6.2.0 on 22 April 2013. + +This version of Unifont includes all additions to the BMP since Unicode +Version 5.1, and adds 1,328 more glyphs to the Basic Multilingual Plane. + +It also incorporates all errata that the Unicode Consortium published +that apply to the BMP from Unicode 3.0 errata through Unicode 6.1 errata +(listed with the Unicode 6.2.0 release). Only one erratum was left +unmodified: the Ogham Space glyph, U+1680, which was left as a line stroke +because of the rendering limitations of the bitmapped Unifont. The errata +for the following glyphs were examined and if necessary corrected: + + Unicode 3.1: U+066B, U+224C, U+1780..U+17E9 + Unicode 3.2: [none] + Unicode 4.0: U+06DD, U+0B66 + Unicode 4.1: U+01B3, U+031A + Unicode 5.0: U+0485, U+0486, U+06E1 + Unicode 5.1: U+047C, U+047D, U+075E, U+075F, + U+1031, U+1E9A, U+1460, U+147E, + U+2626 + Unicode 5.2: U+04A8, U+04A9, U+04BE, U+04BF, + U+135F, U+19D1, U+19D2, U+19D4 + [U+1680 left as is] + Unicode 6.0: [none] + Unicode 6.1: U+2D7F + +Note that some glyphs were assigned in earlier versions of Unicode and +later withdrawn, but their glyphs still appear in the code charts. +Therefore, they have been left in place. The Unicode Consortium now +holds the position that once a glyph is assigned, it is not replaced. + +Andrew Miller noted that one glyph (U+2047) was incorrect and the glyph +CYRILLIC CAPITAL LETTER A (U+0410) did not match LATIN CAPITAL LETTER A +(U+0041). He submitted corrections and they have been incorporated. + +The biggest change was a totally redrawn set of Hangul Syllables, +U+AC00..U+D7A3, comprising 11,172 glyphs in all. This allowed the +entire font to be licensed under the GNU GPL. + +Unicode 6.2 (and hence Unifont) now only has 2,330 unassigned code points +in the BMP for possible future assignments, and the rate at which new +code points are being assigned in the BMP is decreasing greatly. + +The unihex2bmp program has reversed the meaning of its "-f" (flip, +or transpose) flag compared to Unifont Version 5.1 unihex2bmp. +Now the default behavior is to produce 16x16 glyph charts with +the same arrangement as The Unicode Standard. + +The unibmp2hex program now hard-codes several scripts and code points +to be double-width. This was necessary after removing the combining +circles from many glyphs that only occupied the left-hand side of the +16x16 grid, but combine with double-width glyphs from the rest of a +given script. + +The "blanks.hex" file has been renamed to "unassigned.hex" as a more +accurate description of its contents. The "substitutes.hex" file has +been renamed to "spaces.hex", as all it contained were single- and +double-width space glyphs (strings of 0s). + + +Roman Czyborra and Paul Hardy wanted to license this entire collection +under GPL to simplify its adoption by the GNU Project. In the end, there +was just one catch: the Hangul Syllables block that appeared in Unifont 5.1, +although licensed for free use, could not be licensed under the GPL. + +There was no suitable alternative that was covered under the GPL, so Paul +Hardy created a new block of Hangul Syllables. This took a few years of +spare time to complete. Native Koreans reviewed and critiqued the glyphs. +If anyone who is Korean would like to improve this block (U+AC00..U+D7A3), +please feel free to do so and submit the changes so they can be incorporated. + +The font has also gone through a couple of simplifications since the +release of version 5.1: + + - There is only one source file for CJK ideographs now, "wqy.hex", + acknowledging that most of these glyphs were taken from the Wen + Quan Yi distribution. + + - There are no more combining circles; these were all removed. + +The result is now there is just one variation of output font rather than +four. That one is used to generate the TrueType "unifont.ttf" font. + +The directory "font/plane00" contains the .hex input files for building +Unifont, and contains these files: + + hangul-syllables.hex Unicode Hangul Syllables, U+AC00..U+D7A3 + nonprinting.hex Format and other assigned but invisible glyphs + pua.hex Private Use Area glyphs + README The README file + spaces.hex Code points that are space glyphs + unassigned.hex Unassigned code points in the BMP + unifont-base.hex Source file with almost all BMP scripts + wqy.hex Source file with Wen Quan Yi CJK ideographs + +The file previously named "blanks.hex" is now named "unassigned.hex". +These "blank" glyphs are no longer included in the compiled font. +Although the Unicode Standard specifically allows a visual rendering +of unassigned code points, doing so would prevent a display engine +finding a glyph in another font. In fact, the original "blanks.hex" +pattern was modeled after the proposed representation of unassigned +code points depicted in The Unicode Standard, Version 5.0, Section 5.3, +Unknown and Missing Characters (p. 155). + +Incorporating "blanks.hex" (now "unassigned.hex") was invaluable in +spotting assigned code points with glyphs that had not yet been drawn. +However, now there is complete coverage of the entire BMP, with only +about 2,300 BMP code points remaining out of 65,536 that could potentially +be given assignments in the future, so the great bulk of work on the +BMP is done. + +UNIFONT VERSION 5.1 +------------------- +Paul Hardy's first release of Unifont and associated graphics utilities +was Version 5.1. This corresponded to Unicode Version 5.1 (the current +version at the time), with a glyph for every visible character in the +Unicode 5.1 Basic Multilingual Plane. + +For the Unifont 5.1 release, Paul Hardy replaced the 11,172 +thick-stroke Hangul Syllables glyphs with thin-stroke glyphs +(a desire expressed by Roman Czyborra for years), merged Qianqian +Fang's unibit and Wen Quan Yi glyphs into GNU Unifont (with lots +of help and enthusiasm from Qianqian Fang), drew about 8,500 more +glyphs to provide complete coerage of the BMP, and replaced the +existing Tibetan glyphs with new ones contributed by Rich Felker. + +There was a bug in the johab2ucs2 Perl Script that formed one range +of Hangul Syllables incorrectly in previous releases. Paul Hardy +noticed and fixed the bug for the Unifont 5.1 release. All previous +releases of Unifont have an incorrectly formed Hangul Syllables block. + +Earlier releases also had an incorrectly formed Braille glyph block. +There was a bug in the Perl script that drew the Braille glyphs in +earlier releases. Roman Czyborra made a fix to that Perl script, +named "braille" at his website (http://czyborra.com). The revised +script ("hexbraille") was included in the Unifont 5.1 release, and +used to generate the Unifont 5.1 Braille glyphs. + + +HISTORY +------- +Roman Czyborra began GNU Unifont in 1998 as a low +quality font to provide a glyph for every Unicode character in the +Basic Multilingual Plane. He realized that no one font at the time +had complete coverage of the Unicode BMP. http://czyborra.com still +has several cool tools for Unifont not included here. + +Since Roman Czyborra was unable to maintain the Unifont for a while, +and many patches existed on gnu-unifont@groups.yahoo.com +(http://groups.yahoo.com/group/gnu-unifont), David Starner + decided to make a new release extending +Unifont with many characters in 1999. That was the foundation of earlier +GNU Unifont compilations from 1999 to 2004. + +By 2004, work on Unifont had stopped. Qianqian Fang wanted to create +a high-quality Chinese Unicode font in 2004. He began by copying the +GNU Unifont glyphs. He replaced its Latin glyphs with those of another +X11 font. He replaced the existing main CJK ideographs with a higher +quality font that the People's Republic of China had placed in the public +domain. Qianqian named this new font "unibit", and released it under +the terms of the GNU General Public License (GPL) version 2, with the +exception that embedding his font in a document did not by itself bind +that document to the terms of the GNU GPL. + +See http://wqy.sourceforge.net/cgi-bin/enindex.cgi (English) or +http://wenq.org (Chinese) for more information on Wen Quan Yi. + +In late 2007, Paul Hardy became interested in adding to GNU Unifont. +He wrote a couple of programs to convert GNU Unifont .hex files to and +from bitmap images for easy editing with any graphics software. He began +by combining the latest glyphs available for GNU Unifont. This starting +point was posted at http://czyborra.com as the 2007-12-31 version of +unifont.hex. Shortly after that, Roman Czyborra's website went down. +Paul Hardy then started posting complete copies of GNU Unifont on his +website, at "http://unifoundry.com/unifont.html". + +Roman Czyborra encouraged Paul Hardy to continue this work on GNU Unifont. + +In early 2008, Paul Hardy learned of Qianqian Fang's work. Qianqian +encouraged a combining of effort, and Paul Hardy at that point created +two versions of GNU Unifont: one with the original Chinese ideographs +(which Roman Czyborra copied from a Japanese font in the public domain), +and one with Qianqian Fang's Wen Quan Yi (Spring of Letters) ideographs. +The Wen Quan Yi font provides far more coverage of CJK ideographs than +the original Japanese font did, and is of higher quality. + +Paul Hardy created a version of both the font with the original CJK +ideographs from Japan and with CJK ideographs from Wen Quan Yi that +contained combining circles. He then wrote a post-processing program +to remove the combining circles from the final font. + +In 2005, Luis Alejandro Gonzalez Miranda (http://www.lgm.cl) created +a set of Fontforge scripts and Perl programs to build a TrueType font +from unifont.hex. Paul Hardy modified Luis' software in 2008 to cover +the full Unicode 5.1 Basic Multilingual Plane range. Luis gave Paul +Hardy permission to release this modified version under the terms of +"the GNU General Public License, version 2 or (at your option) a later +version." + +On 4 July 2008, Paul Hardy was looking through all of Roman Czyborra's +Perl scripts. One of these, "braille", contained a comment from 2003 +that the original GNU Unifont did not generate its Braille patterns +(U+2800..U+28FF) correctly. The modified script fixed that bug. Paul +Hardy incorporated the corrected Braille glyphs into the 6 July 2008 +release of GNU Unifont. + +All previous versions probably contain this Braille bug and should be +replaced. + +Other notable additions include: + + - Incorporation of CJK glyphs from Qianqian Fang's fonts + + - Incorporation of Rich Felker's Tibetan glyphs + + - Replacement of the Hangul Syllables block with a thin stroke font + (Roman had mentioned wanting to do this someday on his website), + the current version being created from scratch by Paul Hardy + + - Addition of circled pencil glyphs for the Private Use Area + (suggested as an acceptable rendering in the Unicode 5.0 Standard), + now replaced with optional four-digit hexadecimal code point glyphs; + thought not built into the final font by default, they are available + in "font/plane00/pua.hex" + + - Replacement of the Unifont 5.1 gray box glyphs for unassigned + code points with four-digit hexadecimal glyphs; these are built + into the final font by default + + - Proper handling of combining characters in the TrueType version + + - Proper handling of space glyphs in the TrueType version + +The hex2bdf script in this release is Roman's original script, not the +modified version that produced two BDF files (one for 8 pixel wide glyphs +and another for 16 pixel wide glyphs). The TrueType font should be used +in preference to the BDF font, so this is probably a moot point. + +For the Unifont 6.2 release, Qianqian Fang gave Paul Hardy permission +to release the subset of Wen Quan Yi glyphs included in Unifont under +GPLv2+, with a font embedding exception. With the newly-drawn Hangul +Syllables block, this allowed the entire font to be released under +GPLv2+ with a font embedding exception. + + +OPEN ISSUES +----------- +* Some CJK ideographs use an entire 16x16 pixel grid. This leaves +insufficient space between lines. However, changing to a non-square +grid would distort the block drawing glyphs. The best solution is +probably to use GNU Unifont for mostly non-CJK glyph rendering, and +to use Qianqian Fang's Wen Quan Yi fonts (http://wenq.org) for +predominately CJK glyph rendering. The Wen Quan Yi fonts use extra +leading (blank space) between lines. + +* There are still some Control and Format glyphs in "unifont-base.hex"; +these might be more appropriate for "nonprinting.hex". + diff --git a/cpymo-backends/nds/licenses/Unifont/font-plane00-README b/cpymo-backends/nds/licenses/Unifont/font-plane00-README new file mode 100644 index 00000000..74d0ec91 --- /dev/null +++ b/cpymo-backends/nds/licenses/Unifont/font-plane00-README @@ -0,0 +1,106 @@ +The Unicode Basic Multilingual Plane consists of 2^16 = 65,536 code points. +Of this number, 2,048 are the Surrogate Pairs, from U+D800..U+DFFF. This +leaves 65,536 - 2,048 = 63,488 code points. + +==> The total number of lines in the files below should be 63,488 <== + + hangul-syllables.hex + omit.hex + plane00-nonprinting.hex + plane00-unassigned.hex + pua.hex + spaces.hex + unifont-base.hex + wqy.hex + +The file copyleft.hex contains the Copyleft symbol, which is in the +Supplemental Multilingual Plane (Plane 1); it is added to the TrueType +version of Unifont (even though it lies above Plane 0) because of its +significance. + +The file custom00.hex is empty, so it has zero lines. + +The file izmg16-plane00.hex contains Japanese versions of glyphs in +Plane 0 that replace glyphs in corresponding code points in the default +Unifont build. As of Unicode 12.1.04, this contains 9,880 glyphs. +This number is not expected to change. See the end of this document +for further discussion of this file. + +The number of lines in a .hex file (or any other plain text file) can be +conveniently determined in this directory with + + wc -l *.hex + +The last line will be a grand total. + +Here is the output of "wc -l *.hex" with the Unifont 17.0.04 glyph files: + + 1 copyleft.hex + 0 custom00.hex + 11172 hangul-syllables.hex + 9968 izmg16-plane00.hex + 2 omit.hex + 92 plane00-nonprinting.hex + 1336 plane00-unassigned.hex + 6400 pua.hex + 17 spaces.hex + 28142 t-source.hex + 16671 unifont-base.hex + 27798 wqy.hex + ------ + 101599 total + +This makes a total of 101,599 lines in all *.hex files in this directory +as of Unifont 17.0.04. + +Subtracting the duplicate code points that exist in izmg16-plane00.hex, +t-source.hex, and the one Plane 1 glyph in copyleft.hex, the total +non-duplicate Plane 0 code points amount to 63,488 glyphs. That subtotal +should remain constant for Plane 0, as described at the beginning of +this document. + +If there are any duplicates, most likely these will be from new +glyphs being added to unifont-base.hex that were not removed from +plane00-unassigned.hex. A simple comparison using unidup will +show this: + + sort *.hex | unidup + +If there are duplicate code points, unidup will print them. + +Note that plane00-nonprinting.hex, pua.hex, and plane00-unassigned.hex +might not be included in the final generated unifont.hex file. If desired, +they can all be added by modifying the make file one level above this +directory (modify the UNIFILES definition in ../Makefile) or with +the call to "make" in the top-level directory with a command such as: + + make UNASSIGNED="plane00/unassigned.hex" PUA="plane00/pua.hex" + + +Historical Note on wqy.hex +-------------------------- +The file "wqy.hex" includes glyphs from the BDF version of Wen Quan Yi +in the range U+4E00..U+9FA5. That is the CJK Unified Ideographs script +range that was introduced in Unicode 1.0. In March 2005, The Unicode +Consortium released Unicode 4.1.0, which added 22 new glyphs to that +script in the range U+9FA6..U+9FBB. Those glyphs were added to Unifont +in February 2008 during the effort to attain complete Unicode 5.1 Basic +Multilingual Plane coverage. Any additional glyphs added to that Unicode +script in Unifont continue to be added to wqy.hex even though they were +not part of the original Wen Quan Yi font. This allows keeping the whole +CJK Unified Ideographs script in one file. + + +Note on izmg16-plane00.hex +---------------------------- +The file "izmg16-plane00.hex" contains glyphs from the public +domain Izumi BDF font, downloadable at + + http://unifoundry.com/japanese/index.html + +That BDF font contains glyphs for the JIS X 0213:2004 Japanese +standard, and replaces glyphs in the rest of Unifont to produce +the Japanese version, unifont_jp. + + +Paul Hardy, 2014, 2016, 2018, 2019, 2020 diff --git a/cpymo-backends/nds/licenses/calico-COPYING b/cpymo-backends/nds/licenses/calico-COPYING new file mode 100644 index 00000000..41ed3d2b --- /dev/null +++ b/cpymo-backends/nds/licenses/calico-COPYING @@ -0,0 +1,47 @@ +Zope Public License (ZPL) Version 2.1 + +A copyright notice accompanies this license document that identifies +the copyright holders. + +This license has been certified as open source. It has also been +designated as GPL compatible by the Free Software Foundation (FSF). + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + 1. Redistributions in source code must retain the accompanying + copyright notice, this list of conditions, and the following + disclaimer. + + 2. Redistributions in binary form must reproduce the accompanying + copyright notice, this list of conditions, and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + 3. Names of the copyright holders must not be used to endorse or + promote products derived from this software without prior written + permission from the copyright holders. + + 4. The right to distribute this software or to use it for any purpose + does not give you the right to use Servicemarks (sm) or Trademarks + (tm) of the copyright holders. Use of them is covered by separate + agreement with the copyright holders. + + 5. If any files are modified, you must cause the modified files to + carry prominent notices stating that you changed the files and the + date of any change. + +Disclaimer + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/cpymo-backends/nds/licenses/libdvm-COPYING b/cpymo-backends/nds/licenses/libdvm-COPYING new file mode 100644 index 00000000..41ed3d2b --- /dev/null +++ b/cpymo-backends/nds/licenses/libdvm-COPYING @@ -0,0 +1,47 @@ +Zope Public License (ZPL) Version 2.1 + +A copyright notice accompanies this license document that identifies +the copyright holders. + +This license has been certified as open source. It has also been +designated as GPL compatible by the Free Software Foundation (FSF). + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + 1. Redistributions in source code must retain the accompanying + copyright notice, this list of conditions, and the following + disclaimer. + + 2. Redistributions in binary form must reproduce the accompanying + copyright notice, this list of conditions, and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + 3. Names of the copyright holders must not be used to endorse or + promote products derived from this software without prior written + permission from the copyright holders. + + 4. The right to distribute this software or to use it for any purpose + does not give you the right to use Servicemarks (sm) or Trademarks + (tm) of the copyright holders. Use of them is covered by separate + agreement with the copyright holders. + + 5. If any files are modified, you must cause the modified files to + carry prominent notices stating that you changed the files and the + date of any change. + +Disclaimer + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/cpymo-backends/nds/licenses/libnds-LICENSE.txt b/cpymo-backends/nds/licenses/libnds-LICENSE.txt new file mode 100644 index 00000000..199dedad --- /dev/null +++ b/cpymo-backends/nds/licenses/libnds-LICENSE.txt @@ -0,0 +1,22 @@ + Copyright (C) 2005 - 2024 + Michael Noland (joat) + Jason Rogers (dovoto) + Dave Murphy (WinterMute) + fincs + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any + damages arising from the use of this software. + + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and + redistribute it freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you + must not claim that you wrote the original software. If you use + this software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and + must not be misrepresented as being the original software. + 3. This notice may not be removed or altered from any source + distribution. diff --git a/cpymo-backends/nds/licenses/maxmod-LICENSE b/cpymo-backends/nds/licenses/maxmod-LICENSE new file mode 100644 index 00000000..265395b6 --- /dev/null +++ b/cpymo-backends/nds/licenses/maxmod-LICENSE @@ -0,0 +1,23 @@ +/**************************************************************************** + * __ * + * ____ ___ ____ __ ______ ___ ____ ____/ / * + * / __ `__ \/ __ `/ |/ / __ `__ \/ __ \/ __ / * + * / / / / / / /_/ /> > 1) ^ (0xA001 if crc & 1 else 0) + return crc + + +def _load_banner(file): + file.seek(0,2) + length=file.tell() + if length<0x200: + raise ValueError("NDS ROM missing full header") + file.seek(0x68) + location=struct.unpack("length: + raise ValueError("NDS banner offset exceeds ROM boundaries") + file.seek(location) + banner=bytearray(file.read(BANNER_BYTES)) + if len(banner)!=BANNER_BYTES or struct.unpack_from("TITLE_SLOT_BYTES-2: + raise ValueError("Combined banner lines exceed 127 UTF-16 characters") + return encoded+b"\x00"*(TITLE_SLOT_BYTES-len(encoded)) + + +def read_nds_banner_titles(path): + with Path(path).open("rb") as f: + _,banner=_load_banner(f) + out=[] + for i in range(LANGUAGE_COUNT): + start=TITLE_START+i*TITLE_SLOT_BYTES + slot=banner[start:start+TITLE_SLOT_BYTES].decode("utf-16le") + out.append(slot.split("\x00",1)[0].split("\n")) + return out + + +def patch_nds_banner_titles(path,lines): + new_title=_encode_titles(lines) + with Path(path).open("r+b") as f: + location,banner=_load_banner(f) + for i in range(LANGUAGE_COUNT): + start=TITLE_START+i*TITLE_SLOT_BYTES + banner[start:start+TITLE_SLOT_BYTES]=new_title + struct.pack_into("4096?4096:n;n-=k;while(k--){a+=*p++;b+=a;}a%=65521;b%=65521;}return (b<<16)|a; +} +static int alias_find(const Audio* a,const unsigned char key[17]){ + unsigned lo=0,hi=a->alias_count;while(loaliases+mid*33,17);if(!d)return mid;if(d<0)hi=mid;else lo=mid+1;}return -1; +} +static error_t load_aliases(Audio* a,const char* dir){ + if(a->alias_checked)return a->alias_error; + a->alias_checked=true;alias_state[1]++;char path[512];snprintf(path,sizeof path,"%s/nds-cache/audio-aliases.bin",dir);FILE* f=fopen(path,"rb"); + if(!f){if(errno==ENOENT)return CPYMO_ERR_SUCC;goto bad;} + unsigned char h[12];if(fread(h,1,12,f)!=12||memcmp(h,"NAD1",4))goto close_bad; + unsigned n=h[4]|((unsigned)h[5]<<8)|((unsigned)h[6]<<16)|((unsigned)h[7]<<24);uint32_t check=h[8]|((uint32_t)h[9]<<8)|((uint32_t)h[10]<<16)|((uint32_t)h[11]<<24); + if(!n||n>1024)goto close_bad; + a->aliases=malloc(n*33);if(!a->aliases){fclose(f);a->alias_error=CPYMO_ERR_OUT_OF_MEM;return a->alias_error;} + if(fread(a->aliases,33,n,f)!=n||fgetc(f)!=EOF||ferror(f)||alias_checksum(a->aliases,n*33)!=check)goto close_bad; + a->alias_count=n; + for(unsigned i=0;ialiases+i*33;if(row[0]<'0'||row[0]>'2'||!memcmp(row+1,row+17,16)||(i&&memcmp(row-33,row,17)>=0))goto close_bad; + for(unsigned j=1;j<33;j++)if(!((row[j]>='0'&&row[j]<='9')||(row[j]>='a'&&row[j]<='f')))goto close_bad; + unsigned char target[17];target[0]=row[0];memcpy(target+1,row+17,16);if(alias_find(a,target)>=0)goto close_bad; + } + fclose(f);alias_state[2]+=n;alias_state[5]=n*33;return CPYMO_ERR_SUCC; +close_bad:fclose(f);free(a->aliases);a->aliases=NULL;a->alias_count=0; +bad:alias_state[4]++;engine_state[19]++;a->alias_error=CPYMO_ERR_BAD_FILE_FORMAT;return a->alias_error; +} +static void audio_cache_path(char* out,unsigned cap,const char* dir,const char* folder,cpymo_str name,const char* ext,Audio* a,unsigned id){ + nds_cache_path(out,cap,dir,folder,name,ext);if(!a->alias_count)return; + char* tail=strrchr(out,'/');if(!tail||strlen(++tail)<16)return; + unsigned char key[17];key[0]='0'+id;memcpy(key+1,tail,16);int index=alias_find(a,key); + if(index>=0){char canonical[17];memcpy(canonical,a->aliases+index*33+17,16);canonical[16]=0;nds_cache_hash_path(out,cap,dir,folder,canonical,ext);alias_state[3]++;}else alias_state[6]++; +} diff --git a/cpymo-backends/nds/source/audio-gain-nds.h b/cpymo-backends/nds/source/audio-gain-nds.h new file mode 100644 index 00000000..6a2fa290 --- /dev/null +++ b/cpymo-backends/nds/source/audio-gain-nds.h @@ -0,0 +1,61 @@ +/* CPyMO NDS 1.2.1 test3: low-overhead, integer-only master loudness guard. + * + * A restrained +1.50 dB target is applied only while the mixed signal has + * enough headroom. Peaks are inspected before writing each 64-sample block; + * gain attacks immediately to prevent digital clipping and recovers over + * roughly one second, rather than abruptly amplifying a loud transient. + * + * No float, heap allocation, sound-hardware overdrive, or game settings. + * This is intentionally compatible with both MP3 and cached PCM paths. + */ +#ifndef CPYMO_NDS_AUDIO_GAIN_H +#define CPYMO_NDS_AUDIO_GAIN_H +#include +#define NDS_AUDIO_GAIN_Q12_ONE 4096 +#define NDS_AUDIO_GAIN_Q12_TARGET 4868 /* 1.50 dB */ +#define NDS_AUDIO_GAIN_PCM_CEILING 32760 +#define NDS_AUDIO_GAIN_RELEASE_PER_64 8 +typedef struct { + int gain_q12; + uint32_t samples; + uint32_t limited_blocks; + uint32_t preexisting_over_blocks; + uint32_t max_input_peak; +} NdsAudioGain; +static inline void nds_audio_gain_reset(NdsAudioGain* s){ + *s=(NdsAudioGain){NDS_AUDIO_GAIN_Q12_TARGET,0,0,0,0}; +} +static inline void nds_audio_gain_write( + int16_t* dest,const int32_t* mixed,unsigned count,NdsAudioGain* state){ + if(!count)return; + /* All input samples come from at most three signed 16-bit sources: + maximum 98304, safe for the signed 32-bit fixed-point calculation. */ + int32_t peak=0; + for(unsigned i=0;ipeak)peak=m; + } + if((uint32_t)peak>state->max_input_peak)state->max_input_peak=(uint32_t)peak; + if(peak>32767)state->preexisting_over_blocks++; + int target=NDS_AUDIO_GAIN_Q12_TARGET; + if(peak && peak*NDS_AUDIO_GAIN_Q12_TARGET> + NDS_AUDIO_GAIN_PCM_CEILING*NDS_AUDIO_GAIN_Q12_ONE){ + target=(NDS_AUDIO_GAIN_PCM_CEILING*NDS_AUDIO_GAIN_Q12_ONE)/peak; + state->limited_blocks++; + } + if(targetgain_q12)state->gain_q12=target; /* instant attack */ + else if(target>state->gain_q12){ + int step=(int)((count*NDS_AUDIO_GAIN_RELEASE_PER_64+63)/64); + if(step<1)step=1; + if(step>target-state->gain_q12)step=target-state->gain_q12; + state->gain_q12+=step; /* slow release, never above the safe target */ + } + for(unsigned i=0;igain_q12)/NDS_AUDIO_GAIN_Q12_ONE; + if(v>NDS_AUDIO_GAIN_PCM_CEILING)v=NDS_AUDIO_GAIN_PCM_CEILING; + if(v< -NDS_AUDIO_GAIN_PCM_CEILING)v=-NDS_AUDIO_GAIN_PCM_CEILING; + dest[i]=(int16_t)v; + } + state->samples+=count; +} +#endif diff --git a/cpymo-backends/nds/source/audio-nds.c b/cpymo-backends/nds/source/audio-nds.c new file mode 100644 index 00000000..7117c177 --- /dev/null +++ b/cpymo-backends/nds/source/audio-nds.c @@ -0,0 +1,258 @@ +#include +#include +#include +#include +#include +#include "cpymo_engine.h" +#include "cpymo_audio.h" +#include "config.h" +#include "global.h" +#include "fixed.h" +#include "bit.h" +#include "timer.h" +#include "stream.h" +#include "frame.h" +#include "synth.h" +#include "cache-nds.h" +#include +#include "audio-gain-nds.h" +extern volatile unsigned engine_state[46]; +extern volatile unsigned vblank_count; +typedef struct {struct mad_stream stream;struct mad_frame frame;struct mad_synth synth;unsigned char input[8192+MAD_BUFFER_GUARD];unsigned used;bool padded;} MP3; +#include "nar-reader.h" +typedef struct {unsigned total,left;bool modern;unsigned char input[2048];} NAR; +volatile unsigned audio_state[12]={0x4e415235}; +volatile unsigned audio_bench[12]={0x4e415235}; +typedef struct {NAR* nar;FILE* file;bool loop;int volume;char name[64];s16 cache[1152];unsigned pos,count;unsigned offset,length,remaining,rate,phase;MP3* mp3;} Channel; +typedef struct {Channel ch[3];int nar_policy;unsigned char* aliases;unsigned alias_count;bool alias_checked;error_t alias_error;} Audio; +static Audio* active; +static NdsAudioGain nds_gain; +#include "audio-aliases.h" +/* Optional delivered-PCM verification, disabled in normal/performance runs. */ +volatile unsigned movie_audio_check[8]={0x4d414331};static bool movie_verify; +void nds_movie_audio_verify(bool enabled){movie_verify=enabled;for(unsigned i=1;i<8;i++)movie_audio_check[i]=0;movie_audio_check[2]=1;} +extern volatile unsigned movie_state[24];static FILE* movie_audio;static unsigned movie_remaining;static Channel* movie_channel; + +/* In-memory diagnostic ring, no filesystem writes from the audio service. */ +volatile unsigned audio_trace[4+128*8]={0x47545237}; +static unsigned last_service_us,last_service_pc; +static u64 last_audio_tick; +static unsigned last_audio_vblank; +static bool audio_suspended; +extern volatile unsigned sleep_state[12]; +extern void nds_mm_stream_suspend(void); +extern void nds_mm_stream_resume(void); +static void stop(Channel* c){free(c->nar);c->nar=NULL;if(c->file)fclose(c->file);if(c->mp3){mad_synth_finish(&c->mp3->synth);mad_frame_finish(&c->mp3->frame);mad_stream_finish(&c->mp3->stream);free(c->mp3);}c->mp3=NULL;c->file=NULL;c->pos=c->count=0;c->name[0]=0;} +static bool refill_mp3(Channel* c){ + MP3* d=c->mp3;unsigned keep=0; + if(d->stream.next_frame&&d->stream.next_frame>=d->input&&d->stream.next_frame<=d->input+d->used){keep=d->input+d->used-d->stream.next_frame;memmove(d->input,d->stream.next_frame,keep);} + unsigned need=8192-keep;if(need>c->remaining)need=c->remaining; + unsigned n=fread(d->input+keep,1,need,c->file);c->remaining-=n; + if(n!=need){engine_state[19]++;return false;} + d->used=keep+n; + if(!c->remaining){if(d->padded)return false;memset(d->input+d->used,0,MAD_BUFFER_GUARD);d->used+=MAD_BUFFER_GUARD;d->padded=true;} + mad_stream_buffer(&d->stream,d->input,d->used);return d->used>0; +} +static s16 pcm16(mad_fixed_t s){s+=1L<<(MAD_F_FRACBITS-16);if(s>=MAD_F_ONE)s=MAD_F_ONE-1;if(s< -MAD_F_ONE)s=-MAD_F_ONE;return s>>(MAD_F_FRACBITS+1-16);} +static bool decode_mp3(Channel* c){ + MP3* d=c->mp3; + unsigned started=vblank_count; + u64 started_tick=tickGetCount(); + for(unsigned tries=0;tries<4096;tries++){ + if(!d->stream.buffer||d->stream.error==MAD_ERROR_BUFLEN){if(!refill_mp3(c)){ + if(!c->loop)return false; + if(fseek(c->file,c->offset,SEEK_SET))return false; + c->remaining=c->length;mad_stream_finish(&d->stream);mad_stream_init(&d->stream);d->used=0;d->padded=false;mad_frame_mute(&d->frame);mad_synth_mute(&d->synth);continue; + }} + if(mad_frame_decode(&d->frame,&d->stream)==-1){if(d->stream.error==MAD_ERROR_BUFLEN||MAD_RECOVERABLE(d->stream.error))continue;engine_state[19]++;return false;} + // Use libmad's half-rate synthesis for high-rate sources; no offline conversion. + if(d->frame.header.samplerate>=32000)d->frame.options|=MAD_OPTION_HALFSAMPLERATE; + mad_synth_frame(&d->synth,&d->frame);c->count=d->synth.pcm.length;c->pos=0;c->rate=d->synth.pcm.samplerate; + for(unsigned i=0;icount;i++){mad_fixed_t s=d->synth.pcm.samples[0][i];if(d->synth.pcm.channels==2)s=(s/2)+(d->synth.pcm.samples[1][i]/2);c->cache[i]=pcm16(s);} + engine_state[21]++;unsigned took=vblank_count-started;if(took>engine_state[24])engine_state[24]=took; + unsigned us=(tickGetCount()-started_tick)*1000000/TICK_FREQ;if(us>engine_state[26])engine_state[26]=us; + return c->count>0; + } + engine_state[19]++;return false; +} +static unsigned refill_pcm(Channel* c){ + if(!c->nar)return fread(c->cache,sizeof(s16),1024,c->file); + NAR* d=c->nar; + if(!d->left){if(!c->loop||!d->total)return 0;if(fseek(c->file,16,SEEK_SET))goto bad;d->left=d->total;audio_state[9]++;} + unsigned char h[12];u64 start=tickGetCount();if(fread(h,1,12,c->file)!=12)goto bad; + unsigned size=h[0]|(h[1]<<8),n=h[2]|(h[3]<<8),order=h[4],k=h[5];uint32_t check=h[8]|((uint32_t)h[9]<<8)|((uint32_t)h[10]<<16)|((uint32_t)h[11]<<24); + if(n!=(d->left>1024?1024:d->left)||!size||size>n*2||h[6]||h[7]||fread(d->input,1,size,c->file)!=size)goto bad; + audio_state[2]+=(tickGetCount()-start)*1000000/TICK_FREQ;start=tickGetCount(); + if((!d->modern&&order>=16&&order!=255)||!nar_decode(d->input,size,c->cache,n,order,k)||nar_checksum((unsigned char*)c->cache,n*2)!=check)goto bad; + unsigned us=(tickGetCount()-start)*1000000/TICK_FREQ;audio_state[1]++;audio_state[3]+=us;if(us>audio_state[4])audio_state[4]=us;audio_state[5]+=size+12;audio_state[6]+=n*2; + d->left-=n;if(!d->left&&!c->loop)audio_state[10]++;if(!d->left&&(fgetc(c->file)!=EOF||ferror(c->file)))goto bad;return n; +bad:audio_state[7]++;engine_state[19]++;return 0; +} +static int next(Channel* c){ + if(!c->file)return 0; + if(c->mp3){ + if(c->pos>=c->count&&!decode_mp3(c)){stop(c);return 0;} + int sample=c->cache[c->pos]*c->volume/256;c->phase+=c->rate; + while(c->phase>=22050){c->phase-=22050;++c->pos;if(c->pos>=c->count&&!decode_mp3(c)){stop(c);break;}} + return sample; + } + if(c->pos==c->count){ + c->count=refill_pcm(c);c->pos=0; + if(!c->count&&c->loop&&!c->nar){rewind(c->file);c->count=fread(c->cache,sizeof(s16),1024,c->file);} + if(!c->count){if(ferror(c->file))engine_state[19]++;stop(c);return 0;} + } + return c->cache[c->pos++]*c->volume/256; +} +static mm_word refill(mm_word length,mm_addr dest,mm_stream_formats format){ + (void)format;s16* out=dest;engine_state[17]++; + if(movie_audio){unsigned want=length;if(want>movie_remaining)want=movie_remaining;unsigned got=0; + if(movie_channel){while(gotpos==c->count){c->count=refill_pcm(c);c->pos=0;if(!c->count)break;}unsigned n=c->count-c->pos;if(n>want-got)n=want-got;memcpy(out+got,c->cache+c->pos,n*2);c->pos+=n;got+=n;}} + else got=fread(out,2,want,movie_audio);if(movie_verify&&got){unsigned c=nar_checksum((unsigned char*)out,got*2),a=movie_audio_check[2],b=movie_audio_check[3];movie_audio_check[1]+=got;movie_audio_check[2]=(a+(c&65535)-1)%65521;movie_audio_check[3]=(b+(c>>16)+got*2*(a-1))%65521;} + if(got!=want){movie_state[7]++;movie_audio_check[4]++;movie_remaining=0;}else movie_remaining-=got; + for(unsigned i=0;i64)batch=64; + int32_t raw[64];for(unsigned i=0;ich[c].mp3)pcm_only=false; + if(!pcm_only){ + for(unsigned done=0;done64)batch=64; + int32_t mixed[64]; + for(unsigned i=0;ich[c]); + mixed[i]=sample; + } + nds_audio_gain_write(out+done,mixed,batch,&nds_gain); + for(unsigned i=0;i64)batch=64;int32_t mixed[64]={0}; + for(unsigned channel=0;channel<3;channel++){ + Channel* c=&active->ch[channel];unsigned pos=0; + while(posfile){ + if(c->pos==c->count){c->count=refill_pcm(c);c->pos=0; + if(!c->count&&c->loop&&!c->nar){rewind(c->file);c->count=fread(c->cache,sizeof(s16),1024,c->file);} + if(!c->count){if(ferror(c->file))engine_state[19]++;stop(c);break;} + } + unsigned count=c->count-c->pos;if(count>batch-pos)count=batch-pos; + for(unsigned i=0;icache[c->pos+i]*c->volume/256; + c->pos+=count;pos+=count; + } + } + nds_audio_gain_write(out+done,mixed,batch,&nds_gain); + for(unsigned i=0;inar=calloc(1,sizeof *c->nar);if(!c->nar){free(c);fclose(f);return false;} + c->file=f;c->nar->total=c->nar->left=samples;c->nar->modern=true; + } + movie_audio_check[5]=compressed;mmStreamClose();movie_channel=c;movie_audio=f;movie_remaining=samples;nds_audio_gain_reset(&nds_gain);movie_stream(4096);return true; +} +bool nds_movie_audio_begin(const char* path,unsigned offset,unsigned samples){return movie_audio_begin(path,offset,samples,false);} +bool nds_movie_audio_begin_nar(const char* path,unsigned offset,unsigned samples){return movie_audio_begin(path,offset,samples,true);} +unsigned nds_movie_audio_position(void){return mmStreamGetPosition();} +void nds_movie_audio_end(void){if(!movie_audio)return;mmStreamClose();if(movie_channel){stop(movie_channel);free(movie_channel);movie_channel=NULL;}else fclose(movie_audio);movie_audio=NULL;nds_audio_gain_reset(&nds_gain);movie_stream(nds_cache_enabled?4096:2048);} +void cpymo_audio_init(cpymo_audio_system* s){ + Audio* a=calloc(1,sizeof *a);*s=a;active=a;if(a)a->nar_policy=-2;last_audio_tick=tickGetCount();nds_audio_gain_reset(&nds_gain);if(!a)return; + for(unsigned c=0;c<3;++c)a->ch[c].volume=256; + mm_ds_system sys={0};mmInit(&sys); + mm_stream stream={0};stream.sampling_rate=22050;stream.buffer_length=nds_cache_enabled?4096:2048;stream.callback=refill;stream.format=MM_STREAM_16BIT_MONO;stream.timer=MM_TIMER0;stream.manual=true; + mmStreamOpen(&stream);engine_state[15]=1; +} +void nds_audio_update(void){if(active&&!audio_suspended){u64 started_tick=tickGetCount();bool playing=active->ch[0].file||active->ch[1].file||active->ch[2].file;if(playing&&last_audio_tick){unsigned gap=(started_tick-last_audio_tick)*1000000/TICK_FREQ;if(gap>engine_state[28])engine_state[28]=gap;if(gap>=30000){unsigned seq=audio_trace[1]++,i=4+(seq%128)*8;audio_trace[i]=seq;audio_trace[i+1]=gap;audio_trace[i+2]=last_service_us;audio_trace[i+3]=last_service_pc;audio_trace[i+4]=(unsigned)__builtin_return_address(0);audio_trace[i+5]=engine_state[14];audio_trace[i+6]=vblank_count;audio_trace[i+7]=audio_state[1];if(gap>audio_trace[2])audio_trace[2]=gap;}}last_audio_tick=started_tick;unsigned started=vblank_count;mmStreamUpdate();unsigned took=vblank_count-started;if(took>engine_state[25])engine_state[25]=took;unsigned us=(tickGetCount()-started_tick)*1000000/TICK_FREQ;if(us>engine_state[27])engine_state[27]=us;last_service_us=us;last_service_pc=(unsigned)__builtin_return_address(0);last_audio_vblank=vblank_count;}} +void nds_audio_suspend(void){ + if(!active||audio_suspended)return; + nds_audio_update();sleep_state[7]=mmStreamGetPosition(); + nds_mm_stream_suspend();soundSetMixerVolume(0);soundSynchronize();audio_suspended=true; + sleep_state[5]++;sleep_state[8]=0;for(unsigned c=0;c<3;c++)if(active->ch[c].file)sleep_state[8]++; +} +void nds_audio_resume(void){ + if(!active||!audio_suspended)return; + sleep_state[9]=210;nds_mm_stream_resume();sleep_state[9]=220;soundSetMixerVolume(127);sleep_state[9]=230;soundSynchronize();sleep_state[9]=240;audio_suspended=false; + last_audio_tick=tickGetCount();last_audio_vblank=vblank_count;sleep_state[6]++;sleep_state[9]=0; +} +/* A cheap display-tick guard: no clock read or mixer call for every row. */ +void nds_audio_pump_if_due(void){if(active&&vblank_count!=last_audio_vblank){nds_audio_update();last_audio_vblank=vblank_count;}} +void cpymo_audio_free(cpymo_audio_system* s){Audio* a=*s;if(a){mmStreamClose();for(unsigned c=0;c<3;++c)stop(&a->ch[c]);free(a->aliases);free(a);}if(active==a)active=NULL;*s=NULL;} +bool cpymo_audio_enabled(cpymo_engine* e){return e->audio!=NULL;} +float cpymo_audio_get_channel_volume(size_t c,const cpymo_audio_system* s){return *s?((Audio*)*s)->ch[c].volume/256.f:0;} +void cpymo_audio_set_channel_volume(size_t c,cpymo_audio_system* s,float v){if(v<0)v=0;if(v>1)v=1;if(*s)((Audio*)*s)->ch[c].volume=(int)(v*256);} +bool cpymo_audio_channel_is_playing(size_t c,cpymo_audio_system* s){return *s&&((Audio*)*s)->ch[c].file;} +bool cpymo_audio_channel_is_looping(size_t c,cpymo_audio_system* s){return *s&&((Audio*)*s)->ch[c].loop;} +bool cpymo_audio_wait_se(cpymo_engine* e,float d){(void)d;return !cpymo_audio_channel_is_playing(1,&e->audio);} +static bool known_missing_audio(const char* dir,const char* kind,cpymo_str name){ + char expected[512],path[512],line[96],entry[48];nds_cache_path(expected,sizeof expected,"",kind,name,""); + const char* hash=strrchr(expected,'/');if(!hash)return false; + snprintf(entry,sizeof entry,"%s %s\n",kind,hash+1);snprintf(path,sizeof path,"%s/nds-cache/missing-audio.txt",dir); + FILE* file=fopen(path,"rb");if(!file)return false;bool found=false; + while(fgets(line,sizeof line,file))if(!strcmp(line,entry)){found=true;break;} + fclose(file);return found; +} +static error_t play(cpymo_engine* e,cpymo_str name,unsigned id,bool loop){ + Audio* a=e->audio;if(!a)return CPYMO_ERR_OUT_OF_MEM; + Channel* c=&a->ch[id];stop(c);char path[512];const char* folder=id==0?"bgm":id==1?"se":"voice"; + if(name.len>=sizeof c->name)return CPYMO_ERR_INVALID_ARG; + memcpy(c->name,name.begin,name.len);c->name[name.len]=0; + if(nds_cache_enabled){ + error_t alias_error=load_aliases(a,e->assetloader.gamedir);if(alias_error)return alias_error; + if(a->nar_policy==-2){a->nar_policy=-1;snprintf(path,sizeof path,"%s/nds-cache/audio-formats.bin",e->assetloader.gamedir);FILE* f=fopen(path,"rb");if(f){unsigned char h[6];unsigned got=fread(h,1,6,f);fclose(f);if(got!=5||memcmp(h,"NAF1",4)||(h[4]&~7)){engine_state[19]++;/* Optional index is invalid: use checked legacy detection. */}else a->nar_policy=h[4];}} + bool try_nar=a->nar_policy<0||(a->nar_policy&(1<assetloader.gamedir,folder,name,".nar",a,id);c->file=fopen(path,"rb");}else errno=ENOENT; + if(c->file){if(setvbuf(c->file,NULL,_IOFBF,2048)){stop(c);return CPYMO_ERR_OUT_OF_MEM;}unsigned char h[16];if(fread(h,1,16,c->file)!=16||(memcmp(h,"NAR1",4)&&memcmp(h,"NAR2",4))||h[8]!=0x22||h[9]!=0x56||h[10]||h[11]||h[12]||h[13]||h[14]||h[15]){stop(c);engine_state[19]++;return CPYMO_ERR_BAD_FILE_FORMAT;} + c->nar=calloc(1,sizeof *c->nar);if(!c->nar){stop(c);return CPYMO_ERR_OUT_OF_MEM;} + c->nar->modern=h[3]=='2';c->nar->total=c->nar->left=h[4]|((unsigned)h[5]<<8)|((unsigned)h[6]<<16)|((unsigned)h[7]<<24);audio_state[8]++; + }else if(errno!=ENOENT){engine_state[19]++;return CPYMO_ERR_CAN_NOT_OPEN_FILE;} + if(!c->file){audio_cache_path(path,sizeof path,e->assetloader.gamedir,folder,name,".pcm",a,id);c->file=fopen(path,"rb");} +if(!c->file){if(errno==ENOENT&&known_missing_audio(e->assetloader.gamedir,folder,name)){c->name[0]=0;engine_state[44]++;return CPYMO_ERR_SUCC;}engine_state[19]++;return CPYMO_ERR_CAN_NOT_OPEN_FILE;}engine_state[42]++;} + else {snprintf(path,sizeof path,"%s/%s/%s.pcm",e->assetloader.gamedir,folder,c->name);c->file=fopen(path,"rb");} + c->loop=loop; + if(!c->file){ + const char* ext=id==0?e->gameconfig.bgmformat:id==1?e->gameconfig.seformat:e->gameconfig.voiceformat; + cpymo_package* pkg=id==1&&e->assetloader.use_pkg_se?&e->assetloader.pkg_se:id==2&&e->assetloader.use_pkg_voice?&e->assetloader.pkg_voice:NULL; + c->offset=0; + if(pkg){cpymo_package_index index;error_t err=cpymo_package_find(&index,pkg,name);if(err){engine_state[19]++;return err;}snprintf(path,sizeof path,"%s/%s/%s.pak",e->assetloader.gamedir,folder,folder);c->offset=index.file_offset;c->length=index.file_length;} + else snprintf(path,sizeof path,"%s/%s/%s.%s",e->assetloader.gamedir,folder,c->name,ext); + c->file=fopen(path,"rb");if(!c->file){engine_state[19]++;return CPYMO_ERR_CAN_NOT_OPEN_FILE;} + if(!pkg){fseek(c->file,0,SEEK_END);c->length=ftell(c->file);} + if(fseek(c->file,c->offset,SEEK_SET)){stop(c);return CPYMO_ERR_BAD_FILE_FORMAT;} + c->remaining=c->length;c->phase=0; + c->mp3=calloc(1,sizeof *c->mp3);if(!c->mp3){stop(c);return CPYMO_ERR_OUT_OF_MEM;} + mad_stream_init(&c->mp3->stream);mad_frame_init(&c->mp3->frame);mad_synth_init(&c->mp3->synth); + if(!decode_mp3(c)){stop(c);return CPYMO_ERR_BAD_FILE_FORMAT;} + if(pkg)engine_state[22]++;else engine_state[23]++; + } + engine_state[16]++;return CPYMO_ERR_SUCC; +} +error_t cpymo_audio_bgm_play(cpymo_engine* e,cpymo_str n,bool loop){return play(e,n,0,loop);} +error_t cpymo_audio_se_play(cpymo_engine* e,cpymo_str n,bool loop){return play(e,n,1,loop);} +error_t cpymo_audio_vo_play(cpymo_engine* e,cpymo_str n){return play(e,n,2,false);} +void cpymo_audio_bgm_stop(cpymo_engine* e){if(e->audio)stop(&((Audio*)e->audio)->ch[0]);} +void cpymo_audio_se_stop(cpymo_engine* e){if(e->audio)stop(&((Audio*)e->audio)->ch[1]);} +void cpymo_audio_vo_stop(cpymo_engine* e){if(e->audio)stop(&((Audio*)e->audio)->ch[2]);} +const char* cpymo_audio_get_bgm_name(cpymo_engine* e){return e->audio?((Audio*)e->audio)->ch[0].name:"";} +const char* cpymo_audio_get_se_name(cpymo_engine* e){return e->audio?((Audio*)e->audio)->ch[1].name:"";} +error_t cpymo_audio_play_video(cpymo_engine* e,const char* path){(void)e;(void)path;return CPYMO_ERR_UNSUPPORTED;} +void cpymo_audio_copy_mixed_samples(void* dst,size_t len,cpymo_audio_system* s){(void)s;memset(dst,0,len);} +bool cpymo_audio_channel_get_samples(void** samples,size_t* len,size_t c,cpymo_audio_system* s){(void)s;(void)c;*samples=NULL;*len=0;return false;} diff --git a/cpymo-backends/nds/source/aux-screen-nds.h b/cpymo-backends/nds/source/aux-screen-nds.h new file mode 100644 index 00000000..a0ce57d5 --- /dev/null +++ b/cpymo-backends/nds/source/aux-screen-nds.h @@ -0,0 +1,18 @@ +/* The auxiliary GPU follows lcdSwap; choose its physical backlight each time. */ +static void nds_aux_refresh(void){ + unsigned lights=PM_BACKLIGHT_TOP|PM_BACKLIGHT_BOTTOM; + if(nds_aux_hidden())lights&=~(screens_swapped?PM_BACKLIGHT_TOP:PM_BACKLIGHT_BOTTOM); + /* libnds 2.x legacy powerOn/off ignore ARM7 PMIC bits. Use our dedicated + user PXI service, never a system-reserved channel or direct ARM9 POWCNT. */ + pxiWaitRemote(PxiChannel_User0); + ui_preferences_state[4]=pxiSendAndReceive(PxiChannel_User0,lights); + if(nds_playing&&!error_ui_active)launcher_play_panel(NULL); + nds_preferences_sync(); +} +static void nds_aux_poll(void){ + int held=keysHeld();if(!(held&KEY_TOUCH))nds_touch_blocked=false; + if(keysDown()&KEY_Y){nds_aux_override=!nds_aux_override;ui_preferences_state[8]++;nds_aux_refresh();cpymo_engine_request_redraw(&engine);} + if((keysDown()&KEY_TOUCH)&&!screens_swapped&&nds_aux_hidden()){ + nds_aux_override=!nds_aux_override;nds_touch_blocked=true;ui_preferences_state[7]++;nds_aux_refresh();cpymo_engine_request_redraw(&engine); + } +} diff --git a/cpymo-backends/nds/source/cache-nds.h b/cpymo-backends/nds/source/cache-nds.h new file mode 100644 index 00000000..7ca4af90 --- /dev/null +++ b/cpymo-backends/nds/source/cache-nds.h @@ -0,0 +1,10 @@ +#ifndef CPYMO_NDS_CACHE_H +#define CPYMO_NDS_CACHE_H +#include +#include +#include "cpymo_str.h" +extern bool nds_cache_enabled; +void nds_cache_path(char*,size_t,const char*,const char*,cpymo_str,const char*); +#endif + +void nds_cache_hash_path(char*,size_t,const char*,const char*,const char*,const char*); diff --git a/cpymo-backends/nds/source/clock-nds.h b/cpymo-backends/nds/source/clock-nds.h new file mode 100644 index 00000000..6388968e --- /dev/null +++ b/cpymo-backends/nds/source/clock-nds.h @@ -0,0 +1,58 @@ +/* DS wall clock, AGPL-3.0-or-later. Calico's ARM7 RTC service supplies time(). + Its epoch represents the user's local DS clock; never apply a second timezone. */ +#include +/* magic, valid, minute, reads, changes, menu paints, panel paints, minute patches, + hidden updates, menu visible, hour, minute-of-hour */ +volatile unsigned clock_state[12]={0x4e434c4b}; +static char nds_clock_text[6]="--:--"; +static u64 nds_clock_checked; +static bool nds_clock_initialized,nds_clock_pending,nds_menu_clock_visible,nds_registering_rmenu; +static cpymo_ui_drawer nds_rmenu_original_drawer; +static bool nds_clock_sample(void){ + u64 tick=tickGetCount(); + if(nds_clock_initialized&&tick-nds_clock_checked=946684800ULL&&(u64)stamp<4102444800ULL; + unsigned minute=valid?(unsigned)((u64)stamp/60):0; + bool changed=!nds_clock_initialized||valid!=clock_state[1]||minute!=clock_state[2]; + nds_clock_initialized=true; + if(!changed)return false; + nds_clock_pending=true;clock_state[1]=valid;clock_state[2]=minute;clock_state[4]++; + if(valid){unsigned hour=(minute/60)%24,min=minute%60; + nds_clock_text[0]='0'+hour/10;nds_clock_text[1]='0'+hour%10; + nds_clock_text[2]=':';nds_clock_text[3]='0'+min/10;nds_clock_text[4]='0'+min%10; + clock_state[10]=hour;clock_state[11]=min; + }else{memcpy(nds_clock_text,"--:--",6);clock_state[10]=clock_state[11]=0;} + return true; +} +static void nds_clock_paint_impl(u16* pixels,int x,int y,u16 ink,bool clear){ + /* Fixed 48x18 native-font tile. Also usable directly on non-cached VRAM: + minute refresh never clears the game framebuffer or republishes a panel. */ + unsigned width=0; + for(unsigned i=0;i<5;i++){int g=ui_fallback_glyph(nds_clock_text[i]);if(g>=0)width+=ui_fallback_advances[g];} + if(clear)for(int yy=0;yy<18;yy++)for(int xx=0;xx<48;xx++)pixels[(y+yy)*256+x+xx]=RGB15(3,5,8)|BIT(15); + int pen=x+(48-(int)width)/2; + for(unsigned i=0;i<5;i++){int g=ui_fallback_glyph(nds_clock_text[i]);if(g<0)continue; + for(unsigned yy=0;yy<16;yy++){unsigned bits=ui_fallback_rows[g][yy]; + for(unsigned xx=0;xx<16;xx++)if((bits&(1u< +#include +#include "ui-language-nds.h" + +#define CONFIG_ITEMS 9 +extern int nds_read_gray_get(void); +extern void nds_read_gray_set(int); +extern int nds_chara_effects_get(void); +extern void nds_chara_effects_set(int); +#ifdef __NDS__ +extern int nds_font_choices_available(void); +extern int nds_font_choice_get(void); +extern void nds_font_choice_set(int); +#endif + +typedef struct { + cpymo_backend_text show_name; + cpymo_backend_text show_value; + float show_value_width; + int value, max_value, min_value; + bool show_inc_dec_button; +} cpymo_config_ui_item; + +typedef struct { + cpymo_backend_text inc_btn, dec_btn; + float inc_btn_w, dec_btn_w; + cpymo_config_ui_item items[CONFIG_ITEMS]; + float font_size; + + cpymo_key_pluse left, right, ok, mouse_button; +} cpymo_config_ui; + +#define ITEM_BGM_VOL 0 +#define ITEM_SE_VOL 1 +#define ITEM_VO_VOL 2 +#define ITEM_TEXT_SPEED 3 +#define ITEM_FONT_SIZE 4 +#define ITEM_SKIP_ALREADY_READ_ONLY 5 +#define ITEM_READ_GRAY 6 +#define ITEM_CHARA_EFFECTS 7 +#define ITEM_UI_LANGUAGE 8 + +const static float side_padding = 16; + +static void *cpymo_config_ui_get_next_item(const cpymo_engine *e, const void *ui_data, const void *cur) +{ + uintptr_t x = cpymo_list_ui_encode_uint_node_dec(cur); + + if (x >= CONFIG_ITEMS - 1) return NULL; + else return cpymo_list_ui_encode_uint_node_enc((x + 1)); +} + +static void *cpymo_config_ui_get_prev_item(const cpymo_engine *e, const void *ui_data, const void *cur) +{ + uintptr_t x = cpymo_list_ui_encode_uint_node_dec(cur); + if (x == 0) return NULL; + else return cpymo_list_ui_encode_uint_node_enc((x - 1)); +} + +static inline void cpymo_config_ui_calc_layout( + const cpymo_engine *e, + const cpymo_config_ui *ui, + size_t item_id, + float y, + const cpymo_config_ui_item **out_item, + float *out_text_y, + float *out_value_display_x, + float *out_inc_btn_xywh, + float *out_dec_btn_x, + float *out_inc_dec_btn_symbol +) +{ + const cpymo_config_ui_item *item = + &ui->items[item_id]; + *out_item = item; + + float height = (float)e->gameconfig.imagesize_h / (float)CONFIG_ITEMS; + + float text_y = y + height / 2 + ui->font_size / 4; + *out_text_y = text_y; + + const float max_font_size = 32 / 240.0f * e->gameconfig.imagesize_h * 0.8f; + float inc_dec_btn_width = 0; + float inc_dec_btn_space = 0; + if (item->show_inc_dec_button) { + inc_dec_btn_width = ui->dec_btn_w; + if (ui->inc_btn_w > inc_dec_btn_width) inc_dec_btn_width = + ui->inc_btn_w; + if (max_font_size > inc_dec_btn_width) inc_dec_btn_width = + max_font_size; + inc_dec_btn_space = max_font_size / 2; + } + + float right_edge = + (float)e->gameconfig.imagesize_w - side_padding; + + out_inc_btn_xywh[0] = right_edge - inc_dec_btn_width; + out_inc_btn_xywh[1] = (height - max_font_size) / 2 + y; + out_inc_btn_xywh[2] = inc_dec_btn_width; + out_inc_btn_xywh[3] = max_font_size; + + float max_value_width = 0; + for (size_t i = 0; i < CONFIG_ITEMS; ++i) + if (max_value_width < ui->items[i].show_value_width && + ui->items[i].show_inc_dec_button) + max_value_width = ui->items[i].show_value_width; + + *out_dec_btn_x = + out_inc_btn_xywh[0] + - (max_value_width + 1.95f * inc_dec_btn_space + inc_dec_btn_width); + + /* Center all variable-length values in the same space between +/-. + * Buttons and their hit areas remain unchanged. Toggle settings without + * +/- retain right alignment. */ + *out_value_display_x = item->show_inc_dec_button + ? (*out_dec_btn_x + inc_dec_btn_width + out_inc_btn_xywh[0] - item->show_value_width) * 0.5f + : right_edge - item->show_value_width; + + *out_inc_dec_btn_symbol = y + height / 2 + max_font_size / 4; + +} + +static void cpymo_config_ui_draw_node(const cpymo_engine *e, const void *node_to_draw, float y) +{ + const cpymo_config_ui *ui = (cpymo_config_ui *)cpymo_list_ui_data_const(e); + const cpymo_config_ui_item *item; + float + text_y, + value_display_x, + inc_dec_btn_xywh[4], + dec_btn_x, + inc_dec_btn_symbol_y; + + size_t item_index = cpymo_list_ui_encode_uint_node_dec(node_to_draw); + + cpymo_config_ui_calc_layout( + e, ui, + item_index, y, + &item, + &text_y, + &value_display_x, + inc_dec_btn_xywh, + &dec_btn_x, + &inc_dec_btn_symbol_y); + + if (item->show_name) { + cpymo_backend_text_draw( + item->show_name, side_padding, text_y, cpymo_color_white, 1.0f, + cpymo_backend_image_draw_type_ui_element); + } + + if (item->show_value) { + cpymo_backend_text_draw( + item->show_value, + value_display_x, + text_y, cpymo_color_white, 1.0f, + cpymo_backend_image_draw_type_ui_element); + } + + if (item->show_inc_dec_button) { + bool inc_pressed = false, dec_pressed = false; + + if (cpymo_list_ui_get_current_selected_const(e) == node_to_draw) + { + dec_pressed = e->input.left; + inc_pressed = e->input.right || e->input.ok; + } + + bool is_pointed = false; + if (e->input.mouse_position_useable) { + is_pointed = cpymo_utils_point_in_rect_xywh( + e->input.mouse_x, + e->input.mouse_y, + inc_dec_btn_xywh); + + if (e->input.mouse_button && is_pointed) + inc_pressed = true; + } + + cpymo_color pressed_color; + pressed_color.r = 127; + pressed_color.g = 127; + pressed_color.b = 127; + + cpymo_backend_image_fill_rects( + inc_dec_btn_xywh, + 1, + inc_pressed ? pressed_color : + (is_pointed ? cpymo_color_white : cpymo_color_black), + 0.5f, + cpymo_backend_image_draw_type_ui_element); + + cpymo_backend_text_draw( + ui->inc_btn, + inc_dec_btn_xywh[0] + (inc_dec_btn_xywh[2] - ui->inc_btn_w) / 2, + inc_dec_btn_symbol_y, + is_pointed || inc_pressed ? cpymo_color_black : cpymo_color_white, 1.0f, + cpymo_backend_image_draw_type_ui_element); + + inc_dec_btn_xywh[0] = dec_btn_x; + + if (e->input.mouse_position_useable) { + is_pointed = cpymo_utils_point_in_rect_xywh( + e->input.mouse_x, + e->input.mouse_y, + inc_dec_btn_xywh); + + if (e->input.mouse_button && is_pointed) + dec_pressed = true; + } + + cpymo_backend_image_fill_rects( + inc_dec_btn_xywh, + 1, + dec_pressed ? pressed_color : + (is_pointed ? cpymo_color_white : cpymo_color_black), + 0.5f, + cpymo_backend_image_draw_type_ui_element); + + cpymo_backend_text_draw( + ui->dec_btn, + inc_dec_btn_xywh[0] + (inc_dec_btn_xywh[2] - ui->dec_btn_w) / 2, + inc_dec_btn_symbol_y, + is_pointed || dec_pressed ? cpymo_color_black : cpymo_color_white, 1.0f, + cpymo_backend_image_draw_type_ui_element); + } +} + +static void cpymo_config_ui_deleter(cpymo_engine *e, void *ui_data) +{ + cpymo_config_ui *ui = (cpymo_config_ui *)ui_data; + for (size_t i = 0; i < sizeof(ui->items) / sizeof(ui->items[0]); ++i) { + if (ui->items[i].show_name) cpymo_backend_text_free(ui->items[i].show_name); + if (ui->items[i].show_value) cpymo_backend_text_free(ui->items[i].show_value); + } + + if (ui->dec_btn) cpymo_backend_text_free(ui->dec_btn); + if (ui->inc_btn) cpymo_backend_text_free(ui->inc_btn); + + cpymo_save_config_save(e); +} + +static error_t cpymo_config_ui_set_value( + cpymo_engine *e, + cpymo_config_ui *ui, + int item_index, + int val, + bool refreshing); + +static void cpymo_config_ui_refresh_items(cpymo_engine *e) +{ + cpymo_config_ui *ui = (cpymo_config_ui *)cpymo_list_ui_data(e); + + const cpymo_gameconfig *c = &e->gameconfig; + ui->font_size = c->fontsize / 240.0f * c->imagesize_h * 0.8f; + + float width; + cpymo_backend_text show_name; + + error_t err = CPYMO_ERR_SUCC; + + + #define INIT_ITEM(ITEM_ID, TEXT, MIN_VAL, MAX_VAL, CUR_VAL, SHOW_INC_DEC_BTN) \ + ui->items[ITEM_ID].min_value = MIN_VAL; \ + ui->items[ITEM_ID].max_value = MAX_VAL; \ + ui->items[ITEM_ID].show_inc_dec_button = SHOW_INC_DEC_BTN; \ + err = cpymo_backend_text_create( \ + &show_name, \ + &width, \ + cpymo_str_pure(TEXT), \ + ui->font_size); \ + if (err == CPYMO_ERR_SUCC) { \ + if (ui->items[ITEM_ID].show_name) \ + cpymo_backend_text_free(ui->items[ITEM_ID].show_name); \ + ui->items[ITEM_ID].show_name = show_name; \ + } \ + err = cpymo_config_ui_set_value(e, ui, ITEM_ID, CUR_VAL, true); \ + if (err != CPYMO_ERR_SUCC) { \ + cpymo_ui_exit(e); \ + return; \ + } + + const cpymo_localization *l = cpymo_localization_get(e); + + #ifdef LOW_FRAME_RATE + const static int min_say_speed = 5; + e->gameconfig.textspeed = 5; + const static bool text_speed_inc_dec_btn = false; + #else + const static int min_say_speed = 0; + const static bool text_speed_inc_dec_btn = true; + #endif + + + INIT_ITEM( + ITEM_BGM_VOL, + l->config_bgmvol, + 0, + 10, + (int)roundf( + cpymo_audio_get_channel_volume( + CPYMO_AUDIO_CHANNEL_BGM, &e->audio) * 10), + true); + + INIT_ITEM( + ITEM_SE_VOL, + l->config_sevol, + 0, + 10, + (int)roundf( + cpymo_audio_get_channel_volume( + CPYMO_AUDIO_CHANNEL_SE, &e->audio) * 10), + true); + + INIT_ITEM( + ITEM_VO_VOL, + l->config_vovol, + 0, + 10, + (int)roundf( + cpymo_audio_get_channel_volume( + CPYMO_AUDIO_CHANNEL_VO, &e->audio) * 10), + true); + + INIT_ITEM( + ITEM_TEXT_SPEED, + l->config_sayspeed, + min_say_speed, + 5, + (int)e->gameconfig.textspeed, + text_speed_inc_dec_btn); + +#ifdef __NDS__ + if (nds_font_choices_available()) { + INIT_ITEM(ITEM_FONT_SIZE, l->config_fontsize, 0, 1, nds_font_choice_get(), true); + } else +#endif + { + INIT_ITEM( + ITEM_FONT_SIZE, + l->config_fontsize, + 12, + 32, + (int)e->gameconfig.fontsize, + true); + } + + INIT_ITEM( + ITEM_SKIP_ALREADY_READ_ONLY, + l->config_skip_mode, + 0, + 1, + (int)e->config_skip_already_read_only, + false); + + INIT_ITEM(ITEM_READ_GRAY, nds_ui("已读变灰"), 0, 1, nds_read_gray_get(), false); + INIT_ITEM(ITEM_CHARA_EFFECTS, nds_ui("立绘特效(全局)"), 0, 1, nds_chara_effects_get(), false); + INIT_ITEM(ITEM_UI_LANGUAGE, nds_ui("界面语言"), 0, NDS_LANG_COUNT-1, nds_language_choice_get(), false); + #undef INIT_ITEM +} + +#ifdef ENABLE_TEXT_EXTRACT +static void cpymo_config_ui_extract_setting_title(cpymo_engine *e, int item_id) +{ + const cpymo_localization *l = cpymo_localization_get(e); + const char *p = NULL; + switch (item_id) { + case ITEM_BGM_VOL: p = l->config_bgmvol; break; + case ITEM_SE_VOL: p = l->config_sevol; break; + case ITEM_VO_VOL: p = l->config_vovol; break; + case ITEM_FONT_SIZE: p = l->config_fontsize; break; + case ITEM_TEXT_SPEED: p = l->config_sayspeed; break; + case ITEM_SKIP_ALREADY_READ_ONLY: p = l->config_skip_mode; break; + case ITEM_READ_GRAY: p = nds_ui("已读变灰"); break; + case ITEM_CHARA_EFFECTS: p = nds_ui("立绘特效(全局)"); break; + case ITEM_UI_LANGUAGE: p = nds_ui("界面语言"); break; + default: assert(false); + } + + cpymo_backend_text_extract(p); +} +#endif + +static error_t cpymo_config_ui_set_value( + cpymo_engine *e, + cpymo_config_ui *ui, + int item_index, + int val, + bool refreshing) +{ + cpymo_config_ui_item *item = ui->items + item_index; + + item->value = val; + if (item->show_value) { + cpymo_backend_text_free(item->show_value); + item->show_value = NULL; + } + + const cpymo_localization *l = cpymo_localization_get(e); + + char val_str_buf[8]; + const char *val_str = val_str_buf; + switch (item_index) { + case ITEM_UI_LANGUAGE: val_str = nds_language_choice_name(val); break; + case ITEM_READ_GRAY: + case ITEM_CHARA_EFFECTS: val_str = nds_ui(val ? "开" : "关"); break; + case ITEM_BGM_VOL: + case ITEM_SE_VOL: + case ITEM_VO_VOL: + if (val) sprintf(val_str_buf, "%d0%%", val); + else val_str = "0%"; + break; + case ITEM_FONT_SIZE: + #ifdef __NDS__ + if (nds_font_choices_available()) val_str = nds_ui(val ? "大" : "小"); + else +#endif + sprintf(val_str_buf, "%d", val); + break; + case ITEM_TEXT_SPEED: + assert(val >= 0 && val <= 5); + val_str = l->config_sayspeeds[val]; + break; + case ITEM_SKIP_ALREADY_READ_ONLY: + assert(val == 0 || val == 1); + val_str = l->config_skip_modes[val]; + break; + } + +#ifdef ENABLE_TEXT_EXTRACT + if (!refreshing) { + cpymo_config_ui_extract_setting_title(e, item_index); + cpymo_backend_text_extract(val_str); + } +#endif + + error_t err = CPYMO_ERR_SUCC; + if (!refreshing && item_index == ITEM_FONT_SIZE) goto JUST_REFRESH; + + err = cpymo_backend_text_create( + &item->show_value, + &item->show_value_width, + cpymo_str_pure(val_str), + ui->font_size); + + if (err != CPYMO_ERR_SUCC) + item->show_value = NULL; + + if (refreshing) return CPYMO_ERR_SUCC; + +JUST_REFRESH: + switch (item_index) { + case ITEM_UI_LANGUAGE: nds_language_choice_set(val); cpymo_config_ui_refresh_items(e); break; + case ITEM_READ_GRAY: nds_read_gray_set(val); break; + case ITEM_CHARA_EFFECTS: nds_chara_effects_set(val); break; + case ITEM_BGM_VOL: + cpymo_audio_set_channel_volume(CPYMO_AUDIO_CHANNEL_BGM, &e->audio, (float)val / 10.0f); + break; + case ITEM_SE_VOL: + cpymo_audio_set_channel_volume(CPYMO_AUDIO_CHANNEL_SE, &e->audio, (float)val / 10.0f); + break; + case ITEM_VO_VOL: + cpymo_audio_set_channel_volume(CPYMO_AUDIO_CHANNEL_VO, &e->audio, (float)val / 10.0f); + break; + case ITEM_FONT_SIZE: + #ifdef __NDS__ + if (nds_font_choices_available()) nds_font_choice_set(val); + else +#endif + e->gameconfig.fontsize = (uint16_t)val; + cpymo_config_ui_refresh_items(e); + break; + case ITEM_TEXT_SPEED: + e->gameconfig.textspeed = (unsigned)val; + break; + case ITEM_SKIP_ALREADY_READ_ONLY: + e->config_skip_already_read_only = val > 0; + break; + default: assert(false); + } + + cpymo_engine_request_redraw(e); + + return CPYMO_ERR_SUCC; +} + +static error_t cpymo_config_ui_item_inc(cpymo_engine *e, cpymo_config_ui *ui, int item_index) +{ + cpymo_config_ui_item *item = ui->items + item_index; + int new_val = item->value + 1; + if (new_val > item->max_value) + new_val = item->min_value; + + if (new_val != item->value) { + error_t err = cpymo_config_ui_set_value(e, ui, item_index, new_val, false); + CPYMO_THROW(err); + } + + return CPYMO_ERR_SUCC; +} + +static error_t cpymo_config_ui_item_dec(cpymo_engine *e, cpymo_config_ui *ui, int item_index) +{ + cpymo_config_ui_item *item = ui->items + item_index; + int new_val = item->value - 1; + if (new_val < item->min_value) + new_val = item->max_value; + + if (new_val != item->value) { + error_t err = cpymo_config_ui_set_value(e, ui, item_index, new_val, false); + CPYMO_THROW(err); + } + + return CPYMO_ERR_SUCC; +} + +static error_t cpymo_config_ui_update(cpymo_engine *e, float dt, void *sel) +{ + cpymo_config_ui *ui = (cpymo_config_ui *)cpymo_list_ui_data(e); + cpymo_key_pluse_update(&ui->left, dt, e->input.left); + cpymo_key_pluse_update(&ui->right, dt, e->input.right); + cpymo_key_pluse_update(&ui->ok, dt, e->input.ok); + cpymo_key_pluse_update(&ui->mouse_button, dt, e->input.mouse_button); + + const int i = (int)cpymo_list_ui_encode_uint_node_dec(sel); + + if (ui->items[i].show_inc_dec_button) + { + const cpymo_config_ui_item *item; + float y; + float x; + + float inc_dec_rect_xywh[4]; + float dec_rect_x; + float symbol_y; + cpymo_config_ui_calc_layout( + e, ui, i, + ((float)e->gameconfig.imagesize_h / CONFIG_ITEMS) * i, + &item, + &y, + &x, + inc_dec_rect_xywh, + &dec_rect_x, + &symbol_y); + + bool cur_pointed_plus = false, prev_pointed = false; + if (e->input.mouse_position_useable) + cur_pointed_plus = cpymo_utils_point_in_rect_xywh( + e->input.mouse_x, e->input.mouse_y, inc_dec_rect_xywh); + if (e->prev_input.mouse_position_useable) + prev_pointed = cpymo_utils_point_in_rect_xywh( + e->prev_input.mouse_x, e->prev_input.mouse_y, inc_dec_rect_xywh); + if (cur_pointed_plus != prev_pointed) + cpymo_engine_request_redraw(e); + + inc_dec_rect_xywh[0] = dec_rect_x; + bool cur_pointed_minus = false; + prev_pointed = false; + if (e->input.mouse_position_useable) + cur_pointed_minus = cpymo_utils_point_in_rect_xywh( + e->input.mouse_x, e->input.mouse_y, inc_dec_rect_xywh); + if (e->prev_input.mouse_position_useable) + prev_pointed = cpymo_utils_point_in_rect_xywh( + e->prev_input.mouse_x, e->prev_input.mouse_y, inc_dec_rect_xywh); + if (cur_pointed_minus != prev_pointed) + cpymo_engine_request_redraw(e); + + if (cur_pointed_minus && cpymo_key_pluse_output(&ui->mouse_button)) + cpymo_config_ui_item_dec(e, ui, i); + + if (cur_pointed_plus && cpymo_key_pluse_output(&ui->mouse_button)) + cpymo_config_ui_item_inc(e, ui, i); + + if (e->prev_input.mouse_position_useable != e->input.mouse_position_useable || + (e->prev_input.mouse_button != e->input.mouse_button && (cur_pointed_minus || cur_pointed_plus)) || + e->prev_input.ok != e->input.ok || + e->prev_input.left != e->input.left || + e->prev_input.right != e->input.right) + cpymo_engine_request_redraw(e); + + if (cpymo_key_pluse_output(&ui->left)) + cpymo_config_ui_item_dec(e, ui, i); + else if (cpymo_key_pluse_output(&ui->right) || + (cpymo_key_pluse_output(&ui->ok))) + cpymo_config_ui_item_inc(e, ui, i); + } + else { + if (CPYMO_INPUT_JUST_PRESSED(e, left)) + cpymo_config_ui_item_dec(e, ui, i); + else if (CPYMO_INPUT_JUST_PRESSED(e, right)) + cpymo_config_ui_item_inc(e, ui, i); + } + + return CPYMO_ERR_SUCC; +} + + +static error_t cpymo_config_ui_ok(cpymo_engine *e, void *sel) +{ + cpymo_config_ui *ui = (cpymo_config_ui *)cpymo_list_ui_data(e); + const int i = (int)cpymo_list_ui_encode_uint_node_dec(sel); + + return ui->items[i].show_inc_dec_button ? + CPYMO_ERR_SUCC : + cpymo_config_ui_item_inc( + e, (cpymo_config_ui *)cpymo_list_ui_data(e), i); +} + +#ifdef ENABLE_TEXT_EXTRACT +static error_t cpymo_config_ui_visual_im_help_selection_changed_callback(cpymo_engine *e, void *sel) +{ + const int i = (int)cpymo_list_ui_encode_uint_node_dec(sel); + cpymo_config_ui_extract_setting_title(e, i); + + return CPYMO_ERR_SUCC; +} +#endif + +error_t cpymo_config_ui_mouse_button_just_hold(cpymo_engine *e) +{ + cpymo_config_ui *ui = (cpymo_config_ui *)cpymo_list_ui_data(e); + for (size_t i = 0; i < CONFIG_ITEMS; ++i) { + if (!ui->items[i].show_inc_dec_button) continue; + const cpymo_config_ui_item *item; + float y; + float x; + + float inc_dec_rect_xywh[4]; + float dec_rect_x; + float symbol_y; + cpymo_config_ui_calc_layout( + e, ui, i, + ((float)e->gameconfig.imagesize_h / CONFIG_ITEMS) * i, + &item, + &y, + &x, + inc_dec_rect_xywh, + &dec_rect_x, + &symbol_y); + + if (e->input.mouse_position_useable) + if (cpymo_utils_point_in_rect_xywh( + e->input.mouse_x, e->input.mouse_y, inc_dec_rect_xywh)) + return CPYMO_ERR_SUCC; + + inc_dec_rect_xywh[0] = dec_rect_x; + if (e->input.mouse_position_useable) + if (cpymo_utils_point_in_rect_xywh( + e->input.mouse_x, e->input.mouse_y, inc_dec_rect_xywh)) + return CPYMO_ERR_SUCC; + } + + cpymo_ui_exit(e); + + return CPYMO_ERR_SUCC; +} + +error_t cpymo_config_ui_enter(cpymo_engine *e) +{ + const cpymo_gameconfig *c = &e->gameconfig; + const float font_size = c->fontsize / 240.0f * c->imagesize_h * 0.8f; + + cpymo_config_ui *ui = NULL; + error_t err = cpymo_list_ui_enter( + e, + (void **)&ui, + sizeof(cpymo_config_ui), + &cpymo_config_ui_draw_node, + &cpymo_config_ui_ok, + &cpymo_config_ui_deleter, + + cpymo_list_ui_encode_uint_node_enc(ITEM_BGM_VOL), + &cpymo_config_ui_get_next_item, + &cpymo_config_ui_get_prev_item, + false, + CONFIG_ITEMS); + CPYMO_THROW(err); + + ui->dec_btn = NULL; + ui->dec_btn_w = 0; + ui->inc_btn = NULL; + ui->inc_btn_w = 0; + +#ifdef ENABLE_TEXT_EXTRACT + cpymo_list_ui_set_selection_changed_callback(e, &cpymo_config_ui_visual_im_help_selection_changed_callback); +#endif + + cpymo_list_ui_set_scroll_enabled(e, false); + cpymo_list_ui_set_custom_update(e, &cpymo_config_ui_update); + cpymo_list_ui_enable_loop(e); + cpymo_list_ui_set_mouse_button_just_hold_callback( + e, &cpymo_config_ui_mouse_button_just_hold); + + for (size_t i = 0; i < sizeof(ui->items) / sizeof(ui->items[0]); ++i) { + ui->items[i].show_name = NULL; + ui->items[i].show_value = NULL; + } + + ui->font_size = font_size; + + cpymo_key_pluse_init(&ui->left, e->input.left); + cpymo_key_pluse_init(&ui->right, e->input.right); + cpymo_key_pluse_init(&ui->ok, e->input.ok); + cpymo_key_pluse_init(&ui->mouse_button, e->input.mouse_button); + + cpymo_backend_text_extract(cpymo_localization_get(e)->config_bgmvol); + + err = cpymo_backend_text_create( + &ui->inc_btn, + &ui->inc_btn_w, + cpymo_str_pure("+"), + 32 / 240.0f * c->imagesize_h * 0.8f); + if (err != CPYMO_ERR_SUCC) { + ui->inc_btn = NULL; + ui->dec_btn = NULL; + cpymo_ui_exit(e); + return err; + } + + err = cpymo_backend_text_create( + &ui->dec_btn, + &ui->dec_btn_w, + cpymo_str_pure("-"), + 32 / 240.0f * c->imagesize_h * 0.8f); + if (err != CPYMO_ERR_SUCC) { + ui->dec_btn = NULL; + cpymo_ui_exit(e); + return err; + } + + cpymo_config_ui_refresh_items(e); + + return CPYMO_ERR_SUCC; +} diff --git a/cpymo-backends/nds/source/cpymo_rmenu.c b/cpymo-backends/nds/source/cpymo_rmenu.c new file mode 100644 index 00000000..835f8d1f --- /dev/null +++ b/cpymo-backends/nds/source/cpymo_rmenu.c @@ -0,0 +1,335 @@ +#include "cpymo_prelude.h" +#include "cpymo_rmenu.h" +#include "cpymo_engine.h" +#include "cpymo_config_ui.h" +#include "cpymo_msgbox_ui.h" +#include "cpymo_save_ui.h" +#include "cpymo_save.h" +#include "cpymo_localization.h" +#include "ui-language-nds.h" +#include +#include +#include + +#ifdef __3DS__ +extern bool fill_screen_enabled; +const extern bool fill_screen; +const extern bool enhanced_3ds_display_mode; +#endif + +#ifdef ENABLE_TEXT_EXTRACT_ANDROID_ACCESSIBILITY +#include "../cpymo-backends/android/app/src/main/cpp/include/cpymo_android.h" +#endif + +typedef struct { + cpymo_backend_image bg; + int bg_w, bg_h; + + cpymo_select_img menu; + cpymo_wait menu_waiter; + + cpymo_key_hold touch; + float bg_zoom_out; + + bool alive; +} cpymo_rmenu; + +static error_t cpymo_rmenu_update(cpymo_engine *e, void *ui_data, float dt) +{ + cpymo_rmenu *r = (cpymo_rmenu *)ui_data; + + enum cpymo_key_hold_result result = cpymo_key_hold_update( + e, &r->touch, dt, e->input.mouse_button); + if (result == cpymo_key_hold_result_just_hold) { + cpymo_ui_exit(e); + return CPYMO_ERR_SUCC; + } + + if (r->alive) { + error_t err = cpymo_wait_update(&r->menu_waiter, e, dt); + CPYMO_THROW(err); + + if (r->alive) { + err = cpymo_select_img_update(e, &r->menu, dt); + CPYMO_THROW(err); + } + } + + return CPYMO_ERR_SUCC; +} + +static void cpymo_rmenu_draw(const cpymo_engine *e, const void *ui_data) +{ + const cpymo_rmenu *r = (const cpymo_rmenu *)ui_data; + + cpymo_bg_draw(e); + cpymo_scroll_draw(&e->scroll); + + #ifdef __3DS__ + if (fill_screen && !enhanced_3ds_display_mode) + fill_screen_enabled = false; + #endif + + float w = (float)r->bg_w * r->bg_zoom_out; + float h = (float)r->bg_h * r->bg_zoom_out; + + float bg_xywh[4] = { + ((float)e->gameconfig.imagesize_w - (float)w) / 2, + ((float)e->gameconfig.imagesize_h - (float)h) / 2 - 0.018f * (float)e->gameconfig.imagesize_h, + (float)w, + (float)h, + }; + + if (r->bg) { +#ifdef DISABLE_IMAGE_SCALING + cpymo_backend_image_draw( + bg_xywh[0] + (bg_xywh[2] - r->bg_w) / 2, + bg_xywh[1] + (bg_xywh[3] - r->bg_h) / 2, + r->bg_w, + r->bg_h, + r->bg, + 0, + 0, + r->bg_w, + r->bg_h, + 1.0f, + cpymo_backend_image_draw_type_ui_element_bg); +#else + cpymo_backend_image_draw( + bg_xywh[0], + bg_xywh[1], + bg_xywh[2], + bg_xywh[3], + r->bg, + 0, + 0, + r->bg_w, + r->bg_h, + 1.0f, + cpymo_backend_image_draw_type_ui_element_bg); +#endif + } + else { + cpymo_backend_image_fill_rects( + bg_xywh, 1, cpymo_color_black, 0.75f, + cpymo_backend_image_draw_type_ui_element_bg); + } + + /* NDS: retain the game's menu art, improve white bitmap text contrast. */ + cpymo_backend_image_fill_rects(bg_xywh, 1, cpymo_color_black, 0.60f, + cpymo_backend_image_draw_type_ui_element_bg); + + cpymo_select_img_draw(&r->menu, e->gameconfig.imagesize_w, e->gameconfig.imagesize_h, false); + + #ifdef __3DS__ + fill_screen_enabled = true; + #endif +} + +static void cpymo_rmenu_delete(cpymo_engine *e, void *ui_data) +{ + cpymo_rmenu *r = (cpymo_rmenu *)ui_data; + r->alive = false; + + if (r->bg) cpymo_backend_image_free(r->bg); + + cpymo_select_img_free(&r->menu); +} + +extern void nds_request_title_guide_reset(void); +error_t cpymo_rmenu_restart_game(cpymo_engine *e, void *data, bool confirm) +{ + if (!confirm) return CPYMO_ERR_SUCC; + char *gamedir = + cpymo_str_copy_malloc(cpymo_str_pure(e->assetloader.gamedir)); + if (gamedir == NULL) return CPYMO_ERR_OUT_OF_MEM; + + cpymo_engine_free(e); + error_t err = cpymo_engine_init(e, gamedir); + free(gamedir); + if (!err) nds_request_title_guide_reset(); + return err; +} + +extern void nds_request_exit_to_library(void); + +/* The message box exits its own UI before calling this callback. + * The owning main loop tears down the engine AFTER cpymo_engine_update. */ +static error_t cpymo_rmenu_exit_to_library( + cpymo_engine *e, void *data, bool confirmed) +{ + (void)e; (void)data; + if (confirmed) nds_request_exit_to_library(); + return CPYMO_ERR_SUCC; +} + +static error_t cpymo_rmenu_ok(cpymo_engine *e, int sel, uint64_t hash, bool _) +{ + switch (sel) { + case 0: cpymo_ui_exit(e); e->say.auto_mode = true; e->say.auto_mode_timer = -1; break; + case 1: cpymo_ui_exit(e); cpymo_save_ui_enter(e, false); break; + case 2: cpymo_ui_exit(e); cpymo_save_ui_enter(e, true); break; + case 3: cpymo_ui_exit(e); e->skipping = true; break; + case 4: cpymo_say_hidewindow_until_click(e); cpymo_ui_exit(e); break; + case 5: cpymo_ui_exit(e); cpymo_backlog_ui_enter(e); break; + case 6: cpymo_ui_exit(e); cpymo_config_ui_enter(e); break; + case 7: + cpymo_ui_exit(e); + cpymo_msgbox_ui_enter( + e, + cpymo_str_pure( + cpymo_localization_get(e)->rmenu_restat_game_confirm_message), + &cpymo_rmenu_restart_game, + NULL); + break; + + case 8: + cpymo_ui_exit(e); + cpymo_msgbox_ui_enter(e, + cpymo_str_pure(nds_ui("确定退出到游戏库?\n未保存的进度将丢失。")), + &cpymo_rmenu_exit_to_library, NULL); + break; + case 9: cpymo_ui_exit(e); break; + default: + assert(false); + } + + return CPYMO_ERR_SUCC; +} + +static inline float cpymo_rmenu_bg_zoom( + const cpymo_rmenu *r, + float font_size) +{ + #ifdef DISABLE_IMAGE_SCALING + return 1.0f; + #else + const size_t menu_items = 10; + const float menu_item_padding = 2.0f; + const float menu_padding = 16.0f; + const float menu_height = + (menu_item_padding + font_size) * menu_items + 2.0f * menu_padding; + + float zoom_out = (menu_height / r->bg_h); + if (zoom_out < 1.0f) zoom_out = 1.0f; + return zoom_out; + #endif +} + +error_t cpymo_rmenu_enter(cpymo_engine *e) +{ + cpymo_rmenu *rmenu = NULL; + error_t err = cpymo_ui_enter( + (void **)&rmenu, + e, + sizeof(cpymo_rmenu), + &cpymo_rmenu_update, + &cpymo_rmenu_draw, + &cpymo_rmenu_delete); + CPYMO_THROW(err); + +#ifdef ENABLE_TEXT_EXTRACT_ANDROID_ACCESSIBILITY + cpymo_android_play_sound(SOUND_MENU); +#endif + + rmenu->alive = true; + + cpymo_key_hold_init(&rmenu->touch, e->input.mouse_button); + + cpymo_select_img_init(&rmenu->menu); + cpymo_wait_reset(&rmenu->menu_waiter); + + rmenu->bg = NULL; + err = cpymo_assetloader_load_system_image( + &rmenu->bg, + &rmenu->bg_w, + &rmenu->bg_h, + cpymo_str_pure("menu"), + &e->assetloader, + true); + + if (err != CPYMO_ERR_SUCC) { + rmenu->bg = NULL; + + if (strcmp(e->gameconfig.platform, "s60v3") == 0) { + rmenu->bg_w = 240; + rmenu->bg_h = 144; + } + else if (strcmp(e->gameconfig.platform, "s60v5") == 0) { + rmenu->bg_w = 360; + rmenu->bg_h = 216; + } + else { + rmenu->bg_w = (int)((float)e->gameconfig.imagesize_w * 0.75f); + rmenu->bg_h = (int)((float)e->gameconfig.imagesize_h * 0.6f); + } + } + + err = cpymo_select_img_configuare_begin( + &rmenu->menu, + 10, + cpymo_str_pure(""), + &e->assetloader, + &e->gameconfig); + if (err != CPYMO_ERR_SUCC) { + cpymo_ui_exit(e); + return err; + } + + const float font_size = cpymo_gameconfig_font_size(&e->gameconfig); + rmenu->bg_zoom_out = cpymo_rmenu_bg_zoom(rmenu, font_size); + + #define RMENU_ITEM(_, TEXT, ENABLED) \ + err = cpymo_select_img_configuare_select_text( \ + &rmenu->menu, \ + &e->assetloader, \ + &e->gameconfig, \ + &e->flags, \ + cpymo_str_pure(TEXT), \ + ENABLED, \ + cpymo_select_img_selection_nohint, \ + 0xFFFFFFFFFFFFFFFF, \ + font_size); \ + if (err != CPYMO_ERR_SUCC) { \ + cpymo_ui_exit(e); \ + return err; \ + } + + cpymo_select_img_configuare_set_ok_callback(&rmenu->menu, &cpymo_rmenu_ok); + + const cpymo_localization *l = cpymo_localization_get(e); + + RMENU_ITEM(0, l->rmenu_auto, e->select_img.selections == NULL); + RMENU_ITEM(1, l->rmenu_save, true); + RMENU_ITEM(2, l->rmenu_load, true); + RMENU_ITEM(3, l->rmenu_skip, e->select_img.selections == NULL); + RMENU_ITEM(4, l->rmenu_hide_window, e->select_img.selections == NULL); + RMENU_ITEM(5, l->rmenu_backlog, true); + RMENU_ITEM(6, l->rmenu_config, true) + RMENU_ITEM(7, l->rmenu_restart, true); + RMENU_ITEM(8, nds_ui("退出到游戏库"), true); + RMENU_ITEM(9, l->rmenu_back_to_game, true); + + float xywh[4] = { + ((float)e->gameconfig.imagesize_w - (float)rmenu->bg_w) / 2, + ((float)e->gameconfig.imagesize_h - (float)rmenu->bg_h) / 2, + (float)rmenu->bg_w, + (float)rmenu->bg_h, + }; + + cpymo_select_img_configuare_end_select_text( + &rmenu->menu, + &rmenu->menu_waiter, + e, + xywh[0], + xywh[1], + xywh[0] + xywh[2], + xywh[1] + xywh[3], + cpymo_color_white, + 0, + false); + + rmenu->menu.draw_type = cpymo_backend_image_draw_type_ui_element; + + return CPYMO_ERR_SUCC; +} diff --git a/cpymo-backends/nds/source/cpymo_say.c b/cpymo-backends/nds/source/cpymo_say.c new file mode 100644 index 00000000..21c4e922 --- /dev/null +++ b/cpymo-backends/nds/source/cpymo_say.c @@ -0,0 +1,534 @@ +#include "cpymo_prelude.h" +#include "cpymo_say.h" +#include "cpymo_rmenu.h" +#include "cpymo_engine.h" +#include "cpymo_save.h" +#include +#include + +/* NDS: preserve read tracking while allowing per-game display preferences. */ +extern int nds_read_gray_get(void); +const static float already_read_text_alpha = 0.6f; +const float static auto_mode_time = 2.0f; + +#define DISABLE_TEXTBOX(SAY) \ + if (SAY->textbox_usable) { \ + cpymo_textbox_free(&(SAY)->textbox, &e->backlog); \ + SAY->textbox_usable = false; \ + } + +#define ENABLE_TEXTBOX(SAY, E, X, Y, W, H, FONT_SIZE, COL, ALPHA, TEXT, ERR) \ + { \ + DISABLE_TEXTBOX(SAY); \ + ERR = cpymo_textbox_init( \ + &(SAY)->textbox, X, Y, W, H, FONT_SIZE, \ + COL, ALPHA, TEXT, &(E)->backlog); \ + if (ERR == CPYMO_ERR_SUCC) SAY->textbox_usable = true; \ + } + +#define RESET_NAME(SAY) SAY->name = NULL; + +static void cpymo_say_lazy_init(cpymo_say *out, cpymo_assetloader *loader) +{ + if (out->lazy_init == false) { + out->lazy_init = true; + error_t err = cpymo_assetloader_load_system_image( + &out->msg_cursor, + &out->msg_cursor_w, + &out->msg_cursor_h, + cpymo_str_pure("message_cursor"), + loader, + true); + + if (err != CPYMO_ERR_SUCC) out->msg_cursor = NULL; + } +} + +void cpymo_say_init(cpymo_say *out) +{ + out->msgbox = NULL; + out->namebox = NULL; + out->msg_cursor = NULL; + out->active = false; + out->lazy_init = false; + out->textbox_usable = false; + out->name = NULL; + out->hide_window = false; + out->msgbox_name = NULL; + out->namebox_name = NULL; + + out->current_name = NULL; + out->current_text = NULL; + out->current_say_is_already_read = true; + out->auto_mode = false; + out->auto_mode_timer = -1; +} + +void cpymo_say_free(cpymo_say *say) +{ + cpymo_textbox_free(&say->textbox, NULL); + RESET_NAME(say); + if (say->msgbox) cpymo_backend_image_free(say->msgbox); + if (say->namebox) cpymo_backend_image_free(say->namebox); + if (say->msg_cursor) cpymo_backend_image_free(say->msg_cursor); + if (say->msgbox_name) free(say->msgbox_name); + if (say->namebox_name) free(say->namebox_name); + + if (say->current_name) free(say->current_name); + if (say->current_text) free(say->current_text); +} + +void cpymo_say_draw(const struct cpymo_engine *e) +{ + if (e->say.active && !e->input.hide_window && !e->say.hide_window) { + float ratio = (float)e->gameconfig.imagesize_w / (float)e->say.msgbox_w; + float msg_h = (float)e->say.msgbox_h * ratio; + float y = (float)e->gameconfig.imagesize_h - msg_h; + float offx = (float)e->gameconfig.nameboxorg_x / 540.0f * (float)e->gameconfig.imagesize_w; + float offy = (float)e->gameconfig.nameboxorg_y / 360.0f * (float)e->gameconfig.imagesize_h; + + float fontsize = cpymo_gameconfig_font_size(&e->gameconfig); + float namebox_h = fontsize * 1.4f; + float namebox_w = (float)e->say.namebox_w / ((float)e->say.namebox_h / namebox_h); + + float namebox_x = 0; + float namebox_y = y - namebox_h; + + namebox_x += offx; + namebox_y -= offy; + + const cpymo_color gray = { 127, 127, 127 }; + + if (e->say.msgbox) { +#ifdef DISABLE_IMAGE_SCALING + const float screen_w = e->gameconfig.imagesize_w; + const float screen_h = e->gameconfig.imagesize_h; + cpymo_backend_image_draw( + screen_w / 2 - (float)e->say.msgbox_w / 2, + screen_h - (float)e->say.msgbox_h, + e->say.msgbox_w, e->say.msgbox_h, + e->say.msgbox, + 0, 0, e->say.msgbox_w, e->say.msgbox_h, 1.0f, + cpymo_backend_image_draw_type_text_say_textbox); +#else + cpymo_backend_image_draw( + 0, y, (float)e->gameconfig.imagesize_w, msg_h, + e->say.msgbox, 0, 0, e->say.msgbox_w, e->say.msgbox_h, + 1.0f, cpymo_backend_image_draw_type_text_say_textbox); +#endif + } + else { + float xywh[] = { + 0, + e->gameconfig.imagesize_h * 0.75f, + (float)e->gameconfig.imagesize_w, + e->gameconfig.imagesize_h * 0.25f + }; + + cpymo_backend_image_fill_rects(xywh, 1, gray, 0.5f, cpymo_backend_image_draw_type_text_say_textbox); + } + + if (e->say.name) { + float name_x = namebox_x; + + switch (e->gameconfig.namealign) + { + case 0: // middle + name_x += namebox_w / 2 - (float)e->say.name_width / 2; + break; + case 1: // left + name_x += cpymo_gameconfig_font_size(&e->gameconfig) / 2; + break; + case 2: // right + name_x += namebox_w - (float)e->say.name_width; + break; + } + + if (e->say.namebox) { +#ifdef DISABLE_IMAGE_SCALING + cpymo_backend_image_draw( + namebox_x + (namebox_w - e->say.namebox_w) / 2, + namebox_y + (namebox_h - e->say.namebox_h) / 2, + e->say.namebox_w, + e->say.namebox_h, + e->say.namebox, 0, 0, e->say.namebox_w, e->say.namebox_h, 1.0f, + cpymo_backend_image_draw_type_text_say_textbox); +#else + cpymo_backend_image_draw( + namebox_x, namebox_y, namebox_w, namebox_h, + e->say.namebox, 0, 0, e->say.namebox_w, e->say.namebox_h, 1.0f, + cpymo_backend_image_draw_type_text_say_textbox); +#endif + } + else { + float xywh[] = { namebox_x, namebox_y, namebox_w, namebox_h }; + cpymo_backend_image_fill_rects(xywh, 1, gray, 0.5f, cpymo_backend_image_draw_type_text_say_textbox); + } + + cpymo_backend_text_draw( + e->say.name, + name_x, namebox_y + cpymo_gameconfig_font_size(&e->gameconfig) / 10.0f * 9.0f, + e->gameconfig.textcolor, + (e->say.current_say_is_already_read && nds_read_gray_get()) ? + already_read_text_alpha : 1, + cpymo_backend_image_draw_type_text_say); + } + + if (e->say.textbox_usable) { + cpymo_textbox_draw(e, &e->say.textbox, cpymo_backend_image_draw_type_text_say); + } + } +} + +static inline error_t cpymo_say_load_msgbox_image(cpymo_say *say, cpymo_str name, cpymo_assetloader *l) +{ + if (say->msgbox) cpymo_backend_image_free(say->msgbox); + say->msgbox = NULL; + + char *msgbox_name = (char *)realloc(say->msgbox_name, name.len + 1); + if (msgbox_name) { + cpymo_str_copy(msgbox_name, name.len + 1, name); + say->msgbox_name = msgbox_name; + } + + error_t err = cpymo_assetloader_load_system_image( + &say->msgbox, + &say->msgbox_w, + &say->msgbox_h, + name, + l, + true); + + if (err != CPYMO_ERR_SUCC) say->msgbox = NULL; + + return err; +} + +static inline error_t cpymo_say_load_namebox_image(cpymo_say *say, cpymo_str name, cpymo_assetloader *l) +{ + if (say->namebox) cpymo_backend_image_free(say->namebox); + say->namebox = NULL; + + char *namebox_name = (char *)realloc(say->namebox_name, name.len + 1); + if (namebox_name) { + cpymo_str_copy(namebox_name, name.len + 1, name); + say->namebox_name = namebox_name; + } + + error_t err = cpymo_assetloader_load_system_image( + &say->namebox, + &say->namebox_w, + &say->namebox_h, + name, + l, + true); + + if (err != CPYMO_ERR_SUCC) say->namebox = NULL; + + return err; +} + +error_t cpymo_say_load_msgbox_and_namebox_image(cpymo_say *say, cpymo_str msgbox, cpymo_str namebox, cpymo_assetloader *l) +{ + cpymo_say_lazy_init(say, l); + error_t err = cpymo_say_load_namebox_image(say, namebox, l); + if (err != CPYMO_ERR_SUCC) { + say->namebox = NULL; + say->namebox_w = (int)(l->game_config->imagesize_w * 0.25f); + say->namebox_h = (int)(cpymo_gameconfig_font_size(l->game_config) * 1.5f); + + say->msgbox = NULL; + say->msgbox_w = (int)l->game_config->imagesize_w; + say->msgbox_h = (int)(l->game_config->imagesize_h * 0.25f); + + printf("[Warning] Can not load namebox image.\n"); + + return err; + } + + err = cpymo_say_load_msgbox_image(say, msgbox, l); + if (err != CPYMO_ERR_SUCC) { + say->msgbox = NULL; + say->msgbox_w = l->game_config->imagesize_w; + say->msgbox_h = (int)(l->game_config->imagesize_h * 0.25f); + + printf("[Warning] Can not load msgbox image.\n"); + + return err; + } + + return CPYMO_ERR_SUCC; +} + +/** Mermaid Flow Chart + +graph TB + A(START) --> cpymo_say_wait_text_fadein + cpymo_say_wait_text_fadein --> cpymo_say_wait_text_fadein_callback + cpymo_say_wait_text_fadein_callback --> cpymo_say_wait_text_reading + cpymo_say_wait_text_reading --> cpymo_say_wait_text_read_callback + cpymo_say_wait_text_read_callback --> cpymo_say_wait_text_fadein + cpymo_say_wait_text_read_callback --> E(END) + + **/ + +static error_t cpymo_say_wait_text_fadein_callback(cpymo_engine *e); + +bool cpymo_say_wait_process_auto_mode(cpymo_engine *e, float dt, bool prev_wait_result) +{ + if (!e->say.auto_mode) return prev_wait_result; + + if (prev_wait_result) { + e->say.auto_mode = false; + e->say.auto_mode_timer = -1; + return false; + } + + if (e->say.auto_mode_timer < 0) e->say.auto_mode_timer = auto_mode_time; + + if (!cpymo_audio_channel_is_playing(CPYMO_AUDIO_CHANNEL_VO, &e->audio) && + (!cpymo_audio_channel_is_playing(CPYMO_AUDIO_CHANNEL_SE, &e->audio) || + cpymo_audio_channel_is_looping(CPYMO_AUDIO_CHANNEL_SE, &e->audio)) && + !e->input.hide_window && !e->input.hide_window) + e->say.auto_mode_timer -= dt; + + return e->say.auto_mode_timer < 0; +} + +void cpymo_say_stop_auto_mode(cpymo_engine *e) +{ + e->say.auto_mode = false; + e->say.auto_mode_timer = -1; + if (e->say.textbox_usable) { + e->say.textbox.timer = 0.0f; + e->say.textbox.draw_cursor = true; + cpymo_engine_request_redraw(e); + } +} + +static bool cpymo_say_wait_text_reading(cpymo_engine *e, float dt) +{ + assert(e->say.textbox_usable); + + const enum cpymo_key_hold_result mouse_button_state = + cpymo_key_hold_update(e, &e->say.key_mouse_button, dt, e->input.mouse_button); + + if (e->say.hide_window) { + if (e->say.auto_mode) { + cpymo_say_stop_auto_mode(e); + return false; + } + else { + if (cpymo_input_foward_key_just_released(e)) { + e->say.hide_window = false; + cpymo_engine_request_redraw(e); + } + return false; + } + } + + bool open_backlog_by_slide = false; + if (e->prev_input.mouse_button && e->input.mouse_button) { + if (e->prev_input.mouse_position_useable && + e->input.mouse_position_useable) { + + if (e->input.mouse_y - e->prev_input.mouse_y > 10) { + open_backlog_by_slide = true; + } + } + } + + if (CPYMO_INPUT_JUST_PRESSED(e, up) || + e->input.mouse_wheel_delta > 0 || + open_backlog_by_slide) { + + if (!e->say.auto_mode) cpymo_backlog_ui_enter(e); + else cpymo_say_stop_auto_mode(e); + + return false; + } + else if ( + CPYMO_INPUT_JUST_RELEASED(e, cancel) || + (mouse_button_state == cpymo_key_hold_result_just_hold && + !e->ignore_next_mouse_button_flag)) { + + if (!e->say.auto_mode) cpymo_rmenu_enter(e); + else cpymo_say_stop_auto_mode(e); + + return false; + } + + return cpymo_say_wait_process_auto_mode(e, dt, + cpymo_textbox_wait_text_reading(e, dt, &e->say.textbox)); +} + +static bool cpymo_say_wait_text_fadein(cpymo_engine *e, float dt) +{ + assert(e->say.textbox_usable); + + if (e->say.hide_window) { + if (cpymo_input_foward_key_just_released(e)) { + e->say.hide_window = false; + cpymo_engine_request_redraw(e); + } + return false; + } + + return cpymo_textbox_wait_text_fadein(e, dt, &e->say.textbox); +} + +static error_t cpymo_say_wait_text_read_callback(cpymo_engine *e) +{ + cpymo_say *say = &e->say; + + assert(say->textbox_usable); + + if (!cpymo_textbox_all_finished(&say->textbox)) { + error_t err = cpymo_textbox_clear_page(&say->textbox, &e->backlog); + CPYMO_THROW(err); + + cpymo_wait_register_with_callback( + &e->wait, + &cpymo_say_wait_text_fadein, + &cpymo_say_wait_text_fadein_callback); + cpymo_engine_request_redraw(e); + } + else { + DISABLE_TEXTBOX(say); + say->active = false; + } + + cpymo_engine_request_redraw(e); + + return CPYMO_ERR_SUCC; +} + +static error_t cpymo_say_autosave_and_next(cpymo_engine *e) +{ + cpymo_save_autosave(e); + cpymo_wait_register_with_callback( + &e->wait, + &cpymo_say_wait_text_reading, + &cpymo_say_wait_text_read_callback); + return CPYMO_ERR_SUCC; +} + +static error_t cpymo_say_wait_text_fadein_callback(cpymo_engine *e) +{ + cpymo_key_hold_init(&e->say.key_mouse_button, e->input.mouse_button); + if (cpymo_engine_skipping(e)) { + cpymo_wait_register_with_callback( + &e->wait, + &cpymo_say_wait_text_reading, + &cpymo_say_wait_text_read_callback); + } + else { + cpymo_wait_callback_nextframe(&e->wait, cpymo_say_autosave_and_next); + } + return CPYMO_ERR_SUCC; +} + +error_t cpymo_say_start(cpymo_engine *e, cpymo_str name, cpymo_str text) +{ + cpymo_say_lazy_init(&e->say, &e->assetloader); + + uint64_t hash; + cpymo_str_hash_init(&hash); + cpymo_str_hash_append_cstr(&hash, "say:"); + cpymo_str_hash_append_cstr(&hash, e->interpreter->script->script_name); + char buf[32]; + sprintf(buf, "%u:%u:", + (unsigned)e->interpreter->script_parser.cur_pos, + (unsigned)e->interpreter->script_parser.cur_line); + cpymo_str_hash_append_cstr(&hash, buf); + cpymo_str_hash_append(&hash, name); + cpymo_str_hash_append(&hash, text); + + e->say.current_say_is_already_read = + cpymo_hash_flags_check(&e->flags, hash); + if (!e->say.current_say_is_already_read) + cpymo_hash_flags_add(&e->flags, hash); + + if (name.len > 0) { + char *current_name = (char *)realloc(e->say.current_name, name.len + 1); + if (current_name) { + cpymo_str_copy(current_name, name.len + 1, name); + e->say.current_name = current_name; + } + } + else { + free(e->say.current_name); + e->say.current_name = NULL; + } + + char *current_text = (char *)realloc(e->say.current_text, text.len + 1); + if (current_text) { + cpymo_str_copy(current_text, text.len + 1, text); + e->say.current_text = current_text; + } + + float fontsize = cpymo_gameconfig_font_size(&e->gameconfig); + + // Create name box + cpymo_say *say = &e->say; + RESET_NAME(say); + + cpymo_str_trim(&name); + if (name.len > 0) { + error_t err = cpymo_backend_text_create(&say->name, &say->name_width, name, fontsize); + if (err != CPYMO_ERR_SUCC) say->name = NULL; + } + + cpymo_backlog_record_write_name(&e->backlog, say->name, name); + + // Create say message text + float msglr_l = (float)e->gameconfig.msglr_l * e->gameconfig.imagesize_w / 540.0f; + float msglr_r = (float)e->gameconfig.msglr_r * e->gameconfig.imagesize_w / 540.0f; + float msgtb_t = (float)e->gameconfig.msgtb_t * e->gameconfig.imagesize_h / 360.0f; + float msgtb_b = (float)e->gameconfig.msgtb_b * e->gameconfig.imagesize_h / 360.0f; + +#ifndef DISABLE_IMAGE_SCALING + float ratio = (float)e->gameconfig.imagesize_w / (float)e->say.msgbox_w; + float msg_h = (float)e->say.msgbox_h * ratio; + float x = msglr_l; + float w = (float)e->gameconfig.imagesize_w - msglr_l - msglr_r; +#else + float msg_h = (float)e->say.msgbox_h; + float x = (e->gameconfig.imagesize_w - e->say.msgbox_w) / 2 + msglr_l; + float w = e->say.msgbox_w - msglr_l - msglr_r; +#endif + + float y = (float)e->gameconfig.imagesize_h - msg_h + msgtb_t; + float h = msg_h - msgtb_t - msgtb_b; + + const float text_alpha = + (e->say.current_say_is_already_read && nds_read_gray_get()) ? + already_read_text_alpha : 1.0f; + + error_t err; + ENABLE_TEXTBOX( + say, e, x, y, w, h, fontsize, e->gameconfig.textcolor, text_alpha, text, err); + + cpymo_engine_request_redraw(e); + + e->say.active = true; + + if (cpymo_engine_skipping(e)) { + cpymo_say_wait_text_read_callback(e); + cpymo_engine_request_redraw(e); + } + else { + cpymo_wait_register_with_callback( + &e->wait, + &cpymo_say_wait_text_fadein, + &cpymo_say_wait_text_fadein_callback); + } + + return err; +} + +void cpymo_say_hidewindow_until_click(cpymo_engine * e) +{ + e->say.hide_window = true; + cpymo_engine_request_redraw(e); +} diff --git a/cpymo-backends/nds/source/display-mode-prefs-nds.h b/cpymo-backends/nds/source/display-mode-prefs-nds.h new file mode 100644 index 00000000..dbb81f57 --- /dev/null +++ b/cpymo-backends/nds/source/display-mode-prefs-nds.h @@ -0,0 +1,32 @@ +/* CPyMO for NDS 1.2: portable per-game screen-mode preference grammar. + * No libnds dependency; tested by the host CI with exact serialized bytes. + * Mode 0: classic top, 1: classic bottom, 2: enhanced dual. + */ +#ifndef CPYMO_NDS_DISPLAY_MODE_PREFS_H +#define CPYMO_NDS_DISPLAY_MODE_PREFS_H +#include +#include + +/* Parse exactly one line. CRLF, LF and EOF are accepted; extra tokens, + * overflow and unsupported future modes default safely to classic. + * Compatibility: the 1.2 prototype wrote a single '1' for enhanced mode. */ +static inline unsigned nds_display_pref_parse(const char *src){ + char text[48]; + if(!src)return 0; + size_t n=strcspn(src,"\r\n"); + if(n>=sizeof text)return 0; + memcpy(text,src,n); + text[n]=0; + if(!strcmp(text,"1"))return 2; + unsigned mode=0; + int consumed=0; + if(sscanf(text,"NDSDISPLAY2 %u %n",&mode,&consumed)!=1 || + consumed<=0 || text[consumed]!=0 || mode>2)return 0; + return mode; +} +static inline int nds_display_pref_format(char *dst,size_t capacity,unsigned mode){ + if(!dst||capacity2)return 0; + int n=snprintf(dst,capacity,"NDSDISPLAY2 %u\n",mode); + return n>0 && (size_t)n +#include +#define NDS_DUAL_CANVAS_W 256 +#define NDS_DUAL_CANVAS_H 192 + +static inline uint16_t nds_dual_canvas_color(unsigned r,unsigned g,unsigned b){ + return (uint16_t)(0x8000u | (r&31u) | ((g&31u)<<5) | ((b&31u)<<10)); +} +/* A+B refinement: quiet, RGB555-native navy gradient instead of four + * abrupt 48-line stripes. Dialogue only occupies the TOP portion of the + * touch LCD in actual PyMO games, so the bottom stays intentionally clean: + * no fabricated footer or horizontal bar beneath the original textbox. + * Integer-only math; a scanline uses ONE color, avoiding spatial dithering + * noise over game-owned text. Keep this backdrop platform-independent. */ +static inline uint16_t nds_dual_canvas_row(unsigned y){ + if(y>=NDS_DUAL_CANVAS_H)y=NDS_DUAL_CANVAS_H-1; + unsigned bottom=(NDS_DUAL_CANVAS_H-1)-y; + const unsigned half=(NDS_DUAL_CANVAS_H-1)/2; + return nds_dual_canvas_color( + (5u*bottom+2u*y+half)/(NDS_DUAL_CANVAS_H-1), + (9u*bottom+4u*y+half)/(NDS_DUAL_CANVAS_H-1), + (13u*bottom+7u*y+half)/(NDS_DUAL_CANVAS_H-1)); +} +/* The balanced 1+3 art direction: the original quiet navy reading panel + * remains the base. A small, deterministic field of dusk stars and two soft + * cloud horizons give the unoccupied lower LCD a little visual-novel mood. + * Entirely 256x192 RGB555; no file I/O, heap, second buffer or animation. + * Story assets always render AFTER this backdrop. */ +static inline unsigned nds_dual_canvas_horizon(const uint8_t* knots,unsigned x){ + const unsigned slot=x>>4, frac=x&15u; + return ((unsigned)knots[slot]*(16u-frac)+(unsigned)knots[slot+1]*frac+8u)>>4; +} +static inline uint16_t nds_dual_canvas_cloud(unsigned y,int foreground){ + const uint16_t col=nds_dual_canvas_row(y); + const unsigned r=col&31u,g=(col>>5)&31u,b=(col>>10)&31u; + return foreground + ? nds_dual_canvas_color(r?r-1u:0u,g,b+1u) + : nds_dual_canvas_color(r+1u,g+1u,b+2u); +} +typedef struct {uint8_t x,y,light;} nds_dual_canvas_star; +static inline void nds_dual_canvas_draw_yield(uint16_t *pixels, + int interactive,int dialogue_visible, + void (*audio_tick)(void*),void* audio_ctx){ + (void)dialogue_visible; + if(!pixels)return; + for(unsigned y=0;yy*NDS_DUAL_CANVAS_W+p->x]=p->light?star:dim; + if(p->light){ + pixels[(p->y-1u)*NDS_DUAL_CANVAS_W+p->x]=dim; + pixels[p->y*NDS_DUAL_CANVAS_W+p->x+1u]=dim; + } + } + /* A single faint shooting star at the far edge alludes to concept #3. + * Unlike the concept illustration it is only 11 muted RGB555 pixels. */ + for(unsigned i=0;i<11;i++) + pixels[(108u+i/3u)*NDS_DUAL_CANVAS_W+(206u-i)]=dim; + pixels[108u*NDS_DUAL_CANVAS_W+206u]=star; + + /* Quiet inner-frame treatment from concept #1. It is deliberately weaker + * than the textbox border and must never act as a second dialogue box. */ + for(unsigned y=16;y<181;y++){ + const uint16_t base=nds_dual_canvas_row(y); + const unsigned r=base&31u,g=(base>>5)&31u,b=(base>>10)&31u; + const uint16_t edge=nds_dual_canvas_color(r+1u,g+2u,b+2u); + pixels[y*NDS_DUAL_CANVAS_W+7]=edge; + pixels[y*NDS_DUAL_CANVAS_W+248]=edge; + } + const uint16_t corner=nds_dual_canvas_color(6,9,13); + for(unsigned x=12;x<30;x++){ + pixels[181*NDS_DUAL_CANVAS_W+x]=corner; + pixels[181*NDS_DUAL_CANVAS_W+(255u-x)]=corner; + } +} +static inline void nds_dual_canvas_draw(uint16_t *pixels, + int interactive,int dialogue_visible){ + nds_dual_canvas_draw_yield(pixels,interactive,dialogue_visible,NULL,NULL); +} +#endif diff --git a/cpymo-backends/nds/source/dual-input-nds.h b/cpymo-backends/nds/source/dual-input-nds.h new file mode 100644 index 00000000..e2e8d7fa --- /dev/null +++ b/cpymo-backends/nds/source/dual-input-nds.h @@ -0,0 +1,61 @@ +/* NDS 1.2 physical touch routing, pure C for ROM + host regression. + * A display mode is not itself proof of a visible interactive touch + * layer: enhanced mode's hidden lower LCD cannot accept menu taps. + */ +#ifndef CPYMO_NDS_DUAL_INPUT_H +#define CPYMO_NDS_DUAL_INPUT_H +typedef struct { + float x,y; + unsigned mouse_button,ok; +} nds_touch_sample; + +/* 0 classic upper: touch bottom auxiliary to advance. + * 1 classic lower: native game touch coordinates. + * 2 enhanced: native coordinate choice/UI hit-tests, narrative tap=A. + * hidden enhanced lower: first touch is separately consumed as wake-up. */ +static inline unsigned nds_touch_uses_coordinates(unsigned mode, + unsigned enhanced_visible,unsigned ui,unsigned choice){ + return mode==1 || (mode==2 && enhanced_visible && (ui||choice)); +} +/* A physical pen contact must keep the meaning it had on touch-down. + * PyMO can enter a script choice or menu while that same contact is held; + * enhanced narrative touch=A would otherwise become menu mouse=pressed. + * Conversely a menu->story transition could synthesize an A release. + * Return 0 (no boundary), 1 (sanitize previous input), or 2 (sanitize + * previous input and block the continuing pen until it is lifted). + * A fresh pen-down AFTER a UI transition is always accepted normally. */ +typedef struct { + unsigned valid,coordinate_role,physical_held; +} nds_touch_role_tracker; + +static inline unsigned nds_touch_role_step(nds_touch_role_tracker* state, + unsigned coordinate_role, + unsigned physical_held){ + if(!state)return 0; + coordinate_role=!!coordinate_role; + physical_held=!!physical_held; + unsigned crossing=state->valid && state->coordinate_role!=coordinate_role + && state->physical_held; + state->valid=1; + state->coordinate_role=coordinate_role; + state->physical_held=physical_held; + return crossing?(physical_held?2u:1u):0u; +} + +static inline nds_touch_sample nds_touch_project(unsigned mode, + unsigned enhanced_visible,unsigned ui,unsigned choice, + unsigned physical_touch,unsigned blocked,unsigned key_a, + int screen_x,int screen_y,float screen_scale,float letterbox_x, + float letterbox_y){ + nds_touch_sample out={0,0,0,0}; + unsigned touch=physical_touch&&!blocked; + unsigned coordinates=nds_touch_uses_coordinates(mode,enhanced_visible,ui,choice); + out.ok=!!key_a || (touch&&!coordinates); + out.mouse_button=touch&&coordinates; + if(out.mouse_button && screen_scale>0.f){ + out.x=(screen_x-letterbox_x)/screen_scale; + out.y=(screen_y-letterbox_y)/screen_scale; + } + return out; +} +#endif diff --git a/cpymo-backends/nds/source/dual-layout-nds.h b/cpymo-backends/nds/source/dual-layout-nds.h new file mode 100644 index 00000000..c4fdd56d --- /dev/null +++ b/cpymo-backends/nds/source/dual-layout-nds.h @@ -0,0 +1,33 @@ +/* NDS 1.2 enhanced dialogue geometry, pure C with no libnds coupling. + * Derived from upstream 3DS behavior: preserve game-owned message/name + * box assets while translating their origin toward the top of the touch LCD. + */ +#ifndef CPYMO_NDS_DUAL_LAYOUT_H +#define CPYMO_NDS_DUAL_LAYOUT_H + +/* The lower LCD is 192 px tall. Fit artwork in its original scale. + * The 3DS backend targets a fixed top margin; NDS uses a pixel-space margin, + * since PyMO logical scene resolutions vary from game to game. + * Do not move a dialog when that would clip the message or speaker label. */ +static inline float nds_dual_dialogue_shift(float logical_height, + float msg_height,float font_height,float name_offset, + int has_name,float scale,float letterbox_y){ + if(logical_height<=0.f||msg_height<=0.f||scale<=0.f)return 0.f; + float origin=logical_height-msg_height; + if(has_name)origin-=font_height*1.4f+name_offset; + /* Safe-area constants are physical pixels, not game-specific scale units. */ + const float top_margin=14.f, bottom_limit=185.f; + const float available=(bottom_limit-top_margin)/scale; + float content_height=logical_height-origin; + float target=(top_margin-letterbox_y)/scale; + float shift=target-origin; + if(content_height>available){ + /* Oversized original textbox: prefer no shift rather than clipping it + further. This preserves default legibility until adapted per game. */ + return 0.f; + } + float lowest=(bottom_limit-letterbox_y)/scale-logical_height; + if(shift>lowest)shift=lowest; + return shift; +} +#endif diff --git a/cpymo-backends/nds/source/dual-screen-nds.h b/cpymo-backends/nds/source/dual-screen-nds.h new file mode 100644 index 00000000..9ce6e2a4 --- /dev/null +++ b/cpymo-backends/nds/source/dual-screen-nds.h @@ -0,0 +1,202 @@ +/* CPyMO for NDS · experimental dual-screen routing for 1.2. + * Original independent implementation; behavior informed by the 3DS backend's + * draw-type partition. No upstream 3DS rendering code is copied. + * L cycles classic top -> classic bottom -> enhanced dual screen. + * SELECT still quick-loads; Y still hides/reveals the auxiliary LCD. + */ +#ifndef CPYMO_NDS_DUALSCREEN_H +#define CPYMO_NDS_DUALSCREEN_H +#include "display-mode-prefs-nds.h" +#include "dual-layout-nds.h" +#include "dual-title-nds.h" +/* Defined later in main.c, declared here for enhanced geometry. */ +static float display_scale(void); +static float display_y(void); + +/* 0: classic game top / auxiliary bottom + * 1: classic game bottom / auxiliary top + * 2: enhanced scene top / dialogue or menu bottom. */ +static unsigned nds_display_mode; +static bool nds_dual_mode, nds_dual_bottom_pass; +/* A transition from classic-lower to enhanced must not show the stale + * sub-VRAM help panel on the physical lower LCD before its new draw. */ +static bool nds_display_swap_pending; +static nds_dual_title_gate nds_title_gate; +/* Do not synchronously write FAT on every L press. Coalesce a burst of + * three-mode cycling and persist once it settles, or on game exit. */ +static bool nds_dual_save_pending; +static u64 nds_dual_save_after; +/* magic, selected, enabled, toggles, saves, save failures, bottom draws, + * skipped top, skipped bottom */ +volatile unsigned nds_dual_state[9]={0x4e445332}; + +static bool nds_dual_active(void){ + /* A boot/title selection is a complete original game screen. + Split only after the story has reached its first real #say. */ + return nds_dual_mode && nds_dual_title_allow_split(&nds_title_gate) && + nds_playing && !error_ui_active && !nds_aux_hidden(); +} +static bool nds_dual_is_say(enum cpymo_backend_image_draw_type type){ + return type==cpymo_backend_image_draw_type_text_say || + type==cpymo_backend_image_draw_type_text_say_textbox; +} +static bool nds_dual_has_choice(void){ + return !cpymo_ui_enabled(&engine) && engine.select_img.selections!=NULL; +} +/* Match CPyMO's actual 3DS behavior: engine UI background remains on + * the upper screen; individual interactive elements live below. */ +static bool nds_dual_is_ui(enum cpymo_backend_image_draw_type type){ + return type==cpymo_backend_image_draw_type_ui_element || + type==cpymo_backend_image_draw_type_ui_element_bg; +} +static bool nds_dual_accept(enum cpymo_backend_image_draw_type type){ + if(!nds_dual_active())return true; + /* Mirror 3DS: UI background and non-interactive graphics above, + interactive menu elements below; story choices below on NDS. */ + bool lower = cpymo_ui_enabled(&engine)?nds_dual_is_ui(type): + (nds_dual_is_say(type) || + (nds_dual_has_choice() && type==cpymo_backend_image_draw_type_sel_img)); + if(lower != nds_dual_bottom_pass){ + nds_dual_state[nds_dual_bottom_pass?8:7]++; + return false; + } + return true; +} +/* 3DS-style: original game assets retain their size, but the complete + * dialogue/name group starts around 14 physical pixels down, not 20% of + * the logical game height. Detect oversized assets and avoid clipping. */ +static float nds_dual_say_offset(void){ + if(!nds_dual_active() || !nds_dual_bottom_pass || + cpymo_ui_enabled(&engine))return 0; + float height=(float)engine.gameconfig.imagesize_h; + float box_h=height*.25f; + if(engine.say.msgbox && engine.say.msgbox_h>0 && engine.say.msgbox_w>0) + box_h=(float)engine.say.msgbox_h * + ((float)engine.gameconfig.imagesize_w/(float)engine.say.msgbox_w); + float name_offset=(float)engine.gameconfig.nameboxorg_y / 360.f * height; + return nds_dual_dialogue_shift(height,box_h, + cpymo_gameconfig_font_size(&engine.gameconfig),name_offset, + engine.say.name!=NULL,display_scale(),display_y()); +} +static void nds_dual_filename(char* path,size_t size,const char* gamedir){ + snprintf(path,size,"%s/save/nds-dualscreen-mode.txt",gamedir); +} +static void nds_dual_load(const char* gamedir){ + nds_dual_title_reset(&nds_title_gate); + nds_dual_save_pending=false; + nds_dual_save_after=0; + nds_display_mode=0; + nds_dual_mode=false; + nds_dual_bottom_pass=false; + char path[512];nds_dual_filename(path,sizeof path,gamedir); + FILE* f=fopen(path,"rb"); + if(f){ + char line[48]={0}; + if(fgets(line,sizeof line,f)) + nds_display_mode=nds_display_pref_parse(line); + fclose(f); + } + nds_dual_mode=nds_display_mode==2; + nds_dual_state[1]=nds_display_mode; + nds_dual_state[2]=0; +} +static void nds_dual_save(const char* gamedir){ + char path[512],line[32]; + nds_dual_filename(path,sizeof path,gamedir); + bool ok=nds_display_pref_format(line,sizeof line,nds_display_mode); + FILE* f=ok&&nds_save_ensure_directory(gamedir)?fopen(path,"wb"):NULL; + if(f){ok=fputs(line,f)!=EOF;if(fclose(f))ok=false;} + else ok=false; + nds_dual_state[4]++; + if(!ok)nds_dual_state[5]++; +} +static void nds_dual_flush_mode(void){ + if(!nds_dual_save_pending)return; + /* The game's assetloader still owns gamedir before engine teardown. */ + nds_dual_save_pending=false; + nds_dual_save(engine.assetloader.gamedir); +} +static void nds_dual_poll_mode(void){ + if(nds_dual_save_pending && tickGetCount()>=nds_dual_save_after) + nds_dual_flush_mode(); +} +static void nds_display_commit_pending_swap(void){ + if(!nds_display_swap_pending)return; + /* Both target VRAM surfaces have been filled by synchronous libnds + * dmaCopy. Switch at VBlank so no old auxiliary pixels are exposed. */ + swiWaitForVBlank(); + lcdMainOnTop(); + screens_swapped=false; + presentation_state[1]=0; + nds_display_swap_pending=false; +} +static void nds_display_start(void){ + nds_display_swap_pending=false; + nds_dual_mode=nds_display_mode==2; + nds_dual_bottom_pass=false; + /* The selected game may be launched after a previous game used lower LCD. + Always establish a known physical mapping BEFORE applying its preference. + Blind lcdSwap() would invert a still-swapped previous session. */ + lcdMainOnTop();screens_swapped=false; + if(nds_display_mode==1){lcdSwap();screens_swapped=true;} + presentation_state[1]=screens_swapped; + nds_dual_state[1]=nds_display_mode; +} +static void nds_display_restore_launcher(void){ + nds_display_swap_pending=false; + nds_dual_flush_mode(); + /* Launcher always owns the regular upper-game/lower-helper assignment. + Do not leak per-game LCD routing, split drawing or hidden helper state. */ + nds_dual_mode=false; + nds_dual_bottom_pass=false; + nds_aux_override=false; + lcdMainOnTop(); + screens_swapped=false; + presentation_state[1]=0; +} +static void nds_display_cycle(void){ + /* A stylus held while L switches touch-routing modes must not become a + synthetic mouse-release click on the newly selected screen. Ignore + this contact until the stylus has actually been lifted. */ + unsigned held=keysHeld(); + if(held&KEY_TOUCH)nds_touch_blocked=true; + /* The core snapshots engine.input as prev_input on the next update. + Scrub the OLD stylus edge before that snapshot: classic-upper and + enhanced narrative taps are mapped to "ok", not "mouse_button". + Ignoring only mouse-release leaves a false A-release at L transitions + that can advance text or select a highlighted script choice. + Preserve a genuinely held physical A button; invalidate the stylus + mouse coordinate, which belongs to the PREVIOUS screen mapping. */ + cpymo_input_ignore_next_mouse_button_event(&engine); + engine.input.ok=!!(held&KEY_A); + engine.input.mouse_button=false; + engine.input.mouse_position_useable=false; + unsigned next=(nds_display_mode+1)%3; + /* LCD swap applies only to classic lower-game. Enhanced always has + the scene on the physical upper LCD and interactive UI below. */ + if(next==1){lcdSwap();screens_swapped=true;} + else if(nds_display_mode==1 && next==2 && screens_swapped){ + /* Hold the old physical mapping until next redraw publishes BOTH LCDs. */ + nds_display_swap_pending=true; + } + else if(nds_display_mode==1 || screens_swapped){ + lcdMainOnTop();screens_swapped=false; + } + nds_display_mode=next; + nds_dual_mode=next==2; + nds_dual_bottom_pass=false; + presentation_state[1]=screens_swapped; + /* A newly selected display must be visible, even when the previous + auxiliary LCD was temporarily hidden with Y. */ + nds_aux_override=false; + nds_aux_refresh(); + nds_dual_state[1]=nds_display_mode; + nds_dual_state[3]++; + /* 0.75s after the *last* switch: a 0→1→2 sequence writes only mode 2. + This keeps rapid L cycling responsive on slow flashcart storage while + still persisting the chosen state during ordinary play. */ + nds_dual_save_pending=true; + nds_dual_save_after=tickGetCount()+(TICK_FREQ*3u)/4u; + cpymo_engine_request_redraw(&engine); +} +#endif diff --git a/cpymo-backends/nds/source/dual-title-nds.h b/cpymo-backends/nds/source/dual-title-nds.h new file mode 100644 index 00000000..8c642b50 --- /dev/null +++ b/cpymo-backends/nds/source/dual-title-nds.h @@ -0,0 +1,32 @@ +/* 1.2 enhanced-display opening-screen gate. + * Keep the original title/entry selection as one authored upper-screen + * scene, instead of splitting its decorative labels and input sprites. + * Transition only on actual narrative dialogue, not on a script filename + * (PyMO games use many different startup script names). Independently + * tracks narrative progress even when the player starts in classic mode. + * The gate is session-local; it never touches saves or script state. + * Public independent implementation, header also compiled in host tests. + */ +#ifndef CPYMO_NDS_DUAL_TITLE_H +#define CPYMO_NDS_DUAL_TITLE_H + +typedef struct { + unsigned before_story; +} nds_dual_title_gate; + +static inline void nds_dual_title_reset(nds_dual_title_gate* gate){ + gate->before_story=1u; +} +static inline unsigned nds_dual_title_observe(nds_dual_title_gate* gate, + unsigned say_active, + unsigned ui_active, + unsigned choice_active){ + if(!gate->before_story || !say_active || ui_active || choice_active) + return 0u; + gate->before_story=0u; + return 1u; /* one-time transition: repaint lower LCD as dialogue */ +} +static inline unsigned nds_dual_title_allow_split(const nds_dual_title_gate* gate){ + return !gate->before_story; +} +#endif diff --git a/cpymo-backends/nds/source/font.h b/cpymo-backends/nds/source/font.h new file mode 100644 index 00000000..764b11ae --- /dev/null +++ b/cpymo-backends/nds/source/font.h @@ -0,0 +1,4 @@ +/* Noto Sans CJK SC, SIL OFL1.1. */ +static const unsigned short glyph_codes[]={32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,183,215,8212,8216,8217,8220,8221,8230,9632,12288,12289,12290,12295,12298,12299,12300,12301,12302,12303,12354,12356,12363,12364,12371,12374,12383,12384,12387,12392,12398,12399,12427,12471,12479,12483,12515,12540,19968,19969,19971,19975,19977,19978,19979,19981,19982,19987,19988,19990,19994,19996,19997,20004,20005,20006,20010,20013,20016,20020,20026,20027,20029,20030,20037,20040,20041,20043,20046,20048,20056,20061,20063,20064,20070,20080,20081,20102,20107,20108,20110,20113,20116,20123,20129,20132,20135,20142,20146,20154,20160,20165,20170,20173,20174,20180,20182,20184,20185,20195,20196,20197,20202,20204,20208,20214,20215,20219,20221,20223,20241,20249,20250,20256,20260,20272,20276,20280,20284,20294,20301,20302,20303,20307,20309,20313,20315,20316,20320,20351,20363,20379,20381,20387,20389,20391,20415,20419,20445,20449,20457,20462,20498,20505,20511,20540,20551,20559,20570,20572,20581,20598,20599,20658,20667,20677,20687,20725,20731,20799,20803,20805,20808,20809,20813,20817,20828,20837,20840,20843,20844,20845,20848,20849,20851,20852,20854,20855,20860,20869,20876,20877,20882,20889,20908,20912,20914,20915,20917,20919,20925,20928,20934,20937,20940,20943,20945,20957,20960,20961,20973,20985,20986,20998,20999,21002,21010,21015,21017,21018,21021,21028,21033,21035,21038,21040,21046,21047,21049,21050,21051,21058,21069,21076,21093,21095,21097,21103,21106,21147,21149,21150,21151,21152,21153,21160,21161,21162,21170,21171,21183,21187,21193,21205,21247,21253,21254,21270,21271,21273,21305,21306,21307,21313,21315,21319,21320,21322,21326,21333,21334,21335,21344,21345,21355,21360,21363,21364,21367,21380,21381,21382,21385,21387,21397,21400,21402,21407,21410,21435,21439,21442,21448,21450,21451,21452,21453,21457,21462,21463,21464,21472,21475,21476,21477,21478,21480,21482,21483,21485,21487,21488,21490,21491,21495,21497,21505,21507,21508,21512,21516,21517,21518,21520,21521,21527,21534,21542,21543,21547,21548,21551,21553,21557,21560,21561,21566,21568,21571,21574,21578,21592,21596,21602,21608,21619,21628,21629,21644,21650,21652,21653,21667,21670,21676,21683,21688,21691,21693,21696,21697,21703,21704,21709,21710,21712,21719,21727,21734,21736,21738,21741,21767,21780,21792,21806,21807,21834,21843,21855,21862,21863,21888,21890,21891,21895,21898,21903,21912,21916,21966,21970,21985,21999,22016,22030,22043,22047,22068,22105,22120,22163,22218,22228,22235,22238,22240,22242,22253,22256,22260,22266,22269,22270,22278,22280,22307,22312,22320,22330,22351,22352,22359,22362,22363,22369,22402,22411,22446,22478,22495,22519,22522,22524,22534,22581,22609,22622,22681,22686,22763,22766,22768,22788,22791,22797,22799,22805,22806,22810,22812,22815,22823,22825,22826,22833,22836,22841,22846,22855,22856,22859,22868,22871,22882,22899,22902,22905,22909,22914,22969,22987,22993,22995,22996,23039,23047,23113,23244,23376,23383,23384,23395,23396,23398,23401,23425,23427,23429,23432,23433,23436,23450,23452,23453,23454,23457,23458,23460,23475,23478,23481,23485,23487,23490,23494,23506,23518,23519,23521,23544,23545,23547,23548,23553,23558,23559,23565,23567,23569,23572,23574,23578,23588,23601,23610,23612,23613,23614,23618,23621,23627,23631,23637,23646,23653,23665,23681,23696,23706,23707,23724,23736,23777,23853,24029,24037,24038,24039,24040,24046,24049,24050,24052,24062,24065,24066,24067,24072,24076,24088,24102,24110,24120,24178,24179,24180,24182,24184,24202,24211,24212,24213,24215,24230,24231,24237,24247,24265,24266,24310,24314,24320,24323,24324,24335,24341,24352,24367,24369,24377,24378,24403,24418,24433,24443,24444,24448,24452,24453,24456,24465,24466,24471,24490,24494,24515,24517,24518,24525,24535,24536,24537,24555,24565,24573,24576,24577,24590,24597,24604,24605,24613,24615,24616,24618,24635,24651,24656,24674,24680,24687,24688,24694,24700,24708,24713,24736,24744,24748,24754,24773,24778,24785,24796,24815,24819,24833,24840,24847,24863,24867,24895,24908,24917,24930,24936,24999,25004,25026,25103,25104,25105,25110,25138,25140,25143,25151,25152,25159,25163,25165,25169,25171,25172,25176,25187,25191,25196,25197,25206,25214,25215,25226,25235,25237,25238,25239,25240,25242,25243,25250,25252,25253,25260,25265,25269,25273,25277,25282,25285,25289,25292,25293,25294,25296,25298,25302,25304,25307,25311,25315,25318,25319,25320,25321,25325,25340,25342,25343,25345,25346,25351,25353,25361,25377,25380,25381,25384,25386,25402,25405,25417,25439,25442,25454,25481,25484,25487,25490,25504,25506,25509,25512,25551,25552,25554,25569,25597,25602,25630,25644,25645,25670,25671,25674,25684,25688,25705,25720,25745,25746,25758,25773,25797,25806,25830,25874,25893,25903,25910,25913,25918,25925,25928,25943,25945,25950,25955,25968,25972,25976,25991,26009,26012,26029,26031,26032,26041,26049,26053,26063,26080,26082,26085,26086,26087,26089,26102,26126,26127,26131,26143,26144,26149,26152,26159,26174,26179,26194,26197,26202,26216,26222,26223,26228,26238,26242,26257,26262,26263,26286,26354,26355,26356,26366,26367,26368,26371,26376,26377,26379,26381,26391,26395,26397,26399,26406,26408,26410,26411,26412,26415,26421,26426,26432,26434,26435,26438,26448,26463,26464,26465,26469,26494,26495,26497,26500,26519,26524,26530,26550,26575,26576,26579,26580,26588,26597,26631,26635,26641,26657,26679,26680,26681,26684,26690,26694,26696,26723,26725,26757,26790,26799,26800,26816,26834,26840,26885,26893,26970,27004,27010,27138,27169,27224,27225,27284,27425,27426,27431,27442,27454,27465,27490,27491,27492,27493,27494,27511,27513,27515,27531,27573,27597,27599,27604,27605,27611,27627,27631,27668,27700,27704,27713,27714,27719,27721,27735,27744,27773,27785,27801,27809,27813,27833,27835,27838,27839,27849,27850,27861,27867,27873,27874,27880,27882,27891,27905,27922,27927,27934,27941,27954,27963,27966,27969,27973,27975,27979,27985,27987,28010,28014,28020,28023,28024,28040,28044,28082,28101,28107,28108,28129,28145,28165,28176,28183,28201,28216,28246,28287,28293,28304,28346,28369,28385,28393,28404,28418,28422,28436,28459,28526,28548,28552,28577,28625,28779,28781,28783,28784,28789,28796,28799,28809,28822,28843,28856,28857,28858,28865,28866,28872,28888,28895,28902,28903,28909,28982,29031,29060,29087,29233,29238,29240,29245,29255,29256,29260,29275,29289,29305,29366,29369,29378,29408,29420,29421,29436,29467,29468,29486,29577,29579,29609,29615,29616,29627,29664,29677,29702,29730,29790,29827,29916,29942,29976,29978,29983,29992,29993,30000,30001,30005,30007,30011,30028,30041,30053,30058,30070,30095,30097,30103,30116,30140,30149,30165,30171,30331,30333,30334,30340,30361,30382,30385,30417,30422,30424,30427,30446,30447,30452,30456,30460,30475,30495,30524,30528,30555,30561,30629,30636,30693,30697,30701,30707,30719,30721,30768,30772,30828,30830,30861,30862,30887,30896,30906,30952,31034,31038,31069,31070,31080,31105,31163,31168,31179,31181,31185,31204,31215,31216,31227,31243,31245,31283,31295,31350,31354,31359,31361,31364,31373,31383,31435,31449,31455,31471,31505,31508,31532,31546,31561,31572,31609,31614,31616,31639,31649,31665,31726,31735,31800,31859,31867,31881,31890,31895,31934,31946,31967,31995,32032,32034,32039,32043,32047,32147,32218,32321,32418,32422,32423,32426,32435,32439,32440,32445,32447,32451,32454,32455,32456,32463,32467,32469,32473,32477,32479,32487,32493,32511,32531,32534,32536,32553,32568,32570,32599,32622,32626,32654,32670,32673,32763,32764,32768,32769,32771,32773,32780,32781,32791,32819,32842,32844,32858,32862,32908,32920,32922,32929,32932,32937,32943,32958,32972,32974,32999,33014,33016,33021,33030,33039,33041,33050,33073,33080,33109,33136,33147,33151,33152,33179,33181,33258,33267,33268,33298,33322,33324,33394,33395,33402,33410,33426,33457,33485,33509,33510,33521,33579,33609,33633,33647,33707,33719,33756,33830,33853,33945,34013,34223,34255,34382,34385,34394,34429,34430,34588,34615,34633,34701,34880,34892,34903,34913,34915,34917,34920,34923,34924,34928,34955,34966,34987,35010,35013,35029,35033,35036,35037,35044,35065,35074,35114,35167,35199,35201,35265,35266,35268,35270,35273,35282,35299,35302,35328,35373,35377,35441,35442,35486,35712,35745,35746,35748,35753,35758,35760,35762,35766,35768,35770,35774,35775,35776,35777,35781,35782,35785,35786,35789,35797,35805,35806,35813,35814,35821,35823,35828,35831,35835,35838,35841,35843,35848,35859,35868,35874,35880,35937,35946,35947,36039,36127,36129,36131,36133,36134,36135,36143,36148,36149,36151,36153,36154,36164,36172,36182,36186,36190,36192,36196,36208,36214,36215,36225,36229,36234,36255,36259,36275,36292,36300,36305,36317,36319,36335,36339,36361,36367,36393,36454,36523,36524,36530,36538,36617,36710,36716,36718,36731,36733,36735,36739,36742,36763,36776,36793,36794,36798,36807,36808,36814,36816,36817,36820,36824,36825,36827,36828,36829,36830,36831,36843,36857,36861,36864,36865,36866,36867,36873,36879,36882,36884,36887,36890,36891,36894,36895,36914,36920,36935,36938,36941,36947,36965,36974,36984,36991,37027,37096,37117,37197,37202,37240,37266,37319,37324,37325,37326,37327,37329,38024,38046,38047,38053,38065,38081,38134,38138,38142,38147,38169,38215,38236,38271,38291,38376,38378,38381,38382,38386,38388,38393,38420,38428,38450,38451,38452,38453,38459,38463,38468,38469,38470,38476,38480,38497,38498,38500,38505,38506,38519,38534,38543,38544,38548,38577,38590,38632,38634,38646,38654,38656,38686,38706,38718,38745,38750,38752,38754,38795,38816,38899,38917,39030,39033,39034,39035,39038,39039,39044,39046,39057,39063,39064,39068,39069,39072,39076,39118,39128,39134,39135,39184,39277,39280,39295,39302,39318,39532,39540,39542,39550,39569,39640,40092,40635,40644,40654,40657,40664,40669,40763,40784,40857,65281,65288,65289,65292,65306,65307,65311}; +static const unsigned char glyph_advances[]={3,4,6,7,7,12,9,4,4,4,6,7,4,5,4,5,7,7,7,7,7,7,7,7,7,7,4,4,7,7,7,6,12,8,9,8,9,8,7,9,9,4,7,8,7,11,9,10,8,10,8,8,8,9,7,11,7,7,8,4,5,4,7,7,8,7,8,7,8,7,4,7,8,4,4,7,4,12,8,8,8,8,5,6,5,8,7,10,6,7,6,4,4,4,7,13,13,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13}; +static const unsigned short glyph_rows[][14]={{0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,6,6,6,6,4,4,4,0,6,6,0,0,0},{0,22,18,18,18,0,0,0,0,0,0,0,0,0},{0,0,36,36,126,36,20,127,18,18,18,0,0,0},{8,24,62,6,6,12,24,32,32,34,28,8,0,0},{0,270,154,147,83,1874,1198,3232,1168,1168,1800,0,0,0},{0,28,36,52,20,12,142,210,115,226,412,0,0,0},{0,6,2,2,2,0,0,0,0,0,0,0,0,0},{8,4,4,6,6,2,2,2,6,6,4,4,8,0},{2,2,6,4,4,4,4,4,4,4,6,2,2,0},{0,8,30,12,20,0,0,0,0,0,0,0,0,0},{0,0,0,8,8,8,127,8,8,8,0,0,0,0},{0,0,0,0,0,0,0,0,0,2,6,4,2,0},{0,0,0,0,0,0,0,14,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,2,6,0,0,0},{0,16,24,8,8,8,4,4,4,2,2,2,1,1},{0,28,54,34,98,98,98,98,34,54,28,0,0,0},{0,28,28,24,24,24,24,24,24,24,62,0,0,0},{0,28,50,32,32,48,16,24,12,6,126,0,0,0},{0,30,50,32,48,28,48,32,96,51,30,0,0,0},{0,48,56,56,52,54,50,127,48,48,48,0,0,0},{0,62,6,2,30,50,32,96,32,51,30,0,0,0},{0,56,36,2,2,62,38,98,98,38,28,0,0,0},{0,126,32,48,16,24,8,8,8,8,12,0,0,0},{0,28,38,34,38,28,62,34,98,34,60,0,0,0},{0,28,50,34,34,98,60,32,32,50,30,0,0,0},{0,0,0,0,6,2,0,0,0,2,6,0,0,0},{0,0,0,0,6,2,0,0,0,2,6,4,2,0},{0,0,0,64,56,6,6,56,96,0,0,0,0,0},{0,0,0,0,127,0,0,127,0,0,0,0,0,0},{0,0,0,2,14,48,112,30,3,0,0,0,0,0},{0,30,18,16,16,24,12,12,0,4,12,0,0,0},{0,0,496,520,1028,1250,2194,1170,1170,1010,6,12,248,0},{0,24,24,60,36,36,38,126,66,67,195,0,0,0},{0,62,70,70,70,62,198,134,134,198,126,0,0,0},{0,120,76,6,2,2,2,2,6,204,120,0,0,0},{0,62,102,198,134,134,134,134,198,102,62,0,0,0},{0,126,6,6,6,62,6,6,6,6,126,0,0,0},{0,126,6,6,6,62,6,6,6,6,6,0,0,0},{0,120,204,6,2,2,226,130,134,204,120,0,0,0},{0,134,134,134,134,254,134,134,134,134,134,0,0,0},{0,6,6,6,6,6,6,6,6,6,6,0,0,0},{0,48,48,48,48,48,48,48,48,18,30,0,0,0},{0,198,102,54,22,30,62,102,70,198,134,0,0,0},{0,6,6,6,6,6,6,6,6,6,126,0,0,0},{0,262,390,398,462,330,338,338,306,290,258,0,0,0},{0,134,134,142,154,150,182,166,230,198,198,0,0,0},{0,120,204,134,386,386,386,386,134,204,120,0,0,0},{0,62,70,198,198,70,62,6,6,6,6,0,0,0},{0,120,204,134,386,386,386,386,134,204,120,32,448,0},{0,126,70,198,198,70,62,54,102,70,198,0,0,0},{0,60,102,2,6,28,112,96,64,102,60,0,0,0},{0,127,24,24,24,24,24,24,24,24,24,0,0,0},{0,134,134,134,134,134,134,134,134,204,120,0,0,0},{0,67,67,98,98,38,36,52,20,28,24,0,0,0},{0,1123,1122,1650,594,594,726,660,908,396,396,0,0,0},{0,98,38,52,28,24,24,20,54,98,67,0,0,0},{0,99,34,50,20,28,12,8,8,8,8,0,0,0},{0,126,96,32,48,24,8,12,4,6,126,0,0,0},{0,14,2,2,2,2,2,2,2,2,2,2,14,0},{0,1,2,2,2,6,4,4,4,8,8,8,16,16},{0,7,4,4,4,4,4,4,4,4,4,4,6,0},{0,8,28,20,52,34,34,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,127,0},{4,12,16,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,28,34,32,60,34,50,62,0,0,0},{0,2,2,2,62,102,66,66,66,102,62,0,0,0},{0,0,0,0,60,6,2,2,2,38,60,0,0,0},{0,64,64,64,124,102,66,66,66,102,92,0,0,0},{0,0,0,0,60,38,98,126,2,6,60,0,0,0},{0,28,6,6,15,6,6,6,6,6,6,0,0,0},{0,0,0,0,124,38,34,54,30,2,126,66,98,62},{0,2,2,2,62,102,102,66,66,66,66,0,0,0},{0,6,2,0,2,2,2,2,2,2,2,0,0,0},{0,6,2,0,2,2,2,2,2,2,2,2,2,3},{0,2,2,2,34,50,26,30,54,34,98,0,0,0},{2,2,2,2,2,2,2,2,2,6,6,0,0,0},{0,0,0,0,954,1766,1126,1122,1122,1122,1122,0,0,0},{0,0,0,0,58,102,102,66,66,66,66,0,0,0},{0,0,0,0,60,102,66,66,66,102,60,0,0,0},{0,0,0,0,58,102,66,66,66,102,62,2,2,2},{0,0,0,0,124,102,66,66,66,102,124,64,64,64},{0,0,0,0,26,6,6,2,2,2,2,0,0,0},{0,0,0,0,30,2,6,28,48,50,30,0,0,0},{0,0,6,6,31,6,6,6,6,6,28,0,0,0},{0,0,0,0,98,98,98,98,98,102,92,0,0,0},{0,0,0,0,99,34,50,22,20,28,12,0,0,0},{0,0,0,0,563,818,882,342,334,460,204,0,0,0},{0,0,0,0,50,22,28,12,28,18,35,0,0,0},{0,0,0,0,99,34,34,22,20,28,8,8,12,6},{0,0,0,0,62,16,8,12,4,2,63,0,0,0},{0,12,4,4,4,4,3,6,4,4,4,4,12,0},{2,2,2,2,2,2,2,2,2,2,2,2,2,2},{0,3,4,4,4,4,12,4,4,4,4,4,2,0},{0,0,0,0,0,6,106,48,0,0,0,0,0,0},{0,0,0,0,0,224,224,64,0,0,0,0,0,0},{0,0,0,520,792,432,224,224,432,792,1548,0,0,0},{0,0,0,0,0,0,0,2046,0,0,0,0,0,0},{2048,2048,3072,2048,0,0,0,0,0,0,0,0,0,0},{2,6,2,0,0,0,0,0,0,0,0,0,0,0},{512,2304,2816,2816,0,0,0,0,0,0,0,0,0,0},{26,26,18,8,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,1092,3142,0,0,0,0,0,0,0},{0,4094,4094,4094,4094,4094,4094,4094,4094,4094,4094,2044,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,2,6,12,0,0},{0,0,0,0,0,0,0,0,4,10,17,10,4,0},{496,792,1028,3078,2050,2050,2050,2050,2050,3078,1028,792,496,0},{2560,2560,2304,1280,1280,640,640,1664,1280,1280,2560,2560,0,0},{8,10,26,20,20,40,40,36,20,22,10,10,0,0},{7936,768,768,768,768,768,768,768,768,0,0,0,0,0},{0,0,0,0,24,24,24,24,24,24,24,24,31,0},{7936,7168,512,512,512,512,512,512,512,768,0,0,0,0},{0,0,0,24,8,8,8,8,8,8,8,7,31,0},{0,32,1020,32,288,1008,1848,3244,2276,3174,1078,828,128,0},{0,0,4,516,1540,1028,1028,3076,2116,2124,104,56,0,0},{0,48,48,1552,1278,3472,2328,2312,392,396,132,246,0,0},{2048,3120,1040,1552,1278,3480,2456,2440,392,132,132,114,0,0},{0,0,1016,0,0,0,0,0,12,12,1036,2040,0,0},{2048,1216,1152,2044,384,256,768,904,12,4,8,1008,0,0},{0,48,176,254,16,3984,24,8,72,76,196,3972,0,0},{0,2576,3152,126,24,1944,8,8,76,68,68,1990,0,0},{0,0,0,0,0,992,1596,1024,1024,1536,896,224,0,0},{0,8,24,784,496,96,48,24,8,8,24,2032,0,0},{0,0,496,1624,1100,3140,2146,2082,3106,1078,1564,448,0,0},{0,516,772,772,4068,516,518,518,974,1574,2852,452,0,0},{0,0,1016,128,96,496,536,1036,1028,1264,1936,496,0,0},{0,0,24,96,0,3084,1048,512,896,192,120,28,0,0},{64,96,2016,1040,1544,556,996,384,896,704,112,24,0,0},{0,0,0,0,1120,1612,1608,520,768,384,192,112,0,0},{0,0,0,0,16,1584,2032,572,288,96,64,64,64,0},{0,0,0,0,0,0,4094,0,0,0,0,0,0,0},{0,0,0,0,0,0,8191,0,0,0,0,0,0,0},{0,4094,192,192,192,192,192,192,192,192,192,192,120,0},{16,48,48,48,4080,126,48,48,48,2096,2096,2016,0,0},{0,4094,16,16,16,2032,1040,1040,1048,1032,1548,1542,962,0},{0,4094,0,0,0,0,2044,0,0,0,0,4094,0,0},{0,96,96,96,96,4064,96,96,96,96,96,4094,0,0},{0,4094,64,64,64,448,1856,1088,64,64,64,64,64,0},{0,4094,192,64,96,880,1624,3150,2114,64,64,64,64,0},{8,8,2040,8,8,12,4092,3072,1534,1024,1024,1536,960,0},{32,32,2044,48,4094,16,16,2040,512,256,240,448,768,0},{0,1016,520,520,1016,520,520,520,1016,520,520,4094,0,0},{64,1612,1612,1612,4094,1612,1612,1612,1996,12,12,4092,0,0},{272,432,432,2482,3510,1460,1460,956,432,432,432,4094,0,0},{32,32,4094,16,216,200,2044,192,712,1736,1220,2246,96,0},{528,520,264,2340,1188,2014,520,268,4030,0,0,4094,0,0},{0,4094,272,272,4094,2450,2450,2482,2810,3786,2126,2050,3842,0},{0,4094,1188,1708,680,4094,6,6,2,2,2,2,0,0},{520,536,272,4094,176,1204,1204,1204,696,696,176,4094,0,0},{64,224,432,792,3660,2114,64,64,64,64,64,64,0,0},{64,64,64,4094,2114,2114,2114,4094,2114,64,64,64,64,0},{64,64,4094,64,64,2044,64,64,64,4094,64,64,64,0},{136,200,4042,106,298,570,10,4074,2410,2410,2410,4072,2152,0},{36,40,32,4094,2080,2080,3232,3216,3344,3096,1036,1030,1922,0},{32,64,128,4094,64,64,64,2044,64,64,64,4094,0,0},{0,4094,0,4030,2210,2210,2478,2730,3762,2210,2210,2210,3762,0},{1056,588,840,4094,520,1100,3066,64,64,4094,64,64,64,0},{16,16,504,392,132,134,194,224,288,816,1560,3086,2050,0},{0,32,16,280,396,198,64,800,528,1544,4094,2048,0,0},{96,1088,1092,520,520,272,432,224,224,432,1548,3074,0,0},{64,64,64,2046,1536,768,384,192,96,48,28,62,4066,0},{1792,508,1088,1100,1608,584,64,4094,64,64,64,64,120,0},{1536,1020,4,68,68,68,4094,64,584,1092,3142,2114,112,0},{1920,508,64,4094,336,1886,848,2392,4094,336,588,3142,64,0},{32,48,48,48,1022,816,784,784,784,792,4872,4870,3586,0},{64,200,1224,1992,1272,1246,1226,1224,1992,2248,2056,2056,4088,0},{0,4094,3072,3080,3088,3168,3136,3328,3552,1080,1038,1024,1920,0},{32,1632,3168,1020,608,608,4094,2144,2144,2144,2144,1888,96,0},{0,4094,3072,1176,176,132,200,64,4094,64,416,1560,2054,0},{352,318,280,280,383,280,280,382,322,322,6466,2430,3906,0},{0,2046,1536,768,192,64,64,64,64,64,64,64,120,0},{64,4094,64,2044,2044,64,2044,1088,4094,1088,2044,1088,112,0},{0,0,2044,0,0,0,0,0,0,0,4094,0,0,0},{0,2044,64,64,64,64,4094,64,64,64,64,64,120,0},{0,2044,0,0,0,4094,48,272,792,520,1932,4094,2048,0},{0,2046,32,32,32,32,1020,544,560,528,528,4094,0,0},{152,1176,1978,154,2202,2202,4030,0,2044,0,0,0,4094,0},{64,64,192,4094,12,12,12,12,12,12,12,4092,0,0},{64,64,4094,16,792,1036,2326,272,160,224,496,1820,3078,0},{64,64,4094,528,272,4092,6,6,6,6,2,2,2,0},{64,4094,0,2040,1544,1016,4094,2050,2546,272,2328,2316,3846,0},{64,64,2044,792,272,4094,64,4094,64,584,1612,1094,112,0},{64,64,64,64,224,224,160,432,272,520,3086,2050,0,0},{272,264,264,268,262,8182,260,260,260,260,260,260,260,0},{0,24,4072,3116,1092,1094,1607,644,900,388,964,3172,2068,0},{64,224,432,792,3692,2242,128,2044,512,768,384,128,64,0},{8,1020,580,580,582,3687,2148,2084,2084,2084,2100,3092,1804,0},{0,264,264,264,264,280,280,936,748,1732,1094,2146,0,0},{8,4072,1036,772,262,263,8180,260,260,260,260,260,452,0},{264,296,2348,3876,2534,2423,2356,2340,3876,292,6180,2084,4036,0},{1040,1032,1032,4092,1030,1030,1124,1092,1156,1156,1028,1028,1924,0},{264,264,268,2340,2342,2343,2340,2340,2340,2340,2340,4068,2052,0},{144,1176,2184,140,3982,510,269,268,268,268,4876,3596,3084,0},{64,224,432,792,3692,2242,0,2044,512,272,224,192,384,0},{0,1028,1060,1092,1732,516,516,516,804,1948,3270,2144,0,0},{0,136,2472,3364,1062,1126,1605,708,900,388,964,3684,2068,0},{32,4076,2116,2068,2070,2070,2070,2068,2068,2068,2068,2068,3604,0},{8,232,3892,2324,2326,2326,2325,2324,2324,2548,3380,260,260,0},{264,360,300,4068,310,279,260,4084,260,260,260,260,260,0},{0,392,392,580,1124,2070,582,580,580,612,548,564,532,0},{16,1992,488,268,262,263,8188,260,260,260,260,4084,4,0},{520,584,588,1124,3110,2102,2038,1156,1220,1092,1092,1572,788,0},{264,264,268,8180,198,70,4036,3140,3140,1092,1060,1076,1812,0},{272,264,264,268,4084,902,965,1860,1316,3380,6428,260,260,0},{264,264,268,2340,2342,1462,388,388,900,580,3172,2100,0,0},{64,224,432,1548,4094,0,0,4094,48,784,1544,2044,2052,0},{136,136,4092,132,4086,71,68,4068,1540,516,388,772,516,0},{72,72,4076,36,150,135,4084,2180,2180,2244,2116,3108,1812,0},{264,264,268,8180,262,263,260,4068,2084,2084,2084,4068,2084,0},{264,2344,1324,1380,262,4086,261,260,8180,260,260,260,260,0},{264,264,4084,2324,2326,4087,2324,2324,4084,2324,260,260,260,0},{0,1032,1068,1188,1190,1318,1061,1060,1700,3812,2868,2436,132,0},{8,4072,3116,3108,3110,4070,3108,3108,3108,4068,4,8180,4,0},{384,264,264,4076,4,1094,1092,1604,580,708,516,4084,4,0},{3592,1000,812,804,550,4071,548,548,548,548,5924,3492,3444,0},{136,264,264,4084,262,262,260,4068,260,260,260,8180,4,0},{392,392,388,4084,390,967,964,1444,3508,8188,388,388,260,0},{8,8184,3076,3076,3558,3366,3364,3364,3556,3108,3076,3076,1796,0},{64,224,272,1548,8190,64,64,4094,64,584,1612,3142,112,0},{584,584,4092,2628,2630,4087,597,596,4084,2628,2660,3620,532,0},{136,72,8140,420,438,3991,388,388,388,3972,388,388,388,0},{72,72,108,4068,2358,2327,1349,1380,2340,2340,2324,260,452,0},{264,264,8188,260,4086,2359,2356,4068,420,228,196,2020,3124,0},{2048,2300,2596,2598,2806,2711,2708,2812,2660,2628,2084,2100,3604,0},{72,1608,1612,4084,1606,1607,1605,1604,8180,4,1604,3108,2068,0},{136,392,268,4084,134,2502,3428,1844,556,1572,1060,2532,36,0},{8,2024,1060,1060,2022,7,4,4084,2100,2100,2100,4084,2068,0},{72,3784,2044,1156,902,3063,3588,4,4092,836,868,6948,3612,0},{2052,2804,2708,2710,2710,2711,2708,2740,2740,2740,2148,2196,3076,0},{8,4088,268,4068,2342,4070,2340,4068,388,164,196,996,3636,0},{8,4076,3108,3110,4070,263,260,292,3876,292,372,468,3996,0},{8,4072,2092,2084,4070,263,260,4084,900,1860,3364,6420,260,0},{136,264,4084,4,2022,7,2020,4,2020,3108,3108,4068,36,0},{8,4092,580,580,4086,2647,2644,3028,4052,3380,2228,2068,3092,0},{136,140,4036,1252,1974,1942,3317,276,1236,788,3284,900,196,0},{2056,3068,2596,2710,3062,2823,2660,2804,2660,2148,2532,2108,3588,0},{8,1996,1028,4084,150,214,4055,308,4084,788,900,3268,2148,0},{584,584,4092,580,582,8183,5,4068,3108,4068,3108,4068,1060,0},{264,4088,140,132,2022,1062,2020,1060,2020,1060,2020,1060,4084,0},{0,4084,2196,2196,4086,22,3862,2420,1812,1780,1556,3860,2196,0},{0,264,4072,2084,4070,39,4084,2804,2804,4084,2772,2772,3140,0},{552,556,804,8188,2342,2471,4084,1684,1684,1684,1780,2452,132,0},{392,4088,4,2020,1062,2023,4084,2068,4084,260,260,260,196,0},{8,4092,2852,4070,2838,4031,804,4004,820,4084,820,116,3980,0},{8,4072,2348,4068,2342,4071,260,4084,2324,3988,4084,2068,3092,0},{392,972,1636,4084,6,2295,2708,2804,2708,2804,2708,2196,1748,0},{616,620,764,3684,3062,2918,2812,1572,1780,1172,1684,2964,2412,0},{136,4092,2644,2452,2646,4087,1636,2292,2020,1652,900,1988,3124,0},{1096,4088,1100,1988,262,4070,2341,4068,4068,260,4068,260,4084,0},{72,1000,316,4092,2486,4071,196,1204,1988,1460,3524,2356,388,0},{4088,12,4068,4068,2342,2023,4084,2020,2340,4068,4068,4,4084,0},{520,1268,3988,2452,2806,1046,3863,1268,1172,3996,1180,1276,1028,0},{0,264,264,264,264,264,264,264,264,264,6404,2310,3842,0},{0,2044,0,0,0,4094,400,400,400,408,2440,2436,3842,0},{64,64,4094,48,792,520,2044,2480,400,400,6552,2444,3846,0},{72,72,2044,68,70,64,4094,272,272,272,2312,2316,3846,0},{64,1092,1612,584,64,4094,272,272,272,280,6408,2310,3842,0},{16,504,392,132,2046,1092,1092,2044,160,160,2192,2188,3974,0},{520,792,272,2044,1028,1028,1028,2044,432,400,400,2444,3846,0},{72,4084,2326,2326,2550,2326,2334,4094,400,400,2448,2444,3846,0},{0,16,48,96,64,224,416,288,784,536,1036,2054,2,0},{64,224,432,792,3086,8190,64,64,2040,64,64,64,4094,0},{0,272,272,272,280,280,776,520,1548,1028,3074,2050,0,0},{0,272,792,520,1036,3174,2082,48,784,520,2044,3196,0,0},{0,64,64,0,4094,0,0,792,520,1548,1028,2054,2050,0},{520,792,272,4094,0,0,0,2044,0,0,0,4094,0,0},{272,272,272,4094,272,272,272,8190,0,272,520,3078,2050,0},{520,792,272,4092,64,64,64,4094,224,416,816,3596,2054,0},{32,2082,3170,1092,1604,516,0,4094,0,792,1548,3078,2050,0},{520,520,4094,520,1016,520,1016,520,520,4094,272,1564,2050,0},{0,2040,1544,2040,1544,2040,1544,2040,1544,4094,792,3596,2050,0},{520,792,4094,176,2044,1200,4094,1200,2044,440,1724,3254,162,0},{64,64,4094,2114,2114,2146,2274,2354,2842,2574,2050,2050,3842,0},{0,1980,1188,1188,1188,1188,8191,1188,1188,1188,1250,1122,1914,0},{0,4094,64,2044,1092,1092,2044,1092,1092,8191,1028,1028,1796,0},{0,2046,2046,1030,2046,0,2044,1548,2044,1548,2044,2044,4,0},{0,4094,2066,16,1016,8,2040,1024,1536,2046,512,512,960,0},{32,1008,792,316,226,224,1820,3110,224,256,56,480,768,0},{128,386,390,2436,3568,1984,992,932,1956,3474,6554,384,192,0},{256,258,262,4080,2320,2320,2320,4092,2324,262,258,256,256,0},{128,130,2020,1156,1152,1152,1152,8176,388,964,578,3122,2072,0},{0,4066,2084,2092,2080,2080,4064,588,580,582,4706,6704,3608,0},{128,386,966,612,1200,2456,0,2016,1540,518,450,386,768,0},{2048,2298,2598,2596,2800,2704,2704,2796,2660,2630,2082,2098,3608,0},{64,994,806,308,2032,1152,8176,1156,1156,2036,134,130,224,0},{256,290,550,4084,304,4088,288,292,4068,292,290,4066,32,0},{128,386,4086,4,2020,1056,1056,2020,388,1446,3474,2458,192,0},{384,2018,390,4084,0,1632,3312,1988,1636,726,386,2018,3096,0},{1536,2562,4086,532,3056,2576,3824,1844,1844,2042,5930,3338,3208,0},{128,4082,134,4084,64,4088,1568,4092,132,2022,450,1634,2064,0},{3920,3186,1820,1680,1136,3984,2680,812,4092,802,1010,1746,7304,0},{0,1016,776,776,776,776,776,776,776,776,6916,2822,3586,0},{0,1016,776,776,776,808,872,968,776,780,6916,6918,3586,0},{1032,1000,388,4086,388,388,4084,0,1016,776,776,6924,3590,0},{0,4030,2482,2482,2482,2482,2546,2050,2050,2050,2050,4094,2050,0},{64,1092,1092,1092,1092,2044,64,3142,3142,3142,3142,4094,2048,0},{272,792,520,1548,3078,4094,1568,1568,560,528,536,524,966,0},{4,4068,2436,2492,2447,2180,2180,2180,2228,2268,2116,3168,1840,0},{2048,2174,2312,2312,2312,2312,2431,2312,2312,2312,2056,2056,3592,0},{2052,2100,2348,2508,2431,2376,2408,2344,2328,2072,2204,2294,3682,0},{2048,2302,2312,2316,2428,2372,2402,2350,2360,2320,2072,2060,3590,0},{2048,2174,2370,2386,2386,2386,2386,2394,2394,2376,2104,2148,3650,0},{2048,2302,2690,2722,2730,2714,2706,2706,2746,2730,2182,2178,3682,0},{4,4072,2432,2462,2200,2184,2204,2206,2206,2124,3148,1132,1836,0},{2064,2130,2388,2356,2430,2320,2328,2328,2430,2312,2056,2052,3590,0},{2080,2078,2312,2312,2430,2312,2332,2364,2414,2058,2057,2056,3592,0},{0,2110,2338,2338,2366,2312,2312,2430,2408,2404,2148,2086,3634,0},{2144,2078,2328,2328,2559,2328,2328,2430,2370,2114,2114,2174,3650,0},{2048,2558,2344,2404,2430,2304,2320,2430,2320,2320,2288,2110,3586,0},{2064,2582,2686,2578,2814,2576,2576,2686,2642,2130,2130,2162,3600,0},{2048,2302,2498,2498,2558,2322,2558,2454,2454,2198,2166,2067,3600,0},{2048,2086,2364,2360,2374,2320,2430,2320,2356,2134,2130,2072,3596,0},{2064,2064,2430,2320,2430,2386,2394,2426,2328,2172,2134,2067,3600,0},{2072,2064,2814,2568,2660,2622,2576,2648,2662,2098,2168,2252,3586,0},{2064,2064,2814,2596,2620,2616,2766,2660,2660,2148,2148,2150,3682,0},{520,792,4094,0,3390,3366,3366,3390,3366,3390,3110,3110,1586,0},{2048,2174,2626,2686,2626,2686,2564,2814,2730,2196,2134,2122,3688,0},{0,2174,2880,2940,2880,3070,2834,2902,2876,2172,2258,2064,3612,0},{2048,2174,2626,2686,2594,2594,2814,2594,2810,2250,2250,2297,3584,0},{2144,2078,2576,2814,2580,2774,2644,2646,2776,2680,2260,2070,3600,0},{2048,2302,2560,2686,2630,2684,2560,2814,2706,2302,2194,2302,3714,0},{2064,2302,2706,2686,2576,2684,2576,2814,2576,2684,2116,2172,3652,0},{32,32,32,4094,2080,2080,3104,3120,3088,1048,1032,1028,1922,0},{256,256,318,4080,2322,2324,2460,2184,2204,2260,2118,3171,1824,0},{32,32,32,1022,544,1572,3620,2870,2834,2840,264,260,482,0},{256,256,318,268,4076,2444,2444,2188,2236,2206,2114,3168,1840,0},{0,12,3980,2238,2220,2212,2212,2212,2212,2212,2214,4002,2235,0},{48,2032,1564,790,480,1008,3598,64,2044,1056,1040,1052,902,0},{0,830,768,3968,2304,2366,2308,2340,2340,2482,2302,2240,1600,0},{256,318,290,4066,2366,2338,2338,2366,2466,2226,2302,3138,1824,0},{8,3976,2238,1316,1852,1848,2286,64,2044,1056,1072,1048,1798,0},{768,830,784,3992,2876,2406,2304,2366,2312,2312,2216,2302,3650,0},{272,4094,272,0,4094,2050,96,2044,1056,1072,1040,1548,902,0},{392,2046,1160,1276,1422,8136,2158,96,2046,1056,1040,1052,902,0},{520,638,520,3976,2942,2882,2364,2320,2424,2334,2440,2184,1612,0},{520,828,820,3986,2430,2386,2394,2430,2456,2200,3804,2102,4066,0},{32,798,894,3976,2430,2378,2430,2430,2312,2558,2184,2302,1602,0},{8,8,4092,2340,2342,2354,2450,2200,2184,2124,3142,1056,1840,0},{16,8,2044,1030,1278,1164,1164,1164,1276,1804,12,2060,4088,0},{8,8,4092,2340,2342,2491,2224,3320,3528,3404,1126,1058,1808,0},{144,152,2184,3212,1678,910,394,200,232,2184,6280,2184,3976,0},{16,144,144,2192,1694,912,400,144,144,4248,4246,6544,3856,0},{382,322,382,3394,894,256,510,272,6514,2326,3870,26,4081,0},{0,4094,290,290,290,306,2322,2322,3866,2,2,4094,0,0},{0,4094,2,530,818,354,194,450,866,562,1034,2,4094,0},{0,4094,34,2034,154,130,4090,194,834,1586,1050,4094,0,0},{64,64,64,64,64,4094,64,64,64,64,64,64,64,0},{1536,2032,126,64,64,64,4094,64,64,64,64,64,64,0},{64,880,798,792,792,792,4094,792,776,776,780,774,770,0},{8,8,2044,68,70,66,64,4094,64,64,64,64,64,0},{64,1092,584,584,64,4094,64,64,4094,64,64,64,64,0},{144,3224,1932,462,234,2184,3976,64,64,4094,64,64,64,0},{520,784,2044,1092,1092,2044,1092,2044,64,4094,64,64,64,0},{64,2044,64,64,4094,1176,1188,200,4094,64,416,3612,2054,0},{64,4094,64,64,4094,3350,3254,4094,3142,4094,3142,3142,1606,0},{64,64,64,4032,64,64,2044,1028,1028,1028,1028,2044,1028,0},{64,64,1984,64,64,4094,64,64,960,3648,64,64,64,0},{0,2046,1120,1120,1120,1120,1120,1888,96,96,96,4094,0,0},{16,3996,2182,2178,2178,2238,2178,2178,2178,2226,3742,128,128,0},{0,4094,2530,2530,2558,2530,2558,2434,2450,4002,446,494,256,0},{8,3864,2328,2430,2328,2328,2430,2312,2348,2340,3966,326,256,0},{584,584,2044,32,32,4094,776,4094,6410,264,1480,1032,1008,0},{0,4092,4,2036,1044,1044,1044,1044,916,22,2066,2098,4066,0},{0,4092,4,4,4092,388,390,390,390,386,386,386,226,0},{0,4094,6,70,70,4094,3142,3142,3138,1122,1058,1042,1930,0},{0,4092,4,4092,68,100,100,2020,1062,1062,1074,1562,906,0},{0,8190,6,134,134,134,4090,130,1666,1154,130,4094,0,0},{0,4094,6,2814,2702,2734,2734,2730,2730,2730,2162,2258,3592,0},{0,4092,4,2036,1172,2036,1172,2038,134,4090,130,130,4090,0},{4092,4,2036,1044,2036,1044,2036,2038,902,4094,130,130,224,0},{0,4092,132,2036,1044,2036,1044,2038,134,1714,1170,2186,224,0},{0,4094,6,3990,2198,2302,4022,2230,4090,2206,2194,3986,2192,0},{64,64,2044,64,64,64,4094,48,272,536,1548,2044,0,0},{0,2040,1544,2040,1544,2040,1544,1544,4094,272,520,2044,2052,0},{32,792,2044,1056,32,4094,792,1644,2454,224,792,480,60,0},{0,2046,1036,520,520,784,272,160,224,224,920,3598,2050,0},{0,510,280,280,3992,1080,1064,1640,716,388,902,3682,2064,0},{16,16,4094,16,16,2032,536,552,364,452,454,1906,3096,0},{0,4094,2208,3248,1174,1172,1308,792,792,828,1956,3270,2146,0},{1792,508,4,4,2044,1556,548,804,324,452,486,3642,2058,0},{584,1644,1124,4092,32,48,2032,1584,616,460,454,1890,3096,0},{0,126,4070,2214,2494,3366,1318,1854,550,630,1854,3488,2272,0},{1984,254,1092,584,4094,2050,2050,1020,792,432,224,952,3598,0},{64,4094,432,956,1460,2486,0,2044,520,304,224,1016,3598,0},{1016,824,504,1982,1436,1982,4094,3066,2570,1016,1016,520,4094,0},{0,0,2044,1028,1028,1028,1028,1028,1028,1028,2044,1028,0,0},{64,64,64,4094,64,64,64,2044,1028,1028,1028,2044,1028,0},{24,8,4088,2052,2052,2298,2184,2184,2184,3320,3080,1024,1920,0},{0,2044,1028,1028,1028,2044,64,4094,1056,1056,1040,1036,1926,0},{0,4094,2450,2194,2194,2194,2194,2194,2270,2114,3170,3104,1808,0},{0,2044,1028,1028,1028,1028,2044,0,272,792,1548,3078,2050,0},{2048,3230,3218,3218,3218,3218,3218,3218,4062,3266,3072,3072,2048,0},{0,734,722,722,594,1618,1106,1106,1106,1150,3106,2080,2048,0},{0,4094,1024,1024,1148,1092,1092,1092,1148,1028,1024,1024,896,0},{32,48,272,520,2044,3326,0,2044,1028,1028,1028,2044,1028,0},{64,64,4092,3142,3142,3142,4092,64,76,56,48,508,3846,0},{32,32,32,4094,16,24,2040,1052,1050,1050,1048,2040,1048,0},{0,2044,1540,2044,0,0,4094,8,2040,1536,512,512,448,0},{0,4064,3166,1114,1114,1114,666,666,410,414,706,3168,2064,0},{0,4062,282,282,282,8186,282,282,286,258,256,256,384,0},{128,222,4058,122,58,2010,1562,282,158,66,6242,2144,4032,0},{48,1016,540,310,226,224,824,3598,1016,520,520,1016,520,0},{64,192,416,792,1548,4090,0,2044,1548,1548,1548,2044,1032,0},{0,4094,2050,3066,2050,2050,2546,2322,2322,2546,2066,2050,3586,0},{32,2032,520,774,400,224,112,2044,1038,1032,1032,2040,1032,0},{1792,508,4,4,4092,4,4,4084,3092,3094,3090,4082,1040,0},{256,286,282,282,4090,282,282,282,286,258,256,8176,0,0},{96,32,4094,2050,2050,2546,2322,2322,2322,2546,2066,2050,3842,0},{0,2030,1050,1114,1114,1114,4058,2074,2078,3042,2050,3072,1536,0},{0,4094,96,32,4094,272,520,4094,3598,520,520,1016,520,0},{0,4094,192,352,856,3150,2114,64,2044,1028,1028,2044,1028,0},{0,4062,2394,2394,2394,2394,4058,2138,94,66,6210,2112,4032,0},{64,224,304,1644,2246,1020,768,384,2044,1028,1028,2044,1028,0},{1536,990,82,82,82,4050,1106,1106,1118,1090,1120,1056,1056,0},{64,64,2044,1028,1028,2044,4,4084,3100,3102,3098,4090,3090,0},{256,270,4090,282,282,4090,1114,1114,670,386,960,3696,2096,0},{256,270,1354,3402,2410,2346,298,1290,1294,514,384,224,32,0},{0,2046,586,586,586,3658,2250,1258,1326,802,816,3472,2256,0},{128,222,90,4058,2170,2362,282,282,926,642,1216,3168,2064,0},{0,4092,32,1020,528,528,4094,0,2044,1028,1028,2044,1028,0},{0,4064,1050,1114,1146,8186,1562,1306,1182,1218,1136,1072,1792,0},{0,4078,42,4010,2218,2218,2218,2218,3758,162,4258,2192,3856,0},{0,2044,1028,1028,2044,64,64,4094,224,336,1612,3142,64,0},{72,72,2044,70,66,4094,0,0,2044,1028,1028,2044,1028,0},{0,2044,1548,2044,0,2044,1028,1092,1092,1124,416,1816,2054,0},{256,2014,1106,1106,1106,1618,82,4050,2066,4066,2048,2048,1536,0},{0,4078,2090,2090,4074,170,3242,1962,430,162,2224,2192,3856,0},{0,4092,3140,3572,3140,4092,3076,3572,3348,3350,3570,3090,1794,0},{256,270,4074,266,266,266,4090,906,1998,1378,2352,2320,256,0},{3072,1006,2314,3434,1354,1354,266,8186,266,270,258,256,448,0},{64,224,432,1820,3574,0,1980,1188,1188,1188,1724,132,128,0},{48,3982,2184,2184,2302,2184,2204,2236,2218,2186,3976,2184,8,0},{0,4030,3234,3234,4030,0,504,264,264,264,6408,2820,3586,0},{256,414,3994,410,410,8186,410,410,1950,3458,384,384,256,0},{256,286,274,8178,274,274,274,4050,2130,2142,2114,4032,2112,0},{256,2350,1370,1370,282,8186,666,666,666,590,578,6688,3600,0},{256,4078,266,4074,2314,4074,298,4074,2446,2434,1730,1632,2096,0},{256,270,4074,10,1098,2154,1658,650,910,258,896,3168,2080,0},{256,256,4094,138,1226,2026,2826,3466,1226,1646,898,3264,2096,0},{1792,3328,4092,260,260,1404,1284,1918,846,842,890,3778,3138,0},{576,590,554,4074,826,1850,1834,1578,2734,2786,608,544,544,0},{0,4078,2346,2346,4074,2346,2346,2986,2734,3298,2080,4064,2080,0},{64,64,4094,0,2044,1540,2044,3248,1692,798,792,3192,2072,0},{0,1016,520,520,1016,0,0,4030,2210,2210,2210,4030,2210,0},{256,270,4074,266,266,4090,266,266,4078,258,256,4080,0,0},{256,398,650,1738,3194,4090,10,1994,1102,1090,1088,1984,1088,0},{256,270,4074,2090,2090,2986,2730,2730,2734,2978,2082,2080,3104,0},{1600,1614,8186,1610,1098,1098,1098,1738,910,386,896,3680,2096,0},{0,4078,58,4026,570,570,4026,570,574,4066,32,8160,0,0},{704,2638,1642,890,1018,2634,3658,266,266,4094,258,256,256,0},{576,590,810,3882,2538,2426,2666,2730,2110,2050,2274,2096,1536,0},{640,2798,2634,586,4090,586,2634,2026,1662,1602,5954,5440,3184,0},{256,2336,2398,1362,4082,2162,4082,2162,2174,4066,2144,2144,3616,0},{0,3838,2730,2730,2810,1706,2730,2810,2734,2722,3728,656,704,0},{0,4030,2210,2210,4030,576,1088,4095,224,160,784,3596,2054,0},{4092,4,2036,4,4092,1172,916,3700,2054,2034,1042,2034,1040,0},{0,4078,138,2026,1162,1162,4090,10,4078,3170,3168,4064,2048,0},{1600,4094,1610,10,4074,2090,266,4074,3214,3202,1218,1120,1840,0},{72,2044,196,2046,198,2044,196,4092,0,2044,1028,2044,1028,0},{128,718,586,4074,634,4058,586,586,4046,578,576,4032,64,0},{0,8190,2138,2906,2938,2938,2906,3034,3038,2418,2064,2064,3600,0},{264,392,4030,1510,1894,830,1794,2242,1016,520,520,1016,520,0},{520,280,382,8002,2370,3582,1794,1662,1614,1614,1870,2559,2176,0},{544,558,554,4090,2346,2346,2410,3450,1326,1314,1314,1056,8112,0},{256,4078,266,4074,4074,10,4074,2346,2350,2338,384,1728,2096,0},{256,4078,2218,2218,1994,1770,906,1994,3194,1998,1090,1088,1984,0},{0,4078,2346,4074,2346,4074,10,8186,2382,3650,1600,3520,2144,0},{256,270,8170,266,4074,2730,2730,3050,2346,4078,2338,2336,3104,0},{2112,2126,3066,2634,3066,2906,2906,2810,2794,2542,2130,2136,3648,0},{1536,2574,4074,554,3050,2602,4074,1898,1902,2034,5712,7440,2192,0},{1152,1166,4090,1162,138,8186,202,74,4078,2146,2128,4032,2112,0},{256,2350,2346,4074,10,8186,266,4074,2734,2722,2720,2720,3744,0},{64,4094,64,2044,1016,1548,2044,272,4094,2044,1028,1028,2044,0},{0,4078,314,4090,314,4090,314,4090,2062,3426,2464,2064,1536,0},{1600,1614,4090,1866,906,1098,8186,10,2030,1058,1056,2016,1056,0},{512,1614,3242,714,2026,10,4090,2186,2734,3266,2994,2176,3264,0},{0,4078,2346,4074,2474,3818,4074,10,1358,2898,3154,3152,960,0},{256,4078,1098,650,4074,2346,4074,2346,2990,2722,2978,2080,3104,0},{0,4094,4074,2090,4074,4074,4074,1674,3982,1522,1792,5056,3120,0},{256,4094,26,1114,1114,4090,1754,2010,3710,3442,1488,1096,1032,0},{0,3886,2810,2794,1018,1642,2810,2746,2798,2722,3746,736,544,0},{576,4078,618,4090,74,1002,4090,2346,4074,2350,4066,2352,3344,0},{384,718,3434,2042,42,1450,1770,2026,4090,2206,2770,2256,3088,0},{0,1980,1188,1188,1980,800,4094,792,3596,4030,1188,1188,1980,0},{256,4078,2090,4074,3754,1738,2026,3130,4090,270,1314,2352,384,0},{4094,64,1644,2040,4094,4030,956,2044,2044,4094,1208,858,3128,0},{4080,2022,1450,2026,4090,2490,1770,4074,2030,4082,1602,1648,2272,0},{0,4094,2226,2226,2194,2194,2194,3866,2062,2050,4094,2050,0,0},{0,4094,2050,2050,2546,2322,2322,2322,2546,2050,2050,4094,2050,0},{0,4094,2114,2114,3066,2114,2274,2210,2354,2586,2058,4094,2050,0},{0,4094,2178,2178,3066,2242,2274,2226,2186,2242,2050,4094,2050,0},{0,4094,2050,3066,2050,3066,2226,2194,3218,2954,2050,4094,2050,0},{0,4094,2114,2114,3066,2274,2546,2906,2638,2114,2050,4094,2050,0},{0,4094,2114,3066,2114,3066,2114,3066,2626,2882,2114,4094,2050,0},{0,4094,2050,2114,3066,2114,2546,2322,2322,2546,2050,4094,2050,0},{0,4094,2050,3066,2114,2114,3066,2370,2370,3066,2050,4094,2050,0},{0,4094,2082,3058,2490,2274,3002,2154,2178,2290,2306,4094,2050,0},{0,4094,2546,2826,2546,2050,3066,2634,2634,2466,2842,4094,2050,0},{0,4094,2114,2386,3066,3066,2322,4094,2194,2258,2546,2050,4094,0},{0,2046,520,432,224,1980,3142,64,2044,64,64,4094,0,0},{32,48,4094,16,264,264,268,4078,270,268,268,268,4092,0},{260,324,2404,3967,2532,2420,2404,2404,3452,358,6242,2112,4032,0},{4,2020,772,414,196,4068,2692,2756,2372,2364,2182,3136,1568,0},{4,8180,260,414,900,3428,2356,260,284,270,256,256,256,0},{64,584,584,588,1884,3542,2242,64,4092,64,64,4094,0,0},{260,388,4068,3486,3460,3460,3460,4068,412,654,1602,3168,2064,0},{0,4050,1106,1682,914,914,3794,2128,64,2044,64,64,4094,0},{4,4068,4,31,4,4068,132,132,1244,1102,3683,4064,2048,0},{260,260,4068,2340,2366,292,4068,1252,1212,942,818,1936,2112,0},{1536,1020,64,4094,584,584,4094,584,584,4094,64,64,2044,0},{2048,2430,2348,2430,2340,2340,2086,1602,64,2044,64,4094,0,0},{260,388,4068,718,1134,8180,4,4068,68,2012,1030,1024,1920,0},{1540,2564,4068,558,558,2788,2724,3748,1716,1724,5846,5392,3208,0},{1540,2564,4084,516,2799,2692,3716,1668,1764,524,2034,3456,3200,0},{264,318,264,1992,1342,1300,1492,1470,1928,1726,5256,6216,2120,0},{520,4094,520,1016,520,1016,520,4094,1608,4094,66,64,2044,0},{260,4068,260,1758,2148,8180,3076,3556,3388,3374,3552,3072,1536,0},{132,708,580,4095,612,4036,580,580,4060,590,578,4032,64,0},{132,2180,2020,1668,8094,388,196,4084,2132,4046,2114,4032,2112,0},{32,4020,2558,3976,2250,4094,2188,3142,64,2044,64,64,4094,0},{64,4094,2322,2044,272,2044,272,4094,584,4094,66,64,4094,0},{260,4068,260,1358,324,4084,4,4068,2988,2662,2976,4064,2080,0},{1092,580,4068,2340,3966,2340,4068,4,2020,2030,1122,2016,1024,0},{64,64,64,64,64,4094,64,64,64,64,64,4094,0,0},{264,264,266,266,270,8184,264,264,270,266,264,4072,8,0},{64,4094,64,4092,0,2044,1092,1092,1092,2044,6,2,2,0},{264,268,380,868,804,1318,2346,280,280,312,236,3974,2,0},{48,1016,796,438,224,1976,3599,2044,1092,2044,1092,1092,2044,0},{8,4092,4,2042,1032,2040,2040,16,1016,796,480,1008,3598,0},{0,4094,2044,1028,2044,2044,1028,2044,1016,798,482,1016,3598,0},{96,32,4080,1040,1032,1558,610,448,384,192,96,28,12,0},{264,268,380,356,806,1830,3390,2352,272,280,268,262,258,0},{96,1008,792,404,224,432,4046,3168,1656,960,448,120,14,0},{64,64,4094,152,4040,3148,1390,1663,652,396,908,3692,2108,0},{516,3844,3262,1506,815,938,3882,2474,2542,1826,1568,800,216,0},{64,64,64,64,4094,224,224,160,304,784,1544,3078,2050,0},{0,4094,64,64,64,4094,224,224,432,272,792,3598,2050,0},{64,64,64,64,4094,224,224,160,304,816,1656,3150,2178,0},{72,72,76,2044,70,66,4094,224,160,432,792,3598,2050,0},{128,152,160,132,152,192,4094,64,96,416,1584,3086,2050,0},{64,64,4094,64,584,584,328,4094,224,160,784,1548,3078,0},{64,64,4094,584,584,588,1884,2550,162,432,792,3596,2050,0},{64,4094,96,496,1820,1030,4094,1536,1660,1604,1660,1540,896,0},{96,32,4094,272,520,4094,2051,0,2044,64,588,1094,112,0},{64,64,4094,160,272,1548,4094,1604,2044,1604,1604,2044,1540,0},{64,32,4094,792,1612,4094,64,856,792,4094,776,780,774,0},{96,4094,272,536,4094,3066,8,1016,8,4094,792,2044,1036,0},{32,4094,792,1580,3066,416,4094,48,2044,1550,2040,1544,2040,0},{32,32,48,4094,784,280,264,412,240,224,1008,3614,3078,0},{4,2020,1732,734,726,3666,2130,2138,2124,2124,2108,3110,1810,0},{516,580,580,3678,3030,3058,2642,2634,3660,588,2140,2134,3970,0},{4,4036,3076,1599,532,786,8178,786,796,792,796,774,386,0},{8,3980,2188,2238,2212,2212,2212,2230,2196,2200,2232,4012,2178,0},{260,260,4068,286,276,274,8178,778,1934,1484,2396,2342,258,0},{260,388,1156,1247,3158,4082,18,4042,2124,2140,2132,4034,2112,0},{772,772,772,4062,786,786,786,4058,2126,2124,2140,4054,2114,0},{772,836,836,4063,886,818,786,4042,780,792,796,774,8162,0},{1920,252,64,4094,464,1608,3142,32,4094,280,504,2032,3102,0},{66,4076,2464,1424,908,1638,3120,32,4094,280,504,2032,3102,0},{1028,1988,260,286,4084,1174,3282,7402,1166,1164,1244,1110,1058,0},{260,4068,2084,95,3674,3050,2730,2730,2762,3724,588,4706,3616,0},{1092,580,4068,670,4074,2698,4090,2698,4078,1740,1788,2738,640,0},{0,2044,768,384,64,64,4094,64,64,64,64,64,120,0},{64,64,4094,2050,1016,256,192,64,4094,64,64,64,112,0},{32,48,4094,16,2024,1548,782,270,8188,268,268,268,452,0},{1920,252,64,4094,496,856,3662,2554,192,4094,64,64,112,0},{3584,2046,1400,1384,1316,1316,1340,1326,2340,2724,2724,3988,1174,0},{1092,584,4094,2050,2050,1016,384,64,4094,64,64,64,112,0},{256,798,8184,136,1164,972,2844,3470,1228,556,1932,3276,2086,0},{64,64,4094,2050,0,0,4094,64,64,64,64,64,112,0},{64,64,4094,2050,2058,8,904,248,24,8,3080,3080,2040,0},{64,64,4094,2050,960,124,96,3936,510,96,2144,2144,4032,0},{64,64,4094,2050,2306,256,4094,256,264,280,272,256,448,0},{64,64,4094,2050,2082,32,4094,280,264,240,480,1848,3086,0},{64,64,4094,2050,3066,0,0,4094,400,400,408,2444,3846,0},{64,64,4094,2050,3066,64,64,72,1996,76,92,118,4034,0},{64,64,4094,2050,3066,520,520,1016,520,1016,520,520,4094,0},{64,64,4094,2050,2050,2044,64,64,2044,320,576,1088,4094,0},{64,64,4094,2050,2266,192,76,72,4094,96,944,3612,2054,0},{64,64,4094,2114,2044,1092,1092,2044,1092,2044,1092,64,64,0},{64,4094,2082,3058,796,438,224,1008,3870,1018,520,520,1016,0},{64,4094,2050,4094,304,792,2044,1032,64,2044,64,64,4094,0},{64,4094,2114,4090,64,2044,64,4094,64,2044,1036,1036,2044,0},{64,4094,2050,2050,1016,1072,1868,480,988,742,1176,3270,112,0},{64,4094,2050,2842,1612,3302,432,1816,4094,522,520,520,1016,0},{64,4094,2050,2322,2044,272,1016,584,584,744,6304,2200,3982,0},{64,4094,2050,2056,4088,388,4070,3111,3108,4068,3108,4068,1060,0},{64,4094,2050,10,4088,2184,1288,1406,1800,554,1866,3464,2124,0},{64,4094,2082,2914,1428,3286,2610,510,66,1092,1092,2044,1024,0},{64,4094,2322,2044,272,2044,272,4094,824,3788,2050,240,768,0},{64,4094,2050,2044,272,2044,2044,1028,2040,64,4094,944,3598,0},{64,4094,2050,2040,1188,794,1020,3598,4092,64,1608,3142,114,0},{64,4094,2050,1016,1016,1016,1016,520,4094,2044,3622,816,396,0},{256,256,256,4094,256,256,268,280,272,256,256,256,480,0},{1024,1024,1086,1056,8160,1072,1044,1176,1432,1080,1068,1030,1794,0},{0,2044,1024,2040,1024,2044,768,4094,784,784,800,768,448,0},{0,2044,1028,2044,2052,4092,0,768,4094,776,784,768,448,0},{1032,1032,1086,3976,3080,1150,1160,1288,1342,1032,1032,1086,1792,0},{264,3976,3178,1710,908,1480,1064,4092,1038,1098,1160,1032,1800,0},{280,3994,3290,1850,926,1432,1144,4095,1114,1242,1178,1050,1817,0},{1040,1142,1076,1150,4004,1060,1406,1288,1406,1032,1144,1150,1792,0},{64,64,64,64,1612,1092,3140,2118,2114,6210,64,64,112,0},{64,64,584,1092,3140,2114,66,1600,768,448,120,14,0,0},{16,24,8,4092,2116,1090,72,584,1100,3142,2114,64,112,0},{64,584,1608,1092,2118,64,64,4094,224,160,272,1548,3078,0},{64,1092,584,584,4094,3078,3574,3350,3350,3350,3574,3094,1542,0},{352,1632,1120,4094,32,224,160,160,144,2192,2184,2188,3970,0},{520,1800,2942,768,4030,802,830,776,812,938,4746,4808,3148,0},{0,2044,1028,1028,1028,2044,132,132,388,260,518,3074,2050,0},{0,2044,1028,1028,2044,4,1076,948,244,2100,2102,2018,2,0},{0,2044,1028,1028,2044,772,516,1764,1158,2050,56,480,768,0},{0,4092,3076,4092,772,244,1604,1014,2118,4066,122,2114,3970,0},{0,4092,3076,4092,4,2036,4,6,4094,610,1570,2034,3186,0},{0,4092,3076,4092,132,132,4092,132,2036,1046,1042,2034,1040,0},{0,4092,3076,4092,4,4092,548,2044,134,2046,130,130,4094,0},{0,4092,3076,4092,548,548,4092,548,550,4094,546,530,522,0},{0,4092,3076,4092,548,4092,548,548,4094,1430,786,1778,3122,0},{0,4092,3076,4092,2036,132,2036,2036,134,4090,2698,3050,3082,0},{0,4092,2052,4092,4052,76,3316,4062,1950,1938,1266,1938,3280,0},{64,64,64,3138,3138,3138,3138,3138,3138,3138,3138,4094,2048,0},{64,3140,3140,4092,32,48,2040,524,784,480,192,56,14,0},{256,264,4072,282,282,4090,2138,1178,1178,798,790,1728,2144,0},{1092,1092,2044,0,2044,1028,1428,1188,1252,1252,5558,7426,2050,0},{96,2044,516,612,516,4,4092,2048,2338,2338,2338,3582,1792,0},{0,4040,2888,2906,4058,2906,2906,4058,2906,794,798,768,768,0},{64,3140,4092,0,4092,6,6,4086,134,4094,130,130,128,0},{256,260,4068,278,2390,1366,1302,4086,790,670,1238,3168,2080,0},{64,2114,4094,3080,2046,132,150,4094,1168,1272,1182,1232,1104,0},{0,3076,3140,3140,3140,3140,3140,3140,3140,3142,3138,3075,0,0},{0,0,4094,64,64,64,64,64,64,64,64,4094,0,0},{32,48,48,4094,16,24,4088,136,140,132,130,131,4088,0},{0,8160,159,140,140,204,4044,2060,2060,2078,2050,3072,1920,0},{0,4092,4,4,2044,1028,1028,1028,2044,4,4,4092,0,0},{520,784,4094,96,2044,32,4094,16,2040,140,134,4090,0,0},{0,2044,1024,1024,1024,2044,1028,4,4,2052,2052,2052,4092,0},{0,2046,1024,1028,1028,1028,2044,1028,4,2052,2052,2052,2044,0},{0,2044,1092,1092,1092,1092,2044,1028,4,4,2052,2052,2044,0},{64,64,64,4094,2118,2118,2118,2118,2118,3142,1862,64,64,0},{3072,2046,64,64,2044,1092,1092,1092,1092,1092,1860,64,64,0},{96,64,4094,64,64,2044,1092,1092,1092,1092,1860,64,64,0},{32,32,4094,16,152,136,4092,3214,3211,3208,3208,1672,128,0},{8,4072,266,4074,2346,2346,2346,2346,2344,2344,3372,260,256,0},{1536,952,480,1852,32,4094,88,2044,1230,1226,1224,1736,192,0},{64,4094,2050,2842,1036,64,2044,1092,1092,1092,1092,1860,64,0},{584,584,4094,584,0,4094,2114,2044,1092,1092,1092,1860,64,0},{24,4094,1432,1534,2456,2558,3980,70,2044,1092,1092,1860,64,0},{1092,584,4094,2050,3066,520,1016,64,2044,1092,1092,1860,64,0},{0,4094,64,64,64,64,4094,64,64,64,64,64,64,0},{0,4094,64,1612,584,584,64,4094,64,64,64,64,64,0},{8,8,4092,132,134,4088,136,136,136,4094,128,128,128,0},{520,792,272,4094,272,272,272,4094,280,264,264,260,258,0},{64,64,2044,64,4094,520,280,2044,64,64,4094,64,64,0},{64,192,4094,134,134,4094,454,966,674,1202,2202,138,128,0},{192,4094,70,70,4094,38,310,4086,258,258,4090,258,258,0},{64,192,4094,6,3142,1246,1174,1686,694,514,258,4090,2,0},{192,4092,6,1798,502,278,278,4086,274,786,658,3826,3355,0},{64,192,4092,4,132,3972,134,134,2038,1042,1042,2034,1040,0},{192,4092,548,548,4092,548,998,6,2046,1570,994,1010,3610,0},{64,128,4094,134,1686,1686,1722,2510,130,4090,130,130,4095,0},{192,4094,6,3902,934,534,4030,546,554,4018,18,122,4046,0},{192,4094,134,2046,1158,4094,1158,2046,3226,1010,1778,3210,96,0},{192,4094,2,546,4090,2034,1378,4094,1378,2042,882,3450,2304,0},{64,4094,2,3874,2554,3530,1530,1482,2426,2378,3962,410,256,0},{3072,2030,776,772,836,3934,856,842,846,4044,12,62,4066,0},{384,2030,1416,4084,1412,2030,392,4074,398,4092,396,62,4066,0},{0,4094,784,784,784,784,4094,784,792,776,780,774,770,0},{64,64,4094,272,520,2044,0,272,4094,280,264,260,258,0},{0,4094,64,2044,64,4094,0,272,4094,280,264,262,258,0},{128,1408,384,4094,384,256,382,280,280,792,4728,2622,3074,0},{1024,1150,1088,1088,1148,1028,1030,1150,1088,1088,1088,1120,1080,0},{0,2142,1104,1616,350,4066,4066,606,592,1616,1112,2504,78,0},{64,4094,432,1980,3508,0,2044,1024,2044,4,4092,1024,1920,0},{62,4000,2080,4030,130,130,4030,2208,2860,3640,3006,3120,1816,0},{1088,1230,648,4072,2350,4066,2338,4094,264,8184,264,264,270,0},{0,4062,3152,4062,258,4034,2402,2430,4080,1304,3352,3848,2286,0},{64,1092,1612,584,64,2044,1024,1024,2044,1024,1024,2046,1024,0},{0,1278,548,292,36,3108,1791,804,2084,2084,1574,802,162,0},{2174,1090,638,322,2174,1278,1536,382,2118,2172,1110,850,280,0},{4,4004,2594,2664,2684,2598,2855,2340,2532,2404,2180,2244,1604,0},{264,260,4070,2346,2348,292,4070,1127,1188,948,788,1748,2164,0},{136,268,262,4082,264,260,262,4071,260,260,260,260,8180,0},{8,2028,1542,778,904,3172,2070,4068,260,260,260,260,4084,0},{264,268,4070,266,264,8188,1030,4086,1028,1092,1220,1028,772,0},{8,2028,1062,2024,1068,1060,2022,2343,3364,804,1572,3556,2148,0},{8,4068,262,1322,1708,1188,3430,2116,4068,260,260,260,8180,0},{264,260,4070,264,268,8180,262,293,3876,292,372,468,7964,0},{2024,3108,4066,3112,4072,4,4086,1541,4084,1540,1604,1540,772,0},{1548,1012,274,4088,276,278,4054,2132,4052,4052,2132,4052,2132,0},{516,662,659,7924,2820,3062,3591,1780,1684,1940,1748,2844,2308,0},{0,32,64,128,16,1044,3094,2066,2066,2578,530,528,1008,0},{16,1120,1728,528,272,1428,1238,2130,2098,2072,540,534,1008,0},{4,4068,1038,542,790,389,132,68,2148,2084,2084,4068,4,0},{0,2046,1088,1100,1060,1072,1804,34,1116,1244,2586,2586,1008,0},{64,64,4094,64,64,4094,32,96,1244,1182,3610,2586,1008,0},{64,64,4094,12,12,2044,0,64,1236,3230,2586,2586,1008,0},{260,260,12,8190,86,69,68,68,68,68,68,4036,4,0},{388,388,2028,3486,3478,3461,8180,388,900,708,1604,3124,2068,0},{64,224,792,3662,2050,1020,768,288,1120,1246,2586,2586,1008,0},{16,8,2044,1318,1170,1224,1124,1824,64,1226,2698,2586,496,0},{4,4084,268,414,406,1991,1508,2356,276,260,260,260,260,0},{64,64,4094,224,416,304,1644,3270,64,1244,3742,2586,3056,0},{8,8,4088,36,2022,34,4064,32,96,1244,3230,2586,1008,0},{260,260,260,4094,2166,2150,2148,4068,2148,2148,2148,4068,2116,0},{260,388,908,606,1270,2358,5,2020,1540,516,452,388,516,0},{0,2044,1092,2044,1092,1092,2044,32,1088,1172,2582,2578,496,0},{16,504,396,2046,1026,2044,1024,2044,0,1096,3278,2586,1008,0},{260,324,364,4094,310,309,260,4068,260,260,260,4084,4,0},{8,4028,3236,3234,1726,152,2188,3974,96,1172,3606,2578,496,0},{4,4068,1100,670,918,1991,2100,260,4068,260,260,260,8180,0},{512,272,272,2044,1548,1548,2044,64,1216,3222,2066,2578,1008,0},{64,64,4094,432,1980,1460,2482,0,1088,1244,2718,2586,1008,0},{0,2014,1096,1480,1864,1148,5158,3120,80,1172,2578,2578,496,0},{68,68,4092,590,598,2758,2724,1700,804,788,1428,3268,2116,0},{4,2020,1068,2046,1078,1063,2020,2340,3364,804,1572,3556,2148,0},{64,1016,1548,2044,1548,2044,1548,2044,64,1228,2698,2586,1008,0},{260,388,652,1630,3190,4086,4,2020,1124,1124,1124,2020,1060,0},{0,4094,160,1188,680,160,4094,32,1088,1228,2702,2586,1008,0},{132,388,4092,14,2622,2789,2468,2340,2980,3812,2148,4068,2052,0},{260,2404,3404,286,4086,2087,4068,2084,2084,4068,2084,2084,3620,0},{1920,124,584,840,4094,496,584,3142,96,1748,3092,2578,496,0},{136,136,4052,1238,2039,788,916,3284,2144,1244,3228,2586,1010,0},{72,4076,2340,278,1348,3364,2340,388,64,1228,3726,2586,1008,0},{0,1016,1016,520,1016,4094,792,2044,3196,1108,1172,2834,496,0},{160,4030,160,4030,160,160,4030,160,64,1236,3222,2578,496,0},{260,4084,268,4094,4086,5,2020,3108,4068,3108,4068,3108,1572,0},{260,260,4068,14,4086,3125,3109,4068,260,1380,2340,2356,452,0},{1728,4094,128,1212,932,804,2876,3064,3214,1088,3230,2586,2546,0},{1156,1668,4068,1678,1686,4069,4,4036,2116,4036,2116,4036,2116,0},{4036,2372,4092,1326,2038,6,4068,3108,3364,3364,420,1732,2100,0},{3976,2184,2302,3976,2204,4014,2186,3976,64,1236,2706,2578,496,0},{312,782,2952,2942,1884,828,1162,2250,72,1088,3214,2586,1008,0},{64,416,4088,2054,1084,1340,1316,1340,1572,64,1172,2838,498,0},{64,2044,272,4094,0,2044,2044,1028,2044,96,1172,2322,498,0},{1920,4092,260,1404,1286,1914,842,2938,3202,1096,3790,2586,496,0},{4,4068,2732,2734,4086,262,4068,132,1988,1092,1092,1060,1844,0},{0,4094,2038,1046,2038,2038,150,1690,74,1154,3242,2606,992,0},{580,4084,588,270,4094,38,4068,4,1316,1316,1316,5412,3348,0},{272,4094,272,2044,2044,1028,2044,4094,552,3886,2794,684,48,0},{2020,3108,4076,4078,6,4085,2708,4068,4084,1092,900,2020,3124,0},{4,4084,1172,1534,1438,1436,4084,1556,1620,1748,1460,1172,3204,0},{260,4068,1612,4094,6,4069,2341,4068,4068,260,4068,260,4084,0},{2020,3108,4076,3134,2038,4086,4,2020,1060,2020,1284,3364,2452,0},{1092,4084,1612,1006,4086,262,4069,4068,2340,4068,4068,260,4084,0},{128,1152,3262,144,4082,406,1308,1288,796,788,2950,3778,3136,0},{640,1152,4092,132,1156,1468,1444,1830,806,806,3002,2754,3170,0},{160,1214,3224,408,4094,280,1304,1400,798,792,5016,2680,3086,0},{1664,3200,4094,128,384,3516,1444,1828,828,768,7160,2766,3168,0},{1552,2800,2814,2714,3998,626,2682,3586,1658,1658,5642,8169,2236,0},{272,1406,272,4094,380,3410,1374,1916,1918,552,766,3876,3202,0},{64,64,2044,1028,1028,1028,2044,1028,4,4,6,2,2,0},{64,4092,3076,3076,4092,132,132,4092,102,2022,1058,1042,778,0},{2080,3998,130,190,162,8098,1186,1214,1154,1154,1090,1091,1056,0},{64,2044,1028,1028,2044,4,4092,2372,2646,3174,3962,2114,1634,0},{1792,252,64,64,4094,64,64,4094,64,64,64,64,120,0},{256,256,256,4094,448,448,288,304,280,268,262,384,224,0},{392,392,392,446,392,1928,3512,2462,394,392,392,392,398,0},{12,8172,524,542,524,524,540,542,526,524,524,524,902,0},{4,996,580,606,580,3652,2140,2126,2148,2084,2084,3124,1814,0},{1028,1988,484,286,260,3332,4092,270,262,260,6404,2308,3846,0},{12,4044,2124,2143,2124,2124,2140,2142,2126,2124,4044,2124,6,0},{132,132,132,2046,1156,1156,1276,1230,1988,1092,1060,7220,3094,0},{4,2020,772,414,196,4068,2692,2654,2406,2340,2180,3140,1574,0},{4,4068,2436,3230,3204,3204,2028,1182,1158,1156,1220,1220,8182,0},{260,260,260,4062,260,260,4092,782,900,644,1220,3172,2086,0},{132,1668,1156,3742,2020,132,1436,1806,772,772,4996,3684,3078,0},{0,1016,768,192,2638,4088,1608,2044,1092,3574,2114,66,112,0},{4,4068,2340,2366,2340,2340,4092,2094,36,36,6180,6244,4038,0},{4,2020,1444,1470,1444,1444,1468,1454,1444,3492,2452,2452,406,0},{964,580,606,580,3620,4,2044,1134,1604,964,388,2020,3126,0},{1028,1092,1412,1054,1028,1220,1180,1038,3844,2020,1028,1028,1030,0},{132,260,260,8190,4,1988,1116,1102,1092,1092,5220,5156,3094,0},{3084,1996,76,94,76,8140,604,606,590,620,556,556,550,0},{4,4068,388,159,132,8164,924,910,964,836,868,6948,3606,0},{548,548,548,3886,2804,2724,2732,2726,2724,2468,3476,2196,3982,0},{260,900,644,1118,3172,2020,1116,1118,1094,836,2116,2116,4038,0},{260,772,4036,2142,2116,2116,4060,2126,100,100,36,36,22,0},{0,4076,3180,1918,108,4076,2300,3567,1388,1900,1900,3564,2278,0},{132,132,196,1119,3172,4068,28,2030,3172,3172,3172,4068,1030,0},{68,68,4095,2084,3060,2596,2620,3055,3108,1572,6180,2148,4038,0},{1028,1988,868,574,548,4068,572,559,548,548,5924,3556,3174,0},{260,260,4068,287,260,260,4092,926,1988,1348,2340,276,262,0},{260,260,260,4095,2340,2340,2364,4078,2340,2340,2340,4068,2086,0},{644,644,4068,2702,2692,4068,700,734,4084,2628,2628,3620,566,0},{4,4068,3172,3198,3172,4068,3196,3198,3174,4068,4,4084,6,0},{260,260,260,4094,4,1092,1116,1230,1668,644,516,8164,6,0},{260,2340,3428,1375,260,4068,268,286,8164,260,260,260,262,0},{260,260,260,4094,2148,2148,2172,4094,2150,2148,2148,4068,2086,0},{260,388,708,1615,3252,2324,12,2022,1542,516,452,388,518,0},{4,4036,2116,2143,2116,4036,284,4078,2436,2180,2180,2148,1574,0},{4,4068,108,126,2020,1124,1148,1150,2022,100,100,4068,6,0},{68,68,4068,319,308,3908,3020,2430,2372,1348,68,2116,4038,0},{68,68,4068,2111,2100,3044,2860,2862,2854,2532,2084,3076,1798,0},{4,4068,2180,2207,2244,1636,28,4079,2148,2148,2148,4068,2086,0},{4,1060,1188,1455,1316,1316,1068,1070,1956,2788,2916,6532,134,0},{132,132,4084,78,484,324,300,4078,260,1348,2340,2356,454,0},{1092,1092,644,4094,4,4,28,1998,4,4,4,4084,6,0},{260,260,4068,2110,2052,4068,284,270,260,260,260,260,390,0},{260,3396,292,4094,132,132,4036,1230,1766,804,788,1732,2150,0},{4,4068,1220,926,900,3300,284,4079,260,260,4068,260,262,0},{516,2564,516,4094,516,516,1004,590,580,1604,6084,3300,3078,0},{1092,1220,1668,4079,1668,1668,1676,4094,1732,1604,1604,1636,1574,0},{260,900,644,1758,3172,4068,28,1998,1092,1092,1092,1988,1094,0},{64,432,2044,2050,2044,2044,512,508,2044,64,4094,64,112,0},{260,260,4068,287,260,8164,1036,4078,1028,1092,1156,1028,1798,0},{260,260,4068,286,260,4068,28,270,4068,260,260,8180,6,0},{68,1604,964,2143,2116,4036,28,4062,2116,4036,2116,4036,2118,0},{260,260,4068,2111,2212,132,8164,1116,1615,708,772,3780,2150,0},{516,708,2804,3839,1764,708,716,1774,2676,580,4676,6692,3606,0},{260,2340,2372,1375,1284,4068,2076,2062,4068,2052,2052,4068,2054,0},{4,260,4084,1102,644,900,3820,1102,1604,1604,1604,1572,1558,0},{4,4084,2228,2190,2020,68,364,4078,260,260,8180,260,262,0},{132,708,1124,4095,100,4068,316,279,4084,388,708,1636,2102,0},{4,3828,2724,2734,3828,1700,2732,2807,2724,2724,3732,660,710,0},{4,3956,580,558,548,3956,588,606,612,3940,100,228,7958,0},{132,964,580,830,4084,2340,2348,4078,388,388,452,4452,3638,0},{4,4068,2084,2111,2084,4068,268,3943,292,356,356,436,7958,0},{1988,1092,1092,2015,4,4068,2108,2350,2340,2340,644,3172,2102,0},{132,1988,1636,574,4068,3364,3364,3374,4086,900,708,3172,2070,0},{4,4068,2084,4095,548,548,4076,558,4068,2148,2132,4052,2118,0},{260,3844,260,4095,3108,4068,3132,3118,4070,260,8180,260,262,0},{1088,584,4094,2050,3066,1016,768,508,4092,64,4094,64,112,0},{68,36,4094,2132,3012,2212,2188,3046,2180,2724,3044,2052,1542,0},{644,644,3812,670,644,3812,668,654,7908,644,644,644,646,0},{260,260,4068,30,4068,3172,3180,4046,260,1380,2340,2356,454,0},{4,4068,2084,734,1124,2340,268,4078,900,1860,3428,2324,262,0},{260,4068,4,1615,516,4084,140,8191,1092,612,964,1988,2166,0},{68,580,580,4095,628,4084,636,622,4068,612,612,4068,70,0},{1092,1092,4068,1103,4,4068,2348,2351,4068,2340,2340,4068,2086,0},{2020,3108,4095,3108,4068,4,4092,270,294,3876,356,500,7958,0},{1540,996,260,4094,260,260,3940,2350,4068,2340,2340,4068,2086,0},{4,4068,2084,4095,36,4068,1204,4094,308,4084,276,276,4078,0},{708,4068,484,1022,1252,4,2028,1326,1444,1444,388,4420,3638,0},{260,1380,1348,4094,964,3428,2364,142,4068,1604,964,1924,3174,0},{388,4068,4,1999,1124,2020,12,4078,2980,2660,3044,2084,3110,0},{36,1572,1780,1471,2548,148,4092,2462,1783,1748,1684,3980,2506,0},{1092,4084,1092,1358,900,1636,4092,6,2020,1060,1060,2020,1062,0},{4,4068,2724,2750,4068,260,4076,270,4084,1220,1092,4068,2150,0},{3076,2020,2340,1390,1092,4068,316,4095,260,2340,2340,4068,2054,0},{516,1284,1396,4047,1476,1524,3948,1319,3940,1396,1300,7940,262,0},{388,4084,388,2238,2020,388,2796,3038,260,4084,260,260,262,0},{260,4068,1092,591,4068,2340,4092,2350,3044,2660,3044,2084,3110,0},{64,4094,514,4090,1586,3054,1538,242,4090,130,4090,130,225,0},{580,4084,580,2030,3108,4068,3116,2030,260,4084,644,1604,2102,0},{260,1348,4084,4095,1092,1988,1564,1006,4068,260,4084,260,454,0},{676,676,3828,2735,3060,2820,3836,1687,1780,1268,1684,2964,470,0},{260,4068,1604,4094,4,4068,4076,2350,4068,260,4068,260,4086,0},{1540,1508,1348,1375,4084,964,3452,8191,2340,4068,2340,4068,2086,0},{388,4084,4,2094,3044,2980,4076,14,1060,2020,2020,4,8182,0},{276,4094,1470,1890,830,3582,560,508,2044,64,4094,64,112,0},{260,4068,2100,4079,3748,1732,2028,2086,4084,260,1316,2356,390,0},{1092,4084,1092,4095,1764,6612,12,4078,2340,2340,420,1732,2102,0},{548,4068,2036,3118,4068,4068,2028,4086,3812,468,2020,1348,2486,0},{64,64,4094,64,64,2044,520,792,304,224,496,3870,3078,0},{144,144,146,8082,1234,1234,1522,1810,798,798,1808,3280,2128,0},{256,446,160,4000,1248,1278,1346,1794,770,818,1950,3270,2112,0},{264,264,447,8068,3204,1532,1380,1828,804,804,1830,3314,2137,0},{264,392,136,8191,1224,1224,1534,1826,802,802,1982,3298,2080,0},{264,264,382,3844,3236,1506,1494,1308,792,536,1828,3458,2112,0},{256,446,162,8126,1250,1250,1342,1826,830,788,1974,3298,2114,0},{328,382,424,4008,3583,1496,1404,1814,520,638,1800,3272,2124,0},{328,362,7982,2312,3582,1474,1498,1622,1622,606,1858,3522,6370,0},{292,292,382,8100,3583,1408,1406,1826,574,546,1854,3490,2162,0},{264,298,300,4094,1468,1518,1352,1854,548,1844,1304,3244,66,0},{264,382,4030,1514,1918,1596,3502,2048,4094,72,1992,72,4094,0},{512,894,382,3906,3452,1534,1730,1662,1598,1572,1596,2364,134,0},{64,64,64,4094,520,792,272,432,224,224,432,3598,2050,0},{1032,1194,1434,1306,1032,1278,1420,1052,7966,1482,1033,1032,1032,0},{1040,1048,1324,1606,1087,1416,1406,3080,4014,1514,1098,1032,1036,0},{3088,1878,442,146,254,8082,1210,1242,1174,1170,1170,1278,1088,0},{3104,804,254,164,8124,1188,1212,1188,1188,1279,1172,1126,1090,0},{1032,2046,132,180,144,8190,1160,1278,1160,1194,1258,1096,1100,0},{64,64,4094,48,48,16,2032,1040,1040,1560,1544,516,962,0},{64,4094,792,272,4094,2114,2114,4094,16,2032,1560,524,898,0},{136,136,4094,3140,1988,668,2708,1684,1684,1174,1170,2514,2264,0},{132,136,4095,68,164,3996,596,532,4052,790,1298,3218,2138,0},{0,4094,64,64,96,4094,224,160,176,144,6296,2188,3974,0},{0,4094,546,702,674,738,4094,770,786,786,702,710,3648,0},{0,2044,1028,1028,1028,1028,2044,1028,1028,1028,1028,2044,1028,0},{0,2040,1544,1544,1544,2040,1544,1544,2040,0,0,4094,0,0},{0,4086,3126,3126,3126,3126,4086,3126,3126,3126,3126,4086,3126,0},{0,2044,1028,2044,1028,1028,2044,64,64,8190,64,64,64,0},{1024,1054,1042,8146,1042,1118,1170,1426,1298,1054,1026,1026,1920,0},{0,4062,2258,2258,4050,2270,2258,4050,2142,2114,2144,2080,3600,0},{1792,252,196,4092,388,2876,3612,2044,1548,2044,1548,2044,1028,0},{0,2044,1028,2044,1028,2044,24,4092,3366,3218,1176,1100,1892,0},{0,2044,1028,2044,1028,2044,76,2044,66,2044,64,64,4094,0},{256,270,4058,2394,2394,2398,2394,8186,794,670,1218,3168,2096,0},{64,4094,96,2044,32,4094,792,2044,3598,1016,520,1016,520,0},{128,222,8146,370,306,3870,274,274,3858,286,258,256,256,0},{0,2044,2044,1028,2044,0,4094,64,72,1996,76,118,4066,0},{0,2044,1028,2044,1028,2044,0,1204,1204,696,176,8191,0,0},{2044,1028,2044,1028,2044,1092,584,584,4094,144,144,2444,3846,0},{0,4078,650,4074,2730,2734,2730,3818,2154,2094,2082,4064,2080,0},{2044,1028,2044,2044,0,4094,2082,2044,200,2044,192,4094,192,0},{128,990,594,626,4082,2366,2354,4082,914,670,4802,6752,3600,0},{0,2044,2044,1028,2044,4092,4,2046,4094,1174,786,3826,2074,0},{520,280,4094,1188,680,4094,0,2044,1028,2044,1028,1028,2044,0},{2044,1028,2044,1028,2044,4094,0,2044,1548,1016,840,3654,2162,0},{256,4078,266,4042,4074,14,4042,2122,4042,2126,4034,2112,1600,0},{256,4094,18,4050,2130,2142,2130,4050,1362,3422,2338,2336,448,0},{3080,1022,148,4094,1168,1278,1168,1024,2044,1028,2044,1028,2044,0},{2044,1028,2044,1028,2044,2044,800,4094,2040,1038,2040,1032,2040,0},{3584,2046,1322,1354,4074,222,4090,1994,1226,1262,802,3984,3152,0},{256,286,4090,1114,1178,8190,26,4058,2138,4062,2114,4032,2112,0},{272,4094,272,2044,2044,1028,2044,4094,520,4094,1016,520,1016,0},{16,400,400,4094,2450,2450,2450,4094,2450,2450,2450,4094,2050,0},{64,64,2044,1092,2044,1092,1092,2044,1668,896,448,2936,3598,0},{0,4094,64,2044,1092,2044,1092,2044,72,104,48,252,3846,0},{792,272,4092,3404,3412,4092,0,2040,1548,2044,1548,2044,1036,0},{520,4030,520,4094,780,1460,2242,2044,1540,2044,1540,2044,4,0},{2044,1028,2044,1028,2044,4094,36,4092,3236,1340,868,1982,2272,0},{64,160,1016,3078,2044,1364,1364,2044,1016,520,1016,520,1016,0},{0,2040,1032,1032,2040,1032,1032,1036,2044,1028,1028,1538,898,0},{32,32,4094,16,2040,1036,1038,2042,1032,2040,1032,1032,776,0},{0,4028,2212,2212,4028,2212,2214,4030,2210,2210,2210,2146,3707,0},{0,4062,2130,3666,94,4050,2514,2398,1874,1618,1618,3922,2520,0},{8,3976,2238,2210,4030,2210,2238,3970,2194,2226,2238,2278,3650,0},{3976,2302,3972,2180,3972,2300,3648,2044,64,64,2044,64,4094,0},{8,3976,2302,2184,4030,2210,2238,4002,2238,2184,2303,2120,3656,0},{32,4004,2558,2468,4028,2468,2492,4004,2212,2303,2196,2214,3650,0},{1088,4078,1098,4074,4078,10,4074,2286,1930,1386,1482,2363,397,0},{64,64,64,64,4094,224,224,336,584,1612,3142,64,64,0},{64,64,2044,64,64,64,4094,224,336,856,1612,2114,64,0},{64,64,4094,64,64,64,4094,224,336,600,3660,2114,64,0},{64,64,64,4094,496,336,856,584,1092,3066,64,64,64,0},{64,832,1600,64,4094,224,480,336,584,1100,2118,64,64,0},{0,496,272,280,776,3654,64,4094,224,856,1612,2118,64,0},{8,1992,1224,1278,1228,1228,1116,1150,1098,1099,5192,5160,3112,0},{512,796,240,496,796,1094,64,4094,64,584,1092,2114,112,0},{32,32,510,272,2328,3590,64,4094,64,840,1612,1094,112,0},{8,4072,2120,2174,3148,1180,1180,1966,778,777,1928,3272,2088,0},{8,4040,264,318,268,268,8188,286,266,265,264,264,264,0},{1032,1032,1032,8190,1544,1564,1852,1326,1162,1227,1096,1032,1800,0},{64,64,4094,64,2044,1092,1092,2044,224,336,1612,3142,64,0},{8,4072,264,318,268,284,284,270,266,266,264,8168,8,0},{48,1008,796,438,224,952,3598,64,2044,64,584,1094,96,0},{64,64,4094,1088,584,584,4094,224,336,856,1612,3138,64,0},{8,1676,1228,1118,2124,2348,412,158,1166,1229,3148,4076,2060,0},{3084,1996,108,126,108,4076,3324,1470,1326,813,812,1468,2140,0},{4,2028,1740,606,588,3788,2268,1230,1358,1837,812,3516,2268,0},{204,76,4044,2174,2220,2188,2524,2654,3054,2669,2060,3084,1804,0},{520,520,520,4094,776,1820,1964,1710,2762,2635,520,520,520,0},{0,2044,1092,2044,1092,2044,64,4094,224,856,1612,3142,64,0},{12,4076,44,1278,1452,1836,572,1838,1326,2284,44,8172,0,0},{8,4030,2212,2212,2212,4026,64,64,4094,496,856,3662,2114,0},{260,260,260,4094,2156,2156,2174,4086,2150,2149,2148,4068,2116,0},{520,4094,520,520,1016,520,1016,64,4094,496,856,3142,2114,0},{132,140,1008,582,584,2596,3670,64,4094,496,856,3662,2114,0},{0,1020,240,4094,1136,1612,102,64,4094,496,856,3662,2114,0},{4,4044,108,126,4044,3148,3166,3150,4046,77,76,4044,0,0},{64,64,4094,496,856,3662,3066,520,1016,520,1016,0,4094,0},{8,4040,8,30,12,8172,284,1310,3402,2377,2344,2344,392,0},{132,132,4068,94,332,364,4092,262,1350,3429,2340,2356,388,0},{4,3076,3300,3214,8068,3308,3438,3654,3654,3301,3108,3092,1540,0},{260,260,4068,30,1100,2156,3708,670,902,773,900,3268,2084,0},{1092,1092,1156,4094,260,268,4060,278,262,4069,260,260,260,0},{260,780,8172,158,1164,972,2846,3470,1230,524,1932,2284,2084,0},{8,2024,1128,2046,1132,1132,2044,2414,3946,616,1640,3560,2152,0},{136,1928,1224,1278,940,780,1948,7294,4042,3145,3144,4040,72,0},{260,260,4068,286,268,4076,30,262,4071,260,260,8180,4,0},{4,4068,36,4031,556,556,4030,550,550,4068,36,8164,4,0},{64,4094,2082,4094,280,440,1008,3086,64,4094,496,1612,2114,0},{260,2348,3404,1374,268,4076,2076,2078,4078,2061,2060,4076,2060,0},{1028,1988,260,414,4076,1164,3164,3302,1158,1157,1092,1092,1060,0},{68,68,4036,62,4068,2380,2638,8182,3558,3365,4068,1028,1540,0},{520,4094,796,1980,2794,584,96,2032,524,304,224,120,14,0},{1092,1220,4076,2334,2316,4076,318,4070,2439,2436,2372,3364,260,0},{516,3588,516,4094,516,2732,2732,4070,1702,1701,1700,3508,2052,0},{260,388,644,1630,3108,4092,14,2342,1382,1348,516,4084,4,0},{260,4068,260,4094,132,4076,1372,3430,3062,263,4068,260,260,0},{520,520,4094,520,4030,2730,2730,4026,1820,1980,2794,2635,520,0},{260,4068,260,926,3308,4076,3102,3526,3398,3397,3524,3076,1540,0},{260,260,4068,158,2020,1068,2046,1062,2022,1061,2020,1060,4084,0},{520,4030,796,4028,2762,520,4094,2112,72,1996,92,118,4066,0},{260,1348,1348,4094,900,3436,2366,134,4070,1605,964,1924,3172,0},{4,4084,1172,1534,1428,1428,4094,1566,1622,1749,1460,1428,3204,0},{1092,740,2746,1966,1252,2750,4094,64,4094,496,856,3142,64,0},{1732,4068,1732,4094,2084,4076,2110,4070,262,4084,644,1636,2100,0},{1988,1156,900,4094,3012,812,4094,2230,2790,4069,2724,2980,3108,0},{4,1764,1668,3198,4068,6204,2046,1142,2022,5,1604,580,4084,0},{260,1348,4068,2110,4036,1100,1996,30,4070,2341,4068,4068,2084,0},{64,102,4076,2080,3504,1424,392,396,388,582,1634,3120,2072,0},{128,128,4030,2128,2386,342,284,776,792,660,1238,3171,2080,0},{256,382,386,8102,2798,2650,530,794,810,1318,1410,2302,0,0},{276,420,4034,2696,2780,2660,610,830,804,1316,1444,2236,2116,0},{264,510,392,4030,2688,2814,512,895,776,1322,1514,2184,2060,0},{802,292,3966,2324,3070,2772,638,596,1662,1844,1366,2453,148,0},{192,192,192,192,204,4044,204,204,204,204,204,4094,0,0},{0,4094,64,64,64,76,1996,76,76,76,76,4094,0,0},{400,400,400,3476,2036,404,404,404,404,4500,6644,3870,0,0},{64,72,1992,72,4094,64,1096,588,838,448,224,62,6,0},{256,1404,2304,4094,256,272,276,372,788,532,4628,3710,3078,0},{0,4094,1830,574,4094,1846,2814,646,130,1938,146,146,4095,0},{0,4094,96,48,2032,536,524,818,448,192,96,56,12,0},{0,4094,392,392,3580,2022,934,440,400,408,2444,3846,0,0},{256,1342,260,3972,476,2322,4050,2399,3336,1800,772,7878,3106,0},{16,1948,1158,1182,1094,2118,2014,1158,1158,798,774,4038,2144,0},{0,2040,1032,1224,1164,4094,1028,1124,1220,1540,4092,512,896,0},{8,4088,4,6,2042,1128,1164,8191,1636,1732,4092,512,896,0},{132,132,132,3204,1980,388,132,132,132,2180,2212,2238,3974,0},{132,3204,1980,132,2180,2292,3998,64,64,4094,64,64,64,0},{512,992,126,32,2016,254,32,3872,1020,38,2080,2080,4032,0},{64,4094,0,2044,2044,0,4094,2554,1888,252,4092,2144,4032,0},{528,2958,1358,776,3324,78,2824,1404,847,1928,2248,2056,4088,0},{8,4092,4,2046,2,3,1020,512,512,512,1536,5120,3072,0},{64,64,64,1088,1630,976,464,328,584,1604,3142,66,112,0},{48,224,384,124,2112,1216,734,472,328,588,1606,2114,112,0},{258,268,256,256,258,8180,256,256,264,268,260,262,258,0},{832,1600,4094,64,3268,1740,968,352,880,1612,3142,2112,112,0},{0,4084,56,48,50,54,48,48,56,52,54,4082,0,0},{2,4076,2080,1088,1090,1092,704,640,392,900,708,3186,2066,0},{0,4076,264,256,258,262,8176,256,264,268,260,262,258,0},{262,300,2336,3872,2530,2420,2352,2336,3880,292,6180,2086,4034,0},{64,102,4072,48,2032,6,2032,1024,1032,1028,1028,7170,2048,0},{0,4092,2096,2048,1990,1604,1600,1600,1608,1612,5732,5670,3090,0},{0,390,396,1440,3488,2470,2452,3472,1288,524,772,230,50,0},{0,966,584,608,3634,20,2032,1056,1608,964,388,1906,3090,0},{0,4086,280,272,4050,2324,2448,2192,2196,2196,3222,1098,1610,0},{256,268,256,4064,2338,2340,2336,4064,2344,2348,2340,4070,2080,0},{132,204,576,1120,3890,4084,0,2016,3112,3108,3110,4066,1056,0},{132,140,128,8064,130,134,128,4064,2088,2092,2084,4070,2080,0},{0,1990,1608,1600,1634,3126,16,4064,3112,3116,3108,4066,1056,0},{64,2044,1028,2044,1028,2044,1088,1758,976,328,1612,3142,112,0},{128,140,136,4064,2080,2086,2080,4064,2088,2084,2084,4066,2080,0},{262,268,4064,256,262,260,4080,128,200,1612,1124,4070,2050,0},{1024,2028,168,384,258,4086,1024,1536,776,396,100,246,3986,0},{66,108,4064,2080,2550,2340,2336,2536,3116,1572,2084,2082,4066,0},{258,268,4064,2352,2354,310,2032,1136,1752,916,788,1754,2154,0},{128,268,264,4080,258,262,256,4064,264,268,260,262,8178,0},{0,4076,2088,2080,4070,2092,2080,2080,4072,2092,2084,4070,2080,0},{194,908,0,480,258,2310,1392,832,872,1316,3348,2330,194,0},{258,260,4080,256,258,4084,0,0,2024,1060,1060,2018,1056,0},{0,4092,640,640,4082,2708,2640,3664,2172,2068,2068,4082,2066,0},{258,300,4064,304,274,260,8176,576,588,580,4708,4658,3602,0},{0,4086,2072,3024,2066,3028,2640,2640,2648,3028,2132,2066,3602,0},{128,2044,3208,3200,4082,3206,2032,128,4092,132,4086,130,128,0},{0,2342,2348,2336,2336,2934,3504,3496,2340,2340,2358,2322,2320,0},{3586,1004,256,256,8178,260,256,4072,2088,2084,2086,4066,2080,0},{0,1538,492,1056,1952,678,2724,3744,1712,1172,1172,2962,136,0},{128,260,4088,576,1122,4086,2048,1184,1192,1196,1188,5270,3090,0},{194,1740,1152,4080,242,2180,4080,2192,1420,772,2948,2674,3602,0},{64,3780,2040,1152,770,3046,3616,0,4088,580,580,2658,3634,0},{2050,2548,2832,2896,2898,2902,2896,2896,2900,2100,2150,2226,3074,0},{0,4084,2072,192,2018,70,288,4064,268,260,4084,262,258,0},{256,396,4080,2448,450,326,3936,1648,604,1604,3142,6626,32,0},{128,388,2040,1072,2034,1078,2032,432,3388,820,1590,3314,2096,0},{3842,508,1184,1440,2,2020,512,256,4092,260,260,258,194,0},{576,1612,3112,2480,386,582,1632,3120,2040,1060,1060,2018,1056,0},{64,44,4072,48,4082,2470,3360,8176,3236,1316,4084,1026,1794,0},{2018,1036,2016,1024,2018,4,4080,2064,2020,580,902,1986,3122,0},{258,2348,1376,256,4066,2084,4064,2080,2092,4068,2084,2082,1570,0},{0,2022,1608,896,4066,2358,2352,4080,2360,4084,2356,2354,3360,0},{128,260,8176,288,4002,2230,3832,1512,1828,804,1830,3490,2144,0},{2082,1830,288,504,290,3878,1392,1520,1332,1324,1442,1186,1184,0},{544,548,548,4088,1570,1638,2032,3888,2868,6828,546,546,546,0},{258,3372,1376,256,4086,2100,2992,2680,2684,3060,2164,2098,3634,0},{0,258,3372,1440,896,1734,2164,384,3496,1460,900,1634,3122,0},{0,4094,2064,576,1120,2102,388,4080,964,964,1446,2450,384,0},{130,4092,384,2032,4082,6,2016,1056,2028,1060,2020,1058,1570,0},{2080,3622,504,304,3926,1364,1520,1344,1476,1396,1350,1474,1218,0},{128,1612,4064,128,4082,1636,3376,2264,868,3524,1574,450,96,0},{0,2028,1064,2016,1058,2020,0,4080,2648,2644,2644,2646,8186,0},{546,804,8184,304,3894,3316,1232,1232,8148,1108,1118,1098,874,0},{0,3878,2336,2552,3874,2340,2544,3984,2460,2452,2550,2194,3202,0},{0,4076,2080,4064,2082,4068,0,2752,2812,3812,1764,706,8186,0},{512,1662,588,3944,872,622,3948,2664,2668,1588,5746,8026,2056,0},{0,4086,272,4048,2130,4052,2128,4048,276,3412,2398,2346,392,0},{0,4086,2176,4080,274,278,4080,2176,2716,3812,3070,2114,1632,0},{2022,1068,1512,1312,4082,2068,2016,1056,2024,1060,2020,1062,1570,0},{576,4086,584,0,4080,710,4080,2640,3036,4052,2358,2066,3088,0},{258,1286,1528,4064,1250,1278,4016,1200,4020,1236,1226,3978,128,0},{128,4086,576,576,4082,2198,3024,2192,3028,2644,3030,2130,1552,0},{4086,652,4064,2704,2706,4084,0,2016,4084,260,1318,2322,192,0},{384,4086,968,1504,2194,454,1632,3472,1452,964,998,3474,194,0},{134,4092,2064,2064,390,4084,2448,4080,2452,4084,582,3122,2064,0},{2018,3116,4072,4064,2,4084,2704,4064,2044,1636,966,2018,3120,0},{34,3622,3068,2592,3826,2806,2704,4080,2340,2556,2342,2338,3234,0},{256,2036,2648,3680,4066,6166,2016,1056,2024,580,580,582,4082,0},{546,766,3616,2704,3058,2822,3824,1680,1268,1268,1686,2962,338,0},{2022,1068,1064,2016,4082,2452,4080,388,4084,964,2018,3506,384,0},{544,3620,2548,1312,4080,2486,3504,3568,3428,3060,1598,2858,288,0},{0,64,64,64,3148,1092,1638,96,160,432,792,3596,2050,0},{0,4094,64,64,1096,1096,740,740,160,304,792,3596,2050,0},{8,8136,520,554,538,538,520,520,524,540,564,518,898,0},{16,16,4094,24,392,1192,1192,940,388,966,578,3120,2064,0},{0,2044,1024,2044,1024,2044,64,1092,1604,740,432,1816,3078,0},{128,136,136,4090,2138,2170,2188,2444,2828,2076,2100,3074,1792,0},{256,268,268,2334,2430,2414,2404,2404,2412,2412,2422,4066,2050,0},{256,780,4044,2142,2142,2142,4036,2116,76,92,118,34,34,0},{260,268,4076,286,2398,2382,2372,2372,4044,2316,278,6402,3586,0},{260,260,4068,278,158,1166,1604,964,260,1420,3286,4066,2050,0},{140,204,8156,350,318,3886,260,260,3852,284,278,258,258,0},{64,64,4032,64,2044,1028,1028,1028,2044,0,1204,2358,2338,0},{72,88,1022,544,560,2032,1048,4092,2054,2908,2724,3236,1536,0},{3076,964,68,342,382,4070,260,260,1356,2380,2358,2338,384,0},{1092,1156,660,4086,30,14,4,1988,12,12,22,4066,0,0},{0,2174,2312,2428,2406,2346,2352,3096,1542,1028,3252,2338,2338,0},{1156,1220,1220,4094,1246,1230,1220,1220,8172,156,1110,3170,2082,0},{0,4068,2340,2366,4094,2351,2340,2852,2732,3324,2166,4066,2082,0},{0,4072,264,4062,2138,2382,2380,2372,2380,2396,1942,3266,2144,0},{132,3204,4068,3478,1822,3022,3684,4,4068,652,726,6754,3632,0},{136,136,2046,1160,1176,1278,1224,1480,7278,3108,3252,2338,2338,0},{1544,3704,2660,4078,818,796,1816,1164,2118,0,1156,2466,2338,0},{0,4062,2450,3794,30,4050,2130,2130,4062,2,1172,2358,2338,0},{256,4044,2124,4062,2142,4046,2116,4036,268,2940,2150,7282,898,0},{264,382,1980,1314,1340,1470,1944,5822,6344,2124,1024,3508,2338,0},{1792,1020,584,4094,2050,48,2044,16,1016,808,460,2038,3090,0},{0,272,536,1036,3078,794,272,432,224,224,432,3870,2050,0},{272,1800,3478,224,496,3598,2044,1092,1092,2044,4,2060,4088,0},{64,64,4094,1372,1612,1366,1088,1772,1964,434,792,1548,3074,0},{128,132,132,132,4092,4,4,1020,516,516,518,514,514,0},{3090,2002,82,82,4094,2242,2370,1374,1874,1618,1618,3443,2225,0},{266,4042,2378,2378,4094,2370,4034,158,1618,4082,1554,1554,528,0},{64,72,76,4092,70,66,64,4094,64,64,64,64,64,0},{136,202,4042,3454,3755,2728,2696,2652,2414,2344,2184,3272,1608,0},{264,266,4042,286,8170,1034,1032,4092,1102,1224,1160,1032,1800,0},{264,1288,2314,270,4092,392,392,908,654,714,1096,3112,2104,0},{130,1166,140,4078,138,136,908,972,842,840,2920,2856,3614,0},{16,4092,268,268,266,280,4088,284,274,280,280,4088,14,0},{0,2026,1068,2030,1066,1064,2028,428,3370,808,552,3560,2158,0},{256,266,268,4078,2346,2344,2348,4076,266,1288,3336,4072,2086,0},{274,270,4076,270,3402,1352,1356,4092,394,648,1736,3176,2102,0},{256,266,4076,3180,4074,3176,3176,4076,2414,1642,1640,3560,2150,0},{10,2030,780,262,4094,264,460,12,4074,2728,2728,2732,8182,0},{274,4078,268,4078,4074,8,4044,3148,4042,4040,3144,3144,1606,0},{520,1544,2686,2568,4094,598,602,1662,1610,1406,3402,2506,2274,0},{0,4094,64,64,64,64,2044,64,832,1600,64,4094,0,0},{0,4094,64,64,64,64,2044,64,64,64,64,4094,0,0},{0,4062,4,4,4,8190,644,644,708,604,4686,4640,3600,0},{0,4079,260,260,388,1934,1476,2404,292,268,262,256,256,0},{0,4094,3140,3396,3396,3422,3396,3396,900,924,3038,2914,3632,0},{256,286,4068,2340,2340,302,4068,1124,1188,956,830,1936,2160,0},{256,350,324,4036,292,318,8164,900,1924,1372,2414,6448,256,0},{128,3983,1668,1700,1700,1700,3998,1684,1732,1604,1646,8112,0,0},{0,4094,2340,4068,2340,2366,4068,260,260,4076,270,8176,0,0},{0,4094,388,196,2548,1934,2020,1892,3972,2764,6974,256,448,0},{256,2350,2340,4068,4,4078,260,4068,2724,2732,2734,2720,3744,0},{256,4095,4,2980,2980,2158,4068,260,4068,2748,4071,2080,3104,0},{0,1920,764,580,580,580,1604,1124,1188,1316,3510,3058,0,0},{0,4052,148,190,1940,1172,1428,1534,1684,1684,1174,6098,3282,0},{520,520,520,4094,520,520,520,1016,520,520,520,1016,520,0},{520,4094,520,1016,520,1016,520,4094,292,548,532,2044,0,0},{72,72,76,4092,70,66,64,2044,64,64,64,4094,0,0},{0,4092,3140,3140,4092,3140,3140,3140,4092,3140,3142,3138,1858,0},{0,2044,1092,1092,2044,1092,2044,1092,1092,1862,66,2114,4035,0},{0,4094,2114,2114,2114,2114,4094,2114,2114,2114,2114,4094,2050,0},{64,64,64,4094,3142,3142,3142,4094,3142,3142,3142,4094,3078,0},{64,64,2044,1092,1092,2044,1092,1092,2044,68,6208,2112,4032,0},{0,2044,1092,2044,1092,2044,64,96,4094,1056,1040,1036,902,0},{0,4094,0,1016,2634,2634,3066,2634,2634,3066,2050,4094,2048,0},{2044,1092,1092,2044,1092,2044,272,1560,3350,272,280,264,260,0},{48,4060,2310,2326,2238,1774,0,2044,1092,2044,1092,2044,1028,0},{384,3998,3290,1530,826,798,3994,6394,4090,2142,2114,4032,2112,0},{1536,1020,584,840,4094,496,600,4094,1094,2044,1092,1092,2044,0},{1092,584,4094,2050,3066,520,1016,0,2044,1092,2044,1092,2044,0},{256,830,4048,1416,1160,4042,26,1354,1354,1370,1374,5474,3104,0},{4050,3086,1954,830,1024,4038,2622,650,3838,712,732,884,3682,0},{128,128,8188,14,4094,3596,780,270,260,260,260,386,194,0},{128,128,4092,14,4094,3516,3516,4094,52,52,2100,2102,4066,0},{128,128,8188,78,2030,636,924,964,3711,388,4,486,514,0},{128,128,8184,10,4094,268,4092,2460,2455,2772,3188,2070,3602,0},{128,4092,12,2030,1086,2044,1084,2038,2228,1844,822,3826,2098,0},{128,4092,4,2022,838,388,4084,2454,4087,2452,4084,2450,3218,0},{0,702,2480,1820,2044,3078,1016,520,520,1016,272,272,4094,0},{96,32,2044,1028,1028,1028,1028,2044,1028,1028,1028,2044,1028,0},{0,4094,64,96,2044,1028,1028,2044,1028,1028,1028,2044,1028,0},{392,136,4030,2274,2146,2082,2366,2850,2594,2082,3134,1026,1792,0},{1928,254,76,4060,638,587,584,2040,1036,2044,1036,1036,2044,0},{64,64,4092,3140,1092,68,2044,1556,548,358,450,1906,3096,0},{524,572,4004,2706,658,4030,2464,2464,1470,1696,1632,3966,2528,0},{272,406,3990,150,982,1622,1040,0,2044,1188,1188,1188,4094,0},{520,272,4094,64,2044,64,4094,0,2044,1188,1188,1188,4094,0},{64,2040,1064,1096,4094,1068,1604,770,2044,1188,1188,1188,4094,0},{704,704,4092,1156,1980,806,3066,3074,2044,1188,1188,1188,4094,0},{0,2044,1028,1028,2044,1028,1028,1028,2044,1028,1028,2044,1028,0},{0,8190,530,530,542,530,530,542,530,530,542,514,896,0},{64,4094,64,2044,1028,2044,1028,2044,1028,2044,1028,4094,0,0},{8,4040,2120,2174,4044,2124,2140,2142,4042,2123,2120,4040,2120,0},{128,1694,1234,1106,2174,6194,4050,1182,1170,1234,1118,1122,1824,0},{2044,32,2044,48,4094,24,2040,1036,2046,1034,2040,2040,1032,0},{64,4094,64,2044,1548,2044,2044,1548,2044,4094,272,1564,2054,0},{0,4062,2130,4050,2142,2130,4050,2398,3922,1618,1630,3554,2144,0},{792,4094,96,2044,32,4094,24,2040,2044,1050,2040,1048,2040,0},{256,4078,266,4074,4094,10,1998,3146,4042,3146,4046,3138,1600,0},{1536,1006,266,4074,1358,1354,4090,1358,1354,4074,270,258,4064,0},{264,3886,1470,1886,622,1866,3242,2044,2044,1548,2044,1548,2044,0},{3072,2030,1322,1354,4094,3130,1258,4014,1466,3962,1102,1058,1040,0},{4,3972,2238,2186,2187,2184,2303,2184,2200,2236,4068,2178,0,0},{4,4038,126,74,4042,3144,3198,3144,4040,92,100,4034,0,0},{4,4038,30,4042,2122,2120,2175,4040,12,1180,1172,1666,8160,0},{0,4094,48,16,24,8,2044,1036,1034,1032,1032,2040,1032,0},{318,516,4036,68,70,94,82,83,82,82,126,34,32,0},{0,2014,1028,1092,1094,1118,4050,2067,2066,3058,2078,3078,1536,0},{0,4094,260,2372,1350,1374,274,8179,274,274,286,258,256,0},{256,286,260,4036,2374,4062,3283,1266,1458,818,830,3490,2112,0},{0,4094,260,4068,2404,4094,2418,4083,274,338,414,1986,3104,0},{128,2014,580,4068,2404,2398,4054,2391,4054,2422,2366,2342,3088,0},{4032,2142,4036,2116,4036,30,4054,1047,8182,1174,1182,1030,1792,0},{256,286,4068,1028,1094,1758,2866,274,8178,274,286,258,256,0},{512,4094,2248,4094,2248,4094,0,4094,24,2044,1038,1034,2040,0},{1088,1630,516,4068,646,2750,2730,2731,1770,1738,654,642,4080,0},{256,4094,2468,644,4036,638,630,4054,598,4054,606,4036,64,0},{192,4094,34,3966,1586,4094,550,4094,98,4082,3130,3106,4065,0},{0,2044,0,0,0,4094,64,584,1612,1092,3138,2114,112,0},{772,776,798,784,4040,780,798,799,780,780,780,8172,8,0},{4,4076,2152,2174,2168,2152,4076,670,670,716,588,6764,3640,0},{260,264,4094,2416,2408,4076,2430,2430,4068,2308,260,260,260,0},{4094,176,2044,3252,3252,2044,0,2040,4094,72,1612,3142,114,0},{520,4094,796,1980,2794,584,2044,0,4094,64,1612,3142,2162,0},{64,4094,272,1252,1252,1300,2044,64,4094,2354,2546,2050,1538,0},{1920,252,64,4094,496,856,3142,508,400,1936,1048,1036,902,0},{272,270,264,2376,2430,3404,1884,796,906,1675,1160,3144,2088,0},{784,782,776,4040,2942,2892,2908,4094,2890,777,776,776,776,0},{1040,1182,1416,1032,1087,1228,1436,1054,7946,2025,1032,1032,1032,0},{16,4046,264,2376,3422,1356,268,8190,266,267,264,264,264,0},{16,4046,2120,2120,2174,2124,4060,46,1162,1163,2248,2120,2120,0},{144,206,4040,2888,894,1804,1884,2910,2890,2923,808,776,392,0},{280,3982,1132,1708,926,748,3868,2270,3310,1805,780,460,108,0},{0,4046,2120,2120,4062,12,4092,286,266,4043,264,264,8168,0},{264,2382,3404,268,4062,2124,4060,2142,2126,4044,2124,2124,3660,0},{152,1998,556,2028,3102,4044,3100,4094,270,2413,2156,3164,908,0},{280,4078,12,1996,1118,1996,12,4094,2990,3247,3244,2988,3116,0},{64,64,4094,2050,792,3076,32,1022,800,816,6928,2828,3590,0},{64,64,4094,2050,2834,1548,2054,2044,64,64,64,4094,0,0},{64,4094,2050,2842,1036,4092,256,260,4092,448,304,270,448,0},{64,4094,2050,2842,1548,1348,576,4094,224,160,272,3596,3074,0},{64,4094,2050,2842,1564,16,4088,108,2022,96,4064,96,96,0},{64,4094,2050,2842,1548,0,4094,136,136,3976,3132,1038,1792,0},{64,4094,2322,792,3110,2044,1060,1524,1188,1220,1332,2044,1028,0},{64,64,64,4094,0,520,792,272,272,400,128,4094,0,0},{260,264,264,7998,272,274,274,4052,2132,2168,2142,4034,2112,0},{64,4094,272,4094,0,2044,1028,2044,1028,2044,400,2456,3854,0},{260,2340,2336,4094,16,4082,266,4074,2730,2744,2750,2720,3744,0},{132,252,4042,594,1920,508,64,64,4094,224,432,1564,3078,0},{132,4028,586,594,2016,124,2016,510,96,4094,102,2144,4032,0},{396,4092,726,82,2044,1088,2044,68,4092,3184,3160,1870,66,0},{132,4092,586,434,1952,510,2080,4088,1102,960,448,2428,3590,0},{132,4092,586,578,2044,64,4094,512,4094,520,528,816,384,0},{388,4028,730,594,96,272,2044,3078,1016,520,520,1016,520,0},{388,4028,734,98,2046,2044,48,4094,792,2040,806,834,384,0},{132,4092,586,594,176,792,3582,0,1604,584,840,256,4094,0},{396,4028,726,18,4092,2058,2546,2322,2546,2322,2546,3074,1538,0},{132,4094,586,2044,1028,2044,2044,1028,2044,272,4094,264,262,0},{388,4028,730,82,4094,2050,1016,1016,8,2040,1032,1032,2040,0},{132,4092,586,602,8,4040,2302,4044,2268,4078,2250,4040,2120,0},{388,4030,594,16,3988,148,596,1556,0,2044,1188,1188,4094,0},{132,4030,586,1986,1764,908,3952,2022,2020,260,4076,286,4066,0},{132,4094,602,548,4094,2724,2748,4004,3516,2046,1620,3942,2242,0},{64,1092,1612,584,64,4094,224,336,856,1612,3142,2114,64,0},{64,584,72,4094,496,1628,3142,64,4094,224,432,1820,3078,0},{12,1694,1182,1246,3148,2174,4044,1420,1182,1166,1229,1100,1836,0},{260,276,278,4094,12,1118,1228,1164,1182,646,644,8164,0,0},{8,2026,1114,1118,1992,1150,1100,1116,2014,1098,1098,1096,8168,0},{260,4054,278,4046,4068,31,4044,2124,4062,2118,4037,2116,1604,0},{3652,2646,2630,3070,3662,2628,2796,3774,2998,2982,2532,2340,3332,0},{644,4086,662,4078,2732,4094,2732,4076,4054,2118,4037,2116,4036,0},{1792,510,48,280,252,608,1560,4092,2112,840,1612,3142,112,0},{64,4094,2044,64,4094,32,280,252,1584,4094,584,1612,2162,0},{64,4094,64,4094,2082,2322,252,560,2044,2112,584,3140,2162,0},{0,2000,1170,914,2002,3184,408,252,1584,4094,72,1612,2162,0},{152,3738,506,2202,4094,98,400,252,1584,4092,2888,1612,2162,0},{2044,1092,2044,1092,2044,272,252,560,2044,2112,840,1094,2162,0},{8,4068,2068,3418,1326,1356,2902,30,4048,278,278,266,4064,0},{264,4036,2132,4058,2126,2124,4052,2846,4086,1938,1878,2854,384,0},{380,3842,1470,1444,638,1954,2302,504,1584,4092,584,1612,2146,0},{8,4076,260,274,286,270,260,286,270,256,280,8175,0,0},{136,136,132,4036,2130,2063,2188,2308,2846,2048,2064,3086,1792,0},{8,2028,1668,726,730,3791,2244,1502,1358,848,1852,3494,2256,0},{8,4040,2052,2068,2066,2079,4040,2116,94,66,6208,2142,4032,0},{264,260,260,4082,2350,2350,2852,2998,3822,3168,2104,2094,3616,0},{8,1676,1156,1236,3154,2159,1996,1412,1182,1152,1240,1102,1824,0},{3592,972,580,594,606,4044,580,638,582,576,5240,3534,3168,0},{8,4076,2436,3476,3226,3215,2028,1156,1182,1154,1176,1230,8176,0},{264,1292,2308,4052,282,3342,1996,2324,3358,1792,792,7878,3104,0},{128,132,4068,198,490,334,356,4070,270,1344,2348,2354,384,0},{8,4040,2372,2406,2418,2383,4044,2406,2430,2368,2416,4094,2112,0},{8,4044,3140,3158,3166,3150,4036,30,14,1088,3164,2151,2080,0},{136,3972,1220,1714,783,908,3268,2366,782,0,476,1799,1024,0},{8,2028,1540,790,922,3310,36,4062,270,256,280,270,8160,0},{264,268,4068,278,286,4046,4,30,4038,2112,2140,4038,2112,0},{132,3204,4068,1426,778,3022,3684,6,4094,640,712,2662,3632,0},{264,396,900,1750,3162,4079,4,2014,1102,1088,1116,1990,1088,0},{136,1996,1604,630,4094,2382,2372,4062,70,64,2168,2126,4032,0},{264,268,4068,406,1182,3790,3044,726,718,576,600,2670,3632,0},{520,2724,2724,562,4078,812,1828,2750,2790,544,572,4066,0,0},{264,4044,260,4086,2062,2446,356,350,4070,256,1678,3138,2080,0},{0,4044,3076,4038,3082,8174,260,3398,1934,1920,3452,2342,384,0},{3592,2028,3396,1366,4090,207,4068,70,2014,1216,952,1975,3280,0},{256,260,4068,2086,4074,46,4068,2414,2414,4064,2428,2386,2112,0},{72,1996,1988,1042,4078,140,3556,1950,1894,1840,2764,2914,384,0},{264,4068,2084,118,4042,558,4004,2230,2222,4000,2220,4002,2208,0},{4,4038,574,522,520,575,520,554,554,554,570,8174,0,0},{260,258,4094,3338,3336,3390,3336,4074,810,1834,1210,3326,2112,0},{0,4094,3218,3218,4094,48,2040,524,816,480,224,56,14,0},{4092,2486,4094,64,4094,96,2044,2044,1540,2044,2044,1540,4094,0},{4092,2450,4094,64,2044,576,4094,96,2044,1038,2040,1032,2040,0},{520,272,4094,64,2044,64,4094,64,4094,224,432,1820,3078,0},{520,272,4094,96,2044,4094,16,2040,1100,1094,2042,1600,4092,0},{784,4094,64,2044,64,4094,64,4076,3360,1408,908,3682,2096,0},{48,3982,2346,3070,3484,3502,2314,2366,4010,2366,2346,2366,3490,0},{4030,2212,3900,2470,2044,1092,2044,2044,272,4094,4094,792,3078,0},{4032,2326,3414,3486,2924,703,4044,620,4078,586,4090,586,4032,0},{32,3104,2044,800,416,4094,96,568,926,114,2064,3088,2016,0},{32,1056,2044,800,4094,96,2040,28,22,1008,512,512,448,0},{32,1056,2044,800,416,4094,48,2044,1054,2040,1048,1048,2040,0},{0,4094,64,96,4094,2450,2450,2450,2450,2450,2450,2450,1538,0},{4094,64,96,2044,1188,1188,1572,32,4094,280,248,2032,3086,0},{1032,904,510,264,3870,456,318,7948,988,314,4363,6408,3848,0},{0,4094,520,520,1016,520,520,1016,520,520,4092,542,512,0},{0,3806,2674,2738,2750,2738,2750,2738,2802,3838,730,592,544,0},{0,4094,2130,2130,2142,2130,4062,18,1042,1214,2262,2128,2128,0},{0,4094,3132,1956,1852,2558,544,508,1104,974,880,3662,64,0},{0,4030,4030,2210,4030,2050,3066,2546,2322,2546,3058,2306,3586,0},{0,1950,1170,1170,1182,1170,1234,1246,1234,1106,5202,5202,3195,0},{1024,1054,1042,8178,1054,1042,1170,1182,1426,1042,1042,1042,1816,0},{0,798,786,786,4062,786,786,798,786,786,786,8179,24,0},{0,1950,1170,1106,3198,18,4082,1118,1170,914,786,1746,2168,0},{256,286,274,4082,286,274,4082,798,786,658,1170,3154,2104,0},{64,2044,1028,1028,2044,4,2036,1044,2036,1046,2034,1042,1552,0},{64,1992,72,4094,0,2044,1548,2044,1548,2044,1548,1548,772,0},{0,2002,1234,914,1938,3184,2044,1028,2044,1028,2044,1540,772,0},{144,1950,400,2200,3990,0,2044,1548,2044,1548,2044,1548,776,0},{256,158,1170,1106,3710,4082,18,4062,3154,3154,3154,4051,2141,0},{128,1694,1170,4082,670,2706,2770,1630,1618,594,850,6898,3640,0},{286,274,4082,18,1118,2162,1266,1694,914,786,914,3282,2105,0},{94,82,4082,2098,2430,3506,3506,3518,3698,3122,4082,2066,3596,0},{140,3220,934,190,2176,4030,162,2238,4002,446,162,6306,4018,0},{128,2014,594,4094,114,4050,2514,2526,2546,1522,434,2482,3901,0},{286,786,4082,626,638,626,4082,574,562,562,562,4083,9,0},{286,274,4082,18,2590,2802,2994,2366,2994,2802,2162,4083,2057,0},{3662,2634,2794,2634,2638,2762,2810,2638,2730,2730,4074,554,525,0},{1024,1246,1682,4050,2142,2130,4050,670,658,658,722,4690,3641,0},{256,926,1682,3186,8190,18,2322,2398,1362,1106,530,4083,9,0},{256,4094,2098,114,4062,2994,2738,2814,2706,3730,594,2683,3629,0},{0,4094,650,4074,2734,2730,4074,142,4090,1098,970,1931,2157,0},{3584,3598,4090,1514,1038,1514,1514,1326,1322,1322,5482,7627,2860,0},{0,4014,2218,3978,2190,4026,170,3758,1194,2986,2282,251,3997,0},{256,4094,1106,1170,4094,2098,274,4094,146,3986,1106,1115,1837,0},{256,3422,1362,4082,2110,4050,1106,2014,274,4082,274,275,4093,0},{256,4094,914,1490,2430,914,1234,6526,1362,914,2002,2418,397,0},{64,96,2044,1028,1028,2044,1028,1028,2044,1028,1028,2044,1028,0},{0,4094,16,792,1804,4092,64,64,2044,64,64,4094,0,0},{256,510,388,3988,1214,1506,1352,1854,776,776,2044,3279,2112,0},{8,3996,1078,830,1544,4040,2622,2568,574,546,546,574,930,0},{264,264,4094,30,1946,1170,1182,1170,1178,1178,5330,5202,3194,0},{8,1980,1190,1198,3310,38,4094,2210,1194,1834,802,4002,2298,0},{16,504,392,132,2046,1092,1092,2044,1028,4,6148,2052,4088,0},{136,1928,1150,616,4040,2376,2398,4040,126,72,6216,2120,4040,0},{272,272,4094,272,0,1020,384,224,48,24,2060,2060,2040,0},{272,272,4094,272,0,2046,1056,1056,1056,1056,1824,32,32,0},{272,4094,272,304,64,128,4094,12,12,12,12,2044,0,0},{272,4094,272,16,152,3208,1676,398,234,168,6280,2184,3976,0},{280,4094,344,64,240,792,3598,3066,776,264,1480,1032,2040,0},{272,4094,272,304,32,4094,16,24,2040,1038,1034,2040,1032,0},{272,4094,272,272,64,4094,64,64,2044,1028,1028,2044,1028,0},{272,4094,272,336,64,2044,1092,1092,4094,224,432,1820,3078,0},{272,4094,272,260,268,4080,70,68,64,72,68,4038,0,0},{272,4094,272,2044,1028,2044,1028,2044,64,64,4094,64,64,0},{272,4094,272,2020,776,192,4086,2628,2368,2348,2452,3270,1602,0},{272,4094,272,136,3972,2134,2142,2184,2324,2334,3072,3134,1794,0},{272,4094,272,2044,1028,2044,1028,2044,64,4094,160,1816,3078,0},{272,4094,272,272,1308,268,4074,264,412,670,1736,3176,2094,0},{272,4094,272,1920,254,1124,1612,64,4094,496,856,3662,66,0},{272,4094,272,4094,2082,2322,252,624,2044,2112,584,3142,114,0},{272,4094,272,196,1996,1632,914,1988,3184,2024,1060,2022,1056,0},{272,4094,272,4094,3066,0,2044,568,998,476,694,3292,98,0},{272,4094,272,144,3988,724,596,1044,2044,1188,1188,1188,4094,0},{272,4094,0,2044,2044,1056,2044,4094,112,2046,2042,1032,2040,0},{272,4094,3344,4090,522,1006,3674,2040,1695,762,2042,5398,3204,0},{64,1984,64,4092,2884,2172,4036,6,486,294,2354,2322,3854,0},{64,1984,64,4092,2116,1020,2116,4038,134,1442,2090,2602,962,0},{64,1984,64,4092,2884,2172,4036,6,1326,1342,818,290,4094,0},{0,2044,1028,2044,64,2044,1092,1092,2044,68,1600,4094,2048,0},{8,8168,264,318,298,810,3370,2366,266,312,312,319,256,0},{64,4094,2146,980,3702,1020,66,2044,1092,2044,576,4094,2048,0},{256,1348,1284,4062,274,4082,1234,4094,3308,1172,668,2198,1920,0},{1160,1160,4062,2386,2386,4050,2386,4062,266,8184,284,295,256,0},{638,512,574,4002,2750,2688,2814,4054,594,2686,2634,4042,162,0},{64,96,32,2044,1188,1188,1188,1188,1188,1188,1188,8191,0,0},{8,4044,6,18,8,4076,1550,1551,1548,1548,1548,1548,908,0},{68,3652,242,72,76,8180,1094,1095,1524,1092,1092,1532,1540,0},{36,3812,146,508,8020,1526,1366,1524,1092,1524,1252,1460,1556,0},{64,64,4094,224,2224,1176,908,778,264,520,1736,2168,8,0},{256,268,264,318,272,792,3368,2364,298,264,264,264,264,0},{64,4094,64,2044,64,4094,240,3224,910,778,1736,3192,8,0},{1028,1548,776,478,16,1032,828,478,2079,3084,1548,460,76,0},{1028,1032,1024,4062,1040,1032,1212,1182,1438,1036,1036,1036,1804,0},{64,4094,0,1016,520,4094,520,1016,3248,1948,798,3832,2072,0},{648,1160,4076,398,2828,3660,64,4094,1200,1948,794,3704,8,0},{260,780,776,4062,2376,2376,2428,4062,2399,2372,2372,4036,2116,0},{260,260,4064,2431,2408,360,4092,1262,1215,804,804,1972,2132,0},{2174,2312,2428,2406,2360,2072,3662,64,4094,1200,798,1752,3128,0},{280,282,4092,280,286,4090,64,4094,1200,1948,782,3704,2072,0},{132,1164,1096,2430,936,648,1244,3198,4095,1100,1100,1996,1088,0},{4,4036,2304,8190,2184,2184,4060,206,4055,2276,2276,4036,2052,0},{1284,2308,8190,264,4072,2356,2348,4078,2341,4068,2340,2340,3364,0},{274,274,4094,272,286,4050,82,4094,1200,1950,778,3704,2072,0},{260,4068,302,302,4072,428,684,4014,564,4068,548,532,532,0},{64,4094,2044,1604,1092,2044,4094,1016,3174,1720,798,3704,2072,0},{1092,1092,1508,1102,1096,4092,3086,3150,1508,1092,1220,2036,1028,0},{0,4004,2222,3976,2184,4020,172,3758,1197,2980,2212,244,3988,0},{1092,1092,4064,1774,3944,1100,4076,14,4086,260,1316,2356,388,0},{0,4094,160,160,4094,2230,2198,2198,3854,2054,2054,4094,2050,0},{0,4094,400,4094,3478,4094,32,48,4094,280,504,1008,3086,0},{0,2044,1540,1604,1604,1604,1604,1636,1764,160,2224,2200,3974,0},{0,4062,2128,2384,2386,2398,2380,2376,796,916,4758,6722,3616,0},{8,4040,2120,2142,2376,2376,2431,2892,796,916,4740,2626,3618,0},{4,4044,2120,2398,2392,2376,2380,2398,798,900,4740,2628,3620,0},{1024,1612,584,4094,2050,3066,584,584,584,744,160,2200,3982,0},{16,504,268,2046,1102,1100,2044,1100,1092,2044,1092,1094,1858,0},{4,3996,2324,2322,3838,554,702,4010,746,8190,554,554,560,0},{516,540,532,3986,2750,2730,2750,4010,554,3646,2602,4074,56,0},{64,64,4094,0,1016,0,1016,0,2044,1548,1548,2044,1028,0},{4,1928,1214,1088,3166,32,4094,1088,1246,914,786,4062,2146,0},{132,140,4095,832,894,768,8190,768,798,786,786,798,514,0},{3588,968,798,768,8158,768,798,768,4062,2130,2130,4062,2114,0},{260,520,8190,384,1182,960,2846,3456,1246,594,1810,3294,2082,0},{4036,264,414,1984,1182,1152,8190,0,4062,2130,2130,4062,2114,0},{260,4068,4063,4064,2734,4064,4046,2144,4078,4074,4074,1742,2082,0},{256,268,264,256,270,8168,264,264,264,280,284,268,256,0},{4,8172,520,512,526,520,520,520,520,552,568,524,896,0},{260,268,264,256,270,264,776,904,648,1720,1240,3180,2080,0},{256,268,264,256,270,3848,264,264,264,280,268,8180,0,0},{128,2468,3368,1056,1094,1604,708,644,388,404,732,3180,2096,0},{0,4076,3080,3072,3086,3080,4040,72,72,72,6264,2124,4036,0},{1088,1092,1096,4064,1088,1095,1092,8180,1092,1108,1116,1060,1056,0},{0,4068,520,576,591,620,8172,780,908,668,588,564,896,0},{64,76,4040,288,303,264,264,8168,264,264,280,268,256,0},{256,908,712,1088,6207,76,1612,972,204,76,2140,2124,4036,0},{0,1988,1608,1088,3175,4,4068,1092,1604,916,924,1740,3104,0},{256,260,264,4064,134,142,3980,3276,1100,1116,1116,1068,1824,0},{260,268,2024,1280,1295,1292,1420,4076,396,652,1756,3180,2096,0},{0,4068,776,768,774,844,3916,844,844,860,844,8180,0,0},{0,1988,1096,1088,1998,1096,1096,1096,1992,1096,1116,1100,8160,0},{0,4036,3144,3136,3142,3148,4044,12,12,1116,3164,2156,2080,0},{1536,972,72,64,4047,588,588,1004,1644,3644,572,572,512,0},{260,908,1736,3168,302,204,588,268,3276,1116,796,460,96,0},{0,4068,2060,3040,2062,3020,2892,2892,2892,3036,2140,2060,3584,0},{1536,2564,2568,8176,518,518,740,580,580,580,6108,3180,3072,0},{1536,996,264,256,8166,260,260,260,4068,2100,2108,4068,2080,0},{2048,3958,1604,1568,1591,4084,1860,1876,1892,3900,108,212,7952,0},{256,260,4072,128,1230,1000,2824,3464,1640,808,1944,3308,2100,0},{3136,1220,1164,4064,262,270,4044,268,268,4076,284,268,260,0},{0,4070,140,2016,1158,1222,8180,4,4068,3108,3132,4068,32,0},{0,4070,2156,2144,4039,4,4068,260,8164,900,668,3180,2080,0},{1088,1604,584,2016,1062,1070,2028,716,716,604,604,2604,3632,0},{256,4068,264,4064,4070,14,1996,3180,4076,3180,4092,3180,1568,0},{256,4068,264,4064,2055,2500,292,324,4084,412,1692,3172,2096,0},{0,4070,2348,4064,2343,4068,260,4084,900,1884,3436,6452,256,0},{64,580,588,4064,631,4068,612,612,4068,636,620,8164,96,0},{0,4068,2344,2976,2336,4071,2084,2980,2724,2740,2972,2076,3600,0},{256,3436,1448,896,1742,2412,268,2412,1452,1964,732,3180,2096,0},{4064,2340,4072,2336,4070,4,4068,2148,4068,2148,4092,2156,1568,0},{512,2710,2740,1696,519,4020,804,1828,2724,2724,556,116,3984,0},{2114,2292,2196,8176,2198,2292,2708,2804,2244,2276,2236,2196,1728,0},{1090,4084,1612,1984,263,4068,4068,260,4068,260,4092,260,4080,0},{16,248,140,2046,1092,2044,1080,870,984,750,1200,2190,96,0},{64,4094,1016,1548,1016,4094,2050,3066,1660,1008,748,3228,98,0},{128,2014,616,4078,2408,4095,404,3444,1924,1892,2692,2660,390,0},{68,4076,1440,716,3106,2044,1028,2044,2044,1028,2044,1820,3078,0},{16,504,392,132,2046,1036,1100,1100,1100,1132,432,1816,3078,0},{0,2044,64,64,4094,0,2044,1036,1100,1100,480,1848,3078,0},{64,4094,2044,64,4094,0,2044,1092,1092,1092,480,1848,2054,0},{256,318,418,4010,1194,1258,1258,1322,810,776,1812,3494,2242,0},{0,3230,1170,666,410,4090,666,666,1686,1164,3220,2514,192,0},{144,3720,494,2186,3976,0,2044,1100,1100,1100,416,1816,2054,0},{2040,1096,4094,1604,2044,0,2044,1100,1100,1100,416,1816,2054,0},{256,318,290,7978,298,298,298,4074,2154,2124,2132,4086,2114,0},{64,2044,2044,64,4094,0,2044,1612,1612,1612,416,1816,3078,0},{592,1224,4092,398,2824,3592,2044,1548,1612,1612,160,1816,3078,0},{288,2046,1440,2044,4092,2456,3470,2046,1092,1092,1188,1848,3086,0},{8,4094,2284,2212,4022,0,2044,1612,1612,1612,416,1816,3078,0},{64,4076,3368,1424,732,3174,2048,2044,1092,1092,1188,1816,3086,0},{256,2334,4050,1306,4090,282,410,4090,2230,3972,2196,3986,2176,0},{264,1800,1214,1224,4094,2730,2730,2750,2716,2492,1834,3466,2120,0},{1182,1682,4050,666,4058,2714,4090,2706,4054,1676,1748,2802,640,0},{652,4030,522,4094,1812,3218,2,2044,1612,1612,1644,944,3086,0},{1152,1182,4082,2426,3578,2938,4058,1946,1110,1996,1108,2002,64,0},{64,64,2044,64,64,4094,288,1332,3380,2322,2322,264,452,0},{64,64,2044,64,64,4094,64,72,1996,76,92,118,4034,0},{8,3976,574,520,638,4056,522,570,522,526,526,26,4083,0},{8,3976,2110,2056,2174,3976,138,186,6282,2190,3982,26,4083,0},{264,776,1726,2632,392,1598,778,3258,1546,910,206,27,4081,0},{8,4040,2366,2440,3838,72,3976,2234,2186,3982,14,26,4081,0},{1544,2568,4094,584,2686,2632,1610,2042,5834,3918,2446,26,4081,0},{520,2632,1726,520,4094,2888,2378,2426,2890,2126,3150,26,4081,0},{8,488,3934,2504,2942,3912,1482,3450,4042,2926,782,26,4081,0},{0,2044,1028,1028,1028,2044,64,72,4044,76,92,118,4034,0},{256,798,658,1234,2174,2024,1098,1114,1098,842,2138,2270,3968,0},{350,338,4050,338,382,264,4074,794,778,650,1182,3143,2080,0},{128,222,4050,2162,3038,2632,2634,3034,3146,1610,90,2126,4032,0},{0,4062,82,82,4062,2120,2122,2170,4042,74,126,8135,0,0},{0,4062,2130,4050,2142,2120,4042,2394,3658,1610,1658,3534,2112,0},{384,1950,1234,2034,894,776,1930,3322,4042,2250,2302,4047,2048,0},{640,670,2738,2802,1758,648,650,1754,2794,650,606,4718,3616,0},{256,286,4050,2130,4062,2120,2122,4058,2890,1610,1630,3526,2144,0},{256,2846,4082,1938,1374,2408,394,4058,2122,4042,2142,4038,2112,0},{3072,2046,2322,3410,1374,260,260,4094,902,1926,3422,2350,256,0},{256,2366,4090,26,3822,2724,3814,2750,2726,3814,3006,2454,3536,0},{64,1016,520,1016,520,2568,4088,1544,1022,640,608,536,902,0},{8,4092,2082,4030,162,190,162,4094,2096,2088,2086,3106,1848,0},{8,1950,1170,1182,3154,286,4082,798,1944,1436,3414,2418,280,0},{776,2910,3986,798,4050,2142,2902,2398,2392,2900,2134,2130,3160,0},{1296,3454,2320,4094,272,2430,1404,1362,894,894,4880,4094,3152,0},{32,48,4094,24,200,204,2044,192,192,4094,192,192,128,0},{520,780,4062,260,8174,138,158,3976,1032,1726,904,1544,1032,0},{260,772,926,1220,3178,2282,1182,904,392,158,2186,2184,3976,0},{4,4036,1086,1540,782,1930,2302,8,4040,792,782,776,4072,0},{272,1406,272,4094,264,3582,1284,1812,1918,528,5118,3998,3216,0},{1028,1988,286,260,4076,1162,2302,1192,1160,1182,1160,1096,1128,0},{260,772,4062,1156,3214,2122,1246,1928,776,798,1800,3272,2120,0},{4,4068,670,646,4074,2730,2750,3752,4072,3454,2408,2088,3112,0},{64,64,4092,520,272,4094,64,64,64,4094,64,64,64,0},{644,1156,3998,2210,2730,1192,4030,1156,3934,1092,1092,1062,1026,0},{128,134,140,4080,2176,2183,2244,2116,2116,3108,1812,30,8179,0},{2,4086,2188,3200,3264,3142,3140,1124,1060,1812,12,26,4066,0},{256,390,388,4080,128,390,900,1604,1124,2100,12,30,4066,0},{512,518,524,4080,512,614,580,516,516,908,30,4082,0,0},{0,4082,68,64,4032,2118,3140,3172,3108,1076,1820,30,4082,0},{192,3938,2348,2336,2336,2342,2340,2548,3380,260,268,30,4066,0},{0,4070,12,0,4080,199,580,1092,1060,4068,2060,30,4066,0},{3584,998,44,32,4064,550,548,548,548,564,540,30,4066,0},{1024,2022,36,4064,1056,1062,1700,820,788,1236,2124,30,4082,0},{2,4084,268,384,384,1991,1508,2484,388,388,388,30,4083,0},{128,386,4084,1536,560,838,388,900,1732,3188,20,30,4082,0},{64,582,588,4080,576,582,4084,580,580,548,556,30,4066,0},{0,4070,12,0,4080,583,580,580,2596,3636,12,26,4066,0},{384,386,4084,384,4064,390,4084,2436,2436,3972,396,30,4082,0},{194,4084,76,352,288,4070,260,260,4084,260,260,286,4082,0},{0,4070,3116,3104,4064,38,804,548,1060,3092,2076,30,4066,0},{258,388,4076,3104,3104,4071,3108,3108,3108,4068,12,30,4083,0},{128,262,4092,640,672,2726,2772,2652,580,612,812,30,4066,0},{386,2020,1060,1056,2022,36,4068,2084,2084,2084,4076,30,4082,0},{0,2018,1060,2016,1056,2022,3108,1828,548,1252,2092,30,4066,0},{1026,1094,588,4080,256,262,4084,388,644,1092,3124,30,4083,0},{1536,998,260,4080,256,263,2020,3108,3108,4068,12,30,4066,0},{320,2386,3412,1888,832,838,1908,2396,324,2340,3604,30,4082,0},{256,358,4068,304,256,4086,580,580,580,2596,3612,54,4066,0},{1536,486,260,4080,1984,3126,996,708,3652,2148,1596,54,4066,0},{1600,582,4084,2304,4064,288,4086,2436,2500,3380,270,4082,0,0},{384,454,1644,3120,1984,390,4084,388,1444,2452,204,30,4066,0},{0,4086,4,2016,1056,1062,2020,1604,580,4084,12,26,4066,0},{4066,1606,908,4064,2336,2343,4068,2340,4068,2340,3372,26,4066,0},{80,4082,548,560,608,4070,628,604,580,4068,60,30,4066,0},{2018,1060,1068,2016,0,4086,260,4068,260,260,4084,30,4066,0},{256,4086,260,256,4064,2350,4076,908,1996,3372,2332,30,4066,0},{322,358,4068,304,304,4078,292,4068,292,4068,12,30,4082,0},{64,998,804,4080,3376,3494,4068,1412,1348,2404,3900,30,4066,0},{2016,1446,2028,1440,2016,390,4084,2964,2964,4084,3100,30,4066,0},{544,866,4094,292,4064,1190,1188,3988,1172,1244,1644,30,4066,0},{386,4070,2068,4080,16,4087,2740,2740,4084,2748,3108,30,4083,0},{1088,578,4084,128,2016,1062,2020,1060,2020,1060,2028,30,4066,0},{1792,502,1196,608,4064,310,260,4084,3364,3364,2028,30,4066,0},{256,4086,20,1168,4080,1174,1172,1940,20,2780,2732,30,4066,0},{4082,2454,4084,400,3808,582,4084,580,4092,580,3116,2110,4066,0},{512,1778,3988,2192,1776,3862,1268,4020,1212,1196,228,30,4066,0},{0,3966,2408,1384,1406,1388,3436,2430,2404,2404,3878,290,314,0},{8,3864,2430,3364,1316,1534,3328,2304,2430,2370,3906,382,322,0},{8,4040,2430,3368,1534,1304,1292,2430,2375,2428,2372,3964,324,0},{0,4094,2064,2110,2098,4018,2230,182,162,190,4258,6334,3970,0},{0,4094,832,832,4080,2390,2384,3696,2068,4084,2070,4082,2064,0},{256,1342,3204,4094,1454,2222,2414,4018,3234,1534,802,4030,2146,0},{0,4030,2196,4030,2214,4006,678,4082,610,4030,546,574,8162,0},{1792,1022,1024,1092,588,584,64,4094,224,336,1612,3142,64,0},{0,2044,1092,2044,1092,1092,2044,64,64,4092,64,64,4094,0},{1020,120,4094,64,2044,1092,2044,1092,2044,4092,64,64,4094,0},{0,4094,3146,1918,1610,8190,2568,2568,638,520,616,574,896,0},{1020,1028,2044,2044,4094,0,2044,2044,1092,2044,2044,64,4094,0},{64,224,400,1548,4094,64,64,4094,64,584,840,320,4094,0},{516,772,830,771,798,4072,776,798,776,776,824,796,516,0},{260,260,318,3394,2398,2376,360,2366,1288,1544,824,476,100,0},{772,798,770,4034,2880,2910,2888,4094,2888,776,824,796,772,0},{4,3972,2238,2178,4030,2188,2188,4094,2252,2124,2124,2140,3620,0},{260,1796,286,4034,286,3848,968,2366,3336,1800,824,3804,3140,0},{516,964,4094,835,894,776,4040,830,776,1928,1208,2268,2116,0},{4,4036,2142,4035,2142,2124,4044,2398,3660,1612,1628,3548,2116,0},{1284,2308,4094,258,4062,2376,4040,2398,2376,4040,2396,2380,3396,0},{0,290,4078,771,654,4084,548,558,4068,548,548,252,8084,0},{4036,2118,2142,2115,4062,8,4040,286,264,4040,280,284,8164,0},{1156,1156,4094,1154,1182,8168,8,4062,2120,4040,2136,4044,2116,0},{772,4036,286,4035,2142,4044,4044,2142,4044,4076,1180,3292,2148,0},{260,4036,1182,4066,30,4044,2124,4062,4044,652,668,4812,3172,0},{8,1544,776,456,104,8,4094,200,136,264,776,3192,2072,0},{0,4030,2210,4030,4002,2110,2546,2322,2322,2546,2322,2546,3586,0},{4,4068,2056,2050,2050,2050,2050,2050,2050,2050,2050,2050,3842,0},{0,4068,2056,2114,2114,2114,2146,2210,2322,2842,2050,2050,3586,0},{0,4068,2056,2178,2178,3066,2242,2274,2226,2202,2186,2274,3586,0},{0,4068,2056,2050,2546,2322,2322,2322,2546,2066,2050,2050,3586,0},{0,4068,2056,2114,2114,3066,2274,2530,2898,2634,2114,2114,3586,0},{0,4084,2056,2050,2546,2322,2322,2546,2322,2322,2546,2050,3586,0},{4,4068,2056,2114,3066,2114,2546,2634,2634,2890,2378,2114,3586,0},{4,4068,2056,2826,2554,2178,3050,2178,3042,2610,3050,2090,3586,0},{96,1020,516,1020,4,2044,1028,1028,2044,64,4094,64,64,0},{286,274,4090,138,138,138,3994,3282,3154,3162,1122,1074,1810,0},{0,4062,2130,2122,2122,2122,4050,2130,2130,2142,2114,4034,2114,0},{0,4062,2130,2138,4042,2138,2130,4050,2130,2138,2114,2082,3618,0},{256,414,4090,138,714,586,4050,530,530,8174,514,514,514,0},{0,4062,3154,3146,4042,3146,3154,3154,4050,3162,3138,8178,2,0},{0,8190,1034,1034,1514,1322,1338,1330,1522,1070,1026,1026,1794,0},{0,1118,1098,8170,1146,1146,1354,1370,1882,1102,1090,1090,1602,0},{0,4062,18,10,4074,282,274,1362,3410,2426,2338,2338,386,0},{286,282,4042,266,270,266,8170,274,2354,2414,2402,4066,2050,0},{0,4094,282,266,4042,2122,2130,4050,2130,2126,2114,4034,2114,0},{0,4062,3154,4042,3146,3146,4050,338,3410,1626,1602,3522,2146,0},{286,282,4074,266,266,4074,346,3922,346,366,482,418,7954,0},{286,282,4074,2090,4042,10,26,4082,666,718,578,4706,3634,0},{256,926,650,3178,4078,266,266,4082,282,1358,2338,2338,386,0},{256,414,650,3178,8186,10,2330,2386,1362,1358,514,4066,2,0},{256,286,4090,1098,1098,4074,10,18,4082,3182,3170,4066,2114,0},{128,158,1994,1098,1578,138,3706,2098,2106,4078,2082,4066,2082,0},{128,2014,1258,938,906,3306,2010,338,4082,302,4034,258,4066,0},{512,270,4090,426,3974,2554,3882,2346,3882,2350,3362,242,3986,0},{128,2014,618,4074,2058,4042,2058,4082,18,398,2658,3154,962,0},{4064,30,4042,2122,4042,10,4074,3258,2746,4014,2338,2338,3362,0},{3584,510,1354,4074,4074,10,4074,4050,2074,1998,2402,3170,898,0},{640,640,734,4048,626,4092,588,584,4060,596,578,4032,64,0},{0,4094,64,64,4094,2114,2394,2642,2114,2394,2642,2114,3650,0},{2044,64,4094,2114,2906,64,1884,2044,1024,2044,1024,2044,1024,0},{0,2044,4094,2114,2114,1820,224,952,3142,2044,784,224,384,0},{2044,4094,2114,2906,856,16,2044,498,4094,96,2044,1072,782,0},{0,2044,4094,2114,2906,1884,0,4094,64,4092,3492,3492,1572,0},{2044,64,4094,2906,64,64,4030,4002,62,4030,1922,1854,2242,0},{2044,64,4094,2906,64,856,1982,1250,828,3578,1930,1210,1950,0},{2044,64,4094,2906,1884,16,4046,4058,2398,4060,4090,822,4056,0},{264,1982,1160,638,3976,2366,8190,2338,2366,4002,318,290,434,0},{416,432,4030,432,432,4030,432,432,432,8126,432,432,432,0},{72,2044,4094,0,2044,1028,2044,4030,160,4030,160,4030,160,0},{0,4094,64,96,4094,2322,2546,2322,2322,2546,2322,4094,2050,0},{564,4094,564,572,520,4094,554,554,4030,574,574,8136,8,0},{146,190,4050,2142,2408,2942,2346,4094,2440,3007,2376,2312,3848,0},{64,4094,520,792,272,4094,0,2044,1036,2044,1036,2044,1024,0},{0,8160,286,4036,2116,4036,2116,4036,2140,4034,1152,3168,2096,0},{0,8190,264,4040,2120,2888,2888,2888,2888,264,1928,2246,0,0},{0,4094,260,4068,3108,3364,3364,3364,3388,295,1664,3168,2096,0},{0,4066,810,4010,2218,2730,2730,2730,2730,2858,1834,2211,2112,0},{0,4072,262,4066,3192,3436,3430,3426,3440,264,1676,3270,2080,0},{0,4094,514,4026,2218,2730,2730,2730,2746,2698,1834,3482,2240,0},{8,4040,574,3976,2218,2730,2730,2750,2952,264,1336,2268,2112,0},{0,8158,528,4046,2248,2815,2792,2776,2760,2312,1288,3276,2118,0},{8,3976,540,4006,2186,2688,2750,2736,2704,2972,1804,2456,2128,0},{8,3976,570,3978,2303,2696,2696,2730,2730,2704,1816,3468,2242,0},{0,4030,554,4030,2218,2750,2696,2814,2716,2748,1834,3464,200,0},{0,4094,830,4002,2750,2688,2750,2696,3002,1294,2254,26,4066,0},{8,4094,548,3988,2238,2722,2714,2726,2714,2734,1330,3486,2244,0},{8,4094,610,3980,2236,2710,2716,2726,2750,2980,1316,3516,6368,0},{8,4094,520,4030,2210,2750,2750,2722,2750,2815,1300,3494,2242,0},{8,4094,574,4002,2238,2730,2750,2750,2750,2722,1852,3488,222,0},{0,2044,1028,1284,1172,1188,1252,1220,1252,1460,5406,7170,2050,0},{0,4094,3262,3766,4022,3006,2750,2688,2942,3912,3562,6378,2124,0},{0,510,2432,1280,768,768,1792,3328,256,256,4864,2560,3072,0},{64,224,432,1612,8190,520,1016,520,2040,1608,904,1656,1052,0},{4024,1036,1980,1814,3308,954,4094,522,1016,1016,1736,1912,1048,0},{3076,1988,94,82,4050,3269,1508,1380,1828,804,1852,3252,2128,0},{132,196,4062,370,274,4036,2372,2372,2372,2372,3420,268,260,0},{900,3812,2654,594,4090,581,2628,1988,1652,1604,5716,3532,3172,0},{260,772,4094,2098,2010,1094,1988,68,4036,2132,2140,4036,2112,0},{520,784,4094,64,2044,1028,1028,2044,1028,2044,1028,2044,1028,0},{0,1020,512,520,520,520,4092,2048,2048,2558,3072,1024,1920,0},{798,528,4048,2130,2130,2130,4058,2174,80,94,82,80,124,0},{256,798,784,4050,2898,2898,4050,382,464,414,914,1744,2156,0},{8,4030,2220,4022,2,1020,512,520,4088,2048,3070,3072,1536,0},{512,4062,784,1938,2258,8146,2074,3006,2640,2654,3026,2064,1548,0},{64,4094,0,1016,520,1016,0,4094,2546,2322,2322,2546,1538,0},{132,1212,1046,4050,574,554,4030,554,554,8190,512,574,512,0},{64,192,4094,514,546,4094,1586,1906,3962,2730,4774,547,544,0},{272,4092,272,4094,64,2044,1092,2044,1092,2044,272,1564,2054,0},{304,3982,2814,2908,2364,2538,1770,792,3662,858,496,1612,96,0},{0,2044,1364,1364,2044,64,2044,64,64,4094,0,3252,2482,0},{574,1578,2622,574,4094,520,574,776,1336,1286,3250,2258,64,0},{1054,1194,1086,3966,3582,2760,2718,2760,2680,3014,2926,2318,3328,0},{64,1016,1016,1016,520,1016,2046,2046,2046,0,4094,264,262,0},{64,4094,792,432,224,1016,3598,792,792,776,776,780,772,0},{288,816,48,4094,144,1168,1168,656,920,392,204,2294,3970,0},{0,8,12,12,8,8,8,8,0,0,12,8,0,0},{2048,3072,1024,1536,512,512,512,512,512,1024,1024,2048,0,0},{2,6,4,12,8,8,8,8,8,4,4,2,0,0},{0,0,0,0,0,0,0,0,0,12,12,8,4,0},{0,0,0,12,12,0,0,0,0,0,12,12,0,0},{0,0,0,12,12,0,0,0,0,12,8,8,8,4},{0,28,50,32,48,16,8,8,0,0,12,8,0,0}}; diff --git a/cpymo-backends/nds/source/fvds-adpcm-nds.c b/cpymo-backends/nds/source/fvds-adpcm-nds.c new file mode 100644 index 00000000..61e45dc5 --- /dev/null +++ b/cpymo-backends/nds/source/fvds-adpcm-nds.c @@ -0,0 +1,55 @@ +/* Independent IMA-style quantized delta reconstruction for FVDS. + * Each channel block has a little-endian signed predictor and a 16-bit + * index followed by 128 low-nibble-first packed bytes (256 PCM samples). + * Index transition -3,-3,-2,-1,+2,+4,+6,+8 is the FVDS bitstream rule. + */ +#include "fvds-adpcm-nds.h" + +static const uint16_t step_size[89]={ + 7,8,9,10,11,12,13,14,16,17,19,21,23,25,28,31,34,37,41,45, + 50,55,60,66,73,80,88,97,107,118,130,143,157,173,190,209, + 230,253,279,307,337,371,408,449,494,544,598,658,724,796, + 876,963,1060,1166,1282,1411,1552,1707,1878,2066,2272,2499, + 2749,3024,3327,3660,4026,4428,4871,5358,5894,6484,7132,7845, + 8630,9493,10442,11487,12635,13899,15289,16818,18500,20350, + 22385,24623,27086,29794,32767 +}; +static const int8_t index_jump[8]={-3,-3,-2,-1,2,4,6,8}; + +static int16_t clamp_pcm(int value){ + if(value>32767)value=32767; + if(value< -32767)value=-32767; + return (int16_t)value; +} +/* Decode the channel into its interleaved output lane. + * The caller validates both indexes before writing either lane. */ +static void channel(const uint8_t *data,int16_t *dest,unsigned lane){ + int pred=(int16_t)((unsigned)data[0]|((unsigned)data[1]<<8)); + int index=(int)((unsigned)data[2]|((unsigned)data[3]<<8)); + unsigned written=0; + for(unsigned i=4;i>4):(byte&15u); + unsigned magnitude=nibble&7u; + int delta=((int)step_size[index]*(int)(2u*magnitude+1u))>>3; + pred=clamp_pcm((nibble&8u)?pred-delta:pred+delta); + dest[2*written+lane]=(int16_t)pred; + written++; + index+=index_jump[magnitude]; + if(index<0)index=0;else if(index>88)index=88; + } + } +} +int nds_fvds_adpcm_pair(const uint8_t *in,size_t bytes, + int16_t *out_interleaved,size_t out_samples){ + if(!in||!out_interleaved||bytes!=NDS_FVDS_ADPCM_PAIR_BYTES|| + out_samples=89||right_index>=89)return -2; + channel(in,out_interleaved,0); + channel(right,out_interleaved,1); + return NDS_FVDS_ADPCM_SAMPLES_PER_BLOCK; +} diff --git a/cpymo-backends/nds/source/fvds-adpcm-nds.h b/cpymo-backends/nds/source/fvds-adpcm-nds.h new file mode 100644 index 00000000..ce204889 --- /dev/null +++ b/cpymo-backends/nds/source/fvds-adpcm-nds.h @@ -0,0 +1,19 @@ +/* CPyMO 1.2 NDS/DSi: original, allocation-free FVDS ADPCM block decoder. + * ADPCM waveform reconstruction uses the documented IMA-style quantizer. + * This contains no transplanted FastVideoDSPlayer source or ARM assembly. + * Decoder ONLY: does not activate audio hardware, Maxmod, IPC or DMA. + */ +#ifndef CPYMO_NDS_FVDS_ADPCM_H +#define CPYMO_NDS_FVDS_ADPCM_H +#include +#include +enum { NDS_FVDS_ADPCM_BLOCK_BYTES=132, NDS_FVDS_ADPCM_PAIR_BYTES=264, + NDS_FVDS_ADPCM_SAMPLES_PER_BLOCK=256, + NDS_FVDS_ADPCM_INTERLEAVED_SAMPLES=512 }; +/* Decode one independently-reset L/R pair (264 bytes) into 256 signed + * stereo PCM frames (L0,R0,L1,R1,...). Pass at least 512 int16_t slots. + * Return 256 output frames or a negative error. No partial output on + * malformed headers (invalid step index). */ +int nds_fvds_adpcm_pair(const uint8_t *in, size_t bytes, + int16_t *out_interleaved, size_t out_samples); +#endif diff --git a/cpymo-backends/nds/source/fvds-av-clock-nds.h b/cpymo-backends/nds/source/fvds-av-clock-nds.h new file mode 100644 index 00000000..01231c6e --- /dev/null +++ b/cpymo-backends/nds/source/fvds-av-clock-nds.h @@ -0,0 +1,27 @@ +/* Exact FVDS audio/video clock conversion. + * Arithmetic only: does not schedule VBlank, ARM7 timers or actual playback. + */ +#ifndef CPYMO_NDS_FVDS_AV_CLOCK_H +#define CPYMO_NDS_FVDS_AV_CLOCK_H +#include +/* Return the intended number of stereo PCM frames already played at a video + * frame boundary. Floor division is intentional and deterministic; calculate + * each boundary independently to prevent accumulated integer drift. + * All inputs are already checked by nds_fvds_open(). + */ +static inline uint64_t nds_fvds_pcm_target(uint32_t frame_boundary, + uint32_t fps_n,uint32_t fps_d, + uint32_t sample_rate){ + if(!fps_n||!fps_d||!sample_rate)return 0; + return ((uint64_t)frame_boundary*fps_d*sample_rate)/fps_n; +} +/* How many PCM frames to consume in this frame interval? */ +static inline uint32_t nds_fvds_pcm_interval(uint32_t frame, + uint32_t fps_n,uint32_t fps_d, + uint32_t sample_rate){ + if(!fps_n||!fps_d||!sample_rate)return 0; + uint64_t start=nds_fvds_pcm_target(frame,fps_n,fps_d,sample_rate); + uint64_t stop=nds_fvds_pcm_target(frame+1,fps_n,fps_d,sample_rate); + return (uint32_t)(stop-start); +} +#endif diff --git a/cpymo-backends/nds/source/fvds-bits-nds.c b/cpymo-backends/nds/source/fvds-bits-nds.c new file mode 100644 index 00000000..29ef6cad --- /dev/null +++ b/cpymo-backends/nds/source/fvds-bits-nds.c @@ -0,0 +1,58 @@ +#include "fvds-bits-nds.h" +#include + +int nds_fvds_bits_init(nds_fvds_bits *b,nds_fvds_bit_pull pull, + void *context,uint32_t picture_bytes){ + if(!b)return 0; + memset(b,0,sizeof *b); + if(!pull || picture_bytes<2 || picture_bytes>131068u || + (picture_bytes&1u)){b->failed=1;return 0;} + b->pull=pull; + b->context=context; + b->total_bytes=picture_bytes; + return 1; +} +static int next_word(nds_fvds_bits *b){ + if(b->at==b->available){ + if(b->fetched_bytes>=b->total_bytes)return 0; + size_t count=b->total_bytes-b->fetched_bytes; + if(count>sizeof b->bytes)count=sizeof b->bytes; + /* All storage words are two bytes; chunks always end on word boundaries. */ + if(b->pull(b->context,b->bytes,count)!=count)return 0; + b->fetched_bytes+=(uint32_t)count; + b->available=count; + b->at=0; + } + if(b->available-b->at<2)return 0; + b->word=(uint16_t)((unsigned)b->bytes[b->at]| + ((unsigned)b->bytes[b->at+1]<<8)); + b->at+=2; + b->remaining_bits=16; + return 1; +} +int nds_fvds_bits_read(nds_fvds_bits *b,unsigned count,uint32_t *value){ + if(!b||!value||b->failed||!count||count>16)return 0; + uint32_t result=0; + unsigned needed=count; + while(needed){ + if(!b->remaining_bits&&!next_word(b)){ + b->failed=1; + return 0; + } + unsigned take=neededremaining_bits?needed:b->remaining_bits; + unsigned shift=b->remaining_bits-take; + unsigned mask=(1u<word>>shift)&mask); + b->remaining_bits-=take; + b->consumed_bits+=take; + needed-=take; + } + *value=result; + return 1; +} +int nds_fvds_bits_align16(nds_fvds_bits *b){ + if(!b||b->failed)return 0; + b->consumed_bits+=b->remaining_bits; + b->remaining_bits=0; + return 1; +} diff --git a/cpymo-backends/nds/source/fvds-bits-nds.h b/cpymo-backends/nds/source/fvds-bits-nds.h new file mode 100644 index 00000000..084249a7 --- /dev/null +++ b/cpymo-backends/nds/source/fvds-bits-nds.h @@ -0,0 +1,33 @@ +/* CPyMO for NDS 1.2 — original bounded FVDS elementary bit reader. + * FVDS video bit words are LITTLE-ENDIAN 16-bit, consumed MSB-first. + * It is NOT a VLC, inverse DCT, or movie picture renderer. + * Single-thread, caller-owned memory; never touches FAT, IRQ, VRAM or ARM7. + */ +#ifndef CPYMO_NDS_FVDS_BITS_H +#define CPYMO_NDS_FVDS_BITS_H +#include +#include + +typedef size_t (*nds_fvds_bit_pull)(void *context,void *dst,size_t maximum); + +typedef struct { + nds_fvds_bit_pull pull; + void *context; + uint8_t bytes[512]; + uint32_t total_bytes, fetched_bytes, consumed_bits; + size_t available, at; + uint16_t word; + unsigned remaining_bits, failed; +} nds_fvds_bits; + +/* Size must be even and bounded to a single FVDS picture payload. + * Reader can only consume its own video bytes, never the following audio. */ +int nds_fvds_bits_init(nds_fvds_bits *b,nds_fvds_bit_pull pull, + void *context,uint32_t picture_bytes); +/* Return 1 on complete success, 0 on invalid request or short input. + * Reads 1..16 bits into *value. The caller must stop after failure. */ +int nds_fvds_bits_read(nds_fvds_bits *b,unsigned count,uint32_t *value); +/* Align past remaining low bits of the current 16-bit storage word; + * no read-ahead and no scanning for magic values. */ +int nds_fvds_bits_align16(nds_fvds_bits *b); +#endif diff --git a/cpymo-backends/nds/source/fvds-pcm-queue-nds.c b/cpymo-backends/nds/source/fvds-pcm-queue-nds.c new file mode 100644 index 00000000..5c59c617 --- /dev/null +++ b/cpymo-backends/nds/source/fvds-pcm-queue-nds.c @@ -0,0 +1,57 @@ +#include "fvds-pcm-queue-nds.h" +#include +#include + +int nds_fvds_pcm_queue_init(nds_fvds_pcm_queue *q,int16_t *memory, + size_t capacity){ + if(!q||!memory||capacity<256||capacity>16384 || + capacity>(SIZE_MAX/sizeof(int16_t))/2)return 0; + memset(q,0,sizeof(*q)); + q->samples=memory; + q->capacity=capacity; + return 1; +} +void nds_fvds_pcm_queue_reset(nds_fvds_pcm_queue *q){ + if(!q)return; + q->read_at=q->write_at=q->queued=q->high_watermark=0; + q->produced=q->consumed=q->underflows=q->overflows=0; +} +int nds_fvds_pcm_queue_push(nds_fvds_pcm_queue *q, + const int16_t *interleaved,size_t frames){ + if(!q||!q->samples||(!interleaved&&frames))return 0; + if(frames>q->capacity-q->queued){ + q->overflows++; + return 0; + } + if(!frames)return 1; + size_t first=framescapacity-q->write_at?frames:q->capacity-q->write_at; + memcpy(q->samples+2*q->write_at,interleaved,first*2*sizeof(int16_t)); + if(frames>first) + memcpy(q->samples,interleaved+2*first,(frames-first)*2*sizeof(int16_t)); + q->write_at=(q->write_at+frames)%q->capacity; + q->queued+=frames; + q->produced+=frames; + if(q->queued>q->high_watermark)q->high_watermark=q->queued; + return 1; +} +size_t nds_fvds_pcm_queue_drain(nds_fvds_pcm_queue *q, + int16_t *dst,size_t frames){ + if(!q||!q->samples||(!dst&&frames))return 0; + if(!frames)return 0; + /* Large drains can be supported, but avoid size_t*4 overflow before + calling memset on an uncontrolled output length. */ + if(frames>SIZE_MAX/(2*sizeof(int16_t)))return 0; + size_t ready=framesqueued?frames:q->queued; + size_t first=readycapacity-q->read_at?ready:q->capacity-q->read_at; + if(first)memcpy(dst,q->samples+2*q->read_at,first*2*sizeof(int16_t)); + if(ready>first) + memcpy(dst+2*first,q->samples,(ready-first)*2*sizeof(int16_t)); + if(readyunderflows+=frames-ready; + } + q->read_at=(q->read_at+ready)%q->capacity; + q->queued-=ready; + q->consumed+=ready; + return ready; +} diff --git a/cpymo-backends/nds/source/fvds-pcm-queue-nds.h b/cpymo-backends/nds/source/fvds-pcm-queue-nds.h new file mode 100644 index 00000000..e1e08eaa --- /dev/null +++ b/cpymo-backends/nds/source/fvds-pcm-queue-nds.h @@ -0,0 +1,32 @@ +/* Original FVDS stereo PCM staging queue, AGPL-3.0-or-later. + * Single-thread cooperative queue (caller-owned memory). This is NOT an + * ARM7 shared-memory or hardware sound driver. Synchronization and cache + * management are the responsibility of a future audio transport. + */ +#ifndef CPYMO_NDS_FVDS_PCM_QUEUE_H +#define CPYMO_NDS_FVDS_PCM_QUEUE_H +#include +#include + +/* A signed stereo PCM frame contains 2 x int16_t = 4 bytes. */ +typedef struct { + int16_t *samples; + size_t capacity; /* stereo FRAME count, not sample count */ + size_t read_at, write_at, queued, high_watermark; + uint64_t produced, consumed, underflows, overflows; +} nds_fvds_pcm_queue; + +/* Caller MUST supply at least 2*capacity int16_t slots. */ +int nds_fvds_pcm_queue_init(nds_fvds_pcm_queue *q,int16_t *memory, + size_t capacity); +/* All-or-nothing push. Return zero if the queue is too full; no partial + * sample write, no mutation of read or write indices on failure. */ +int nds_fvds_pcm_queue_push(nds_fvds_pcm_queue *q, + const int16_t *interleaved,size_t frames); +/* Consume exactly frames stereo frames into dst; copy any available samples + * and fill the shortfall with silence. Returns number of REAL frames. + * For diagnostic purposes underflows counts requested missing frames. */ +size_t nds_fvds_pcm_queue_drain(nds_fvds_pcm_queue *q, + int16_t *dst,size_t frames); +void nds_fvds_pcm_queue_reset(nds_fvds_pcm_queue *q); +#endif diff --git a/cpymo-backends/nds/source/fvds-picture-prefix-nds.h b/cpymo-backends/nds/source/fvds-picture-prefix-nds.h new file mode 100644 index 00000000..2ff3caa1 --- /dev/null +++ b/cpymo-backends/nds/source/fvds-picture-prefix-nds.h @@ -0,0 +1,29 @@ +/* FastVideoDS FVDS picture-prefix metadata, independently parsed. + * This does NOT decode 4x4 DCT, motion vectors or RGB555 pixels. + * The first little-endian 16-bit word carries the I/P high-bit flag. + */ +#ifndef CPYMO_NDS_FVDS_PICTURE_PREFIX_H +#define CPYMO_NDS_FVDS_PICTURE_PREFIX_H +#include +#include +/* -1: too short; -2: indexed keyframe starts with P picture + * 0: I-picture; 1: P-picture. */ +static inline int nds_fvds_picture_type(const uint8_t *bytes,size_t length, + int indexed_keyframe){ + if(!bytes||length<2)return -1; + unsigned prefix=(unsigned)bytes[0]|((unsigned)bytes[1]<<8); + int predicted=(prefix&0x8000u)?1:0; + if(indexed_keyframe&&predicted)return -2; + return predicted; +} +/* For an I-picture, the first bit is 0 and the next six bits contain + * a quantizer scale: MSB-first within a LITTLE-ENDIAN 16-bit word. + * P-pictures have another header layout and no I quantizer at this spot. + * Returns -1 for incomplete/P pictures, 0..63 for an I quantizer. */ +static inline int nds_fvds_intra_quantizer(const uint8_t *bytes,size_t length){ + if(!bytes||length<2)return -1; + unsigned header=(unsigned)bytes[0]|((unsigned)bytes[1]<<8); + if(header&0x8000u)return -1; + return (int)((header>>9)&0x3fu); +} +#endif diff --git a/cpymo-backends/nds/source/fvds-picture-source-nds.h b/cpymo-backends/nds/source/fvds-picture-source-nds.h new file mode 100644 index 00000000..98132b92 --- /dev/null +++ b/cpymo-backends/nds/source/fvds-picture-source-nds.h @@ -0,0 +1,36 @@ +/* Original FVDS elementary-picture adapter for the existing packet reader. + * No frame cache or video decoder. Two readers MUST NOT consume one packet + * concurrently: either stage callbacks OR this single elementary bit stream. + */ +#ifndef CPYMO_NDS_FVDS_PICTURE_SOURCE_H +#define CPYMO_NDS_FVDS_PICTURE_SOURCE_H +#include "fvds-stream-nds.h" +#include "fvds-bits-nds.h" + +static inline size_t nds_fvds_picture_pull(void *ctx,void *data,size_t bytes){ + return nds_fvds_read_video((nds_fvds_stream*)ctx,data,bytes); +} +/* Must be called after nds_fvds_next() and before reading this packet's + * first video byte; only the packet's VIDEO boundary is exposed. */ +static inline int nds_fvds_picture_begin(nds_fvds_stream *movie, + nds_fvds_bits *bits){ + if(!movie||!bits||!movie->packet_open || + !movie->video_remaining)return 0; + return nds_fvds_bits_init(bits,nds_fvds_picture_pull,movie, + movie->video_remaining); +} +/* Once a picture decoder has consumed its payload, discard only the + * remaining in-video padding/unused bytes so the audio blocks can follow. + * Never read beyond packet.video_remaining into ADPCM. */ +static inline int nds_fvds_picture_to_audio(nds_fvds_stream *movie, + nds_fvds_bits *bits){ + if(!movie||!bits||!movie->packet_open||bits->failed)return 0; + while(movie->video_remaining){ + size_t count=movie->video_remaining; + if(count>sizeof(bits->bytes))count=sizeof(bits->bytes); + if(nds_fvds_read_video(movie,bits->bytes,count)!=count)return 0; + } + bits->at=bits->available=bits->remaining_bits=0; + return 1; +} +#endif diff --git a/cpymo-backends/nds/source/fvds-preflight-nds.h b/cpymo-backends/nds/source/fvds-preflight-nds.h new file mode 100644 index 00000000..b03b41df --- /dev/null +++ b/cpymo-backends/nds/source/fvds-preflight-nds.h @@ -0,0 +1,176 @@ +/* CPyMO 1.2 research-only FVDS on-device I/O preflight. + * Independent container parser; intentionally NO video/audio decode, + * VRAM setup, ARM7 changes, sound stream takeover or new gameplay commands. + * Enabled only by an explicit nds-fvds-probe.flag inside the selected game. + * A per-game text report enables physical NTR/TWL regression without debugger. + */ +#ifndef CPYMO_NDS_FVDS_PREFLIGHT_H +#define CPYMO_NDS_FVDS_PREFLIGHT_H + +/* [0] magic, [1] runs, [2] pass, [3] fail, [4] frames scanned, + * [5] video bytes, [6] audio bytes, [7] last code, [8] TWL, [9] I/O us */ +/* [10] FNV1a payload checksum, [11] verified payload byte count */ +volatile unsigned fvds_preflight_state[12]={0x46565031}; + +static unsigned fvds_le16(const unsigned char *p){ + return (unsigned)p[0] | ((unsigned)p[1]<<8); +} +static unsigned fvds_le32(const unsigned char *p){ + return fvds_le16(p) | (fvds_le16(p+2)<<16); +} +static bool fvds_read_exact(FILE *f,unsigned char *buf,unsigned n){ + return fread(buf,1,n,f)==n; +} +static bool fvds_skip_to(FILE *f,unsigned offset){ + return offset<=0x7fffffffu && fseek(f,(long)offset,SEEK_SET)==0; +} + +/* Return true only when the explicit probe flag AND a .fv are present. + * In all other cases the original .nvl playback path remains untouched. */ +static bool nds_fvds_preflight(cpymo_engine *engine,cpymo_str name){ + FILE *opt=savefile(engine->assetloader.gamedir,"nds-fvds-probe.flag","rb"); + if(!opt)return false; + fclose(opt); + char path[512]; + nds_cache_path(path,sizeof path,engine->assetloader.gamedir,"video",name,".fv"); + FILE *f=fopen(path,"rb"); + if(!f)return false; + + fvds_preflight_state[1]++; + fvds_preflight_state[8]=isDSiMode()?1:0; + fvds_preflight_state[4]=fvds_preflight_state[5]=fvds_preflight_state[6]=0; + unsigned result=1,frames=0,video_total=0,audio_total=0,keyframes=0; + unsigned payload_digest=2166136261u,payload_read=0; + /* Allocate this only for explicit I/O tests: ordinary NTR game memory + * is not penalized with permanent, always-resident probe buffers. */ + unsigned char *io_buffer=malloc(4096); + if(!io_buffer)result=17; + const u64 started=tickGetCount(); + unsigned char header[28],key[8],packet[4]; + unsigned size=0,frame_count=0,data_start=0; + unsigned next_key_frame=0,next_key_offset=0,next_key_idx=0,last_key_frame=0,last_key_offset=0; + if(!io_buffer)goto close; + const bool size_ok=fseek(f,0,SEEK_END)==0; + long end=size_ok?ftell(f):-1; + if(end<28 || end>192*1024*1024 || fseek(f,0,SEEK_SET)!=0){result=2;goto close;} + size=(unsigned)end; + if(!fvds_read_exact(f,header,sizeof header) || memcmp(header,"FVDS",4)){ + result=3;goto close; + } + const unsigned w=fvds_le16(header+4),h=fvds_le16(header+6); + const unsigned fps_num=fvds_le32(header+8),fps_den=fvds_le32(header+12); + const unsigned audio_rate=fvds_le16(header+16),channels=fvds_le16(header+18); + frame_count=fvds_le32(header+20);keyframes=fvds_le32(header+24); + if(w!=256||h!=192||!fps_num||fps_num>1000||!fps_den||fps_den>1000|| + audio_rate!=47605||channels!=2||!frame_count||frame_count>18000|| + !keyframes||keyframes>512||keyframes>frame_count){ + result=4;goto close; + } + data_start=28+keyframes*8; + if(data_start>=size || (unsigned long long)data_start+(unsigned long long)frame_count*4>size){ + result=5;goto close; + } + /* Validate keyframe entries without allocation. A second file pointer is + * unnecessary because frame packets start at the end of the key index. */ + for(unsigned i=0;i0&&(ki<=last_key_frame||ko<=last_key_offset)) || + ki>=frame_count || ko>=size){ + result=7;goto close; + } + last_key_frame=ki;last_key_offset=ko; + } + /* Walk contiguous packets and compare each scheduled keyframe offset + * to the exact boundary. The file cursor never leaves the game device. */ + if(!fvds_skip_to(f,28)){result=8;goto close;} + if(!fvds_read_exact(f,key,sizeof key)){result=6;goto close;} + next_key_frame=fvds_le32(key); + next_key_offset=fvds_le32(key+4); + next_key_idx=0; + if(!fvds_skip_to(f,data_start)){result=8;goto close;} + for(unsigned frame=0;frame=size){result=9;goto close;} + if(frame==next_key_frame){ + if((unsigned)at!=next_key_offset){result=10;goto close;} + next_key_idx++; + if(next_key_idx>17; + if(!video_bytes || (video_bytes&3u) || !audio_blocks || audio_blocks>255){ + result=13;goto close; + } + const unsigned audio_bytes=audio_blocks*2*132; + long payload=ftell(f); + if(payload<0 || (unsigned)payload>size || + (unsigned long long)payload+video_bytes+audio_bytes>size){ + result=14;goto close; + } + /* Unlike index-only scans, read the full video and ADPCM payload + * through libfat. This proves sequential media transfer, not merely + * successful fseek into FAT data clusters. No codec is invoked. */ + unsigned remaining=video_bytes+audio_bytes; + while(remaining){ + unsigned n=remaining>4096?4096:remaining; + if(!fvds_read_exact(f,io_buffer,n)){result=15;goto close;} + for(unsigned i=0;i='A'&&c<='Z')||(c>='a'&&c<='z')|| + (c>='0'&&c<='9')||c=='_'||c=='-'?(char)c:'_'; + } + if(!j)safe_name[0]='_',safe_name[1]=0; + snprintf(report_name,sizeof report_name,"nds-fvds-probe-%s.txt",safe_name); + FILE *log=savefile(engine->assetloader.gamedir,report_name,"wb"); + if(log){ + fprintf(log,"CPyMO 1.2 FVDS preflight (NO playback)\n"); + fprintf(log,"mode=%s\n",isDSiMode()?"DSi-TWL":"DS-NTR"); + fprintf(log,"result=%s code=%u\n",result?"FAILED":"OK",result); + fprintf(log,"frames=%u/%u keys=%u video_bytes=%u audio_bytes=%u\n", + frames,frame_count,keyframes,video_total,audio_total); + fprintf(log,"file_bytes=%u io_microseconds=%u\n",size,fvds_preflight_state[9]); + fprintf(log,"payload_read_bytes=%u payload_fnv1a32=%08X\n", + payload_read,payload_digest); + fprintf(log,"source=%s\n",path); + fclose(log); + } + nds_audio_update(); + loaded_image=true; + cpymo_engine_request_redraw(engine); + return true; +} +#endif diff --git a/cpymo-backends/nds/source/fvds-stage-nds.c b/cpymo-backends/nds/source/fvds-stage-nds.c new file mode 100644 index 00000000..452b34e4 --- /dev/null +++ b/cpymo-backends/nds/source/fvds-stage-nds.c @@ -0,0 +1,71 @@ +#include "fvds-stage-nds.h" +#include "fvds-picture-prefix-nds.h" + +/* Normalize callback codes while leaving our published stage result stable. */ +static int cb_result(int value){ + return value>0?NDS_FVDS_STEP_SKIPPED: + value<0?NDS_FVDS_STEP_ERROR:NDS_FVDS_STEP_FRAME; +} +static int poll_result(const nds_fvds_stage_callbacks *c, void *ctx){ + return c->poll?cb_result(c->poll(ctx)):NDS_FVDS_STEP_FRAME; +} +int nds_fvds_stage_step(nds_fvds_stream *file,nds_fvds_stage *stage, + const nds_fvds_stage_callbacks *callbacks,void *ctx){ + if(!file || !file->file || !stage || !callbacks || + !callbacks->video_begin || !callbacks->video_chunk || + !callbacks->video_end || !callbacks->audio_pcm)return NDS_FVDS_STEP_ERROR; + nds_fvds_packet packet; + int next=nds_fvds_next(file,&packet); + if(next==1)return NDS_FVDS_STEP_EOF; + if(next!=0)return NDS_FVDS_STEP_ERROR; + int status=poll_result(callbacks,ctx); + if(status)goto close_packet; + /* 64-bit integer PTS, avoiding drift in 12 fps / 47605 Hz streams. */ + uint64_t pts=((uint64_t)packet.frame * 1000000u * file->fps_den) / + file->fps_num; + status=cb_result(callbacks->video_begin(ctx,packet.frame,pts)); + if(status)goto close_packet; + unsigned picture_prefix_seen=0, picture_predicted=0; + for(uint32_t remain=packet.video_bytes;remain;){ + status=poll_result(callbacks,ctx); + if(status)goto close_packet; + size_t amount=remainvideo)?remain:sizeof(stage->video); + size_t got=nds_fvds_read_video(file,stage->video,amount); + if(got!=amount){status=NDS_FVDS_STEP_ERROR;goto close_packet;} + remain-=(uint32_t)got; + if(!picture_prefix_seen){ + int picture=nds_fvds_picture_type(stage->video,got, + file->current_is_keyframe); + if(picture<0){status=NDS_FVDS_STEP_ERROR;goto close_packet;} + picture_predicted=(unsigned)picture; + picture_prefix_seen=1; + } + status=cb_result(callbacks->video_chunk(ctx,stage->video,got)); + if(status)goto close_packet; + } + status=cb_result(callbacks->video_end(ctx,packet.frame)); + if(status)goto close_packet; + for(uint32_t i=0;iaudio,sizeof(stage->audio))!= + sizeof(stage->audio) || + nds_fvds_adpcm_pair(stage->audio,sizeof(stage->audio), + stage->pcm,512)!=256){ + status=NDS_FVDS_STEP_ERROR;goto close_packet; + } + status=cb_result(callbacks->audio_pcm(ctx,stage->pcm,256)); + if(status)goto close_packet; + stage->audio_frames+=256; + } + if(nds_fvds_finish(file))return NDS_FVDS_STEP_ERROR; + stage->completed_frames++; + if(file->current_is_keyframe)stage->key_pictures++; + if(picture_predicted)stage->predicted_pictures++; + return NDS_FVDS_STEP_FRAME; +close_packet: + /* On cancellation the owner will normally close the movie immediately. + * Still restore parser to a valid packet boundary for orderly teardown. */ + if(nds_fvds_finish(file))return NDS_FVDS_STEP_ERROR; + return status; +} diff --git a/cpymo-backends/nds/source/fvds-stage-nds.h b/cpymo-backends/nds/source/fvds-stage-nds.h new file mode 100644 index 00000000..00e6008a --- /dev/null +++ b/cpymo-backends/nds/source/fvds-stage-nds.h @@ -0,0 +1,46 @@ +/* CPyMO NDS 1.2: original bounded FVDS frame/audio scheduling adapter. + * Consumes validated FVDS packets and emits COMPRESSED VIDEO chunks plus + * DECODED stereo PCM. A future video decoder / ARM7 producer owns callbacks. + * No VRAM, DMA, ARM7, IRQ, audio hardware, FAT mounts or heap allocation. + */ +#ifndef CPYMO_NDS_FVDS_STAGE_H +#define CPYMO_NDS_FVDS_STAGE_H +#include "fvds-stream-nds.h" +#include "fvds-adpcm-nds.h" + +enum nds_fvds_step_result { + NDS_FVDS_STEP_ERROR = -1, + NDS_FVDS_STEP_FRAME = 0, + NDS_FVDS_STEP_EOF = 1, + NDS_FVDS_STEP_SKIPPED = 2 +}; + +/* Each callback returns 0=continue, +1=user skip, negative=error. + * Chunks are ephemeral: callback MUST consume synchronously; it must NOT + * retain pointers into stage. video_begin/video_chunk/video_end are required: + * passing bytes alone is not video decoding. */ +typedef struct { + int (*poll)(void *ctx); + int (*video_begin)(void *ctx, uint32_t frame, uint64_t pts_us); + int (*video_chunk)(void *ctx, const uint8_t *data, size_t bytes); + int (*video_end)(void *ctx, uint32_t frame); + int (*audio_pcm)(void *ctx, const int16_t *interleaved, size_t frames); +} nds_fvds_stage_callbacks; + +typedef struct { + /* Deliberately caller-owned: buffers survive synchronous callbacks, no + * per-frame allocation and only 512 + 264 + 1024 bytes of staging RAM. */ + uint8_t video[512], audio[264]; + int16_t pcm[512]; + uint32_t completed_frames; + uint64_t audio_frames; + uint32_t key_pictures, predicted_pictures; +} nds_fvds_stage; + +/* Call exactly once per video frame. On B skip/error the current FVDS packet + * is finished (seek to next packet) when possible, then return to caller. + * The caller remains responsible for stopping audio, restoring VRAM/BGM, + * closing FVDS and redrawing CPyMO. */ +int nds_fvds_stage_step(nds_fvds_stream *file, nds_fvds_stage *stage, + const nds_fvds_stage_callbacks *callbacks, void *ctx); +#endif diff --git a/cpymo-backends/nds/source/fvds-stream-nds.c b/cpymo-backends/nds/source/fvds-stream-nds.c new file mode 100644 index 00000000..242b690b --- /dev/null +++ b/cpymo-backends/nds/source/fvds-stream-nds.c @@ -0,0 +1,128 @@ +#include "fvds-stream-nds.h" +#include +#include + +static uint16_t u16le(const uint8_t *a){return (uint16_t)a[0]|(uint16_t)((uint16_t)a[1]<<8);} +static uint32_t u32le(const uint8_t *a){return (uint32_t)u16le(a)|((uint32_t)u16le(a+2)<<16);} +static int read_exact(FILE *f,uint8_t *buf,size_t count){return fread(buf,1,count,f)==count;} +static int goto_offset(FILE *f,uint32_t offset){return offset<=INT32_MAX && !fseek(f,(long)offset,SEEK_SET);} +static uint32_t cursor(FILE *f){long n=ftell(f);return n<0?UINT32_MAX:(uint32_t)n;} + +int nds_fvds_open(nds_fvds_stream *s,const char *filename){ + uint8_t header[28],key[8];uint32_t prior_frame=0,prior_pos=0; + if(!s||!filename)return -1; + memset(s,0,sizeof(*s)); + s->file=fopen(filename,"rb"); + if(!s->file)return -2; + if(fseek(s->file,0,SEEK_END))goto invalid; + long size=ftell(s->file); + if(size<36||size>192L*1024L*1024L||!goto_offset(s->file,0))goto invalid; + s->bytes=(uint32_t)size; + if(!read_exact(s->file,header,sizeof header)||memcmp(header,"FVDS",4))goto invalid; + s->width=u16le(header+4);s->height=u16le(header+6); + s->fps_num=u32le(header+8);s->fps_den=u32le(header+12); + s->sample_rate=u16le(header+16);s->channels=u16le(header+18); + s->frame_count=u32le(header+20);s->keyframe_count=u32le(header+24); + if(s->width!=256||s->height!=192||!s->fps_num||s->fps_num>1000|| + !s->fps_den||s->fps_den>1000||s->sample_rate!=47605||s->channels!=2|| + !s->frame_count||s->frame_count>18000||!s->keyframe_count|| + s->keyframe_count>512||s->keyframe_count>s->frame_count)goto invalid; + s->data_offset=28+s->keyframe_count*8; + if((uint64_t)s->data_offset+s->frame_count*4>(uint64_t)s->bytes)goto invalid; + for(uint32_t i=0;ikeyframe_count;i++){ + if(!read_exact(s->file,key,8))goto invalid; + uint32_t frame=u32le(key),pos=u32le(key+4); + if((i==0&&(frame||pos!=s->data_offset))|| + (i>0&&(frame<=prior_frame||pos<=prior_pos))|| + frame>=s->frame_count||pos>=s->bytes)goto invalid; + prior_frame=frame;prior_pos=pos; + } + if(!goto_offset(s->file,s->data_offset))goto invalid; + s->next_key_index=0; + s->next_key_frame=0; + s->next_key_offset=s->data_offset; + return 0; +invalid: + nds_fvds_close(s); + return -3; +} +void nds_fvds_close(nds_fvds_stream *s){ + if(!s)return; + if(s->file)fclose(s->file); + memset(s,0,sizeof(*s)); +} +int nds_fvds_next(nds_fvds_stream *s,nds_fvds_packet *pkt){ + uint8_t word[4]; + if(!s||!s->file||!pkt||s->packet_open)return -1; + if(s->frame_index==s->frame_count) + return cursor(s->file)==s->bytes?1:-5; + uint32_t pos=cursor(s->file); + s->current_is_keyframe=(s->frame_index==s->next_key_frame); + if(s->current_is_keyframe){ + /* The header index must point to actual packet boundaries, not merely + monotonically increasing offsets. Otherwise a bad seek could interpret + compressed payload bytes as packet lengths and overrun buffers. */ + if(pos!=s->next_key_offset)return -6; + if(s->next_key_index+1keyframe_count){ + uint8_t key[8]; + if(!goto_offset(s->file,28+(s->next_key_index+1)*8) || + !read_exact(s->file,key,8) || + !goto_offset(s->file,pos))return -7; + s->next_key_index++; + s->next_key_frame=u32le(key); + s->next_key_offset=u32le(key+4); + }else{ + s->next_key_index=s->keyframe_count; + s->next_key_frame=s->frame_count; + s->next_key_offset=s->bytes; + } + } + if(pos==UINT32_MAX||pos>s->bytes||s->bytes-pos<4|| + !read_exact(s->file,word,4))return -2; + uint32_t value=u32le(word); + uint32_t video=value&0x1ffffu,blocks=value>>17; + if(!video||(video&3)||!blocks||blocks>255)return -3; + uint32_t audio=blocks*(uint32_t)s->channels*132; + uint32_t data_pos=cursor(s->file); + if(data_pos==UINT32_MAX||(uint64_t)data_pos+video+audio>s->bytes)return -4; + pkt->frame=s->frame_index; + pkt->video_bytes=video;pkt->audio_bytes=audio;pkt->audio_blocks=blocks; + s->video_remaining=video;s->audio_remaining=audio; + s->packet_end=data_pos+video+audio; + s->packet_open=1; + s->frame_index++; + return 0; +} +size_t nds_fvds_read_video(nds_fvds_stream *s,void *buf,size_t capacity){ + if(!s||!s->file||!s->packet_open||!buf)return 0; + if(capacity>s->video_remaining)capacity=s->video_remaining; + size_t got=fread(buf,1,capacity,s->file); + s->video_remaining-=(uint32_t)got; + return got; +} +size_t nds_fvds_read_audio(nds_fvds_stream *s,void *buf,size_t capacity){ + if(!s||!s->file||!s->packet_open||!buf||s->video_remaining)return 0; + if(capacity>s->audio_remaining)capacity=s->audio_remaining; + size_t got=fread(buf,1,capacity,s->file); + s->audio_remaining-=(uint32_t)got; + return got; +} +int nds_fvds_finish(nds_fvds_stream *s){ + if(!s||!s->file||!s->packet_open)return -1; + /* Decoder may skip remaining payload on B, EOF or a corrupt frame. + A failed seek is always fatal and must not publish an old frame. */ + if(!goto_offset(s->file,s->packet_end))return -2; + s->video_remaining=0;s->audio_remaining=0;s->packet_open=0; + return 0; +} +int nds_fvds_seek_keyframe(nds_fvds_stream *s,uint32_t index){ + uint8_t key[8]; + if(!s||!s->file||index>=s->keyframe_count)return -1; + if(!goto_offset(s->file,28+index*8)||!read_exact(s->file,key,8))return -2; + uint32_t frame=u32le(key),pos=u32le(key+4); + if(frame>=s->frame_count||posdata_offset||pos>=s->bytes|| + !goto_offset(s->file,pos))return -3; + s->frame_index=frame;s->packet_open=0;s->video_remaining=0;s->audio_remaining=0; + s->next_key_index=index;s->next_key_frame=frame;s->next_key_offset=pos; + return 0; +} diff --git a/cpymo-backends/nds/source/fvds-stream-nds.h b/cpymo-backends/nds/source/fvds-stream-nds.h new file mode 100644 index 00000000..fb7dba5f --- /dev/null +++ b/cpymo-backends/nds/source/fvds-stream-nds.h @@ -0,0 +1,37 @@ +/* CPyMO NDS 1.2 experimental FVDS packet reader. AGPL-3.0-or-later. + * Original container I/O implementation; NO FVDS video or audio decoder. + * Does not take ownership of ARM7/FAT/VRAM/DMA/audio, or allocate memory. + */ +#ifndef CPYMO_NDS_FVDS_STREAM_H +#define CPYMO_NDS_FVDS_STREAM_H +#include +#include +#include + +typedef struct { + FILE *file; + uint32_t bytes, frame_count, frame_index, keyframe_count; + uint32_t data_offset, fps_num, fps_den; + uint16_t width, height, sample_rate, channels; + uint32_t video_remaining, audio_remaining, packet_end; + /* Check packet boundary against the index without caching all keyframes. + * These are the NEXT expected keyframe coordinates, updated by fseek + * only when a keyframe is crossed (usually hundreds of frames apart). */ + uint32_t next_key_index, next_key_frame, next_key_offset; + unsigned packet_open, current_is_keyframe; +} nds_fvds_stream; + +typedef struct { + uint32_t frame, video_bytes, audio_bytes, audio_blocks; +} nds_fvds_packet; + +/* 0=success, 1=EOF, negative values are invalid data or I/O errors. + * Stream owns only its FILE*; caller owns decoder, audio and display. */ +int nds_fvds_open(nds_fvds_stream *s,const char *filename); +void nds_fvds_close(nds_fvds_stream *s); +int nds_fvds_next(nds_fvds_stream *s,nds_fvds_packet *pkt); +size_t nds_fvds_read_video(nds_fvds_stream *s,void *buf,size_t capacity); +size_t nds_fvds_read_audio(nds_fvds_stream *s,void *buf,size_t capacity); +int nds_fvds_finish(nds_fvds_stream *s); +int nds_fvds_seek_keyframe(nds_fvds_stream *s,uint32_t key_index); +#endif diff --git a/cpymo-backends/nds/source/heap-audit.c b/cpymo-backends/nds/source/heap-audit.c new file mode 100644 index 00000000..5b3f90ff --- /dev/null +++ b/cpymo-backends/nds/source/heap-audit.c @@ -0,0 +1,15 @@ +#include +#include +extern volatile unsigned engine_state[46]; +void *__real_malloc(size_t); +void *__real_calloc(size_t,size_t); +void *__real_realloc(void*,size_t); +static void observe(void *p,size_t size){ + unsigned used=(unsigned)mallinfo().uordblks; + if(used>engine_state[8])engine_state[8]=used; + if(!p && size)++engine_state[9]; +} +extern void nds_scene_release(void); +void *__wrap_malloc(size_t size){void *p=__real_malloc(size);if(!p&&size){nds_scene_release();p=__real_malloc(size);}observe(p,size);return p;} +void *__wrap_calloc(size_t n,size_t size){void *p=__real_calloc(n,size);if(!p&&n&&size){nds_scene_release();p=__real_calloc(n,size);}observe(p,n && size);return p;} +void *__wrap_realloc(void *old,size_t size){void *p=__real_realloc(old,size);if(!p&&size){nds_scene_release();p=__real_realloc(old,size);}observe(p,size);return p;} diff --git a/cpymo-backends/nds/source/launcher.h b/cpymo-backends/nds/source/launcher.h new file mode 100644 index 00000000..fadb6476 --- /dev/null +++ b/cpymo-backends/nds/source/launcher.h @@ -0,0 +1,553 @@ +/* DS front end, AGPL-3.0-or-later. Included after the shared font renderer. */ +#include +#include +#include +#include +#include "app-icon.h" +typedef struct {char path[256],title[256],platform[8];unsigned status;u16 width,height;bool title_ok,meta_ok,icon_ok,list_title_ok;char intro[2][128];unsigned char title_bits[350],meta_bits[1050],list_title_bits[400];u16 icon[24*24];} LauncherGame; +static LauncherGame launcher_games[64]; +/* magic, visible, count, selected, launches, scan truncated, last init error */ +volatile unsigned launcher_state[7]={0x4c41554e}; +static unsigned launcher_count,launcher_selected; +/* Four visible rows; keep the selected game on-screen without page jumps. */ +static unsigned launcher_scroll_first; +static bool launcher_scroll_dragging; +static int launcher_scroll_drag_y; +static unsigned launcher_scroll_drag_first; +static void launcher_scroll_ensure_visible(void){ + if(launcher_count<=4){launcher_scroll_first=0;return;} + unsigned last_start=launcher_count-4; + if(launcher_scroll_first>last_start)launcher_scroll_first=last_start; + if(launcher_selected=launcher_scroll_first+4)launcher_scroll_first=launcher_selected-3; +} +static u16* launcher_sub; +static bool launcher_about,launcher_restored,launcher_language_menu,launcher_theme_menu; +static unsigned launcher_theme_cursor; +static u64 launcher_refresh_notice_until; +/* User-facing text describes the *runtime mode*, not a guessed shell + * model: DSi and DSi XL/LL share the same TWL mode; a DSi can also run + * homebrew in NTR/DS mode. 16/4 MiB are hardware RAM capacities, not free + * heap sizes. Detailed heap bounds stay available in nds_runtime_state. */ +static const char* nds_runtime_mode_label(void){ + return nds_ui(isDSiMode() ? "DSi 模式 · 16 MiB" : "DS 模式 · 4 MiB"); +} +static unsigned launcher_language_cursor; +static char launcher_font_path[256],launcher_icon_path[256]; +static u16 selected_icon[48*48];static bool selected_icon_ok; +static u64 toast_started; +/* Enhanced split cannot show the classic aux-panel toast on its touch LCD. */ +static char nds_toast_text[128]; +/* magic, about, font reads, title reads, restore success, selection writes, write errors */ +volatile unsigned frontend_state[7]={0x4e465231}; +/* magic, visible, presentations, completed library presentations */ +volatile unsigned splash_state[4]={0x4e53504c}; +static void launcher_remember(void){ + if(!launcher_count)return;mkdir("/pymo",0777);FILE* f=fopen("/pymo/last-game.txt","wb");bool ok=false; + if(f){ok=fprintf(f,"%s\n",launcher_games[launcher_selected].path)>0;if(fclose(f))ok=false;} + frontend_state[5]++;if(!ok)frontend_state[6]++; +} +static bool launcher_file(const char* dir,const char* suffix){char path[512];struct stat s;snprintf(path,sizeof path,"%s/%s",dir,suffix);return !stat(path,&s)&&S_ISREG(s.st_mode);} +/* Explicit device-prefixed paths let the unmodified CPyMO asset loader, + * config and save code operate on either mounted FAT volume. Never rewrite + * one game's source paths or redirect its save files. */ +static bool launcher_valid_game_path(const char* dir){ + return dir && (dir[0]=='/' || + !strncasecmp(dir,"fat:/",5) || + !strncasecmp(dir,"sd:/",4)); +} +static void launcher_add(const char* dir){ + if(!launcher_valid_game_path(dir)||strlen(dir)>=256||!launcher_file(dir,"gameconfig.txt"))return; + for(unsigned i=0;ipath,sizeof game->path,"%s",dir); + cpymo_gameconfig config;char path[512];snprintf(path,sizeof path,"%s/gameconfig.txt",dir); + bool parsed=!cpymo_gameconfig_parse_from_file(&config,path); + if(parsed){snprintf(game->title,sizeof game->title,"%s",config.gametitle);snprintf(game->platform,sizeof game->platform,"%s",config.platform);game->width=config.imagesize_w;game->height=config.imagesize_h;} + else game->status=3; + char* line=game->title;for(unsigned i=0;i<3;i++){ + char* next=strstr(line,"\\n");unsigned delimiter=2;if(!next){next=strchr(line,'\n');delimiter=1;} + if(next)*next=0;if(i)snprintf(game->intro[i-1],sizeof game->intro[0],"%s",line); + if(!next)break;line=next+delimiter; + } + if(!game->title[0])snprintf(game->title,sizeof game->title,"%s",strrchr(dir,'/')+1); + if(!parsed)return;snprintf(path,sizeof path,"%s/nds-cache/format.txt",dir);FILE* f=fopen(path,"rb");if(f){char marker[32]={0};fread(marker,1,31,f);fclose(f);game->status=(!strcmp(marker,"CPYMO-NDS-CACHE-1\n")||!strcmp(marker,"CPYMO-NDS-CACHE-2\n")||!strcmp(marker,"CPYMO-NDS-CACHE-3\n")||!strcmp(marker,"CPYMO-NDS-CACHE-4\n")||!strcmp(marker,"CPYMO-NDS-CACHE-5\n")||!strcmp(marker,"CPYMO-NDS-CACHE-6\n"))&&launcher_file(dir,"nds-cache/font.bin")?1:2;} + snprintf(path,sizeof path,"%s/nds-cache/launcher-title.bin",dir);f=fopen(path,"rb");if(f){ + struct {char magic[4];u16 w,h;} h;game->title_ok=fread(&h,1,8,f)==8&&!memcmp(h.magic,"NLT1",4)&&h.w==200&&h.h==14&&fread(game->title_bits,1,350,f)==350&&fgetc(f)==EOF;fclose(f);frontend_state[3]++;} + snprintf(path,sizeof path,"%s/nds-cache/launcher-meta.bin",dir);f=fopen(path,"rb");if(f){ + struct {char magic[4];u16 w,h;} h;game->meta_ok=fread(&h,1,8,f)==8&&!memcmp(h.magic,"NLM1",4)&&h.w==200&&h.h==42&&fread(game->meta_bits,1,1050,f)==1050&&fgetc(f)==EOF;fclose(f); + if(game->meta_ok){memcpy(game->title_bits,game->meta_bits,350);game->title_ok=true;}} + snprintf(path,sizeof path,"%s/nds-cache/launcher-icon.bin",dir);f=fopen(path,"rb");if(f){ + struct {char magic[4];u16 w,h;} h;u16 row[48];bool ok=fread(&h,1,8,f)==8&&!memcmp(h.magic,"NLI1",4)&&h.w==48&&h.h==48; + for(unsigned y=0;ok&&y<48;y++){ok=fread(row,2,48,f)==48;if(!(y&1))for(unsigned x=0;x<24;x++)game->icon[(y/2)*24+x]=row[x*2];} + game->icon_ok=ok&&fgetc(f)==EOF;fclose(f);} + + +} +static void launcher_scan_dir(const char* root){ + DIR* d=opendir(root);if(!d)return;struct dirent* entry;char path[256];unsigned scanned=0; + while((entry=readdir(d))&&scanned++<1024){if(entry->d_name[0]=='.')continue;int n=snprintf(path,sizeof path,"%s%s%s",root,root[strlen(root)-1]=='/'?"":"/",entry->d_name);if(n>0&&n<(int)sizeof path)launcher_add(path);} + if(scanned>=1024)launcher_state[5]=1;closedir(d); +} +/* libfat's fatInitDefault mounts both "sd:" and "fat:" where available, + * then chooses the running executable's device as cwd. Preserve the current + * /pymo/games scan and scan only the *other* device to avoid duplicates. + * DS/DS Lite never attempts DSi-SD discovery. No additional card writes. */ +static void launcher_scan_other_card(void){ + if(!isDSiMode())return; + char cwd[256]; + if(!getcwd(cwd,sizeof cwd))return; + const char* other=NULL; + if(!strncasecmp(cwd,"fat:",4))other="sd:"; + else if(!strncasecmp(cwd,"sd:",3))other="fat:"; + if(!other)return; + char path[32]; + snprintf(path,sizeof path,"%s/pymo/games",other); + launcher_scan_dir(path); + snprintf(path,sizeof path,"%s/",other); + launcher_scan_dir(path); +} +static int launcher_compare(const void* a,const void* b){return strcasecmp(((const LauncherGame*)a)->path,((const LauncherGame*)b)->path);} +static void launcher_scan(const char* hint){ + char previous[256]={0};if(launcher_count)snprintf(previous,sizeof previous,"%s",launcher_games[launcher_selected].path); + launcher_count=0;launcher_state[5]=0;launcher_scan_dir("/pymo/games");launcher_scan_dir("/");launcher_scan_other_card();launcher_add(hint); + const char* configs[]={"/cpymo-nds/cache-game-path.txt","/cpymo-nds/game-path.txt"}; + for(unsigned i=0;i<2;i++){FILE* f=fopen(configs[i],"rb");if(f){char path[256];if(fgets(path,sizeof path,f)){path[strcspn(path,"\r\n")]=0;launcher_add(path);}fclose(f);}} + qsort(launcher_games,launcher_count,sizeof *launcher_games,launcher_compare);if(launcher_selected>=launcher_count)launcher_selected=0;launcher_state[2]=launcher_count; + if(!launcher_restored){FILE* f=fopen("/pymo/last-game.txt","rb");if(f){if(fgets(previous,sizeof previous,f))previous[strcspn(previous,"\r\n")]=0;fclose(f);}launcher_restored=true;} + for(unsigned i=0;i=0&&yy>=0)framebuffer[yy*256+xx]=color|BIT(15);} +/* Preserve R5's full-width game rows and 4px visual track. The 14px + * touch target is hit testing only (partly overlapping the visually blank + * right edge of a row), so increased usability does not change appearance. */ +#define LAUNCHER_SCROLL_Y 33 +#define LAUNCHER_SCROLL_H 121 +#define LAUNCHER_SCROLL_TOUCH_X 242 +static int launcher_scroll_thumb_height(void){ + if(launcher_count<=4)return LAUNCHER_SCROLL_H; + int h=(LAUNCHER_SCROLL_H*4+(int)launcher_count/2)/(int)launcher_count; + return h<14?14:h; +} +static int launcher_scroll_thumb_top(void){ + if(launcher_count<=4)return LAUNCHER_SCROLL_Y; + int travel=LAUNCHER_SCROLL_H-launcher_scroll_thumb_height(); + unsigned max_first=launcher_count-4; + return LAUNCHER_SCROLL_Y+(int)((travel*launcher_scroll_first+max_first/2)/max_first); +} +static bool launcher_scroll_set_first(unsigned first){ + if(launcher_count<=4)return false; + const unsigned max_first=launcher_count-4; + if(first>max_first)first=max_first; + const unsigned old_first=launcher_scroll_first,old_selected=launcher_selected; + launcher_scroll_first=first; + /* Keep the highlighted title attached to a visible row, not an + * offscreen game, when the viewport moves independently of the D-pad. */ + if(launcher_selected=first+4)launcher_selected=first+3; + return old_first!=launcher_scroll_first||old_selected!=launcher_selected; +} +static bool launcher_scrollbar_begin_touch(int x,int y){ + if(launcher_count<=4||x=256|| + y=LAUNCHER_SCROLL_Y+LAUNCHER_SCROLL_H)return false; + int top=launcher_scroll_thumb_top(),height=launcher_scroll_thumb_height(); + /* A tap outside the thumb jumps to the corresponding place. Pressing + * the thumb itself keeps its position and avoids an initial jump. */ + if(y=top+height){ + int travel=LAUNCHER_SCROLL_H-height,relative=y-LAUNCHER_SCROLL_Y-height/2; + if(relative<0)relative=0; + if(relative>travel)relative=travel; + launcher_scroll_set_first((unsigned)((relative*(int)(launcher_count-4)+travel/2)/travel)); + } + launcher_scroll_dragging=true; + launcher_scroll_drag_y=y; + launcher_scroll_drag_first=launcher_scroll_first; + return true; +} +static bool launcher_scrollbar_move_touch(int y){ + if(!launcher_scroll_dragging||launcher_count<=4)return false; + const int travel=LAUNCHER_SCROLL_H-launcher_scroll_thumb_height(); + const int max_first=(int)launcher_count-4; + const int delta=(y-launcher_scroll_drag_y)*max_first; + /* Signed rounding, then clamp. Keep capture even if the pen slides + * outside the narrow gutter until release, for natural nail dragging. */ + const int shift=(delta+(delta>=0?travel/2:-(travel/2)))/travel; + int first=(int)launcher_scroll_drag_first+shift; + if(first<0)first=0; + if(first>max_first)first=max_first; + return launcher_scroll_set_first((unsigned)first); +} +static void launcher_scrollbar_draw(void){ + if(launcher_count<=4)return; + launcher_rect(251,LAUNCHER_SCROLL_Y,4,LAUNCHER_SCROLL_H,nds_theme_card()); + launcher_rect(252,launcher_scroll_thumb_top(),2,launcher_scroll_thumb_height(),nds_theme_accent()); +} +static void launcher_text_mode(const char* text,int x,int y,u16 color,int max_x,unsigned mode){ + const char* p=text;int start=x;while(*p){unsigned cp=decode(&p);if(cp==13)continue;if(cp==10|| (cp=='\\'&&*p=='n')){if(cp=='\\')p++;x=start;y+=17;continue;}if(y>178)break; + int g=text_glyph(mode,cp),fallback=g<0?ui_fallback_glyph(cp):-1;if(g<0&&fallback<0)g=text_glyph(mode,'?');if(g<0&&fallback<0)continue;unsigned advance=fallback>=0?ui_fallback_advances[fallback]:text_advance(mode,g);if(x+(int)advance>max_x){while(*p&&*p!='\n')p++;continue;} + for(int yy=0;yy<(fallback>=0?16:(int)font_height(mode));yy++){unsigned bits=fallback>=0?ui_fallback_rows[fallback][yy]:text_row(mode,g,yy);for(int xx=0;xx<(fallback>=0?16:(int)font_width(mode));xx++)if(bits&(1u<=0)width+=(int)text_advance(mode,g); + } + return width; +} +static void launcher_text_centered(const char* text,int cell_x,int cell_width,int y,u16 color){ + int x=cell_x+(cell_width-launcher_text_pixel_width(text))/2; + if(xtitle_ok)return false;for(unsigned yy=0;yy<14;yy++)for(unsigned xx=0;xx<200;xx++)if(game->title_bits[yy*25+xx/8]&(1u<<(xx%8)))launcher_rect(x+xx,y+yy,1,1,color);return true; +} +static void launcher_list_title(LauncherGame* game,int x,int y,u16 color){ + /* Use the exact native 12px dialogue font, including its full glyph grid. + Older on-card title/meta bitmaps may still contain a pre-pixel-font style. + Generate once from this game's own subset, never the selected game's. */ + if(!game->list_title_ok){ + PixelFont own={0}; + if(read_pixel_font(&own,game->path,"small",12)){ + memset(game->list_title_bits,0,sizeof game->list_title_bits);const char* p=game->title;unsigned pen=0; + while(*p){unsigned cp=decode(&p);int lo=0,hi=own.count-1,found=-1; + while(lo<=hi){int mid=(lo+hi)/2;if(own.data[mid].code==cp){found=mid;break;}if(own.data[mid].code=0?own.data[found].advance:ui_fallback_advances[fallback];if(pen+advance>200)break; + for(unsigned yy=0;yy<16;yy++){unsigned bits=found>=0?own.data[found].rows[yy]:ui_fallback_rows[fallback][yy]; + for(unsigned xx=0;xx<16&&pen+xx<200;xx++)if(bits&(1u<list_title_bits[yy*25+(pen+xx)/8]|=1u<<((pen+xx)%8);} + pen+=advance; + } + free(own.data);game->list_title_ok=true; + } + } + if(game->list_title_ok){for(unsigned yy=0;yy<16;yy++)for(unsigned xx=0;xx<200;xx++)if(game->list_title_bits[yy*25+xx/8]&(1u<<(xx%8)))launcher_rect(x+xx,y+yy,1,1,color);} + else if(!launcher_title_bitmap(game,x,y,color))launcher_text_mode(game->title,x,y,color,244,0); +} +/* Fit complete UTF-8 glyphs on one line, reserving dots when text overflows. */ +static void launcher_line(const char* text,int x,int y,u16 color,int max_x,unsigned mode){ + const char* p=text;unsigned width=0;while(*p&&*p!='\n'&&*p!='\r'&&!(p[0]=='\\'&&p[1]=='n')){unsigned cp=decode(&p);int g=text_glyph(mode,cp);if(g<0)g=text_glyph(mode,'?');if(g>=0)width+=text_advance(mode,g);} + if(width<=(unsigned)(max_x-x)){launcher_text_mode(text,x,y,color,max_x,mode);return;} + int dot=text_glyph(mode,'.');unsigned dots=dot>=0?3*text_advance(mode,dot):0;int limit=max_x-x-(int)dots; + char fitted[256];unsigned used=0;int pixels=0;p=text; + while(*p&&*p!='\n'&&*p!='\r'&&!(p[0]=='\\'&&p[1]=='n')){const char* begin=p;unsigned cp=decode(&p);int g=text_glyph(mode,cp);if(g<0)g=text_glyph(mode,'?');unsigned advance=g>=0?text_advance(mode,g):0;unsigned bytes=p-begin;if(pixels+(int)advance>limit||used+bytes+4>sizeof fitted)break;memcpy(fitted+used,begin,bytes);used+=bytes;pixels+=advance;} + memcpy(fitted+used,dots?"...":"",dots?4:1);launcher_text_mode(fitted,x,y,color,max_x,mode); +} +static void launcher_title(const LauncherGame* game,int x,int y,u16 color,int max_x){ + if(nds_font_choices_available())launcher_line(game->title,x,y,color,max_x,2); + else if(!launcher_title_bitmap(game,x,y,color))launcher_line(game->title,x,y,color,max_x,0); +} +static void launcher_background(void){const u16 color=nds_theme_bg()|BIT(15);for(unsigned i=0;i<256*192;i++)framebuffer[i]=color;} +/* C scheme: no redundant bar across the entire top of the screen. */ +static void launcher_header(const char* title){ + launcher_rect(0,0,256,28,nds_theme_header()); + launcher_text(title,10,7,nds_theme_primary(),248); +} +static void launcher_icon(int x,int y){for(int yy=0;yy<32;yy++)for(int xx=0;xx<32;xx++){u16 c=app_icon[yy*32+xx];if(c)launcher_rect(x+xx,y+yy,1,1,c);}} +/* ROM-resident glyphs work before FAT or a game's font cache is available. */ +static void launcher_splash_text(const char* text,int y,bool large,u16 color){ + const char* p=text;unsigned width=0;while(*p){int g=ui_fallback_glyph(decode(&p));if(g>=0)width+=large?ui_large_advances[g]:ui_fallback_advances[g];} + int x=(256-(int)width)/2;p=text;while(*p){int g=ui_fallback_glyph(decode(&p));if(g<0)continue; + for(int yy=0;yy<16;yy++){unsigned bits=large?ui_large_rows[g][yy]:ui_fallback_rows[g][yy];for(int xx=0;xx<16;xx++)if(bits&(1u<path))return; + snprintf(launcher_icon_path,sizeof launcher_icon_path,"%s",g->path);selected_icon_ok=false; + char path[512];snprintf(path,sizeof path,"%s/nds-cache/launcher-icon.bin",g->path);FILE* f=fopen(path,"rb");if(f){ + struct {char magic[4];u16 w,h;} h;selected_icon_ok=fread(&h,1,8,f)==8&&!memcmp(h.magic,"NLI1",4)&&h.w==48&&h.h==48&&fread(selected_icon,2,48*48,f)==48*48&&fgetc(f)==EOF;fclose(f);} + presentation_state[6]=selected_icon_ok;presentation_state[7]=1+(g->intro[0][0]!=0)+(g->intro[1][0]!=0); +} +static void launcher_game_icon(const LauncherGame* game,int x,int y,bool large){ + if(large&&selected_icon_ok){for(unsigned yy=0;yy<48;yy++)for(unsigned xx=0;xx<48;xx++){u16 c=selected_icon[yy*48+xx];if(c&BIT(15))launcher_rect(x+xx,y+yy,1,1,c);}} + else if(!large&&game->icon_ok){for(unsigned yy=0;yy<24;yy++)for(unsigned xx=0;xx<24;xx++){u16 c=game->icon[yy*24+xx];if(c&BIT(15))launcher_rect(x+xx,y+yy,1,1,c);}} + else if(large)launcher_icon(x+8,y+8); + else {for(unsigned yy=0;yy<24;yy++)for(unsigned xx=0;xx<24;xx++){u16 c=app_icon_small[yy*24+xx];if(c)launcher_rect(x+xx,y+yy,1,1,c);}} +} +static void launcher_intro(const LauncherGame* game,unsigned line,int x,int y,u16 color){ + /* Small dialogue font on its native grid; title remains the visual anchor. */ + launcher_line(game->intro[line-1],x,y,color,245,nds_font_choices_available()?1:0); +} +static bool nds_aux_clock_suppressed; +static void nds_clock_patch_aux(bool show){ + if(debug_trace||!launcher_sub||nds_aux_hidden())return; + for(unsigned y=96;y<114;y++)for(unsigned x=196;x<244;x++)launcher_sub[y*256+x]=nds_theme_bg()|BIT(15); + if(show){nds_clock_paint_impl(launcher_sub,196,96,nds_theme_aux_clock_ink(),false);clock_state[7]++;} +} +static void nds_clock_sync_aux_visibility(void){ + bool suppress=nds_menu_clock_visible; + if(suppress==nds_aux_clock_suppressed)return; + nds_aux_clock_suppressed=suppress;nds_clock_patch_aux(!suppress); +} +static void launcher_play_panel(const char* message){ + /* Enhanced mode owns the sub LCD; never repaint it with the classic help UI. */ + if(nds_dual_active())return; + if(nds_aux_hidden()){if(launcher_sub)dmaFillHalfWords(BIT(15),launcher_sub,256*192*2);return;} + u16 white=nds_theme_primary(),muted=nds_theme_muted(),accent=nds_theme_accent(); + launcher_background();launcher_header("CPyMO for NDS " CPYMO_NDS_VERSION); + /* Physical touch is a native game coordinate only in classic-lower. + Do not imply the help LCD is a universal virtual A button. D-pad + story shortcuts use the physical controller's UP/DOWN labels. + Keep the game icon at x=196,y=40 and clock at x=196,y=96 untouched. */ + if(nds_dual_title_allow_split(&nds_title_gate)){ + launcher_text(nds_ui("A / DOWN:继续"),12,32,white,183); + launcher_text(nds_ui("UP:历史对话"),12,50,white,183); + launcher_text(nds_ui("X:菜单 · B:返回"),12,68,white,183); + launcher_text(nds_ui("B:按住隐藏文字"),12,86,white,183); + launcher_text(nds_ui("Y:隐藏/唤回辅助屏"),12,104,white,183); + launcher_text(nds_ui("R:快进 · L:切换显示模式"),12,122,white,245); + launcher_text(nds_ui("上屏游戏 / 下屏游戏 / 增强双屏"),12,140,accent,245); + launcher_text(nds_ui("START:快速保存 SELECT:快速读取"),12,158,muted,245); + }else{ + launcher_text(nds_ui("标题菜单"),12,32,accent,183); + launcher_text(nds_ui("UP / DOWN:选择项目"),12,50,white,183); + launcher_text(nds_ui("A:确认"),12,68,white,183); + launcher_text(nds_ui("B:返回"),12,86,white,183); + launcher_text(nds_ui("Y:隐藏/唤回辅助屏"),12,104,white,183); + launcher_text(nds_ui("L:切换显示模式"),12,122,white,245); + const char* active=nds_display_mode==0?"当前显示:上屏游戏": + nds_display_mode==1?"当前显示:下屏游戏":"当前显示:增强双屏"; + launcher_text(nds_ui(active),12,158,accent,245); + } + if(launcher_count)launcher_game_icon(&launcher_games[launcher_selected],196,40,true); + /* Keep the last help row useful without placeholder text: status overlays + native runtime mode metadata and resets when its toast expires. */ + launcher_text(message&&*message?nds_ui(message):nds_runtime_mode_label(), + 12,176,message&&*message?accent:muted,245); + nds_clock_sample();nds_aux_clock_suppressed=nds_menu_clock_visible; + if(!nds_aux_clock_suppressed)nds_clock_paint_impl(framebuffer,196,96,nds_theme_aux_clock_ink(),false);clock_state[6]++; + launcher_publish(launcher_sub); +} +static void nds_clock_poll(void){ + nds_clock_sample();if(!nds_clock_pending)return;nds_clock_pending=false; + if(nds_dual_active())return; /* sub LCD belongs to enhanced dialogue/UI */ + if(nds_menu_clock_visible&&cpymo_ui_enabled(&engine))cpymo_engine_request_redraw(&engine); + if(nds_aux_hidden()){clock_state[8]++;return;} + if(!nds_menu_clock_visible)nds_clock_patch_aux(true); +} +static void launcher_toast(const char* message){ + const char* localized=nds_ui(message?message:""); + snprintf(nds_toast_text,sizeof nds_toast_text,"%s",localized?localized:""); + toast_started=tickGetCount();presentation_state[2]=1;presentation_state[3]++;presentation_state[5]=0; + /* Only the split mode owns both screens as gameplay. Redraw a brief + upper-scene feedback banner rather than destroying its lower dialogue. */ + if(nds_dual_active())cpymo_engine_request_redraw(&engine); + else launcher_play_panel(nds_toast_text); +} +static void launcher_update_toast(void){ + if(!presentation_state[2])return; + u64 elapsed=tickGetCount()-toast_started;presentation_state[5]=elapsed*1000/TICK_FREQ; + if(elapsed>=2*TICK_FREQ){ + presentation_state[2]=0;presentation_state[4]++; + /* Force repaint to remove the actual upper-scene overlay; relying on + script activity can leave a stale success message over a static CG. */ + if(nds_dual_active())cpymo_engine_request_redraw(&engine); + else launcher_play_panel(NULL); + } +} +/* Error rendering is ROM-only: it never consults game fonts or FAT. */ +volatile unsigned error_ui_state[8]={0x4e455231}; +static unsigned launcher_rom_width(const char* text,bool large){ + unsigned w=0;while(*text&&*text!='\n'){unsigned cp=decode(&text);int g=ui_fallback_glyph(cp);if(g<0)g=ui_fallback_glyph('?');if(g>=0)w+=large?ui_large_advances[g]:ui_fallback_advances[g];}return w; +} +static void launcher_rom_box(const char* text,int x,int y,int width,int bottom,bool large,u16 color){ + int left=x,right=x+width;const char* p=text;unsigned lines=1; + while(*p){unsigned cp=decode(&p);if(cp==13)continue; + if(cp==10){x=left;y+=18;lines++;continue;} + int g=ui_fallback_glyph(cp);if(g<0){error_ui_state[5]++;g=ui_fallback_glyph('?');}if(g<0)continue; + unsigned advance=large?ui_large_advances[g]:ui_fallback_advances[g]; + if(x+(int)advance>right){x=left;y+=18;lines++;if(cp==' ')continue;} + if(y+16>bottom){error_ui_state[6]++;break;} + for(unsigned yy=0;yy<16;yy++){unsigned bits=large?ui_large_rows[g][yy]:ui_fallback_rows[g][yy]; + for(unsigned xx=0;xx<16;xx++)if((bits&(1u<path;while(strlen(path)>36)path++;launcher_text(path,12,153,muted,215); + if(!strncasecmp(game->path,"sd:/",4))launcher_text("SD",220,153,accent,248); + else if(!strncasecmp(game->path,"fat:/",5))launcher_text("TF",220,153,accent,248); + launcher_text(nds_ui(game->status==1?"已转换,可以启动":game->status==2?"缓存无效,请重新转换":game->status==3?"游戏配置无效":"需要先使用转换脚本"),12,175,accent,245);} + else {launcher_text(nds_ui("没有找到游戏"),12,58,white,245);launcher_text(nds_ui("请先转换游戏,再放入"),12,88,muted,245);launcher_text(nds_ui("/pymo/games/"),12,114,accent,245);} + if(!launcher_count||launcher_about)launcher_text(nds_runtime_mode_label(),12,177,muted,245);launcher_publish(vram); + launcher_background(); + if(!launcher_about&&!launcher_language_menu&&!launcher_theme_menu){ + launcher_rect(0,0,256,28,nds_theme_header()); + launcher_line(nds_ui("选择游戏"),10,7,white,194,1); + nds_clock_sample();launcher_library_clock(framebuffer,false); + }else launcher_header(nds_ui(launcher_theme_menu?"主题设置":launcher_about?"关于与许可":"界面语言")); + if(launcher_theme_menu){ + for(unsigned i=0;i<2;i++){ + int x=i?131:8,w=i?117:115; + launcher_rect(x,33,w,22,launcher_theme_cursor==i?nds_theme_selected():nds_theme_card()); + launcher_text_centered(nds_theme_choice_name(i),x,w,36,white); + } + for(unsigned i=0;i<16;i++){ + int x=8+(i%4)*61,y=60+(i/4)*24; + if(launcher_theme_cursor==i+2)launcher_rect(x-2,y-2,61,25,white); + launcher_rect(x,y,57,21,nds_theme_color(i)); + } + launcher_text(nds_theme_choice_name(launcher_theme_cursor),12,156,accent,245); + launcher_text(nds_ui("方向键选择 · A 确定 · B 返回"),7,174,muted,250); + } + else if(launcher_language_menu){ + for(unsigned i=0;istatus==1?white:muted);} + launcher_scrollbar_draw(); + /* Preserve the original 28px game cards, touch hitboxes and 18px hint row spacing. + Move both hint lines 4px up; do not redesign the UI. */ + launcher_text(message&&*message?nds_ui(message):nds_ui("A / START 启动 · 轻触两次启动"),7,156,accent,250); + launcher_text(nds_ui("上下选择 · B 关于 · X 语言 · Y 主题"),7,174,muted,250);} + launcher_publish(launcher_sub);launcher_state[3]=launcher_selected;frontend_state[1]=launcher_about; + if(splash_state[1]){splash_state[1]=0;splash_state[3]++;} +} +static void launcher_release_keys(void){do{nds_power_poll();swiWaitForVBlank();scanKeys();}while(keysHeld()&(KEY_A|KEY_B|KEY_X|KEY_Y|KEY_L|KEY_TOUCH|KEY_START|KEY_SELECT));} +static void launcher_choose(char* out,size_t size,const char* hint){ + error_ui_active=false; + if(!splash_state[1]){launcher_video_init();launcher_show_splash();} + nds_playing=false;nds_aux_override=false;nds_aux_refresh();lcdMainOnTop();screens_swapped=false;presentation_state[1]=0;presentation_state[2]=0;launcher_icon_path[0]=0; + free(game_glyphs);game_glyphs=NULL;game_glyph_count=0;launcher_font_path[0]=0;free_pixel_fonts();clear_menu_images();nds_cache_enabled=false; + nds_menu_clock_visible=false;clock_state[9]=0; + launcher_about=false;launcher_language_menu=false;launcher_theme_menu=false;launcher_refresh_notice_until=0;launcher_scroll_dragging=false;launcher_state[1]=1;launcher_scan(hint);launcher_draw(NULL);launcher_video_show();launcher_release_keys(); + while(1){nds_power_poll();swiWaitForVBlank();scanKeys();int down=keysDown(),held=keysHeld();bool redraw=false,start=false; + if(!(held&KEY_TOUCH))launcher_scroll_dragging=false; + if(nds_clock_sample()&&!launcher_about&&!launcher_language_menu&&!launcher_theme_menu)launcher_library_clock(launcher_sub,true); + if(down&KEY_X){launcher_language_menu=!launcher_language_menu;launcher_theme_menu=false;launcher_about=false;launcher_language_cursor=nds_language_choice_get();launcher_draw(NULL);continue;} + if(down&KEY_Y){launcher_theme_menu=!launcher_theme_menu;launcher_language_menu=false;launcher_about=false;launcher_theme_cursor=nds_theme_get();launcher_draw(NULL);continue;} + if(down&KEY_B){if(launcher_language_menu)launcher_language_menu=false;else if(launcher_theme_menu)launcher_theme_menu=false;else launcher_about=!launcher_about;launcher_draw(NULL);continue;} + if(launcher_theme_menu){ + if(down&KEY_UP){ + if(launcher_theme_cursor>=2&&launcher_theme_cursor<=5)launcher_theme_cursor=(launcher_theme_cursor-2)/2; + else if(launcher_theme_cursor>=6)launcher_theme_cursor-=4; + } + if(down&KEY_DOWN){ + if(launcher_theme_cursor<2)launcher_theme_cursor=launcher_theme_cursor?4:2; + else if(launcher_theme_cursor<14)launcher_theme_cursor+=4; + } + if(down&KEY_LEFT){ + if(launcher_theme_cursor==1)launcher_theme_cursor=0; + else if(launcher_theme_cursor>=3&&(launcher_theme_cursor-2)%4)launcher_theme_cursor--; + } + if(down&KEY_RIGHT){ + if(launcher_theme_cursor==0)launcher_theme_cursor=1; + else if(launcher_theme_cursor>=2&&(launcher_theme_cursor-2)%4!=3)launcher_theme_cursor++; + } + if(down&KEY_TOUCH){ + touchPosition t;touchRead(&t); + if(t.py>=33&&t.py<55){if(t.px>=8&&t.px<123)launcher_theme_cursor=0;else if(t.px>=131&&t.px<248)launcher_theme_cursor=1;} + else if(t.py>=60&&t.py<153&&t.px>=8&&t.px<248){ + unsigned col=(t.px-8)/61,row=(t.py-60)/24; + if(col<4&&row<4)launcher_theme_cursor=2+row*4+col; + } + } + if(down&KEY_A){ + const char* msg=nds_theme_set(launcher_theme_cursor)?"主题已保存":"设置保存失败"; + launcher_theme_menu=false;launcher_draw(msg);continue; + } + launcher_draw(NULL);continue; + } + if(launcher_language_menu){ + if(!(down&(KEY_UP|KEY_DOWN|KEY_A)))continue; + if(down&KEY_UP)launcher_language_cursor=(launcher_language_cursor+NDS_LANG_COUNT-1)%NDS_LANG_COUNT; + if(down&KEY_DOWN)launcher_language_cursor=(launcher_language_cursor+1)%NDS_LANG_COUNT; + const char* notice=NULL;if(down&KEY_A){notice=nds_language_choice_set(launcher_language_cursor)?"语言设置已保存":"设置保存失败";nds_language_take_refresh();launcher_language_menu=false;} + launcher_draw(notice);continue; + } + if(launcher_about)continue; + if(down&KEY_SELECT){launcher_font_path[0]=0;launcher_scan(hint);launcher_refresh_notice_until=tickGetCount()+2*TICK_FREQ;redraw=true;} + if(launcher_count){if(down&KEY_UP){launcher_selected=(launcher_selected+launcher_count-1)%launcher_count;redraw=true;}if(down&KEY_DOWN){launcher_selected=(launcher_selected+1)%launcher_count;redraw=true;} + if(down&KEY_LEFT){launcher_selected=launcher_selected>=4?launcher_selected-4:0;redraw=true;}if(down&KEY_RIGHT){launcher_selected+=4;if(launcher_selected>=launcher_count)launcher_selected=launcher_count-1;redraw=true;} + if(down&KEY_TOUCH){touchPosition t;touchRead(&t); + if(launcher_scrollbar_begin_touch(t.px,t.py)){redraw=true;} + else if(t.px>=6&&t.px<(launcher_count>4?LAUNCHER_SCROLL_TOUCH_X:250)&&t.py>=33&&t.py<157){ + unsigned index=launcher_scroll_first+(t.py-33)/31; + if(indexstatus==1){launcher_remember();snprintf(out,size,"%s",game->path);launcher_release_keys();launcher_state[1]=0;launcher_state[4]++;return;}launcher_draw("请在电脑上先转换或修复缓存");continue;}} + if(launcher_refresh_notice_until&&tickGetCount()>=launcher_refresh_notice_until){launcher_refresh_notice_until=0;redraw=true;} + if(redraw)launcher_draw(launcher_refresh_notice_until?"游戏列表已刷新":NULL); + } +} diff --git a/cpymo-backends/nds/source/main.c b/cpymo-backends/nds/source/main.c new file mode 100644 index 00000000..57902915 --- /dev/null +++ b/cpymo-backends/nds/source/main.c @@ -0,0 +1,970 @@ +#include "release-version.h" +#include +#include +#include +#include +#include +#include +#include +#include "cpymo_engine.h" +#include "cpymo_save.h" +#include "cpymo_config_ui.h" +#include "cpymo_list_ui.h" +#include "cpymo_rmenu.h" +#include "cpymo_ui.h" +#include "ui-language-nds.h" +#include "cpymo_backend_masktrans.h" +#include "font.h" +#include "cache-nds.h" +#define STB_DS_IMPLEMENTATION +#include "stb_ds.h" +#define STB_IMAGE_IMPLEMENTATION +#define STBI_ONLY_PNG +#define STBI_ONLY_JPEG +#define STBI_NO_HDR +#define STBI_NO_LINEAR +#include "stb_image.h" +#define STB_IMAGE_RESIZE_IMPLEMENTATION +#include "stb_image_resize.h" +#define STB_IMAGE_WRITE_IMPLEMENTATION +#include "stb_image_write.h" +/* Keep audio supplied while the original JPEG/PNG decoder reads the card. + This wrapper leaves upstream CPyMO and stb sources unchanged. */ +extern stbi_uc* __real_stbi_load_from_callbacks(const stbi_io_callbacks*,void*,int*,int*,int*,int); +extern void nds_audio_update(void); +extern void nds_audio_pump_if_due(void); +typedef struct {const stbi_io_callbacks* cb;void* user;u64 last;} PumpIO; +static int pump_read(void* user,char* data,int size){PumpIO* io=user;int n=io->cb->read(io->user,data,size);u64 now=tickGetCount();if(now-io->last>TICK_FREQ/100){nds_audio_update();io->last=tickGetCount();}return n;} +static void pump_skip(void* user,int n){PumpIO* io=user;io->cb->skip(io->user,n);} +static int pump_eof(void* user){PumpIO* io=user;return io->cb->eof(io->user);} +stbi_uc* __wrap_stbi_load_from_callbacks(const stbi_io_callbacks* cb,void* user,int* w,int* h,int* channels,int requested){PumpIO io={cb,user,tickGetCount()};stbi_io_callbacks pump={pump_read,pump_skip,pump_eof};return __real_stbi_load_from_callbacks(&pump,&io,w,h,channels,requested);} + +static cpymo_engine engine; +/* UI requests only set this latch; the main game loop owns cleanup. */ +static bool nds_library_exit_requested,nds_title_restart_pending; +void nds_request_exit_to_library(void){nds_library_exit_requested=true;} +/* Restart callback runs during UI update; only set a latch here. */ +void nds_request_title_guide_reset(void){nds_title_restart_pending=true;} + +static u16 framebuffer[256*192] __attribute__((aligned(32))); +static u16 *vram; +/* Cache the exact immutable base-layer command sequence, never dialogue/UI/effects. */ +typedef struct {float dx,dy,dw,dh,alpha;cpymo_backend_image image;int sx,sy,sw,sh,type;} SceneCommand; +static SceneCommand scene_commands[64],scene_previous[64]; +static unsigned scene_count,scene_previous_count;static bool scene_collect,scene_overflow,scene_valid; +static float scene_view[3];static u16* scene_pixels;static u16* scene_verify_pixels; +volatile unsigned scene_state[8]={0x53435238}; +void nds_scene_release(void){scene_valid=false;if(scene_pixels){free(scene_pixels);scene_pixels=NULL;scene_state[4]++;}} + +static bool screens_swapped; +#include "save-dir-nds.h" +#include "preferences-nds.h" +/* magic, swapped, toast active/shown/expired/age ms, icon loaded, metadata lines, touch samples */ +volatile unsigned presentation_state[9]={0x4e505232}; +#include "dual-screen-nds.h" +#include "dual-input-nds.h" +static nds_touch_role_tracker nds_touch_role_state; +/* Runs BEFORE cpymo_engine_update snapshots input as prev_input. + * Do not allow a pen already pressing story-A to become a new click + * when CPyMO opens a touch-controlled choice or menu (or vice versa). */ +static void nds_touch_prepare_input(unsigned held){ + unsigned coords=nds_touch_uses_coordinates(nds_display_mode, + nds_dual_active(),cpymo_ui_enabled(&engine),nds_dual_has_choice()); + unsigned boundary=nds_touch_role_step(&nds_touch_role_state, + coords,!!(held&KEY_TOUCH)); + if(!boundary)return; + cpymo_input_ignore_next_mouse_button_event(&engine); + engine.input.ok=!!(held&KEY_A); + engine.input.mouse_button=false; + engine.input.mouse_position_useable=false; + if(boundary==2)nds_touch_blocked=true; +} +volatile unsigned engine_state[46]={0x4350454e}; +/* magic, image loads, total/max load us, draws, total/max draw us, loop pixels, omitted pixels */ +volatile unsigned perf_state[9]={0x4e505246}; +volatile unsigned draw_trace[4+64*8]={0x44545238}; +static unsigned text_us,fill_us; +/* magic, auto/hide/X/skip flags, current script line; bounded test telemetry */ +volatile unsigned control_state[3]={0x4e43544c}; +bool nds_cache_enabled; +static bool loaded_image; +extern void nds_audio_update(void); +volatile unsigned vblank_count; +static void on_vblank(void){++vblank_count;} +static float display_scale(void){ + int w=engine.gameconfig.imagesize_w,h=engine.gameconfig.imagesize_h; + if(w<=0||h<=0)return 1; + float sx=256.f/w,sy=192.f/h;return sx0){int min_font=(int)(text_native_pixels()*240.f/(engine.gameconfig.imagesize_h*.8f*display_scale())+.999f);if(nds_font_choices_available()||engine.gameconfig.fontsizeload_state[phase+12])load_state[phase+12]=us;} + +#include "npl4-reader.h" +#include "nps-reader.h" +#include "opaque-span-r12.h" +static void prepare_bounds(Image* im){ + if(!im->mask)return; + im->bounds=malloc(im->ph*2*sizeof(u16));if(!im->bounds)return; + + for(int y=0;yph;y++){if(!(y&7))nds_audio_pump_if_due();int l=0,r=im->pw;const unsigned char* m=im->mask+y*im->pw; + while(ll&&!m[r-1])r--; + im->bounds[y*2]=l;im->bounds[y*2+1]=r; + + } +} + +/* Defer optional metadata to the first partial-alpha draw, away from the + scene's file-loading update. Reserve its potential size in the image cache. */ +static void prepare_opaque(Image* im){ + im->opaque_checked=true; + if(!im->mask||!im->bounds)return; + extern void* __real_malloc(size_t);im->opaque=__real_malloc(im->ph*2*sizeof(u16)); + if(!im->opaque){render_policy[6]++;return;}render_policy[2]++; + for(int y=0;yph;y++){if(!(y&7))nds_audio_pump_if_due();opaque_span(im->mask+y*im->pw,im->bounds[y*2],im->bounds[y*2+1],im->opaque+y*2);} +} + +/* Bounded recent character-image cache: owns one reference, never changes pixels. */ +#define RECENT_LIMIT (384u*1024u) +#define RECENT_LIMIT_TWL (2048u*1024u) +/* Keep the original DS budget except on a genuine TWL runtime with >=8 MiB + * of heap address space. No direct clock, SCFG, or heap-bound changes. */ +static unsigned nds_recent_image_budget(void){ + if(!isDSiMode())return RECENT_LIMIT; + const uintptr_t lo=(uintptr_t)getHeapStart(),hi=(uintptr_t)getHeapLimit(); + return hi>lo && hi-lo>=(8u*1024u*1024u)?RECENT_LIMIT_TWL:RECENT_LIMIT; +} +typedef struct {char path[512];Image* image;unsigned bytes,age;} RecentImage; +/* NTR keeps the original six-slot policy. TWL's 2 MiB budget can retain + * more recently used sprites; more memory is NOT reserved for sprite pixels + * unless those assets are actually loaded. */ +#define RECENT_SLOTS_DS 6u +#define RECENT_SLOTS_TWL 12u +static RecentImage recent_images[RECENT_SLOTS_TWL]; +static unsigned recent_bytes,recent_age,recent_limit=RECENT_LIMIT; +/* Diagnostic-only counters: magic, background hits, misses, stores, skips. + * Background reuse is TWL-only, sharing the existing 2 MiB LRU with sprites. */ +volatile unsigned background_cache_state[5]={0x42474331,0,0,0,0}; +static bool nds_bg_cache_enabled; +static unsigned recent_capacity(void){ + return recent_limit>=RECENT_LIMIT_TWL?RECENT_SLOTS_TWL:RECENT_SLOTS_DS; +} +static void recent_remove(unsigned i){if(recent_images[i].image){recent_bytes-=recent_images[i].bytes;cpymo_backend_image_free(recent_images[i].image);}memset(&recent_images[i],0,sizeof recent_images[i]);} +static void recent_clear(void){for(unsigned i=0;irefs++;load_state[9]++;return recent_images[i].image;}load_state[10]++;return NULL;} +static bool recent_store(const char* path,Image* im){ + unsigned cost=sizeof *im+im->pw*im->ph*(im->mask?3:2)+(im->bounds?im->ph*4:0)+(((render_bits&1)&&im->mask&&im->bounds)?im->ph*4:0); + if(cost>recent_limit)return false; + int slot=-1; + for(;;){slot=-1;for(unsigned i=0;i=0&&recent_bytes+cost<=recent_limit)break; + unsigned oldest=0;for(unsigned i=1;ipath,sizeof r->path,"%s",path);r->image=im;r->bytes=cost;r->age=++recent_age;im->refs++;recent_bytes+=cost; + if(recent_bytes>load_state[30])load_state[30]=recent_bytes; + return true; +} +static Image* menu_images[2]; +static char menu_image_dir[256]; +void nds_cache_hash_path(char* out,size_t size,const char* dir,const char* kind,const char* hex,const char* ext){ + unsigned mask=(!strcmp(kind,"bgm")||!strcmp(kind,"se")||!strcmp(kind,"voice"))?2:1; + if(cache_layout_policy&mask)snprintf(out,size,"%s/nds-cache/%s/%.2s/%s%s",dir,kind,hex,hex,ext); + else snprintf(out,size,"%s/nds-cache/%s/%s%s",dir,kind,hex,ext); +} +void nds_cache_path(char* out,size_t size,const char* dir,const char* kind,cpymo_str name,const char* ext){ + u64 hash=14695981039346656037ULL;for(size_t i=0;i='A'&&c<='Z')c+='a'-'A';hash^=c;hash*=1099511628211ULL;} + char hex[17];snprintf(hex,sizeof hex,"%016llx",(unsigned long long)hash);nds_cache_hash_path(out,size,dir,kind,hex,ext); +} +static error_t cached_image(cpymo_backend_image* out,int* w,int* h,cpymo_str name,const cpymo_assetloader* loader,const char* kind){ + u64 perf_start=tickGetCount(),phase_start=perf_start;unsigned old_phase[8];for(unsigned i=1;i<8;i++)old_phase[i]=load_state[i];unsigned old_decode=compressed_state[3],old_check=compressed_state[5]; + char path[512];nds_cache_path(path,sizeof path,loader->gamedir,kind,name,".npi"); + const bool is_bg=!strcmp(kind,"bg"); + /* Sprite reuse remains unchanged on NTR; only actual TWL heap profiles + * reuse backgrounds. Both resource kinds share the same bounded LRU. */ + const bool reuse=!strcmp(kind,"chara")||(is_bg&&nds_bg_cache_enabled); + if(reuse){ + Image* hit=recent_find(path); + if(is_bg)background_cache_state[hit?1:2]++; + if(hit){*out=hit;*w=hit->w;*h=hit->h;loaded_image=true;engine_state[40]++;nds_audio_pump_if_due();return CPYMO_ERR_SUCC;} + } + FILE* f=fopen(path,"rb");if(!f)return CPYMO_ERR_CAN_NOT_OPEN_FILE; + if(image_buffer_policy&&setvbuf(f,NULL,image_buffer_policy==1?_IONBF:_IOFBF,image_buffer_policy==2?8192:4096)&&setvbuf(f,NULL,_IONBF,0)){fclose(f);return CPYMO_ERR_OUT_OF_MEM;} + + load_phase(1,phase_start);phase_start=tickGetCount(); + struct {char magic[4];u16 w,h,pw,ph;u32 flags;} header; + if(fread(&header,1,sizeof header,f)!=sizeof header||(memcmp(header.magic,"NPI1",4)&&memcmp(header.magic,"NPA4",4)&&memcmp(header.magic,"NPS1",4)&&memcmp(header.magic,"NPS2",4))||!header.w||!header.h||!header.pw||!header.ph||header.pw>2048||header.ph>2048||(unsigned)header.pw*header.ph>262144||header.flags>1){fclose(f);return CPYMO_ERR_BAD_FILE_FORMAT;} + unsigned count=(unsigned)header.pw*header.ph; + bool packed=!memcmp(header.magic,"NPA4",4),sparse=!memcmp(header.magic,"NPS1",4)||!memcmp(header.magic,"NPS2",4); + if(sparse&&header.flags!=1){fclose(f);return CPYMO_ERR_BAD_FILE_FORMAT;} + if(!packed&&!sparse&&!image_sequential&&(fseek(f,0,SEEK_END)||ftell(f)!=(long)(sizeof header+count*(header.flags?3:2))||fseek(f,sizeof header,SEEK_SET))){fclose(f);return CPYMO_ERR_BAD_FILE_FORMAT;} + load_phase(2,phase_start);phase_start=tickGetCount(); + Image* image=calloc(1,sizeof *image);if(!image){fclose(f);if(recent_bytes){recent_clear();return cached_image(out,w,h,name,loader,kind);}return CPYMO_ERR_OUT_OF_MEM;} + image->refs=1;image->w=header.w;image->h=header.h;image->pw=header.pw;image->ph=header.ph;image->px=malloc(count*2);if(header.flags)image->mask=malloc(count); + if(!image->px||(header.flags&&!image->mask)){fclose(f);free(image->px);free(image->mask);free(image);if(recent_bytes){recent_clear();return cached_image(out,w,h,name,loader,kind);}return CPYMO_ERR_OUT_OF_MEM;} + load_phase(3,phase_start);phase_start=tickGetCount(); + unsigned bytes=count*2,done=0;bool ok=true; + if(sparse){int result=nps_file(f,image,!memcmp(header.magic,"NPS2",4));if(result<0){fclose(f);free(image->px);free(image->mask);free(image);if(recent_bytes){recent_clear();return cached_image(out,w,h,name,loader,kind);}return CPYMO_ERR_OUT_OF_MEM;}ok=result>0;phase_start=tickGetCount();} + else if(packed){unsigned char* input=malloc(8192);if(!input){fclose(f);free(image->px);free(image->mask);free(image);if(recent_bytes){recent_clear();return cached_image(out,w,h,name,loader,kind);}return CPYMO_ERR_OUT_OF_MEM;} + ok=npl_plane(f,(unsigned char*)image->px,bytes,input); + if(ok&&image->mask)ok=npl_plane(f,image->mask,count,input); + if(ok)ok=fgetc(f)==EOF&&!ferror(f);free(input);phase_start=tickGetCount(); + }else{ + while(done8192)chunk=8192;if(fread((unsigned char*)image->px+done,1,chunk,f)!=chunk){ok=false;break;}done+=chunk;load_phase(4,phase_start);phase_start=tickGetCount();nds_audio_update();load_phase(5,phase_start);phase_start=tickGetCount();} + if(ok&&image->mask){done=0;while(done8192)chunk=8192;if(fread(image->mask+done,1,chunk,f)!=chunk){ok=false;break;}done+=chunk;load_phase(4,phase_start);phase_start=tickGetCount();nds_audio_update();load_phase(5,phase_start);phase_start=tickGetCount();}} + } + if(ok&&!packed&&!sparse&&image_sequential)ok=fgetc(f)==EOF&&!ferror(f); + load_phase(4,phase_start);phase_start=tickGetCount();fclose(f);load_phase(6,phase_start);if(!ok){free(image->px);free(image->mask);free(image);return CPYMO_ERR_BAD_FILE_FORMAT;} + phase_start=tickGetCount();prepare_bounds(image);load_phase(7,phase_start);load_state[8]++; + if(reuse){ + bool stored=recent_store(path,image); + if(is_bg)background_cache_state[stored?3:4]++; + } + unsigned perf_us=(tickGetCount()-perf_start)*1000000/TICK_FREQ;perf_state[1]++;perf_state[2]+=perf_us;if(perf_us>perf_state[3])perf_state[3]=perf_us; + unsigned seq=load_trace[1]++,j=4+(seq%64)*14;load_trace[j]=seq;load_trace[j+1]=perf_us;for(unsigned i=1;i<8;i++)load_trace[j+1+i]=load_state[i]-old_phase[i];load_trace[j+9]=!strcmp(kind,"bg")?0:!strcmp(kind,"chara")?1:2;load_trace[j+10]=count;load_trace[j+11]=engine_state[14];load_trace[j+12]=compressed_state[3]-old_decode;load_trace[j+13]=compressed_state[5]-old_check; + *out=image;*w=image->w;*h=image->h;loaded_image=true;engine_state[40]++;return CPYMO_ERR_SUCC; +} +extern error_t __real_cpymo_assetloader_load_bg_image(cpymo_backend_image*,int*,int*,cpymo_str,const cpymo_assetloader*); +extern error_t __real_cpymo_assetloader_load_chara_image(cpymo_backend_image*,int*,int*,cpymo_str,const cpymo_assetloader*); +extern error_t __real_cpymo_assetloader_load_system_image(cpymo_backend_image*,int*,int*,cpymo_str,const cpymo_assetloader*,bool); +error_t __wrap_cpymo_assetloader_load_bg_image(cpymo_backend_image* out,int* w,int* h,cpymo_str name,const cpymo_assetloader* l){if(nds_cache_enabled)return cached_image(out,w,h,name,l,"bg");return __real_cpymo_assetloader_load_bg_image(out,w,h,name,l);} +error_t __wrap_cpymo_assetloader_load_chara_image(cpymo_backend_image* out,int* w,int* h,cpymo_str name,const cpymo_assetloader* l){if(nds_cache_enabled)return cached_image(out,w,h,name,l,"chara");return __real_cpymo_assetloader_load_chara_image(out,w,h,name,l);} +static void clear_menu_images(void){for(unsigned i=0;i<2;i++){if(menu_images[i])cpymo_backend_image_free(menu_images[i]);menu_images[i]=NULL;}menu_image_dir[0]=0;} +error_t __wrap_cpymo_assetloader_load_system_image(cpymo_backend_image* out,int* w,int* h,cpymo_str name,const cpymo_assetloader* l,bool mask){ + if(!nds_cache_enabled)return __real_cpymo_assetloader_load_system_image(out,w,h,name,l,mask); + int slot=mask&&name.len==4&&!memcmp(name.begin,"menu",4)?0:mask&&name.len==13&&!memcmp(name.begin,"sel_highlight",13)?1:-1; + if(slot<0)return cached_image(out,w,h,name,l,mask?"system1":"system0"); + if(strcmp(menu_image_dir,l->gamedir)){clear_menu_images();snprintf(menu_image_dir,sizeof menu_image_dir,"%s",l->gamedir);} + if(!menu_images[slot]){error_t err=cached_image(out,w,h,name,l,"system1");if(err)return err;menu_images[slot]=*out;} + Image* image=menu_images[slot];image->refs++;*out=image;*w=image->w;*h=image->h;return CPYMO_ERR_SUCC; +} +static void warm_menu_images(void){for(unsigned i=0;i<2;i++){cpymo_backend_image image=NULL;int w,h;error_t err=__wrap_cpymo_assetloader_load_system_image(&image,&w,&h,cpymo_str_pure(i?"sel_highlight":"menu"),&engine.assetloader,true);if(!err)cpymo_backend_image_free(image);nds_audio_update();}} +static u16 color(cpymo_color c){return RGB15(c.r>>3,c.g>>3,c.b>>3)|BIT(15);} +static void pixel(int x,int y,cpymo_color c,float alpha){ + if(x<0||x>=256||y<0||y>=192||alpha<=0)return; + unsigned idx=y*256+x;if(alpha>=.99f){framebuffer[idx]=color(c);return;} + u16 old=framebuffer[idx];int a=(int)(alpha*32);if(a>32)a=32; + int r=((old&31)*(32-a)+(c.r>>3)*a)>>5; + int g=(((old>>5)&31)*(32-a)+(c.g>>3)*a)>>5; + int b=(((old>>10)&31)*(32-a)+(c.b>>3)*a)>>5; + framebuffer[idx]=RGB15(r,g,b)|BIT(15); +} +/* Integer area filter: load-time only, before RGB555 quantization. + Alpha images accumulate premultiplied channels to avoid dark fringes. */ +static void shrink_pixels(const unsigned char* src,int w,int h,unsigned char* dst,int nw,int nh,int channels){ + for(int y=0;y>8;sy<(y1+255)>>8;sy++)for(int sx=x0>>8;sx<(x1+255)>>8;sx++){ + int lo=sx*256>x0?sx*256:x0,hi=(sx+1)*256y0?sy*256:y0;hi=(sy+1)*256refs=1;im->w=w;im->h=h; + float scale=display_scale();if(scale>1)scale=1; + im->pw=(int)(w*scale+.5f);im->ph=(int)(h*scale+.5f); + if(im->pw<1)im->pw=1;if(im->ph<1)im->ph=1; + int channels=f==cpymo_backend_image_format_rgb?3:4; + unsigned char *filtered=NULL; + if(im->pw!=w||im->ph!=h){ + filtered=malloc(im->pw*im->ph*channels); + if(!filtered){free(im);return CPYMO_ERR_OUT_OF_MEM;} + shrink_pixels(px,w,h,filtered,im->pw,im->ph,channels); + } + im->px=malloc(im->pw*im->ph*2); + if(channels==4)im->mask=malloc(im->pw*im->ph); + if(!im->px||(channels==4&&!im->mask)){free(filtered);free(im->px);free(im->mask);free(im);return CPYMO_ERR_OUT_OF_MEM;} + unsigned char* p=filtered?filtered:px; + for(int i=0;ipw*im->ph;i++,p+=channels){im->px[i]=RGB15(p[0]>>3,p[1]>>3,p[2]>>3)|BIT(15);if(im->mask)im->mask[i]=p[3];} + free(filtered); + prepare_bounds(im);free(px);*out=im;return CPYMO_ERR_SUCC; +} +error_t cpymo_backend_image_load_with_mask(cpymo_backend_image *out,void *px,void *mask,int w,int h,int mw,int mh){ + unsigned char* p=px;unsigned char* m=mask; + for(int y=0;yrefs)return;free(image->opaque);free(image->bounds);free(image->px);free(image->mask);free(image);}} +/* Independent red/blue lanes are ten bits apart: sums stay <=31*32. + Exact RGB555 blend, using two multiplies for both lanes instead of four. */ +static u16 blend(u16 old,u16 col,int a){if(a>=32)return col;if(a<=0)return old;unsigned rb=(((old&0x7c1f)*(32-a)+(col&0x7c1f)*a+0x4010u)>>5)&0x7c1f;unsigned g=(((old&0x03e0)*(32-a)+(col&0x03e0)*a+0x0200u)>>5)&0x03e0;return rb|g|BIT(15);} +static void image_draw_reference(float dx,float dy,float dw,float dh,cpymo_backend_image image,int sx,int sy,int sw,int sh,float alpha,enum cpymo_backend_image_draw_type type){ + if(scene_collect){ + if(scene_count>=64){scene_overflow=true;return;} + SceneCommand* c=&scene_commands[scene_count++];memset(c,0,sizeof *c); + c->dx=dx;c->dy=dy;c->dw=dw;c->dh=dh;c->alpha=alpha;c->image=image;c->sx=sx;c->sy=sy;c->sw=sw;c->sh=sh;c->type=type;return; + } + u64 perf_start=tickGetCount(); + (void)type;Image* im=image;if(!im||dw<=0||dh<=0)return; + float scale=display_scale();dx=dx*scale+display_x();dy=dy*scale+display_y();dw*=scale;dh*=scale; + int a=(int)(alpha*32);if(a<=0)return;if(a>32)a=32; + if((render_bits&1)&&im->mask&&!im->opaque_checked&&(a<32||native_row_copy))prepare_opaque(im); + int left=(int)dx,top=(int)dy,right=(int)(dx+dw),bottom=(int)(dy+dh); + int x0=left<0?0:left,y0=top<0?0:top,x1=right>256?256:right,y1=bottom>192?192:bottom; + if(x1<=x0||y1<=y0)return; + int startX=(int)(sx*(float)im->pw/im->w*65536.f),startY=(int)(sy*(float)im->ph/im->h*65536.f); + unsigned char opacity[256];if(im->mask)for(unsigned i=0;i<256;i++)opacity[i]=(a*i+127)/255; + int stepX=(int)(sw*(float)im->pw/im->w*65536.f/dw+.5f),stepY=(int)(sh*(float)im->ph/im->h*65536.f/dh+.5f); + int columns[256];for(int x=x0;x>16;columns[x]=ix>=0&&ixpw?ix:-1;} + for(int y=y0;y>16;if(iy<0||iy>=im->ph)continue; + int sourceX=(startX>>16)+x0-left; + if(!im->mask && a==32 && stepX==65536 && sourceX>=0 && sourceX+x1-x0<=im->pw){memcpy(framebuffer+y*256+x0,im->px+iy*im->pw+sourceX,(x1-x0)*2);continue;} + int first=x0,last=x1; + if(im->bounds&&stepX>0){int l=im->bounds[iy*2],r=im->bounds[iy*2+1]; + if(l==r){perf_state[8]+=x1-x0;continue;} + while(first=r))first++; + while(last>first&&(columns[last-1]=r))last--; + } + perf_state[8]+=(x1-x0)-(last-first);perf_state[7]+=last-first; + if((render_bits&1)&&im->opaque&&stepX>0){ + int ol=im->opaque[iy*2],orr=im->opaque[iy*2+1],f=first,l=last; + if(orr>ol){ + while(f=orr))f++; + while(l>f&&(columns[l-1]=orr))l--; + }else f=l; + if(fpw+ix;int aa=opacity[im->mask[idx]];if(!aa)continue;if(aa==32)framebuffer[y*256+x]=im->px[idx];else framebuffer[y*256+x]=blend(framebuffer[y*256+x],im->px[idx],aa);} + if(a==32){ + if(native_row_copy&&stepX==65536){memcpy(framebuffer+y*256+f,im->px+iy*im->pw+columns[f],(l-f)*sizeof(u16));render_policy[7]+=l-f;} + else for(int x=f;xpx[iy*im->pw+columns[x]]; + } + else{for(int x=f;xpx[iy*im->pw+columns[x]],a);} + for(int x=l;xpw+ix;int aa=opacity[im->mask[idx]];if(!aa)continue;if(aa==32)framebuffer[y*256+x]=im->px[idx];else framebuffer[y*256+x]=blend(framebuffer[y*256+x],im->px[idx],aa);} + continue; + } + } + for(int x=first;xpw+ix;int aa=im->mask?opacity[im->mask[idx]]:a;if(!aa)continue;if(aa==32)framebuffer[y*256+x]=im->px[idx];else framebuffer[y*256+x]=blend(framebuffer[y*256+x],im->px[idx],aa);} + } + unsigned perf_us=(tickGetCount()-perf_start)*1000000/TICK_FREQ;perf_state[4]++;perf_state[5]+=perf_us;if(perf_us>perf_state[6])perf_state[6]=perf_us; +} +__attribute__((optimize("O3"))) static void image_draw_fast(float dx,float dy,float dw,float dh,cpymo_backend_image image,int sx,int sy,int sw,int sh,float alpha,enum cpymo_backend_image_draw_type type){ + if(scene_collect){ + if(scene_count>=64){scene_overflow=true;return;} + SceneCommand* c=&scene_commands[scene_count++];memset(c,0,sizeof *c); + c->dx=dx;c->dy=dy;c->dw=dw;c->dh=dh;c->alpha=alpha;c->image=image;c->sx=sx;c->sy=sy;c->sw=sw;c->sh=sh;c->type=type;return; + } + u64 perf_start=tickGetCount(); + (void)type;Image* im=image;if(!im||dw<=0||dh<=0)return; + float scale=display_scale();dx=dx*scale+display_x();dy=dy*scale+display_y();dw*=scale;dh*=scale; + int a=(int)(alpha*32);if(a<=0)return;if(a>32)a=32; + if((render_bits&1)&&im->mask&&!im->opaque_checked&&(a<32||native_row_copy))prepare_opaque(im); + int left=(int)dx,top=(int)dy,right=(int)(dx+dw),bottom=(int)(dy+dh); + int x0=left<0?0:left,y0=top<0?0:top,x1=right>256?256:right,y1=bottom>192?192:bottom; + if(x1<=x0||y1<=y0)return; + int startX=(int)(sx*(float)im->pw/im->w*65536.f),startY=(int)(sy*(float)im->ph/im->h*65536.f); + unsigned char opacity[256];if(im->mask)for(unsigned i=0;i<256;i++)opacity[i]=(a*i+127)/255; + int stepX=(int)(sw*(float)im->pw/im->w*65536.f/dw+.5f),stepY=(int)(sh*(float)im->ph/im->h*65536.f/dh+.5f); + int columns[256];for(int x=x0;x>16;columns[x]=ix>=0&&ixpw?ix:-1;} + for(int y=y0;y>16;if(iy<0||iy>=im->ph)continue; + int sourceX=(startX>>16)+x0-left; + if(!im->mask && a==32 && stepX==65536 && sourceX>=0 && sourceX+x1-x0<=im->pw){memcpy(framebuffer+y*256+x0,im->px+iy*im->pw+sourceX,(x1-x0)*2);continue;} + int first=x0,last=x1; + if(im->bounds&&stepX>0){int l=im->bounds[iy*2],r=im->bounds[iy*2+1]; + if(l==r){perf_state[8]+=x1-x0;continue;} + while(first=r))first++; + while(last>first&&(columns[last-1]=r))last--; + } + perf_state[8]+=(x1-x0)-(last-first);perf_state[7]+=last-first; + if((render_bits&1)&&im->opaque&&stepX>0){ + int ol=im->opaque[iy*2],orr=im->opaque[iy*2+1],f=first,l=last; + if(orr>ol){ + while(f=orr))f++; + while(l>f&&(columns[l-1]=orr))l--; + }else f=l; + if(fpw+ix;int aa=opacity[im->mask[idx]];if(!aa)continue;if(aa==32)framebuffer[y*256+x]=im->px[idx];else framebuffer[y*256+x]=blend(framebuffer[y*256+x],im->px[idx],aa);} + if(a==32){ + if(native_row_copy&&stepX==65536){memcpy(framebuffer+y*256+f,im->px+iy*im->pw+columns[f],(l-f)*sizeof(u16));render_policy[7]+=l-f;} + else for(int x=f;xpx[iy*im->pw+columns[x]]; + } + else{for(int x=f;xpx[iy*im->pw+columns[x]],a);} + for(int x=l;xpw+ix;int aa=opacity[im->mask[idx]];if(!aa)continue;if(aa==32)framebuffer[y*256+x]=im->px[idx];else framebuffer[y*256+x]=blend(framebuffer[y*256+x],im->px[idx],aa);} + continue; + } + } + for(int x=first;xpw+ix;int aa=im->mask?opacity[im->mask[idx]]:a;if(!aa)continue;if(aa==32)framebuffer[y*256+x]=im->px[idx];else framebuffer[y*256+x]=blend(framebuffer[y*256+x],im->px[idx],aa);} + } + unsigned perf_us=(tickGetCount()-perf_start)*1000000/TICK_FREQ;perf_state[4]++;perf_state[5]+=perf_us;if(perf_us>perf_state[6])perf_state[6]=perf_us; +} +void cpymo_backend_image_draw(float dx,float dy,float dw,float dh,cpymo_backend_image image,int sx,int sy,int sw,int sh,float alpha,enum cpymo_backend_image_draw_type type){ + if(!nds_dual_accept(type))return; + if(nds_dual_bottom_pass && nds_dual_is_say(type))dy+=nds_dual_say_offset(); + nds_clock_menu_rect(dx,dy,type); + if(renderer_fast)image_draw_fast(dx,dy,dw,dh,image,sx,sy,sw,sh,alpha,type); + else image_draw_reference(dx,dy,dw,dh,image,sx,sy,sw,sh,alpha,type); +} +static void fill_rects_impl(const float* r,size_t n,cpymo_color c,float alpha,enum cpymo_backend_image_draw_type type){ + if(n)nds_clock_menu_rect(r[0],r[1],type); + (void)type;int a=(int)(alpha*32);u16 col=color(c);if(a<=0)return; + float scale=display_scale(),ox=display_x(),oy=display_y(); + for(size_t i=0;i256)x1=256;if(y1>192)y1=192;for(int y=y0;y20000){fclose(f);return false;}unsigned count=header[1];GameGlyph* data=malloc(count*sizeof *data);if(!data){fclose(f);return false;}bool ok=fread(data,sizeof *data,count,f)==count&&fgetc(f)==EOF;fclose(f);for(unsigned i=0;ok&&i=data[i].code)||data[i].advance>32)ok=false;for(unsigned y=0;y<14;y++)if(data[i].rows[y]&~8191u)ok=false;}if(!ok){free(data);return false;}free(game_glyphs);game_glyphs=data;game_glyph_count=count;engine_state[41]=count;return true;} +static FILE* trace_open(const char* mode); +static void missing_glyph(unsigned cp){engine_state[20]++;FILE* file=trace_open("ab");if(file){fprintf(file,"MISSING_GLYPH U+%04X\n",cp);fclose(file);}} +#include "ui-fallback-font.h" +#include "pixel-font-nds.h" +#include "clock-nds.h" +typedef struct {float size;unsigned mode;u8 name_bounds_ready,ink_top,ink_bottom,pad;char text[];} GlyphText; +float cpymo_backend_text_width(cpymo_str s,float size){unsigned mode=active_font_mode(),w=0,maxw=0;const char* p=s.begin;while(pmaxw)maxw=w;w=0;continue;}int g=text_glyph(mode,c);w+=g>=0?text_advance(mode,g):font_nominal(mode);}if(w>maxw)maxw=w;return maxw*(font_scale(size,mode)/display_scale());} +error_t cpymo_backend_text_create(cpymo_backend_text *out,float *width,cpymo_str s,float size){GlyphText* p=malloc(sizeof *p+s.len+1);if(!p)return CPYMO_ERR_OUT_OF_MEM;p->size=size;p->mode=active_font_mode();p->name_bounds_ready=0;memcpy(p->text,s.begin,s.len);p->text[s.len]=0;*out=p;*width=cpymo_backend_text_width(s,size);return CPYMO_ERR_SUCC;} +void cpymo_backend_text_free(cpymo_backend_text p){free(p);} +// Original PyMO centers name ink in its box. The core's fixed 0.9-em +// baseline assumes different font metrics; adapt only the live speaker name. +// Cache bounds on first draw: no repeated glyph scan or FAT access per frame. +static float name_baseline_adjustment(GlyphText* t,float scale,float screen_scale){ + if(!t->name_bounds_ready){ + unsigned top=font_height(t->mode),bottom=0;const char* p=t->text; + while(*p){unsigned cp=decode(&p);if(cp==10||cp==13)continue; + int g=text_glyph(t->mode,cp);if(g<0)g=text_glyph(t->mode,'?'); + if(g>=0)for(unsigned y=0;ymode);y++)if(text_row(t->mode,g,y)){ + if(ybottom)bottom=y+1; + } + } + t->ink_top=top;t->ink_bottom=bottom;t->name_bounds_ready=1; + } + if(t->ink_bottom<=t->ink_top)return 0; + // Box height = 1.4 em, supplied baseline = box top + 0.9 em. + return (font_baseline(t->mode)-(t->ink_top+t->ink_bottom)*.5f)*scale + -.2f*t->size*screen_scale; +} +static void text_draw_impl(cpymo_backend_text text,float x,float baseline,cpymo_color c,float alpha,enum cpymo_backend_image_draw_type type){ + GlyphText* t=text;unsigned mode=t->mode;const char* p=t->text;float screen_scale=display_scale();x=x*screen_scale+display_x();baseline=baseline*screen_scale+display_y();float scale=font_scale(t->size,mode);unsigned gh=font_height(mode),gw=font_width(mode),gb=font_baseline(mode); + if(type==cpymo_backend_image_draw_type_text_say&&text==engine.say.name) + baseline+=name_baseline_adjustment(t,scale,screen_scale); + int h=(int)(gh*scale+.5f),w=(int)(gw*scale+.5f); + if(scale==1.f){int pen=(int)x,top=(int)(baseline-gb);int a=(int)(alpha*32);u16 col=color(c); + while(*p){unsigned cp=decode(&p);if(cp==13)continue;if(cp==10){pen=(int)x;top+=font_nominal(mode)+3;continue;}int g=text_glyph(mode,cp);if(g<0){missing_glyph(cp);g=text_glyph(mode,'?');}if(g>=0){for(unsigned y=0;y=192)continue;unsigned bits=text_row(mode,g,y);for(unsigned xx=0;xx=0&&px<256){unsigned idx=yy*256+px;framebuffer[idx]=blend(framebuffer[idx],col,a);}}}pen+=text_advance(mode,g);}else pen+=font_nominal(mode);} + return; + } + float start_x=x;while(*p){unsigned cp=decode(&p);if(cp==13)continue;if(cp==10){x=start_x;baseline+=(font_nominal(mode)+3)*scale;continue;}int g=text_glyph(mode,cp);if(g<0){missing_glyph(cp);g=text_glyph(mode,'?');} + if(g>=0)for(int y=0;y=0?text_advance(mode,g):font_nominal(mode))*scale;} +} +void cpymo_backend_text_draw(cpymo_backend_text text,float x,float baseline,cpymo_color c,float alpha,enum cpymo_backend_image_draw_type type){ + if(!nds_dual_accept(type))return; + u64 t=tickGetCount(); + if(nds_dual_bottom_pass && nds_dual_is_say(type))baseline+=nds_dual_say_offset(); + text_draw_impl(text,x,baseline,c,alpha,type); + text_us+=(tickGetCount()-t)*1000000/TICK_FREQ; +} +cpymo_input cpymo_input_snapshot(){ + int k=keysHeld();touchPosition t={0};if(k&KEY_TOUCH){touchRead(&t);presentation_state[8]++;} + bool ui=cpymo_ui_enabled(&engine); + // Script menus use the core cancel rule; save-enabled story choices keep X for the menu. + bool script_menu=engine.select_img.selections&&!engine.select_img.save_enabled; + cpymo_input in={0};in.ok=k&KEY_A;in.cancel=k&((ui||script_menu)?KEY_B:KEY_X); + in.up=k&KEY_UP;in.down=k&KEY_DOWN;in.left=k&KEY_LEFT;in.right=k&KEY_RIGHT;in.skip=k&KEY_R; + in.hide_window=!ui&&!engine.select_img.selections&&(k&KEY_B); + /* Touch semantics follow the PHYSICAL lower LCD, not an assumed game + coordinate space. Classic upper-game: whole auxiliary LCD = A. + Classic lower-game: accurate PyMO coordinates including menus/choices. + Enhanced: story area = A; core menus drawn below = real coordinates. + A wake-up touch is blocked by nds_aux_poll when Y hid the sub LCD. */ + nds_touch_sample touch_sample=nds_touch_project(nds_display_mode, + nds_dual_active(),ui,nds_dual_has_choice(), + !!(k&KEY_TOUCH),nds_touch_blocked,!!(k&KEY_A), + t.px,t.py,display_scale(),display_x(),display_y()); + in.ok=touch_sample.ok; + in.mouse_button=touch_sample.mouse_button; + in.mouse_position_useable=in.mouse_button; + in.mouse_x=touch_sample.x; + in.mouse_y=touch_sample.y; + return in; +} +static FILE* savefile(const char* dir,const char* name,const char* mode){return nds_save_fopen(dir,name,mode);} +FILE* cpymo_backend_read_save(const char* dir,const char* name){return savefile(dir,name,"rb");} +FILE* cpymo_backend_write_save(const char* dir,const char* name){return savefile(dir,name,"wb");} +/* Movie wrapper is implemented after the power and framebuffer helpers. */ +/* Release play does not synchronously open/write a card log for each line. + Opt in with save/nds-debug.flag; telemetry remains available in RAM. */ +volatile unsigned diagnostic_state[4]={0x4e444247}; +static bool debug_trace; +/* Upstream stdout must not write tile-map bytes into our bitmap auxiliary + screen. Diagnostic mode retains the original libnds console device. */ +static const devoptab_t* console_output; +static devoptab_t filtered_output; +static ssize_t filtered_console_write(struct _reent* r,void* fd,const char* data,size_t size){ + if(debug_trace&&console_output&&console_output->write_r)return console_output->write_r(r,fd,data,size); + return size; +} +static void filter_console_output(void){ + if(devoptab_list[STD_OUT]==&filtered_output)return; + fflush(stdout);console_output=devoptab_list[STD_OUT];filtered_output=*console_output; + filtered_output.write_r=filtered_console_write;devoptab_list[STD_OUT]=&filtered_output; +} +static FILE* trace_open(const char* mode){diagnostic_state[2]++;if(!debug_trace||!engine.assetloader.gamedir)return NULL;FILE* f=savefile(engine.assetloader.gamedir,"nds-trace.txt",mode);if(f)diagnostic_state[3]++;return f;} +void cpymo_backend_text_extract(const char* text){FILE* trace=trace_open("ab");if(trace){fprintf(trace,"TEXT %s\n",text);fclose(trace);}} +/* Keep a separate profiler so the existing 46-word acceptance ABI is stable. */ +volatile unsigned menu_performance[5]={0x4d454e55}; +extern error_t __real_cpymo_rmenu_enter(cpymo_engine*); +error_t __wrap_cpymo_rmenu_enter(cpymo_engine* e){ + nds_audio_update();u64 begin=tickGetCount(); + nds_registering_rmenu=true;error_t result=__real_cpymo_rmenu_enter(e);nds_registering_rmenu=false; + unsigned us=(tickGetCount()-begin)*1000000/TICK_FREQ; + menu_performance[1]++;menu_performance[2]=us; + if(us>menu_performance[3])menu_performance[3]=us; + nds_audio_update();FILE* trace=trace_open("ab"); + if(trace){fprintf(trace,"MENU_OPEN us=%u status=%d\n",us,result);fclose(trace);} + return result; +} +/* magic, asleep, sleep/wake counts, last sleep ms, audio close/open, + preserved tail samples, live source channels, underrun tails, wake dt us, polls */ +volatile unsigned sleep_state[12]={0x4e534c31}; +extern void nds_audio_suspend(void); +extern void nds_audio_resume(void); +static void nds_power_poll(void){sleep_state[11]++;unsigned wakes=sleep_state[3];if(!pmMainLoop())exit(0);if(wakes!=sleep_state[3])nds_aux_refresh();} +#include "theme-nds.h" +#include "launcher.h" +#include "aux-screen-nds.h" +#include "visual-capture-nds.h" +#include "dual-canvas-nds.h" +#include "nds-picture-bg.h" +/* Refined lower-LCD presentation for the 1.2 enhanced screen. + * Native RGB555 decoration sits BEHIND the game's own speaker/name/text. + * Do not stretch a captured upper screen or allocate a second framebuffer. + * Menus/choices use a less decorated canvas to preserve hit-test contrast. */ +static void nds_dual_canvas_audio_tick(void *unused){ + (void)unused; + nds_audio_pump_if_due(); +} +static void nds_dual_lower_background(bool ui,bool choices){ + const bool interactive=ui||choices; + const bool dialogue_visible=engine.say.active && + !engine.input.hide_window && !engine.say.hide_window; + /* Same RGB555 canvas function is compiled and pixel-tested on desktop; + CPyMO's REAL namebox, textbox, text and menu render over it afterward. */ + /* Use the exact same ROM-embedded artwork under story, choices, + restart and exit-to-library confirmations. Interactive pages get a + 25% dimming pass; otherwise a legacy plain-color panel would flash. */ + if(nds_picture_draw(framebuffer,interactive)){ + nds_audio_pump_if_due(); + }else{ + /* Unpatched developer ROM keeps the established canvas fallback. */ + nds_dual_canvas_draw_yield(framebuffer,interactive,dialogue_visible, + nds_dual_canvas_audio_tick,NULL); + } + if(!interactive && dialogue_visible) + launcher_text(nds_ui("A / DOWN / 轻触:继续"),14,169,RGB15(19,25,28),248); +} +static PmEventCookie sleep_cookie; +static u64 sleep_started; +static void nds_power_event(void* user,PmEvent event){ + (void)user; + if(event==PmEvent_OnSleep){sleep_started=tickGetCount();nds_audio_suspend();sleep_state[1]=1;sleep_state[2]++;} + else if(event==PmEvent_OnWakeup){u64 delta=tickGetCount()-sleep_started;sleep_state[4]=delta*1000/TICK_FREQ;if(presentation_state[2])toast_started+=delta;nds_audio_resume();sleep_state[1]=0;sleep_state[3]++;} +} + +#include "fvds-preflight-nds.h" +#include "movie-lz4-r7.h" +extern void __real_cpymo_charas_wait(cpymo_engine*); +extern void cpymo_charas_gc(cpymo_charas*,bool); +void __wrap_cpymo_charas_wait(cpymo_engine* e){ + if(nds_chara_effects_get()){__real_cpymo_charas_wait(e);return;} + /* Finish one complete character command before drawing its final state. + Image masks remain active; only timed character interpolation is skipped. */ + for(struct cpymo_chara* c=e->charas.chara;c;c=c->next){cpymo_tween_finish(&c->pos_x);cpymo_tween_finish(&c->pos_y);cpymo_tween_finish(&c->alpha);} + cpymo_charas_gc(&e->charas,false);chara_effect_state[2]++;cpymo_engine_request_redraw(e); +} + + +volatile unsigned render_bench[68]={0x52424e43}; +/* Private fixed mask benchmark: real DS code, both directions and endpoints. */ +static void run_mask_bench(void){ + static const unsigned sizes[4][4]={{1,1,320,240},{256,192,480,320},{73,57,240,320},{137,91,4096,17}}; + int oldw=engine.gameconfig.imagesize_w,oldh=engine.gameconfig.imagesize_h; + for(unsigned n=0;n<4;n++){ + MaskTransition* mask=mask_alloc(sizes[n][0],sizes[n][1]); + if(!mask){render_bench[2]=CPYMO_ERR_OUT_OF_MEM;render_bench[1]=1;return;} + for(unsigned i=0;iw*mask->h;i++)mask->pixels[i]=(i*37+i/13)&255; + engine.gameconfig.imagesize_w=sizes[n][2];engine.gameconfig.imagesize_h=sizes[n][3]; + for(unsigned c=0;c<4;c++){ + unsigned total=0,maximum=0,hash=2166136261u;float t=c==0?0:c==1?.15f:c==2?.65f:1; + for(unsigned repeat=0;repeat<16;repeat++){ + for(unsigned i=0;i<256*192;i++)framebuffer[i]=0x8000|((i*3+repeat*17)&0x7fff); + u64 start=tickGetCount();cpymo_backend_masktrans_draw(mask,t,(n+c)&1); + unsigned us=(tickGetCount()-start)*1000000/TICK_FREQ;total+=us;if(us>maximum)maximum=us; + for(unsigned i=0;i<256*192;i++){hash^=framebuffer[i];hash*=16777619u;} + } + unsigned index=4+(n*4+c)*4;render_bench[index]=total;render_bench[index+1]=maximum;render_bench[index+2]=hash;render_bench[index+3]=16;render_bench[3]++; + } + cpymo_backend_masktrans_free(mask); + } + engine.gameconfig.imagesize_w=oldw;engine.gameconfig.imagesize_h=oldh;render_bench[1]=1; +} + +static void run_render_bench(void){ + static const char* names[] = {"CC01_01M","CC01_02M","CC01_04M","CC01_05M"}; + for(unsigned n=0;n<4;n++){ + cpymo_backend_image image=NULL;int w,h;error_t err=cached_image(&image,&w,&h,cpymo_str_pure(names[n]),&engine.assetloader,"chara"); + if(err){render_bench[2]=err;render_bench[1]=1;return;} + for(unsigned c=0;c<4;c++){ + unsigned total=0,maximum=0;float x=c==1?-80:c==2?80:0,y=c==2?-20:0,scale=c==3?.75f:1.f,a=c==1?.5f:1.f; + for(unsigned repeat=0;repeat<16;repeat++){ + for(unsigned p=0;p<256*192;p++)framebuffer[p]=0x8010; + u64 start=tickGetCount(); + cpymo_backend_image_draw(x,y,w*scale,h*scale,image,0,0,w,h,a,cpymo_backend_image_draw_type_chara); + unsigned us=(tickGetCount()-start)*1000000/TICK_FREQ;total+=us;if(us>maximum)maximum=us; + } + unsigned hash=2166136261u;for(unsigned p=0;p<256*192;p++){hash^=framebuffer[p];hash*=16777619u;} + unsigned index=4+(n*4+c)*4;render_bench[index]=total;render_bench[index+1]=maximum;render_bench[index+2]=hash;render_bench[index+3]=16; + render_bench[3]++; + } + cpymo_backend_image_free(image); + } + render_bench[1]=1; +} + + +extern volatile unsigned audio_state[12],audio_bench[12]; +extern volatile unsigned stream_diag[8]; +extern void nds_stream_diag_reset(void); +volatile unsigned load_bench[40]={0x4c424e43}; +static void run_load_bench(void){ + char names[4][64],kinds[4][16]; + FILE* spec=savefile(engine.assetloader.gamedir,"nds-bench-assets.txt","rb"); + if(!spec){load_bench[2]=1;load_bench[1]=1;return;} + for(unsigned n=0;n<4;n++)if(fscanf(spec,"%15s %63s",kinds[n],names[n])!=2){fclose(spec);load_bench[2]=2;load_bench[1]=1;return;} + fclose(spec);recent_limit=0; + cpymo_audio_set_channel_volume(0,&engine.audio,.20f);cpymo_audio_set_channel_volume(1,&engine.audio,.20f);cpymo_audio_set_channel_volume(2,&engine.audio,.20f); + load_bench[2]=cpymo_audio_bgm_play(&engine,cpymo_str_pure("BGM07"),true); + load_bench[2]|=cpymo_audio_se_play(&engine,cpymo_str_pure("SE013"),true); + load_bench[2]|=cpymo_audio_vo_play(&engine,cpymo_str_pure("8RD93O2Y")); + nds_audio_update();nds_stream_diag_reset();for(unsigned i=1;i<8;i++)audio_state[i]=0; + FILE* stress=savefile(engine.assetloader.gamedir,"nds-cache-stress.flag","rb");if(stress){fclose(stress);recent_limit=0;}recent_clear();for(unsigned i=1;i<32;i++)load_state[i]=0;for(unsigned i=1;i<8;i++)compressed_state[i]=0; + engine_state[28]=0;perf_state[4]=perf_state[5]=perf_state[6]=0; + for(unsigned repeat=0;repeat<8;repeat++)for(unsigned n=0;n<4;n++){ + u64 start=tickGetCount();cpymo_backend_image image=NULL;int w,h; + error_t err=cached_image(&image,&w,&h,cpymo_str_pure(names[n]),&engine.assetloader,kinds[n]); + if(err){load_bench[2]=err;load_bench[1]=1;return;} + if(n==0)for(unsigned p=0;p<256*192;p++)framebuffer[p]=0x8010; + cpymo_backend_image_draw(n==2?64:0,0,w,h,image,0,0,w,h,n==0?1.f:.5f,strcmp(kinds[n],"bg")?cpymo_backend_image_draw_type_chara:cpymo_backend_image_draw_type_bg); + cpymo_backend_image_free(image);nds_audio_update(); + unsigned us=(tickGetCount()-start)*1000000/TICK_FREQ; + load_bench[4+n]+=us;if(us>load_bench[8+n])load_bench[8+n]=us; + unsigned hash=2166136261u;for(unsigned p=0;p<256*192;p++){hash^=framebuffer[p];hash*=16777619u;} + load_bench[12+n]=hash;load_bench[3]++; + } + load_bench[16]=engine_state[28];load_bench[17]=perf_state[5];load_bench[18]=perf_state[6]; + for(unsigned i=1;i<8;i++)load_bench[20+i]=stream_diag[i]; + for(unsigned i=1;i<12;i++)audio_bench[i]=audio_state[i];load_bench[1]=1; +} + + +static void nds_base_draw(const cpymo_engine* e){cpymo_bg_draw(e);cpymo_scroll_draw(&e->scroll);cpymo_charas_draw(e);cpymo_anime_draw(&e->anime);} +static void nds_engine_draw(const cpymo_engine* e){ + nds_menu_clock_visible=false;clock_state[9]=0; + if(cpymo_ui_enabled(e)){ + /* Keep the live authored scene as the upper canvas. In contrast to the + first prototype, also render UI_BG on top (as CPyMO 3DS does), while + interactive UI_ELEMENT/UI_ELEMENT_BG are routed to the lower LCD. + This avoids an empty black top for menus lacking their own UI_BG. */ + if(nds_dual_active()&&!nds_dual_bottom_pass)nds_base_draw(e); + cpymo_engine_draw(e); + return; + } + scene_count=0;scene_overflow=false;scene_collect=true;nds_base_draw(e);scene_collect=false; + float view[3]={display_scale(),display_x(),display_y()}; + nds_audio_pump_if_due(); + bool same=!scene_overflow&&scene_previous_count==scene_count&&!memcmp(scene_view,view,sizeof view)&&!memcmp(scene_previous,scene_commands,scene_count*sizeof(SceneCommand)); + bool hit=scene_valid&&same; + if(hit){memcpy(framebuffer,scene_pixels,sizeof framebuffer);scene_state[1]++;} + else{ + nds_base_draw(e);scene_state[2]++; + /* Avoid copying a changing scene: populate only after two identical sequences. */ + if(same&&!scene_pixels){extern void* __real_malloc(size_t);scene_pixels=__real_malloc(sizeof framebuffer);} + if(same&&scene_pixels){memcpy(scene_pixels,framebuffer,sizeof framebuffer);scene_valid=true;}else{scene_valid=false;if(same)scene_state[3]++;} + memcpy(scene_previous,scene_commands,scene_count*sizeof(SceneCommand));memcpy(scene_view,view,sizeof view);scene_previous_count=scene_count; + } + nds_audio_pump_if_due(); + cpymo_select_img_draw(&e->select_img,e->gameconfig.imagesize_w,e->gameconfig.imagesize_h,e->gameconfig.grayselected); + cpymo_floating_hint_draw(&e->floating_hint);cpymo_flash_draw(e);cpymo_bg_draw_transform_effect(e);cpymo_fade_draw(e);cpymo_text_draw(e);cpymo_say_draw(e); +} + +/* Read-only runtime telemetry for hardware acceptance tests. + * [1] actual TWL runtime (not simply DSi console), [2] linked-memory profile. + * This deliberately does not modify CPU clock, SCFG or heap bounds. */ +volatile unsigned nds_runtime_state[5]={0x43505457,0,0,0,0}; +#ifdef CPYMO_DSI_MEMORY_LAYOUT +/* Nonzero TWL section makes the experimental ROM DSi-capable. + * Touch it only after hardware confirms TWL mode. */ +static volatile u32 nds_twl_probe_slot[256] TWL_BSS __attribute__((used)); +#endif +int main(int argc,char** argv){ + nds_runtime_state[1]=isDSiMode()?1u:0u; + nds_runtime_state[3]=(unsigned)getHeapStart(); + nds_runtime_state[4]=(unsigned)getHeapLimit(); +#ifdef CPYMO_DSI_MEMORY_LAYOUT + if(nds_runtime_state[1]){ + nds_twl_probe_slot[0]=0x44534931u; + nds_runtime_state[2]=nds_twl_probe_slot[0]==0x44534931u?1u:2u; + } +#endif + pmAddEventHandler(&sleep_cookie,nds_power_event,NULL); + /* Start Calico's lazy tick service through its public thread API before + the launcher uses tickGetCount(); audio used to initialize it later. */ + threadSleepTicks(1); + /* Initialize the bitmap screens before accessing FAT, but do not draw the + localized game-library loading screen with firmware language. The saved + CPyMO preference is only available after the card is mounted. */ + debug_trace=false;nds_language_boot();filter_console_output();launcher_video_init(); + if(!fatInitDefault()){launcher_failure_hint("无法访问存储卡",CPYMO_ERR_CAN_NOT_OPEN_FILE,"请关机后重新启动");launcher_video_show();while(1){nds_power_poll();swiWaitForVBlank();}} + nds_language_load();nds_global_preferences_load();nds_theme_load(); + /* First visible game-list transition now honors the resolved CPyMO locale, + including the Chinese default on English/Japanese DSi firmware. */ + launcher_show_splash(); + const char* hint=argc>1?argv[1]:NULL; + for(;;){ + debug_trace=false;filter_console_output(); + char game_dir[256];launcher_choose(game_dir,sizeof game_dir,hint); + render_bits=3;{FILE* policy=savefile(game_dir,"nds-render-policy.txt","rb");if(policy){int value=fgetc(policy);fclose(policy);if(value>='0'&&value<='3')render_bits=value-'0';}}render_policy[1]=render_bits; + FILE* debug_flag=savefile(game_dir,"nds-debug.flag","rb");debug_trace=debug_flag!=NULL;if(debug_flag)fclose(debug_flag);diagnostic_state[1]=debug_trace;diagnostic_state[2]=diagnostic_state[3]=0; + recent_clear();recent_limit=nds_recent_image_budget(); + nds_bg_cache_enabled=recent_limit>=RECENT_LIMIT_TWL; + /* Optional test override: game root/nds-bg-cache.txt containing 0 disables + * background caching only; character caching and game assets are unchanged. */ + FILE* bg_cache_flag=savefile(game_dir,"nds-bg-cache.txt","rb"); + if(bg_cache_flag){if(fgetc(bg_cache_flag)=='0')nds_bg_cache_enabled=false;fclose(bg_cache_flag);} + for(unsigned i=1;i<5;i++)background_cache_state[i]=0; + memset(&engine,0,sizeof engine);memset((void*)(engine_state+1),0,sizeof engine_state-sizeof engine_state[0]); + if(debug_trace)consoleDemoInit(); + nds_cache_enabled=true; + nds_library_exit_requested=false;nds_title_restart_pending=false; + nds_dual_load(game_dir); + nds_capture_init(game_dir); + error_t err=(load_game_font(game_dir)&&load_pixel_fonts(game_dir))?CPYMO_ERR_SUCC:CPYMO_ERR_BAD_FILE_FORMAT; + FILE* sequential_file=savefile(game_dir,"nds-image-sequential.txt","rb");image_sequential=!sequential_file||fgetc(sequential_file)!='0';if(sequential_file)fclose(sequential_file); + char layout_path[512],layout_marker[32]={0};snprintf(layout_path,sizeof layout_path,"%s/nds-cache/format.txt",game_dir);FILE* marker_file=fopen(layout_path,"rb");if(marker_file){fread(layout_marker,1,31,marker_file);fclose(marker_file);}int format_layout=!strcmp(layout_marker,"CPYMO-NDS-CACHE-6\n")?3:0; + FILE* layout_file=savefile(game_dir,"nds-layout-policy.txt","rb");int layout=layout_file?fgetc(layout_file)-'0':format_layout;if(layout_file)fclose(layout_file);cache_layout_policy=layout>=0&&layout<=3?layout:0; + FILE* fast_file=savefile(game_dir,"nds-render-fast.txt","rb");renderer_fast=!fast_file||fgetc(fast_file)!='0';if(fast_file)fclose(fast_file); + FILE* row_file=savefile(game_dir,"nds-row-copy.txt","rb");native_row_copy=row_file&&fgetc(row_file)!='0';if(row_file)fclose(row_file); + FILE* buffer_file=savefile(game_dir,"nds-image-buffer.txt","rb");int buffer_policy=buffer_file?fgetc(buffer_file)-'0':2;if(buffer_file)fclose(buffer_file);image_buffer_policy=buffer_policy>=0&&buffer_policy<=3?buffer_policy:0; + extern void nds_stream_guard_policy(bool);FILE* guard_file=savefile(game_dir,"nds-refill-guard.txt","rb");bool guard=!guard_file||fgetc(guard_file)!='0';if(guard_file)fclose(guard_file);nds_stream_guard_policy(guard); + if(!err)err=cpymo_engine_init(&engine,game_dir);engine_state[1]=err; + // DS readability policy is in memory only. Keep layout line spacing in + // agreement with the selected native pixel size; never rewrite gameconfig.txt. + if(!err){nds_preferences_load(game_dir);enforce_text_readability();if(nds_cache_enabled)warm_menu_images();} + if(debug_trace)printf("Core init: %d\n",err);FILE* trace=trace_open("wb");if(trace){fprintf(trace,"INIT %d\n",err);fclose(trace);} + if(err){launcher_state[6]=err;cpymo_audio_free(&engine.audio);if(debug_trace)printf("Game init failed: %d\nPress B to return to games.\n",err);else launcher_failure("启动失败,请检查转换结果",err);do{nds_power_poll();swiWaitForVBlank();scanKeys();}while(!(keysDown()&KEY_B));continue;} + free(scene_verify_pixels);scene_verify_pixels=NULL;FILE* verify_flag=savefile(game_dir,"nds-scene-verify.flag","rb");if(verify_flag){fclose(verify_flag);scene_verify_pixels=malloc(sizeof framebuffer);scene_state[7]=scene_verify_pixels!=NULL;} + FILE* mask_flag=savefile(game_dir,"nds-maskbench.flag","rb");if(mask_flag){fclose(mask_flag);run_mask_bench();for(;;)swiWaitForVBlank();} + FILE* bench_flag=savefile(game_dir,"nds-renderbench.flag","rb");if(bench_flag){fclose(bench_flag);run_render_bench();for(;;)swiWaitForVBlank();} + nds_playing=true;nds_display_start(); + nds_touch_role_state=(nds_touch_role_tracker){0}; + nds_aux_refresh(); + if(debug_trace){consoleClear();printf("CPyMO Nintendo DS\n\nA / Touch: Next\nX: Menu B: Hold to hide text\nR: Skip read text\nSTART: Save slot 1\nSELECT: Load slot 1\n\n%s\n",nds_runtime_mode_label());}else launcher_play_panel(NULL); + // Count actual display interrupts; include missed frames during decoding/drawing. + irqSet(IRQ_VBLANK,on_vblank);irqEnable(IRQ_VBLANK); + FILE* load_flag=savefile(game_dir,"nds-loadbench.flag","rb");if(load_flag){fclose(load_flag);run_load_bench();for(;;){swiWaitForVBlank();nds_audio_update();}} + u64 prev_tick=tickGetCount(),observed_tick=prev_tick;float elapsed=0;char last_script[64]={0}; + while(1){unsigned wakes=sleep_state[3];nds_power_poll();bool woke=sleep_state[3]!=wakes;if(woke)prev_tick=observed_tick=tickGetCount();swiWaitForVBlank();scanKeys(); + nds_audio_update(); + if(!debug_trace)launcher_update_toast(); + /* Three screen modes by a single L press: + classic scene top -> classic scene bottom -> enhanced split -> repeat. */ + if(keysDown()&KEY_L)nds_display_cycle(); + /* Persist only the final L-cycled mode, not every transient selection. */ + nds_dual_poll_mode(); + nds_aux_poll(); + /* UI/choice changes may alter pen semantics while it is still down. + Resolve the boundary before the core copies its previous input. */ + nds_touch_prepare_input((unsigned)keysHeld()); + nds_clock_poll(); + if(keysDown()&KEY_START){error_t save_err=cpymo_save_write(&engine,1);engine_state[10]=(unsigned)save_err;engine_state[12]++;if(!debug_trace)launcher_toast(save_err?"快速保存到存档1失败":"已快速保存到存档1");trace=trace_open("ab");if(trace){fprintf(trace,"SAVE slot=1 status=%d\n",save_err);fclose(trace);}} + if((keysDown()&KEY_SELECT)&&!(keysHeld()&KEY_L)){FILE* saved=cpymo_save_open_read(&engine,1);error_t load_err=CPYMO_ERR_CAN_NOT_OPEN_FILE;if(saved){load_err=cpymo_save_load_savedata(&engine,saved);fclose(saved);}engine_state[11]=(unsigned)load_err;engine_state[13]++;if(!debug_trace)launcher_toast(load_err?"读取存档1失败或存档不存在":"已快速读取存档1");trace=trace_open("ab");if(trace){fprintf(trace,"LOAD slot=1 status=%d\n",load_err);fclose(trace);}if(saved&&load_err){engine_state[1]=(unsigned)load_err;break;}} + unsigned now=vblank_count;u64 now_tick=tickGetCount();float dt=(float)(now_tick-prev_tick)/TICK_FREQ;prev_tick=now_tick;if(woke)sleep_state[10]=(unsigned)(dt*1000000);elapsed+=dt;bool redraw=false; + bool saved_skip_policy=engine.config_skip_already_read_only; + bool skip_override=false; /* L is now exclusively screen swap; skip policy comes from settings. */ + if(skip_override)engine.config_skip_already_read_only=false; + unsigned interval_us=(now_tick-observed_tick)*1000000/TICK_FREQ;observed_tick=now_tick; + engine_state[33+(interval_us<=20000?0:interval_us<=34000?1:interval_us<=50000?2:interval_us<=100000?3:4)]++; + u64 update_start=tickGetCount();loaded_image=false; + err=cpymo_engine_update(&engine,dt,&redraw); + if(nds_library_exit_requested){ + /* The confirmation callback has already exited its UI. Leave the + engine alive until the common teardown below; do not restart ROM. */ + trace=trace_open("ab"); + if(trace){fputs("EXIT_TO_LIBRARY\n",trace);fclose(trace);} + engine_state[1]=0; + break; + } + if(!err&&nds_title_restart_pending){ + nds_title_restart_pending=false; + nds_dual_title_reset(&nds_title_gate); + nds_menu_clock_visible=false;clock_state[9]=0; + nds_aux_clock_suppressed=false; + nds_aux_refresh(); + cpymo_engine_request_redraw(&engine); + redraw=true; + } + if(!err){ + enforce_text_readability(); + /* Only narrative dialogue ends the opening/title screen. No script-name + heuristic, input remap, or changes to PyMO's authored title assets. */ + unsigned title_ended=nds_dual_title_observe(&nds_title_gate, + engine.say.active,cpymo_ui_enabled(&engine), + engine.select_img.selections!=NULL); + if(title_ended){ + if(nds_display_mode==2){ + /* Previous sub LCD held auxiliary help. The upcoming split pass will + replace it with the real CPyMO dialogue on the same frame. */ + nds_aux_refresh(); + cpymo_engine_request_redraw(&engine); + redraw=true; + }else if(!debug_trace)launcher_play_panel(NULL); + } + } + if(skip_override)engine.config_skip_already_read_only=saved_skip_policy;engine_state[1]=err;engine_state[2]++; + nds_preferences_sync(); + /* Rebuild UI objects after their updater returns, never from a setter while + its data is still in use. Recreate the parent menu too, so Back is localized. */ + if(nds_language_take_refresh()){ + while(cpymo_ui_enabled(&engine))cpymo_ui_exit(&engine); + err=cpymo_rmenu_enter(&engine);if(!err)err=cpymo_config_ui_enter(&engine); + if(!err)cpymo_list_ui_set_selection_relative_to_cur(&engine,8); + engine_state[1]=err;launcher_play_panel(NULL);redraw=true; + } + control_state[1]=(engine.say.auto_mode?1:0)|(engine.say.hide_window?2:0)|(engine.input.hide_window?4:0)|((engine.skipping||engine.input.skip)?8:0)|(engine.config_skip_already_read_only?16:0);control_state[2]=engine.interpreter?engine.interpreter->checkpoint.cur_line:0; + if(loaded_image){prev_tick=tickGetCount();engine_state[32]++;} + unsigned update_us=(tickGetCount()-update_start)*1000000/TICK_FREQ;if(update_us>engine_state[31])engine_state[31]=update_us; + engine_state[5]=(unsigned)(elapsed*1000);engine_state[6]=(unsigned)now; + if(err==CPYMO_ERR_NO_MORE_CONTENT){trace=trace_open("ab");if(trace){fprintf(trace,"SESSION_END\n");fclose(trace);}engine_state[1]=0;break;} + if(err){if(!debug_trace){launcher_failure("运行失败,请检查游戏资源",err);do{nds_power_poll();swiWaitForVBlank();scanKeys();}while(!(keysDown()&KEY_B));}else printf("Update error: %d\n",err);trace=trace_open("ab");if(trace){fprintf(trace,"ERROR %d\n",err);fclose(trace);}break;} + if(engine.interpreter && engine.interpreter->script){ + engine_state[14]=(unsigned)engine.interpreter->checkpoint.cur_line; + const char* name=engine.interpreter->script->script_name; + if(strcmp(last_script,name)){snprintf(last_script,sizeof last_script,"%s",name);trace=trace_open("ab");if(trace){fprintf(trace,"SCRIPT %s\n",name);fclose(trace);}} + /* Generic startup-menu marker; script names are recorded in the trace. */ + engine_state[7]=!strcmp(name,"MENU")?10:0; + } + if(redraw){unsigned image_before=perf_state[5],text_before=text_us,fill_before=fill_us;u64 draw_start=tickGetCount();for(unsigned i=0;i<256*192;i++)framebuffer[i]=BIT(15);nds_dual_bottom_pass=false;nds_engine_draw(&engine);if(scene_verify_pixels){memcpy(scene_verify_pixels,framebuffer,sizeof framebuffer);for(unsigned i=0;i<256*192;i++)framebuffer[i]=BIT(15);unsigned saved_bits=render_bits;bool saved_copy=native_row_copy,saved_fast=renderer_fast;render_bits=0;native_row_copy=false;renderer_fast=false;cpymo_engine_draw(&engine);render_bits=saved_bits;native_row_copy=saved_copy;renderer_fast=saved_fast;scene_state[5]++;if(memcmp(scene_verify_pixels,framebuffer,sizeof framebuffer))scene_state[6]++;} + /* Brief save/load or settings feedback while enhanced owns the lower + LCD. The regular auxiliary panel still owns classic-mode toasts. + Draw only on the upper GAME canvas, after the source scene and its + optional verification; never bake this overlay into cached scene data. */ + if(nds_dual_active() && presentation_state[2] && nds_toast_text[0]){ + launcher_rect(0,0,256,24,RGB15(3,5,8)); + launcher_text(nds_toast_text,10,4,RGB15(31,31,31),246); + } + // DMA reads main memory, not the ARM9 data cache. Publish the whole frame. + nds_clock_sync_aux_visibility(); + DC_FlushRange(framebuffer,sizeof framebuffer); + dmaCopy(framebuffer,vram,sizeof framebuffer);engine_state[29]++; + /* In classic-lower mode the sub BG lives on the PHYSICAL upper LCD. + Snapshot the original help/clock VRAM first, then this exact main + framebuffer on the lower LCD. No extra 96 KiB staging allocation. */ + if(nds_capture_armed && nds_display_mode==1 && screens_swapped && + launcher_sub && !cpymo_ui_enabled(&engine) && !nds_dual_has_choice() && + engine.say.active && !engine.say.hide_window && !engine.input.hide_window){ + FILE* classic=nds_capture_begin(4,launcher_sub); + nds_capture_finish(classic,4,framebuffer); + } + if(nds_dual_active() && launcher_sub){ + /* Save the exact rendered pixels only when explicitly armed by a file + in this game's save directory. Never render synthetic preview data. */ + /* Capture story choices separately: a selection may coexist with the + previous dialogue state, but its true touch targets belong below. */ + unsigned capture_kind=cpymo_ui_enabled(&engine)?2: + nds_dual_has_choice()?3: + (engine.say.active&&!engine.say.hide_window&& + !engine.input.hide_window)?1:0; + FILE* capture=nds_capture_begin(capture_kind,framebuffer); + /* Render only say / UI on the lower LCD, preserving the current scene + on the upper LCD and the existing VRAM and ARM7 owners. No extra heap + framebuffer; reuse the RAM draw surface after publishing the top. */ + nds_dual_bottom_pass=true; + nds_dual_lower_background(cpymo_ui_enabled(&engine),nds_dual_has_choice()); + if(cpymo_ui_enabled(&engine))cpymo_engine_draw(&engine); + else{ + cpymo_say_draw(&engine); + if(nds_dual_has_choice())cpymo_select_img_draw(&engine.select_img, + engine.gameconfig.imagesize_w,engine.gameconfig.imagesize_h, + engine.gameconfig.grayselected); + } + DC_FlushRange(framebuffer,sizeof framebuffer); + dmaCopy(framebuffer,launcher_sub,sizeof framebuffer); + nds_capture_finish(capture,capture_kind,framebuffer); + nds_dual_bottom_pass=false; + nds_dual_state[6]++; + } + /* Commit a pending physical LCD role swap only AFTER both target VRAM + surfaces have been published. This avoids exposing the previous + auxiliary panel as a one-frame lower-screen ghost in mode 1 -> 2. */ + nds_display_commit_pending_swap(); + if(engine.bg.transform_draw){engine_state[38]++;float p=cpymo_tween_value(&engine.bg.transform_progression);if(p>0&&p<1)engine_state[39]|=1u<<(unsigned)(p*31);} + unsigned draw_us=(tickGetCount()-draw_start)*1000000/TICK_FREQ;if(draw_us>engine_state[30])engine_state[30]=draw_us;if(draw_us>50000){unsigned seq=draw_trace[1]++,j=4+(seq%64)*8;draw_trace[j]=seq;draw_trace[j+1]=draw_us;draw_trace[j+2]=perf_state[5]-image_before;draw_trace[j+3]=text_us-text_before;draw_trace[j+4]=fill_us-fill_before;draw_trace[j+5]=engine_state[14];draw_trace[j+6]=engine_state[2];draw_trace[j+7]=mask_state[3];}} + nds_audio_update(); + struct mallinfo mi=mallinfo();engine_state[3]=mi.uordblks;if(engine_state[3]>engine_state[4])engine_state[4]=engine_state[3]; + if(false && engine_state[2]%60==0)printf("\x1b[6;0HFrame: %6u \nHeap: %7u \nPeak: %7u ",engine_state[2],engine_state[3],engine_state[4]); + if(engine_state[2]%120==0){trace=trace_open("ab");if(trace){fprintf(trace,"STATE frame=%u ms=%u vblank=%u bg=%s\n",engine_state[2],engine_state[5],engine_state[6],engine.bg.current_bg_name?engine.bg.current_bg_name:"none");fclose(trace);}} + } + nds_playing=false;nds_display_restore_launcher();nds_aux_refresh();cpymo_engine_free(&engine); + } +} diff --git a/cpymo-backends/nds/source/masktrans-nds.h b/cpymo-backends/nds/source/masktrans-nds.h new file mode 100644 index 00000000..a2df41e0 --- /dev/null +++ b/cpymo-backends/nds/source/masktrans-nds.h @@ -0,0 +1,38 @@ +/* Native DS mask transitions; matching the upstream SDL mask/radius curve. + Backend code AGPL-3.0-or-later. */ +typedef struct {unsigned w,h;unsigned char pixels[];} MaskTransition; +/* magic, cache loads, raw loads, draws, direction bits, progression bits, load errors */ +volatile unsigned mask_state[9]={0x4e4d5431}; +static MaskTransition* mask_alloc(unsigned w,unsigned h){ + if(!w||!h||w>256||h>192)return NULL; + MaskTransition* m=malloc(sizeof *m+w*h);if(m){m->w=w;m->h=h;}return m; +} +error_t cpymo_backend_masktrans_create(cpymo_backend_masktrans *out,void* pixels,int w,int h){ + if(!pixels||w<=0||h<=0||w>4096||h>4096)return CPYMO_ERR_BAD_FILE_FORMAT; + unsigned dw=(unsigned)(engine.gameconfig.imagesize_w*display_scale()+.5f),dh=(unsigned)(engine.gameconfig.imagesize_h*display_scale()+.5f); + MaskTransition* m=mask_alloc(dw,dh);if(!m)return CPYMO_ERR_OUT_OF_MEM; + for(unsigned y=0;ypixels[y*dw+x]=((unsigned char*)pixels)[(y*(unsigned)h/dh)*w+x*(unsigned)w/dw];} + free(pixels);*out=m;mask_state[2]++;return CPYMO_ERR_SUCC; +} +void cpymo_backend_masktrans_free(cpymo_backend_masktrans m){free(m);} +extern error_t __real_cpymo_assetloader_load_system_masktrans(cpymo_backend_masktrans*,cpymo_str,const cpymo_assetloader*); +error_t __wrap_cpymo_assetloader_load_system_masktrans(cpymo_backend_masktrans* out,cpymo_str name,const cpymo_assetloader* loader){ + char path[512];nds_cache_path(path,sizeof path,loader->gamedir,"mask",name,".nmt");FILE* f=nds_cache_enabled?fopen(path,"rb"):NULL; + if(!f)return __real_cpymo_assetloader_load_system_masktrans(out,name,loader); + struct {char magic[4];u16 w,h;} header; + bool ok=fread(&header,1,8,f)==8&&!memcmp(header.magic,"NMT1",4)&&header.w&&header.h&&header.w<=256&&header.h<=192; + MaskTransition* m=ok?mask_alloc(header.w,header.h):NULL;ok=ok&&m; + if(ok){unsigned count=header.w*header.h;ok=fread(m->pixels,1,count,f)==count&&fgetc(f)==EOF;} + fclose(f);nds_audio_update();if(!ok){free(m);mask_state[6]++;return CPYMO_ERR_BAD_FILE_FORMAT;} + *out=m;mask_state[1]++;return CPYMO_ERR_SUCC; +} +void cpymo_backend_masktrans_draw(cpymo_backend_masktrans mask,float t,bool fade_in){ + MaskTransition* m=mask;if(!m)return;if(t<0)t=0;if(t>1)t=1; + unsigned char opacity[256];int threshold=(int)(t*765+.5f); + for(int value=0;value<256;value++){int a=(threshold-2*value)*32/255;if(a<0)a=0;if(a>32)a=32;if(t<=0)a=0;if(t>=1)a=32;opacity[value]=fade_in?32-a:a;} + int x0=(int)(display_x()+.5f),y0=(int)(display_y()+.5f),dw=(int)(engine.gameconfig.imagesize_w*display_scale()+.5f),dh=(int)(engine.gameconfig.imagesize_h*display_scale()+.5f); + unsigned columns[256];bool mapped=(render_bits&2)&&dw>0&&dw<=256;if(mapped){for(int x=0;xw/dw;render_policy[5]++;} + for(int y=0;y=192)continue;unsigned row=y*m->h/dh*m->w; + for(int x=0;x=256)continue;int a=opacity[m->pixels[row+(mapped?columns[x]:(unsigned)x*m->w/dw)]];unsigned i=py*256+px;framebuffer[i]=blend(framebuffer[i],BIT(15),a);}} + mask_state[3]++;mask_state[4]|=fade_in?2:1;mask_state[5]|=1u<<(unsigned)(t*31);mask_state[7]=(unsigned)(t*1000);mask_state[8]=fade_in; +} diff --git a/cpymo-backends/nds/source/mm-stream-nds.c b/cpymo-backends/nds/source/mm-stream-nds.c new file mode 100644 index 00000000..af627cd4 --- /dev/null +++ b/cpymo-backends/nds/source/mm-stream-nds.c @@ -0,0 +1,354 @@ +#include +#include +#include +/* Derived from devkitPro/maxmod v2.1.0 source_calico/mm_stream.c. + Corresponding license in ../licenses/maxmod-LICENSE. + Local change: freeze/rebase the stream tick on console sleep/wakeup. + Hardware channel phase and the original prefilled buffer are preserved. */ + +#define SOUND_CLOCKS_PER_TICK (64/2) + +typedef union mm_buf { + void* ptr; + u16* ptr16; + u8* ptr8; +} mm_buf; + +static u32 s_mmStreamMailboxSlots[2]; + +static struct { + TickTask task; + + Thread* thread; + Mailbox mbox; + + mm_stream_func cb; + + mm_buf buf; + mm_buf workbuf; + + unsigned page_cnt; + unsigned page_len; + unsigned timer; + + size_t right_offset; + + unsigned write_pos; + unsigned read_pos; + + u8 fmt_shift; + mm_stream_formats fmt; +} s_mmStreamState; + +static void _mmStreamTickTask(TickTask* t) +{ + s_mmStreamState.page_cnt++; + + if (s_mmStreamState.mbox.pending_slots == 0) { + mailboxTrySend(&s_mmStreamState.mbox, 1); + } +} + +void _mmDeinterleave8 (unsigned len, const u8* in, u8* out, unsigned right_offset); +void _mmDeinterleave16(unsigned len, const u16* in, u16* out, unsigned right_offset); + +static unsigned _mmStreamRead(unsigned pos, unsigned len) +{ + mm_buf left_buf = { &s_mmStreamState.buf.ptr8[pos< len) { + return 0; + } + + if (right_offset) { + // Deinterleave the audio data into the final left/right buffers + if (fmt_shift) { + _mmDeinterleave16(ret, cb_buf.ptr16, left_buf.ptr16, right_offset); + } else { + _mmDeinterleave8 (ret, cb_buf.ptr8, left_buf.ptr8, right_offset); + } + + mm_buf right_buf = { &left_buf.ptr8[right_offset] }; + armDCacheFlush(right_buf.ptr, ret< wr_pos) { + len = _mmStreamRead(wr_pos, rd_pos-wr_pos); + } else { + len = _mmStreamRead(wr_pos, total_len-wr_pos); + } + + if (!len) { + break; + } + + wr_pos += len; + if (wr_pos == total_len) { + wr_pos = 0; + } + + } while (wr_pos != rd_pos); + + s_mmStreamState.write_pos = wr_pos; +} + +MK_NOINLINE static void _mmStreamStart(u32 chn_mask, unsigned task_period) +{ + // Prefill audio buffers + _mmStreamRefill(); + + // Atomically start channel(s) and afterwards the stream tick task + ArmIrqState st = armIrqLockByPsr(); + soundStart(chn_mask); + soundSynchronize(); + tickTaskStart(&s_mmStreamState.task, _mmStreamTickTask, task_period, task_period); + armIrqUnlockByPsr(st); +} + +MK_NOINLINE static void _mmStreamStop(u32 chn_mask) +{ + // Stop counter tick task + tickTaskStop(&s_mmStreamState.task); + + // Stop channels and return them to maxmod's ARM7 engine + soundStop(chn_mask); + soundSynchronize(); + mmUnlockChannels(chn_mask); +} + +static int _mmStreamThread(void* arg) +{ + u32 chn_mask = s_mmStreamState.right_offset ? 5 : 1; + unsigned task_period = (unsigned)arg; + + _mmStreamStart(chn_mask, task_period); + + while (mailboxRecv(&s_mmStreamState.mbox) != 0) { + mmStreamUpdate(); + } + + _mmStreamStop(chn_mask); + + return 0; +} + +void mmStreamOpen(const mm_stream* stream) +{ + // Close stream if already open + if (s_mmStreamState.task.fn || s_mmStreamState.thread) { + mmStreamClose(); + } + + // Calculate page length (half buffer) + unsigned page_len = (stream->buffer_length + 1) / 2; + page_len = (page_len + SOUND_CLOCKS_PER_TICK - 1) &~ (SOUND_CLOCKS_PER_TICK - 1); + + // Calculate timing constants + unsigned sound_timer = soundTimerFromHz(stream->sampling_rate); + unsigned task_period = (page_len/SOUND_CLOCKS_PER_TICK) * sound_timer; + + // Other misc useful values + unsigned fmt_shift = stream->format >= MM_STREAM_16BIT_MONO; + unsigned chn_shift = stream->format & 1; + + // Calculate total buffer size + unsigned buf_len_words = page_len >> (1-fmt_shift); // only one channel + size_t buf_sz = page_len << (1 + fmt_shift + chn_shift); // if stereo: including both channels + + // Allocate main audio buffer + s_mmStreamState.buf.ptr = aligned_alloc(ARM_CACHE_LINE_SZ, buf_sz); + if (!s_mmStreamState.buf.ptr) { + return; + } + + // Allocate separate interleaved work buffer for stereo streams + if (chn_shift) { + s_mmStreamState.workbuf.ptr = malloc(buf_sz); + s_mmStreamState.right_offset = buf_sz/2; + + if (!s_mmStreamState.workbuf.ptr) { + free(s_mmStreamState.buf.ptr); + return; + } + } else { + s_mmStreamState.workbuf.ptr = NULL; + s_mmStreamState.right_offset = 0; + } + + // Allocate and prepare stream thread if needed + if (stream->minus_thread_prio <= 0) { + // Calculate needed size for thread + size_t thread_sz = stream->thread_stack_size ? stream->thread_stack_size : 8*1024; + thread_sz = (sizeof(Thread) + threadGetLocalStorageSize() + thread_sz + 7) &~ 7; + + // Allocate thread memory + s_mmStreamState.thread = malloc(thread_sz); + if (!s_mmStreamState.thread) { + free(s_mmStreamState.workbuf.ptr); + free(s_mmStreamState.buf.ptr); + return; + } + + // Prepare thread + threadPrepare(s_mmStreamState.thread, _mmStreamThread, (void*)task_period, + (u8*)s_mmStreamState.thread + thread_sz, + stream->minus_thread_prio < 0 ? (-stream->minus_thread_prio) : (MAIN_THREAD_PRIO+1)); + threadAttachLocalStorage(s_mmStreamState.thread, NULL); + } + + // Initialize stream state struct + mailboxPrepare(&s_mmStreamState.mbox, s_mmStreamMailboxSlots, 2); + s_mmStreamState.cb = stream->callback; + s_mmStreamState.page_cnt = 0; + s_mmStreamState.page_len = page_len; + s_mmStreamState.timer = sound_timer; + s_mmStreamState.read_pos = 0; + s_mmStreamState.write_pos = 0; + s_mmStreamState.fmt_shift = fmt_shift; + s_mmStreamState.fmt = stream->format; + + // Reserve channels from maxmod's ARM7 engine + u32 chn_mask = chn_shift ? 5 : 1; + mmLockChannels(chn_mask); + + // Prepare (left) channel + SoundFmt sound_fmt = fmt_shift ? SoundFmt_Pcm16 : SoundFmt_Pcm8; + soundPreparePcm(0, 0x7f0, chn_shift ? 0 : 0x40, sound_timer, SoundMode_Repeat, sound_fmt, + s_mmStreamState.buf.ptr, 0, buf_len_words); + + // Prepare right channel if needed + if (chn_shift) { + soundPreparePcm(2, 0x7f0, 0x7f, sound_timer, SoundMode_Repeat, sound_fmt, + &s_mmStreamState.buf.ptr8[s_mmStreamState.right_offset], 0, buf_len_words); + } + + if (stream->minus_thread_prio > 0) { + // Start the stream directly + _mmStreamStart(chn_mask, task_period); + } else { + // Start the stream thread + threadStart(s_mmStreamState.thread); + } +} + +static mm_word _mmStreamGetPosition(mm_word mask) +{ + // Atomically read current page + tick position + ArmIrqState st = armIrqLockByPsr(); + unsigned cur_page = s_mmStreamState.page_cnt; + unsigned ticks = (unsigned)tickGetCount() - (s_mmStreamState.task.target - s_mmStreamState.task.period); + armIrqUnlockByPsr(st); + + // XX: For safety's sake, account for not-yet-triggered page switch events + while (ticks >= s_mmStreamState.task.period) { + cur_page ++; + ticks -= s_mmStreamState.task.period; + } + + // Combine page counter + fine grained sample counter + mm_word coarse = (cur_page & mask) * s_mmStreamState.page_len; + mm_word fine = ticks*SOUND_CLOCKS_PER_TICK/s_mmStreamState.timer; + + return coarse + fine; +} + +volatile unsigned stream_diag[8]={0x53545244}; +static unsigned diag_last_pos;static bool diag_primed; +void nds_stream_diag_reset(void){for(unsigned i=1;i<8;i++)stream_diag[i]=0;diag_last_pos=mmStreamGetPosition();diag_primed=true;} +/* R15: distinguish no newly consumed samples from initial/full-wrap prefill. */ +volatile unsigned refill_diag[16]={0x52464c31}; +static bool refill_guard; +void nds_stream_guard_policy(bool enabled){refill_guard=enabled;refill_diag[1]=enabled;} +void mmStreamUpdate(void) +{ + if (!s_mmStreamState.task.fn) { + return; + } + + if (s_mmStreamState.thread && threadGetSelf() != s_mmStreamState.thread) { + return; + } + + unsigned absolute=mmStreamGetPosition();unsigned elapsed_samples=diag_primed?absolute-diag_last_pos:0;if(diag_primed){unsigned elapsed=absolute-diag_last_pos;if(elapsed>stream_diag[2])stream_diag[2]=elapsed;if(elapsed>=s_mmStreamState.page_len*2)stream_diag[3]++;}diag_last_pos=absolute;diag_primed=true;stream_diag[1]++; + s_mmStreamState.read_pos = _mmStreamGetPosition(1) &~ 3; // only allow 4-sample increments + bool equal=s_mmStreamState.read_pos==s_mmStreamState.write_pos; + if(equal){refill_diag[2]++;if(elapsed_samplesstream_diag[4])stream_diag[4]=diag_us; +} + +void mmStreamClose(void) +{ + // Check for and stop the stream thread + if (s_mmStreamState.thread) { + mailboxTrySend(&s_mmStreamState.mbox, 0); + threadJoin(s_mmStreamState.thread); + free(s_mmStreamState.thread); + } + // Otherwise: check for and stop manually started streams + else if (s_mmStreamState.task.fn) { + u32 chn_mask = s_mmStreamState.right_offset ? 5 : 1; + _mmStreamStop(chn_mask); + } + // Otherwise: no stream is active + else { + return; + } + + // Free buffers + free(s_mmStreamState.workbuf.ptr); + free(s_mmStreamState.buf.ptr); + + // Clear all state + armFillMem32(&s_mmStreamState, 0, sizeof(s_mmStreamState)); +} + +mm_word mmStreamGetPosition(void) +{ + if (!s_mmStreamState.task.fn) { + return 0; + } + + return _mmStreamGetPosition(~0U); +} + +static unsigned nds_stream_remaining; +static bool nds_stream_suspended; +void nds_mm_stream_suspend(void){ + if(!s_mmStreamState.task.fn||nds_stream_suspended)return; + ArmIrqState st=armIrqLockByPsr(); + unsigned now=(unsigned)tickGetCount();nds_stream_remaining=s_mmStreamState.task.target-now; + if((s32)nds_stream_remaining<1)nds_stream_remaining=1; + tickTaskStop(&s_mmStreamState.task);nds_stream_suspended=true; + armIrqUnlockByPsr(st); +} +void nds_mm_stream_resume(void){ + if(!nds_stream_suspended)return; + ArmIrqState st=armIrqLockByPsr(); + tickTaskStart(&s_mmStreamState.task,_mmStreamTickTask,nds_stream_remaining,s_mmStreamState.task.period); + nds_stream_suspended=false;armIrqUnlockByPsr(st); +} diff --git a/cpymo-backends/nds/source/movie-lz4-r7.h b/cpymo-backends/nds/source/movie-lz4-r7.h new file mode 100644 index 00000000..a9f5b31f --- /dev/null +++ b/cpymo-backends/nds/source/movie-lz4-r7.h @@ -0,0 +1,100 @@ +/* Experimental NVL1 RGB555/LZ4 delta video; AGPL-3.0-or-later. */ +/* An NVL1/NVA1 movie takes over the upper game LCD directly. In enhanced + * dual-screen mode, the physical lower LCD otherwise retains the prior + * dialogue because cpymo_engine_draw does not run during movie playback. + * Render ONLY the owner-approved illustration, without dialogue or the + * "continue" hint, once before the first movie frame. + * + * Do not touch VRAM A (upper movie), audio scheduling, touch mapping or the + * per-game mode. The normal end/skip/error cleanup requests an engine redraw + * that will restore the ordinary lower-screen story or menu afterward. + */ +static void nds_movie_prepare_lower_screen(void){ + if(!nds_dual_active() || !launcher_sub)return; + if(!nds_picture_draw(framebuffer,false)){ + /* Unpatched developer ROM: use the prior decorative fallback, without + synthesizing a story prompt or repeating stale dialogue. */ + nds_dual_canvas_draw_yield(framebuffer,false,false, + nds_dual_canvas_audio_tick,NULL); + } + DC_FlushRange(framebuffer,sizeof framebuffer); + dmaCopy(framebuffer,launcher_sub,sizeof framebuffer); +} +volatile unsigned movie_state[24]={0x4e564c37}; +extern bool nds_movie_audio_begin(const char*,unsigned,unsigned); +extern void nds_movie_audio_verify(bool); +extern bool nds_movie_audio_begin_nar(const char*,unsigned,unsigned); +extern unsigned nds_movie_audio_position(void); +extern void nds_movie_audio_end(void); +static bool nvl_read(FILE* f,void* dst,unsigned n){ + unsigned done=0;while(done8192)k=8192;if(fread((unsigned char*)dst+done,1,k,f)!=k)return false;done+=k;nds_audio_pump_if_due();}return true; +} +static void nvl_research_log(cpymo_engine* e,cpymo_str name,const char* status, + unsigned frames_total,unsigned decoded,unsigned displayed,unsigned samples, + unsigned elapsed_ms,unsigned late,unsigned error_code){ + FILE* enabled=savefile(e->assetloader.gamedir,"nds-nvl-probe.flag","rb"); + if(!enabled)return; + fclose(enabled); + char safe[33]={0},report[80];unsigned j=0; + for(unsigned i=0;i='A'&&c<='Z')||(c>='a'&&c<='z')|| + (c>='0'&&c<='9')||c=='_'||c=='-')?(char)c:'_'; + } + if(!j){safe[0]='_';safe[1]=0;} + snprintf(report,sizeof report,"nds-nvl-probe-%s.txt",safe); + FILE* log=savefile(e->assetloader.gamedir,report,"wb"); + if(!log)return; + fprintf(log,"CPyMO 1.2 NVL1/NVA1 playback diagnostic\n"); + fprintf(log,"mode=%s\n",isDSiMode()?"DSi-TWL":"DS-NTR"); + fprintf(log,"status=%s error=%u\n",status,error_code); + fprintf(log,"frames_decoded=%u/%u frames_presented=%u/%u late=%u\n", + decoded,frames_total,displayed,frames_total,late); + fprintf(log,"audio_samples=%u elapsed_ms=%u\n",samples,elapsed_ms); + fclose(log); +} +error_t __wrap_cpymo_movie_play(cpymo_engine* e,cpymo_str name){ + /* Probe is strictly opt-in and non-decoding; regular NVL playback is unchanged. */ + if(nds_fvds_preflight(e,name))return CPYMO_ERR_SUCC; + u64 movie_begin=tickGetCount();unsigned decoded_before=movie_state[3],presented_before=movie_state[4],late_before=movie_state[5]; + FILE* audio_verify=savefile(e->assetloader.gamedir,"nds-video-verify.flag","rb");nds_movie_audio_verify(audio_verify!=NULL);if(audio_verify)fclose(audio_verify); + movie_state[2]++;char path[512];nds_cache_path(path,sizeof path,e->assetloader.gamedir,"video",name,".nvl"); + FILE* f=fopen(path,"rb");if(!f){ + movie_state[8]++;engine_state[45]++; + nvl_research_log(e,name,"MISSING",0,0,0,0,0,0,1); + return CPYMO_ERR_SUCC; + } + unsigned h[8];bool header_read=fread(h,4,8,f)==8;bool compressed=header_read&&!memcmp(h,"NVA1",4);bool valid=header_read&&(!memcmp(h,"NVL1",4)||compressed)&&h[1]==256&&h[2]==192&&h[3]>0&&h[3]<=30&&h[4]>0&&h[4]<=h[3]*600&&h[5]==22050&&h[6]==(unsigned long long)h[4]*22050/h[3]&&h[7]>=32+h[4]*12&&h[7]<512*1024*1024; + if(valid){long pos=ftell(f);valid=!fseek(f,0,SEEK_END);long size=valid?ftell(f):-1;if(valid)valid=compressed?(size>=(long)(h[7]+16)&&size<=(long)(h[7]+16+h[6]*2+((h[6]+1023)/1024)*12)):(size==(long)(h[7]+h[6]*2));valid=valid&&!fseek(f,pos,SEEK_SET);} + unsigned char *packet=valid?malloc(98304):NULL,*delta=packet?malloc(98304):NULL; + bool started=false,failed=!packet||!delta,skipped=false;unsigned last_samples=0,audio_errors_before=movie_state[7]; + if(failed)goto done; + /* Movie accepted and buffers acquired: clear the previous dialogue from + the lower LCD exactly once, before starting frame/audio playback. */ + nds_movie_prepare_lower_screen(); + memset(framebuffer,0,sizeof framebuffer);movie_state[1]=1;movie_state[19]=h[4];movie_state[11]=(unsigned long long)h[4]*1000/h[3]; + for(unsigned frame=0;frame98304||(p[1]&~3)||(!frame&&(p[1]&2))||!nvl_read(f,packet,p[0])){failed=true;break;} + if(p[1]&1){if(!npl_decode(packet,p[0],delta,98304)){failed=true;break;}}else{if(p[0]!=98304){failed=true;break;}memcpy(delta,packet,98304);} + if(p[1]&2){u32* a=(u32*)framebuffer;u32* b=(u32*)delta;for(unsigned i=0;i<98304/4;i++)a[i]^=b[i];}else memcpy(framebuffer,delta,98304); + if(npl_crc((unsigned char*)framebuffer,98304)!=p[2]){failed=true;break;} + unsigned us=(tickGetCount()-start)*1000000/TICK_FREQ;if(us>movie_state[9])movie_state[9]=us;movie_state[3]++; + if(frame){while((unsigned long long)nds_movie_audio_position()*h[3]<(unsigned long long)frame*22050){nds_power_poll();scanKeys();if(keysDown()&KEY_B){skipped=true;goto done;}nds_audio_update();swiWaitForVBlank();}} + nds_audio_update();DC_FlushRange(framebuffer,sizeof framebuffer);dmaCopy(framebuffer,vram,sizeof framebuffer);movie_state[4]++;movie_state[15]=frame; + if(!started){if(!(compressed?nds_movie_audio_begin_nar(path,h[7],h[6]):nds_movie_audio_begin(path,h[7],h[6]))){failed=true;break;}started=true;} + if(movie_state[7]!=audio_errors_before){failed=true;break;} + unsigned samples=nds_movie_audio_position();unsigned target=(unsigned long long)frame*22050/h[3];unsigned late=samples>target?(unsigned long long)(samples-target)*1000000/22050:0; + if(late>movie_state[16])movie_state[16]=late;if(late>1000000/h[3])movie_state[5]++; + if(late>500000){failed=true;break;} + } + if(started&&!failed&&!skipped)while(nds_movie_audio_position() +typedef struct {const unsigned char* p;unsigned size,pos,bits;uint32_t value;} NarBits; +static bool nar_get(NarBits* r,unsigned n,unsigned* out){ + while(r->bitspos>=r->size)return false;r->value=(r->value<<8)|r->p[r->pos++];r->bits+=8;} + r->bits-=n;*out=(r->value>>r->bits)&((1u<bits){if(r->pos>=r->size)return false;r->value=r->p[r->pos++];r->bits=8;} + uint32_t v=r->value<<(32-r->bits);unsigned z=v?__builtin_clz(v):r->bits;if(z>r->bits)z=r->bits; + q+=z;if(q>31)return false;r->bits-=z; + if(r->bits){r->bits--;*out=q;return true;} + } +} +static uint32_t nar_checksum(const unsigned char* p,unsigned n){uint32_t a=1,b=0;while(n>=8){a+=*p++;b+=a; a+=*p++;b+=a; a+=*p++;b+=a; a+=*p++;b+=a; a+=*p++;b+=a; a+=*p++;b+=a; a+=*p++;b+=a; a+=*p++;b+=a; n-=8;}while(n--){a+=*p++;b+=a;}return ((b%65521)<<16)|(a%65521);} +static bool nar_decode(const unsigned char* data,unsigned size,int16_t* dst,unsigned n,unsigned order,unsigned k){ + if(!n||n>1024||size>n*2||!size)return false; + if(order==255){if(k||size!=n*2)return false;memcpy(dst,data,size);return true;} + + /* Private r10 block mode: 32/64/128-sample partitions with fixed-width + zigzag residuals. No unary loop, no change to reconstructed PCM. */ + if(order>=16&&order<=18){ + unsigned predorder=order-16; + if(k<5||k>7||n<=predorder||size16)return false; + unsigned end=start+(1u<n)end=n; + for(;start>1)^-(int)(z&1),pred=predorder==0?0:predorder==1?dst[start-1]:2*(int)dst[start-1]-dst[start-2]; + dst[start]=(int16_t)(pred+d); + } + } + return r.pos==size&&r.bits<8&&!(r.value&((1u<=32&&order<=34){ + unsigned po=order-32; + if(k<5||k>7||n<=po||sizen)end=n; + for(;start65535)return false; + int d=(z>>1)^-(int)(z&1),pred=po==0?0:po==1?dst[start-1]:2*(int)dst[start-1]-dst[start-2];dst[start]=(int16_t)(pred+d); + } + } + return r.pos==size&&r.bits<8&&!(r.value&((1u<2||k>15||n<=order||size65535)return false; + int d=(z>>1)^-(int)(z&1),pred=order==0?0:order==1?dst[i-1]:2*(int)dst[i-1]-dst[i-2];dst[i]=(int16_t)(pred+d); + } + return r.pos==size&&r.bits<8&&!(r.value&((1u< +#include +#include + +#define NDS_PICTURE_PIXELS (256u * 192u) +#define NDS_PICTURE_MARKER_SIZE 16u +#define NDS_PICTURE_WAIT_MARKER "CPYMO_BG_AWAIT12" +#define NDS_PICTURE_READY_MARKER "CPYMO_BG_READY12" +#define NDS_PICTURE_PLACEHOLDER 0x5a5au + +typedef struct { + unsigned char marker[NDS_PICTURE_MARKER_SIZE]; + uint16_t pixels[NDS_PICTURE_PIXELS]; +} nds_picture_embedded_record; + +/* GCC's designated range initializer emits the entire reserved image in + * immutable ROM .rodata, not zero-initialized BSS. Volatile marker reads + * below prevent constant folding of the staging marker by -O2/LTO. */ +static const nds_picture_embedded_record nds_picture_embedded + __attribute__((used,aligned(4))) = { + .marker={'C','P','Y','M','O','_','B','G','_','A','W','A','I','T','1','2'}, + .pixels={[0 ... NDS_PICTURE_PIXELS-1] = NDS_PICTURE_PLACEHOLDER} +}; + +#define nds_picture_pixels (nds_picture_embedded.pixels) + +static inline const uint16_t* nds_picture_get(void){ + const volatile unsigned char* found= + (const volatile unsigned char*)nds_picture_embedded.marker; + static const unsigned char wanted[NDS_PICTURE_MARKER_SIZE]={ + 'C','P','Y','M','O','_','B','G','_','R','E','A','D','Y','1','2'}; + for(unsigned i=0;i>5)&31u)*3u/4u; + unsigned b=((native>>10)&31u)*3u/4u; + return (uint16_t)(0x8000u|r|(g<<5)|(b<<10)); +} +static inline bool nds_picture_draw(uint16_t* target,bool interactive){ + const uint16_t* source=nds_picture_get(); + if(!source||!target)return false; + for(unsigned i=0;i +volatile unsigned compressed_state[8]={0x43504c34}; +static uint32_t npl_crc(const unsigned char* p,unsigned n){ + uint32_t a=1,b=0; + while(n){unsigned k=n>4096?4096:n;n-=k; + while(k>=8){a+=*p++;b+=a; a+=*p++;b+=a; a+=*p++;b+=a; a+=*p++;b+=a; a+=*p++;b+=a; a+=*p++;b+=a; a+=*p++;b+=a; a+=*p++;b+=a; k-=8;} + while(k--){a+=*p++;b+=a;}a%=65521;b%=65521; + }return (b<<16)|a; +} +static bool npl_length(const unsigned char* src,unsigned size,unsigned* pos,unsigned* n,unsigned limit){ + if(*n!=15)return true; + for(;;){if(*pos>=size)return false;unsigned b=src[(*pos)++];*n+=b;if(*n>limit)return false;if(b!=255)return true;} +} +static bool npl_decode(const unsigned char* src,unsigned size,unsigned char* dst,unsigned expected){ + unsigned ip=0,op=0; + while(ip>4; + if(!npl_length(src,size,&ip,&lit,expected)||lit>size-ip||lit>expected-op)return false; + memcpy(dst+op,src+ip,lit);ip+=lit;op+=lit;if(ip==size)return op==expected; + if(size-ip<2)return false;unsigned offset=src[ip]|(src[ip+1]<<8);ip+=2; + if(!offset||offset>op)return false;unsigned match=token&15; + if(!npl_length(src,size,&ip,&match,expected)||match+4>expected-op)return false;match+=4; + unsigned copied=matchcopied)n=copied;memcpy(dst+op+copied,dst+op,n);copied+=n;}op+=match; + }return op==expected; +} +static bool npl_plane(FILE* file,unsigned char* dst,unsigned bytes,unsigned char* input){ + unsigned done=0; + while(done8192)want=8192; + if(raw!=want||!stored||stored>raw||fread(input,1,stored,file)!=stored)return false; + load_phase(4,start);start=tickGetCount(); + bool ok=true;if(stored==raw)memcpy(dst+done,input,raw);else ok=npl_decode(input,stored,dst+done,raw); + unsigned decode_us=(tickGetCount()-start)*1000000/TICK_FREQ;compressed_state[3]+=decode_us;if(decode_us>compressed_state[4])compressed_state[4]=decode_us; + if(!ok)return false;start=tickGetCount();if(npl_crc(dst+done,raw)!=crc)return false; + compressed_state[5]+=(tickGetCount()-start)*1000000/TICK_FREQ; + compressed_state[1]+=raw;compressed_state[2]+=stored+8;compressed_state[6]++; + done+=raw;start=tickGetCount();nds_audio_update();load_phase(5,start); + }return true; +} diff --git a/cpymo-backends/nds/source/nps-reader.h b/cpymo-backends/nds/source/nps-reader.h new file mode 100644 index 00000000..f320c6d2 --- /dev/null +++ b/cpymo-backends/nds/source/nps-reader.h @@ -0,0 +1,57 @@ +/* NPS1: row spans, exact RGB555/alpha reconstruction. No lossy quantization. + * Bounded input buffer; omitted pixels are exactly RGB=0x8000, alpha=0. + * Like NPI1 this raw container has length/bounds checks, not a content checksum. */ +volatile unsigned sparse_state[8]={0x4e505331}; +typedef struct {FILE* file;unsigned char* bytes;unsigned pos,size,left;unsigned char* encoded;bool compressed;} NpsInput; +static bool nps_copy(NpsInput* in,unsigned char* out,unsigned n){ + while(n){ + if(in->pos==in->size){ + unsigned want=in->left>8192?8192:in->left;if(!want)return false; + u64 begin=tickGetCount(); + if(in->compressed){ + unsigned char h[8];if(fread(h,1,8,in->file)!=8)return false; + unsigned packed=h[0]|(h[1]<<8),raw=h[2]|(h[3]<<8);uint32_t check=(uint32_t)h[4]|((uint32_t)h[5]<<8)|((uint32_t)h[6]<<16)|((uint32_t)h[7]<<24); + if(raw!=want||!packed||packed>raw||(packed==raw&&check))return false; + if(fread(packed==raw?in->bytes:in->encoded,1,packed,in->file)!=packed)return false; + load_phase(4,begin);begin=tickGetCount(); + bool ok=true;if(packedencoded,packed,in->bytes,raw); + unsigned us=(tickGetCount()-begin)*1000000/TICK_FREQ;compressed_state[3]+=us;if(us>compressed_state[4])compressed_state[4]=us; + if(!ok)return false;begin=tickGetCount();if(packedbytes,raw)!=check)return false; + compressed_state[5]+=(tickGetCount()-begin)*1000000/TICK_FREQ;compressed_state[1]+=raw;compressed_state[2]+=packed+8;compressed_state[6]++; + }else if(fread(in->bytes,1,want,in->file)!=want)return false; + in->size=want;in->pos=0;in->left-=want;load_phase(4,begin); + begin=tickGetCount();nds_audio_update();load_phase(5,begin); + } + unsigned take=in->size-in->pos;if(take>n)take=n; + memcpy(out,in->bytes+in->pos,take);in->pos+=take;out+=take;n-=take; + } + return true; +} +/* 1=success, 0=bad data, -1=allocation failure, for caller cache recovery. */ +static int nps_file(FILE* file,Image* image,bool compressed){ + u64 started=tickGetCount();sparse_state[1]++; + unsigned rows=image->ph,width=image->pw,count=rows*width; + unsigned char* table=malloc(rows*4);unsigned char* buffer=malloc(8192);unsigned char* encoded=compressed?malloc(8192):NULL; + if(!table||!buffer||(compressed&&!encoded)){free(table);free(buffer);free(encoded);sparse_state[6]++;return -1;} + unsigned scratch=rows*4+8192+(compressed?8192:0);if(scratch>sparse_state[7])sparse_state[7]=scratch; + bool ok=false;u64 begin=tickGetCount();unsigned stored=0; + if(fread(table,1,rows*4,file)!=rows*4)goto done; + for(unsigned y=0;ywidth||n>width-x)goto done;stored+=n; + } + if(!compressed&&!image_sequential&&(fseek(file,0,SEEK_END)||ftell(file)!=(long)(16+rows*4+stored*3)||fseek(file,16+rows*4,SEEK_SET)))goto done; + load_phase(4,begin); + for(unsigned i=0;ipx[i]=0x8000; + memset(image->mask,0,count); + NpsInput in={file,buffer,0,0,stored*3,encoded,compressed}; + for(unsigned plane=0;plane<2;plane++)for(unsigned y=0;ymask+y*width+x:(unsigned char*)(image->px+y*width+x); + if(!nps_copy(&in,out,n*(plane?1:2)))goto done; + } + ok=in.left==0&&in.pos==in.size&&fgetc(file)==EOF&&!ferror(file); +done:free(table);free(buffer);free(encoded); + if(ok){unsigned us=(tickGetCount()-started)*1000000/TICK_FREQ;sparse_state[2]+=count*3;sparse_state[3]+=16+rows*4+stored*3;sparse_state[4]+=us;if(us>sparse_state[5])sparse_state[5]=us;}else sparse_state[6]++; + return ok; +} diff --git a/cpymo-backends/nds/source/opaque-span-r12.h b/cpymo-backends/nds/source/opaque-span-r12.h new file mode 100644 index 00000000..d054215d --- /dev/null +++ b/cpymo-backends/nds/source/opaque-span-r12.h @@ -0,0 +1,17 @@ +/* Exact largest 255-alpha run. Aligned word scan, scalar edges/mixed words. + * A run is metadata only; failure to allocate it keeps the generic renderer. */ +#include +typedef uint32_t OpaqueWord __attribute__((__may_alias__)); +static void opaque_span(const unsigned char* row,int left,int right,uint16_t* out){ + int x=left,start=left,best_l=left,best_r=left; +#define OPAQUE_STEP() do{if(row[x]!=255){if(x-start>best_r-best_l){best_l=start;best_r=x;}start=x+1;}x++;}while(0) + while(xbest_r-best_l){best_l=start;best_r=right;} + out[0]=best_l;out[1]=best_r; +} diff --git a/cpymo-backends/nds/source/pixel-font-nds.h b/cpymo-backends/nds/source/pixel-font-nds.h new file mode 100644 index 00000000..93ad015f --- /dev/null +++ b/cpymo-backends/nds/source/pixel-font-nds.h @@ -0,0 +1,56 @@ +/* NDS native bitmap fonts. Backend code AGPL-3.0-or-later; glyph data OFL-1.1. */ +typedef struct {u32 code;u8 advance,pad[3];u16 rows[16];} PixelGlyph; +typedef struct {PixelGlyph* data;unsigned count,width,height,baseline,nominal;} PixelFont; +static PixelFont pixel_fonts[2]; +static unsigned font_choice; +/* magic, available, choice, changes, setting write error, small count, large count */ +volatile unsigned font_state[7]={0x4e504631}; +static void free_pixel_fonts(void){for(unsigned i=0;i<2;i++){free(pixel_fonts[i].data);memset(&pixel_fonts[i],0,sizeof pixel_fonts[i]);}font_state[1]=0;} +static bool read_pixel_font(PixelFont* out,const char* dir,const char* name,unsigned nominal){ + char path[512];snprintf(path,sizeof path,"%s/nds-cache/font-%s.bin",dir,name);FILE* f=fopen(path,"rb");if(!f)return false; + struct {char magic[4];u32 count;u8 width,height,baseline,nominal;} h; + bool ok=fread(&h,1,sizeof h,f)==sizeof h&&!memcmp(h.magic,"NPF1",4)&&h.count>0&&h.count<=20000&&h.width==16&&h.height==16&&h.baseline<=16&&h.nominal==nominal; + PixelGlyph* data=ok?malloc(h.count*sizeof *data):NULL;ok=ok&&data; + if(ok)ok=fread(data,sizeof *data,h.count,f)==h.count&&fgetc(f)==EOF; + fclose(f); + for(unsigned i=0;ok&&i=data[i].code)||data[i].advance>32)ok=false; + if(!ok){free(data);return false;} + *out=(PixelFont){data,h.count,h.width,h.height,h.baseline,h.nominal};return true; +} +static bool load_pixel_fonts(const char* dir){ + free_pixel_fonts();font_choice=0;memset((void*)(font_state+1),0,sizeof font_state-sizeof font_state[0]); + char path[512];snprintf(path,sizeof path,"%s/nds-cache/font-small.bin",dir);FILE* f=fopen(path,"rb"); + if(!f)return true; /* Old converted packages retain NF13 support. */ + fclose(f); + if(!read_pixel_font(&pixel_fonts[0],dir,"small",12)||!read_pixel_font(&pixel_fonts[1],dir,"large",16)){free_pixel_fonts();return false;} + font_state[1]=1;font_state[5]=pixel_fonts[0].count;font_state[6]=pixel_fonts[1].count; + snprintf(path,sizeof path,"%s/save/nds-font.cfg",dir);f=fopen(path,"rb");if(f){char setting[16]={0};fread(setting,1,sizeof setting-1,f);fclose(f);if(!strcmp(setting,"NDSFONT1 1\n"))font_choice=1;} + font_state[2]=font_choice;return true; +} +int nds_font_choices_available(void){return font_state[1]!=0;} +int nds_font_choice_get(void){return font_choice;} +static unsigned text_native_pixels(void){return nds_font_choices_available()?pixel_fonts[font_choice].nominal:13;} +void nds_font_choice_set(int choice){ + if(!nds_font_choices_available()||choice<0||choice>1)return; + font_choice=choice;font_state[2]=choice;font_state[3]++;enforce_text_readability(); + char path[512];snprintf(path,sizeof path,"%s/save/nds-font.cfg",engine.assetloader.gamedir);FILE* f=fopen(path,"wb");bool ok=false; + if(f){ok=fprintf(f,"NDSFONT1 %u\n",font_choice)>0;if(fclose(f))ok=false;}font_state[4]=!ok; +} +static unsigned active_font_mode(void){return nds_font_choices_available()?font_choice+1:0;} +static unsigned text_glyph_base(unsigned mode){return mode?pixel_fonts[mode-1].count:BUILTIN_GLYPHS+game_glyph_count;} +static int text_glyph(unsigned mode,unsigned cp){ + int g=-1;if(!mode)g=glyph(cp);else{PixelFont* f=&pixel_fonts[mode-1];int lo=0,hi=f->count-1;while(lo<=hi){int m=(lo+hi)/2;if(f->data[m].code==cp){g=m;break;}if(f->data[m].code=0)return g;int fallback=ui_fallback_glyph(cp);return fallback<0?-1:text_glyph_base(mode)+fallback; +} +static unsigned text_advance(unsigned mode,int g){unsigned base=text_glyph_base(mode);if((unsigned)g>=base)return mode==2?ui_large_advances[g-base]:ui_fallback_advances[g-base];return mode?pixel_fonts[mode-1].data[g].advance:glyph_advance(g);} +static unsigned text_row(unsigned mode,int g,int y){unsigned base=text_glyph_base(mode);if((unsigned)g>=base)return mode==2?ui_large_rows[g-base][y]:ui_fallback_rows[g-base][y];return mode?pixel_fonts[mode-1].data[g].rows[y]:glyph_row(g,y);} +static unsigned font_nominal(unsigned mode){return mode?pixel_fonts[mode-1].nominal:13;} +static unsigned font_width(unsigned mode){return mode?16:13;} +static unsigned font_height(unsigned mode){return mode?16:14;} +static unsigned font_baseline(unsigned mode){return mode?pixel_fonts[mode-1].baseline:11;} +static float font_scale(float size,unsigned mode){ + if(mode){/* Preserve the bitmap grid, including authored large text. */ + int integer=(int)(size*display_scale()/font_nominal(mode)+.5f);return integer<1?1:integer; + } + float pixels=(int)(size*display_scale()+.5f);return (pixels<13?13:pixels)/13.f; +} diff --git a/cpymo-backends/nds/source/preferences-nds.h b/cpymo-backends/nds/source/preferences-nds.h new file mode 100644 index 00000000..69386f9b --- /dev/null +++ b/cpymo-backends/nds/source/preferences-nds.h @@ -0,0 +1,52 @@ +/* NDS per-game preferences; AGPL-3.0-or-later. */ +static int nds_read_gray=1; +static int nds_chara_effects=1; +/* magic, enabled, instant transition batches, writes, write errors */ +volatile unsigned chara_effect_state[5]={0x4e434658,1}; +static bool nds_playing,nds_aux_override,nds_touch_blocked,error_ui_active; +/* magic, gray, policy, hidden, backlight mask, writes, errors, touch wakes, + Y toggles, loaded, textbox alpha/1000, UI open */ +volatile unsigned ui_preferences_state[12]={0x4e555031}; +static void nds_aux_refresh(void); +static void launcher_toast(const char* message); +static void nds_global_preferences_load(void){ + nds_chara_effects=1;FILE* f=fopen("/pymo/nds-global.cfg","rb"); + if(f){char line[64];int value,n=0; + if(fgets(line,sizeof line,f)&&sscanf(line,"NDSGLOBAL1 %d %n",&value,&n)==1&&n>0&&line[n]==0&&fgetc(f)==EOF&&value>=0&&value<=1)nds_chara_effects=value; + fclose(f); + }chara_effect_state[1]=nds_chara_effects; +} +int nds_chara_effects_get(void){return nds_chara_effects;} +void nds_chara_effects_set(int value){ + if(value<0||value>1)return;nds_chara_effects=value;chara_effect_state[1]=value; + FILE* f=fopen("/pymo/nds-global.cfg","wb");bool ok=false; + if(f){ok=fprintf(f,"NDSGLOBAL1 %d\n",value)>0;if(fclose(f))ok=false;} + chara_effect_state[3]++;if(!ok){chara_effect_state[4]++;launcher_toast(nds_ui("设置保存失败"));} +} +static bool nds_aux_hidden(void){return nds_playing&&!error_ui_active&&nds_aux_override;} +static void nds_preferences_sync(void){ + ui_preferences_state[1]=nds_read_gray;ui_preferences_state[2]=engine.say.current_say_is_already_read; + ui_preferences_state[3]=nds_aux_hidden(); + ui_preferences_state[10]=(unsigned)(engine.say.textbox.alpha*1000+.5f); + ui_preferences_state[11]=cpymo_ui_enabled(&engine); +} +static void nds_preferences_load(const char* dir){ + nds_read_gray=1;nds_aux_override=false;nds_touch_blocked=false; + ui_preferences_state[9]=0; + char path[512],line[64];snprintf(path,sizeof path,"%s/save/nds-ui.cfg",dir); + FILE* f=fopen(path,"rb");if(f){int gray,n=0; + if(fgets(line,sizeof line,f)&&sscanf(line,"NDSUI1 %d %n",&gray,&n)==1&&n>0&&line[n]==0&&fgetc(f)==EOF&&gray>=0&&gray<=1){nds_read_gray=gray;ui_preferences_state[9]=1;} + fclose(f); + }nds_preferences_sync(); +} +static void nds_preferences_save(void){ + char path[512];snprintf(path,sizeof path,"%s/save/nds-ui.cfg",engine.assetloader.gamedir); + FILE* f=nds_save_ensure_directory(engine.assetloader.gamedir)?fopen(path,"wb"):NULL;bool ok=false;if(f){ok=fprintf(f,"NDSUI1 %d\n",nds_read_gray)>0;if(fclose(f))ok=false;} + ui_preferences_state[5]++;if(!ok){ui_preferences_state[6]++;launcher_toast(nds_ui("设置保存失败"));}nds_preferences_sync(); +} +int nds_read_gray_get(void){return nds_read_gray;} +void nds_read_gray_set(int value){ + if(value<0||value>1)return;nds_read_gray=value; + engine.say.textbox.alpha=engine.say.current_say_is_already_read&&value?.6f:1.f; + nds_preferences_save();cpymo_engine_request_redraw(&engine); +} diff --git a/cpymo-backends/nds/source/save-dir-nds.h b/cpymo-backends/nds/source/save-dir-nds.h new file mode 100644 index 00000000..c246a094 --- /dev/null +++ b/cpymo-backends/nds/source/save-dir-nds.h @@ -0,0 +1,30 @@ +/* Per-game NDS FAT save path policy, host-testable and independent of libnds. + * Existing saves are never deleted or replaced when their directory exists. */ +#ifndef CPYMO_NDS_SAVE_DIR_H +#define CPYMO_NDS_SAVE_DIR_H +#include +#include +#include +#include + +static inline int nds_save_ensure_directory(const char* gamedir){ + if(!gamedir || !*gamedir)return 0; + char dir[512]; + int count=snprintf(dir,sizeof(dir),"%s/save",gamedir); + if(count<0 || (size_t)count>=sizeof(dir))return 0; + if(mkdir(dir,0777)==0)return 1; + if(errno!=EEXIST)return 0; + struct stat st; + return stat(dir,&st)==0 && S_ISDIR(st.st_mode); +} + +static inline FILE* nds_save_fopen(const char* gamedir,const char* name,const char* mode){ + if(!gamedir||!name||!mode||!name[0]||!mode[0])return NULL; + if((strchr(mode,'w')||strchr(mode,'a')) && !nds_save_ensure_directory(gamedir)) + return NULL; + char path[512]; + int count=snprintf(path,sizeof(path),"%s/save/%s",gamedir,name); + if(count<0 || (size_t)count>=sizeof(path))return NULL; + return fopen(path,mode); +} +#endif diff --git a/cpymo-backends/nds/source/theme-nds.h b/cpymo-backends/nds/source/theme-nds.h new file mode 100644 index 00000000..062547f4 --- /dev/null +++ b/cpymo-backends/nds/source/theme-nds.h @@ -0,0 +1,110 @@ +/* v1.2.1 test: NDS/DS Lite IPL theme palette, no game-asset changes. */ +#ifndef CPYMO_NDS_THEME_H +#define CPYMO_NDS_THEME_H +#include +/* NITRO Programming Manual, IPL favorite colors: 5-bit RGB 0..15. */ +static const unsigned char nds_ipl_theme_rgb[16][3]={ + {12,16,19},{23,9,0},{31,0,3},{31,17,31}, + {31,18,0},{30,28,0},{21,31,0},{0,31,0}, + {0,20,7},{9,27,17},{6,23,30},{0,11,30}, + {0,0,18},{17,0,26},{26,0,29},{31,0,18} +}; +static const char* const nds_ipl_theme_names[4][16]={ + {"灰蓝","棕色","红色","粉色","橙色","黄色","青柠","绿色","深绿","青绿","浅蓝","蓝色","深蓝","深紫","淡紫","洋红"}, + {"Grey blue","Brown","Red","Pink","Orange","Yellow","Lime","Green","Dark green","Sea green","Cyan","Blue","Dark blue","Purple","Violet","Magenta"}, + {"灰藍","棕色","紅色","粉色","橘色","黃色","青檸","綠色","深綠","青綠","淺藍","藍色","深藍","深紫","淡紫","洋紅"}, + {"グレー","ブラウン","赤","ピンク","オレンジ","黄色","ライム","緑","深緑","青緑","水色","青","濃紺","紫","薄紫","マゼンタ"} +}; +/* 0=original default; 1=firmware Auto; 2..17=the sixteen IPL colors. */ +static unsigned nds_theme_preference; +static int nds_theme_effective_index=-1; +typedef struct { + u16 bg,header,card,selected,accent,primary,muted,detail,clock,aux_clock,rail; +} NdsThemeScheme; +static NdsThemeScheme nds_theme_scheme; + +/* Firmware is read only at boot or explicit theme changes, never on a pixel. */ +static unsigned nds_theme_firmware(void){ + if(g_envUserSettings->version!=5||PersonalData->settingsLost||PersonalData->theme>15)return 16; + return PersonalData->theme; +} +static u16 nds_theme_tint(unsigned idx,unsigned strength,unsigned neutral){ + const unsigned char* c=nds_ipl_theme_rgb[idx]; + return RGB15(neutral+(c[0]*strength+15)/31, + neutral+(c[1]*strength+15)/31, + neutral+(c[2]*strength+15)/31); +} +static void nds_theme_resolve(void){ + int idx=-1; + if(nds_theme_preference==1){ + unsigned firmware=nds_theme_firmware(); + if(firmware<16)idx=(int)firmware; + }else if(nds_theme_preference>=2&&nds_theme_preference<=17){ + idx=(int)nds_theme_preference-2; + } + nds_theme_effective_index=idx; + if(idx<0){ + /* Keep original default color roles intact; B rail is the only change. */ + nds_theme_scheme=(NdsThemeScheme){ + RGB15(3,5,8),RGB15(5,10,16),RGB15(4,7,11),RGB15(7,15,23), + RGB15(10,24,31),RGB15(31,31,31),RGB15(19,22,25), + RGB15(26,27,29),RGB15(26,28,30),RGB15(21,24,27), + RGB15(15,26,30)}; + }else{ + unsigned i=(unsigned)idx; + /* Every role derives from the original IPL hue, never a blue base. + * All color sums fit RGB555 without overflowing a 5-bit component. */ + nds_theme_scheme=(NdsThemeScheme){ + nds_theme_tint(i,6,1),nds_theme_tint(i,11,3), + nds_theme_tint(i,9,3),nds_theme_tint(i,11,4), + /* Approved A typography: neutral primary, hue-aware accents, + * softened secondary/detail/clock ink. Keep every surface and rail. */ + nds_theme_tint(i,13,17),RGB15(30,30,30), + nds_theme_tint(i,3,23),nds_theme_tint(i,3,24), + nds_theme_tint(i,2,24),nds_theme_tint(i,3,23), + nds_theme_tint(i,13,13)}; + } +} +static int nds_theme_active_index(void){return nds_theme_effective_index;} +static void nds_theme_load(void){ + nds_theme_preference=0; + FILE* f=fopen("/pymo/nds-theme.cfg","rb"); + if(f){ + char line[32]={0};unsigned v=18;int n=0; + if(fgets(line,sizeof line,f)&&sscanf(line,"NDSTHEME1 %u %n",&v,&n)==1 + && n>0&&line[n]==0&&fgetc(f)==EOF&&v<=17)nds_theme_preference=v; + fclose(f); + } + nds_theme_resolve(); +} +static int nds_theme_set(unsigned v){ + if(v>17)return 0; + mkdir("/pymo",0777);FILE* f=fopen("/pymo/nds-theme.cfg","wb");int ok=0; + if(f){ok=fprintf(f,"NDSTHEME1 %u\n",v)>0;if(fclose(f))ok=0;} + if(ok){nds_theme_preference=v;nds_theme_resolve();} + return ok; +} +static unsigned nds_theme_get(void){return nds_theme_preference;} +static u16 nds_theme_color(unsigned id){ + if(id>15)id=0; + return RGB15(nds_ipl_theme_rgb[id][0],nds_ipl_theme_rgb[id][1],nds_ipl_theme_rgb[id][2]); +} +static const char* nds_theme_choice_name(unsigned v){ + if(v==0)return nds_ui("默认"); + if(v==1)return nds_ui("自动"); + if(v>17)return "?"; + return nds_ipl_theme_names[nds_language_effective()][v-2]; +} +/* Constant-time palette lookups, including when the preference is Auto. */ +static u16 nds_theme_bg(void){return nds_theme_scheme.bg;} +static u16 nds_theme_header(void){return nds_theme_scheme.header;} +static u16 nds_theme_card(void){return nds_theme_scheme.card;} +static u16 nds_theme_selected(void){return nds_theme_scheme.selected;} +static u16 nds_theme_accent(void){return nds_theme_scheme.accent;} +static u16 nds_theme_primary(void){return nds_theme_scheme.primary;} +static u16 nds_theme_muted(void){return nds_theme_scheme.muted;} +static u16 nds_theme_detail(void){return nds_theme_scheme.detail;} +static u16 nds_theme_clock_ink(void){return nds_theme_scheme.clock;} +static u16 nds_theme_aux_clock_ink(void){return nds_theme_scheme.aux_clock;} +static u16 nds_theme_rail(void){return nds_theme_scheme.rail;} +#endif diff --git a/cpymo-backends/nds/source/ui-fallback-font.h b/cpymo-backends/nds/source/ui-fallback-font.h new file mode 100644 index 00000000..ca1cbe1f --- /dev/null +++ b/cpymo-backends/nds/source/ui-fallback-font.h @@ -0,0 +1,1197 @@ +/* Generated by tools/generate-ui-font.py. Do not hand-edit. + Fusion Pixel 12px / GNU Unifont 16px subsets, OFL-1.1. + See licenses/Fusion-OFL.txt and licenses/Unifont/. */ +static const unsigned ui_fallback_codes[]={32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,183,12289,12290,12354,12356,12360,12363,12364,12365,12367,12369,12371,12373,12375,12377,12379,12383,12384,12385,12387,12388,12390,12391,12392,12394,12395,12398,12399,12408,12409,12414,12415,12416,12418,12420,12425,12426,12427,12428,12434,12435,12449,12450,12452,12456,12458,12459,12461,12463,12464,12466,12467,12469,12471,12472,12473,12474,12475,12479,12481,12483,12484,12488,12489,12491,12496,12497,12501,12502,12503,12512,12513,12514,12515,12517,12519,12521,12522,12523,12524,12525,12531,12539,12540,19968,19969,19978,19979,19981,19982,20004,20006,20013,20026,20043,20048,20063,20102,20110,20132,20165,20171,20184,20195,20197,20214,20250,20294,20301,20303,20307,20316,20320,20351,20381,20415,20445,20462,20648,20677,20786,20808,20837,20840,20841,20849,20851,20855,20869,20877,20986,20999,21010,21015,21021,21040,21047,21069,21152,21160,21161,21177,21205,21253,21270,21315,21333,21345,21382,21407,21442,21450,21452,21453,21462,21464,21482,21487,21488,21490,21495,21517,21518,21527,21547,21551,21578,21644,21796,21843,21855,21914,21934,21966,22238,22312,22351,22495,22519,22577,22686,22750,22768,22788,22793,22797,22799,22823,22833,22841,22846,22909,22987,23383,23384,23433,23450,23455,23545,23550,23558,23559,23565,23567,23616,23631,23646,23706,24037,24050,24102,24120,24149,24179,24182,24211,24213,24230,24235,24314,24320,24335,24341,24375,24378,24403,24452,24456,24460,24465,24467,24489,24515,24517,24540,24555,24615,24687,24773,24930,25014,25103,25110,25138,25147,25163,25165,25191,25214,25246,25276,25321,25345,25353,25407,25439,25442,25475,25480,25511,25551,25554,25563,25613,25799,25805,25806,25903,25918,25925,25928,25943,25968,25976,25991,26009,26032,26044,26080,26082,26085,26174,26178,26223,26263,26360,26367,26368,26371,26376,26377,26410,26412,26426,26448,26524,26597,26679,26680,26694,26696,26723,26816,26893,26908,27138,27161,27169,27171,27231,27284,27298,27402,27425,27491,27492,27511,27721,27770,27809,27861,28040,28155,28168,28216,28304,28310,28450,28784,28858,28961,29031,29256,29305,29486,29563,29702,29992,30005,30011,30028,30041,30059,30070,30340,30452,30636,30721,30830,30906,30908,31034,31227,31435,31456,31471,31616,32026,32032,32034,32048,32066,32080,32117,32147,32154,32218,32321,32362,32380,32396,32447,32463,32467,32472,32487,32493,32531,32622,32626,32763,32773,32930,32972,33021,33041,33050,33126,33139,33258,33267,33287,33521,33756,34255,34389,34722,34892,34917,34920,35013,35036,35037,35201,35211,35239,35265,35302,35320,35328,35352,35373,35377,35379,35430,35441,35442,35443,35469,35486,35492,35501,35531,35696,35712,35722,35758,35768,35774,35775,35797,35805,35813,35814,35821,35823,35831,35835,36002,36039,36129,36133,36164,36215,36335,36617,36628,36629,36681,36716,36731,36733,36741,36796,36816,36820,36827,36864,36873,36890,36895,36914,36933,36938,36984,37096,37197,37325,37327,37679,38169,38263,38283,38291,38364,38382,38388,38468,38544,38556,38560,38568,38577,38617,38651,38656,38754,38899,38917,39023,39033,39304,39636,40657,65292,65295,65306,65311}; +static const unsigned char ui_fallback_advances[]={6,4,6,7,6,8,7,4,6,6,6,6,4,6,4,6,6,6,6,6,6,6,6,6,6,6,4,4,5,6,5,6,8,8,7,7,7,7,7,7,7,4,6,7,6,8,7,8,7,8,7,7,8,7,8,10,8,8,7,6,6,6,6,6,5,6,6,6,6,6,5,6,6,4,4,6,4,8,6,6,6,6,5,6,5,6,6,8,6,6,6,7,4,7,6,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12}; +static const unsigned short ui_fallback_rows[][16]={ +{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, +{0,0,0,0,2,2,2,2,2,2,2,0,2,0,0,0}, +{0,0,0,0,10,10,10,0,0,0,0,0,0,0,0,0}, +{0,0,0,0,18,18,63,18,18,18,63,18,18,0,0,0}, +{0,0,0,4,14,21,5,5,14,20,20,21,14,4,0,0}, +{0,0,0,0,34,37,18,16,8,4,36,82,34,0,0,0}, +{0,0,0,0,12,18,18,12,38,41,17,17,46,0,0,0}, +{0,0,0,0,2,2,2,0,0,0,0,0,0,0,0,0}, +{0,0,0,8,4,4,2,2,2,2,2,4,4,8,0,0}, +{0,0,0,2,4,4,8,8,8,8,8,4,4,2,0,0}, +{0,0,0,0,0,0,0,4,21,14,21,4,0,0,0,0}, +{0,0,0,0,0,0,0,4,4,31,4,4,0,0,0,0}, +{0,0,0,0,0,0,0,0,0,0,0,0,2,2,1,0}, +{0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0}, +{0,0,0,16,16,8,8,4,4,4,2,2,1,1,0,0}, +{0,0,0,0,14,17,17,25,21,19,17,17,14,0,0,0}, +{0,0,0,0,4,6,4,4,4,4,4,4,14,0,0,0}, +{0,0,0,0,14,17,16,16,8,4,2,1,31,0,0,0}, +{0,0,0,0,14,17,16,16,12,16,16,17,14,0,0,0}, +{0,0,0,0,8,12,12,10,10,9,31,8,8,0,0,0}, +{0,0,0,0,31,1,1,1,15,16,16,17,14,0,0,0}, +{0,0,0,0,14,17,1,1,15,17,17,17,14,0,0,0}, +{0,0,0,0,31,16,16,8,8,4,4,4,4,0,0,0}, +{0,0,0,0,14,17,17,17,14,17,17,17,14,0,0,0}, +{0,0,0,0,14,17,17,17,30,16,16,17,14,0,0,0}, +{0,0,0,0,0,0,0,2,0,0,0,0,2,0,0,0}, +{0,0,0,0,0,0,0,2,0,0,0,0,2,2,1,0}, +{0,0,0,0,0,0,8,4,2,1,2,4,8,0,0,0}, +{0,0,0,0,0,0,0,0,31,0,31,0,0,0,0,0}, +{0,0,0,0,0,0,1,2,4,8,4,2,1,0,0,0}, +{0,0,0,0,14,17,16,16,8,4,4,0,4,0,0,0}, +{0,0,0,0,28,34,89,85,85,85,85,109,2,60,0,0}, +{0,0,0,0,8,8,20,20,34,62,34,65,65,0,0,0}, +{0,0,0,0,31,33,33,33,31,33,33,33,31,0,0,0}, +{0,0,0,0,28,34,1,1,1,1,1,34,28,0,0,0}, +{0,0,0,0,15,17,33,33,33,33,33,17,15,0,0,0}, +{0,0,0,0,63,1,1,1,31,1,1,1,63,0,0,0}, +{0,0,0,0,63,1,1,1,31,1,1,1,1,0,0,0}, +{0,0,0,0,28,34,1,1,1,49,33,34,60,0,0,0}, +{0,0,0,0,33,33,33,33,63,33,33,33,33,0,0,0}, +{0,0,0,0,7,2,2,2,2,2,2,2,7,0,0,0}, +{0,0,0,0,16,16,16,16,16,16,17,17,14,0,0,0}, +{0,0,0,0,33,17,9,5,3,5,9,17,33,0,0,0}, +{0,0,0,0,1,1,1,1,1,1,1,1,31,0,0,0}, +{0,0,0,0,65,65,99,99,85,85,73,73,73,0,0,0}, +{0,0,0,0,33,35,37,37,41,41,49,49,33,0,0,0}, +{0,0,0,0,28,34,65,65,65,65,65,34,28,0,0,0}, +{0,0,0,0,31,33,33,33,31,1,1,1,1,0,0,0}, +{0,0,0,0,28,34,65,65,65,65,81,34,92,0,0,0}, +{0,0,0,0,31,33,33,33,31,9,17,17,33,0,0,0}, +{0,0,0,0,30,33,1,2,12,16,32,33,30,0,0,0}, +{0,0,0,0,127,8,8,8,8,8,8,8,8,0,0,0}, +{0,0,0,0,33,33,33,33,33,33,33,33,30,0,0,0}, +{0,0,0,0,65,65,34,34,34,20,20,8,8,0,0,0}, +{0,0,0,0,273,273,273,170,170,170,68,68,68,0,0,0}, +{0,0,0,0,65,34,34,20,8,20,34,34,65,0,0,0}, +{0,0,0,0,65,34,34,20,20,8,8,8,8,0,0,0}, +{0,0,0,0,63,32,16,8,4,4,2,1,63,0,0,0}, +{0,0,0,14,2,2,2,2,2,2,2,2,2,14,0,0}, +{0,0,0,1,1,2,2,4,4,4,8,8,16,16,0,0}, +{0,0,0,14,8,8,8,8,8,8,8,8,8,14,0,0}, +{0,0,0,0,4,10,17,0,0,0,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0}, +{0,0,0,0,2,4,0,0,0,0,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,14,16,30,17,17,30,0,0,0}, +{0,0,0,0,1,1,1,15,17,17,17,17,15,0,0,0}, +{0,0,0,0,0,0,0,14,17,1,1,17,14,0,0,0}, +{0,0,0,0,16,16,16,30,17,17,17,17,30,0,0,0}, +{0,0,0,0,0,0,0,14,17,31,1,17,14,0,0,0}, +{0,0,0,0,12,2,2,15,2,2,2,2,2,0,0,0}, +{0,0,0,0,0,0,0,30,17,17,17,17,30,16,14,0}, +{0,0,0,0,1,1,1,13,19,17,17,17,17,0,0,0}, +{0,0,0,0,2,0,0,3,2,2,2,2,7,0,0,0}, +{0,0,0,0,4,0,0,7,4,4,4,4,4,4,3,0}, +{0,0,0,0,1,1,1,17,13,3,5,9,17,0,0,0}, +{0,0,0,0,3,2,2,2,2,2,2,2,6,0,0,0}, +{0,0,0,0,0,0,0,55,73,73,73,73,73,0,0,0}, +{0,0,0,0,0,0,0,13,19,17,17,17,17,0,0,0}, +{0,0,0,0,0,0,0,14,17,17,17,17,14,0,0,0}, +{0,0,0,0,0,0,0,15,17,17,17,17,15,1,1,0}, +{0,0,0,0,0,0,0,30,17,17,17,17,30,16,16,0}, +{0,0,0,0,0,0,0,13,3,1,1,1,1,0,0,0}, +{0,0,0,0,0,0,0,14,17,6,8,17,14,0,0,0}, +{0,0,0,0,2,2,2,15,2,2,2,2,12,0,0,0}, +{0,0,0,0,0,0,0,17,17,17,17,25,22,0,0,0}, +{0,0,0,0,0,0,0,17,17,10,10,4,4,0,0,0}, +{0,0,0,0,0,0,0,73,73,85,85,34,34,0,0,0}, +{0,0,0,0,0,0,0,17,10,4,4,10,17,0,0,0}, +{0,0,0,0,0,0,0,17,17,17,10,10,4,4,3,0}, +{0,0,0,0,0,0,0,31,8,4,2,1,31,0,0,0}, +{0,0,0,24,4,4,4,4,2,4,4,4,4,24,0,0}, +{0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0}, +{0,0,0,6,8,8,8,8,16,8,8,8,8,6,0,0}, +{0,0,0,0,0,0,0,2,21,8,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,0,96,96,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,0,0,0,0,2,12,8,0,0}, +{0,0,0,0,0,0,0,0,0,0,12,18,18,12,0,0}, +{0,0,0,16,16,1022,16,504,660,1170,1105,1057,529,398,0,0}, +{0,0,0,0,257,257,513,513,513,1025,1057,1058,18,12,0,0}, +{0,0,0,24,224,0,510,128,64,32,80,72,68,1923,0,0}, +{0,0,0,8,264,520,1151,1160,136,136,132,132,130,97,0,0}, +{0,0,0,1288,1288,8,639,1160,1160,136,132,132,130,97,0,0}, +{0,0,0,16,510,32,2047,64,128,508,514,2,4,504,0,0}, +{0,0,0,512,256,192,48,12,2,12,48,192,256,512,0,0}, +{0,0,0,130,130,129,2041,129,129,129,129,130,66,48,0,0}, +{0,0,0,0,508,0,0,0,0,4,2,2,2,1020,0,0}, +{0,0,0,32,32,2047,64,128,504,516,2,2,4,504,0,0}, +{0,0,0,2,2,2,2,2,2,2,514,514,260,248,0,0}, +{0,0,0,64,64,2047,64,112,72,72,112,64,32,24,0,0}, +{0,0,0,132,132,132,2047,132,132,132,100,4,4,1016,0,0}, +{0,0,0,8,8,255,8,996,4,4,34,18,17,993,0,0}, +{0,0,0,1288,1288,255,8,996,4,4,34,18,17,993,0,0}, +{0,0,0,16,16,1023,8,8,252,258,512,512,256,252,0,0}, +{0,0,0,0,0,0,248,262,512,512,512,512,384,120,0,0}, +{0,0,0,0,240,268,515,1024,1024,1024,1024,512,384,112,0,0}, +{0,0,0,0,2032,79,32,32,16,16,16,16,32,960,0,0}, +{0,0,0,0,2032,79,1312,1312,16,16,16,16,32,960,0,0}, +{0,0,0,4,4,776,200,48,12,2,1,1,2,1020,0,0}, +{0,0,0,8,392,575,1028,132,130,130,241,393,648,1136,0,0}, +{0,0,0,2,2034,1,1,1,1,33,17,17,18,2018,0,0}, +{0,0,0,0,504,548,1058,1057,1057,1041,1041,521,262,192,0,0}, +{0,0,0,130,130,129,2041,129,129,129,241,393,650,1138,0,0}, +{0,0,0,0,0,16,40,68,68,130,257,1536,0,0,0,0}, +{0,0,0,0,640,656,40,68,68,130,257,1536,0,0,0,0}, +{0,0,0,32,510,32,32,1023,32,32,60,98,162,284,0,0}, +{0,0,0,62,32,288,288,508,802,1297,273,137,134,64,0,0}, +{0,0,0,8,520,1151,1032,8,14,9,521,526,520,496,0,0}, +{0,0,0,8,8,255,8,8,255,516,516,516,264,240,0,0}, +{0,0,0,68,68,900,1128,1052,1035,528,400,32,32,32,0,0}, +{0,0,0,48,192,4,4,242,266,518,512,512,384,112,0,0}, +{0,0,0,114,138,262,258,258,258,258,256,256,128,112,0,0}, +{0,0,0,510,128,64,32,496,524,1027,1048,1060,804,248,0,0}, +{0,0,0,4,4,196,303,276,268,262,134,133,1157,772,0,0}, +{0,0,0,16,16,510,8,56,1860,226,81,72,8,2032,0,0}, +{0,0,0,32,32,16,16,8,56,68,1092,1090,578,385,0,0}, +{0,0,0,0,0,510,256,272,144,80,16,16,8,4,0,0}, +{0,0,0,0,1023,512,528,272,144,80,16,16,8,6,0,0}, +{0,0,0,256,128,64,48,44,35,32,32,32,32,32,0,0}, +{0,0,0,0,1022,32,32,32,32,32,32,32,2047,0,0,0}, +{0,0,0,128,128,128,2047,192,160,144,140,131,128,96,0,0}, +{0,0,0,16,16,16,2047,1040,1040,1040,1032,1032,1028,899,0,0}, +{0,0,0,16,16,16,1023,32,32,32,1023,64,64,64,0,0}, +{0,0,0,8,8,504,260,258,129,128,64,32,24,6,0,0}, +{0,0,0,1288,1288,248,260,258,129,128,64,32,24,6,0,0}, +{0,0,0,1284,1284,4,2044,130,129,128,64,64,48,12,0,0}, +{0,0,0,0,1023,512,512,512,512,512,512,512,1023,0,0,0}, +{0,0,0,0,132,132,1023,132,132,132,128,128,64,60,0,0}, +{0,0,0,6,24,0,0,515,524,256,128,64,48,14,0,0}, +{0,0,0,1286,1304,0,0,515,524,256,128,64,48,14,0,0}, +{0,0,0,0,511,256,256,128,128,64,160,272,524,1027,0,0}, +{0,0,0,1280,1280,255,128,128,64,64,160,272,524,1027,0,0}, +{0,0,0,8,8,8,1928,1144,527,520,264,8,8,1008,0,0}, +{0,0,0,8,8,1016,516,522,273,288,192,64,48,14,0,0}, +{0,0,0,768,192,62,32,32,2047,32,32,32,16,14,0,0}, +{0,0,0,0,0,0,530,548,548,256,256,128,96,24,0,0}, +{0,0,0,0,1041,1041,1058,546,512,256,256,128,96,28,0,0}, +{0,0,0,4,4,4,4,28,100,388,4,4,4,4,0,0}, +{0,0,0,4,644,644,4,28,100,388,4,4,4,4,0,0}, +{0,0,0,0,0,1022,0,0,0,0,0,0,2047,0,0,0}, +{0,0,0,1280,1416,136,136,260,260,260,514,514,1025,1025,0,0}, +{0,0,0,512,1416,648,136,260,260,260,514,514,1025,1025,0,0}, +{0,0,0,0,0,1023,512,512,512,256,256,128,96,28,0,0}, +{0,0,0,1280,1280,1023,512,512,512,256,256,128,96,28,0,0}, +{0,0,0,512,1280,767,256,256,256,128,128,64,48,12,0,0}, +{0,0,0,32,32,16,16,8,264,260,516,898,1138,1039,0,0}, +{0,0,0,256,256,256,256,140,176,64,192,288,536,7,0,0}, +{0,0,0,1022,16,16,16,2047,16,16,16,16,16,992,0,0}, +{0,0,0,0,0,4,968,568,270,272,144,16,32,32,0,0}, +{0,0,0,0,0,0,508,256,256,256,128,128,128,1022,0,0}, +{0,0,0,0,0,508,256,256,256,508,256,256,256,508,0,0}, +{0,0,0,510,0,0,1023,512,512,256,256,128,96,28,0,0}, +{0,0,0,258,258,258,258,258,258,256,256,128,64,56,0,0}, +{0,0,0,136,136,136,136,136,136,1160,1156,1156,642,385,0,0}, +{0,0,0,2,2,2,2,2,514,514,258,130,98,30,0,0}, +{0,0,0,0,1022,514,514,514,514,514,514,514,1022,0,0,0}, +{0,0,0,0,6,536,512,512,256,256,128,64,48,14,0,0}, +{0,0,0,0,0,0,0,0,96,96,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,0,1022,0,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,0,2047,0,0,0,0,0,0,0}, +{0,0,0,2047,32,32,32,32,32,32,32,32,32,56,0,0}, +{0,0,0,32,32,32,32,992,32,32,32,32,32,2047,0,0}, +{0,0,0,2047,32,32,32,160,288,544,32,32,32,32,0,0}, +{0,0,0,2047,64,32,48,168,292,547,1056,32,32,32,0,0}, +{0,0,0,8,2040,8,4,2044,1024,1024,1279,1024,1024,896,0,0}, +{0,0,0,2047,136,136,2047,1161,1161,1365,1571,1025,1025,1793,0,0}, +{0,0,0,260,136,2047,136,136,1161,1162,650,136,136,2047,0,0}, +{0,0,0,32,32,2047,1057,1057,1057,2047,32,32,32,32,0,0}, +{0,0,0,34,36,32,2047,1056,1184,1296,1296,1032,1028,771,0,0}, +{0,0,0,16,32,1023,256,128,64,32,16,12,50,1985,0,0}, +{0,0,0,896,126,2,34,33,2047,32,292,546,1057,56,0,0}, +{0,0,0,32,36,804,740,572,551,804,36,1028,1028,2040,0,0}, +{0,0,0,1022,512,256,128,64,64,64,64,64,64,112,0,0}, +{0,0,0,1022,32,32,32,32,2047,32,32,32,32,56,0,0}, +{0,0,0,32,2047,0,136,260,1675,80,32,80,396,1539,0,0}, +{0,0,0,2036,1044,1042,1042,547,546,546,322,130,322,1586,0,0}, +{0,0,0,32,80,136,260,1675,136,136,136,132,132,130,0,0}, +{0,0,0,260,260,2034,258,259,274,290,290,258,258,450,0,0}, +{0,0,0,324,580,66,1986,123,66,66,130,1154,1282,1538,0,0}, +{0,0,0,256,274,290,290,258,258,146,138,326,546,1048,0,0}, +{0,0,0,148,148,2034,138,131,130,2042,130,130,130,130,0,0}, +{0,0,0,32,80,396,1539,508,0,0,2047,8,260,766,0,0}, +{0,0,0,1012,532,530,530,1011,530,530,530,1010,2,2042,0,0}, +{0,0,0,68,132,2042,2,531,530,546,290,290,130,2042,0,0}, +{0,0,0,68,132,2042,130,131,130,1010,130,130,130,2042,0,0}, +{0,0,0,68,68,2042,66,227,338,338,586,1526,66,66,0,0}, +{0,0,0,36,36,2018,82,75,1986,66,66,1986,66,66,0,0}, +{0,0,0,20,2036,1042,1162,131,674,674,1170,1162,130,194,0,0}, +{0,0,0,132,2036,130,2034,1171,1170,2034,162,66,162,1818,0,0}, +{0,0,0,68,132,2042,66,163,1170,666,274,274,594,1074,0,0}, +{0,0,0,2036,132,2034,1170,2035,1170,2034,162,66,162,1818,0,0}, +{0,0,0,1012,532,530,1010,131,130,2042,450,674,1178,130,0,0}, +{0,0,0,36,996,306,202,1851,138,618,394,618,386,114,0,0}, +{0,0,0,260,1996,1298,770,1987,282,1938,1234,1938,1202,1938,0,0}, +{0,0,0,548,2036,546,2034,1171,1170,2034,130,2034,130,2042,0,0}, +{0,0,0,276,2004,1338,770,2043,258,1978,1218,1978,1194,1978,0,0}, +{0,0,0,36,36,1020,34,32,2047,136,136,1160,1156,1923,0,0}, +{0,0,0,8,16,32,32,80,80,136,136,260,514,1025,0,0}, +{0,0,0,32,80,396,1539,508,32,32,1022,32,32,2047,0,0}, +{0,0,0,2047,32,32,2047,1057,1189,1321,1453,1651,1057,1569,0,0}, +{0,0,0,136,136,1022,136,136,136,2047,0,136,260,1539,0,0}, +{0,0,0,260,136,1022,32,32,32,2047,80,136,260,1539,0,0}, +{0,0,0,508,260,508,260,508,260,508,260,2047,260,1539,0,0}, +{0,0,0,32,32,2047,1057,1057,1105,1161,1285,1025,1025,1793,0,0}, +{0,0,0,2047,32,1022,546,1022,546,546,2047,514,514,898,0,0}, +{0,0,0,32,546,546,546,1022,32,32,1057,1057,1057,2047,0,0}, +{0,0,0,2034,1090,1090,1102,1091,1090,1090,1098,1062,1058,784,0,0}, +{0,0,0,1044,1316,1284,1404,1287,1316,1300,1288,1096,1108,1891,0,0}, +{0,0,0,1087,1156,1156,1212,1186,1190,1193,1168,1040,1032,1798,0,0}, +{0,0,0,2034,1092,1103,1096,1092,1108,1102,1109,1060,1060,788,0,0}, +{0,0,0,1151,1288,1284,1314,1375,1288,1288,1407,1032,1144,1799,0,0}, +{0,0,0,1150,1346,1406,1298,1298,1406,1366,1366,1109,1141,1809,0,0}, +{0,0,0,260,136,2047,0,702,674,702,674,702,546,818,0,0}, +{0,0,0,4,1924,1215,1188,1188,1188,1188,1188,1186,1186,1945,0,0}, +{0,0,0,128,158,2016,1152,1183,1156,1154,1170,1113,1111,800,0,0}, +{0,0,0,158,146,2034,1182,1170,1170,1182,1170,1138,1103,800,0,0}, +{0,0,0,136,191,1984,1170,1185,1170,1170,1172,1096,1108,803,0,0}, +{0,0,0,318,264,2047,1322,1342,1322,1342,1288,1214,1160,1663,0,0}, +{0,0,0,4,1020,514,637,580,580,636,900,4,1028,2040,0,0}, +{0,0,0,68,68,578,322,195,98,90,66,1090,1090,1922,0,0}, +{0,0,0,960,62,32,32,32,2047,32,32,32,32,32,0,0}, +{0,0,0,260,136,1022,546,1022,546,1022,32,2047,32,32,0,0}, +{0,0,0,32,32,992,32,32,2047,32,160,288,544,32,0,0}, +{0,0,0,2046,2,66,66,2042,1090,1090,1058,1058,1042,781,0,0}, +{0,0,0,2046,66,1018,522,1018,522,1018,66,586,1098,1125,0,0}, +{0,0,0,8,260,766,16,2047,136,308,1731,60,384,126,0,0}, +{0,0,0,511,260,132,68,964,524,276,164,66,434,1549,0,0}, +{0,0,0,2015,1104,1105,1105,1105,1105,650,650,260,650,1105,0,0}, +{0,0,0,960,62,2,2,1022,522,274,162,66,434,1549,0,0}, +{0,0,0,63,2002,1118,1106,1106,1118,658,658,314,663,1104,0,0}, +{0,0,0,32,2047,136,650,1161,136,1022,260,136,112,1935,0,0}, +{0,0,0,1022,514,514,514,514,1022,0,0,260,514,1025,0,0}, +{0,0,0,2047,512,512,636,580,580,580,636,512,512,896,0,0}, +{0,0,0,16,8,260,514,1535,1024,1022,514,514,514,1022,0,0}, +{0,0,0,32,1022,546,546,546,1022,32,20,24,100,1923,0,0}, +{0,0,0,508,260,260,508,0,2047,8,504,256,256,224,0,0}, +{0,0,0,16,1008,520,278,160,64,2040,1039,1032,1032,2040,0,0}, +{0,0,0,960,62,2,2,2046,2,1018,522,522,522,1017,0,0}, +{0,0,0,1008,519,549,549,549,2021,1029,1029,1527,1024,896,0,0}, +{0,0,0,112,396,1571,64,1022,256,128,1022,514,514,1022,0,0}, +{0,0,0,64,2044,1028,1028,2044,4,2044,1036,1034,1034,2041,0,0}, +{0,0,0,34,1022,33,32,2047,0,1022,514,514,514,1022,0,0}, +{0,0,0,48,1934,1160,1160,1215,1160,1164,1178,1193,1928,8,0,0}, +{0,0,0,64,455,293,1013,661,661,661,2045,327,544,1048,0,0}, +{0,0,0,136,1950,594,702,258,1730,1,1022,514,514,1022,0,0}, +{0,0,0,136,190,1954,610,702,642,702,294,294,677,1149,0,0}, +{0,0,0,992,279,2045,1365,1365,1845,1173,2045,325,551,1048,0,0}, +{0,0,0,990,594,1022,546,1022,546,1022,32,2047,32,32,0,0}, +{0,0,0,1008,151,1013,149,1013,149,2037,1029,1367,1360,1544,0,0}, +{0,0,0,2047,1025,1025,1273,1161,1161,1161,1273,1025,1025,2047,0,0}, +{0,0,0,16,16,2047,8,136,132,2038,133,132,132,2036,0,0}, +{0,0,0,2036,260,132,143,708,1188,1172,140,131,128,128,0,0}, +{0,0,0,1282,1282,2042,263,1394,1362,1362,630,515,1376,1176,0,0}, +{0,0,0,132,159,996,671,682,714,671,836,607,1060,1060,0,0}, +{0,0,0,1988,1119,1092,1887,74,1994,1279,1348,607,1348,1220,0,0}, +{0,0,0,546,2042,1162,1711,2042,2,1010,534,1011,528,1008,0,0}, +{0,0,0,130,2042,1362,1367,2034,130,1714,322,1338,551,1264,0,0}, +{0,0,0,32,2047,32,1022,0,1022,546,1022,2,2,1,0,0}, +{0,0,0,260,260,316,290,802,1317,276,276,264,52,1987,0,0}, +{0,0,0,32,2047,144,658,1169,8,504,262,144,112,1935,0,0}, +{0,0,0,2,2046,517,1020,516,1020,16,1016,270,240,1807,0,0}, +{0,0,0,2047,32,1022,514,1022,514,1022,260,139,112,1935,0,0}, +{0,0,0,32,32,32,2047,32,80,80,136,136,260,1539,0,0}, +{0,0,0,36,36,1020,34,33,32,2047,80,136,260,1539,0,0}, +{0,0,0,32,1022,32,292,168,32,2047,80,136,260,1539,0,0}, +{0,0,0,32,2047,32,292,292,682,1105,80,136,260,1539,0,0}, +{0,0,0,996,516,271,138,138,2042,137,138,132,138,225,0,0}, +{0,0,0,132,132,591,554,1530,10,2025,1066,1060,1066,2017,0,0}, +{0,0,0,32,2047,1025,1533,128,64,32,2047,32,32,56,0,0}, +{0,0,0,16,2047,8,996,260,134,133,2036,132,132,196,0,0}, +{0,0,0,32,2047,1025,16,16,2047,264,260,136,112,1935,0,0}, +{0,0,0,32,2047,1025,0,1022,32,36,996,36,58,1985,0,0}, +{0,0,0,32,2047,1057,1022,32,1022,32,2047,80,396,1539,0,0}, +{0,0,0,512,527,2024,521,522,554,580,580,522,522,897,0,0}, +{0,0,0,514,516,2015,520,521,586,644,644,522,530,897,0,0}, +{0,0,0,1924,1140,581,390,116,516,2038,517,548,580,772,0,0}, +{0,0,0,1802,1258,682,334,232,520,2031,522,554,586,777,0,0}, +{0,0,0,597,566,1940,639,532,703,776,574,520,568,775,0,0}, +{0,0,0,32,32,32,292,548,546,1058,1057,32,32,56,0,0}, +{0,0,0,1022,514,1022,2,2046,1026,1274,1162,1162,1274,769,0,0}, +{0,0,0,2046,1026,2046,530,290,2042,290,290,2042,290,281,0,0}, +{0,0,0,2046,1026,2046,66,1018,586,1018,66,2046,1349,1781,0,0}, +{0,0,0,546,1022,0,1022,514,650,594,546,594,1674,1025,0,0}, +{0,0,0,1022,32,32,32,32,32,32,32,32,32,2047,0,0}, +{0,0,0,1022,512,512,514,514,1022,2,2,1026,1026,2044,0,0}, +{0,0,0,292,2047,292,0,2047,1057,1022,546,546,802,32,0,0}, +{0,0,0,292,2047,1025,1533,260,508,32,1022,546,802,32,0,0}, +{0,0,0,136,2047,136,1022,514,2047,292,1022,1317,420,32,0,0}, +{0,0,0,1022,32,546,292,32,2047,32,32,32,32,32,0,0}, +{0,0,0,260,136,2047,136,136,136,2047,136,136,132,131,0,0}, +{0,0,0,64,2046,34,2046,18,74,1018,66,2046,66,65,0,0}, +{0,0,0,64,2046,514,506,138,138,2042,138,266,1322,1625,0,0}, +{0,0,0,64,2046,274,2046,274,498,2,1018,274,226,1821,0,0}, +{0,0,0,64,2046,66,2046,586,1018,586,1018,66,2046,65,0,0}, +{0,0,0,71,1012,578,2041,583,1012,69,1013,66,70,2041,0,0}, +{0,0,0,2047,260,260,260,260,2047,260,260,258,258,257,0,0}, +{0,0,0,640,1152,2047,128,128,191,136,264,1288,1592,1031,0,0}, +{0,0,0,575,544,544,575,513,513,575,544,544,544,540,0,0}, +{0,0,0,71,548,1524,135,2033,1169,1175,2036,132,644,1523,0,0}, +{0,0,0,999,548,996,135,2033,1169,1175,2036,132,644,1523,0,0}, +{0,0,0,32,546,292,32,1022,512,512,1022,512,512,1022,0,0}, +{0,0,0,1012,514,257,132,354,1563,994,130,130,130,2034,0,0}, +{0,0,0,1012,530,1009,532,530,1011,1170,658,274,594,1074,0,0}, +{0,0,0,68,546,497,68,546,1523,66,994,562,450,1586,0,0}, +{0,0,0,2036,2,673,340,338,675,2,1010,130,130,2042,0,0}, +{0,0,0,548,578,321,2036,130,163,1954,162,162,210,1802,0,0}, +{0,0,0,20,2034,537,1012,530,1011,34,1010,554,450,1594,0,0}, +{0,0,0,16,32,64,72,8,522,1034,1034,1289,264,496,0,0}, +{0,0,0,16,288,288,264,138,650,1098,1065,1304,268,499,0,0}, +{0,0,0,64,2046,2,66,130,162,554,1066,1062,546,961,0,0}, +{0,0,0,68,68,1013,589,581,581,2044,68,164,276,1548,0,0}, +{0,0,0,292,292,2021,301,277,261,2020,260,260,260,2036,0,0}, +{0,0,0,16,508,260,508,260,508,260,508,554,1354,1521,0,0}, +{0,0,0,132,996,133,1005,133,2037,548,996,548,996,548,0,0}, +{0,0,0,996,548,997,557,2037,1365,2036,548,324,132,1908,0,0}, +{0,0,0,132,996,333,2037,549,997,548,996,324,1108,908,0,0}, +{0,0,0,320,591,72,1993,122,586,324,132,1162,1354,1569,0,0}, +{0,0,0,320,576,2047,64,606,594,338,158,1152,1368,1575,0,0}, +{0,0,0,1336,264,1919,457,1343,1353,1407,581,637,1321,1277,0,0}, +{0,0,0,64,2046,1026,1026,2046,2,66,2046,66,434,1549,0,0}, +{0,0,0,960,62,32,32,1022,32,32,2047,32,32,56,0,0}, +{0,0,0,128,128,2047,128,192,160,144,140,131,128,224,0,0}, +{0,0,0,68,68,1007,580,580,612,716,583,548,1060,1046,0,0}, +{0,0,0,322,578,71,1986,122,582,323,130,1154,1378,1563,0,0}, +{0,0,0,2034,1042,1047,1042,2034,150,147,274,274,530,1035,0,0}, +{0,0,0,2034,1170,1175,2034,1170,1174,2035,130,130,130,131,0,0}, +{0,0,0,2034,1042,551,450,1586,134,995,130,2034,130,131,0,0}, +{0,0,0,130,994,135,130,2034,518,2035,546,578,514,899,0,0}, +{0,0,0,130,2034,1047,130,130,2038,579,546,322,386,1651,0,0}, +{0,0,0,2034,130,2043,130,2034,1170,2038,1171,2034,130,131,0,0}, +{0,0,0,994,546,999,2,2034,1046,1171,1170,322,546,1043,0,0}, +{0,0,0,66,450,295,1010,658,662,659,2042,322,546,1051,0,0}, +{0,0,0,1010,514,1015,514,2042,1098,1015,594,594,850,67,0,0}, +{0,0,0,770,250,1111,674,2042,1038,1011,530,290,194,1851,0,0}, +{0,0,0,130,2034,1047,322,546,1046,995,130,130,130,2035,0,0}, +{0,0,0,546,2034,551,2,2034,1174,1171,2034,1170,1170,2035,0,0}, +{0,0,0,770,226,135,2034,130,166,1683,1170,1714,1170,2035,0,0}, +{0,0,0,994,274,2047,1362,1362,1842,1174,2043,322,546,1051,0,0}, +{0,0,0,994,546,999,2,2034,1046,2035,1042,2034,546,1043,0,0}, +{0,0,0,2034,1362,2039,130,2034,134,2035,546,2034,130,131,0,0}, +{0,0,0,994,546,999,1906,1362,1910,131,2034,450,674,1171,0,0}, +{0,0,0,74,2047,682,430,1616,510,32,508,32,2047,32,0,0}, +{0,0,0,32,32,2047,32,32,1022,260,136,112,396,1539,0,0}, +{0,0,0,66,68,2015,546,578,606,338,338,146,338,1593,0,0}, +{0,0,0,68,68,2015,548,580,580,351,337,145,337,1599,0,0}, +{0,0,0,136,191,1920,594,673,658,658,660,264,660,1123,0,0}, +{0,0,0,79,73,1999,553,601,591,329,335,128,330,1585,0,0}, +{0,0,0,169,154,1983,588,666,681,644,703,292,668,1123,0,0}, +{0,0,0,136,190,1962,639,682,703,681,703,292,668,1123,0,0}, +{0,0,0,16,32,2047,260,260,136,136,80,32,216,1799,0,0}, +{0,0,0,516,589,646,516,559,580,1542,910,613,516,516,0,0}, +{0,0,0,1544,447,162,148,1983,648,703,648,682,585,588,0,0}, +{0,0,0,130,132,351,1570,2,222,786,18,210,786,1049,0,0}, +{0,0,0,1022,32,32,32,2047,80,80,72,1096,1092,1987,0,0}, +{0,0,0,2031,297,303,297,2041,271,257,389,1353,1317,1811,0,0}, +{0,0,0,1022,514,514,514,514,1022,514,514,514,514,1022,0,0}, +{0,0,0,1022,514,1022,514,1022,136,1161,650,396,136,2047,0,0}, +{0,0,0,128,999,133,133,2037,519,2037,549,581,519,896,0,0}, +{0,0,0,1022,514,1022,514,1022,32,2047,514,1022,292,1587,0,0}, +{0,0,0,128,2039,549,325,2037,7,997,549,997,551,992,0,0}, +{0,0,0,1022,544,2047,544,1022,32,2047,514,1022,514,1022,0,0}, +{0,0,0,260,2015,260,2015,650,1105,1022,514,1022,514,1022,0,0}, +{0,0,0,1022,514,1022,514,2047,18,2014,1106,698,279,1744,0,0}, +{0,0,0,112,396,1787,0,1022,682,1022,260,508,260,508,0,0}, +{0,0,0,1020,516,516,1020,516,516,1020,516,514,514,897,0,0}, +{0,0,0,16,2047,8,4,1020,518,1021,516,1020,516,900,0,0}, +{0,0,0,32,32,1022,32,32,2047,168,168,292,1571,32,0,0}, +{0,0,0,32,32,2047,168,168,168,292,292,762,1057,32,0,0}, +{0,0,0,484,292,303,292,292,294,302,293,1316,1316,1812,0,0}, +{0,0,0,516,516,2031,516,772,774,654,581,564,516,900,0,0}, +{0,0,0,1022,546,1022,546,1022,32,2047,168,292,1571,32,0,0}, +{0,0,0,32,2047,168,292,2047,260,508,260,508,0,2047,0,0}, +{0,0,0,548,324,2047,132,132,998,142,133,2036,132,132,0,0}, +{0,0,0,132,2036,79,548,500,134,1102,565,260,708,1076,0,0}, +{0,0,0,2036,20,2015,276,276,2006,286,277,2004,20,2036,0,0}, +{0,0,0,32,2047,1041,1022,136,120,1927,32,2047,292,1571,0,0}, +{0,0,0,132,1172,687,132,2036,1030,1038,2037,1028,1028,2036,0,0}, +{0,0,0,132,324,559,1044,996,6,1110,685,676,260,2036,0,0}, +{0,0,0,132,2036,143,996,548,998,558,997,548,548,2036,0,0}, +{0,0,0,132,324,559,1492,132,2038,1182,2037,132,324,1588,0,0}, +{0,0,0,546,369,1365,626,1365,1911,32,2047,168,292,1571,0,0}, +{0,0,0,2036,324,2047,1364,2036,6,1006,5,2036,676,1236,0,0}, +{0,0,0,324,2036,335,996,548,998,558,2037,132,324,1588,0,0}, +{0,0,0,548,2036,143,996,132,2038,78,1781,420,676,1236,0,0}, +{0,0,0,1188,660,1199,724,1972,646,2046,149,1332,596,1292,0,0}, +{0,0,0,1172,676,2047,1044,996,558,2038,1173,2036,1172,2036,0,0}, +{0,0,0,132,324,559,1492,4,1910,1374,1909,548,548,1364,0,0}, +{0,0,0,548,2036,559,1364,1908,294,2030,309,2020,292,2020,0,0}, +{0,0,0,33,34,2018,1040,648,128,130,322,322,545,1049,0,0}, +{0,0,0,2047,32,32,32,36,996,36,36,36,36,2047,0,0}, +{0,0,0,136,136,1160,650,442,138,138,138,1162,1210,1799,0,0}, +{0,0,0,2046,818,478,274,954,1366,274,66,970,74,2045,0,0}, +{0,0,0,2034,1044,1040,1041,546,544,544,322,130,321,1585,0,0}, +{0,0,0,66,68,1008,577,578,576,2040,66,162,273,1549,0,0}, +{0,0,0,482,292,288,289,1818,0,1008,530,290,193,1849,0,0}, +{0,0,0,130,132,1008,129,130,2040,64,546,546,1425,1145,0,0}, +{0,0,0,1170,676,128,2033,1042,2032,1040,2034,1042,1041,1553,0,0}, +{0,0,0,1010,68,64,2041,290,528,1096,722,1362,1353,97,0,0}, +{0,0,0,129,2042,288,193,290,1560,1008,530,1010,529,521,0,0}, +{0,0,0,137,146,1980,73,906,568,296,2026,298,297,437,0,0}, +{0,0,0,2041,138,1000,553,1002,552,1000,138,682,1193,1237,0,0}, +{0,0,0,162,2036,145,2042,144,2036,146,2033,32,2047,32,0,0}, +{0,0,0,289,2042,288,2033,1170,2032,128,2042,322,545,1049,0,0}, +{0,0,0,4,2047,4,68,596,596,332,66,162,273,1548,0,0}, +{0,0,0,34,36,511,272,1016,520,2044,1026,1365,1364,1538,0,0}, +{0,0,0,2,2046,341,340,2047,340,340,2047,0,586,1169,0,0}, +{0,0,0,2031,1161,1097,1583,9,2025,1065,2031,0,586,1169,0,0}, +{0,0,0,1546,490,42,62,2018,1058,1134,682,298,682,1113,0,0}, +{0,0,0,132,997,143,133,2036,524,2039,548,580,516,900,0,0}, +{0,0,0,1284,1343,260,2047,299,293,319,677,703,677,1141,0,0}, +{0,0,0,1308,1284,319,2021,319,261,319,661,703,1125,1067,0,0}, +{0,0,0,2032,1175,1170,2034,1170,1175,2034,130,2038,131,2040,0,0}, +{0,0,0,1022,546,546,1022,546,546,1022,546,546,546,801,0,0}, +{0,0,0,16,511,273,273,511,273,273,511,1040,1040,2016,0,0}, +{0,0,0,2047,0,508,1317,1317,1533,1317,1317,1533,1025,2047,0,0}, +{0,0,0,1022,546,1022,546,1022,136,260,1675,136,132,131,0,0}, +{0,0,0,2008,1159,1153,1105,1583,0,1022,546,1022,546,1022,0,0}, +{0,0,0,1022,544,2047,544,1022,32,2047,546,1022,546,2047,0,0}, +{0,0,0,546,292,2047,1025,508,260,1022,546,1022,546,1022,0,0}, +{0,0,0,68,66,2015,1073,1041,1169,1311,1297,1041,1041,799,0,0}, +{0,0,0,32,1022,32,508,260,508,260,508,260,260,2047,0,0}, +{0,0,0,2032,1191,677,2047,1045,757,1943,757,653,1991,560,0,0}, +{0,0,0,1007,516,580,578,590,1995,1034,1034,1514,1038,896,0,0}, +{0,0,0,79,964,548,2034,1198,2027,1194,2026,1194,1198,1680,0,0}, +{0,0,0,143,2036,1108,290,2030,315,2026,298,2026,302,2016,0,0}, +{0,0,0,2031,292,2020,290,2030,299,2026,1034,1194,1198,1552,0,0}, +{0,0,0,1022,0,0,2047,32,32,292,548,1058,1057,56,0,0}, +{0,0,0,136,1991,1076,580,399,116,1990,1078,589,388,116,0,0}, +{0,0,0,16,32,2047,0,260,260,264,136,136,64,2047,0,0}, +{0,0,0,32,1022,136,2047,260,508,260,508,32,2047,32,0,0}, +{0,0,0,1169,1170,2039,0,2037,133,2037,1362,1366,1361,1552,0,0}, +{0,0,0,66,2014,297,1018,512,762,650,762,650,762,770,0,0}, +{0,0,0,1010,546,545,295,1826,1061,1127,672,277,661,1129,0,0}, +{0,0,0,32,1022,32,508,32,2047,72,548,1535,292,1587,0,0}, +{0,0,0,32,2047,32,2047,1161,102,536,1535,32,292,1587,0,0}, +{0,0,0,2034,1170,1169,1175,1170,2037,1175,1168,1173,1173,2037,0,0}, +{0,0,0,34,994,529,295,194,293,1567,96,389,53,965,0,0}, +{0,0,0,130,130,2041,135,130,1013,7,1008,533,533,1013,0,0}, +{0,0,0,130,322,545,1051,994,5,7,2032,69,549,1525,0,0}, +{0,0,0,2034,2,673,343,338,677,7,992,133,133,2037,0,0}, +{0,0,0,130,2034,129,999,2,2037,1047,320,325,1317,1813,0,0}, +{0,0,0,130,2034,1041,2039,1042,2037,135,1720,421,661,1225,0,0}, +{0,0,0,258,1919,1450,1407,554,1470,72,548,1535,292,1587,0,0}, +{0,0,0,450,546,1489,7,2034,1365,2039,544,997,549,997,0,0}, +{0,0,0,594,1458,593,1463,2034,21,599,1456,597,1461,2037,0,0}, +{0,0,0,130,2034,129,2039,1362,2037,551,992,549,997,1589,0,0}, +{0,0,0,644,1156,1922,233,135,1924,226,1167,768,1420,1651,0,0}, +{0,0,0,1010,514,257,133,355,1562,993,135,128,132,2035,0,0}, +{0,0,0,132,132,2034,137,135,996,2,1007,544,556,995,0,0}, +{0,0,0,130,322,545,1045,995,2,1,2039,64,548,1523,0,0}, +{0,0,0,274,1362,913,277,2003,274,913,1367,272,20,2035,0,0}, +{0,0,0,130,994,129,2037,1059,338,289,2039,128,580,1075,0,0}, +{0,0,0,1794,1266,673,2037,67,2034,33,999,592,396,1651,0,0}, +{0,0,0,2047,1161,2047,32,2047,32,508,260,508,260,2047,0,0}, +{0,0,0,1022,594,1022,1040,766,272,2047,516,1022,517,1020,0,0}, +{0,0,0,1752,1159,1461,1759,1166,1173,1759,1461,1183,1173,1759,0,0}, +{0,0,0,1040,766,272,144,2047,8,1020,518,1021,516,1020,0,0}, +{0,0,0,135,133,2045,135,133,1013,535,533,293,197,1853,0,0}, +{0,0,0,72,1615,456,1100,1931,508,260,508,260,508,260,0,0}, +{0,0,0,1602,457,87,1088,1951,17,1631,465,95,1105,1945,0,0}, +{0,0,0,135,2037,5,1047,1589,1365,1175,1365,1589,1045,2037,0,0}, +{0,0,0,1831,1317,1533,1319,1317,1533,1319,1301,1877,333,445,0,0}, +{0,0,0,1191,597,597,1191,5,69,2039,1365,1173,1365,2037,0,0}, +{0,0,0,1879,1421,1317,1367,1421,1285,1399,1365,1877,341,373,0,0}, +{0,0,0,32,16,1022,514,1022,514,514,1022,514,514,1022,0,0}, +{0,0,0,2047,16,136,260,766,544,32,1022,32,32,2047,0,0}, +{0,0,0,20,882,530,886,578,854,594,2047,0,260,1539,0,0}, +{0,0,0,136,2047,136,32,1022,546,546,2047,80,396,1539,0,0}, +{0,0,0,136,2047,136,896,126,530,292,2047,168,292,1571,0,0}, +{0,0,0,136,2047,136,1280,2045,341,1527,1428,759,597,1525,0,0}, +{0,0,0,992,32,2046,1314,250,2018,10,954,1710,18,2029,0,0}, +{0,0,0,260,1365,650,1105,2047,1057,1022,546,1022,544,1535,0,0}, +{0,0,0,996,2,1,2036,258,259,258,258,258,258,450,0,0}, +{0,0,0,130,132,143,136,388,660,1166,149,132,132,132,0,0}, +{0,0,0,32,1022,32,1022,32,2047,80,1096,647,308,1548,0,0}, +{0,0,0,137,2042,136,140,1003,32,2047,72,647,308,1548,0,0}, +{0,0,0,641,2034,135,2036,1170,2042,1175,2042,1170,1170,1682,0,0}, +{0,0,0,273,2047,272,287,2004,18,2047,552,583,388,1598,0,0}, +{0,0,0,2047,80,1022,594,1022,16,2047,264,140,112,1935,0,0}, +{0,0,0,1022,514,1022,514,1022,514,1022,136,1160,1156,1923,0,0}, +{0,0,0,95,1989,63,1937,383,261,511,260,508,1096,1991,0,0}, +{0,0,0,1022,514,514,546,546,546,546,80,1104,1096,1991,0,0}, +{0,0,0,258,270,1993,1375,1365,1375,2005,287,1301,1813,1237,0,0}, +{0,0,0,1986,1358,1993,159,2005,1343,2005,1375,2005,1301,981,0,0}, +{0,0,0,16,32,2047,0,1022,0,1022,0,1022,514,1022,0,0}, +{0,0,0,1009,514,519,512,519,1008,23,16,1047,1045,2023,0,0}, +{0,0,0,481,290,295,288,1815,0,1015,528,295,197,1847,0,0}, +{0,0,0,33,994,151,128,135,2032,135,128,135,133,135,0,0}, +{0,0,0,2033,1042,1047,1040,2039,144,151,272,279,533,1039,0,0}, +{0,0,0,1281,1282,2039,256,263,496,583,576,583,1477,1079,0,0}, +{0,0,0,769,226,135,128,2039,128,135,992,551,549,999,0,0}, +{0,0,0,129,2034,71,544,503,128,1095,560,263,709,1079,0,0}, +{0,0,0,545,322,2039,128,135,992,135,128,2039,133,135,0,0}, +{0,0,0,2033,1154,1191,1168,1095,1584,71,672,1079,1325,455,0,0}, +{0,0,0,2033,66,1015,544,551,2040,7,2032,1047,1045,2039,0,0}, +{0,0,0,993,546,551,992,7,992,135,2032,135,325,1591,0,0}, +{0,0,0,129,2034,135,992,7,2032,1047,320,327,1317,1815,0,0}, +{0,0,0,129,1010,135,1008,135,2040,535,1008,535,1013,535,0,0}, +{0,0,0,545,2042,135,2032,135,2040,1319,2040,1319,637,1319,0,0}, +{0,0,0,129,2034,135,2032,1367,2032,551,992,551,997,1591,0,0}, +{0,0,0,546,1397,514,1397,1799,112,1365,2044,267,240,1807,0,0}, +{0,0,0,65,1170,1168,1040,547,546,546,322,138,326,1586,0,0}, +{0,0,0,17,1010,136,128,131,2042,130,130,130,134,130,0,0}, +{0,0,0,481,290,288,288,1819,2,1010,530,290,198,1850,0,0}, +{0,0,0,65,130,2040,32,35,994,546,546,530,534,394,0,0}, +{0,0,0,641,1154,2040,128,131,250,290,290,1314,1766,1050,0,0}, +{0,0,0,769,242,128,128,2035,130,130,994,554,550,994,0,0}, +{0,0,0,130,2036,64,544,499,130,1090,562,258,710,1074,0,0}, +{0,0,0,546,324,2032,128,135,996,132,132,2036,140,132,0,0}, +{0,0,0,2033,66,1008,544,547,2042,2,2034,1042,1046,2034,0,0}, +{0,0,0,1009,530,528,1008,3,1010,130,2042,130,326,1594,0,0}, +{0,0,0,129,1010,128,1008,131,2042,530,1010,538,1014,530,0,0}, +{0,0,0,129,1010,128,2040,1059,330,274,2042,130,614,1050,0,0}, +{0,0,0,1022,32,2047,0,1022,514,1022,514,1022,260,1539,0,0}, +{0,0,0,32,2023,1168,328,546,1533,260,508,260,508,1539,0,0}, +{0,0,0,1022,32,2047,0,1022,514,546,546,80,396,1539,0,0}, +{0,0,0,95,81,2005,565,597,597,341,341,132,330,1585,0,0}, +{0,0,0,34,2020,1168,324,1587,0,1022,546,546,216,1799,0,0}, +{0,0,0,968,542,520,520,991,72,1098,1114,1930,13,2033,0,0}, +{0,0,0,79,969,553,351,132,324,1597,997,549,557,995,0,0}, +{0,0,0,648,1214,136,2047,136,1279,682,318,1322,1727,1096,0,0}, +{0,0,0,1284,2015,260,2015,1365,2015,1365,2015,1348,1375,1348,0,0}, +{0,0,0,2020,31,1348,703,693,1375,21,2015,260,287,2020,0,0}, +{0,0,0,260,2047,1348,2015,1365,2015,1301,2047,580,671,772,0,0}, +{0,0,0,132,1007,130,133,2037,79,996,524,327,132,260,0,0}, +{0,0,0,996,527,258,133,357,1567,996,140,135,132,2036,0,0}, +{0,0,0,648,1214,136,2047,132,1215,650,318,1288,1727,1096,0,0}, +{0,0,0,644,2039,130,2037,1173,2047,1172,2044,1175,1172,1684,0,0}, +{0,0,0,33,66,128,128,323,322,546,546,1042,5,2041,0,0}, +{0,0,0,1009,2,0,2040,35,546,530,1426,1146,5,2041,0,0}, +{0,0,0,1793,242,16,16,2035,1074,594,402,1642,5,2041,0,0}, +{0,0,0,289,290,2040,288,291,2042,290,290,274,5,2041,0,0}, +{0,0,0,1009,530,1008,528,1011,1106,658,338,1586,5,2041,0,0}, +{0,0,0,145,1010,136,128,2043,290,290,1298,1802,5,2041,0,0}, +{0,0,0,1009,322,128,2032,1171,2034,1170,2034,1170,5,2041,0,0}, +{0,0,0,129,2042,128,2032,1171,2034,450,674,1178,133,2041,0,0}, +{0,0,0,161,290,2032,152,2035,146,2034,146,2034,5,2041,0,0}, +{0,0,0,2041,1034,2040,328,2043,138,1002,138,2042,133,2041,0,0}, +{0,0,0,273,1914,144,1904,1107,594,2002,594,874,5,2041,0,0}, +{0,0,0,953,682,952,1224,1915,290,1010,290,2042,533,2041,0,0}, +{0,0,0,1928,1214,1152,674,660,1279,1152,1214,930,162,190,0,0}, +{0,0,0,2015,1034,1034,1055,1045,2005,91,81,1119,1105,1951,0,0}, +{0,0,0,1022,32,2047,546,1022,546,1022,32,1022,32,2047,0,0}, +{0,0,0,1022,514,1022,514,2047,546,1022,546,1022,32,2047,0,0}, +{0,0,0,324,1002,321,334,2036,15,996,557,998,556,995,0,0}, +{0,0,0,290,1014,289,295,2042,2,1015,530,1010,534,1010,0,0}, +{0,0,0,1020,4,508,4,508,4,2047,548,324,148,1804,0,0}, +{0,0,0,2015,1105,2015,1105,2015,1025,1533,1161,1533,1161,1669,0,0}, +{0,0,0,2015,1105,2015,1105,2015,1025,1273,1161,1273,1161,1785,0,0}, +{0,0,0,2015,1105,2015,1105,2015,1161,1365,1161,1365,1501,1609,0,0}, +{0,0,0,2041,1026,1024,1273,1161,1161,1161,1273,1025,1025,1793,0,0}, +{0,0,0,2041,1026,1024,1273,1161,1161,1273,1161,1161,1273,1537,0,0}, +{0,0,0,551,549,2005,533,539,597,661,661,535,529,785,0,0}, +{0,0,0,967,549,2037,1029,2035,1029,2037,69,679,1329,1513,0,0}, +{0,0,0,135,1013,293,2045,531,1013,533,1013,135,2041,129,0,0}, +{0,0,0,2039,1109,677,2037,1027,2037,1029,2037,167,561,1513,0,0}, +{0,0,0,263,1997,149,1989,315,2005,597,981,599,41,1993,0,0}, +{0,0,0,1527,1173,677,2043,1029,2037,1029,2037,163,553,1477,0,0}, +{0,0,0,650,1950,715,1950,650,1950,0,1022,260,248,1799,0,0}, +{0,0,0,1022,32,2047,1193,1022,546,1022,546,1022,1056,1984,0,0}, +{0,0,0,1022,32,2047,1057,1453,0,2047,16,2047,1161,1673,0,0}, +{0,0,0,2047,32,16,2047,1161,1273,1161,1161,1273,1161,2047,0,0}, +{0,0,0,32,1022,260,136,2047,0,508,260,508,260,508,0,0}, +{0,0,0,2032,135,2034,1042,2034,1042,2034,1046,2035,544,1040,0,0}, +{0,0,0,2015,273,2015,1105,2015,1098,2005,1115,1984,650,1109,0,0}, +{0,0,0,2032,135,2034,1042,1170,1170,1170,1174,323,544,1040,0,0}, +{0,0,0,130,1014,661,1008,130,2042,530,658,658,326,1586,0,0}, +{0,0,0,334,2042,1370,2047,1361,2046,554,1006,554,334,2042,0,0}, +{0,0,0,1022,546,682,546,1022,32,1022,32,2047,586,1169,0,0}, +{0,0,0,0,0,0,0,0,0,0,12,12,8,4,0,0}, +{0,0,0,1024,512,256,128,64,32,16,8,4,2,1,0,0}, +{0,0,0,0,0,12,12,0,0,0,0,12,12,0,0,0}, +{0,0,0,0,14,17,17,16,8,4,4,0,4,0,0,0} +}; +static const unsigned char ui_large_advances[]={8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16}; +static const unsigned short ui_large_rows[][16]={ +{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, +{0,0,0,0,16,16,16,16,16,16,16,0,16,16,0,0}, +{0,0,68,68,68,68,0,0,0,0,0,0,0,0,0,0}, +{0,0,0,0,72,72,72,126,36,36,126,18,18,18,0,0}, +{0,0,0,0,16,124,146,18,28,112,144,146,124,16,0,0}, +{0,0,0,0,140,82,82,44,16,16,104,148,148,98,0,0}, +{0,0,0,0,56,68,68,40,24,148,162,66,98,156,0,0}, +{0,0,16,16,16,16,0,0,0,0,0,0,0,0,0,0}, +{0,0,0,32,16,16,8,8,8,8,8,8,16,16,32,0}, +{0,0,0,4,8,8,16,16,16,16,16,16,8,8,4,0}, +{0,0,0,0,0,0,16,146,84,56,84,146,16,0,0,0}, +{0,0,0,0,0,0,16,16,16,254,16,16,16,0,0,0}, +{0,0,0,0,0,0,0,0,0,0,0,0,24,16,16,8}, +{0,0,0,0,0,0,0,0,0,60,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,0,0,0,0,0,24,24,0,0}, +{0,0,0,0,64,64,32,16,16,8,8,4,2,2,0,0}, +{0,0,0,0,24,36,66,98,82,74,70,66,36,24,0,0}, +{0,0,0,0,16,24,20,16,16,16,16,16,16,124,0,0}, +{0,0,0,0,60,66,66,64,48,8,4,2,2,126,0,0}, +{0,0,0,0,60,66,66,64,56,64,64,66,66,60,0,0}, +{0,0,0,0,32,48,40,36,34,34,126,32,32,32,0,0}, +{0,0,0,0,126,2,2,2,62,64,64,64,66,60,0,0}, +{0,0,0,0,56,4,2,2,62,66,66,66,66,60,0,0}, +{0,0,0,0,126,64,64,32,32,32,16,16,16,16,0,0}, +{0,0,0,0,60,66,66,66,60,66,66,66,66,60,0,0}, +{0,0,0,0,60,66,66,66,124,64,64,64,32,28,0,0}, +{0,0,0,0,0,0,24,24,0,0,0,24,24,0,0,0}, +{0,0,0,0,0,0,24,24,0,0,0,24,16,16,8,0}, +{0,0,0,0,0,64,32,16,8,4,8,16,32,64,0,0}, +{0,0,0,0,0,0,0,126,0,0,0,126,0,0,0,0}, +{0,0,0,0,0,2,4,8,16,32,16,8,4,2,0,0}, +{0,0,0,0,60,66,66,64,32,16,16,0,16,16,0,0}, +{0,0,0,0,56,68,82,106,74,74,74,114,4,120,0,0}, +{0,0,0,0,24,36,36,66,66,126,66,66,66,66,0,0}, +{0,0,0,0,62,66,66,66,62,66,66,66,66,62,0,0}, +{0,0,0,0,60,66,66,2,2,2,2,66,66,60,0,0}, +{0,0,0,0,30,34,66,66,66,66,66,66,34,30,0,0}, +{0,0,0,0,126,2,2,2,62,2,2,2,2,126,0,0}, +{0,0,0,0,126,2,2,2,62,2,2,2,2,2,0,0}, +{0,0,0,0,60,66,66,2,2,114,66,66,98,92,0,0}, +{0,0,0,0,66,66,66,66,126,66,66,66,66,66,0,0}, +{0,0,0,0,124,16,16,16,16,16,16,16,16,124,0,0}, +{0,0,0,0,248,32,32,32,32,32,32,34,34,28,0,0}, +{0,0,0,0,66,34,18,10,6,6,10,18,34,66,0,0}, +{0,0,0,0,2,2,2,2,2,2,2,2,2,126,0,0}, +{0,0,0,0,66,66,102,102,90,90,66,66,66,66,0,0}, +{0,0,0,0,66,70,70,74,74,82,82,98,98,66,0,0}, +{0,0,0,0,60,66,66,66,66,66,66,66,66,60,0,0}, +{0,0,0,0,62,66,66,66,62,2,2,2,2,2,0,0}, +{0,0,0,0,60,66,66,66,66,66,66,90,102,60,192,0}, +{0,0,0,0,62,66,66,66,62,18,34,34,66,66,0,0}, +{0,0,0,0,60,66,66,2,12,48,64,66,66,60,0,0}, +{0,0,0,0,254,16,16,16,16,16,16,16,16,16,0,0}, +{0,0,0,0,66,66,66,66,66,66,66,66,66,60,0,0}, +{0,0,0,0,130,130,130,68,68,68,40,40,16,16,0,0}, +{0,0,0,0,66,66,66,66,90,90,102,102,66,66,0,0}, +{0,0,0,0,66,66,36,36,24,24,36,36,66,66,0,0}, +{0,0,0,0,130,130,68,68,40,16,16,16,16,16,0,0}, +{0,0,0,0,126,64,64,32,16,8,4,2,2,126,0,0}, +{0,0,0,112,16,16,16,16,16,16,16,16,16,16,112,0}, +{0,0,0,0,2,2,4,8,8,16,16,32,64,64,0,0}, +{0,0,0,14,8,8,8,8,8,8,8,8,8,8,14,0}, +{0,0,24,36,66,0,0,0,0,0,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,0}, +{0,4,8,16,0,0,0,0,0,0,0,0,0,0,0,0}, +{0,0,0,0,0,0,60,66,64,124,66,66,98,92,0,0}, +{0,0,0,2,2,2,58,70,66,66,66,66,70,58,0,0}, +{0,0,0,0,0,0,60,66,2,2,2,2,66,60,0,0}, +{0,0,0,64,64,64,92,98,66,66,66,66,98,92,0,0}, +{0,0,0,0,0,0,60,66,66,126,2,2,66,60,0,0}, +{0,0,0,48,8,8,8,62,8,8,8,8,8,8,0,0}, +{0,0,0,0,0,64,92,34,34,34,28,4,60,66,66,60}, +{0,0,0,2,2,2,58,70,66,66,66,66,66,66,0,0}, +{0,0,0,16,16,0,24,16,16,16,16,16,16,124,0,0}, +{0,0,0,32,32,0,48,32,32,32,32,32,32,32,18,12}, +{0,0,0,2,2,2,34,18,10,6,10,18,34,66,0,0}, +{0,0,0,24,16,16,16,16,16,16,16,16,16,124,0,0}, +{0,0,0,0,0,0,110,146,146,146,146,146,146,146,0,0}, +{0,0,0,0,0,0,58,70,66,66,66,66,66,66,0,0}, +{0,0,0,0,0,0,60,66,66,66,66,66,66,60,0,0}, +{0,0,0,0,0,0,58,70,66,66,66,66,70,58,2,2}, +{0,0,0,0,0,0,92,98,66,66,66,66,98,92,64,64}, +{0,0,0,0,0,0,58,70,66,2,2,2,2,2,0,0}, +{0,0,0,0,0,0,60,66,2,12,48,64,66,60,0,0}, +{0,0,0,0,8,8,8,62,8,8,8,8,8,48,0,0}, +{0,0,0,0,0,0,66,66,66,66,66,66,98,92,0,0}, +{0,0,0,0,0,0,66,66,66,36,36,36,24,24,0,0}, +{0,0,0,0,0,0,130,146,146,146,146,146,146,108,0,0}, +{0,0,0,0,0,0,66,66,36,24,24,36,66,66,0,0}, +{0,0,0,0,0,0,66,66,66,66,66,100,88,64,64,60}, +{0,0,0,0,0,0,126,64,32,16,8,4,2,126,0,0}, +{0,0,0,48,8,8,16,16,8,4,8,16,16,8,8,48}, +{0,0,16,16,16,16,16,16,16,16,16,16,16,16,16,16}, +{0,0,0,12,16,16,8,8,16,32,16,8,8,16,16,12}, +{0,0,0,140,146,98,0,0,0,0,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,0,24,24,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,0,0,0,8,48,96,64,0,0}, +{0,0,0,0,0,0,0,0,0,0,48,72,72,48,0,0}, +{0,32,64,832,248,288,288,2016,2224,4264,4164,4196,2132,1544,0,0}, +{0,0,0,0,2,1540,2052,4100,4164,6180,4136,24,16,0,0,0}, +{0,32,448,0,0,904,368,128,64,32,112,136,132,7940,0,0}, +{0,0,16,32,1568,2274,4412,6416,272,272,264,136,164,68,0,0}, +{0,4096,9232,2080,544,1250,2364,4368,6416,272,264,136,164,68,0,0}, +{0,64,128,1664,496,256,3840,760,1024,1024,4064,2064,16,96,896,0}, +{0,256,512,512,256,128,96,16,16,32,64,128,256,512,512,0}, +{0,256,516,1032,1032,15368,1988,1028,1028,1028,1028,1048,520,520,256,0}, +{0,0,16,2016,256,128,0,0,0,0,4,4,2056,2032,0,0}, +{0,32,64,3200,900,376,512,512,2016,1040,8,8,48,960,0,0}, +{0,0,8,16,16,16,16,16,16,16,4112,2064,1568,448,0,0}, +{0,128,256,7938,508,256,448,800,544,960,512,256,256,128,64,0}, +{0,0,256,520,528,7696,978,572,528,528,784,528,32,1984,0,0}, +{0,0,16,288,224,60,3856,6160,1040,8,8,136,132,7940,0,0}, +{0,4096,9232,2336,224,60,3856,6160,1040,8,8,136,132,7940,0,0}, +{0,16,32,800,226,60,16,784,1232,2104,2056,2048,1024,768,224,0}, +{0,0,0,0,0,0,0,896,1120,2076,2048,2048,1024,768,224,0}, +{0,0,0,0,1984,2098,4108,4096,4096,4096,2048,1536,448,0,0,0}, +{0,0,7168,962,316,128,128,64,64,64,64,64,128,1792,0,0}, +{0,0,7168,962,4412,9344,2176,64,64,64,64,64,128,1792,0,0}, +{0,0,32,64,64,64,3648,448,96,16,8,8,16,4064,0,0}, +{0,32,64,320,252,3616,6160,1040,520,520,516,960,1568,2592,448,0}, +{0,0,4,8,3848,6344,1028,4,4,4,68,84,8072,8,8,0}, +{0,0,0,960,1200,2184,4232,4164,4164,4132,2084,2068,1544,384,0,0}, +{0,512,1028,1032,7208,1992,1028,1028,1028,1028,1940,3144,5192,904,0,0}, +{0,0,0,0,0,96,144,264,516,3072,12288,0,0,0,0,0}, +{0,0,0,2048,4608,1120,144,264,516,3072,12288,0,0,0,0,0}, +{0,128,256,3848,496,256,1800,496,256,256,496,1800,2312,240,0,0}, +{0,0,272,480,128,128,1088,2112,4080,6188,9250,1042,524,256,0,0}, +{0,16,32,228,3128,4128,12344,36,36,1076,2072,2064,2064,2016,0,0}, +{0,64,128,136,112,448,72,1060,1080,2272,2080,2080,2080,1088,896,0}, +{0,128,256,896,24,3848,4304,4146,4140,3648,64,128,128,256,256,0}, +{0,64,128,896,96,16,16,16,1936,2160,2064,2064,1024,768,192,0}, +{0,8,400,592,1072,1072,1040,1040,1040,1040,512,512,256,128,64,0}, +{0,0,784,736,256,128,64,992,1072,2056,2052,2496,1568,544,448,0}, +{0,0,8,16,912,1104,1080,1078,1040,1048,1048,1044,9234,6168,16,0}, +{0,32,64,840,240,32,1056,7408,792,388,320,288,16,16,2016,0}, +{0,64,128,128,64,64,32,32,240,272,264,4360,2308,1540,0,0}, +{0,0,0,0,0,0,0,1924,1144,576,384,128,128,64,32,0}, +{0,0,0,3972,2168,1024,576,384,128,128,128,64,64,32,16,0}, +{0,0,1024,1024,512,256,192,176,268,256,256,256,256,256,256,0}, +{0,0,0,0,3584,504,64,128,128,128,128,4032,4156,0,0,0}, +{0,0,256,512,512,7684,1016,768,640,576,544,528,520,768,512,0}, +{0,0,64,128,128,3972,2296,2112,2112,1056,1056,1040,648,772,256,0}, +{0,0,32,64,3648,448,184,128,7808,448,316,256,512,512,512,0}, +{0,0,32,3648,2496,1088,1056,544,528,264,256,128,64,32,16,0}, +{0,4096,9232,11040,2784,544,528,272,264,132,128,64,32,16,8,0}, +{0,4096,9232,10272,2080,7200,1008,144,264,260,256,128,128,64,32,0}, +{0,0,0,0,3972,2168,2048,2048,2048,1024,1024,1984,1080,0,0,0}, +{0,0,256,528,544,544,7972,760,544,544,544,256,256,128,64,0}, +{0,0,0,48,64,0,24,4128,2048,1024,512,256,200,48,0,0}, +{0,0,4096,9264,10304,2048,24,4128,2048,1024,512,256,200,48,0,0}, +{0,0,0,1800,1264,512,512,256,256,640,1088,2096,2060,0,0,0}, +{0,4096,9216,11140,2680,256,256,128,128,320,544,1048,1030,0,0,0}, +{0,0,16,32,32,7712,4512,2148,1080,544,32,32,64,3968,0,0}, +{0,0,64,128,3968,2112,1088,1184,784,520,256,128,64,48,12,0}, +{0,0,512,384,120,128,7936,452,312,256,256,128,128,64,32,0}, +{0,0,0,0,0,0,0,544,1096,1104,528,512,256,128,64,0}, +{0,0,0,2080,4164,4232,2192,2064,1024,1024,512,256,128,64,0,0}, +{0,0,16,32,32,32,32,224,800,1056,32,32,32,32,32,0}, +{0,1024,2312,2576,528,16,16,112,400,528,16,16,16,16,16,0}, +{0,0,0,0,1792,248,0,0,0,0,3968,4220,0,0,0,0}, +{0,0,4096,9216,10240,2320,544,1056,2064,2064,4104,4100,4098,0,0,0}, +{0,6144,9216,9216,6144,272,544,1056,2064,2064,4104,4100,4098,0,0,0}, +{0,0,0,3848,2288,2048,1024,1024,512,512,256,128,64,32,0,0}, +{0,4096,9216,11204,2616,512,256,256,128,128,64,32,16,8,0,0}, +{0,6144,9216,10180,6712,512,256,256,128,128,64,32,16,8,0,0}, +{0,0,64,128,128,128,64,64,576,1056,3104,5012,4216,0,0,0}, +{0,0,512,1024,1024,1024,1120,896,512,1280,2304,128,64,48,12,0}, +{0,0,0,1800,240,64,64,8132,120,64,64,64,3968,0,0,0}, +{0,0,0,0,0,0,32,3648,2496,1144,640,128,256,256,256,0}, +{0,0,0,0,0,0,0,896,624,512,256,1920,2168,0,0,0}, +{0,0,0,0,0,0,1920,1136,1024,1920,624,512,896,1136,0,0}, +{0,0,0,904,112,3584,2500,2104,2048,1024,1024,512,256,192,48,0}, +{0,0,512,1040,1056,1056,1056,1056,1056,1056,512,512,256,128,64,0}, +{0,0,0,128,272,288,288,4384,4384,2336,2320,1296,776,260,0,0}, +{0,0,8,16,16,16,16,16,2064,1040,528,272,208,48,0,0}, +{0,0,0,0,3972,2168,2056,2056,1040,1040,1936,2160,16,0,0,0}, +{0,0,0,0,24,4128,4160,2048,2048,1024,512,256,200,48,0,0}, +{0,0,0,0,0,0,192,480,480,192,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,7938,252,0,0,0,0,0,0,0}, +{0,0,0,0,0,0,0,32767,0,0,0,0,0,0,0,0}, +{0,16382,128,128,128,128,128,128,128,128,128,128,128,128,160,64}, +{64,64,64,64,64,64,8128,64,64,64,64,64,64,64,32767,0}, +{0,32767,64,64,64,64,576,1088,2112,4160,4160,64,64,64,64,64}, +{0,16382,256,256,128,128,704,1184,2192,4232,8324,8322,129,128,128,128}, +{8,8,8,16376,8,4,4,8188,4096,4096,4096,5119,4096,4096,2560,1024}, +{0,32767,544,544,544,16382,8738,8738,8738,9554,10578,10378,8258,8194,10242,4098}, +{2056,1040,544,16382,544,544,544,8738,8740,4648,2600,544,544,544,32767,0}, +{128,128,128,128,8188,4228,4228,4228,4228,4228,8188,4228,128,128,128,128}, +{128,132,136,136,128,8190,4160,4160,4416,4640,4640,4112,4104,4100,2562,1025}, +{64,128,128,0,8190,2048,1024,512,256,128,64,32,24,36,32706,0}, +{1024,3840,248,8,136,132,132,16380,128,1168,2192,4232,8324,8322,160,64}, +{128,128,136,3208,2952,2280,2204,2187,2184,2696,1160,16520,16392,16392,32752,0}, +{0,8190,2048,1024,512,384,128,128,128,128,128,128,128,128,160,64}, +{0,8188,128,128,128,128,32767,128,128,128,128,128,128,128,160,64}, +{64,128,128,32767,0,2056,4104,9220,9234,544,320,128,320,560,3084,28675}, +{16,16336,8336,8328,8328,4364,4364,4362,2569,2568,1032,1032,2568,4360,8328,16488}, +{128,128,320,544,1040,2056,4100,25619,1040,1040,1040,1040,1032,1032,1028,1026}, +{2064,2064,2064,2056,32744,2060,2060,2058,2185,2312,2312,2056,2056,2056,2568,1032}, +{2320,4368,4368,264,32008,1004,268,522,521,520,1032,17416,18440,20488,24584,16392}, +{2048,2080,2116,2180,2180,2052,2052,1028,1028,1028,548,2580,4364,8324,16448,16416}, +{1040,1040,1168,1160,16264,1100,1100,1066,1033,32744,1032,1032,1032,1032,1032,1032}, +{128,128,320,544,1040,6156,26611,0,0,16382,64,32,1040,2056,8188,4104}, +{16,16,16336,8264,8264,8268,16332,8266,8265,8264,16328,8264,8,8,32744,8}, +{272,528,528,8,16360,12,4108,4170,4169,2184,2184,2184,1160,1032,32760,8}, +{272,528,16,16360,520,524,524,522,16361,520,520,520,520,520,32760,8}, +{528,528,528,520,16360,524,1804,1802,2697,2696,4680,12200,16920,520,520,520}, +{144,144,144,32648,328,332,300,7946,265,264,264,16136,264,264,264,264}, +{272,272,272,32648,16520,8268,1068,1034,5257,9352,9288,17480,17448,1032,1288,520}, +{520,520,32760,516,516,16358,8742,8741,16356,516,580,644,260,644,3140,28724}, +{272,528,528,32744,264,268,652,8842,4809,3240,1176,2184,4232,8840,16776,136}, +{8,32744,520,16356,8740,8742,16358,8741,8740,16356,580,644,260,644,3140,28724}, +{16,8144,4176,4168,4168,8140,524,522,16361,1800,2696,4680,8744,16920,520,520}, +{264,264,8072,4228,2388,1590,6549,25716,788,2260,1044,4884,2260,1540,388,100}, +{1032,1032,24344,9252,5156,32646,1030,573,16164,8868,8804,15908,8868,8804,15908,8708}, +{2184,2184,32760,2180,3972,518,16358,8741,16356,516,32756,516,16356,516,32756,4}, +{2088,2120,24136,18676,10244,32502,4102,2293,15364,9972,9620,15508,9364,9460,15508,9220}, +{128,136,136,8184,132,130,128,32767,544,544,544,528,16912,16904,31748,3}, +{32,64,128,128,128,320,320,320,544,544,1040,1040,2056,2052,4098,24577}, +{128,128,320,544,1040,2056,6132,24707,128,128,4088,128,128,128,16382,0}, +{0,32767,128,128,128,16382,8322,8842,9362,9362,10922,10662,8322,8322,10370,4098}, +{1056,1056,1056,1056,16380,1056,1056,1056,1056,1056,32766,0,1056,2064,4104,8196}, +{2056,2064,1040,0,8188,128,128,128,32767,128,320,320,544,1040,6156,24579}, +{0,4088,2056,2056,4088,2056,4088,2056,4088,2056,2056,32767,544,1040,2056,4100}, +{128,128,128,16382,8322,8322,8322,8514,8770,9250,10258,10250,8194,8194,10242,4098}, +{0,32767,128,128,8188,4228,4228,8188,4228,4228,32767,4100,4100,4100,5124,2052}, +{128,128,4228,4228,4228,4228,8188,4224,128,128,8322,8322,8322,8322,16382,8192}, +{8,8,16264,8712,8712,8824,8719,8712,8712,8776,8744,8472,8456,8320,5184,2080}, +{8200,8232,8264,9224,9672,9279,9224,9352,9352,9288,9264,9488,8488,8516,10627,4352}, +{8192,8702,8208,9232,9464,9352,9348,9348,9290,9297,9248,9248,8208,8200,10244,4098}, +{4,8,16256,8767,8720,8712,8712,8748,8730,8745,8744,8456,8456,8328,5192,2088}, +{8192,8703,8208,9224,9284,9346,9727,9488,9232,9232,9470,9232,8208,8688,10271,4098}, +{16384,17404,16900,16900,19452,18500,18500,18500,19452,19018,19018,19018,17097,16712,20544,8256}, +{2056,2064,1040,32767,0,4220,4676,4676,4732,4676,4676,4732,4164,4164,5204,2084}, +{8,8,8,15880,8831,8776,8776,8776,8776,8776,8776,8776,8772,15940,8786,33}, +{512,512,574,512,16256,8704,8831,8708,8708,8452,8466,8482,8383,8354,5184,2080}, +{1024,1086,1058,1058,16162,9278,9250,9250,9278,9250,9250,8738,8818,8463,5248,2112}, +{1032,1040,1024,1279,16128,9252,9282,9345,9252,9256,9232,8744,8772,8514,5249,2112}, +{1264,1054,1040,1535,15888,9470,9362,9470,9362,9470,9232,9470,8720,9200,10527,4226}, +{16,16,4088,2056,2052,2554,2313,2312,2312,2552,2568,1032,8200,8200,16368,0}, +{272,272,8464,4360,2312,1292,780,266,393,328,296,16648,16648,16648,32264,8}, +{2048,7936,252,128,128,128,128,32767,128,128,128,128,128,128,128,128}, +{2056,1040,544,8188,4228,4228,8188,4228,4228,8188,128,128,32767,128,128,128}, +{64,64,8128,64,64,64,32767,64,64,576,1088,2112,4160,64,64,64}, +{0,32764,4,260,260,260,16372,8452,8452,8324,8324,8260,8260,8226,5138,2057}, +{0,32764,260,132,4068,2084,2084,4068,2084,2084,4068,260,2340,4370,8522,129}, +{64,544,1040,4088,64,16382,1040,2312,4292,25139,384,2144,1048,768,224,30}, +{0,2044,1040,1040,528,528,7984,4176,4176,2192,2184,1288,516,1284,6338,24625}, +{0,0,16319,8480,8482,8482,4372,4372,2568,2568,1044,1044,2594,4386,8321,16448}, +{2048,7936,252,4,4,8188,4132,2084,2116,1092,644,260,642,1090,6193,24588}, +{0,511,16196,8772,8828,8772,8772,8828,5188,5188,5604,2143,2114,5184,8768,16704}, +{64,128,32767,544,2600,4644,8738,0,4092,1040,544,320,128,864,3096,28679}, +{0,4088,2056,2056,2056,2056,2056,2056,4088,2056,0,1040,2064,4104,8196,8194}, +{0,32766,2048,2048,2296,2184,2184,2184,2184,2184,2296,2184,2048,2048,2560,1024}, +{64,64,32,1040,2056,4100,16382,8196,0,4088,2056,2056,2056,2056,4088,2056}, +{128,128,128,8188,4228,4228,4228,8188,4228,128,136,144,96,416,3608,28679}, +{0,4088,2056,2056,2056,4088,0,32767,16,8,4088,2048,2048,2048,1280,512}, +{64,64,4064,2064,1064,582,320,128,96,8184,4119,4112,4112,4112,8176,4112}, +{2048,7936,248,8,8,32760,8,8,8,8168,4136,4132,4132,4130,8161,4128}, +{0,4032,2078,2066,2194,2194,2194,16274,8210,8210,8222,12242,8192,8192,5120,2048}, +{128,128,320,544,1104,6284,24707,2032,512,256,4088,2056,2056,2056,4088,2056}, +{128,256,16376,8200,8200,8200,16376,8,8,8,16360,8228,8228,8226,16353,8224}, +{128,136,136,8184,132,130,128,32767,0,0,4088,2056,2056,2056,4088,2056}, +{32,112,30,15888,8720,8959,8720,8728,8760,8788,8788,8722,15889,8720,16,16}, +{128,128,3983,2121,1065,8153,4681,4681,4681,4681,32751,1289,1280,2176,4160,24624}, +{520,528,32380,4420,4804,2684,1028,6658,24962,1,4088,2056,2056,2056,4088,2056}, +{1040,1056,1276,31876,8836,8836,8956,9476,5124,5372,2188,2186,5258,5369,8840,16640}, +{128,128,4047,2089,1049,16361,8233,9513,10409,8745,527,32761,1280,2176,4160,24624}, +{0,16254,8514,8514,16254,0,8188,4228,8188,4228,8188,128,32767,128,128,128}, +{0,32640,1182,16274,1170,16274,1170,1170,32658,16402,21854,21842,21824,16448,10240,4096}, +{0,16380,8196,8196,10212,9252,9252,9252,9252,9252,10212,8196,8196,16380,8196,0}, +{64,64,32,32767,16,528,520,524,16362,521,520,520,520,520,32760,8}, +{8,8,32712,2056,2056,1087,1032,5640,9736,9480,17592,17479,1058,1024,1024,1024}, +{10244,18436,2052,32740,2052,2079,19396,19012,19012,10820,11204,4124,22279,22754,25664,16896}, +{520,520,574,8072,4616,4735,4642,4756,4926,4616,5384,5503,20744,20616,24712,16456}, +{8,16136,8510,8456,10504,4479,290,16148,9534,9480,5384,5503,2312,5384,8968,16648}, +{4164,2180,4,16356,8740,10943,10020,8740,16356,4,8132,4188,8135,4162,8128,4160}, +{260,516,32756,4,16356,9535,16356,4676,2692,4164,8740,5404,2183,4290,25264,384}, +{128,128,32767,128,16382,0,8188,4228,4228,8188,4,4,4,2,2,1}, +{520,520,520,632,1608,2628,4676,8778,8745,552,528,528,552,196,32514,1}, +{64,128,32767,544,2600,4644,8738,16,4080,2056,1044,546,448,1584,6156,24579}, +{8,8,16376,4,4090,2057,4088,2056,4088,32,4080,1048,550,448,3640,28679}, +{16382,64,4088,2056,4088,2056,4088,2056,4088,16,4088,1044,546,448,3640,28679}, +{128,128,128,128,128,32767,128,128,320,320,544,544,1040,2056,4100,24579}, +{128,136,136,136,8184,132,130,128,32767,128,320,320,544,1040,2056,12294}, +{128,128,128,16382,128,2184,1168,128,32767,128,320,320,544,1040,6156,24579}, +{128,128,128,16382,128,2184,2184,2184,5268,8866,320,320,544,1040,6156,24579}, +{8,16136,8200,4104,2111,1060,1060,32676,1060,1042,1044,1032,1044,1058,1313,512}, +{1032,1032,1032,520,4671,8484,32676,16676,36,16146,8468,8456,8468,8482,16129,8448}, +{64,128,32766,16386,8193,2040,512,256,128,32767,128,128,128,128,160,64}, +{32,32,32767,16,16,8136,2056,1036,522,32745,520,520,520,520,648,264}, +{64,128,16380,8196,4162,64,64,32767,1056,1040,536,608,384,1600,2096,4110}, +{64,128,32766,16386,8193,0,8188,128,128,136,8072,136,136,148,32738,1}, +{64,128,32766,16386,8321,128,8188,128,4088,128,16382,320,544,1040,6156,24579}, +{2048,2048,2048,2174,32576,2112,2084,2344,2576,2576,2088,2120,2116,2050,2560,1024}, +{2052,2056,2056,2048,32639,2080,2080,2322,2580,2568,2056,2068,2084,2082,2561,1024}, +{272,7952,4240,2130,1300,532,2320,2256,2072,32724,2067,2192,2320,2064,2576,1040}, +{544,15908,8996,5284,2340,1340,4640,4512,4159,32676,4132,4388,4644,4130,5153,2080}, +{4136,4136,4266,4204,32296,4351,4096,4676,5160,5374,4112,4220,4112,4336,5150,2052}, +{128,128,128,128,128,2184,4232,8328,8324,16516,16514,16513,128,128,160,64}, +{0,8188,4100,4100,8188,4,4,16380,8196,10212,9252,9252,10210,8194,5121,2048}, +{0,8188,4100,4100,8188,2084,1092,8180,1092,1092,16380,1092,1090,1058,1057,1040}, +{0,16380,8196,16380,4,8180,260,8180,4372,8180,260,16380,10506,12266,10249,4104}, +{128,4228,4228,8188,0,4088,2056,2568,2600,2376,2184,18760,21028,21012,24578,16385}, +{0,0,16382,128,128,128,128,128,128,128,128,128,128,32767,0,0}, +{0,4092,2048,2048,2048,2052,2052,4092,4,4,4,8196,8196,8196,16376,0}, +{1168,1168,16382,1168,1168,0,32766,16514,8321,4088,2184,2184,2696,1160,128,128}, +{128,2184,1168,32766,16386,10225,1040,1040,2032,128,4088,2184,2184,2696,1160,128}, +{544,16382,544,4088,2056,4088,2056,4088,32,32767,2184,8188,26763,2696,1160,128}, +{0,16382,128,128,2184,2192,1168,128,32767,128,128,128,128,128,128,128}, +{2056,2064,1040,0,16382,1040,1040,1040,1040,32767,1040,1040,1032,1032,1028,1026}, +{128,256,32764,132,132,16380,68,292,276,8180,260,260,32762,258,257,256}, +{128,256,32764,4,15364,996,548,548,548,32740,1060,1060,18468,20642,25186,17441}, +{128,256,32764,1092,1092,16380,1092,1092,1988,4,4084,2084,1090,898,3169,28700}, +{128,256,32764,260,16380,260,8180,4372,8180,4372,8180,260,32762,258,257,256}, +{512,512,8159,4624,32744,4616,8132,542,8144,528,530,16364,520,564,32706,1}, +{0,16382,1040,1040,1040,1040,1040,32767,1040,1040,1040,1040,1032,1032,1028,1026}, +{4608,8704,8704,512,32767,512,512,636,528,528,1040,17424,18672,20510,24580,16384}, +{4096,4350,4224,4224,4224,4348,4100,4100,4098,4350,4224,4224,4224,4224,4176,4128}, +{1024,543,4368,8336,32720,17438,1026,32706,17474,17502,32720,1040,9232,17424,32746,16388}, +{0,16287,8336,8336,16272,1054,1026,32706,17474,17502,32720,1040,9232,17424,32746,16388}, +{128,4228,4232,2192,1168,128,8190,4096,4096,4096,8188,4096,4096,4096,8190,4096}, +{16,8144,2056,1028,1554,6416,8328,16492,10,16329,520,520,520,520,32744,8}, +{16,8144,4168,4164,8146,4176,4168,8140,8778,4681,3144,1096,2120,4424,24776,72}, +{1040,528,4360,2180,2002,528,4360,16332,8458,265,8072,4296,2344,1544,6536,24680}, +{16,16336,8,9348,4690,2352,4680,9356,10,16329,520,520,520,520,32744,8}, +{8208,8336,4360,2308,18,32720,1032,1036,1162,15497,1160,1160,1352,1608,31784,24}, +{144,144,32648,68,16306,8336,16264,8332,16266,265,16136,4232,2376,1544,6536,24680}, +{0,64,128,256,256,32,4128,8228,8228,16420,16418,18466,2081,2080,4032,0}, +{0,32,2112,2176,1152,1040,4628,8724,8468,16530,16466,18481,2064,2072,4068,2}, +{128,256,32764,4,132,260,580,68,68,4180,8276,10324,2122,2114,3969,0}, +{520,520,520,8136,4632,4650,4618,4618,32745,520,1288,1288,2184,2184,4168,24616}, +{1032,1032,1160,1160,16280,1194,1098,1034,1033,16264,1032,1032,1032,1032,32712,8}, +{128,64,4088,2056,4088,2056,4088,2056,4088,2056,128,8464,18706,18450,4065,0}, +{520,520,16360,520,8152,554,32746,10,8137,4168,8136,4168,8136,4168,5192,2120}, +{8132,4164,8132,4172,8149,5,16357,9509,9508,16356,4,8132,2180,1796,6340,24628}, +{264,520,16328,4248,2346,32746,10,16329,8264,16328,8264,16328,520,9384,20648,24344}, +{1024,5120,9216,9342,1088,31808,1956,9256,9232,5136,5160,2120,19524,20994,24832,16512}, +{4608,8704,512,32767,512,512,8828,8772,8772,5188,5244,18432,19680,21022,24836,16576}, +{5136,9456,9232,1278,29842,3890,1182,9442,9218,5370,5122,2298,18570,21754,25169,16892}, +{64,128,16380,8196,8196,16380,260,260,260,16372,644,644,1090,2082,4113,24584}, +{2048,7936,252,128,128,8188,128,128,128,32767,128,128,128,128,160,64}, +{256,256,256,256,32767,384,320,320,288,288,272,264,260,258,320,128}, +{520,520,520,520,8127,4616,4616,4648,4760,4876,4619,5384,21768,20616,24650,16420}, +{2312,4360,4360,264,15679,968,264,4392,4376,2316,1547,8712,9480,10376,12362,8196}, +{8,16264,8328,8328,8383,8328,16264,9384,1176,1164,2187,2184,4168,4168,8234,16404}, +{8,16264,9352,9352,9407,16264,9352,9384,9368,16268,9355,1032,1032,1032,1034,1028}, +{4,8164,4164,2180,1295,516,3460,29284,524,8135,516,516,16356,516,517,514}, +{1032,1032,1032,16264,1087,1032,32712,4104,4120,32716,4107,4360,4616,4104,5130,2052}, +{520,1032,1032,32712,16479,8744,520,32728,4364,4363,4232,2824,1032,2568,4362,8388}, +{14344,1928,1032,1032,32703,1032,16264,9384,9368,16268,9355,9352,16264,1032,1034,1028}, +{8,7944,4360,4360,7999,8,16264,8360,9368,9356,9355,9352,2568,4616,8458,8388}, +{264,264,7944,4232,2143,16296,9352,9368,9356,9355,32744,2568,2568,4360,8330,16484}, +{8,16264,8200,16136,8255,16264,8,32712,17496,1036,16267,9352,9352,11400,5258,1028}, +{14344,1992,8456,8776,4799,2184,32744,16424,24,8140,4235,2184,1288,520,3466,28772}, +{520,1032,1032,32712,16479,10536,4232,8280,12,16267,1032,1032,1032,1032,32746,4}, +{4360,4360,32712,4360,4415,8,16264,9384,9368,9356,16267,9352,9352,9352,16266,8324}, +{4100,15364,996,516,543,32756,516,660,14956,8743,8740,15076,8740,8740,16357,8226}, +{264,264,8072,4168,2111,32712,16456,19032,20812,17483,1032,32744,2568,4360,8330,16484}, +{8,8072,4232,4232,8127,8,16328,8296,16344,8268,16331,8264,16328,2312,4234,8260}, +{8,32712,19016,32712,1087,16264,1064,32728,4364,2571,16264,1032,32744,1032,1034,1028}, +{8132,4164,4164,8132,31,15844,9508,9524,15852,519,32756,1668,2628,4644,25117,514}, +{1060,1279,32292,9086,5185,2142,5202,25438,1056,1016,128,8188,128,16382,128,192}, +{128,128,128,16382,128,128,128,4092,2056,1040,544,320,128,864,3096,28679}, +{516,520,512,383,32516,4228,4476,4388,4388,2596,2596,1060,2594,4394,8337,16448}, +{520,520,520,264,32639,4232,4424,4360,4414,2594,2594,1058,2594,4414,8354,16448}, +{1032,1040,1024,31999,8704,8740,8770,9601,5156,5160,2064,2088,5188,4674,8449,16512}, +{512,574,290,32546,4286,4258,4450,4414,4386,2594,2622,1024,2580,4388,8354,16449}, +{1040,1170,1108,31760,8959,8788,8850,9489,5128,5247,2116,2114,5158,5144,8748,16707}, +{2064,2302,2194,1535,31890,8958,9232,9470,9362,5374,5128,2303,5252,5198,8752,16847}, +{64,128,128,32767,2056,2056,1040,1040,544,320,128,320,544,1040,6156,24579}, +{4112,4368,4690,4692,4148,4368,4735,4632,4152,28756,8020,4114,4113,4112,4112,4112}, +{8,8208,7934,512,580,552,32511,4624,4624,4862,4624,4692,4754,4369,4372,4232}, +{1028,1032,1024,2687,2564,4356,8380,16484,1572,2084,36,804,1058,2090,4113,0}, +{0,4092,64,64,64,64,16382,288,288,288,272,272,8456,8452,15874,1}, +{0,16318,1058,1058,1214,1186,32674,1086,1026,3090,2594,2642,18762,18694,28802,64}, +{0,4088,2056,2056,2056,2056,2056,4088,2056,2056,2056,2056,2056,2056,4088,2056}, +{0,4088,2056,2056,4088,2056,2056,4088,544,8738,8740,4648,2600,544,32767,0}, +{1024,1024,1086,16290,1058,1058,32738,4158,4130,32674,4130,4386,4670,4130,5120,2048}, +{4088,2056,4088,2056,4088,128,32767,0,4088,2056,2056,4088,128,4228,8354,64}, +{256,512,16350,18,4242,2322,32754,30,8082,4242,4242,8082,4254,4242,8064,4224}, +{128,4092,2176,32767,2176,4092,128,8188,128,32767,0,4088,2056,4088,2056,4088}, +{1040,1040,16254,1040,32639,2600,4420,24706,4089,2056,2056,4088,2056,2056,4088,2056}, +{4088,2056,4088,2056,4088,0,32767,68,8060,4420,2428,2628,1268,2639,4418,24768}, +{128,320,1584,7148,24579,8188,5268,4772,8188,0,4088,2056,4088,2056,4088,2056}, +{0,8176,4112,4112,4112,8176,4112,4112,4112,8176,4112,4112,4104,4104,5124,2050}, +{64,64,32767,32,32,4080,2064,2072,4084,2066,2065,4080,2064,2064,2576,1040}, +{128,128,128,8188,128,128,128,32767,448,672,1168,2184,4228,24707,128,128}, +{128,128,128,128,16382,448,672,672,1168,2184,4228,10226,16513,128,128,128}, +{8,3976,2184,2184,2239,2184,2188,2204,2218,2218,2185,18568,18568,18504,28744,40}, +{4112,4112,4112,4112,32639,4112,6168,6200,5204,5204,4626,4369,4112,4112,5136,2064}, +{0,4088,2184,2184,4088,2184,2184,4088,2184,128,32767,672,1168,6284,24707,128}, +{128,128,32767,672,1168,2184,8188,26635,2056,4088,2056,2056,4088,0,32767,0}, +{8328,8456,4360,8,32735,1032,1036,16284,1066,1034,32713,1032,1032,1032,1032,1032}, +{1032,2056,2056,32712,1087,16904,8460,8092,2090,17450,8969,4296,2056,5128,8968,16584}, +{8,32648,136,136,32703,2184,2188,16028,2218,2218,2185,32648,136,136,32648,8}, +{128,16382,8194,32,32767,1040,632,960,7228,128,32767,672,1168,6284,24707,128}, +{1032,9352,9480,9480,5439,1032,16332,8220,8234,8202,16265,8200,8200,8200,16328,8200}, +{520,520,1288,1288,2239,4168,28588,28,4394,4618,4681,2696,2184,1032,32744,8}, +{1032,1032,32712,1032,1087,16264,8332,16284,8362,16298,8329,16264,8328,8328,32744,8}, +{1032,1032,2568,4360,8383,24392,1036,1052,16298,9386,9353,16264,2568,4360,8328,16456}, +{8324,8260,5090,18985,14887,5090,18985,31279,17384,128,32767,672,1168,6284,24707,128}, +{8,32712,2568,16264,10943,10888,16268,28,16298,42,32713,1032,5384,9352,17736,520}, +{2184,2184,16360,2184,63,8136,4172,8156,4202,8138,521,16360,1288,2184,4168,24616}, +{8328,4360,32712,1032,16319,1032,32716,1052,2090,1834,17417,11720,5384,9352,17768,520}, +{9352,9352,21832,30152,9375,21832,30156,9372,32746,2186,10377,10376,20808,21064,26696,17448}, +{1032,9352,5384,32712,16511,7944,4364,4380,7978,42,16265,9352,16264,9352,16264,8328}, +{1032,1032,2568,4360,8383,24392,12,28,15274,10922,10889,15240,4360,4360,10888,17480}, +{4360,32712,4360,31688,19071,31688,1292,2332,32682,1162,16329,1192,16264,1160,32648,136}, +{256,258,260,16132,8320,4240,592,552,520,1287,1284,2180,2180,4164,8228,16400}, +{0,16382,128,128,128,128,136,8072,136,136,136,136,136,136,32767,0}, +{544,544,544,8740,4644,2788,1572,548,548,548,548,16932,17140,16911,31746,0}, +{32764,4,12484,3644,2084,32508,2084,7284,10924,18724,260,7972,290,290,32765,0}, +{0,8164,4168,4168,4161,2178,2194,2192,1288,1288,519,516,1284,2180,4164,24624}, +{256,260,264,8168,4353,4354,4370,4368,32744,264,647,644,1092,2084,4116,24584}, +{0,3972,2184,2184,2177,2114,28714,24,8136,4164,4231,2180,1284,516,3460,28784}, +{512,516,520,520,16353,514,514,520,32760,516,263,132,2116,4132,16372,8224}, +{512,4676,4744,2696,513,8130,4178,4176,8136,4168,4167,8132,4164,4164,5188,2112}, +{0,16324,520,520,32737,1282,2178,4168,25128,516,4615,9796,19012,18980,644,256}, +{512,1028,32744,4232,2305,1538,6530,24680,4232,8068,4231,8068,4228,4228,4164,4128}, +{2112,2180,2184,32232,1089,578,15810,8520,4424,4420,32071,4420,4388,4388,5524,2056}, +{0,32740,1064,552,16289,8354,16290,8360,16296,9380,1063,5412,9364,17492,1292,512}, +{644,1160,16321,586,8168,596,8135,580,16324,68,128,32767,128,128,128,128}, +{2176,2180,32744,2184,3969,514,8146,4688,8136,520,16359,516,32756,1284,2180,12384}, +{32,32,32,32767,32,528,528,4624,4680,2632,548,1284,1282,2177,4160,24624}, +{64,72,80,4094,1056,544,8176,4112,2056,16376,8196,9556,9554,8201,5120,2048}, +{8,8,16376,1364,1362,1360,16382,1360,1360,1360,16382,0,4388,8772,8770,8193}, +{0,16318,8738,8738,8738,10530,4286,16162,8482,8482,8482,16190,0,4370,8738,8737}, +{4112,14354,1938,146,146,16318,8834,8834,8862,5266,5266,2194,2194,5202,8786,16689}, +{1032,1032,1034,16266,1086,1034,32713,4104,4152,32655,4106,4360,4616,4104,5128,2056}, +{2064,10256,18943,18448,2064,32510,2178,2218,2194,2234,5266,5374,5266,8850,8866,16706}, +{2064,10480,18448,18686,2194,32634,2194,2302,2130,5370,5258,5338,8874,8954,8618,16553}, +{0,16256,9407,9352,16264,9352,9352,16318,1032,1032,16264,1032,1080,1031,32706,0}, +{0,8188,4228,4228,4228,8188,4228,4228,4228,8188,4228,4228,4228,4226,5250,2049}, +{128,128,128,8188,4228,4228,4228,8188,4228,4228,4228,8188,20612,16512,16512,32512}, +{0,32767,0,0,10226,9362,9362,10226,9362,9362,9362,10226,8194,8194,16382,8192}, +{0,4088,2184,2184,4088,2184,2184,4088,320,1584,6700,25123,544,528,528,520}, +{96,16158,8706,8722,8738,10586,4230,0,8188,4228,4228,8188,4228,4228,8188,4100}, +{128,8188,4224,32767,4224,8188,128,16382,0,8188,4228,8188,4228,8188,0,32767}, +{128,2184,1168,32766,16386,12281,2056,2056,4088,0,8188,4228,8188,4228,8188,4100}, +{520,520,516,15998,8514,8514,8386,8770,9342,9282,8258,8258,8258,8318,5186,2048}, +{128,128,16382,128,4088,2056,2056,4088,2056,4088,2056,4088,2056,2056,32767,0}, +{15360,992,8719,9289,4233,32751,16425,4185,4175,32201,4393,5465,31887,4169,4128,4112}, +{0,8064,4159,4104,4360,4356,4412,32550,16422,16421,16420,24484,16444,16420,10244,4096}, +{512,512,15935,8456,4232,32580,18748,18726,32550,18725,18724,32548,18748,18596,20612,8256}, +{512,512,32735,17732,2308,32642,2206,2258,32691,2194,2194,32658,2206,2194,32640,128}, +{0,32640,1183,16260,1156,16258,1182,1170,32659,16402,21842,21842,21854,16466,10240,4096}, +{0,8188,0,0,0,0,32767,128,128,2184,4232,8324,16514,16513,160,64}, +{1040,1080,15887,8456,4744,3135,1032,4620,2460,31786,16938,9609,6152,2056,1544,392}, +{64,128,128,0,16382,0,2048,2056,1040,1040,544,544,288,0,32767,0}, +{64,128,8188,1040,544,32767,0,4088,2056,4088,2056,4088,128,32767,128,128}, +{1028,9352,9352,9407,16256,16,32721,1041,530,16274,10890,10890,10936,10887,10882,12416}, +{516,32508,2322,4257,8,8144,4100,5092,4644,4644,5092,4644,4644,5092,4100,6148}, +{8,16328,8452,4388,4386,2335,14600,8452,8850,8895,5280,5248,2133,5205,8737,16768}, +{128,8188,128,4088,128,32767,64,1056,1016,384,2144,8188,4224,1160,2212,4162}, +{128,128,8188,128,128,32766,16450,9249,1016,384,2144,8188,4224,1160,2212,4162}, +{8,8,16260,9380,9378,9375,9352,9348,16274,9407,9376,9344,9386,9386,16257,8320}, +{520,520,15876,8468,4498,2639,1032,2564,4370,24799,1552,2048,4117,789,1025,2048}, +{1032,1032,1028,32724,1042,1039,16264,4,18,16319,8352,8320,8362,8362,16257,8320}, +{1032,1032,2564,4372,8338,16463,7944,4,18,32735,1040,512,4373,8341,32705,16512}, +{8,32648,4,18708,9362,4687,9352,18692,18,32703,1056,1024,1066,1066,32705,0}, +{1032,1032,32708,1044,16274,15,32712,16452,8242,2335,2320,2304,2325,18581,18561,28736}, +{520,264,16260,8340,16274,8335,16264,1028,19474,11743,5392,5248,9365,9301,17697,512}, +{1028,1276,31746,4733,5460,5375,2130,5374,25120,272,248,2112,8188,4224,1192,2116}, +{1032,2568,4356,11924,16466,16271,9352,13700,9362,16319,32,7936,4394,7978,4353,7936}, +{8712,8520,22340,29268,9554,30543,17480,32708,8786,8543,22352,29248,9557,30549,17473,32704}, +{1032,32712,1028,16276,18,32719,19016,32708,8338,16319,8352,16256,8362,16298,4353,8320}, +{2568,4616,516,14884,1954,543,31240,1988,8706,4671,3074,17408,19000,20743,24770,16384}, +{8,16264,4100,2084,3106,4639,8456,16580,2,16319,1026,1024,1080,1031,32706,0}, +{1032,1032,1028,32740,1058,1055,16264,4,2,16319,8322,8320,8376,8327,16258,8320}, +{520,520,1284,2180,4178,24623,3976,4,2,16351,514,256,2200,4167,16354,8256}, +{1032,1096,1092,9412,5458,1103,16328,1092,3650,5471,9410,1088,1112,1095,32706,0}, +{1032,1032,16260,1060,1058,32735,16392,10500,2562,2239,2306,32704,5176,8711,16642,16576}, +{15368,1000,8772,5252,18,16351,264,260,32738,159,8066,4416,2648,1063,6930,24768}, +{16382,8738,8738,16382,128,32767,64,4088,2056,4088,2056,4088,2056,4088,2056,32767}, +{0,8188,4644,4644,8188,64,3064,1088,32767,192,4080,2076,4083,2064,4080,2064}, +{112,15247,8777,8746,11007,13084,8746,8769,12862,11050,9898,8766,8746,8746,10942,4386}, +{64,4160,3068,1088,576,32767,128,64,4080,2072,2068,4082,2065,2064,4080,2064}, +{1024,1084,1060,32676,1060,1084,1060,16292,8484,4412,4644,2596,1060,2594,4522,24689}, +{288,6432,1854,8480,8504,15911,2,4088,2056,4088,2056,4088,2056,2056,2568,1032}, +{520,8740,4674,3839,640,16896,17022,31810,66,8830,4674,3650,638,16962,16978,31778}, +{512,1054,1042,32754,18,30,2322,10834,9298,9310,10834,10578,8274,8274,16338,8217}, +{128,158,30866,18898,18578,18590,18578,19442,18578,18590,22610,10578,3058,2642,2066,2073}, +{18688,9374,4690,9362,18706,542,274,32722,16466,20830,19026,17490,19026,20818,32722,16473}, +{0,31070,19026,19026,19122,18590,18770,19026,19506,19422,23122,10834,2642,2642,3026,2649}, +{128,64,32,4088,2056,2056,2056,4088,2056,2056,4088,2056,2056,2056,4088,2056}, +{0,16382,64,32,1040,2056,8188,4096,128,128,8188,128,128,128,32767,0}, +{80,7244,4548,4164,7260,4548,4356,7516,4420,4420,32767,0,1040,2056,4100,8194}, +{1040,1040,32767,1040,128,128,4088,2184,2184,2184,32767,320,544,1040,6156,24579}, +{1040,1040,32767,1040,2048,7936,252,2184,1040,128,16382,672,1168,6284,24707,128}, +{544,32767,4640,9216,32760,1034,1514,9390,9704,5423,5610,2218,18601,21988,25092,16642}, +{128,8064,128,32764,16516,3972,8436,16132,36,7204,5604,21780,21676,25154,418,32281}, +{1040,9556,5298,2600,4420,32766,16514,8321,4088,2184,2184,4088,128,4224,16382,8192}, +{16,16272,8,4,18,16,32712,1036,1034,1033,1032,1032,1032,1032,1288,520}, +{520,528,512,638,576,1568,2576,4696,8756,8786,592,528,528,528,528,528}, +{128,128,16382,128,128,8188,128,128,32767,160,4368,2584,1044,6291,24656,48}, +{1040,1042,32724,1040,1048,1044,16275,80,128,32767,160,4400,2604,3235,28768,32}, +{5124,9224,32704,1055,1040,16264,9352,9388,16282,9385,9384,16264,9352,9352,9352,12424}, +{1060,1060,1084,16288,1087,1060,7972,98,128,32767,160,4400,2604,3235,28768,32}, +{0,16382,544,544,8188,4644,4644,8188,64,16382,1056,528,312,448,3680,4124}, +{0,4088,2056,2056,4088,2056,2056,4088,2056,2056,4088,544,544,16912,16908,31747}, +{1276,1060,31996,644,2812,4388,8188,2056,4088,2056,4088,2056,4088,16928,16920,31751}, +{0,4088,2056,2056,2184,2184,2184,2184,2184,2376,2376,288,288,16656,16652,32259}, +{1028,1028,1054,16274,9353,9406,9386,9386,16318,9386,1066,5182,9258,32746,16546,49}, +{4,16260,10910,10898,16265,318,16298,8810,12222,10922,10922,12222,8746,12202,10274,4145}, +{64,128,32767,0,0,8188,0,0,8188,0,0,8188,4100,4100,8188,4100}, +{4,8,16136,8319,8192,8254,8192,16190,8448,318,290,290,16674,16702,32290,0}, +{4,7944,4360,4479,4352,24766,64,16318,8448,8510,4642,2594,1058,2622,4386,24768}, +{260,264,256,16319,1152,1118,1024,1054,32704,1054,1042,1042,1042,1054,1042,1024}, +{4,16264,8320,8383,8320,8350,16256,9374,1152,1182,2194,2194,4178,4190,8226,16400}, +{2052,10248,18432,2111,32704,2078,2048,2974,2304,2334,2322,4370,22290,20958,24594,16384}, +{4100,15368,1928,1151,1024,32702,1024,1086,1024,16318,8354,8354,8354,8382,16290,8320}, +{1028,2056,2056,32703,1024,9278,8704,7998,18432,17470,8738,4514,2082,5182,8738,16768}, +{8324,8456,4352,63,32704,1054,1024,16286,1024,1054,32722,1042,1042,1054,1042,1024}, +{4,16328,8704,8895,8832,8542,10496,4254,576,1054,9490,16722,20818,20830,7714,0}, +{4,16328,512,575,8064,4382,4352,32734,0,30,8082,4242,4242,4254,8082,4224}, +{4,16264,8320,8383,16256,30,0,16286,1024,1054,32722,1042,2578,4382,8338,16448}, +{1028,1032,32704,1087,16256,30,32704,16478,8224,2334,2322,2322,2322,18590,18578,28736}, +{1028,1032,32704,1087,16256,1054,32704,30,16256,8350,16274,8338,16274,8350,10386,4224}, +{8324,4360,32704,1087,16256,1054,32704,10782,18816,2334,32722,2322,11026,20958,26898,17792}, +{1028,32712,1024,16319,0,32734,19008,32734,8320,16286,8338,16274,8338,16286,4370,8320}, +{8324,5090,18449,15823,4100,18898,31775,448,21845,21973,16,8184,1044,992,3096,28679}, +{256,4612,4680,4168,4160,2176,2191,2184,1288,1288,520,552,1304,2184,4160,24624}, +{256,260,264,16264,1152,1088,1039,1032,32712,1032,1032,1032,1064,1048,1032,1024}, +{0,3972,2184,2184,2176,28736,47,8136,4232,2184,2312,1320,536,1288,6336,24624}, +{256,516,520,32744,128,128,143,8072,4232,4232,4232,4264,4184,4168,2592,1040}, +{5120,9220,9224,1032,32736,1024,1039,2024,1160,2184,2184,2216,21400,20712,24640,16384}, +{4096,15364,1928,1032,1024,32704,1039,1032,1032,16264,8328,8328,8360,8344,16264,8320}, +{256,514,32756,260,2176,2176,9287,10212,4612,4356,2180,1108,2604,4356,8384,8240}, +{4160,4228,2184,8,16352,512,527,8136,520,520,32744,520,552,536,520,512}, +{0,16354,516,516,8128,4352,4359,32740,4,4,8132,4164,4180,4172,8132,4160}, +{0,8130,4164,4164,8128,0,16359,516,516,32756,516,1284,1300,2188,4164,24608}, +{512,514,16356,516,8128,512,32743,4,8132,4164,8132,4164,8148,4172,5188,2112}, +{1024,1028,16264,1032,1024,32704,16399,10504,2568,2184,2312,32712,5160,8728,16648,16576}, +{0,8188,128,128,32767,0,8188,4100,8188,4100,8188,4100,8188,1040,2056,4100}, +{130,16260,8784,4616,1287,6276,24676,4088,2056,4088,2056,4088,2056,4088,1040,2056}, +{0,8188,128,128,16382,0,0,4088,2056,2184,2184,2184,2120,800,3096,4102}, +{512,574,546,298,32554,4266,4458,4394,4394,2602,2602,1032,2580,4388,8354,16449}, +{128,130,16260,8784,4648,1287,2180,12388,4088,2056,2184,2184,2184,1600,6192,8206}, +{16,16,7952,4222,4112,4112,8063,4368,276,276,8564,8468,15892,26,32754,1}, +{512,574,7714,4386,2722,1086,2568,4360,24712,7994,4362,4362,4362,4410,7943,4352}, +{1040,5374,9232,32767,1040,1535,9232,9470,9362,5374,5266,2302,18448,22015,25104,16656}, +{5128,9224,32712,1087,1032,16318,9386,9406,16298,9406,9352,16319,9352,9352,9352,12424}, +{8,32648,8,18815,9352,4734,9386,18750,42,32702,1032,1151,1032,1032,32712,8}, +{1032,32712,1032,16319,9352,16318,9386,16318,17450,32702,4104,32703,4232,4360,5128,2056}, +{1028,1028,1028,16319,1026,522,32713,575,264,16264,8248,4367,2570,1032,2056,2056}, +{4,16260,4100,2111,3074,4618,8457,16639,8,16264,1080,1039,1034,1032,32712,8}, +{1040,5136,9470,1040,32767,1032,9224,9471,9220,5138,5374,2064,18672,21535,25104,16656}, +{5124,9220,32708,1087,1026,16266,9353,9407,16264,9352,9400,16271,9354,9352,9352,12424}, +{64,132,264,520,512,1280,1295,2184,2184,4168,8232,16408,8,20,32738,0}, +{0,8132,8,8,0,16352,527,264,2184,4168,16360,8264,8,20,32738,0}, +{4096,15364,968,72,64,16320,8271,4424,2632,1096,2632,4392,8360,20,32738,0}, +{2304,2308,2312,16328,2304,2304,2319,32744,2312,2312,2184,2184,2120,20,32738,0}, +{8128,4164,4168,8136,4160,4160,8143,8776,5192,2120,4424,8392,8264,20,32738,0}, +{512,580,584,8136,544,512,16367,1160,1160,1160,9288,9288,14376,20,32738,0}, +{0,8162,2052,1412,512,16352,8743,8740,16356,8740,8740,16356,8740,10788,4138,32753}, +{512,516,16360,520,8128,4672,4687,8136,1800,2696,4680,8744,520,20,32738,0}, +{640,1156,32712,1096,1120,16336,1103,1096,16328,1096,1096,32712,72,20,32738,0}, +{0,16370,8212,8212,16368,2192,1303,16372,532,8148,532,16364,516,522,32753,0}, +{1056,1090,32244,548,15392,8672,4391,4388,32548,4388,4388,4372,5524,2058,32753,0}, +{15600,9362,15604,17684,31200,2176,16359,2180,2180,32756,2180,4164,8228,10,32753,0}, +{8,31760,17918,9216,9348,5192,10239,9216,17408,17660,17540,11396,5252,1276,1156,1024}, +{0,127,7956,4116,4223,4181,4181,8021,4469,323,321,383,16705,16705,32383,65}, +{2048,7936,252,128,32767,128,4088,2184,4088,2184,4088,128,8188,128,32767,0}, +{0,4088,2056,4088,2056,32767,0,4088,2184,4088,2184,4088,128,4088,128,16382}, +{4616,4616,4628,32676,4674,4669,32648,8,16255,8456,8489,16154,8458,8568,16143,8450}, +{2180,2180,2204,16356,2178,2206,32757,4,8159,4164,4164,8132,4180,4172,8132,4160}, +{0,8176,16,4080,16,4080,16,32767,72,2184,1288,520,1096,6184,24600,8}, +{0,7998,4386,7998,4386,7998,4098,5106,4386,4386,6138,4386,4386,4370,5386,2050}, +{0,7998,4386,7998,4386,7998,4098,5106,4626,5106,4626,5106,4626,4098,5122,2050}, +{15934,8738,15934,8738,15934,8722,10570,10042,10834,12154,8514,10570,12154,8514,10530,4370}, +{4,16360,8192,8194,8194,9186,8738,8738,8738,8738,8738,9186,8738,8194,10242,4098}, +{4,16328,8200,8194,9186,8738,8738,8738,9186,8738,8738,8738,9186,8194,10242,4098}, +{4352,4414,4386,4242,32402,4298,4274,4754,5282,5282,4258,4246,4234,4226,5250,2178}, +{256,286,8082,4178,2090,16330,8198,16266,8210,16338,8210,534,9354,21666,20642,7954}, +{1024,16318,4386,2578,32722,10,16274,8338,16290,8354,16290,1046,32714,1026,1026,1026}, +{4096,15422,930,8722,9362,5386,16274,8210,16162,8226,16290,534,9482,21826,20802,7714}, +{1024,32670,562,16210,2186,32586,6,16234,8530,16210,8530,16214,8522,12610,162,32530}, +{31744,1022,8786,5266,8138,522,16358,10,8146,4114,8146,4118,8138,8866,21666,24338}, +{2064,4644,32508,4902,32509,4644,32508,4644,32508,516,4088,1040,544,448,3640,28679}, +{8188,128,32766,16514,11961,128,3768,0,8188,4228,8188,4228,8188,16512,16512,32512}, +{0,8188,128,32766,16514,11961,128,3768,0,32767,64,8188,4388,4388,5412,2052}, +{0,32767,64,64,32,8188,4644,4644,5092,4644,4644,5092,4644,4644,8188,4100}, +{64,128,8188,0,1040,544,32767,0,4088,2056,2056,4088,2056,2056,4088,2056}, +{0,32640,1024,575,16264,8328,8328,16264,8328,16264,8328,8376,16263,4354,8320,16448}, +{0,32639,2113,1151,16193,8575,8482,16213,8567,16162,8533,8567,16128,4693,8533,16512}, +{0,32640,1024,575,16264,8328,9352,9352,9352,9352,9352,8888,2567,4354,8320,16448}, +{1028,1028,16260,9404,16290,1042,32705,4,16260,8324,9348,9380,9364,2572,4356,8384}, +{2560,16318,10914,16302,10922,16383,65,16318,34,16318,8354,16318,4386,2594,32746,18}, +{0,8188,4228,5268,4772,8188,128,128,8188,128,128,32767,0,4370,8738,8737}, +{0,0,0,0,0,0,0,0,0,0,48,48,32,32,16,0}, +{0,16384,8192,4096,2048,1024,512,256,128,64,32,16,8,4,2,0}, +{0,0,0,0,0,96,96,0,0,0,96,96,0,0,0,0}, +{0,0,992,1040,2056,2048,1024,768,128,128,0,0,128,128,0,0} +}; +static int ui_fallback_glyph(unsigned cp){int lo=0,hi=sizeof ui_fallback_codes/sizeof *ui_fallback_codes-1;while(lo<=hi){int m=(lo+hi)/2;if(ui_fallback_codes[m]==cp)return m;if(ui_fallback_codes[m] +#include +#include +#include +#include +#include "cpymo_localization.h" +#include "ui-language-nds.h" + +/* magic, firmware language, valid settings, ordered preference ID, effective + language (0=CHS, 1=EN, 2=CHT, 3=JA), loaded, + writes, write errors, effective-language changes, refresh pending */ +volatile unsigned language_state[12]={0x4e4c4731}; +static int preference, firmware_language, effective_language, refresh_pending; +static const char* const language_endonyms[NDS_LANG_COUNT]={NULL,"简体中文","繁體中文","English","日本語"}; +static void resolve_language(void){ + int next=preference==0?firmware_language:preference==3?1:preference==2?2:preference==4?3:0; + if(next!=effective_language){effective_language=next;refresh_pending=1;language_state[8]++;} + language_state[3]=preference;language_state[4]=effective_language;language_state[9]=refresh_pending; +} +void nds_language_boot(void){ + /* libnds/Calico expose the bootloader's RAM copy; no FAT or NVRAM write. + Invalid/lost settings and all unsupported languages fall back to Chinese. */ + unsigned language=g_envUserSettings->config.language; + int valid=g_envUserSettings->version==5&&!PersonalData->settingsLost; + language_state[1]=language;language_state[2]=valid; + language_state[10]=g_envUserSettings->version;language_state[11]=PersonalData->settingsLost; + preference=NDS_LANG_AUTO;firmware_language=valid?(language==EnvLanguage_English?1:language==EnvLanguage_Japanese?3:0):0; + resolve_language();refresh_pending=0;language_state[9]=0; +} +void nds_language_load(void){ + /* First normal launch is Chinese even on English firmware. IDs follow the + current five-item menu order; no old-ID remapping. Pre-FAT uses firmware. */ + preference=NDS_LANG_CHINESE; + FILE* f=fopen("/pymo/nds-language.cfg","rb"); + if(f){char line[32];int value,n=0; + if(fgets(line,sizeof line,f)&&sscanf(line,"NDSLANG1 %d %n",&value,&n)==1&&n>0&&line[n]==0&&fgetc(f)==EOF&&value>=0&&value=NDS_LANG_COUNT)return 0; + preference=value;resolve_language();mkdir("/pymo",0777); + FILE* f=fopen("/pymo/nds-language.cfg","wb");int ok=0; + if(f){ok=fprintf(f,"NDSLANG1 %d\n",value)>0;if(fclose(f))ok=0;} + language_state[6]++;if(!ok)language_state[7]++; + return ok; +} +int nds_language_take_refresh(void){int value=refresh_pending;refresh_pending=0;language_state[9]=0;return value;} +/* Only engine-owned interface literals call this function. Game titles, + introductions, scripts and resource names are deliberately not passed in. */ +static const struct {const char* zh;const char* en;} strings[]={ + {"正在读取游戏列表...","Reading game list..."}, + {"游戏资料库","Game library"},{"选择游戏","Select a game"},{"关于与许可","About and licenses"}, + {"A / DOWN / 轻触:继续","A / DOWN / Touch: Next"},{"X:菜单 · B:返回","X: Menu / B: Back"}, + {"B:按住隐藏文字","Hold B: Hide text"},{"R:按设置快进","R: Skip (per settings)"}, + {"L:切换显示模式","L: Cycle display mode"},{"Y:隐藏/唤回辅助屏","Y: Toggle info screen"}, + {"START:快速保存到存档1","START: Save to slot 1"},{"SELECT:快速读取存档1","SELECT: Load slot 1"}, + {"显示、字号、音量:X 菜单","Display, font, audio: X"}, + {"已快速保存到存档1","Saved to slot 1"},{"已快速读取存档1","Loaded slot 1"}, + {"快速保存失败,请检查TF卡","Save failed; check TF card"},{"快速读取失败,请检查存档1","Load failed; check slot 1"}, + {"设置保存失败","Could not save settings"}, + {"快速保存到存档1失败","Could not save to slot 1"},{"读取存档1失败或存档不存在","Slot 1 missing or unreadable"}, + {"NDS 平台移植:千岚之夏","NDS port: 千岚之夏"}, + {"引擎与后端:AGPL v3","Engine/backend: AGPL v3"},{"转换工具:MIT","Converter: MIT"}, + {"许可详情请见附带文档","See included license notices"}, + {"PyMO:chen_xin_ming","PyMO: chen_xin_ming"}, + {"已转换,可以启动","Converted: ready to start"},{"缓存无效,请重新转换","Invalid cache: reconvert"}, + {"游戏配置无效","Invalid game configuration"},{"需要先使用转换脚本","Convert this game first"}, + {"没有找到游戏","No games found"},{"请先转换游戏,再放入","Convert games, then place in"}, + {"CPyMO:Seng Jik 及贡献者","CPyMO: Seng Jik and contributors"}, + {"游戏与汉化署名照原样保留","Game/translation credits retained"}, + {"新游戏请先使用转换助手","Use the converter for new games"}, + {"按 B 返回游戏列表","B: Back to game list"}, + {"A 启动 · 上下选择 · SELECT 刷新","A: Start / Up,Down / SELECT: Scan"}, + {"轻触两次启动 · B 关于与许可","Tap twice: Start / B: About"}, + {"请在电脑上先转换或修复缓存","Convert or repair on your PC"}, + {"无法访问存储卡","Storage unavailable"}, + {"启动失败,请检查转换结果","Game could not start"}, + {"运行失败,请检查游戏资源","Game could not continue"}, + {"错误码:%d","Error code: %d"},{"处理建议","What to try"}, + {"关机后重新插好TF卡。\n检查读卡与R4内核文件,再重试。\n此错误码不代表TF卡已损坏。","Power off and reinsert the TF card.\nCheck the card reader and R4 files.\nThis code does not prove card damage."}, + {"请检查转换结果和游戏资源。\n原始错误码已保留,便于反馈。","Check the conversion and game files.\nInclude the original code when reporting."}, + {"请关机后重新启动","Power off, then restart"},{"按 B 返回游戏资料库","B: Return to game library"}, + {"界面语言","UI language"},{"自动","Auto"},{"已读变灰","Dim read text"}, + {"立绘特效(全局)","Sprite effects (global)"},{"开","On"},{"关","Off"},{"大","Large"},{"小","Small"}, + {"X:界面语言","X: UI language"},{"上下选择 · A 确定 · B 返回","Up/Down: Select / A: Set / B: Back"}, + {"选择游戏 · X 语言","Select game / X: Language"}, + {"轻触两次启动 · B 关于 · X 语言","Tap twice / B: About / X: Lang"}, + {"语言设置已保存","Language preference saved"}, + {"SELECT: 语言 / B: 返回","SELECT: Language / B: Back"}, + /* Runtime profile: native mode detection, not a console-model guess. */ + {"DSi 模式 · 16 MiB","DSi mode · 16 MiB"}, + {"DS 模式 · 4 MiB","DS mode · 4 MiB"}, + /* Classic-lower: the stylus now targets game coordinates, not virtual A. */ + {"A:继续 · 触屏操控","A: Next / Touch: Game"}, + /* 1.2 clean dual-screen guide: controller lettering and explicit mode names. */ + {"A / DOWN:继续","A / DOWN: Continue"}, + {"UP:历史对话","UP: History"}, + {"R:快进 · L:切换模式","R: Skip / L: Cycle modes"}, + {"上屏游戏 / 下屏游戏 / 增强双屏","Game top / Game bottom / Dual screen"}, + {"START:快速保存 SELECT:快速读取","START: Save / SELECT: Load"}, + {"SELECT:快速读取","SELECT: Quick load"}, + {"退出到游戏库","Exit to library"}, + {"确定退出到游戏库?\n未保存的进度将丢失。","Exit to library?\nUnsaved progress will be lost."}, + {"主题设置","Theme settings"}, + {"默认","Default"}, + {"主题已保存","Theme saved"}, + {"游戏列表已刷新","Game list refreshed"}, + {"A / START 启动 · 轻触两次启动","A/START: Start · Tap twice"}, + {"上下选择 · B 关于 · X 语言 · Y 主题","UP/DOWN · B Info · X Lang · Y Color"}, + {"UP / DOWN:选择项目","UP / DOWN: Choose"}, + {"A:确认","A: Confirm"}, + {"B:返回","B: Back"}, + {"标题菜单","Title menu"}, + {"当前显示:上屏游戏","Display: Upper game"}, + {"当前显示:下屏游戏","Display: Lower game"}, + {"当前显示:增强双屏","Display: Dual screen"}, + {"方向键选择 · A 确定 · B 返回","D-pad: Pick · A: Set · B: Back"}, + {"R:快进 · L:切换显示模式","R: Skip · L: Cycle display"}, + {"L:切换显示模式","L: Cycle display mode"}, + {"NDS 移植:千岚之夏(Blueteemo)","NDS port: 千岚之夏 (Blueteemo)"} +}; +#include "ui-language-extra.h" +int nds_language_choice_get(void){return preference;} +int nds_language_choice_set(int i){return i>=0&&i=NDS_LANG_COUNT)return "?";return i?language_endonyms[i]:nds_ui("自动");} +const char* nds_ui(const char* zh){ + if(!effective_language||!zh)return zh; + for(unsigned i=0;i/save/nds-visual-capture.flag + * + * NDSPIX1 layout (little-endian, 16 byte header): + * [0..7] ASCII "NDSPIX1\0" + * [8..9] width=256 [10..11] height=192 + * [12..13] frame_count=2 [14..15] kind=1(enhanced dialogue), + * 2(enhanced menu), 3(enhanced story choices), 4(classic lower dialogue). + * [16..] TOP RGB555+bit15, then BOTTOM RGB555+bit15, row major. + * Pixels come from the exact CPyMO frame as presented to libnds DMA. + * The host converter creates PNGs without scaling or reinterpreting art. + */ +#ifndef CPYMO_NDS_VISUAL_CAPTURE_H +#define CPYMO_NDS_VISUAL_CAPTURE_H +#include +#include +#include + +static char nds_capture_directory[300]; +static unsigned nds_capture_armed, nds_capture_taken, nds_capture_error; +static char nds_capture_path[512]; + +static void nds_capture_init(const char* game_dir){ + nds_capture_armed=nds_capture_taken=nds_capture_error=0; + nds_capture_directory[0]=0; + if(!game_dir)return; + int n=snprintf(nds_capture_path,sizeof nds_capture_path, + "%s/save/nds-visual-capture.flag",game_dir); + if(n<0||(size_t)n>=sizeof nds_capture_path)return; + FILE* f=fopen(nds_capture_path,"rb"); + if(!f)return; + fclose(f); + n=snprintf(nds_capture_directory,sizeof nds_capture_directory,"%s",game_dir); + if(n<0||(size_t)n>=sizeof nds_capture_directory){ + nds_capture_directory[0]=0;return; + } + nds_capture_armed=1; +} +static int nds_capture_pixels(FILE* f,const u16* pixels){ + /* Eight scanlines per write; keep the engine audio pump responsive while + performing exceptional SD-card I/O. No additional 96 KiB buffer. */ + for(unsigned y=0;y<192;y+=8){ + if(fwrite(pixels+y*256,sizeof(u16),8*256,f)!=8*256)return 0; + nds_audio_pump_if_due(); + } + return 1; +} +static FILE* nds_capture_begin(unsigned kind,const u16* top){ + if(!nds_capture_armed||kind<1||kind>4|| + (nds_capture_taken&(1u<<(kind-1))))return NULL; + const char* names[]={"dialogue","menu","choice","classic-lower"}; + int n=snprintf(nds_capture_path,sizeof nds_capture_path, + "%s/save/nds-capture-%s.ndsraw",nds_capture_directory,names[kind-1]); + if(n<0||(size_t)n>=sizeof nds_capture_path)return NULL; + FILE* f=fopen(nds_capture_path,"wb"); + if(!f){nds_capture_error++;return NULL;} + const unsigned char magic[8]={'N','D','S','P','I','X','1',0}; + const uint16_t meta[4]={256,192,2,(uint16_t)kind}; + if(fwrite(magic,1,sizeof magic,f)!=sizeof magic || + fwrite(meta,sizeof meta[0],4,f)!=4 || + !nds_capture_pixels(f,top)){ + fclose(f);remove(nds_capture_path);nds_capture_error++;return NULL; + } + return f; +} +static void nds_capture_finish(FILE* f,unsigned kind,const u16* bottom){ + if(!f)return; + int ok=nds_capture_pixels(f,bottom); + if(fclose(f))ok=0; + if(ok)nds_capture_taken|=(1u<<(kind-1)); + else{remove(nds_capture_path);nds_capture_error++;} +} +#endif diff --git a/cpymo-backends/nds/tools/audit-desktop-release.py b/cpymo-backends/nds/tools/audit-desktop-release.py new file mode 100644 index 00000000..82a84ac0 --- /dev/null +++ b/cpymo-backends/nds/tools/audit-desktop-release.py @@ -0,0 +1,286 @@ +#!/usr/bin/env python3 +"""Audit four same-commit CPyMO for NDS release distributions. + +Read the actual ZIPs, check paired ROM, corresponding FFmpeg +source, the Windows PE icon, Mac Finder icon, and required artwork attribution. +Never treat a green individual build job as cross-package acceptance. +Pillow reconstructs the pinned Mac derivation and checks every actual ICNS frame. +""" +from __future__ import annotations + +import argparse +import hashlib +import importlib.util +import io +import json +import os +from pathlib import Path +import plistlib +import struct +import zipfile + +APPROVED_ICON_SOURCE_SHA256 = "133abae11b6d958c8e02d70e67dcf997049b5277bde3c734860e19f80257d90e" +APPROVED_ICON_RGBA_SHA256 = "a5954aa3fb04caecaf3796a314910f1e6fcc6d62d72d2b07a582f50ec15a4460" +APPROVED_ICON_ID = "approved-pymo-original-rounded-2026" +MACOS_CONTENT_SCALE = 0.80 +APPROVED_FFMPEG_SOURCE_SHA256 = "de668509caf9e35e3cd162473441fdb29538c6d96ed080292b3cf9e6fc5d558f" +VERSION = "1.3.0" + + +def digest(data: bytes) -> str: + return hashlib.sha256(data).hexdigest() + + +def read_zip(path: Path) -> zipfile.ZipFile: + z = zipfile.ZipFile(path) + damaged = z.testzip() + if damaged is not None: + raise ValueError(f"Corrupt member in {path}: {damaged}") + return z + + +def verify_macos_icon(source_png: bytes, manifest: dict, icns: bytes) -> dict: + """Independently reconstruct the approved Mac derivation, including every frame.""" + from PIL import Image + assert digest(source_png) == APPROVED_ICON_SOURCE_SHA256 + with Image.open(io.BytesIO(source_png)) as opened: + source = opened.convert("RGBA") + assert source.size == (1024, 1024) + assert digest(source.tobytes()) == APPROVED_ICON_RGBA_SHA256 + side = round(1024 * MACOS_CONTENT_SCALE) + offset = (1024 - side) // 2 + expected = Image.new("RGBA", (1024, 1024), (0, 0, 0, 0)) + expected.alpha_composite(source.resize((side, side), Image.Resampling.LANCZOS), (offset, offset)) + rule = manifest["macos_derivation"] + assert rule == {"content_scale": MACOS_CONTENT_SCALE, "canvas_size": [1024, 1024], + "content_size": [side, side], "offset": [offset, offset], + "padding": [offset, offset, 1024-side-offset, 1024-side-offset], + "resampling": "LANCZOS", "uniform_scale": True, + "crop_or_corner_mask_applied": False, + "derived_rgba_sha256": digest(expected.tobytes())} + assert digest(icns) == manifest["outputs"]["icns"]["sha256"] + frames = {} + with Image.open(io.BytesIO(icns)) as icon: + assert icon.size == (1024, 1024) + for size in icon.info["sizes"]: + frame = icon.icns.getimage(size).convert("RGBA") + required = expected.resize(frame.size, Image.Resampling.LANCZOS) + assert frame.tobytes() == required.tobytes(), ("Incorrect Mac ICNS frame", size) + frames[f"{size[0]}x{size[1]}@{size[2]}"] = digest(frame.tobytes()) + return {"status": "PASS", "content_scale": MACOS_CONTENT_SCALE, + "content_size": [side, side], "offset": [offset, offset], + "derived_rgba_sha256": digest(expected.tobytes()), "frames_rgba_sha256": frames} + + +def member(z: zipfile.ZipFile, suffix: str) -> str: + matches = [p for p in z.namelist() if p.endswith("/" + suffix)] + if len(matches) != 1: + raise ValueError(f"Expected one {suffix}, got {matches}") + return matches[0] + + +def ensure_pe_icon(payload: bytes, expected_frames: dict | None = None) -> dict: + """Check the actual .exe resources, not just PyInstaller's --icon CLI.""" + u16 = lambda i: struct.unpack_from("= 7 and len(groups) == 1 + lang_entries = entries(groups[0][1] & 0x7fffffff) + assert lang_entries + _, leaf = lang_entries[0] + assert not leaf & 0x80000000 + data_rva = u32(base + leaf) + size = u32(base + leaf + 4) + data = payload[offset(data_rva):offset(data_rva)+size] + reserved, kind, count = struct.unpack_from(" 100 and b"pymo" in contents.lower(), label + src = z.read(member(z, "FFmpeg-Corresponding-Source/ffmpeg-7.1.5.tar.xz")) + assert digest(src) == APPROVED_FFMPEG_SOURCE_SHA256 + ffmpeg_sources.append(digest(src)) + conf = z.read(member(z, "FFmpeg-Corresponding-Source/FFMPEG-BUILDCONF.txt")).decode() + assert "--disable-gpl" in conf and "--disable-nonfree" in conf + assert "--enable-gpl" not in conf and "--enable-nonfree" not in conf + info["rom_matches"] = True + info["pymo_icon_license_and_attribution"] = "present" + info["ffmpeg_corresponding_source_sha256"] = digest(src) + if kind == "windows": + exe = z.read(member(z, "Converter/Converter.exe")) + info["windows_icon"] = ensure_pe_icon(exe,icon_manifest["windows_ico_frames_sha256"]) + else: + plist = plistlib.loads(z.read(member(z, "CPyMO-NDS-Converter.app/Contents/Info.plist"))) + assert plist.get("CFBundleVersion") == VERSION + assert plist.get("CFBundleShortVersionString") == VERSION + assert plist.get("CFBundleIconFile") == "converter-icon.icns" + icns = z.read(member(z, "Contents/Resources/converter-icon.icns")) + assert icns[:4] == b"icns" and len(icns) > 100000 + assert digest(icns)==icon_manifest["outputs"]["icns"]["sha256"] + derivation = verify_macos_icon(approved_source_png, icon_manifest, icns) + assert metadata.get("macos_dock_icon_source") == "bundle_icns" + assert metadata.get("macos_icon_derivation") == icon_manifest["macos_derivation"] + assert metadata.get("macos_architecture") == "arm64" + assert metadata.get("rosetta_required") is False + info["macos_icon"] = {"sha256": digest(icns), "plist": "MATCH", + "derivation": derivation, "runtime_source": "bundle_icns"} + info["native_arch"] = "arm64" + report["distributions"][kind] = info + assert len(set(ffmpeg_sources)) == 1 + with read_zip(paths["sources"]) as z: + source_icon = z.read(member(z, "cpymo-tool/nds-converter/assets/converter-icon-source.png")) + assert digest(source_icon) == APPROVED_ICON_SOURCE_SHA256 + generator = z.read(member(z, "cpymo-tool/nds-converter/tools/build_desktop_icons.py")) + assert APPROVED_ICON_SOURCE_SHA256.encode() in generator + assert APPROVED_ICON_RGBA_SHA256.encode() in generator + # The source archive carries the exact approved lossless rounded PNG; + # all desktop derivatives are reproducible without the retired artwork. + for name in ("ICON-ATTRIBUTION.txt", "PYMO-ORIGINAL-MIT-LICENSE.txt"): + assert z.getinfo(member(z, "cpymo-tool/nds-converter/assets/" + name)).file_size > 100 + assert z.getinfo(f"CPyMO-for-NDS-{VERSION}-Sources/LICENSE").file_size > 100 + nds_manifest = json.loads((nds_root / 'assets/NDS-ICON-MANIFEST.json').read_text()) + nds_files = ['assets/' + nds_manifest['source'], 'assets/NDS-ICON-MANIFEST.json', + 'tools/build_nds_icons.py', 'tools/verify_nds_icons.py', + *nds_manifest['outputs']] + for relative in nds_files: + assert z.read(member(z, 'cpymo-backends/nds/' + relative)) == (nds_root / relative).read_bytes(), relative + report["distributions"]["sources"] = {"bytes": paths["sources"].stat().st_size, + "sha256": digest(paths["sources"].read_bytes()), + "approved_icon_source_sha256": digest(source_icon)} + report["distributions"]["rom"] = {"bytes": len(rom), "sha256": digest(rom)} + args.output.mkdir(parents=True, exist_ok=True) + output = args.output / f"CPyMO-for-NDS-{VERSION}-SHA256SUMS.txt" + output.write_text("".join(f"{digest(paths[name].read_bytes())} {paths[name].name}\n" + for name in ("rom","windows","macos","sources")), encoding="ascii") + (args.output / "RELEASE-PAIRED-AUDIT.json").write_text( + json.dumps(report, indent=2, ensure_ascii=False) + "\n", encoding="utf-8") + print(json.dumps(report, indent=2, ensure_ascii=False)) + + +if __name__ == "__main__": + main() diff --git a/cpymo-backends/nds/tools/build_nds_icons.py b/cpymo-backends/nds/tools/build_nds_icons.py new file mode 100644 index 00000000..485c2cb0 --- /dev/null +++ b/cpymo-backends/nds/tools/build_nds_icons.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python3 +"""Derive NDS-only icon sizes from the pinned full-square artwork. + +No crop or new corner mask; keep desktop sources and outputs independent. +The 32px banner reserves transparent palette index zero even though all +actual pixels are opaque. Runtime sizes use native RGB555, not that palette. +""" +from __future__ import annotations +import argparse +import hashlib +import json +from pathlib import Path +from PIL import Image, ImageFilter + +NDS = Path(__file__).resolve().parents[1] +SOURCE_SHA256 = 'f3bb25e8d37c8c8201969c8a59d629983544786c80903c5c27de848ffe532312' +SOURCE_RGBA_SHA256 = '7e157efd3272febbd8431f70e9e9fdd80fa13fecd3ef83d0299ba489210b5c10' +BORDER_RGB555 = (14, 12, 10) +BORDER_RGB = tuple(v * 255 // 31 for v in BORDER_RGB555) + +def sha(data: bytes) -> str: + return hashlib.sha256(data).hexdigest() + +def rgb555(image: Image.Image) -> Image.Image: + image = image.convert('RGB') + image.putdata([tuple((v >> 3) * 255 // 31 for v in rgb) + for rgb in image.get_flattened_data()]) + return image + +def pixels(image: Image.Image) -> list[int]: + return [0x8000 | sum(round(v * 31 / 255) << shift + for v, shift in zip(rgb, (0, 5, 10))) + for rgb in image.get_flattened_data()] + +def derive(source: Path) -> dict[str, Image.Image]: + if sha(source.read_bytes()) != SOURCE_SHA256: + raise ValueError('Wrong NDS full-square source file') + with Image.open(source) as opened: + if opened.size != (1254, 1254) or sha(opened.convert('RGBA').tobytes()) != SOURCE_RGBA_SHA256: + raise ValueError('Wrong NDS source pixels or dimensions') + master = opened.convert('RGB') + result = {} + for size, name in ((32, 'icon.png'), (24, 'icon-small.png'), (64, 'icon-splash.png')): + content = master.resize((size - 2, size - 2), Image.Resampling.LANCZOS) + if size <= 32: + content = content.filter(ImageFilter.UnsharpMask(radius=.55, percent=80, threshold=2)) + if size == 32: + content = content.quantize(colors=14, method=Image.Quantize.MEDIANCUT, + kmeans=8, dither=Image.Dither.NONE).convert('RGB') + content = rgb555(content) + canvas = Image.new('RGB', (size, size), BORDER_RGB) + canvas.paste(content, (1, 1)) + result[name] = canvas + return result + +def build(source: Path, output: Path) -> dict: + images = derive(source) + assets, code = output / 'assets', output / 'source' + assets.mkdir(parents=True, exist_ok=True) + code.mkdir(parents=True, exist_ok=True) + for name, image in images.items(): + image.save(assets / name) + banner = images['icon.png'] + colors = sorted(set(banner.get_flattened_data())) + if len(colors) > 15: + raise ValueError('NDS banner exceeds 15 opaque colors') + lookup = {c: i + 1 for i, c in enumerate(colors)} + bmp = Image.new('P', banner.size) + palette = [0, 0, 0] + [v for color in colors for v in color] + bmp.putpalette(palette + [0] * (768 - len(palette))) + bmp.putdata([lookup[c] for c in banner.get_flattened_data()]) + bmp.save(assets / 'icon.bmp') + lines = ['/* Generated by tools/build_nds_icons.py. NDS-only warm-grey-brown frames.', + ' * Complete artwork, no crop; all displayed pixels are opaque RGB555. */'] + for name, symbol in (('icon.png', 'app_icon'), ('icon-small.png', 'app_icon_small'), + ('icon-splash.png', 'app_icon_splash')): + data = pixels(images[name]) + lines.append(f'static const u16 {symbol}[{len(data)}]={{') + lines.extend(' ' + ','.join(map(str, data[i:i+32])) + ',' for i in range(0, len(data), 32)) + lines.append('};') + (code / 'app-icon.h').write_text('\n'.join(lines) + '\n', encoding='ascii') + paths = [assets / name for name in images] + [assets / 'icon.bmp', code / 'app-icon.h'] + manifest = { + 'source': 'icon-source-square.png', 'source_sha256': SOURCE_SHA256, + 'source_rgba_sha256': SOURCE_RGBA_SHA256, 'source_size': [1254, 1254], + 'border_rgb555': list(BORDER_RGB555), 'border_rgb': list(BORDER_RGB), + 'border_pixels': 1, 'uniform_scale': True, 'crop_or_corner_mask': False, + 'resampling': 'LANCZOS', + 'small_detail_filter': {'sizes': [24, 32], 'radius': .55, 'percent': 80, 'threshold': 2}, + 'banner_quantization': {'art_colors': 14, 'border_color': 1, + 'method': 'MEDIANCUT', 'kmeans': 8, 'dither': 'NONE', + 'transparent_palette_index': 0, 'actual_opaque_colors': len(colors)}, + 'runtime_sizes': [24, 32, 64], + 'outputs': {str(path.relative_to(output)): {'bytes': path.stat().st_size, + 'sha256': sha(path.read_bytes())} for path in paths}, + } + for name, image in images.items(): + manifest['outputs']['assets/' + name].update( + size=list(image.size), rgb_sha256=sha(image.tobytes())) + (assets / 'NDS-ICON-MANIFEST.json').write_text(json.dumps(manifest, indent=2) + '\n', encoding='ascii') + return manifest + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--source', type=Path, default=NDS / 'assets/icon-source-square.png') + parser.add_argument('--output', type=Path, default=NDS) + args = parser.parse_args() + print(json.dumps(build(args.source, args.output), indent=2)) diff --git a/cpymo-backends/nds/tools/encode-dual-background.py b/cpymo-backends/nds/tools/encode-dual-background.py new file mode 100644 index 00000000..7a55f654 --- /dev/null +++ b/cpymo-backends/nds/tools/encode-dual-background.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +"""Encode an owner-approved 256x192 PNG into CPyMO's native lower-LCD art. + +This is a build/asset-preparation helper, NOT a game-time PNG decoder. +Runtime reads exactly 8-byte CPYBG12\\0 + 49152 RGB555LE pixels. +Requires Pillow on the host only. +""" +from __future__ import annotations +import argparse +import hashlib +from pathlib import Path +import struct + +def encode(src: Path, dest: Path) -> dict: + from PIL import Image + with Image.open(src) as image: + if image.size != (256,192): + raise ValueError("Expected native 256x192 RGB PNG") + rgb=image.convert("RGB") + raw=bytearray(b"CPYBG12\0") + for r,g,b in rgb.getdata(): + native=(0x8000 | ((r*31+127)//255) | + (((g*31+127)//255)<<5) | (((b*31+127)//255)<<10)) + raw+=struct.pack(" +#include +#include + +int main(int argc,char **argv){ + if(argc!=2){ + fprintf(stderr,"usage: fvds-picture-audit video.fv\n"); + return 2; + } + nds_fvds_stream file; + int result=nds_fvds_open(&file,argv[1]); + if(result){ + fprintf(stderr,"FVDS open failed: %d\n",result); + return 3; + } + uint32_t indexed_i=0, predicted=0, first_q=0, min_q=64,max_q=0; + uint64_t video_bytes=0, audio_bytes=0; + int success=1; + for(uint32_t frame=0;framemax_q)max_q=quantizer; + indexed_i++; + printf("I %" PRIu32 " q=%" PRIu32 " bytes=%" PRIu32 "\n", + frame,quantizer,pkt.video_bytes); + }else{ + if(file.current_is_keyframe){ + fprintf(stderr,"Predicted picture in indexed key slot %" PRIu32 "\n",frame); + success=0;break; + } + predicted++; + } + video_bytes+=pkt.video_bytes; + audio_bytes+=pkt.audio_bytes; + /* Skip the rest of this packet: do not interpret compressed DCT as audio. */ + if(nds_fvds_finish(&file)){ + fprintf(stderr,"Cannot finish picture %" PRIu32 "\n",frame); + success=0;break; + } + } + if(success && nds_fvds_next(&file,&(nds_fvds_packet){0})!=1) + success=0; + if(success && (indexed_i!=file.keyframe_count || + (uint64_t)indexed_i+predicted!=file.frame_count))success=0; + if(success) + printf("PASS frames=%" PRIu32 " I=%" PRIu32 " P=%" PRIu32 + " q_min=%" PRIu32 " q_max=%" PRIu32 + " q_first=%" PRIu32 " video_bytes=%" PRIu64 + " audio_bytes=%" PRIu64 "\n", + file.frame_count,indexed_i,predicted, + min_q,max_q,first_q,video_bytes,audio_bytes); + nds_fvds_close(&file); + return success?0:4; +} diff --git a/cpymo-backends/nds/tools/fvds-to-wav.c b/cpymo-backends/nds/tools/fvds-to-wav.c new file mode 100644 index 00000000..ee3d9a21 --- /dev/null +++ b/cpymo-backends/nds/tools/fvds-to-wav.c @@ -0,0 +1,83 @@ +/* Standalone host-side WAV reference exporter for CPyMO FVDS audio. + * Builds from our independently implemented packet reader + block decoder. + * Usage: fvds-to-wav input.fv output.wav + * This program DOES NOT decode video and is NOT embedded into the .nds. + */ +#include "fvds-stream-nds.h" +#include "fvds-adpcm-nds.h" +#include +#include +#include +#include +#include + +static int word16(FILE*f,uint16_t value){ + return fputc(value&255,f)!=EOF && fputc(value>>8,f)!=EOF; +} +static int word32(FILE*f,uint32_t value){ + return word16(f,(uint16_t)value) && word16(f,(uint16_t)(value>>16)); +} +static int wav_header(FILE*f,uint32_t data_size,uint32_t rate){ + if(fseek(f,0,SEEK_SET))return 0; + return fwrite("RIFF",1,4,f)==4 && word32(f,data_size+36) && + fwrite("WAVEfmt ",1,8,f)==8 && + word32(f,16)&&word16(f,1)&&word16(f,2)&&word32(f,rate)&& + word32(f,rate*4)&&word16(f,4)&&word16(f,16)&& + fwrite("data",1,4,f)==4&&word32(f,data_size); +} +int main(int argc,char**argv){ + if(argc!=3){fprintf(stderr,"usage: fvds-to-wav input.fv output.wav\n");return 2;} + /* Never truncate the source: output may alias input via symlink or + hardlink even when the supplied path strings differ. */ + struct stat source_stat, output_stat; + if(!strcmp(argv[1],argv[2]) || + (!stat(argv[1],&source_stat) && !stat(argv[2],&output_stat) && + source_stat.st_dev==output_stat.st_dev && + source_stat.st_ino==output_stat.st_ino)){ + fprintf(stderr,"Source and destination refer to the same file\n"); + return 2; + } + nds_fvds_stream input; + if(nds_fvds_open(&input,argv[1])){ + fprintf(stderr,"Invalid or inaccessible FVDS source\n");return 3; + } + FILE*out=fopen(argv[2],"wb"); + if(!out){nds_fvds_close(&input);return 4;} + int ok=wav_header(out,0,input.sample_rate); + uint64_t output_bytes=0; + uint8_t block[264],video[4096],pcm[1024]; + nds_fvds_packet p; + while(ok){ + int rc=nds_fvds_next(&input,&p); + if(rc==1)break; + if(rc!=0){ok=0;break;} + unsigned remaining=p.video_bytes; + while(ok&&remaining){ + size_t amount=remaining>sizeof(video)?sizeof(video):remaining; + size_t got=nds_fvds_read_video(&input,video,amount); + if(got!=amount)ok=0; + else remaining-=(unsigned)got; + } + for(uint32_t i=0;ok&&i>8); + } + if(output_bytes+sizeof pcm>UINT32_MAX-36 || + fwrite(pcm,1,sizeof pcm,out)!=sizeof pcm){ok=0;break;} + output_bytes+=sizeof pcm; + } + if(ok && nds_fvds_finish(&input))ok=0; + } + if(ok)ok=wav_header(out,(uint32_t)output_bytes,input.sample_rate); + if(fclose(out))ok=0; + nds_fvds_close(&input); + if(!ok){remove(argv[2]);fprintf(stderr,"FVDS payload or output I/O error\n");return 5;} + fprintf(stderr,"Decoded FVDS stereo PCM: %llu bytes\n", + (unsigned long long)output_bytes); + return 0; +} diff --git a/cpymo-backends/nds/tools/generate-ui-font.py b/cpymo-backends/nds/tools/generate-ui-font.py new file mode 100644 index 00000000..2152511f --- /dev/null +++ b/cpymo-backends/nds/tools/generate-ui-font.py @@ -0,0 +1,35 @@ +"""Generate ROM UI subsets from the repository's OFL bitmap font sources.""" +from pathlib import Path +import sys,re,json,hashlib +backend=Path(__file__).resolve().parents[1] +repo=backend.parents[1] +converter=repo/'cpymo-tool/nds-converter' +sys.path.insert(0,str(converter)) +from pixel_font import read_bdf,read_hex +header=backend/'source/ui-fallback-font.h' +codes=set(range(32,127)) +codes.update(map(int,re.search(r'ui_fallback_codes\[\]=\{([^}]+)',header.read_text(encoding='utf8')).group(1).split(','))) +files=[backend/'source'/n for n in ('launcher.h','theme-nds.h','ui-language-nds.c','ui-language-extra.h','cpymo_config_ui.c')] +texts=[p.read_text(encoding='utf8') for p in files] +core=(repo/'cpymo/cpymo_localization.c').read_text(encoding='utf8') +texts.append(core[:core.index('STR_I(enu,')]) +for text in texts: + for match in re.finditer(r'"((?:\\.|[^"\\])*)"',text): + try:literal=json.loads('"'+match.group(1)+'"') + except ValueError:continue + codes.update(ord(c) for c in literal if ord(c)>=32) +codes=sorted(codes) +small_source=converter/'fonts/pixel/Fusion/fusion-pixel-12px-proportional-zh_hans.bdf.gz' +large_source=converter/'fonts/pixel/Unifont/unifont-17.0.05.hex.gz' +small=read_bdf(small_source,set(codes));large=read_hex(large_source,set(codes)) +assert set(codes)<=small.keys() and set(codes)<=large.keys() +lines=['/* Generated by tools/generate-ui-font.py. Do not hand-edit.\n' + ' Fusion Pixel 12px / GNU Unifont 16px subsets, OFL-1.1.\n' + ' See licenses/Fusion-OFL.txt and licenses/Unifont/. */', + 'static const unsigned ui_fallback_codes[]={'+','.join(map(str,codes))+'};'] +for prefix,glyphs in (('ui_fallback',small),('ui_large',large)): + lines.append('static const unsigned char '+prefix+'_advances[]={'+','.join(str(glyphs[c][0]) for c in codes)+'};') + lines.append('static const unsigned short '+prefix+'_rows[][16]={\n'+',\n'.join('{'+','.join(map(str,glyphs[c][1]))+'}' for c in codes)+'};') +lines.append('static int ui_fallback_glyph(unsigned cp){int lo=0,hi=sizeof ui_fallback_codes/sizeof *ui_fallback_codes-1;while(lo<=hi){int m=(lo+hi)/2;if(ui_fallback_codes[m]==cp)return m;if(ui_fallback_codes[m] tuple[int, tuple[bytes, bytes]]: + if len(data) != EXPECTED_BYTES: + raise ValueError(f"Invalid capture length: {len(data)} (expected {EXPECTED_BYTES})") + magic, width, height, frames, kind = HEADER.unpack_from(data) + if magic != MAGIC or (width, height, frames) != (WIDTH, HEIGHT, 2): + raise ValueError("Not an NDSPIX1 256x192 two-screen RGB555 capture") + if kind not in (1, 2, 3, 4): + raise ValueError("Unsupported display capture kind") + result = [] + for start in (HEADER.size, HEADER.size + FRAME_BYTES): + src = memoryview(data)[start : start + FRAME_BYTES] + rgb = bytearray(WIDTH * HEIGHT * 3) + for i in range(0, FRAME_BYTES, 2): + px = src[i] | (src[i + 1] << 8) + r, g, b = px & 31, (px >> 5) & 31, (px >> 10) & 31 + offset = i // 2 * 3 + rgb[offset] = r << 3 | r >> 2 + rgb[offset + 1] = g << 3 | g >> 2 + rgb[offset + 2] = b << 3 | b >> 2 + result.append(bytes(rgb)) + return kind, (result[0], result[1]) + + +def png_chunk(tag: bytes, data: bytes) -> bytes: + return (struct.pack(">I", len(data)) + tag + data + + struct.pack(">I", zlib.crc32(tag + data) & 0xFFFFFFFF)) + + +def png_rgb(width: int, height: int, rgb: bytes) -> bytes: + if len(rgb) != width * height * 3: + raise ValueError("Unexpected RGB buffer length") + scanlines = bytearray() + for y in range(height): + scanlines.append(0) # PNG filter: None + scanlines.extend(rgb[y * width * 3 : (y + 1) * width * 3]) + return (b"\x89PNG\r\n\x1a\n" + + png_chunk(b"IHDR", struct.pack(">2I5B", width, height, 8, 2, 0, 0, 0)) + + png_chunk(b"IDAT", zlib.compress(bytes(scanlines), 9)) + + png_chunk(b"IEND", b"")) + + +def convert(path: Path) -> tuple[Path, Path]: + _kind, (top, bottom) = decode_capture(path.read_bytes()) + paths = (path.with_name(path.stem + "-top.png"), + path.with_name(path.stem + "-bottom.png")) + for target, rgb in zip(paths, (top, bottom)): + target.write_bytes(png_rgb(WIDTH, HEIGHT, rgb)) + return paths + + +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("capture", type=Path, nargs="+", + help="Actual .ndsraw files copied from the game's save directory") + args = parser.parse_args() + for capture in args.capture: + for path in convert(capture): + print(f"Saved {path} ({WIDTH} x {HEIGHT}, native pixels)") + + +if __name__ == "__main__": + main() diff --git a/cpymo-backends/nds/tools/nds-dual-canvas-preview.py b/cpymo-backends/nds/tools/nds-dual-canvas-preview.py new file mode 100644 index 00000000..595511dc --- /dev/null +++ b/cpymo-backends/nds/tools/nds-dual-canvas-preview.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python3 +"""Compile the REAL NDS enhanced lower-canvas C function and preview its RGB555 output. + +Each preview is only the exact 256x192 canvas/backdrop drawn BEFORE real PyMO +game-owned dialogue, text, menu sprites and launcher hint glyphs. This is NOT +a game screenshot, emulator screenshot, or AI illustration. + +Requires a host C compiler (gcc/clang), no NDS SDK. PNG output uses only the +source-identical RGB555 converter already included in this repository. +""" +from __future__ import annotations + +import argparse +import importlib.util +from pathlib import Path +import subprocess +import tempfile + +ROOT = Path(__file__).resolve().parents[3] +SRC = ROOT / "cpymo-backends/nds/source" +CONVERTER = SRC.parent / "tools/nds-capture-to-png.py" +spec = importlib.util.spec_from_file_location("nds_capture_to_png", CONVERTER) +capture = importlib.util.module_from_spec(spec) +spec.loader.exec_module(capture) + +C_SOURCE = r""" +#include "dual-canvas-nds.h" +#include +#include +#include +static uint16_t buffer[256*192]; +int main(int argc,char**argv){ + if(argc!=3)return 2; + int interactive=atoi(argv[1]); + int dialogue=atoi(argv[2]); + if(interactive<0||interactive>1||dialogue<0||dialogue>1)return 3; + nds_dual_canvas_draw(buffer,interactive,dialogue); + if(fwrite(buffer,sizeof buffer[0],256*192,stdout)!=256*192)return 4; + return 0; +} +""" + +def convert_one(raw: bytes) -> bytes: + # Reuse exact RGB555 -> native PNG conversion, with no image editing. + if len(raw) != capture.FRAME_BYTES: + raise ValueError(f"Bad native framebuffer size: {len(raw)}") + top = bytes(capture.FRAME_BYTES) + header = capture.HEADER.pack(capture.MAGIC, 256, 192, 2, 1) + _, (_unused_top, rgb) = capture.decode_capture(header + top + raw) + return capture.png_rgb(256, 192, rgb) + +def render(output: Path) -> list[Path]: + output.mkdir(parents=True, exist_ok=True) + cases = (("01-dialogue-canvas",0,1), + ("02-menu-canvas",1,0), + ("03-idle-canvas",0,0)) + results = [] + with tempfile.TemporaryDirectory() as tmp: + path = Path(tmp) + test_c = path / "render.c" + test_c.write_text(C_SOURCE, encoding="utf-8") + binary = path / "render" + subprocess.run(["gcc","-std=c11","-O2","-Wall","-Wextra","-Werror", + "-I",str(SRC),str(test_c),"-o",str(binary)], + capture_output=True,text=True,check=True) + for name, interactive, dialogue in cases: + raw = subprocess.run([str(binary),str(interactive),str(dialogue)], + capture_output=True,check=True).stdout + png = output / f"{name}-256x192.png" + png.write_bytes(convert_one(raw)) + results.append(png) + return results + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--output", type=Path, default=Path("dual-canvas-output")) + args = parser.parse_args() + for result in render(args.output): + print(result) diff --git a/cpymo-backends/nds/tools/patch-rom-bg.py b/cpymo-backends/nds/tools/patch-rom-bg.py new file mode 100644 index 00000000..b285332e --- /dev/null +++ b/cpymo-backends/nds/tools/patch-rom-bg.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +"""Embed the approved 256x192 RGB555 artwork into an NDS ARM9 ROM image. + +The ROM compiled from nds-picture-bg.h contains one immutable 98320-byte +placeholder. Replacement is in-place (identical file length, header/CRC/ARM7 +untouched), so players need ONLY the .nds, never a separate /pymo file. + +Usage: + python patch-rom-bg.py --rom unpatched.nds --art nds-dual-bg.rgb555 \\ + --output CPyMO_1.2_DSpico_TWL.nds +""" +from __future__ import annotations +import argparse +import hashlib +from pathlib import Path +import struct + +WAIT=b"CPYMO_BG_AWAIT12" +READY=b"CPYMO_BG_READY12" +PLACEHOLDER=bytes([0x5a,0x5a]) * (256*192) +ART_MAGIC=b"CPYBG12"+bytes([0]) +ART_SIZE=8+len(PLACEHOLDER) + +def embed(rom: Path, art: Path, dest: Path) -> dict: + raw=rom.read_bytes() + src=art.read_bytes() + if len(src)!=ART_SIZE or src[:8]!=ART_MAGIC: + raise ValueError("Approved art must be CPYBG12\\0 + 256x192 opaque RGB555LE") + image=src[8:] + if any(not (value & 0x8000) for (value,) in struct.iter_unpack("len(raw): + raise ValueError("Invalid ARM9 ROM section bounds") + arm9=raw[off:off+size] + count=arm9.count(WAIT) + if count!=1: + raise ValueError(f"Expected exactly one unpatched embedded image; found {count}") + relative=arm9.index(WAIT) + marker_pos=off+relative + start=marker_pos+len(WAIT) + if raw[start:start+len(image)]!=PLACEHOLDER: + raise ValueError("Reserved RGB555 storage differs from expected placeholder") + patched=bytearray(raw) + patched[marker_pos:start]=READY + patched[start:start+len(image)]=image + if len(patched)!=len(raw): + raise AssertionError("ROM size changed unexpectedly") + dest.parent.mkdir(parents=True,exist_ok=True) + dest.write_bytes(patched) + verify=dest.read_bytes() + if verify[marker_pos:start]!=READY or verify[start:start+len(image)]!=image: + raise AssertionError("Embedded artwork failed byte-identical readback") + if verify[:0x200]!=raw[:0x200]: + raise AssertionError("ROM header modified") + return { + "rom":str(dest),"rom_bytes":len(verify), + "image_bytes":len(image), + "image_sha256":hashlib.sha256(image).hexdigest(), + "rom_sha256":hashlib.sha256(verify).hexdigest(), + "internal_offset":marker_pos, + "single_nds":True + } + +if __name__=="__main__": + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument("--rom",type=Path,required=True) + parser.add_argument("--art",type=Path,required=True) + parser.add_argument("--output",type=Path,required=True) + args=parser.parse_args() + print(embed(args.rom,args.art,args.output)) diff --git a/cpymo-backends/nds/tools/verify-release-artifact.py b/cpymo-backends/nds/tools/verify-release-artifact.py new file mode 100644 index 00000000..40c5a8e7 --- /dev/null +++ b/cpymo-backends/nds/tools/verify-release-artifact.py @@ -0,0 +1,132 @@ +#!/usr/bin/env python3 +"""Read-only gate for CPyMO for NDS release artifacts. + +Validates the *actual published ROM*, not an intermediate SDK build. The +unpatched/placeholder build must FAIL. Also check any paired Windows/macOS +archives have the exact same ROM bytes. This does not replace hardware tests, +GUI testing, FFmpeg licensing, or full corresponding-source review. +""" +from __future__ import annotations +import argparse +import hashlib +import importlib.util +import io +import json +import stat +from pathlib import Path +import struct +import zipfile + +READY = b"CPYMO_BG_READY12" +EXPECTED_BG_SHA256 = "92d91514ac12ccab6037a86a71e0c4cf1047917d15de59b91bcc8e4bb4d7d1b2" +FRAME_BYTES = 256 * 192 * 2 +BACKEND = Path(__file__).resolve().parents[1] +EXPECTED_VERSION = json.loads((BACKEND / "release.json").read_text(encoding="utf8"))["version"] +_banner_spec = importlib.util.spec_from_file_location("release_rom_banner", BACKEND / "rom_banner.py") +_banner_module = importlib.util.module_from_spec(_banner_spec) +_banner_spec.loader.exec_module(_banner_module) + + +def sha(b: bytes) -> str: + return hashlib.sha256(b).hexdigest() + + +def validate_rom_bytes(b: bytes) -> dict: + if len(b) < 0x200: + raise ValueError("Not a valid Nintendo DS ROM header") + if b[0x12] != 2: + raise ValueError("ROM header does not advertise DS/DSi compatibility") + offset, size = struct.unpack_from(" len(b): + raise ValueError("Invalid ARM9 ROM bounds") + arm9 = b[offset:offset + size] + # Check compiled ARM9 text independently of the outer filename and Banner. + runtime_title = f"CPyMO for NDS {EXPECTED_VERSION}".encode("ascii") + if runtime_title not in arm9: + raise ValueError(f"Compiled runtime version is not {EXPECTED_VERSION}") + _, banner = _banner_module._load_banner(io.BytesIO(b)) + titles = [] + for i in range(_banner_module.LANGUAGE_COUNT): + start = _banner_module.TITLE_START + i * _banner_module.TITLE_SLOT_BYTES + text = banner[start:start + _banner_module.TITLE_SLOT_BYTES].decode("utf-16le") + titles.append(text.split("\x00", 1)[0].split("\n")) + if any(title != ["CPyMO for NDS", EXPECTED_VERSION, "千岚之夏"] for title in titles): + raise ValueError(f"Banner version/title is not {EXPECTED_VERSION}") + found = [] + i = 0 + while True: + pos = arm9.find(READY, i) + if pos < 0: + break + start = pos + len(READY) + frame = arm9[start:start + FRAME_BYTES] + if len(frame) == FRAME_BYTES and sha(frame) == EXPECTED_BG_SHA256: + found.append(offset + pos) + if any((value & 0x8000) == 0 for (value,) in struct.iter_unpack(" dict: + names = [] + with zipfile.ZipFile(path) as z: + for item in z.infolist(): + if item.is_dir() or not item.filename.lower().endswith(".nds"): + continue + # macOS PyInstaller applications include symlink entries to the + # actual Contents/Resources ROM. ZIP stores a symlink's link text, + # not the image bytes; do not mistake that text for a second ROM. + # The real bundled ROM is validated during macOS app construction. + if stat.S_ISLNK(item.external_attr >> 16): + continue + # Starter bundles include one copy for players and another inside + # the frozen worker. All such copies must be byte-identical. + h = sha(z.read(item)) + if h != expected_sha: + raise ValueError( + f"{path.name}: {item.filename} differs from officially validated ROM " + f"({h} vs {expected_sha})" + ) + names.append(item.filename) + if z.testzip() is not None: + raise ValueError(f"Archive corruption detected: {path.name}") + if not names: + raise ValueError(f"{path.name}: no packaged .nds found") + return {"file": path.name, "size_bytes": path.stat().st_size, + "rom_copies": names, "rom_sha256": expected_sha} + + +def main() -> None: + p = argparse.ArgumentParser(description=__doc__) + p.add_argument("--rom", type=Path, required=True) + p.add_argument("--windows-starter", type=Path) + p.add_argument("--macos-starter", type=Path) + p.add_argument("--report", type=Path) + args = p.parse_args() + raw = args.rom.read_bytes() + result = validate_rom_bytes(raw) + result["rom_file"] = args.rom.name + result["paired_archives"] = [] + for archive in (args.windows_starter, args.macos_starter): + if archive: + result["paired_archives"].append( + verify_archive(archive, result["rom_sha256"]) + ) + if args.report: + args.report.parent.mkdir(parents=True, exist_ok=True) + args.report.write_text(json.dumps(result, indent=2, ensure_ascii=False) + "\n", encoding="utf-8") + print(json.dumps(result, indent=2, ensure_ascii=True)) + + +if __name__ == "__main__": + main() diff --git a/cpymo-backends/nds/tools/verify_nds_icons.py b/cpymo-backends/nds/tools/verify_nds_icons.py new file mode 100644 index 00000000..1fca0997 --- /dev/null +++ b/cpymo-backends/nds/tools/verify_nds_icons.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +"""Read-only checks of generated NDS assets and optionally the actual ROM. + +Standard library only so the pinned SDK container can verify the same +committed resources without installing an image stack during compilation. +""" +from __future__ import annotations +import argparse +import hashlib +import json +from pathlib import Path +import re +import struct + +NDS = Path(__file__).resolve().parents[1] + +def verify(nds: Path, rom: Path | None = None) -> dict: + manifest = json.loads((nds / 'assets/NDS-ICON-MANIFEST.json').read_text()) + source = nds / 'assets' / manifest['source'] + if hashlib.sha256(source.read_bytes()).hexdigest() != manifest['source_sha256']: + raise ValueError('NDS source identity mismatch') + for relative, identity in manifest['outputs'].items(): + data = (nds / relative).read_bytes() + if len(data) != identity['bytes'] or hashlib.sha256(data).hexdigest() != identity['sha256']: + raise ValueError('NDS icon resource identity mismatch: ' + relative) + header = (nds / 'source/app-icon.h').read_text() + arrays = {} + edge = 0x8000 | sum(v << shift for v, shift in zip(manifest['border_rgb555'], (0, 5, 10))) + for symbol, side in (('app_icon', 32), ('app_icon_small', 24), ('app_icon_splash', 64)): + match = re.search(r'\b' + symbol + r'\[' + str(side * side) + r'\]\s*=\s*\{([^}]+)\}', header, re.S) + if not match: + raise ValueError('Missing native NDS icon array: ' + symbol) + values = [int(v) for v in re.findall(r'\d+', match.group(1))] + if len(values) != side * side or any(not (0x8000 <= v <= 0xffff) for v in values): + raise ValueError('Wrong native dimensions/opacity: ' + symbol) + if any(values[y*side+x] != edge for y in range(side) for x in range(side) + if x in (0, side-1) or y in (0, side-1)): + raise ValueError('Wrong native border: ' + symbol) + arrays[symbol] = values + if len(set(arrays['app_icon'])) > 15: + raise ValueError('Banner exceeds 15 opaque colors') + result = {'assets': 'PASS', 'native_sizes': [24, 32, 64], + 'border_rgb555': manifest['border_rgb555'], 'source_sha256': manifest['source_sha256']} + if rom is not None: + data = rom.read_bytes() + for symbol, values in arrays.items(): + if struct.pack('<' + str(len(values)) + 'H', *values) not in data: + raise ValueError('Compiled ROM is missing native resource: ' + symbol) + if len(data) < 0x200: + raise ValueError('Truncated NDS header') + offset = struct.unpack_from('> (4*(x%2))) & 15 + if index == 0 or (palette[index] | 0x8000) != arrays['app_icon'][y*32+x]: + raise ValueError('Actual banner differs from approved generated icon') + result.update(rom='PASS', rom_sha256=hashlib.sha256(data).hexdigest(), + actual_banner_matches_internal_icon=True, + all_native_arrays_present=True, rom_bytes=len(data)) + return result + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--nds', type=Path, default=NDS) + parser.add_argument('--rom', type=Path) + parser.add_argument('--report', type=Path) + args = parser.parse_args() + result = verify(args.nds, args.rom) + text = json.dumps(result, indent=2) + '\n' + if args.report: + args.report.write_text(text) + print(text, end='') diff --git a/cpymo-tool/nds-converter/.gitattributes b/cpymo-tool/nds-converter/.gitattributes new file mode 100644 index 00000000..92e3456e --- /dev/null +++ b/cpymo-tool/nds-converter/.gitattributes @@ -0,0 +1,2 @@ +* text=auto eol=lf +fonts/** -whitespace diff --git a/cpymo-tool/nds-converter/.gitignore b/cpymo-tool/nds-converter/.gitignore new file mode 100644 index 00000000..19e21432 --- /dev/null +++ b/cpymo-tool/nds-converter/.gitignore @@ -0,0 +1,7 @@ +/__pycache__/ +**/__pycache__/ +*.pyc +/build/ +/dist/ +*.spec +*.dll diff --git a/cpymo-tool/nds-converter/LICENSE-MIT.txt b/cpymo-tool/nds-converter/LICENSE-MIT.txt new file mode 100644 index 00000000..3dd9b229 --- /dev/null +++ b/cpymo-tool/nds-converter/LICENSE-MIT.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 CPyMO NDS converter contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/cpymo-tool/nds-converter/README.md b/cpymo-tool/nds-converter/README.md new file mode 100644 index 00000000..6830523c --- /dev/null +++ b/cpymo-tool/nds-converter/README.md @@ -0,0 +1,109 @@ +# CPyMO for NDS 1.3.0 转换助手 + +## v1.3.0(维护更新) + +此版本沿用 1.2.0 的缓存格式与视频转换策略,并进行 **NDS 程序及配套转换器图标焕新**:采用同一张原始插画,NDS 程序使用完整方形图标,Windows/macOS 配套游戏转换器使用平滑圆角版本。macOS 同时改善图标显示比例。 + +游戏库新增 NDS 固件 16 色主题(含自动跟随固件、默认经典深蓝)、统一的选中竖线和增强的多语言主题文字层次。修订了“重新开始”后标题辅助屏的回切、START 启动与选中高亮边缘。音频输出采用保守的 +1.5dB 目标增益和峰值保护;不替代各游戏自身音量设置。 + + +NDS 移植:千岚之夏。独立转换助手 MIT;引擎 AGPL-3.0-or-later;字体与依赖保留各自许可。 + +程序及配套元数据由同一份 1.3.0 源码真实构建;[当前发行说明](../../cpymo-backends/nds/RELEASE-NOTES-1.3.0.md)。 + +## 给玩家 + +Windows 玩家完整解压 Starter,双击“启动转换器.bat”,也可运行“Converter/Converter.exe”。Apple Silicon Mac 玩家使用通过最终验收的 ARM64 `.app` 发行包;Intel Mac 可按下文从源码运行。 +免安装套件已内置 Python 运行时和 FFmpeg,普通玩家无须另行安装。打开助手后,可选择简体中文或 English(界面选择会保存);选择游戏 ZIP 或含 gameconfig.txt 的文件夹, +支持嵌套 ZIP 与 S60v3 / S60v5 / Android PyMO 数据(指输入数据平台,非电脑系统)。 +同包多版本优先推荐 S60v3。选择新的输出位置,开始转换,结束后阅读兼容性警告与安装必读。 + +把输出的 cpymo-nds.nds 和 pymo 文件夹复制到 TF 根目录。路径应为 +`pymo/games/<游戏目录>/gameconfig.txt`,旁边有 script、nds-cache 和 save。 +保留原有烧录卡内核或 DSi 启动配置。已有同名游戏先保留自己的 save,不要用新输出的空 save 覆盖。 +转换助手在电脑使用,不需要复制进 TF。本包不附游戏。 + +默认精简已有缓存的重复原媒体,无损压缩语音与适合的图片;BGM/音效保持 PCM,兼顾读取和存储。 +无损针对 NDS 缓存:图像先缩放为 DS 尺寸 RGB555,音频先转为 22050 Hz 单声道 PCM16。 +缓存压缩不会在此基础上继续降低像素或采样质量;不承诺比所有原版平台包更小。 +可选择不压缩缓存作对照;全部音频压缩是实验项,不属于默认性能基线。 +启用缓存压缩会同时精简重复媒体。输出专用于 NDS,保留原包供其他平台使用。 + +视频资源默认转换为 NVL1,玩家也可选择 NVA1(压缩音轨)或主动跳过视频。字库缺字默认替换为 □ 并生成警告,原始包、脚本和定稿汉化不修改,源存档不导入。 +转换通过不等于全剧情或全部烧录卡认证。缺资源、未知指令和缺字策略记录在 +`nds-cache/manifest.json` 及转换结果中。GUI 默认缺字显示 □ 并记录,脚本文字不改;英文界面转换完成后还会生成 `INSTALL-READ-ME.txt` 英文安装说明。 +加密/打包脚本和其他游戏引擎不支持。 + +## 1.2 游戏视频转换 + +1.1.0 正式版不受影响。1.3.0 继承 1.2.0 的转换流程,视频默认使用 NVL1、原样保留脚本; +1.2 提供 **NVL1**(22050 Hz PCM16)与 **NVA1**(NAR2 +无损压缩音频)视频转换,在 GUI 的“游戏视频”下拉框中选择(默认 NVL1,NVA1 和跳过视频可选)。默认 +12 FPS、256×192 RGB555;保留原始画面比例,居中补黑边,不随意拉伸。 +字幕、脚本与存档策略不改;无音轨视频补零音频。 + +CLI 用法(发行前请确认与同版 NDS 引擎匹配): + + + +```sh +python cpymo-tool/nds-converter/convert.py convert 原游戏目录 新输出目录 --cache-only +# 可选:使用压缩音轨的视频转换模式 +python cpymo-tool/nds-converter/convert.py convert 原游戏目录 另一新目录 --video-mode nva1 --video-fps 12 +``` + +识别游戏目录内的 \`video/\`、\`movie/\`、\`videos/\`、\`movies/\` +普通视频(FFmpeg 支持的 MP4/AVI/MKV/MOV 等)。输出为 +\`nds-cache/video/<哈希前缀>/<视频名哈希>.nvl\`;原 PyMO \`#movie\` 指令 +无需修改。全程校验帧的 Adler32 与像素还原,音轨严格按视频帧数对齐; +不支持的视频会在审计中继续标注为未转换。单段视频受现有 NDS 播放器 +10 分钟限制。生成缓存及主机验证通过**不等于** NTR/DSi 实机视频性能、 +跳过恢复、所有原始游戏视频的兼容性已验收。 + +1.2 对玩家公开的可播放视频格式为 NVL1/NVA1;不要将其他研究阶段的格式当成正式支持功能。 + + +## 从源码运行与构建 + +Python 3.10+,安装 requirements.txt,另备 FFmpeg;完整仓库内运行 `python app.py`。 +Windows 提供免安装包;macOS **仅发行 Apple Silicon 原生 ARM64 `.app`**,不提供 Intel macOS 预编译包。Apple Silicon 版本使用 ARM64 Python、PyInstaller 和 FFmpeg 构建,通过同提交原生构建及配套验收发布。Intel Mac、Linux 仍可按要求从源码运行命令行工具;Mac 采用临时签名,未经 Apple Developer ID 签名及 Apple 公证;请核对来源与 SHA-256。 + +```sh +python -m pip install -r cpymo-tool/nds-converter/requirements.txt +python cpymo-tool/nds-converter/convert.py convert /path/to/game /path/to/new-output --ffmpeg /path/to/ffmpeg --missing-glyph-policy box --cache-only --audio-lossless voice --compress-images +python cpymo-tool/nds-converter/convert.py verify /path/to/new-output +``` + +CLI 默认也将缺字替换为 □ 并记录;若开发者希望针对字体严格检查,可明确传入 `--missing-glyph-policy error`。CLI 保留便于对照的原媒体/未压缩缓存,GUI 默认启用精简与推荐压缩方案。 +缓存格式6按哈希前两位分目录,兼容引擎旧格式1~5;`--cache-layout flat` 用于对照测试。 +图像/音频去重不改脚本资源名称。保留 fonts/ 的字体文件和全部许可,不要只拷单个 Python 文件。 +版本从 cpymo-backends/nds/release.json 读取。macOS ARM64 构建由 `build_portable_macos.py --target-arch arm64` 在 Apple Silicon CI 上完成,打包器会对主程序和 FFmpeg 都做 ARM64 架构校验。 + +构建 Windows 包:先构建 ROM,安装 requirements-build.txt,使用可信 Windows x86_64 C 编译器构建加速库: + +```sh +python build_native.py --cc /path/to/x86_64-w64-mingw32-gcc.exe +python build_portable.py --rom /path/to/verified/cpymo-nds.nds --ffmpeg /path/to/ffmpeg.exe --output /path/to/new-portable +``` + +加速库可选,源码模式缺失时使用 Python 实现;公开 Windows 包包含该库。 +打包脚本嵌入并检查同一 ROM 与版本元数据。发布时还需附玩家必读、第三方许可和完整对应源码。 +FFmpeg 独立进程运行,不链接进 MIT 转换器;tools/ 提供音频专用构建脚本。 +Windows/macOS 包内的 `FFmpeg-Corresponding-Source` 提供对应 FFmpeg 官方源码、编译配置及许可;发行源码包提供引擎、转换器和构建脚本。 + + +macOS ARM64 源码构建(须在 Mac 上运行,且显式传入与目标发行版本匹配的 ROM): + +```sh +python cpymo-tool/nds-converter/build_portable_macos.py \ + --rom /path/to/cpymo-nds.nds --ffmpeg /path/to/ffmpeg \ + --output /path/to/new-macos-package +``` + +历史原生构建记录:[原生 macOS CI](https://github.com/Blueteemo/CPyMO/actions/runs/40484402394): +使用打包后的 `.app` 工作进程转换原创 MP4 为 NVL1 并校验配套 ROM 的 SHA。 +该 CI 的 ROM 是**内部构建测试输入**,不是用户最终验收并内置星夜素材的发行 ROM, +不能直接拿该构建的研究包替代正式版;仍需完整许可证、最终 ROM 配套及发行门槛。 + +回归:`python -m unittest discover -s cpymo-tool/nds-converter/tests -v`,可用 NDS_TEST_FFMPEG 指定程序。 +app.py 的 `--self-test JSON` 通过真实 GUI 与工作进程完成转换,未指定压缩字段时使用实际界面默认值。 diff --git a/cpymo-tool/nds-converter/app.py b/cpymo-tool/nds-converter/app.py new file mode 100644 index 00000000..424276b6 --- /dev/null +++ b/cpymo-tool/nds-converter/app.py @@ -0,0 +1,390 @@ +"""CPyMO NDS conversion assistant UI, MIT. NDS port: 千岚之夏.""" +from pathlib import Path +import argparse, contextlib, datetime, json, os, subprocess, sys, tempfile +import tkinter as tk +from tkinter import ttk, filedialog, messagebox, font as tkfont +from helper_core import run_job + +from release_info import VERSION +from ui_i18n import tr, tr_log, LANGUAGES + +def apply_desktop_icon(window): + """Keep the native macOS bundle icon; use the small PNG on other hosts.""" + # Tk's iconphoto replaces the macOS Dock tile with the 64px window PNG. + # Frozen .apps already carry the correctly sized, high-resolution ICNS. + if sys.platform == 'darwin' and getattr(sys, 'frozen', False): + return False + base=Path(sys._MEIPASS) if getattr(sys,'frozen',False) else Path(__file__).resolve().parent + icon=base/'assets/converter-icon-64.png' + if not icon.is_file(): + return False + try: + photo=tk.PhotoImage(master=window,file=str(icon)) + window.iconphoto(True,photo) + window._cpymo_icon_photo=photo # Keep a live Tk image reference. + return True + except tk.TclError: + return False # Never block conversion over a window manager limitation. + + +class App: + def __init__(self,window,state_root=None,self_test=None): + self.window=window;self.process=None;self.self_test=self_test;self.test_started=False + apply_desktop_icon(window) + self.state_root=Path(state_root or (Path(os.environ['LOCALAPPDATA'])/'CPyMO-NDS-转换助手'/'jobs' if os.name=='nt' and os.environ.get('LOCALAPPDATA') else Path.home()/'Library/Application Support/CPyMO-NDS-Converter/jobs' if sys.platform=='darwin' else Path.home()/'.local/share/CPyMO-NDS-Converter/jobs')) + self.preference_file=self.state_root.parent/'ui-preferences.json' + try: + saved=json.loads(self.preference_file.read_text(encoding='utf8')).get('language') + except (OSError, ValueError, TypeError): + saved=None + self.language=tk.StringVar(value=saved if saved in LANGUAGES else LANGUAGES[0]) + self._ui_sources={} + self._status_zh='先选择游戏压缩包或游戏文件夹。' + self.source=tk.StringVar();self.output=tk.StringVar(value=str(Path.home()/'Desktop')) + self.status=tk.StringVar(value=self.tr(self._status_zh)) + self.candidates=[];self.serial=0;self.last_result=None;self.last_output=None + self._log_disk_text='' + self._log_extra_text='' + self._log_extra_report=None + self._last_log_display='' + window.title('CPyMO NDS 转换助手');window.geometry(f"840x{min(890,max(700,window.winfo_screenheight()-110))}");window.minsize(760,670) + ui_font='PingFang SC' if sys.platform=='darwin' else 'Microsoft YaHei UI' + window.option_add('*Font',(ui_font,10)) + style=ttk.Style();style.theme_use('clam');style.configure('TButton',padding=(12,7));style.configure('Title.TLabel',font=(ui_font,19,'bold')) + frame=ttk.Frame(window,padding=22);frame.pack(fill='both',expand=True) + head=ttk.Frame(frame);head.pack(fill='x') + ttk.Label(head,text='CPyMO NDS 转换助手',style='Title.TLabel').pack(side='left') + self.language_box=ttk.Combobox(head,textvariable=self.language,values=LANGUAGES,state='readonly',width=12) + self.language_box.pack(side='right') + ttk.Label(head,text='界面语言:').pack(side='right',padx=(0,8)) + self.language_box.bind('<>',self.change_language) + ttk.Label(frame,text='选择自己的 PyMO 游戏,转换好后复制到 DS / DSi 的存储卡即可。',wraplength=780).pack(anchor='w',pady=(6,16)) + ttk.Label(frame,text='1 选择游戏',font=(ui_font,11,'bold')).pack(anchor='w') + row=ttk.Frame(frame);row.pack(fill='x',pady=(7,8)) + ttk.Entry(row,textvariable=self.source,state='readonly').pack(side='left',fill='x',expand=True) + self.zip_button=ttk.Button(row,text='选压缩包',command=self.pick_zip);self.zip_button.pack(side='left',padx=(8,4)) + self.folder_button=ttk.Button(row,text='选文件夹',command=self.pick_folder);self.folder_button.pack(side='left') + game_row=ttk.Frame(frame);game_row.pack(fill='x') + self.games=tk.Listbox(game_row,height=3,exportselection=False,activestyle='none',background='#ffffff',foreground='#233247',selectbackground='#27659c',selectforeground='#ffffff',relief='solid',borderwidth=1) + self.games.pack(side='left',fill='x',expand=True) + self.game_scroll=ttk.Scrollbar(game_row,orient='vertical',command=self.games.yview) + self.games.configure(yscrollcommand=self.game_scroll.set) + self._update_game_list_layout() + ttk.Label(frame,text='自动识别游戏版本;如果找到多个版本,会优先推荐适合 NDS 的版本。',foreground='#526579',wraplength=780).pack(anchor='w',pady=(5,12)) + ttk.Label(frame,text='2 选择保存位置',font=(ui_font,11,'bold')).pack(anchor='w') + row=ttk.Frame(frame);row.pack(fill='x',pady=(7,6));ttk.Entry(row,textvariable=self.output,state='readonly').pack(side='left',fill='x',expand=True) + self.output_button=ttk.Button(row,text='选保存位置',command=self.pick_output);self.output_button.pack(side='left',padx=(8,0)) + ttk.Label(frame,text='转换后保存在新文件夹,不会修改原游戏或覆盖已有存档。',foreground='#526579',wraplength=780).pack(anchor='w',pady=(0,10)) + # Media de-duplication is a safe default, not a player decision. + # Keep the variable for existing CLI and GUI self-test fixtures. + self.cache_only=tk.BooleanVar(value=True) + self.video_modes=['不转换视频(兼容旧流程)','转换视频 NVL1(推荐:兼容优先)','转换视频 NVA1(压缩音频)'] + self.video=tk.StringVar(value=self.video_modes[1]) + row=ttk.Frame(frame);row.pack(fill='x',pady=(7,0));ttk.Label(row,text='游戏视频:').pack(side='left') + self.video_box=ttk.Combobox(row,textvariable=self.video,values=self.video_modes, + state='readonly',width=47) + self.video_box.pack(side='left',fill='x',expand=True) + ttk.Label(frame,text='默认保留并转换游戏视频;如不需要视频,也可以选择跳过。', + foreground='#526579',wraplength=780).pack(anchor='w',pady=(3,0)) + self.compression=tk.StringVar(value='无损压缩语音与适合的图片(推荐)') + self.compression_modes=['不压缩缓存(读取优先)','无损压缩语音与适合的图片(推荐)','无损压缩全部音频与适合的图片(实验)'] + self.advanced_visible=False + self.advanced_button=ttk.Button(frame,text='更多设置(可选)',command=self.toggle_advanced) + self.advanced_button.pack(anchor='w',pady=(8,0)) + self.advanced_frame=ttk.Frame(frame) + ttk.Label(self.advanced_frame,text='缺字自动以 □ 显示并记录警告,不中断转换;原脚本保持不变。',foreground='#526579',wraplength=780).pack(anchor='w',pady=(4,3)) + row=ttk.Frame(self.advanced_frame);row.pack(fill='x',pady=(5,0)) + ttk.Label(row,text='文件体积与读取:').pack(side='left') + self.compression_box=ttk.Combobox(row,textvariable=self.compression,values=self.compression_modes, + state='readonly',width=64) + self.compression_box.pack(side='left',fill='x',expand=True,padx=(9,0)) + ttk.Label(self.advanced_frame,text='默认设置兼顾体积和读取速度,普通使用无需调整。', + foreground='#526579',wraplength=780).pack(anchor='w',pady=(3,0)) + row=ttk.Frame(frame);row.pack(fill='x',pady=(13,8)) + self.convert_button=ttk.Button(row,text='3 开始转换',command=self.begin,state='disabled');self.convert_button.pack(side='left') + self.cancel_button=ttk.Button(row,text='取消',command=self.cancel,state='disabled');self.cancel_button.pack(side='left',padx=8) + self.open_button=ttk.Button(row,text='打开结果文件夹',command=self.open_output,state='disabled');self.open_button.pack(side='right') + self.progress=ttk.Progressbar(frame,mode='indeterminate') # Show only while a job runs. + self.status_label=ttk.Label(frame,textvariable=self.status,wraplength=790) + self.status_label.pack(anchor='w',pady=(8,4)) + # Never inherit a white macOS dark-mode foreground over a pale log panel. + # Give Tk's CJK fallback extra line height on Retina screens and avoid + # repainting the entire Text control every polling interval. + log_font=tkfont.Font(window,family='Menlo' if sys.platform=='darwin' else ui_font,size=10) + self.log=tk.Text(frame,height=4,wrap='word',background='#f1f4f8',foreground='#233247',insertbackground='#233247',selectbackground='#27659c',selectforeground='#ffffff',relief='solid',borderwidth=1,font=log_font,spacing1=3,spacing2=4,spacing3=5,padx=10,pady=8) + self.log.pack(fill='both',expand=True,pady=(4,8)) + self.log.configure(state='disabled') + self.version_label=ttk.Label(frame,text='NDS 平台移植:千岚之夏 · 基于 CPyMO / PyMO · 转换助手 '+VERSION,foreground='#526579') + self.version_label.pack(anchor='w') + window.protocol('WM_DELETE_WINDOW',self.close) + self._capture_localizable_widgets(self.window) + self.change_language() + if self_test: + if 'cache_only' in self_test:self.cache_only.set(self_test['cache_only']) + if 'audio_lossless' in self_test:self.compression.set(self.compression_modes[{'off':0,'voice':1,'all':2}[self_test['audio_lossless']]]) + if 'video_mode' in self_test:self.video.set(self.video_modes[{'skip':0,'nvl1':1,'nva1':2}[self_test['video_mode']]]) + self.source.set(self_test['source']);self.output.set(self_test['output_base']);window.after(300,self.inspect) + + def tr(self,text): + return tr(text,self.language.get()) + + def set_status(self,raw): + self._status_zh=raw + suffix='。点击“打开结果文件夹”查看安装必读。' + if raw.endswith(suffix): + translated=self.tr(raw[:-len(suffix)])+self.tr(suffix) + elif raw.startswith('未完成:'): + translated=self.tr('未完成:')+self.tr(raw[len('未完成:'):]) + else: + translated=self.tr(raw) + self.status.set(translated) + + def _capture_localizable_widgets(self,parent): + for widget in parent.winfo_children(): + if 'text' in widget.keys(): + original=widget.cget('text') + if original:self._ui_sources[widget]=original + self._capture_localizable_widgets(widget) + + def _apply_language(self): + self.window.title(self.tr('CPyMO NDS 转换助手')) + for widget,source in self._ui_sources.items(): + widget.configure(text=self.tr(source)) + self.set_status(self._status_zh) + + def change_language(self,_event=None): + audio_idx=self.compression_modes.index(self.compression.get()) + video_idx=self.video_modes.index(self.video.get()) + raw_compression=['不压缩缓存(读取优先)', + '无损压缩语音与适合的图片(推荐)', + '无损压缩全部音频与适合的图片(实验)'] + raw_video=['不转换视频(兼容旧流程)', + '转换视频 NVL1(推荐:兼容优先)', + '转换视频 NVA1(压缩音频)'] + self.compression_modes=[self.tr(x) for x in raw_compression] + self.video_modes=[self.tr(x) for x in raw_video] + self.compression_box.configure(values=self.compression_modes) + self.video_box.configure(values=self.video_modes) + self.compression.set(self.compression_modes[audio_idx]) + self.video.set(self.video_modes[video_idx]) + self._apply_language() + self._update_advanced_caption() + self._render_log(force=True) + if self.last_output and self.last_result and not self.last_result.get('ok'): + self.open_button.configure(text=self.tr('查看错误日志')) + if self.candidates: + selected=self.games.curselection() + self.games.delete(0,'end') + for i,c in enumerate(self.candidates): + prefix=self.tr('推荐 ') if i==0 else '' + self.games.insert('end',f"{prefix}[{c['platform']}] {c['title']}") + if selected:self.games.selection_set(selected[0]) + try: + self.preference_file.parent.mkdir(parents=True,exist_ok=True) + self.preference_file.write_text(json.dumps({'language':self.language.get()},ensure_ascii=False),encoding='utf8') + except OSError: + pass # Keep a usable UI if preferences are read-only. + + def _update_advanced_caption(self): + label='收起更多设置' if self.advanced_visible else '更多设置(可选)' + self.advanced_button.configure(text=self.tr(label)) + + def toggle_advanced(self): + self.advanced_visible=not self.advanced_visible + if self.advanced_visible: + self.advanced_frame.pack(fill='x',after=self.advanced_button) + else: + self.advanced_frame.pack_forget() + self._update_advanced_caption() + + def _update_game_list_layout(self): + """Keep the game picker compact; scroll only for more than three variants.""" + count=len(self.candidates) + self.games.configure(height=max(1,min(count,3))) + if count>3: + self.game_scroll.pack(side='right',fill='y') + else: + self.game_scroll.pack_forget() + + def pick_zip(self): + p=filedialog.askopenfilename(title=self.tr('选择 PyMO 游戏包'),filetypes=[(self.tr('游戏包'),'*.zip'),(self.tr('全部文件'),'*.*')]) + if p:self.source.set(p);self.inspect() + + def pick_folder(self): + p=filedialog.askdirectory(title=self.tr('选择含 gameconfig.txt 的游戏数据目录')) + if p:self.source.set(p);self.inspect() + + def pick_output(self): + p=filedialog.askdirectory(title=self.tr('选择保存位置')) + if p:self.output.set(p) + + def busy(self,value): + for button in (self.zip_button,self.folder_button,self.output_button):button.configure(state='disabled' if value else 'normal') + self.cancel_button.configure(state='normal' if value else 'disabled') + self.convert_button.configure(state='normal' if not value and self.candidates else 'disabled') + self.games.configure(state='disabled' if value else 'normal') + for widget in (self.video_box,self.compression_box,self.language_box): + widget.configure(state='disabled' if value else 'readonly') + self.advanced_button.configure(state='disabled' if value else 'normal') + if value: + self.progress.pack(fill='x',before=self.status_label) + self.progress.start(12) + else: + self.progress.stop() + self.progress.pack_forget() + + def start(self,job,callback): + self._log_disk_text='' + self._log_extra_text='' + self._log_extra_report=None + self._render_log(force=True) + self.serial+=1;stamp=datetime.datetime.now().strftime('%Y%m%d-%H%M%S-%f');folder=self.state_root/(stamp+'-'+str(self.serial));folder.mkdir(parents=True) + self.job_file=folder/'job.json';self.result_file=folder/'result.json';self.log_file=folder/'log.txt' + job.update(result=str(self.result_file.resolve()),log=str(self.log_file.resolve()));self.job_file.write_text(json.dumps(job,ensure_ascii=False,indent=2),encoding='utf8') + cmd=[sys.executable]+([] if getattr(sys,'frozen',False) else [str(Path(__file__).resolve())])+['--job',str(self.job_file.resolve())] + self.process=subprocess.Popen(cmd,stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL,creationflags=0x08000000 if os.name=='nt' else 0) + self.callback=callback;self.busy(True);self.window.after(200,self.poll) + + def _format_conversion_notes(self,report): + notes=['\n'+('\n'.join(self.tr(w) for w in report['warnings']) + if report['warnings'] else self.tr('未发现静态兼容性警告。'))+'\n'] + if report.get('cache_only'): + notes.append(self.tr('已省去重复媒体 {size:.2f} MiB。脚本与署名保留,原包未修改。').format(size=report['redundant_media_bytes']/1048576)+'\n') + comp=report.get('lossless',{}) + if comp.get('audio_mode','off')!='off': + notes.append(self.tr('无损缓存另节省 {size:.2f} MiB。请使用随附的 {version} 引擎。').format(size=(comp['audio_saved_bytes']+comp['image_saved_bytes'])/1048576,version=VERSION)+'\n') + return ''.join(notes) + + def _render_log(self,force=False): + extra=(self._format_conversion_notes(self._log_extra_report) + if self._log_extra_report is not None else self._log_extra_text) + displayed=(tr_log(self._log_disk_text,self.language.get())+extra)[-12000:] + if not force and displayed==self._last_log_display: + return + self.log.configure(state='normal') + # Append only when the new content really extends the old content; + # wholesale deletion every 300 ms caused macOS Tk repaint artifacts. + if not force and displayed.startswith(self._last_log_display): + self.log.insert('end',displayed[len(self._last_log_display):]) + else: + self.log.delete('1.0','end') + self.log.insert('end',displayed) + self._last_log_display=displayed + self.log.see('end') + self.log.configure(state='disabled') + + def poll(self): + if not self.process:return + if self.log_file.exists(): + text=self.log_file.read_text(encoding='utf8',errors='replace') + if text!=self._log_disk_text: + self._log_disk_text=text + self._render_log() + if self.process.poll() is None:self.window.after(300,self.poll);return + self.process=None;self.busy(False) + report=json.loads(self.result_file.read_text(encoding='utf8')) if self.result_file.exists() else {'ok':False,'error':'转换进程意外退出,请保留诊断日志。'} + self.last_result=report;self.callback(report) + + def inspect(self): + self.candidates=[];self.games.delete(0,'end');self._update_game_list_layout();self.set_status('正在识别游戏包里的平台版本……') + self.start({'action':'inspect','source':self.source.get()},self.inspected) + + def inspected(self,report): + if not report['ok']:self.failed(report);return + self.candidates=report['candidates'] + self._update_game_list_layout() + for i,c in enumerate(self.candidates):self.games.insert('end',f"{self.tr('推荐 ') if i==0 else ''}[{c['platform']}] {c['title']}") + selected=self.self_test.get('candidate',0) if self.self_test else 0 + self.games.selection_set(selected);self.convert_button.configure(state='normal');self.set_status('已识别游戏。确认保存位置后,点击“开始转换”。') + if self.self_test and not self.test_started:self.test_started=True;self.window.after(200,self.begin) + + def begin(self): + selected=self.games.curselection() + if not selected:return + source=Path(self.source.get()).resolve();base=Path(self.output.get()).resolve() + if source.is_dir() and base.is_relative_to(source):self.failed({'ok':False,'error':self.tr('保存位置不能位于原游戏目录内部。')});return + name='CPyMO_NDS_转换结果_'+datetime.datetime.now().strftime('%Y%m%d_%H%M%S_%f');output=base/name + self.set_status('正在转换,请稍候。语音较多的游戏需要更长时间……');self.open_button.configure(state='disabled',text=self.tr('打开结果文件夹')) + audio_mode=['off','voice','all'][self.compression_modes.index(self.compression.get())] + self.start({'action':'convert','source':str(source),'candidate':int(selected[0]),'output':str(output),'missing_policy':'box','cache_only':self.cache_only.get(),'audio_lossless':audio_mode,'video_mode':['skip','nvl1','nva1'][self.video_modes.index(self.video.get())],'ui_language':self.language.get()},self.converted) + + def converted(self,report): + if not report['ok']:self.failed(report);return + self.last_output=Path(report['output']);self.open_button.configure(state='normal',text=self.tr('打开结果文件夹')) + self.set_status('转换完成!有一些提示,建议先查看下方记录。' if report.get('warnings') else '转换完成!请打开结果文件夹,按说明复制到 TF 卡。') + # Keep the original structured result: the displayed summary must + # follow UI language changes, without rewriting diagnostic files. + self._log_extra_report=report + self._render_log() + if self.self_test:self.finish_test(report) + + def failed(self,report): + if self.result_file.parent.is_dir(): + self.last_output=self.result_file.parent + self.open_button.configure(state='normal',text=self.tr('查看错误日志')) + self.set_status('未完成:'+report['error']) + if self.self_test:self.finish_test(report) + else:messagebox.showerror(self.tr('暂时不能完成转换'),self.tr(report['error'])+'\n\n'+self.tr('原游戏包未改动。诊断目录:')+str(self.result_file.parent)) + + def finish_test(self,report): + def capture(): + result=dict(report) + try: + self.window.lift();self.window.update() + result['ui_title']=self.window.title() + result['ui_version_footer']=str(self.version_label.cget('text')) + result['ui_layout']={ + 'progress_visible':bool(self.progress.winfo_ismapped()), + 'game_list_rows':int(self.games.cget('height')), + 'game_scroll_visible':bool(self.game_scroll.winfo_ismapped()), + 'video_right_gap':self.video_box.master.winfo_width() + -self.video_box.winfo_x()-self.video_box.winfo_width(), + } + from PIL import ImageGrab + # Screenshot capture is ancillary on macOS: permissions and + # unsupported window capture APIs must not discard the actual + # conversion result or leave the frozen test GUI running. + ImageGrab.grab(window=self.window.winfo_id()).save(self.self_test['screenshot']) + result['ui_screenshot']='captured' + except Exception as exc: + result['ui_screenshot']='unavailable' + result['ui_screenshot_error']=str(exc) + finally: + Path(self.self_test['result']).write_text( + json.dumps(result,ensure_ascii=False,indent=2),encoding='utf8') + self.window.after(250,self.close) + self.window.after(250,capture) + + def cancel(self): + if self.process and self.process.poll() is None: + if os.name=='nt':subprocess.run(['taskkill','/PID',str(self.process.pid),'/T','/F'],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL,creationflags=0x08000000) + else:self.process.terminate() + self.process=None;self.busy(False);self.set_status('已取消。原游戏包未改动;未完成目录和日志保留供检查。') + if getattr(self,'log_file',None) and self.log_file.parent.is_dir(): + self.last_output=self.log_file.parent + self.open_button.configure(state='normal',text=self.tr('查看错误日志')) + + def open_output(self): + if self.last_output: + if sys.platform=='darwin':subprocess.Popen(['open',str(self.last_output)]) + elif os.name=='nt':os.startfile(self.last_output) + else:subprocess.Popen(['xdg-open',str(self.last_output)]) + + def close(self): + if self.process:self.cancel() + self.window.destroy() + +def main(): + parser=argparse.ArgumentParser();parser.add_argument('--job',type=Path);parser.add_argument('--state-root',type=Path);parser.add_argument('--self-test',type=Path);args=parser.parse_args() + if args.job: + job=json.loads(args.job.read_text(encoding='utf8')) + with Path(job['log']).open('w',encoding='utf8',buffering=1) as log,contextlib.redirect_stdout(log),contextlib.redirect_stderr(log):report=run_job(job) + return 0 if report['ok'] else 1 + test=json.loads(args.self_test.read_text(encoding='utf8')) if args.self_test else None + + if os.name=='nt': + import ctypes + ctypes.windll.user32.SetProcessDPIAware() + window=tk.Tk();App(window,args.state_root,test);window.mainloop();return 0 + +if __name__=='__main__':sys.exit(main()) diff --git a/cpymo-tool/nds-converter/assets/ICON-ATTRIBUTION.txt b/cpymo-tool/nds-converter/assets/ICON-ATTRIBUTION.txt new file mode 100644 index 00000000..09def60a --- /dev/null +++ b/cpymo-tool/nds-converter/assets/ICON-ATTRIBUTION.txt @@ -0,0 +1,46 @@ +CPyMO for NDS — NDS program and companion-converter icon refresh (1.3.0) +======================================================================= + +Source motif: + PyMO original app icon (girl, yellow mascot and game controller) + https://github.com/pymo/pymo/blob/master/images/pymo-icon.png + https://github.com/pymo/pymo/blob/master/images/pymo-icon.psd + Copyright (c) 2013 pymo. + The original project's MIT notice is retained in + PYMO-ORIGINAL-MIT-LICENSE.txt. No endorsement is implied. + +Current artwork: + User-provided, AI-assisted high-resolution interpretation of the PyMO motif, + selected and approved for CPyMO for NDS 1.2.1 on 2026-11-05. + Original square illustration SHA-256: + c5144d0bc49afdbccb3ce336cbedfecf130eb50574e4df7de35c048db34b9c38 + +Desktop companion converters: + The approved 1024x1024 RGBA PNG has a small outer-edge cleanup and a + supersampled antialiased rounded-corner mask. No CPyMO wordmark was added; + the characters, original colors, layout and internal linework are retained. + Canonical file: assets/converter-icon-source.png + Canonical PNG SHA-256: + 133abae11b6d958c8e02d70e67dcf997049b5277bde3c734860e19f80257d90e + Decoded 1024x1024 RGBA pixel SHA-256: + a5954aa3fb04caecaf3796a314910f1e6fcc6d62d72d2b07a582f50ec15a4460 + All Windows ICO, macOS ICNS and GUI PNG variants share this source. + macOS alone uniformly scales the complete image to 80% and centers it + on a transparent canvas. No extra crop, edge erosion, corner mask or + horizontal compression is applied. Frozen Mac applications retain the + native Bundle ICNS instead of replacing the Dock tile with a Tk PNG. + Windows ICO and its small GUI PNG retain the original direct resampling. + There is no second round-corner mask, 16px erosion or horizontal compression. + The former 04 pixel-art / perimeter-cleanup icon is superseded, not bundled + as an alternative design. Git history is not rewritten. + +Nintendo DS program: + Its external banner, splash and internal fallback icon use the original + FULL-SQUARE composition at 32x32, 15 opaque RGB555 colors, with no rounded mask. + This desktop icon generator does not write those NDS resources or any + game's own cover/icon. See cpymo-backends/nds/assets/ICON-ORIGIN.md. + +These are an NDS game program and Windows/macOS companion data converters, +not three independent game clients or new Windows/macOS playback backends. +The original creators' rights and notices are retained. This update does not +claim ownership of the original characters or authors' approval. diff --git a/cpymo-tool/nds-converter/assets/PYMO-ORIGINAL-MIT-LICENSE.txt b/cpymo-tool/nds-converter/assets/PYMO-ORIGINAL-MIT-LICENSE.txt new file mode 100644 index 00000000..061fdf8e --- /dev/null +++ b/cpymo-tool/nds-converter/assets/PYMO-ORIGINAL-MIT-LICENSE.txt @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013 pymo + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/cpymo-tool/nds-converter/assets/README.md b/cpymo-tool/nds-converter/assets/README.md new file mode 100644 index 00000000..b15f95ac --- /dev/null +++ b/cpymo-tool/nds-converter/assets/README.md @@ -0,0 +1,44 @@ +# CPyMO for NDS — desktop converter icon + +This folder is reserved for the desktop **converter app**, **not** the 32×32 NDS/DSi ROM banner. The owner chose the archived **04_高清像素图标_透明外框.png** on 2026-10-27 after direct 02/04 comparison. + +## Canonical source and deterministic derivatives + +The approved image is 1254×1254 RGBA with a genuinely transparent outer area. Its **exact original bytes** have SHA-256: + +`3f110860ce4e242b79147ccd7b6c6d260efd1a232fa8039b41c02677aa3f8c62` + +Before producing an icon-branded public installer, put those original bytes at: + +`cpymo-tool/nds-converter/assets/converter-icon-source.png` + +Generate build assets with: + +```sh +python cpymo-tool/nds-converter/tools/build_desktop_icons.py \ + --source cpymo-tool/nds-converter/assets/converter-icon-source.png \ + --output cpymo-tool/nds-converter/assets/generated +``` + +This generates a 1024px PNG, 64px Tk PNG, Windows multi-resolution ICO, +macOS Retina ICNS and icon SHA manifest. The archived original stays unchanged. +Only desktop derivatives are horizontally scaled by 0.976 and recentered on +square transparent canvases (visible bounds 1119x1092 become about 1097x1092). +The NDS ROM banner icon is never modified. Windows/macOS packagers can generate +these from the approved source when present, without modifying the DS ROM. + +**For the public RC**, pass `--require-desktop-icon` to both +`build_portable.py` and `build_portable_macos.py`: the release build must +stop instead of silently falling back to PyInstaller's default icon. + +## Provenance and public distribution + +The selected picture is a user-approved high-resolution pixel-style +derivative of a historical PyMO logo/icon design (girl, yellow character, +game controller); the CPyMO project does **not** thereby establish ownership +or commercial redistribution rights to the original visual elements. +Confirm the upstream artwork's applicable permission and include appropriate +attribution or choose separately licensed art **before public redistribution**. + +The original high-resolution image remains archived in the user's ChatGPT +Library under `游戏与项目资料/PyMO引擎与跨平台移植/03_NDS图标重制_2026-10-25`. The source PNG is committed in this repository and validated against the pinned digest above. diff --git a/cpymo-tool/nds-converter/assets/converter-icon-source.png b/cpymo-tool/nds-converter/assets/converter-icon-source.png new file mode 100644 index 00000000..d8e40484 Binary files /dev/null and b/cpymo-tool/nds-converter/assets/converter-icon-source.png differ diff --git a/cpymo-tool/nds-converter/audio_aliases.py b/cpymo-tool/nds-converter/audio_aliases.py new file mode 100644 index 00000000..af6c3ccd --- /dev/null +++ b/cpymo-tool/nds-converter/audio_aliases.py @@ -0,0 +1,18 @@ +"""MIT. Exact-content audio deduplication in an owned new conversion directory.""" +from pathlib import Path +import hashlib,struct,zlib + +def deduplicate_audio(cache,rows,key): + groups={};records=[];saved=0 + for row in sorted(rows,key=lambda a:(a['kind'],key(a['name']))): + identity=(row['kind'],row['decoded_pcm_sha256']);suffix='.nar' if row['encoding']=='NAR2' else '.pcm';path=cache/row['kind']/(key(row['name'])+suffix) + if identity not in groups:groups[identity]=(row,path);continue + canonical,target=groups[identity] + # A bounded table is optional. Extra duplicates remain ordinary files. + if len(records)>=1024:continue + if path.suffix!=target.suffix or hashlib.sha256(path.read_bytes()).digest()!=hashlib.sha256(target.read_bytes()).digest():raise ValueError('Duplicate audio encoding differs') + source_key=key(row['name']);target_key=key(canonical['name']);channel={'bgm':'0','se':'1','voice':'2'}[row['kind']] + records.append((channel+source_key+target_key).encode('ascii'));saved+=row['bytes'];row['alias_original_bytes']=row['bytes'];row['bytes']=0;row['alias_target']=target.relative_to(cache).as_posix();path.unlink() + if records: + data=b''.join(sorted(records));(cache/'audio-aliases.bin').write_bytes(struct.pack('<4sII',b'NAD1',len(records),zlib.adler32(data))+data) + return {'aliases':len(records),'saved_bytes':saved,'index_bytes':12+33*len(records) if records else 0} diff --git a/cpymo-tool/nds-converter/build_native.py b/cpymo-tool/nds-converter/build_native.py new file mode 100644 index 00000000..27825917 --- /dev/null +++ b/cpymo-tool/nds-converter/build_native.py @@ -0,0 +1,8 @@ +"""MIT. Build the optional Windows host encoder; players need no compiler.""" +from pathlib import Path +import argparse,subprocess,hashlib,json +root=Path(__file__).resolve().parent +parser=argparse.ArgumentParser();parser.add_argument('--cc',type=Path,required=True);a=parser.parse_args() +command=[str(a.cc.resolve()),'-shared','-static','-O3',str(root/'lossless-native.c'),'-o',str(root/'lossless-native.dll')] +subprocess.run(command,check=True) +print(json.dumps({'command':command,'sha256':hashlib.sha256((root/'lossless-native.dll').read_bytes()).hexdigest()})) diff --git a/cpymo-tool/nds-converter/build_portable.py b/cpymo-tool/nds-converter/build_portable.py new file mode 100644 index 00000000..4fe7fcd9 --- /dev/null +++ b/cpymo-tool/nds-converter/build_portable.py @@ -0,0 +1,101 @@ +"""Build a paired Windows ROM/converter distribution. MIT; Python 3.10+.""" +from pathlib import Path +import argparse +import hashlib +import json +import os +import shutil +import subprocess +import sys +import importlib + +ROOT = Path(__file__).resolve().parent +BACKEND = ROOT.parents[1] / 'cpymo-backends/nds' + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--ffmpeg', type=Path, required=True) + parser.add_argument('--rom', type=Path, help='Explicit paired, validated NTR/TWL release ROM') + parser.add_argument('--output', type=Path, required=True) + parser.add_argument('--rebuild', action='store_true', help='Reuse an owned portable-build directory') + parser.add_argument('--require-desktop-icon', action='store_true', + help='Fail packaging if the owner-approved converter icon is missing') + args = parser.parse_args() + if os.name != 'nt': + parser.error('Build the Windows portable executable on Windows.') + # Fail before creating a package which starts but cannot compress images. + for module in ('PyInstaller', 'PIL.Image', 'lz4.block'): + try: + importlib.import_module(module) + except ImportError as error: + parser.error(f'Missing build dependency {module}: {error}') + ffmpeg = args.ffmpeg.resolve() + output = args.output.resolve() + rom = args.rom.resolve() if args.rom else BACKEND / 'engine.nds' + owned = (output/'build/Converter.spec').is_file() and (output/'helper-build.log').is_file() + if (output.exists() and not (args.rebuild and owned)) or not ffmpeg.is_file() or not rom.is_file(): + parser.error('Use a new output directory and existing FFmpeg/ROM files.') + # A release candidate must never bundle the staging image placeholder. + # Developer builds that omit --rom remain possible, but cannot be + # mistaken for the explicitly validated single-ROM release path. + if args.rom: + from importlib import util as importlib_util + verifier = BACKEND / 'tools/verify-release-artifact.py' + spec = importlib_util.spec_from_file_location('cpymo_release_gate', verifier) + module = importlib_util.module_from_spec(spec) + spec.loader.exec_module(module) + module.validate_rom_bytes(rom.read_bytes()) + # Old 1.1 Starter's custom ffmpeg.exe intentionally had --disable-swscale + # and --disable-everything. It plays audio but can never convert MP4. + # Refuse to ship a deceptive 1.2 bundle even when PyInstaller succeeds. + from video_nvl import validate_ffmpeg + try: + validate_ffmpeg(str(ffmpeg)) + except ValueError as error: + parser.error(str(error)) + release = json.loads((BACKEND/'release.json').read_text(encoding='utf8')) + output.mkdir(parents=True, exist_ok=args.rebuild) + build = output/'build' + resources = build/'resources' + resources.mkdir(parents=True, exist_ok=True) + source_icon = ROOT/'assets/converter-icon-source.png' + icon_out = build/'branding' + icon_args=[] + icon_manifest=None + if source_icon.is_file(): + from tools.build_desktop_icons import build as build_icons + icon_manifest=build_icons(source_icon,icon_out) + shutil.copy2(icon_out/'icon-manifest.json',output/'ICON-MANIFEST.json') + icon_args=['--icon',str(icon_out/'converter-icon.ico'), + '--add-data',f"{icon_out/'converter-icon-64.png'};assets"] + elif args.require_desktop_icon: + parser.error("Missing approved converter artwork: "+str(source_icon)) + paired_rom = resources/'cpymo-nds.nds' + shutil.copy2(rom, paired_rom) + command = [sys.executable, '-m', 'PyInstaller', '--noconfirm', '--clean', + '--onedir', '--windowed', '--name', 'Converter', + '--distpath', str(output/'app'), '--workpath', str(build), + '--specpath', str(build), '--add-data', f'{ROOT / "fonts"};fonts', + '--add-data', f'{BACKEND / "release.json"};.', + '--add-data', f'{paired_rom};.', '--add-binary', f'{ffmpeg};.', + '--exclude-module', 'numpy', '--exclude-module', 'scipy', + '--exclude-module', 'matplotlib', '--exclude-module', 'pytest', + str(ROOT/'app.py')] + command[-1:-1]=icon_args + if (ROOT/'lossless-native.dll').is_file(): + command[-1:-1]=['--add-binary',f'{ROOT / "lossless-native.dll"};.'] + with (output/'helper-build.log').open('w', encoding='utf8') as log: + subprocess.run(command, check=True, stdout=log, stderr=subprocess.STDOUT) + shutil.copy2(rom, output/'cpymo-nds.nds') + digest = lambda p: hashlib.sha256(p.read_bytes()).hexdigest() + assert digest(rom) == digest(output/'app/Converter/_internal/cpymo-nds.nds') + release.update(rom_sha256=digest(rom), ffmpeg_sha256=digest(ffmpeg), + desktop_icon=icon_manifest["artwork_id"] if icon_manifest else "default-not-public", + desktop_icon_pixel_sha256=icon_manifest["source_rgba_sha256"] if icon_manifest else None, + desktop_icon_source_sha256=digest(source_icon) if icon_args else None) + (output/'VERSION.json').write_text(json.dumps(release, indent=2)+'\n', encoding='utf8') + (output/'BUILD-COMMAND.json').write_text(json.dumps(command, indent=2), encoding='utf8') + print(json.dumps(release, indent=2)) + +if __name__ == '__main__': + main() diff --git a/cpymo-tool/nds-converter/build_portable_macos.py b/cpymo-tool/nds-converter/build_portable_macos.py new file mode 100644 index 00000000..1b0daed5 --- /dev/null +++ b/cpymo-tool/nds-converter/build_portable_macos.py @@ -0,0 +1,199 @@ +"""Build a self-contained macOS CPyMO NDS conversion assistant (.app). + +Development candidate until native macOS bundle, third-party FFmpeg licensing +and Gatekeeper distribution are validated. Must be built ON macOS with an +explicit final ROM; never substitutes an unrelated local 1.1 engine. +""" +from __future__ import annotations +from pathlib import Path +import argparse +import hashlib +import importlib +import json +import plistlib +import platform +import shutil +import subprocess +import sys + +HERE = Path(__file__).resolve().parent +BACKEND = HERE.parents[1] / "cpymo-backends/nds" + + +def digest(path: Path) -> str: + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--ffmpeg", type=Path, required=True) + parser.add_argument("--rom", type=Path, required=True) + parser.add_argument("--output", type=Path, required=True) + parser.add_argument("--target-arch", choices=("arm64", "x86_64"), default=platform.machine(), + help="Build a native single-architecture app; ARM64 requires Apple silicon.") + parser.add_argument("--require-desktop-icon", action="store_true", + help="Fail packaging unless the approved rounded original icon source is present") + args = parser.parse_args() + if sys.platform != "darwin": + parser.error("Build native macOS applications on a macOS host.") + if platform.machine() != args.target_arch: + parser.error(f"Host architecture {platform.machine()} != {args.target_arch}; " + "use a matching native macOS runner, never Rosetta for arm64 builds.") + for module in ("PyInstaller", "PIL.Image", "lz4.block", "tkinter"): + try: + importlib.import_module(module) + except ImportError as exc: + parser.error(f"Missing package {module}: {exc}") + output = args.output.resolve() + rom = args.rom.resolve() + ffmpeg = args.ffmpeg.resolve() + if output.exists() or not rom.is_file() or not ffmpeg.is_file(): + parser.error("Choose a NEW output directory and valid ROM / FFmpeg inputs.") + from video_nvl import validate_ffmpeg + validate_ffmpeg(str(ffmpeg)) + def require_arch(binary: Path) -> None: + probe = subprocess.run(["lipo", "-archs", str(binary)], check=True, + capture_output=True, text=True, timeout=30) + arches = probe.stdout.strip().split() + if args.target_arch not in arches: + raise RuntimeError(f"{binary} is {arches}, expected {args.target_arch}; " + "do not ship an x86_64-only app on Apple silicon.") + require_arch(ffmpeg) + metadata = json.loads((BACKEND / "release.json").read_text(encoding="utf8")) + if metadata["version"] != (BACKEND / "VERSION").read_text().strip(): + parser.error("Engine version metadata mismatch.") + output.mkdir(parents=True) + build = output / "_build" + resources = build / "resources" + resources.mkdir(parents=True) + paired_rom = resources / "cpymo-nds.nds" + paired_ffmpeg = resources / "ffmpeg" + shutil.copy2(rom, paired_rom) + shutil.copy2(ffmpeg, paired_ffmpeg) + paired_ffmpeg.chmod(paired_ffmpeg.stat().st_mode | 0o111) + icon_source = HERE / "assets/converter-icon-source.png" + icon_args=[] + icon_manifest=None + if icon_source.is_file(): + from tools.build_desktop_icons import build as build_icons + branding = build / "branding" + icon_manifest=build_icons(icon_source,branding) + shutil.copy2(branding/"icon-manifest.json",output/"ICON-MANIFEST.json") + # macOS uses only the native bundle ICNS. A Tk 64px iconphoto would + # replace the Dock tile, discarding both its padding and resolution. + icon_args=["--icon",str(branding/"converter-icon.icns")] + elif args.require_desktop_icon: + parser.error(f"Missing owner-approved desktop icon: {icon_source}") + command = [sys.executable, "-m", "PyInstaller", + "--noconfirm", "--clean", "--onedir", "--windowed", + "--name", "CPyMO-NDS-Converter", + "--target-arch", args.target_arch, + "--osx-bundle-identifier", "dev.blueteemo.cpymo-nds-converter", + "--distpath", str(build / "dist"), + "--workpath", str(build / "temp"), + "--specpath", str(build), + "--add-data", f"{HERE / 'fonts'}:fonts", + "--add-data", f"{BACKEND / 'release.json'}:.", + "--add-data", f"{paired_rom}:.", + "--add-binary", f"{paired_ffmpeg}:.", + "--exclude-module", "numpy", "--exclude-module", "scipy", + "--exclude-module", "matplotlib", "--exclude-module", "pytest", + str(HERE / "app.py")] + command[-1:-1]=icon_args + # The runtime uses sys._MEIPASS for the bundled FFmpeg and ROM. macOS's + # app contains Resources/Frameworks cross-links; inspect both locations. + with (output / "build.log").open("w", encoding="utf8") as log: + subprocess.run(command, check=True, stdout=log, stderr=subprocess.STDOUT) + app = build / "dist/CPyMO-NDS-Converter.app" + if not app.is_dir(): + raise RuntimeError("Missing .app from PyInstaller") + # Confirm the actual bundle icon is our selected design rather than + # PyInstaller's default icon, irrespective of its eventual basename. + icon_name=None + if icon_args: + expected_icon=digest(branding/"converter-icon.icns") + candidates=list((app/"Contents/Resources").glob("*.icns")) + verified=[p for p in candidates if digest(p)==expected_icon] + if len(verified)!=1: + raise RuntimeError("Configured Finder/Dock icon does not match approved rounded original ICNS") + icon_name=verified[0].name + # PyInstaller defaults to Finder's 0.0.0 unless the actual release is set. + # Set the release metadata and re-apply only an ad-hoc local code signature: + # this is NOT Apple Developer ID signing or notarization. + info = app / "Contents/Info.plist" + with info.open("rb") as file: + plist = plistlib.load(file) + plist["CFBundleShortVersionString"] = metadata["version"] + plist["CFBundleVersion"] = metadata["version"] + plist["CFBundleGetInfoString"] = f"CPyMO NDS Converter {metadata['version']}" + if icon_name: + plist["CFBundleIconFile"] = icon_name + with info.open("wb") as file: + plistlib.dump(plist, file) + subprocess.run(["codesign", "--force", "--deep", "--sign", "-", str(app)], + check=True, capture_output=True, text=True, timeout=180) + subprocess.run(["codesign", "--verify", "--deep", "--strict", str(app)], + check=True, capture_output=True, text=True, timeout=90) + with info.open("rb") as file: + assert plistlib.load(file)["CFBundleShortVersionString"] == metadata["version"] + require_arch(app / "Contents/MacOS/CPyMO-NDS-Converter") + if icon_name: + if digest(app/"Contents/Resources"/icon_name)!=expected_icon: + raise RuntimeError("Packaged Finder/Dock icon changed after ad-hoc signing") + for resource in ("cpymo-nds.nds", "ffmpeg", "release.json"): + present = any((app / location / resource).is_file() for location in + ("Contents/Resources", "Contents/Frameworks", "Contents/MacOS")) + if not present: + raise RuntimeError("Missing bundled resource " + resource) + internal_rom = next(p for p in (app / "Contents/Resources/cpymo-nds.nds", + app / "Contents/Frameworks/cpymo-nds.nds") if p.is_file()) + if digest(internal_rom) != digest(rom): + raise RuntimeError("Bundled ROM does not match the supplied input") + bundled_ffmpeg = next((p for p in ( + app / "Contents/Resources/ffmpeg", + app / "Contents/Frameworks/ffmpeg", + ) if p.is_file()), None) + if bundled_ffmpeg is None: + raise RuntimeError("Bundled FFmpeg executable not found") + require_arch(bundled_ffmpeg) + # PyInstaller applies an ad-hoc macOS code signature to its collected + # binaries; the app's actual executable can differ byte-for-byte from + # the source-built input. Record BOTH hashes, not a misleading single one. + ffmpeg_input_sha = digest(ffmpeg) + ffmpeg_bundle_sha = digest(bundled_ffmpeg) + shutil.copytree(app, output / app.name, symlinks=True) + shutil.copy2(rom, output / "cpymo-nds.nds") + shutil.rmtree(build) + metadata.update(desktop_icon=icon_manifest["artwork_id"] if icon_manifest else "default-not-public", + desktop_icon_source_sha256=icon_manifest["source_sha256"] if icon_manifest else None, + desktop_icon_pixel_sha256=icon_manifest["source_rgba_sha256"] if icon_manifest else None, + macos_dock_icon_source="bundle_icns", + macos_icon_derivation=icon_manifest["macos_derivation"] if icon_manifest else None, + macos_architecture=args.target_arch, + app_bundle_version=metadata["version"], + rosetta_required=False if args.target_arch=="arm64" else "Apple silicon only", + rom_sha256=digest(rom), + ffmpeg_input_sha256=ffmpeg_input_sha, + ffmpeg_bundled_sha256=ffmpeg_bundle_sha, + ffmpeg_sha256=ffmpeg_input_sha, + macos_bundle_validation="paired ROM and FFmpeg captured; ad-hoc signed/not notarized") + (output / "VERSION.json").write_text(json.dumps(metadata, ensure_ascii=False, indent=2) + "\n", encoding="utf8") + (output / "README-macOS.txt").write_text( + f"CPyMO NDS 转换助手 {metadata['version']} macOS ARM64\n" + "打开 CPyMO-NDS-Converter.app 转换原版 PyMO 游戏。\n" + "本应用采用临时签名,未经 Apple Developer ID 签名及 Apple 公证。\n" + "请确认从可信发布来源获取并核对 SHA-256 后再决定是否打开。\n" + "若被 Gatekeeper 拦截,可参照 Apple 官方说明在「系统设置 > 隐私与安全性」\n" + "中检查「仍要打开」;不要全局关闭 Gatekeeper 或系统完整性保护。\n" + "官方文档:https://support.apple.com/zh-cn/102445\n" + "第三方来源、构建信息和许可随包提供,请保留对应材料。\n" + "可运行游戏程序为同目录 cpymo-nds.nds,不含商业游戏。\n", + encoding="utf8") + print(json.dumps({"version": metadata["version"], "architecture":args.target_arch, + "rom_sha256": digest(rom), + "app": str(output / app.name), "macos_package": True}, + ensure_ascii=False, indent=2)) + + +if __name__ == "__main__": + main() diff --git a/cpymo-tool/nds-converter/convert.py b/cpymo-tool/nds-converter/convert.py new file mode 100644 index 00000000..0fbc7ad7 --- /dev/null +++ b/cpymo-tool/nds-converter/convert.py @@ -0,0 +1,482 @@ +"""CPyMO NDS cache converter, MIT. Python 3.10+, Pillow, external FFmpeg. + +Scripts/config and retained resources remain byte-identical in a new directory. +Normal CLI conversion defaults to playable NVL1 movie caches; users can opt out. +Original source video bytes stay untouched and hashes remain in the manifest. +No game names, chapters, translated text, or machine-specific paths are assumed. +""" +from __future__ import annotations +import argparse, concurrent.futures, hashlib, io, json, os, shutil, struct +import subprocess, sys, uuid, re +from dataclasses import dataclass +from pathlib import Path +from PIL import Image, ImageFont, ImageDraw, __version__ as pillow_version +from pixel_font import pixel_font_cache +import lossless +import video_nvl +from fvds_inspect import inspect_fvds + +from release_info import VERSION +CORE_COMMANDS = frozenset(['add', 'album', 'anime_off', 'anime_on', 'bg', 'bgm', 'bgm_stop', 'call', 'change', 'chara', 'chara_anime', 'chara_cls', 'chara_down', 'chara_pos', 'chara_quake', 'chara_scroll', 'chara_up', 'chara_y', 'config', 'date', 'fade_in', 'fade_out', 'flash', 'goto', 'if', 'label', 'load', 'movie', 'music', 'quake', 'rand', 'ret', 'say', 'scroll', 'se', 'se_stop', 'sel', 'select_img', 'select_imgs', 'select_text', 'select_var', 'set', 'sub', 'text', 'text_off', 'textbox', 'title', 'title_dsp', 'vo', 'wait', 'wait_se', 'waitkey']) +CACHE = 'nds-cache' +# Unicode repertoire for upstream core UI, not game dialogue. +# Stable superset of upstream/NDS UI glyphs, including printable ASCII. +# Game dialogue/config characters are collected separately during conversion. +UI_CODEPOINTS = ( + 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49, + 50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67, + 68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85, + 86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103, + 104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121, + 122,123,124,125,126,183,12289,12290,19969,19978,19979,19981,19982,20004,20006,20013,20026,20043, + 20048,20063,20110,20132,20165,20197,20214,20250,20294,20301,20303,20307,20316,20320,20351,20379,20381,20445, + 20462,20677,20808,20837,20840,20851,20855,20877,20986,21010,21015,21040,21047,21069,21095,21152,21160,21205, + 21253,21270,21315,21333,21345,21382,21407,21462,21482,21487,21488,21490,21491,21495,21508,21517,21518,21527, + 21547,21551,21644,21843,21855,21966,22238,22312,22519,22797,22799,22823,22833,22841,22846,23383,23384,23433, + 23436,23450,23545,23558,23559,23565,23567,23631,23706,24037,24038,24050,24120,24149,24179,24182,24211,24213, + 24230,24335,24341,24403,24452,24456,24465,24555,24773,24930,25103,25110,25138,25165,25191,25214,25321,25345, + 25353,25442,25552,25773,25806,25903,25918,25928,25943,25968,25972,25976,25991,26009,26032,26080,26085,26223, + 26371,26376,26377,26410,26412,26448,26694,26696,26723,26893,27138,27169,27284,27425,27491,27492,27511,27721, + 27809,27839,28040,28216,28304,28857,28858,29256,29486,29992,30005,30041,30053,30070,30340,30636,30721,30830, + 30906,31163,31227,31435,31471,32032,32147,32218,32447,32463,32472,32487,32493,32531,32622,32626,32773,32972, + 33041,33050,33258,33521,33756,34255,34892,34917,34920,35013,35036,35037,35201,35270,35302,35373,35377,35441, + 35442,35486,35712,35768,35774,35805,35813,35821,35831,35835,36039,36129,36133,36164,36182,36317,36335,36617, + 36716,36731,36733,36807,36816,36820,36827,36864,36873,36895,36914,36938,36984,37096,37197,37325,37327,38291, + 38388,38543,38544,38577,38656,38899,38917,39033,39057,65292,65306,65311, +) +# All three mode names are engine UI, not game script dialogue. Always embed +# them in newly converted games even when their novels never use these glyphs. +# The ROM fallback font independently covers already-converted game caches. +UI_CODEPOINTS = tuple(sorted(set(UI_CODEPOINTS) | set(map(ord, '立绘特效(全局)增强双屏增強雙強化画面操控モむ退出到游戏库确定未保存的进度将丢失。遊戲庫確定未儲存的進度將遺失。ゲーム一覧へ終了戻りますか進行は失われます')))) + +def sha(path): + h = hashlib.sha256() + with Path(path).open('rb') as f: + for block in iter(lambda: f.read(1024*1024), b''): h.update(block) + return h.hexdigest() + +def key(name): + value = 14695981039346656037 + for b in name.translate(str.maketrans('ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')).encode('utf-8'): value = ((value ^ b)*1099511628211) & ((1<<64)-1) + return f'{value:016x}' + +def safe_name(name): + if not name or name in ('.','..') or any(c in name for c in '/\\\0:'): + raise ValueError(f'Unsafe asset name: {name!r}') + return name + +@dataclass(frozen=True) +class Asset: + path: Path + offset: int = 0 + length: int | None = None + def read(self): + with self.path.open('rb') as f: + f.seek(self.offset) + data = f.read() if self.length is None else f.read(self.length) + if self.length is not None and len(data) != self.length: raise ValueError('Truncated package') + return data + +def assets(folder, extension=None): + package = folder/(folder.name+'.pak') + if package.is_file(): + size = package.stat().st_size + result = {} + with package.open('rb') as f: + header = f.read(4) + if len(header) != 4: raise ValueError(f'Invalid package {package}') + count, = struct.unpack(' 50000 or 4+count*40 > size: raise ValueError('Invalid package index') + for _ in range(count): + raw, offset, length = struct.unpack('<32sII', f.read(40)) + name = safe_name(raw.split(b'\0')[0].decode('utf-8')) + if name in result or offset < 4+count*40 or offset+length > size: + raise ValueError(f'Overlapping index/name or out-of-bounds asset {name}') + result[name] = Asset(package, offset, length) + return result + result = {} + if folder.is_dir(): + for f in sorted(folder.iterdir()): + if f.is_file() and (extension is None or f.suffix.lower() == '.'+extension.lower().lstrip('.')): + if f.suffix.lower() not in ('.jpg','.jpeg','.png','.bmp','.mp3','.ogg','.wav','.pcm'): continue + name = safe_name(f.stem) + if name in result: raise ValueError(f'Duplicate loose asset {name}') + result[name] = Asset(f) + return result + +def image_cache(asset, target, scale, mask=None, rgb=False): + data = asset.read() + image = Image.open(io.BytesIO(data)).convert('RGB' if rgb else 'RGBA') + lw, lh = image.size + if mask is not None: + image.putalpha(Image.open(io.BytesIO(mask.read())).convert('L').resize(image.size, Image.Resampling.BILINEAR)) + pw, ph = max(1,round(lw*scale)), max(1,round(lh*scale)) + if max(lw,lh)>65535 or max(pw,ph)>2048 or pw*ph>262144: raise ValueError('Image exceeds cache/DS allocation limit') + image = image.resize((pw,ph), Image.Resampling.LANCZOS) + colors = bytearray(); alpha = bytearray() + for p in (image.get_flattened_data() if hasattr(image,"get_flattened_data") else image.getdata()): + colors += struct.pack('>3) | ((p[1]>>3)<<5) | ((p[2]>>3)<<10)) + if not rgb: alpha.append(p[3]) + if alpha and all(a==255 for a in alpha): alpha.clear() + target.parent.mkdir(parents=True,exist_ok=True) + target.write_bytes(struct.pack('<4sHHHHI', b'NPI1', lw, lh, pw, ph, bool(alpha))+colors+alpha) + return {'source_sha256':hashlib.sha256(data).hexdigest(),'logical_size':[lw,lh],'physical_size':[pw,ph],'alpha':bool(alpha)} + +def font_cache(text, font_path, target): + codes = sorted(set(map(ord,text)) | set(range(32,127)) | set(UI_CODEPOINTS)) + codes = [cp for cp in codes if cp>=32 and cp not in (0xfeff,0xfffe,0xffff)] + if len(codes)>20000: raise ValueError('More than 20000 glyphs; split game or use a future streamed-font backend') + font = ImageFont.truetype(str(font_path),13) + output = bytearray(struct.pack('<4sI',b'NF13',len(codes))) + for cp in codes: + image=Image.new('L',(13,14));ImageDraw.Draw(image).text((0,11),chr(cp),font=font,fill=255,anchor='ls') + rows=[sum(1<=100) for y in range(14)] + output += struct.pack('1 else '' + if command and command not in CORE_COMMANDS: unknown.append({'script':path.name,'line':line_number,'command':command,'behavior':'upstream skips unknown directive; review before distribution'}) + if command in ('album','music','chara_anime','anime_on','scroll'): runtime.append({'script':path.name,'line':line_number,'command':command}) + if command in ('movie','video') and args.split(',')[0].strip().casefold() not in playable_videos: + unsupported.append({'script':path.name,'line':line_number,'command':command,'name':args.split(',')[0].strip()}) + folder=mapping.get(command) + if folder is None: continue + name=args.split(',')[0].strip() + if command=='vo' and name and (name[0].isdigit() or name.startswith('-')): name=args.split(',')[-1].strip() + if not name or name in ('NULL','none','-1'): continue + if any(c in name for c in '$%{}'): dynamic.append({'script':path.name,'line':line_number,'name':name});continue + if name.lower() not in {n.lower() for n in collections.get(folder,{})}: missing.append({'script':path.name,'line':line_number,'folder':folder,'name':name}) + return {'unknown_commands':unknown,'commands_requiring_game_runtime_check':runtime,'missing_resource_references':missing,'unsupported_video_commands':unsupported,'dynamic_references_not_resolved':dynamic,'limitations':['video safely skipped; masks supported with fade fallback for invalid masks','other games require runtime verification','font coverage depends on the supplied font; characters absent from it may render as tofu','memory use depends on concurrent images, not only individual file limits']} + +def verify(destination): + manifest=json.loads((destination/CACHE/'manifest.json').read_text(encoding='utf-8')) + for section in ('original_files','cache_files'): + for item in manifest[section]: + rel=Path(item['path']) + if rel.is_absolute() or '..' in rel.parts: raise ValueError('Unsafe manifest path') + if sha(destination/rel)!=item['sha256']: raise ValueError(f'Hash mismatch: {rel}') + for item in manifest.get('omitted_files',[]): + rel=Path(item['path']) + if rel.is_absolute() or '..' in rel.parts: raise ValueError('Unsafe omitted path') + if (destination/rel).exists(): raise ValueError(f'Omitted source asset remains: {rel}') + print(f'VERIFIED {len(manifest["original_files"])} original files and {len(manifest["cache_files"])} cache files') + +def inspect_source(src): + if not (src/'gameconfig.txt').is_file(): raise ValueError('Choose the extracted GAME folder containing gameconfig.txt, not the platform bundle or Android installer') + config={} + for line in (src/'gameconfig.txt').read_text(encoding='utf-8-sig').splitlines(): + k,sep,v=line.partition(',') + if sep: config[k.strip().lower()]=v.strip() + if config.get('scripttype','').lower() not in ('pymo','pym'): raise ValueError('Only text PyMO scripts are supported; other script languages need a separate importer') + scripts=sorted((src/'script').glob('*.txt')) + if not scripts: raise ValueError('Expected UTF-8 script/*.txt; packed/encrypted scripts are not supported') + start=safe_name(config.get('startscript','')) + if not (src/'script'/(start+'.txt')).is_file(): raise ValueError(f'Missing start script: script/{start}.txt') + for script in scripts: script.read_text(encoding='utf-8-sig') + return config + +def video_file(relative): + # PyMO movie assets live under movie/video, including packed containers. + return any(part.casefold() in ('movie','video','movies','videos') for part in relative.parts[:-1]) or relative.suffix.casefold() in ('.mp4','.avi','.mpg','.mpeg','.mkv','.webm','.3gp','.wmv','.mov','.ogv','.flv','.m4v') + +def launcher_bitmap(lines): + from pixel_font import read_bdf + codes=set(map(ord,''.join(lines)))|{ord('…'),ord('?')} + glyphs=read_bdf(Path(__file__).parent/'fonts/pixel/Fusion/fusion-pixel-12px-proportional-zh_hans.bdf.gz',codes) + image=Image.new('L',(200,14*len(lines))) + for row,text in enumerate(lines): + def width(value): return sum(glyphs.get(ord(c),glyphs[ord('?')])[0] for c in value) + if width(text)>200: + while text and width(text+'…')>200:text=text[:-1] + text+='…' + x=0 + for c in text: + advance,bits=glyphs.get(ord(c),glyphs[ord('?')]) + for y in range(14): + for xx in range(16): + if x+xx<200 and bits[y+2]&(1<16777216:raise ValueError('Game icon exceeds presentation conversion limit') + image=source.convert('RGBA');image.thumbnail((48,48),Image.Resampling.LANCZOS) + canvas=Image.new('RGBA',(48,48));canvas.alpha_composite(image,((48-image.width)//2,(48-image.height)//2)) + pixels=canvas.get_flattened_data() if hasattr(canvas,'get_flattened_data') else canvas.getdata() + data=b''.join(struct.pack('>3)|((g>>3)<<5)|((b>>3)<<10)) for r,g,b,a in pixels) + (cache/'launcher-icon.bin').write_bytes(struct.pack('<4sHH',b'NLI1',48,48)+data);result['icon']='icon.png' + return result + +def convert(args): + src=args.source.resolve();dst=args.destination.resolve() + if not (src/'gameconfig.txt').is_file(): raise ValueError('Source must be a game directory containing gameconfig.txt') + if dst.exists() or dst==src or src in dst.parents: raise ValueError('Destination must be new and outside source') + source_files=sorted(p for p in src.rglob('*') if p.is_file() and 'save' not in p.relative_to(src).parts and CACHE not in p.relative_to(src).parts) + if any(p.is_symlink() for p in src.rglob('*')): raise ValueError('Symlinks are not accepted') + originals=[{'path':p.relative_to(src).as_posix(),'sha256':sha(p)} for p in source_files] + source_hashes=originals + omitted=[dict(item,bytes=(src/item['path']).stat().st_size,reason='video safely skipped on NDS') for item in originals if video_file(Path(item['path']))] + originals=[item for item in originals if not video_file(Path(item['path']))] + config=inspect_source(src) + width,height=map(int,config['imagesize'].split(',')) + if not 1<=width<=65535 or not 1<=height<=65535: raise ValueError('Invalid imagesize') + scale=min(256/width,192/height,1) + font=Path(args.font or Path(__file__).parent/'fonts/NotoSansCJKsc-Regular.otf').resolve() + if not font.is_file(): raise ValueError('Font missing; use --font') + ffmpeg=shutil.which(args.ffmpeg) + if not ffmpeg: raise ValueError('FFmpeg missing; install it or provide --ffmpeg PATH') + ffversion=subprocess.check_output([ffmpeg,'-version'],creationflags=0x08000000 if os.name=='nt' else 0,text=True,encoding='utf-8',errors='replace').splitlines()[0] + stage=dst.parent/('.'+dst.name+'.partial-'+uuid.uuid4().hex) + stage.mkdir(parents=True) + print('Staging:',stage,flush=True) + cache_only=getattr(args,'cache_only',False) + if cache_only: + media_ext={'.jpg','.jpeg','.png','.bmp','.webp','.mp3','.wav','.ogg','.flac','.pcm','.pak'} + dropped=[item for item in originals if Path(item['path']).parts[0] in ('bg','bgm','chara','se','voice','system') and Path(item['path']).suffix.lower() in media_ext] + omitted.extend(dict(item,bytes=(src/item['path']).stat().st_size,reason='redundant original media; NDS cache generated and verified') for item in dropped) + drop_names={x['path'] for x in dropped};originals=[item for item in originals if item['path'] not in drop_names] + for item in originals: + target=stage/item['path'];target.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(src/item['path'],target) + (stage/'save').mkdir(exist_ok=True) + cache=stage/CACHE;cache.mkdir();(cache/'format.txt').write_bytes(b'CPYMO-NDS-CACHE-1\n');launcher_title(config,font,cache/'launcher-title.bin');presentation=launcher_presentation(src,config,font,cache) + folders={} + for kind in ('bg','chara','bgm','voice','se','system'): + ext=config.get(kind+'format','png' if kind=='system' else 'mp3' if kind in ('bgm','voice','se') else 'jpg') + folders[kind]=assets(src/kind,ext) + if kind=='chara' and not (src/kind/(kind+'.pak')).is_file(): + masks=assets(src/kind,config.get('charamaskformat',ext)) + folders[kind].update({k:v for k,v in masks.items() if k.lower().endswith('_mask')}) + # Opt-in 1.2 research: ingest only already-encoded FVDS files, without + # re-encoding or changing any game scripts, saves or the existing cache + # formats. The normal conversion still omits all videos. + video_entries=[] + if getattr(args,'video_fvds',False): + fv_candidates=[p for p in source_files + if len(p.relative_to(src).parts)==2 + and p.parent.name.casefold() in ('video','movie') + and p.suffix.casefold()=='.fv'] + seen_video={} + for asset in fv_candidates: + name=asset.stem + hashed=key(name) + if hashed in seen_video: + raise ValueError(f'Ambiguous FVDS movie identity: {seen_video[hashed]} vs {asset}') + seen_video[hashed]=asset + report=inspect_fvds(asset,hash_file=True) + if (report['width'],report['height'])!=(256,192) or report['frames']>18000: + raise ValueError(f'FVDS unsupported display geometry/duration: {asset}') + if report['audio_sample_rate']!=47605 or report['audio_channels']!=2: + raise ValueError(f'FVDS audio format not supported for probe: {asset}') + output=cache/'video'/hashed[:2]/(hashed+'.fv') + output.parent.mkdir(parents=True,exist_ok=True) + shutil.copy2(asset,output) + if sha(output)!=report['sha256']: + raise ValueError(f'FVDS copy checksum mismatch: {asset}') + video_entries.append({'name':name,'path':output.relative_to(stage).as_posix(), + 'bytes':report['size_bytes'],'frames':report['frames'], + 'keyframes':report['keyframe_count'],'duration_seconds':report['duration_seconds'], + 'source_sha256':report['sha256'],'status':'preflight only; not yet playable'}) + retained={p.relative_to(src).as_posix() for p in fv_candidates} + omitted=[item for item in omitted if item['path'] not in retained] + + # 1.2 public playback path: independently encoded NVL1/NVA1 from + # FFmpeg-decoded source movie; original game assets/scripts are untouched. + video_mode=getattr(args,'video_mode','skip') + if video_mode not in ('skip','nvl1','nva1'): + raise ValueError('Unknown NDS video conversion mode') + if video_mode!='skip' and getattr(args,'video_fvds',False): + raise ValueError('Choose playable NVL1/NVA1 or research FVDS preflight, not both') + playable_videos=[] + if video_mode!='skip': + names={} + for src_video in source_files: + rel=src_video.relative_to(src) + if (len(rel.parts)!=2 or + rel.parts[0].casefold() not in ('movie','video','movies','videos') or + rel.suffix.casefold() not in video_nvl.VIDEO_SUFFIXES): + continue + name=src_video.stem + hashed=key(name) + if hashed in names: + raise ValueError(f'Ambiguous video name: {names[hashed]} vs {src_video}') + names[hashed]=str(src_video) + output=cache/'video'/hashed[:2]/(hashed+'.nvl') + print(f'Converting movie {name}: {video_mode}',flush=True) + meta=video_nvl.encode(src_video,output,ffmpeg, + fps=getattr(args,'video_fps',12), + audio='nar' if video_mode=='nva1' else 'pcm') + playable_videos.append({'name':name,'path':output.relative_to(stage).as_posix(), + 'source_sha256':sha(src_video),**meta}) + for item in omitted: + if item['path']==rel.as_posix(): + item['reason']='source video replaced with playable '+meta['format']+' cache' + # Some legacy packers included Windows Thumbs.db in image packages. + # Recognize both its name and OLE signature; never hide corrupt game images. + ignored=[] + for kind in ('bg','chara','system'): + for name,asset in list(folders[kind].items()): + if name.casefold() in ('thumbs','thumbs.db') and asset.read().startswith(b'\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1'): + ignored.append({'kind':kind,'name':name,'reason':'Windows thumbnail database, preserved in original package'}) + del folders[kind][name] + images=[];audio=[];masks=[];seen={} + def target(kind,name,suffix): + hashed=key(name);identity=(kind,hashed) + if identity in seen and seen[identity]!=name: raise ValueError('Hash collision; rename the conflicting source asset') + seen[identity]=name + return cache/kind/(hashed+suffix) + for kind in ('bg','chara','system'): + entries=folders[kind] + # Legacy Symbian packers may uppercase names, including the mask suffix. + # The runtime asset/cache identity is already ASCII case-insensitive. + by_lower={name.lower():asset for name,asset in entries.items()} + for name,asset in entries.items(): + if kind!='bg' and name.lower().endswith('_mask') and name[:-5].lower() in by_lower: continue + variants=('system0','system1') if kind=='system' else (kind,) + for variant in variants: + mask=by_lower.get((name+'_mask').lower()) if variant in ('chara','system1') and config.get('platform','').lower() in ('s60v3','s60v5','symbian') else None + meta=image_cache(asset,target(variant,name,'.npi'),scale,mask,kind=='bg') + images.append({'kind':variant,'name':name,**meta}) + for name,asset in folders['system'].items(): + meta=mask_cache(asset,target('mask',name,'.nmt'),min(256,max(1,round(width*scale))),min(192,max(1,round(height*scale)))) + masks.append({'name':name,**meta}) + audio_jobs=[] + audio_mode=getattr(args,'audio_lossless','off') + if audio_mode not in ('off','voice','all'):raise ValueError('Unknown lossless audio mode') + for kind in ('bgm','se','voice'): + for name,asset in folders[kind].items(): audio_jobs.append((kind,name,asset,target(kind,name,'.pcm'))) + def audio_job(job): + kind,name,asset,out=job;out.parent.mkdir(parents=True,exist_ok=True) + data=asset.read();temp=out.with_suffix('.input');temp.write_bytes(data) + input_flags=['-f','s16le','-ar','22050','-ac','1'] if asset.path.suffix.lower()=='.pcm' else [] + try: + subprocess.run([ffmpeg,'-nostdin','-hide_banner','-loglevel','error','-threads','1','-y',*input_flags,'-i',str(temp),'-vn','-ac','1','-ar','22050','-f','s16le',str(out)],check=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE,creationflags=0x08000000 if os.name=='nt' else 0) + finally: temp.unlink(missing_ok=True) + meta={'kind':kind,'name':name,'source_sha256':hashlib.sha256(data).hexdigest(),'bytes':out.stat().st_size,'encoding':'PCM16','pcm_bytes':out.stat().st_size,'decoded_pcm_sha256':sha(out)} + if audio_mode=='all' or (audio_mode=='voice' and kind=='voice'): + compressed=out.with_suffix('.nar');result=lossless.encode_audio(out,compressed) + meta.update(pcm_bytes=result['pcm_bytes'],decoded_pcm_sha256=result['pcm_sha256']) + if result['nar_bytes']<=result['pcm_bytes']*.9: + out.unlink();meta.update(bytes=result['nar_bytes'],encoding='NAR2') + else:compressed.unlink() + return meta + with concurrent.futures.ThreadPoolExecutor(max_workers=args.jobs) as pool: + for result in pool.map(audio_job,audio_jobs): audio.append(result) + from audio_aliases import deduplicate_audio + audio_dedup=deduplicate_audio(cache,audio,key) if audio_mode!='off' else {'aliases':0,'saved_bytes':0,'index_bytes':0} + # This converter produces PCM on all channels. Experimental engines can + # avoid repeated missing-NAR probes; 1.0.0 safely ignores this optional index. + (cache/'audio-formats.bin').write_bytes(b'NAF1'+bytes([7 if audio_mode=='all' else 4 if audio_mode=='voice' else 0])) + scripts=sorted((src/'script').glob('*.txt')) + text=''.join(p.read_text(encoding='utf-8-sig') for p in scripts)+(src/'gameconfig.txt').read_text(encoding='utf-8-sig') + glyphs=font_cache(text,font,cache/'font.bin') + pixel_fonts=pixel_font_cache([cp for cp in (set(map(ord,text))|set(range(32,127))|set(UI_CODEPOINTS)) if cp>=32 and cp not in (0xfeff,0xfffe,0xffff)],cache,args.missing_glyph_policy) + findings=audit(scripts,folders,{v['name'].casefold() for v in playable_videos}) + allowed=sorted({(x['folder'],key(x['name'])) for x in findings['missing_resource_references'] if x['folder'] in ('bgm','se','voice')}) + (cache/'missing-audio.txt').write_bytes(''.join(f'{kind} {hashed}\n' for kind,hashed in allowed).encode('ascii')) + compressed_images=[] + if getattr(args,'compress_images',False): + for path in sorted(cache.rglob('*.npi')): + raw=path.read_bytes();packed=lossless.image_candidate(raw,compress_spans=getattr(args,'experimental_sparse',False)) + if packed!=raw: + path.write_bytes(packed);compressed_images.append({'path':path.relative_to(stage).as_posix(),'raw_bytes':len(raw),'bytes':len(packed),'decoded_sha256':hashlib.sha256(raw).hexdigest()}) + layout=getattr(args,'cache_layout','sharded') + if layout not in ('flat','sharded'):raise ValueError('Unknown cache layout') + layout_files=0 + if layout=='sharded': + moved={} + for folder in sorted(cache.iterdir()): + if not folder.is_dir():continue + for path in sorted(folder.iterdir()): + if not path.is_file() or not re.fullmatch('[0-9a-f]{16}',path.stem):continue + dest=folder/path.stem[:2]/path.name;dest.parent.mkdir(exist_ok=True) + old=path.relative_to(stage).as_posix();path.rename(dest);moved[old]=dest.relative_to(stage).as_posix();layout_files+=1 + for entry in compressed_images:entry['path']=moved.get(entry['path'],entry['path']) + cache_files=[{'path':p.relative_to(stage).as_posix(),'sha256':sha(p)} for p in sorted(cache.rglob('*')) if p.is_file()] + manifest={'format':1,'converter_version':VERSION,'logical_screen':[width,height],'display_scale':scale,'original_files':originals,'cache_files':cache_files,'images':images,'audio':sorted(audio,key=lambda x:(x['kind'],x['name'])),'font_glyphs':glyphs,'font_sha256':sha(font),'audio_format':'22050 Hz mono signed 16-bit little endian PCM','tools':{'python':sys.version.split()[0],'pillow':pillow_version,'ffmpeg':ffversion},'audit':findings,'save_policy':'new empty save directory; existing saves not imported'} + if audio_mode!='off' or getattr(args,'compress_images',False): + manifest['format']=5;(cache/'format.txt').write_bytes(b'CPYMO-NDS-CACHE-5\n') + manifest['minimum_engine']='r13 research / future 1.1; not 1.0.0 or r9-r12' + for entry in cache_files: + if entry['path']=='nds-cache/format.txt':entry['sha256']=sha(cache/'format.txt') + if layout=='sharded': + manifest['format']=6;(cache/'format.txt').write_bytes(b'CPYMO-NDS-CACHE-6\n') + manifest['minimum_engine']='r15 research / future 1.1; not 1.0.0 or r9-r14' + for entry in cache_files: + if entry['path']=='nds-cache/format.txt':entry['sha256']=sha(cache/'format.txt') + manifest['cache_layout']={'name':layout,'prefix_hex_digits':2 if layout=='sharded' else 0,'files':layout_files,'resource_bytes_changed':False} + manifest['omitted_files']=omitted + manifest['lossless']={'audio_mode':audio_mode,'audio_dedup':audio_dedup,'audio_saved_bytes':sum(x.get('pcm_bytes',x['bytes'])-x['bytes'] for x in audio),'image_saved_bytes':sum(x['raw_bytes']-x['bytes'] for x in compressed_images),'images':compressed_images,'image_threshold':{'NPA4':0.2,'NPS1':0.9},'audio_threshold':0.9,'quality':'exact relative to existing NDS RGB555/PCM16 cache; no extra downsampling or quantization'} + manifest['lossless']['experimental_sparse']=getattr(args,'experimental_sparse',False) + if audio_mode!='off':manifest['audio_format']='PCM16/NAR2 per file; identical 22050 Hz mono PCM16 samples' + manifest['source_files']=source_hashes + manifest['video_policy']=('playable NVL1/NVA1 converted from source videos; unconverted movie references still skipped' + if video_mode!='skip' + else 'opt-in FVDS cache pass-through; 1.2 runtime preflight only; video decoding not implemented' + if getattr(args,'video_fvds',False) + else 'omit video assets; keep scripts; runtime safely skips movie commands') + manifest['videos']=playable_videos + manifest['fvds_videos']=video_entries + manifest['resource_policy']='cache-only experimental' if cache_only else 'original media retained' + manifest['presentation']=presentation + manifest['source_platform']=config.get('platform','pygame') + manifest['pixel_fonts']=pixel_fonts + manifest['mask_transitions']=masks + manifest['ignored_non_game_entries']=ignored + (cache/'manifest.json').write_text(json.dumps(manifest,ensure_ascii=False,indent=2),encoding='utf-8') + for item in source_hashes: + if sha(src/item['path'])!=item['sha256']: raise ValueError('Source changed during conversion') + verify(stage) + if dst.exists(): raise ValueError('Destination appeared during conversion; partial output preserved') + stage.rename(dst) + print(f'COMPLETE: {dst}\n{len(images)} image variants, {len(audio)} audio files, {glyphs} glyphs; source and scripts unchanged',flush=True) + print(f'Audit: {len(findings["missing_resource_references"])} missing references, {len(findings["unknown_commands"])} unknown directives, {len(findings["unsupported_video_commands"])} skipped video commands; see nds-cache/manifest.json') + +def main(): + parser=argparse.ArgumentParser(description=__doc__) + sub=parser.add_subparsers(dest='command',required=True) + c=sub.add_parser('convert');c.add_argument('source',type=Path);c.add_argument('destination',type=Path);c.add_argument('--ffmpeg',default='ffmpeg');c.add_argument('--font');c.add_argument('--jobs',type=int,choices=range(1,9),default=4);c.add_argument('--cache-only',action='store_true',help='Omit redundant source media, retain scripts/config/credits and verify caches');c.add_argument('--missing-glyph-policy',choices=('error','box'),default='box',help='Default box fallback with warning for missing pixel-font characters; original scripts unchanged') + c.add_argument('--audio-lossless',choices=('off','voice','all'),default='off');c.add_argument('--compress-images',action='store_true',help='Lossless NPA4 or row-span NPS1 selected per image; keep raw when not worthwhile') + c.add_argument('--cache-layout',choices=('flat','sharded'),default='sharded',help='Two-hex directory fanout avoids large flat FAT directories; requires r15 engine') + c.add_argument('--experimental-sparse',action='store_true',help='Private NPS2: smaller transparent images; may increase scene-change stalls') + c.add_argument('--video-fvds',action='store_true',help='Research-only: validate and copy pre-encoded video/*.fv into hashed NDS cache; NOT playback') + c.add_argument('--video-mode',choices=('skip','nvl1','nva1'),default='nvl1',help='Source video conversion: default NVL1 PCM, optionally NVA1 NAR2 or skip (legacy)') + c.add_argument('--video-fps',type=int,choices=(6,8,12,15,20,24),default=12,help='Output video FPS, default 12 for NDS') + v=sub.add_parser('verify');v.add_argument('destination',type=Path) + i=sub.add_parser('inspect');i.add_argument('source',type=Path) + args=parser.parse_args() + try: + if args.command=='convert': convert(args) + elif args.command=='inspect': print(json.dumps(inspect_source(args.source.resolve()),ensure_ascii=False,indent=2)) + else: verify(args.destination.resolve()) + except (ValueError,OSError,subprocess.SubprocessError,UnicodeError,KeyError) as error: + if isinstance(error,subprocess.CalledProcessError) and error.stderr: print(error.stderr.decode('utf-8',errors='replace') if isinstance(error.stderr,bytes) else error.stderr,file=sys.stderr) + print(f'ERROR: {error}\nNo source files were modified; an owned .partial directory may remain for diagnosis.',file=sys.stderr) + return 1 + return 0 + +if __name__=='__main__': raise SystemExit(main()) diff --git a/cpymo-tool/nds-converter/fonts/NOTICE.txt b/cpymo-tool/nds-converter/fonts/NOTICE.txt new file mode 100644 index 00000000..febf09a2 --- /dev/null +++ b/cpymo-tool/nds-converter/fonts/NOTICE.txt @@ -0,0 +1,6 @@ +CPyMO DS Glyphs +Raster subset derived from Noto Sans CJK SC; SIL OFL 1.1. +Source: https://github.com/notofonts/noto-cjk/tree/main/Sans/OTF/SimplifiedChinese + +Version 2.004;hotconv 1.0.118;makeotfexe 2.5.65603 +© 2014-2021 Adobe (http://www.adobe.com/). diff --git a/cpymo-tool/nds-converter/fonts/NotoSansCJKsc-Regular.otf b/cpymo-tool/nds-converter/fonts/NotoSansCJKsc-Regular.otf new file mode 100644 index 00000000..dc155624 Binary files /dev/null and b/cpymo-tool/nds-converter/fonts/NotoSansCJKsc-Regular.otf differ diff --git a/cpymo-tool/nds-converter/fonts/OFL.txt b/cpymo-tool/nds-converter/fonts/OFL.txt new file mode 100644 index 00000000..d952d62c --- /dev/null +++ b/cpymo-tool/nds-converter/fonts/OFL.txt @@ -0,0 +1,92 @@ +This Font Software is licensed under the SIL Open Font License, +Version 1.1. + +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font +creation efforts of academic and linguistic communities, and to +provide a free and open framework in which fonts may be shared and +improved in partnership with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply to +any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software +components as distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, +deleting, or substituting -- in part or in whole -- any of the +components of the Original Version, by changing formats or by porting +the Font Software to a new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, +modify, redistribute, and sell modified and unmodified copies of the +Font Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, in +Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the +corresponding Copyright Holder. This restriction only applies to the +primary font name as presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created using +the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/cpymo-tool/nds-converter/fonts/pixel/Fusion/LICENSES/ark-pixel/OFL.txt b/cpymo-tool/nds-converter/fonts/pixel/Fusion/LICENSES/ark-pixel/OFL.txt new file mode 100644 index 00000000..264873a2 --- /dev/null +++ b/cpymo-tool/nds-converter/fonts/pixel/Fusion/LICENSES/ark-pixel/OFL.txt @@ -0,0 +1,96 @@ +Ark Pixel Font +https://github.com/TakWolf/ark-pixel-font + +Copyright (c) 2021, TakWolf (https://takwolf.com). + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/cpymo-tool/nds-converter/fonts/pixel/Fusion/LICENSES/cubic-11/OFL.txt b/cpymo-tool/nds-converter/fonts/pixel/Fusion/LICENSES/cubic-11/OFL.txt new file mode 100644 index 00000000..4e863313 --- /dev/null +++ b/cpymo-tool/nds-converter/fonts/pixel/Fusion/LICENSES/cubic-11/OFL.txt @@ -0,0 +1,108 @@ +[Cubic 11] +These fonts are free software. +Unlimited permission is granted to use, copy, and distribute them, with or without modification, either commercially or noncommercially. +THESE FONTS ARE PROVIDED "AS IS" WITHOUT WARRANTY. +此字型是免費的。 +無論您是否進行對本字型進行商業或非商業性修改,均可無限制地使用,複製和分發它們。 +本字型的衍生品之授權必須與此字型相同,且不作任何擔保。 +[JF Dot M+H 12] +Copyright(c) 2005 M+ FONTS PROJECT +[M+ BITMAP FONTS] +Copyright (C) 2002-2004 COZ +These fonts are free software. +Unlimited permission is granted to use, copy, and distribute it, with or without modification, either commercially and noncommercially. +THESE FONTS ARE PROVIDED "AS IS" WITHOUT WARRANTY. +これらのフォントはフリー(自由な)ソフトウエアです。 +あらゆる改変の有無に関わらず、また商業的な利用であっても、自由にご利用、複製、再配布することができますが、全て無保証とさせていただきます。 + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/cpymo-tool/nds-converter/fonts/pixel/Fusion/LICENSES/galmuri/LICENSE.txt b/cpymo-tool/nds-converter/fonts/pixel/Fusion/LICENSES/galmuri/LICENSE.txt new file mode 100644 index 00000000..ae34182f --- /dev/null +++ b/cpymo-tool/nds-converter/fonts/pixel/Fusion/LICENSES/galmuri/LICENSE.txt @@ -0,0 +1,93 @@ +Copyright (c) 2019–2025 Lee Minseo (quiple@quiple.dev) + +This font software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/cpymo-tool/nds-converter/fonts/pixel/Fusion/OFL.txt b/cpymo-tool/nds-converter/fonts/pixel/Fusion/OFL.txt new file mode 100644 index 00000000..0427d1db --- /dev/null +++ b/cpymo-tool/nds-converter/fonts/pixel/Fusion/OFL.txt @@ -0,0 +1,96 @@ +Fusion Pixel Font +https://github.com/TakWolf/fusion-pixel-font + +Copyright (c) 2022, TakWolf (https://takwolf.com). + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/cpymo-tool/nds-converter/fonts/pixel/Fusion/fusion-pixel-12px-proportional-zh_hans.bdf.gz b/cpymo-tool/nds-converter/fonts/pixel/Fusion/fusion-pixel-12px-proportional-zh_hans.bdf.gz new file mode 100644 index 00000000..56e4752d Binary files /dev/null and b/cpymo-tool/nds-converter/fonts/pixel/Fusion/fusion-pixel-12px-proportional-zh_hans.bdf.gz differ diff --git a/cpymo-tool/nds-converter/fonts/pixel/Unifont/COPYING b/cpymo-tool/nds-converter/fonts/pixel/Unifont/COPYING new file mode 100644 index 00000000..d9c5a106 --- /dev/null +++ b/cpymo-tool/nds-converter/fonts/pixel/Unifont/COPYING @@ -0,0 +1,953 @@ + +License for all non-font source code in this package: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, see . + + + +License for font/plane00/jiskan16-plane00.hex and +font/plane02/jiskan16-plane02.hex: + + These two files are in the Public Domain. They were created + from Public Domain BDF font files jiskan16-2004-1.bdf and + jiskan16-2000-2.bdf. + + +License for font files except the jiskan16 files mentioned above +are dual-licensed under the SIL Open Font License version 1.1, +and under this GNU license: + + All glyphs are released under the GNU General Public License + (GPL) version 2 or (at your option) a later version, with the + GNU font embedding exception: + + ** GPL v2.0 license with font embedding exception: + + As a special exception, if you create a document which + uses this font, and embed this font or unaltered portions + of this font into the document, this font does not by + itself cause the resulting document to be covered by + the GNU General Public License. This exception does not + however invalidate any other reasons why the document + might be covered by the GNU General Public License. + If you modify this font, you may extend this exception + to your version of the font, but you are not obligated + to do so. If you do not wish to do so, delete this + exception statement from your version. + +The SIL Open Font License is in the separate file "OFL-1.1.txt" +in the Unifont distribution, and is also available with a FAQ at +http://scripts.sil.org/OFL. The license is copied below: + + ----------------------------------------------------------- + SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 + ----------------------------------------------------------- + + PREAMBLE + The goals of the Open Font License (OFL) are to stimulate worldwide + development of collaborative font projects, to support the font creation + efforts of academic and linguistic communities, and to provide a free and + open framework in which fonts may be shared and improved in partnership + with others. + + The OFL allows the licensed fonts to be used, studied, modified and + redistributed freely as long as they are not sold by themselves. The + fonts, including any derivative works, can be bundled, embedded, + redistributed and/or sold with any software provided that any reserved + names are not used by derivative works. The fonts and derivatives, + however, cannot be released under any other type of license. The + requirement for fonts to remain under this license does not apply + to any document created using the fonts or their derivatives. + + DEFINITIONS + "Font Software" refers to the set of files released by the Copyright + Holder(s) under this license and clearly marked as such. This may + include source files, build scripts and documentation. + + "Reserved Font Name" refers to any names specified as such after the + copyright statement(s). + + "Original Version" refers to the collection of Font Software components as + distributed by the Copyright Holder(s). + + "Modified Version" refers to any derivative made by adding to, deleting, + or substituting -- in part or in whole -- any of the components of the + Original Version, by changing formats or by porting the Font Software to a + new environment. + + "Author" refers to any designer, engineer, programmer, technical + writer or other person who contributed to the Font Software. + + PERMISSION & CONDITIONS + Permission is hereby granted, free of charge, to any person obtaining + a copy of the Font Software, to use, study, copy, merge, embed, modify, + redistribute, and sell modified and unmodified copies of the Font + Software, subject to the following conditions: + + 1) Neither the Font Software nor any of its individual components, + in Original or Modified Versions, may be sold by itself. + + 2) Original or Modified Versions of the Font Software may be bundled, + redistributed and/or sold with any software, provided that each copy + contains the above copyright notice and this license. These can be + included either as stand-alone text files, human-readable headers or + in the appropriate machine-readable metadata fields within text or + binary files as long as those fields can be easily viewed by the user. + + 3) No Modified Version of the Font Software may use the Reserved Font + Name(s) unless explicit written permission is granted by the corresponding + Copyright Holder. This restriction only applies to the primary font name as + presented to the users. + + 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font + Software shall not be used to promote, endorse or advertise any + Modified Version, except to acknowledge the contribution(s) of the + Copyright Holder(s) and the Author(s) or with their explicit written + permission. + + 5) The Font Software, modified or unmodified, in part or in whole, + must be distributed entirely under this license, and must not be + distributed under any other license. The requirement for fonts to + remain under this license does not apply to any document created + using the Font Software. + + TERMINATION + This license becomes null and void if any of the above conditions are + not met. + + DISCLAIMER + THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT + OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE + COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL + DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM + OTHER DEALINGS IN THE FONT SOFTWARE. + + +============================================================================== + +License for doc/unifont.*: + + The files doc/unifont.* are released under the following terms: + + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.3 or + any later version published by the Free Software Foundation; with no + Invariant Sections, with no Front-Cover Texts and no Back-Cover Texts. + + +GPL version 2 and GFDL version 1.3 are included below. + + +============================================================================== + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see + . + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + +============================================================================== + + + GNU Free Documentation License + Version 1.3, 3 November 2008 + + + Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +0. PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +functional and useful document "free" in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. + +This License is a kind of "copyleft", which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + + +1. APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The "Document", below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as "you". You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. + +A "Modified Version" of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A "Secondary Section" is a named appendix or a front-matter section of +the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall +subject (or to related matters) and contains nothing that could fall +directly within that overall subject. (Thus, if the Document is in +part a textbook of mathematics, a Secondary Section may not explain +any mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The "Invariant Sections" are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. + +The "Cover Texts" are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. + +A "Transparent" copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not "Transparent" is called "Opaque". + +Examples of suitable formats for Transparent copies include plain +ASCII without markup, Texinfo input format, LaTeX input format, SGML +or XML using a publicly available DTD, and standard-conforming simple +HTML, PostScript or PDF designed for human modification. Examples of +transparent image formats include PNG, XCF and JPG. Opaque formats +include proprietary formats that can be read and edited only by +proprietary word processors, SGML or XML for which the DTD and/or +processing tools are not generally available, and the +machine-generated HTML, PostScript or PDF produced by some word +processors for output purposes only. + +The "Title Page" means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, "Title Page" means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. + +The "publisher" means any person or entity that distributes copies of +the Document to the public. + +A section "Entitled XYZ" means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as "Acknowledgements", +"Dedications", "Endorsements", or "History".) To "Preserve the Title" +of such a section when you modify the Document means that it remains a +section "Entitled XYZ" according to this definition. + +The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. + +2. VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no +other conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. + + +3. COPYING IN QUANTITY + +If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document's license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to +give them a chance to provide you with an updated version of the +Document. + + +4. MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +A. Use in the Title Page (and on the covers, if any) a title distinct + from that of the Document, and from those of previous versions + (which should, if there were any, be listed in the History section + of the Document). You may use the same title as a previous version + if the original publisher of that version gives permission. +B. List on the Title Page, as authors, one or more persons or entities + responsible for authorship of the modifications in the Modified + Version, together with at least five of the principal authors of the + Document (all of its principal authors, if it has fewer than five), + unless they release you from this requirement. +C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. +D. Preserve all the copyright notices of the Document. +E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. +F. Include, immediately after the copyright notices, a license notice + giving the public permission to use the Modified Version under the + terms of this License, in the form shown in the Addendum below. +G. Preserve in that license notice the full lists of Invariant Sections + and required Cover Texts given in the Document's license notice. +H. Include an unaltered copy of this License. +I. Preserve the section Entitled "History", Preserve its Title, and add + to it an item stating at least the title, year, new authors, and + publisher of the Modified Version as given on the Title Page. If + there is no section Entitled "History" in the Document, create one + stating the title, year, authors, and publisher of the Document as + given on its Title Page, then add an item describing the Modified + Version as stated in the previous sentence. +J. Preserve the network location, if any, given in the Document for + public access to a Transparent copy of the Document, and likewise + the network locations given in the Document for previous versions + it was based on. These may be placed in the "History" section. + You may omit a network location for a work that was published at + least four years before the Document itself, or if the original + publisher of the version it refers to gives permission. +K. For any section Entitled "Acknowledgements" or "Dedications", + Preserve the Title of the section, and preserve in the section all + the substance and tone of each of the contributor acknowledgements + and/or dedications given therein. +L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section titles. +M. Delete any section Entitled "Endorsements". Such a section + may not be included in the Modified Version. +N. Do not retitle any existing section to be Entitled "Endorsements" + or to conflict in title with any Invariant Section. +O. Preserve any Warranty Disclaimers. + +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section Entitled "Endorsements", provided it contains +nothing but endorsements of your Modified Version by various +parties--for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. + + +5. COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections Entitled "History" +in the various original documents, forming one section Entitled +"History"; likewise combine any sections Entitled "Acknowledgements", +and any sections Entitled "Dedications". You must delete all sections +Entitled "Endorsements". + + +6. COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other +documents released under this License, and replace the individual +copies of this License in the various documents with a single copy +that is included in the collection, provided that you follow the rules +of this License for verbatim copying of each of the documents in all +other respects. + +You may extract a single document from such a collection, and +distribute it individually under this License, provided you insert a +copy of this License into the extracted document, and follow this +License in all other respects regarding verbatim copying of that +document. + + +7. AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an "aggregate" if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation's users beyond what the individual works permit. +When the Document is included in an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document's Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. + + +8. TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. + +If a section in the Document is Entitled "Acknowledgements", +"Dedications", or "History", the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. + + +9. TERMINATION + +You may not copy, modify, sublicense, or distribute the Document +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense, or distribute it is void, and +will automatically terminate your rights under this License. + +However, if you cease all violation of this License, then your license +from a particular copyright holder is reinstated (a) provisionally, +unless and until the copyright holder explicitly and finally +terminates your license, and (b) permanently, if the copyright holder +fails to notify you of the violation by some reasonable means prior to +60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, receipt of a copy of some or all of the same material does +not give you any rights to use it. + + +10. FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions of the +GNU Free Documentation License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in +detail to address new problems or concerns. See +http://www.gnu.org/copyleft/. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License "or any later version" applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. If the Document +specifies that a proxy can decide which future versions of this +License can be used, that proxy's public statement of acceptance of a +version permanently authorizes you to choose that version for the +Document. + +11. RELICENSING + +"Massive Multiauthor Collaboration Site" (or "MMC Site") means any +World Wide Web server that publishes copyrightable works and also +provides prominent facilities for anybody to edit those works. A +public wiki that anybody can edit is an example of such a server. A +"Massive Multiauthor Collaboration" (or "MMC") contained in the site +means any set of copyrightable works thus published on the MMC site. + +"CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 +license published by Creative Commons Corporation, a not-for-profit +corporation with a principal place of business in San Francisco, +California, as well as future copyleft versions of that license +published by that same organization. + +"Incorporate" means to publish or republish a Document, in whole or in +part, as part of another Document. + +An MMC is "eligible for relicensing" if it is licensed under this +License, and if all works that were first published under this License +somewhere other than this MMC, and subsequently incorporated in whole or +in part into the MMC, (1) had no cover texts or invariant sections, and +(2) were thus incorporated prior to November 1, 2008. + +The operator of an MMC Site may republish an MMC contained in the site +under CC-BY-SA on the same site at any time before August 1, 2009, +provided the MMC is eligible for relicensing. + + +ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + + Copyright (c) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.3 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. + A copy of the license is included in the section entitled "GNU + Free Documentation License". + +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the "with...Texts." line with this: + + with the Invariant Sections being LIST THEIR TITLES, with the + Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. + +If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. + +============================================================================== + diff --git a/cpymo-tool/nds-converter/fonts/pixel/Unifont/LICENSE.txt b/cpymo-tool/nds-converter/fonts/pixel/Unifont/LICENSE.txt new file mode 100644 index 00000000..60be3b66 --- /dev/null +++ b/cpymo-tool/nds-converter/fonts/pixel/Unifont/LICENSE.txt @@ -0,0 +1,476 @@ +LICENSE +------- +The source code for everything except the compiled fonts in this current +release is licensed as follows: + + License for this current distribution of program source + files (i.e., everything except the fonts) is released under + the terms of the GNU General Public License version 2, + or (at your option) a later version. + + See the section below for a copy of the GNU General Public License + version 2. + +The license for the compiled fonts is covered by the SIL Open Font License +version 1.1 and by the above GPL terms with the GNU font embedding exception, +as follows: + + As a special exception, if you create a document which uses this font, + and embed this font or unaltered portions of this font into the document, + this font does not by itself cause the resulting document to be covered + by the GNU General Public License. This exception does not however + invalidate any other reasons why the document might be covered by the + GNU General Public License. If you modify this font, you may extend + this exception to your version of the font, but you are not obligated + to do so. If you do not wish to do so, delete this exception statement + from your version. + +See "http://www.gnu.org/licenses/gpl-faq.html#FontException" and +"https://scripts.sil.org/OFL" for more details. + + +GPL VERSION 2 +------------- + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + + + +SIL Open Font License version 1.1 +--------------------------------- +Copyright (c) , (), +with Reserved Font Name . +Copyright (c) , (), +with Reserved Font Name . +Copyright (c) , (). + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + diff --git a/cpymo-tool/nds-converter/fonts/pixel/Unifont/OFL-1.1.txt b/cpymo-tool/nds-converter/fonts/pixel/Unifont/OFL-1.1.txt new file mode 100644 index 00000000..94339e0f --- /dev/null +++ b/cpymo-tool/nds-converter/fonts/pixel/Unifont/OFL-1.1.txt @@ -0,0 +1,90 @@ +The SIL Open Font License version 1.1 is copied below, and is also +available with a FAQ at http://scripts.sil.org/OFL. + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/cpymo-tool/nds-converter/fonts/pixel/Unifont/README b/cpymo-tool/nds-converter/fonts/pixel/Unifont/README new file mode 100644 index 00000000..3c0b0d85 --- /dev/null +++ b/cpymo-tool/nds-converter/fonts/pixel/Unifont/README @@ -0,0 +1,621 @@ + +OVERVIEW +-------- +GNU Unifont is an official GNU package. It is a dual-width +bitmap font, 16 pixels tall by 8 or 16 pixels wide. Experimental +use of 24 and 32 pixel wide glyphs is also supported by some +utility programs; consult the man pages and texinfo documentation. +Unifont is designed to provide coverage for all of Unicode Plane 0, +the Basic Multilingual Plane (BMP). + +GNU Unifont has a glyph for each visible code point in the +Unicode Basic Multilingual Plane (Plane 0) and some glyphs +in the Supplemental Multilingual Plane (Plane 1). This version +also includes many glyphs in Michael Everson's ConScript +Unicode Registry (CSUR). + +Unifont only provides a single glyph for each character, making it +impossible to handle any language properly that needs context-dependent +character shaping. It is supplied in the form of a hex file, with +a converter to convert it to BDF. See http://czyborra.com/unifont/ +or http://unifoundry.com/unifont.html for more information. The +BDF font is converted to PCF, and the hex file is converted to a +TrueType font. + +This is the unifoundry.com collection of utilities for GNU Unifont, +assembled by Paul Hardy with the encouragement of the font's creator, +Roman Czyborra. This archive contains the following directories +and files: + + ChangeLog Log of changes made to each GNU release + COPYING Full text of GPL version 2 + doc Documentation in Texinfo format + doxygen Documentation in doxygen format (html/index.html and + unifont-doxy.pdf) + font The font source file with scripts for building + hangul Standalone font sources to build hangul-syllables.hex + INSTALL Instructions for font and software installation + Makefile The "make" file + man Unix man pages + NEWS Summary of what's new with each GNU release + README This file + src Source programs, in Perl and C + +The "font/precompiled" directory contains prebuilt font-related files: + + coverage.txt Percentage coverage of Plane 0 scripts + + unifont-.hex Hex string source of glyphs to build + Unifont + unifont-.bdf.gz BDF version of Unifont + unifont-.pcf.gz PCF version of Unifont + unifont-.ttf TrueType version of Unifont + + unifont_jp-.* Version of Unifont with Japanese glyphs + mapped from Plane 1 and Plane 2 of the + JIS X 0213 standard to Unicode. The + TrueType version includes those Unicode + Plane 2 glyphs that appear in JIS X 0213. + + unifont_sample-.hex Hex string source of all Plane 0 glyphs + (except those for U+FFFE and U+FFFF), + including nonprinting and PUA glyphs, + with combining circles + unifont_sample-.bdf.gz BDF font version of the above .hex file + unifont_sample-.ttf SBIT font version of the above .hex file + + unifont_csur-.* Fonts containing Plane 0 Unifont glyphs + plus glyphs for Michael Everson's + ConScript Unicode Registry (CSUR) for + the Plane 0 Private Use Area + + unifont_upper-.* Fonts containing glyphs from Unicode + Plane 1 through Plane 14, inclusive + + unifont_upper_csur-.* Fonts containing glyphs from Unifont + Upper plus glyphs from Michael Everson's + ConScript Unicode Registry (CSUR) that + are in the Private Use Area in Plane 15 + + Unifont-APL8x16-.psf.gz Monospace console font for using APL + (GNU APL, etc.) in single-user mode. + + unifont-.bmp The entire Plane 0 Unifont font with + combining circles, built from the files + font/plane00/*.hex, showing combining + circles + +The directory that was originally named "font/hexsrc" has been renamed +to "font/plane00" now that Unifont supports glyphs beyond Plane 0. Higher +plane glyphs appear in "font/plane01" through "font/plane0F". Currently +there is no "font/plane10" directory (the highest Unicode plane is Plane 17, +or 0x10). + +This release incorporates all glyph errata issued by The Unicode Consortium +from Unicode 1.0 errata to the latest. + + +BUILDING +-------- +See the "INSTALL" file in this directory for building instructions. + + +PRIVATE USE AREA (PUA) +---------------------- +The "pua.hex" file contains a four-digit hexadecimal representation of +each code point, rendered as white on black. The new program "hexgen.c" +generated these glyphs. A four-digit hexadecimal code point is suggested +as one possible rendering of PUA glyphs in The Unicode Standard, Version +5.0, Section 5.3. Another possible rendering suggested in that same +section is a pencil glyph. A pencil glyph was used originally in Unifont +Version 5.1. + +The glyphs in "pua.hex" are not compiled into the final font. To do +so, modify font/Makefile by adding "pua.hex" to the list of hex source +files. Alternatively, someone could use their own pua.hex file for +various Private Use Area assignments. + +To use these glyphs in the PUA, use the command + + make BUILDFONT=1 PUA=plane00/pua.hex + +The glyphs in font/plane00/hangul/hangul-base.hex begin at 0xE000, +and so can also be used as PUA glyphs. To use these glyphs in the +PUA, use the command + + make BUILDFONT=1 PUA=plane00/hangul/hangul-base.hex + +The unifont_all-$(VERSION).hex will contain Unicode Plane 0 PUA +glyphs from Michael Everson's ConScript Unicode Registry (CSUR) +plus Rebecca Bettencourt's Under CSUR (UCSUR) additions. + + +src/ AUTHORS +------------ +Roman Czyborra wrote all the Perl files in the src directory except +"hex2sfd", "hexkinya", "unifontchojung", "unifontksx", "unihex2png", +and "unipng2hex". + +In the case of "johab2ucs2", Jungshik Shin wrote the orignial version; +he then gave it to Roman. Paul Hardy made further changes to "johab2ucs2". + +Roman originally named the "src/hexbraille" script as simply "braille". +Paul Hardy thought there was too great a chance of a name conflict with +other utilities, and so renamed it. + +Luis Alejandro Gonzalez Miranda wrote the original "hex2sfd" Perl +script, as well as a "howto-build.sh" shell script that Paul Hardy +converted into "./font/ttfsrc/Makefile". + +Paul Hardy wrote "unifontchojung" and "unifontksx" for extracting subsets +of Hangul glyphs, as an aid in creating a new Hangul Syllables block. + +Andrew Miller wrote "hexkinya". He also wrote "unihex2png" and "unipng2hex" +based upon Paul Hardy's "unihex2bmp" and "unibmp2hex" programs. Last but not +least, he wrote the "unifont-viewer" Perl script to graphically view a Unifont +hex file dynamically. + +David Corbett contributed the font/unipatch-hex.awk script, used +to replace glyphs in an existing Unifont .hex file with new glyphs. +This script is used to replace Chinese variation ideographs with +Japanese versions for the "unifont_jp*" font files. He also wrote +src/hexrotate to simplify rotating some glyphs such as Mongolian, +which can be written vertically or horizontally. + +Paul Hardy wrote all the C programs except for hex2otf.c, which +何志翔 (He Zhixiang) contributed. + + +Unifont AUTHORS +--------------- +Roman Czyborra created the original GNU Unifont, including the +.hex format. For greater detail, see the HISTORY section below. + +David Starner aggregated many glyphs contributed by others and +incorporated these into pre-2004 Unifont releases. + +Qianqian Fang began his Wen Quan Yi font in 2004, by which +time work on Unifont had stopped. Most of the almost 30,000 +CJK ideographs in Unifont versions 5.1 and later were taken +from Wen Quan Yi with permission of Qianqian Fang. The glyphs +in "./font/plane00/wqy-cjk.hex" are for the most part Qianqian +Fang's Unibit and Wen Quan Yi glyphs. + +Paul Hardy drew most of the newly-drawn glyphs added to the BMP +from the Unifont 5.1 release to the present release. This includes +the 11,172 glyphs in the Hangul Syllables block, plus approximately +10,000 additional glyphs scattered throughout the BMP. + +Andrew Miller drew the glyphs added to Unicode 6.3.0. + +For full details of software changes after Unicode 6.3.0, higher +Unicode planes, and the Private Use Area glyphs, etc., see the +ChangeLog file. + + +LICENSE +------- +The source code for everything except the compiled fonts in this current +release is licensed as follows: + + License for this current distribution of program source + files (i.e., everything except the fonts) is released under + the terms of the GNU General Public License version 2, + or (at your option) a later version. + +GPL version 2 is contained in the "COPYING" file in the main source +directory for this package. If your received this source without +a copy of GPL version 2, you can download a copy from GNU's website +at http://www.gnu.org/licenses/gpl-2.0.html. + +The license for the compiled fonts is covered by the above GPL terms +with the GNU font embedding exception, as follows: + + As a special exception, if you create a document which uses this font, + and embed this font or unaltered portions of this font into the document, + this font does not by itself cause the resulting document to be covered + by the GNU General Public License. This exception does not however + invalidate any other reasons why the document might be covered by the + GNU General Public License. If you modify this font, you may extend + this exception to your version of the font, but you are not obligated + to do so. If you do not wish to do so, delete this exception statement + from your version. + +See "http://www.gnu.org/licenses/gpl-faq.html#FontException" for more details. + + +CHANGES IN VERSION 6.3 +---------------------- +Version 6.3 reflects all glyph changes and errata published in Unicode +6.3.0. In preparation for releasing this version, Paul Hardy obtained +a hard copy of the errata published in Unicode Version 1.1, not yet +available on Unicode's website. All previously published errata have +been incorporated. This is a complete replacement for all previous +releases. + +The following code points in previously published errata were examined +and found to be correct: + + Unicode 1.1: U+717F, U+773E, U+809C, U+8480, U+908E + +Andrew Miller drew the 5 new additions to the Unicode 6.3.0 Basic +Multilingual Plane in the initial Unifont 6.3 release. + +The latest Unifont 6.3 release includes these glyph changes by Paul Hardy: + + - Armenian -- several glyphs were redrawn based upon feedback from + native speakers (U+0530..U+058F). + + - CJK Radicals Supplement -- several glyphs were redrawn to better match + their representations in The Unicode Standard code charts: + U+2E9F, U+2EA9, U+2EAC, U+2EAE, U+2EC0, U+2EDE, U+2EE7, and U+2EED. + + - Capricorn sign (U+2651) -- this was redrawn to an alternate form that + better fit in an 8 by 16 pixel grid. + + - Dashes -- changed to distguish better between different dash types + (a two horizontal pixel difference is the minimum to easily distinguish + a difference between two glyphs): + * Hyphen (U+002D) and Soft Hyphen (U+00AD) are now 4 pixels wide + * En Dash (U+2012) is now 6 pixels wide + * Em Dash (U+2013) is now 8 pixels wide + + - Control Pictures: + * Centered text for C1 Controls U+0089 ("HTJ"), U+0095 ("MW"), + and U+009E ("PM") + * Copied glyphs from U+0000..U+001F to U+2400..u+241F and erased + surrounding borders; earlier, some glyphs in U+0000..U+001F had + their text re-centered so this carries that change forward + + - Arrows -- General Re-alignment + * Aligned most single vertical arrow strokes with the 5th column, + counting from the left, to align with the center of the "w" glyph + (U+0077) + * Aligned most single horizontal arrow strokes with the 7th row, + counting from the bottom, to align with the horizontal stroke in + the "e" glyph (U+0065); this follows the convention of Donald Knuth's + fonts in TeX, as illustrated in The TeXbook + * Modified the following ranges per the above two re-alignments: + o U+2190..U+21FF Arrows + o U+27F0..U+27FF Supplemental Arrows -- A + o U+2900..U+297F Supplemental Arrows -- B + o U+2B00..U+2BFF Miscellaneous Symbols and Arrows + + - Modified the following additional Miscellaneous Technical glyphs + * Scan lines for old 9-line character terminals: + o U+23BA Line 1, horizontal line across row 1 (counting from the top) + o U+23BB Line 3, horizontal line across row 5 (counting from the top) + o U+23BC Line 7, horizontal line across row 12 (counting from the top) + o U+23BD Line 9, horizontal line across row 16 (counting from the top) + * U+23CE Return Symbol: shortened to match Latin capital height + * U+23AF Horizontal Line Extension: aligned on 7th row, counting + from the bottom + * U+23D0 Vertical Line Extension: aligned on 5th column, counting + from the left + * U+23DA Ground Symbol: aligned with Vertical Line Extension (U+23D0) + * U+23DB Fuse Symbol: algined with Horizontal Line Extension (U+23AF) + * U+23EC Black Down-pointing Double Triangle: moved down one row to + match Latin capital height + + - Swapped U+FE17 and U+FE18, which had been reversed + + - hangul/ directory -- updated "hangul-generation.html" to match the + latest version at http://unifoundry.com/hangul/hangul-generation.html + +Five new utility programs have also been added: + + - unifontpic - creates a bitmapped graphics (.bmp) file of the entire + Basic Multilingual Plane (Plane 0), by default in a 256-by-256 + glyph grid for ease of printing, and optionally in a 16-by-4096 glyph + grid for easier scrolling on a screen, for software that can handle + a .bmp file with over 64k pixel rows (not all software can). The + 256-by-256 glyph grid can be scaled to print on a piece of paper + approximately 3 feet by 3 feet (or one meter by one meter). Written + by Paul Hardy. + + - unigencircles - adds dashed combining circles to unifont.hex glyphs + for code points that are in "font/ttfsrc/combining.txt" but not in + "font/plane00/nonprinting.hex". Written by Paul Hardy. + + - unigenwidth - creates an implementation of the POSIX functions + wcwidth() and wcswidth() as specified in IEEE 1003.1-2008, Vol. 2: + System Interfaces, Issue 7, pages 2251 and 2241, respectively. + Plane 0 widths are determined by reading the current Unifont glyphs. + All higher planes, 0x01 through 0x10, are calculated without regard + to Unifont glyphs. This can be modified in the future if Unifont + glyphs extend beyond Plane 0. Written by Paul Hardy. + + - unihex2png - converts a unifont.hex-format file into a Portable + Network Graphics (PNG) file for editing with a wider rane of graphics + editors than the original unihex2bmp allowed. Written by Andrew + Miller, based upon the unihex2bmp source code. Introduced in + Version 6.3.20131215. + + - unipng2hex - converts a PNG graphics file created by unihex2png + back into a unifont.hex-format file. Written by Andrew Miller, + based upon the unibmp2hex source code. Introduced in Version + 6.3.20131215. + +The last two program additions, unihex2png and unipng2hex, also support +glyph heights of 24 and 32 pixels in addition to Unifont's original +height of 16 pixels. hex2bdf and hexdraw have also been modified to +support these alternate glyph heights. This capability has not been +tested extensively, and for now is considered experimental. + + +CHANGES IN VERSION 6.2 +---------------------- +After release of version 5.1 of Unifont, it was learned that the +replacement glyphs used in Hangul Syllables, although free to use, +could never be licensed under any version of GPL. For that reason, +Paul Hardy created a set of Hangul Syllables from scratch with the +oversight of some native Koreans. This was done using the files that +appear in the "hangul/" directory. For a detailed discussion of the +process, see + + http://unifoundry.com/hangul/hangul-generation.html + +The new font was released as Unifont 6.2, with representation of +all glyphs in the Unicode 6.2 BMP. As a result of replacing the +Hangul Syllables block, this was the first release that provided +GPLv2+ coverage (with a font embedding exception) for the entire +package. + +The Unicode Consortium released Unicode Version 6.2.0 on 22 April 2013. + +This version of Unifont includes all additions to the BMP since Unicode +Version 5.1, and adds 1,328 more glyphs to the Basic Multilingual Plane. + +It also incorporates all errata that the Unicode Consortium published +that apply to the BMP from Unicode 3.0 errata through Unicode 6.1 errata +(listed with the Unicode 6.2.0 release). Only one erratum was left +unmodified: the Ogham Space glyph, U+1680, which was left as a line stroke +because of the rendering limitations of the bitmapped Unifont. The errata +for the following glyphs were examined and if necessary corrected: + + Unicode 3.1: U+066B, U+224C, U+1780..U+17E9 + Unicode 3.2: [none] + Unicode 4.0: U+06DD, U+0B66 + Unicode 4.1: U+01B3, U+031A + Unicode 5.0: U+0485, U+0486, U+06E1 + Unicode 5.1: U+047C, U+047D, U+075E, U+075F, + U+1031, U+1E9A, U+1460, U+147E, + U+2626 + Unicode 5.2: U+04A8, U+04A9, U+04BE, U+04BF, + U+135F, U+19D1, U+19D2, U+19D4 + [U+1680 left as is] + Unicode 6.0: [none] + Unicode 6.1: U+2D7F + +Note that some glyphs were assigned in earlier versions of Unicode and +later withdrawn, but their glyphs still appear in the code charts. +Therefore, they have been left in place. The Unicode Consortium now +holds the position that once a glyph is assigned, it is not replaced. + +Andrew Miller noted that one glyph (U+2047) was incorrect and the glyph +CYRILLIC CAPITAL LETTER A (U+0410) did not match LATIN CAPITAL LETTER A +(U+0041). He submitted corrections and they have been incorporated. + +The biggest change was a totally redrawn set of Hangul Syllables, +U+AC00..U+D7A3, comprising 11,172 glyphs in all. This allowed the +entire font to be licensed under the GNU GPL. + +Unicode 6.2 (and hence Unifont) now only has 2,330 unassigned code points +in the BMP for possible future assignments, and the rate at which new +code points are being assigned in the BMP is decreasing greatly. + +The unihex2bmp program has reversed the meaning of its "-f" (flip, +or transpose) flag compared to Unifont Version 5.1 unihex2bmp. +Now the default behavior is to produce 16x16 glyph charts with +the same arrangement as The Unicode Standard. + +The unibmp2hex program now hard-codes several scripts and code points +to be double-width. This was necessary after removing the combining +circles from many glyphs that only occupied the left-hand side of the +16x16 grid, but combine with double-width glyphs from the rest of a +given script. + +The "blanks.hex" file has been renamed to "unassigned.hex" as a more +accurate description of its contents. The "substitutes.hex" file has +been renamed to "spaces.hex", as all it contained were single- and +double-width space glyphs (strings of 0s). + + +Roman Czyborra and Paul Hardy wanted to license this entire collection +under GPL to simplify its adoption by the GNU Project. In the end, there +was just one catch: the Hangul Syllables block that appeared in Unifont 5.1, +although licensed for free use, could not be licensed under the GPL. + +There was no suitable alternative that was covered under the GPL, so Paul +Hardy created a new block of Hangul Syllables. This took a few years of +spare time to complete. Native Koreans reviewed and critiqued the glyphs. +If anyone who is Korean would like to improve this block (U+AC00..U+D7A3), +please feel free to do so and submit the changes so they can be incorporated. + +The font has also gone through a couple of simplifications since the +release of version 5.1: + + - There is only one source file for CJK ideographs now, "wqy.hex", + acknowledging that most of these glyphs were taken from the Wen + Quan Yi distribution. + + - There are no more combining circles; these were all removed. + +The result is now there is just one variation of output font rather than +four. That one is used to generate the TrueType "unifont.ttf" font. + +The directory "font/plane00" contains the .hex input files for building +Unifont, and contains these files: + + hangul-syllables.hex Unicode Hangul Syllables, U+AC00..U+D7A3 + nonprinting.hex Format and other assigned but invisible glyphs + pua.hex Private Use Area glyphs + README The README file + spaces.hex Code points that are space glyphs + unassigned.hex Unassigned code points in the BMP + unifont-base.hex Source file with almost all BMP scripts + wqy.hex Source file with Wen Quan Yi CJK ideographs + +The file previously named "blanks.hex" is now named "unassigned.hex". +These "blank" glyphs are no longer included in the compiled font. +Although the Unicode Standard specifically allows a visual rendering +of unassigned code points, doing so would prevent a display engine +finding a glyph in another font. In fact, the original "blanks.hex" +pattern was modeled after the proposed representation of unassigned +code points depicted in The Unicode Standard, Version 5.0, Section 5.3, +Unknown and Missing Characters (p. 155). + +Incorporating "blanks.hex" (now "unassigned.hex") was invaluable in +spotting assigned code points with glyphs that had not yet been drawn. +However, now there is complete coverage of the entire BMP, with only +about 2,300 BMP code points remaining out of 65,536 that could potentially +be given assignments in the future, so the great bulk of work on the +BMP is done. + +UNIFONT VERSION 5.1 +------------------- +Paul Hardy's first release of Unifont and associated graphics utilities +was Version 5.1. This corresponded to Unicode Version 5.1 (the current +version at the time), with a glyph for every visible character in the +Unicode 5.1 Basic Multilingual Plane. + +For the Unifont 5.1 release, Paul Hardy replaced the 11,172 +thick-stroke Hangul Syllables glyphs with thin-stroke glyphs +(a desire expressed by Roman Czyborra for years), merged Qianqian +Fang's unibit and Wen Quan Yi glyphs into GNU Unifont (with lots +of help and enthusiasm from Qianqian Fang), drew about 8,500 more +glyphs to provide complete coerage of the BMP, and replaced the +existing Tibetan glyphs with new ones contributed by Rich Felker. + +There was a bug in the johab2ucs2 Perl Script that formed one range +of Hangul Syllables incorrectly in previous releases. Paul Hardy +noticed and fixed the bug for the Unifont 5.1 release. All previous +releases of Unifont have an incorrectly formed Hangul Syllables block. + +Earlier releases also had an incorrectly formed Braille glyph block. +There was a bug in the Perl script that drew the Braille glyphs in +earlier releases. Roman Czyborra made a fix to that Perl script, +named "braille" at his website (http://czyborra.com). The revised +script ("hexbraille") was included in the Unifont 5.1 release, and +used to generate the Unifont 5.1 Braille glyphs. + + +HISTORY +------- +Roman Czyborra began GNU Unifont in 1998 as a low +quality font to provide a glyph for every Unicode character in the +Basic Multilingual Plane. He realized that no one font at the time +had complete coverage of the Unicode BMP. http://czyborra.com still +has several cool tools for Unifont not included here. + +Since Roman Czyborra was unable to maintain the Unifont for a while, +and many patches existed on gnu-unifont@groups.yahoo.com +(http://groups.yahoo.com/group/gnu-unifont), David Starner + decided to make a new release extending +Unifont with many characters in 1999. That was the foundation of earlier +GNU Unifont compilations from 1999 to 2004. + +By 2004, work on Unifont had stopped. Qianqian Fang wanted to create +a high-quality Chinese Unicode font in 2004. He began by copying the +GNU Unifont glyphs. He replaced its Latin glyphs with those of another +X11 font. He replaced the existing main CJK ideographs with a higher +quality font that the People's Republic of China had placed in the public +domain. Qianqian named this new font "unibit", and released it under +the terms of the GNU General Public License (GPL) version 2, with the +exception that embedding his font in a document did not by itself bind +that document to the terms of the GNU GPL. + +See http://wqy.sourceforge.net/cgi-bin/enindex.cgi (English) or +http://wenq.org (Chinese) for more information on Wen Quan Yi. + +In late 2007, Paul Hardy became interested in adding to GNU Unifont. +He wrote a couple of programs to convert GNU Unifont .hex files to and +from bitmap images for easy editing with any graphics software. He began +by combining the latest glyphs available for GNU Unifont. This starting +point was posted at http://czyborra.com as the 2007-12-31 version of +unifont.hex. Shortly after that, Roman Czyborra's website went down. +Paul Hardy then started posting complete copies of GNU Unifont on his +website, at "http://unifoundry.com/unifont.html". + +Roman Czyborra encouraged Paul Hardy to continue this work on GNU Unifont. + +In early 2008, Paul Hardy learned of Qianqian Fang's work. Qianqian +encouraged a combining of effort, and Paul Hardy at that point created +two versions of GNU Unifont: one with the original Chinese ideographs +(which Roman Czyborra copied from a Japanese font in the public domain), +and one with Qianqian Fang's Wen Quan Yi (Spring of Letters) ideographs. +The Wen Quan Yi font provides far more coverage of CJK ideographs than +the original Japanese font did, and is of higher quality. + +Paul Hardy created a version of both the font with the original CJK +ideographs from Japan and with CJK ideographs from Wen Quan Yi that +contained combining circles. He then wrote a post-processing program +to remove the combining circles from the final font. + +In 2005, Luis Alejandro Gonzalez Miranda (http://www.lgm.cl) created +a set of Fontforge scripts and Perl programs to build a TrueType font +from unifont.hex. Paul Hardy modified Luis' software in 2008 to cover +the full Unicode 5.1 Basic Multilingual Plane range. Luis gave Paul +Hardy permission to release this modified version under the terms of +"the GNU General Public License, version 2 or (at your option) a later +version." + +On 4 July 2008, Paul Hardy was looking through all of Roman Czyborra's +Perl scripts. One of these, "braille", contained a comment from 2003 +that the original GNU Unifont did not generate its Braille patterns +(U+2800..U+28FF) correctly. The modified script fixed that bug. Paul +Hardy incorporated the corrected Braille glyphs into the 6 July 2008 +release of GNU Unifont. + +All previous versions probably contain this Braille bug and should be +replaced. + +Other notable additions include: + + - Incorporation of CJK glyphs from Qianqian Fang's fonts + + - Incorporation of Rich Felker's Tibetan glyphs + + - Replacement of the Hangul Syllables block with a thin stroke font + (Roman had mentioned wanting to do this someday on his website), + the current version being created from scratch by Paul Hardy + + - Addition of circled pencil glyphs for the Private Use Area + (suggested as an acceptable rendering in the Unicode 5.0 Standard), + now replaced with optional four-digit hexadecimal code point glyphs; + thought not built into the final font by default, they are available + in "font/plane00/pua.hex" + + - Replacement of the Unifont 5.1 gray box glyphs for unassigned + code points with four-digit hexadecimal glyphs; these are built + into the final font by default + + - Proper handling of combining characters in the TrueType version + + - Proper handling of space glyphs in the TrueType version + +The hex2bdf script in this release is Roman's original script, not the +modified version that produced two BDF files (one for 8 pixel wide glyphs +and another for 16 pixel wide glyphs). The TrueType font should be used +in preference to the BDF font, so this is probably a moot point. + +For the Unifont 6.2 release, Qianqian Fang gave Paul Hardy permission +to release the subset of Wen Quan Yi glyphs included in Unifont under +GPLv2+, with a font embedding exception. With the newly-drawn Hangul +Syllables block, this allowed the entire font to be released under +GPLv2+ with a font embedding exception. + + +OPEN ISSUES +----------- +* Some CJK ideographs use an entire 16x16 pixel grid. This leaves +insufficient space between lines. However, changing to a non-square +grid would distort the block drawing glyphs. The best solution is +probably to use GNU Unifont for mostly non-CJK glyph rendering, and +to use Qianqian Fang's Wen Quan Yi fonts (http://wenq.org) for +predominately CJK glyph rendering. The Wen Quan Yi fonts use extra +leading (blank space) between lines. + +* There are still some Control and Format glyphs in "unifont-base.hex"; +these might be more appropriate for "nonprinting.hex". + diff --git a/cpymo-tool/nds-converter/fonts/pixel/Unifont/font-plane00-README b/cpymo-tool/nds-converter/fonts/pixel/Unifont/font-plane00-README new file mode 100644 index 00000000..74d0ec91 --- /dev/null +++ b/cpymo-tool/nds-converter/fonts/pixel/Unifont/font-plane00-README @@ -0,0 +1,106 @@ +The Unicode Basic Multilingual Plane consists of 2^16 = 65,536 code points. +Of this number, 2,048 are the Surrogate Pairs, from U+D800..U+DFFF. This +leaves 65,536 - 2,048 = 63,488 code points. + +==> The total number of lines in the files below should be 63,488 <== + + hangul-syllables.hex + omit.hex + plane00-nonprinting.hex + plane00-unassigned.hex + pua.hex + spaces.hex + unifont-base.hex + wqy.hex + +The file copyleft.hex contains the Copyleft symbol, which is in the +Supplemental Multilingual Plane (Plane 1); it is added to the TrueType +version of Unifont (even though it lies above Plane 0) because of its +significance. + +The file custom00.hex is empty, so it has zero lines. + +The file izmg16-plane00.hex contains Japanese versions of glyphs in +Plane 0 that replace glyphs in corresponding code points in the default +Unifont build. As of Unicode 12.1.04, this contains 9,880 glyphs. +This number is not expected to change. See the end of this document +for further discussion of this file. + +The number of lines in a .hex file (or any other plain text file) can be +conveniently determined in this directory with + + wc -l *.hex + +The last line will be a grand total. + +Here is the output of "wc -l *.hex" with the Unifont 17.0.04 glyph files: + + 1 copyleft.hex + 0 custom00.hex + 11172 hangul-syllables.hex + 9968 izmg16-plane00.hex + 2 omit.hex + 92 plane00-nonprinting.hex + 1336 plane00-unassigned.hex + 6400 pua.hex + 17 spaces.hex + 28142 t-source.hex + 16671 unifont-base.hex + 27798 wqy.hex + ------ + 101599 total + +This makes a total of 101,599 lines in all *.hex files in this directory +as of Unifont 17.0.04. + +Subtracting the duplicate code points that exist in izmg16-plane00.hex, +t-source.hex, and the one Plane 1 glyph in copyleft.hex, the total +non-duplicate Plane 0 code points amount to 63,488 glyphs. That subtotal +should remain constant for Plane 0, as described at the beginning of +this document. + +If there are any duplicates, most likely these will be from new +glyphs being added to unifont-base.hex that were not removed from +plane00-unassigned.hex. A simple comparison using unidup will +show this: + + sort *.hex | unidup + +If there are duplicate code points, unidup will print them. + +Note that plane00-nonprinting.hex, pua.hex, and plane00-unassigned.hex +might not be included in the final generated unifont.hex file. If desired, +they can all be added by modifying the make file one level above this +directory (modify the UNIFILES definition in ../Makefile) or with +the call to "make" in the top-level directory with a command such as: + + make UNASSIGNED="plane00/unassigned.hex" PUA="plane00/pua.hex" + + +Historical Note on wqy.hex +-------------------------- +The file "wqy.hex" includes glyphs from the BDF version of Wen Quan Yi +in the range U+4E00..U+9FA5. That is the CJK Unified Ideographs script +range that was introduced in Unicode 1.0. In March 2005, The Unicode +Consortium released Unicode 4.1.0, which added 22 new glyphs to that +script in the range U+9FA6..U+9FBB. Those glyphs were added to Unifont +in February 2008 during the effort to attain complete Unicode 5.1 Basic +Multilingual Plane coverage. Any additional glyphs added to that Unicode +script in Unifont continue to be added to wqy.hex even though they were +not part of the original Wen Quan Yi font. This allows keeping the whole +CJK Unified Ideographs script in one file. + + +Note on izmg16-plane00.hex +---------------------------- +The file "izmg16-plane00.hex" contains glyphs from the public +domain Izumi BDF font, downloadable at + + http://unifoundry.com/japanese/index.html + +That BDF font contains glyphs for the JIS X 0213:2004 Japanese +standard, and replaces glyphs in the rest of Unifont to produce +the Japanese version, unifont_jp. + + +Paul Hardy, 2014, 2016, 2018, 2019, 2020 diff --git a/cpymo-tool/nds-converter/fonts/pixel/Unifont/unifont-17.0.05.hex.gz b/cpymo-tool/nds-converter/fonts/pixel/Unifont/unifont-17.0.05.hex.gz new file mode 100644 index 00000000..3355a3bb Binary files /dev/null and b/cpymo-tool/nds-converter/fonts/pixel/Unifont/unifont-17.0.05.hex.gz differ diff --git a/cpymo-tool/nds-converter/fvds_inspect.py b/cpymo-tool/nds-converter/fvds_inspect.py new file mode 100644 index 00000000..af323e4b --- /dev/null +++ b/cpymo-tool/nds-converter/fvds_inspect.py @@ -0,0 +1,128 @@ +#!/usr/bin/env python3 +"""Independent FVDS container inspector for CPyMO NDS 1.2 research. + +Container structure only: does not decode video/audio or establish hardware +compatibility. No third-party player or encoder code is incorporated. +""" +import argparse +import hashlib +import json +import os +import struct +from pathlib import Path + +HEADER = struct.Struct("<4sHHIIHHII") +KEY = struct.Struct("= HEADER.size, "Truncated FVDS header") + with path.open("rb") as f: + magic, width, height, fps_n, fps_d, rate, channels, frames, key_count = HEADER.unpack( + f.read(HEADER.size)) + require(magic == b"FVDS", "Bad FVDS magic") + require(0 < width <= 1024 and 0 < height <= 1024, "Bad video dimensions") + require(0 < fps_n <= 1000 and 0 < fps_d <= 1000, "Bad frame rate") + require(0 < rate <= 96000 and channels in (1, 2), "Bad audio configuration") + require(0 < frames <= 108000, "Frame count beyond safety bound") + require(0 < key_count <= frames, "Bad keyframe count") + require(key_count <= 4096, "Keyframe index too large for NDS research") + data_start = HEADER.size + key_count * KEY.size + require(data_start + frames * UINT.size <= size, "Keyframes/frames exceed file bounds") + keys = [] + prev_frame = prev_offset = -1 + for _ in range(key_count): + frame, offset = KEY.unpack(f.read(KEY.size)) + require(prev_frame < frame < frames, "Keyframes must be sorted") + require(prev_offset < offset < size and offset >= data_start, + "Keyframe offsets must be sorted and in file bounds") + keys.append((frame, offset)) + prev_frame, prev_offset = frame, offset + require(keys[0] == (0, data_start), "Missing first keyframe") + expected_key_offsets = dict(keys) + video_bytes = audio_bytes = audio_blocks_total = 0 + payload_digest = 2166136261 + payload_read = 0 + for frame_index in range(frames): + position = f.tell() + if frame_index in expected_key_offsets: + require(position == expected_key_offsets[frame_index], + "Keyframe offset disagrees with packet boundary") + require(size - position >= 4, "Truncated per-frame size field") + value, = UINT.unpack(f.read(4)) + video_length, blocks = value & 0x1FFFF, value >> 17 + require(0 < blocks <= 255, "Bad per-frame ADPCM block count") + require(video_length > 0 and video_length % 4 == 0, + "Bad video length/alignment") + audio_length = blocks * channels * AUDIO_BLOCK_SIZE + require(f.tell() + video_length + audio_length <= size, + "Video or audio packet exceeds file") + if payload_hash: + remaining=video_length+audio_length + while remaining: + block=f.read(min(65536,remaining)) + require(len(block)>0, "Truncated media payload") + for value in block: + payload_digest=((payload_digest ^ value)*16777619)&0xffffffff + payload_read+=len(block);remaining-=len(block) + else: + f.seek(video_length + audio_length, os.SEEK_CUR) + video_bytes += video_length + audio_bytes += audio_length + audio_blocks_total += blocks + require(f.tell() == size, "Unexpected trailing bytes") + seconds = frames * fps_d / fps_n + report = { + "file": str(path), "size_bytes": size, + "width": width, "height": height, "fps_numerator": fps_n, + "fps_denominator": fps_d, "duration_seconds": seconds, + "frames": frames, "audio_sample_rate": rate, + "audio_channels": channels, "keyframe_count": key_count, + "keyframes": [{"frame": n, "offset": offset} for n, offset in keys], + "header_and_index_bytes": data_start, + "frame_headers_bytes": frames * 4, "video_payload_bytes": video_bytes, + "video_section_bytes": video_bytes + frames * 4, + "audio_bytes": audio_bytes, "audio_blocks_per_channel": audio_blocks_total, + "audio_capacity_samples_per_channel": audio_blocks_total * 256, + "expected_audio_samples_per_channel": seconds * rate, + "container_exact_bytes": data_start + frames * 4 + video_bytes + audio_bytes, + } + if payload_hash: + report["payload_fnv1a32"]=f"{payload_digest:08X}" + report["payload_read_bytes"]=payload_read + if hash_file: + digest = hashlib.sha256() + with path.open("rb") as f: + for part in iter(lambda: f.read(1024 * 1024), b""): + digest.update(part) + report["sha256"] = digest.hexdigest() + return report + + +def main(): + p = argparse.ArgumentParser(description=__doc__) + p.add_argument("video", type=Path) + p.add_argument("--sha256", action="store_true") + p.add_argument("--payload-hash", action="store_true", help="Read all packet payload bytes and report on-device comparable FNV checksum") + args = p.parse_args() + try: + print(json.dumps(inspect_fvds(args.video, args.sha256, args.payload_hash), indent=2, ensure_ascii=False)) + except (OSError, FVDSFormatError) as e: + p.exit(2, "Invalid FVDS: %s\n" % e) + + +if __name__ == "__main__": + main() diff --git a/cpymo-tool/nds-converter/helper_core.py b/cpymo-tool/nds-converter/helper_core.py new file mode 100644 index 00000000..41b8f118 --- /dev/null +++ b/cpymo-tool/nds-converter/helper_core.py @@ -0,0 +1,171 @@ +"""CPyMO NDS conversion assistant backend. MIT. NDS port: 千岚之夏. + +Input archives and game scripts are read-only. Each conversion gets a new job +directory; only a selected game's files are extracted, never the whole bundle. +""" +from pathlib import Path, PurePosixPath +import argparse, contextlib, hashlib, json, os, shutil, stat, sys, tempfile +import zipfile +import convert +from release_info import VERSION + +MAX_FILES = 30000 +MAX_BYTES = 8 * 1024**3 +ROOT = Path(__file__).resolve().parent + +def checked_name(name): + name=name.replace('\\','/') + path=PurePosixPath(name) + if not name or path.is_absolute() or '..' in path.parts or ':' in name or '\0' in name: + raise ValueError('压缩包含不安全的文件路径,已停止。') + return path.as_posix() + +def archive_entries(archive): + entries=archive.infolist() + if len(entries)>MAX_FILES or sum(i.file_size for i in entries)>MAX_BYTES: + raise ValueError('压缩包过大,超出本工具的安全处理范围。') + for entry in entries: + checked_name(entry.filename) + if stat.S_ISLNK(entry.external_attr>>16): + raise ValueError('压缩包含符号链接,已停止。') + return entries + +def configuration(data): + if len(data)>65536:raise ValueError('游戏配置文件异常过大。') + values={} + for line in data.decode('utf-8-sig').splitlines(): + key,sep,value=line.partition(',') + if sep:values[key.strip().lower()]=value.strip() + return values + +def discover(source,temp): + source=Path(source).resolve();temp=Path(temp).resolve();candidates=[] + if source.is_dir(): + count=0 + for folder,dirs,files in os.walk(source,followlinks=False): + dirs[:]=sorted(d for d in dirs if d not in ('save','nds-cache','.git') and not (Path(folder)/d).is_symlink()) + count+=len(files) + if count>MAX_FILES:raise ValueError('选择的目录文件太多,请直接选择游戏数据目录。') + if 'gameconfig.txt' in files: + p=Path(folder)/'gameconfig.txt';c=configuration(p.read_bytes()) + candidates.append({'chain':[],'root':str(Path(folder).resolve()),'title':c.get('gametitle',Path(folder).name).replace('\\n',' / '),'platform':c.get('platform','未知'),'kind':'folder'}) + elif source.suffix.casefold() in ('.zip',): + def scan(path,chain,depth): + with zipfile.ZipFile(path) as archive: + entries=archive_entries(archive) + for entry in entries: + name=checked_name(entry.filename) + if PurePosixPath(name).name=='gameconfig.txt' and not entry.is_dir(): + c=configuration(archive.read(entry));root=name[:-len('gameconfig.txt')] + candidates.append({'chain':chain,'root':root,'title':c.get('gametitle',PurePosixPath(root).name or source.stem).replace('\\n',' / '),'platform':c.get('platform','未知'),'kind':'archive','archive':str(path)}) + if depth<2: + nested=sorted((e for e in entries if Path(e.filename).suffix.casefold() in ('.zip',) and not e.is_dir()),key=lambda e:e.filename.casefold()) + if len(nested)>12:raise ValueError('嵌套游戏包太多,请单独选择要转换的游戏包。') + for entry in nested: + name=checked_name(entry.filename);next_path=temp/(hashlib.sha256(('/'.join(chain+[name])).encode()).hexdigest()+'.zip') + with archive.open(entry) as inp,next_path.open('wb') as out:shutil.copyfileobj(inp,out,1024*1024) + scan(next_path,chain+[name],depth+1) + scan(source,[],0) + else:raise ValueError('请选择游戏文件夹,或 ZIP 压缩包。') + rank={'s60v3':0,'symbian':0,'s60v5':1,'android':2,'pygame':3} + candidates.sort(key=lambda c:(rank.get(c['platform'].casefold(),9),c['title'],c['chain'],c['root'])) + for index,candidate in enumerate(candidates):candidate['id']=index + if not candidates:raise ValueError('没有找到 gameconfig.txt。请选 PyMO 游戏数据包;加密脚本或其他引擎的游戏暂不支持。') + return candidates + +def extract_game(candidate,destination): + destination.mkdir(parents=True) + with zipfile.ZipFile(candidate['archive']) as archive: + for entry in archive_entries(archive): + name=checked_name(entry.filename) + if not name.startswith(candidate['root']):continue + rel=PurePosixPath(name[len(candidate['root']):]) + if not rel.parts or any(p in ('save','nds-cache') for p in rel.parts):continue + target=destination.joinpath(*rel.parts) + if not target.resolve().is_relative_to(destination.resolve()):raise ValueError('解压路径异常。') + if entry.is_dir():target.mkdir(parents=True,exist_ok=True) + else: + target.parent.mkdir(parents=True,exist_ok=True) + with archive.open(entry) as inp,target.open('xb') as out:shutil.copyfileobj(inp,out,1024*1024) + return destination + +def public_candidates(candidates): + return [{k:v for k,v in c.items() if k!='archive'} for c in candidates] + +def run_job(job): + """Jobs are also used by the frozen EXE tests; no external Python required.""" + source=Path(job['source']).resolve();result=Path(job['result']).resolve() + if source.is_dir() and result.parent.is_relative_to(source): + raise ValueError('诊断位置不能放在原游戏目录内部,请选其他文件夹。') + result.parent.mkdir(parents=True,exist_ok=True) + try: + with tempfile.TemporaryDirectory(prefix='inspect-',dir=result.parent) as temporary: + candidates=discover(source,Path(temporary)) + if job['action']=='inspect': + report={'ok':True,'candidates':public_candidates(candidates)} + else: + index=int(job.get('candidate',0)) + if not 0<=index2048 or ph>2048 or pw*ph>262144 or a!=1 or len(data)<16+ph*4:raise ValueError('Invalid compressed sparse header') + spans=[struct.unpack_from('pw or n>pw-x for x,n in spans):raise ValueError('Invalid row table') + left=sum(n for _,n in spans)*3;pos=16+ph*4;out=bytearray(b'NPS1'+data[4:pos]) + while left: + if len(data)-pos<8:raise ValueError('Truncated chunk header') + packed,raw,check=struct.unpack_from('raw or packed>len(data)-pos:raise ValueError('Invalid chunk limits') + block=data[pos:pos+packed];pos+=packed + if packedleft and mask[start+right-1]==0 and colors[(start+right-1)*2]==0 and colors[(start+right-1)*2+1]==128:right-=1 + if left==right:left=right=0 + spans.append(struct.pack('2048 or ph>2048 or pw*ph>262144 or a!=1 or len(data)<16+ph*4:raise ValueError('Invalid sparse header') + spans=[struct.unpack_from('pw or n>pw-x for x,n in spans) or len(data)!=16+ph*4+sum(n for _,n in spans)*3:raise ValueError('Invalid sparse layout') + pixels=bytearray(b'\0\x80'*(pw*ph));mask=bytearray(pw*ph);pos=16+ph*4 + for y,(x,n) in enumerate(spans):pixels[(y*pw+x)*2:(y*pw+x+n)*2]=data[pos:pos+n*2];pos+=n*2 + for y,(x,n) in enumerate(spans):mask[y*pw+x:y*pw+x+n]=data[pos:pos+n];pos+=n + return b'NPI1'+data[4:16]+pixels+mask diff --git a/cpymo-tool/nds-converter/lossless-native.c b/cpymo-tool/nds-converter/lossless-native.c new file mode 100644 index 00000000..9537ab7f --- /dev/null +++ b/cpymo-tool/nds-converter/lossless-native.c @@ -0,0 +1,136 @@ +/* MIT. Independent bounded PCM16/Rice block encoder, NDS port: 千岚之夏. + * Host conversion only. This does not alter NDS decoding or audio quality. */ +#include +#include +#define API __declspec(dllexport) +static int sample(const unsigned char* p,unsigned i){return (int16_t)(p[i*2]|((unsigned)p[i*2+1]<<8));} +API unsigned nar_encode_block(const unsigned char* raw,unsigned n,unsigned char* out,unsigned cap,unsigned* order_out,unsigned* k_out){ + if(!raw||!out||!n||n>1024||capmax)max=z; + } + for(unsigned k=0;k<16;k++){ + if((max>>k)>31)continue; + unsigned bits=o*16+(n-o)*(k+1);if(bits>=best)continue; + for(unsigned i=o;i>k; + if(bits>key;acc=(acc<<(q+1))|1;used+=q+1; + while(used>=8){used-=8;out[pos++]=(unsigned char)(acc>>used);}acc&=((UINT64_C(1)<=8){used-=8;out[pos++]=(unsigned char)(acc>>used);}acc&=((UINT64_C(1)<bytes*8)return 0;unsigned v=0;while(n--){v=(v<<1)|((p[*bit/8]>>(7-*bit%8))&1);(*bit)++;}*out=v;return 1; +} +API unsigned nar_validate_block(const unsigned char* data,unsigned bytes,const unsigned char* original,unsigned n,unsigned order,unsigned k){ + if(!n||n>1024||!bytes||bytes>n*2||k>15)return 0; + if(order==255)return !k&&bytes==n*2&&!memcmp(data,original,bytes); + if(order>2||n<=order||bytes1?sample(original,order-2):0;unsigned bit=order*16; + for(unsigned i=order;i31)return 0;}while(!b); + if(!get(data,bytes,&bit,k,&lo))return 0;unsigned z=(q<65535)return 0; + int d=(int)(z>>1)^-(int)(z&1),pred=order==0?0:order==1?prev:2*prev-prev2;int v=(int16_t)(pred+d); + if(v!=sample(original,i))return 0;prev2=prev;prev=v; + } + return (bit+7)/8==bytes&&(!(bit%8)||!(data[bytes-1]&((1u<<(8-bit%8))-1))); +} + +/* MIT. Host experimental encoder; private block orders 16..18. */ +#include +#include +static unsigned zz(int d){d=(int16_t)d;return ((unsigned)d<<1)^((unsigned)(d>>31));} +static unsigned width(unsigned x){return x?32-__builtin_clz(x):0;} +typedef struct{unsigned char *p;unsigned pos,bits;uint32_t v;} Bits; +static void put(Bits*b,unsigned n,unsigned v){b->v=(b->v<bits+=n;while(b->bits>=8){b->bits-=8;b->p[b->pos++]=(unsigned char)(b->v>>b->bits);}} +__declspec(dllexport) unsigned pack_encode(const unsigned char* raw,unsigned n,unsigned char*out,unsigned part,unsigned*order){ + if(!n||n>1024||part<5||part>7)return 0; + int16_t s[1024];for(unsigned i=0;in)end=n;unsigned start=i; + for(;imx)mx=z;} + cost+=5+(end-start)*width(mx); + } + if(cost=n*2){memcpy(out,raw,n*2);*order=255;return n*2;} + memcpy(out,raw,bo*2);Bits b={out,bo*2,0,0}; + for(unsigned i=bo;in)end=n; + for(unsigned j=i;jmx)mx=z;} + unsigned w=width(mx);put(&b,5,w); + for(;i1024||part<5||part>7)return 0; + int16_t s[1024];unsigned z[1024],keys[32],bestkeys[32];for(unsigned i=0;in)end=n;unsigned mx=0; + for(unsigned i=start;imx)mx=z[i]; + unsigned bc=~0u,bk=0; + for(unsigned k=0;k<16;k++){ + if((mx>>k)>31)continue; + unsigned bits=(end-start)*(k+1);for(unsigned i=start;i>k; + if(bits=n*2){memcpy(out,raw,n*2);*order=255;return n*2;} + memcpy(out,raw,bo*2);Bits b={out,bo*2,0,0};unsigned group=0; + for(unsigned start=bo;startn)end=n;unsigned k=bestkeys[group++];put(&b,4,k); + for(unsigned i=start;i>k; + /* Emit long unary words in bounded pieces so the 32-bit reservoir cannot overflow. */ + while(q>=16){put(&b,16,0);q-=16;}put(&b,q+1,1);put(&b,k,v&((1u<1024||!bytes||bytes>n*2||k<5||k>7)return 0; + unsigned po,partition=0; + if(order>=16&&order<=18)po=order-16; + else if(order>=32&&order<=34){po=order-32;partition=1;}else return 0; + if(n<=po||bytes16)return 0; + unsigned end=start+(1u<n)end=n; + for(;start31)return 0;}while(!b);if(!get(data,bytes,&bit,width,&lo))return 0;z=(q<65535)return 0;} + else if(!get(data,bytes,&bit,width,&z))return 0; + int d=(z>>1)^-(int)(z&1),pred=po==0?0:po==1?sample(original,start-1):2*sample(original,start-1)-sample(original,start-2); + if((int16_t)(pred+d)!=sample(original,start))return 0; + } + } + return (bit+7)/8==bytes&&(!(bit%8)||!(data[bytes-1]&((1u<<(8-bit%8))-1))); +} diff --git a/cpymo-tool/nds-converter/lossless.py b/cpymo-tool/nds-converter/lossless.py new file mode 100644 index 00000000..e22e61c5 --- /dev/null +++ b/cpymo-tool/nds-converter/lossless.py @@ -0,0 +1,78 @@ +"""MIT. Streaming host lossless conversion, original PCM/RGB555 bytes preserved.""" +from pathlib import Path +import ctypes,sys,struct,zlib,hashlib +from nar_codec import encode_block,decode_block +ROOT=Path(getattr(sys,'_MEIPASS',Path(__file__).resolve().parent)) +_native=None +if (ROOT/'lossless-native.dll').is_file(): + _native=ctypes.CDLL(str(ROOT/'lossless-native.dll')) + _native.nar_encode_block.argtypes=[ctypes.c_void_p,ctypes.c_uint,ctypes.c_void_p,ctypes.c_uint,ctypes.POINTER(ctypes.c_uint),ctypes.POINTER(ctypes.c_uint)] + _native.nar_encode_block.restype=ctypes.c_uint + _native.nar_validate_block.argtypes=[ctypes.c_void_p,ctypes.c_uint,ctypes.c_void_p,ctypes.c_uint,ctypes.c_uint,ctypes.c_uint] + _native.nar_validate_block.restype=ctypes.c_uint + _native.pack_encode.argtypes=[ctypes.c_void_p,ctypes.c_uint,ctypes.c_void_p,ctypes.c_uint,ctypes.POINTER(ctypes.c_uint)] + _native.pack_encode.restype=ctypes.c_uint + _native.part_encode.argtypes=_native.pack_encode.argtypes + _native.part_encode.restype=ctypes.c_uint + _native.nar2_validate_block.argtypes=_native.nar_validate_block.argtypes + _native.nar2_validate_block.restype=ctypes.c_uint + +def encode_audio(source,destination=None,validate_ds=None): + """Optional destination; a whole-dataset audit can discard encoded bytes.""" + source=Path(source);size=source.stat().st_size + if size%2 or size//2>0xffffffff:raise ValueError('Invalid PCM16 sample count') + header=struct.pack('<4sIII',b'NAR2',size//2,22050,0) + output=Path(destination).open('xb') if destination is not None else None + digest=hashlib.sha256(header);original=hashlib.sha256();stored=len(header);blocks=0 + buf=ctypes.create_string_buffer(2048);extra=ctypes.create_string_buffer(2048);order=ctypes.c_uint();key=ctypes.c_uint();alt_order=ctypes.c_uint() + try: + if output:output.write(header) + with source.open('rb') as inp: + while raw:=inp.read(2048): + n=len(raw)//2 + if _native: + count=_native.nar_encode_block(raw,n,buf,2048,ctypes.byref(order),ctypes.byref(key)) + if not count or not _native.nar2_validate_block(buf,count,raw,n,order.value,key.value):raise ValueError('Native lossless round trip failed') + o,k,data=order.value,key.value,buf.raw[:count] + for fn,part in ((_native.pack_encode,5),(_native.part_encode,6)): + other=fn(raw,n,extra,part,ctypes.byref(alt_order)) + if not other:raise ValueError('Native encoder rejected valid PCM') + if other1 or len(raw)!=16+pw*ph*(3 if alpha else 2):raise ValueError('Invalid NPI1') + out=bytearray(b'NPA4'+raw[4:16]);p=16 + for size in ([pw*ph*2,pw*ph] if alpha else [pw*ph*2]): + end=p+size + while plen(data)*8:raise ValueError('Truncated block') + v=0 + for _ in range(count):v=(v<<1)|((data[bit//8]>>(7-bit%8))&1);bit+=1 + return v + while len(values)16:raise ValueError('Width') + end=min(n,len(values)+(1<31:raise ValueError('Unary limit') + z=(q<65535:raise ValueError('Residual limit') + else:z=get(width) + delta=(z>>1)^-(z&1);pred=0 if po==0 else values[-1] if po==1 else 2*values[-1]-values[-2];values.append(wrap(pred+delta)) + if (bit+7)//8!=len(data) or (bit%8 and data[-1]&((1<<(8-bit%8))-1)):raise ValueError('Padding') + return struct.pack('<'+'h'*n,*values) +def unpack_audio(data): + magic,n,rate,res=struct.unpack_from('<4sIII',data) + if magic not in (b'NAR1',b'NAR2') or rate!=22050 or res:raise ValueError('Header') + pos=16;out=bytearray() + while n: + size,count,order,k,res,check=struct.unpack_from('count*2 or res or pos+size>len(data):raise ValueError('Block header') + if magic==b'NAR1' and order>=16 and order!=255:raise ValueError('NAR2 mode in old header') + raw=decode_block(data[pos:pos+size],count,order,k);pos+=size + if zlib.adler32(raw)!=check:raise ValueError('Checksum') + out.extend(raw);n-=count + if pos!=len(data):raise ValueError('Trailing data') + return bytes(out) diff --git a/cpymo-tool/nds-converter/nar_codec.py b/cpymo-tool/nds-converter/nar_codec.py new file mode 100644 index 00000000..e1eaad65 --- /dev/null +++ b/cpymo-tool/nds-converter/nar_codec.py @@ -0,0 +1,69 @@ +"""Experimental bounded lossless PCM16 predictor/Rice blocks, mono 22050Hz.""" +import struct,zlib +def wrap(x):return (x+32768)%65536-32768 +def encode_block(raw): + samples=struct.unpack('<'+'h'*(len(raw)//2),raw);best=(len(raw)*8,255,0,raw) + for order in (0,1,2): + if len(samples)<=order:continue + residual=[] + for i in range(order,len(samples)): + pred=0 if order==0 else samples[i-1] if order==1 else 2*samples[i-1]-samples[i-2] + d=wrap(samples[i]-pred);residual.append((d<<1)^(d>>15)) + for k in range(16): + if max(residual)>>k>31:continue + bits=sum((x>>k)+1+k for x in residual)+order*16 + if bits>=best[0]:continue + best=(bits,order,k,residual) + _,order,k,residual=best + if order==255:return order,k,raw + out=bytearray(raw[:order*2]);acc=used=0 + def put(value,n): + nonlocal acc,used + acc=(acc<=8:used-=8;out.append((acc>>used)&255) + acc&=(1<>k)+1);put(x&((1<2 or k>15 or n<=order or len(data)<2*order:raise ValueError('parameters') + samples=list(struct.unpack('<'+'h'*order,data[:2*order]));bit=order*16 + def get(count): + nonlocal bit + if bit+count>len(data)*8:raise ValueError('truncated bits') + v=0 + for _ in range(count):v=(v<<1)|((data[bit//8]>>(7-bit%8))&1);bit+=1 + return v + for i in range(order,n): + q=0 + while not get(1): + q+=1 + if q>31:raise ValueError('unary bound') + v=(q<65535:raise ValueError('residual bound') + d=(v>>1)^-(v&1);pred=0 if order==0 else samples[-1] if order==1 else 2*samples[-1]-samples[-2] + samples.append(wrap(pred+d)) + if (bit+7)//8!=len(data) or (bit%8 and data[-1]&((1<<(8-bit%8))-1)):raise ValueError('padding') + return struct.pack('<'+'h'*n,*samples) +def pack_audio(raw): + if len(raw)%2:raise ValueError('odd PCM') + out=bytearray(struct.pack('<4sIII',b'NAR1',len(raw)//2,22050,0)) + for p in range(0,len(raw),2048): + block=raw[p:p+2048];order,k,data=encode_block(block) + out.extend(struct.pack('count*2 or res:raise ValueError('block header') + raw=decode_block(data[p:p+size],count,order,k);p+=size + if zlib.adler32(raw)!=checksum:raise ValueError('checksum') + out.extend(raw);n-=count + if p!=len(data):raise ValueError('trailing') + return bytes(out) diff --git a/cpymo-tool/nds-converter/npl4_codec.py b/cpymo-tool/nds-converter/npl4_codec.py new file mode 100644 index 00000000..92356f9d --- /dev/null +++ b/cpymo-tool/nds-converter/npl4_codec.py @@ -0,0 +1,75 @@ +"""Experimental independent LZ4 blocks around unchanged NPI1 image planes. +No whole-game output. Written from the public LZ4 block specification. +""" +import struct,zlib +BLOCK=8192 +def length(out,n): + while n>=255:out.append(255);n-=255 + out.append(n) +def compress(raw): + n=len(raw);out=bytearray();table={};anchor=i=0 + while i<=n-12: + k=raw[i:i+4];old=table.get(k);table[k]=i + if old is None or i-old>65535:i+=1;continue + end=i+4 + while end=15:length(out,literals-15) + out.extend(raw[anchor:i]);out.extend(struct.pack('=15:length(out,match-15) + i=end;anchor=i + for j in range(max(0,i-2),i):table[raw[j:j+4]]=j + literals=n-anchor;out.append(min(15,literals)<<4) + if literals>=15:length(out,literals-15) + out.extend(raw[anchor:]);return bytes(out) +def decompress(data,expected): + out=bytearray();p=0 + def ext(v): + nonlocal p + if v==15: + while True: + if p>=len(data):raise ValueError('Truncated length') + b=data[p];p+=1;v+=b + if v>expected:raise ValueError('Length exceeds output') + if b!=255:break + return v + while p>4) + if lit>len(data)-p or lit>expected-len(out):raise ValueError('Literal bounds') + out.extend(data[p:p+lit]);p+=lit + if p==len(data):break + if p+2>len(data):raise ValueError('Truncated offset') + off=int.from_bytes(data[p:p+2],'little');p+=2 + if not off or off>len(out):raise ValueError('Invalid offset') + match=ext(tok&15)+4 + if match>expected-len(out):raise ValueError('Match bounds') + for _ in range(match):out.append(out[-off]) + if len(out)!=expected:raise ValueError('Output size') + return bytes(out) +def pack_image(data,adler=False): + magic,w,h,pw,ph,alpha=struct.unpack_from('<4sHHHHI',data) + if magic!=b'NPI1' or not pw or not ph or alpha>1 or len(data)!=16+pw*ph*(3 if alpha else 2):raise ValueError('Bad NPI1') + out=bytearray((b'NPA4' if adler else b'NPL4')+data[4:16]);pos=16 + for size in ([pw*ph*2,pw*ph] if alpha else [pw*ph*2]): + end=pos+size + while pos262144 or alpha>1:raise ValueError('Bad NPL4') + out=bytearray(b'NPI1'+data[4:16]);p=16 + for size in ([pw*ph*2,pw*ph] if alpha else [pw*ph*2]): + done=0 + while donelen(data):raise ValueError('Truncated block header') + stored,n,crc=struct.unpack_from('n or p+stored>len(data):raise ValueError('Bad block lengths') + raw=data[p:p+stored] if stored==n else decompress(data[p:p+stored],n);p+=stored + if (zlib.adler32 if magic==b'NPA4' else zlib.crc32)(raw)!=crc:raise ValueError('Checksum mismatch') + out.extend(raw);done+=n + if p!=len(data):raise ValueError('Trailing bytes') + return bytes(out) diff --git a/cpymo-tool/nds-converter/nvl_trim.py b/cpymo-tool/nds-converter/nvl_trim.py new file mode 100644 index 00000000..b8360261 --- /dev/null +++ b/cpymo-tool/nds-converter/nvl_trim.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python3 +"""Extract beginning-only NVL1 test clips without transcoding. + +The script copies original compressed frame packets and the corresponding +PCM16 audio prefix. It does not include any third-party codec or media and +never replaces the source. Trimming at frame zero preserves delta frames' +reference dependency; arbitrary start timestamps are deliberately unsupported. +""" +from pathlib import Path +import argparse +import struct + +HEADER = struct.Struct("<4s7I") +PACKET = struct.Struct("<3I") + + +class NVLFormatError(ValueError): + pass + + +def trim_first_frames(source, output, first_frames): + source, output = Path(source), Path(output) + if source.resolve() == output.resolve() or output.exists(): + raise ValueError("Output must be a new path distinct from input") + with source.open("rb") as f: + if source.stat().st_size < HEADER.size: + raise NVLFormatError("Missing header") + magic, width, height, fps, frames, sample_rate, samples, audio_start = HEADER.unpack(f.read(32)) + if (magic != b"NVL1" or (width,height)!=(256,192) + or not (1<=fps<=30) or not (1<=frames<=fps*600) + or sample_rate != 22050 or samples != frames*22050//fps + or audio_start < 32+frames*PACKET.size): + raise NVLFormatError("Unsupported NVL1 header") + if source.stat().st_size != audio_start + samples*2: + raise NVLFormatError("Invalid PCM audio boundary") + if not (1<=first_frames<=frames): + raise ValueError("Requested frame count outside source range") + end = 32 + for index in range(frames): + f.seek(end) + payload = f.read(PACKET.size) + if len(payload)!=12: + raise NVLFormatError("Truncated video packet") + n,flags,checksum = PACKET.unpack(payload) + if not (1<=n<=98304) or flags&~3 or (index==0 and flags&2): + raise NVLFormatError("Invalid video packet") + end += PACKET.size+n + if end > audio_start: + raise NVLFormatError("Video spills into audio") + if index+1==first_frames: + stop=end + if end!=audio_start: + raise NVLFormatError("Trailing video bytes") + target_samples=first_frames*sample_rate//fps + target_offset=stop + try: + with output.open("xb") as dest: + dest.write(HEADER.pack(magic,width,height,fps,first_frames,sample_rate,target_samples,target_offset)) + f.seek(32) + remaining=stop-32 + while remaining: + block=f.read(min(8192,remaining)) + if not block:raise NVLFormatError("Truncated source frames") + dest.write(block) + remaining-=len(block) + f.seek(audio_start) + remaining=target_samples*2 + while remaining: + block=f.read(min(8192,remaining)) + if not block:raise NVLFormatError("Truncated source audio") + dest.write(block) + remaining-=len(block) + except BaseException: + output.unlink(missing_ok=True) + raise + return {"frames":first_frames,"fps":fps, + "duration_seconds":first_frames/fps, + "bytes":output.stat().st_size, + "audio_samples":target_samples} + + +if __name__=="__main__": + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument("source",type=Path) + parser.add_argument("output",type=Path) + parser.add_argument("frames",type=int) + args=parser.parse_args() + print(trim_first_frames(args.source,args.output,args.frames)) diff --git a/cpymo-tool/nds-converter/pixel_font.py b/cpymo-tool/nds-converter/pixel_font.py new file mode 100644 index 00000000..72abb5c2 --- /dev/null +++ b/cpymo-tool/nds-converter/pixel_font.py @@ -0,0 +1,97 @@ +"""Native bitmap subset generator (MIT); font data retains upstream OFL licenses.""" +from pathlib import Path +import gzip, struct, shutil, hashlib + +def read_bdf(path, codes=None): + glyphs={}; state={}; bitmap=False + with gzip.open(path,'rt',encoding='ascii') as stream: + for line in stream: + line=line.strip() + if line.startswith('STARTCHAR'): state={}; bitmap=False + elif line.startswith('ENCODING '): state['code']=int(line.split()[1]) + elif line.startswith('DWIDTH '): state['advance']=int(line.split()[1]) + elif line.startswith('BBX '): state['bbx']=list(map(int,line.split()[1:])) + elif line=='BITMAP': bitmap=True; state['rows']=[] + elif line=='ENDCHAR': + if codes is not None and state['code'] not in codes: + bitmap=False + continue + w,h,dx,dy=state['bbx']; rows=[0]*16 + for y,row in enumerate(state['rows']): + yy=13-dy-h+y + bits=int(row,16); n=len(row)*4 + for x in range(w): + xx=dx+x + if bits>>(n-1-x)&1: + if not (0<=xx<16 and 0<=yy<16): + raise ValueError(f'Bitmap outside 16x16 storage: U+{state["code"]:04X}') + rows[yy]|=1<>(w-1-x)&1)) + glyphs[int(code,16)]=(w,rows) + return glyphs + +def pixel_font_cache(codes, target, missing_policy='error'): + from PIL import Image, ImageDraw, ImageFont + fonts=Path(__file__).parent/'fonts/pixel' + sources=[('small',fonts/'Fusion/fusion-pixel-12px-proportional-zh_hans.bdf.gz',12,13,read_bdf), + ('large',fonts/'Unifont/unifont-17.0.05.hex.gz',16,14,read_hex)] + codes=sorted(set(codes)); report=[] + for name,path,nominal,baseline,reader in sources: + glyphs=reader(path,set(codes)) + missing=[c for c in codes if c not in glyphs] + fallback=[] + # Preserve native Fusion pixels; use the existing licensed Noto face + # only for uncovered CJK characters, never guess private-use mappings. + noto=Path(__file__).parent/'fonts/NotoSansCJKsc-Regular.otf' + if name=='small' and any(0x3400<=c<=0x9fff for c in missing): + font=ImageFont.truetype(str(noto),13) + absent=bytes(font.getmask(chr(0x10ffff))) + for code in missing: + if not 0x3400<=code<=0x9fff or bytes(font.getmask(chr(code)))==absent: continue + image=Image.new('L',(13,14)) + ImageDraw.Draw(image).text((0,11),chr(code),font=font,fill=255,anchor='ls') + rows=[0,0]+[sum(1<=100) for y in range(14)] + advance=min(13,round(font.getlength(chr(code)))) + if not any(rows) or not advance: continue + glyphs[code]=(advance,rows);fallback.append(code) + missing=[c for c in missing if c not in glyphs] + if fallback: + license_dir=target/'font-licenses/Noto';license_dir.mkdir(parents=True,exist_ok=True) + shutil.copy2(noto.parent/'OFL.txt',license_dir/'OFL.txt') + print('INFO: small Noto fallback glyphs: '+','.join(f'U+{c:04X}' for c in fallback),flush=True) + if missing: + if missing_policy != 'box': + raise ValueError(f'{name} pixel font lacks {len(missing)} characters: '+','.join(f'U+{c:04X}' for c in missing[:16])) + box=reader(path,{0x25a1}) + if 0x25a1 not in box: raise ValueError('Fallback box glyph unavailable') + for code in missing: glyphs[code]=box[0x25a1] + print(f'WARNING: {name} displays missing glyphs as boxes: '+','.join(f'U+{c:04X}' for c in missing),flush=True) + data=bytearray(struct.pack('<4sI4B',b'NPF1',len(codes),16,16,baseline,nominal)) + for code in codes: + advance,rows=glyphs[code] + data+=struct.pack('.42: + d.rectangle((x+4+j*4,skyline-h+8+z*12,x+6+j*4,skyline-h+12+z*12),fill=(186,166,89)) + d.rectangle((0,186,319,239),fill=(15,43,66)) + for k in range(26): + y=192+k*2 + x=(k*13+scene*9)%160 + d.line((x,y,x+28,y),fill=(58+scene%4*8,70+scene%5*8,95+scene%2*12),width=1) + d.line((0,186,319,186),fill=(91,125,137),width=2) + im.save(ROOT/'bg'/f'SCENE{scene+1:02}.png') + +# Four original character silhouettes with true alpha masks, dimensions safe +# for the 256x192 display and for the NDS image cache. +for k in range(4): + w,h=170,205 + chara=Image.new('RGB',(w,h),(42+k*15,71+k*8,99+k*7)) + mask=Image.new('L',(w,h),0) + d=ImageDraw.Draw(chara);m=ImageDraw.Draw(mask) + hair=[(33,45,72),(67,55,71),(71,38,57),(44,64,55)][k] + clothes=[(46,71,107),(88,71,94),(53,102,83),(72,77,107)][k] + m.ellipse((46,23,125,105),fill=255) + m.polygon(((31,205),(35,137),(53,104),(122,104),(149,137),(160,205)),fill=255) + d.ellipse((48,26,123,104),fill=(220,184,157)) + d.pieslice((40,15,131,105),180,348,fill=hair) + d.polygon(((31,205),(35,137),(53,104),(122,104),(149,137),(160,205)),fill=clothes) + d.polygon(((72,109),(87,143),(103,109)),fill=(204,217,219)) + d.arc((57,67,81,76),185,355,fill=(34,34,47),width=2) + d.arc((93,67,117,76),185,355,fill=(34,34,47),width=2) + d.arc((75,79,100,94),10,155,fill=(149,83,75),width=2) + chara.save(ROOT/'chara'/f'PLAYER{k+1}.png') + mask.save(ROOT/'chara'/f'PLAYER{k+1}_MASK.png') + +# All eight BGM tracks are playable PCM16 audio, not padded noise. +# A 6.4-second multivoice original sequence is looped to 83 seconds per track. +# 8*83*22050*2 = 29,282,400 audio bytes before additional scene assets. +RATE=22050 +SAMPLES=RATE*8 +notes=[220,247,262,294,330,349,392,440,494,523,587] +for k in range(8): + frame=bytearray(SAMPLES*2) + notes_for_track=[notes[(k*2 + i*3 + ((i//2)%3))%len(notes)] for i in range(16)] + for n in range(SAMPLES): + note=notes_for_track[(n*16)//SAMPLES] + t=n/RATE + beat=(n%(RATE//2))/(RATE//2) + env=0.38+0.62*(1.0-beat)**2 + val=(math.sin(2*math.pi*note*t)*0.58 + + math.sin(2*math.pi*(note/2)*t)*0.23+ + math.sin(2*math.pi*(note*1.5)*t)*0.12) + v=max(-32767,min(32767,round(11000*env*val))) + struct.pack_into('>3)|((g>>3)<<5)|((b>>3)<<10)) + delta=bytes(frame) if last is None else bytes(a^b for a,b in zip(frame,last)) + raw=bytes(frame) + encoded=lz4.block.compress(delta,store_size=False,mode="high_compression",compression=9) + flags=1+(2 if last is not None else 0) + packet+=struct.pack("<3I",len(encoded),flags,zlib.adler32(raw))+encoded + last=raw + samples=frames*rate//fps + pcm=bytearray(samples*2) + for i in range(samples): + t=i/rate + amp=2600+600*math.sin(2*math.pi*t) + freq=330 if int(t*4)%2==0 else 440 + struct.pack_into(" deterministic silence + ('LONGRUN',24.0,True), # long decode + sustained BGM/return stress +) + + +def write_game(target,ffmpeg): + target=Path(target).resolve() + if target.exists(): + raise ValueError('Use a new source directory; never overwrite a saved game') + # Execute the old approved original generator as is, without a duplicate + # corpus of bundled artwork or copyrighted/third-party datasets. + old_argv=sys.argv[:] + try: + sys.argv=[str(HERE/'make_dual_card_game.py'),str(target)] + runpy.run_path(str(HERE/'make_dual_card_game.py'),run_name='__main__') + finally: + sys.argv=old_argv + config=target/'gameconfig.txt' + original=config.read_text(encoding='utf-8') + assert 'playvideo,0' in original + config.write_text(original.replace('playvideo,0','playvideo,1').replace( + '双卡回廊:星夜讯号','双卡回廊:终章验收'),encoding='utf-8') + video=target/'video' + video.mkdir(exist_ok=True) + checks=[] + for index,(name,duration,with_audio) in enumerate(CLIPS): + output=video/(name+'.mp4') + # Real 320x240, 15fps source frames with motion; the converter must + # scale to 256x192, choose 12fps, RGB555 and encode frame deltas. + # Use video testsrc2 for dynamic patterns, not frozen/static padding. + args=[str(ffmpeg),'-nostdin','-hide_banner','-loglevel','error', + '-f','lavfi','-i', + f'testsrc2=size=320x240:rate=15:duration={duration:.1f}'] + if with_audio: + args+=['-f','lavfi','-i', + f'sine=frequency={330+index*90}:sample_rate=44100:duration={duration:.1f}', + '-c:a','aac','-b:a','64k'] + args+=['-c:v','mpeg4','-q:v','6','-pix_fmt','yuv420p', + '-movflags','+faststart','-y',str(output)] + subprocess.run(args,check=True,timeout=150,capture_output=True) + checks.append({'name':name,'source_seconds':duration, + 'has_audio':with_audio,'source_bytes':output.stat().st_size, + 'sha256':hashlib.sha256(output.read_bytes()).hexdigest()}) + + # Official PyMO parser: '#sel ' consumes N following raw text lines; + # the chosen index becomes FSEL. '#if FSEL=0,goto CHAPTER' uses + # conditional interpreter dispatch. Never invent private engine syntax. + story=[ + '#bg SCENE01,BG_NOFADE,0', + '#bgm BGM01,1', + '#label TITLE', + '#sel 2', + '开始综合测试', + '直接测试视频', + '#if FSEL=1,goto VIDEO', + '#label CHAPTER', + '#say 系统,双卡回廊:终章验收。', + '#say 系统,请确认开场标题与选项完全位于上屏。', + '#say 系统,进入剧情后请按 L 轮换三种显示模式。', + '#say 系统,按 START 快速保存,SELECT 快速读取。', + '#say 系统,请通过 X 打开原有菜单并查看时钟。', + '#say 系统,按 UP 打开历史对话,再用 B 返回。', + ] + chapters=[ + '星夜启程','安静街灯','信号交汇','雨后街巷', + '远方归途','海面回声','另一张卡','梦的轮廓', + '夜色余温','最后的窗口','切换场景','星夜再会', + ] + for i,title in enumerate(chapters): + num=i+1 + story.extend([ + f'#bg SCENE{num:02},BG_ALPHA,250', + f'#bgm BGM{(i%8)+1:02},1', + ]) + if i%3==0: + story.extend(['#chara_cls a,0',f'#chara 1,PLAYER{(i//3)+1},50,1,180']) + if i%4==0:story.append(f'#se TONE{(i//4)%3+1},0') + if i==5:story.append('#vo SIGNAL') + story.extend([ + f'#say 系统,第{num:02}幕:{title}。', + '#say 千岚之夏,请观察图片切换、音频持续播放以及触控响应。' + ]) + if i in (3,8): + story.extend([ + '#sel 2', + '继续下一个场景', + '重听这一幕的音乐', + '#if FSEL=1,bgm BGM01,1', + '#say 系统,剧情选项已返回;请确认操作发生在下屏。' + ]) + story.extend([ + '#chara_cls a,0', + '#label VIDEO', + '#bg SCENE08,BG_ALPHA,200', + '#bgm BGM02,1', + '#say 系统,视频一:等影片自然结束,再继续对白。', + '#movie OPENING', + '#say 系统,正常播放返回成功;检查背景音乐是否恢复。', + '#say 系统,视频二:请在视频播放中按 B 提前跳过。', + '#movie SKIPTEST', + '#say 系统,B 跳过视频返回成功,不能卡住或漏播下一句。', + '#say 系统,视频三:原视频没有声音,转换后应为静音。', + '#movie SILENT', + '#say 系统,静音视频返回成功;音轨处理不应报错。', + '#say 系统,视频四:较长连续播放,可观察帧率和音画同步。', + '#movie LONGRUN', + '#say 系统,长视频结束。请确认没有明显拖慢、声音错位或崩溃。', + '#bg SCENE12,BG_ALPHA,250', + '#bgm BGM08,1', + '#say 系统,综合验收完成。现在保存,再读取存档,确认恢复位置。', + '#say 系统,返回标题菜单可重复体验;建议两张卡分别保存测试记录。', + '#goto TITLE', + ]) + (target/'script'/'START.txt').write_text('\n'.join(story)+'\n',encoding='utf-8') + (target/'README_ORIGINAL.txt').write_text( + '《双卡回廊:终章验收》是 CPyMO 1.2 用原创素材生成的压力测试。\n' + '基于已验收的 30MiB 场景/语音/BGM 测试,增加独立生成的 MP4、标题、剧情选择。\n' + '不是商业游戏;无需付费素材,也不附任何外部游戏 ROM 或版权视频。\n' + '正常流程:启动选择「开始综合测试」→ 12 幕剧情 → 四段视频 → 存读档。\n' + '请在 SKIPTEST 段按 B,其他视频优先正常播放。\n' + '同一游戏目录可用于 DS/NTR 与 DSi/TWL,两端各自使用正确的 ROM。\n', + encoding='utf-8') + (target/'SOURCE_INVENTORY.json').write_text( + json.dumps({'project':'CPyMO 1.2 original final stress game', + 'script_lines':len(story),'scenes':12,'bgm_tracks':8, + 'sprites':4,'clip_sources':checks},ensure_ascii=False,indent=2)+'\n', + encoding='utf-8') + return {'script_lines':len(story),'clips':checks} + + +if __name__=='__main__': + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument('destination',type=Path) + parser.add_argument('--ffmpeg',default='ffmpeg') + args=parser.parse_args() + print(json.dumps(write_game(args.destination,args.ffmpeg), + ensure_ascii=False,indent=2)) diff --git a/cpymo-tool/nds-converter/tests/smoke_macos_portable.py b/cpymo-tool/nds-converter/tests/smoke_macos_portable.py new file mode 100644 index 00000000..2aa656cf --- /dev/null +++ b/cpymo-tool/nds-converter/tests/smoke_macos_portable.py @@ -0,0 +1,94 @@ +"""macOS frozen .app smoke: real MP4->NVL1, glyph fallback, paired ROM. + +Run on an actual macOS CI runner after build_portable_macos.py. +Synthetic assets only; does not attest to Finder/Gatekeeper acceptance. +""" +from pathlib import Path +import argparse +import hashlib +import json +import platform +import plistlib +import subprocess +import sys +import tempfile + +from test_converter import fixture, hashes +from release_info import VERSION + + +def digest(path): + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def main(): + p=argparse.ArgumentParser() + p.add_argument("--portable", type=Path, required=True) + p.add_argument("--ffmpeg", type=Path, required=True) + p.add_argument("--target-arch", choices=("arm64","x86_64"), required=True) + a=p.parse_args() + assert platform.machine()==a.target_arch, f"Host is {platform.machine()}, not {a.target_arch}" + root=a.portable.resolve() + app=root/"CPyMO-NDS-Converter.app" + exe=app/"Contents/MacOS/CPyMO-NDS-Converter" + assert exe.is_file(), "Frozen .app executable is missing" + def check_arch(binary): + out=subprocess.run(["lipo","-archs",str(binary)],check=True, + capture_output=True,text=True,timeout=30) + assert a.target_arch in out.stdout.split(), (str(binary),out.stdout,a.target_arch) + check_arch(exe) + rom=root/"cpymo-nds.nds" + assert rom.is_file() + metadata=json.loads((root/"VERSION.json").read_text()) + assert metadata["version"]==VERSION + info=plistlib.loads((app/"Contents/Info.plist").read_bytes()) + assert info["CFBundleVersion"]==info["CFBundleShortVersionString"]==VERSION + assert metadata["macos_architecture"]==a.target_arch + assert digest(rom)==metadata["rom_sha256"] + bundled=app/"Contents/Frameworks/ffmpeg" + if not bundled.is_file(): + bundled=app/"Contents/Resources/ffmpeg" + assert bundled.is_file(), "Bundled FFmpeg missing from frozen application" + check_arch(bundled) + bundled_hash=digest(bundled) + expected_hash=metadata.get("ffmpeg_bundled_sha256") + if expected_hash: + assert bundled_hash==expected_hash, ("Bundled FFmpeg checksum mismatch", + bundled_hash,expected_hash) + cfg=subprocess.run([str(bundled),"-buildconf"],check=True, + capture_output=True,text=True,timeout=45) + assert "--disable-gpl" in cfg.stdout and "--disable-nonfree" in cfg.stdout + assert "--enable-nonfree" not in cfg.stdout and "--enable-gpl" not in cfg.stdout + with tempfile.TemporaryDirectory(prefix="cpymo-macos-smoke-") as temp: + base=Path(temp);source=base/"source";fixture(source,"s60v3") + movie=source/"video/omitted.mp4" + cmd=[str(a.ffmpeg),"-nostdin","-hide_banner","-loglevel","error", + "-f","lavfi","-i","testsrc2=duration=1.2:size=320x240:rate=12", + "-f","lavfi","-i","sine=frequency=440:duration=1.2:sample_rate=44100", + "-c:v","mpeg4","-q:v","7","-c:a","aac","-y",str(movie)] + subprocess.run(cmd,check=True,timeout=90) + original=hashes(source) + result=base/"result.json";log=base/"log.txt";out=base/"converted" + job={"action":"convert","source":str(source),"output":str(out), + "result":str(result),"log":str(log)} + cfg=base/"job.json";cfg.write_text(json.dumps(job),encoding="utf8") + done=subprocess.run([str(exe),"--job",str(cfg)], + capture_output=True,text=True,timeout=180) + assert result.is_file(),f"Frozen conversion failed {done.returncode}: {done.stderr[-1200:]}" + report=json.loads(result.read_text(encoding="utf8")) + assert done.returncode==0 and report["ok"], (report,log.read_text(errors="replace")[-1400:]) + assert report["release_version"]==VERSION,report + assert report["videos"][0]["format"]=="NVL1",report + assert report["missing_policy"]=="box",report + assert hashes(source)==original,"Source was modified" + assert digest(out/"cpymo-nds.nds")==digest(rom),"Bundled ROM mismatch" + assert (Path(report["game_directory"])/"nds-cache/video").is_dir() + print(json.dumps({"mac_frozen_worker":"PASS","release_version":VERSION,"default_video":"NVL1", + "missing_glyph_policy":"box","paired_rom":"MATCH", + "source_integrity":"PASS","ffmpeg_license_flags":"LGPL-compatible", + "ffmpeg_bundle_sha256":bundled_hash,"native_arch":a.target_arch, + "rosetta_required":"NO" if a.target_arch=="arm64" else "Intel native"},ensure_ascii=False)) + + +if __name__=="__main__": + main() diff --git a/cpymo-tool/nds-converter/tests/smoke_windows_portable.py b/cpymo-tool/nds-converter/tests/smoke_windows_portable.py new file mode 100644 index 00000000..d8432402 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/smoke_windows_portable.py @@ -0,0 +1,106 @@ +"""Smoke a real frozen Windows Converter.exe worker, with source MP4 and NVL1. + +Run on Windows Actions after build_portable.py. Uses original synthetic media; +never embeds private or commercial video. This verifies _MEIPASS lookups, +FFmpeg *video* decoding, generated ROM, game cache and source immutability. +Also constructs the frozen GUI and records its actual version footer. +This does not certify real NDS frame rate or all Windows display settings. +""" +from pathlib import Path +import argparse +import hashlib +import json +import shutil +import subprocess +import sys +import tempfile + +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +sys.path.insert(0,str(HERE.parent)) +from test_converter import fixture,hashes +from convert import verify +from release_info import VERSION + + +def main(): + ap=argparse.ArgumentParser() + ap.add_argument('--portable',type=Path,required=True) + ap.add_argument('--ffmpeg',type=Path,required=True) + opt=ap.parse_args() + root=opt.portable.resolve() + exe=root/'app/Converter/Converter.exe' + internal=root/'app/Converter/_internal' + rom=root/'cpymo-nds.nds' + assert exe.is_file() and (internal/'ffmpeg.exe').is_file(), 'Portable app or FFmpeg missing' + assert rom.is_file() and (internal/'cpymo-nds.nds').is_file() + assert json.loads((root/'VERSION.json').read_text())['version']==VERSION + digest=lambda p:hashlib.sha256(p.read_bytes()).hexdigest() + assert digest(rom)==digest(internal/'cpymo-nds.nds'),'Paired ROM mismatch' + with tempfile.TemporaryDirectory(prefix='cpymo-portable-smoke-') as temp: + work=Path(temp) + src=work/'game' + original_script=fixture(src,'s60v3') + # Replace test fixture's placeholder "omitted.mp4" with real audiovisual + # video using a full, video-capable external FFmpeg on the Windows host. + cmd=[str(opt.ffmpeg),'-nostdin','-hide_banner','-loglevel','error', + '-f','lavfi','-i','testsrc2=duration=1.2:size=320x240:rate=15', + '-f','lavfi','-i','sine=frequency=440:duration=1.2:sample_rate=44100', + '-c:v','mpeg4','-q:v','7','-c:a','aac','-y',str(src/'video/omitted.mp4')] + subprocess.run(cmd,capture_output=True,check=True,timeout=90) + before=hashes(src) + result=work/'job/result.json' + job={'action':'convert','source':str(src),'output':str(work/'converted'), + 'candidate':0,'video_mode':'nvl1','audio_lossless':'voice', + 'cache_only':True,'missing_policy':'box', + 'result':str(result),'log':str(work/'job/log.txt')} + result.parent.mkdir(parents=True) + job_path=work/'job/task.json' + job_path.write_text(json.dumps(job,ensure_ascii=False),encoding='utf-8') + completed=subprocess.run([str(exe),'--job',str(job_path)], + capture_output=True,timeout=180) + assert result.is_file(),( + f'Frozen executable failed before producing result; code={completed.returncode}; ' + f'output={completed.stderr[-500:]!r}') + report=json.loads(result.read_text(encoding='utf-8')) + assert completed.returncode==0,report + assert report['ok'],report + assert report['release_version']==VERSION,report + assert len(report['videos'])==1,report + assert report['videos'][0]['format']=='NVL1',report + game=Path(report['game_directory']) + verify(game) + assert hashes(src)==before,'Original game changed' + assert (game/'script/START.txt').read_bytes()==original_script + assert (Path(report['output'])/'cpymo-nds.nds').is_file(),'ROM not bundled with converted output' + assert digest(Path(report['output'])/'cpymo-nds.nds')==digest(rom),'ROM mismatch in conversion' + proof=root/'native-validation';proof.mkdir() + gui_result=proof/'result.json' + gui_cfg={'source':str(src),'output_base':str(work/'gui-output'), + 'result':str(gui_result),'screenshot':str(proof/'window.png')} + (work/'gui-output').mkdir() + gui_path=work/'gui.json';gui_path.write_text(json.dumps(gui_cfg),encoding='utf8') + gui=subprocess.run([str(exe),'--state-root',str(proof/'jobs'),'--self-test',str(gui_path)], + capture_output=True,timeout=180) + assert gui.returncode==0 and gui_result.is_file(),gui.stderr[-500:] + gui_report=json.loads(gui_result.read_text(encoding='utf8')) + assert gui_report['ok'] and gui_report['release_version']==VERSION,gui_report + assert VERSION in gui_report['ui_version_footer'],gui_report + assert gui_report['ui_title'],gui_report + layout=gui_report['ui_layout'] + assert layout['progress_visible'] is False,layout + assert layout['game_list_rows']==1 and layout['game_scroll_visible'] is False,layout + assert abs(layout['video_right_gap'])<=2,layout + verify(Path(gui_report['game_directory'])) + assert hashes(src)==before,'GUI modified original source' + assert digest(Path(gui_report['output'])/'cpymo-nds.nds')==digest(rom) + print(json.dumps({'frozen_worker':'PASS','ffmpeg_video':'PASS','format':'NVL1', + 'frames':report['videos'][0]['frames'],'rom_pair':'MATCH', + 'source_preservation':'PASS','release_version':VERSION, + 'frozen_gui':'PASS','actual_ui_version_footer':gui_report['ui_version_footer'], + 'ui_layout':layout, + 'ui_screenshot':gui_report.get('ui_screenshot')},ensure_ascii=True)) + + +if __name__=='__main__': + main() diff --git a/cpymo-tool/nds-converter/tests/test_converter.py b/cpymo-tool/nds-converter/tests/test_converter.py new file mode 100644 index 00000000..0fa5f807 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_converter.py @@ -0,0 +1,228 @@ +"""Synthetic input/output checks; no copyrighted game files. MIT.""" +from pathlib import Path +import argparse +import hashlib +import io +import json +import math +import os +import shutil +import struct +import sys +import tempfile +import unittest +import wave +import zipfile +from PIL import Image + +sys.path.insert(0, str(Path(__file__).resolve().parents[1])) +import convert +import helper_core + +def fixture(folder, platform, packed=False): + folder.mkdir(parents=True) + for name in ['bg','bgm','script','video','save']: + (folder/name).mkdir() + (folder/'gameconfig.txt').write_text( + 'gametitle,合成测试\nplatform,'+platform+'\nimagesize,320,240\n' + 'scripttype,pymo\nstartscript,START\nengineversion,0.5\n' + 'bgformat,.png\ncharaformat,.png\nbgmformat,.wav\nvoiceformat,.wav\n' + 'seformat,.wav\nbgmvolume,5\nvovolume,5\nplayvideo,1\n' + 'fontsize,16\ntextcolor,#ffffff\n',encoding='utf8') + script=b'#bg scene,BG_NOFADE\n#bgm tone\n#movie omitted\n#label LOOP\n#say '+ '视频略过后继续。'.encode() + b'\n#goto LOOP\n' + (folder/'script/START.txt').write_bytes(script) + (folder/'video/omitted.mp4').write_bytes(b'synthetic video must not enter output') + (folder/'save/existing.csav').write_bytes(b'input save must not be imported') + image=io.BytesIO();Image.new('RGB',(320,240),(50,90,120)).save(image,format='PNG') + if packed: + data=image.getvalue();(folder/'bg/bg.pak').write_bytes(struct.pack(' +#include +#include +#define EXPECT(c) do{if(!(c))abort();}while(0) +int main(void){ + char line[32]; + for(unsigned mode=0;mode<3;mode++){ + EXPECT(nds_display_pref_format(line,sizeof line,mode)); + EXPECT(strchr(line,'\n')!=NULL); + EXPECT(nds_display_pref_parse(line)==mode); + } + EXPECT(nds_display_pref_parse("1")==2); + EXPECT(nds_display_pref_parse("1\n")==2); + EXPECT(nds_display_pref_parse("1\r\n")==2); + EXPECT(nds_display_pref_parse("NDSDISPLAY2 2\n")==2); + EXPECT(nds_display_pref_parse("NDSDISPLAY2 1\r\n")==1); + EXPECT(nds_display_pref_parse("NDSDISPLAY2 0")==0); + EXPECT(nds_display_pref_parse("NDSDISPLAY2 3")==0); + EXPECT(nds_display_pref_parse("NDSDISPLAY2 1 junk")==0); + EXPECT(nds_display_pref_parse("NDSDISPLAY2 -1")==0); + EXPECT(nds_display_pref_parse("broken")==0); + EXPECT(nds_display_pref_parse(NULL)==0); + EXPECT(!nds_display_pref_format(line,3,2)); + EXPECT(!nds_display_pref_format(line,sizeof line,3)); + /* Deliberately do a physical file roundtrip: CRLF normalization is not + equivalent to just checking a parser with an absent newline. */ + FILE*f=tmpfile();EXPECT(f!=NULL); + EXPECT(nds_display_pref_format(line,sizeof line,2)); + EXPECT(fputs(line,f)!=EOF); + rewind(f); + char readback[32]={0}; + EXPECT(fgets(readback,sizeof readback,f)!=NULL); + EXPECT(nds_display_pref_parse(readback)==2); + fclose(f); + return 0; +} +""" +@unittest.skipUnless(shutil.which("gcc"),"GCC unavailable") +class DisplayModePrefTests(unittest.TestCase): + def test_compile_and_roundtrip(self): + with tempfile.TemporaryDirectory() as t: + td=Path(t);src=td/"check.c";src.write_text(C_TEST,encoding="utf-8") + exe=td/"check" + subprocess.run(["gcc","-std=c11","-O2","-Wall","-Wextra","-Werror", + "-fsanitize=undefined","-I",str(HEADER),str(src), + "-o",str(exe)],check=True) + subprocess.run([str(exe)],check=True,capture_output=True,text=True) diff --git a/cpymo-tool/nds-converter/tests/test_fvds_adpcm.py b/cpymo-tool/nds-converter/tests/test_fvds_adpcm.py new file mode 100644 index 00000000..a007c0c1 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_fvds_adpcm.py @@ -0,0 +1,92 @@ +"""Host regression for independent FVDS ADPCM decoder (no game media). +Compiles the *actual NDS C file* and checks stereo sample order, nibble order, +clipping, index transitions and malformed data using synthetic inputs. +""" +import shutil +import struct +import subprocess +import tempfile +import unittest +from pathlib import Path + +ROOT=Path(__file__).resolve().parents[3] +SOURCE=ROOT/"cpymo-backends/nds/source/fvds-adpcm-nds.c" +INCLUDE=SOURCE.parent +STEPS=(7,8,9,10,11,12,13,14,16,17,19,21,23,25,28,31,34,37,41,45, + 50,55,60,66,73,80,88,97,107,118,130,143,157,173,190,209, + 230,253,279,307,337,371,408,449,494,544,598,658,724,796, + 876,963,1060,1166,1282,1411,1552,1707,1878,2066,2272,2499, + 2749,3024,3327,3660,4026,4428,4871,5358,5894,6484,7132,7845, + 8630,9493,10442,11487,12635,13899,15289,16818,18500,20350, + 22385,24623,27086,29794,32767) +JUMPS=(-3,-3,-2,-1,2,4,6,8) + +RUNNER=r""" +#include "fvds-adpcm-nds.h" +#include +#include +int main(int argc,char**argv){ + if(argc!=2)return 2; + FILE*f=fopen(argv[1],"rb");if(!f)return 3; + uint8_t in[264];int16_t out[512]={0}; + if(fread(in,1,sizeof in,f)!=sizeof in||fgetc(f)!=EOF)return 4; + fclose(f); + int n=nds_fvds_adpcm_pair(in,sizeof in,out,512); + if(n<0)return 5; + if(n!=256||fwrite(out,1,sizeof out,stdout)!=sizeof out)return 6; + return 0; +} +""" + +def channel(predictor,index,nibbles): + samples=[] + for nib in nibbles: + diff=(STEPS[index]*(2*(nib&7)+1))>>3 + predictor+=-diff if (nib&8) else diff + predictor=max(-32767,min(32767,predictor)) + samples.append(predictor) + index=max(0,min(88,index+JUMPS[nib&7])) + return samples + +def make_pair(left_predictor,left_index,left_data, + right_predictor,right_index,right_data): + return (struct.pack(">4)] + result.append(channel(predictor,index,nibbles)) + return struct.pack("<512h",*(x for pair in zip(*result) for x in pair)) + +@unittest.skipUnless(shutil.which("gcc"),"GCC unavailable") +class FVDSADPCMTests(unittest.TestCase): + def test_block_pcm_and_reject_corruption(self): + with tempfile.TemporaryDirectory() as d: + d=Path(d);(d/"runner.c").write_text(RUNNER) + exe=d/"runner" + subprocess.run(["gcc","-std=c11","-O2","-Wall","-Wextra","-Werror", + "-fsanitize=undefined","-I",str(INCLUDE), + str(SOURCE),str(d/"runner.c"),"-o",str(exe)],check=True) + vectors=[ + make_pair(0,0,bytes(128),0,0,bytes(128)), + make_pair(-1,3,bytes(range(128)),12000,67,bytes(255-i for i in range(128))), + make_pair(-32000,88,bytes([0xff]*128),32000,88,bytes([0x77]*128)), + make_pair(13579,23,bytes([0x18]*128),-13579,70,bytes([0xe2]*128)), + ] + for i,blob in enumerate(vectors): + file=d/(str(i)+".fv-audio-pair");file.write_bytes(blob) + p=subprocess.run([str(exe),str(file)],capture_output=True,check=True) + self.assertEqual(p.stdout,baseline(blob)) + self.assertEqual(len(p.stdout),1024) + for bad in (make_pair(0,89,bytes(128),0,0,bytes(128)), + make_pair(0,0,bytes(128),0,65535,bytes(128))): + file=d/"bad";file.write_bytes(bad) + p=subprocess.run([str(exe),str(file)],capture_output=True) + self.assertEqual(p.returncode,5) + +if __name__=="__main__": + unittest.main() diff --git a/cpymo-tool/nds-converter/tests/test_fvds_audio_pipeline.py b/cpymo-tool/nds-converter/tests/test_fvds_audio_pipeline.py new file mode 100644 index 00000000..b8e41026 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_fvds_audio_pipeline.py @@ -0,0 +1,68 @@ +"""End-to-end packet + audio decode contract using the production NDS C modules. +The fixture is synthetic silent FVDS with 3 frames; nothing from commercial media +or unlicensed player sources is committed. +""" +from pathlib import Path +import shutil,subprocess,tempfile,unittest +from test_fvds_inspect import sample + +ROOT=Path(__file__).resolve().parents[3] +INC=ROOT/"cpymo-backends/nds/source" +C=[INC/"fvds-stream-nds.c",INC/"fvds-adpcm-nds.c"] +RUNNER=r""" +#include "fvds-stream-nds.h" +#include "fvds-adpcm-nds.h" +#include +#include +#include +static void ck(int condition){if(!condition)abort();} +int main(int argc,char **argv){ + ck(argc==2); + nds_fvds_stream stream;nds_fvds_packet packet; + ck(nds_fvds_open(&stream,argv[1])==0); + uint8_t compressed[264],video[512];int16_t decoded[512]; + unsigned frames=0,pairs=0,readbytes=0; + while(nds_fvds_next(&stream,&packet)==0){ + ck(packet.frame==frames); + unsigned vremain=packet.video_bytes; + while(vremain){ + size_t got=nds_fvds_read_video(&stream,video,sizeof video); + ck(got&&got<=vremain);vremain-=got;readbytes+=got; + } + ck(nds_fvds_read_audio(&stream,compressed,264)==264); + ck(nds_fvds_adpcm_pair(compressed,264,decoded,512)==256); + for(unsigned i=0;i<512;i++)ck(decoded[i]==0); + pairs++;readbytes+=264; + for(unsigned b=1;b +#include +#include +#define CHECK(e) do{if(!(e))abort();}while(0) +typedef struct { + const uint8_t *data; + unsigned length,pos,calls; + int fail_early; +} memory_source; +static size_t pull(void *ctx,void *dst,size_t request){ + memory_source*s=ctx; + s->calls++; + if(s->fail_early && s->calls==1)return 0; + if(request>s->length-s->pos)request=s->length-s->pos; + memcpy(dst,s->data+s->pos,request); + s->pos+=(unsigned)request; + return request; +} +static void split_and_bounds(void){ + uint8_t video[514]={0}; + /* Four source byte pairs prove the storage endian and bit direction. */ + video[0]=0x0f;video[1]=0x3c; /* 0 + six-bit intra Q=30 */ + video[2]=0x00;video[3]=0x80; /* 1 + remaining bits 0 */ + video[510]=0xff;video[511]=0x7f; /* last word of first chunk */ + video[512]=0xca;video[513]=0xad; /* first word of next chunk */ + memory_source src={video,sizeof video,0,0,0}; + nds_fvds_bits bit; + CHECK(nds_fvds_bits_init(&bit,pull,&src,sizeof video)); + uint32_t value=~0u; + CHECK(nds_fvds_bits_read(&bit,1,&value)&&value==0); + CHECK(nds_fvds_bits_read(&bit,6,&value)&&value==30); + CHECK(nds_fvds_bits_read(&bit,9,&value)&&value==0x00f); + CHECK(nds_fvds_bits_read(&bit,1,&value)&&value==1); + CHECK(nds_fvds_bits_align16(&bit)); + CHECK(bit.consumed_bits==32); + for(unsigned i=2;i<255;i++) + CHECK(nds_fvds_bits_read(&bit,16,&value)&&value==0); + CHECK(nds_fvds_bits_read(&bit,16,&value)&&value==0x7fff); + CHECK(nds_fvds_bits_read(&bit,16,&value)&&value==0xadca); + CHECK(!nds_fvds_bits_read(&bit,1,&value)&&bit.failed); + CHECK(src.pos==514 && src.calls==2); + CHECK(!nds_fvds_bits_read(&bit,1,&value)); +} +static void rejects_bad_data(void){ + uint8_t data[8]={0}; + memory_source src={data,8,0,0,1}; + nds_fvds_bits b; + CHECK(!nds_fvds_bits_init(&b,pull,&src,0)); + CHECK(!nds_fvds_bits_init(&b,pull,&src,3)); + CHECK(!nds_fvds_bits_init(&b,pull,&src,131072)); + CHECK(nds_fvds_bits_init(&b,pull,&src,8)); + uint32_t v=0x12345678; + CHECK(!nds_fvds_bits_read(&b,17,&v)&&v==0x12345678); + CHECK(!nds_fvds_bits_read(&b,1,&v)&&b.failed); + CHECK(v==0x12345678); + /* Short reader cannot cause out-of-bounds source consumption. */ + src.fail_early=0; + src.calls=0; + CHECK(nds_fvds_bits_init(&b,pull,&src,16)); + CHECK(!nds_fvds_bits_read(&b,1,&v)); + CHECK(b.failed && src.pos==8); +} +int main(void){split_and_bounds();rejects_bad_data();return 0;} +""" + +@unittest.skipUnless(shutil.which("gcc"),"gcc not installed") +class FVDSBitsTests(unittest.TestCase): + def test_endian_word_boundary_and_failed_pull(self): + with tempfile.TemporaryDirectory() as td: + d=Path(td) + c=d/"check.c";c.write_text(C_TEST,encoding="utf-8") + runner=d/"runner" + subprocess.run(["gcc","-std=c11","-O2","-Wall","-Wextra","-Werror", + "-fsanitize=undefined","-I",str(SRC), + str(SRC/"fvds-bits-nds.c"),str(c),"-o",str(runner)], + check=True,capture_output=True,text=True) + subprocess.run([str(runner)],check=True,capture_output=True,text=True) diff --git a/cpymo-tool/nds-converter/tests/test_fvds_inspect.py b/cpymo-tool/nds-converter/tests/test_fvds_inspect.py new file mode 100644 index 00000000..7eea2394 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_fvds_inspect.py @@ -0,0 +1,67 @@ +"""Synthetic FVDS format tests. No external game media or player code.""" +import struct +import sys +import tempfile +import unittest +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parents[1])) +from fvds_inspect import FVDSFormatError, inspect_fvds + + +def sample(bad_key=False, bad_video=False, tail=False): + header = struct.pack("<4sHHIIHHII", b"FVDS", 256, 192, 12, 1, + 47605, 2, 3, 1) + first = 40 if bad_key else 36 + data = [header, struct.pack(" +#include +#include +#define CHECK(x) do{if(!(x))abort();}while(0) + +typedef struct { + nds_fvds_pcm_queue queue; + unsigned video_bytes; + unsigned video_frames; +} test_context; +static int begin(void *ctx,uint32_t frame,uint64_t pts){ + test_context *c=ctx; + CHECK(frame==c->video_frames); + CHECK(pts==(uint64_t)frame*1000000/12); + return 0; +} +static int chunk(void *ctx,const uint8_t *p,size_t n){ + test_context *c=ctx; + CHECK(p && n && n<=512); + c->video_bytes+=(unsigned)n; + return 0; +} +static int end(void *ctx,uint32_t frame){ + test_context *c=ctx; + CHECK(frame==c->video_frames++); + return 0; +} +static int pcm(void *ctx,const int16_t *p,size_t frames){ + test_context *c=ctx; + CHECK(frames==256); + for(size_t i=0;iqueue,p,frames)?0:-1; +} +static void test_boundaries(void){ + int16_t memory[2*256]={0}; + int16_t in[2*256],out[2*300]; + for(unsigned i=0;i<512;i++)in[i]=(int16_t)(i-256); + nds_fvds_pcm_queue q; + CHECK(!nds_fvds_pcm_queue_init(&q,memory,0)); + CHECK(nds_fvds_pcm_queue_init(&q,memory,256)); + CHECK(nds_fvds_pcm_queue_push(&q,in,256)); + size_t previous=q.queued; + CHECK(!nds_fvds_pcm_queue_push(&q,in,1)); + CHECK(q.overflows==1 && q.queued==previous); + CHECK(nds_fvds_pcm_queue_drain(&q,out,200)==200); + for(unsigned i=0;i<400;i++)CHECK(out[i]==in[i]); + CHECK(nds_fvds_pcm_queue_push(&q,in,200)); + CHECK(q.queued==256); + CHECK(nds_fvds_pcm_queue_drain(&q,out,300)==256); + for(unsigned i=0;i<56*2;i++)CHECK(out[i]==in[200*2+i]); + for(unsigned i=0;i<200*2;i++)CHECK(out[56*2+i]==in[i]); + for(unsigned i=256*2;i<300*2;i++)CHECK(out[i]==0); + CHECK(q.underflows==44 && q.consumed==456); + nds_fvds_pcm_queue_reset(&q); + CHECK(!q.queued && !q.underflows && !q.overflows); +} +static void test_two_picture_preroll(const char *filename){ + nds_fvds_stream stream; + nds_fvds_stage stage={0}; + int16_t memory[2*8192],output[2*4096]; + test_context c={0}; + const nds_fvds_stage_callbacks callbacks={NULL,begin,chunk,end,pcm}; + CHECK(nds_fvds_pcm_queue_init(&c.queue,memory,8192)); + CHECK(nds_fvds_open(&stream,filename)==0); + /* Decode two genuine packets before the presentation clock starts. + Do not inject fake silence as an artificial warmup. */ + CHECK(nds_fvds_stage_step(&stream,&stage,&callbacks,&c)==0); + CHECK(nds_fvds_stage_step(&stream,&stage,&callbacks,&c)==0); + CHECK(c.queue.queued==8192); + for(unsigned presentation=0;presentation<3;presentation++){ + size_t demand=nds_fvds_pcm_interval(presentation,12,1,47605); + CHECK(demand<=4096); + CHECK(nds_fvds_pcm_queue_drain(&c.queue,output,demand)==demand); + for(size_t i=0;i<2*demand;i++)CHECK(output[i]==0); + /* Once presentation consumes a picture interval, exactly one upcoming + picture may be produced into the regained queue headroom. */ + if(presentation+2<3) + CHECK(nds_fvds_stage_step(&stream,&stage,&callbacks,&c)==0); + } + CHECK(stage.completed_frames==3); + CHECK(c.queue.underflows==0 && c.queue.overflows==0); + CHECK(c.queue.high_watermark==8192); + CHECK(nds_fvds_stage_step(&stream,&stage,&callbacks,&c)==1); + nds_fvds_close(&stream); +} +int main(int argc,char **argv){ + CHECK(argc==2); + test_boundaries(); + test_two_picture_preroll(argv[1]); + int16_t memory[2*8192]; + int16_t out[2*4096]; + test_context c={0}; + CHECK(nds_fvds_pcm_queue_init(&c.queue,memory,8192)); + nds_fvds_stream file; + CHECK(nds_fvds_open(&file,argv[1])==0); + nds_fvds_stage stage={0}; + const nds_fvds_stage_callbacks callbacks={NULL,begin,chunk,end,pcm}; + size_t previously_drained=0; + for(unsigned frame=0;frame<3;frame++){ + CHECK(nds_fvds_stage_step(&file,&stage,&callbacks,&c)==0); + size_t target=nds_fvds_pcm_target(frame+1,12,1,47605); + size_t delta=nds_fvds_pcm_interval(frame,12,1,47605); + CHECK(delta==target-previously_drained); + CHECK(delta<4096); + CHECK(nds_fvds_pcm_queue_drain(&c.queue,out,delta)==delta); + for(size_t j=0;j=4096); + CHECK(c.queue.underflows==0 && c.queue.overflows==0); + CHECK(c.queue.produced==47*256 && c.queue.consumed==previously_drained); + CHECK(nds_fvds_pcm_target(1908,12,1,47605)==7569195ULL); + CHECK(nds_fvds_pcm_interval(1907,12,1,47605)>=3967); + CHECK(nds_fvds_pcm_interval(1907,12,1,47605)<=3968); + CHECK(nds_fvds_pcm_interval(0,0,1,47605)==0); + nds_fvds_close(&file); + return 0; +} +""" + +@unittest.skipUnless(shutil.which("gcc"),"GCC unavailable") +class FVDSPCMQueueTests(unittest.TestCase): + def test_ring_and_paced_stage(self): + with tempfile.TemporaryDirectory() as folder: + d=Path(folder) + runner=d/"runner.c";runner.write_text(DRIVER,encoding="utf-8") + exe=d/"runner" + subprocess.run(["gcc","-std=c11","-O2","-Wall","-Wextra","-Werror", + "-fsanitize=undefined","-I",str(INC), + *(str(INC/c) for c in C_FILES),str(runner), + "-o",str(exe)],check=True,capture_output=True,text=True) + fixture=d/"synthetic.fv";fixture.write_bytes(sample()) + subprocess.run([str(exe),str(fixture)],check=True, + capture_output=True,text=True) diff --git a/cpymo-tool/nds-converter/tests/test_fvds_picture_audit.py b/cpymo-tool/nds-converter/tests/test_fvds_picture_audit.py new file mode 100644 index 00000000..8c0dd475 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_fvds_picture_audit.py @@ -0,0 +1,70 @@ +"""Audit coded picture I/P headers through the production FVDS bitreader. + +Synthetic 3-frame FVDS fixture tests success, index/picture mismatch and +container trailing data. Neither proprietary samples nor decoder source are +committed. A user-provided private 159-second sample can be tested locally. +""" +from pathlib import Path +import shutil +import struct +import subprocess +import tempfile +import unittest +from test_fvds_inspect import sample + +ROOT = Path(__file__).resolve().parents[3] +SRC = ROOT / "cpymo-backends/nds/source" +CLI = ROOT / "cpymo-backends/nds/tools/fvds-picture-audit.c" + + +def picture_fixture(): + raw = bytearray(sample()) + offset = 36 + for frame in range(3): + header = struct.unpack_from("> 17 + struct.pack_into(" +int main(void){ + const uint8_t iframe[2]={0x0f,0x3c}; /* 0 + quantizer 30 */ + const uint8_t pframe[2]={0xff,0xff}; /* P flag */ + assert(nds_fvds_picture_type(iframe,2,1)==0); + assert(nds_fvds_intra_quantizer(iframe,2)==30); + assert(nds_fvds_picture_type(pframe,2,0)==1); + assert(nds_fvds_picture_type(pframe,2,1)==-2); + assert(nds_fvds_intra_quantizer(pframe,2)==-1); + assert(nds_fvds_picture_type(iframe,1,0)==-1); + assert(nds_fvds_picture_type(NULL,0,0)==-1); + /* 6-bit quantizer should not shift with signedness. */ + const uint8_t maxq[2]={0x00,0x7e}; + assert(nds_fvds_intra_quantizer(maxq,2)==63); + return 0; +} +""" +@unittest.skipUnless(shutil.which("gcc"),"GCC unavailable") +class FVDSPicturePrefixTests(unittest.TestCase): + def test_intra_and_predicted_header(self): + with tempfile.TemporaryDirectory() as tmp: + folder=Path(tmp) + c=folder/"probe.c";c.write_text(RUNNER,encoding="utf-8") + exe=folder/"probe" + subprocess.run(["gcc","-std=c11","-O2","-Wall","-Wextra","-Werror", + "-fsanitize=undefined","-I",str(SRC),str(c), + "-o",str(exe)],check=True,capture_output=True,text=True) + subprocess.run([str(exe)],check=True,capture_output=True,text=True) diff --git a/cpymo-tool/nds-converter/tests/test_fvds_picture_source.py b/cpymo-tool/nds-converter/tests/test_fvds_picture_source.py new file mode 100644 index 00000000..5f96f703 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_fvds_picture_source.py @@ -0,0 +1,91 @@ +"""Production FVDS packet -> 16-bit MSB-first bit reader -> ADPCM boundary. +Synthetic video crosses the 512-byte frame buffer. No user media committed. +""" +import shutil +import struct +import subprocess +import tempfile +import unittest +from pathlib import Path +from test_fvds_inspect import sample + +ROOT=Path(__file__).resolve().parents[3] +SRC=ROOT/"cpymo-backends/nds/source" +C_TEST=r""" +#include "fvds-picture-source-nds.h" +#include +#include +#define CHECK(x) do{if(!(x)){fprintf(stderr,"FVDS stream test line %d failed: %s\\n",__LINE__,#x);abort();}}while(0) +int main(int argc,char **argv){ + CHECK(argc==2); + nds_fvds_stream movie; + nds_fvds_packet packet; + nds_fvds_bits bits; + CHECK(nds_fvds_open(&movie,argv[1])==0); + CHECK(nds_fvds_next(&movie,&packet)==0); + CHECK(packet.video_bytes==516u); + CHECK(nds_fvds_picture_begin(&movie,&bits)); + uint32_t b=0; + CHECK(nds_fvds_bits_read(&bits,1,&b) && b==0); + CHECK(nds_fvds_bits_read(&bits,6,&b) && b==30); + CHECK(nds_fvds_bits_read(&bits,9,&b) && b==15); + /* Consume the second storage word's leading 1 before aligning over its + remaining 15 padding bits. The previous test aligned at the boundary + *before* this word, erroneously expecting a zero next. */ + CHECK(nds_fvds_bits_read(&bits,1,&b) && b==1); + CHECK(nds_fvds_bits_align16(&bits)); + for(unsigned i=2;i<255;i++){ + int ok=nds_fvds_bits_read(&bits,16,&b); + if(!ok || b!=0){ + fprintf(stderr,"word=%u value=%08x ok=%d fetched=%u remaining=%u used=%u\\n", + i,(unsigned)b,ok,bits.fetched_bytes,bits.remaining_bits,bits.consumed_bits); + abort(); + } + } + CHECK(nds_fvds_bits_read(&bits,16,&b)&&b==0x7fffu); + CHECK(nds_fvds_bits_read(&bits,16,&b)&&b==0xadcau); + /* Its remaining final 2 bytes are padding and must NOT spill into audio. */ + CHECK(nds_fvds_picture_to_audio(&movie,&bits)); + CHECK(movie.video_remaining==0); + uint8_t compressed[264]; + for(unsigned i=0;i>17 + self.assertEqual(packed&0x1ffff,8) + video=bytearray(516) + video[:4]=b"\x0f\x3c\x00\x80" + video[510:514]=b"\xff\x7f\xca\xad" + extended=(old[:offset]+struct.pack(" +#include +#include +#include + +#define REQUIRE(v) do{if(!(v))abort();}while(0) +struct state { + unsigned begins,ends,chunks,video_bytes,audio_blocks,polls; + uint64_t last_pts; + int mode; +}; +static int poll(void *context){ + struct state*s=context;s->polls++; + /* Ensure the first completed frame stays fully complete. */ + if(s->mode==1 && s->begins>=2 && s->polls>20)return 1; + return 0; +} +static int begin(void *context,uint32_t frame,uint64_t pts){ + struct state*s=context; + REQUIRE(frame==s->begins); + REQUIRE(pts==(uint64_t)frame*1000000/12); + s->last_pts=pts;s->begins++; + return 0; +} +static int compressed_video(void *context,const uint8_t *bytes,size_t count){ + struct state*s=context; + REQUIRE(bytes && count && count<=512); + if(s->mode==2)return -1; + s->chunks++;s->video_bytes+=(unsigned)count; + return 0; +} +static int end(void *context,uint32_t frame){ + struct state*s=context; + REQUIRE(frame==s->ends);s->ends++;return 0; +} +static int pcm(void *context,const int16_t*bytes,size_t frames){ + struct state*s=context; + REQUIRE(frames==256); + for(size_t i=0;iaudio_blocks++;return 0; +} +int main(int argc,char**argv){ + REQUIRE(argc==3); + nds_fvds_stream stream; + REQUIRE(nds_fvds_open(&stream,argv[1])==0); + nds_fvds_stage stage={0}; + struct state state={0}; + state.mode=atoi(argv[2]); + nds_fvds_stage_callbacks callbacks={poll,begin,compressed_video,end,pcm}; + int status=0; + while((status=nds_fvds_stage_step(&stream,&stage,&callbacks,&state))==0){} + if(state.mode==0 || state.mode==5){ + REQUIRE(status==NDS_FVDS_STEP_EOF); + REQUIRE(stage.completed_frames==3 && stage.audio_frames==47u*256u); + REQUIRE(stage.key_pictures==1 && stage.predicted_pictures==(state.mode==5?1u:0u)); + REQUIRE(state.audio_blocks==47 && state.video_bytes==24); + REQUIRE(state.begins==3 && state.ends==3); + REQUIRE(state.last_pts==166666); + }else if(state.mode==1){ + REQUIRE(status==NDS_FVDS_STEP_SKIPPED); + REQUIRE(stage.completed_frames>=1 && stage.completed_frames<3); + REQUIRE(stream.packet_open==0); + }else if(state.mode==2){ + REQUIRE(status==NDS_FVDS_STEP_ERROR); + REQUIRE(stage.completed_frames==0 && stream.packet_open==0); + }else if(state.mode==3 || state.mode==4){ + REQUIRE(status==NDS_FVDS_STEP_ERROR); + REQUIRE(stream.packet_open==0); + }else REQUIRE(0); + nds_fvds_close(&stream); + return 0; +} +""" + +@unittest.skipUnless(shutil.which("gcc"),"GCC unavailable") +class FVDSStageTests(unittest.TestCase): + def test_callbacks_exit_and_truncated_audio(self): + with tempfile.TemporaryDirectory() as td: + d=Path(td);driver=d/"driver.c" + driver.write_text(DRIVER,encoding="utf-8") + binary=d/"driver" + subprocess.run(["gcc","-std=c11","-O2","-Wall","-Wextra","-Werror", + "-fsanitize=undefined","-I",str(SRC), + *(str(SRC/name) for name in C_FILES), + str(driver),"-o",str(binary)],check=True) + source=d/"three-frames.fv";source.write_bytes(sample()) + for mode in range(3): + subprocess.run([str(binary),str(source),str(mode)], + capture_output=True,text=True,check=True) + damaged=bytearray(sample()) + # First packet begins at byte 36; 4-byte packed header + 8-byte + # video. The first audio L-channel step index is at +2. + damaged[36+4+8+2]=89 + source.write_bytes(damaged) + subprocess.run([str(binary),str(source),"3"], + capture_output=True,text=True,check=True) + bad_keyframe=bytearray(sample()) + # The indexed first video picture must have its I/P flag clear. + bad_keyframe[36+4+1]|=0x80 + source.write_bytes(bad_keyframe) + subprocess.run([str(binary),str(source),"4"], + capture_output=True,text=True,check=True) + predicted=bytearray(sample()) + # The second packet is intentionally non-key. A P flag is valid + # here, unlike in the first indexed I-picture. + second=36+(4+8+16*264) + predicted[second+4+1]|=0x80 + source.write_bytes(predicted) + subprocess.run([str(binary),str(source),"5"], + capture_output=True,text=True,check=True) diff --git a/cpymo-tool/nds-converter/tests/test_fvds_stream.py b/cpymo-tool/nds-converter/tests/test_fvds_stream.py new file mode 100644 index 00000000..f97a86af --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_fvds_stream.py @@ -0,0 +1,91 @@ +"""Host executable regression for the ORIGINAL FVDS packet reader. + +Compiles the same C source used in ARM9 with the native host compiler. +Only synthetic 3-frame samples from test_fvds_inspect.py are used. +No reference FastVideoDS decoder source or commercial game assets. +""" +import shutil +import struct +import subprocess +import tempfile +import unittest +from pathlib import Path +from test_fvds_inspect import sample + +ROOT=Path(__file__).resolve().parents[3] +SOURCE=ROOT/"cpymo-backends/nds/source/fvds-stream-nds.c" +INCLUDE=ROOT/"cpymo-backends/nds/source" + +RUNNER=r""" +#include "fvds-stream-nds.h" +#include +#include +#include +#include +static void ck(int yes) { if(!yes)abort(); } +int main(int argc,char **argv){ + if(argc!=3)return 2; + nds_fvds_stream s;nds_fvds_packet p; + int result=nds_fvds_open(&s,argv[2]); + if(!strcmp(argv[1],"bad-header")){ck(result!=0);return 0;} + if(!strcmp(argv[1],"bad-packet")){ck(result==0);ck(nds_fvds_next(&s,&p)==-3);nds_fvds_close(&s);return 0;} + ck(result==0);ck(s.frame_count==3);ck(s.width==256);ck(s.keyframe_count==1||s.keyframe_count==2); + uint8_t chunk[1007]; + for(unsigned frame=0;frame<3;frame++){ + int rc=nds_fvds_next(&s,&p); + if(!strcmp(argv[1],"bad-index")&&frame==2){ + ck(rc==-6);nds_fvds_close(&s);return 0; + } + ck(rc==0);ck(p.frame==frame); + ck(p.video_bytes==8); + for(unsigned remain=p.video_bytes;remain;){ + size_t n=nds_fvds_read_video(&s,chunk,sizeof(chunk)); + ck(n>0&&n<=remain);remain-=n; + } + for(unsigned remain=p.audio_bytes;remain;){ + size_t n=nds_fvds_read_audio(&s,chunk,sizeof(chunk)); + ck(n>0&&n<=remain);remain-=n; + } + ck(nds_fvds_finish(&s)==0); + } + result=nds_fvds_next(&s,&p); + ck(result==(!strcmp(argv[1],"tail")?-5:1)); + ck(nds_fvds_seek_keyframe(&s,0)==0); + ck(nds_fvds_next(&s,&p)==0 && p.frame==0); + ck(nds_fvds_read_audio(&s,chunk,sizeof(chunk))==0); + ck(nds_fvds_finish(&s)==0); + nds_fvds_close(&s);return 0; +} +""" + +@unittest.skipUnless(shutil.which("gcc"),"C compiler unavailable") +class FVDSStreamTests(unittest.TestCase): + @staticmethod + def two_keyframe_sample(invalid=False): + original=sample() + head=bytearray(original[:28]) + struct.pack_into(" +#include +#include +#include "audio-gain-nds.h" +int main(void){ + NdsAudioGain g; + int16_t out[64];int32_t raw[64],saved[64]; + nds_audio_gain_reset(&g); + assert(g.gain_q12==NDS_AUDIO_GAIN_Q12_TARGET); + for(unsigned i=0;i<64;i++)raw[i]=(i&1)?-8000:8000; + nds_audio_gain_write(out,raw,64,&g); + assert(out[0]>=9480&&out[0]<=9530); + assert(out[1]<=-9480&&out[1]>=-9530); + assert(g.limited_blocks==0&&g.samples==64); + nds_audio_gain_reset(&g); + for(unsigned i=0;i<64;i++)raw[i]=(i&1)?-32768:32767; + nds_audio_gain_write(out,raw,64,&g); + assert(g.limited_blocks==1&&g.preexisting_over_blocks==1); + for(unsigned i=0;i<64;i++)assert(out[i]<=32760&&out[i]>=-32760); + nds_audio_gain_reset(&g); + for(unsigned i=0;i<64;i++)raw[i]=(i&1)?-98304:98301; + nds_audio_gain_write(out,raw,64,&g); + assert(g.preexisting_over_blocks==1&&g.max_input_peak==98304); + assert(out[0]>30000&&out[1]<-30000); + for(unsigned i=0;i<64;i++)assert(out[i]<=32760&&out[i]>=-32760); + int previous=g.gain_q12; + memset(raw,0,sizeof raw); + nds_audio_gain_write(out,raw,64,&g); + assert(g.gain_q12>previous&&g.gain_q1214000); + return 0; +} +""" + +class NDSAudioGainTests(unittest.TestCase): + @unittest.skipUnless(shutil.which("gcc"),"host compiler unavailable") + def test_integer_headroom_and_no_digital_clipping(self): + with tempfile.TemporaryDirectory() as td: + d=Path(td);(d/"test.c").write_text(PROGRAM,encoding="utf8") + subprocess.run(["gcc","-std=c11","-O2","-Wall","-Wextra","-Werror", + "-fsanitize=undefined","-I",str(SOURCE), + str(d/"test.c"),"-o",str(d/"test")],check=True,capture_output=True,text=True) + subprocess.run([str(d/"test")],check=True,capture_output=True,text=True) + def test_pcm_mp3_movie_paths_share_peak_limiter(self): + audio=(SOURCE/"audio-nds.c").read_text(encoding="utf8") + self.assertEqual(audio.count("nds_audio_gain_write("),3) + self.assertIn("nds_audio_gain_reset(&nds_gain)",audio) + self.assertIn("int32_t mixed[64]={0}",audio) + self.assertIn("int32_t raw[64]",audio) + self.assertIn("int32_t mixed[64];",audio) + video=audio.split("if(movie_audio){",1)[1].split("bool pcm_only=",1)[0] + self.assertLess(video.index("nar_checksum("),video.index("nds_audio_gain_write(")) + self.assertIn("if(got +#include +#include +#include +#include +#include +#include +typedef uint64_t u64; +#define TICK_FREQ 1000u +static u64 fake_ticks; +static u64 tickGetCount(void){return fake_ticks;} +enum cpymo_backend_image_draw_type{ + cpymo_backend_image_draw_type_bg=0, + cpymo_backend_image_draw_type_text_say, + cpymo_backend_image_draw_type_text_say_textbox, + cpymo_backend_image_draw_type_ui_bg, + cpymo_backend_image_draw_type_ui_element, + cpymo_backend_image_draw_type_ui_element_bg, + cpymo_backend_image_draw_type_sel_img +}; +typedef struct { + struct { int imagesize_w,imagesize_h,nameboxorg_y; }gameconfig; + struct {void *msgbox,*name,*namebox; int msgbox_h,msgbox_w;}say; + struct {void *selections;}select_img; + struct {const char *gamedir;}assetloader; + struct {bool ok,mouse_button,mouse_position_useable;}input; + bool ignore_next_mouse_button_flag; +} cpymo_engine; +static cpymo_engine engine; +static bool nds_playing=true,error_ui_active=false,nds_aux_override=false; +static bool nds_touch_blocked=false,screens_swapped=false,menu_enabled=false,aux_hidden=false; +static volatile unsigned presentation_state[9]; +static int keys=0,remap=0,refresh=0,redraw=0,ignored=0,vblanks=0; +#define KEY_TOUCH 1 +#define KEY_A 2 +static int keysHeld(void){return keys;} +static void lcdMainOnTop(void){remap=0;} +static void lcdSwap(void){remap=!remap;} +static void swiWaitForVBlank(void){vblanks++;} +static void nds_aux_refresh(void){refresh++;} +static bool nds_aux_hidden(void){return aux_hidden;} +static bool cpymo_ui_enabled(const cpymo_engine *e){(void)e;return menu_enabled;} +static float cpymo_gameconfig_font_size(const void *cfg){(void)cfg;return 20.f;} +static void cpymo_engine_request_redraw(cpymo_engine *e){(void)e;redraw++;} +static void cpymo_input_ignore_next_mouse_button_event(cpymo_engine *e){ + ignored++;e->ignore_next_mouse_button_flag=e->input.mouse_button; +} +static float display_scale(void){return .8f;} +static float display_y(void){return 0.f;} +#include "save-dir-nds.h" +#include "dual-screen-nds.h" + +static void verify_not_saved(const char *dir){ + char p[512]; + snprintf(p,sizeof p,"%s/save/nds-dualscreen-mode.txt",dir); + FILE *f=fopen(p,"rb"); + assert(!f); +} +static void verify_saved(const char *dir,const char *want){ + char p[512],actual[80]={0}; + snprintf(p,sizeof p,"%s/save/nds-dualscreen-mode.txt",dir); + FILE *f=fopen(p,"rb");assert(f); + size_t n=fread(actual,1,sizeof actual-1,f); + fclose(f); + assert(n==strlen(want)); + assert(!strcmp(actual,want)); +} +int main(int argc,char**argv){ + assert(argc==2); + engine.assetloader.gamedir=argv[1]; + engine.gameconfig.imagesize_w=320; + engine.gameconfig.imagesize_h=240; + engine.say.msgbox_w=320; + engine.say.msgbox_h=60; + nds_dual_load(argv[1]); + nds_display_start(); + assert(nds_display_mode==0 && !screens_swapped && remap==0); + assert(nds_dual_accept(cpymo_backend_image_draw_type_text_say)); + /* Hold stylus in a lower touch menu and press L; its eventual release + must not get interpreted as the next mode's tap or selection. */ + keys=KEY_TOUCH; + engine.input.mouse_button=true; + nds_display_cycle(); + assert(nds_display_mode==1 && screens_swapped && remap==1); + assert(nds_touch_blocked && ignored==1 && engine.ignore_next_mouse_button_flag); + assert(!engine.input.mouse_button && !engine.input.mouse_position_useable); + assert(refresh==1 && redraw==1); + assert(nds_dual_save_pending && nds_dual_state[4]==0); + verify_not_saved(argv[1]); + /* If the user cycles quickly, each L resets the FAT-write cooldown. */ + fake_ticks=500;nds_dual_poll_mode(); + verify_not_saved(argv[1]); + /* Releasing stylus lets the real input poll clear touch_blocked. */ + keys=0;nds_touch_blocked=false; + nds_display_cycle(); + /* The LCD remains mapped to classic-lower until both new framebuffers + have been published, then commits the switch at VBlank. */ + assert(nds_display_mode==2 && nds_dual_mode && screens_swapped && remap==1); + assert(nds_display_swap_pending && vblanks==0); + nds_display_commit_pending_swap(); + assert(!screens_swapped && remap==0 && !nds_display_swap_pending && vblanks==1); + assert(refresh==2 && redraw==2); + fake_ticks=1200;nds_dual_poll_mode(); + verify_not_saved(argv[1]); /* new deadline is 1250 ticks */ + fake_ticks=1250;nds_dual_poll_mode(); + verify_saved(argv[1],"NDSDISPLAY2 2\n"); + assert(nds_dual_state[4]==1 && !nds_dual_save_pending); + menu_enabled=false;nds_dual_bottom_pass=false; + /* Initial title/boot selection is an unsplit upper-LCD scene. */ + assert(!nds_dual_title_allow_split(&nds_title_gate)); + assert(nds_dual_accept(cpymo_backend_image_draw_type_text_say)); + assert(!nds_dual_title_observe(&nds_title_gate,0,0,1)); /* title choice */ + assert(nds_dual_title_observe(&nds_title_gate,1,0,0)); /* story begins */ + assert(nds_dual_title_allow_split(&nds_title_gate)); + assert(nds_dual_accept(cpymo_backend_image_draw_type_bg)); + assert(!nds_dual_accept(cpymo_backend_image_draw_type_text_say)); + nds_dual_bottom_pass=true; + assert(nds_dual_accept(cpymo_backend_image_draw_type_text_say)); + assert(nds_dual_say_offset() < 0.f); + assert(!nds_dual_accept(cpymo_backend_image_draw_type_bg)); + /* Narrative selection images MUST route to the touch LCD. */ + engine.select_img.selections=(void*)1; + assert(nds_dual_accept(cpymo_backend_image_draw_type_sel_img)); + menu_enabled=true; + assert(nds_dual_accept(cpymo_backend_image_draw_type_ui_element)); + assert(!nds_dual_accept(cpymo_backend_image_draw_type_ui_bg)); + nds_dual_bottom_pass=false; + assert(nds_dual_accept(cpymo_backend_image_draw_type_ui_bg)); + assert(!nds_dual_accept(cpymo_backend_image_draw_type_ui_element)); + menu_enabled=false; + /* Three-state return, new game reloads its own preference. */ + nds_display_cycle(); + assert(nds_display_mode==0 && !nds_dual_mode && remap==0); + verify_saved(argv[1],"NDSDISPLAY2 2\n"); /* not yet written */ + fake_ticks=2010;nds_dual_poll_mode(); + verify_saved(argv[1],"NDSDISPLAY2 0\n"); + assert(nds_dual_state[4]==2); + /* Reproduce real ghost-A: classic-upper turns held TOUCH into OK, not + mouse_button. An unsanitized old OK generates JUST_RELEASED in the + subsequent core update, advancing a story from a mode-only L press. */ + keys=KEY_TOUCH; + engine.input.ok=true; + engine.input.mouse_button=false; + engine.input.mouse_position_useable=false; + nds_display_cycle(); + assert(nds_display_mode==1 && nds_touch_blocked); + assert(!engine.input.ok && !engine.input.mouse_button); + assert(!engine.input.mouse_position_useable); + verify_saved(argv[1],"NDSDISPLAY2 0\n"); /* still coalescing */ + fake_ticks=2250;nds_dual_poll_mode(); + assert(nds_dual_state[4]==2); + /* Physical A is preserved while the obsolete stylus input is discarded. */ + keys=KEY_TOUCH|KEY_A; + engine.input.ok=true; + engine.input.mouse_button=true; + engine.input.mouse_position_useable=true; + nds_display_cycle(); + assert(nds_display_mode==2 && engine.input.ok); + assert(nds_display_swap_pending && remap==1); + assert(!engine.input.mouse_button && !engine.input.mouse_position_useable); + keys=0; + /* Exit must persist even before the 750ms threshold; never lose last + selected mode because the story completed quickly. */ + assert(nds_dual_save_pending && nds_dual_state[4]==2); + nds_aux_override=true; + nds_display_restore_launcher(); + assert(nds_dual_state[4]==3 && !nds_dual_save_pending); + verify_saved(argv[1],"NDSDISPLAY2 2\n"); + assert(!nds_aux_override && !nds_dual_bottom_pass && remap==0); + assert(refresh==5 && redraw==5); + nds_dual_load(argv[1]); + assert(nds_display_mode==2 && !nds_dual_save_pending); + assert(!nds_dual_title_allow_split(&nds_title_gate)); /* next launch title */ + return 0; +} +""" +@unittest.skipUnless(shutil.which("gcc"),"GCC unavailable") +class NDSDisplayMachineTests(unittest.TestCase): + def test_live_header_mode_cycle_stylus_and_saved_state(self): + with tempfile.TemporaryDirectory() as td: + base=Path(td) + game=base/"game";game.mkdir(parents=True) + src=base/"mode.c";src.write_text(C_PROGRAM,encoding="utf-8") + exe=base/"mode" + result=subprocess.run(["gcc","-std=c11","-O2","-Wall","-Wextra","-Werror", + "-fsanitize=undefined","-I",str(SRC),str(src), + "-o",str(exe)],capture_output=True,text=True) + self.assertEqual(result.returncode,0,result.stderr) + subprocess.run([str(exe),str(game)],check=True, + capture_output=True,text=True) diff --git a/cpymo-tool/nds-converter/tests/test_nds_dual_canvas.py b/cpymo-tool/nds-converter/tests/test_nds_dual_canvas.py new file mode 100644 index 00000000..30ec8315 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_nds_dual_canvas.py @@ -0,0 +1,66 @@ +"""Execute the exact NDS enhanced RGB555 canvas C source on host. +Checks exact RGB555 background gradients, star field, low-contrast cloud +horizons, interactive suppression and six audio yield calls per pass. +""" +from pathlib import Path +import shutil,subprocess,tempfile,unittest + +ROOT=Path(__file__).resolve().parents[3] +SOURCE=ROOT/"cpymo-backends/nds/source" +PROGRAM=r""" +#include "dual-canvas-nds.h" +#include +#include +#define CHECK(x) do{if(!(x))abort();}while(0) +static uint16_t source_a[256*192],source_b[256*192]; +static int ticks; +static void audio_tick(void *unused){CHECK(unused==NULL);ticks++;} +int main(void){ + const uint16_t bg=nds_dual_canvas_color(5,9,13); + const uint16_t dark=nds_dual_canvas_color(2,4,7); + const uint16_t bright=nds_dual_canvas_color(12,18,23); + for(int interactive=0;interactive<=1;interactive++){ + for(int dialogue=0;dialogue<=1;dialogue++){ + ticks=0; + nds_dual_canvas_draw(source_a,interactive,dialogue); + nds_dual_canvas_draw_yield(source_b,interactive,dialogue, + audio_tick,NULL); + CHECK(ticks==6); /* scanlines y=0,32,64,96,128,160 */ + CHECK(!memcmp(source_a,source_b,sizeof source_a)); + CHECK(source_a[1*256+0]==nds_dual_canvas_row(1)); + CHECK(source_a[0]==bg); + CHECK(source_a[191*256+0]==(interactive?dark:nds_dual_canvas_cloud(191,1))); + CHECK(source_a[7*256+15]==bright); + /* Artistic sky/horizon only appears when the canvas is not occupied by + a menu or story choice; original dialogue pixels are drawn on top. */ + CHECK(source_a[155*256+2]==(interactive?nds_dual_canvas_row(155):nds_dual_canvas_cloud(155,0))); + CHECK(source_a[162*256+20]==(interactive?nds_dual_canvas_row(162):nds_dual_canvas_cloud(162,0))); + CHECK(source_a[170*256+2]==(interactive?nds_dual_canvas_row(170):nds_dual_canvas_cloud(170,0))); + CHECK(source_a[191*256+200]==(interactive?dark:nds_dual_canvas_cloud(191,1))); + CHECK(source_a[125*256+132]==(interactive?nds_dual_canvas_row(125): + nds_dual_canvas_color(9,14,19))); + CHECK(source_a[108*256+206]==(interactive?nds_dual_canvas_row(108): + nds_dual_canvas_color(9,14,19))); + const uint16_t base=nds_dual_canvas_row(70); + const uint16_t edge=nds_dual_canvas_color( + (base&31u)+1u,((base>>5)&31u)+2u,((base>>10)&31u)+2u); + CHECK(source_a[70*256+7]==(interactive?base:edge)); + CHECK(source_a[70*256+248]==(interactive?base:edge)); + CHECK(source_a[181*256+18]==(interactive?nds_dual_canvas_row(181): + nds_dual_canvas_color(6,9,13))); + } + } + return 0; +} +""" +@unittest.skipUnless(shutil.which("gcc"),"GCC unavailable") +class NDSDualCanvasTests(unittest.TestCase): + def test_backdrop_and_cooperative_audio_cadence(self): + with tempfile.TemporaryDirectory() as folder: + d=Path(folder);code=d/"test.c";code.write_text(PROGRAM,encoding="utf-8") + exe=d/"test" + subprocess.run(["gcc","-std=c11","-O2","-Wall","-Wextra","-Werror", + "-fsanitize=undefined","-I",str(SOURCE), + str(code),"-o",str(exe)], + capture_output=True,text=True,check=True) + subprocess.run([str(exe)],capture_output=True,text=True,check=True) diff --git a/cpymo-tool/nds-converter/tests/test_nds_dual_layout.py b/cpymo-tool/nds-converter/tests/test_nds_dual_layout.py new file mode 100644 index 00000000..29ea7b64 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_nds_dual_layout.py @@ -0,0 +1,60 @@ +"""Pure-C 3DS-inspired NDS dialogue geometry tests. + +Use the actual production layout header. Target the *physical* 256x192 +touch LCD independently of original PyMO logical scene dimensions. +""" +from pathlib import Path +import shutil +import subprocess +import tempfile +import unittest + +ROOT=Path(__file__).resolve().parents[3] +SRC=ROOT/"cpymo-backends/nds/source" + +PROGRAM=r""" +#include "dual-layout-nds.h" +#include +#include + +static void test_placement(float logical_h,float msg_h,float font, + float off,int name,float scale,float letterbox){ + float delta=nds_dual_dialogue_shift(logical_h,msg_h,font,off,name,scale,letterbox); + float top=logical_h-msg_h-(name?(font*1.4f+off):0.f); + float position=(top+delta)*scale+letterbox; + float bottom=(logical_h+delta)*scale+letterbox; + assert(isfinite(delta)); + assert(position>=12.9f && position<=15.1f); + assert(bottom<=185.1f); +} +int main(void){ + test_placement(360.f,90.f,26.f,0.f,1,192.f/360.f,0.f); + test_placement(240.f,60.f,20.f,0.f,1,192.f/240.f,0.f); + test_placement(360.f,90.f,26.f,18.f,1,192.f/360.f,0.f); + test_placement(360.f,90.f,26.f,0.f,0,192.f/360.f,0.f); + /* Letterbox y differs when logical aspect ratio exceeds 4:3. */ + test_placement(200.f,50.f,16.f,0.f,1,256.f/480.f, + (192.f-200.f*(256.f/480.f))/2); + /* An overlarge game-authored textbox must not be shifted into clipping. */ + assert(nds_dual_dialogue_shift(192.f,190.f,14.f,0.f,1,1.f,0.f)==0.f); + assert(nds_dual_dialogue_shift(360.f,90.f,26.f,0.f,1,0.f,0.f)==0.f); + return 0; +} +""" +@unittest.skipUnless(shutil.which("gcc"),"GCC unavailable") +class NDSDualLayoutTests(unittest.TestCase): + def test_dialogue_geometry_and_preserve_oversized(self): + with tempfile.TemporaryDirectory() as folder: + folder=Path(folder) + source=folder/"layout.c" + source.write_text(PROGRAM,encoding="utf-8") + binary=folder/"layout" + subprocess.run(["gcc","-std=c11","-O2","-Wall","-Wextra","-Werror", + "-fsanitize=undefined","-I",str(SRC), + str(source),"-lm","-o",str(binary)], + check=True,capture_output=True,text=True) + subprocess.run([str(binary)],capture_output=True, + text=True,check=True) + +if __name__=="__main__": + unittest.main() diff --git a/cpymo-tool/nds-converter/tests/test_nds_dual_touch.py b/cpymo-tool/nds-converter/tests/test_nds_dual_touch.py new file mode 100644 index 00000000..1ce1fa30 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_nds_dual_touch.py @@ -0,0 +1,99 @@ +"""Native three-state DS touch routing regression. + +Compiles the SAME dual-input-nds.h C used by the ARM9 input callback: +classic upper touch=A; classic lower true PyMO coordinates; 3DS-style +enhanced lower menu/choice hit-tests; stylus wake/touch lockout. +""" +from pathlib import Path +import shutil +import subprocess +import tempfile +import unittest + +SRC=Path(__file__).resolve().parents[3]/"cpymo-backends/nds/source" +CODE=r""" +#include "dual-input-nds.h" +#include +#include +#include +#define CHECK(x) assert(x) +static nds_touch_sample project(unsigned mode,unsigned visible,unsigned ui, + unsigned choice,unsigned held,unsigned block, + unsigned key_a,int x,int y, + float scale,float lx,float ly){ + return nds_touch_project(mode,visible,ui,choice,held,block,key_a, + x,y,scale,lx,ly); +} +int main(void){ + /* Classic top uses the physically touched helper as NEXT, not x/y input. + The auxiliary screen cannot accidentally select an invisible option. */ + nds_touch_sample s=project(0,0,1,1,1,0,0,144,100,.8f,0,0); + CHECK(s.ok==1 && !s.mouse_button && s.x==0 && s.y==0); + /* Classic bottom scales letterboxed 320x240 coordinates exactly. */ + s=project(1,0,0,0,1,0,0,128,96,.8f,0,0); + CHECK(!s.ok && s.mouse_button && s.x==160 && s.y==120); + /* Enhanced scene top + authored menu elements bottom. */ + s=project(2,1,1,0,1,0,0,128,96,.8f,0,0); + CHECK(!s.ok && s.mouse_button && s.x==160 && s.y==120); + /* Enhanced choices below use the same author-native hit targets. */ + s=project(2,1,0,1,1,0,0,128,96,.8f,0,0); + CHECK(!s.ok && s.mouse_button && s.y==120); + /* Enhance narrative only: tap anywhere to advance; no phantom mouse. */ + s=project(2,1,0,0,1,0,0,128,96,.8f,0,0); + CHECK(s.ok && !s.mouse_button); + /* Hidden sub LCD is NOT a usable interactive game screen. A wake-up + contact is blocked by nds_aux_poll, regardless of its old coordinates. */ + s=project(2,0,1,1,1,1,0,128,96,.8f,0,0); + CHECK(!s.ok && !s.mouse_button); + /* L mode-cycle while a stylus is already held: blocked contact is + ignored until release, no accidental on-release choice click. */ + s=project(1,0,1,1,1,1,0,128,96,.8f,0,0); + CHECK(!s.ok && !s.mouse_button); + /* Handheld A remains functional even when touch is blocked. */ + s=project(2,1,0,0,1,1,1,100,50,.8f,0,0); + CHECK(s.ok==1 && !s.mouse_button); + /* Nonzero letterbox offsets are removed in physical 256x192 pixels. */ + s=project(2,1,1,0,1,0,0,128,96,.5f,8.f,20.f); + CHECK(s.mouse_button && fabsf(s.x-240.f)<.01f && + fabsf(s.y-152.f)<.01f); + /* All absent input yields a completely inert neutral snapshot. */ + s=project(1,1,1,1,0,0,0,128,96,1.f,0,0); + CHECK(!s.ok && !s.mouse_button); + /* The same held stylus cannot become a fresh menu/choice click merely + because an interpreter state changed during this contact. */ + nds_touch_role_tracker state={0}; + CHECK(nds_touch_role_step(&state,0,0)==0); + CHECK(nds_touch_role_step(&state,0,1)==0); /* narrative begins */ + CHECK(nds_touch_role_step(&state,1,1)==2); /* narrative -> choice */ + CHECK(nds_touch_role_step(&state,1,1)==0); /* remains blocked by caller */ + CHECK(nds_touch_role_step(&state,1,0)==0); /* lift clears global block */ + CHECK(nds_touch_role_step(&state,1,1)==0); /* fresh menu tap allowed */ + CHECK(nds_touch_role_step(&state,0,0)==1); /* UI -> story on release */ + CHECK(nds_touch_role_step(&state,0,1)==0); /* next story tap allowed */ + CHECK(nds_touch_role_step(&state,1,0)==1); /* pen lifted on role edge */ + CHECK(nds_touch_role_step(&state,0,0)==0); /* no contact, no block */ + CHECK(nds_touch_role_step(&state,1,1)==0); /* fresh tap after UI opens */ + CHECK(nds_touch_role_step(NULL,0,1)==0); + /* Real modes 0 and 1 remain invariant across UI/selection changes. */ + for(unsigned mode=0;mode<2;mode++){ + unsigned expected=mode==1; + for(unsigned ui=0;ui<2;ui++) + for(unsigned choice=0;choice<2;choice++) + CHECK(nds_touch_uses_coordinates(mode,1,ui,choice)==expected); + } + return 0; +} +""" + +@unittest.skipUnless(shutil.which("gcc"),"Host GCC unavailable") +class NDSDualTouchTests(unittest.TestCase): + def test_real_three_mode_projection_and_touch_block(self): + with tempfile.TemporaryDirectory() as folder: + root=Path(folder) + src=root/"check.c";src.write_text(CODE,encoding="utf-8") + exe=root/"check" + subprocess.run(["gcc","-std=c11","-O2","-Wall","-Wextra","-Werror", + "-fsanitize=undefined","-I",str(SRC),str(src), + "-lm","-o",str(exe)],check=True, + capture_output=True,text=True) + subprocess.run([str(exe)],check=True,capture_output=True,text=True) diff --git a/cpymo-tool/nds-converter/tests/test_nds_fvds_release_gate.py b/cpymo-tool/nds-converter/tests/test_nds_fvds_release_gate.py new file mode 100644 index 00000000..e0cb361d --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_nds_fvds_release_gate.py @@ -0,0 +1,76 @@ +"""Temporary publication hold for the unlicensed-source-derived FVDS decoder. + +This is intentionally an engineering guard, NOT a legal provenance proof: +renaming a file will not cure a licence problem. Once explicit permission +or a reviewed independent replacement exists, update this test together +with RELEASE-LICENSE-GATE-1.2.md and its documentary evidence. +""" +from pathlib import Path +import unittest + +ROOT = Path(__file__).resolve().parents[3] +NDS = ROOT / "cpymo-backends" / "nds" +SRC = NDS / "source" +TOOL = ROOT / "cpymo-tool" / "nds-converter" + +# Files from the private DeepSeek decoder handoff, NOT published source. +# In particular fvds-vlc-tables.h was mechanically created by parsing the +# unlicensed upstream Gericom.FastVideoDS/VlcTables.cs. +REVIEW_HOLD = ( + SRC / "fvds-vlc-tables.h", + SRC / "fvds-vlc-nds.c", + SRC / "fvds-vlc-nds.h", + SRC / "fvds-idct-nds.c", + SRC / "fvds-idct-nds.h", + SRC / "fvds-video-nds.c", + SRC / "fvds-video-nds.h", + NDS / "tools" / "fvds-video-dump.c", + TOOL / "tests" / "test_fvds_coefficients.py", +) + +# A manually renamed copy of the exact generated table should also be +# rejected. This cannot detect every derivative implementation and does not +# replace human review or an upstream licence grant. +VENDOR_TABLE_SIGNATURES = ( + "nds_fvds_vlc_bias[224]", + "nds_fvds_vlc_offset[4097]", + "TableARefLinear", + "Gericom.FastVideoDS/VlcTables.cs", +) + +# Private film assets must not be committed even as test fixtures. +PRIVATE_FILM_NAMES = { + "full-j1.fv", "source_n2_opening.mp4", + "source_n2_opening.fv", +} + +class NDSFVDSPublicReleaseGate(unittest.TestCase): + def test_quarantined_decoder_files_not_in_public_tree(self): + leaked = [str(path.relative_to(ROOT)) for path in REVIEW_HOLD if path.exists()] + self.assertEqual(leaked, [], "Unreviewed FVDS decoder imported into public tree: " + + ", ".join(leaked)) + + def test_generated_vendor_table_signature_not_present_in_nds_source(self): + hits = [] + for path in SRC.glob("*"): + if path.suffix not in (".c", ".h", ".py"): + continue + text = path.read_text(encoding="utf-8", errors="replace") + for token in VENDOR_TABLE_SIGNATURES: + if token in text: + hits.append(f"{path.name}:{token}") + self.assertEqual(hits, [], "Vendor-derived FVDS table marker(s) in source: " + + ", ".join(hits)) + + def test_user_private_media_not_shipped_as_source_fixtures(self): + roots = (NDS, TOOL / "tests") + matches = [] + for root in roots: + for path in root.rglob("*"): + if path.is_file() and path.name.lower() in PRIVATE_FILM_NAMES: + matches.append(str(path.relative_to(ROOT))) + self.assertEqual(matches, [], "Private movie data in public repo: " + + ", ".join(matches)) + +if __name__ == "__main__": + unittest.main() diff --git a/cpymo-tool/nds-converter/tests/test_nds_help_guide.py b/cpymo-tool/nds-converter/tests/test_nds_help_guide.py new file mode 100644 index 00000000..2cb18b4b --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_nds_help_guide.py @@ -0,0 +1,76 @@ +"""Regression for the 1.2 owner-approved help text and unmodified LCD landmarks. + +This intentionally checks the authored help layout rather than rasterizing a +different font or pretending to be a physical-screen capture. The NDS SDK +build still validates compilation with all four actual interface languages. +""" +from pathlib import Path +import re +import unittest + +ROOT = Path(__file__).resolve().parents[3] +SOURCE = ROOT / "cpymo-backends/nds/source" + + +class NDSHelpGuideTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.launcher = (SOURCE / "launcher.h").read_text(encoding="utf-8") + cls.panel = cls.launcher.split("static void launcher_play_panel(", 1)[1].split( + "static void nds_clock_poll(", 1 + )[0] + cls.i18n = (SOURCE / "ui-language-nds.c").read_text(encoding="utf-8") + cls.extra = (SOURCE / "ui-language-extra.h").read_text(encoding="utf-8") + + def test_guide_has_owner_approved_controller_labels(self): + panel = self.panel + for msg in ("A / DOWN:继续", "UP:历史对话", "X:菜单 · B:返回", + "B:按住隐藏文字", "Y:隐藏/唤回辅助屏", + "R:快进 · L:切换显示模式", + "上屏游戏 / 下屏游戏 / 增强双屏", + "START:快速保存 SELECT:快速读取"): + self.assertIn(f'nds_ui("{msg}")', panel, msg) + self.assertNotRegex(panel, r'%u/3|[123]/3') + self.assertNotIn("存档1", panel) + self.assertIn('launcher_text(message&&*message?nds_ui(message):nds_runtime_mode_label(),', panel) + self.assertNotIn('launcher_text(nds_ui("SELECT:快速读取")', panel) + self.assertNotIn('显示、字号、音量:X 菜单', panel) + + def test_landmarks_and_conservative_clip_areas_unchanged(self): + panel = self.panel + self.assertIn("launcher_game_icon(&launcher_games[launcher_selected],196,40,true)", panel) + self.assertIn("nds_clock_paint_impl(framebuffer,196,96,", panel) + positions = re.findall( + r'launcher_text\(nds_ui\("([^"]+)"\),12,(\d+),(?:white|accent|muted),(\d+)\)', + panel + ) + self.assertEqual([int(y) for _, y, _ in positions], + [32, 50, 68, 86, 104, 122, 140, 158, 32, 50, 68, 86, 104, 122]) + for _, y, max_x in positions: + if int(y) < 114: + self.assertLessEqual(int(max_x), 183) + else: + self.assertLessEqual(int(max_x), 245) + self.assertIn('12,176,message&&*message?accent:muted,245)', panel) + + def test_translation_index_count_and_no_missing_new_keys(self): + source = self.i18n + section = source.split("static const struct", 1)[1].split( + '#include "ui-language-extra.h"', 1 + )[0] + pair_count = len(re.findall(r'\{"(?:[^"\\]|\\.)*","(?:[^"\\]|\\.)*"\}', section)) + self.assertEqual(pair_count, 89) + self.assertIn("extra_ui[2][89]", self.extra) + for value in ("A / DOWN:继续", "UP:历史对话", + "R:快进 · L:切换显示模式", + "上屏游戏 / 下屏游戏 / 增强双屏", + "START:快速保存 SELECT:快速读取", "SELECT:快速读取"): + self.assertIn(f'{{"{value}",', section) + cht = '{"正在讀取' + self.extra.split('{"正在讀取', 1)[1].split('{"ゲーム一覧', 1)[0] + jap = '{"ゲーム一覧' + self.extra.split('{"ゲーム一覧', 1)[1].split("static error_t jp_saved", 1)[0] + for localized in (cht, jap): + self.assertEqual(len(re.findall(r'"(?:[^"\\]|\\.)*"', localized)), 89) + + +if __name__ == "__main__": + unittest.main() diff --git a/cpymo-tool/nds-converter/tests/test_nds_icon_derivation.py b/cpymo-tool/nds-converter/tests/test_nds_icon_derivation.py new file mode 100644 index 00000000..68589054 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_nds_icon_derivation.py @@ -0,0 +1,92 @@ +"""Protect reproducible NDS-only icon derivation and actual ROM identity gates.""" +import importlib.util +import json +from pathlib import Path +import struct +import tempfile +import unittest +from PIL import Image + +ROOT = Path(__file__).resolve().parents[3] +NDS = ROOT / 'cpymo-backends/nds' + +def load(name, filename): + spec = importlib.util.spec_from_file_location(name, NDS / 'tools' / filename) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + +generator = load('native_icon_generator', 'build_nds_icons.py') +verifier = load('native_icon_verifier', 'verify_nds_icons.py') + +class NdsIconDerivationTests(unittest.TestCase): + def test_committed_outputs_reproduce_from_pinned_source(self): + with tempfile.TemporaryDirectory() as tmp: + target = Path(tmp) + actual = generator.build(NDS / 'assets/icon-source-square.png', target) + expected = json.loads((NDS / 'assets/NDS-ICON-MANIFEST.json').read_text()) + # PNG compression bytes can differ between macOS/Linux zlib builds. + # Pin decoded pixels and dimensions for regeneration, while the + # verifier separately checks the hashes of actual committed files. + self.assertEqual(verifier.verify(NDS)['assets'], 'PASS') + for relative in actual['outputs']: + if relative.endswith('.png'): + a, b = actual['outputs'][relative], expected['outputs'][relative] + self.assertEqual((a['size'], a['rgb_sha256']), (b['size'], b['rgb_sha256'])) + with Image.open(target / relative) as generated, Image.open(NDS / relative) as committed: + self.assertEqual(generated.size, committed.size) + self.assertEqual(generated.convert('RGB').tobytes(), committed.convert('RGB').tobytes()) + else: + self.assertEqual(actual['outputs'][relative], expected['outputs'][relative]) + self.assertEqual((target / relative).read_bytes(), (NDS / relative).read_bytes()) + self.assertEqual({k:v for k,v in actual.items() if k != 'outputs'}, + {k:v for k,v in expected.items() if k != 'outputs'}) + + def test_banner_has_reserved_transparency_and_native_warm_frame(self): + self.assertEqual(verifier.verify(NDS)['assets'], 'PASS') + with Image.open(NDS / 'assets/icon.bmp') as bmp: + self.assertEqual(bmp.size, (32, 32)) + self.assertEqual(bmp.mode, 'P') + self.assertTrue(all(1 <= v <= 15 for v in bmp.get_flattened_data())) + self.assertEqual(len(set(bmp.get_flattened_data())), 15) + for name, side in [('icon.png',32), ('icon-small.png',24), ('icon-splash.png',64)]: + with Image.open(NDS / 'assets' / name) as image: + self.assertEqual(image.size, (side, side)) + self.assertTrue(all(image.getpixel((x,y)) == generator.BORDER_RGB + for y in range(side) for x in range(side) + if x in (0,side-1) or y in (0,side-1))) + + def test_rejects_changed_source_even_if_image_still_decodes(self): + with tempfile.TemporaryDirectory() as tmp: + source = Path(tmp) / 'other.png' + source.write_bytes((NDS / 'assets/icon-source-square.png').read_bytes() + b'changed') + with self.assertRaisesRegex(ValueError, 'source file'): + generator.derive(source) + + def test_rejects_rom_missing_new_high_resolution_resource(self): + images = generator.derive(NDS / 'assets/icon-source-square.png') + data = b'\0' * 0x200 + for name in ('icon.png', 'icon-small.png'): + values = generator.pixels(images[name]) + data += struct.pack('<' + str(len(values)) + 'H', *values) + with tempfile.TemporaryDirectory() as tmp: + rom = Path(tmp) / 'old-resources.nds' + rom.write_bytes(data) + with self.assertRaisesRegex(ValueError, 'app_icon_splash'): + verifier.verify(NDS, rom) + + def test_rejects_banner_not_matching_compiled_runtime_icon(self): + images = generator.derive(NDS / 'assets/icon-source-square.png') + data = bytearray(0x200 + 0x840) + struct.pack_into('=33&&t.py<157",LAUNCHER) + for y in (156,174): + self.assertRegex(LAUNCHER,rf"launcher_text\([^;]+,7,{y},") + self.assertGreaterEqual(156-(33+3*31+28),2) + self.assertGreaterEqual(192-(174+16),2) + self.assertEqual(174-156,18) + def test_splash_uses_saved_language_before_first_render(self): + main=MAIN[MAIN.index("int main(int argc,char** argv)"):] + self.assertLess(main.index("fatInitDefault()"),main.index("nds_language_load()")) + self.assertLess(main.index("nds_language_load()"),main.index("launcher_show_splash()")) + self.assertIn('nds_ui("正在读取游戏列表...")',LAUNCHER) + def test_all_enhanced_locales_explain_down_without_new_arrow_glyph(self): + self.assertIn('nds_ui("A / DOWN / 轻触:继续")',MAIN) + self.assertIn('{"A / DOWN / 轻触:继续","A / DOWN / Touch: Next"}',L10N) + self.assertIn('"A / DOWN / 輕觸:繼續"',EXTRA) + self.assertIn('"A / DOWN / タッチ: 進む"',EXTRA) + self.assertNotIn('nds_ui("A / 轻触:继续")',MAIN) + +if __name__=="__main__": + unittest.main() diff --git a/cpymo-tool/nds-converter/tests/test_nds_picture_bg.py b/cpymo-tool/nds-converter/tests/test_nds_picture_bg.py new file mode 100644 index 00000000..cd0e919c --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_nds_picture_bg.py @@ -0,0 +1,104 @@ +"""ROM-owned CPyMO 1.2 enhanced touch-screen artwork regression. + +No per-card external bitmap is required: immutable bytes are patched into the +ROM's fixed-size ARM9 placeholder. Verify safe unpatched fallback, low-contrast +UI RGB555 dimming, and deterministic no-relocation ROM injection. +""" +from pathlib import Path +import importlib.util +import shutil +import struct +import subprocess +import tempfile +import unittest + +ROOT = Path(__file__).resolve().parents[3] +SRC = ROOT / "cpymo-backends/nds/source" +PATCHER = ROOT / "cpymo-backends/nds/tools/patch-rom-bg.py" +spec = importlib.util.spec_from_file_location("patch_rom_bg", PATCHER) +patcher = importlib.util.module_from_spec(spec) +spec.loader.exec_module(patcher) + +C_PROGRAM = r""" +#include +#include +#include +#include "nds-picture-bg.h" +int main(void) { + uint16_t pixels[NDS_PICTURE_PIXELS] = {0}; + /* An unpatched developer build should never display staging pixels. */ + assert(nds_picture_get() == 0); + assert(!nds_picture_draw(pixels, false)); + assert(!nds_picture_draw(pixels, true)); + assert(nds_picture_dim_color(0x8000) == 0x8000); + assert(nds_picture_dim_color(0xffff) == (0x8000 | 23 | (23<<5) | (23<<10))); + assert(nds_picture_dim_color(0x801f) == (0x8000 | 23)); + return 0; +} +""" + +@unittest.skipUnless(shutil.which("gcc"), "host GCC unavailable") +class EmbeddedPictureTests(unittest.TestCase): + def test_unpatched_fallback_and_rgb555_dimming(self): + with tempfile.TemporaryDirectory() as folder: + folder=Path(folder) + src=folder/"test.c" + src.write_text(C_PROGRAM,encoding="utf8") + exe=folder/"test" + cmd=["gcc","-std=gnu11","-O2","-Wall","-Wextra","-Werror", + "-fsanitize=undefined","-I",str(SRC),str(src),"-o",str(exe)] + run=subprocess.run(cmd,capture_output=True,text=True) + self.assertEqual(run.returncode,0,run.stderr) + subprocess.run([str(exe)],capture_output=True,text=True,check=True) + + def test_inplace_patch_in_rom_and_reject_corruption(self): + with tempfile.TemporaryDirectory() as folder: + folder=Path(folder) + image=(b"\x01\x80")*(256*192) + art=folder/"art.rgb555" + art.write_bytes(patcher.ART_MAGIC+image) + mark=patcher.WAIT+patcher.PLACEHOLDER + raw=bytearray(0x200+len(mark)+64) + struct.pack_into(" +#include +#include +#define CHECK(expr) do{if(!(expr))abort();}while(0) +int main(int argc,char**argv){ + if(argc!=2)return 2; + const char* game=argv[1]; + char savepath[768]; + snprintf(savepath,sizeof savepath,"%s/save",game); + struct stat st; + CHECK(stat(savepath,&st)!=0); + CHECK(nds_save_fopen(game,"save-01.csav","rb")==NULL); + FILE *f=nds_save_fopen(game,"save-01.csav","wb"); + CHECK(f!=NULL); + CHECK(fwrite("good",1,4,f)==4); + CHECK(fclose(f)==0); + CHECK(stat(savepath,&st)==0 && S_ISDIR(st.st_mode)); + f=nds_save_fopen(game,"save-01.csav","rb"); + CHECK(f!=NULL); + char bytes[5]={0}; + CHECK(fread(bytes,1,4,f)==4 && !strcmp(bytes,"good")); + CHECK(fclose(f)==0); + /* Re-creating an existing directory must not clobber its saves. */ + CHECK(nds_save_ensure_directory(game)); + f=nds_save_fopen(game,"save-01.csav","rb"); + CHECK(f!=NULL); + CHECK(fread(bytes,1,4,f)==4 && !strcmp(bytes,"good")); + CHECK(fclose(f)==0); + CHECK(nds_save_fopen(game,"nds-ui.cfg","wb")!=NULL); + return 0; +} +""" +@unittest.skipUnless(shutil.which("gcc"),"GCC unavailable") +class NDSSaveFolderTests(unittest.TestCase): + def test_auto_mkdir_and_existing_slot_preserved(self): + with tempfile.TemporaryDirectory() as temp: + root=Path(temp) + folder=root/"fixture game";folder.mkdir() + code=root/"test.c";code.write_text(PROGRAM,encoding="utf-8") + exe=root/"test" + subprocess.run(["gcc","-std=c11","-O2","-Wall","-Wextra","-Werror", + "-I",str(SOURCE),str(code),"-o",str(exe)], + capture_output=True,text=True,check=True) + subprocess.run([str(exe),str(folder)],capture_output=True,text=True,check=True) + self.assertEqual((folder/"save/save-01.csav").read_bytes(),b"good") + diff --git a/cpymo-tool/nds-converter/tests/test_nds_title_gate.py b/cpymo-tool/nds-converter/tests/test_nds_title_gate.py new file mode 100644 index 00000000..67dc3d98 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_nds_title_gate.py @@ -0,0 +1,71 @@ +"""Hardware-neutral regression: startup/title stays fully upper until dialogue. + +This is a deliberately limited opening-scene state machine. It does not +attempt to identify game-specific MENU or START filenames, modify scripts, +or remap touch/gamepad controls. The first true narrative say takes over. +""" +from pathlib import Path +import shutil +import subprocess +import tempfile +import unittest + +ROOT=Path(__file__).resolve().parents[3] +SOURCE=ROOT/'cpymo-backends/nds/source' +PROGRAM=r""" +#include "dual-title-nds.h" +#include +#define CHECK(x) do{if(!(x))abort();}while(0) +int main(void){ + nds_dual_title_gate gate={0}; + nds_dual_title_reset(&gate); + CHECK(!nds_dual_title_allow_split(&gate)); + CHECK(!nds_dual_title_observe(&gate,0,0,0)); /* boot splash */ + CHECK(!nds_dual_title_observe(&gate,0,0,1)); /* title selection */ + CHECK(!nds_dual_title_observe(&gate,0,1,0)); /* menu/settings */ + CHECK(!nds_dual_title_observe(&gate,1,1,0)); /* modal UI */ + CHECK(!nds_dual_title_observe(&gate,1,0,1)); /* choice before story */ + CHECK(!nds_dual_title_allow_split(&gate)); + CHECK(nds_dual_title_observe(&gate,1,0,0)); /* first real story say */ + CHECK(nds_dual_title_allow_split(&gate)); + CHECK(!nds_dual_title_observe(&gate,0,1,0)); /* later X menu */ + CHECK(nds_dual_title_allow_split(&gate)); + CHECK(!nds_dual_title_observe(&gate,1,0,0)); /* not twice */ + nds_dual_title_reset(&gate); /* a newly launched or restarted game */ + CHECK(!nds_dual_title_allow_split(&gate)); + CHECK(!nds_dual_title_observe(&gate,0,0,1)); /* title selection again */ + CHECK(nds_dual_title_observe(&gate,1,0,0)); /* next story */ + CHECK(nds_dual_title_allow_split(&gate)); + return 0; +} +""" + + +@unittest.skipUnless(shutil.which('gcc'),"C host compiler unavailable") +class NDSTitleGateTests(unittest.TestCase): + def test_startup_then_story_state_machine(self): + with tempfile.TemporaryDirectory() as temp: + root=Path(temp) + test=root/'test.c' + test.write_text(PROGRAM,encoding='utf-8') + exe=root/'test' + subprocess.run(['gcc','-std=c11','-O2','-Wall','-Wextra','-Werror', + '-fsanitize=undefined','-I',str(SOURCE), + str(test),'-o',str(exe)],check=True,capture_output=True,text=True) + subprocess.run([str(exe)],check=True,capture_output=True,text=True) + + def test_integration_keeps_touch_and_lcd_semantics(self): + dual=(SOURCE/'dual-screen-nds.h').read_text(encoding='utf-8') + backend=(SOURCE/'main.c').read_text(encoding='utf-8') + self.assertIn('nds_dual_title_reset(&nds_title_gate);',dual) + self.assertIn('nds_dual_title_allow_split(&nds_title_gate)',dual) + self.assertIn('nds_dual_title_observe(&nds_title_gate',backend) + self.assertIn('engine.say.active,cpymo_ui_enabled(&engine)',backend) + self.assertIn('nds_display_mode==2',backend) + self.assertIn('nds_aux_refresh();',backend) + self.assertIn('nds_touch_project(nds_display_mode,',backend) + self.assertIn('nds_dual_has_choice()',dual) + self.assertIn('if(next==1){lcdSwap();screens_swapped=true;}',dual) + + +if __name__=='__main__':unittest.main() diff --git a/cpymo-tool/nds-converter/tests/test_nds_ui_font_coverage.py b/cpymo-tool/nds-converter/tests/test_nds_ui_font_coverage.py new file mode 100644 index 00000000..fbd56986 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_nds_ui_font_coverage.py @@ -0,0 +1,105 @@ +"""ROM UI must render in every game, not rely on a novel's font subset. + +Regression for the confirmed DSi symptoms: + 简体中文: 上屏游戏 / 下屏游戏 / ???屏 + 日本語: 上画面 / 下画面 / ?化2画面 +""" +from pathlib import Path +import ast +import re +import unittest + +ROOT=Path(__file__).resolve().parents[3] +NDS=ROOT/'cpymo-backends/nds/source' + + +def source_ui_codepoints(): + """Read the converter's literal set without importing Pillow on UI CI.""" + code=(ROOT/'cpymo-tool/nds-converter/convert.py').read_text(encoding='utf-8') + numeric=set() + for node in ast.parse(code).body: + if not isinstance(node,ast.Assign) or not any( + isinstance(t,ast.Name) and t.id=='UI_CODEPOINTS' + for t in node.targets): + continue + if isinstance(node.value,ast.Tuple): + numeric.update(int(t.value) for t in node.value.elts + if isinstance(t,ast.Constant) and isinstance(t.value,int)) + else: + for expr in ast.walk(node.value): + if isinstance(expr,ast.Constant) and isinstance(expr.value,str): + numeric.update(map(ord,expr.value)) + return numeric + +UI_CODEPOINTS=source_ui_codepoints() + +CJK_LABELS=( + '上屏游戏 / 下屏游戏 / 增强双屏', + '上屏遊戲 / 下屏遊戲 / 增強雙屏', + '上画面 / 下画面 / 強化2画面', +) +LANG_FILES=('launcher.h','ui-language-nds.c','ui-language-extra.h') + + +class RomUIFontCoverageTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + raw=(NDS/'ui-fallback-font.h').read_text(encoding='utf-8') + blocks={} + patterns={ + 'codes':r'ui_fallback_codes\[\]=\{([^}]+)\}', + 's_adv':r'ui_fallback_advances\[\]=\{([^}]+)\}', + 'l_adv':r'ui_large_advances\[\]=\{([^}]+)\}', + 's_rows':r'ui_fallback_rows\[\]\[16\]=\{([\s\S]*?)\};', + 'l_rows':r'ui_large_rows\[\]\[16\]=\{([\s\S]*?)\};' + } + for key,pattern in patterns.items(): + match=re.search(pattern,raw) + assert match, key + values=match.group(1) + if key.endswith('rows'): + blocks[key]=[tuple(int(n) for n in row.split(',')) + for row in re.findall(r'\{([0-9,\s]+)\}',values)] + else: + blocks[key]=[int(n) for n in values.split(',')] + cls.table=blocks + cls.codes={c:i for i,c in enumerate(blocks['codes'])} + + def test_arrays_aligned_sorted_and_not_blank(self): + t=self.table + self.assertEqual(len(t['codes']),len(set(t['codes']))) + self.assertEqual(t['codes'],sorted(t['codes'])) + for key in ('s_adv','l_adv','s_rows','l_rows'): + self.assertEqual(len(t[key]),len(t['codes']),key) + for key in ('s_rows','l_rows'): + for rows in t[key]: + self.assertEqual(len(rows),16) + self.assertTrue(all(0<=v<=65535 for v in rows)) + for label in CJK_LABELS: + for c in set(map(ord,label)): + self.assertIn(c,self.codes,'missing codepoint U+%04X'%c) + i=self.codes[c] + if chr(c).strip(): + self.assertTrue(any(self.table['s_rows'][i])) + self.assertTrue(any(self.table['l_rows'][i])) + + def test_all_literal_multi_language_ui_text_is_in_rom(self): + # Includes existing screens and future official UI strings. + for filename in LANG_FILES: + text=(NDS/filename).read_text(encoding='utf-8') + for literal in re.findall(r'"((?:\\.|[^"\\])*)"',text): + for ch in literal: + cp=ord(ch) + if cp>=32: + self.assertIn(cp,self.codes, + f'{filename}: U+{cp:04X} {ch!r} missing from ROM UI font') + + def test_future_converter_caches_contain_new_ui_labels(self): + for label in CJK_LABELS: + for cp in map(ord,label): + self.assertIn(cp,UI_CODEPOINTS, + f'converter will not embed UI glyph U+{cp:04X}') + + +if __name__=='__main__': + unittest.main() diff --git a/cpymo-tool/nds-converter/tests/test_nds_v121_icon.py b/cpymo-tool/nds-converter/tests/test_nds_v121_icon.py new file mode 100644 index 00000000..0cdac76d --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_nds_v121_icon.py @@ -0,0 +1,38 @@ +"""NDS external banner and internal launcher icon must share the full-square art.""" +from pathlib import Path +import re +import unittest +from PIL import Image + +ROOT=Path(__file__).resolve().parents[3] +NDS=ROOT/"cpymo-backends/nds" + +def rgb555(v): + return tuple(((v>>shift)&31)*255//31 for shift in (0,5,10)) + +class NdsV121IconTests(unittest.TestCase): + def test_square_banner_and_internal_icon_identical(self): + with Image.open(NDS/"assets/icon.bmp") as bmp, Image.open(NDS/"assets/icon.png") as png: + self.assertEqual(bmp.size,(32,32)) + self.assertEqual(bmp.mode,"P") + self.assertEqual(png.size,(32,32)) + actual=list(bmp.convert("RGB").getdata()) + self.assertEqual(actual,list(png.convert("RGB").getdata())) + self.assertEqual(len(set(actual)),15) + self.assertTrue(all(1<=idx<=15 for idx in bmp.getdata()), + "no rounded transparent corners on the NDS icon") + source=(NDS/"source/app-icon.h").read_text(encoding="utf8") + match=re.search(r"app_icon\[1024\]\s*=\s*\{([^}]+)\}",source,re.S) + self.assertIsNotNone(match) + pixels=[int(x) for x in re.findall(r"\d+",match.group(1))] + self.assertEqual(len(pixels),1024) + self.assertTrue(all(v&0x8000 for v in pixels)) + self.assertEqual([rgb555(v) for v in pixels],actual) + def test_release_language_precise(self): + self.assertEqual((NDS/"VERSION").read_text().strip(),"1.3.0") + notes=(NDS/"RELEASE-NOTES-1.3.0.md").read_text(encoding="utf8") + self.assertIn("NDS 程序及配套转换器图标焕新",notes) + self.assertIn("配套游戏转换器",notes) + +if __name__=="__main__": + unittest.main() diff --git a/cpymo-tool/nds-converter/tests/test_nds_v121_theme_title.py b/cpymo-tool/nds-converter/tests/test_nds_v121_theme_title.py new file mode 100644 index 00000000..63eb8699 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_nds_v121_theme_title.py @@ -0,0 +1,153 @@ +"""v1.2.1: host-level guards for themes, title help and rendering.""" +from pathlib import Path +import re +import unittest + +ROOT=Path(__file__).resolve().parents[3] +SRC=ROOT/"cpymo-backends/nds/source" +def load(name):return (SRC/name).read_text(encoding="utf8") + +class NdsV121Tests(unittest.TestCase): + def test_ipl_favorite_colors_exact(self): + theme=load("theme-nds.h") + match=re.search(r'nds_ipl_theme_rgb\[16\]\[3\]=\{(.*?)\};',theme,re.S) + self.assertIsNotNone(match) + rgb=[tuple(map(int,x)) for x in re.findall(r'\{(\d+),(\d+),(\d+)\}',match.group(1))] + self.assertEqual(rgb,[ + (12,16,19),(23,9,0),(31,0,3),(31,17,31), + (31,18,0),(30,28,0),(21,31,0),(0,31,0), + (0,20,7),(9,27,17),(6,23,30),(0,11,30), + (0,0,18),(17,0,26),(26,0,29),(31,0,18)]) + self.assertIn('PersonalData->theme',theme) + self.assertIn('/pymo/nds-theme.cfg',theme) + def test_launcher_shortcuts(self): + launcher=load("launcher.h") + for text in ('if(down&(KEY_A|KEY_START))start=true;', + 'if(down&KEY_Y){launcher_theme_menu', + 'nds_ui("A / START 启动 · 轻触两次启动")', + 'nds_ui("上下选择 · B 关于 · X 语言 · Y 主题")', + 'launcher_rect(x,y,57,21,nds_theme_color(i))'): + self.assertIn(text,launcher) + def test_title_help_and_alpha_rounding(self): + launcher=load("launcher.h") + main=load("main.c") + self.assertIn('nds_dual_title_allow_split(&nds_title_gate)',launcher) + self.assertIn('nds_ui("UP / DOWN:选择项目")',launcher) + self.assertIn('nds_ui("L:切换显示模式")',launcher) + self.assertIn('else if(!debug_trace)launcher_play_panel(NULL)',main) + self.assertIn('0x4010u',main) + self.assertIn('0x0200u',main) + + def test_nondefault_colors_are_true_theme_families(self): + theme=load("theme-nds.h");launcher=load("launcher.h") + self.assertIn('nds_theme_tint(unsigned idx,unsigned strength,unsigned neutral)',theme) + self.assertIn('RGB15(3,5,8),RGB15(5,10,16),RGB15(4,7,11),RGB15(7,15,23)',theme) + self.assertIn('nds_theme_tint(i,6,1),nds_theme_tint(i,11,3)',theme) + self.assertIn('nds_theme_tint(i,9,3),nds_theme_tint(i,11,4)',theme) + self.assertIn('RGB15(15,26,30)};',theme) # approved Default B rail + self.assertIn('nds_theme_tint(i,13,17),RGB15(30,30,30)',theme) + self.assertIn('nds_theme_tint(i,3,23),nds_theme_tint(i,3,24)',theme) + self.assertIn('nds_theme_tint(i,2,24),nds_theme_tint(i,3,23)',theme) + self.assertIn('u16 white=nds_theme_primary(),muted=nds_theme_muted(),accent=nds_theme_accent();',launcher) + self.assertNotIn('launcher_theme_header_trim',launcher) + self.assertNotIn('launcher_rect(6,y,3,28',launcher) + self.assertIn('if(index==launcher_selected)launcher_rect(6,y,2,28,nds_theme_rail());',launcher) + mat=re.search(r'nds_ipl_theme_rgb\[16\]\[3\]=\{(.*?)\};',theme,re.S) + colors=[tuple(map(int,m)) for m in re.findall(r'\{(\d+),(\d+),(\d+)\}',mat.group(1))] + self.assertEqual(len(colors),16) + def tinted(c,s,n):return tuple(n+(v*s+15)//31 for v in c) + def luminance(rgb): + def linear(c): + x=c/31 + return x/12.92 if x<=.04045 else ((x+.055)/1.055)**2.4 + return sum(weight*linear(x) for weight,x in zip((.2126,.7152,.0722),rgb)) + for c in colors: + primary=(30,30,30);selected=tinted(c,11,4) + self.assertGreaterEqual((luminance(primary)+.05)/(luminance(selected)+.05),4.5) + for strength,neutral in ((6,1),(11,3),(9,3),(11,4),(13,17), + (3,23),(3,24),(2,24),(13,13)): + self.assertTrue(all(0<=v<=31 for v in tinted(c,strength,neutral))) + red=tinted(colors[2],6,1) + self.assertGreater(red[0],red[2]) + def test_auto_palette_is_cached_across_all_redraws(self): + theme=load("theme-nds.h");launcher=load("launcher.h") + self.assertIn('static int nds_theme_effective_index=-1;',theme) + self.assertIn('static int nds_theme_active_index(void){return nds_theme_effective_index;}',theme) + self.assertEqual(theme.count('nds_theme_firmware()'),1) + self.assertIn('if(ok){nds_theme_preference=v;nds_theme_resolve();}',theme) + self.assertIn('const u16 color=nds_theme_bg()|BIT(15)',launcher) + self.assertIn('static u16 nds_theme_bg(void){return nds_theme_scheme.bg;}',theme) + def test_auto_firmware_snapshot_on_host(self): + import shutil,subprocess,tempfile + if not shutil.which("gcc"):self.skipTest("gcc unavailable") + program=r""" +#include +#include +#include +#include +typedef uint16_t u16; +#define RGB15(r,g,b) ((u16)((r)|((g)<<5)|((b)<<10))) +struct FakeEnv { unsigned version; }; +struct FakePersonal { unsigned settingsLost,theme; }; +static struct FakeEnv env={5}; +static struct FakePersonal pd={0,2}; +static struct FakeEnv* g_envUserSettings=&env; +static struct FakePersonal* PersonalData=&pd; +static const char* nds_ui(const char* text){return text;} +static int nds_language_effective(void){return 0;} +#include "theme-nds.h" +int main(void){ + nds_theme_preference=0;nds_theme_resolve(); + assert(nds_theme_bg()==RGB15(3,5,8)); + assert(nds_theme_primary()==RGB15(31,31,31)); + assert(nds_theme_rail()==RGB15(15,26,30)); + nds_theme_preference=1;nds_theme_resolve(); + assert(nds_theme_active_index()==2); + const u16 first=nds_theme_bg(); + pd.theme=7; + for(int i=0;i<100000;i++)assert(nds_theme_bg()==first); + assert(nds_theme_active_index()==2); + nds_theme_resolve(); + assert(nds_theme_active_index()==7); + assert(nds_theme_bg()!=first); + for(unsigned i=0;i<16;i++){ + nds_theme_preference=i+2;nds_theme_resolve(); + assert(nds_theme_active_index()==(int)i); + assert(nds_theme_primary()==RGB15(30,30,30)); + assert(nds_theme_accent()==nds_theme_tint(i,13,17)); + assert(nds_theme_muted()==nds_theme_tint(i,3,23)); + assert(nds_theme_detail()==nds_theme_tint(i,3,24)); + assert(nds_theme_clock_ink()==nds_theme_tint(i,2,24)); + assert(nds_theme_aux_clock_ink()==nds_theme_tint(i,3,23)); + assert(nds_theme_rail()==nds_theme_tint(i,13,13)); + } + pd.settingsLost=1;nds_theme_preference=1;nds_theme_resolve(); + assert(nds_theme_active_index()==-1); + return 0; +} +""" + with tempfile.TemporaryDirectory() as td: + from pathlib import Path + p=Path(td);(p/"calico/nds").mkdir(parents=True) + (p/"calico/nds/env.h").write_text("/* host shim */\n",encoding="utf8") + (p/"main.c").write_text(program,encoding="utf8") + subprocess.run(["gcc","-std=c11","-O2","-Wall","-Wextra","-Werror", + "-Wno-unused-function","-fsanitize=undefined", + "-I",str(p),"-I",str(SRC), + str(p/"main.c"),"-o",str(p/"program")], + check=True,capture_output=True,text=True) + subprocess.run([str(p/"program")],check=True,capture_output=True,text=True) + def test_default_and_auto_labels_are_centered(self): + launcher=load("launcher.h") + self.assertIn('launcher_text_pixel_width(',launcher) + self.assertIn('launcher_text_centered(nds_theme_choice_name(i),x,w,36,white)',launcher) + self.assertNotIn('nds_theme_choice_name(i),x+30',launcher) + def test_restart_callback_rearms_title_guide(self): + main=load("main.c");rmenu=load("cpymo_rmenu.c") + self.assertIn('if (!err) nds_request_title_guide_reset();',rmenu) + self.assertIn('if(!err&&nds_title_restart_pending)',main) + self.assertIn('nds_dual_title_reset(&nds_title_gate);',main) + self.assertIn('nds_aux_refresh();',main) + +if __name__=="__main__": + unittest.main() diff --git a/cpymo-tool/nds-converter/tests/test_nds_visual_capture.py b/cpymo-tool/nds-converter/tests/test_nds_visual_capture.py new file mode 100644 index 00000000..b600e067 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_nds_visual_capture.py @@ -0,0 +1,89 @@ +"""Check bit-perfect native LCD RGB555 -> PNG conversion with synthetic +pixel fixtures. These are tests only, NEVER presented as rendered game images. +""" +import importlib.util +from pathlib import Path +import struct +import tempfile +import unittest +import zlib + +MODULE=Path(__file__).resolve().parents[3]/"cpymo-backends/nds/tools/nds-capture-to-png.py" +SPEC=importlib.util.spec_from_file_location("nds_capture_to_png",MODULE) +capture=importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(capture) + + +def fixture(kind=1): + # Top: true RGB555 red / green alternating; bottom: blue/black. + red=0x801f + green=0x83e0 + blue=0xfc00 + top=struct.pack("I",blob,pos)[0] + tag=blob[pos+4:pos+8] + data=blob[pos+8:pos+8+length] + crc=struct.unpack_from(">I",blob,pos+8+length)[0] + assert zlib.crc32(tag+data)&0xffffffff==crc + pos+=length+12 + if tag==b"IHDR": + width,height=struct.unpack_from(">II",data) + assert data[8:]==bytes((8,2,0,0,0)) + elif tag==b"IDAT": + payload+=data + elif tag==b"IEND": + break + raw=zlib.decompress(payload) + assert (width,height)==(256,192) + assert len(raw)==192*(256*3+1) + assert all(raw[y*(256*3+1)]==0 for y in range(192)) + return b"".join(raw[y*(256*3+1)+1:(y+1)*(256*3+1)] + for y in range(192)) + + +class NativeLCDCaptureTests(unittest.TestCase): + def test_capture_header_and_rgb555_color(self): + kind,(top,bottom)=capture.decode_capture(fixture()) + self.assertEqual(kind,1) + self.assertEqual(top[:6],bytes((255,0,0, 0,255,0))) + self.assertEqual(bottom[:6],bytes((0,0,255, 0,0,0))) + self.assertEqual(parse_png(capture.png_rgb(256,192,top)),top) + self.assertEqual(parse_png(capture.png_rgb(256,192,bottom)),bottom) + + def test_four_capture_kinds_and_screen_order(self): + for kind in (1, 2, 3, 4): + with self.subTest(kind=kind): + actual_kind, (top, bottom) = capture.decode_capture(fixture(kind)) + self.assertEqual(actual_kind, kind) + self.assertEqual(top[:3], bytes((255, 0, 0))) + self.assertEqual(bottom[:3], bytes((0, 0, 255))) + + def test_reject_truncated_and_corrupt(self): + cases=[fixture()[:-1],fixture()+b"x",b"X"+fixture()[1:], + fixture(kind=0),fixture(kind=5),fixture(kind=99)] + for blob in cases: + with self.subTest(length=len(blob)): + with self.assertRaises(ValueError): + capture.decode_capture(blob) + + def test_file_outputs_are_two_separate_native_lcd_pngs(self): + with tempfile.TemporaryDirectory() as d: + path=Path(d)/"nds-capture-dialogue.ndsraw" + path.write_bytes(fixture()) + top,bottom=capture.convert(path) + self.assertEqual(top.name,"nds-capture-dialogue-top.png") + self.assertEqual(bottom.name,"nds-capture-dialogue-bottom.png") + self.assertEqual(parse_png(top.read_bytes())[:3],bytes((255,0,0))) + self.assertEqual(parse_png(bottom.read_bytes())[:3],bytes((0,0,255))) + self.assertEqual(path.read_bytes(),fixture()) diff --git a/cpymo-tool/nds-converter/tests/test_nds_visual_capture_c.py b/cpymo-tool/nds-converter/tests/test_nds_visual_capture_c.py new file mode 100644 index 00000000..5aaad594 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_nds_visual_capture_c.py @@ -0,0 +1,93 @@ +"""Run the actual NDS C framebuffer writer under host GCC (fake libnds types) +and verify its two files against the same native PNG decoder. + +Synthetic pixels ONLY exercise the exporter; never represent visual screenshots +of CPyMO or emulator gameplay. +""" +from pathlib import Path +import importlib.util +import shutil +import subprocess +import tempfile +import unittest + +ROOT=Path(__file__).resolve().parents[3] +SOURCE=ROOT/"cpymo-backends/nds/source" +CONVERTER=ROOT/"cpymo-backends/nds/tools/nds-capture-to-png.py" +SPEC=importlib.util.spec_from_file_location("nds_capture_to_png",CONVERTER) +capture=importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(capture) + +C_TEST=r""" +#include +#include +typedef uint16_t u16; +static void nds_audio_pump_if_due(void){} +#include "visual-capture-nds.h" +#include +#include +#define CHECK(x) do { if(!(x))abort(); } while(0) +static u16 top[256*192],bottom[256*192]; +int main(int argc,char**argv){ + CHECK(argc==2); + nds_capture_init(argv[1]); + CHECK(!nds_capture_armed); + CHECK(nds_capture_begin(1,top)==NULL); + char flag[512]; + int n=snprintf(flag,sizeof flag,"%s/save/nds-visual-capture.flag",argv[1]); + CHECK(n>0 && (size_t)n200 for p in outputs)) diff --git a/cpymo-tool/nds-converter/tests/test_nvl_converter_integration.py b/cpymo-tool/nds-converter/tests/test_nvl_converter_integration.py new file mode 100644 index 00000000..2e082fd8 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_nvl_converter_integration.py @@ -0,0 +1,75 @@ +"""Integration: actual synthetic PyMO #movie produces hashed playable cache.""" +import argparse,hashlib,json,shutil,sys,tempfile,unittest +from pathlib import Path +sys.path.insert(0,str(Path(__file__).resolve().parents[1])) +from test_converter import fixture,hashes +from test_video_nvl import NVLVideoTests +import convert +import helper_core + + +@unittest.skipUnless(shutil.which('ffmpeg'),'FFmpeg required') +class NVLConverterTests(unittest.TestCase): + def test_playable_movie_cache_preserves_script_and_source(self): + with tempfile.TemporaryDirectory() as temp: + root=Path(temp);source=root/'source';script=fixture(source,'s60v3') + video=NVLVideoTests().make_movie(root) + shutil.copyfile(video,source/'video/omitted.mp4') + original=hashes(source) + for mode,magic in [('nvl1',b'NVL1'),('nva1',b'NVA1')]: + dst=root/mode + convert.convert(argparse.Namespace( + source=source,destination=dst,ffmpeg=shutil.which('ffmpeg'), + font=None,jobs=1,missing_glyph_policy='box',cache_only=True, + video_mode=mode,video_fps=12)) + convert.verify(dst) + self.assertEqual(hashes(source),original) + self.assertEqual((dst/'script/START.txt').read_bytes(),script) + manifest=json.loads((dst/'nds-cache/manifest.json').read_text()) + self.assertEqual(manifest['audit']['unsupported_video_commands'],[]) + self.assertEqual(len(manifest['videos']),1) + item=manifest['videos'][0] + self.assertEqual(item['name'],'omitted') + self.assertEqual(item['format'].encode(),magic) + self.assertEqual(item['source_sha256'],original['video/omitted.mp4']) + movie=dst/item['path'] + self.assertEqual(movie.read_bytes()[:4],magic) + self.assertFalse((dst/'video/omitted.mp4').exists()) + hashed=convert.key('omitted') + self.assertEqual(item['path'],f'nds-cache/video/{hashed[:2]}/{hashed}.nvl') + + + def test_default_helper_converts_movie_and_warns_for_missing_glyph(self): + # A first-time player should get working video and best-effort fonts + # without enabling advanced checkboxes or passing --video-mode. + with tempfile.TemporaryDirectory() as tmp: + root=Path(tmp);source=root/'source';fixture(source,'s60v3') + shutil.copyfile(NVLVideoTests().make_movie(root),source/'video/omitted.mp4') + script=source/'script/START.txt' + script.write_text(script.read_text(encoding='utf8')+'\n#say 🦄\n',encoding='utf8') + original=hashes(source) + report=helper_core.run_job({ + 'action':'convert','source':str(source), + 'output':str(root/'result'), + 'result':str(root/'jobs/result.json'), + 'ui_language':'English', + 'ffmpeg':shutil.which('ffmpeg')}) + self.assertTrue(report['ok'],report) + self.assertEqual(report['video_policy'].split()[0],'playable') + self.assertEqual(report['videos'][0]['format'],'NVL1') + self.assertEqual(hashes(source),original) + self.assertEqual(report['missing_policy'],'box') + english=(Path(report['output'])/'INSTALL-READ-ME.txt') + self.assertTrue(english.is_file()) + self.assertIn('Video mode: NVL1',english.read_text(encoding='utf8')) + self.assertIn('Back up the existing save',english.read_text(encoding='utf8')) + dst=Path(report['game_directory']) + manifest=json.loads((dst/'nds-cache/manifest.json').read_text(encoding='utf8')) + boxed={c for data in manifest['pixel_fonts'] for c in data['boxed_codepoints']} + self.assertIn('U+1F984',boxed) + self.assertTrue(any('U+1F984' in item for item in report['warnings'])) + self.assertIn('🦄',(dst/'script/START.txt').read_text(encoding='utf8')) + convert.verify(dst) + + +if __name__=='__main__':unittest.main() diff --git a/cpymo-tool/nds-converter/tests/test_nvl_trim.py b/cpymo-tool/nds-converter/tests/test_nvl_trim.py new file mode 100644 index 00000000..29d6f983 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_nvl_trim.py @@ -0,0 +1,41 @@ +"""Host regression for NVL1 beginning-only trimming (no media assets).""" +import struct, sys, tempfile, unittest +from pathlib import Path +sys.path.insert(0,str(Path(__file__).resolve().parents[1])) +from nvl_trim import trim_first_frames, NVLFormatError + +def fixture(): + packets=[struct.pack("<3I",4,0 if i==0 else 2,123+i)+bytes([i+1])*4 + for i in range(6)] + audio=bytes(range(256))* (11025*2//256) + # 6 frames @ 12 fps is half a second -> 11025 samples + audio=audio[:11025*2].ljust(11025*2,b"\0") + return struct.pack("<4s7I",b"NVL1",256,192,12,6,22050,11025,32+6*16)+b"".join(packets)+audio + +class NVLTrimTest(unittest.TestCase): + def test_clip_copy_exact(self): + with tempfile.TemporaryDirectory() as tmp: + source=Path(tmp)/"src.nvl";target=Path(tmp)/"short.nvl" + data=fixture();source.write_bytes(data) + info=trim_first_frames(source,target,3) + trimmed=target.read_bytes() + self.assertEqual(info["frames"],3) + self.assertEqual(trimmed[32:32+48],data[32:32+48]) + self.assertEqual(trimmed[80:],data[32+6*16:32+6*16+5512*2]) + self.assertEqual(struct.unpack("<4s7I",trimmed[:32])[4],3) + self.assertEqual(len(trimmed),32+48+5512*2) + self.assertEqual(source.read_bytes(),data) + + def test_trailing_source_audio_rejected(self): + with tempfile.TemporaryDirectory() as tmp: + inp=Path(tmp)/"bad.nvl";inp.write_bytes(fixture()+b"x") + with self.assertRaises(NVLFormatError): + trim_first_frames(inp,Path(tmp)/"clip.nvl",3) + + def test_no_overwrite(self): + with tempfile.TemporaryDirectory() as tmp: + inp=Path(tmp)/"a.nvl";inp.write_bytes(fixture()) + with self.assertRaises(ValueError): + trim_first_frames(inp,inp,3) + +if __name__=="__main__":unittest.main() diff --git a/cpymo-tool/nds-converter/tests/test_release_version.py b/cpymo-tool/nds-converter/tests/test_release_version.py new file mode 100644 index 00000000..9de33036 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_release_version.py @@ -0,0 +1,72 @@ +"""The current release must be compiled into ARM9 and every Banner title.""" +from pathlib import Path +import importlib.util +import json +import struct +import unittest + +ROOT = Path(__file__).resolve().parents[3] +NDS = ROOT / 'cpymo-backends/nds' +spec = importlib.util.spec_from_file_location('current_release_gate', NDS / 'tools/verify-release-artifact.py') +gate = importlib.util.module_from_spec(spec) +spec.loader.exec_module(gate) + + +def synthetic_rom(runtime='1.3.0', banner_version='1.3.0'): + # Real approved background, synthetic executable/title layout; no game data. + art = (NDS / 'assets/nds-dual-bg.rgb555').read_bytes() + assert art[:8] == b'CPYBG12\0' + arm9 = gate.READY + art[8:] + arm9 += f'CPyMO for NDS {runtime}'.encode('ascii') + b'\0' + arm9_at = 0x400 + banner_at = (arm9_at + len(arm9) + 511) & ~511 + data = bytearray(banner_at + gate._banner_module.BANNER_BYTES) + data[0x12] = 2 + struct.pack_into('V\n' for name in names) + decoders=' VFS..D h264 H.264 decoder\n' + calls=[] + def output(argv,**kwargs): + calls.append(argv[-1]) + return subprocess.CompletedProcess(argv,0, + stdout=filters if argv[-1]=='-filters' else decoders,stderr='') + with mock.patch.object(video_nvl.subprocess,'run',side_effect=output): + result=video_nvl.validate_ffmpeg('known-full-ffmpeg.exe') + self.assertEqual(result['video_decoder'],True) + self.assertEqual(video_nvl.validate_ffmpeg('known-full-ffmpeg.exe'),result) + self.assertEqual(calls,['-filters','-decoders']) + + def test_ffmpeg_new_filter_flag_width_and_stderr_tables(self): + # New FFmpeg variants expose more flag columns, and some platforms + # send the capability listing to stderr rather than stdout. + names='fps scale pad format aresample apad atrim'.split() + table=''.join(f' TSC.. {name} V->V supported\n' for name in names) + def output(argv,**kwargs): + if argv[-1]=='-filters': + return subprocess.CompletedProcess(argv,0,stdout='',stderr=table) + return subprocess.CompletedProcess(argv,0, + stdout=' VFS..D h264 supported\n',stderr='') + with mock.patch.object(video_nvl.subprocess,'run',side_effect=output): + self.assertTrue(video_nvl.validate_ffmpeg('ffmpeg8.exe')['video_decoder']) + + def test_bad_executable_or_timeout_fails_before_output_creation(self): + with mock.patch.object(video_nvl.subprocess,'run',side_effect=OSError('missing')): + with self.assertRaisesRegex(ValueError,'unavailable'): + video_nvl.validate_ffmpeg('missing-ffmpeg.exe') + video_nvl.validate_ffmpeg.cache_clear() + with mock.patch.object(video_nvl.subprocess,'run', + side_effect=subprocess.TimeoutExpired('ffmpeg',20)): + with self.assertRaisesRegex(ValueError,'unavailable'): + video_nvl.validate_ffmpeg('stalled-ffmpeg.exe') + + +if __name__=='__main__': + unittest.main() diff --git a/cpymo-tool/nds-converter/tests/test_video_nvl.py b/cpymo-tool/nds-converter/tests/test_video_nvl.py new file mode 100644 index 00000000..2db46660 --- /dev/null +++ b/cpymo-tool/nds-converter/tests/test_video_nvl.py @@ -0,0 +1,85 @@ +"""End-to-end synthetic-media proof for independent NVL1/NVA1 FFmpeg encoder.""" +import hashlib +import shutil +import struct +import subprocess +import sys +import tempfile +import unittest +import zlib +from pathlib import Path +import lz4.block + +sys.path.insert(0,str(Path(__file__).resolve().parents[1])) +import video_nvl +FFMPEG=shutil.which('ffmpeg') + + +@unittest.skipUnless(FFMPEG,'FFmpeg required') +class NVLVideoTests(unittest.TestCase): + def make_movie(self,where,with_audio=True): + dest=where/'sample.mp4' + cmd=[FFMPEG,'-nostdin','-loglevel','error','-f','lavfi','-i', + 'testsrc2=duration=1.3:size=320x240:rate=15'] + if with_audio: + cmd+=['-f','lavfi','-i','sine=frequency=440:duration=1.3:sample_rate=44100'] + cmd+=['-pix_fmt','yuv420p','-y',str(dest)] + subprocess.run(cmd,capture_output=True,check=True) + return dest + + def check_frames(self,video): + data=video.read_bytes() + magic,w,h,fps,frames,rate,samples,audio_at=struct.unpack_from('<4s7I',data) + self.assertIn(magic,(b'NVL1',b'NVA1')) + self.assertEqual((w,h,rate,samples),(256,192,22050,frames*22050//fps)) + previous=None;pos=32 + for frame_id in range(frames): + n,flag,expected=struct.unpack_from(' tuple[Image.Image, dict]: + """Scale the whole approved artwork uniformly onto a transparent Mac canvas.""" + side = round(SOURCE_SIZE[0] * MACOS_CONTENT_SCALE) + offset = (SOURCE_SIZE[0] - side) // 2 + canvas = Image.new("RGBA", SOURCE_SIZE, (0, 0, 0, 0)) + canvas.alpha_composite(image.convert("RGBA").resize((side, side), Image.Resampling.LANCZOS), + (offset, offset)) + rule = {"content_scale": MACOS_CONTENT_SCALE, "canvas_size": list(SOURCE_SIZE), + "content_size": [side, side], "offset": [offset, offset], + "padding": [offset, offset, SOURCE_SIZE[0]-side-offset, SOURCE_SIZE[1]-side-offset], + "resampling": "LANCZOS", "uniform_scale": True, + "crop_or_corner_mask_applied": False, "derived_rgba_sha256": pixel_sha(canvas)} + return canvas, rule + +def sha(path: Path) -> str: + return hashlib.sha256(path.read_bytes()).hexdigest() + +def pixel_sha(image: Image.Image) -> str: + return hashlib.sha256(image.convert("RGBA").tobytes()).hexdigest() + +def ico_frame_hashes(path: Path) -> dict[str, str]: + """Hash real RT_ICON payloads so the release audit can inspect the EXE.""" + data=path.read_bytes() + if len(data)<6 or struct.unpack_from("len(data): + raise ValueError("Generated ICO frame is out of bounds") + key=f"{w or 256}x{h or 256}" + if key in result: + raise ValueError("Duplicate ICO frame: "+key) + result[key]=hashlib.sha256(data[offset:offset+size]).hexdigest() + return result + +def build(source: Path, dest: Path, *, allow_alternate_source: bool=False) -> dict: + source=Path(source);dest=Path(dest) + if not source.is_file(): + raise FileNotFoundError(f"Approved icon source missing: {source}") + source_hash=sha(source) + if not allow_alternate_source and source_hash!=SOURCE_SHA256: + raise ValueError("Wrong desktop icon source; expected the approved " + "1024px rounded original, not the retired 04 artwork: "+source_hash) + with Image.open(source) as opened: + if opened.format!="PNG": + raise ValueError("Use the lossless approved PNG, not a lossy substitute") + image=opened.convert("RGBA") + if image.size!=SOURCE_SIZE: + raise ValueError(f"Expected {SOURCE_SIZE}, got {image.size}") + if image.getchannel("A").getextrema()[0]>=255: + raise ValueError("Expected transparent antialiased corners") + rgba_hash=pixel_sha(image) + if not allow_alternate_source and rgba_hash!=APPROVED_RGBA_SHA256: + raise ValueError("Approved source's decoded pixels differ: "+rgba_hash) + dest.mkdir(parents=True,exist_ok=True) + paths={"png":dest/"converter-icon.png", "png_64":dest/"converter-icon-64.png", + "macos_png":dest/"converter-icon-macos.png", + "ico":dest/"converter-icon.ico", "icns":dest/"converter-icon.icns"} + if source.resolve()==paths["png"].resolve(): + raise ValueError("Do not generate output over the canonical source") + # Preserve full-size PNG bytes exactly, including its approved alpha mask. + shutil.copyfile(source,paths["png"]) + image.resize((64,64),Image.Resampling.LANCZOS).save(paths["png_64"],format="PNG",optimize=True) + image.save(paths["ico"],format="ICO",sizes=list(WINDOWS_SIZES)) + mac_image, mac_rule = macos_canvas(image) + mac_image.save(paths["macos_png"],format="PNG",optimize=True) + # Pillow's ICNS default resize uses BICUBIC; provide explicit frames so + # every stored resolution follows the recorded LANCZOS derivation. + mac_image.save(paths["icns"],format="ICNS",append_images=[ + mac_image.resize((n,n),Image.Resampling.LANCZOS) for n in (32,64,128,256,512,1024)]) + with Image.open(paths["ico"]) as check: + if set(check.info["sizes"])!=set(WINDOWS_SIZES): + raise ValueError("Windows ICO resolution inventory mismatch") + with Image.open(paths["icns"]) as check: + if check.size!=SOURCE_SIZE or pixel_sha(check)!=mac_rule["derived_rgba_sha256"]: + raise ValueError("ICNS largest frame must match the approved Mac scale and transparent padding") + manifest={ + "artwork_id":ARTWORK_ID, + "source":"converter-icon-source.png", + "source_sha256":source_hash, + "source_rgba_sha256":rgba_hash, + "source_size":list(SOURCE_SIZE), + "macos_derivation":mac_rule, + "optical_width_scale":1.0, + "reapplied_crop_or_mask":False, + "lossy_reencoding":False, + "nds_icon_modified":False, + "source_attribution":"assets/ICON-ATTRIBUTION.txt", + "outputs":{k:{"file":p.name,"sha256":sha(p),"bytes":p.stat().st_size} + for k,p in paths.items()}, + "windows_ico_frames_sha256":ico_frame_hashes(paths["ico"]), + } + (dest/"icon-manifest.json").write_text(json.dumps(manifest,indent=2,ensure_ascii=False)+"\n",encoding="utf8") + return manifest + +def main() -> None: + p=argparse.ArgumentParser(description=__doc__) + p.add_argument("--source",type=Path,required=True) + p.add_argument("--output",type=Path,required=True) + p.add_argument("--allow-alternate-source",action="store_true", + help="Synthetic development fixtures only, never public packages") + a=p.parse_args() + print(json.dumps(build(a.source,a.output,allow_alternate_source=a.allow_alternate_source), + ensure_ascii=False,indent=2)) + +if __name__=="__main__": + main() diff --git a/cpymo-tool/nds-converter/tools/build_ffmpeg_macos_lgpl.sh b/cpymo-tool/nds-converter/tools/build_ffmpeg_macos_lgpl.sh new file mode 100644 index 00000000..aafba3e6 --- /dev/null +++ b/cpymo-tool/nds-converter/tools/build_ffmpeg_macos_lgpl.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +# Build a redistributable FFmpeg executable without GPL/nonfree components. +# The EXACT source tarball, config, command log and executable hashes are retained +# for inclusion with the corresponding macOS package. Only used for new RCs. +set -euo pipefail +if [[ "$(uname -s)" != Darwin ]]; then echo 'macOS host required' >&2; exit 1; fi +if (( $# != 1 )); then echo "usage: bash $0 NEW-OUTPUT-DIR" >&2; exit 2; fi +OUT="$1" +if [[ -e "$OUT" ]]; then echo "Output exists: $OUT" >&2; exit 2; fi +mkdir -p "$OUT/bin" "$OUT/source" "$OUT/build" +OUT="$(cd "$OUT" && pwd -P)" +trap 'rc=$?; echo "FFmpeg source build failed; recent diagnostics:" >&2; for log in "$OUT/source/configure.log" "$OUT/source/make.log"; do if [[ -f "$log" ]]; then echo "$log" >&2; tail -n 90 "$log" >&2; fi; done; exit "$rc"' ERR +VERSION="7.1.5" +ARCHIVE="ffmpeg-${VERSION}.tar.xz" +URL="https://ffmpeg.org/releases/${ARCHIVE}" +curl --fail --location --retry 3 --silent --show-error "$URL" -o "$OUT/source/$ARCHIVE" +shasum -a 256 "$OUT/source/$ARCHIVE" > "$OUT/source/SOURCE-SHA256SUMS.txt" +tar -xJf "$OUT/source/$ARCHIVE" -C "$OUT/build" +cd "$OUT/build/ffmpeg-$VERSION" +# Internal decoders, swscale and swresample are included. No external +# nonfree/GPL libraries and no sidecar wrapper binaries are permitted. +CONFIG_ARGS=( + "--prefix=$OUT/install" + "--disable-autodetect" + "--disable-x86asm" + "--disable-gpl" + "--disable-nonfree" + "--disable-doc" + "--disable-debug" + "--disable-network" + "--disable-ffplay" + "--disable-ffprobe" + "--enable-ffmpeg" +) +printf '%s\n' "FFmpeg $VERSION" "$URL" "${CONFIG_ARGS[@]}" > "$OUT/source/BUILD-CONFIG.txt" +./configure "${CONFIG_ARGS[@]}" > "$OUT/source/configure.log" 2>&1 +make -j"$(sysctl -n hw.ncpu)" ffmpeg > "$OUT/source/make.log" 2>&1 +cp ffmpeg "$OUT/bin/ffmpeg" +chmod 755 "$OUT/bin/ffmpeg" +"$OUT/bin/ffmpeg" -version > "$OUT/source/FFMPEG-VERSION.txt" 2>&1 +"$OUT/bin/ffmpeg" -buildconf > "$OUT/source/FFMPEG-BUILDCONF.txt" 2>&1 +"$OUT/bin/ffmpeg" -L > "$OUT/source/FFMPEG-LICENSE.txt" 2>&1 +grep -F -- '--disable-gpl' "$OUT/source/FFMPEG-BUILDCONF.txt" +grep -F -- '--disable-nonfree' "$OUT/source/FFMPEG-BUILDCONF.txt" +if grep -Eiq -- 'nonfree and unredistributable|--enable-nonfree|--enable-gpl' "$OUT/source/FFMPEG-BUILDCONF.txt" "$OUT/source/FFMPEG-LICENSE.txt"; then + echo 'Rejected nonredistributable or GPL-enabled FFmpeg build' >&2; exit 1 +fi +shasum -a 256 "$OUT/bin/ffmpeg" > "$OUT/source/BINARY-SHA256SUMS.txt" +cat > "$OUT/source/README-REDISTRIBUTION.txt" <<'TXT' +This CPyMO macOS converter bundles an executable compiled from the included +unmodified FFmpeg source archive (ffmpeg-7.1.5.tar.xz), with its exact +configure options and build logs. Its build has --disable-gpl and +--disable-nonfree and does not enable external GPL/nonfree libraries. +FFmpeg's LGPL and component notices are included in the original source; +the bundled executable is invoked as a separate process by the MIT converter. +See https://ffmpeg.org/legal.html and FFMPEG-LICENSE.txt. +TXT diff --git a/cpymo-tool/nds-converter/tools/build_ffmpeg_windows_lgpl.sh b/cpymo-tool/nds-converter/tools/build_ffmpeg_windows_lgpl.sh new file mode 100644 index 00000000..bdcd956d --- /dev/null +++ b/cpymo-tool/nds-converter/tools/build_ffmpeg_windows_lgpl.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +# Build a self-contained LGPL-only FFmpeg for Windows/MINGW64 in GitHub Actions. +# Bundle the exact corresponding unmodified source archive/configuration. +set -euo pipefail +if (( $# != 1 )); then echo "usage: bash $0 NEW-OUTPUT-DIR" >&2; exit 2; fi +OUT="$1" +if [[ -e "$OUT" ]]; then echo "Output exists: $OUT" >&2; exit 2; fi +mkdir -p "$OUT/bin" "$OUT/source" "$OUT/build" +OUT="$(cd "$OUT" && pwd -P)" +trap 'rc=$?; echo "Windows LGPL FFmpeg build failed; diagnostic logs:" >&2; for log in "$OUT/source/configure.log" "$OUT/source/make.log"; do if [[ -f "$log" ]]; then echo "$log" >&2; tail -n 75 "$log" >&2; fi; done; exit "$rc"' ERR +VERSION="7.1.5" +ARCHIVE="ffmpeg-${VERSION}.tar.xz" +URL="https://ffmpeg.org/releases/${ARCHIVE}" +EXPECTED_SOURCE_SHA256="de668509caf9e35e3cd162473441fdb29538c6d96ed080292b3cf9e6fc5d558f" +# CI may reuse the original archive bundled by the paired macOS job. Local +# callers can supply the same verified archive without changing the default URL. +if [[ -n "${FFMPEG_SOURCE_ARCHIVE:-}" ]]; then + if [[ ! -f "$FFMPEG_SOURCE_ARCHIVE" ]]; then + echo "FFmpeg source archive missing: $FFMPEG_SOURCE_ARCHIVE" >&2; exit 1 + fi + cp "$FFMPEG_SOURCE_ARCHIVE" "$OUT/source/$ARCHIVE" +else + curl --fail --location --retry 3 --retry-all-errors \ + --connect-timeout 20 --max-time 180 --retry-max-time 600 \ + --silent --show-error "$URL" -o "$OUT/source/$ARCHIVE" +fi +printf '%s %s\n' "$EXPECTED_SOURCE_SHA256" "$OUT/source/$ARCHIVE" | sha256sum --check --status +sha256sum "$OUT/source/$ARCHIVE" > "$OUT/source/SOURCE-SHA256SUMS.txt" +tar -xJf "$OUT/source/$ARCHIVE" -C "$OUT/build" +cd "$OUT/build/ffmpeg-$VERSION" +CONFIG_ARGS=( + "--prefix=$OUT/install" + "--target-os=mingw32" + "--arch=x86_64" + "--cc=gcc" + "--disable-x86asm" + "--disable-autodetect" + "--disable-gpl" + "--disable-nonfree" + "--disable-doc" + "--disable-debug" + "--disable-network" + "--disable-ffplay" + "--disable-ffprobe" + "--disable-shared" + "--enable-static" + "--enable-ffmpeg" + "--extra-ldflags=-static" +) +printf '%s\n' "FFmpeg $VERSION" "$URL" "${CONFIG_ARGS[@]}" > "$OUT/source/BUILD-CONFIG.txt" +./configure "${CONFIG_ARGS[@]}" > "$OUT/source/configure.log" 2>&1 +make -j4 ffmpeg.exe > "$OUT/source/make.log" 2>&1 +cp ffmpeg.exe "$OUT/bin/ffmpeg.exe" +"$OUT/bin/ffmpeg.exe" -version > "$OUT/source/FFMPEG-VERSION.txt" 2>&1 +"$OUT/bin/ffmpeg.exe" -buildconf > "$OUT/source/FFMPEG-BUILDCONF.txt" 2>&1 +"$OUT/bin/ffmpeg.exe" -L > "$OUT/source/FFMPEG-LICENSE.txt" 2>&1 +grep -F -- '--disable-gpl' "$OUT/source/FFMPEG-BUILDCONF.txt" +grep -F -- '--disable-nonfree' "$OUT/source/FFMPEG-BUILDCONF.txt" +if grep -Eiq -- 'nonfree and unredistributable|--enable-nonfree|--enable-gpl' "$OUT/source/FFMPEG-BUILDCONF.txt" "$OUT/source/FFMPEG-LICENSE.txt"; then + echo 'Rejected GPL/nonfree FFmpeg build' >&2; exit 1 +fi +sha256sum "$OUT/bin/ffmpeg.exe" > "$OUT/source/BINARY-SHA256SUMS.txt" +cat > "$OUT/source/README-REDISTRIBUTION.txt" <<'TXT' +FFmpeg 7.1.5 has been built from the included original source tarball using +the recorded configure flags; no external GPL/nonfree libraries are enabled. +The corresponding source, build configuration, binary hash, and license text +accompany the separate FFmpeg executable included in the Windows converter. +See https://ffmpeg.org/legal.html. This does not license CPyMO game content. +TXT diff --git a/cpymo-tool/nds-converter/ui_i18n.py b/cpymo-tool/nds-converter/ui_i18n.py new file mode 100644 index 00000000..76a7b3ec --- /dev/null +++ b/cpymo-tool/nds-converter/ui_i18n.py @@ -0,0 +1,144 @@ +"""Small, dependency-free player-facing UI translations (MIT). + +The canonical UI strings are Simplified Chinese. Translation is applied at +display time only: PyMO scripts, conversion diagnostics and output paths never +change when users switch the assistant's language. +""" + +LANGUAGES = ("简体中文", "English") +UI_EN = { + "CPyMO NDS 转换助手": "CPyMO NDS Converter", + "选择游戏包,生成可复制到 DS / DSi 存储卡的游戏目录。无需另装 Python 或 FFmpeg。": + "Choose a PyMO game and prepare its DS / DSi files. No separate Python or FFmpeg installation.", + "1 选择游戏": "1 Select a game", + "选压缩包": "Open ZIP", + "选文件夹": "Open folder", + "支持 S60v3 / S60v5 / Android PyMO 数据;同包有多个版本时优先推荐 S60v3。": + "Supports S60v3 / S60v5 / Android PyMO data. If multiple versions exist, S60v3 is preferred.", + "2 选择保存位置": "2 Choose output location", + "选保存位置": "Browse", + "自动创建新文件夹,不覆盖原包或已有存档;视频默认转换为 NVL1。": + "Creates a new output folder. Source games and existing saves are never overwritten. NVL1 video is on by default.", + "缺字自动以 □ 显示并记录警告,不中断转换;原脚本保持不变。": + "Missing font glyphs appear as □ with a warning. Conversion continues and scripts stay unchanged.", + "精简输出:不重复保存已转换的图片/音频(原游戏、脚本与署名不变)": + "Smaller output: omit converted source images/audio (original game, scripts and credits unchanged)", + "不压缩缓存(读取优先)": "Uncompressed cache (faster reads)", + "无损压缩语音与适合的图片(推荐)": + "Lossless voice and image cache compression (recommended)", + "无损压缩全部音频与适合的图片(实验)": + "Lossless compression for all audio and images (experimental)", + "缓存压缩:": "Cache compression:", + "安装包已包含 CPyMO {version};缓存压缩不会进一步降低转换后素材质量。": + "CPyMO {version} is included. Cache compression does not further reduce converted asset quality.", + "不转换视频(兼容旧流程)": "Skip videos (legacy mode)", + "转换视频 NVL1(推荐:兼容优先)": "Convert to NVL1 (recommended)", + "转换视频 NVA1(压缩音频)": "Convert to NVA1 (compressed audio)", + "游戏视频:": "Game videos:", + "视频默认转换为 256×192 / 12 FPS;可选 NVA1 或跳过,安装包已含对应引擎。": + "Video defaults to 256×192 at 12 FPS. NVA1 or skip is optional; the matching engine is bundled.", + "3 开始转换": "3 Convert", + "取消": "Cancel", + "打开结果文件夹": "Open output folder", + "NDS 平台移植:千岚之夏 · 基于 CPyMO / PyMO · 转换助手 {version}": + "NDS port: 千岚之夏 · Based on CPyMO / PyMO · Converter {version}", + "先选择游戏压缩包或游戏文件夹。": "Select a game ZIP or folder to begin.", + "选择 PyMO 游戏包": "Select a PyMO game package", + "游戏包": "Game packages", + "全部文件": "All files", + "选择含 gameconfig.txt 的游戏数据目录": "Select the game folder containing gameconfig.txt", + "选择保存位置": "Choose an output folder", + "正在识别游戏包里的平台版本……": "Detecting platform variants in the game package…", + "推荐 ": "Recommended ", + "已识别游戏。确认保存位置后,点击“开始转换”。": + "Game recognized. Choose an output folder, then click Convert.", + "保存位置不能位于原游戏目录内部。": + "The output folder cannot be inside the source game's directory.", + "正在转换,请稍候。语音较多的游戏需要更长时间……": + "Converting… Games with extensive voice audio may take longer.", + "。点击“打开结果文件夹”查看安装必读。": + ". Open the output folder and read the installation instructions.", + "已转换,仍需实际运行确认": + "Converted with warnings; on-device verification is still recommended", + "转换和完整性检查通过,仍需实际运行确认": + "Conversion and integrity checks passed; on-device verification is still recommended", + "未发现静态兼容性警告。": "No static compatibility warnings were found.", + "已省去重复媒体 {size:.2f} MiB。脚本与署名保留,原包未修改。": + "Removed {size:.2f} MiB of redundant media. Scripts and credits kept; source unchanged.", + "无损缓存另节省 {size:.2f} MiB。请使用随附的 {version} 引擎。": + "Lossless caching saved another {size:.2f} MiB. Use the bundled {version} engine.", + "未完成:": "Not completed: ", + "暂时不能完成转换": "Conversion could not be completed", + "原游戏包未改动。诊断目录:": "Source game was not modified. Diagnostic folder: ", + "已取消。原游戏包未改动;未完成目录和日志保留供检查。": + "Cancelled. Source unchanged; incomplete output and logs remain for inspection.", + "转换进程意外退出,请保留诊断日志。": + "The conversion worker exited unexpectedly. Please keep the diagnostic logs.", + "界面语言:": "Language:", + "检测到不支持的素材;请查看诊断日志。": "Unsupported assets were detected; see diagnostic logs.", + "默认保留并转换游戏视频;如不需要视频,也可以选择跳过。": + "Videos are converted automatically. Choose Skip only if you do not want them.", + "更多设置(可选)": "More settings (optional)", + "收起更多设置": "Hide additional settings", + "文件体积与读取:": "Storage and loading:", + "默认设置兼顾体积和读取速度,普通使用无需调整。": + "Recommended settings balance file size and loading speed. Usually no changes are needed.", + "查看错误日志": "Open diagnostic logs", + "转换完成!请打开结果文件夹,按说明复制到 TF 卡。": + "Done! Open the output folder and follow the instructions to copy files to your storage card.", + "转换完成!有一些提示,建议先查看下方记录。": + "Conversion finished with some notes. Please read the messages below.", + "自动识别游戏版本;如果找到多个版本,会优先推荐适合 NDS 的版本。": + "Game versions are detected automatically. A recommended version is selected if multiple are found.", + "转换后保存在新文件夹,不会修改原游戏或覆盖已有存档。": + "A new output folder is created. Your original game and existing saves are left untouched.", + "选择自己的 PyMO 游戏,转换好后复制到 DS / DSi 的存储卡即可。": + "Select your PyMO game, convert it, then copy the result to your DS / DSi storage card.", + "缺少视频和音频转换组件 FFmpeg,请完整解压转换助手。": + "FFmpeg is missing. Extract the complete converter package.", + "视频转换模式无效。": "Invalid video conversion mode.", + "无损压缩模式无效。": "Invalid lossless compression mode.", + "嵌套游戏包太多,请单独选择要转换的游戏包。": + "Too many nested game packages; select one game package.", +} + +DIAGNOSTIC_PREFIXES_EN = { + "已识别:": "Detected: ", + "正在转换图片、音频和字体,游戏较大时需要等待……": + "Converting images, audio and fonts; larger games may take longer…", + "未知脚本指令:": "Unknown script commands: ", + "缺失资源引用:": "Missing asset references: ", + "需运行检查的指令:": "Commands requiring runtime checks: ", + "字库缺字以□显示,原脚本未改:": "Missing glyphs displayed as □; original script unchanged: ", +} + +def tr(value: str, language: str = "简体中文") -> str: + if language != "English": + return value + if value in UI_EN: + return UI_EN[value] + for prefix, translated in DIAGNOSTIC_PREFIXES_EN.items(): + if value.startswith(prefix): + return translated + value[len(prefix):] + # A version number embedded in a static UI caption is not a translation + # key; replacing it temporarily makes the label stable across releases. + import re + normalized = re.sub(r"(? str: + # Display-only translation. Preserve the original diagnostic text on disk. + if language == "English": + return "\n".join(tr(line, language) for line in raw.split("\n")) + if language == "简体中文": + return "\n".join( + "正在准备输出:" + line[len("Staging:"):] if line.startswith("Staging:") + else line + for line in raw.split("\n") + ) + return raw diff --git a/cpymo-tool/nds-converter/video_nvl.py b/cpymo-tool/nds-converter/video_nvl.py new file mode 100644 index 00000000..c088231c --- /dev/null +++ b/cpymo-tool/nds-converter/video_nvl.py @@ -0,0 +1,206 @@ +"""Original CPyMO NDS NVL1/NVA1 encoder; no external proprietary codec tables. + +FFmpeg supplies normalized RGB and PCM. We only package bounded 256x192 +RGB555 LZ4/XOR pictures plus 22,050-Hz mono samples in the format understood +by cpymo-backends/nds/source/movie-lz4-r7.h. The source is never modified. +""" +from __future__ import annotations +from pathlib import Path +import functools +import hashlib +import os +import re +import shutil +import struct +import subprocess +import tempfile +import zlib + +import lz4.block +import lossless + +WIDTH, HEIGHT, RATE = 256, 192, 22050 +RAW_RGB = WIDTH * HEIGHT * 3 +RAW_FRAME = WIDTH * HEIGHT * 2 +VIDEO_SUFFIXES = frozenset({'.mp4', '.avi', '.mpg', '.mpeg', '.mkv', '.webm', + '.3gp', '.wmv', '.mov', '.ogv', '.flv', '.m4v'}) + + +@functools.lru_cache(maxsize=8) +def validate_ffmpeg(ffmpeg): + """Reject old Starter's *audio-only* FFmpeg before producing a broken video. + + Probe real filter/decoder tables, not a version string. ffmpeg -version + succeeds even when video codecs and swscale were intentionally disabled. + This check is required for video conversions and Windows distribution. + """ + executable = str(ffmpeg) + flags = 0x08000000 if os.name == 'nt' else 0 + def capabilities(option): + try: + done = subprocess.run( + [executable, '-hide_banner', option], + capture_output=True, text=True, encoding='utf-8', + errors='replace', timeout=20, creationflags=flags) + except (OSError, subprocess.TimeoutExpired) as error: + raise ValueError('Video-capable FFmpeg is unavailable: '+str(error)) from error + if done.returncode != 0: + raise ValueError('FFmpeg cannot list '+option+' capabilities: '+done.stderr[-400:]) + # FFmpeg builds/terminal platforms sometimes put capability tables on + # stderr. Collect both while keeping the check fully read-only. + return done.stdout + '\n' + done.stderr + filters = capabilities('-filters') + decoders = capabilities('-decoders') + required = ('fps', 'scale', 'pad', 'format', 'aresample', 'apad', 'atrim') + # Do NOT match a fixed-width flag prefix: FFmpeg has changed its filter + # capability indicators across releases (e.g. three vs five columns). + # Instead identify named filters followed by their V->V/A->A signature. + available = set() + for line in filters.splitlines(): + fields = line.split() + if len(fields) >= 3 and '->' in fields[2]: + available.add(fields[1]) + missing = sorted(set(required) - available) + video_decoders = set(re.findall(r'^\s*[A-Z.]{6}\s+([a-z0-9_]+)\s', decoders, re.M)) + if not video_decoders.intersection({'h264', 'hevc', 'mpeg4', 'mjpeg', 'vp9', 'av1'}): + missing.append('MP4/video decoder') + if missing: + raise ValueError( + 'This FFmpeg was built for audio only, or lacks NDS video features: '+ + ', '.join(missing)+ + '. Use a video-capable FFmpeg build; the old Starter audio-only ffmpeg.exe cannot convert movies.') + return {'filters':sorted(set(required)), 'video_decoder':True} + + +def _rgb555(rgb: bytes) -> bytes: + if len(rgb) != RAW_RGB: + raise ValueError('Truncated RGB24 movie frame') + out = bytearray(RAW_FRAME) + j = 0 + for i in range(0, RAW_RGB, 3): + pixel = 0x8000 | (rgb[i] >> 3) | ((rgb[i+1] >> 3) << 5) | ((rgb[i+2] >> 3) << 10) + out[j] = pixel & 255 + out[j+1] = pixel >> 8 + j += 2 + return bytes(out) + + +def encode(source, destination, ffmpeg='ffmpeg', *, fps=12, audio='pcm'): + """Write player-compatible .nvl to a new file in the caller's staging area.""" + source, destination = Path(source).resolve(), Path(destination).resolve() + if not source.is_file() or source.suffix.lower() not in VIDEO_SUFFIXES: + raise ValueError('Video input must be a supported existing media file') + if source == destination or destination.exists(): + raise ValueError('Video output must be a new file distinct from source') + if audio not in ('pcm', 'nar') or fps not in (6, 8, 12, 15, 20, 24): + raise ValueError('Unsupported NDS movie FPS/audio option') + ffmpeg = str(ffmpeg) + validate_ffmpeg(ffmpeg) + destination.parent.mkdir(parents=True, exist_ok=True) + with tempfile.TemporaryDirectory(prefix='nvl-', dir=destination.parent) as temp: + temp = Path(temp) + video_stream = temp/'frames.bin' + pcm = temp/'sound.pcm' + # Decode one RGB24 frame at a time; memory independent of duration. + filterchain = (f'fps={fps},scale={WIDTH}:{HEIGHT}:' + 'force_original_aspect_ratio=decrease:flags=bicubic,' + f'pad={WIDTH}:{HEIGHT}:(ow-iw)/2:(oh-ih)/2:black,format=rgb24') + command = [ffmpeg, '-nostdin', '-hide_banner', '-loglevel', 'error', + '-i', str(source), '-map', '0:v:0', '-an', + '-vf', filterchain, '-f', 'rawvideo', '-pix_fmt', 'rgb24', 'pipe:1'] + frames = 0 + previous = None + with video_stream.open('wb') as out: + process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, + creationflags=0x08000000 if os.name == 'nt' else 0) + try: + while True: + raw = process.stdout.read(RAW_RGB) + if not raw: + break + if len(raw) != RAW_RGB: + raise ValueError('Truncated source video frame') + if frames >= fps*600: + raise ValueError('NDS video longer than 600 seconds') + frame = _rgb555(raw) + key = previous is None or frames % (fps*4) == 0 + delta = frame if key else bytes(a ^ b for a,b in zip(frame,previous)) + packed = lz4.block.compress(delta, mode='high_compression', + compression=6, store_size=False) + use_packed = len(packed) < RAW_FRAME + payload = packed if use_packed else delta + out.write(struct.pack('= 512*1024*1024: + raise ValueError('NDS video packets exceed 512 MiB limit') + magic = b'NVA1' if audio=='nar' else b'NVL1' + try: + with destination.open('xb') as out: + out.write(struct.pack('<4s7I',magic,WIDTH,HEIGHT, + fps,frames,RATE,samples,start)) + with video_stream.open('rb') as inp: + shutil.copyfileobj(inp,out,1024*1024) + with data.open('rb') as inp: + shutil.copyfileobj(inp,out,1024*1024) + except BaseException: + destination.unlink(missing_ok=True) + raise + # Hash in chunks, including for long full-length clips. + h=hashlib.sha256() + with destination.open('rb') as inp: + for block in iter(lambda:inp.read(1024*1024),b''): + h.update(block) + return {'format':magic.decode('ascii'),'frames':frames,'fps':fps, + 'duration_seconds':frames/fps,'audio_samples':samples,'audio_rate':RATE, + 'width':WIDTH,'height':HEIGHT,'bytes':destination.stat().st_size, + 'sha256':h.hexdigest(),'has_audio':result.returncode==0}