include/media/v4l2-rect.h
Source file repositories/reference/linux-study-clean/include/media/v4l2-rect.h
File Facts
- System
- Linux kernel
- Corpus path
include/media/v4l2-rect.h- Extension
.h- Size
- 5852 bytes
- Lines
- 208
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/videodev2.h
Detected Declarations
function v4l2_rect_set_size_tofunction v4l2_rect_set_min_sizefunction v4l2_rect_set_max_sizefunction v4l2_rect_map_insidefunction v4l2_rect_same_sizefunction v4l2_rect_same_positionfunction v4l2_rect_equalfunction v4l2_rect_intersectfunction v4l2_rect_scalefunction v4l2_rect_overlapfunction v4l2_rect_enclosed
Annotated Snippet
#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;
}
Annotation
- Immediate include surface: `linux/videodev2.h`.
- Detected declarations: `function v4l2_rect_set_size_to`, `function v4l2_rect_set_min_size`, `function v4l2_rect_set_max_size`, `function v4l2_rect_map_inside`, `function v4l2_rect_same_size`, `function v4l2_rect_same_position`, `function v4l2_rect_equal`, `function v4l2_rect_intersect`, `function v4l2_rect_scale`, `function v4l2_rect_overlap`.
- Atlas domain: Repository Root And Misc / include.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.