camera/QCamera2/HAL/QCameraPostProc.cpp
/*===========================================================================
 * FUNCTION   : processData
 *
 * DESCRIPTION: enqueue data into dataProc thread
 *
 * PARAMETERS :
 *   @frame   : process frame received from mm-camera-interface
 *
 * RETURN     : int32_t type of status
 *              NO_ERROR  -- success
 *              none-zero failure code
 *
 * NOTE       : depends on if offline reprocess is needed, received frame will
 *              be sent to either input queue of postprocess or jpeg encoding
 *==========================================================================*/
FUNCTION   : processData
DESCRIPTION: enqueue data into dataProc thread

PARAMETERS :
@frame   : process frame received from mm-camera-interface

RETURN     : int32_t type of status
NO_ERROR  -- success
none-zero failure code

NOTE       : depends on if offline reprocess is needed, received frame will
be sent to either input queue of postprocess or jpeg encoding
FUNCTION : processData DESCRIPTION : enqueue data into dataProc thread PARAMETERS : @frame : process frame received from mm - camera - interface RETURN : int32_t type of status NO_ERROR -- success none - zero failure code NOTE : depends on if offline reprocess is needed received frame will be sent to either input queue of postprocess or jpeg encoding
int32_t QCameraPostProcessor::processData(mm_camera_super_buf_t *frame)
{
    if (m_bInited == FALSE) {
        ALOGE("%s: postproc not initialized yet", __func__);
        return UNKNOWN_ERROR;
    }
    if (m_parent->needReprocess()) {
        if (!m_parent->isLongshotEnabled() ||
            (m_parent->isLongshotEnabled() &&
             (m_parent->isCaptureShutterEnabled() ||
             m_parent->isLongshotSnapLimited()))) {
            m_parent->playShutter();
        }
        ATRACE_INT("Camera:Reprocess", 1);
        CDBG_HIGH("%s: need reprocess", __func__);
        m_inputPPQ.enqueue((void *)frame);
    } else if (m_parent->mParameters.isNV16PictureFormat() ||
        m_parent->mParameters.isNV21PictureFormat()) {
        if(m_parent->mParameters.isYUVFrameInfoNeeded())
            setYUVFrameInfo(frame);
        processRawData(frame);
    } else {
        m_parent->playShutter();
        CDBG_HIGH("%s: no need offline reprocess, sending to jpeg encoding", __func__);
        qcamera_jpeg_data_t *jpeg_job =
            (qcamera_jpeg_data_t *)malloc(sizeof(qcamera_jpeg_data_t));
        if (jpeg_job == NULL) {
            ALOGE("%s: No memory for jpeg job", __func__);
            return NO_MEMORY;
        }
        memset(jpeg_job, 0, sizeof(qcamera_jpeg_data_t));
        jpeg_job->src_frame = frame;
        mm_camera_buf_def_t *meta_frame = NULL;
        for (uint32_t i = 0; i < frame->num_bufs; i++) {
            if (frame->bufs[i]->stream_type == CAM_STREAM_TYPE_METADATA) {
                meta_frame = frame->bufs[i];
                break;
            }
        }
        if (meta_frame != NULL) {
            jpeg_job->metadata = (cam_metadata_info_t *)meta_frame->buffer;
        }
        m_inputJpegQ.enqueue((void *)jpeg_job);
    }
    m_dataProcTh.sendCmd(CAMERA_CMD_TYPE_DO_NEXT_JOB, FALSE, FALSE);
    return NO_ERROR;
}
int32_t QCameraPostProcessor :: processData ( mm_camera_super_buf_t * frame ) { if ( m_bInited == FALSE ) { ALOGE ( " " , __func__ ) ; return UNKNOWN_ERROR ; } if ( m_parent -> needReprocess ( ) ) { if ( ! m_parent -> isLongshotEnabled ( ) || ( m_parent -> isLongshotEnabled ( ) && ( m_parent -> isCaptureShutterEnabled ( ) || m_parent -> isLongshotSnapLimited ( ) ) ) ) { m_parent -> playShutter ( ) ; } ATRACE_INT ( " " , 1 ) ; CDBG_HIGH ( " " , __func__ ) ; m_inputPPQ . enqueue ( ( void * ) frame ) ; } else if ( m_parent -> mParameters . isNV16PictureFormat ( ) || m_parent -> mParameters . isNV21PictureFormat ( ) ) { if ( m_parent -> mParameters . isYUVFrameInfoNeeded ( ) ) setYUVFrameInfo ( frame ) ; processRawData ( frame ) ; } else { m_parent -> playShutter ( ) ; CDBG_HIGH ( " " , __func__ ) ; qcamera_jpeg_data_t * jpeg_job = ( qcamera_jpeg_data_t * ) malloc ( sizeof ( qcamera_jpeg_data_t ) ) ; if ( jpeg_job == NULL ) { ALOGE ( " " , __func__ ) ; return NO_MEMORY ; } memset ( jpeg_job , 0 , sizeof ( qcamera_jpeg_data_t ) ) ; jpeg_job -> src_frame = frame ; mm_camera_buf_def_t * meta_frame = NULL ; for ( uint32_t i = 0 ; i < frame -> num_bufs ; i ++ ) { if ( frame -> bufs [ i ] -> stream_type == CAM_STREAM_TYPE_METADATA ) { meta_frame = frame -> bufs [ i ] ; break ; } } if ( meta_frame != NULL ) { jpeg_job -> metadata = ( cam_metadata_info_t * ) meta_frame -> buffer ; } m_inputJpegQ . enqueue ( ( void * ) jpeg_job ) ; } m_dataProcTh . sendCmd ( CAMERA_CMD_TYPE_DO_NEXT_JOB , FALSE , FALSE ) ; return NO_ERROR ; }
FUNCTION   : processData
 DESCRIPTION: enqueue data into dataProc thread
FUNCTION : processData DESCRIPTION : enqueue data into dataProc thread
//play shutter sound // enqueu to post proc input queue //check if raw frame information is needed. //play shutter sound // find meta data frame // look through input superbuf // fill in meta data frame ptr // enqueu to jpeg input queue