UMOD(1)

πŸ“¦ version 7.44.0, in nixpkgs unstable

πŸ’… 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 β€” add add to each value. simple. slay.
  • -s sub β€” subtract sub from each value.
  • -m mult β€” multiply each value by mult.
  • -d div β€” divide each value by div. 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 power exp. main character energy honestly.
  • -r root β€” take the root root of each value (equivalent to raising to the power 1/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 πŸ’œ


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's umod, she's from BRL-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