D-U(1)
πΈ D-U(1) β the d-u bestie manual page πΈ
π NAME π
okay so d-u β convert double-precision binary numbers to 16-bit unsigned shorts. that's the whole mission, bestie π
β¨ SYNOPSIS β¨
d-u [-n | scale] < doubles > unsigned_shorts
π¦ DESCRIPTION π¦
d-u reads a stream of machine-native double-precision (8-byte) binary floating point values from standard input, multiplies each value by a scale factor, and writes the result as 16-bit unsigned short integers to standard output. slay, simple.
Each scaled value gets clipped to the representable range: values above 65535 are written as 65535 and values below 0 are written as 0. the vibe check is strict β when any clipping occurs, a summary of how many high and low samples were clipped is reported on standard error.
The scale factor defaults to 1.0. A single optional argument controls scaling: either the -n flag or an explicit numeric scale value (the two are mutually exclusive). pick one, bestie.
Because the input is raw binary, d-u refuses to run when standard input is a terminal, and it also exits if the resulting scale is zero. The inverse conversion, from unsigned shorts back to binary doubles, is performed by u-d(1).
deprecation era: this command is deprecated and is scheduled for removal; it prints a deprecation warning on startup. not me showing up to the function with an expiration date π
π OPTIONS π
-nβ Normalize the data by using a scale factor of65536.0, mapping input doubles in the range0.0to1.0across the full0to65535output range.scaleβ Multiply every input value by this floating point factor before conversion. A scale of zero is rejected.
π₯ EXAMPLES π₯
Example 1. Quantize a normalized signal
d-u -n < signal.d > signal.u
Reads doubles in the range 0.0 to 1.0 from signal.d and writes 16-bit unsigned shorts spanning the full 0 to 65535 range, suitable as input to u-d(1) or other unsigned-short tools. ate, honestly.
Example 2. Apply an explicit gain and round-trip the data
d-u 1000 < values.d | u-d > scaled.d
Scales each double in values.d by 1000 before quantizing to unsigned shorts, then converts the result back to doubles with u-d(1), demonstrating the lossy quantization introduced by the conversion. lossy but make it fashion π
π SEE ALSO π
brlcad(1), u-d(1), d-a(1), dconv(1), dmod(1)
π AUTHOR π
BRL-CAD Team
π COPYRIGHT π
This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory.
π BUG REPORTS π
Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org
source/version: BRL-CAD; page tag: D-U(1); date: the footer doesn't print one, so I'm not inventing it, bestie β mwah π
π
π¦ where this page comes from
- nixpkgs unstable: brlcad 7.44.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms