int bobDeintFilter(VideoFilter *f, VideoFrame *frame, int field) { (void)field; BDFilter *filter = (BDFilter *)(f); int width = frame->width; int height = frame->height; int ymax = height; int stride = frame->pitches[0]; unsigned char *yoff = frame->buf + frame->offsets[0]; unsigned char *uoff = frame->buf + frame->offsets[1]; unsigned char *voff = frame->buf + frame->offsets[2]; if (filter->tmp_size < width) { filter->tmp_ptr = (unsigned char *)realloc( filter->tmp_ptr, width * sizeof(char)); filter->tmp_size = width; } if (filter->state_size < height) { filter->line_state = (unsigned char *)realloc( filter->line_state, height * sizeof(char)); filter->state_size = height; } doSplit(filter, yoff, ymax, stride); stride = frame->pitches[1]; ymax = height >> 1; doSplit(filter, uoff, ymax, stride); doSplit(filter, voff, ymax, stride); return 0; }
void Octree::doSplit(int maxSplit, Node *node) { // Don't split down any further than 4 levels. if (maxSplit <= 0 || (node->edges.size() < 5 && node->faces.size() < 5)) { return; } if (!node->split()) { for (int i = 0; i < 8; ++i) { doSplit(maxSplit - 1, node->children[i]); } } }
void Octree::splitTree() { // initially split 4 levels doSplit(0, root); }