History

Declare for loop variables consistently in GetIntraPredictorTest

Previously, the same variable 'i' was sometimes declared within a for loop and sometimes outside of the loop, all within the same function. This avoids spurious warnings in MSVC 2005.

Martin Storsjö committed 12 years ago

Commit a25f7b71 parent d3fab241 file · +13 −8Browse files

Showing the changes to test/encoder/EncUT_GetIntraPredictor.cpp (1 of 1 file). Show all

Unified · Split

test/encoder/EncUT_GetIntraPredictor.cpp+13−8
@@ -477,15 +477,16 @@ TEST(GetIntraPredictorTest, TestGetIChormaPredV) { · 476 unmodified lines
477477 TEST(GetIntraPredictorTest, TestGetI16x16LumaPredPlane) {
478478 const int32_t kiStride = rand()%16+16;
479479
480+ int32_t i, j;
481+
480482 uint8_t *pPred = new uint8_t[16*kiStride];
481483 uint8_t *pRef = new uint8_t[16*kiStride+1];
482− for (int i=0; i<16*kiStride+1; i++)
484+ for (i=0; i<16*kiStride+1; i++)
483485 pRef[i]=rand()%256+1;
484486
485487 pRef += kiStride + 1;
486488
487489 int32_t iA=0, iB=0, iC=0, iH=0, iV=0;
488− int32_t i, j;
489490 uint8_t *pTop = &pRef[-kiStride];
490491 uint8_t *pLeft = &pRef[-1];
491492 int32_t iPredStride = 16;
@@ -514,16 +515,18 @@ TEST(GetIntraPredictorTest, TestGetI16x16LumaPredPlane) { · 22 unmodified lines
514515 TEST(GetIntraPredictorTest, TestGetI16x16LumaPredDc) {
515516 const int32_t kiStride = rand()%16+16;
516517
518+ int i;
519+
517520 uint8_t *pPred = new uint8_t[256];
518521 uint8_t *pRef = new uint8_t[16*kiStride];
519− for (int i=0; i<16*kiStride; i++)
522+ for (i=0; i<16*kiStride; i++)
520523 pRef[i] = rand() % 256 + 1;
521524
522525 pRef += kiStride;
523526
524527 int32_t iTmp = (kiStride << 4) - kiStride;
525528 int32_t iSum = 0;
526− uint8_t i = 15;
529+ i = 15;
527530 uint8_t uiMean = 0;
528531
529532 do {
@@ -533,7 +536,7 @@ TEST(GetIntraPredictorTest, TestGetI16x16LumaPredDc) { · 3 unmodified lines
533536 uiMean = ( 16 + iSum ) >> 5;
534537
535538 WelsI16x16LumaPredDc_c(pPred, pRef, kiStride);
536− for (int i=0; i<256; i++)
539+ for (i=0; i<256; i++)
537540 EXPECT_EQ(pPred[i],uiMean);
538541
539542 pRef -= kiStride;
@@ -545,15 +548,17 @@ TEST(GetIntraPredictorTest, TestGetI16x16LumaPredDc) { · 5 unmodified lines
545548 TEST(GetIntraPredictorTest, TestGetI16x16LumaPredDcTop) {
546549 const int32_t kiStride = rand()%16+16;
547550
551+ int i;
552+
548553 uint8_t *pPred = new uint8_t[256];
549554 uint8_t *pRef = new uint8_t[16*kiStride];
550− for (int i=0; i<16*kiStride; i++)
555+ for (i=0; i<16*kiStride; i++)
551556 pRef[i] = rand() % 256 + 1;
552557
553558 pRef += kiStride;
554559
555560 int32_t iSum = 0;
556− uint8_t i = 15;
561+ i = 15;
557562 uint8_t uiMean = 0;
558563 do {
559564 iSum += pRef[-kiStride+i];
@@ -561,7 +566,7 @@ TEST(GetIntraPredictorTest, TestGetI16x16LumaPredDcTop) { · 1 unmodified line
561566 uiMean = ( 8 + iSum ) >> 4;
562567
563568 WelsI16x16LumaPredDcTop_c(pPred, pRef, kiStride);
564− for (int i=0; i<256; i++)
569+ for (i=0; i<256; i++)
565570 EXPECT_EQ(pPred[i],uiMean);
566571
567572 pRef -= kiStride;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t