Fix conversion issue with RGB888

This commit is contained in:
Lorenzooone 2025-05-02 00:17:08 +02:00
parent 4787215de3
commit f6b9a76119
3 changed files with 12 additions and 4 deletions

View File

@ -158,6 +158,7 @@ private:
const float v_sync_timeout = 5.0f;
const float bad_resolution_timeout = 30.0f;
const float menu_change_timeout = 0.3f;
const float input_data_format_change_timeout = 1.0f;
CurrMenuType curr_menu = DEFAULT_MENU_TYPE;
GenericMenu* curr_menu_ptr = NULL;
@ -213,6 +214,7 @@ private:
FPSArray poll_fps;
std::chrono::time_point<std::chrono::high_resolution_clock> last_poll_time;
std::chrono::time_point<std::chrono::high_resolution_clock> last_menu_change_time;
std::chrono::time_point<std::chrono::high_resolution_clock> last_data_format_change_time;
int curr_frame_texture_pos = 0;
int num_frames_to_blend;

View File

@ -97,6 +97,7 @@ static double FPSArrayGetAverage(FPSArray *array) {
void WindowScreen::init_menus() {
this->last_menu_change_time = std::chrono::high_resolution_clock::now();
this->last_data_format_change_time = std::chrono::high_resolution_clock::now();
this->connection_menu = new ConnectionMenu(this->text_rectangle_pool);
this->main_menu = new MainMenu(this->text_rectangle_pool);
this->video_menu = new VideoMenu(this->text_rectangle_pool);
@ -589,8 +590,13 @@ void WindowScreen::devices_allowed_change(PossibleCaptureDevices device) {
}
void WindowScreen::input_video_data_format_request_change(bool positive) {
std::chrono::time_point<std::chrono::high_resolution_clock> curr_time = std::chrono::high_resolution_clock::now();
const std::chrono::duration<double> diff = curr_time - this->last_data_format_change_time;
if(diff.count() < this->input_data_format_change_timeout)
return;
this->capture_status->request_low_bw_format = !this->capture_status->request_low_bw_format;
this->print_notification("Changing data format...\nPlease wait...");
this->last_data_format_change_time = curr_time;
}
bool WindowScreen::can_execute_cmd(const WindowCommand* window_cmd, bool is_extra, bool is_always) {

View File

@ -259,9 +259,9 @@ static inline void usb_rgb888convertInterleaveU16VideoToOutputDirectOpt(deinterl
size_t input_halfline_pixel = (input_halfline * real_num_iters) + i;
size_t output_halfline_pixel = (output_halfline * real_num_iters) + i;
for(size_t j = 0; j < INTERLEAVED_RGB888_TOTAL_SIZE; j++)
out_ptr_bottom[output_halfline_pixel].pixels[j] = _reverse_endianness(in_ptr[input_halfline_pixel].pixels[j][bottom_pos]);
out_ptr_bottom[output_halfline_pixel].pixels[j] = in_ptr[input_halfline_pixel].pixels[j][bottom_pos];
for(size_t j = 0; j < INTERLEAVED_RGB888_TOTAL_SIZE; j++)
out_ptr_top[output_halfline_pixel].pixels[j] = _reverse_endianness(in_ptr[input_halfline_pixel].pixels[j][top_pos]);
out_ptr_top[output_halfline_pixel].pixels[j] = in_ptr[input_halfline_pixel].pixels[j][top_pos];
}
}
@ -273,7 +273,7 @@ static inline void usb_rgb888convertInterleaveU16VideoToOutputDirectOptMonoTop(d
size_t input_halfline_pixel = (input_halfline * real_num_iters) + i;
size_t output_halfline_pixel = (output_halfline * real_num_iters) + i;
for(size_t j = 0; j < INTERLEAVED_RGB888_TOTAL_SIZE; j++)
out_ptr_top[output_halfline_pixel].pixels[j] = _reverse_endianness(in_ptr[input_halfline_pixel].pixels[j][top_pos]);
out_ptr_top[output_halfline_pixel].pixels[j] = in_ptr[input_halfline_pixel].pixels[j][top_pos];
}
}
@ -285,7 +285,7 @@ static inline void usb_rgb888convertInterleaveU16VideoToOutputDirectOptMonoBotto
size_t input_halfline_pixel = (input_halfline * real_num_iters) + i;
size_t output_halfline_pixel = (output_halfline * real_num_iters) + i;
for(size_t j = 0; j < INTERLEAVED_RGB888_TOTAL_SIZE; j++)
out_ptr_bottom[output_halfline_pixel].pixels[j] = _reverse_endianness(in_ptr[input_halfline_pixel].pixels[j][bottom_pos]);
out_ptr_bottom[output_halfline_pixel].pixels[j] = in_ptr[input_halfline_pixel].pixels[j][bottom_pos];
}
}