Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
c534fee
Add research notes on Dolby Atmos, channel 14 sync and MXF handling
JaumeAP Sep 26, 2026
d3454f2
Merge pull request #1 from JaumeAP/docs/atmos-channel14-research
JaumeAP Sep 26, 2026
87b5f89
Cleanup: compress an if.
cth103 Sep 30, 2026
040f723
Replace references_dcp_{video,audio} with methods that return all the…
cth103 Sep 30, 2026
c3926f0
Gather the main sound configuration from the CPL in use.
cth103 Sep 30, 2026
f4cfec2
Re-use the OV's MainSoundConfiguration rather than making a new (prob…
cth103 Sep 30, 2026
1e62b5d
White space: smpte_metadata_dialog.{cc,h}
cth103 Sep 30, 2026
dcf7627
White space: language_tag_widget.{cc,h}
cth103 Sep 30, 2026
6e811f5
Allow user configuration of the full content title text.
cth103 Sep 30, 2026
c24f204
Preserve main picture active area from OVs in VFs.
cth103 Oct 1, 2026
9f73d17
Bump libdcp.
cth103 Oct 1, 2026
0f43cbc
White space: isdcf_name_test.cc
cth103 Oct 1, 2026
a7c0da2
Add option to put multiple subtitle languages into the ISDCF name.
cth103 Oct 4, 2026
c5c36d5
Updated sl_SI translation from Martin Srebotnjak.
cth103 Oct 5, 2026
b24cb95
Fix tests that run dcp_inspect on VFs.
cth103 Oct 5, 2026
7b67dd9
Share one stereo downmix between monitor and export
JaumeAP Oct 13, 2026
1916e5c
Bump libsub for macOS build fix.
cth103 Oct 14, 2026
4f41a37
Replace deprecated constructor use.
cth103 Oct 14, 2026
c0ed423
using cleanup.
cth103 Oct 15, 2026
9e93b20
Workaround bug in macOS 27.{0,1} causing crashes in locales with , de…
Oct 15, 2026
3c10e40
Supporters update.
cth103 Oct 15, 2026
049cc85
Give mac-new .dmgs the correct name.
cth103 Oct 14, 2026
db21714
Rename mp -> volume_mount_points.
cth103 Sep 21, 2026
737a2c6
Add some more logging.
cth103 Sep 21, 2026
4dccc90
Coalesce mount point lists for a given disk number.
cth103 Sep 21, 2026
f713baa
Fix doubled-up text.
cth103 Sep 21, 2026
09569cb
Cleanup: use consistent ifdef for Windows.
cth103 Sep 27, 2026
3d4dc1a
Fix corrupted disk writes on second and subsequent runs on Windows (w…
cth103 Sep 27, 2026
dc87ed8
Improve log.
cth103 Sep 29, 2026
c8482c1
Eject drive on completion of disk write.
cth103 Sep 29, 2026
e712f1d
Better error.
cth103 Sep 29, 2026
f91f712
Missing space.
cth103 Sep 29, 2026
de7153a
White space: exceptions.{cc,h}
cth103 Oct 1, 2026
46aa396
Bump lwext4 for some fixes:
cth103 Sep 21, 2026
ebfbb4b
Pass new lwext4 error details to CopyError.
cth103 Oct 1, 2026
5971d5d
pot/merge.
cth103 Oct 16, 2026
41aaebf
Updated nl_NL translation from Rob van Nieuwkerk.
cth103 Oct 16, 2026
920fb9b
Supporters update.
cth103 Oct 16, 2026
2a843ce
Include constants.h in config.h for MAX_DCP_AUDIO_CHANNELS
claude Oct 20, 2026
c06cdfd
Fold 7.1 into 5.1 monitor output at -6 dB per input
claude Oct 20, 2026
141cb13
Weigh the 7.1 to 5.1 monitor fold 0.6 side, 0.4 rear
claude Oct 20, 2026
30a798d
Apply the rear fold weight to 7.1 films only
claude Oct 20, 2026
1a174ee
Fold 7.1 into 5.1 at 0.87 side / 0.49 rear and add a peak limiter to …
claude Oct 20, 2026
df99900
Use std::max and std::min in limit_peaks
claude Oct 20, 2026
fcba530
Document that the 7.1 to 5.1 fold only borrows Pro Logic IIx numbers
claude Oct 20, 2026
ab10cb9
Fold 7.1 into 5.1 at -3 dB for both side and rear
claude Oct 20, 2026
86cb5db
Make the 7.1 to stereo downmix go through 5.1
claude Oct 20, 2026
b3c22f6
Restore the export's 5.1 to stereo gains; 7.1 goes through 5.1
claude Oct 20, 2026
6afb7c4
Add New-Renderer as a submodule
JaumeAP Oct 21, 2026
6ea3198
Remove the New-Renderer submodule
JaumeAP Oct 21, 2026
d196177
Merge upstream main into downmix-7-1-stereo
JaumeAP Oct 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cscript
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,8 @@ def build_with_cpp17(target):


def dependencies(target, options):
deps = [('libdcp', 'v1.10.63', {'c++17': build_with_cpp17(target)})]
deps.append(('libsub', 'v1.6.63'))
deps = [('libdcp', 'v1.10.64', {'c++17': build_with_cpp17(target)})]
deps.append(('libsub', 'v1.6.65'))
deps.append(('leqm-nrt', '3913040723f746c0b4a59cb55cd8a23030ea49a2'))
deps.append(('libttf', 'v0.0.7'))
if target.platform != 'linux' or target.distro != 'arch':
Expand All @@ -439,7 +439,7 @@ def dependencies(target, options):
# the appropriate place later
deps.append(('openssl', '54298369cacfe0ae01c5aa42ace8a463fd2e7a2e'))
deps.append(('rtaudio', 'f619b76'))
deps.append(('lwext4', '5755f8f25aadf18ec49e0350b6daaab3a648b9d7'))
deps.append(('lwext4', '5eb5608487fa0884822bb4805da32ba11d2a86f6'))
if build_tests(target):
deps.append(('ffcmp', '26f17612f391'))

Expand Down
124 changes: 124 additions & 0 deletions doc/design/atmos_sync/dcpomatic_code.md

Large diffs are not rendered by default.

99 changes: 99 additions & 0 deletions doc/design/atmos_sync/realtime_playback.md

Large diffs are not rendered by default.

80 changes: 80 additions & 0 deletions doc/design/atmos_sync/report.md

Large diffs are not rendered by default.

190 changes: 190 additions & 0 deletions doc/design/atmos_sync/standards_channel14.md

Large diffs are not rendered by default.

128 changes: 128 additions & 0 deletions doc/design/downmix_7_1_to_5_1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Downmix of DCP audio: 7.1 to 5.1, 7.1 to stereo, 5.1 to stereo

Status: implemented, not compiled or tested in the development environment. Values are marked where they come from a source and where they are a decision.

## 1. Scope

DCP-o-matic converts channels in two places:

- Monitor: `Config::audio_mapping(output_channels, film_channels)` in `src/lib/config.cc`, used by the Player through `FilmViewer` (`src/wx/film_viewer.cc`). It is the default mapping; a mapping edited in preferences takes precedence.
- Export: `FFmpegFilmEncoder::stereo_map()` in `src/lib/ffmpeg_film_encoder.cc`, used by "Mixdown to stereo".

Both call the same function, `stereo_downmix_map(film_channels, input_channels)` in `src/lib/audio_mapping.cc`, so monitor and export give the same stereo result for the same film.

## 2. What is used

### 2.1 Stereo (monitor and export)

| Film channels | Input | Gain into Lo / Ro | Value |
|---|---|---|---|
| 2 | L, R | identity | 1.0 |
| 4 | L, R, C, Ls | unchanged from before (not in any source) | L, R 0.369; C 0.261; Ls 0.369 |
| 6 or 8 (5.1) | L, R, Ls, Rs | 2 / (4 + √2) | 0.369 |
| 6 or 8 (5.1) | C | 0.707 × 0.369 | 0.261 |
| 12 or more (7.1) | L, R | same as 5.1 | 0.369 |
| 12 or more (7.1) | C | same as 5.1 | 0.261 |
| 12 or more (7.1) | Ls, Rs, Lrs, Rrs | 0.707 × 0.369 | 0.261 |

A 5.1 film sums to 1.0 in each output (0.369 + 0.261 + 0.369). A 7.1 film goes through 5.1 first (section 3.2), so L, R and C have the 5.1 gains and the sum is 1.15 (0.369 + 3 × 0.261), reached only with coherent full-level content in all of them. LFE is not mapped.

### 2.2 Monitor, 5.1 output

| Input | Output | Gain | Note |
|---|---|---|---|
| Channels 1 to 6 | Outputs 1 to 6 | 1.0 | 1:1 |
| Channels 7 and 8 (HI, VI) | Outputs 7 and 8, if the device has them | 1.0 | 1:1 |
| Ls (5) | Ls (output 5) | 0.707 (−3 dB) | 7.1 films only |
| Rs (6) | Rs (output 6) | 0.707 (−3 dB) | 7.1 films only |
| Lrs (11) | Ls (output 5) | 0.707 (−3 dB) | |
| Rrs (12) | Rs (output 6) | 0.707 (−3 dB) | |

Ls and Rs keep 1.0 for films with fewer than 12 channels, so 5.1 sources pass unchanged. For a 7.1 film, the side and the rear channel of each side go in at 0.707 each, with no cross-feed. The amplitudes add up to 1.41, so the monitor runs a peak limiter (`limit_peaks()` in `util.cc`, called from `Butler::audio`) after the mapping.

### 2.3 Export, 5.1 or 7.1

The export has no 5.1 output. A film is exported as stereo (section 2.1) or as 16 channels 1:1 (`many_channel_map()`). The 7.1 to 5.1 fold applies only to the monitor.

## 3. Origin and reasons

### 3.1 Stereo: the rule the export already had

- 5.1 to stereo is the rule the stereo mixdown export used before this change (`FFmpegFilmEncoder::stereo_map()`), unchanged: Lo = g·(L + 0.707·C + Ls), g = 2 / (4 + √2) = 0.369. The coefficients into each output add up to 1.0, so full-scale 5.1 content cannot overflow.
- It has the shape of the LoRo downmix of ETSI TS 102 366 §6.8.2 [1] and ATSC A/52 §7.8.2 [2] (C at −3 dB), but the surround enters at the same level as L, not at −3 dB. That part is the old behaviour; it is not in any source read here, and it was kept so that existing 5.1 mixdowns do not change (`ffmpeg_encoder_h264_test5` compares against a stored file).
- Dolby's LoRo [3] uses L : C : Ls = 1 : 0.707 : 0.707 with no scaling. ITU-R BS.775-4 [5] has L′ = L + 0.7071·C + 0.7071·LS, also unscaled.
- For 7.1, Dolby's Atmos Renderer makes stereo by folding 7.1 to 5.1 first and then 5.1 to 2.0 [3, pp. 223-224]. This code does the same, with the 7.1 to 5.1 fold of section 3.2 (Lss and Lrs at 0.707 each into Ls). L, R and C therefore keep exactly the 5.1 gains: a 7.1 film is not louder than a 5.1 one in those channels. Each of the four surrounds enters at 0.707 × 0.369 = 0.261.
- The 7.1 stereo output can reach 1.15 with coherent full-level content in all channels. The monitor has the peak limiter; the stereo mixdown export has none yet.

Why LoRo and not Pro Logic: the requirement was basic stereo. Dolby's LoRo is its default stereo option. Lt/Rt and Pro Logic II are matrix-encoded and not what a stereo monitor or a stereo file needs.

### 3.2 Monitor 5.1 from 7.1: −3 dB on the side and the rear

Ls = 0.707·Lss + 0.707·Lrs and Rs = 0.707·Rss + 0.707·Rrs, no cross-feed, for films of 12 or more channels. L, R, C and LFE pass at 1.0.

Sources that give the same fold:

- ETSI TS 103 190-1 V1.4.1 (AC-4), clause 6.2.17.5, Table 219, p. 272 [8]: the normative decoder matrix for 7 to 5 channels, Ls' = 0.707·Ls + 0.707·Lb, Rs' = 0.707·Rs + 0.707·Rb.
- ETSI TS 102 366 V1.4.1 Table H.3.9, p. 223 [1], `dmixtyp` = 1: Ls' = −3 dB·Ls + −3 dB·Lrs. This is informational (it says how the encoder made the 5.1 programme), not a decoder rule.
- Fraunhofer FDK-AAC, `libPCMutils/src/pcmdmx_lib.cpp` [9]: with no metadata, `dmix_a_idx` = `dmix_b_idx` = 2 gives 0.707 for both. Read in the source code, not in ISO/IEC 14496-3.

Sources that give other values:

| Source | Lss | Lrs | Rrs (opposite side) |
|---|---|---|---|
| This code, ETSI AC-4, FDK-AAC | 0.707 | 0.707 | 0 |
| Dolby Standard [3, p. 224] | 1.0 | 1.0 | 0 |
| Dolby Pro Logic IIx [3, p. 224] | 1.0 | 0.871 (−1.2 dB) | 0.490 (−6.2 dB) |
| ETSI `dmixtyp` = 2 [1] | 1.0 | 0.871 | 0.490 |

- No cinema or broadcast standard read (SMPTE ST 428-12, ST 2098-2, RDD 57, DCI, ITU-R BS.775, ISDCF Doc 4) defines a 7.1 to 5.1 fold. The DCI text and ARIB STD-B32 were not read in the primary document. See the research reports for the full list of what was and was not read.
- Dolby's Standard fold sums two full-level channels, which reaches 2.0, and nothing normalizes it.
- 0.707 + 0.707 reaches 1.41 with coherent full-level content, so the monitor runs a peak limiter. For uncorrelated signals the power is kept.
- What the Dolby CP650 or other cinema processors do with Lrs/Rrs in a 5.1 auditorium was not found in any retrievable document.

### 3.3 Why no 7.1 coefficient is in ETSI

ETSI §6.8 covers 3/2 (5.1) to 2/0 and smaller. A 7.1 channel layout appears only as encoder metadata (`dmixtyp`, H.3.9). No source gives a decoder rule for 7.1 to 5.1 or 7.1 to stereo. The 7.1 values above are therefore the 5.1 rule extended by §6.8.1.

### 3.4 Channel numbering

DCP channels 11 and 12 are Lrs and Rrs (7.1DS) according to ISDCF Doc 4 [6]. Channels 7 and 8 are HI and VI-N, 9 and 10 are Lc and Rc (SDDS only), 13 is motion data, 14 is the sync signal, 15 is sign language and 16 is unused. The code tests for a film of 12 or more channels to enable the 7.1 rule.

### 3.5 LFE

Not mapped in either path. ETSI §6.8.2 equations do not include LFE, and §6.8.0 says LFE downmix is optional [1]. BS.775-4 also omits LFE [5].

## 4. Notes

1. The 4-channel stereo formula (L, R 0.369; C 0.261; Ls 0.369) is the original code. It is not in any source here. It is kept unchanged.
2. For a 2-channel film, the stereo mapping is identity. The old code also used identity for the export.
3. The monitor's 2-output default is not saved to the configuration file. It is regenerated for each film. A configuration written by an earlier version may hold a saved default: "Reset to default" in Preferences → Sound replaces it.
4. The preferences page calls `audio_mapping(channels)` with no film, so it shows the 16-channel (7.1) stereo default.
5. "Reset to default" calls `audio_mapping(channels)` with 16 channels, so it restores the 7.1 stereo default. The Player then regenerates the default for the actual film on the next call.
6. The Atmos guide [3] is version 3.0 (2018). Later Renderer versions may differ.

## 5. Open points

1. The 5.1 monitor fold (section 2.2) can reach 1.41 with coherent full-level content; the peak limiter handles it. It differs from Dolby's Standard fold (1.0 + 1.0) and from Pro Logic IIx.
2. The export has no 7.1 to 5.1 path (section 2.3).
3. `test/ffmpeg_encoder_test.cc` (mixdown 5.1 to stereo) compares against stored output. With the export rule unchanged for 5.1, `ffmpeg_encoder_h264_test5` and `_test8` pass. The monitor's stereo default changed (it now uses the export's rule), and no test covers it.

