Processing Apple Immersive Video with foveation
At a glance
| Item | Summary |
|---|---|
| Purpose | Reduce a video’s data rate while maintaining high acuity in the center of the imagery by applying foveation to immersive video content. |
| App architecture | A Metal, Swift sample with the source-visible chain FoveateAIV → FoveationEngine → ImmersiveMediaSupport APIs. |
| Main patterns | No named application pattern supported by the extracted structure |
| Project style | 9 scanned source file(s) across Metal, Swift, organized around ranked entry, type, and file boundaries. |
Project structure
Source bundle/
├── ImmersiveMediaSupport-Foveation/
│ ├── ImmersiveMediaSupport-Foveation/
│ │ ├── FoveateAIV.swift
│ │ ├── AIMEProcessor.swift
│ │ ├── FoveationEngine.swift
│ │ ├── MetalProcessor.swift
│ │ ├── VideoProcessor.swift
│ │ ├── UVSample.metal
│ │ ├── Types/
│ │ │ ├── FoveationConfig.swift
│ │ │ └── RuntimeError.swift
│ │ └── AVVideoCodecTypeExtension.swift
│ └── ImmersiveMediaSupport-Foveation.xcodeproj/
│ ├── .xcodesamplecode.plist
│ └── project.pbxproj
└── Configuration/
└── SampleCode.xcconfig
Structure observations
- Architecturally prominent files are ranked from entry points and role-named declarations; resource-only paths are omitted.
- Primary languages: Metal, Swift.
- The verified tree contains 3 project/configuration file(s) and 9 source declaration(s).
Overall architecture
flowchart LR
N1["FoveateAIV"]
N2["FoveationEngine"]
N3["ImmersiveMediaSupport APIs"]
N1 --> N2
N2 --> N3
Reference code
ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/FoveateAIV.swift:12 — architecture anchor
@main
struct FoveateAIV: AsyncParsableCommand {
// ...
}Interpretation
The arrows summarize the source-visible entry, role-named types or folders, and framework direction; when nodes come from structural folders, the sequence is a high-level interpretation rather than proof that every adjacent node calls the next. Ownership is claimed only where the next section cites a stored property or assignment. The diagram is intentionally limited to the dominant path into Immersive Media Support.
Ownership and state
classDiagram
FoveateAIV *-- CommandConfiguration : configuration
FoveateAIV *-- String : inputVideoFile
FoveateAIV *-- String : inputAIMEFile
FoveateAIV *-- String : outputDirectory
Ownership evidence
ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/FoveateAIV.swift:14 — stored dependency or nearest verified ownership anchor
static let configuration = CommandConfiguration(
// ...
)| Owner | Object or state | Relationship | Mutation authority |
|---|---|---|---|
FoveateAIV |
CommandConfiguration (configuration) |
creates and retains | Initialized by the owner; the binding is immutable |
FoveateAIV |
String (inputVideoFile) |
owns value state | App/module collaborators |
FoveateAIV |
String (inputAIMEFile) |
owns value state | App/module collaborators |
FoveateAIV |
String (outputDirectory) |
owns value state | App/module collaborators |
Composition arrows indicate a source-visible construction expression or locally owned value state; aggregation means the owner stores or receives a dependency without proving exclusive lifetime ownership.
Class and protocol design
ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/AIMEProcessor.swift:12 — representative type boundary
final class AIMEProcessor {
// ...
}| Type | Responsibility | Depends on or conforms to |
|---|---|---|
AIMEProcessor |
Owns a feature processing stage | Concrete collaborators/imported frameworks |
FoveationEngine |
Owns processing or simulation work | Concrete collaborators/imported frameworks |
MetalProcessor |
Owns a feature processing stage | Concrete collaborators/imported frameworks |
VideoProcessor |
Owns a feature processing stage | Concrete collaborators/imported frameworks |
FoveateAIV |
Represents a feature value or composable behavior | AsyncParsableCommand |
VertexIn |
Represents a feature value or composable behavior | Concrete collaborators/imported frameworks |
VertexOut |
Represents a feature value or composable behavior | Concrete collaborators/imported frameworks |
FoveationConfig |
Carries feature or framework configuration | Concrete collaborators/imported frameworks |
RuntimeError |
Represents feature failure conditions | Error, CustomStringConvertible |
No local protocol conformance is claimed as protocol-oriented design; external framework conformances are listed only as dependencies.
Access control
| Symbol | Access | Verified effect | Likely rationale |
|---|---|---|---|
foveationConfig (ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/AIMEProcessor.swift:14) |
private |
Use is restricted to the lexical declaration and same-file extensions allowed by Swift. | Inference: keep state mutation or dependency lifetime inside the owning implementation. |
inputAIMEURL (ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/AIMEProcessor.swift:16) |
private |
Use is restricted to the lexical declaration and same-file extensions allowed by Swift. | Inference: keep state mutation or dependency lifetime inside the owning implementation. |
outputAIMEURL (ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/AIMEProcessor.swift:17) |
private |
Use is restricted to the lexical declaration and same-file extensions allowed by Swift. | Inference: keep state mutation or dependency lifetime inside the owning implementation. |
venueDescriptor (ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/AIMEProcessor.swift:18) |
private |
Use is restricted to the lexical declaration and same-file extensions allowed by Swift. | Inference: keep state mutation or dependency lifetime inside the owning implementation. |
Reference code
ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/AIMEProcessor.swift:14 — representative boundary
private let foveationConfig: FoveationConfig
private let inputAIMEURL: URL
private let outputAIMEURL: URL
private let venueDescriptor: VenueDescriptorSwift declarations without a modifier are internal; explicit private, fileprivate, private(set), public, or open entries above are interpreted by language semantics. Objective-C/C samples instead rely on header and implementation boundaries, which are not equivalent to Swift lexical privacy.
Logic ownership and placement
| Logic | Owning type or file | Placement rationale |
|---|---|---|
| Owns processing or simulation work | FoveationEngine |
The source’s Engine suffix makes this role explicit. |
| Owns a feature processing stage | AIMEProcessor, MetalProcessor, VideoProcessor |
The source’s Processor suffix makes this role explicit. |
Design patterns
| Pattern | Source evidence | Purpose or tradeoff |
|---|---|---|
| No named application pattern | ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/FoveateAIV.swift:12 |
The verified source directly composes concrete framework types; this document avoids forcing a pattern name. |
Naming conventions
- Types: Engine: FoveationEngine; Processor: AIMEProcessor, MetalProcessor, VideoProcessor.
- Protocols: no local protocol declaration in the scanned source.
- Methods:
run,validateParameters,validateInputs,validateOutputs,process,foveateMesh,generateMesh,createBuffers. - Files:
ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/FoveateAIV.swift,ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/AIMEProcessor.swift,ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/FoveationEngine.swift,ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/MetalProcessor.swift,ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/VideoProcessor.swift,ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/Types/FoveationConfig.swift.
Architecture takeaways
FoveateAIVis the main source-visible entry or composition anchor for this sample.- Framework work reaches AVFoundation, VideoToolbox, ArgumentParser, ImmersiveMediaSupport through a deliberately small high-level chain; the detailed API graph remains inside the cited implementation files.
- Stored-property evidence identifies lifecycle collaboration; it does not by itself prove exclusive object ownership.
- Access-control conclusions separate verified language visibility from the likely design rationale.
- The source does not justify labeling the design protocol-oriented.
Source map
| Source file | Relevant symbols |
|---|---|
ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/FoveateAIV.swift |
FoveateAIV |
ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/AIMEProcessor.swift |
AIMEProcessor |
ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/FoveationEngine.swift |
FoveationEngine |
ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/MetalProcessor.swift |
MetalProcessor |
ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/VideoProcessor.swift |
VideoProcessor |
ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/UVSample.metal |
VertexIn, VertexOut |
ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/Types/FoveationConfig.swift |
FoveationConfig |
ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/Types/RuntimeError.swift |
RuntimeError |
ImmersiveMediaSupport-Foveation/ImmersiveMediaSupport-Foveation/AVVideoCodecTypeExtension.swift |
Feature implementation |