track_frame == that.track_frame &&
bottom_is_master == that.bottom_is_master &&
horizontal_only == that.horizontal_only &&
- vertical_only == that.vertical_only;
+ vertical_only == that.vertical_only &&
+ tracking_type == that.tracking_type;
}
void MotionHVConfig::copy_from(MotionHVConfig &that)
delete rotate_target_dst;
}
-const char* MotionHVMain::plugin_title() { return _("MotionHV"); }
+const char* MotionHVMain::plugin_title() { return N_("MotionHV"); }
int MotionHVMain::is_realtime() { return 1; }
int MotionHVMain::is_multichannel() { return 1; }
FileXML output;
// cause data to be stored directly in text
- output.set_shared_output(keyframe->get_data(), MESSAGESIZE);
- output.tag.set_title("MOTION");
+ output.set_shared_output(keyframe->xbuf);
+ output.tag.set_title("MOTIONHV");
output.tag.set_property("BLOCK_COUNT", config.block_count);
// output.tag.set_property("GLOBAL_POSITIONS", config.global_positions);
output.tag.set_property("HORIZONTAL_ONLY", config.horizontal_only);
output.tag.set_property("VERTICAL_ONLY", config.vertical_only);
output.append_tag();
- output.tag.set_title("/MOTION");
+ output.tag.set_title("/MOTIONHV");
output.append_tag();
output.terminate_string();
}
{
FileXML input;
- input.set_shared_input(keyframe->get_data(), strlen(keyframe->get_data()));
+ input.set_shared_input(keyframe->xbuf);
int result = 0;
if(!result)
{
- if(input.tag.title_is("MOTION"))
+ if(input.tag.title_is("MOTIONHV"))
{
config.block_count = input.tag.get_property("BLOCK_COUNT", config.block_count);
// config.global_positions = input.tag.get_property("GLOBAL_POSITIONS", config.global_positions);
}
-
-void MotionHVMain::draw_pixel(VFrame *frame, int x, int y)
+MotionHvVVFrame::MotionHvVVFrame(VFrame *vfrm, int n)
+ : VFrame(vfrm->get_data(), -1, vfrm->get_y()-vfrm->get_data(),
+ vfrm->get_u()-vfrm->get_data(), vfrm->get_v()-vfrm->get_data(),
+ vfrm->get_w(), vfrm->get_h(), vfrm->get_color_model(),
+ vfrm->get_bytes_per_line())
{
- if(!(x >= 0 && y >= 0 && x < frame->get_w() && y < frame->get_h())) return;
-
-#define DRAW_PIXEL(x, y, components, do_yuv, max, type) \
-{ \
- type **rows = (type**)frame->get_rows(); \
- rows[y][x * components] = max - rows[y][x * components]; \
- if(!do_yuv) \
- { \
- rows[y][x * components + 1] = max - rows[y][x * components + 1]; \
- rows[y][x * components + 2] = max - rows[y][x * components + 2]; \
- } \
- else \
- { \
- rows[y][x * components + 1] = (max / 2 + 1) - rows[y][x * components + 1]; \
- rows[y][x * components + 2] = (max / 2 + 1) - rows[y][x * components + 2]; \
- } \
- if(components == 4) \
- rows[y][x * components + 3] = max; \
+ this->n = n;
}
-
- switch(frame->get_color_model())
- {
- case BC_RGB888:
- DRAW_PIXEL(x, y, 3, 0, 0xff, unsigned char);
- break;
- case BC_RGBA8888:
- DRAW_PIXEL(x, y, 4, 0, 0xff, unsigned char);
- break;
- case BC_RGB_FLOAT:
- DRAW_PIXEL(x, y, 3, 0, 1.0, float);
- break;
- case BC_RGBA_FLOAT:
- DRAW_PIXEL(x, y, 4, 0, 1.0, float);
- break;
- case BC_YUV888:
- DRAW_PIXEL(x, y, 3, 1, 0xff, unsigned char);
- break;
- case BC_YUVA8888:
- DRAW_PIXEL(x, y, 4, 1, 0xff, unsigned char);
- break;
- case BC_RGB161616:
- DRAW_PIXEL(x, y, 3, 0, 0xffff, uint16_t);
- break;
- case BC_YUV161616:
- DRAW_PIXEL(x, y, 3, 1, 0xffff, uint16_t);
- break;
- case BC_RGBA16161616:
- DRAW_PIXEL(x, y, 4, 0, 0xffff, uint16_t);
- break;
- case BC_YUVA16161616:
- DRAW_PIXEL(x, y, 4, 1, 0xffff, uint16_t);
- break;
+int MotionHvVVFrame::draw_pixel(int x, int y)
+{
+ VFrame::draw_pixel(x+0, y+0);
+ for( int i=1; i<n; ++i ) {
+ VFrame::draw_pixel(x-i, y-i);
+ VFrame::draw_pixel(x+i, y+i);
}
+ return 0;
}
-
void MotionHVMain::draw_line(VFrame *frame, int x1, int y1, int x2, int y2)
{
- int w = labs(x2 - x1);
- int h = labs(y2 - y1);
-//printf("MotionHVMain::draw_line 1 %d %d %d %d\n", x1, y1, x2, y2);
-
- if(!w && !h)
- {
- draw_pixel(frame, x1, y1);
- }
- else
- if(w > h)
- {
-// Flip coordinates so x1 < x2
- if(x2 < x1)
- {
- y2 ^= y1;
- y1 ^= y2;
- y2 ^= y1;
- x1 ^= x2;
- x2 ^= x1;
- x1 ^= x2;
- }
- int numerator = y2 - y1;
- int denominator = x2 - x1;
- for(int i = x1; i < x2; i++)
- {
- int y = y1 + (int64_t)(i - x1) * (int64_t)numerator / (int64_t)denominator;
- draw_pixel(frame, i, y);
- }
- }
- else
- {
-// Flip coordinates so y1 < y2
- if(y2 < y1)
- {
- y2 ^= y1;
- y1 ^= y2;
- y2 ^= y1;
- x1 ^= x2;
- x2 ^= x1;
- x1 ^= x2;
- }
- int numerator = x2 - x1;
- int denominator = y2 - y1;
- for(int i = y1; i < y2; i++)
- {
- int x = x1 + (int64_t)(i - y1) * (int64_t)numerator / (int64_t)denominator;
- draw_pixel(frame, x, i);
- }
- }
-//printf("MotionHVMain::draw_line 2\n");
+ int iw = frame->get_w(), ih = frame->get_h();
+ int mx = iw > ih ? iw : ih;
+ int n = mx/800 + 1;
+ MotionHvVVFrame vfrm(frame, n);
+ vfrm.set_pixel_color(WHITE);
+ int m = 2; while( m < n ) m <<= 1;
+ vfrm.set_stiple(2*m);
+ vfrm.draw_line(x1,y1, x2,y2);
}
#define ARROW_SIZE 10