Repository navigation
Releases
Releases · Rabbit-Company/regrain
v0.5.0
Changes
diffmeasures the grain a denoiser took away rather than the difference between the two videos. Most denoisers weaken the finest grain instead of removing it, so part of it stays in the picture, and the difference then holds less grain than was taken away and leans to the coarser grain that was removed in full. regrain put back grain of that strength and pattern, which left the picture weaker and coarser than the source. It now measures how much more the source varies than the denoised picture, and how much more alike its neighbouring pixels are, in every flat block. On a 1080p film scan in H.264 with rabbit-denoise, the grain put back went from 22 to 8 per cent weaker than the source's and finer, from 0.52 to 0.47 neighbouring pixel likeness where the source has 0.38. With NL4D it went from 10 per cent weaker to the source's strength. Tables measured against an encode, which removes the grain it smooths in full, stay about the same.- The README's workflow measures the grain against the encode rather than the denoised video, so the table also holds the grain the encoder smoothed away. Measuring against the denoised video still works.
v0.4.0
Changes
applyandexportcount frame times as libaom does when it encodes with a table: from the first frame, rounded down. regrain rounded them up and counted from the time stamp zero, soexportof an IVF or MP4 encode placed two of every three changes at 24000/1001 one tick after the time libaom uses, and libaom read such a table with each entry one frame longer. A raw IVF stream that starts later than zero had every entry shifted.- Constant frame rate video gets the exact time of each frame, worked out from its frame number, so Matroska's millisecond time stamps no longer move a frame across a table boundary. This also holds for an MP4 remuxed from Matroska, which keeps the rounding. A video counts as constant frame rate when every frame sits within a millisecond of a frame of the lowest fitting frame rate among
--fps, the common rates from 15 to 240 and the one the time stamps give. Frames may be skipped, but not repeated. Variable frame rate video keeps its time stamps. - A table entry that ends up to a millisecond after a frame ends at that frame, as an entry that starts that close to a frame already started there. Tables that regrain 0.3 exported, or that grav1synth writes, round frame times up, and tables taken from Matroska round them to milliseconds, so their ends sit just after the frame they were written for. With exact frame times that frame would have kept the grain of the entry before a gap. Tables with exact frame times, as libaom and
diffwrite them, are read as before.
v0.3.9
Fixes
applygave grain to the frame a table entry ends at when no entry starts there, such as the last frame of a video whose table ends where that frame starts. Matroska rounds frame times to milliseconds, so at 24000/1001 it can store that frame up to half a millisecond before the end, and regrain counted it as inside the entry.exportthen showed the entry one frame longer than the table. regrain now tells from the uneven steps between frame times that the container rounded them, and counts a frame that rounding can have moved before an end as at the end. Containers that store exact times, such as IVF and MP4, look entries up as before.
v0.3.8
Changes
diffputs back grain that shimmers as much as the source's, not more. AV1 draws a new grain pattern for every frame, but part of a source's grain often stays in place from one frame to the next. The grain was put back at the strength of a single frame, so it changed two to three times more between frames than the source's and drew the eye. In a still shot of an anime Blu-ray, the source's grain changed by 0.44 between frames and the grain regrain put back by 0.88. regrain now compares the grain of consecutive frames where the picture stands still and scales each scene's grain to match, here to 0.55.--full-strengthkeeps the strength of a single frame, and-vshows each scene's scale asstrength.
v0.3.7
Fixes
diffstopped withsize_mismatchon a source whose Matroska track has a pixel crop, such as a UHD Blu-ray remux of a 4:3 show stored as 3840x2160 with 480 pixels cropped from each side. ffprobe reports the stored size, but ffmpeg applies the crop when decoding and hands back 2880x2160 frames, so regrain compared the denoised video against a size the source never has. regrain now takes the container crop off the probed size, as ffmpeg does, and--cropcounts in the picture that is left.
v0.3.6
Fixes
diffdrew grain coarser and more clumped than the source's. Every flat block counted almost the same in the grain pattern, so faint blocks decided it in scenes with large dark areas, where an encoder or denoiser also smooths dim texture and leaves a coarser difference. In a dark scene of an anime Blu-ray with fine grain, neighbouring grain pixels were alike by 0.11 in the source and by 0.25 in the encode, and still by 0.16 three pixels apart where the source had 0.03. regrain now measures the pattern over the grain of all blocks together, so blocks with strong grain decide it, and takes out the slope of each block first. The same encode now has 0.14 and 0.06.diff --startbegan one frame late when the container stored the first frame's timestamp rounded down, as Matroska does in milliseconds for about half the frames at 23.976 fps. Both videos started on the same later frame, so the pairing stayed right, but the table described the video one frame later than asked. regrain now seeks halfway to the frame before, as it already did for every later part of the video.
v0.3.5
Fixes
diffgave pure black grain when a scene also had a few flat blocks just below black, as an encode measured against its source often has. The grain was cut to zero only below the darkest measured level, so those few blocks moved the cut under black, and the decoder then drew the grain of the darkest point on every black frame. regrain now counts measured blocks by level, as it counts the grain free ones, and places the cut where it keeps the most blocks right. The same rule now also cuts the grain at clipped white instead of drawing it there. The levels next to a cut keep the grain measured at them, so a highlight just under clipped white gets its own weaker grain and not that of the brighter mid tones.diffmeasured an 8 bit source against a 10 bit encode with the rounding of the source's own 8 bits counted as grain, a deviation of 0.29 on the 0 to 255 scale. A screen rounds the output to whole steps again, so faint grain came out too strong: a clean logo got 0.53 where the source had 0.38. regrain now takes that rounding away, unless--scalefilters the source at the measured depth.
v0.3.4
Fixes
diffread every part of an IVF file after the first one starting one frame early, so an AV1 encode measured against its source failed withmisalignedat the first stretch with enough motion to show it. ffmpeg keeps the frame still on screen at the seek time when frames carry a duration, as in IVF, and drops it when they do not, as in most Matroska files. regrain now seeks two frames early and picks the first frame by its own timestamp, so both kinds of file land on the same frame.
v0.3.3
Features
diff --allow-vfraccepts variable frame rate videos whose frames match one to one, such as a source with 24 and 30 fps stretches and an encode of it fed to the encoder frame by frame. regrain reads the timestamp of every frame and seeks to it, pairs the frames in order and times the table at the nominal frame rate. Before, such a source had to be remuxed to a constant frame rate first.
v0.3.2
Features
apply,removeandexportreport progress:startandprogressevents with--progress json, with thestagethey are in (read,writeorverify) and apercentfor the whole command, and a progress line on standard error with text output. Verifying, which decodes the whole output with dav1d, reports the frames decoded. With--progress json, their output now begins with astartevent.diff --scale WIDTHxHEIGHTscales the source with Lanczos after--crop, for a denoised video or encode that was downscaled, such as a 4K original encoded at 1080p. Before, the source had to be scaled into a lossless copy first. Only frames a sampled scan measures are scaled. The table is the same as with a source scaled beforehand.
Other changes
- Uses rabbit-av1 0.1.2, whose decoder check reports the frames it has decoded.