## 6. References

1. **ETSI TS 102 366 V1.4.1 (2017-09)**, Digital Audio Compression (AC-3, Enhanced AC-3). Clause 6.8 (downmixing, pp. 77-81): 3/2 to 2/0 equations (§6.8.2), normalization (§6.8.1), worst-case scaling (Tables 6.31 and 6.32). Table H.3.9 (pp. 222-223): `dmixtyp` metadata for acmod 7. Read from the PDF. <https://www.etsi.org/deliver/etsi_ts/102300_102399/102366/01.04.01_60/ts_102366v010401p.pdf>

2. **ATSC A/52:2018**, Digital Audio Compression (AC-3, E-AC-3). Section 7.8 (downmixing, pp. 74-80), the same downmix as ETSI §6.8. Tables 7.31 and 7.32: scaled LoRo and LtRt coefficients. Read from the PDF. <https://www.atsc.org/wp-content/uploads/2021/04/A52-2018.pdf>

3. **Dolby Atmos Renderer Guide, software version 3.0**, 2 August 2018, §22.1 (monitor and 5.1 downmix, pp. 223-224). Standard and Pro Logic IIx 7.1-to-5.1 coefficients; LoRo, Lt/Rt Legacy and Lt/Rt Pro Logic II stereo coefficients; the rule that all stereo options except Direct Render go through 5.1. Read from the PDF. <https://professional.dolby.com/siteassets/content-creation/dolby-atmos/dolby_atmos_renderer_guide.pdf>

