code wiki / (root) / nx_video_feature_research_fetch.nx

nx_video_feature_research_fetch.nx source

↩ module page · 82 lines · 6246 B

1// nx_video_feature_research_fetch.nx -- SOVEREIGN research round for the VIDEO FEATURE FRONTIER (operator 2// 2026-06-28: "get the video capability s-class exceed via the researcher: live translation, topic suggestions, 3// game integration esp. mobile"). Mirrors nx_codec_research_fetch: own TLS-1.3 (nx_https_fetch_follow) + Mozilla 4// CA, idempotent have-skip, nx_cc->nxasm (no curl/gcc). Wikipedia = ORIENTATION only. The codec corpus already 5// banked AV1/HEVC/VP9; THIS round banks the FEATURE levers (live captioning/translation, real-time streaming/ 6// WebRTC, recommendation/topic-modeling, mobile/PWA) -> knowledge/fetched/vidfeat_*.raw so the corpus COMPOUNDS 7// and can be grepped to CITE the s-class-exceed standard. expect_exit: 0 license_tier: ORIGINAL 8import "nx_syscalls.nx" 9import "nx_x509_trust_store.nx" 10import "nx_trust_store_load_from_certdata.nx" 11import "nx_https_fetch_follow.nx" 12const K_MAGIC_4194304: i64 = 4194304 13const K_MAGIC_8388608: i64 = 8388608 14 15func df_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } 16func df_putn(v: i64) -> i64 { 17 if v == 0 { sys_write(1, "0" as *u8, 1); return 0 } 18 var m: i64 = v 19 if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m } 20 let d: *u8 = sys_mmap(24); var k: i64 = 0 21 while m > 0 { d[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 22 var j: i64 = k - 1 23 while j >= 0 { sys_write(1, ((d as i64)+j) as *u8, 1); j = j - 1 } 24 return 0 25} 26func have_file(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 } 27func fetch_save(url: *u8, opath: *u8, store: *TrustStore, out: *u8, cap: i64) -> i64 { 28 if have_file(opath) == 1 { df_puts(opath); df_puts(" [have-skip]\n" as *u8); return 1 } 29 let status: *i64 = sys_mmap(8) as *i64 30 let n: i64 = nx_https_fetch_follow(url, store, out, cap, 6, status) 31 df_puts(url); df_puts(" status=" as *u8); df_putn(status[0]); df_puts(" bytes=" as *u8); df_putn(n) 32 if n <= 0 { df_puts(" FETCH-FAIL\n" as *u8); return 0 } 33 var gz: i64 = 0 34 if n >= 2 { if out[0] == 0x1f as u8 { if out[1] == 0x8b as u8 { gz = 1 } } } 35 if gz == 1 { df_puts(" [GZIP-skip]\n" as *u8); return 0 } 36 let fd: i64 = sys_openat_wr(opath, 0x1a4) 37 if fd < 0 { df_puts(" SAVE-FAIL\n" as *u8); return 0 } 38 sys_write(fd, out, n); sys_close(fd) 39 df_puts(" SAVED\n" as *u8) 40 return 1 41} 42 43func main() -> i64 { 44 let r: i64 = nx_trust_store_load_from_certdata("data/mozilla_certdata.txt" as *u8, 512, K_MAGIC_4194304) 45 if r <= 0 { df_puts("VIDFEAT: certdata load failed\n" as *u8); return 1 } 46 let store: *TrustStore = r as *TrustStore 47 df_puts("CA roots=" as *u8); df_putn(trust_store_count(store)); df_puts("\n" as *u8) 48 let cap: i64 = K_MAGIC_8388608 49 let out: *u8 = sys_mmap(cap) 50 var ok: i64 = 0 51 52 df_puts("== LIVE TRANSLATION / CAPTIONS (the s-class differentiator) ==\n" as *u8) 53 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Speech_recognition" as *u8, "knowledge/fetched/vidfeat_asr.raw" as *u8, store, out, cap) 54 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Speech_translation" as *u8, "knowledge/fetched/vidfeat_speechtrans.raw" as *u8, store, out, cap) 55 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Neural_machine_translation" as *u8, "knowledge/fetched/vidfeat_nmt.raw" as *u8, store, out, cap) 56 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Subtitles" as *u8, "knowledge/fetched/vidfeat_subtitles.raw" as *u8, store, out, cap) 57 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Closed_captioning" as *u8, "knowledge/fetched/vidfeat_cc.raw" as *u8, store, out, cap) 58 ok = ok + fetch_save("https://en.wikipedia.org/wiki/WebVTT" as *u8, "knowledge/fetched/vidfeat_webvtt.raw" as *u8, store, out, cap) 59 60 df_puts("== REAL-TIME STREAMING / TRANSPORT (latency + reach levers) ==\n" as *u8) 61 ok = ok + fetch_save("https://en.wikipedia.org/wiki/WebRTC" as *u8, "knowledge/fetched/vidfeat_webrtc.raw" as *u8, store, out, cap) 62 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Real-time_Transport_Protocol" as *u8, "knowledge/fetched/vidfeat_rtp.raw" as *u8, store, out, cap) 63 ok = ok + fetch_save("https://en.wikipedia.org/wiki/HTTP_Live_Streaming" as *u8, "knowledge/fetched/vidfeat_hls.raw" as *u8, store, out, cap) 64 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP" as *u8, "knowledge/fetched/vidfeat_dash.raw" as *u8, store, out, cap) 65 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Scalable_Video_Coding" as *u8, "knowledge/fetched/vidfeat_svc.raw" as *u8, store, out, cap) 66 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Videotelephony" as *u8, "knowledge/fetched/vidfeat_videotelephony.raw" as *u8, store, out, cap) 67 68 df_puts("== TOPIC SUGGESTIONS / RECOMMENDATION (engagement lever) ==\n" as *u8) 69 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Recommender_system" as *u8, "knowledge/fetched/vidfeat_recsys.raw" as *u8, store, out, cap) 70 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Topic_model" as *u8, "knowledge/fetched/vidfeat_topicmodel.raw" as *u8, store, out, cap) 71 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Okapi_BM25" as *u8, "knowledge/fetched/vidfeat_bm25.raw" as *u8, store, out, cap) 72 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Latent_Dirichlet_allocation" as *u8, "knowledge/fetched/vidfeat_lda.raw" as *u8, store, out, cap) 73 74 df_puts("== MOBILE DELIVERY (the operator's emphasis) ==\n" as *u8) 75 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Progressive_web_app" as *u8, "knowledge/fetched/vidfeat_pwa.raw" as *u8, store, out, cap) 76 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Responsive_web_design" as *u8, "knowledge/fetched/vidfeat_rwd.raw" as *u8, store, out, cap) 77 78 df_puts("video-feature research: fetched/have=" as *u8); df_putn(ok); df_puts(" / 18\n" as *u8) 79 if ok >= 15 { df_puts("verdict=GREEN (video-feature corpus on disk; grep knowledge/fetched/vidfeat_*.raw to cite the exceed standard)\n" as *u8); sys_exit(0); return 0 } 80 df_puts("verdict=PARTIAL (re-run to resume the remaining fetches -- idempotent have-skip)\n" as *u8) 81 sys_exit(1); return 1 82}