convert->lines = lines;
- convert->tmpline8 = g_malloc (lines * sizeof (guint8) * (width + 8) * 4);
- convert->tmpline16 = g_malloc (lines * sizeof (guint16) * (width + 8) * 4);
+ convert->tmpline = g_malloc (lines * sizeof (guint16) * (width + 8) * 4);
convert->errline = g_malloc0 (sizeof (guint16) * width * 4);
return convert;
void
videoconvert_convert_free (VideoConvert * convert)
{
- g_free (convert->tmpline8);
- g_free (convert->tmpline16);
+ g_free (convert->tmpline);
g_free (convert->errline);
g_free (convert);
videoconvert_dither_verterr (VideoConvert * convert, guint16 * pixels, int j)
{
int i;
- guint16 *tmpline = convert->tmpline16;
+ guint16 *tmpline = convert->tmpline;
guint16 *errline = convert->errline;
unsigned int mask = 0xff;
videoconvert_dither_halftone (VideoConvert * convert, guint16 * pixels, int j)
{
int i;
- guint16 *tmpline = convert->tmpline16;
+ guint16 *tmpline = convert->tmpline;
static guint16 halftone[8][8] = {
{0, 128, 32, 160, 8, 136, 40, 168},
{192, 64, 224, 96, 200, 72, 232, 104},
lines = convert->lines;
for (j = 0; j < height; j += lines) {
- tmpline8 = convert->tmpline8;
- tmpline16 = convert->tmpline16;
+ tmpline8 = convert->tmpline;
+ tmpline16 = convert->tmpline;
for (k = 0; k < lines; k++) {
if (in_bits == 16) {
UNPACK_FRAME (src, tmpline8, j + k, width);
if (out_bits == 16)
- for (i = 0; i < width * 4; i++)
+ for (i = (width - 1) * 4; i >= 0; i--)
tmpline16[i] = TO_16 (tmpline8[i]);
}
convert->matrix16 (convert, tmpline16);
if (convert->dither16)
convert->dither16 (convert, tmpline16, j);
+ tmpline8 += width * 8;
+ tmpline16 += width * 4;
} else {
if (convert->matrix)
convert->matrix (convert, tmpline8);
+ tmpline8 += width * 4;
}
- tmpline8 += width * 4;
- tmpline16 += width * 8;
}
- tmpline8 = convert->tmpline8;
- tmpline16 = convert->tmpline16;
+ tmpline8 = convert->tmpline;
+ tmpline16 = convert->tmpline;
if (out_bits == 16) {
PACK_FRAME (dest, tmpline16, j, width);
/* now handle last line */
if (height & 1) {
- UNPACK_FRAME (src, convert->tmpline8, height - 1, width);
- PACK_FRAME (dest, convert->tmpline8, height - 1, width);
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
/* now handle last line */
if (height & 1) {
- UNPACK_FRAME (src, convert->tmpline8, height - 1, width);
- PACK_FRAME (dest, convert->tmpline8, height - 1, width);
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
/* now handle last line */
if (height & 1) {
- UNPACK_FRAME (src, convert->tmpline8, height - 1, width);
- PACK_FRAME (dest, convert->tmpline8, height - 1, width);
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
/* now handle last line */
if (height & 1) {
- UNPACK_FRAME (src, convert->tmpline8, height - 1, width);
- PACK_FRAME (dest, convert->tmpline8, height - 1, width);
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
/* now handle last line */
if (height & 1) {
- UNPACK_FRAME (src, convert->tmpline8, height - 1, width);
- PACK_FRAME (dest, convert->tmpline8, height - 1, width);
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
/* now handle last line */
if (height & 1) {
- UNPACK_FRAME (src, convert->tmpline8, height - 1, width);
- PACK_FRAME (dest, convert->tmpline8, height - 1, width);
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
/* now handle last line */
if (height & 1) {
- UNPACK_FRAME (src, convert->tmpline8, height - 1, width);
- PACK_FRAME (dest, convert->tmpline8, height - 1, width);
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
/* now handle last line */
if (height & 1) {
- UNPACK_FRAME (src, convert->tmpline8, height - 1, width);
- PACK_FRAME (dest, convert->tmpline8, height - 1, width);
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
/* now handle last line */
if (height & 1) {
- UNPACK_FRAME (src, convert->tmpline8, height - 1, width);
- PACK_FRAME (dest, convert->tmpline8, height - 1, width);
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
/* now handle last line */
if (height & 1) {
- UNPACK_FRAME (src, convert->tmpline8, height - 1, width);
- PACK_FRAME (dest, convert->tmpline8, height - 1, width);
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
/* now handle last line */
if (height & 1) {
- UNPACK_FRAME (src, convert->tmpline8, height - 1, width);
- PACK_FRAME (dest, convert->tmpline8, height - 1, width);
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}