4. **Dolby Professional Support**, "How do the 5.1 and Stereo downmix settings work?". Same coefficients as [3]. The page is a JavaScript application and was not readable with curl; quoted from search results only. <https://professionalsupport.dolby.com/s/article/How-do-the-5-1-and-Stereo-downmix-settings-work?language=en_US>

5. **ITU-R BS.775-4 (12/2022)**, Annex 4, Table 2: 3/2 to 2/0, L′ = L + 0.7071·C + 0.7071·LS, no normalization, no LFE. Read from the PDF. <https://www.itu.int/dms_pubrec/itu-r/rec/bs/R-REC-BS.775-4-202212-I!!PDF-E.pdf>

6. **ISDCF Doc 4**, Audio channel recommendations: channel 11 = Lrs, channel 12 = Rrs (7.1DS). Channel numbers as listed in that document. <https://files.isdcf.com/papers/ISDCF-Doc4-Audio-channel-recommendations.pdf>

7. **FFmpeg libswresample**: default `center_mix_level` and `surround_mix_level` = M_SQRT1_2. Secondary, from doxygen and search results; the source was not read in full. <https://ffmpeg.org/doxygen/trunk/group__lswr.html>

8. **ETSI TS 103 190-1 V1.4.1 (2018)**, Digital Audio Compression (AC-4), Part 1. Clause 6.2.17.5, Table 219, p. 272: 7 to 5 channel rendering matrix; speaker indices in Table D.1, p. 302. Read from the PDF. <https://www.etsi.org/deliver/etsi_ts/103100_103199/10319001/01.04.01_60/ts_10319001v010401p.pdf>

