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, \
{
ScopePackage *pkg = (ScopePackage*)package;
-
- YUV yuv;
float r, g, b;
float h, s, v;
int x, y;
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);
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;
}
}
}
+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; y<h; ++y ) {
+ uint8_t *ap = arows[y], *bp = brows[y];
+ for( int x=0; x<w; ++x ) {
+ for( int i=0; i<3; ++i ) {
+ int d = *ap++ - *bp++;
+ m += d;
+ if( d < 0 ) d = -d;
+ n += d;
+ }
+ }
+ }
+ int sz = h*w*3;
+ printf(" %d %d %f", m, n, (double)n/sz);
+ tm += m; tn += n;
+ return n;
+}
+
int main(int ac, char **av)
{
BC_Signals signals;
if( to_cmdl == BC_TRANSPARENCY || to_cmdl == BC_COMPRESSED ) continue;
if( to_cmdl == BC_A8 || to_cmdl == BC_A16 ) continue;
if( to_cmdl == BC_A_FLOAT || to_cmdl == 8 ) continue;
- printf("xfer_%s_to_%s\n", cmdl[fr_cmdl],cmdl[to_cmdl]);
+ printf("xfer_%s_to_%s ", cmdl[fr_cmdl],cmdl[to_cmdl]);
VFrame bfrm(w, h, to_cmdl, -1);
bfrm.transfer_from(&afrm, 0);
test_window.draw(&bfrm);
VFrame cfrm(w, h, BC_RGB888, -1);
cfrm.transfer_from(&bfrm, 0);
- printf("xfer_%s_to_%s\n",cmdl[fr_cmdl],cmdl[to_cmdl]);
test_window.show_text(50,50, "xfer_%s_to_%s",cmdl[fr_cmdl],cmdl[to_cmdl]);
-// write_ppm(cfrm.get_data(), w,h, "/tmp/test/xfer_%s_to_%s.pgm",
-// cmdl[fr_cmdl],cmdl[to_cmdl]);
+ write_ppm(cfrm.get_data(), w,h, "/tmp/test/xfer_%s_to_%s.pgm",
+ cmdl[fr_cmdl],cmdl[to_cmdl]);
+ diff_vframe(ifrm, cfrm);
// usleep(100000);
+ printf("\n");
}
}
test_window.close_window();
Color3WayUnit(Color3WayMain *plugin, Color3WayEngine *server);
void process_package(LoadPackage *package);
Color3WayMain *plugin;
- YUV yuv;
};
class Color3WayEngine : public LoadServer
*
*/
+#include "bccolors.h"
#include "filexml.h"
#include "clip.h"
#include "colorbalance.h"
switch(input->get_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;
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;
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;
int last_frame;
Condition input_lock, output_lock;
VFrame *input, *output;
- YUV yuv;
float cyan_f, magenta_f, yellow_f;
};
#include <stdint.h>
#include <string.h>
+#include "bccolors.h"
#include "bcdisplayinfo.h"
#include "clip.h"
#include "bchash.h"
{
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,
{
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,
void process_package(LoadPackage *package);
GradientServer *server;
GradientMain *plugin;
- YUV yuv;
};
class GradientServer : public LoadServer
*
*/
+#include "bccolors.h"
#include "bcdisplayinfo.h"
#include "clip.h"
#include "bchash.h"
HueUnit(HueEffect *plugin, HueEngine *server);
void process_package(LoadPackage *package);
HueEffect *plugin;
- YUV yuv;
};
class HueEffect : public PluginVClient
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 = new unsigned char[w * h];
diff2 = new unsigned char[w * h];
yuv_init();
- yuv = new YUV;
}
EffectTV::~EffectTV()
delete [] background;
delete [] diff;
delete [] diff2;
- delete yuv;
}
int GtoV[0x100];
int BtoY[0x100];
int BtoV[0x100];
- YUV *yuv;
};
*
*/
-#include "histogramengine.h"
#include "bccolors.h"
+#include "histogramengine.h"
#include "vframe.h"
#include <stdio.h>
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:
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:
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:
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;
}
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];
HistogramEngine::~HistogramEngine()
{
- delete yuv;
for(int i = 0; i < 5; i++)
delete [] accum[i];
}
LoadClient* new_client();
LoadPackage* new_package();
VFrame *data;
- YUV *yuv;
int64_t *accum[5];
};
void process_package(LoadPackage *package);
TimeFrontServer *server;
TimeFrontMain *plugin;
- YUV yuv;
};
class TimeFrontServer : public LoadServer
VFrame **output, **input;
int last_frame;
Mutex input_lock, output_lock;
- YUV yuv;
};