Skip to content

Commit

Permalink
Fix a bug with more_rbsp_data detection. Improve logging of SEI types.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianFeldmann committed Oct 17, 2023
1 parent 3805e69 commit 21398f9
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 4 deletions.
6 changes: 6 additions & 0 deletions YUViewLib/src/parser/AVC/SEI/sei_message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ SEIParsingResult sei_message::parse(reader::SubByteReaderLogging & read
// When reading the data above, emulation prevention was alread removed.
this->payloadReader.disableEmulationPrevention();

if (payloadNameMap.count(this->payloadType) > 0)
{
const auto payloadTypeName = payloadNameMap.at(this->payloadType);
subLevel.updateSubLevelName("sei_message() - " + payloadTypeName);
}

return this->parsePayloadData(false, spsMap, associatedSPS);
}

Expand Down
4 changes: 2 additions & 2 deletions YUViewLib/src/parser/common/SubByteReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ bool SubByteReader::more_rbsp_data() const
posBytes++;
posBits = 0;
}
else
else if (posBits != 0)
{
// Check the remainder of the current byte
unsigned char c = this->byteVector[posBytes];
Expand All @@ -300,7 +300,7 @@ bool SubByteReader::more_rbsp_data() const
return true;
else if (!terminatingBitFound && (c == 128))
terminatingBitFound = true;
else
else if (c != 0)
return true;
posBytes++;
}
Expand Down
16 changes: 15 additions & 1 deletion YUViewLib/src/parser/common/SubByteReaderLogging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ SubByteReaderLogging::SubByteReaderLogging(const ByteVector & inArr,
}
}

void SubByteReaderLogging::addLogSubLevel(const std::string name)
void SubByteReaderLogging::addLogSubLevel(const std::string &name)
{
if (!this->currentTreeLevel)
return;
Expand All @@ -169,6 +169,14 @@ void SubByteReaderLogging::addLogSubLevel(const std::string name)
this->currentTreeLevel = this->itemHierarchy.top()->createChildItem(name);
}

void SubByteReaderLogging::updateCurrentLevelName(const std::string &name)
{
if (!this->currentTreeLevel)
return;
assert(!name.empty());
this->currentTreeLevel->setName(name);
}

void SubByteReaderLogging::removeLogSubLevel()
{
if (this->itemHierarchy.empty())
Expand Down Expand Up @@ -351,4 +359,10 @@ SubByteReaderLoggingSubLevel::~SubByteReaderLoggingSubLevel()
this->r->removeLogSubLevel();
}

void SubByteReaderLoggingSubLevel::updateSubLevelName(const std::string &name)
{
if (this->r != nullptr)
this->r->updateCurrentLevelName(name);
}

} // namespace parser::reader
5 changes: 4 additions & 1 deletion YUViewLib/src/parser/common/SubByteReaderLogging.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ class SubByteReaderLogging : public SubByteReader

private:
friend class SubByteReaderLoggingSubLevel;
void addLogSubLevel(std::string name);
void addLogSubLevel(const std::string &name);
void updateCurrentLevelName(const std::string &name);
void removeLogSubLevel();

void logExceptionAndThrowError [[noreturn]] (const std::exception &ex, const std::string &when);
Expand All @@ -112,6 +113,8 @@ class SubByteReaderLoggingSubLevel
SubByteReaderLoggingSubLevel(SubByteReaderLogging &reader, std::string name);
~SubByteReaderLoggingSubLevel();

void updateSubLevelName(const std::string &name);

private:
SubByteReaderLogging *r{};
};
Expand Down
2 changes: 2 additions & 0 deletions YUViewLib/src/parser/common/TreeItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class TreeItem : public std::enable_shared_from_this<TreeItem>
return ss.str();
}

void setName(const std::string &name) { this->name = name; }

int getStreamIndex() const
{
if (this->streamIndex >= 0)
Expand Down

0 comments on commit 21398f9

Please sign in to comment.