feat: rawmax 2.0 (2) - nr

This commit is contained in:
zhoubinjia committed 2026-08-06 14:00:51 +08:00
1 parent bc27c5d01a
commit 867cfaa1e3
20 files changed
+10216 -129

No files matched your search

@@ -0,0 +1,373 @@
#!/usr/bin/env python3
"""Analyze the verified MGC full-resolution denoise static closure.
This is intentionally a mechanical analyzer, not a reimplementation. It
records the exact arm64 Halide code ranges, every constant page referenced by
ADRP, link-time task relocations, host callbacks and recovered ABI from the
pinned MGC 9.6.080 V24 libgcastartup.so. The output is research metadata only;
it contains no executable payload and is never packaged by the Android app.
"""
from __future__ import annotations
import argparse
import hashlib
import json
import struct
from dataclasses import dataclass
from pathlib import Path
SOURCE_SHA256 = "2103c54ebba1627733b79e3646105595ed1ccefa2b1629f63fb7e1785a48d6a0"
PAGE_SIZE = 4096
MANIFEST_FORMAT = "mgc-full-resolution-denoise-static-lift-v1"
SHT_RELA = 4
R_AARCH64_RELATIVE = 0x403
HALIDE_DO_PAR_FOR = 0x05A7FEF0
RGB_TO_YUV_NOISE_MATRIX_VADDR = 0x0D64C24
RUN_FULL_RESOLUTION_DENOISE_ENTRY = 0x04670524
RUN_FULL_RESOLUTION_DENOISE_CALLER = 0x0466A3A0
PECAN_LUMA_WRAPPER_ENTRY = 0x04EDE4E0
@dataclass(frozen=True)
class CodeRange:
name: str
start: int
entry: int
end: int
CODE_RANGES = (
CodeRange("BayerRawToYuv1xS16", 0x049C3484, 0x049C7B64, 0x049CAA54),
CodeRange("RgbRawToYuv1xS16", 0x04A17EA8, 0x04A198B8, 0x04A1C3E8),
CodeRange(
"ChromaDenoisePyramidCompleteS16",
0x04BE28CC,
0x04BE28CC,
0x04BE8764,
),
CodeRange(
"ChromaDenoisePyramidLevelS16",
0x04BEE520,
0x04BF1874,
0x04BF1878,
),
CodeRange(
"ChromaDenoisePyramidDownsampleS16",
0x04BF4CDC,
0x04C394A0,
0x04C394BC,
),
CodeRange("YuvToRgbS16", 0x04CE4F50, 0x04CE554C, 0x04CE61B4),
CodeRange("PecanLumaDenoiseS16", 0x04EF0000, 0x04EF1760, 0x04F1BB2C),
CodeRange(
"ComputeDenoiseStrengthMapsU16",
0x054DBE04,
0x054DCD34,
0x054DE730,
),
)
# Successful oracle runs reached only malloc/free/trace/par-for. memset is
# retained as a known Halide runtime target for callers whose dimensions select
# a different generated schedule.
HOST_TARGETS = {
0x05EF2634: "halide_malloc",
0x05EF2650: "halide_free",
0x05EF54BC: "halide_trace",
0x05A7FEF0: "halide_do_par_for",
0x05FB8540: "memset",
}
def page_floor(value: int) -> int:
return value & ~(PAGE_SIZE - 1)
def page_ceil(value: int) -> int:
return (value + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)
def sign_extend(value: int, bits: int) -> int:
sign = 1 << (bits - 1)
return (value ^ sign) - sign
def adrp_target(pc: int, instruction: int) -> int:
immediate = (((instruction >> 5) & 0x7FFFF) << 2) | (
(instruction >> 29) & 0x3
)
return page_floor(pc) + (sign_extend(immediate, 21) << 12)
def branch_target(pc: int, instruction: int) -> int:
return pc + (sign_extend(instruction & 0x03FFFFFF, 26) << 2)
def is_adrp(instruction: int) -> bool:
return instruction & 0x9F000000 == 0x90000000
def is_direct_branch(instruction: int) -> bool:
return instruction & 0xFC000000 in (0x14000000, 0x94000000)
def source_slice(source: bytes, start: int, size: int) -> bytes:
# All selected pages belong to the first two PT_LOAD segments, whose file
# offset equals virtual address in this pinned ELF.
end = start + size
if start < 0 or end > len(source):
raise ValueError(f"source range 0x{start:x}..0x{end:x} is unavailable")
return source[start:end]
def do_par_for_task_slot(
source: bytes,
code_range: CodeRange,
call_pc: int,
) -> int:
"""Recover the task-table slot loaded into x1 for one do_par_for call."""
load_pc = None
load_instruction = 0
for pc in range(call_pc - 4, max(code_range.start, call_pc - 32), -4):
instruction = struct.unpack_from("<I", source, pc)[0]
# LDR X1, [X1, #imm12 * 8]
if instruction & 0xFFC003FF == 0xF9400021:
load_pc = pc
load_instruction = instruction
break
if load_pc is None:
raise ValueError(
f"do_par_for at 0x{call_pc:x} has no nearby x1 task load"
)
for pc in range(load_pc - 4, code_range.start - 1, -4):
instruction = struct.unpack_from("<I", source, pc)[0]
# ADRP X1, target_page
if instruction & 0x9F00001F == 0x90000001:
target_page = adrp_target(pc, instruction)
byte_offset = ((load_instruction >> 10) & 0xFFF) * 8
return target_page + byte_offset
raise ValueError(
f"task load at 0x{load_pc:x} has no preceding ADRP x1"
)
def iter_elf64_rela(source: bytes):
"""Yield (offset, type, addend) from every ELF64 SHT_RELA section."""
if (
source[:4] != b"\x7fELF"
or source[4] != 2
or source[5] != 1
):
raise ValueError("source is not a little-endian ELF64 image")
section_offset = struct.unpack_from("<Q", source, 0x28)[0]
section_entry_size = struct.unpack_from("<H", source, 0x3A)[0]
section_count = struct.unpack_from("<H", source, 0x3C)[0]
if section_entry_size < 64:
raise ValueError("ELF64 section table entry is truncated")
for index in range(section_count):
header = section_offset + index * section_entry_size
section_type = struct.unpack_from("<I", source, header + 4)[0]
if section_type != SHT_RELA:
continue
payload_offset = struct.unpack_from("<Q", source, header + 0x18)[0]
payload_size = struct.unpack_from("<Q", source, header + 0x20)[0]
entry_size = struct.unpack_from("<Q", source, header + 0x38)[0]
if entry_size < 24 or payload_size % entry_size != 0:
raise ValueError("ELF64 RELA section has an invalid entry size")
for cursor in range(
payload_offset,
payload_offset + payload_size,
entry_size,
):
offset, info, addend = struct.unpack_from("<QQq", source, cursor)
yield offset, info & 0xFFFFFFFF, addend
def analyze(source_path: Path, manifest_path: Path) -> None:
source = source_path.read_bytes()
source_digest = hashlib.sha256(source).hexdigest()
if source_digest != SOURCE_SHA256:
raise ValueError(
"refusing a different libgcastartup.so: "
f"expected {SOURCE_SHA256}, got {source_digest}"
)
pages: set[int] = set()
direct_targets: dict[str, set[int]] = {}
do_par_for_calls: list[tuple[CodeRange, int]] = []
for code_range in CODE_RANGES:
for page in range(
page_floor(code_range.start),
page_ceil(code_range.end),
PAGE_SIZE,
):
pages.add(page)
targets: set[int] = set()
code = source_slice(
source,
code_range.start,
code_range.end - code_range.start,
)
for offset in range(0, len(code) - 3, 4):
instruction = struct.unpack_from("<I", code, offset)[0]
pc = code_range.start + offset
if is_adrp(instruction):
target_page = adrp_target(pc, instruction)
if 0 <= target_page < len(source):
pages.add(target_page)
if is_direct_branch(instruction):
target = branch_target(pc, instruction)
targets.add(target)
if target == HALIDE_DO_PAR_FOR:
do_par_for_calls.append((code_range, pc))
direct_targets[code_range.name] = targets
relative_relocations = {
location: target
for location, relocation_type, target in iter_elf64_rela(source)
if relocation_type == R_AARCH64_RELATIVE
}
task_slots = [
do_par_for_task_slot(source, code_range, call_pc)
for code_range, call_pc in do_par_for_calls
]
if len(set(task_slots)) != len(task_slots):
raise ValueError("multiple do_par_for calls unexpectedly share a task slot")
task_relocations = {}
for slot in task_slots:
if slot not in relative_relocations:
raise ValueError(
f"do_par_for task slot 0x{slot:x} has no RELATIVE relocation"
)
task_relocations[slot] = relative_relocations[slot]
code_intervals = [(item.start, item.end) for item in CODE_RANGES]
for location, target in task_relocations.items():
if not any(start <= target < end for start, end in code_intervals):
raise ValueError(
f"task slot 0x{location:x} targets code outside closure: "
f"0x{target:x}"
)
ordered_pages = sorted(pages)
ranges_json = [
{
"name": item.name,
"start": f"0x{item.start:x}",
"entry": f"0x{item.entry:x}",
"end": f"0x{item.end:x}",
}
for item in CODE_RANGES
]
branch_json: dict[str, list[dict[str, str]]] = {}
for name, targets in direct_targets.items():
external = []
for target in sorted(targets):
if any(start <= target < end for start, end in code_intervals):
continue
external.append(
{
"target": f"0x{target:x}",
"host": HOST_TARGETS.get(target, "halide_error_path"),
}
)
branch_json[name] = external
manifest = {
"format": MANIFEST_FORMAT,
"source": str(source_path),
"source_sha256": source_digest,
"page_size": PAGE_SIZE,
"page_count": len(ordered_pages),
"do_par_for_call_count": len(do_par_for_calls),
"code_ranges": ranges_json,
"task_relocations": {
f"0x{location:x}": f"0x{target:x}"
for location, target in sorted(task_relocations.items())
},
"direct_external_targets": branch_json,
"recovered_abi": {
"RgbRawToYuv1xS16": {
"input": "u16[x,y,rgb]",
"output": "s16[x,y,yuv]",
"neutral_wrapper_arguments": {
"black_levels": [0.0, 0.0, 0.0],
"channel_gains": [1.0, 1.0, 1.0],
"input_white_level": 16383,
"output_white_level": 16383,
"gain_map": "f32[x,y,4]=1",
"sample_rate": [1.0, 1.0],
"zoom_ratio": 1.0,
},
},
"ChromaDenoisePyramidCompleteS16": {
"input": "s16[x,y,yuv]",
"strength": "u16[x/4,y/4,3]",
"log2_strength_decimation": 2,
"log2_downsample_factor": 0,
"quadratic": "f32[level=4,branch=2], strides=[1,12]",
"shot": "f32[level=4,branch=2], strides=[1,12]",
"read": "f32[level=4,channel=3,branch=2], strides=[1,4,12]",
"outlier": "u8[level=4,branch=2], strides=[1,4]",
"output": "s16[x,y,yuv]",
},
"YuvToRgbS16": {
"input": "s16[x,y,yuv]",
"output": "s16[x,y,rgb]",
},
"PecanLumaDenoiseS16": {
"input": "s16[x,y]",
"strength": "u16[x/4,y/4,3]",
"read": "f32[level=4,branch=2], strides=[1,4]",
"shot": "f32[level=4,branch=2], strides=[1,4]",
"quadratic": "f32[level=4,branch=2], strides=[1,4]",
"outlier_distance": "f32[level=5]",
"revert_factor": "f32[level=5]",
"output": "s16[x,y]",
},
},
"run_full_resolution_denoise_contract": {
"entry": f"0x{RUN_FULL_RESOLUTION_DENOISE_ENTRY:x}",
"unique_direct_caller": (
f"0x{RUN_FULL_RESOLUTION_DENOISE_CALLER:x}"
),
"non_ai_pecan_wrapper": f"0x{PECAN_LUMA_WRAPPER_ENTRY:x}",
"input": "planar s16 YUV; non-AI Pecan consumes channel-0 luma",
"output": "planar s16 full-resolution luma",
"chroma_boundary": (
"ChromaDenoisePyramidComplete is a separate sibling stage; "
"it is not part of RunFullResolutionDenoise"
),
},
"rgb_to_yuv_noise_matrix": {
"vaddr": f"0x{RGB_TO_YUV_NOISE_MATRIX_VADDR:x}",
"layout": "row-major Y,Cb,Cr by R,G,B",
"values": list(
struct.unpack_from(
"<9f",
source,
RGB_TO_YUV_NOISE_MATRIX_VADDR,
)
),
},
"pages": [f"0x{page:x}" for page in ordered_pages],
}
manifest_path.write_text(
json.dumps(manifest, indent=2, sort_keys=True) + "\n",
encoding="utf-8",
)
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("source", type=Path)
parser.add_argument("manifest", type=Path)
args = parser.parse_args()
analyze(args.source, args.manifest)
if __name__ == "__main__":
main()
@@ -0,0 +1,388 @@
#!/usr/bin/env python3
"""Lift the pinned MGC Halide closure into normal link-time assembly.
The generated source contains no executable bytes of its own. It uses
``.incbin`` to select the verified code/constant pages from libgcastartup.so
and replaces every page-relative or cross-range reference with a standard ELF
relocation. Android's normal linker therefore owns code placement and
relocation; no runtime page container, mmap, mprotect, or branch patching is
required.
This is a mechanical binary lift. It intentionally does not translate the
Halide schedule into a hand-written approximation.
"""
from __future__ import annotations
import argparse
import hashlib
import json
import struct
from dataclasses import dataclass
from pathlib import Path
SOURCE_SHA256 = "2103c54ebba1627733b79e3646105595ed1ccefa2b1629f63fb7e1785a48d6a0"
PAGE_SIZE = 4096
@dataclass(frozen=True)
class CodeRange:
name: str
start: int
entry: int
end: int
symbol: str | None = None
CODE_RANGES = (
CodeRange("BayerRawToYuv1xS16", 0x049C3484, 0x049C7B64, 0x049CAA54),
CodeRange(
"RgbRawToYuv1xS16",
0x04A17EA8,
0x04A198B8,
0x04A1C3E8,
"photon_mgc_rgb_raw_to_yuv_s16",
),
CodeRange(
"ChromaDenoisePyramidCompleteS16",
0x04BE28CC,
0x04BE28CC,
0x04BE8764,
"photon_mgc_chroma_denoise_pyramid_complete_s16",
),
CodeRange(
"ChromaDenoisePyramidLevelS16",
0x04BEE520,
0x04BF1874,
0x04BF1878,
),
CodeRange(
"ChromaDenoisePyramidDownsampleS16",
0x04BF4CDC,
0x04C394A0,
0x04C394BC,
),
CodeRange(
"YuvToRgbS16",
0x04CE4F50,
0x04CE554C,
0x04CE61B4,
"photon_mgc_yuv_to_rgb_s16",
),
CodeRange(
"PecanLumaDenoiseS16",
0x04EF0000,
0x04EF1760,
0x04F1BB2C,
"photon_mgc_pecan_luma_denoise_s16",
),
CodeRange(
"ComputeDenoiseStrengthMapsU16",
0x054DBE04,
0x054DCD34,
0x054DE730,
"photon_mgc_compute_denoise_strength_maps_u16",
),
)
HOST_TARGETS = {
0x05EF2634: "photon_mgc_halide_malloc",
0x05EF2650: "photon_mgc_halide_free",
0x05EF54BC: "photon_mgc_halide_trace",
0x05A7FEF0: "photon_mgc_halide_do_par_for",
0x05FB8540: "memset",
}
def page_floor(value: int) -> int:
return value & ~(PAGE_SIZE - 1)
def page_ceil(value: int) -> int:
return (value + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)
def sign_extend(value: int, bits: int) -> int:
sign = 1 << (bits - 1)
return (value ^ sign) - sign
def adrp_target(pc: int, instruction: int) -> int:
immediate = (((instruction >> 5) & 0x7FFFF) << 2) | (
(instruction >> 29) & 0x3
)
return page_floor(pc) + (sign_extend(immediate, 21) << 12)
def adr_target(pc: int, instruction: int) -> int:
immediate = (((instruction >> 5) & 0x7FFFF) << 2) | (
(instruction >> 29) & 0x3
)
return pc + sign_extend(immediate, 21)
def branch_target(pc: int, instruction: int) -> int:
return pc + (sign_extend(instruction & 0x03FFFFFF, 26) << 2)
def relative_imm19_target(pc: int, instruction: int) -> int:
return pc + (sign_extend((instruction >> 5) & 0x7FFFF, 19) << 2)
def relative_imm14_target(pc: int, instruction: int) -> int:
return pc + (sign_extend((instruction >> 5) & 0x3FFF, 14) << 2)
def range_for(address: int) -> CodeRange | None:
return next(
(item for item in CODE_RANGES if item.start <= address < item.end),
None,
)
def address_symbol(address: int) -> str:
return f"photon_mgc_address_{address:x}"
def page_symbol(address: int) -> str:
return f"photon_mgc_page_{address:x}"
def error_symbol(address: int) -> str:
return f"photon_mgc_halide_error_{address:x}"
def emit_incbin(lines: list[str], start: int, end: int) -> None:
if end <= start:
return
lines.append(
f' .incbin "@MGC_GCASTARTUP_SO@", 0x{start:x}, 0x{end - start:x}'
)
def validate_local_pc_relative(
code_range: CodeRange,
pc: int,
instruction: int,
) -> None:
target: int | None = None
kind = ""
if instruction & 0x9F000000 == 0x10000000:
target = adr_target(pc, instruction)
kind = "ADR"
elif instruction & 0x3B000000 == 0x18000000:
target = relative_imm19_target(pc, instruction)
kind = "literal load"
elif instruction & 0xFF000010 == 0x54000000:
target = relative_imm19_target(pc, instruction)
kind = "conditional branch"
elif instruction & 0x7E000000 == 0x34000000:
target = relative_imm19_target(pc, instruction)
kind = "compare branch"
elif instruction & 0x7E000000 == 0x36000000:
target = relative_imm14_target(pc, instruction)
kind = "test branch"
if target is not None and not (
page_floor(code_range.start)
<= target
< page_ceil(code_range.end)
):
raise ValueError(
f"{kind} at 0x{pc:x} escapes {code_range.name}: 0x{target:x}"
)
def generate(source_path: Path, manifest_path: Path, output_path: Path) -> None:
source = source_path.read_bytes()
digest = hashlib.sha256(source).hexdigest()
if digest != SOURCE_SHA256:
raise ValueError(
f"expected libgcastartup.so {SOURCE_SHA256}, got {digest}"
)
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
pages = {int(value, 16) for value in manifest["pages"]}
task_relocations = {
int(location, 16): int(target, 16)
for location, target in manifest["task_relocations"].items()
}
expected_task_count = manifest["do_par_for_call_count"]
if len(task_relocations) != expected_task_count:
raise ValueError(
f"manifest records {expected_task_count} do_par_for calls but "
f"{len(task_relocations)} task relocations"
)
code_pages: set[int] = set()
labels: dict[int, list[str]] = {}
patches: dict[int, str] = {}
external_error_targets: set[int] = set()
for code_range in CODE_RANGES:
section_start = page_floor(code_range.start)
section_end = page_ceil(code_range.end)
code_pages.update(range(section_start, section_end, PAGE_SIZE))
if code_range.symbol is not None:
labels.setdefault(code_range.entry, []).append(code_range.symbol)
labels.setdefault(code_range.entry, []).append(
address_symbol(code_range.entry)
)
for pc in range(code_range.start, code_range.end, 4):
instruction = struct.unpack_from("<I", source, pc)[0]
if instruction & 0x9F000000 == 0x90000000:
target_page = adrp_target(pc, instruction)
if target_page not in pages:
raise ValueError(
f"ADRP at 0x{pc:x} references missing page "
f"0x{target_page:x}"
)
register = instruction & 0x1F
patches[pc] = (
f" adrp x{register}, {page_symbol(target_page)}"
)
continue
if instruction & 0xFC000000 in (0x14000000, 0x94000000):
target = branch_target(pc, instruction)
target_range = range_for(target)
if target_range is code_range:
continue
mnemonic = (
"bl"
if instruction & 0xFC000000 == 0x94000000
else "b"
)
if target_range is not None:
symbol = address_symbol(target)
labels.setdefault(target, []).append(symbol)
else:
symbol = HOST_TARGETS.get(target, error_symbol(target))
if target not in HOST_TARGETS:
external_error_targets.add(target)
patches[pc] = f" {mnemonic} {symbol}"
continue
validate_local_pc_relative(code_range, pc, instruction)
for target in task_relocations.values():
if range_for(target) is None:
raise ValueError(
f"task relocation target 0x{target:x} is outside code closure"
)
labels.setdefault(target, []).append(address_symbol(target))
lines = [
"/* Generated mechanically from pinned MGC 9.6.080 V24.",
" * Do not edit; regenerate with",
" * scripts/research/generate_mgc_denoise_static_asm.py.",
" */",
"",
"#if !defined(__aarch64__)",
'#error "MGC denoise static lift is arm64-only"',
"#endif",
"",
]
for target in sorted(external_error_targets):
lines.append(f" .hidden {error_symbol(target)}")
for symbol in sorted(set(HOST_TARGETS.values()) - {"memset"}):
lines.append(f" .hidden {symbol}")
lines.append("")
for code_range in CODE_RANGES:
section_start = page_floor(code_range.start)
section_end = page_ceil(code_range.end)
lines.extend(
[
(
f'.section .text.photon_mgc.{code_range.name},'
'"ax",@progbits'
),
" .p2align 12",
]
)
if code_range.symbol is not None:
lines.extend(
[
f" .global {code_range.symbol}",
f" .hidden {code_range.symbol}",
f" .type {code_range.symbol}, %function",
]
)
events = set(range(section_start, section_end, PAGE_SIZE))
events.update(
address
for address in labels
if section_start <= address < section_end
)
events.update(
address
for address in patches
if section_start <= address < section_end
)
position = section_start
for address in sorted(events):
emit_incbin(lines, position, address)
if address % PAGE_SIZE == 0:
lines.append(f"{page_symbol(address)}:")
for symbol in dict.fromkeys(labels.get(address, [])):
lines.append(f"{symbol}:")
patch = patches.get(address)
if patch is not None:
lines.append(patch)
position = address + 4
else:
position = address
emit_incbin(lines, position, section_end)
lines.append("")
relocation_pages = {page_floor(value) for value in task_relocations}
for page in sorted(pages - code_pages):
if page in relocation_pages:
lines.append(
f'.section .data.rel.ro.photon_mgc.page_{page:x},'
'"aw",@progbits'
)
else:
lines.append(
f'.section .rodata.photon_mgc.page_{page:x},"a",@progbits'
)
lines.extend([" .p2align 12", f"{page_symbol(page)}:"])
page_relocations = sorted(
(location, target)
for location, target in task_relocations.items()
if page_floor(location) == page
)
position = page
for location, target in page_relocations:
emit_incbin(lines, position, location)
lines.append(f" .xword {address_symbol(target)}")
position = location + 8
emit_incbin(lines, position, page + PAGE_SIZE)
lines.append("")
lines.extend(
[
'.section .note.GNU-stack,"",@progbits',
"",
]
)
output_path.write_text("\n".join(lines), encoding="utf-8")
print(
f"generated={output_path} pages={len(pages)} "
f"patches={len(patches)} "
f"task_relocations={len(task_relocations)} "
f"error_targets={len(external_error_targets)}"
)
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("source", type=Path)
parser.add_argument("manifest", type=Path)
parser.add_argument("output", type=Path)
args = parser.parse_args()
generate(args.source, args.manifest, args.output)
if __name__ == "__main__":
main()
@@ -0,0 +1,887 @@
{
"code_ranges": [
{
"end": "0x49caa54",
"entry": "0x49c7b64",
"name": "BayerRawToYuv1xS16",
"start": "0x49c3484"
},
{
"end": "0x4a1c3e8",
"entry": "0x4a198b8",
"name": "RgbRawToYuv1xS16",
"start": "0x4a17ea8"
},
{
"end": "0x4be8764",
"entry": "0x4be28cc",
"name": "ChromaDenoisePyramidCompleteS16",
"start": "0x4be28cc"
},
{
"end": "0x4bf1878",
"entry": "0x4bf1874",
"name": "ChromaDenoisePyramidLevelS16",
"start": "0x4bee520"
},
{
"end": "0x4c394bc",
"entry": "0x4c394a0",
"name": "ChromaDenoisePyramidDownsampleS16",
"start": "0x4bf4cdc"
},
{
"end": "0x4ce61b4",
"entry": "0x4ce554c",
"name": "YuvToRgbS16",
"start": "0x4ce4f50"
},
{
"end": "0x4f1bb2c",
"entry": "0x4ef1760",
"name": "PecanLumaDenoiseS16",
"start": "0x4ef0000"
},
{
"end": "0x54de730",
"entry": "0x54dcd34",
"name": "ComputeDenoiseStrengthMapsU16",
"start": "0x54dbe04"
}
],
"direct_external_targets": {
"BayerRawToYuv1xS16": [
{
"host": "halide_do_par_for",
"target": "0x5a7fef0"
},
{
"host": "halide_malloc",
"target": "0x5ef2634"
},
{
"host": "halide_free",
"target": "0x5ef2650"
},
{
"host": "halide_trace",
"target": "0x5ef54bc"
},
{
"host": "halide_error_path",
"target": "0x5ef61ac"
},
{
"host": "halide_error_path",
"target": "0x5ef6294"
},
{
"host": "halide_error_path",
"target": "0x5ef636c"
},
{
"host": "halide_error_path",
"target": "0x5ef63f8"
},
{
"host": "halide_error_path",
"target": "0x5ef64dc"
},
{
"host": "halide_error_path",
"target": "0x5ef6568"
},
{
"host": "halide_error_path",
"target": "0x5ef6600"
},
{
"host": "halide_error_path",
"target": "0x5ef6794"
},
{
"host": "halide_error_path",
"target": "0x5ef6a74"
},
{
"host": "halide_error_path",
"target": "0x5ef6a94"
},
{
"host": "halide_error_path",
"target": "0x5ef6b6c"
},
{
"host": "halide_error_path",
"target": "0x5ef6bd8"
},
{
"host": "halide_error_path",
"target": "0x5ef6c38"
}
],
"ChromaDenoisePyramidCompleteS16": [
{
"host": "halide_malloc",
"target": "0x5ef2634"
},
{
"host": "halide_free",
"target": "0x5ef2650"
},
{
"host": "halide_trace",
"target": "0x5ef54bc"
},
{
"host": "halide_error_path",
"target": "0x5ef604c"
},
{
"host": "halide_error_path",
"target": "0x5ef6140"
},
{
"host": "halide_error_path",
"target": "0x5ef61ac"
},
{
"host": "halide_error_path",
"target": "0x5ef6294"
},
{
"host": "halide_error_path",
"target": "0x5ef636c"
},
{
"host": "halide_error_path",
"target": "0x5ef63f8"
},
{
"host": "halide_error_path",
"target": "0x5ef64dc"
},
{
"host": "halide_error_path",
"target": "0x5ef6568"
},
{
"host": "halide_error_path",
"target": "0x5ef6600"
},
{
"host": "halide_error_path",
"target": "0x5ef668c"
},
{
"host": "halide_error_path",
"target": "0x5ef6794"
},
{
"host": "halide_error_path",
"target": "0x5ef6a74"
},
{
"host": "halide_error_path",
"target": "0x5ef6a94"
}
],
"ChromaDenoisePyramidDownsampleS16": [
{
"host": "halide_do_par_for",
"target": "0x5a7fef0"
},
{
"host": "halide_malloc",
"target": "0x5ef2634"
},
{
"host": "halide_free",
"target": "0x5ef2650"
},
{
"host": "halide_trace",
"target": "0x5ef54bc"
},
{
"host": "halide_error_path",
"target": "0x5ef61ac"
},
{
"host": "halide_error_path",
"target": "0x5ef6294"
},
{
"host": "halide_error_path",
"target": "0x5ef636c"
},
{
"host": "halide_error_path",
"target": "0x5ef63f8"
},
{
"host": "halide_error_path",
"target": "0x5ef64dc"
},
{
"host": "halide_error_path",
"target": "0x5ef6568"
},
{
"host": "halide_error_path",
"target": "0x5ef6600"
},
{
"host": "halide_error_path",
"target": "0x5ef668c"
},
{
"host": "halide_error_path",
"target": "0x5ef6794"
},
{
"host": "halide_error_path",
"target": "0x5ef6a74"
},
{
"host": "halide_error_path",
"target": "0x5ef6a94"
},
{
"host": "halide_error_path",
"target": "0x5ef6b6c"
},
{
"host": "halide_error_path",
"target": "0x5ef6bd8"
}
],
"ChromaDenoisePyramidLevelS16": [
{
"host": "halide_do_par_for",
"target": "0x5a7fef0"
},
{
"host": "halide_malloc",
"target": "0x5ef2634"
},
{
"host": "halide_free",
"target": "0x5ef2650"
},
{
"host": "halide_trace",
"target": "0x5ef54bc"
},
{
"host": "halide_error_path",
"target": "0x5ef61ac"
},
{
"host": "halide_error_path",
"target": "0x5ef6294"
},
{
"host": "halide_error_path",
"target": "0x5ef636c"
},
{
"host": "halide_error_path",
"target": "0x5ef63f8"
},
{
"host": "halide_error_path",
"target": "0x5ef64dc"
},
{
"host": "halide_error_path",
"target": "0x5ef6568"
},
{
"host": "halide_error_path",
"target": "0x5ef6600"
},
{
"host": "halide_error_path",
"target": "0x5ef668c"
},
{
"host": "halide_error_path",
"target": "0x5ef6794"
},
{
"host": "halide_error_path",
"target": "0x5ef6a74"
},
{
"host": "halide_error_path",
"target": "0x5ef6a94"
},
{
"host": "halide_error_path",
"target": "0x5ef6b6c"
},
{
"host": "halide_error_path",
"target": "0x5ef6bd8"
}
],
"ComputeDenoiseStrengthMapsU16": [
{
"host": "halide_do_par_for",
"target": "0x5a7fef0"
},
{
"host": "halide_malloc",
"target": "0x5ef2634"
},
{
"host": "halide_free",
"target": "0x5ef2650"
},
{
"host": "halide_trace",
"target": "0x5ef54bc"
},
{
"host": "halide_error_path",
"target": "0x5ef61ac"
},
{
"host": "halide_error_path",
"target": "0x5ef6294"
},
{
"host": "halide_error_path",
"target": "0x5ef636c"
},
{
"host": "halide_error_path",
"target": "0x5ef63f8"
},
{
"host": "halide_error_path",
"target": "0x5ef64dc"
},
{
"host": "halide_error_path",
"target": "0x5ef6568"
},
{
"host": "halide_error_path",
"target": "0x5ef6600"
},
{
"host": "halide_error_path",
"target": "0x5ef6794"
},
{
"host": "halide_error_path",
"target": "0x5ef6a74"
},
{
"host": "halide_error_path",
"target": "0x5ef6a94"
},
{
"host": "halide_error_path",
"target": "0x5ef6b6c"
},
{
"host": "halide_error_path",
"target": "0x5ef6bd8"
},
{
"host": "memset",
"target": "0x5fb8540"
}
],
"PecanLumaDenoiseS16": [
{
"host": "halide_do_par_for",
"target": "0x5a7fef0"
},
{
"host": "halide_malloc",
"target": "0x5ef2634"
},
{
"host": "halide_free",
"target": "0x5ef2650"
},
{
"host": "halide_trace",
"target": "0x5ef54bc"
},
{
"host": "halide_error_path",
"target": "0x5ef604c"
},
{
"host": "halide_error_path",
"target": "0x5ef6140"
},
{
"host": "halide_error_path",
"target": "0x5ef61ac"
},
{
"host": "halide_error_path",
"target": "0x5ef6294"
},
{
"host": "halide_error_path",
"target": "0x5ef636c"
},
{
"host": "halide_error_path",
"target": "0x5ef63f8"
},
{
"host": "halide_error_path",
"target": "0x5ef64dc"
},
{
"host": "halide_error_path",
"target": "0x5ef6568"
},
{
"host": "halide_error_path",
"target": "0x5ef6600"
},
{
"host": "halide_error_path",
"target": "0x5ef668c"
},
{
"host": "halide_error_path",
"target": "0x5ef6794"
},
{
"host": "halide_error_path",
"target": "0x5ef6a74"
},
{
"host": "halide_error_path",
"target": "0x5ef6a94"
},
{
"host": "halide_error_path",
"target": "0x5ef6b6c"
},
{
"host": "halide_error_path",
"target": "0x5ef6bd8"
},
{
"host": "halide_error_path",
"target": "0x5ef6c38"
},
{
"host": "halide_error_path",
"target": "0x5ef6cd0"
},
{
"host": "halide_error_path",
"target": "0x5ef7030"
}
],
"RgbRawToYuv1xS16": [
{
"host": "halide_do_par_for",
"target": "0x5a7fef0"
},
{
"host": "halide_malloc",
"target": "0x5ef2634"
},
{
"host": "halide_free",
"target": "0x5ef2650"
},
{
"host": "halide_trace",
"target": "0x5ef54bc"
},
{
"host": "halide_error_path",
"target": "0x5ef61ac"
},
{
"host": "halide_error_path",
"target": "0x5ef6294"
},
{
"host": "halide_error_path",
"target": "0x5ef636c"
},
{
"host": "halide_error_path",
"target": "0x5ef63f8"
},
{
"host": "halide_error_path",
"target": "0x5ef64dc"
},
{
"host": "halide_error_path",
"target": "0x5ef6568"
},
{
"host": "halide_error_path",
"target": "0x5ef6600"
},
{
"host": "halide_error_path",
"target": "0x5ef6794"
},
{
"host": "halide_error_path",
"target": "0x5ef6a74"
},
{
"host": "halide_error_path",
"target": "0x5ef6a94"
},
{
"host": "halide_error_path",
"target": "0x5ef6b6c"
},
{
"host": "halide_error_path",
"target": "0x5ef6bd8"
}
],
"YuvToRgbS16": [
{
"host": "halide_do_par_for",
"target": "0x5a7fef0"
},
{
"host": "halide_trace",
"target": "0x5ef54bc"
},
{
"host": "halide_error_path",
"target": "0x5ef61ac"
},
{
"host": "halide_error_path",
"target": "0x5ef6294"
},
{
"host": "halide_error_path",
"target": "0x5ef636c"
},
{
"host": "halide_error_path",
"target": "0x5ef63f8"
},
{
"host": "halide_error_path",
"target": "0x5ef64dc"
},
{
"host": "halide_error_path",
"target": "0x5ef6568"
},
{
"host": "halide_error_path",
"target": "0x5ef6600"
},
{
"host": "halide_error_path",
"target": "0x5ef6794"
},
{
"host": "halide_error_path",
"target": "0x5ef6a94"
},
{
"host": "halide_error_path",
"target": "0x5ef6b6c"
},
{
"host": "halide_error_path",
"target": "0x5ef6bd8"
}
]
},
"do_par_for_call_count": 12,
"format": "mgc-full-resolution-denoise-static-lift-v1",
"page_count": 181,
"page_size": 4096,
"pages": [
"0x6a8000",
"0x6a9000",
"0x6aa000",
"0x6ab000",
"0x6ac000",
"0x6ad000",
"0x6ae000",
"0x6af000",
"0x6b0000",
"0x6b1000",
"0x6b2000",
"0x6b4000",
"0x6b5000",
"0x6b6000",
"0x6b7000",
"0x6b9000",
"0x6ba000",
"0x6bc000",
"0x6bd000",
"0xd4d000",
"0xd51000",
"0xd5f000",
"0xd60000",
"0xd61000",
"0xd62000",
"0xd65000",
"0xf36000",
"0xf37000",
"0xf38000",
"0xf39000",
"0xf3a000",
"0x10a9000",
"0x49c3000",
"0x49c4000",
"0x49c5000",
"0x49c6000",
"0x49c7000",
"0x49c8000",
"0x49c9000",
"0x49ca000",
"0x4a17000",
"0x4a18000",
"0x4a19000",
"0x4a1a000",
"0x4a1b000",
"0x4a1c000",
"0x4be2000",
"0x4be3000",
"0x4be4000",
"0x4be5000",
"0x4be6000",
"0x4be7000",
"0x4be8000",
"0x4bee000",
"0x4bef000",
"0x4bf0000",
"0x4bf1000",
"0x4bf4000",
"0x4bf5000",
"0x4bf6000",
"0x4bf7000",
"0x4bf8000",
"0x4bf9000",
"0x4bfa000",
"0x4bfb000",
"0x4bfc000",
"0x4bfd000",
"0x4bfe000",
"0x4bff000",
"0x4c00000",
"0x4c01000",
"0x4c02000",
"0x4c03000",
"0x4c04000",
"0x4c05000",
"0x4c06000",
"0x4c07000",
"0x4c08000",
"0x4c09000",
"0x4c0a000",
"0x4c0b000",
"0x4c0c000",
"0x4c0d000",
"0x4c0e000",
"0x4c0f000",
"0x4c10000",
"0x4c11000",
"0x4c12000",
"0x4c13000",
"0x4c14000",
"0x4c15000",
"0x4c16000",
"0x4c17000",
"0x4c18000",
"0x4c19000",
"0x4c1a000",
"0x4c1b000",
"0x4c1c000",
"0x4c1d000",
"0x4c1e000",
"0x4c1f000",
"0x4c20000",
"0x4c21000",
"0x4c22000",
"0x4c23000",
"0x4c24000",
"0x4c25000",
"0x4c26000",
"0x4c27000",
"0x4c28000",
"0x4c29000",
"0x4c2a000",
"0x4c2b000",
"0x4c2c000",
"0x4c2d000",
"0x4c2e000",
"0x4c2f000",
"0x4c30000",
"0x4c31000",
"0x4c32000",
"0x4c33000",
"0x4c34000",
"0x4c35000",
"0x4c36000",
"0x4c37000",
"0x4c38000",
"0x4c39000",
"0x4ce4000",
"0x4ce5000",
"0x4ce6000",
"0x4ef0000",
"0x4ef1000",
"0x4ef2000",
"0x4ef3000",
"0x4ef4000",
"0x4ef5000",
"0x4ef6000",
"0x4ef7000",
"0x4ef8000",
"0x4ef9000",
"0x4efa000",
"0x4efb000",
"0x4efc000",
"0x4efd000",
"0x4efe000",
"0x4eff000",
"0x4f00000",
"0x4f01000",
"0x4f02000",
"0x4f03000",
"0x4f04000",
"0x4f05000",
"0x4f06000",
"0x4f07000",
"0x4f08000",
"0x4f09000",
"0x4f0a000",
"0x4f0b000",
"0x4f0c000",
"0x4f0d000",
"0x4f0e000",
"0x4f0f000",
"0x4f10000",
"0x4f11000",
"0x4f12000",
"0x4f13000",
"0x4f14000",
"0x4f15000",
"0x4f16000",
"0x4f17000",
"0x4f18000",
"0x4f19000",
"0x4f1a000",
"0x4f1b000",
"0x54db000",
"0x54dc000",
"0x54dd000",
"0x54de000",
"0x614f000",
"0x6150000",
"0x6152000"
],
"recovered_abi": {
"ChromaDenoisePyramidCompleteS16": {
"input": "s16[x,y,yuv]",
"log2_downsample_factor": 0,
"log2_strength_decimation": 2,
"outlier": "u8[level=4,branch=2], strides=[1,4]",
"output": "s16[x,y,yuv]",
"quadratic": "f32[level=4,branch=2], strides=[1,12]",
"read": "f32[level=4,channel=3,branch=2], strides=[1,4,12]",
"shot": "f32[level=4,branch=2], strides=[1,12]",
"strength": "u16[x/4,y/4,3]"
},
"PecanLumaDenoiseS16": {
"input": "s16[x,y]",
"outlier_distance": "f32[level=5]",
"output": "s16[x,y]",
"quadratic": "f32[level=4,branch=2], strides=[1,4]",
"read": "f32[level=4,branch=2], strides=[1,4]",
"revert_factor": "f32[level=5]",
"shot": "f32[level=4,branch=2], strides=[1,4]",
"strength": "u16[x/4,y/4,3]"
},
"RgbRawToYuv1xS16": {
"input": "u16[x,y,rgb]",
"neutral_wrapper_arguments": {
"black_levels": [
0.0,
0.0,
0.0
],
"channel_gains": [
1.0,
1.0,
1.0
],
"gain_map": "f32[x,y,4]=1",
"input_white_level": 16383,
"output_white_level": 16383,
"sample_rate": [
1.0,
1.0
],
"zoom_ratio": 1.0
},
"output": "s16[x,y,yuv]"
},
"YuvToRgbS16": {
"input": "s16[x,y,yuv]",
"output": "s16[x,y,rgb]"
}
},
"rgb_to_yuv_noise_matrix": {
"layout": "row-major Y,Cb,Cr by R,G,B",
"vaddr": "0xd64c24",
"values": [
0.2125999927520752,
0.7152000069618225,
0.07219959795475006,
-0.16245023906230927,
-0.5464943051338196,
0.7089447379112244,
0.9999967217445374,
-0.9083024859428406,
-0.09169333428144455
]
},
"run_full_resolution_denoise_contract": {
"chroma_boundary": "ChromaDenoisePyramidComplete is a separate sibling stage; it is not part of RunFullResolutionDenoise",
"entry": "0x4670524",
"input": "planar s16 YUV; non-AI Pecan consumes channel-0 luma",
"non_ai_pecan_wrapper": "0x4ede4e0",
"output": "planar s16 full-resolution luma",
"unique_direct_caller": "0x466a3a0"
},
"source": "MGC/MGC_9.6.080_V24_MGC/lib/arm64-v8a/libgcastartup.so",
"source_sha256": "2103c54ebba1627733b79e3646105595ed1ccefa2b1629f63fb7e1785a48d6a0",
"task_relocations": {
"0x614fd58": "0x49c3484",
"0x614fda8": "0x4a17ea8",
"0x614ffb0": "0x4bee520",
"0x614ffc0": "0x4bf4cdc",
"0x6150150": "0x4ce4f50",
"0x6150478": "0x4ef5f3c",
"0x6150480": "0x4ef7830",
"0x6150488": "0x4ef8f8c",
"0x6150490": "0x4f02464",
"0x6150498": "0x4f0b8a0",
"0x61504a0": "0x4f138cc",
"0x6152b00": "0x54dbe04"
}
}