to use CAVLC you must use the extended encoding options feature of Intel Media SDK.
See below for an example on to implement this. Please refer to Intel Media SDK samples for details on common code.
//
// In containing class declaration
//
mfxExtBuffer* m_pExtBuf[1];
mfxExtCodingOption m_ExtCO;
mfxVideoParam m_mfxParamsVideo;
//
// In section of code initializing encoder video paramters
//
memset(&m_ExtCO, 0, sizeof(mfxExtCodingOption));
m_ExtCO.Header.BufferId = MFX_EXTBUFF_CODING_OPTION;
m_ExtCO.Header.BufferSz = sizeof(mfxExtCodingOption);
m_ExtCO.CAVLC = MFX_CODINGOPTION_ON;
m_mfxParamsVideo.ExtParam = m_pExtBuf;
m_pExtBuf[0] = (mfxExtBuffer*)&(m_ExtCO);
m_mfxParamsVideo.NumExtParam = 1;
//
// Call to query the encoder
// (note: make sure to also reference the extended buffer from the Query out structure)
mfxVideoParam actualParams;
actualParams.ExtParam = m_mfxParamsVideo.ExtParam;
actualParams.NumExtParam = m_mfxParamsVideo.NumExtParam;
sts = m_pmfxEnc->Query(&m_mfxParamsVideo, &actualParams);
//
// Alternatively if you use encoder Init without Query
//
sts = m_pmfxEnc->Init(&m_mfxParamsVideo);