History

astyle all

huili2 committed 12 years ago

Commit dc3fae41 parent 101265385 files · +4906 −4701Browse files

Showing the changes to test/api/DataGenerator.cpp (1 of 85 files). Show all

Unified · Split

test/api/DataGenerator.cpp+19−23
@@ -7,35 +7,34 @@ · 6 unmodified lines
7using namespace std;7using namespace std;
8 8
9 9
10bool YUVPixelDataGenerator( uint8_t* pPointer, int32_t iWidth, int32_t iHeight, int32_t iStride )10bool YUVPixelDataGenerator (uint8_t* pPointer, int32_t iWidth, int32_t iHeight, int32_t iStride) {
11{
12#define SRC_FRAME_WIDTH (160)11#define SRC_FRAME_WIDTH (160)
13#define SRC_FRAME_HEIGHT (96)12#define SRC_FRAME_HEIGHT (96)
14 13
15 if ( SRC_FRAME_WIDTH-iWidth <= 0 || SRC_FRAME_HEIGHT-iHeight <= 0 ) {14 if (SRC_FRAME_WIDTH - iWidth <= 0 || SRC_FRAME_HEIGHT - iHeight <= 0) {
16 return false;15 return false;
17 }16 }
18 17
19 const int32_t kiFrameSize = SRC_FRAME_WIDTH*SRC_FRAME_HEIGHT;18 const int32_t kiFrameSize = SRC_FRAME_WIDTH * SRC_FRAME_HEIGHT;
20 BufferedData sBuf;19 BufferedData sBuf;
21 sBuf.SetLength(kiFrameSize);20 sBuf.SetLength (kiFrameSize);
22 if (sBuf.Length() != (size_t)kiFrameSize) {21 if (sBuf.Length() != (size_t)kiFrameSize) {
23 return false;22 return false;
24 }23 }
25 24
26 FileInputStream fileStream;25 FileInputStream fileStream;
27 if (!fileStream.Open("res/CiscoVT2people_160x96_6fps.yuv")) {26 if (!fileStream.Open ("res/CiscoVT2people_160x96_6fps.yuv")) {
28 return false;27 return false;
29 }28 }
30 if (fileStream.read(sBuf.data(), kiFrameSize) == kiFrameSize) {29 if (fileStream.read (sBuf.data(), kiFrameSize) == kiFrameSize) {
31 srand((uint32_t)time(NULL));30 srand ((uint32_t)time (NULL));
32 int32_t iStartPosX = rand()%(SRC_FRAME_WIDTH-iWidth);31 int32_t iStartPosX = rand() % (SRC_FRAME_WIDTH - iWidth);
33 int32_t iStartPosY = rand()%(SRC_FRAME_HEIGHT-iHeight);32 int32_t iStartPosY = rand() % (SRC_FRAME_HEIGHT - iHeight);
34 uint8_t* pSrcPointer = sBuf.data() + iStartPosX + iStartPosY*SRC_FRAME_WIDTH;33 uint8_t* pSrcPointer = sBuf.data() + iStartPosX + iStartPosY * SRC_FRAME_WIDTH;
35 uint8_t* pLocalPointer = pPointer;34 uint8_t* pLocalPointer = pPointer;
36 35
37 for (int j=0;j<iHeight;j++) {36 for (int j = 0; j < iHeight; j++) {
38 memcpy(pLocalPointer, pSrcPointer, iWidth*sizeof(uint8_t));37 memcpy (pLocalPointer, pSrcPointer, iWidth * sizeof (uint8_t));
39 pLocalPointer += iStride;38 pLocalPointer += iStride;
40 pSrcPointer += SRC_FRAME_WIDTH;39 pSrcPointer += SRC_FRAME_WIDTH;
41 }40 }
@@ -44,24 +43,21 @@ bool YUVPixelDataGenerator( uint8_t* pPointer, int32_t iWidth, int32_t iHeight, · 2 unmodified lines
44 return false;43 return false;
45}44}
46 45
47void RandomPixelDataGenerator( uint8_t* pPointer, int32_t iWidth, int32_t iHeight, int32_t iStride, int32_t iIdx )46void RandomPixelDataGenerator (uint8_t* pPointer, int32_t iWidth, int32_t iHeight, int32_t iStride, int32_t iIdx) {
48{
49 uint8_t* pLocalPointer = pPointer;47 uint8_t* pLocalPointer = pPointer;
50 srand((uint32_t)(time(NULL)+iIdx));48 srand ((uint32_t) (time (NULL) + iIdx));
51 for (int32_t j=0;j<iHeight;j++) {49 for (int32_t j = 0; j < iHeight; j++) {
52 for (int32_t i=0;i<iWidth;i++) {50 for (int32_t i = 0; i < iWidth; i++) {
53 pLocalPointer[i] = rand()%256;51 pLocalPointer[i] = rand() % 256;
54 }52 }
55 pLocalPointer += iStride;53 pLocalPointer += iStride;
56 }54 }
57}55}
58 56
59 57
60void RandomResidueDataGenerator( uint16_t* pPointer, int32_t iWidth, int32_t iHeight, int32_t iStride )58void RandomResidueDataGenerator (uint16_t* pPointer, int32_t iWidth, int32_t iHeight, int32_t iStride) {
61{
62}59}
63 60
64void RandomCoeffDataGenerator( uint16_t* pPointer, int32_t iWidth, int32_t iHeight, int32_t iStride )61void RandomCoeffDataGenerator (uint16_t* pPointer, int32_t iWidth, int32_t iHeight, int32_t iStride) {
65{
66}62}
67 63

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