#include //memset/memcpy #include "utils/DataGenerator.h" #include "utils/BufferedData.h" #include "utils/FileInputStream.h" using namespace std; bool YUVPixelDataGenerator( uint8_t* pPointer, int32_t iWidth, int32_t iHeight, int32_t iStride ) { #define SRC_FRAME_WIDTH (160) #define SRC_FRAME_HEIGHT (96) if ( SRC_FRAME_WIDTH-iWidth <= 0 || SRC_FRAME_HEIGHT-iHeight <= 0 ) { return false; } const int32_t kiFrameSize = SRC_FRAME_WIDTH*SRC_FRAME_HEIGHT; BufferedData sBuf; sBuf.SetLength(kiFrameSize); if (sBuf.Length() != kiFrameSize) { return false; } FileInputStream fileStream; if (!fileStream.Open("res/CiscoVT2people_160x96_6fps.yuv")) { return false; } if (fileStream.read(sBuf.data(), kiFrameSize) == kiFrameSize) { srand((uint32_t)time(NULL)); int32_t iStartPosX = rand()%(SRC_FRAME_WIDTH-iWidth); int32_t iStartPosY = rand()%(SRC_FRAME_HEIGHT-iHeight); uint8_t* pSrcPointer = sBuf.data() + iStartPosX + iStartPosY*SRC_FRAME_WIDTH; uint8_t* pLocalPointer = pPointer; for (int j=0;j