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

📄 umc_avs_dec_processing_unit_deb.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_deb.h"

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

namespace UMC
{

AVSDebProcessingUnit::AVSDebProcessingUnit(void)
{

} // AVSDebProcessingUnit::AVSDebProcessingUnit(void)

AVSDebProcessingUnit::~AVSDebProcessingUnit(void)
{

} // AVSDebProcessingUnit::~AVSDebProcessingUnit(void)

bool AVSDebProcessingUnit::LoadJob(AVSListElement<AVSFrame> *pFrameList)
{
    eAVSPicStructure field = AVS_UPPER_FIELD;

    // run over frame list and find an unparsed slice
    while (pFrameList)
    {
        AVSListElement<AVSSlice> *pSlice;

        if (AVS_FRAME == pFrameList->m_picStructure)
        {
            pSlice = pFrameList->m_Slices.GetHead();
        }
        else
        {
            pSlice = pFrameList->GetPicture(field)->m_Slices.GetHead();
        }

        // run over slice list and find an unparsed slice
        while (pSlice)
        {
            if ((false == pSlice->m_bError) &&
                (pSlice->m_bDebVacant) &&
                (pSlice->m_debCtx.MbIndex < pSlice->m_debCtx.MbLast) &&
                ((pSlice->m_recCtx.MbIndex - pSlice->m_debCtx.MbIndex >= pSlice->m_debCtx.MbWidth * 2) ||
                (pSlice->m_recCtx.MbIndex == pSlice->m_debCtx.MbLast)) )
            {
                // this slice is uncomplete,
                // wrap it around and go work.

                m_deblocker.SetDeblockingContext(pSlice->m_debCtx);
                pSlice->m_bDebVacant = false;

                return true;
            }

            pSlice = pSlice->GetNext();
        }

        // get next frame only if both fields of the current were inspected
        if ((AVS_FRAME == pFrameList->m_picStructure) ||
            (AVS_LOWER_FIELD == field))
        {
            pFrameList = pFrameList->GetNext();
            field = AVS_UPPER_FIELD;
        }
        else
        {
            field = AVS_LOWER_FIELD;
        }
    }

    return false;

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

void AVSDebProcessingUnit::DoJob(void)
{
    // do deblocking manipulation
    switch (m_deblocker.GetDeblockingContext().m_pPicHeader->PictureType)
    {
    case AVS_I_PICTURE:
        m_deblocker.DeblockIMacroBlocksRow();
        break;

    case AVS_P_PICTURE:
    case AVS_B_PICTURE:
        m_deblocker.DeblockPBMacroBlocksRow();
        break;
    default:
        break;
    };

    // finalize processed task
    UnloadJob();

} // void AVSDebProcessingUnit::DoJob(void)

void AVSDebProcessingUnit::HandleError(void)
{

} // void AVSDebProcessingUnit::HandleError(void)

AVSTaskID AVSDebProcessingUnit::GetTaskID(void)
{
    return AVS_TASK_DEBLOCKING;

} // AVSTaskID AVSDebProcessingUnit::GetTaskID(void)

void AVSDebProcessingUnit::UnloadJob(void)
{
    AVSSlice *pSlice;

    pSlice = m_deblocker.GetDeblockingContext().m_pSlice;

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

        pSlice->m_debCtx = m_deblocker.GetDeblockingContext();
        pSlice->m_bDebVacant = true;

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

} // void AVSDebProcessingUnit::UnloadJob(void)

} // namespace UMC

#endif // #if defined(UMC_ENABLE_AVS_VIDEO_DECODER)

⌨️ 快捷键说明

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