Lines Matching refs:vdebayer

35 	void (*set_rgb_src)(struct vimc_debayer_device *vdebayer,
156 struct vimc_debayer_device *vdebayer = v4l2_get_subdevdata(sd); in vimc_debayer_init_cfg() local
166 mf->code = vdebayer->src_code; in vimc_debayer_init_cfg()
220 struct vimc_debayer_device *vdebayer = v4l2_get_subdevdata(sd); in vimc_debayer_get_fmt() local
225 vdebayer->sink_fmt; in vimc_debayer_get_fmt()
229 fmt->format.code = vdebayer->src_code; in vimc_debayer_get_fmt()
258 struct vimc_debayer_device *vdebayer = v4l2_get_subdevdata(sd); in vimc_debayer_set_fmt() local
264 if (vdebayer->src_frame) in vimc_debayer_set_fmt()
267 sink_fmt = &vdebayer->sink_fmt; in vimc_debayer_set_fmt()
268 src_code = &vdebayer->src_code; in vimc_debayer_set_fmt()
291 dev_dbg(vdebayer->ved.dev, "%s: sink format update: " in vimc_debayer_set_fmt()
293 "new:%dx%d (0x%x, %d, %d, %d, %d)\n", vdebayer->sd.name, in vimc_debayer_set_fmt()
317 static void vimc_debayer_process_rgb_frame(struct vimc_debayer_device *vdebayer, in vimc_debayer_process_rgb_frame() argument
325 vpix = vimc_pix_map_by_code(vdebayer->src_code); in vimc_debayer_process_rgb_frame()
326 index = VIMC_FRAME_INDEX(lin, col, vdebayer->sink_fmt.width, 3); in vimc_debayer_process_rgb_frame()
330 vdebayer->src_frame[index + i] = rgb[i]; in vimc_debayer_process_rgb_frame()
333 vdebayer->src_frame[index + i] = rgb[2 - i]; in vimc_debayer_process_rgb_frame()
341 struct vimc_debayer_device *vdebayer = v4l2_get_subdevdata(sd); in vimc_debayer_s_stream() local
347 if (vdebayer->src_frame) in vimc_debayer_s_stream()
351 vpix = vimc_pix_map_by_code(vdebayer->src_code); in vimc_debayer_s_stream()
352 frame_size = vdebayer->sink_fmt.width * vdebayer->sink_fmt.height * in vimc_debayer_s_stream()
356 vpix = vimc_pix_map_by_code(vdebayer->sink_fmt.code); in vimc_debayer_s_stream()
357 vdebayer->sink_bpp = vpix->bpp; in vimc_debayer_s_stream()
360 vdebayer->sink_pix_map = in vimc_debayer_s_stream()
361 vimc_debayer_pix_map_by_code(vdebayer->sink_fmt.code); in vimc_debayer_s_stream()
367 vdebayer->src_frame = vmalloc(frame_size); in vimc_debayer_s_stream()
368 if (!vdebayer->src_frame) in vimc_debayer_s_stream()
372 if (!vdebayer->src_frame) in vimc_debayer_s_stream()
375 vfree(vdebayer->src_frame); in vimc_debayer_s_stream()
376 vdebayer->src_frame = NULL; in vimc_debayer_s_stream()
410 static void vimc_debayer_calc_rgb_sink(struct vimc_debayer_device *vdebayer, in vimc_debayer_calc_rgb_sink() argument
427 seek = vdebayer->mean_win_size / 2; in vimc_debayer_calc_rgb_sink()
431 dev_dbg(vdebayer->ved.dev, in vimc_debayer_calc_rgb_sink()
433 vdebayer->sd.name, lin, col, vdebayer->sink_fmt.height, seek); in vimc_debayer_calc_rgb_sink()
442 wlin < lin + seek + 1 && wlin < vdebayer->sink_fmt.height; in vimc_debayer_calc_rgb_sink()
452 wcol < col + seek + 1 && wcol < vdebayer->sink_fmt.width; in vimc_debayer_calc_rgb_sink()
458 color = vdebayer->sink_pix_map->order[wlin % 2][wcol % 2]; in vimc_debayer_calc_rgb_sink()
461 vdebayer->sink_fmt.width, in vimc_debayer_calc_rgb_sink()
462 vdebayer->sink_bpp); in vimc_debayer_calc_rgb_sink()
464 dev_dbg(vdebayer->ved.dev, in vimc_debayer_calc_rgb_sink()
466 vdebayer->sd.name, index, wlin, wcol, color); in vimc_debayer_calc_rgb_sink()
471 vdebayer->sink_bpp); in vimc_debayer_calc_rgb_sink()
476 dev_dbg(vdebayer->ved.dev, "deb: %s: RGB CALC: val %d, n %d\n", in vimc_debayer_calc_rgb_sink()
477 vdebayer->sd.name, rgb[color], n_rgb[color]); 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], n_rgb[i]); in vimc_debayer_calc_rgb_sink()
490 dev_dbg(vdebayer->ved.dev, in vimc_debayer_calc_rgb_sink()
492 vdebayer->sd.name, lin, col, i, rgb[i]); in vimc_debayer_calc_rgb_sink()
499 struct vimc_debayer_device *vdebayer = in vimc_debayer_process_frame() local
506 if (!vdebayer->src_frame) in vimc_debayer_process_frame()
509 for (i = 0; i < vdebayer->sink_fmt.height; i++) in vimc_debayer_process_frame()
510 for (j = 0; j < vdebayer->sink_fmt.width; j++) { in vimc_debayer_process_frame()
511 vimc_debayer_calc_rgb_sink(vdebayer, sink_frame, i, j, rgb); in vimc_debayer_process_frame()
512 vdebayer->set_rgb_src(vdebayer, i, j, rgb); in vimc_debayer_process_frame()
515 return vdebayer->src_frame; in vimc_debayer_process_frame()
520 struct vimc_debayer_device *vdebayer = in vimc_debayer_s_ctrl() local
525 vdebayer->mean_win_size = ctrl->val; in vimc_debayer_s_ctrl()
539 struct vimc_debayer_device *vdebayer = in vimc_debayer_release() local
542 v4l2_ctrl_handler_free(&vdebayer->hdl); in vimc_debayer_release()
543 media_entity_cleanup(vdebayer->ved.ent); in vimc_debayer_release()
544 kfree(vdebayer); in vimc_debayer_release()
569 struct vimc_debayer_device *vdebayer; in vimc_debayer_add() local
573 vdebayer = kzalloc(sizeof(*vdebayer), GFP_KERNEL); in vimc_debayer_add()
574 if (!vdebayer) in vimc_debayer_add()
578 v4l2_ctrl_handler_init(&vdebayer->hdl, 2); in vimc_debayer_add()
579 v4l2_ctrl_new_custom(&vdebayer->hdl, &vimc_debayer_ctrl_class, NULL); in vimc_debayer_add()
580 v4l2_ctrl_new_custom(&vdebayer->hdl, &vimc_debayer_ctrl_mean_win_size, NULL); in vimc_debayer_add()
581 vdebayer->sd.ctrl_handler = &vdebayer->hdl; in vimc_debayer_add()
582 if (vdebayer->hdl.error) { in vimc_debayer_add()
583 ret = vdebayer->hdl.error; in vimc_debayer_add()
588 vdebayer->pads[0].flags = MEDIA_PAD_FL_SINK; in vimc_debayer_add()
589 vdebayer->pads[1].flags = MEDIA_PAD_FL_SOURCE; in vimc_debayer_add()
591 ret = vimc_ent_sd_register(&vdebayer->ved, &vdebayer->sd, v4l2_dev, in vimc_debayer_add()
594 vdebayer->pads, &vimc_debayer_ops); in vimc_debayer_add()
598 vdebayer->ved.process_frame = vimc_debayer_process_frame; in vimc_debayer_add()
599 vdebayer->ved.dev = vimc->mdev.dev; in vimc_debayer_add()
600 vdebayer->mean_win_size = vimc_debayer_ctrl_mean_win_size.def; in vimc_debayer_add()
603 vdebayer->sink_fmt = sink_fmt_default; in vimc_debayer_add()
610 vdebayer->src_code = MEDIA_BUS_FMT_RGB888_1X24; in vimc_debayer_add()
611 vdebayer->set_rgb_src = vimc_debayer_process_rgb_frame; in vimc_debayer_add()
613 return &vdebayer->ved; in vimc_debayer_add()
616 v4l2_ctrl_handler_free(&vdebayer->hdl); in vimc_debayer_add()
618 kfree(vdebayer); in vimc_debayer_add()