For key frames: increase the sequence index until the last 7 bits are all zeroes. If this results in an overflow, wraparound to 0. Also: * Allow setting and getting the sequence index * Allow getting LayerId Bug: webrtc:358039777 Change-Id: Ibe16689a3d1eb5706d4fce5c9220770046f26896 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/362540 Reviewed-by: Erik Språng <sprang@webrtc.org> Auto-Submit: Fanny Linderborg <linderborg@webrtc.org> Commit-Queue: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/main@{#43042}
49 lines
1.6 KiB
C++
49 lines
1.6 KiB
C++
/*
|
|
* Copyright 2024 The WebRTC project authors. All rights reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#ifndef VIDEO_CORRUPTION_DETECTION_HALTON_SEQUENCE_H_
|
|
#define VIDEO_CORRUPTION_DETECTION_HALTON_SEQUENCE_H_
|
|
|
|
#include <vector>
|
|
|
|
namespace webrtc {
|
|
|
|
// Generates the Halton sequence: a low discrepancy sequence of doubles in the
|
|
// half-open interval [0,1). See https://en.wikipedia.org/wiki/Halton_sequence
|
|
// for information on how the sequence is constructed.
|
|
class HaltonSequence {
|
|
public:
|
|
// Creates a sequence in `num_dimensions` number of dimensions. Possible
|
|
// values are [1, 5].
|
|
explicit HaltonSequence(int num_dimensions);
|
|
// Creates a default sequence in a single dimension.
|
|
HaltonSequence() = default;
|
|
HaltonSequence(const HaltonSequence&) = default;
|
|
HaltonSequence(HaltonSequence&&) = default;
|
|
HaltonSequence& operator=(const HaltonSequence&) = default;
|
|
HaltonSequence& operator=(HaltonSequence&&) = default;
|
|
~HaltonSequence() = default;
|
|
|
|
// Gets the next point in the sequence where each value is in the half-open
|
|
// interval [0,1).
|
|
std::vector<double> GetNext();
|
|
int GetCurrentIndex() const { return current_idx_; }
|
|
void SetCurrentIndex(int idx);
|
|
void Reset();
|
|
|
|
private:
|
|
int num_dimensions_ = 1;
|
|
int current_idx_ = 0;
|
|
};
|
|
|
|
} // namespace webrtc
|
|
|
|
#endif // VIDEO_CORRUPTION_DETECTION_HALTON_SEQUENCE_H_
|