ref: 5bf4e379a707e0bd95ef69d690d023b555c08658
parent: bbfc84007617cd5beef636c330f0e6fd25403546
author: Martin Storsjö <martin@martin.st>
date: Fri Jan 12 06:31:44 EST 2018
Initialize the frame buffer in EncodeDecodeTestAPIBase::InitialEncDec This avoids use of uninitialized data (valgrind errors) in EncodeDecodeTestAPI.ScreenContent_LosslessLink0_EnableLongTermReference. Normally the buffer is initialized separately for each encoded frame if using EncodeDecodeTestAPIBase::EncodeOneFrame, but for tests that use encoder_->EncodeFrame directly, make sure the data always is initialized.
--- a/test/api/encode_options_test.cpp
+++ b/test/api/encode_options_test.cpp
@@ -36,6 +36,7 @@
//set a fixed random value
iRandValue = rand() % 256;
+ memset (buf_.data(), iRandValue, frameSize);
return true;
}
@@ -2157,11 +2158,6 @@
iSrcHeight = iHeight;
ASSERT_TRUE (InitialEncDec (iSrcWidth, iSrcHeight));
-
- int frameSize = EncPic.iPicWidth * EncPic.iPicHeight * 3 / 2;
- int lumaSize = EncPic.iPicWidth * EncPic.iPicHeight;
- memset (buf_.data(), iRandValue, lumaSize);
- memset (buf_.data() + lumaSize, rand() % 256, (frameSize - lumaSize));
iRet = encoder_->EncodeFrame (&EncPic, &info);