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

📄 umc_avs_dec_processing_unit_rec.cpp

📁 audio-video-codecs.rar语音编解码器
💻 CPP
字号:
/*
//
//              INTEL CORPORATION PROPRIETARY INFORMATION
//  This software is supplied under the terms of a license  agreement or
//  nondisclosure agreement with Intel Corporation and may not be copied
//  or disclosed except in  accordance  with the terms of that agreement.
//    Copyright (c) 2007 Intel Corporation. All Rights Reserved.
//
//
*/

#include "umc_defs.h"
#if defined(UMC_ENABLE_AVS_VIDEO_DECODER)

#include "umc_avs_dec_processing_unit_rec.h"

#include "umc_automatic_mutex.h"
#include "umc_mutex.h"

namespace UMC
{

AVSRecProcessingUnit::AVSRecProcessingUnit(void)
{

} // AVSRecProcessingUnit::AVSRecProcessingUnit(void)

AVSRecProcessingUnit::~AVSRecProcessingUnit(void)
{

} // AVSRecProcessingUnit::~AVSRecProcessingUnit(void)

bool AVSRecProcessingUnit::LoadJob(AVSListElement<AVSFrame> *pFrameList)
{
    // run over frame list and find an unparsed slice
    while (pFrameList)
    {
        AVSListElement<AVSSlice> *pSlice = pFrameList->m_Slices.GetHead();

        // run over slice list and find an unparsed slice
        while (pSlice)
        {
            if ((false == pSlice->m_bError) &&
                (pSlice->m_bRecVacant) &&
                (pSlice->m_recCtx.MbIndex < pSlice->m_recCtx.MbLast))
            {
                Ipp16s *pCoeffsBuffer = pSlice->GetUsed();

                // this slice is uncomplete,
                // wrap it around and go work.
                if (pCoeffsBuffer)
                {
                    pSlice->m_recCtx.m_pCoeffs = pCoeffsBuffer;
                    m_decompressor.SetReconstructingContext(pSlice->m_recCtx);
                    pSlice->m_bRecVacant = false;

                    return true;
                }
            }

            pSlice = pSlice->GetNext();
        }

        pFrameList = pFrameList->GetNext();
    }

    return false;

} // bool AVSRecProcessingUnit::LoadJob(AVSListElement<AVSFrame> *pFrameList)

void AVSRecProcessingUnit::DoJob(void)
{
    // do reconstruction
    switch (m_decompressor.GetReconstructingContext().m_pPicHeader->PictureType)
    {
    case AVS_I_PICTURE:
        m_decompressor.ReconstructIMacroBlocksRow();
        break;

    case AVS_P_PICTURE:
        m_decompressor.ReconstructPMacroBlocksRow();
        break;

    default:
        m_decompressor.ReconstructBMacroBlocksRow();
        break;
    };

    // finalize processed task
    UnloadJob();

} // void AVSRecProcessingUnit::DoJob(void)

void AVSRecProcessingUnit::HandleError(void)
{
    AutomaticMutex guard(m_pGuard->ExtractHandle());
    AVSSlice *pSlice;

    pSlice = m_decompressor.GetReconstructingContext().m_pSlice;

    // drop the slice's flags
    pSlice->m_bRecVacant = true;
    pSlice->m_bError = true;

} // void AVSRecProcessingUnit::HandleError(void)

AVSTaskID AVSRecProcessingUnit::GetTaskID(void)
{
    return AVS_TASK_RECONSTRUCTION;

} // AVSTaskID AVSRecProcessingUnit::GetTaskID(void)

void AVSRecProcessingUnit::UnloadJob(void)
{
    AVS_RECONSTRUCTING_CONTEXT &recCtx = m_decompressor.GetReconstructingContext();
    AVSSlice *pSlice;

    pSlice = recCtx.m_pSlice;

    // reflect changes to the slice
    {
        AutomaticMutex guard(m_pGuard->ExtractHandle());

        pSlice->AdvanceUsed(recCtx.m_pCoeffs - pSlice->m_recCtx.m_pCoeffs);
        pSlice->m_recCtx = recCtx;
        pSlice->m_bRecVacant = true;

        // move exhausted slice to other queue
        if ((pSlice->m_recCtx.m_pPicHeader->loop_filter_disable) &&
            (pSlice->m_recCtx.MbIndex == pSlice->m_recCtx.MbLast))
        {
            pSlice->m_pPic->MarkSliceAsDone(pSlice);
        }
    }

} // void AVSRecProcessingUnit::UnloadJob(void)

} // namespace UMC

#endif // #if defined(UMC_ENABLE_AVS_VIDEO_DECODER)

⌨️ 快捷键说明

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