From 752639db2e161b9d74900c11b5ddd55d5da88e0f Mon Sep 17 00:00:00 2001 From: Good Guy Date: Fri, 13 Feb 2026 17:05:33 -0700 Subject: [PATCH] Credit Andrew - allow for old 16BPC integer formats and set variable value to prevent crashes and reenable in code --- cinelerra-5.1/cinelerra/scopewindow.C | 20 ++++++++++++++++++++ cinelerra-5.1/cinelerra/vdevicex11.C | 13 +++++++++++++ cinelerra-5.1/cinelerra/vrender.C | 11 ++++++++++- cinelerra-5.1/guicast/bccolors.C | 16 ++++++++-------- cinelerra-5.1/plugins/color3way/color3way.C | 13 +++++++++++++ 5 files changed, 64 insertions(+), 9 deletions(-) diff --git a/cinelerra-5.1/cinelerra/scopewindow.C b/cinelerra-5.1/cinelerra/scopewindow.C index e1cfe335..3ae9bf4d 100644 --- a/cinelerra-5.1/cinelerra/scopewindow.C +++ b/cinelerra-5.1/cinelerra/scopewindow.C @@ -305,6 +305,26 @@ void ScopeUnit::process_package(LoadPackage *package) } } break; + case BC_YUV161616: + for( int y=pkg->row1; yrow2; ++y ) { + uint8_t *row = rows[y]; + for( int x=0; xrow1; yrow2; ++y ) { + uint8_t *row = rows[y]; + for( int x=0; xdata_frame->get_y(); uint8_t *up = gui->data_frame->get_u(); diff --git a/cinelerra-5.1/cinelerra/vdevicex11.C b/cinelerra-5.1/cinelerra/vdevicex11.C index 9a67d238..215dde54 100644 --- a/cinelerra-5.1/cinelerra/vdevicex11.C +++ b/cinelerra-5.1/cinelerra/vdevicex11.C @@ -262,6 +262,19 @@ void VDeviceX11::new_output_buffer(VFrame **result, int file_colormodel, EDL *ed !output->xscroll && !output->yscroll && output_x1 == 0 && output_x2 == device->out_w && output_y1 == 0 && output_y2 == device->out_h; + + int colormodel_is16bpc = 0; + switch (edl->session->color_model) { + case BC_YUV161616: + case BC_YUVA16161616: + case BC_RGB161616: + case BC_RGBA16161616: + colormodel_is16bpc = 1; + default: {} + } + + if(colormodel_is16bpc = 1) direct_supported = 0; + // file wants direct frame but we need a temp if( !direct_supported && file_colormodel == BC_BGR8888 ) diff --git a/cinelerra-5.1/cinelerra/vrender.C b/cinelerra-5.1/cinelerra/vrender.C index 03b1421d..c8ca1535 100644 --- a/cinelerra-5.1/cinelerra/vrender.C +++ b/cinelerra-5.1/cinelerra/vrender.C @@ -258,6 +258,15 @@ int VRender::get_colormodel(VEdit *playable_edit, int use_vconsole, int use_bren { EDL *edl = renderengine->get_edl(); int colormodel = renderengine->get_edl()->session->color_model; + int colormodel_is16bpc = 0; + switch (colormodel) { + case BC_YUV161616: + case BC_YUVA16161616: + case BC_RGB161616: + case BC_RGBA16161616: + colormodel_is16bpc = 1; + default: {} + } VideoOutConfig *vconfig = renderengine->config->vconfig; // check for playback: no plugins, not single frame if( !use_vconsole && !renderengine->command->single_frame() ) { @@ -274,7 +283,7 @@ int VRender::get_colormodel(VEdit *playable_edit, int use_vconsole, int use_bren if( file ) { // damn the color range, full speed ahead if( vconfig->driver == PLAYBACK_X11 && vconfig->use_direct_x11 && - file->colormodel_supported(BC_BGR8888) == BC_BGR8888 ) + file->colormodel_supported(BC_BGR8888) == BC_BGR8888 && ! colormodel_is16bpc ) colormodel = BC_BGR8888; else { // file favorite colormodel may mismatch rgb/yuv diff --git a/cinelerra-5.1/guicast/bccolors.C b/cinelerra-5.1/guicast/bccolors.C index 287cc9f8..1676255f 100644 --- a/cinelerra-5.1/guicast/bccolors.C +++ b/cinelerra-5.1/guicast/bccolors.C @@ -83,11 +83,11 @@ int HSV::yuv_to_hsv(int y, int u, int v, float &h, float &s, float &va, int max) float r, g, b; int r_i, g_i, b_i; -// if(max == 0xffff) -// { -// YUV::yuv.yuv_to_rgb_16(r_i, g_i, b_i, y, u, v); -// } -// else + if(max == 0xffff) + { + YUV::yuv.yuv_to_rgb_16(r_i, g_i, b_i, y, u, v); + } + else { YUV::yuv.yuv_to_rgb_8(r_i, g_i, b_i, y, u, v); } @@ -115,9 +115,9 @@ int HSV::hsv_to_yuv(int &y, int &u, int &v, float h, float s, float va, int max) b_i = (int)CLIP(b, 0, max); int y2, u2, v2; -// if(max == 0xffff) -// YUV::yuv.rgb_to_yuv_16(r_i, g_i, b_i, y2, u2, v2); -// else + if(max == 0xffff) + YUV::yuv.rgb_to_yuv_16(r_i, g_i, b_i, y2, u2, v2); + else YUV::yuv.rgb_to_yuv_8(r_i, g_i, b_i, y2, u2, v2); y = y2; u = u2; v = v2; diff --git a/cinelerra-5.1/plugins/color3way/color3way.C b/cinelerra-5.1/plugins/color3way/color3way.C index 7685257b..42fb7af3 100644 --- a/cinelerra-5.1/plugins/color3way/color3way.C +++ b/cinelerra-5.1/plugins/color3way/color3way.C @@ -277,6 +277,19 @@ void Color3WayUnit::process_package(LoadPackage *package) case BC_YUVA8888: PROCESS(unsigned char, 0xff, 4, 1) break; + case BC_RGB161616: + PROCESS(uint16_t, 0xffff, 3, 0) + break; + case BC_RGBA16161616: + PROCESS(uint16_t, 0xffff, 4, 0) + break; + case BC_YUV161616: + PROCESS(uint16_t, 0xffff, 3, 1) + break; + case BC_YUVA16161616: + PROCESS(uint16_t, 0xffff, 4, 1) + break; + case BC_RGB_FLOAT: PROCESS(float, 1.0, 3, 0) break; -- 2.34.1