int ExynosJpegBase::create(enum MODE eMode)
{
    if (t_bFlagCreate == true) {
        return ERROR_JPEG_DEVICE_ALREADY_CREATE;
    }

    int iRet = ERROR_NONE;

    switch (eMode) {
    case MODE_ENCODE:
        t_iJpegFd = open(JPEG_ENC_NODE, O_RDWR, 0);
        break;
    case MODE_DECODE:
        t_iJpegFd = open(JPEG_DEC_NODE, O_RDWR, 0);
        break;
    default:
        t_iJpegFd = -1;
        return ERROR_INVALID_JPEG_MODE;
        break;
    }

    if (t_iJpegFd < 0) {
        t_iJpegFd = -1;
        JPEG_ERROR_LOG("[%s]: JPEG_NODE open failed\n", __func__);
        return ERROR_CANNOT_OPEN_JPEG_DEVICE;
    }

    if (t_iJpegFd <= 0) {
        t_iJpegFd = -1;
        JPEG_ERROR_LOG("ERR(%s):JPEG device was closed\n", __func__);
        return ERROR_JPEG_DEVICE_ALREADY_CLOSED;
    }

    iRet = t_v4l2Querycap(t_iJpegFd);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s]: QUERYCAP failed\n", __func__);
        close(t_iJpegFd);
        return ERROR_CANNOT_OPEN_JPEG_DEVICE;
    }

    memset(&t_stJpegConfig, 0, sizeof(struct CONFIG));
    memset(&t_stJpegInbuf, 0, sizeof(struct BUFFER));
    memset(&t_stJpegOutbuf, 0, sizeof(struct BUFFER));

    t_stJpegConfig.mode = eMode;

    t_bFlagCreate = true;
    t_bFlagCreateInBuf = false;
    t_bFlagCreateOutBuf = false;
    t_bFlagExcute = false;

    t_iPlaneNum = 0;

    return ERROR_NONE;
}
int SecJpegEncoderHal::create(void)
{
    if (t_bFlagCreate == true) {
        return ERROR_JPEG_DEVICE_ALREADY_CREATE;
    }

    int iRet = ERROR_NONE;

    t_iJpegFd = open(JPEG_ENC_NODE, O_RDWR, 0);

    if (t_iJpegFd < 0) {
        t_iJpegFd = -1;
        JPEG_ERROR_LOG("[%s]: JPEG_ENC_NODE open failed", __func__);
        return ERROR_CANNOT_OPEN_JPEG_DEVICE;
    }

    if (t_iJpegFd <= 0) {
        t_iJpegFd = -1;
        JPEG_ERROR_LOG("ERR(%s):JPEG device was closed\n", __func__);
        return ERROR_JPEG_DEVICE_ALREADY_CLOSED;
    }

    iRet = t_v4l2Querycap(t_iJpegFd);
    if (iRet < 0) {
        JPEG_ERROR_LOG("[%s]: QUERYCAP failed", __func__);
        close(t_iJpegFd);
        return ERROR_CANNOT_OPEN_JPEG_DEVICE;
    }

    memset(&t_stJpegConfig, 0, sizeof(struct CONFIG));
    memset(&t_stJpegInbuf, 0, sizeof(struct BUFFER));
    memset(&t_stJpegOutbuf, 0, sizeof(struct BUFFER));

    t_stJpegConfig.mode = MODE_ENCODE;

    t_bFlagCreate = true;
    t_bFlagCreateInBuf = false;
    t_bFlagCreateOutBuf = false;
    t_bFlagExcute = false;

    t_iPlaneNum = 0;

    return ERROR_NONE;
}