Revert "camera3: Use JPEG size as ZSL stream size"

This reverts commit 26aae0d7dbe6d4c8a9c189486ddbc0cacbcc7ddb.

Change-Id: If0319ca12bf5f77506888bf9b7b48612cb348d37
diff --git a/camera/QCamera2/HAL3/QCamera3Channel.cpp b/camera/QCamera2/HAL3/QCamera3Channel.cpp
index 753d1c1..6348625 100644
--- a/camera/QCamera2/HAL3/QCamera3Channel.cpp
+++ b/camera/QCamera2/HAL3/QCamera3Channel.cpp
@@ -514,45 +514,7 @@
                                 paddingInfo, postprocess_mask, userData),
                         mCamera3Stream(stream),
                         mNumBufs(0),
-                        mStreamType(stream_type),
-                        mWidth(stream->width),
-                        mHeight(stream->height)
-{
-}
-
-/*===========================================================================
- * FUNCTION   : QCamera3RegularChannel
- *
- * DESCRIPTION: constructor of QCamera3RegularChannel
- *
- * PARAMETERS :
- *   @cam_handle : camera handle
- *   @cam_ops    : ptr to camera ops table
- *   @cb_routine : callback routine to frame aggregator
- *   @stream     : camera3_stream_t structure
- *   @stream_type: Channel stream type
- *   @postprocess_mask: bit mask for postprocessing
- *   @width      : width overriding camera3_stream_t::width
- *   @height     : height overriding camera3_stream_t::height
- *
- * RETURN     : none
- *==========================================================================*/
-QCamera3RegularChannel::QCamera3RegularChannel(uint32_t cam_handle,
-                    mm_camera_ops_t *cam_ops,
-                    channel_cb_routine cb_routine,
-                    cam_padding_info_t *paddingInfo,
-                    void *userData,
-                    camera3_stream_t *stream,
-                    cam_stream_type_t stream_type,
-                    uint32_t postprocess_mask,
-                    uint32_t width, uint32_t height) :
-                        QCamera3Channel(cam_handle, cam_ops, cb_routine,
-                                paddingInfo, postprocess_mask, userData),
-                        mCamera3Stream(stream),
-                        mNumBufs(0),
-                        mStreamType(stream_type),
-                        mWidth(width),
-                        mHeight(height)
+                        mStreamType(stream_type)
 {
 }
 
@@ -639,8 +601,8 @@
         return -EINVAL;
     }
 
-    streamDim.width = mWidth;
-    streamDim.height = mHeight;
+    streamDim.width = mCamera3Stream->width;
+    streamDim.height = mCamera3Stream->height;
 
     rc = QCamera3Channel::addStream(mStreamType,
             streamFormat,
@@ -1642,12 +1604,14 @@
     } else {
        reproc_cfg.padding->height_padding = reproc_cfg.padding->width_padding;
     }
-
-    reproc_cfg.input_stream_dim.width = mYuvWidth;
-    reproc_cfg.input_stream_dim.height = mYuvHeight;
-    if (NULL == pInputBuffer)
+    if (NULL != pInputBuffer) {
+        reproc_cfg.input_stream_dim.width = pInputBuffer->stream->width;
+        reproc_cfg.input_stream_dim.height = pInputBuffer->stream->height;
+    } else {
+        reproc_cfg.input_stream_dim.width = mYuvWidth;
+        reproc_cfg.input_stream_dim.height = mYuvHeight;
         reproc_cfg.src_channel = this;
-
+    }
     reproc_cfg.output_stream_dim.width = mCamera3Stream->width;
     reproc_cfg.output_stream_dim.height = mCamera3Stream->height;
     reproc_cfg.stream_type = mStreamType;
diff --git a/camera/QCamera2/HAL3/QCamera3Channel.h b/camera/QCamera2/HAL3/QCamera3Channel.h
index 6916621..f67216e 100644
--- a/camera/QCamera2/HAL3/QCamera3Channel.h
+++ b/camera/QCamera2/HAL3/QCamera3Channel.h
@@ -143,15 +143,7 @@
                     camera3_stream_t *stream,
                     cam_stream_type_t stream_type,
                     uint32_t postprocess_mask);
