mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:57:44 +00:00
LibVideo/VP9: Specify which spec section defines certain behaviors
This commit is contained in:
parent
ce524214c9
commit
91572a49c4
6 changed files with 51 additions and 36 deletions
|
@ -37,13 +37,6 @@ u8 BitStream::read_f(size_t n)
|
|||
return result;
|
||||
}
|
||||
|
||||
i8 BitStream::read_s(size_t n)
|
||||
{
|
||||
auto value = read_f(n);
|
||||
auto sign = read_bit();
|
||||
return sign ? -value : value;
|
||||
}
|
||||
|
||||
u8 BitStream::read_f8()
|
||||
{
|
||||
if (!m_current_byte.has_value())
|
||||
|
@ -63,30 +56,6 @@ u16 BitStream::read_f16()
|
|||
return (read_f8() << 8u) | read_f8();
|
||||
}
|
||||
|
||||
u8 BitStream::read_literal(size_t n)
|
||||
{
|
||||
u8 return_value = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
return_value = (2 * return_value) + read_bool(128);
|
||||
}
|
||||
return return_value;
|
||||
}
|
||||
|
||||
u64 BitStream::get_position()
|
||||
{
|
||||
return (m_bytes_read * 8) + (7 - m_current_bit_position);
|
||||
}
|
||||
|
||||
size_t BitStream::bytes_remaining()
|
||||
{
|
||||
return m_bytes_remaining;
|
||||
}
|
||||
|
||||
size_t BitStream::bits_remaining()
|
||||
{
|
||||
return (bytes_remaining() * 8) + m_current_bit_position + 1;
|
||||
}
|
||||
|
||||
/* 9.2.1 */
|
||||
bool BitStream::init_bool(size_t bytes)
|
||||
{
|
||||
|
@ -139,4 +108,35 @@ bool BitStream::exit_bool()
|
|||
return padding_element == 0;
|
||||
}
|
||||
|
||||
u8 BitStream::read_literal(size_t n)
|
||||
{
|
||||
u8 return_value = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
return_value = (2 * return_value) + read_bool(128);
|
||||
}
|
||||
return return_value;
|
||||
}
|
||||
|
||||
i8 BitStream::read_s(size_t n)
|
||||
{
|
||||
auto value = read_f(n);
|
||||
auto sign = read_bit();
|
||||
return sign ? -value : value;
|
||||
}
|
||||
|
||||
u64 BitStream::get_position()
|
||||
{
|
||||
return (m_bytes_read * 8) + (7 - m_current_bit_position);
|
||||
}
|
||||
|
||||
size_t BitStream::bytes_remaining()
|
||||
{
|
||||
return m_bytes_remaining;
|
||||
}
|
||||
|
||||
size_t BitStream::bits_remaining()
|
||||
{
|
||||
return (bytes_remaining() * 8) + m_current_bit_position + 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue