From f3adc7285af86851913b48592a8c4fdfcdcdf8b6 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Fri, 1 Dec 2017 11:42:50 -0700 Subject: [PATCH] bug fixes, typos, and omits in yuv mod --- cinelerra-5.1/cinelerra/scopewindow.C | 4 +-- cinelerra-5.1/guicast/bccolors.h | 7 ++-- cinelerra-5.1/guicast/test4.C | 35 ++++++++++++++++--- cinelerra-5.1/plugins/color3way/color3way.h | 1 - .../plugins/colorbalance/colorbalance.C | 13 +++---- .../plugins/colorbalance/colorbalance.h | 1 - cinelerra-5.1/plugins/gradient/gradient.C | 9 ++--- cinelerra-5.1/plugins/gradient/gradient.h | 1 - .../plugins/huesaturation/huesaturation.C | 6 ++-- cinelerra-5.1/plugins/libeffecttv/effecttv.C | 2 -- cinelerra-5.1/plugins/libeffecttv/effecttv.h | 1 - .../plugins/threshold/histogramengine.C | 12 +++---- .../plugins/threshold/histogramengine.h | 1 - cinelerra-5.1/plugins/timefront/timefront.h | 1 - cinelerra-5.1/plugins/yuv/yuv.h | 1 - 15 files changed, 55 insertions(+), 40 deletions(-) diff --git a/cinelerra-5.1/cinelerra/scopewindow.C b/cinelerra-5.1/cinelerra/scopewindow.C index 56dd5171..4713b95d 100644 --- a/cinelerra-5.1/cinelerra/scopewindow.C +++ b/cinelerra-5.1/cinelerra/scopewindow.C @@ -193,7 +193,7 @@ void ScopeUnit::draw_point(unsigned char **rows, u_in, \ v_in) \ { \ - yuv.yuv_to_rgb_f(r, g, b, (float)y_in / 255, (float)(u_in - 0x80) / 255, (float)(v_in - 0x80) / 255); \ + YUV::yuv.yuv_to_rgb_f(r, g, b, (float)y_in / 255, (float)(u_in - 0x80) / 255, (float)(v_in - 0x80) / 255); \ HSV::rgb_to_hsv(r, \ g, \ b, \ @@ -209,8 +209,6 @@ void ScopeUnit::process_package(LoadPackage *package) { ScopePackage *pkg = (ScopePackage*)package; - - YUV yuv; float r, g, b; float h, s, v; int x, y; diff --git a/cinelerra-5.1/guicast/bccolors.h b/cinelerra-5.1/guicast/bccolors.h index eed34fef..ed3b6fe1 100644 --- a/cinelerra-5.1/guicast/bccolors.h +++ b/cinelerra-5.1/guicast/bccolors.h @@ -241,8 +241,8 @@ public: bc_always_inline void rgb_to_yuv_f(float r, float g, float b, float &y, float &u, float &v) { y = r * r_to_y + g * g_to_y + b * b_to_y + yminf; - u = r * r_to_u + g * g_to_u + b * b_to_u + uvminf; - v = r * r_to_v + g * g_to_v + b * b_to_v + uvminf; + u = r * r_to_u + g * g_to_u + b * b_to_u; + v = r * r_to_v + g * g_to_v + b * b_to_v; } bc_always_inline void rgb_to_yuv_8(float r, float g, float b, int &y, int &u, int &v) { float fy, fu, fv; rgb_to_yuv_f(r, g, b, fy, fu, fv); @@ -304,9 +304,8 @@ public: bc_always_inline void yuv_to_rgb_f(float &r, float &g, float &b, float y, float u, float v) { y = (y-yminf) / yrangef; - u = u-uvminf; v = v-uvminf; r = y + v_to_r * v; - g = u + u_to_g * u + v_to_g * v; + g = y + u_to_g * u + v_to_g * v; b = y + u_to_b * u; } diff --git a/cinelerra-5.1/guicast/test4.C b/cinelerra-5.1/guicast/test4.C index 79b8623e..ed0f3840 100644 --- a/cinelerra-5.1/guicast/test4.C +++ b/cinelerra-5.1/guicast/test4.C @@ -111,6 +111,32 @@ void write_ppm(uint8_t *tp, int w, int h, const char *fmt, ...) } } +int64_t tm = 0, tn = 0; + +static int diff_vframe(VFrame &afrm, VFrame &bfrm) +{ + int n = 0, m = 0; + int w = afrm.get_w(), h = afrm.get_h(); + uint8_t **arows = afrm.get_rows(); + uint8_t **brows = bfrm.get_rows(); + + for( int y=0; yget_color_model()) { case BC_RGB888: - PROCESS(yuv.yuv_to_rgb_8, yuv.rgb_to_yuv_8, + PROCESS(YUV::yuv.yuv_to_rgb_8, YUV::yuv.rgb_to_yuv_8, r_lookup_8, g_lookup_8, b_lookup_8, unsigned char, 0xff, 3, 0); break; @@ -269,7 +270,7 @@ printf("PROCESS_F %f\n", cyan_f); \ break; case BC_YUV888: - PROCESS(yuv.yuv_to_rgb_8, yuv.rgb_to_yuv_8, + PROCESS(YUV::yuv.yuv_to_rgb_8, YUV::yuv.rgb_to_yuv_8, r_lookup_8, g_lookup_8, b_lookup_8, unsigned char, 0xff, 3, 1); break; @@ -279,25 +280,25 @@ printf("PROCESS_F %f\n", cyan_f); \ break; case BC_RGBA8888: - PROCESS(yuv.yuv_to_rgb_8, yuv.rgb_to_yuv_8, + PROCESS(YUV::yuv.yuv_to_rgb_8, YUV::yuv.rgb_to_yuv_8, r_lookup_8, g_lookup_8, b_lookup_8, unsigned char, 0xff, 4, 0); break; case BC_YUVA8888: - PROCESS(yuv.yuv_to_rgb_8, yuv.rgb_to_yuv_8, + PROCESS(YUV::yuv.yuv_to_rgb_8, YUV::yuv.rgb_to_yuv_8, r_lookup_8, g_lookup_8, b_lookup_8, unsigned char, 0xff, 4, 1); break; case BC_YUV161616: - PROCESS(yuv.yuv_to_rgb_16, yuv.rgb_to_yuv_16, + PROCESS(YUV::yuv.yuv_to_rgb_16, YUV::yuv.rgb_to_yuv_16, r_lookup_16, g_lookup_16, b_lookup_16, u_int16_t, 0xffff, 3, 1); break; case BC_YUVA16161616: - PROCESS(yuv.yuv_to_rgb_16, yuv.rgb_to_yuv_16, + PROCESS(YUV::yuv.yuv_to_rgb_16, YUV::yuv.rgb_to_yuv_16, r_lookup_16, g_lookup_16, b_lookup_16, u_int16_t, 0xffff, 4, 1); break; diff --git a/cinelerra-5.1/plugins/colorbalance/colorbalance.h b/cinelerra-5.1/plugins/colorbalance/colorbalance.h index 69b5923a..ecc4f18a 100644 --- a/cinelerra-5.1/plugins/colorbalance/colorbalance.h +++ b/cinelerra-5.1/plugins/colorbalance/colorbalance.h @@ -71,7 +71,6 @@ public: int last_frame; Condition input_lock, output_lock; VFrame *input, *output; - YUV yuv; float cyan_f, magenta_f, yellow_f; }; diff --git a/cinelerra-5.1/plugins/gradient/gradient.C b/cinelerra-5.1/plugins/gradient/gradient.C index 9b49f85c..9cf1c152 100644 --- a/cinelerra-5.1/plugins/gradient/gradient.C +++ b/cinelerra-5.1/plugins/gradient/gradient.C @@ -23,6 +23,7 @@ #include #include +#include "bccolors.h" #include "bcdisplayinfo.h" #include "clip.h" #include "bchash.h" @@ -1327,14 +1328,14 @@ void GradientUnit::process_package(LoadPackage *package) { int in1, in2, in3, in4; int out1, out2, out3, out4; - yuv.rgb_to_yuv_8(plugin->config.in_r, + YUV::yuv.rgb_to_yuv_8(plugin->config.in_r, plugin->config.in_g, plugin->config.in_b, in1, in2, in3); in4 = plugin->config.in_a; - yuv.rgb_to_yuv_8(plugin->config.out_r, + YUV::yuv.rgb_to_yuv_8(plugin->config.out_r, plugin->config.out_g, plugin->config.out_b, out1, @@ -1349,14 +1350,14 @@ void GradientUnit::process_package(LoadPackage *package) { int in1, in2, in3, in4; int out1, out2, out3, out4; - yuv.rgb_to_yuv_8(plugin->config.in_r, + YUV::yuv.rgb_to_yuv_8(plugin->config.in_r, plugin->config.in_g, plugin->config.in_b, in1, in2, in3); in4 = plugin->config.in_a; - yuv.rgb_to_yuv_8(plugin->config.out_r, + YUV::yuv.rgb_to_yuv_8(plugin->config.out_r, plugin->config.out_g, plugin->config.out_b, out1, diff --git a/cinelerra-5.1/plugins/gradient/gradient.h b/cinelerra-5.1/plugins/gradient/gradient.h index db7cd327..f6d1d994 100644 --- a/cinelerra-5.1/plugins/gradient/gradient.h +++ b/cinelerra-5.1/plugins/gradient/gradient.h @@ -284,7 +284,6 @@ public: void process_package(LoadPackage *package); GradientServer *server; GradientMain *plugin; - YUV yuv; }; class GradientServer : public LoadServer diff --git a/cinelerra-5.1/plugins/huesaturation/huesaturation.C b/cinelerra-5.1/plugins/huesaturation/huesaturation.C index f7f04f24..4ecb1d61 100644 --- a/cinelerra-5.1/plugins/huesaturation/huesaturation.C +++ b/cinelerra-5.1/plugins/huesaturation/huesaturation.C @@ -19,6 +19,7 @@ * */ +#include "bccolors.h" #include "bcdisplayinfo.h" #include "clip.h" #include "bchash.h" @@ -128,7 +129,6 @@ public: HueUnit(HueEffect *plugin, HueEngine *server); void process_package(LoadPackage *package); HueEffect *plugin; - YUV yuv; }; class HueEffect : public PluginVClient @@ -399,9 +399,9 @@ HueUnit::HueUnit(HueEffect *plugin, HueEngine *server) u = (int)in_row[1]; \ v = (int)in_row[2]; \ if(max == 0xffff) \ - yuv.yuv_to_rgb_16(r_i, g_i, b_i, y, u, v); \ + YUV::yuv.yuv_to_rgb_16(r_i, g_i, b_i, y, u, v); \ else \ - yuv.yuv_to_rgb_8(r_i, g_i, b_i, y, u, v); \ + YUV::yuv.yuv_to_rgb_8(r_i, g_i, b_i, y, u, v); \ HSV::rgb_to_hsv((float)r_i / max, \ (float)g_i / max, \ (float)b_i / max, \ diff --git a/cinelerra-5.1/plugins/libeffecttv/effecttv.C b/cinelerra-5.1/plugins/libeffecttv/effecttv.C index 60f2c8a9..6ec0b5e7 100644 --- a/cinelerra-5.1/plugins/libeffecttv/effecttv.C +++ b/cinelerra-5.1/plugins/libeffecttv/effecttv.C @@ -39,7 +39,6 @@ EffectTV::EffectTV(int w, int h) diff = new unsigned char[w * h]; diff2 = new unsigned char[w * h]; yuv_init(); - yuv = new YUV; } EffectTV::~EffectTV() @@ -47,7 +46,6 @@ EffectTV::~EffectTV() delete [] background; delete [] diff; delete [] diff2; - delete yuv; } diff --git a/cinelerra-5.1/plugins/libeffecttv/effecttv.h b/cinelerra-5.1/plugins/libeffecttv/effecttv.h index 473a4240..0093f7db 100644 --- a/cinelerra-5.1/plugins/libeffecttv/effecttv.h +++ b/cinelerra-5.1/plugins/libeffecttv/effecttv.h @@ -80,7 +80,6 @@ public: int GtoV[0x100]; int BtoY[0x100]; int BtoV[0x100]; - YUV *yuv; }; diff --git a/cinelerra-5.1/plugins/threshold/histogramengine.C b/cinelerra-5.1/plugins/threshold/histogramengine.C index e7c69ff0..bdfab86c 100644 --- a/cinelerra-5.1/plugins/threshold/histogramengine.C +++ b/cinelerra-5.1/plugins/threshold/histogramengine.C @@ -19,8 +19,8 @@ * */ -#include "histogramengine.h" #include "bccolors.h" +#include "histogramengine.h" #include "vframe.h" #include @@ -116,7 +116,7 @@ void HistogramUnit::process_package(LoadPackage *package) y = (row[0] << 8) | row[0]; u = (row[1] << 8) | row[1]; v = (row[2] << 8) | row[2]; - server->yuv->yuv_to_rgb_16(r, g, b, y, u, v); + YUV::yuv.yuv_to_rgb_16(r, g, b, y, u, v); HISTOGRAM_TAIL(3) break; case BC_RGBA8888: @@ -138,7 +138,7 @@ void HistogramUnit::process_package(LoadPackage *package) y = (row[0] << 8) | row[0]; u = (row[1] << 8) | row[1]; v = (row[2] << 8) | row[2]; - server->yuv->yuv_to_rgb_16(r, g, b, y, u, v); + YUV::yuv.yuv_to_rgb_16(r, g, b, y, u, v); HISTOGRAM_TAIL(4) break; case BC_RGB161616: @@ -153,7 +153,7 @@ void HistogramUnit::process_package(LoadPackage *package) y = row[0]; u = row[1]; v = row[2]; - server->yuv->yuv_to_rgb_16(r, g, b, y, u, v); + YUV::yuv.yuv_to_rgb_16(r, g, b, y, u, v); HISTOGRAM_TAIL(3) break; case BC_RGBA16161616: @@ -168,7 +168,7 @@ void HistogramUnit::process_package(LoadPackage *package) y = row[0]; u = row[1]; v = row[2]; - server->yuv->yuv_to_rgb_16(r, g, b, y, u, v); + YUV::yuv.yuv_to_rgb_16(r, g, b, y, u, v); HISTOGRAM_TAIL(4) break; } @@ -184,7 +184,6 @@ void HistogramUnit::process_package(LoadPackage *package) HistogramEngine::HistogramEngine(int total_clients, int total_packages) : LoadServer(total_clients, total_packages) { - yuv = new YUV; data = 0; for(int i = 0; i < 5; i++) accum[i] = new int64_t[HISTOGRAM_RANGE]; @@ -192,7 +191,6 @@ HistogramEngine::HistogramEngine(int total_clients, int total_packages) HistogramEngine::~HistogramEngine() { - delete yuv; for(int i = 0; i < 5; i++) delete [] accum[i]; } diff --git a/cinelerra-5.1/plugins/threshold/histogramengine.h b/cinelerra-5.1/plugins/threshold/histogramengine.h index 41603cb8..6d4f6725 100644 --- a/cinelerra-5.1/plugins/threshold/histogramengine.h +++ b/cinelerra-5.1/plugins/threshold/histogramengine.h @@ -56,7 +56,6 @@ public: LoadClient* new_client(); LoadPackage* new_package(); VFrame *data; - YUV *yuv; int64_t *accum[5]; }; diff --git a/cinelerra-5.1/plugins/timefront/timefront.h b/cinelerra-5.1/plugins/timefront/timefront.h index 9eeb4ee2..54aa46e2 100644 --- a/cinelerra-5.1/plugins/timefront/timefront.h +++ b/cinelerra-5.1/plugins/timefront/timefront.h @@ -275,7 +275,6 @@ public: void process_package(LoadPackage *package); TimeFrontServer *server; TimeFrontMain *plugin; - YUV yuv; }; class TimeFrontServer : public LoadServer diff --git a/cinelerra-5.1/plugins/yuv/yuv.h b/cinelerra-5.1/plugins/yuv/yuv.h index b1e07d36..76be8dad 100644 --- a/cinelerra-5.1/plugins/yuv/yuv.h +++ b/cinelerra-5.1/plugins/yuv/yuv.h @@ -82,7 +82,6 @@ public: VFrame **output, **input; int last_frame; Mutex input_lock, output_lock; - YUV yuv; }; -- 2.26.2