static void fill_stream_info(mct_stream_info_t *stream_info) { memset(stream_info, 0, sizeof(mct_stream_info_t)); stream_info->identity = identity; stream_info->stream_type = CAM_STREAM_TYPE_PREVIEW; stream_info->fmt = CAM_FORMAT_YUV_420_NV12; stream_info->dim.width = 640; stream_info->dim.height = 480; stream_info->buf_planes; stream_info->streaming_mode = CAM_STREAMING_MODE_CONTINUOUS; stream_info->num_burst = 0; stream_info->buf_planes.plane_info.num_planes = 2; stream_info->buf_planes.plane_info.mp[0].stride = stream_info->dim.width; stream_info->buf_planes.plane_info.mp[0].scanline= stream_info->dim.height; stream_info->buf_planes.plane_info.mp[0].offset_x = 0; stream_info->buf_planes.plane_info.mp[0].offset_y = 0; stream_info->buf_planes.plane_info.mp[0].len = PAD_TO_WORD(640 * 480); stream_info->buf_planes.plane_info.mp[0].offset = 0; stream_info->buf_planes.plane_info.mp[1].offset_x = 0; stream_info->buf_planes.plane_info.mp[1].offset_y = 0; stream_info->buf_planes.plane_info.mp[0].stride = stream_info->dim.width/2; stream_info->buf_planes.plane_info.mp[0].scanline= stream_info->dim.height; stream_info->buf_planes.plane_info.mp[1].len = PAD_TO_WORD(640 * 480 / 2); stream_info->buf_planes.plane_info.mp[1].offset = 0; stream_info->buf_planes.plane_info.frame_len = PAD_TO_4K(stream_info->buf_planes.plane_info.mp[0].len + stream_info->buf_planes.plane_info.mp[1].len); }
uint32_t mm_camera_get_msm_frame_len(cam_format_t fmt_type, camera_mode_t mode, int width, int height, int image_type, uint8_t *num_planes, uint32_t plane[]) { uint32_t size; *num_planes = 0; int local_height; switch (fmt_type) { case CAMERA_YUV_420_NV12: case CAMERA_YUV_420_NV21: *num_planes = 2; if(CAMERA_MODE_3D == mode) { size = (uint32_t)(PAD_TO_2K(width*height)*3/2); plane[0] = PAD_TO_WORD(width*height); } else { if (image_type == OUTPUT_TYPE_V) { plane[0] = PAD_TO_2K(width * height); plane[1] = PAD_TO_2K(width * height/2); } else if (image_type == OUTPUT_TYPE_P) { plane[0] = PAD_TO_WORD(width * height); plane[1] = PAD_TO_WORD(width * height/2); } else { plane[0] = PAD_TO_WORD(width * CEILING16(height)); plane[1] = PAD_TO_WORD(width * CEILING16(height)/2); } size = plane[0] + plane[1]; } break; case CAMERA_BAYER_SBGGR10: *num_planes = 1; plane[0] = PAD_TO_WORD(width * height); size = plane[0]; break; case CAMERA_YUV_422_NV16: case CAMERA_YUV_422_NV61: if( image_type == OUTPUT_TYPE_S || image_type == OUTPUT_TYPE_V) { local_height = CEILING16(height); } else { local_height = height; } *num_planes = 2; plane[0] = PAD_TO_WORD(width * height); plane[1] = PAD_TO_WORD(width * height); size = plane[0] + plane[1]; break; default: CDBG("%s: format %d not supported.\n", __func__, fmt_type); size = 0; } CDBG("%s:fmt=%d,image_type=%d,width=%d,height=%d,frame_len=%d\n", __func__, fmt_type, image_type, width, height, size); return size; }