9. **Fraunhofer FDK AAC**, `libPCMutils/src/pcmdmx_lib.cpp` (tag v2.0.3): level table (lines 276-280), default `dmix_a_idx` = `dmix_b_idx` = 2 (lines 357-358), 7.1 surround-back case (lines 1091-1105). Read in the source. <https://github.com/mstorsjo/fdk-aac>
4 changes: 3 additions & 1 deletion platform/osx/make_dmg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,9 @@ function make_dmg {
local full_name="$3"
local exes="$4"
tmp_dmg=dcpomatic_tmp.dmg
if [ "$ARCH2" == "" ]; then
if [[ "$ARCH1" == "arm64/11.0" && "$ARCH2" == "" ]]; then
dmg="$full_name $version macOS11.0+.dmg"
elif [[ "$ARCH1" == "x86_64/10.8" && "$ARCH2" == "" ]]; then
dmg="$full_name $version macOS10.8+.dmg"
else
dmg="$full_name $version macOS10.10+.dmg"
Expand Down
50 changes: 50 additions & 0 deletions src/lib/audio_mapping.cc
Original file line number Diff line number Diff line change
Expand Up @@ -305,3 +305,53 @@ AudioMapping::take_from(AudioMapping const& other)
}
}


AudioMapping
stereo_downmix_map(int film_channels, int input_channels)
{
auto map = AudioMapping(input_channels, 2);
float const minus_3dB = 1 / sqrt(2);

switch (film_channels) {
case 2:
map.set(dcp::Channel::LEFT, 0, 1);
map.set(dcp::Channel::RIGHT, 1, 1);
break;
case 4:
/* Not in ETSI TS 102 366; unchanged from before. */
{
float const overall_gain = 2 / (4 + sqrt(2));
map.set(dcp::Channel::LEFT, 0, overall_gain);
map.set(dcp::Channel::RIGHT, 1, overall_gain);
map.set(dcp::Channel::CENTRE, 0, overall_gain * minus_3dB);
map.set(dcp::Channel::CENTRE, 1, overall_gain * minus_3dB);
map.set(dcp::Channel::LS, 0, overall_gain);
}
break;
default:
/* 5.1 as the stereo mixdown export has always done it: L, R, Ls and Rs at 2 / (4 + sqrt(2)), C at -3 dB
of that. 7.1 goes through 5.1 first, as in Dolby's Atmos Renderer Guide 3.0 (pp. 223-224): Lss and Lrs
enter Ls at 0.707 each (the same fold as Config::audio_mapping), then the 5.1 rule applies. So L, R and C
have exactly the 5.1 gains, and a 7.1 film is not louder than a 5.1 one in those channels.
*/
{
bool const seven_one = film_channels > static_cast<int>(dcp::Channel::BSR);
float const overall_gain = 2 / (4 + sqrt(2));
float const surround = overall_gain * (seven_one ? minus_3dB : 1);
map.set(dcp::Channel::LEFT, 0, overall_gain);
map.set(dcp::Channel::RIGHT, 1, overall_gain);
map.set(dcp::Channel::CENTRE, 0, overall_gain * minus_3dB);
map.set(dcp::Channel::CENTRE, 1, overall_gain * minus_3dB);
map.set(dcp::Channel::LS, 0, surround);
map.set(dcp::Channel::RS, 1, surround);
if (seven_one) {
map.set(dcp::Channel::BSL, 0, surround);
map.set(dcp::Channel::BSR, 1, surround);
}
}
break;
}

return map;
}

