int32_t cam_getFrameChirpFlags(const uint8_t &type, const uint16_t &xOffset, const uint16_t &yOffset, const uint16_t &xWidth, const uint16_t &yWidth, Chirp *chirp, uint8_t renderFlags) { int32_t result, len; uint8_t *frame = (uint8_t *)SRAM1_LOC; // fill buffer contents manually for return data len = Chirp::serialize(chirp, frame, SRAM1_SIZE, HTYPE(FOURCC('B','A','8','1')), HINT8(renderFlags), UINT16(xWidth), UINT16(yWidth), UINTS8_NO_COPY(xWidth*yWidth), END); // write frame after chirp args result = cam_getFrame(frame+len, SRAM1_SIZE-len, type, xOffset, yOffset, xWidth, yWidth); // tell chirp to use this buffer chirp->useBuffer(frame, len+xWidth*yWidth); return result; }
int32_t cc_getRLSFrameChirpFlags(Chirp *chirp, uint8_t renderFlags) { int32_t result; uint32_t len, numRls; if (g_rawFrame.m_pixels) cc_loadLut(); g_qqueue->flush(); // figure out prebuf length (we need the prebuf length and the number of runlength segments, but there's a chicken and egg problem...) len = Chirp::serialize(chirp, RLS_MEMORY, RLS_MEMORY_SIZE, HTYPE(0), UINT16(0), UINT16(0), UINTS32_NO_COPY(0), END); result = cc_getRLSFrame((uint32_t *)(RLS_MEMORY+len), LUT_MEMORY); // copy from IPC memory to RLS_MEMORY numRls = g_qqueue->readAll((Qval *)(RLS_MEMORY+len), (RLS_MEMORY_SIZE-len)/sizeof(Qval)); Chirp::serialize(chirp, RLS_MEMORY, RLS_MEMORY_SIZE, HTYPE(FOURCC('C','C','Q','1')), HINT8(renderFlags), UINT16(CAM_RES2_WIDTH), UINT16(CAM_RES2_HEIGHT), UINTS32_NO_COPY(numRls), END); // send frame, use in-place buffer chirp->useBuffer(RLS_MEMORY, len+numRls*4); return result; }
int cc_sendBlobs(Chirp *chirp, const BlobA *blobs, uint32_t len, const BlobB *ccBlobs, uint32_t ccLen, uint8_t renderFlags) { CRP_RETURN(chirp, HTYPE(FOURCC('C','C','B','2')), HINT8(renderFlags), HINT16(CAM_RES2_WIDTH), HINT16(CAM_RES2_HEIGHT), UINTS16(len*sizeof(BlobA)/sizeof(uint16_t), blobs), UINTS16(ccLen*sizeof(BlobB)/sizeof(uint16_t), ccBlobs), END); return 0; }
void sendCustom(uint8_t renderFlags=RENDER_FLAG_FLUSH) { int32_t len; uint8_t *frame = (uint8_t *)SRAM1_LOC; uint32_t fcc; // fill buffer contents manually for return data len = Chirp::serialize(g_chirpUsb, frame, SRAM1_SIZE, HTYPE(FOURCC('B','A','8','1')), HINT8(renderFlags), UINT16(CAM_RES2_WIDTH), UINT16(CAM_RES2_HEIGHT), UINTS8_NO_COPY(CAM_RES2_WIDTH*CAM_RES2_HEIGHT), END); // write frame after chirp args cam_getFrame(frame+len, SRAM1_SIZE-len, CAM_GRAB_M1R2, 0, 0, CAM_RES2_WIDTH, CAM_RES2_HEIGHT); //convolutionImage(CAM_RES2_WIDTH, CAM_RES2_HEIGHT, len, frame, true); //inverceImage(CAM_RES2_WIDTH, CAM_RES2_HEIGHT, len, frame); // tell chirp to use this buffer g_chirpUsb->useBuffer(frame, len+CAM_RES2_WIDTH*CAM_RES2_HEIGHT); // if (g_execArg==1) // { // cprintf("g_execArg==1"); // // fill buffer contents manually for return data // len = Chirp::serialize(g_chirpUsb, frame, SRAM1_SIZE, HTYPE(FOURCC('C','M','V','2')), HINT8(renderFlags), UINT16(CAM_RES2_WIDTH), UINT16(CAM_RES2_HEIGHT), UINTS8_NO_COPY(CAM_RES2_WIDTH*CAM_RES2_HEIGHT), END); // // write frame after chirp args // cam_getFrame(frame+len, SRAM1_SIZE-len, CAM_GRAB_M1R2, 0, 0, CAM_RES2_WIDTH, CAM_RES2_HEIGHT); // //inverceImage(CAM_RES2_WIDTH, CAM_RES2_HEIGHT, len, frame); // // tell chirp to use this buffer // g_chirpUsb->useBuffer(frame, len+CAM_RES2_WIDTH*CAM_RES2_HEIGHT); // } // else if (100<=g_execArg && g_execArg<200) // { // cprintf("100<=g_execArg && g_execArg<200"); // fcc = FOURCC('E','X',(g_execArg%100)/10 + '0', (g_execArg%10) + '0'); // len = Chirp::serialize(g_chirpUsb, frame, SRAM1_SIZE, HTYPE(fcc), HINT8(renderFlags), UINT16(CAM_RES2_WIDTH), UINT16(CAM_RES2_HEIGHT), UINTS8_NO_COPY(CAM_RES2_WIDTH*CAM_RES2_HEIGHT), END); // // write frame after chirp args // cam_getFrame(frame+len, SRAM1_SIZE-len, CAM_GRAB_M1R2, 0, 0, CAM_RES2_WIDTH, CAM_RES2_HEIGHT); // //inverceImage(CAM_RES2_WIDTH, CAM_RES2_HEIGHT, len, frame); // // tell chirp to use this buffer // g_chirpUsb->useBuffer(frame, len+CAM_RES2_WIDTH*CAM_RES2_HEIGHT); // } // else // { // cprintf("sendCustom else"); // cam_getFrameChirp(CAM_GRAB_M1R2, 0, 0, CAM_RES2_WIDTH, CAM_RES2_HEIGHT, g_chirpUsb); // } }