Skip to content

Commit

Permalink
AF: improve general responsiveness (commaai#1137)
Browse files Browse the repository at this point in the history
* sync control with readout; always assume worst

* faster recover
  • Loading branch information
ZwX1616 authored and pd0wm committed Feb 20, 2020
1 parent cdc715f commit 2410519
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions selfdrive/camerad/cameras/camera_qcom.c
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ static void parse_autofocus(CameraState *s, uint8_t *d) {
int16_t max_focus = -32767;
int avg_focus = 0;
// force to max if not able to determine focus for long
const int patience_cnt = 100;
const int patience_cnt = 20;
static int nan_cnt = 0;

/*printf("FOCUS: ");
Expand Down Expand Up @@ -1757,7 +1757,7 @@ static void parse_autofocus(CameraState *s, uint8_t *d) {
nan_cnt = 0;
}
} else {
s->focus_err = avg_focus;
s->focus_err = max_focus;
nan_cnt = 0;
}
// printf("fe=%f\n", s->focus_err);
Expand Down Expand Up @@ -2084,7 +2084,6 @@ static void* ops_thread(void* arg) {
if (cmsg.type == CAMERA_MSG_AUTOEXPOSE) {
if (cmsg.camera_num == 0) {
do_autoexposure(&s->rear, cmsg.grey_frac);
do_autofocus(&s->rear);
} else {
do_autoexposure(&s->front, cmsg.grey_frac);
}
Expand Down Expand Up @@ -2187,6 +2186,7 @@ void cameras_run(DualCameraState *s) {
// fwrite(d, c->ss[buffer].bufs[buf_idx].len, sizeof(uint8_t), df);
// fclose(df);
parse_autofocus(c, d);
do_autofocus(&s->rear);
}
c->ss[buffer].qbuf_info[buf_idx].dirty_buf = 1;
ioctl(c->isp_fd, VIDIOC_MSM_ISP_ENQUEUE_BUF, &c->ss[buffer].qbuf_info[buf_idx]);
Expand Down

0 comments on commit 2410519

Please sign in to comment.