#undef LOCAL_DEBUG
-#include "ucw/lib.h"
-#include "ucw/mempool.h"
-#include "ucw/fastbuf.h"
-#include "images/images.h"
-#include "images/error.h"
-#include "images/color.h"
-#include "images/io-main.h"
+#include <ucw/lib.h>
+#include <ucw/mempool.h>
+#include <ucw/fastbuf.h>
+#include <images/images.h>
+#include <images/error.h>
+#include <images/color.h>
+#include <images/io-main.h>
#include <stdio.h>
#include <sys/types.h>
uns read_flags = io->flags;
/* Select color space */
- switch (read_flags & IMAGE_COLOR_SPACE)
+ switch (i->cinfo.jpeg_color_space)
{
- case COLOR_SPACE_GRAYSCALE:
- i->cinfo.out_color_space = JCS_GRAYSCALE;
- break;
- case COLOR_SPACE_YCBCR:
+ case JCS_GRAYSCALE:
+ read_flags = (read_flags & ~IMAGE_COLOR_SPACE & IMAGE_CHANNELS_FORMAT) | COLOR_SPACE_YCBCR;
+ i->cinfo.out_color_space = JCS_YCbCr;
+ break;
+ case JCS_YCbCr:
+ read_flags = (read_flags & ~IMAGE_COLOR_SPACE & IMAGE_CHANNELS_FORMAT) | COLOR_SPACE_YCBCR;
i->cinfo.out_color_space = JCS_YCbCr;
break;
- case COLOR_SPACE_CMYK:
+ case JCS_CMYK:
+ read_flags = (read_flags & ~IMAGE_COLOR_SPACE & IMAGE_CHANNELS_FORMAT) | COLOR_SPACE_CMYK;
i->cinfo.out_color_space = JCS_CMYK;
break;
- case COLOR_SPACE_YCCK:
+ case JCS_YCCK:
+ read_flags = (read_flags & ~IMAGE_COLOR_SPACE & IMAGE_CHANNELS_FORMAT) | COLOR_SPACE_YCCK;
i->cinfo.out_color_space = JCS_YCCK;
break;
default:
- switch (i->cinfo.jpeg_color_space)
- {
- case JCS_CMYK:
- read_flags = (read_flags & ~IMAGE_COLOR_SPACE & IMAGE_CHANNELS_FORMAT) | COLOR_SPACE_CMYK;
- i->cinfo.out_color_space = JCS_CMYK;
- break;
- case JCS_YCCK:
- read_flags = (read_flags & ~IMAGE_COLOR_SPACE & IMAGE_CHANNELS_FORMAT) | COLOR_SPACE_YCCK;
- i->cinfo.out_color_space = JCS_YCCK;
- break;
- default:
- read_flags = (read_flags & ~IMAGE_COLOR_SPACE & IMAGE_CHANNELS_FORMAT) | COLOR_SPACE_RGB;
- i->cinfo.out_color_space = JCS_RGB;
- break;
- }
+ read_flags = (read_flags & ~IMAGE_COLOR_SPACE & IMAGE_CHANNELS_FORMAT) | COLOR_SPACE_RGB;
+ i->cinfo.out_color_space = JCS_RGB;
break;
- }
+ }
/* Prepare the image */
struct image_io_read_data_internals rdi;
# define IMAGE_WALK_COL_STEP 2
# define IMAGE_WALK_DO_ROW_START do{ src = buf; jpeg_read_scanlines(&i->cinfo, (JSAMPLE **)&src, 1); }while(0)
# define IMAGE_WALK_DO_STEP do{ walk_pos[0] = *src++; walk_pos[1] = 255; }while(0)
-# include "images/image-walk.h"
+# include <images/image-walk.h>
}
break;
case 4: /* * -> *+Alpha or aligned * */
# define IMAGE_WALK_COL_STEP 4
# define IMAGE_WALK_DO_ROW_START do{ src = buf; jpeg_read_scanlines(&i->cinfo, (JSAMPLE **)&src, 1); }while(0)
# define IMAGE_WALK_DO_STEP do{ *(u32 *)walk_pos = *(u32 *)src; walk_pos[3] = 255; src += 3; }while(0)
-# include "images/image-walk.h"
+# include <images/image-walk.h>
}
break;
default:
# define IMAGE_WALK_COL_STEP 2
# define IMAGE_WALK_DO_ROW_END do{ dest = buf; jpeg_write_scanlines(&i.cinfo, (JSAMPLE **)&dest, 1); }while(0)
# define IMAGE_WALK_DO_STEP do{ *dest++ = walk_pos[0]; }while(0)
-# include "images/image-walk.h"
+# include <images/image-walk.h>
break;
}
case 4: /* *+Alpha or aligned * -> * */
# define IMAGE_WALK_COL_STEP 4
# define IMAGE_WALK_DO_ROW_END do{ dest = buf; jpeg_write_scanlines(&i.cinfo, (JSAMPLE **)&dest, 1); }while(0)
# define IMAGE_WALK_DO_STEP do{ *dest++ = walk_pos[0]; *dest++ = walk_pos[1]; *dest++ = walk_pos[2]; }while(0)
-# include "images/image-walk.h"
+# include <images/image-walk.h>
break;
}
default: