mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-22 21:09:34 -10:00
rmp4_mux writes "ulaw" tracks and rwav reads mu-law back, but nothing in libretro-common made the codes. A core replacing FFmpeg for recording had pcm_mulaw for that and nothing to replace it with. - convert_s16_to_ulaw: each sample's top 14 bits, and the code whose decision levels - the midpoints between neighbouring codes' reconstruction levels, rounded - bracket it, found by a binary search over G.711's levels: no table. The same codes FFmpeg's pcm_mulaw writes, all 65536. - convert_float_to_ulaw: floats in -1..1 rounded to 16 bits (clipped outside) first. samples/audio/float_to_ulaw/float_to_ulaw_test checks silence, both full scales, the codes moving one way through each half, each sample's level the nearest (by G.711's decoding, written out in the test) within the 8 the dropped bits and the levels' rounding allow, and floats giving the 16-bit samples' codes, clipping and rounding. --ramp writes every 16-bit sample and --ffmpeg compares FFmpeg's pcm_mulaw codes for it; a new CI step runs the two. Made to fail by dropping the levels' rounding (8 codes unlike FFmpeg's) and by truncating floats.