|
| 1 | +# ld-analyse Oscilloscope Y/C Fixes - Session Log |
| 2 | + |
| 3 | +**Date**: 2025 |
| 4 | +**Branch**: `ld-analyse/improvements` |
| 5 | +**Status**: Completed and Pushed |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## Summary |
| 10 | + |
| 11 | +Fixed scanline oscilloscope display issues for dual-source (Y+C) TBC files, ensuring correct Y (luma) and C (chroma) channel display in all viewing modes. Added binary build GitHub Actions workflow for automated artifact generation. |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## Issues Addressed |
| 16 | + |
| 17 | +### 1. Y/C Data Extraction in BOTH_SOURCES Mode |
| 18 | +**Problem**: When viewing dual-source TBC files (separate Y and C), the scanline oscilloscope was displaying incorrect luma (Y) traces. The oscilloscope was using the mono decoder's luma output instead of the chroma decoder's luma, which meant the Y trace didn't reflect the selected PAL/NTSC chroma decoder settings. |
| 19 | + |
| 20 | +**Solution**: Modified `tbcsource.cpp::getScanLineData()` to use the chroma decoder's luma output (`chromaDecoder.getYData()`) instead of mono decoder when in `BOTH_SOURCES` mode, ensuring Y trace matches the selected decoder. |
| 21 | + |
| 22 | +**Files Modified**: |
| 23 | +- `tools/ld-analyse/tbcsource.cpp` |
| 24 | + |
| 25 | +**Commit**: `96bdba2e` - "Fix scan-line oscilloscope Y/C data extraction in BOTH_SOURCES mode" |
| 26 | + |
| 27 | +--- |
| 28 | + |
| 29 | +### 2. Chroma (C) Trace Mapping and Offset Handling |
| 30 | +**Problem**: |
| 31 | +- In YC mode (combined Y+C display), the oscilloscope showed only luma, not the composite signal |
| 32 | +- In C-only mode, the chroma trace was shifted vertically out of place |
| 33 | +- The chroma offset (32767) was being incorrectly removed in the data extraction, but the oscilloscope expected raw chroma values to calculate centering itself |
| 34 | + |
| 35 | +**Root Cause**: The chroma signal needed to be mapped as "composite minus luma" for correct vertical positioning in the oscilloscope, matching the "combine" feature logic used elsewhere in the codebase. |
| 36 | + |
| 37 | +**Solution**: |
| 38 | +1. Modified `getScanLineData()` to keep raw chroma values (with offset intact) for oscilloscope's own centering calculation |
| 39 | +2. For YC mode in BOTH_SOURCES: Generate synthetic composite by adding `(chroma - CHROMA_OFFSET)` to luma |
| 40 | +3. Modified `oscilloscopedialog.cpp` to render C trace as `composite - luma` for accurate positioning |
| 41 | +4. Preserved CHROMA_OFFSET constant and proper offset handling throughout the pipeline |
| 42 | + |
| 43 | +**Technical Details**: |
| 44 | +- `CHROMA_OFFSET = 32767` centers chroma around zero when subtracted |
| 45 | +- Oscilloscope calculates midpoint IRE for chroma centering at line 201 |
| 46 | +- Composite generation for Y+C sources: `composite = luma + (chroma - CHROMA_OFFSET)` |
| 47 | +- C trace display: `C = composite - Y` (computed in oscilloscope dialog) |
| 48 | + |
| 49 | +**Files Modified**: |
| 50 | +- `tools/ld-analyse/tbcsource.cpp` - Scanline data extraction and composite generation |
| 51 | +- `tools/ld-analyse/oscilloscopedialog.cpp` - Chroma trace rendering calculation |
| 52 | +- `tools/ld-analyse/tbcsource.h` - Validated (staged and committed) |
| 53 | + |
| 54 | +**Commit**: `de5d6747` - "Fix scanline oscilloscope Y+C and C mapping for dual-source TBC" |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +## Binary Build Workflow Addition |
| 59 | + |
| 60 | +### Phase 1: Initial Binary Build Workflow |
| 61 | +**Problem**: Repository only had test workflows, no automated binary artifact generation for distribution and testing. |
| 62 | + |
| 63 | +**Solution**: Created comprehensive GitHub Actions workflow for building release binaries on multiple platforms. |
| 64 | + |
| 65 | +**Workflow Features**: |
| 66 | +- **Linux Qt5 Build**: Ubuntu 22.04, full Qwt support |
| 67 | +- **Linux Qt6 Build**: Ubuntu 22.04, no Qwt (unavailable for Qt6 on this platform) |
| 68 | +- **macOS Build**: Latest macOS runner, Qt5 with Qwt |
| 69 | +- **Triggers**: Push to `ld-analyse/improvements` and `main` branches, PRs, and releases |
| 70 | +- **Artifacts**: Compressed tarballs (.tar.gz) with 30-day retention |
| 71 | +- **Build Type**: Release (optimized) |
| 72 | + |
| 73 | +**Files Created**: |
| 74 | +- `.github/workflows/binary-builds.yml` |
| 75 | + |
| 76 | +**Commit**: `badb93b6` - "Add binary build GitHub Actions workflow" |
| 77 | + |
| 78 | +### Phase 2: Copy Production Workflows from vhs_decode Branch |
| 79 | +**User Request**: Copy the complete, production-tested build workflows from the `vhs_decode` branch that include Windows, Linux, and macOS builds with proper packaging (AppImage, DMG, etc.). |
| 80 | + |
| 81 | +**Solution**: Fetched and copied all build workflows from `fork/vhs_decode` branch. |
| 82 | + |
| 83 | +**Workflows Copied**: |
| 84 | +- **Linux Tools**: `build_linux_tools.yml` - Builds AppImage with linuxdeploy, Qt5, includes FlaLDF and scripts |
| 85 | +- **Linux Decode**: `build_linux_decode.yml` - Builds Python decode tools |
| 86 | +- **Windows Tools**: `build_windows_tools.yml` - Builds Windows executables with Qt6 via vcpkg, includes FFmpeg, FLAC, FlaLDF |
| 87 | +- **Windows Decode**: `build_windows_decode.yml` - Builds Python decode tools for Windows |
| 88 | +- **macOS Tools**: `build_macos_tools.yml` - Builds DMG for both x86_64 and ARM64, includes FlaLDF (x86_64 only) |
| 89 | +- **macOS Decode**: `build_macos_decode.yml` - Builds Python decode tools for macOS |
| 90 | +- **PyPI Publishing**: `push_pypi.yml` - Workflow for publishing to PyPI |
| 91 | + |
| 92 | +**Trigger Method**: All workflows use `workflow_dispatch` for manual triggering, allowing on-demand testing. |
| 93 | + |
| 94 | +**Commit**: `d6807011` - "Copy build workflows from vhs_decode branch" |
| 95 | + |
| 96 | +--- |
| 97 | + |
| 98 | +## Testing and Validation |
| 99 | + |
| 100 | +**User Validation**: |
| 101 | +- User confirmed oscilloscope now correctly displays Y, C, and YC traces |
| 102 | +- Chroma positioning "much more accurate" |
| 103 | +- Y trace correctly reflects PAL/NTSC decoder selection in Y+C mode |
| 104 | +- All view modes (field/frame/split) working correctly with oscilloscope |
| 105 | + |
| 106 | +**Code Quality**: |
| 107 | +- No compilation errors |
| 108 | +- Consistent with existing codebase patterns |
| 109 | +- Proper offset handling maintained throughout signal chain |
| 110 | +- Integration with main window modes validated |
| 111 | + |
| 112 | +--- |
| 113 | + |
| 114 | +## Git Push Summary |
| 115 | + |
| 116 | +**Pushed to**: `fork/ld-analyse/improvements` (https://github.com/harrypm/ld-decode.git) |
| 117 | + |
| 118 | +**Commits Pushed**: |
| 119 | +1. `96bdba2e` - Fix scan-line oscilloscope Y/C data extraction in BOTH_SOURCES mode |
| 120 | +2. `de5d6747` - Fix scanline oscilloscope Y+C and C mapping for dual-source TBC |
| 121 | +3. `badb93b6` - Add binary build GitHub Actions workflow |
| 122 | +4. `d6807011` - Copy build workflows from vhs_decode branch (+ session log) |
| 123 | + |
| 124 | +**Push Stats**: |
| 125 | +- First push: 24 objects, 5.12 KiB delta (oscilloscope fixes + initial workflow) |
| 126 | +- Second push: 12 objects, 8.45 KiB delta (vhs_decode workflows + session log) |
| 127 | + |
| 128 | +--- |
| 129 | + |
| 130 | +## Next Steps |
| 131 | + |
| 132 | +### Testing Workflows |
| 133 | +1. Navigate to: https://github.com/harrypm/ld-decode/actions |
| 134 | +2. Manually trigger workflows to test: |
| 135 | + - **Build Linux tools** - Test AppImage generation |
| 136 | + - **Build Windows tools** - Test Windows Qt6 executable with bundled dependencies |
| 137 | + - **Build macOS tools** - Test DMG creation for both architectures |
| 138 | +3. Download and validate artifacts from successful workflow runs |
| 139 | +4. Test binaries on respective platforms |
| 140 | + |
| 141 | +### Oscilloscope Testing |
| 142 | +1. Test oscilloscope behavior with various TBC file types: |
| 143 | + - Single-source composite files |
| 144 | + - Dual-source Y+C files (S-Video style) |
| 145 | + - Chroma-only source files |
| 146 | + - PAL vs NTSC decoder outputs |
| 147 | +2. Verify Y trace follows selected chroma decoder (PAL/NTSC) |
| 148 | +3. Verify C trace positioning is accurate relative to Y and composite |
| 149 | + |
| 150 | +--- |
| 151 | + |
| 152 | +## Technical Notes |
| 153 | + |
| 154 | +### Signal Flow for Oscilloscope |
| 155 | +``` |
| 156 | +TBC File(s) → ldDecodeMetaData → TBCSource |
| 157 | + ↓ |
| 158 | + getScanLineData() [tbcsource.cpp] |
| 159 | + ↓ |
| 160 | + ┌───────────────┴───────────────┐ |
| 161 | + ↓ ↓ |
| 162 | + BOTH_SOURCES ONE_SOURCE |
| 163 | + (Dual Y+C files) (Composite file) |
| 164 | + ↓ ↓ |
| 165 | + chromaDecoder.getYData() monoDecoder.getYData() |
| 166 | + chromaDecoder.getCData() (no chroma) |
| 167 | + ↓ ↓ |
| 168 | + Composite = Y + (C - 32767) Composite = raw composite |
| 169 | + ↓ ↓ |
| 170 | + └───────────────┬───────────────┘ |
| 171 | + ↓ |
| 172 | + OscilloscopeDialog::updateScope() |
| 173 | + ↓ |
| 174 | + Render Y, C, and YC traces |
| 175 | + (C trace = Composite - Y) |
| 176 | +``` |
| 177 | + |
| 178 | +### Key Constants |
| 179 | +- `CHROMA_OFFSET = 32767` - Centers chroma signal around zero |
| 180 | +- Oscilloscope expects raw chroma with offset for internal centering |
| 181 | +- Composite generation removes offset: `Y + (C - CHROMA_OFFSET)` |
| 182 | + |
| 183 | +--- |
| 184 | + |
| 185 | +## References |
| 186 | + |
| 187 | +- Main repository: https://github.com/happycube/ld-decode |
| 188 | +- User fork: https://github.com/harrypm/ld-decode |
| 189 | +- Improvement branch: `ld-analyse/improvements` |
| 190 | +- Related issues: Scanline oscilloscope Y/C display, chroma decoder integration |
| 191 | + |
| 192 | +--- |
| 193 | + |
| 194 | +**Session completed successfully. All changes committed and pushed.** |
0 commit comments