diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-02-01 17:46:22 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-02-01 23:44:36 +0100 |
| commit | 49b655d3e1937018c46ed7f6a62e1157b247e426 (patch) | |
| tree | 45b4b6562e2575a458da5fef8a38af1437458ab6 /src/lib/rng.h | |
| parent | e50967fb2b67b76e139f11206994bc0505cab76c (diff) | |
Use a predictable RNG when adding noise to low-bitrate images.
The recovery code assumes that encoding a given frame from the
same data will always give the same output; it always encodes frame 0
again to set things up properly and if that frame is a different size
to the previous run everything breaks.
Diffstat (limited to 'src/lib/rng.h')
| -rw-r--r-- | src/lib/rng.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/lib/rng.h b/src/lib/rng.h new file mode 100644 index 000000000..f3349ce9b --- /dev/null +++ b/src/lib/rng.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2020 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + + +#include <stdint.h> + + +namespace dcpomatic { + + +/** @class RNG + * @brief Linear-feedback random number generator + */ +class RNG +{ +public: + RNG (int32_t seed); + + int32_t get (); + +private: + uint32_t _state; +}; + + +} + |
