Flutter Engine
The Flutter Engine
Classes | Functions | Variables
generate_fir_coeff Namespace Reference

Classes

class  IndexTracker
 

Functions

def withinStdDev (n)
 
def withinStdDevRange (a, b)
 

Variables

int samples_per_pixel = 4
 
int subpxls_per_pixel = 3
 
list sample_offsets
 
int sample_units_width = 5
 
int std_dev_max = 3
 
int target_sum = 0x110
 
list coeffs = []
 
list coeffs_rounded = []
 
int current_sample_left = sample_offset - sample_units_width
 
int current_std_dev_left = -std_dev_max
 
bool done = False
 
 current_sample_right = math.floor(current_sample_left + 1)
 
int current_std_dev_right
 
def coverage = withinStdDevRange(current_std_dev_left, current_std_dev_right)
 
int delta = 0
 
 coeffs_rounded_sum = sum(coeffs_rounded)
 
list coeff_diff
 
 coeff_pkg
 
 num_elements_to_force_round = abs(coeffs_rounded_sum - target_sum)
 
tuple coeffs_rounded_aligned = ([0] * int(sample_align)) + coeffs_rounded
 

Detailed Description

Copyright 2013 Google Inc.

Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.

Function Documentation

◆ withinStdDev()

def generate_fir_coeff.withinStdDev (   n)
Returns the percent of samples within n std deviations of the normal.

Definition at line 16 of file generate_fir_coeff.py.

16def withinStdDev(n):
17 """Returns the percent of samples within n std deviations of the normal."""
18 return math.erf(n / math.sqrt(2))
19
20

◆ withinStdDevRange()

def generate_fir_coeff.withinStdDevRange (   a,
  b 
)
Returns the percent of samples within the std deviation range a, b

Definition at line 21 of file generate_fir_coeff.py.

21def withinStdDevRange(a, b):
22 """Returns the percent of samples within the std deviation range a, b"""
23 if b < a:
24 return 0;
25
26 if a < 0:
27 if b < 0:
28 return (withinStdDev(-a) - withinStdDev(-b)) / 2;
29 else:
30 return (withinStdDev(-a) + withinStdDev(b)) / 2;
31 else:
32 return (withinStdDev(b) - withinStdDev(a)) / 2;
33
34
35# We have some smudged samples which represent the average coverage of a range.
36# We have a 'center' which may not line up with those samples.
37# From center make a normal where 5 sample widths out is at 3 std deviations.
38# The first and last samples may not be fully covered.
39
40# This is the sub-sample shift for each set of FIR coefficients
41# (the centers of the lcds in the samples)
42# Each subpxl takes up 1/3 of a pixel,
43# so they are centered at x=(i/n+1/2n), or 1/6, 3/6, 5/6 of a pixel.
44# Each sample takes up 1/4 of a pixel,
45# so the results fall at (x*4)%1, or 2/3, 0, 1/3 of a sample.

Variable Documentation

◆ coeff_diff

list generate_fir_coeff.coeff_diff
Initial value:
1= [(coeff_rounded - coeff) * delta
2 for coeff, coeff_rounded in zip(coeffs, coeffs_rounded)]
Definition: zip.py:1

Definition at line 106 of file generate_fir_coeff.py.

◆ coeff_pkg

generate_fir_coeff.coeff_pkg

Definition at line 118 of file generate_fir_coeff.py.

◆ coeffs

list generate_fir_coeff.coeffs = []

Definition at line 67 of file generate_fir_coeff.py.

◆ coeffs_rounded

list generate_fir_coeff.coeffs_rounded = []

Definition at line 68 of file generate_fir_coeff.py.

◆ coeffs_rounded_aligned

tuple generate_fir_coeff.coeffs_rounded_aligned = ([0] * int(sample_align)) + coeffs_rounded

Definition at line 132 of file generate_fir_coeff.py.

◆ coeffs_rounded_sum

generate_fir_coeff.coeffs_rounded_sum = sum(coeffs_rounded)

Definition at line 93 of file generate_fir_coeff.py.

◆ coverage

def generate_fir_coeff.coverage = withinStdDevRange(current_std_dev_left, current_std_dev_right)

Definition at line 84 of file generate_fir_coeff.py.

◆ current_sample_left

generate_fir_coeff.current_sample_left = sample_offset - sample_units_width

Definition at line 71 of file generate_fir_coeff.py.

◆ current_sample_right

int generate_fir_coeff.current_sample_right = math.floor(current_sample_left + 1)

Definition at line 76 of file generate_fir_coeff.py.

◆ current_std_dev_left

int generate_fir_coeff.current_std_dev_left = -std_dev_max

Definition at line 72 of file generate_fir_coeff.py.

◆ current_std_dev_right

int generate_fir_coeff.current_std_dev_right
Initial value:
1= current_std_dev_left + (
2 (current_sample_right - current_sample_left) / sample_units_width
3 ) * std_dev_max

Definition at line 80 of file generate_fir_coeff.py.

◆ delta

int generate_fir_coeff.delta = 0

Definition at line 92 of file generate_fir_coeff.py.

◆ done

bool generate_fir_coeff.done = False

Definition at line 74 of file generate_fir_coeff.py.

◆ num_elements_to_force_round

generate_fir_coeff.num_elements_to_force_round = abs(coeffs_rounded_sum - target_sum)

Definition at line 125 of file generate_fir_coeff.py.

◆ sample_offsets

list generate_fir_coeff.sample_offsets
Initial value:
1= [
2 math.modf(
3 (float(subpxl_index)/subpxls_per_pixel + 1.0/(2.0*subpxls_per_pixel))
4 * samples_per_pixel
5 ) for subpxl_index in range(subpxls_per_pixel)
6]

Definition at line 49 of file generate_fir_coeff.py.

◆ sample_units_width

int generate_fir_coeff.sample_units_width = 5

Definition at line 57 of file generate_fir_coeff.py.

◆ samples_per_pixel

int generate_fir_coeff.samples_per_pixel = 4

Definition at line 46 of file generate_fir_coeff.py.

◆ std_dev_max

int generate_fir_coeff.std_dev_max = 3

Definition at line 60 of file generate_fir_coeff.py.

◆ subpxls_per_pixel

int generate_fir_coeff.subpxls_per_pixel = 3

Definition at line 47 of file generate_fir_coeff.py.

◆ target_sum

int generate_fir_coeff.target_sum = 0x110

Definition at line 64 of file generate_fir_coeff.py.