53 for (
int i = 0; i < num_pixels; i++) {
54 const float *pixel = rgba + 4 * i;
56 gray[i] = weight_red * pixel[0] + weight_green * pixel[1] + weight_blue * pixel[2];
67 for (
int i = 0; i < num_pixels; i++) {
68 const unsigned char *pixel = rgba + i * 4;
70 gray[i] = (weight_red * pixel[0] + weight_green * pixel[1] + weight_blue * pixel[2]) / 255.0f;
104 (
unsigned char *)searchibuf->
rect, gray_pixels,
width *
height, 0.2126f, 0.7152f, 0.0722f);
147 if (marker_keyed ==
NULL) {
151 keyed_framenr = marker_keyed->
framenr;
153 *r_marker_keyed = marker_keyed;
171 clip, user, clip_flag, track, curfra, backwards, reference_marker);
186 const bool is_backwards,
222 float *reference_search_area,
223 int reference_search_area_width,
224 int reference_search_area_height,
226 const bool is_backward,
227 double dst_pixel_x[5],
228 double dst_pixel_y[5])
231 double src_pixel_x[5], src_pixel_y[5];
239 int new_search_area_width, new_search_area_height;
240 int frame_width, frame_height;
244 frame_width = destination_ibuf->
x;
245 frame_height = destination_ibuf->
y;
252 destination_ibuf, track, marker, &new_search_area_width, &new_search_area_height);
260 frame_width, frame_height, reference_marker, src_pixel_x, src_pixel_y);
262 frame_width, frame_height, marker, dst_pixel_x, dst_pixel_y);
264 if (patch_new ==
NULL || reference_search_area ==
NULL) {
270 reference_search_area,
271 reference_search_area_width,
272 reference_search_area_height,
274 new_search_area_width,
275 new_search_area_height,
290 int *reference_framenr)
296 while (reference >= first_marker && reference <= last_marker &&
306 if (reference < first_marker || reference > last_marker) {
310 *reference_framenr = reference->
framenr;
325 ImBuf *reference_ibuf, *destination_ibuf;
327 int frame_width, frame_height;
328 int search_area_height, search_area_width;
330 int reference_framenr;
332 double dst_pixel_x[5], dst_pixel_y[5];
346 clip, &user, clip_flag, track, reference_framenr, backwards, &reference_marker);
347 if (reference_ibuf ==
NULL) {
352 if (reference_marker == marker) {
358 if (destination_ibuf ==
NULL) {
365 reference_ibuf, track, reference_marker, &search_area_width, &search_area_height);
388 frame_width, frame_height, marker, dst_pixel_x, dst_pixel_y);
#define MOVIECLIP_CACHE_SKIP
struct ImBuf * BKE_movieclip_get_ibuf_flag(struct MovieClip *clip, struct MovieClipUser *user, int flag, int cache_flag)
void BKE_movieclip_get_size(struct MovieClip *clip, struct MovieClipUser *user, int *width, int *height)
float BKE_movieclip_remap_clip_to_scene_frame(const struct MovieClip *clip, float framenr)
float * BKE_tracking_track_get_mask(int frame_width, int frame_height, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker)
struct ImBuf * BKE_tracking_get_search_imbuf(struct ImBuf *ibuf, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker, bool anchored, bool disable_channels)
struct MovieTrackingMarker * BKE_tracking_marker_get(struct MovieTrackingTrack *track, int framenr)
@ TRACK_ALGORITHM_FLAG_USE_NORMALIZATION
@ TRACK_ALGORITHM_FLAG_USE_BRUTE
@ TRACK_ALGORITHM_FLAG_USE_MASK
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
void IMB_freeImBuf(struct ImBuf *ibuf)
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
CCL_NAMESPACE_BEGIN struct Options options
@ LIBMV_TRACK_REGION_FORWARD
@ LIBMV_TRACK_REGION_BACKWARD
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
float minimum_correlation
MovieTrackingMarker * markers
int libmv_trackRegion(const libmv_TrackRegionOptions *, const float *, int, int, const float *, int, int, const double *x1, const double *y1, libmv_TrackRegionResult *result, double *x2, double *y2)
void BKE_tracking_refine_marker(MovieClip *clip, MovieTrackingTrack *track, MovieTrackingMarker *marker, bool backwards)
static float * track_get_search_floatbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTrackingMarker *marker, int *r_width, int *r_height)
static ImBuf * tracking_context_get_frame_ibuf(MovieClip *clip, MovieClipUser *user, int clip_flag, int framenr)
static bool refine_marker_reference_frame_get(MovieTrackingTrack *track, MovieTrackingMarker *marker, bool backwards, int *reference_framenr)
static ImBuf * tracking_context_get_keyframed_ibuf(MovieClip *clip, MovieClipUser *user, int clip_flag, MovieTrackingTrack *track, int curfra, bool backwards, MovieTrackingMarker **r_marker_keyed)
static void uint8_rgba_to_float_gray(const unsigned char *rgba, float *gray, int num_pixels, float weight_red, float weight_green, float weight_blue)
static void float_rgba_to_gray(const float *rgba, float *gray, int num_pixels, float weight_red, float weight_green, float weight_blue)
static ImBuf * tracking_context_get_reference_ibuf(MovieClip *clip, MovieClipUser *user, int clip_flag, MovieTrackingTrack *track, int curfra, bool backwards, MovieTrackingMarker **reference_marker)
static bool configure_and_run_tracker(ImBuf *destination_ibuf, MovieTrackingTrack *track, MovieTrackingMarker *reference_marker, MovieTrackingMarker *marker, float *reference_search_area, int reference_search_area_width, int reference_search_area_height, float *mask, const bool is_backward, double dst_pixel_x[5], double dst_pixel_y[5])
void tracking_configure_tracker(const MovieTrackingTrack *track, float *mask, const bool is_backwards, libmv_TrackRegionOptions *options)
void tracking_get_marker_coords_for_tracking(int frame_width, int frame_height, const MovieTrackingMarker *marker, double search_pixel_x[5], double search_pixel_y[5])
MovieTrackingMarker * tracking_get_keyframed_marker(MovieTrackingTrack *track, int current_frame, bool backwards)
void tracking_set_marker_coords_from_tracking(int frame_width, int frame_height, MovieTrackingMarker *marker, const double search_pixel_x[5], const double search_pixel_y[5])
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)