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
477TEST(GetIntraPredictorTest, TestGetI16x16LumaPredPlane) {477TEST(GetIntraPredictorTest, TestGetI16x16LumaPredPlane) {
478 const int32_t kiStride = rand()%16+16;478 const int32_t kiStride = rand()%16+16;
479 479
480 int32_t i, j;
481
480 uint8_t *pPred = new uint8_t[16*kiStride];482 uint8_t *pPred = new uint8_t[16*kiStride];
481 uint8_t *pRef = new uint8_t[16*kiStride+1];483 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++)
483 pRef[i]=rand()%256+1;485 pRef[i]=rand()%256+1;
484 486
485 pRef += kiStride + 1;487 pRef += kiStride + 1;
486 488
487 int32_t iA=0, iB=0, iC=0, iH=0, iV=0;489 int32_t iA=0, iB=0, iC=0, iH=0, iV=0;
488 int32_t i, j;
489 uint8_t *pTop = &pRef[-kiStride];490 uint8_t *pTop = &pRef[-kiStride];
490 uint8_t *pLeft = &pRef[-1];491 uint8_t *pLeft = &pRef[-1];
491 int32_t iPredStride = 16;492 int32_t iPredStride = 16;
@@ -514,16 +515,18 @@ TEST(GetIntraPredictorTest, TestGetI16x16LumaPredPlane) { · 22 unmodified lines
514TEST(GetIntraPredictorTest, TestGetI16x16LumaPredDc) {515TEST(GetIntraPredictorTest, TestGetI16x16LumaPredDc) {
515 const int32_t kiStride = rand()%16+16;516 const int32_t kiStride = rand()%16+16;
516 517
518 int i;
519
517 uint8_t *pPred = new uint8_t[256];520 uint8_t *pPred = new uint8_t[256];
518 uint8_t *pRef = new uint8_t[16*kiStride];521 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++)
520 pRef[i] = rand() % 256 + 1;523 pRef[i] = rand() % 256 + 1;
521 524
522 pRef += kiStride;525 pRef += kiStride;
523 526
524 int32_t iTmp = (kiStride << 4) - kiStride;527 int32_t iTmp = (kiStride << 4) - kiStride;
525 int32_t iSum = 0;528 int32_t iSum = 0;
526 uint8_t i = 15;529 i = 15;
527 uint8_t uiMean = 0;530 uint8_t uiMean = 0;
528 531
529 do {532 do {
@@ -533,7 +536,7 @@ TEST(GetIntraPredictorTest, TestGetI16x16LumaPredDc) { · 3 unmodified lines
533 uiMean = ( 16 + iSum ) >> 5;536 uiMean = ( 16 + iSum ) >> 5;
534 537
535 WelsI16x16LumaPredDc_c(pPred, pRef, kiStride);538 WelsI16x16LumaPredDc_c(pPred, pRef, kiStride);
536 for (int i=0; i<256; i++)539 for (i=0; i<256; i++)
537 EXPECT_EQ(pPred[i],uiMean);540 EXPECT_EQ(pPred[i],uiMean);
538 541
539 pRef -= kiStride;542 pRef -= kiStride;
@@ -545,15 +548,17 @@ TEST(GetIntraPredictorTest, TestGetI16x16LumaPredDc) { · 5 unmodified lines
545TEST(GetIntraPredictorTest, TestGetI16x16LumaPredDcTop) {548TEST(GetIntraPredictorTest, TestGetI16x16LumaPredDcTop) {
546 const int32_t kiStride = rand()%16+16;549 const int32_t kiStride = rand()%16+16;
547 550
551 int i;
552
548 uint8_t *pPred = new uint8_t[256];553 uint8_t *pPred = new uint8_t[256];
549 uint8_t *pRef = new uint8_t[16*kiStride];554 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++)
551 pRef[i] = rand() % 256 + 1;556 pRef[i] = rand() % 256 + 1;
552 557
553 pRef += kiStride;558 pRef += kiStride;
554 559
555 int32_t iSum = 0;560 int32_t iSum = 0;
556 uint8_t i = 15;561 i = 15;
557 uint8_t uiMean = 0;562 uint8_t uiMean = 0;
558 do {563 do {
559 iSum += pRef[-kiStride+i];564 iSum += pRef[-kiStride+i];
@@ -561,7 +566,7 @@ TEST(GetIntraPredictorTest, TestGetI16x16LumaPredDcTop) { · 1 unmodified line
561 uiMean = ( 8 + iSum ) >> 4;566 uiMean = ( 8 + iSum ) >> 4;
562 567
563 WelsI16x16LumaPredDcTop_c(pPred, pRef, kiStride);568 WelsI16x16LumaPredDcTop_c(pPred, pRef, kiStride);
564 for (int i=0; i<256; i++)569 for (i=0; i<256; i++)
565 EXPECT_EQ(pPred[i],uiMean);570 EXPECT_EQ(pPred[i],uiMean);
566 571
567 pRef -= kiStride;572 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