9 changes: 9 additions & 0 deletions src/lib/audio_mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,13 @@ class AudioMapping
};


/** Stereo downmix of a DCP with film_channels channels, used by both the Player and the stereo mixdown export.
* @param film_channels Channels of the film's audio.
* @param input_channels Number of input channels of the returned mapping.
* For 5.1 and 7.1 this follows ETSI TS 102 366 6.8.1/6.8.2, normalized (see doc/design/downmix_7_1_to_5_1.md).
* LFE is not mapped.
*/
AudioMapping stereo_downmix_map(int film_channels, int input_channels);


#endif
4 changes: 3 additions & 1 deletion src/lib/butler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,9 @@ Butler::audio(shared_ptr<AudioBuffers> audio, DCPTime time, int frame_rate)
return;
}

_audio.put(remap(audio, _audio_channels, _audio_mapping), time, frame_rate);
auto mapped = remap(audio, _audio_channels, _audio_mapping);
limit_peaks(mapped, _limiter_gain, frame_rate);
_audio.put(mapped, time, frame_rate);
}


Expand Down
2 changes: 2 additions & 0 deletions src/lib/butler.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ class Butler : public ExceptionStore

AudioMapping _audio_mapping;
int _audio_channels;
/** gain of the peak limiter on the mapped audio, see limit_peaks() */
float _limiter_gain = 1;

bool _disable_video;
bool _disable_audio;
Expand Down
Loading
Loading