/usr/include/rem/rem_vid.h is in librem-dev 0.4.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | /**
* @file rem_vid.h Basic video types
*
* Copyright (C) 2010 Creytiv.com
*/
/** Pixel format */
enum vidfmt {
VID_FMT_YUV420P = 0, /* planar YUV 4:2:0 12bpp */
VID_FMT_YUYV422, /* packed YUV 4:2:2 16bpp */
VID_FMT_UYVY422, /* packed YUV 4:2:2 16bpp */
VID_FMT_RGB32, /* packed RGBA 8:8:8:8 32bpp (native endian) */
VID_FMT_ARGB, /* packed RGBA 8:8:8:8 32bpp (big endian) */
VID_FMT_RGB565, /* packed RGB 5:6:5 16bpp (native endian) */
VID_FMT_RGB555, /* packed RGB 5:5:5 16bpp (native endian) */
VID_FMT_NV12, /* planar YUV 4:2:0 12bpp UV interleaved */
VID_FMT_NV21, /* planar YUV 4:2:0 12bpp VU interleaved */
/* marker */
VID_FMT_N
};
/** Video pixel format component description */
struct vidfmt_compdesc {
unsigned plane_index:2;
unsigned step:3;
};
/** Video pixel format description */
struct vidfmt_desc {
const char *name;
uint8_t planes;
uint8_t compn;
struct vidfmt_compdesc compv[4];
};
/** Video orientation */
enum vidorient {
VIDORIENT_PORTRAIT,
VIDORIENT_PORTRAIT_UPSIDEDOWN,
VIDORIENT_LANDSCAPE_LEFT,
VIDORIENT_LANDSCAPE_RIGHT,
};
/** Video size */
struct vidsz {
unsigned w; /**< Width */
unsigned h; /**< Height */
};
/** Video frame */
struct vidframe {
uint8_t *data[4]; /**< Video planes */
uint16_t linesize[4]; /**< Array of line-sizes */
struct vidsz size; /**< Frame resolution */
enum vidfmt fmt; /**< Video pixel format */
};
/** Video point */
struct vidpt {
unsigned x; /**< X position */
unsigned y; /**< Y position */
};
/** Video rectangle */
struct vidrect {
unsigned x; /**< X position */
unsigned y; /**< Y position */
unsigned w; /**< Width */
unsigned h; /**< Height */
};
static inline bool vidsz_cmp(const struct vidsz *a, const struct vidsz *b)
{
if (!a || !b)
return false;
if (a == b)
return true;
return a->w == b->w && a->h == b->h;
}
static inline bool vidrect_cmp(const struct vidrect *a,
const struct vidrect *b)
{
if (!a || !b)
return false;
if (a == b)
return true;
return a->x == b->x && a->y == b->y && a->w == b->w && a->h == b->h;
}
static inline int rgb2y(uint8_t r, uint8_t g, uint8_t b)
{
return ((66 * r + 129 * g + 25 * b + 128) >> 8) + 16;
}
static inline int rgb2u(uint8_t r, uint8_t g, uint8_t b)
{
return ((-38 * r - 74 * g + 112 * b + 128) >> 8) + 128;
}
static inline int rgb2v(uint8_t r, uint8_t g, uint8_t b)
{
return ((112 * r - 94 * g - 18 * b + 128) >> 8) + 128;
}
size_t vidframe_size(enum vidfmt fmt, const struct vidsz *sz);
void vidframe_init(struct vidframe *vf, enum vidfmt fmt,
const struct vidsz *sz, void *data[4],
unsigned linesize[4]);
void vidframe_init_buf(struct vidframe *vf, enum vidfmt fmt,
const struct vidsz *sz, uint8_t *buf);
int vidframe_alloc(struct vidframe **vfp, enum vidfmt fmt,
const struct vidsz *sz);
void vidframe_fill(struct vidframe *vf, uint32_t r, uint32_t g, uint32_t b);
void vidframe_copy(struct vidframe *dst, const struct vidframe *src);
const char *vidfmt_name(enum vidfmt fmt);
static inline bool vidframe_isvalid(const struct vidframe *f)
{
return f ? f->data[0] != NULL : false;
}
extern const struct vidfmt_desc vidfmt_descv[VID_FMT_N];
/* draw */
void vidframe_draw_point(struct vidframe *f, unsigned x, unsigned y,
uint8_t r, uint8_t g, uint8_t b);
void vidframe_draw_hline(struct vidframe *f,
unsigned x0, unsigned y0, unsigned w,
uint8_t r, uint8_t g, uint8_t b);
void vidframe_draw_vline(struct vidframe *f,
unsigned x0, unsigned y0, unsigned h,
uint8_t r, uint8_t g, uint8_t b);
void vidframe_draw_rect(struct vidframe *f,
unsigned x0, unsigned y0, unsigned w, unsigned h,
uint8_t r, uint8_t g, uint8_t b);
|