aboutsummaryrefslogtreecommitdiff
path: root/camera
diff options
context:
space:
mode:
Diffstat (limited to 'camera')
-rw-r--r--camera/QCamera2/HAL/QCamera2HWI.cpp2
-rwxr-xr-xcamera/QCamera2/HAL/QCameraMem.cpp2
-rw-r--r--camera/QCamera2/HAL/QCameraStream.cpp3
-rw-r--r--camera/QCamera2/stack/common/mm_camera_interface.h3
-rw-r--r--camera/QCamera2/stack/mm-camera-interface/src/mm_camera_stream.c138
5 files changed, 112 insertions, 36 deletions
diff --git a/camera/QCamera2/HAL/QCamera2HWI.cpp b/camera/QCamera2/HAL/QCamera2HWI.cpp
index 1e6f310..bc97c07 100644
--- a/camera/QCamera2/HAL/QCamera2HWI.cpp
+++ b/camera/QCamera2/HAL/QCamera2HWI.cpp
@@ -6828,7 +6828,7 @@ int32_t QCamera2HardwareInterface::addStreamToChannel(QCameraChannel *pChannel,
} else {
padding_info =
gCamCapability[mCameraId]->padding_info;
- if (streamType == CAM_STREAM_TYPE_PREVIEW) {
+ if (streamType == CAM_STREAM_TYPE_PREVIEW || streamType == CAM_STREAM_TYPE_POSTVIEW) {
padding_info.width_padding = mSurfaceStridePadding;
padding_info.height_padding = CAM_PAD_TO_2;
}
diff --git a/camera/QCamera2/HAL/QCameraMem.cpp b/camera/QCamera2/HAL/QCameraMem.cpp
index 00f1548..f4c239a 100755
--- a/camera/QCamera2/HAL/QCameraMem.cpp
+++ b/camera/QCamera2/HAL/QCameraMem.cpp
@@ -1289,7 +1289,7 @@ QCameraVideoMemory::QCameraVideoMemory(camera_request_memory memory,
mMetaBufCount = 0;
mBufType = bufType;
//Set Default color conversion format
- mUsage = private_handle_t::PRIV_FLAGS_ITU_R_601_FR;
+ mUsage = private_handle_t::PRIV_FLAGS_ITU_R_709;
//Set Default frame format
mFormat = OMX_COLOR_FormatYUV420SemiPlanar;
diff --git a/camera/QCamera2/HAL/QCameraStream.cpp b/camera/QCamera2/HAL/QCameraStream.cpp
index cbe8a6a..7817009 100644
--- a/camera/QCamera2/HAL/QCameraStream.cpp
+++ b/camera/QCamera2/HAL/QCameraStream.cpp
@@ -798,8 +798,9 @@ int32_t QCameraStream::calcOffset(cam_stream_info_t *streamInfo)
&streamInfo->buf_planes);
break;
case CAM_STREAM_TYPE_POSTVIEW:
- rc = mm_stream_calc_offset_post_view(streamInfo->fmt,
+ rc = mm_stream_calc_offset_post_view(streamInfo,
&dim,
+ &mPaddingInfo,
&streamInfo->buf_planes);
break;
case CAM_STREAM_TYPE_SNAPSHOT:
diff --git a/camera/QCamera2/stack/common/mm_camera_interface.h b/camera/QCamera2/stack/common/mm_camera_interface.h
index 40bd6d3..f3c7ce4 100644
--- a/camera/QCamera2/stack/common/mm_camera_interface.h
+++ b/camera/QCamera2/stack/common/mm_camera_interface.h
@@ -883,8 +883,9 @@ int32_t mm_stream_calc_offset_preview(cam_stream_info_t *stream_info,
cam_padding_info_t *padding,
cam_stream_buf_plane_info_t *buf_planes);
-int32_t mm_stream_calc_offset_post_view(cam_format_t fmt,
+int32_t mm_stream_calc_offset_post_view(cam_stream_info_t *stream_info,
cam_dimension_t *dim,
+ cam_padding_info_t *padding,
cam_stream_buf_plane_info_t *buf_planes);
int32_t mm_stream_calc_offset_snapshot(cam_format_t fmt,
diff --git a/camera/QCamera2/stack/mm-camera-interface/src/mm_camera_stream.c b/camera/QCamera2/stack/mm-camera-interface/src/mm_camera_stream.c
index 13a01d5..a1958f0 100644
--- a/camera/QCamera2/stack/mm-camera-interface/src/mm_camera_stream.c
+++ b/camera/QCamera2/stack/mm-camera-interface/src/mm_camera_stream.c
@@ -83,8 +83,9 @@ int32_t mm_stream_calc_offset_preview(cam_stream_info_t *stream_info,
cam_dimension_t *dim,
cam_padding_info_t *padding,
cam_stream_buf_plane_info_t *buf_planes);
-int32_t mm_stream_calc_offset_post_view(cam_format_t fmt,
+int32_t mm_stream_calc_offset_post_view(cam_stream_info_t *stream_info,
cam_dimension_t *dim,
+ cam_padding_info_t *padding,
cam_stream_buf_plane_info_t *buf_planes);
int32_t mm_stream_calc_offset_snapshot(cam_format_t fmt,
@@ -2681,22 +2682,27 @@ int32_t mm_stream_calc_offset_preview(cam_stream_info_t *stream_info,
* padding information
*
* PARAMETERS :
- * @fmt : image format
+ * @stream_info : Stream information
* @dim : image dimension
+ * @padding : Padding info
* @buf_planes : [out] buffer plane information
*
* RETURN : int32_t type of status
* 0 -- success
* -1 -- failure
*==========================================================================*/
-int32_t mm_stream_calc_offset_post_view(cam_format_t fmt,
+int32_t mm_stream_calc_offset_post_view(cam_stream_info_t *stream_info,
cam_dimension_t *dim,
+ cam_padding_info_t *padding,
cam_stream_buf_plane_info_t *buf_planes)
{
int32_t rc = 0;
int stride = 0, scanline = 0;
- switch (fmt) {
+ uint32_t width_padding = 0;
+ uint32_t height_padding = 0;
+
+ switch (stream_info->fmt) {
case CAM_FORMAT_YUV_420_NV12:
case CAM_FORMAT_YUV_420_NV21:
case CAM_FORMAT_Y_ONLY:
@@ -2706,8 +2712,16 @@ int32_t mm_stream_calc_offset_post_view(cam_format_t fmt,
/* 2 planes: Y + CbCr */
buf_planes->plane_info.num_planes = 2;
- stride = PAD_TO_SIZE(dim->width, CAM_PAD_TO_64);
- scanline = PAD_TO_SIZE(dim->height, CAM_PAD_TO_64);
+ if (stream_info->stream_type != CAM_STREAM_TYPE_OFFLINE_PROC) {
+ width_padding = padding->width_padding;
+ height_padding = CAM_PAD_TO_2;
+ } else {
+ width_padding = padding->width_padding;
+ height_padding = padding->height_padding;
+ }
+
+ stride = PAD_TO_SIZE(dim->width, width_padding);
+ scanline = PAD_TO_SIZE(dim->height, height_padding);
buf_planes->plane_info.mp[0].offset = 0;
buf_planes->plane_info.mp[0].len = (uint32_t)(stride * scanline);
buf_planes->plane_info.mp[0].offset_x = 0;
@@ -2717,8 +2731,8 @@ int32_t mm_stream_calc_offset_post_view(cam_format_t fmt,
buf_planes->plane_info.mp[0].width = dim->width;
buf_planes->plane_info.mp[0].height = dim->height;
- stride = PAD_TO_SIZE(dim->width, CAM_PAD_TO_64);
- scanline = PAD_TO_SIZE(dim->height / 2, CAM_PAD_TO_64);
+ stride = PAD_TO_SIZE(dim->width, width_padding);
+ scanline = PAD_TO_SIZE(dim->height / 2, height_padding);
buf_planes->plane_info.mp[1].offset = 0;
buf_planes->plane_info.mp[1].len =
(uint32_t)(stride * scanline);
@@ -2738,8 +2752,16 @@ int32_t mm_stream_calc_offset_post_view(cam_format_t fmt,
/* 2 planes: Y + CbCr */
buf_planes->plane_info.num_planes = 2;
- stride = PAD_TO_SIZE(dim->width, CAM_PAD_TO_32);
- scanline = PAD_TO_SIZE(dim->height, CAM_PAD_TO_32);
+ if (stream_info->stream_type != CAM_STREAM_TYPE_OFFLINE_PROC) {
+ width_padding = CAM_PAD_TO_32;
+ height_padding = CAM_PAD_TO_32;
+ } else {
+ width_padding = padding->width_padding;
+ height_padding = padding->height_padding;
+ }
+
+ stride = PAD_TO_SIZE(dim->width, width_padding);
+ scanline = PAD_TO_SIZE(dim->height, height_padding);
buf_planes->plane_info.mp[0].offset = 0;
buf_planes->plane_info.mp[0].len =
PAD_TO_SIZE((uint32_t)(stride * scanline), CAM_PAD_TO_4K);
@@ -2750,8 +2772,8 @@ int32_t mm_stream_calc_offset_post_view(cam_format_t fmt,
buf_planes->plane_info.mp[0].width = dim->width;
buf_planes->plane_info.mp[0].height = dim->height;
- stride = PAD_TO_SIZE(dim->width / 2, CAM_PAD_TO_32) * 2;
- scanline = PAD_TO_SIZE(dim->height / 2, CAM_PAD_TO_32);
+ stride = PAD_TO_SIZE(dim->width / 2, width_padding) * 2;
+ scanline = PAD_TO_SIZE(dim->height / 2, height_padding);
buf_planes->plane_info.mp[1].offset = 0;
buf_planes->plane_info.mp[1].len =
PAD_TO_SIZE((uint32_t)(stride * scanline), CAM_PAD_TO_4K);
@@ -2771,8 +2793,16 @@ int32_t mm_stream_calc_offset_post_view(cam_format_t fmt,
/* 3 planes: Y + Cr + Cb */
buf_planes->plane_info.num_planes = 3;
- stride = PAD_TO_SIZE(dim->width, CAM_PAD_TO_16);
- scanline = PAD_TO_SIZE(dim->height, CAM_PAD_TO_2);
+ if (stream_info->stream_type != CAM_STREAM_TYPE_OFFLINE_PROC) {
+ width_padding = CAM_PAD_TO_16;
+ height_padding = CAM_PAD_TO_2;
+ } else {
+ width_padding = padding->width_padding;
+ height_padding = padding->height_padding;
+ }
+
+ stride = PAD_TO_SIZE(dim->width, width_padding);
+ scanline = PAD_TO_SIZE(dim->height, height_padding);
buf_planes->plane_info.mp[0].offset = 0;
buf_planes->plane_info.mp[0].len = (uint32_t)(stride * scanline);
buf_planes->plane_info.mp[0].offset_x = 0;
@@ -2782,8 +2812,8 @@ int32_t mm_stream_calc_offset_post_view(cam_format_t fmt,
buf_planes->plane_info.mp[0].width = dim->width;
buf_planes->plane_info.mp[0].height = dim->height;
- stride = PAD_TO_SIZE(stride / 2, CAM_PAD_TO_16);
- scanline = scanline / 2;
+ stride = PAD_TO_SIZE(stride / 2, width_padding);
+ scanline = PAD_TO_SIZE(stride / 2, height_padding);
buf_planes->plane_info.mp[1].offset = 0;
buf_planes->plane_info.mp[1].len =
(uint32_t)(stride * scanline);
@@ -2815,8 +2845,13 @@ int32_t mm_stream_calc_offset_post_view(cam_format_t fmt,
/* 2 planes: Y + CbCr */
buf_planes->plane_info.num_planes = 2;
- stride = PAD_TO_SIZE(dim->width, CAM_PAD_TO_16);
- scanline = dim->height;
+ if (stream_info->stream_type != CAM_STREAM_TYPE_OFFLINE_PROC) {
+ stride = PAD_TO_SIZE(dim->width, CAM_PAD_TO_16);
+ scanline = dim->height;
+ } else {
+ stride = PAD_TO_SIZE(dim->width, padding->width_padding);
+ scanline = PAD_TO_SIZE(dim->height, padding->height_padding);
+ }
buf_planes->plane_info.mp[0].offset = 0;
buf_planes->plane_info.mp[0].len = (uint32_t)(stride * scanline);
buf_planes->plane_info.mp[0].offset_x = 0;
@@ -2843,11 +2878,16 @@ int32_t mm_stream_calc_offset_post_view(cam_format_t fmt,
case CAM_FORMAT_YUV_420_NV12_VENUS:
#ifdef VENUS_PRESENT
// using Venus
- stride = VENUS_Y_STRIDE(COLOR_FMT_NV12, dim->width);
- scanline = VENUS_Y_SCANLINES(COLOR_FMT_NV12, dim->height);
+ if (stream_info->stream_type != CAM_STREAM_TYPE_OFFLINE_PROC) {
+ stride = VENUS_Y_STRIDE(COLOR_FMT_NV12, dim->width);
+ scanline = VENUS_Y_SCANLINES(COLOR_FMT_NV12, dim->height);
+ } else {
+ stride = PAD_TO_SIZE(dim->width, padding->width_padding);
+ scanline = PAD_TO_SIZE(dim->height, padding->height_padding);
+ }
buf_planes->plane_info.frame_len =
- VENUS_BUFFER_SIZE(COLOR_FMT_NV12, dim->width, dim->height);
+ VENUS_BUFFER_SIZE(COLOR_FMT_NV12, stride, scanline);
buf_planes->plane_info.num_planes = 2;
buf_planes->plane_info.mp[0].len = (uint32_t)(stride * scanline);
buf_planes->plane_info.mp[0].offset = 0;
@@ -2857,8 +2897,13 @@ int32_t mm_stream_calc_offset_post_view(cam_format_t fmt,
buf_planes->plane_info.mp[0].scanline = scanline;
buf_planes->plane_info.mp[0].width = dim->width;
buf_planes->plane_info.mp[0].height = dim->height;
- stride = VENUS_UV_STRIDE(COLOR_FMT_NV12, dim->width);
- scanline = VENUS_UV_SCANLINES(COLOR_FMT_NV12, dim->height);
+ if (stream_info->stream_type != CAM_STREAM_TYPE_OFFLINE_PROC) {
+ stride = VENUS_UV_STRIDE(COLOR_FMT_NV12, dim->width);
+ scanline = VENUS_UV_SCANLINES(COLOR_FMT_NV12, dim->height);
+ } else {
+ stride = PAD_TO_SIZE(dim->width, padding->width_padding);
+ scanline = PAD_TO_SIZE(dim->height, padding->height_padding);
+ }
buf_planes->plane_info.mp[1].len =
buf_planes->plane_info.frame_len - buf_planes->plane_info.mp[0].len;
buf_planes->plane_info.mp[1].offset = 0;
@@ -2876,8 +2921,13 @@ int32_t mm_stream_calc_offset_post_view(cam_format_t fmt,
case CAM_FORMAT_YUV_420_NV21_VENUS:
#ifdef VENUS_PRESENT
// using Venus
- stride = VENUS_Y_STRIDE(COLOR_FMT_NV21, dim->width);
- scanline = VENUS_Y_SCANLINES(COLOR_FMT_NV21, dim->height);
+ if (stream_info->stream_type != CAM_STREAM_TYPE_OFFLINE_PROC) {
+ stride = VENUS_Y_STRIDE(COLOR_FMT_NV21, dim->width);
+ scanline = VENUS_Y_SCANLINES(COLOR_FMT_NV21, dim->height);
+ } else {
+ stride = PAD_TO_SIZE(dim->width, padding->width_padding);
+ scanline = PAD_TO_SIZE(dim->height, padding->height_padding);
+ }
buf_planes->plane_info.frame_len =
VENUS_BUFFER_SIZE(COLOR_FMT_NV21, dim->width, dim->height);
buf_planes->plane_info.num_planes = 2;
@@ -2889,8 +2939,13 @@ int32_t mm_stream_calc_offset_post_view(cam_format_t fmt,
buf_planes->plane_info.mp[0].scanline = scanline;
buf_planes->plane_info.mp[0].width = dim->width;
buf_planes->plane_info.mp[0].height = dim->height;
- stride = VENUS_UV_STRIDE(COLOR_FMT_NV21, dim->width);
- scanline = VENUS_UV_SCANLINES(COLOR_FMT_NV21, dim->height);
+ if (stream_info->stream_type != CAM_STREAM_TYPE_OFFLINE_PROC) {
+ stride = VENUS_UV_STRIDE(COLOR_FMT_NV21, dim->width);
+ scanline = VENUS_UV_SCANLINES(COLOR_FMT_NV21, dim->height);
+ } else {
+ stride = PAD_TO_SIZE(dim->width, padding->width_padding);
+ scanline = PAD_TO_SIZE(dim->height, padding->height_padding);
+ }
buf_planes->plane_info.mp[1].len =
buf_planes->plane_info.frame_len - buf_planes->plane_info.mp[0].len;
buf_planes->plane_info.mp[1].offset = 0;
@@ -2910,8 +2965,13 @@ int32_t mm_stream_calc_offset_post_view(cam_format_t fmt,
{
int meta_stride = 0,meta_scanline = 0;
// using UBWC
- stride = VENUS_Y_STRIDE(COLOR_FMT_NV12_UBWC, dim->width);
- scanline = VENUS_Y_SCANLINES(COLOR_FMT_NV12_UBWC, dim->height);
+ if (stream_info->stream_type != CAM_STREAM_TYPE_OFFLINE_PROC) {
+ stride = VENUS_Y_STRIDE(COLOR_FMT_NV12_UBWC, dim->width);
+ scanline = VENUS_Y_SCANLINES(COLOR_FMT_NV12_UBWC, dim->height);
+ } else {
+ stride = PAD_TO_SIZE(dim->width, padding->width_padding);
+ scanline = PAD_TO_SIZE(dim->height, padding->height_padding);
+ }
meta_stride = VENUS_Y_META_STRIDE(COLOR_FMT_NV12_UBWC, dim->width);
meta_scanline = VENUS_Y_META_SCANLINES(COLOR_FMT_NV12_UBWC, dim->height);
@@ -2958,7 +3018,7 @@ int32_t mm_stream_calc_offset_post_view(cam_format_t fmt,
break;
default:
LOGE("Invalid cam_format for preview %d",
- fmt);
+ stream_info->fmt);
rc = -1;
break;
}
@@ -4210,8 +4270,9 @@ int32_t mm_stream_calc_offset_postproc(cam_stream_info_t *stream_info,
plns);
break;
case CAM_STREAM_TYPE_POSTVIEW:
- rc = mm_stream_calc_offset_post_view(stream_info->fmt,
+ rc = mm_stream_calc_offset_post_view(stream_info,
&stream_info->dim,
+ padding,
plns);
break;
case CAM_STREAM_TYPE_SNAPSHOT:
@@ -4311,6 +4372,7 @@ uint32_t mm_stream_calc_lcm(int32_t num1, int32_t num2)
int32_t mm_stream_calc_offset(mm_stream_t *my_obj)
{
int32_t rc = 0;
+ uint32_t i;
cam_dimension_t dim = my_obj->stream_info->dim;
if (my_obj->stream_info->pp_config.feature_mask & CAM_QCOM_FEATURE_ROTATION &&
@@ -4331,8 +4393,9 @@ int32_t mm_stream_calc_offset(mm_stream_t *my_obj)
&my_obj->stream_info->buf_planes);
break;
case CAM_STREAM_TYPE_POSTVIEW:
- rc = mm_stream_calc_offset_post_view(my_obj->stream_info->fmt,
+ rc = mm_stream_calc_offset_post_view(my_obj->stream_info,
&dim,
+ &my_obj->padding_info,
&my_obj->stream_info->buf_planes);
break;
case CAM_STREAM_TYPE_SNAPSHOT:
@@ -4376,6 +4439,17 @@ int32_t mm_stream_calc_offset(mm_stream_t *my_obj)
}
my_obj->frame_offset = my_obj->stream_info->buf_planes.plane_info;
+ LOGH("Stream type %d num_planes %d", my_obj->stream_info->stream_type,
+ my_obj->frame_offset.num_planes);
+ for (i = 0; i < my_obj->frame_offset.num_planes; i++) {
+ LOGH("Plane %d, stride %d, scanline %d, width %d, height %d, \
+ length %d", i, my_obj->frame_offset.mp[i].stride,
+ my_obj->frame_offset.mp[i].scanline,
+ my_obj->frame_offset.mp[i].width,
+ my_obj->frame_offset.mp[i].height,
+ my_obj->frame_offset.mp[i].len);
+ }
+
return rc;
}