Skip to content

Commit

Permalink
core: Use controls::ScalerCrop on VC4 platforms
Browse files Browse the repository at this point in the history
The controls::rpi::ScalerCrops is only relevant to PiSP platforms in
the upstream libcamera code.

Also while at it, add a test for crops.

Signed-off-by: Naushir Patuck <[email protected]>
  • Loading branch information
naushir committed Nov 5, 2024
1 parent 65e076b commit 225bef2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/rpicam_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,10 @@ void RPiCamApp::StartCamera()
LOG(2, "Using crop (lores) " << crops.back().toString());
}

controls_.set(controls::rpi::ScalerCrops, libcamera::Span<const Rectangle>(crops.data(), crops.size()));
if (options_->GetPlatform() == Platform::VC4)
controls_.set(controls::ScalerCrop, crops[0]);
else
controls_.set(controls::rpi::ScalerCrops, libcamera::Span<const Rectangle>(crops.data(), crops.size()));
}

if (!controls_.get(controls::AfWindows) && !controls_.get(controls::AfMetering) && options_->afWindow_width != 0 &&
Expand Down
8 changes: 8 additions & 0 deletions utils/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ def test_hello(exe_dir, output_dir):
check_retcode(retcode, "test_hello: roi test")
check_time(time_taken, 1, 6, "test_hello: roi test")

# "crops test". Specify an image crop with lores output and see if it blows up.
print(" crop test")
retcode, time_taken = run_executable(
[executable, '-t', '2000', '--roi', '0.25,0.25,0.5,0.5',
'--lores-width', '640', '--lores-height', '640'], logfile)
check_retcode(retcode, "test_hello: crop test")
check_time(time_taken, 1, 6, "test_hello: crop test")

# "controls test". Specify some image controls and see if it blows up.
print(" controls test")
retcode, time_taken = run_executable(
Expand Down

0 comments on commit 225bef2

Please sign in to comment.