Skip to content

Commit

Permalink
Rename AvcEncoderTest as AvcEncTest
Browse files Browse the repository at this point in the history
  • Loading branch information
harishdm committed Sep 28, 2023
1 parent 27d4e9e commit 6bd56ae
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 61 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ if (${ENABLE_SVC})
endif()

if (${ENABLE_TESTS})
include("${AVC_ROOT}/tests/AvcEncoderTest.cmake")
include("${AVC_ROOT}/tests/AvcEncTest.cmake")
endif()
4 changes: 2 additions & 2 deletions tests/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ package {
}

cc_test {
name: "AvcEncoderTest",
name: "AvcEncTest",
gtest: true,

srcs : [ "AvcEncoderTest.cpp" ],
srcs : [ "AvcEncTest.cpp" ],

shared_libs: [
"libutils",
Expand Down
10 changes: 5 additions & 5 deletions tests/AndroidTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
limitations under the License.
-->
<configuration description="Test module config for AVC encoder unit tests">
<option name="test-suite-tag" value="AvcEncoderTest" />
<option name="test-suite-tag" value="AvcEncTest" />
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
<option name="cleanup" value="true" />
<option name="push" value="AvcEncoderTest->/data/local/tmp/AvcEncoderTest/" />
<option name="push" value="AvcEncTest->/data/local/tmp/AvcEncTest/" />
<option name="push-file"
key="https://storage.googleapis.com/android_media/external/libavc/tests/AvcEncoder.zip?unzip=true"
value="/data/local/tmp/AvcEncoderTestRes/" />
value="/data/local/tmp/AvcEncTestRes/" />
</target_preparer>

<test class="com.android.tradefed.testtype.GTest" >
<option name="native-test-device-path" value="/data/local/tmp" />
<option name="module-name" value="AvcEncoderTest" />
<option name="native-test-flag" value="-P /data/local/tmp/AvcEncoderTestRes/" />
<option name="module-name" value="AvcEncTest" />
<option name="native-test-flag" value="-P /data/local/tmp/AvcEncTestRes/" />
</test>
</configuration>
8 changes: 4 additions & 4 deletions tests/AvcEncoderTest.cmake → tests/AvcEncTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ ExternalProject_Add(googletest

list(
APPEND
AVCENCODERTEST_SRCS
"${AVC_ROOT}/tests/AvcEncoderTest.cpp")
AVCENCTEST_SRCS
"${AVC_ROOT}/tests/AvcEncTest.cpp")

libavc_add_executable(AvcEncoderTest libavcenc SOURCES ${AVCENCODERTEST_SRCS})
target_link_libraries(AvcEncoderTest
libavc_add_executable(AvcEncTest libavcenc SOURCES ${AVCENCTEST_SRCS})
target_link_libraries(AvcEncTest
${AVC_ROOT}/third_party/build/googletest/src/googletest-build/lib/libgtest.a
${AVC_ROOT}/third_party/build/googletest/src/googletest-build/lib/libgtest_main.a
)
74 changes: 37 additions & 37 deletions tests/AvcEncoderTest.cpp → tests/AvcEncTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "ih264e.h"
#include "ih264e_error.h"

#include "AvcEncoderTestEnvironment.h"
#include "TestArgs.h"

#define MAX_FRAME_HEIGHT 1080
#define MAX_FRAME_WIDTH 1920
Expand All @@ -31,9 +31,9 @@ constexpr int16_t kCompressionRatio = 1;
constexpr size_t kMinQP = 4;
constexpr uint32_t kHeaderLength = 0x800;

static AvcEncoderTestEnvironment* gEnv = nullptr;
static TestArgs* gArgs = nullptr;

class AvcEncoderTest
class AvcEncTest
: public ::testing::TestWithParam<tuple<string, int32_t, int32_t, float, int32_t>> {
private:
void setRawBuf(iv_raw_buf_t* psInpRawBuf, const uint8_t* data);
Expand Down Expand Up @@ -106,10 +106,10 @@ class AvcEncoderTest
IV_PROFILE_T mProfile = IV_PROFILE_BASE;

public:
AvcEncoderTest()
AvcEncTest()
: mInputBuffer(nullptr), mOutputBuffer(nullptr), mFpInput(nullptr), mFpOutput(nullptr) {}

~AvcEncoderTest() {
~AvcEncTest() {
iv_mem_rec_t* ps_mem_rec = mMemRecords;
for (size_t i = 0; i < mNumMemRecords; ++i) {
if (ps_mem_rec) {
Expand All @@ -127,12 +127,12 @@ class AvcEncoderTest
tuple<string /* fileName */, int32_t /* frameWidth */, int32_t /* frameHeight */,
float /* frameRate */, int32_t /* bitRate */>
params = GetParam();
mFileName = gEnv->getRes() + get<0>(params);
mFileName = gArgs->getRes() + get<0>(params);
mFrameWidth = get<1>(params);
mFrameHeight = get<2>(params);
mFrameRate = get<3>(params);
mBitRate = get<4>(params);
mOutFileName = gEnv->getRes() + "out.bin";
mOutFileName = gArgs->getRes() + "out.bin";

ASSERT_LE(mFrameWidth, 1080) << "Frame Width <= 1080";

Expand Down Expand Up @@ -321,7 +321,7 @@ class AvcEncoderTest
IV_STATUS_T status;
};

void AvcEncoderTest::setDimensions() {
void AvcEncTest::setDimensions() {
ive_ctl_set_dimensions_ip_t sDimensionsIp = {};
ive_ctl_set_dimensions_op_t sDimensionsOp = {};

Expand All @@ -342,7 +342,7 @@ void AvcEncoderTest::setDimensions() {
return;
}

void AvcEncoderTest::setNumCores() {
void AvcEncTest::setNumCores() {
ive_ctl_set_num_cores_ip_t sNumCoresIp = {};
ive_ctl_set_num_cores_op_t sNumCoresOp = {};

Expand All @@ -362,7 +362,7 @@ void AvcEncoderTest::setNumCores() {
return;
}

void AvcEncoderTest::setDefault() {
void AvcEncTest::setDefault() {
ive_ctl_setdefault_ip_t sDefaultIp = {};
ive_ctl_setdefault_op_t sDefaultOp = {};

Expand All @@ -381,7 +381,7 @@ void AvcEncoderTest::setDefault() {
return;
}

void AvcEncoderTest::getBufInfo() {
void AvcEncTest::getBufInfo() {
ih264e_ctl_getbufinfo_ip_t sGetBufInfoIp = {};
ih264e_ctl_getbufinfo_op_t sGetBufInfoOp = {};

Expand All @@ -400,7 +400,7 @@ void AvcEncoderTest::getBufInfo() {
return;
}

void AvcEncoderTest::setFrameRate() {
void AvcEncTest::setFrameRate() {
ive_ctl_set_frame_rate_ip_t sFrameRateIp = {};
ive_ctl_set_frame_rate_op_t sFrameRateOp = {};

Expand All @@ -421,7 +421,7 @@ void AvcEncoderTest::setFrameRate() {
return;
}

void AvcEncoderTest::setIpeParams() {
void AvcEncTest::setIpeParams() {
ive_ctl_set_ipe_params_ip_t sIpeParamsIp = {};
ive_ctl_set_ipe_params_op_t sIpeParamsOp = {};

Expand All @@ -443,7 +443,7 @@ void AvcEncoderTest::setIpeParams() {
return;
}

void AvcEncoderTest::setBitRate() {
void AvcEncTest::setBitRate() {
ive_ctl_set_bitrate_ip_t sBitrateIp = {};
ive_ctl_set_bitrate_op_t sBitrateOp = {};

Expand All @@ -463,7 +463,7 @@ void AvcEncoderTest::setBitRate() {
return;
}

void AvcEncoderTest::setFrameType(IV_PICTURE_CODING_TYPE_T eFrameType) {
void AvcEncTest::setFrameType(IV_PICTURE_CODING_TYPE_T eFrameType) {
ive_ctl_set_frame_type_ip_t sFrameTypeIp = {};
ive_ctl_set_frame_type_op_t sFrameTypeOp = {};

Expand All @@ -482,7 +482,7 @@ void AvcEncoderTest::setFrameType(IV_PICTURE_CODING_TYPE_T eFrameType) {
return;
}

void AvcEncoderTest::setQp() {
void AvcEncTest::setQp() {
ive_ctl_set_qp_ip_t s_QpIp = {};
ive_ctl_set_qp_op_t s_QpOp = {};

Expand Down Expand Up @@ -513,7 +513,7 @@ void AvcEncoderTest::setQp() {
return;
}

void AvcEncoderTest::setEncMode(IVE_ENC_MODE_T eEncMode) {
void AvcEncTest::setEncMode(IVE_ENC_MODE_T eEncMode) {
ive_ctl_set_enc_mode_ip_t sEncModeIp = {};
ive_ctl_set_enc_mode_op_t sEncModeOp = {};

Expand All @@ -533,7 +533,7 @@ void AvcEncoderTest::setEncMode(IVE_ENC_MODE_T eEncMode) {
return;
}

void AvcEncoderTest::setVbvParams() {
void AvcEncTest::setVbvParams() {
ive_ctl_set_vbv_params_ip_t sVbvIp = {};
ive_ctl_set_vbv_params_op_t sVbvOp = {};

Expand All @@ -554,7 +554,7 @@ void AvcEncoderTest::setVbvParams() {
return;
}

void AvcEncoderTest::setAirParams() {
void AvcEncTest::setAirParams() {
ive_ctl_set_air_params_ip_t sAirIp = {};
ive_ctl_set_air_params_op_t sAirOp = {};

Expand All @@ -575,7 +575,7 @@ void AvcEncoderTest::setAirParams() {
return;
}

void AvcEncoderTest::setMeParams() {
void AvcEncTest::setMeParams() {
ive_ctl_set_me_params_ip_t sMeParamsIp = {};
ive_ctl_set_me_params_op_t sMeParamsOp = {};

Expand All @@ -602,7 +602,7 @@ void AvcEncoderTest::setMeParams() {
return;
}

void AvcEncoderTest::setGopParams() {
void AvcEncTest::setGopParams() {
ive_ctl_set_gop_params_ip_t sGopParamsIp = {};
ive_ctl_set_gop_params_op_t sGopParamsOp = {};

Expand All @@ -624,7 +624,7 @@ void AvcEncoderTest::setGopParams() {
return;
}

void AvcEncoderTest::setProfileParams() {
void AvcEncTest::setProfileParams() {
ive_ctl_set_profile_params_ip_t sProfileParamsIp = {};
ive_ctl_set_profile_params_op_t sProfileParamsOp = {};

Expand All @@ -649,7 +649,7 @@ void AvcEncoderTest::setProfileParams() {
return;
}

void AvcEncoderTest::setDeblockParams() {
void AvcEncTest::setDeblockParams() {
ive_ctl_set_deblock_params_ip_t sDeblockParamsIp = {};
ive_ctl_set_deblock_params_op_t sDeblockParamsOp = {};

Expand All @@ -670,7 +670,7 @@ void AvcEncoderTest::setDeblockParams() {
return;
}

void AvcEncoderTest::setVuiParams() {
void AvcEncTest::setVuiParams() {
ih264e_vui_ip_t sVuiParamsIp = {};
ih264e_vui_op_t sVuiParamsOp = {};

Expand All @@ -692,7 +692,7 @@ void AvcEncoderTest::setVuiParams() {
return;
}

void AvcEncoderTest::setSeiMdcvParams() {
void AvcEncTest::setSeiMdcvParams() {
ih264e_ctl_set_sei_mdcv_params_ip_t sSeiMdcvParamsIp = {};
ih264e_ctl_set_sei_mdcv_params_op_t sSeiMdcvParamsOp = {};

Expand Down Expand Up @@ -721,7 +721,7 @@ void AvcEncoderTest::setSeiMdcvParams() {
return;
}

void AvcEncoderTest::setSeiCllParams() {
void AvcEncTest::setSeiCllParams() {
ih264e_ctl_set_sei_cll_params_ip_t sSeiCllParamsIp = {};
ih264e_ctl_set_sei_cll_params_op_t sSeiCllParamsOp = {};

Expand All @@ -745,7 +745,7 @@ void AvcEncoderTest::setSeiCllParams() {
return;
}

void AvcEncoderTest::setSeiAveParams() {
void AvcEncTest::setSeiAveParams() {
ih264e_ctl_set_sei_ave_params_ip_t sSeiAveParamsIp = {};
ih264e_ctl_set_sei_ave_params_op_t sSeiAveParamsOp = {};

Expand All @@ -770,7 +770,7 @@ void AvcEncoderTest::setSeiAveParams() {
return;
}

void AvcEncoderTest::setSeiCcvParams() {
void AvcEncTest::setSeiCcvParams() {
ih264e_ctl_set_sei_ccv_params_ip_t sSeiCcvParamsIp = {};
ih264e_ctl_set_sei_ccv_params_op_t sSeiCcvParamsOp = {};

Expand Down Expand Up @@ -806,7 +806,7 @@ void AvcEncoderTest::setSeiCcvParams() {
return;
}

void AvcEncoderTest::logVersion() {
void AvcEncTest::logVersion() {
ive_ctl_getversioninfo_ip_t sCtlIp = {};
ive_ctl_getversioninfo_op_t sCtlOp = {};
UWORD8 au1Buf[512];
Expand All @@ -825,7 +825,7 @@ void AvcEncoderTest::logVersion() {
return;
}

void AvcEncoderTest::encodeFrames(int64_t numFramesToEncode) {
void AvcEncTest::encodeFrames(int64_t numFramesToEncode) {
ih264e_video_encode_ip_t ih264e_video_encode_ip = {};
ih264e_video_encode_op_t ih264e_video_encode_op = {};

Expand Down Expand Up @@ -916,7 +916,7 @@ void AvcEncoderTest::encodeFrames(int64_t numFramesToEncode) {
}
}

void AvcEncoderTest::setRawBuf(iv_raw_buf_t* psInpRawBuf, const uint8_t* data) {
void AvcEncTest::setRawBuf(iv_raw_buf_t* psInpRawBuf, const uint8_t* data) {
switch (mIvVideoColorFormat) {
case IV_YUV_420SP_UV:
[[fallthrough]];
Expand Down Expand Up @@ -980,28 +980,28 @@ void AvcEncoderTest::setRawBuf(iv_raw_buf_t* psInpRawBuf, const uint8_t* data) {
return;
}

int64_t AvcEncoderTest::getTotalFrames() {
int64_t AvcEncTest::getTotalFrames() {
struct stat buf;
stat(mFileName.c_str(), &buf);
size_t fileSize = buf.st_size;
int64_t totalFrames = (int64_t)(fileSize / mFrameSize);
return totalFrames;
}

TEST_P(AvcEncoderTest, EncodeTest) {
TEST_P(AvcEncTest, EncodeTest) {
ASSERT_NO_FATAL_FAILURE(encodeFrames(mTotalFrames)) << "Failed to Encode: " << mFileName;
}

INSTANTIATE_TEST_SUITE_P(EncodeTest, AvcEncoderTest,
INSTANTIATE_TEST_SUITE_P(EncodeTest, AvcEncTest,
::testing::Values(make_tuple("bbb_352x288_420p_30fps_32frames.yuv", 352,
288, 30, 2048),
make_tuple("football_qvga.yuv", 320, 240, 30, 1024)));

int32_t main(int argc, char** argv) {
gEnv = new AvcEncoderTestEnvironment();
::testing::AddGlobalTestEnvironment(gEnv);
gArgs = new TestArgs();
::testing::AddGlobalTestEnvironment(gArgs);
::testing::InitGoogleTest(&argc, argv);
uint8_t status = gEnv->initFromOptions(argc, argv);
uint8_t status = gArgs->initFromOptions(argc, argv);
if (status == 0) {
status = RUN_ALL_TESTS();
}
Expand Down
Loading

0 comments on commit 6bd56ae

Please sign in to comment.