"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "srcs/common/nalutil.cpp" between
heif-3.6.0.tar.gz and heif-3.6.1.tar.gz

About: HEIF (High Efficiency Image File Format) is a visual media container format for images and image sequences (MPEG-standard). This HEIF engine demonstrates its powerful features and capabilities (under Nokia HEIF license).

nalutil.cpp  (heif-3.6.0):nalutil.cpp  (heif-3.6.1)
skipping to change at line 36 skipping to change at line 36
if (i > 1 && data[i] == 1) if (i > 1 && data[i] == 1)
{ {
return i + 1; return i + 1;
} }
else else
{ {
return 0; return 0;
} }
} }
Vector<uint8_t> convertByteStreamToRBSP(const Vector<uint8_t>& byteStr) bool convertByteStreamToRBSP(const Vector<uint8_t>& byteStr, Vector<uint8_t>& ou tput)
{ {
Vector<uint8_t> dest;
const size_t numBytesInNalUnit = byteStr.size(); const size_t numBytesInNalUnit = byteStr.size();
output.clear();
// this is a reasonable guess, as the result Vector can not be larger than t he original // this is a reasonable guess, as the result Vector can not be larger than t he original
dest.reserve(numBytesInNalUnit); output.reserve(numBytesInNalUnit);
// find start code end // find start code end
uint32_t i = findStartCodeLen(byteStr); uint32_t i = findStartCodeLen(byteStr);
// copy NALU header // copy NALU header
static const size_t NALU_HEADER_LENGTH = 2; static const size_t NALU_HEADER_LENGTH = 2;
dest.insert(dest.end(), byteStr.cbegin() + static_cast<int32_t>(i),
byteStr.cbegin() + static_cast<int32_t>(i) + NALU_HEADER_LENGTH) if (i + NALU_HEADER_LENGTH > numBytesInNalUnit)
; {
return false;
}
output.insert(output.end(), byteStr.cbegin() + static_cast<int32_t>(i),
byteStr.cbegin() + static_cast<int32_t>(i) + NALU_HEADER_LENGT
H);
i += NALU_HEADER_LENGTH; i += NALU_HEADER_LENGTH;
// copy rest of the data while removing start code emulation prevention byte s // copy rest of the data while removing start code emulation prevention byte s
enum class State enum class State
{ {
COPY_DATA, COPY_DATA,
ONE_ZERO_FOUND, ONE_ZERO_FOUND,
TWO_ZEROS_FOUND TWO_ZEROS_FOUND
}; };
State state = State::COPY_DATA; State state = State::COPY_DATA;
skipping to change at line 94 skipping to change at line 100
{ {
state = State::TWO_ZEROS_FOUND; state = State::TWO_ZEROS_FOUND;
} }
break; break;
case State::TWO_ZEROS_FOUND: case State::TWO_ZEROS_FOUND:
// sequence of 0x000003 means that 0x03 is the emulation prevention byte // sequence of 0x000003 means that 0x03 is the emulation prevention byte
if (byte == 0x03) if (byte == 0x03)
{ {
// skip copying 0x03 // skip copying 0x03
dest.insert(dest.end(), byteStr.cbegin() + copyStartOffset, byte output.insert(output.end(), byteStr.cbegin() + copyStartOffset,
Str.cbegin() + static_cast<int32_t>(i)); byteStr.cbegin() + static_cast<int32_t>(i));
copyStartOffset = static_cast<int32_t>(i) + 1; copyStartOffset = static_cast<int32_t>(i) + 1;
// continue byte stream copying // continue byte stream copying
state = State::COPY_DATA; state = State::COPY_DATA;
} }
else if (byte == 0) else if (byte == 0)
{ {
state = State::TWO_ZEROS_FOUND; state = State::TWO_ZEROS_FOUND;
} }
else else
{ {
state = State::COPY_DATA; state = State::COPY_DATA;
} }
break; break;
} }
} }
dest.insert(dest.end(), byteStr.cbegin() + copyStartOffset, byteStr.cend()); output.insert(output.end(), byteStr.cbegin() + copyStartOffset, byteStr.cend
return dest; ());
return true;
} }
 End of changes. 7 change blocks. 
10 lines changed or deleted 17 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)