Simplify _camerasrc_primary_set_metadata() function 55/166755/2
authorSylwester Nawrocki <s.nawrocki@samsung.com>
Thu, 11 Jan 2018 17:06:08 +0000 (18:06 +0100)
committerSylwester Nawrocki <s.nawrocki@samsung.com>
Fri, 12 Jan 2018 10:16:43 +0000 (11:16 +0100)
fcount and timestamp arguments were always set to 0 and are now removed.
While at it remove commented out code.

Change-Id: Id99ca5a2da181472d129edcad939b05b554aeac1
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
camerasrc/src/camerasrc.c

index 698d3ef101cadc6e2623d5a38b6fbcf3d6ac71ed..b5163cac1cdbd7f1a3776070adfb4b41e83fcc1b 100644 (file)
@@ -161,11 +161,12 @@ int _camerasrc_get_frame_data(camerasrc_handle_t *handle, camerasrc_frame_data_t
 int _camerasrc_get_exif_info(camerasrc_handle_t *handle, camerasrc_buffer_t *exif_string);
 
 static int _camerasrc_secondary_set_metadata(camerasrc_handle_t *p, unsigned int grpid, int fcount,
-                                    unsigned long long timestamp, struct camera2_shot_ext *shot_ext);
-static int _camerasrc_primary_set_metadata(camerasrc_handle_t *p, unsigned int grpid, int fcount,
-                                    unsigned long long timestamp, struct camera2_shot_ext *shot_ext);
+                                       unsigned long long timestamp, struct camera2_shot_ext *shot_ext);
+static int _camerasrc_primary_set_metadata(camerasrc_handle_t *p, unsigned int grpid,
+                                       struct camera2_shot_ext *shot_ext);
 
-static int _camerasrc_get_device_type_string(camerasrc_handle_t *p, int fd, int type, char **device_string, char **type_string);
+static int _camerasrc_get_device_type_string(camerasrc_handle_t *p, int fd, int type,
+                                       char **device_string, char **type_string);
 
 
 /* media definitions */
@@ -1638,7 +1639,7 @@ void *_camerasrc_rear_isp_thread_func(void *arg)
 
 
                /* Queue buffer back to the sensor video node */
