This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spinal Codes (totally metal name) | |
Paper: http://nms.csail.mit.edu/papers/fp049-perry.pdf | |
This is a bitwise error correction code that can correct bit errors anywhere in the message. | |
It is not MDS and the strength of the code includes the processing time allowed for decoding. | |
More discussion at the end. | |
Simple version of the algorithm: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
q = x >> 32 | |
r = x - (q << 32) | |
i = 0 | |
while (q > 0) { | |
t = (q << 4) - q | |
q = t >> 32 | |
r_i = t - (q << 32) | |
if (++i % 2 == 1) | |
r -= r_i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint64_t f64(uint64_t x, uint64_t y) { | |
return y * (2 - y * x); | |
} | |
static uint64_t inverse64(uint64_t x) { | |
uint64_t y = x; | |
y = f64(x, y); | |
y = f64(x, y); | |
y = f64(x, y); | |
y = f64(x, y); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
/* | |
65-bit multiplication of two 64-bit values a, b | |
with low bits set to 1 (implicitly): | |
(2a + 1)(2b + 1) | |
= 4ab + 2a + 2b + 1 | |
Stuffing it back into a 64-bit value: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
// Convolutional encoder: | |
s = a * x + b * y; | |
t = c * x + d * y; | |
The problem with this one is that the "ezc" number of low bit zeros in e is also a number of additional bits that must be sent with each recovery word. | |
Specifically in the decoder this line: | |
> uint64_t yr = ei * t >> ezc; | |
So to tolerate ezc = 4 zero bits, we need to make t 4 bits longer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Reduction as in "Generalized Mersenne Numbers" J. Solinas (NSA). | |
Prime from "Solinas primes of small weight for fixed sizes" J. Angel. | |
Fp = 2^64-2^32+1 | |
t = 2^32 | |
d = 2 | |
f(t) = t^2 - c_1 * t - c_2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------------------------------------------------------------------------ | |
// Integer Arithmetic Modulo Mersenne Prime 2^61-1 | |
// p = 2^61 - 1 | |
static const uint64_t kFp61Prime = ((uint64_t)1 << 61) - 1; | |
// x + y (without reduction modulo p) | |
// For x,y < p this can be done up to 7 times (adding 8 values) without overflow | |
static inline uint64_t fp61_add(uint64_t x, uint64_t y) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some experiment results from today: | |
(0) Using NVENC directly is much more advantageous than using NvPipe library, which uses it indirectly. | |
(1) NVENC lossless video encode mode does worse than the prior open source lossless library (6-8 Mbps versus 4-5) | |
(2) NVENC only allows for one encoding context at a time, since the second available context must be used for color images. So multiple depth images need to be combined before encoding, or it must be paired with software encoding. Still not sure how to make this practical. | |
(3) Using Zstd for high bits is best done the naive way without any filtering. Tried a few options and found that works best. | |
(4) Rescaling the input data to 0...2047 (as wide as possible) to reduce the impact of low bit errors ends up introducing more high bit errors. | |
(5) Using Zstd for high bits + NVENC for low bits produces files that can be arbitrarily small, in trade for errors in the output. It's hard to judge however the impact of the errors it introduces. If the bandwidth requir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2019 (c) Christopher A. Taylor. All rights reserved. | |
/* | |
Xrcap capture client C API for the RGBD Capture Server. | |
Built on top of CaptureClient.hpp | |
*/ | |
//------------------------------------------------------------------------------ | |
// C Boilerplate |