import type { FrameDrawer, FrameDrawerContext } from './nitro/VideoPipeline.nitro'; /** * Callback signature for `drawWithFloat16`: fills a pre-allocated `Float32Array` * of length `ctx.width * ctx.height * 4` with **half-float RGBA** pixels, in * `R, G, B, A` order (no BGRA swizzle — the `rgbaFp16` buffer is RGBA-ordered). * * Color space / range contract (see `PixelFormat` `'rgbaFp16'`, #99): * - **Linear Rec.2020**, **premultiplied** alpha, **extended range** — channel * values may exceed `1.0` for highlights above SDR white (that headroom is * the entire point of HDR compose). Values are stored as IEEE half-floats, so * the representable range is roughly `±65504`. * - You write `Float32Array` for convenience; the helper converts each channel * to a half-float before handing the buffer to the encoder. Producing the * correct *linear Rec.2020* values is the caller's responsibility — the helper * only transports bytes, it does not color-manage. */ export type Float16Drawer = (pixels: Float32Array, ctx: FrameDrawerContext) => void; /** * The half-float (`rgbaFp16`) counterpart to {@link drawWithRGBA} — the * ergonomic CPU worklet path for **HDR compose** (`output.colorRange: 'hdr'`, * #99). Your drawer fills a `Float32Array` of `width * height * 4` linear * Rec.2020 RGBA channels; the helper converts them to IEEE half-floats and * `writeBytes`es the `width * height * 8`-byte buffer the encoder appends. * * ```ts * import { Video, drawWithFloat16 } from 'react-native-video-pipeline'; * * // iOS worklet-generated HDR (v0.5.0). Source-clip Video.compose HDR and all * // of Android are not yet supported — see output.colorRange. * await Video.synthesize({ * output: { path, width, height, fps, colorRange: 'hdr' }, * duration: { mode: 'fixed', seconds: 1 }, * drawFrame: drawWithFloat16((pixels, ctx) => { * 'worklet'; * const i = (y * ctx.width + x) * 4; * pixels[i] = 2.5; // R — an HDR highlight above SDR white (1.0) * pixels[i + 1] = 1.0; // G * pixels[i + 2] = 1.0; // B * pixels[i + 3] = 1.0; // A (premultiplied) * }), * }); * ``` * * It **requires an `rgbaFp16` target** and throws on an 8-bit one — the inverse * of `drawWithRGBA`, which throws on `rgbaFp16`. An `rgbaFp16` target only * appears under `output.colorRange: 'hdr'`. * * The float32→float16 conversion is round-to-nearest-even and is **inlined** * here rather than factored into a helper call: a worklet cannot call a plain * (non-worklet) function on the UI runtime, and calling a sibling module-scope * worklet breaks when this package is consumed pre-built (#75). Correctness is * covered end-to-end by `__tests__/drawWithFloat16.test.ts`, which compares the * emitted halves against `Math.f16round` across normals, subnormals, * highlights, and specials. */ export declare function drawWithFloat16(draw: Float16Drawer): FrameDrawer; //# sourceMappingURL=drawWithFloat16.d.ts.map