-               _camerasrc_primary_set_metadata(p, GRP_SENSOR, 0, 0, shot_sensor);
+               _camerasrc_primary_set_metadata(p, GRP_SENSOR, shot_sensor);
 
                /* SENSOR - QBUF */
                ret = _camerasrc_ioctl_qbuf(p,
@@ -1656,7 +1657,7 @@ void *_camerasrc_rear_isp_thread_func(void *arg)
                p->qbuf_count_sensor++;
 
                shot_3aa = (struct camera2_shot_ext *)p->buffer_3aa_out[buf_index_3aa_out].planes[1].start;
-               _camerasrc_primary_set_metadata(p, GRP_3AA, 0, 0, shot_3aa);
+               _camerasrc_primary_set_metadata(p, GRP_3AA, shot_3aa);
 
                /* 3AA0 OUTPUT - QBUF */
                ret = _camerasrc_ioctl_qbuf(p,
@@ -2741,7 +2742,7 @@ int camerasrc_start_preview_stream(camsrc_handle_t handle)
 
        if (p->buffer_sensor) {
                if (p->cur_dev_id == CAMERASRC_DEV_ID_PRIMARY) {
-                       err = _camerasrc_primary_set_metadata(p, GRP_SENSOR, 0, 0,
+                       err = _camerasrc_primary_set_metadata(p, GRP_SENSOR,
                                                (struct camera2_shot_ext *)p->buffer_sensor[0].planes[1].start);
                } else {
                        err = _camerasrc_secondary_set_metadata(p, GRP_SENSOR, 0, 0,
@@ -2776,7 +2777,7 @@ int camerasrc_start_preview_stream(camsrc_handle_t handle)
 
                for (i = 0 ; i < p->format_scp.num_buffers; i++) {
                        if (p->cur_dev_id == CAMERASRC_DEV_ID_PRIMARY) {
-                               err = _camerasrc_primary_set_metadata(p, GRP_SCP, 0, 0,
+                               err = _camerasrc_primary_set_metadata(p, GRP_SCP,
                                                        (struct camera2_shot_ext *)p->buffer_scp[i].planes[2].start);
                        } else {
                                err = _camerasrc_secondary_set_metadata(p, GRP_SCP, 0, 0,
@@ -2902,7 +2903,7 @@ int camerasrc_start_preview_stream(camsrc_handle_t handle)
                for (i = 0 ; i < p->format_isp.num_buffers; i++) {
                        struct camera2_shot_ext *shot_3aa = (struct camera2_shot_ext *)p->buffer_3aa_out[i].planes[1].start;
 
-                       err = _camerasrc_primary_set_metadata(p, GRP_3AA, 0, 0, shot_3aa);
+                       err = _camerasrc_primary_set_metadata(p, GRP_3AA, shot_3aa);
                        if (err != CAMERASRC_SUCCESS) {
                                camsrc_error("[TA] Frame metadata setting (index %d) failed[%x]", i, err);
                                return err;
@@ -4407,8 +4408,8 @@ int camerasrc_write_extra_dev_info(camsrc_handle_t handle, camerasrc_extra_info_
 }
 
 
-static int _camerasrc_primary_set_metadata(camerasrc_handle_t *p, unsigned int grpid, int fcount,
-                               unsigned long long timestamp, struct camera2_shot_ext *shot_ext)
+static int _camerasrc_primary_set_metadata(camerasrc_handle_t *p, unsigned int grpid,
+                                          struct camera2_shot_ext *shot_ext)
 {
        unsigned int width = FIMC_IS_BAYER_IMG_WIDTH;
        unsigned int height = FIMC_IS_BAYER_IMG_HEIGHT;
@@ -4418,18 +4419,14 @@ static int _camerasrc_primary_set_metadata(camerasrc_handle_t *p, unsigned int g
                return CAMERASRC_ERR_NULL_POINTER;
        }
 
-       if (grpid == GRP_ISP)
-               return CAMERASRC_SUCCESS;
-
        memset(shot_ext, 0, sizeof(struct camera2_shot_ext));
 
        shot_ext->drc_bypass    = 1;
-       shot_ext->dis_bypass    = 1;
-       shot_ext->dnr_bypass    = 1;
+       shot_ext->dis_bypass    = 1;
+       shot_ext->dnr_bypass    = 1;
        shot_ext->fd_bypass     = 1;
 
        shot_ext->setfile       = 0;
-       /* shot_ext->free_cnt   = 5; */
 
        shot_ext->shot.ctl.request.metadataMode = METADATA_MODE_FULL;
        shot_ext->shot.ctl.lens.aperture = 2.26999998;
@@ -4492,7 +4489,7 @@ static int _camerasrc_primary_set_metadata(camerasrc_handle_t *p, unsigned int g
 
        if (grpid == GRP_3AA) {
                shot_ext->setfile = 0;
-#if 1
+
                shot_ext->node_group.leader.vid = FIMC_IS_VIDEO_3A0_NUM;
                shot_ext->node_group.leader.request = 1;
                shot_ext->node_group.leader.input.cropRegion[0] = 0;
@@ -4503,8 +4500,7 @@ static int _camerasrc_primary_set_metadata(camerasrc_handle_t *p, unsigned int g
                shot_ext->node_group.leader.output.cropRegion[1] = 0;
                shot_ext->node_group.leader.output.cropRegion[2] = width + 88;  /* 2648 */
                shot_ext->node_group.leader.output.cropRegion[3] = height + 50; /* 1490 */;
-#endif
-#if 1
+
                shot_ext->node_group.capture[1].vid = FIMC_IS_VIDEO_3A0P_NUM;
                shot_ext->node_group.capture[1].request = 1;
                shot_ext->node_group.capture[1].input.cropRegion[0] = 0;
@@ -4515,33 +4511,14 @@ static int _camerasrc_primary_set_metadata(camerasrc_handle_t *p, unsigned int g
                shot_ext->node_group.capture[1].output.cropRegion[1] = 0;
                shot_ext->node_group.capture[1].output.cropRegion[2] = width;
                shot_ext->node_group.capture[1].output.cropRegion[3] = height;
-#endif
-#if 0
-               /* FIXME: is this needed? */
-               shot_ext->shot.ctl.scaler.cropRegion[0] = 0x3f800000;
-               shot_ext->shot.ctl.scaler.cropRegion[1] = 0;
-               shot_ext->shot.ctl.scaler.cropRegion[2] = width;
-               shot_ext->shot.ctl.scaler.cropRegion[3] = height;
-#endif
-//             shot_ext->shot.ctl.aa.aeTargetFpsRange[0] = 10;
-//             shot_ext->shot.ctl.aa.aeTargetFpsRange[1] = 30;
        }
 
        if (grpid != GRP_SENSOR) {
                shot_ext->shot.dm.request.metadataMode = METADATA_MODE_NONE;
-               shot_ext->shot.dm.request.frameCount = fcount;
-               shot_ext->shot.dm.sensor.timeStamp = timestamp;
-
-//             shot_ext->shot.dm.entry.lowIndexParam = 0;
-//             shot_ext->shot.dm.entry.highIndexParam = 0;
-
-//             shot_ext->shot.ctl.entry.lowIndexParam = 0;
-//             shot_ext->shot.ctl.entry.highIndexParam = 0;
-
+               shot_ext->shot.dm.request.frameCount = 0;
+               shot_ext->shot.dm.sensor.timeStamp = 0;
        }
 
-       camsrc_debug("grpid: %d fcount: %d", grpid, fcount);
-
        shot_ext->shot.magicNumber = METADATA_MAGIC_NUMBER;
 
        return CAMERASRC_SUCCESS;
@@ -4549,7 +4526,7 @@ static int _camerasrc_primary_set_metadata(camerasrc_handle_t *p, unsigned int g
 
 
 static int _camerasrc_secondary_set_metadata(camerasrc_handle_t *p, unsigned int grpid, int fcount,
-                                    unsigned long long timestamp, struct camera2_shot_ext *shot_ext)
+                               unsigned long long timestamp, struct camera2_shot_ext *shot_ext)
 {
        if (p == NULL) {
                camsrc_error("NULL handle");