kernels/linux-2.4.0/drivers/media/video/buz.c
/*
 * The overlay mask has one bit for each pixel on a scan line,
 *  and the maximum window size is BUZ_MAX_WIDTH * BUZ_MAX_HEIGHT pixels.
 */
The overlay mask has one bit for each pixel on a scan line,
and the maximum window size is BUZ_MAX_WIDTH * BUZ_MAX_HEIGHT pixels.
The overlay mask has one bit for each pixel on a scan line and the maximum window size is BUZ_MAX_WIDTH * BUZ_MAX_HEIGHT pixels .
static void write_overlay_mask(struct zoran *zr, struct video_clip *vp, int count)
{
	unsigned mask_line_size = (BUZ_MAX_WIDTH + 31) / 32;
	u32 *mask;
	int x, y, width, height;
	unsigned i, j, k;
	u32 reg;
	memset(zr->overlay_mask, ~0, mask_line_size * 4 * BUZ_MAX_HEIGHT);
	reg = 0;
	for (i = 0; i < count; ++i) {
		x = vp[i].x;
		y = vp[i].y;
		width = vp[i].width;
		height = vp[i].height;
		if (x < 0) {
			width += x;
			x = 0;
		}
		if (y < 0) {
			height += y;
			y = 0;
		}
		if (x + width > zr->window.width) {
			width = zr->window.width - x;
		}
		if (y + height > zr->window.height) {
			height = zr->window.height - y;
		}
		if (height <= 0) {
			continue;
		}
		if (width <= 0) {
			continue;
		}
		for (j = 0; j < height; ++j) {
			mask = zr->overlay_mask + (y + j) * mask_line_size;
			for (k = 0; k < width; ++k) {
				mask[(x + k) / 32] &= ~((u32) 1 << (x + k) % 32);
			}
		}
	}
}
static void write_overlay_mask ( struct zoran * zr , struct video_clip * vp , int count ) { unsigned mask_line_size = ( BUZ_MAX_WIDTH + 31 ) / 32 ; u32 * mask ; int x , y , width , height ; unsigned i , j , k ; u32 reg ; memset ( zr -> overlay_mask , ~ 0 , mask_line_size * 4 * BUZ_MAX_HEIGHT ) ; reg = 0 ; for ( i = 0 ; i < count ; ++ i ) { x = vp [ i ] . x ; y = vp [ i ] . y ; width = vp [ i ] . width ; height = vp [ i ] . height ; if ( x < 0 ) { width += x ; x = 0 ; } if ( y < 0 ) { height += y ; y = 0 ; } if ( x + width > zr -> window . width ) { width = zr -> window . width - x ; } if ( y + height > zr -> window . height ) { height = zr -> window . height - y ; } if ( height <= 0 ) { continue ; } if ( width <= 0 ) { continue ; } for ( j = 0 ; j < height ; ++ j ) { mask = zr -> overlay_mask + ( y + j ) * mask_line_size ; for ( k = 0 ; k < width ; ++ k ) { mask [ ( x + k ) / 32 ] &= ~ ( ( u32 ) 1 << ( x + k ) % 32 ) ; } } } }
The overlay mask has one bit for each pixel on a scan line,
  and the maximum window size is BUZ_MAX_WIDTH * BUZ_MAX_HEIGHT pixels.
The overlay mask has one bit for each pixel on a scan line and the maximum window size is BUZ_MAX_WIDTH * BUZ_MAX_HEIGHT pixels .
/* fill mask with one bits */ /* pick up local copy of clip */ /* trim clips that extend beyond the window */ /* ignore degenerate clips */ /* apply clip for each scan line */ /* reset bit for each pixel */ /* this can be optimized later if need be */