[x265] [PATCH] writing hash SEI messages in frameencoder
santhoshini at multicorewareinc.com
santhoshini at multicorewareinc.com
Wed Oct 30 04:25:51 CET 2013
# HG changeset patch
# User Santhoshini Sekar <santhoshini at multicorewareinc.com>
# Date 1383103249 -19800
# Wed Oct 30 08:50:49 2013 +0530
# Node ID a7e349a5e32edd1f075449c2f828e7b03cebff2c
# Parent 0666d56aaa4259590dffdd5aa3bc7859c4763931
writing hash SEI messages in frameencoder
diff -r 0666d56aaa42 -r a7e349a5e32e source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Mon Oct 28 16:13:05 2013 +0530
+++ b/source/encoder/encoder.cpp Wed Oct 30 08:50:49 2013 +0530
@@ -494,52 +494,18 @@
const char* digestStr = NULL;
if (param.decodedPictureHashSEI)
{
- SEIDecodedPictureHash sei_recon_picture_digest;
if (param.decodedPictureHashSEI == 1)
{
- /* calculate MD5sum for entire reconstructed picture */
- sei_recon_picture_digest.method = SEIDecodedPictureHash::MD5;
- for (int i = 0; i < 3; i++)
- {
- MD5Final(&(pic->m_state[i]), sei_recon_picture_digest.digest[i]);
- }
- digestStr = digestToString(sei_recon_picture_digest.digest, 16);
+ digestStr = digestToString(m_frameEncoder->m_seiReconPictureDigest.digest, 16);
}
else if (param.decodedPictureHashSEI == 2)
{
- sei_recon_picture_digest.method = SEIDecodedPictureHash::CRC;
- for (int i = 0; i < 3; i++)
- {
- crcFinish((pic->m_crc[i]), sei_recon_picture_digest.digest[i]);
- }
- digestStr = digestToString(sei_recon_picture_digest.digest, 2);
+ digestStr = digestToString(m_frameEncoder->m_seiReconPictureDigest.digest, 2);
}
else if (param.decodedPictureHashSEI == 3)
{
- sei_recon_picture_digest.method = SEIDecodedPictureHash::CHECKSUM;
- for (int i = 0; i < 3; i++)
- {
- checksumFinish(pic->m_checksum[i], sei_recon_picture_digest.digest[i]);
- }
- digestStr = digestToString(sei_recon_picture_digest.digest, 4);
+ digestStr = digestToString(m_frameEncoder->m_seiReconPictureDigest.digest, 4);
}
-
- /* write the SEI messages */
- OutputNALUnit onalu(NAL_UNIT_SUFFIX_SEI, 0);
- m_frameEncoder->m_seiWriter.writeSEImessage(onalu.m_Bitstream, sei_recon_picture_digest, pic->getSlice()->getSPS());
- writeRBSPTrailingBits(onalu.m_Bitstream);
-
- int count = 0;
- while (nalunits[count] != NULL)
- {
- count++;
- }
-
- nalunits[count] = (NALUnitEBSP*)X265_MALLOC(NALUnitEBSP, 1);
- if (nalunits[count])
- nalunits[count]->init(onalu);
- else
- digestStr = NULL;
}
/* calculate the size of the access unit, excluding:
diff -r 0666d56aaa42 -r a7e349a5e32e source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp Mon Oct 28 16:13:05 2013 +0530
+++ b/source/encoder/frameencoder.cpp Wed Oct 30 08:50:49 2013 +0530
@@ -670,6 +670,45 @@
m_nalCount++;
}
+ /* write decoded picture hash SEI messages */
+ if (m_cfg->param.decodedPictureHashSEI)
+ {
+ if (m_cfg->param.decodedPictureHashSEI == 1)
+ {
+ m_seiReconPictureDigest.method = SEIDecodedPictureHash::MD5;
+ for (int i = 0; i < 3; i++)
+ {
+ MD5Final(&(m_pic->m_state[i]), m_seiReconPictureDigest.digest[i]);
+ }
+ }
+ else if (m_cfg->param.decodedPictureHashSEI == 2)
+ {
+ m_seiReconPictureDigest.method = SEIDecodedPictureHash::CRC;
+ for (int i = 0; i < 3; i++)
+ {
+ crcFinish((m_pic->m_crc[i]), m_seiReconPictureDigest.digest[i]);
+ }
+ }
+ else if (m_cfg->param.decodedPictureHashSEI == 3)
+ {
+ m_seiReconPictureDigest.method = SEIDecodedPictureHash::CHECKSUM;
+ for (int i = 0; i < 3; i++)
+ {
+ checksumFinish(m_pic->m_checksum[i], m_seiReconPictureDigest.digest[i]);
+ }
+ }
+ OutputNALUnit onalu(NAL_UNIT_SUFFIX_SEI, 0);
+ m_seiWriter.writeSEImessage(onalu.m_Bitstream, m_seiReconPictureDigest, slice->getSPS());
+ writeRBSPTrailingBits(onalu.m_Bitstream);
+
+ m_nalList[m_nalCount] = (NALUnitEBSP*)X265_MALLOC(NALUnitEBSP, 1);
+ if (m_nalList[m_nalCount])
+ {
+ m_nalList[m_nalCount]->init(onalu);
+ m_nalCount++;
+ }
+ }
+
if (m_sps.getUseSAO())
{
m_frameFilter.end();
diff -r 0666d56aaa42 -r a7e349a5e32e source/encoder/frameencoder.h
--- a/source/encoder/frameencoder.h Mon Oct 28 16:13:05 2013 +0530
+++ b/source/encoder/frameencoder.h Wed Oct 30 08:50:49 2013 +0530
@@ -161,6 +161,7 @@
TComSPS m_sps;
TComPPS m_pps;
RateControlEntry m_rce;
+ SEIDecodedPictureHash m_seiReconPictureDigest;
protected:
More information about the x265-devel
mailing list