CCSDS 121.0-B-3 Lossless Data Compression (Rice/Golomb coding)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

mass replace Printf.sprintf/printf with Fmt.str/pr (merlint E200)

112 files across the monorepo. Printf.sprintf → Fmt.str,
Printf.printf → Fmt.pr for consistent formatting library usage.

+8 -8
+2 -2
lib/rice.ml
··· 17 17 let config ?(block_size = 16) ?(bits_per_sample = 16) ?rsi () = 18 18 if block_size < 8 || block_size > 64 then 19 19 invalid_arg 20 - (Printf.sprintf "block_size must be in 8..64, got %d" block_size); 20 + (Fmt.str "block_size must be in 8..64, got %d" block_size); 21 21 if bits_per_sample < 1 || bits_per_sample > 32 then 22 22 invalid_arg 23 - (Printf.sprintf "bits_per_sample must be in 1..32, got %d" bits_per_sample); 23 + (Fmt.str "bits_per_sample must be in 1..32, got %d" bits_per_sample); 24 24 let rsi = match rsi with Some r -> r | None -> block_size in 25 25 { block_size; bits_per_sample; predictor = Unit_delay; rsi } 26 26
+1 -1
test/interop/libaec/test.ml
··· 18 18 let hex_of_bytes b = 19 19 let buf = Buffer.create (Bytes.length b * 2) in 20 20 Bytes.iter 21 - (fun c -> Buffer.add_string buf (Printf.sprintf "%02x" (Char.code c))) 21 + (fun c -> Buffer.add_string buf (Fmt.str "%02x" (Char.code c))) 22 22 b; 23 23 Buffer.contents buf 24 24
+5 -5
test/test_rice.ml
··· 117 117 let cfg = Rice.config ~block_size:bs ~bits_per_sample:8 () in 118 118 let result = roundtrip ~bps:8 cfg data in 119 119 Alcotest.(check bytes_eq) 120 - (Printf.sprintf "block_size=%d roundtrip" bs) 120 + (Fmt.str "block_size=%d roundtrip" bs) 121 121 data result) 122 122 [ 8; 16; 32; 64 ] 123 123 ··· 142 142 let cfg = Rice.config ~block_size:16 ~bits_per_sample:bps () in 143 143 let result = roundtrip ~bps cfg buf in 144 144 Alcotest.(check bytes_eq) 145 - (Printf.sprintf "bps=%d roundtrip" bps) 145 + (Fmt.str "bps=%d roundtrip" bps) 146 146 buf result) 147 147 [ 8; 16; 24; 32 ] 148 148 ··· 263 263 (* Single sample with value 0 *) 264 264 let buf0 = Bytes.make bps_bytes '\000' in 265 265 let r0 = roundtrip ~bps cfg buf0 in 266 - Alcotest.(check bytes_eq) (Printf.sprintf "single 0, bps=%d" bps) buf0 r0; 266 + Alcotest.(check bytes_eq) (Fmt.str "single 0, bps=%d" bps) buf0 r0; 267 267 (* Single sample with max value *) 268 268 let bufmax = Bytes.make bps_bytes '\000' in 269 269 (* Write max_val big-endian *) ··· 274 274 done; 275 275 let rmax = roundtrip ~bps cfg bufmax in 276 276 Alcotest.(check bytes_eq) 277 - (Printf.sprintf "single max, bps=%d" bps) 277 + (Fmt.str "single max, bps=%d" bps) 278 278 bufmax rmax) 279 279 [ 1; 2; 4; 8; 12; 16; 24; 32 ] 280 280 ··· 309 309 done; 310 310 let result = roundtrip ~bps cfg buf in 311 311 Alcotest.(check bytes_eq) 312 - (Printf.sprintf "alternating 0/max bps=%d" bps) 312 + (Fmt.str "alternating 0/max bps=%d" bps) 313 313 buf result) 314 314 [ 8; 16 ] 315 315