mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-23 17:23:44 +08:00
3f950832b9
* Squashed vipc * Update release files * Remove else * add visionipc to release files * use poller in vipc receive * opencl framework instead of lib on macos * Fix camera webcam * Fix opencl on mac in ui * more webcam fixes * typo in ui sconsfile * Use cur_yuv_buf * visionbuf c++ class * Camera qcom was still using visionbuf_allocate * Turn loggerd back on * fix snapshot * No build needed * update test camerad * no more release callback * make encoder c++ * Revert "no more release callback" This reverts commit e5707b07002fee665d0483d90713154efc2d70d4. * fix exit handlers * No need to check errno * move release callback call * s/VIPCBufExtra/VisionIpcBufExtra/g * use non blocking connect * ui use non blocking connect * Lower condition variable wait time * Snapshot cleanup * bump cereal * bump cereal old-commit-hash: fb496c692a9ebdcda15069a8d4eb95734b587d68
58 lines
1.2 KiB
C++
58 lines
1.2 KiB
C++
#include <cstdio>
|
|
#include <cstdlib>
|
|
#include <unistd.h>
|
|
|
|
#include <zmq.h>
|
|
|
|
#include "common/visionipc.h"
|
|
#include "common/timing.h"
|
|
#include "common/utilpp.h"
|
|
#include "RawLogger.h"
|
|
|
|
int main() {
|
|
int err;
|
|
|
|
VisionStream stream;
|
|
|
|
VisionStreamBufs buf_info;
|
|
while (true) {
|
|
err = visionstream_init(&stream, VISION_STREAM_YUV, false, &buf_info);
|
|
if (err != 0) {
|
|
printf("visionstream fail\n");
|
|
util::sleep_for(100);
|
|
}
|
|
break;
|
|
}
|
|
|
|
RawLogger vidlogger("prcamera", buf_info.width, buf_info.height, 20);
|
|
vidlogger.Open("o1");
|
|
|
|
for (int cnt=0; cnt<200; cnt++) {
|
|
VisionIpcBufExtra extra;
|
|
VIPSBuf* buf = visionstream_get(&stream, &extra);
|
|
if (buf == NULL) {
|
|
printf("visionstream get failed\n");
|
|
break;
|
|
}
|
|
|
|
if (cnt == 100) {
|
|
vidlogger.Rotate("o2", 2);
|
|
}
|
|
|
|
uint8_t *y = (uint8_t*)buf->addr;
|
|
uint8_t *u = y + (buf_info.width*buf_info.height);
|
|
uint8_t *v = u + (buf_info.width/2)*(buf_info.height/2);
|
|
|
|
double t1 = millis_since_boot();
|
|
vidlogger.LogFrame(cnt, y, u, v, NULL);
|
|
double t2 = millis_since_boot();
|
|
printf("%d %.2f\n", cnt, (t2-t1));
|
|
}
|
|
|
|
vidlogger.Close();
|
|
|
|
visionstream_destroy(&stream);
|
|
|
|
return 0;
|
|
}
|