Convert EncoderTest::last_pts_ to a local variable
Convert the data member EncoderTest::last_pts_ to a local variable in the EncoderTest::RunLoop() and VP9FrameSizeTestsLarge::RunLoop() methods. EncoderTest::last_pts_ is only used in these two methods, and these two methods first set EncoderTest::last_pts_ to 0 before using it. So EncoderTest::last_pts_ is effectively a local variable in these two methods. Note that several subclasses of EncoderTest declare their own last_pts_ data member and use it to calculate the data rate. Apparently their own last_pts_ data member hides the same-named data member in the base class. Although this is allowed by C++, this is very confusing. Change-Id: I55ce1cf8cc62e07333d8a902d65b46343a3d5881
This commit is contained in:
@@ -169,7 +169,7 @@ void EncoderTest::RunLoop(VideoSource *video) {
|
||||
|
||||
ASSERT_TRUE(passes_ == 1 || passes_ == 2);
|
||||
for (unsigned int pass = 0; pass < passes_; pass++) {
|
||||
last_pts_ = 0;
|
||||
vpx_codec_pts_t last_pts = 0;
|
||||
|
||||
if (passes_ == 1) {
|
||||
cfg_.g_pass = VPX_RC_ONE_PASS;
|
||||
@@ -225,8 +225,8 @@ void EncoderTest::RunLoop(VideoSource *video) {
|
||||
|
||||
has_dxdata = true;
|
||||
}
|
||||
ASSERT_GE(pkt->data.frame.pts, last_pts_);
|
||||
last_pts_ = pkt->data.frame.pts;
|
||||
ASSERT_GE(pkt->data.frame.pts, last_pts);
|
||||
last_pts = pkt->data.frame.pts;
|
||||
FramePktHook(pkt);
|
||||
break;
|
||||
|
||||
|
||||
@@ -206,8 +206,7 @@ class Encoder {
|
||||
class EncoderTest {
|
||||
protected:
|
||||
explicit EncoderTest(const CodecFactory *codec)
|
||||
: codec_(codec), abort_(false), init_flags_(0), frame_flags_(0),
|
||||
last_pts_(0) {
|
||||
: codec_(codec), abort_(false), init_flags_(0), frame_flags_(0) {
|
||||
// Default to 1 thread.
|
||||
cfg_.g_threads = 1;
|
||||
}
|
||||
@@ -291,7 +290,6 @@ class EncoderTest {
|
||||
TwopassStatsStore stats_;
|
||||
unsigned long init_flags_;
|
||||
unsigned long frame_flags_;
|
||||
vpx_codec_pts_t last_pts_;
|
||||
};
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
||||
@@ -111,7 +111,7 @@ class VP9FrameSizeTestsLarge : public ::libvpx_test::EncoderTest,
|
||||
|
||||
ASSERT_TRUE(passes_ == 1 || passes_ == 2);
|
||||
for (unsigned int pass = 0; pass < passes_; pass++) {
|
||||
last_pts_ = 0;
|
||||
vpx_codec_pts_t last_pts = 0;
|
||||
|
||||
if (passes_ == 1) {
|
||||
cfg_.g_pass = VPX_RC_ONE_PASS;
|
||||
@@ -144,8 +144,8 @@ class VP9FrameSizeTestsLarge : public ::libvpx_test::EncoderTest,
|
||||
again = true;
|
||||
switch (pkt->kind) {
|
||||
case VPX_CODEC_CX_FRAME_PKT:
|
||||
ASSERT_GE(pkt->data.frame.pts, last_pts_);
|
||||
last_pts_ = pkt->data.frame.pts;
|
||||
ASSERT_GE(pkt->data.frame.pts, last_pts);
|
||||
last_pts = pkt->data.frame.pts;
|
||||
FramePktHook(pkt);
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user