[x265] [PATCH 6 of 9] encoder: simplify size variables
Steve Borho
steve at borho.org
Tue Nov 19 08:41:17 CET 2013
# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1384826224 21600
# Mon Nov 18 19:57:04 2013 -0600
# Node ID e7aa509f91511410311d264067830e04308f7e2b
# Parent d8766641126dc98b6005076c7b489c4cc5906591
encoder: simplify size variables
diff -r d8766641126d -r e7aa509f9151 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Mon Nov 18 19:51:18 2013 -0600
+++ b/source/encoder/encoder.cpp Mon Nov 18 19:57:04 2013 -0600
@@ -1354,7 +1354,7 @@
for (; nalcount < num; nalcount++)
{
const NALUnitEBSP& nalu = *nalunits[nalcount];
- uint32_t size = 0; /* size of annexB unit in bytes */
+ uint32_t size; /* size of annexB unit in bytes */
static const char start_code_prefix[] = { 0, 0, 0, 1 };
if (nalcount == 0 || nalu.m_nalUnitType == NAL_UNIT_SPS || nalu.m_nalUnitType == NAL_UNIT_PPS)
@@ -1368,21 +1368,19 @@
* 7.4.1.2.3.
*/
::memcpy(m_packetData + memsize, start_code_prefix, 4);
- size += 4;
+ size = 4;
}
else
{
::memcpy(m_packetData + memsize, start_code_prefix + 1, 3);
- size += 3;
+ size = 3;
}
memsize += size;
- uint32_t nalSize = nalu.m_packetSize;
- ::memcpy(m_packetData + memsize, nalu.m_nalUnitData, nalSize);
- size += nalSize;
- memsize += nalSize;
+ ::memcpy(m_packetData + memsize, nalu.m_nalUnitData, nalu.m_packetSize);
+ memsize += nalu.m_packetSize;
m_nals[nalcount].type = nalu.m_nalUnitType;
- m_nals[nalcount].sizeBytes = size;
+ m_nals[nalcount].sizeBytes = size + nalu.m_packetSize;
}
/* Setup payload pointers, now that we're done adding content to m_packetData */
More information about the x265-devel
mailing list