* rocDecode/HEVC: Added empty NAL detection. (#452)

Этот коммит содержится в:
jeffqjiangNew
2024-11-13 13:28:29 -05:00
коммит произвёл GitHub
родитель 6b37dd606f
Коммит b3f8fec41b
2 изменённых файлов: 5 добавлений и 6 удалений
+1 -1
Просмотреть файл
@@ -566,7 +566,7 @@ ParserResult HevcVideoParser::ParsePictureData(const uint8_t* p_stream, uint32_t
return ret;
}
// Parse the NAL unit
if (nal_unit_size_) {
if (nal_unit_size_ >= 5) {
// start code + NAL unit header = 5 bytes
int ebsp_size = nal_unit_size_ - 5 > RBSP_BUF_SIZE ? RBSP_BUF_SIZE : nal_unit_size_ - 5; // only copy enough bytes for header parsing
+4 -5
Просмотреть файл
@@ -139,11 +139,10 @@ ParserResult RocVideoParser::GetNalUnit() {
start_code_found = true;
start_code_num_++;
next_start_code_offset_ = curr_byte_offset_;
// Move the pointer (3 + 2) bytes forward (start_code + nal header)
curr_byte_offset_ += 5;
// Move the pointer 3 bytes forward
curr_byte_offset_ += 3;
// For the very first NAL unit, search for the next start code (or reach the end of frame)
// also detect empty nal units with no data
if (start_code_num_ == 1 ) {
start_code_found = false;
curr_start_code_offset_ = next_start_code_offset_;
@@ -153,7 +152,7 @@ ParserResult RocVideoParser::GetNalUnit() {
}
}
curr_byte_offset_++;
}
}
if (start_code_num_ == 0) {
// No NAL unit in the frame data
return PARSER_NOT_FOUND;
@@ -164,7 +163,7 @@ ParserResult RocVideoParser::GetNalUnit() {
} else {
nal_unit_size_ = pic_data_size_ - curr_start_code_offset_;
return PARSER_EOF;
}
}
}
size_t RocVideoParser::EbspToRbsp(uint8_t *streamBuffer,size_t begin_bytepos, size_t end_bytepos) {