Lines Matching refs:vdebayer
40 void (*set_rgb_src)(struct vimc_debayer_device *vdebayer,
246 struct vimc_debayer_device *vdebayer = v4l2_get_subdevdata(sd); in vimc_debayer_set_fmt() local
250 if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE && vdebayer->src_frame) in vimc_debayer_set_fmt()
265 dev_dbg(vdebayer->ved.dev, "%s: sink format update: " in vimc_debayer_set_fmt()
267 "new:%dx%d (0x%x, %d, %d, %d, %d)\n", vdebayer->sd.name, in vimc_debayer_set_fmt()
294 static void vimc_debayer_process_rgb_frame(struct vimc_debayer_device *vdebayer, in vimc_debayer_process_rgb_frame() argument
302 vpix = vimc_pix_map_by_code(vdebayer->hw.src_code); in vimc_debayer_process_rgb_frame()
303 index = VIMC_FRAME_INDEX(lin, col, vdebayer->hw.size.width, 3); in vimc_debayer_process_rgb_frame()
307 vdebayer->src_frame[index + i] = rgb[i]; in vimc_debayer_process_rgb_frame()
310 vdebayer->src_frame[index + i] = rgb[2 - i]; in vimc_debayer_process_rgb_frame()
318 struct vimc_debayer_device *vdebayer = v4l2_get_subdevdata(sd); in vimc_debayer_s_stream() local
327 if (vdebayer->src_frame) in vimc_debayer_s_stream()
340 vdebayer->hw.sink_bpp = vpix->bpp; in vimc_debayer_s_stream()
343 vdebayer->hw.sink_pix_map = in vimc_debayer_s_stream()
346 vdebayer->hw.size.width = sink_fmt->width; in vimc_debayer_s_stream()
347 vdebayer->hw.size.height = sink_fmt->height; in vimc_debayer_s_stream()
349 vdebayer->hw.src_code = src_fmt->code; in vimc_debayer_s_stream()
357 vdebayer->src_frame = vmalloc(frame_size); in vimc_debayer_s_stream()
358 if (!vdebayer->src_frame) in vimc_debayer_s_stream()
361 if (!vdebayer->src_frame) in vimc_debayer_s_stream()
364 vfree(vdebayer->src_frame); in vimc_debayer_s_stream()
365 vdebayer->src_frame = NULL; in vimc_debayer_s_stream()
403 static void vimc_debayer_calc_rgb_sink(struct vimc_debayer_device *vdebayer, in vimc_debayer_calc_rgb_sink() argument
420 seek = vdebayer->hw.mean_win_size / 2; in vimc_debayer_calc_rgb_sink()
424 dev_dbg(vdebayer->ved.dev, in vimc_debayer_calc_rgb_sink()
426 vdebayer->sd.name, lin, col, vdebayer->hw.size.height, seek); in vimc_debayer_calc_rgb_sink()
435 wlin < lin + seek + 1 && wlin < vdebayer->hw.size.height; in vimc_debayer_calc_rgb_sink()
445 wcol < col + seek + 1 && wcol < vdebayer->hw.size.width; in vimc_debayer_calc_rgb_sink()
451 color = vdebayer->hw.sink_pix_map->order[wlin % 2][wcol % 2]; in vimc_debayer_calc_rgb_sink()
454 vdebayer->hw.size.width, in vimc_debayer_calc_rgb_sink()
455 vdebayer->hw.sink_bpp); in vimc_debayer_calc_rgb_sink()
457 dev_dbg(vdebayer->ved.dev, in vimc_debayer_calc_rgb_sink()
459 vdebayer->sd.name, index, wlin, wcol, color); in vimc_debayer_calc_rgb_sink()
464 vdebayer->hw.sink_bpp); in vimc_debayer_calc_rgb_sink()
469 dev_dbg(vdebayer->ved.dev, "deb: %s: RGB CALC: val %d, n %d\n", in vimc_debayer_calc_rgb_sink()
470 vdebayer->sd.name, rgb[color], n_rgb[color]); in vimc_debayer_calc_rgb_sink()
476 dev_dbg(vdebayer->ved.dev, in vimc_debayer_calc_rgb_sink()
478 vdebayer->sd.name, lin, col, i, rgb[i], n_rgb[i]); in vimc_debayer_calc_rgb_sink()
483 dev_dbg(vdebayer->ved.dev, in vimc_debayer_calc_rgb_sink()
485 vdebayer->sd.name, lin, col, i, rgb[i]); in vimc_debayer_calc_rgb_sink()
492 struct vimc_debayer_device *vdebayer = in vimc_debayer_process_frame() local
499 if (!vdebayer->src_frame) in vimc_debayer_process_frame()
502 for (i = 0; i < vdebayer->hw.size.height; i++) in vimc_debayer_process_frame()
503 for (j = 0; j < vdebayer->hw.size.width; j++) { in vimc_debayer_process_frame()
504 vimc_debayer_calc_rgb_sink(vdebayer, sink_frame, i, j, rgb); in vimc_debayer_process_frame()
505 vdebayer->set_rgb_src(vdebayer, i, j, rgb); in vimc_debayer_process_frame()
508 return vdebayer->src_frame; in vimc_debayer_process_frame()
513 struct vimc_debayer_device *vdebayer = in vimc_debayer_s_ctrl() local
518 vdebayer->hw.mean_win_size = ctrl->val; in vimc_debayer_s_ctrl()
532 struct vimc_debayer_device *vdebayer = in vimc_debayer_release() local
535 v4l2_ctrl_handler_free(&vdebayer->hdl); in vimc_debayer_release()
536 v4l2_subdev_cleanup(&vdebayer->sd); in vimc_debayer_release()
537 media_entity_cleanup(vdebayer->ved.ent); in vimc_debayer_release()
538 kfree(vdebayer); in vimc_debayer_release()
563 struct vimc_debayer_device *vdebayer; in vimc_debayer_add() local
567 vdebayer = kzalloc(sizeof(*vdebayer), GFP_KERNEL); in vimc_debayer_add()
568 if (!vdebayer) in vimc_debayer_add()
572 v4l2_ctrl_handler_init(&vdebayer->hdl, 2); in vimc_debayer_add()
573 v4l2_ctrl_new_custom(&vdebayer->hdl, &vimc_debayer_ctrl_class, NULL); in vimc_debayer_add()
574 v4l2_ctrl_new_custom(&vdebayer->hdl, &vimc_debayer_ctrl_mean_win_size, NULL); in vimc_debayer_add()
575 vdebayer->sd.ctrl_handler = &vdebayer->hdl; in vimc_debayer_add()
576 if (vdebayer->hdl.error) { in vimc_debayer_add()
577 ret = vdebayer->hdl.error; in vimc_debayer_add()
582 vdebayer->pads[0].flags = MEDIA_PAD_FL_SINK; in vimc_debayer_add()
583 vdebayer->pads[1].flags = MEDIA_PAD_FL_SOURCE; in vimc_debayer_add()
585 ret = vimc_ent_sd_register(&vdebayer->ved, &vdebayer->sd, v4l2_dev, in vimc_debayer_add()
588 vdebayer->pads, &vimc_debayer_internal_ops, in vimc_debayer_add()
593 vdebayer->ved.process_frame = vimc_debayer_process_frame; in vimc_debayer_add()
594 vdebayer->ved.dev = vimc->mdev.dev; in vimc_debayer_add()
595 vdebayer->hw.mean_win_size = vimc_debayer_ctrl_mean_win_size.def; in vimc_debayer_add()
597 vdebayer->set_rgb_src = vimc_debayer_process_rgb_frame; in vimc_debayer_add()
599 return &vdebayer->ved; in vimc_debayer_add()
602 v4l2_ctrl_handler_free(&vdebayer->hdl); in vimc_debayer_add()
604 kfree(vdebayer); in vimc_debayer_add()