int SecJpegEncoderHal::encode(void)
{
    if (t_bFlagCreate == false) {
        return ERROR_JPEG_DEVICE_NOT_CREATE_YET;
    }

    struct BUF_INFO stBufInfo;
    int iRet = ERROR_NONE;

    t_bFlagExcute = true;

    stBufInfo.numOfPlanes = t_iPlaneNum;
    stBufInfo.buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;

    stBufInfo.memory = V4L2_MEMORY_USERPTR;

    iRet = t_v4l2Qbuf(t_iJpegFd, &stBufInfo, &t_stJpegInbuf);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s:%d]: Input QBUF failed", __func__, iRet);
        return ERROR_EXCUTE_FAIL;
    }

    stBufInfo.numOfPlanes = NUM_PLANES;
    stBufInfo.buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;

    iRet = t_v4l2Qbuf(t_iJpegFd, &stBufInfo, &t_stJpegOutbuf);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s:%d]: Output QBUF failed", __func__, iRet);
        return ERROR_EXCUTE_FAIL;
    }

    stBufInfo.numOfPlanes = t_iPlaneNum;
    iRet = t_v4l2StreamOn(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s:%d]: input stream on failed", __func__, iRet);
        return ERROR_EXCUTE_FAIL;
    }
    stBufInfo.numOfPlanes = NUM_PLANES;
    iRet = t_v4l2StreamOn(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s:%d]: output stream on failed", __func__, iRet);
        return ERROR_EXCUTE_FAIL;
    }

    stBufInfo.numOfPlanes = t_iPlaneNum;
    iRet = t_v4l2Dqbuf(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_MMAP);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s:%d]: Intput DQBUF failed", __func__, iRet);
        return ERROR_EXCUTE_FAIL;
    }
    stBufInfo.numOfPlanes = NUM_PLANES;
    iRet = t_v4l2Dqbuf(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, V4L2_MEMORY_MMAP);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s:%d]: Output DQBUF failed", __func__, iRet);
        return ERROR_EXCUTE_FAIL;
    }
    return ERROR_NONE;
}
int ExynosJpegBase::execute(int iInBufPlanes, int iOutBufPlanes)
{
    if (t_bFlagCreate == false) {
        return ERROR_JPEG_DEVICE_NOT_CREATE_YET;
    }

    struct BUF_INFO stBufInfo;
    int iRet = ERROR_NONE;

    t_bFlagExcute = true;

    stBufInfo.numOfPlanes = iInBufPlanes;
    stBufInfo.buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;

    stBufInfo.memory = V4L2_MEMORY_DMABUF;

    iRet = t_v4l2Qbuf(t_iJpegFd, &stBufInfo, &t_stJpegInbuf);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s:%d]: Input QBUF failed\n", __func__, iRet);
        return ERROR_EXCUTE_FAIL;
    }

    stBufInfo.numOfPlanes = iOutBufPlanes;
    stBufInfo.buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;

    iRet = t_v4l2Qbuf(t_iJpegFd, &stBufInfo, &t_stJpegOutbuf);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s:%d]: Output QBUF failed\n", __func__, iRet);
        return ERROR_EXCUTE_FAIL;
    }

    iRet = t_v4l2StreamOn(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s:%d]: input stream on failed\n", __func__, iRet);
        return ERROR_EXCUTE_FAIL;
    }
    iRet = t_v4l2StreamOn(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s:%d]: output stream on failed\n", __func__, iRet);
        return ERROR_EXCUTE_FAIL;
    }

    iRet = t_v4l2Dqbuf(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_MMAP, iInBufPlanes);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s:%d]: Intput DQBUF failed\n", __func__, iRet);
        return ERROR_EXCUTE_FAIL;
    }
    iRet = t_v4l2Dqbuf(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, V4L2_MEMORY_MMAP, iOutBufPlanes);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s:%d]: Output DQBUF failed\n", __func__, iRet);
        return ERROR_EXCUTE_FAIL;
    }

    return ERROR_NONE;
}