V853移植rk628成功出图,但是图片颜色异常,求个排查思路
-
驱动里设置
/* * Store information about the video data format. */ static struct sensor_format_struct sensor_formats[] = { { .desc = "UYVY 4:2:2", .mbus_code = MEDIA_BUS_FMT_UYVY8_2X8, /*.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10, */ .regs = 0, .regs_size = 0, .bpp = 4, }, }; #define N_FMTS ARRAY_SIZE(sensor_formats) /* * Then there is the issue of window sizes. Try to capture the info here. */ static struct sensor_win_size sensor_win_sizes[] = { { .width = 1920, .height = 1080, .hoffset = 0, .voffset = 0, .hts = 2200, .vts = 1125, .pclk = 74250000*2, .mipi_bps = 375 * 1000 * 1000, .fps_fixed = 60, .regs = 0, .regs_size = 0, .set_size = NULL, }, };
修改了sunxi_isp.c和vin_tdm.c,增加对MEDIA_BUS_FMT_UYVY8_2X8的支持,设备树里设置 sensor0_isp_used = <0>; sensor0_fmt = <0>;
static struct tdm_format sunxi_tdm_formats[] = { { .code = MEDIA_BUS_FMT_UYVY8_2X8, .input_type = INPUTTPYE_8BIT, .input_bit_width = RAW_8BIT, .raw_fmt = BAYER_RGGB, },{ ...
static struct isp_pix_fmt sunxi_isp_formats[] = { { .fourcc = V4L2_PIX_FMT_UYVY, .mbus_code = MEDIA_BUS_FMT_UYVY8_2X8, .infmt = ISP_BGGR, .input_bit = RAW_8, },{
使用camerademo setting 抓图
root@TinaLinux:/# camerademo setting [CAMERA]********************************************************** [CAMERA]* * [CAMERA]* this is camera test. * [CAMERA]* * [CAMERA]********************************************************** [CAMERA] Please input the setting parameters according to the prompts. [CAMERA]********************************************************** [CAMERA] open /dev/video0! [CAMERA]********************************************************** [CAMERA]********************************************************** [CAMERA] Please enter the data save path: /root/pic [CAMERA] Please enter the number of captured photos: 1 [CAMERA] Please enter the data save type: [CAMERA] 0:save BMP and YUV formats [CAMERA] 1:save BMP format [CAMERA] 2:save YUV format 2 [CAMERA]************************[ 38.522814] [rk628_mipi]PWR_ON! ********************************[ 38.530221] [rk628_mipi]sensor_init ** [CAMERA] The path to data sa[ 38.536887] rk628_mipi 1-0050: RK628 I2C driver version: 00.00.08 ving is /root/pic. [CAMERA] The[ 38.545311] [rk628_mipi]do nothing rk628 init over number of captured photos is 1.[ 38.553725] [VIN]fmt yuv mask [CAMERA] save yuv format [ 38.559577] [VIN]fmt yuv mask [ 38.565431] [VIN]fmt yuv mask [ 38.568777] [VIN]fmt yuv mask [ 38.572136] [VIN]fmt yuv mask [ 38.575590] [VIN]fmt yuv mask [ 38.578934] [VIN]fmt yuv mask [ 38.582275] [VIN]no fmt yuv mask mask:0x2 vinc->support_raw:0x0 [ 38.589048] [VIN]no fmt yuv mask mask:0x2 vinc->support_raw:0x0 [ 38.595745] [VIN]no fmt yuv mask mask:0x2 vinc->support_raw:0x0 [ 38.602458] [VIN]no fmt yuv mask mask:0x2 vinc->support_raw:0x0 [ 38.609179] [VIN]no fmt yuv mask mask:0x2 vinc->support_raw:0x0 [ 38.615919] [VIN]no fmt yuv mask mask:0x2 vinc->support_raw:0x0 [ 38.622589] [VIN]no fmt yuv mask mask:0x2 vinc->support_raw:0x0 [ 38.629328] [VIN]no fmt yuv mask mask:0x2 vinc->support_raw:0x0 [ 38.636020] [VIN]no fmt yuv mask mask:0x2 vinc->support_raw:0x0 [ 38.642742] [VIN]no fmt yuv mask mask:0x2 vinc->support_raw:0x0 [ 38.649440] [VIN]no fmt yuv mask mask:0x2 vinc->support_raw:0x0 [ 38.656219] [VIN]no fmt yuv mask mask:0x2 vinc->support_raw:0x0 [ 38.662874] [VIN]fmt yuv mask [ 38.666308] [VIN]fmt yuv mask [ 38.669643] [VIN]fmt yuv mask [ 38.672999] [VIN]fmt yuv mask [ 38.676424] [VIN]fmt yuv mask [ 38.679768] [VIN]fmt yuv mask [ 38.683100] [VIN]fmt yuv mask [ 38.686521] [VIN]fmt yuv mask [ 38.689881] [VIN]fmt yuv mask [ 38.693214] [VIN]fmt yuv mask [ 38.696641] [VIN]fmt yuv mask [ 38.699984] [VIN]fmt yuv mask [CAMERA]********************************************************* [CAMERA] The sensor supports the following formats : [CAMERA] index 0 : YUV422P [CAMERA] index 1 : NV16 [CAMERA] index 2 : NV61 [CAMERA] index 3 : YUV420 [CAMERA] index 4 : YVU420 [CAMERA] index 5 : NV12 [CAMERA] index 6 : NV21 [CAMERA] index 7 : BGGR8 [CAMERA] index 8 : GBRG8 [CAMERA] index 9 : GRBG8 [CAMERA] index 10 : RGGB8 [CAMERA] index 11 : BGGR10 [CAMERA] index 12 : GBRG10 [CAMERA] index 13 : GRBG10 [CAMERA] index 14 : RGGB10 [CAMERA] index 15 : BGGR12 [CAMERA] index 16 : GBRG12 [CAMERA] index 17 : GRBG12 [CAMERA] index 18 : RGGB12 [CAMERA] index 19 : YUYV [CAMERA] index 20 : UYVY [CAMERA] index 21 : VYUY [CAMERA] index 22 : YVYU [CAMERA] index 23 : YUYV [CAMERA] index 24 : UYVY [CAMERA] index 25 : VYUY [CAMERA] index 26 : YVYU [CAMERA] index 27 : UYVY [CAMERA] index 28 : VYUY [CAMERA] index 29 : YVYU [CAMERA] index 30 : YUYV [CAMERA] Please enter the serial number you need for pixelformat: 0 [CAMERA] The input value is 0. [CAMERA] camera pixelformat: YUV422P [CAMERA]********************************************************** [CAMERA] The YUV422P supports the following resolutions: [CAMERA] Index 0 : 1920 * 1080 [CAMERA] Please enter the serial number you need for windows size: 0 [CAMERA] The input value is 0. [ 45.692968] [VIN]fmt yuv mask [CAMERA] Resolution size : 1920 [ 45.699066] [rk628_mipi]ioctl cmd:0x0 * 1080 [CAMERA] The photo save path is /root/pic. [CAMERA] The number of photos taken is 1. [CAMERA]usr cap mplane begin io[ 45.714464] [cmb_phy_set_deskew_laneck0]-[239]:sel:0, delay:2 n_alloc_open pid: 1118, g_allo[ 45.723594] [cmb_phy_set_deskew_laneck0]-[239]:sel:1, delay:7 c_context = 0xb6efcf70 [CAMERA[ 45.733361] [rk628_mipi]s_stream enable val:1 ] Camera capture framerate is 60/1 [CAMERA] VIDIOC_S_FMT succeed [CAMERA] fmt.type = 9 [CAMER[ 45.747495] rk628_mipi 1-0050: src 1920x1080 clock:148500000 A] fmt.fmt.pix_mp.width = 1920 [ 45.755089] rk628_mipi 1-0050: dst 1920x1080 clock:148500000 [CAMERA] fmt.fmt.pix_mp.height = 1080 [CAMERA] fmt.fmt.pix_mp.pixelformat = YUV422P [CAMERA] fmt.fmt.pix_mp.field = 1 [ 45.901485] rk628_mipi 1-0050: rk628_is_avi_ready PDEC_AVI_PB:0x1084a80c, avi_rcv_rdy:1 [ 45.954623] rk628_mipi 1-0050: rk628_is_avi_ready PDEC_AVI_PB:0x1084a80c, avi_rcv_rdy:1 [ 46.014629] rk628_mipi 1-0050: rk628_is_avi_ready PDEC_AVI_PB:0x1084a80c, avi_rcv_rdy:1 [ 46.074626] rk628_mipi 1-0050: rk628_is_avi_ready PDEC_AVI_PB:0x1084a80c, avi_rcv_rdy:1 [ 46.134614] rk628_mipi 1-0050: rk628_is_avi_ready PDEC_AVI_PB:0x1084a80c, avi_rcv_rdy:1 [ 46.194637] rk628_mipi 1-0050: rk628_is_avi_ready PDEC_AVI_PB:0x1084a80c, avi_rcv_rdy:1 [CAMERA] stream on succeed [CAMERA] camera0 capture num is [0] [CAMERA_PROMPT] the time interval from the start to the first frame is 28 ms [CAMERA] Capture thread finish[ 46.583099] [rk628_mipi]s_stream enable val:0 [CAMERA] close /dev/video0[ 46.594185] [rk628_mipi]PWR_OFF!do nothing ion_alloc_close pid: 1118, release g_alloc_context = 0xb6efcf70 root@TinaLinux:/#
图片格式YUV422,宽高19201080理论上大小是19201080*2=4147200字节,实际上得到的图是4177920字节,多出来啥了?
用yuvplayer看图,颜色设置YUV422,能看到图片还白加点偏移的颜色的
-
@xjy_5 成了,用19201088像素格式查看数据就行了,为什么会是19201088啊??
-
@xjy_5 一般2M摄像头都是1920*1088的,可能就按这个来处理了
-
@awwwwa 现在又开始烦了,我在sample_driverVipp里面用 V4L2_PIX_FMT_YUV422P 抓图,很顺利,不过得到的是1920x1088的图片,然后用sample_virvi抓图,怎么抓出来的图都是红红绿绿蓝蓝的,不过出来的图是1920x1080的了,理论上我应该选MM_PIXEL_FORMAT_UYVY_PACKAGE_422就对了
-
@awwwwa 通过sample_virvi抓到的图比sample_driverVipp小一半,应该是哪没设置好吧
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号