UMOD(1)
π UMOD(1) β the BRL-CAD glow-up station
okay so real talk, this is the manual page for umod, one of the BRL-CAD girlies. she lives in the BRL-CAD family and she is obsessed with 16-bit unsigned short integers. yes bestie, this whole page is about her. let's go β¨
β¨ NAME β¨
umod β apply arithmetic operations to a stream of 16-bit unsigned short integers π
π¦ SYNOPSIS π¦
umod [-a add] [-s sub] [-m mult] [-d div] [-A] [-e exp] [-r root] [file.s] > output.s
πΈ DESCRIPTION πΈ
okay so here's the vibe: umod reads a stream of 16-bit unsigned short integers, applies a chain of arithmetic operations to each value, and writes the modified stream to standard output. she's a pipeline girlie fr fr. π
any number of add, subtract, multiply, divide, exponentiation, and absolute-value operations may be given β and here's the part that matters, bestie: they are applied in the exact order they appear on the command line. no reordering, no "we know better", none of that. she does them in order. periodt. π
and because she is genuinely that girl, umod does not recompute the operations for every single sample. instead she precomputes a lookup table covering all 65536 possible input values. iconic efficiency, no cap. β¨
results that exceed the representable range are clipped to 65535 (high) or 0 (low) β and the total number of clipped values is reported to standard error when processing finishes. so if you clipping too hard, she will tell you. π«Ά
if file.s is given it is read as input; otherwise umod reads from standard input. and don't forget her companions: smod(1) and imod(1) perform the same operations on signed short integer streams, and dmod(1) operates on double-precision floating point streams. the whole squad, truly a friend group π
π OPTIONS π
-a addβ addaddto each value. simple. slay.-s subβ subtractsubfrom each value.-m multβ multiply each value bymult.-d divβ divide each value bydiv. a divisor of zero is an error. do not do that π-Aβ replace each value with its absolute value. since the input is unsigned this only has an effect when a prior operation (such as subtraction) produced a negative intermediate result. so yeah, she's lowkey conditional π-e expβ raise each value to the powerexp. main character energy honestly.-r rootβ take the rootrootof each value (equivalent to raising to the power1/root). a root of zero is an error. same energy as the div-by-zero thing. don't. π
π EXAMPLES π
Example 1. Bias and scale a sample stream π
umod -a 100 -m 3 data.s > scaled.s
for each value, 100 is added first and the result is then multiplied by 3, writing the modified unsigned shorts to scaled.s. and listen β because operations apply in command-line order, swapping -a and -m would yield a different result. order matters, bestie, this is not a drill π₯
Example 2. Convert a pixel image to a stream and stretch its contrast π¦
pix-bw scene.pix | bw-d | d-u | umod -s 8000 -m 2 > stretched.s
the intensity of a pix(5) image is reduced to a single channel, converted to an unsigned short stream, then darkened by subtracting an offset and brightened by doubling β which is literally umod used as a stage in a pipeline. she's a team player, we love to see it π
π SEE ALSO π
brlcad(1), smod(1), imod(1), dmod(1), ustats(1) β go say hi, they're all lovely π«Ά
π§ 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 π§ β they're nice, promise. don't be shy.
no cap, that's the whole page. she'sumod, she's fromBRL-CAD, and this manual page is dated in that copyright range above β1989-2026, we stan a legacy queen. bye bestie!! ππ β¨
π¦ 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