int ExynosJpegBase::updateConfig(enum MODE eMode, int iInBufs, int iOutBufs, int iInBufPlanes, int iOutBufPlanes)
{
    if (t_bFlagCreate == false) {
        return ERROR_JPEG_DEVICE_NOT_CREATE_YET;
    }

    int iRet = ERROR_NONE;

    if (eMode == MODE_ENCODE) {
        iRet = t_v4l2SetJpegcomp(t_iJpegFd, t_stJpegConfig.enc_qual);
        if (iRet < 0) {
            JPEG_ERROR_LOG("[%s,%d]: S_JPEGCOMP failed\n", __func__,iRet);
            return ERROR_INVALID_JPEG_CONFIG;
        }
    }

    t_stJpegConfig.numOfPlanes = iInBufPlanes;
    t_stJpegConfig.mode = eMode;

    iRet = t_v4l2SetFmt(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, &t_stJpegConfig);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s,%d]: jpeg input S_FMT failed\n", __func__,iRet);
        return ERROR_INVALID_JPEG_CONFIG;
    }

    struct BUF_INFO stBufInfo;

    stBufInfo.numOfPlanes = iInBufs;
    stBufInfo.buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
    stBufInfo.memory = V4L2_MEMORY_DMABUF;

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

    t_stJpegConfig.numOfPlanes = iOutBufPlanes;
    iRet = t_v4l2SetFmt(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, &t_stJpegConfig);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s,%d]: jpeg output S_FMT failed\n", __func__,iRet);
        return ERROR_INVALID_JPEG_CONFIG;
    }

    stBufInfo.numOfPlanes = iOutBufs;
    stBufInfo.buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;

    iRet = t_v4l2Reqbufs(t_iJpegFd, iOutBufs, &stBufInfo);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s:%d]: Output REQBUFS failed\n", __func__, iRet);
        return ERROR_REQBUF_FAIL;
    }

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

    int iRet = ERROR_NONE;

    iRet = t_v4l2SetJpegcomp(t_iJpegFd, t_stJpegConfig.enc_qual);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s,%d]: S_JPEGCOMP failed", __func__,iRet);
        return ERROR_INVALID_JPEG_CONFIG;
    }

    t_stJpegConfig.numOfPlanes = t_iPlaneNum;

    t_stJpegConfig.mode = MODE_ENCODE;

    iRet = t_v4l2SetFmt(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, &t_stJpegConfig);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s,%d]: jpeg input S_FMT failed", __func__,iRet);
        return ERROR_INVALID_JPEG_CONFIG;
    }

    struct BUF_INFO stBufInfo;

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

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

    t_stJpegConfig.numOfPlanes = NUM_PLANES;
    iRet = t_v4l2SetFmt(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, &t_stJpegConfig);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s,%d]: jpeg output S_FMT failed", __func__,iRet);
        return ERROR_INVALID_JPEG_CONFIG;
    }

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

    iRet = t_v4l2Reqbufs(t_iJpegFd, NUM_BUFFERS, &stBufInfo);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s:%d]: Output REQBUFS failed", __func__, iRet);
        return ERROR_REQBUF_FAIL;
    }

    return ERROR_NONE;
}