⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mp4decvopi.c

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 C
📖 第 1 页 / 共 4 页
字号:
                    // reset B-prediction blocks on new row                    mp4_ResetIntraPredBblock(pInfo);                }                if (mp4_DecodeMCBPC_I(pInfo, &mb_type, &cbpc) != MP4_STATUS_OK)                    return MP4_STATUS_ERROR;                if (mb_type != IPPVC_MB_STUFFING) {                    ac_pred_flag = mp4_GetBit(pInfo);                    if (mp4_DecodeCBPY_I(pInfo, &cbpy) != MP4_STATUS_OK)                        return MP4_STATUS_ERROR;                    quantPred = quant;                    if (mb_type == IPPVC_MBTYPE_INTRA_Q)                        mp4_UpdateQuant(pInfo, quant);                    if (mbCurr == 0)                        quantPred = quant;                    dcVLC = (quantPred < mp4_DC_vlc_Threshold[pInfo->VisualObject.VideoObject.VideoObjectPlane.intra_dc_vlc_thr]) ? 1 : 0;                    if (pInfo->VisualObject.VideoObject.interlaced) {                        dct_type = mp4_GetBit(pInfo);                        if (dct_type) {                            stepY = stepYc * 2;                            pYoff23 = stepYc;                        } else {                            stepY = stepYc;                            pYoff23 = 8 * stepYc;                        }                        stepFc[0] = stepFc[1] = stepFc[2] = stepFc[3] = stepY;                    }                    pFc[2] = pFc[0] + pYoff23; pFc[3] = pFc[1] + pYoff23;                    if (mp4_DecodeIntraMB(pInfo, colNum, (cbpy << 2) + cbpc, quant, dcVLC, ac_pred_flag, pFc, stepFc) != MP4_STATUS_OK) {                        mp4_Error("Error when decode coefficients of Intra block");                        return MP4_STATUS_ERROR;                    }                    mp4_StatisticInc_(&pInfo->VisualObject.Statistic.nMB);                    mbCurr ++;                    if (mbCurr == nmb) {                        // skip stuffing                        while (mp4_ShowBits9(pInfo, 9) == 1)                            mp4_FlushBits(pInfo, 9);                        return MP4_STATUS_OK;                    }                    mbInVideoPacket ++;                    colNum ++;                    if (colNum == mbPerRow) {                        colNum = 0;                        rowNum ++;                        pFc[0] += 3 * MP4_NUM_EXT_MB * 16 + (stepYc << 4) - stepYc;                        pFc[1] += 3 * MP4_NUM_EXT_MB * 16 + (stepYc << 4) - stepYc;                        pFc[4] += 3 * MP4_NUM_EXT_MB * 8 + (stepCbc << 3) - stepCbc;                        pFc[5] += 3 * MP4_NUM_EXT_MB * 8 + (stepCrc << 3) - stepCrc;                    } else {                        pFc[0] += 16; pFc[1] += 16; pFc[4] += 8; pFc[5] += 8;                    }                }                if (!pInfo->VisualObject.VideoObject.resync_marker_disable) {                    int  found;                    if (mp4_DecodeVideoPacket(pInfo, &quant, &found) == MP4_STATUS_OK) {                        if (found)                            break;                    } else                        return MP4_STATUS_ERROR;                }            }        }    }}#ifdef _OMP_KARABASstatic mp4_Status mp4_DecodeVOP_I_DecodeSlice(mp4_Info* pInfo, int curRow, mp4_MacroBlockMT* pMBinfoMT){    int  mb_type, cbpc, cbpy, quant, quantPred, ac_pred_flag, dcVLC;    int  j, mbPerRow, pat;    mbPerRow = pInfo->VisualObject.VideoObject.MacroBlockPerRow;    if (pInfo->VisualObject.VideoObject.short_video_header) {        quant = pInfo->VisualObject.VideoObject.VideoObjectPlaneH263.vop_quant;        for (j = 0; j < mbPerRow; j ++) {            do {                if (mp4_DecodeMCBPC_I(pInfo, &mb_type, &cbpc) != MP4_STATUS_OK)                    return MP4_STATUS_ERROR;            } while (mb_type == IPPVC_MB_STUFFING);            if (mp4_DecodeCBPY_I(pInfo, &cbpy) != MP4_STATUS_OK)                return MP4_STATUS_ERROR;            if (mb_type == IPPVC_MBTYPE_INTRA_Q)                mp4_UpdateQuant(pInfo, quant);            pat = (cbpy << 2) + cbpc;            mp4_ReconstructCoeffsIntraMB_SVH(pInfo, pMBinfoMT->dctCoeffs, pMBinfoMT->lnz, pat, quant);            mp4_StatisticInc_(&pInfo->VisualObject.Statistic.nMB);            pMBinfoMT ++;            mp4_CheckDecodeGOB_SVH(pInfo, pInfo->VisualObject.VideoObject.VideoObjectPlaneH263.nmb, pInfo->VisualObject.VideoObject.VideoObjectPlaneH263.frGOB, curRow, quant);        }        pInfo->VisualObject.VideoObject.VideoObjectPlaneH263.vop_quant = quant;    } else {        // reset B-prediction blocks on new row        mp4_ResetIntraPredBblock(pInfo);        quant = quantPred = pInfo->VisualObject.VideoObject.VideoObjectPlane.quant;        for (j = 0; j < mbPerRow;) {            if (mp4_DecodeMCBPC_I(pInfo, &mb_type, &cbpc) != MP4_STATUS_OK)                return MP4_STATUS_ERROR;            if (mb_type != IPPVC_MB_STUFFING) {                ac_pred_flag = mp4_GetBit(pInfo);                if (mp4_DecodeCBPY_I(pInfo, &cbpy) != MP4_STATUS_OK)                    return MP4_STATUS_ERROR;                quantPred = quant;                if (mb_type == IPPVC_MBTYPE_INTRA_Q)                    mp4_UpdateQuant(pInfo, quant);                if (curRow == 0 && j == 0)                    quantPred = quant;                dcVLC = (quantPred < mp4_DC_vlc_Threshold[pInfo->VisualObject.VideoObject.VideoObjectPlane.intra_dc_vlc_thr]) ? 1 : 0;                if (pInfo->VisualObject.VideoObject.interlaced)                    pMBinfoMT->dct_type = (Ipp8u)mp4_GetBit(pInfo);                pat = (cbpy << 2) + cbpc;                if (mp4_ReconstructCoeffsIntraMB(pInfo, j, pat, quant, dcVLC, ac_pred_flag, pMBinfoMT->dctCoeffs, pMBinfoMT->lnz) != MP4_STATUS_OK) {                    mp4_Error("Error when decode coefficients of Intra block");                    return MP4_STATUS_ERROR;                }                mp4_StatisticInc_(&pInfo->VisualObject.Statistic.nMB);                pMBinfoMT ++;                j ++;            }            if (!pInfo->VisualObject.VideoObject.resync_marker_disable) {                int  found;                if (mp4_DecodeVideoPacket(pInfo, &quant, &found) == MP4_STATUS_OK) {                    if (found) {                        // reset Intra prediction buffer on new Video_packet                        mp4_ResetIntraPredBuffer(pInfo);                    }                } else                    return MP4_STATUS_ERROR;            }        }        pInfo->VisualObject.VideoObject.VideoObjectPlane.quant = quant;    }    return MP4_STATUS_OK;}static void mp4_DecodeVOP_I_ReconSlice(mp4_Info* pInfo, int curRow, mp4_MacroBlockMT* pMBinfoMT){    int    j, stepYc, stepCbc, stepCrc, mbPerRow, stepFc[6];    Ipp8u  *pYc, *pCbc, *pCrc, *pFc[6];    mbPerRow = pInfo->VisualObject.VideoObject.MacroBlockPerRow;    stepYc = pInfo->VisualObject.cFrame.stepY;    stepCbc = pInfo->VisualObject.cFrame.stepCb;    stepCrc = pInfo->VisualObject.cFrame.stepCr;    pYc = pInfo->VisualObject.cFrame.pY   + curRow * 16 * stepYc;    pCbc = pInfo->VisualObject.cFrame.pCb + curRow * 8 * stepCbc;    pCrc = pInfo->VisualObject.cFrame.pCr + curRow * 8 * stepCrc;    stepFc[0] = stepFc[1] = stepFc[2] = stepFc[3] = stepYc; stepFc[4] = stepCbc; stepFc[5] = stepCrc;    pFc[0] = pYc; pFc[1] = pYc + 8; pFc[2] = pYc + 8 * stepYc; pFc[3] = pYc + 8 * stepYc + 8; pFc[4] = pCbc; pFc[5] = pCrc;    if (pInfo->VisualObject.VideoObject.short_video_header) {        for (j = 0; j < mbPerRow; j ++) {            mp4_DCTInvCoeffsIntraMB(pMBinfoMT->dctCoeffs, pMBinfoMT->lnz, pFc, stepFc);            pMBinfoMT ++;            pFc[0] += 16; pFc[1] += 16; pFc[2] += 16; pFc[3] += 16; pFc[4] += 8; pFc[5] += 8;        }    } else {        int   stepY, pYoff23, interlaced;        stepY = stepYc;        pYoff23 = 8 * stepYc;        interlaced = pInfo->VisualObject.VideoObject.interlaced;        for (j = 0; j < mbPerRow; j ++) {            if (interlaced) {                if (pMBinfoMT->dct_type) {                    stepY = stepYc * 2;                    pYoff23 = stepYc;                } else {                    stepY = stepYc;                    pYoff23 = 8 * stepYc;                }                stepFc[0] = stepFc[1] = stepFc[2] = stepFc[3] = stepY;            }            pFc[2] = pFc[0] + pYoff23; pFc[3] = pFc[1] + pYoff23;            mp4_DCTInvCoeffsIntraMB(pMBinfoMT->dctCoeffs, pMBinfoMT->lnz, pFc, stepFc);            pMBinfoMT ++;            pFc[0] += 16; pFc[1] += 16; pFc[4] += 8; pFc[5] += 8;        }    }}mp4_Status mp4_DecodeVOP_I_MT(mp4_Info* pInfo){    int        i, mbPerCol, mbPerRow;    mp4_Status sts = MP4_STATUS_OK;    mbPerCol = pInfo->VisualObject.VideoObject.MacroBlockPerCol;    mbPerRow = pInfo->VisualObject.VideoObject.MacroBlockPerRow;    if (pInfo->VisualObject.VideoObject.short_video_header) {        pInfo->VisualObject.VideoObject.VideoObjectPlaneH263.gob_number = 0;        pInfo->VisualObject.VideoObject.VideoObjectPlaneH263.nmb = 0;        pInfo->VisualObject.VideoObject.VideoObjectPlaneH263.frGOB = 0;    } else {        mp4_ResetIntraPredBuffer(pInfo);        if (pInfo->VisualObject.VideoObject.sprite_enable != MP4_SPRITE_STATIC)            ippsZero_8u((Ipp8u*)pInfo->VisualObject.VideoObject.MBinfo, pInfo->VisualObject.VideoObject.MacroBlockPerVOP * sizeof(mp4_MacroBlock));    }    i = 0;#ifdef _OPENMP#pragma  omp parallel shared(pInfo, i, mbPerCol, mbPerRow, sts) num_threads(2)#endif    {        int               idThread = 0;   /* the thread id of the calling thread. */        int               curRow;        mp4_MacroBlockMT* pMBinfoMT;#ifdef _OPENMP        idThread = omp_get_thread_num();#endif        pMBinfoMT = pInfo->pMBinfoMT + mbPerRow * idThread;        curRow = i;        while (curRow < mbPerCol) {#ifdef _OPENMP#pragma omp critical(HI_FOXY)#endif            {                curRow = i;                i ++;                if (curRow < mbPerCol)                    if (mp4_DecodeVOP_I_DecodeSlice(pInfo, curRow, pMBinfoMT) != MP4_STATUS_OK) {                        sts = MP4_STATUS_ERROR;                        curRow = mbPerCol;                    }            }            if (curRow < mbPerCol)                if (sts == MP4_STATUS_OK)                    mp4_DecodeVOP_I_ReconSlice(pInfo, curRow, pMBinfoMT);            curRow ++;        }    }    if (pInfo->VisualObject.VideoObject.short_video_header)        mp4_AlignBits(pInfo);    else {        // skip stuffing        while (mp4_ShowBits(pInfo, 9) == 1)            mp4_FlushBits(pInfo, 9);    }    return sts;}#endif // _OMP_KARABAS

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -