Skip to content

Instantly share code, notes, and snippets.

@shreevari
shreevari / README.md
Last active August 17, 2021 11:22
Tuning activity masking

Extracting the activity mask from rav1e.

Even though the activity mask is decoupled from the encoding process, it is an uphill task to output a y4m of the activity masks for each frame currently. The easiest way to get a quick activity mask from the encoder is to write out activity values to a csv file as they are computed. An example patch that does this is present below as "extract-mask.diff"

The activity map

The current attempt to create a map of activity is by computing the cube root of standard deviation(simply, 6th root of variance) of each 8x8 block. Keep track of the activity map implementation in this pull request.

Previous attempts

Attempts of quantifying the activity of an 8x8 block included different trials. One method to do so was to perform a forward transform(DCT) on the image and apply the Constrast Sensitivity Function (CSF) with zeroed DC coefficient and accumulate to get a measure of activity. The distribution of activity was too polar th

@shreevari
shreevari / build_error.txt
Created June 16, 2019 18:05
Building with cargo produces the following error.
error: cannot find macro `scan_fmt_help!` in this scope
--> src/bin/common.rs:417:74
|
417 | let (g_x, g_y, b_x, b_y, r_x, r_y, wp_x, wp_y, max_lum, min_lum) = scan_fmt!(mastering_display_opt, "G({},{})B({},{})R({},{})WP({},{})L({},{})", f64, f64, f64, f64, f64, f64, f64, f64, f64, f64).expect("Cannot parse the mastering display option");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: cannot find macro `scan_fmt_help!` in this scope
--> src/bin/common.rs:443:23
@shreevari
shreevari / Segfault
Last active June 5, 2019 21:02
The following implementation runs into segmentation faults.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
warning: Loadable section ".note.gnu.property" outside of ELF segments
1388x926 @ 24/1 fps
[New Thread 0x7ffff7a7e700 (LWP 13252)]
[New Thread 0x7ffff787d700 (LWP 13253)]
Thread 2 "rav1e" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff7a7e700 (LWP 13252)]
<core::slice::Iter<T> as core::iter::traits::iterator::Iterator>::fold (init=1240900, f=<optimized out>, self=...)
@shreevari
shreevari / Description.md
Last active July 10, 2019 16:10
Relation between biasing scale and encoded file size.

Biasing RDO using scale s_1

biased_distortion = actual_distortion * (s_1 * (mean_activity as f64 / activity as f64) + s_0)

Sets encoded : subset3-y4m and objective-1-fast.

Interpolated scale is to be used as a starting point for Newton-Raphson method to derive the biasing scale as follows:

s' = s - (MSE/f'(s))
where f : s -&gt; file_size