Skip to content
Snippets Groups Projects
Commit a1c11c0e authored by Karsten Suehring's avatar Karsten Suehring
Browse files

BitstreamExtractor: fix re-encapsulation of input NAL units getting written back to the bitstream

parent f3cf8232
No related branches found
No related tags found
No related merge requests found
......@@ -642,8 +642,12 @@ uint32_t BitstreamExtractorApp::decode()
}
ch = 1;
bitstreamFileOut.write( &ch, 1 );
// write input NAL unit
bitstreamFileOut.write( (const char*)nalu.getBitstream().getFifo().data(), nalu.getBitstream().getFifo().size() );
// create output NAL unit
OutputNALUnit out (nalu.m_nalUnitType, nalu.m_nuhLayerId, nalu.m_temporalId);
out.m_Bitstream.getFIFO() = nalu.getBitstream().getFifo();
// write with start code emulation prevention
writeNaluContent (bitstreamFileOut, out);
}
}
}
......
......@@ -60,13 +60,13 @@ OutputBitstream bsNALUHeader;
out.write(reinterpret_cast<const char*>(bsNALUHeader.getByteStream()), bsNALUHeader.getByteStreamLength());
}
/**
* write nalu to bytestream out, performing RBSP anti startcode
* emulation as required. nalu.m_RBSPayload must be byte aligned.
*/
void write(ostream& out, OutputNALUnit& nalu)
void writeNaluContent(ostream& out, OutputNALUnit& nalu)
{
writeNalUnitHeader(out, nalu);
/* write out rsbp_byte's, inserting any required
* emulation_prevention_three_byte's */
/* 7.4.1 ...
......@@ -125,4 +125,10 @@ void write(ostream& out, OutputNALUnit& nalu)
out.write(reinterpret_cast<const char*>(&(*outputBuffer.begin())), outputAmount);
}
void writeNaluWithHeader(ostream& out, OutputNALUnit& nalu)
{
writeNalUnitHeader(out, nalu);
writeNaluContent(out, nalu);
}
//! \}
......@@ -75,12 +75,13 @@ struct OutputNALUnit : public NALUnit
OutputBitstream m_Bitstream;
};
void write(std::ostream& out, OutputNALUnit& nalu);
void writeNaluWithHeader(std::ostream& out, OutputNALUnit& nalu);
void writeNaluContent(std::ostream& out, OutputNALUnit& nalu);
inline NALUnitEBSP::NALUnitEBSP(OutputNALUnit& nalu)
: NALUnit(nalu)
{
write(m_nalUnitData, nalu);
writeNaluWithHeader(m_nalUnitData, nalu);
}
//! \}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment