mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 17:29:57 -04:00
make_picture allocated the three 16-bit deband planes (6.2 MB at 1080p) for every picture and freed them after it, 60 times a second while a movie played, and in its usual path (8-bit, deband on, no overlay) a failed allocation ended the game with "movie: out of memory for a WxH frame", while the slower path and the frame allocation itself drop the frame through movie_oom_log. run_stripes' comment records that FATAL at 45.7 GB of commit on an RX 580. A verifier's probe measured 0.34-0.36 ms and about 1000 page faults a picture for the per-picture allocation against 0.04 ms and 3 faults with kept planes, about 12% of the convert thread's time per picture. Each Video now keeps its planes (y16, u16, v16, plane_room), used only by its convert thread and made again only for a larger picture; planes_for frees what it has and allocates afresh, and on a failure frees all three and keeps none. Both paths take their planes from it and drop the frame through movie_oom_log when it fails. finalize frees the planes after stop_thread has joined the convert thread, which also covers the destructor. The path with the deband off and no overlay no longer allocates planes it never used. tests/movie_planes_check.py cuts the deband, the conversions, run_stripes, planes_for and make_picture from ov_movie2.c with a stub dav1d picture and a malloc that fails on request: two pictures of one size allocate the planes once, a larger one makes them again, the NV12 frame (and the overlay's RGBA frame) equals what fresh planes give, also with an earlier picture left in the kept planes, and a failed plane allocation drops the frame with nothing left allocated. The compile check passes with no new warnings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9.6 KiB
9.6 KiB