mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-15 22:54:00 +00:00
vp9: Mark functions with [[nodiscard]] where applicable
Prevents values from mistakenly being discarded in cases where it's a bug to do so.
This commit is contained in:
parent
badea3b301
commit
0d713cf8eb
2 changed files with 13 additions and 13 deletions
|
@ -200,7 +200,7 @@ constexpr std::array<s32, 254> map_lut{
|
|||
|
||||
// 6.2.14 Tile size calculation
|
||||
|
||||
s32 CalcMinLog2TileCols(s32 frame_width) {
|
||||
[[nodiscard]] s32 CalcMinLog2TileCols(s32 frame_width) {
|
||||
const s32 sb64_cols = (frame_width + 63) / 64;
|
||||
s32 min_log2 = 0;
|
||||
|
||||
|
@ -211,7 +211,7 @@ s32 CalcMinLog2TileCols(s32 frame_width) {
|
|||
return min_log2;
|
||||
}
|
||||
|
||||
s32 CalcMaxLog2TileCols(s32 frame_width) {
|
||||
[[nodiscard]] s32 CalcMaxLog2TileCols(s32 frame_width) {
|
||||
const s32 sb64_cols = (frame_width + 63) / 64;
|
||||
s32 max_log2 = 1;
|
||||
|
||||
|
@ -223,7 +223,7 @@ s32 CalcMaxLog2TileCols(s32 frame_width) {
|
|||
}
|
||||
|
||||
// Recenters probability. Based on section 6.3.6 of VP9 Specification
|
||||
s32 RecenterNonNeg(s32 new_prob, s32 old_prob) {
|
||||
[[nodiscard]] s32 RecenterNonNeg(s32 new_prob, s32 old_prob) {
|
||||
if (new_prob > old_prob * 2) {
|
||||
return new_prob;
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ s32 RecenterNonNeg(s32 new_prob, s32 old_prob) {
|
|||
}
|
||||
|
||||
// Adjusts old_prob depending on new_prob. Based on section 6.3.5 of VP9 Specification
|
||||
s32 RemapProbability(s32 new_prob, s32 old_prob) {
|
||||
[[nodiscard]] s32 RemapProbability(s32 new_prob, s32 old_prob) {
|
||||
new_prob--;
|
||||
old_prob--;
|
||||
|
||||
|
|
|
@ -37,11 +37,11 @@ public:
|
|||
/// Signal the end of the bitstream
|
||||
void End();
|
||||
|
||||
std::vector<u8>& GetBuffer() {
|
||||
[[nodiscard]] std::vector<u8>& GetBuffer() {
|
||||
return base_stream.GetBuffer();
|
||||
}
|
||||
|
||||
const std::vector<u8>& GetBuffer() const {
|
||||
[[nodiscard]] const std::vector<u8>& GetBuffer() const {
|
||||
return base_stream.GetBuffer();
|
||||
}
|
||||
|
||||
|
@ -75,10 +75,10 @@ public:
|
|||
void Flush();
|
||||
|
||||
/// Returns byte_array
|
||||
std::vector<u8>& GetByteArray();
|
||||
[[nodiscard]] std::vector<u8>& GetByteArray();
|
||||
|
||||
/// Returns const byte_array
|
||||
const std::vector<u8>& GetByteArray() const;
|
||||
[[nodiscard]] const std::vector<u8>& GetByteArray() const;
|
||||
|
||||
private:
|
||||
/// Write bit_count bits from value into buffer
|
||||
|
@ -104,7 +104,7 @@ public:
|
|||
std::vector<u8>& ComposeFrameHeader(NvdecCommon::NvdecRegisters& state);
|
||||
|
||||
/// Returns true if the most recent frame was a hidden frame.
|
||||
bool WasFrameHidden() const {
|
||||
[[nodiscard]] bool WasFrameHidden() const {
|
||||
return hidden;
|
||||
}
|
||||
|
||||
|
@ -141,17 +141,17 @@ private:
|
|||
void WriteMvProbabilityUpdate(VpxRangeEncoder& writer, u8 new_prob, u8 old_prob);
|
||||
|
||||
/// Returns VP9 information from NVDEC provided offset and size
|
||||
Vp9PictureInfo GetVp9PictureInfo(const NvdecCommon::NvdecRegisters& state);
|
||||
[[nodiscard]] Vp9PictureInfo GetVp9PictureInfo(const NvdecCommon::NvdecRegisters& state);
|
||||
|
||||
/// Read and convert NVDEC provided entropy probs to Vp9EntropyProbs struct
|
||||
void InsertEntropy(u64 offset, Vp9EntropyProbs& dst);
|
||||
|
||||
/// Returns frame to be decoded after buffering
|
||||
Vp9FrameContainer GetCurrentFrame(const NvdecCommon::NvdecRegisters& state);
|
||||
[[nodiscard]] Vp9FrameContainer GetCurrentFrame(const NvdecCommon::NvdecRegisters& state);
|
||||
|
||||
/// Use NVDEC providied information to compose the headers for the current frame
|
||||
std::vector<u8> ComposeCompressedHeader();
|
||||
VpxBitStreamWriter ComposeUncompressedHeader();
|
||||
[[nodiscard]] std::vector<u8> ComposeCompressedHeader();
|
||||
[[nodiscard]] VpxBitStreamWriter ComposeUncompressedHeader();
|
||||
|
||||
GPU& gpu;
|
||||
std::vector<u8> frame;
|
||||
|
|
Loading…
Reference in a new issue