camera: improve resolution scaling to avoid extra rescallers

This commit is contained in:
Kamil Trzcinski
2023-02-24 19:59:42 +01:00
parent 425bbe7745
commit 6ce1869f71
5 changed files with 63 additions and 42 deletions

View File

@ -18,7 +18,7 @@ static unsigned camera_rescaller_align_size(unsigned size, unsigned align_size)
return (size + align_size - 1) / align_size * align_size;
}
static void camera_get_scaled_resolution2(unsigned in_width, unsigned in_height, unsigned proposed_height, unsigned *target_width, unsigned *target_height)
void camera_get_scaled_resolution2(unsigned in_width, unsigned in_height, unsigned proposed_height, unsigned *target_width, unsigned *target_height)
{
proposed_height = MIN(proposed_height, in_height);
@ -35,19 +35,19 @@ static void camera_get_scaled_resolution2(unsigned in_width, unsigned in_height,
}
}
bool camera_get_scaled_resolution(camera_t *camera, camera_output_options_t *options, buffer_format_t *format)
bool camera_get_scaled_resolution(buffer_format_t capture_format, camera_output_options_t *options, buffer_format_t *format)
{
if (options->disabled)
return false;
camera_get_scaled_resolution2(
camera->options.width,
camera->options.height,
capture_format.width,
capture_format.height,
options->height,
&format->width,
&format->height
);
return true;
return format->height > 0;
}
buffer_list_t *camera_try_rescaller(camera_t *camera, buffer_list_t *src_capture, const char *name, unsigned target_height, unsigned target_format)