Skip to content

Instantly share code, notes, and snippets.

@master-of-zen
master-of-zen / fields.json
Last active April 23, 2021 19:04
Aomenc stat fields
# Fields meanings: <source root>/av1/encoder/firstpass.h
fields = [
"frame",
"weight",
"intra_error",
"frame_avg_wavelet_energy",
"coded_error",
"sr_coded_error",
"tr_coded_error",
"pcnt_inter",

Goals and motivation

Current fast scene detection in rav1e relatively slow to compared methods of scene detection, and have proclivity to show false results or don't detect scene changes where they appear

This pr reworks fast scene detection algorithm, making it faster, better, and more accurate

Achieved goals are:

  • Faster decision making ( Both less and more efficient computations )
  • More accurate scene detection, by adjusting threshold based on previous frames
  • Frame downscale for faster decisions.
  for x in 1..=scale {
    let src_row = &data_origin[(src.cfg.stride * 2 + x)..];
    let local_sum: usize = (1..scale)
      .into_par_iter()
      .map(|y| u32::cast_from(src_row[col * 2 + y]) as usize)
      .sum();
    sum += local_sum;
  }
let mut sum = 0;

for x in 1..=scale {
  let src_row = &data_origin[(src.cfg.stride * 2 + x)..];
  sum += (1..scale)
    .into_par_iter()
    .for_each(|y| u32::cast_from(src_row[col * 2 + y]) as usize)
    .sum();
 }
let mut sum = 0;

for x in 1..=scale {
  let src_row = &data_origin[(src.cfg.stride * 2 + x)..];
  for y in 1..=scale {
    sum += u32::cast_from(src_row[col * 2 + y]) as usize
  }
}

Main changes

  • Y plane downscaling before comparison
  • Frame buffer for keeping scaled frames as long as they required

2160p

Old

#!/usr/bin/env python
from matplotlib import pyplot as plt
import matplotlib
matplotlib.rc('xtick', labelsize=24)
matplotlib.rc('ytick', labelsize=24)
data = {
10: {
#!/usr/bin/env python
from matplotlib import pyplot as plt
import matplotlib
matplotlib.rc('xtick', labelsize=24)
matplotlib.rc('ytick', labelsize=24)
data = {
10: {

rav1e --rdo-lookahead-frames research

Motivation:

Make speed settings faster with reasonable trade-off on different rdo-lookahead-frames values and suggest new defaults for each speed

Encoding speed difference

BD-rate difference