-    QCamera3RegularChannel(uint32_t cam_handle,
-                    mm_camera_ops_t *cam_ops,
-                    channel_cb_routine cb_routine,
-                    cam_padding_info_t *paddingInfo,
-                    void *userData,
-                    camera3_stream_t *stream,
-                    cam_stream_type_t stream_type,
-                    uint32_t postprocess_mask,
-                    uint32_t width, uint32_t height);
+
     virtual ~QCamera3RegularChannel();
 
     virtual int32_t start();
@@ -176,7 +168,6 @@
     camera3_stream_t *mCamera3Stream;
     uint32_t mNumBufs;
     cam_stream_type_t mStreamType; // Stream type
-    uint32_t mWidth, mHeight;
     uint8_t mIntent;
 };
 
diff --git a/camera/QCamera2/HAL3/QCamera3HWI.cpp b/camera/QCamera2/HAL3/QCamera3HWI.cpp
index 4c0c461..cea4342 100644
--- a/camera/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/camera/QCamera2/HAL3/QCamera3HWI.cpp
@@ -1015,9 +1015,11 @@
         stream_config_info.stream_sizes[i].height = newStream->height;
         if (newStream->stream_type == CAMERA3_STREAM_BIDIRECTIONAL &&
             newStream->format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED && jpegStream){
-            //for zsl stream the size is jpeg stream size
-            stream_config_info.stream_sizes[i].width = jpegStream->width;
-            stream_config_info.stream_sizes[i].height = jpegStream->height;
+            //for zsl stream the size is active array size
+            stream_config_info.stream_sizes[i].width =
+                    gCamCapability[mCameraId]->active_array_size.width;
+            stream_config_info.stream_sizes[i].height =
+                    gCamCapability[mCameraId]->active_array_size.height;
             stream_config_info.type[i] = CAM_STREAM_TYPE_SNAPSHOT;
             stream_config_info.postprocess_mask[i] = CAM_QCOM_FEATURE_NONE;
         } else {
@@ -1050,7 +1052,12 @@
                       stream_config_info.postprocess_mask[i] = CAM_QCOM_FEATURE_NONE;
                   }
               }
-              if (m_bIs4KVideo) {
+              if (isZsl) {
+                  stream_config_info.stream_sizes[i].width =
+                          gCamCapability[mCameraId]->active_array_size.width;
+                  stream_config_info.stream_sizes[i].height =
+                          gCamCapability[mCameraId]->active_array_size.height;
+              } else if (m_bIs4KVideo) {
                   stream_config_info.stream_sizes[i].width = videoWidth;
                   stream_config_info.stream_sizes[i].height = videoHeight;
               }
@@ -1093,26 +1100,8 @@
                 break;
             }
 
-            if (newStream->format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED &&
-                    newStream->stream_type == CAMERA3_STREAM_BIDIRECTIONAL &&
-                    jpegStream) {
-                QCamera3Channel *channel = NULL;
-                newStream->max_buffers = QCamera3RegularChannel::kMaxBuffers;
-                channel = new QCamera3RegularChannel(mCameraHandle->camera_handle,
-                        mCameraHandle->ops, captureResultCb,
-                        &gCamCapability[mCameraId]->padding_info,
-                        this,
-                        newStream,
-                        (cam_stream_type_t) stream_config_info.type[i],
-                        stream_config_info.postprocess_mask[i],
-                        jpegStream->width, jpegStream->height);
-                    if (channel == NULL) {
-                        ALOGE("%s: allocation of channel failed", __func__);
-                        pthread_mutex_unlock(&mMutex);
-                        return -ENOMEM;
-                    }
-                    newStream->priv = channel;
-            } else if (newStream->stream_type == CAMERA3_STREAM_OUTPUT) {
+            if (newStream->stream_type == CAMERA3_STREAM_OUTPUT ||
+                    newStream->stream_type == CAMERA3_STREAM_BIDIRECTIONAL) {
                 QCamera3Channel *channel = NULL;
                 switch (newStream->format) {
                 case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
@@ -1185,7 +1174,11 @@
         }
     }
 
-    if (mPictureChannel && m_bIs4KVideo) {
+    if (isZsl) {
+        mPictureChannel->overrideYuvSize(
+                gCamCapability[mCameraId]->active_array_size.width,
+                gCamCapability[mCameraId]->active_array_size.height);
+    } else if (mPictureChannel && m_bIs4KVideo) {
         mPictureChannel->overrideYuvSize(videoWidth, videoHeight);
     }