!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/netdata/ml/   drwxr-xr-x
Free 13.07 GB of 57.97 GB (22.55%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     BitRateWindow.h (4.15 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
// SPDX-License-Identifier: GPL-3.0-or-later

#ifndef BIT_RATE_WINDOW_H
#define BIT_RATE_WINDOW_H

#include "BitBufferCounter.h"
#include "ml-private.h"

namespace ml {

class BitRateWindow {
public:
    enum class State {
        NotFilled,
        BelowThreshold,
        AboveThreshold,
        Idle
    };

    using Edge = std::pair<State, State>;
    using Action = size_t (BitRateWindow::*)(State PrevState, bool NewBit);

private:
    std::map<Edge, Action> EdgeActions = {
        // From == To
        {
            Edge(State::NotFilled, State::NotFilled),
            &BitRateWindow::onRoundtripNotFilled,
        },
        {
            Edge(State::BelowThreshold, State::BelowThreshold),
            &BitRateWindow::onRoundtripBelowThreshold,
        },
        {
            Edge(State::AboveThreshold, State::AboveThreshold),
            &BitRateWindow::onRoundtripAboveThreshold,
        },
        {
            Edge(State::Idle, State::Idle),
            &BitRateWindow::onRoundtripIdle,
        },


        // NotFilled => {BelowThreshold, AboveThreshold}
        {
            Edge(State::NotFilled, State::BelowThreshold),
            &BitRateWindow::onNotFilledToBelowThreshold
        },
        {
            Edge(State::NotFilled, State::AboveThreshold),
            &BitRateWindow::onNotFilledToAboveThreshold
        },

        // BelowThreshold => AboveThreshold
        {
            Edge(State::BelowThreshold, State::AboveThreshold),
            &BitRateWindow::onBelowToAboveThreshold
        },

        // AboveThreshold => Idle
        {
            Edge(State::AboveThreshold, State::Idle),
            &BitRateWindow::onAboveThresholdToIdle
        },

        // Idle => NotFilled
        {
            Edge(State::Idle, State::NotFilled),
            &BitRateWindow::onIdleToNotFilled
        },
    };

public:
    BitRateWindow(size_t MinLength, size_t MaxLength, size_t IdleLength,
                  size_t SetBitsThreshold) :
        MinLength(MinLength), MaxLength(MaxLength), IdleLength(IdleLength),
        SetBitsThreshold(SetBitsThreshold),
        CurrState(State::NotFilled), CurrLength(0), BBC(MinLength) {}

    std::pair<Edge, size_t> insert(bool Bit);

    void print(std::ostream &OS) const;

private:
    size_t onRoundtripNotFilled(State PrevState, bool NewBit) {
        (void) PrevState, (void) NewBit;

        CurrLength += 1;
        return CurrLength;
    }

    size_t onRoundtripBelowThreshold(State PrevState, bool NewBit) {
        (void) PrevState, (void) NewBit;

        CurrLength = MinLength;
        return CurrLength;
    }

    size_t onRoundtripAboveThreshold(State PrevState, bool NewBit) {
        (void) PrevState, (void) NewBit;

        CurrLength += 1;
        return CurrLength;
    }

    size_t onRoundtripIdle(State PrevState, bool NewBit) {
        (void) PrevState, (void) NewBit;

        CurrLength += 1;
        return CurrLength;
    }

    size_t onNotFilledToBelowThreshold(State PrevState, bool NewBit) {
        (void) PrevState, (void) NewBit;

        CurrLength = MinLength;
        return CurrLength;
    }

    size_t onNotFilledToAboveThreshold(State PrevState, bool NewBit) {
        (void) PrevState, (void) NewBit;

        CurrLength += 1;
        return CurrLength;
    }

    size_t onBelowToAboveThreshold(State PrevState, bool NewBit) {
        (void) PrevState, (void) NewBit;

        CurrLength = MinLength;
        return CurrLength;
    }

    size_t onAboveThresholdToIdle(State PrevState, bool NewBit) {
        (void) PrevState, (void) NewBit;

        size_t PrevLength = CurrLength;
        CurrLength = 1;
        return PrevLength;
    }

    size_t onIdleToNotFilled(State PrevState, bool NewBit) {
        (void) PrevState, (void) NewBit;

        BBC = BitBufferCounter(MinLength);
        BBC.insert(NewBit);

        CurrLength = 1;
        return CurrLength;
    }

private:
    size_t MinLength;
    size_t MaxLength;
    size_t IdleLength;
    size_t SetBitsThreshold;

    State CurrState;
    size_t CurrLength;
    BitBufferCounter BBC;
};

} // namespace ml

inline std::ostream& operator<<(std::ostream &OS, const ml::BitRateWindow BRW) {
    BRW.print(OS);
    return OS;
}

#endif /* BIT_RATE_WINDOW_H */

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0047 ]--