__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * v4l2-rect.h - v4l2_rect helper functions
 *
 * Copyright 2014 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
 */

#ifndef _V4L2_RECT_H_
#define _V4L2_RECT_H_

#include <linux/videodev2.h>

/**
 * v4l2_rect_set_size_to() - copy the width/height values.
 * @r: rect whose width and height fields will be set
 * @size: rect containing the width and height fields you need.
 */
static inline void v4l2_rect_set_size_to(struct v4l2_rect *r,
					 const struct v4l2_rect *size)
{
	r->width = size->width;
	r->height = size->height;
}

/**
 * v4l2_rect_set_min_size() - width and height of r should be >= min_size.
 * @r: rect whose width and height will be modified
 * @min_size: rect containing the minimal width and height
 */
static inline void v4l2_rect_set_min_size(struct v4l2_rect *r,
					  const struct v4l2_rect *min_size)
{
	if (r->width < min_size->width)
		r->width = min_size->width;
	if (r->height < min_size->height)
		r->height = min_size->height;
}

/**
 * v4l2_rect_set_max_size() - width and height of r should be <= max_size
 * @r: rect whose width and height will be modified
 * @max_size: rect containing the maximum width and height
 */
static inline void v4l2_rect_set_max_size(struct v4l2_rect *r,
					  const struct v4l2_rect *max_size)
{
	if (r->width > max_size->width)
		r->width = max_size->width;
	if (r->height > max_size->height)
		r->height = max_size->height;
}

/**
 * v4l2_rect_map_inside()- r should be inside boundary.
 * @r: rect that will be modified
 * @boundary: rect containing the boundary for @r
 */
static inline void v4l2_rect_map_inside(struct v4l2_rect *r,
					const struct v4l2_rect *boundary)
{
	v4l2_rect_set_max_size(r, boundary);
	if (r->left < boundary->left)
		r->left = boundary->left;
	if (r->top < boundary->top)
		r->top = boundary->top;
	if (r->left + r->width > boundary->left + boundary->width)
		r->left = boundary->left + boundary->width - r->width;
	if (r->top + r->height > boundary->top + boundary->height)
		r->top = boundary->top + boundary->height - r->height;
}

/**
 * v4l2_rect_same_size() - return true if r1 has the same size as r2
 * @r1: rectangle.
 * @r2: rectangle.
 *
 * Return true if both rectangles have the same size.
 */
static inline bool v4l2_rect_same_size(const struct v4l2_rect *r1,
				       const struct v4l2_rect *r2)
{
	return r1->width == r2->width && r1->height == r2->height;
}

/**
 * v4l2_rect_same_position() - return true if r1 has the same position as r2
 * @r1: rectangle.
 * @r2: rectangle.
 *
 * Return true if both rectangles have the same position
 */
static inline bool v4l2_rect_same_position(const struct v4l2_rect *r1,
					   const struct v4l2_rect *r2)
{
	return r1->top == r2->top && r1->left == r2->left;
}

/**
 * v4l2_rect_equal() - return true if r1 equals r2
 * @r1: rectangle.
 * @r2: rectangle.
 *
 * Return true if both rectangles have the same size and position.
 */
static inline bool v4l2_rect_equal(const struct v4l2_rect *r1,
				   const struct v4l2_rect *r2)
{
	return v4l2_rect_same_size(r1, r2) && v4l2_rect_same_position(r1, r2);
}

/**
 * v4l2_rect_intersect() - calculate the intersection of two rects.
 * @r: intersection of @r1 and @r2.
 * @r1: rectangle.
 * @r2: rectangle.
 */
static inline void v4l2_rect_intersect(struct v4l2_rect *r,
				       const struct v4l2_rect *r1,
				       const struct v4l2_rect *r2)
{
	int right, bottom;

	r->top = max(r1->top, r2->top);
	r->left = max(r1->left, r2->left);
	bottom = min(r1->top + r1->height, r2->top + r2->height);
	right = min(r1->left + r1->width, r2->left + r2->width);
	r->height = max(0, bottom - r->top);
	r->width = max(0, right - r->left);
}

/**
 * v4l2_rect_scale() - scale rect r by to/from
 * @r: rect to be scaled.
 * @from: from rectangle.
 * @to: to rectangle.
 *
 * This scales rectangle @r horizontally by @to->width / @from->width and
 * vertically by @to->height / @from->height.
 *
 * Typically @r is a rectangle inside @from and you want the rectangle as
 * it would appear after scaling @from to @to. So the resulting @r will
 * be the scaled rectangle inside @to.
 */
static inline void v4l2_rect_scale(struct v4l2_rect *r,
				   const struct v4l2_rect *from,
				   const struct v4l2_rect *to)
{
	if (from->width == 0 || from->height == 0) {
		r->left = r->top = r->width = r->height = 0;
		return;
	}
	r->left = (((r->left - from->left) * to->width) / from->width) & ~1;
	r->width = ((r->width * to->width) / from->width) & ~1;
	r->top = ((r->top - from->top) * to->height) / from->height;
	r->height = (r->height * to->height) / from->height;
}

