📄 umc_avs_dec_processing_unit_decrec.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_decrec.h"
#include "umc_automatic_mutex.h"
#include "umc_mutex.h"
namespace UMC
{
AVSDecRecProcessingUnit::AVSDecRecProcessingUnit(void)
{
} // AVSDecRecProcessingUnit::AVSDecRecProcessingUnit(void)
AVSDecRecProcessingUnit::~AVSDecRecProcessingUnit(void)
{
} // AVSDecRecProcessingUnit::~AVSDecRecProcessingUnit(void)
bool AVSDecRecProcessingUnit::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_bDecVacant) &&
(pSlice->m_bRecVacant) &&
(pSlice->m_decCtx.MbIndex == pSlice->m_recCtx.MbIndex) &&
(pSlice->m_decCtx.MbIndex < pSlice->m_decCtx.MbLast))
{
Ipp16s *pCoeffsBuffer = pSlice->GetFree();
// this slice is uncomplete,
// wrap it around and go work.
if (pCoeffsBuffer)
{
pSlice->m_decCtx.m_pCoeffs = pCoeffsBuffer;
m_decompressor.SetDecodingContext(pSlice->m_decCtx);
pSlice->m_bDecVacant = false;
pSlice->m_recCtx.m_pCoeffs = pCoeffsBuffer;
m_decompressor.SetReconstructingContext(pSlice->m_recCtx);
pSlice->m_bRecVacant = 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 AVSDecRecProcessingUnit::LoadJob(AVSListElement<AVSFrame> *pFrameList)
void AVSDecRecProcessingUnit::DoJob(void)
{
// do decompression
switch (m_decompressor.GetDecodingContext().m_pPicHeader->PictureType)
{
case AVS_I_PICTURE:
m_decompressor.DecompressIMacroBlocksRow();
break;
case AVS_P_PICTURE:
m_decompressor.DecompressPMacroBlocksRow();
break;
default:
m_decompressor.DecompressBMacroBlocksRow();
break;
};
// finalize processed task
UnloadJob();
} // void AVSDecRecProcessingUnit::DoJob(void)
void AVSDecRecProcessingUnit::HandleError(void)
{
AutomaticMutex guard(m_pGuard->ExtractHandle());
AVSSlice *pSlice;
pSlice = m_decompressor.GetDecodingContext().m_pSlice;
// drop the slice's flags
pSlice->m_bDecVacant = true;
pSlice->m_bRecVacant = true;
pSlice->m_bError = true;
} // void AVSDecRecProcessingUnit::HandleError(void)
AVSTaskID AVSDecRecProcessingUnit::GetTaskID(void)
{
return AVS_TASK_DECODING;
} // AVSTaskID AVSDecRecProcessingUnit::GetTaskID(void)
void AVSDecRecProcessingUnit::UnloadJob(void)
{
AVSSlice *pSlice;
pSlice = m_decompressor.GetDecodingContext().m_pSlice;
// reflect changes to the slice
{
AutomaticMutex guard(m_pGuard->ExtractHandle());
pSlice->m_decCtx = m_decompressor.GetDecodingContext();
pSlice->m_bDecVacant = true;
pSlice->m_recCtx = m_decompressor.GetReconstructingContext();
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 AVSDecRecProcessingUnit::UnloadJob(void)
} // namespace UMC
#endif // #if defined(UMC_ENABLE_AVS_VIDEO_DECODER)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -