@@ -54,6 +54,7 @@ POSSIBILITY OF SUCH DAMAGE.
54
54
#include < cstring>
55
55
#include < vector>
56
56
#include < tuple>
57
+ #include < unordered_set>
57
58
58
59
#include " vvenc/version.h"
59
60
#include " vvenc/vvenc.h"
@@ -924,6 +925,10 @@ static int runEncoder( vvenc_config& c, uint64_t framesToEncode, bool emulateMis
924
925
uint64_t framesRcvd = 0 ;
925
926
uint64_t numMissingFrames = emulateMissingFrames ? 10 : 0 ;
926
927
928
+ #if VVENC_USE_UNSTABLE_API
929
+ std::unordered_set<int > userDataSet;
930
+ #endif
931
+
927
932
while ( !eof || !encodeDone )
928
933
{
929
934
vvencYUVBuffer* inputPtr = nullptr ;
@@ -932,6 +937,9 @@ static int runEncoder( vvenc_config& c, uint64_t framesToEncode, bool emulateMis
932
937
inputPtr = yuvPicture;
933
938
yuvPicture->cts = (c.m_TicksPerSecond > 0 ) ? (ctsOffset + (framesRcvd * (uint64_t )c.m_TicksPerSecond * (uint64_t )c.m_FrameScale / (uint64_t )c.m_FrameRate )) : (ctsOffset + framesRcvd);
934
939
yuvPicture->ctsValid = true ;
940
+ #if VVENC_USE_UNSTABLE_API
941
+ yuvPicture->userData = new int (framesRcvd);
942
+ #endif
935
943
framesRcvd++;
936
944
937
945
if ( emulateMissingFrames && framesRcvd == framesToEncode>>1 )
@@ -964,6 +972,11 @@ static int runEncoder( vvenc_config& c, uint64_t framesToEncode, bool emulateMis
964
972
}
965
973
}
966
974
lastDts = AU->dts ;
975
+ #if VVENC_USE_UNSTABLE_API
976
+ int * userData = static_cast <int *>(AU->userData );
977
+ userDataSet.insert ( *userData);
978
+ delete userData;
979
+ #endif
967
980
}
968
981
969
982
if ( auCount > 0 && (!AU || ( AU && AU->payloadUsedSize == 0 )) )
@@ -984,6 +997,14 @@ static int runEncoder( vvenc_config& c, uint64_t framesToEncode, bool emulateMis
984
997
goto fail;
985
998
}
986
999
1000
+ #if VVENC_USE_UNSTABLE_API
1001
+ if (userDataSet.size () != framesToEncode)
1002
+ {
1003
+ // std::cout << "expecting " << framesToEncode << " unique user data values, but got " << userDataSet.size() << std::endl;
1004
+ goto fail;
1005
+ }
1006
+ #endif
1007
+
987
1008
vvenc_YUVBuffer_free ( yuvPicture, true );
988
1009
vvenc_accessUnit_free ( AU, true );
989
1010
vvenc_encoder_close ( enc );
0 commit comments