/**
 * v4l2_rect_overlap() - do r1 and r2 overlap?
 * @r1: rectangle.
 * @r2: rectangle.
 *
 * Returns true if @r1 and @r2 overlap.
 */
static inline bool v4l2_rect_overlap(const struct v4l2_rect *r1,
				     const struct v4l2_rect *r2)
{
	/*
	 * IF the left side of r1 is to the right of the right side of r2 OR
	 *    the left side of r2 is to the right of the right side of r1 THEN
	 * they do not overlap.
	 */
	if (r1->left >= r2->left + r2->width ||
	    r2->left >= r1->left + r1->width)
		return false;
	/*
	 * IF the top side of r1 is below the bottom of r2 OR
	 *    the top side of r2 is below the bottom of r1 THEN
	 * they do not overlap.
	 */
	if (r1->top >= r2->top + r2->height ||
	    r2->top >= r1->top + r1->height)
		return false;
	return true;
}

/**
 * v4l2_rect_enclosed() - is r1 enclosed in r2?
 * @r1: rectangle.
 * @r2: rectangle.
 *
 * Returns true if @r1 is enclosed in @r2.
 */
static inline bool v4l2_rect_enclosed(struct v4l2_rect *r1,
				      struct v4l2_rect *r2)
{
	if (r1->left < r2->left || r1->top < r2->top)
		return false;
	if (r1->left + r1->width > r2->left + r2->width)
		return false;
	if (r1->top + r1->height > r2->top + r2->height)
		return false;

	return true;
}

#endif

Filemanager

Name Type Size Permission Actions
davinci Folder 0755
drv-intf Folder 0755
i2c Folder 0755
tpg Folder 0755
cec-notifier.h File 5.03 KB 0644
cec-pin.h File 2.79 KB 0644
cec.h File 17.88 KB 0644
demux.h File 22.69 KB 0644
dmxdev.h File 5.87 KB 0644
dvb-usb-ids.h File 19.46 KB 0644
dvb_ca_en50221.h File 4.35 KB 0644
dvb_demux.h File 10.77 KB 0644
dvb_frontend.h File 30.42 KB 0644
dvb_net.h File 2.43 KB 0644
dvb_ringbuffer.h File 8.32 KB 0644
dvb_vb2.h File 7.65 KB 0644
dvbdev.h File 14.77 KB 0644
frame_vector.h File 1.42 KB 0644
imx.h File 190 B 0644
ipu-bridge.h File 4.3 KB 0644
ipu6-pci-table.h File 876 B 0644
jpeg.h File 500 B 0644
media-dev-allocator.h File 2.21 KB 0644
media-device.h File 17.65 KB 0644
media-devnode.h File 5.29 KB 0644
media-entity.h File 47.13 KB 0644
media-request.h File 11.95 KB 0644
mipi-csi2.h File 1.46 KB 0644
rc-core.h File 12.08 KB 0644
rc-map.h File 14.53 KB 0644
rcar-fcp.h File 1.1 KB 0644
tuner-types.h File 7.54 KB 0644
tuner.h File 8.46 KB 0644
tveeprom.h File 3.3 KB 0644
v4l2-async.h File 11.78 KB 0644
v4l2-cci.h File 4.75 KB 0644
v4l2-common.h File 19.96 KB 0644
v4l2-ctrls.h File 54.48 KB 0644
v4l2-dev.h File 20.42 KB 0644
v4l2-device.h File 18.61 KB 0644
v4l2-dv-timings.h File 10.64 KB 0644
v4l2-event.h File 6.01 KB 0644
v4l2-fh.h File 4.22 KB 0644
v4l2-flash-led-class.h File 5.75 KB 0644
v4l2-fwnode.h File 15.57 KB 0644
v4l2-h264.h File 3.1 KB 0644
v4l2-image-sizes.h File 827 B 0644
v4l2-ioctl.h File 33.52 KB 0644
v4l2-jpeg.h File 6.43 KB 0644
v4l2-mc.h File 7.78 KB 0644
v4l2-mediabus.h File 9.65 KB 0644
v4l2-mem2mem.h File 29.48 KB 0644
v4l2-rect.h File 5.71 KB 0644
v4l2-subdev.h File 74.55 KB 0644
v4l2-vp9.h File 8.32 KB 0644
videobuf2-core.h File 52.05 KB 0644
videobuf2-dma-contig.h File 883 B 0644
videobuf2-dma-sg.h File 698 B 0644
videobuf2-dvb.h File 1.81 KB 0644
videobuf2-memops.h File 1.09 KB 0644
videobuf2-v4l2.h File 14.48 KB 0644
videobuf2-vmalloc.h File 509 B 0644
vsp1.h File 3.62 KB 0644
Filemanager