lib: Remove num_stripes from fpi_assemble_frames()
This commit is contained in:
parent
22a252c57e
commit
e2f06e8f1e
7 changed files with 16 additions and 34 deletions
|
@ -612,7 +612,7 @@ static void capture_read_strip_cb(struct libusb_transfer *transfer)
|
||||||
aes_write_regv(dev, capture_stop, G_N_ELEMENTS(capture_stop), stub_capture_stop_cb, NULL);
|
aes_write_regv(dev, capture_stop, G_N_ELEMENTS(capture_stop), stub_capture_stop_cb, NULL);
|
||||||
aesdev->strips = g_slist_reverse(aesdev->strips);
|
aesdev->strips = g_slist_reverse(aesdev->strips);
|
||||||
fpi_do_movement_estimation(&assembling_ctx, aesdev->strips);
|
fpi_do_movement_estimation(&assembling_ctx, aesdev->strips);
|
||||||
img = fpi_assemble_frames(&assembling_ctx, aesdev->strips, aesdev->strips_len);
|
img = fpi_assemble_frames(&assembling_ctx, aesdev->strips);
|
||||||
img->flags |= FP_IMG_PARTIAL;
|
img->flags |= FP_IMG_PARTIAL;
|
||||||
g_slist_free_full(aesdev->strips, g_free);
|
g_slist_free_full(aesdev->strips, g_free);
|
||||||
aesdev->strips = NULL;
|
aesdev->strips = NULL;
|
||||||
|
|
|
@ -483,8 +483,7 @@ static void capture_read_strip_cb(struct libusb_transfer *transfer,
|
||||||
|
|
||||||
aesdev->strips = g_slist_reverse(aesdev->strips);
|
aesdev->strips = g_slist_reverse(aesdev->strips);
|
||||||
fpi_do_movement_estimation(&assembling_ctx, aesdev->strips);
|
fpi_do_movement_estimation(&assembling_ctx, aesdev->strips);
|
||||||
img = fpi_assemble_frames(&assembling_ctx,
|
img = fpi_assemble_frames(&assembling_ctx, aesdev->strips);
|
||||||
aesdev->strips, aesdev->strips_len);
|
|
||||||
img->flags |= FP_IMG_PARTIAL;
|
img->flags |= FP_IMG_PARTIAL;
|
||||||
g_slist_free_full(aesdev->strips, g_free);
|
g_slist_free_full(aesdev->strips, g_free);
|
||||||
aesdev->strips = NULL;
|
aesdev->strips = NULL;
|
||||||
|
|
|
@ -244,8 +244,7 @@ static void capture_set_idle_reqs_cb(struct libusb_transfer *transfer)
|
||||||
struct fp_img *img;
|
struct fp_img *img;
|
||||||
|
|
||||||
aesdev->strips = g_slist_reverse(aesdev->strips);
|
aesdev->strips = g_slist_reverse(aesdev->strips);
|
||||||
img = fpi_assemble_frames(&assembling_ctx,
|
img = fpi_assemble_frames(&assembling_ctx, aesdev->strips);
|
||||||
aesdev->strips, aesdev->strips_len);
|
|
||||||
img->flags |= FP_IMG_PARTIAL;
|
img->flags |= FP_IMG_PARTIAL;
|
||||||
g_slist_free_full(aesdev->strips, g_free);
|
g_slist_free_full(aesdev->strips, g_free);
|
||||||
aesdev->strips = NULL;
|
aesdev->strips = NULL;
|
||||||
|
|
|
@ -305,7 +305,7 @@ static void capture_set_idle_cmd_cb(struct libusb_transfer *transfer)
|
||||||
struct fp_img *img;
|
struct fp_img *img;
|
||||||
|
|
||||||
aesdev->strips = g_slist_reverse(aesdev->strips);
|
aesdev->strips = g_slist_reverse(aesdev->strips);
|
||||||
img = fpi_assemble_frames(aesdev->assembling_ctx, aesdev->strips, aesdev->strips_len);
|
img = fpi_assemble_frames(aesdev->assembling_ctx, aesdev->strips);
|
||||||
img->flags |= aesdev->extra_img_flags;
|
img->flags |= aesdev->extra_img_flags;
|
||||||
g_slist_foreach(aesdev->strips, (GFunc) g_free, NULL);
|
g_slist_foreach(aesdev->strips, (GFunc) g_free, NULL);
|
||||||
g_slist_free(aesdev->strips);
|
g_slist_free(aesdev->strips);
|
||||||
|
|
|
@ -308,7 +308,7 @@ static void elan_submit_image(struct fp_img_dev *dev)
|
||||||
assembling_ctx.image_width = elandev->frame_width * 3 / 2;
|
assembling_ctx.image_width = elandev->frame_width * 3 / 2;
|
||||||
g_slist_foreach(raw_frames, (GFunc) elandev->process_frame, &frames);
|
g_slist_foreach(raw_frames, (GFunc) elandev->process_frame, &frames);
|
||||||
fpi_do_movement_estimation(&assembling_ctx, frames);
|
fpi_do_movement_estimation(&assembling_ctx, frames);
|
||||||
img = fpi_assemble_frames(&assembling_ctx, frames, num_frames);
|
img = fpi_assemble_frames(&assembling_ctx, frames);
|
||||||
|
|
||||||
img->flags |= FP_IMG_PARTIAL;
|
img->flags |= FP_IMG_PARTIAL;
|
||||||
fpi_imgdev_image_captured(dev, img);
|
fpi_imgdev_image_captured(dev, img);
|
||||||
|
|
|
@ -248,45 +248,34 @@ static inline void aes_blit_stripe(struct fpi_frame_asmbl_ctx *ctx,
|
||||||
* fpi_assemble_frames:
|
* fpi_assemble_frames:
|
||||||
* @ctx: #fpi_frame_asmbl_ctx - frame assembling context
|
* @ctx: #fpi_frame_asmbl_ctx - frame assembling context
|
||||||
* @stripes: linked list of #fpi_frame
|
* @stripes: linked list of #fpi_frame
|
||||||
* @num_stripes: number of items in @stripes to process
|
|
||||||
*
|
*
|
||||||
* fpi_assemble_frames() assembles individual frames into a single image.
|
* fpi_assemble_frames() assembles individual frames into a single image.
|
||||||
* It expects @delta_x and @delta_y of #fpi_frame to be populated.
|
* It expects @delta_x and @delta_y of #fpi_frame to be populated.
|
||||||
*
|
*
|
||||||
* Note that @num_stripes might be shorter than the length of the list,
|
|
||||||
* if some stripes should be skipped.
|
|
||||||
*
|
|
||||||
* Returns: a newly allocated #fp_img.
|
* Returns: a newly allocated #fp_img.
|
||||||
*/
|
*/
|
||||||
struct fp_img *fpi_assemble_frames(struct fpi_frame_asmbl_ctx *ctx,
|
struct fp_img *fpi_assemble_frames(struct fpi_frame_asmbl_ctx *ctx,
|
||||||
GSList *stripes, size_t num_stripes)
|
GSList *stripes)
|
||||||
{
|
{
|
||||||
GSList *stripe;
|
GSList *l;
|
||||||
struct fp_img *img;
|
struct fp_img *img;
|
||||||
int height = 0;
|
int height = 0;
|
||||||
int i, y, x;
|
int y, x;
|
||||||
gboolean reverse = FALSE;
|
gboolean reverse = FALSE;
|
||||||
struct fpi_frame *fpi_frame;
|
struct fpi_frame *fpi_frame;
|
||||||
|
|
||||||
//FIXME g_return_if_fail
|
//FIXME g_return_if_fail
|
||||||
BUG_ON(num_stripes == 0);
|
|
||||||
BUG_ON(ctx->image_width < ctx->frame_width);
|
BUG_ON(ctx->image_width < ctx->frame_width);
|
||||||
|
|
||||||
/* Calculate height */
|
|
||||||
i = 0;
|
|
||||||
stripe = stripes;
|
|
||||||
|
|
||||||
/* No offset for 1st image */
|
/* No offset for 1st image */
|
||||||
fpi_frame = stripe->data;
|
fpi_frame = stripes->data;
|
||||||
fpi_frame->delta_x = 0;
|
fpi_frame->delta_x = 0;
|
||||||
fpi_frame->delta_y = 0;
|
fpi_frame->delta_y = 0;
|
||||||
do {
|
for (l = stripes; l != NULL; l = l->next) {
|
||||||
fpi_frame = stripe->data;
|
fpi_frame = l->data;
|
||||||
|
|
||||||
height += fpi_frame->delta_y;
|
height += fpi_frame->delta_y;
|
||||||
i++;
|
}
|
||||||
stripe = g_slist_next(stripe);
|
|
||||||
} while (i < num_stripes);
|
|
||||||
|
|
||||||
fp_dbg("height is %d", height);
|
fp_dbg("height is %d", height);
|
||||||
|
|
||||||
|
@ -306,13 +295,11 @@ struct fp_img *fpi_assemble_frames(struct fpi_frame_asmbl_ctx *ctx,
|
||||||
img->height = height;
|
img->height = height;
|
||||||
|
|
||||||
/* Assemble stripes */
|
/* Assemble stripes */
|
||||||
i = 0;
|
|
||||||
stripe = stripes;
|
|
||||||
y = reverse ? (height - ctx->frame_height) : 0;
|
y = reverse ? (height - ctx->frame_height) : 0;
|
||||||
x = (ctx->image_width - ctx->frame_width) / 2;
|
x = (ctx->image_width - ctx->frame_width) / 2;
|
||||||
|
|
||||||
do {
|
for (l = stripes; l != NULL; l = l->next) {
|
||||||
fpi_frame = stripe->data;
|
fpi_frame = l->data;
|
||||||
|
|
||||||
if(reverse) {
|
if(reverse) {
|
||||||
y += fpi_frame->delta_y;
|
y += fpi_frame->delta_y;
|
||||||
|
@ -325,10 +312,7 @@ struct fp_img *fpi_assemble_frames(struct fpi_frame_asmbl_ctx *ctx,
|
||||||
y += fpi_frame->delta_y;
|
y += fpi_frame->delta_y;
|
||||||
x += fpi_frame->delta_x;
|
x += fpi_frame->delta_x;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
stripe = g_slist_next(stripe);
|
|
||||||
i++;
|
|
||||||
} while (i < num_stripes);
|
|
||||||
|
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ void fpi_do_movement_estimation(struct fpi_frame_asmbl_ctx *ctx,
|
||||||
GSList *stripes);
|
GSList *stripes);
|
||||||
|
|
||||||
struct fp_img *fpi_assemble_frames(struct fpi_frame_asmbl_ctx *ctx,
|
struct fp_img *fpi_assemble_frames(struct fpi_frame_asmbl_ctx *ctx,
|
||||||
GSList *stripes, size_t num_stripes);
|
GSList *stripes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fpi_line_asmbl_ctx:
|
* fpi_line_asmbl_ctx:
|
||||||
|
|
Loading…
Reference in a new issue