mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Skip the first frame after changing size or format.
This commit is contained in:
parent
547aa0528e
commit
3e6e84cbb4
@ -314,10 +314,7 @@ int sensor_set_pixformat(pixformat_t pixformat)
|
|||||||
{
|
{
|
||||||
uint32_t jpeg_mode = DCMI_JPEG_DISABLE;
|
uint32_t jpeg_mode = DCMI_JPEG_DISABLE;
|
||||||
|
|
||||||
// Set BPP to zero to skip the first frame.
|
if (sensor.pixformat == pixformat) {
|
||||||
fb->bpp = 0;
|
|
||||||
|
|
||||||
if (sensor.pixformat == pixformat) {
|
|
||||||
// No change
|
// No change
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -336,34 +333,35 @@ int sensor_set_pixformat(pixformat_t pixformat)
|
|||||||
jpeg_mode = DCMI_JPEG_ENABLE;
|
jpeg_mode = DCMI_JPEG_ENABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip the first frame.
|
||||||
|
fb->bpp = 0;
|
||||||
|
|
||||||
return dcmi_config(jpeg_mode);
|
return dcmi_config(jpeg_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
int sensor_set_framesize(framesize_t framesize)
|
int sensor_set_framesize(framesize_t framesize)
|
||||||
{
|
{
|
||||||
if (sensor.framesize == framesize) {
|
if (sensor.framesize == framesize) {
|
||||||
/* no change */
|
// No change
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call the sensor specific function */
|
// Call the sensor specific function
|
||||||
if (sensor.set_framesize == NULL
|
if (sensor.set_framesize == NULL
|
||||||
|| sensor.set_framesize(&sensor, framesize) != 0) {
|
|| sensor.set_framesize(&sensor, framesize) != 0) {
|
||||||
/* operation not supported */
|
// Operation not supported
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set framebuffer size */
|
// Set framebuffer size
|
||||||
sensor.framesize = framesize;
|
sensor.framesize = framesize;
|
||||||
|
|
||||||
/* set framebuffer dimensions */
|
// Skip the first frame.
|
||||||
if (framesize < FRAMESIZE_QQCIF
|
fb->bpp = 0;
|
||||||
|| framesize > FRAMESIZE_UXGA) {
|
|
||||||
return -1;
|
// Set framebuffer dimensions
|
||||||
} else {
|
fb->w = resolution[framesize][0];
|
||||||
fb->w = resolution[framesize][0];
|
fb->h = resolution[framesize][1];
|
||||||
fb->h = resolution[framesize][1];
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -542,9 +540,9 @@ int sensor_snapshot(image_t *image)
|
|||||||
fb->bpp = dst.bpp;
|
fb->bpp = dst.bpp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: fb->bpp is set to zero for the first frame.
|
// fb->bpp is set to zero for the first frame after changing the resolution/format.
|
||||||
// If BPP is not zero, then we have a valid frame (compressed or raw).
|
// Note: If fb->bpp is not zero, then we have a valid frame (compressed or raw).
|
||||||
fb->ready = (fb->bpp>0);
|
fb->ready = (fb->bpp > 0);
|
||||||
|
|
||||||
// Wait for the IDE to read the framebuffer before it gets overwritten with a new frame, and
|
// Wait for the IDE to read the framebuffer before it gets overwritten with a new frame, and
|
||||||
// after all the image processing code has run (which possibily draws over the framebuffer).
|
// after all the image processing code has run (which possibily draws over the framebuffer).
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user