|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef __FILEQUANTELP_H__
|
|
Toshihiro Shimizu |
890ddd |
#define __FILEQUANTELP_H__
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "filequantel.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#define QNT_PAL_FILE_SIZE 829440
|
|
Toshihiro Shimizu |
890ddd |
#define QNT_PAL_W_FILE_SIZE 855360
|
|
Toshihiro Shimizu |
890ddd |
#define QTL_NTSC_FILE_SIZE 699840
|
|
Toshihiro Shimizu |
890ddd |
#define QTL_NTSC_W_FILE_SIZE 728640
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#define QUANTEL_XSIZE 720
|
|
Toshihiro Shimizu |
890ddd |
#define QNT_PAL_XSIZE QUANTEL_XSIZE
|
|
Toshihiro Shimizu |
890ddd |
#define QNT_PAL_YSIZE 576
|
|
Toshihiro Shimizu |
890ddd |
#define QTL_NTSC_XSIZE QUANTEL_XSIZE
|
|
Toshihiro Shimizu |
890ddd |
#define QTL_NTSC_YSIZE 486
|
|
Toshihiro Shimizu |
890ddd |
#define BYTESPERROW (QUANTEL_XSIZE * sizeof(short))
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#define CHECK_END_OF_FILE(car) \
|
|
Shinya Kitaoka |
120a6e |
{ \
|
|
Shinya Kitaoka |
120a6e |
if ((car) == EOF) { \
|
|
Shinya Kitaoka |
120a6e |
printf("read error: EOF encountered\n"); \
|
|
Shinya Kitaoka |
120a6e |
exit = 1; \
|
|
Shinya Kitaoka |
120a6e |
break; \
|
|
Shinya Kitaoka |
120a6e |
} \
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#define QUANTEL_GET_YUV_LINE(file_ptr, buf, xsize) \
|
|
Shinya Kitaoka |
120a6e |
{ \
|
|
Shinya Kitaoka |
120a6e |
int pixel; \
|
|
Shinya Kitaoka |
120a6e |
TINT32 r, g, b, y1, y2, u, v; \
|
|
Shinya Kitaoka |
120a6e |
\
|
|
Shinya Kitaoka |
120a6e |
for (pixel = ((xsize) >> 1); pixel--;) { \
|
|
Shinya Kitaoka |
120a6e |
u = fgetc(file_ptr); \
|
|
Shinya Kitaoka |
120a6e |
CHECK_END_OF_FILE(u) \
|
|
Shinya Kitaoka |
120a6e |
u -= 128; \
|
|
Shinya Kitaoka |
120a6e |
y1 = fgetc(file_ptr); \
|
|
Shinya Kitaoka |
120a6e |
CHECK_END_OF_FILE(y1) \
|
|
Shinya Kitaoka |
120a6e |
y1 -= 16; \
|
|
Shinya Kitaoka |
120a6e |
\
|
|
Shinya Kitaoka |
120a6e |
if (y1 < 0) y1 = 0; \
|
|
Shinya Kitaoka |
120a6e |
\
|
|
Shinya Kitaoka |
120a6e |
v = fgetc(file_ptr); \
|
|
Shinya Kitaoka |
120a6e |
CHECK_END_OF_FILE(v) \
|
|
Shinya Kitaoka |
120a6e |
v -= 128; \
|
|
Shinya Kitaoka |
120a6e |
y2 = fgetc(file_ptr); \
|
|
Shinya Kitaoka |
120a6e |
CHECK_END_OF_FILE(y2) \
|
|
Shinya Kitaoka |
120a6e |
y2 -= 16; \
|
|
Shinya Kitaoka |
120a6e |
\
|
|
Shinya Kitaoka |
120a6e |
if (y2 < 0) y2 = 0; \
|
|
Shinya Kitaoka |
120a6e |
\
|
|
Shinya Kitaoka |
120a6e |
r = 76310 * y1 + 104635 * v; \
|
|
Shinya Kitaoka |
120a6e |
if (r > 0xFFFFFF) r = 0xFFFFFF; \
|
|
Shinya Kitaoka |
120a6e |
if (r <= 0xFFFF) r = 0; \
|
|
Shinya Kitaoka |
120a6e |
\
|
|
Shinya Kitaoka |
120a6e |
g = 76310 * y1 + -25690 * u + -53294 * v; \
|
|
Shinya Kitaoka |
120a6e |
if (g > 0xFFFFFF) g = 0xFFFFFF; \
|
|
Shinya Kitaoka |
120a6e |
if (g <= 0xFFFF) g = 0; \
|
|
Shinya Kitaoka |
120a6e |
\
|
|
Shinya Kitaoka |
120a6e |
b = 76310 * y1 + 132278 * u; \
|
|
Shinya Kitaoka |
120a6e |
if (b > 0xFFFFFF) b = 0xFFFFFF; \
|
|
Shinya Kitaoka |
120a6e |
if (b <= 0xFFFF) b = 0; \
|
|
Shinya Kitaoka |
120a6e |
\
|
|
Shinya Kitaoka |
120a6e |
buf->r = (UCHAR)(r >> 16); \
|
|
Shinya Kitaoka |
120a6e |
buf->g = (UCHAR)(g >> 16); \
|
|
Shinya Kitaoka |
120a6e |
buf->b = (UCHAR)(b >> 16); \
|
|
Shinya Kitaoka |
120a6e |
buf->m = (UCHAR)255; \
|
|
Shinya Kitaoka |
120a6e |
buf++; \
|
|
Shinya Kitaoka |
120a6e |
\
|
|
Shinya Kitaoka |
120a6e |
r = 76310 * y2 + 104635 * v; \
|
|
Shinya Kitaoka |
120a6e |
if (r > 0xFFFFFF) r = 0xFFFFFF; \
|
|
Shinya Kitaoka |
120a6e |
if (r <= 0xFFFF) r = 0; \
|
|
Shinya Kitaoka |
120a6e |
\
|
|
Shinya Kitaoka |
120a6e |
g = 76310 * y2 + -25690 * u + -53294 * v; \
|
|
Shinya Kitaoka |
120a6e |
if (g > 0xFFFFFF) g = 0xFFFFFF; \
|
|
Shinya Kitaoka |
120a6e |
if (g <= 0xFFFF) g = 0; \
|
|
Shinya Kitaoka |
120a6e |
\
|
|
Shinya Kitaoka |
120a6e |
b = 76310 * y2 + 132278 * u; \
|
|
Shinya Kitaoka |
120a6e |
if (b > 0xFFFFFF) b = 0xFFFFFF; \
|
|
Shinya Kitaoka |
120a6e |
if (b <= 0xFFFF) b = 0; \
|
|
Shinya Kitaoka |
120a6e |
\
|
|
Shinya Kitaoka |
120a6e |
buf->r = (UCHAR)(r >> 16); \
|
|
Shinya Kitaoka |
120a6e |
buf->g = (UCHAR)(g >> 16); \
|
|
Shinya Kitaoka |
120a6e |
buf->b = (UCHAR)(b >> 16); \
|
|
Shinya Kitaoka |
120a6e |
buf->m = (UCHAR)255; \
|
|
Shinya Kitaoka |
120a6e |
buf++; \
|
|
Shinya Kitaoka |
120a6e |
} \
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#define QUANTEL_FILL_LINE_OF_BLACK(rbuf, gbuf, bbuf, size) \
|
|
Shinya Kitaoka |
120a6e |
{ \
|
|
Shinya Kitaoka |
120a6e |
memset(rbuf, 0, (size_t)(size * sizeof(USHORT))); \
|
|
Shinya Kitaoka |
120a6e |
memset(gbuf, 0, (size_t)(size * sizeof(USHORT))); \
|
|
Shinya Kitaoka |
120a6e |
memset(bbuf, 0, (size_t)(size * sizeof(USHORT))); \
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#define QUANTEL_FILL_LINE_OF_RGB(xmarg, xsize, rbuf, gbuf, bbuf, RGBbuf) \
|
|
Shinya Kitaoka |
120a6e |
{ \
|
|
Shinya Kitaoka |
120a6e |
int i; \
|
|
Shinya Kitaoka |
120a6e |
QUANTEL_FILL_LINE_OF_BLACK(rbuf, gbuf, bbuf, xmarg) \
|
|
Shinya Kitaoka |
120a6e |
for (i = xmarg; i < xsize + xmarg; i++) { \
|
|
Shinya Kitaoka |
120a6e |
rbuf[i] = (USHORT)RGBbuf->r; \
|
|
Shinya Kitaoka |
120a6e |
gbuf[i] = (USHORT)RGBbuf->g; \
|
|
Shinya Kitaoka |
120a6e |
bbuf[i] = (USHORT)RGBbuf->b; \
|
|
Shinya Kitaoka |
120a6e |
RGBbuf++; \
|
|
Shinya Kitaoka |
120a6e |
} \
|
|
Shinya Kitaoka |
120a6e |
QUANTEL_FILL_LINE_OF_BLACK(rbuf + i, gbuf + i, bbuf + i, xmarg) \
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#define QUANTEL_FILL_LINE_OF_RGB2(xmarg, rbuf, gbuf, bbuf, RGBbuf) \
|
|
Shinya Kitaoka |
120a6e |
{ \
|
|
Shinya Kitaoka |
120a6e |
int i; \
|
|
Shinya Kitaoka |
120a6e |
QUANTEL_FILL_LINE_OF_BLACK(rbuf, gbuf, bbuf, xmarg) \
|
|
Shinya Kitaoka |
120a6e |
for (i = xmarg; i < (QUANTEL_XSIZE - xmarg); i++) { \
|
|
Shinya Kitaoka |
120a6e |
rbuf[i] = (USHORT)RGBbuf->r; \
|
|
Shinya Kitaoka |
120a6e |
gbuf[i] = (USHORT)RGBbuf->g; \
|
|
Shinya Kitaoka |
120a6e |
bbuf[i] = (USHORT)RGBbuf->b; \
|
|
Shinya Kitaoka |
120a6e |
RGBbuf++; \
|
|
Shinya Kitaoka |
120a6e |
} \
|
|
Shinya Kitaoka |
120a6e |
QUANTEL_FILL_LINE_OF_BLACK(rbuf + i, gbuf + i, bbuf + i, xmarg) \
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#define QUANTEL_LIMIT(r, x) \
|
|
Shinya Kitaoka |
120a6e |
{ \
|
|
Shinya Kitaoka |
120a6e |
r = x; \
|
|
Shinya Kitaoka |
120a6e |
if (r > 0x00ffffff) r = 0x00ffffff; \
|
|
Shinya Kitaoka |
120a6e |
if (r <= 0x00000000) r = 0; \
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif /* __FILEQUANTELP_H__ */
|