Skip to content

Commit

Permalink
PERF: Switch back to original viewport conversion
Browse files Browse the repository at this point in the history
* Switch back to the original conversion from viewport to pixel.
* The method integrated in PR BrownBiomechanics#204 causes a performace slow down because
  of the larger images generated.
* A follow-up PR, BrownBiomechanics#211 will be integrated to allow for the option of
  using the newer method
  • Loading branch information
NicerNewerCar committed Oct 19, 2023
1 parent 16e4606 commit c04864b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions libautoscoper/src/Tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,9 +600,8 @@ std::vector <double> Tracker::trackFrame(unsigned int volumeID, double* xyzypr)
this->calculate_viewport(modelview, viewport);

// Calculate the size of the image to render based on the viewport
// For more information, see https://github.com/BrownBiomechanics/Autoscoper/issues/203
unsigned render_width = (trial_.render_width * (viewport[2] + 1)) / 2;
unsigned render_height = (trial_.render_height * (viewport[3] + 1)) / 2;
unsigned render_width = viewport[2] * trial_.render_width / views_[i]->camera()->viewport()[2];
unsigned render_height = viewport[3] * trial_.render_height / views_[i]->camera()->viewport()[3];

if (render_width > trial_.render_width || render_height > trial_.render_height) {
throw std::runtime_error("Tracker::trackFrame(): Rendered image is larger than the viewport buffer!\n" + std::to_string(render_width) + " > " + std::to_string(trial_.render_width) + " || " + std::to_string(render_height) + " > " + std::to_string(trial_.render_height));
Expand Down

0 comments on commit c04864b

Please sign in to comment.