Add libmegapixels
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
struct _MPZBarImage {
|
||||
uint8_t *data;
|
||||
MPPixelFormat pixel_format;
|
||||
int format;
|
||||
int width;
|
||||
int height;
|
||||
int rotation;
|
||||
@@ -171,15 +171,6 @@ process_image(MPPipeline *pipeline, MPZBarImage **_image)
|
||||
{
|
||||
MPZBarImage *image = *_image;
|
||||
|
||||
assert(image->pixel_format == MP_PIXEL_FMT_BGGR8 ||
|
||||
image->pixel_format == MP_PIXEL_FMT_GBRG8 ||
|
||||
image->pixel_format == MP_PIXEL_FMT_GRBG8 ||
|
||||
image->pixel_format == MP_PIXEL_FMT_RGGB8 ||
|
||||
image->pixel_format == MP_PIXEL_FMT_BGGR10P ||
|
||||
image->pixel_format == MP_PIXEL_FMT_GBRG10P ||
|
||||
image->pixel_format == MP_PIXEL_FMT_GRBG10P ||
|
||||
image->pixel_format == MP_PIXEL_FMT_RGGB10P);
|
||||
|
||||
// Create a grayscale image for scanning from the current preview.
|
||||
// Rotate/mirror correctly.
|
||||
int width = image->width / 2;
|
||||
@@ -187,11 +178,12 @@ process_image(MPPipeline *pipeline, MPZBarImage **_image)
|
||||
|
||||
uint8_t *data = malloc(width * height * sizeof(uint8_t));
|
||||
size_t row_length =
|
||||
mp_pixel_format_width_to_bytes(image->pixel_format, image->width);
|
||||
libmegapixels_mode_width_to_bytes(image->format, image->width);
|
||||
int padding_bytes =
|
||||
mp_pixel_format_width_to_padding(image->pixel_format, image->width);
|
||||
libmegapixels_mode_width_to_padding(image->format, image->width);
|
||||
size_t i = 0, padding_offset = 0;
|
||||
size_t offset;
|
||||
/* TODO: implement
|
||||
switch (image->pixel_format) {
|
||||
case MP_PIXEL_FMT_BGGR8:
|
||||
case MP_PIXEL_FMT_GBRG8:
|
||||
@@ -267,6 +259,7 @@ process_image(MPPipeline *pipeline, MPZBarImage **_image)
|
||||
mp_zbar_image_unref(image);
|
||||
|
||||
++frames_processed;
|
||||
*/
|
||||
}
|
||||
|
||||
void
|
||||
@@ -288,7 +281,7 @@ mp_zbar_pipeline_process_image(MPZBarImage *image)
|
||||
|
||||
MPZBarImage *
|
||||
mp_zbar_image_new(uint8_t *data,
|
||||
MPPixelFormat pixel_format,
|
||||
int format,
|
||||
int width,
|
||||
int height,
|
||||
int rotation,
|
||||
@@ -296,7 +289,7 @@ mp_zbar_image_new(uint8_t *data,
|
||||
{
|
||||
MPZBarImage *image = malloc(sizeof(MPZBarImage));
|
||||
image->data = data;
|
||||
image->pixel_format = pixel_format;
|
||||
image->format = format;
|
||||
image->width = width;
|
||||
image->height = height;
|
||||
image->rotation = rotation;
|
||||
|
Reference in New Issue
Block a user