MBOOL
PREFEATUREABSE::
queryMpoSize(MPImageInfo * pMPImageInfo, MUINT32 num, MUINT32 MPOType, MUINT32 &mpoSize)
{
    MINT32 err = NO_ERROR;
    MBOOL ok;
    MpoEncoder* mpoEncoder = new MpoEncoder();
    if (mpoEncoder) {
        ok = mpoEncoder->setJpegSources(TYPE_Disparity, pMPImageInfo, num);

        if (!ok) {
            MY_LOGE("  mpoEncoder->setJpegSources fail \n");
            err = 1;
            goto mHalCamMAVMakeMPO_EXIT;
        }

        mpoSize = mpoEncoder->getBufferSize();

        MY_LOGD("mpoSize %d", mpoSize);
    }
    else
    {
        MY_LOGD("new MpoEncoder() fail");
        return false;
    }

mHalCamMAVMakeMPO_EXIT:
    delete mpoEncoder;
    if(err!=NO_ERROR)
        return false;
    else
        return true;
}
MBOOL
PREFEATUREABSE::
createMPOInMemory(MPImageInfo * pMPImageInfo, MUINT32 num, MUINT32 MPOType, MUINT8* mpoBuffer)
{
    MINT32 err = NO_ERROR;
    MBOOL ok;
    MpoEncoder* mpoEncoder = new MpoEncoder();
    if (mpoEncoder) {
        ok = mpoEncoder->setJpegSources(TYPE_Disparity, pMPImageInfo, num);

        if (!ok) {
            MY_LOGE("  mpoEncoder->setJpegSources fail \n");
            err = 1;
            goto mHalCamMAVMakeMPO_EXIT;
        }

        if(!mpoBuffer) {
            MY_LOGE("  malloc fail\n");
            err = 1;
            goto mHalCamMAVMakeMPO_EXIT;
        }

        ok = mpoEncoder->encodeToMemory(mpoBuffer, MPOType);
        //dumpBufToFile("/sdcard/test.mpo", mem, mpoSize);


        if (!ok) {
            MY_LOGE("  mpoEncoder->encode fail \n");
            err = 1;
            goto mHalCamMAVMakeMPO_EXIT;
        }

        MY_LOGD("[createMPOInMemory] Done\n");
    }
    else
    {
        MY_LOGD("new MpoEncoder() fail");
        return false;
    }

mHalCamMAVMakeMPO_EXIT:
    delete mpoEncoder;
    if(err!=NO_ERROR)
        return false;
    else
        return true;
}
MBOOL
PREFEATUREABSE::
createMPO(MPImageInfo * pMPImageInfo, MUINT32 num, char* file, MUINT32 MPOType)
{
    MINT32 err = NO_ERROR;
    MBOOL ok;
    MpoEncoder* mpoEncoder = new MpoEncoder();
    if (mpoEncoder) {
        ok = mpoEncoder->setJpegSources(TYPE_Disparity, pMPImageInfo, num);

        if (!ok) {
            MY_LOGE("  mpoEncoder->setJpegSources fail \n");
            err = 1;
            goto mHalCamMAVMakeMPO_EXIT;
        }

        ok = mpoEncoder->encode(file);

        if (!ok) {
            MY_LOGE("  mpoEncoder->encode fail \n");
            err = 1;
            goto mHalCamMAVMakeMPO_EXIT;
        }
        
        MY_LOGD("[mHalCamMAVMakeMPO] Done, %s \n", file);
    }
    else
    {
        MY_LOGD("new MpoEncoder() fail");
        return false;
    }
 
mHalCamMAVMakeMPO_EXIT:
    delete mpoEncoder;
    delete [] pMPImageInfo;  
    if(err!=NO_ERROR)        
        return false;
    else
        return true;
}