Go to the documentation of this file.
27 #define ONE_HALF (1 << (SCALEBITS - 1))
28 #define FIX(x) ((int) ((x) * (1 << SCALEBITS) + 0.5))
30 #define err_if(expr) do { \
32 fprintf(stderr, "%s\n", strerror(errno)); \
38 unsigned char *
cr,
const unsigned char *
src,
41 int wrap, wrap3, x, y;
42 int r,
g,
b, r1, g1,
b1;
43 const unsigned char *p;
48 for (y = 0; y <
height; y += 2) {
49 for (x = 0; x <
width; x += 2) {
86 cb[0] = ((-
FIX(0.16874) * r1 -
FIX(0.33126) * g1 +
88 cr[0] = ((
FIX(0.50000) * r1 -
FIX(0.41869) * g1 -
102 #define DEFAULT_WIDTH 352
103 #define DEFAULT_HEIGHT 288
104 #define DEFAULT_NB_PICT 50
111 unsigned char *
cb, *
cr;
112 unsigned char *lum_tab, *cb_tab, *cr_tab;
114 lum_tab = malloc(
w *
h);
115 cb_tab = malloc(
w *
h / 4);
116 cr_tab = malloc(
w *
h / 4);
121 f = fopen(filename,
"wb");
122 fprintf(
f,
"P5\n%d %d\n%d\n",
w,
h * 3 / 2, 255);
134 for (
i = 0;
i < h2;
i++) {
142 for (
i = 0;
i < h2;
i++) {
146 for (
i = 0;
i < h2;
i++) {
164 if (x < 0 || x >=
width ||
static double cb(void *priv, double x, double y)
static unsigned char * rgb_tab
static void put_pixel(int x, int y, int r, int g, int b)
static double b1(void *priv, double x, double y)
static void pgmyuv_save(const char *filename, int w, int h, const unsigned char *rgb_tab)
#define i(width, name, range_min, range_max)
static double lum(void *priv, double x, double y, int plane)
static double cr(void *priv, double x, double y)
static void rgb24_to_yuv420p(unsigned char *lum, unsigned char *cb, unsigned char *cr, const unsigned char *src, int width, int height)