Revert "ui: smooth wide cam transition" (#28298)

Revert "ui: smooth wide cam transition (#28277)"

This reverts commit ee6df0ef025d95c495248e46d53de2842363058e.
old-commit-hash: 21f88f997d
beeps
Shane Smiskol 2 years ago committed by GitHub
parent 7db6687227
commit afe7825130
  1. 3
      common/modeldata.h
  2. 24
      selfdrive/ui/qt/widgets/cameraview.cc
  3. 6
      selfdrive/ui/qt/widgets/cameraview.h

@ -34,9 +34,6 @@ const mat3 ecam_intrinsic_matrix = (mat3){{567.0, 0.0, 1928.0 / 2,
0.0, 567.0, 1208.0 / 2, 0.0, 567.0, 1208.0 / 2,
0.0, 0.0, 1.0}}; 0.0, 0.0, 1.0}};
// zoom multiplier between cameras
const float ecam_to_fcam_zoom = fcam_intrinsic_matrix.v[0] / ecam_intrinsic_matrix.v[0];
static inline mat3 get_model_yuv_transform() { static inline mat3 get_model_yuv_transform() {
float db_s = 1.0; float db_s = 1.0;
const mat3 transform = (mat3){{ const mat3 transform = (mat3){{

@ -201,12 +201,6 @@ void CameraWidget::updateFrameMat() {
int w = glWidth(), h = glHeight(); int w = glWidth(), h = glHeight();
if (zoomed_view) { if (zoomed_view) {
if (active_stream_type != VISION_STREAM_WIDE_ROAD) {
// Always ready to switch if wide is not active, start at full zoom
zoom_transition = 1;
ready_to_switch_stream = true;
}
if (active_stream_type == VISION_STREAM_DRIVER) { if (active_stream_type == VISION_STREAM_DRIVER) {
frame_mat = get_driver_view_transform(w, h, stream_width, stream_height); frame_mat = get_driver_view_transform(w, h, stream_width, stream_height);
} else { } else {
@ -215,21 +209,11 @@ void CameraWidget::updateFrameMat() {
// for narrow come and a little lower for wide cam. // for narrow come and a little lower for wide cam.
// TODO: use proper perspective transform? // TODO: use proper perspective transform?
if (active_stream_type == VISION_STREAM_WIDE_ROAD) { if (active_stream_type == VISION_STREAM_WIDE_ROAD) {
// If narrow road camera is requested, start zooming in.
// Mark ready to switch once we're fully zoomed in
if (requested_stream_type != VISION_STREAM_WIDE_ROAD) {
zoom_transition += zoom_transition * 0.2 + 0.01;
} else {
zoom_transition -= (1.0 - zoom_transition) * 0.2 + 0.01;
}
zoom_transition = std::clamp(zoom_transition, 0.0f, 1.0f);
ready_to_switch_stream = fabs(zoom_transition - 1) < 1e-3;
intrinsic_matrix = ecam_intrinsic_matrix; intrinsic_matrix = ecam_intrinsic_matrix;
zoom = util::map_val(zoom_transition, 0.0f, 1.0f, ecam_zoom, ecam_to_fcam_zoom * fcam_zoom); zoom = 2.0;
} else { } else {
intrinsic_matrix = fcam_intrinsic_matrix; intrinsic_matrix = fcam_intrinsic_matrix;
zoom = fcam_zoom; zoom = 1.1;
} }
const vec3 inf = {{1000., 0., 0.}}; const vec3 inf = {{1000., 0., 0.}};
const vec3 Ep = matvecmul3(calibration, inf); const vec3 Ep = matvecmul3(calibration, inf);
@ -388,13 +372,13 @@ void CameraWidget::vipcThread() {
VisionIpcBufExtra meta_main = {0}; VisionIpcBufExtra meta_main = {0};
while (!QThread::currentThread()->isInterruptionRequested()) { while (!QThread::currentThread()->isInterruptionRequested()) {
if (!vipc_client || ((cur_stream != requested_stream_type) && ready_to_switch_stream)) { if (!vipc_client || cur_stream != requested_stream_type) {
clearFrames(); clearFrames();
qDebug().nospace() << "connecting to stream " << requested_stream_type << ", was connected to " << cur_stream; qDebug().nospace() << "connecting to stream " << requested_stream_type << ", was connected to " << cur_stream;
cur_stream = requested_stream_type; cur_stream = requested_stream_type;
vipc_client.reset(new VisionIpcClient(stream_name, cur_stream, false)); vipc_client.reset(new VisionIpcClient(stream_name, cur_stream, false));
active_stream_type = cur_stream;
} }
active_stream_type = cur_stream;
if (!vipc_client->connected) { if (!vipc_client->connected) {
clearFrames(); clearFrames();

@ -73,8 +73,6 @@ protected:
int stream_width = 0; int stream_width = 0;
int stream_height = 0; int stream_height = 0;
int stream_stride = 0; int stream_stride = 0;
bool ready_to_switch_stream = true; // stream transition may be delayed by a zoom animation
float zoom_transition = 0;
std::atomic<VisionStreamType> active_stream_type; std::atomic<VisionStreamType> active_stream_type;
std::atomic<VisionStreamType> requested_stream_type; std::atomic<VisionStreamType> requested_stream_type;
std::set<VisionStreamType> available_streams; std::set<VisionStreamType> available_streams;
@ -87,10 +85,6 @@ protected:
mat3 calibration = DEFAULT_CALIBRATION; mat3 calibration = DEFAULT_CALIBRATION;
mat3 intrinsic_matrix = fcam_intrinsic_matrix; mat3 intrinsic_matrix = fcam_intrinsic_matrix;
// Calibration constants
const float ecam_zoom = 2.0;
const float fcam_zoom = 1.1;
std::recursive_mutex frame_lock; std::recursive_mutex frame_lock;
std::deque<std::pair<uint32_t, VisionBuf*>> frames; std::deque<std::pair<uint32_t, VisionBuf*>> frames;
uint32_t draw_frame_id = 0; uint32_t draw_frame_id = 0;

Loading…
Cancel
Save