📄 umc_h264_slice_decoding.h
字号:
/*
//
// 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) 2003-2007 Intel Corporation. All Rights Reserved.
//
//
*/
#include "umc_defs.h"
#if defined (UMC_ENABLE_H264_VIDEO_DECODER)
#ifndef __UMC_H264_SLICE_DECODING_H
#define __UMC_H264_SLICE_DECODING_H
#include "umc_h264_dec_defs_dec.h"
#include "umc_h264_dec.h"
#include "umc_h264_bitstream.h"
#include "umc_automatic_mutex.h"
#include "umc_event.h"
#include "umc_h264_heap.h"
namespace UMC
{
class H264DBPList;
class H264DecoderFrameList;
// Slice decoding constant
enum
{
MINIMUM_NUMBER_OF_ROWS = 4,
MAXIMUM_NUMBER_OF_ROWS = 8,
MB_BUFFER_SIZE = 480,
NUMBER_OF_PIECES = 8,
NUMBER_OF_DEBLOCKERS = 2
};
// Task ID enumerator
enum
{
// whole slice is processed
TASK_PROCESS = 0,
// piece of slice is decoded
TASK_DEC,
// piece of future frame's slice is decoded
TASK_REC,
// whole slice is deblocked
TASK_DEB_SLICE,
// piece of slice is deblocked
TASK_DEB,
// piece of slice is deblocked by several threads
TASK_DEB_THREADED,
// whole frame is deblocked (when there is the slice groups)
TASK_DEB_FRAME,
// whole frame is deblocked (when there is the slice groups)
TASK_DEB_FRAME_THREADED,
// //whole frame is deblocked (when there is the slice groups)
TASK_DEC_REC
};
// forward declaration of internal types
struct H264RefListInfo;
typedef Ipp16s FactorArrayValue;
struct FactorArray
{
FactorArrayValue values[MAX_NUM_REF_FRAMES][MAX_NUM_REF_FRAMES];
};
struct FactorArrayMV
{
FactorArrayValue values[MAX_NUM_REF_FRAMES];
};
struct FactorArrayAFF
{
FactorArrayValue values[MAX_NUM_REF_FRAMES][2][2][2][MAX_NUM_REF_FRAMES];
};
struct FactorArrayMVAFF
{
FactorArrayValue values[2][2][2][MAX_NUM_REF_FRAMES];
};
class H264Task;
class H264MemoryPiece;
class H264DecoderFrameInfo;
class H264ThreadedDeblockingTools
{
public:
// Default constructor
H264ThreadedDeblockingTools(void);
// Destructor
virtual ~H264ThreadedDeblockingTools(void);
// Initialize tools
bool Init(Ipp32s iConsumerNumber);
// Reset tools when threaded deblocking is started
void Reset(Ipp32s iFirstMB, Ipp32s iMaxMB, Ipp32s iDebUnit, Ipp32s iMBWidth);
// Get next task
bool GetMBToProcess(H264Task *pTask);
// Set deblocked macroblocks
void SetProcessedMB(H264Task *pTask);
// Ask current segment deblocking finish
bool IsDeblockingDone(void);
protected:
// Release object
void Release(void);
// Get next task for currect thread
bool GetMB(Ipp32s iThreadNumber, Ipp32s &iFirstMB, Ipp32s &iMBToProcess);
// Set deblocked macroblocks for current thread
void SetMB(Ipp32s iThreadNumber, Ipp32s iFirstMB, Ipp32s iMBToProcess);
Ipp32s m_iConsumerNumber; // (Ipp32s) number of consumers
H264Array<Ipp32s> m_iCurMBToDeb; // (H264Array<Ipp32s>) array of current MB number to de-blocking
Ipp32s m_iMaxMB; // (Ipp32s) maximum MB number in slice
Ipp32s m_iDebUnit; // (Ipp32s) minimal unit of deblocking process
Ipp32s m_iMBWidth; // (Ipp32s) width of MB row
H264Array<bool> m_bThreadWorking; // (H264Array<bool>) array of "thread does threaded deblocking" flag for threaded version
};
class H264_DXVA_Driver_SegmentDecoder;
class H264DecoderFrameInfo;
class H264Slice
{
// It is OK. H264SliceStore is owner of H264Slice object.
// He can do what he wants.
friend class H264SegmentDecoderMultiThreaded;
friend class H264_DXVA_Driver_SegmentDecoder;
friend class H264_DXVA_SegmentDecoderCommon;
friend class TaskSupplier;
friend class TaskBroker;
friend class TaskBrokerTwoThread;
friend class H264DecoderFrameInfo;
friend void PrintInfoStatus(H264DecoderFrameInfo * info);
public:
// Default constructor
H264Slice();
H264Slice(MemoryAllocator *pMemoryAllocator);
// Destructor
virtual
~H264Slice(void);
// Initialize slice
bool Init(Ipp32s iConsumerNumber);
// Set slice source data
bool Reset(void *pSource, size_t nSourceSize, Ipp32s iConsumerNumber);
// Set slice source data only analyze to owning slice pictures
bool ResetLimited(void *pSource, size_t nSourceSize);
// Set current slice number
void SetSliceNumber(Ipp32s iSliceNumber);
Ipp32s RetrievePicParamSetNumber(void *pSource, size_t nSourceSize);
//
// method(s) to obtain slice specific information
//
// Obtain pointer to slice header
const H264SliceHeader *GetSliceHeader(void) const {return &m_SliceHeader;}
H264SliceHeader *GetSliceHeader(void) {return &m_SliceHeader;}
// Obtain bit stream object
H264Bitstream *GetBitStream(void){return &m_BitStream;}
// Obtain bit stream object
H264Bitstream *GetBitStreamDXVA(void){return &m_BitStream_DXVA;}
// Obtain prediction weigth table
const PredWeightTable *GetPredWeigthTable(Ipp32s iNum) const {return m_PredWeight[iNum & 1];}
// Obtain first MB number
Ipp32s GetFirstMBNumber(void) const {return m_iFirstMBFld;}
void SetFirstMBNumber(Ipp32s x) {m_iFirstMB = x;}
// Obtain MB width
Ipp32s GetMBWidth(void) const {return m_iMBWidth;}
// Obtain MB row width
Ipp32s GetMBRowWidth(void) const {return (m_iMBWidth * (m_SliceHeader.MbaffFrameFlag + 1));}
// Obtain MB height
Ipp32s GetMBHeight(void) const {return m_iMBHeight;}
// Obtain current picture parameter set number
Ipp32s GetPicParamSet(void) const {return m_pPicParamSet->pic_parameter_set_id;}
// Obtain current sequence parameter set number
Ipp32s GetSeqParamSet(void) const {return m_pSeqParamSet->seq_parameter_set_id;}
// Obtain current picture parameter set
H264PicParamSet *GetPicParam(void){return m_pPicParamSet;}
// Obtain current sequence parameter set
H264SeqParamSet *GetSeqParam(void){return m_pSeqParamSet;}
// Obtain current sequence extension parameter set
H264SeqParamSetExtension *GetSeqParamEx(void){return m_pSeqParamSetEx;}
// Obtain current destination frame
H264DecoderFrame *GetCurrentFrame(void){return m_pCurrentFrame;}
// Obtain slice number
Ipp32s GetSliceNum(void) const {return m_iNumber;}
// Obtain owning slice field index
Ipp32s GetFieldIndex(void) const {return m_field_index;}
// Need to check slice edges
bool NeedToCheckSliceEdges(void) const {return m_bNeedToCheckMBSliceEdges;}
// Do we can doing deblocking
bool GetDeblockingCondition(void) const;
// Obtain scale factor arrays
FactorArray *GetDistScaleFactor(void){return &m_DistScaleFactor;}
FactorArrayMV *GetDistScaleFactorMV(void){return &m_DistScaleFactorMV;}
FactorArrayAFF *GetDistScaleFactorAFF(void){return m_DistScaleFactorAFF;}
FactorArrayMVAFF *GetDistScaleFactorMVAFF(void){return m_DistScaleFactorMVAFF;}
// Obtain maximum of macroblock
Ipp32s GetMaxMB(void) const {return m_iMaxMB;}
void SetMaxMB(Ipp32s x) {m_iMaxMB = x;}
Ipp32s GetMBCount() const { return m_iMaxMB - m_iFirstMB;}
// Obtain local MB information
H264DecoderLocalMacroblockDescriptor &GetMBInfo(void){return *m_mbinfo;}
// Obtain pointer to MB intra types
IntraType *GetMBIntraTypes(void){return m_pMBIntraTypes;}
// Check field slice
bool IsField() const {return m_SliceHeader.field_pic_flag != 0;}
// Check top field slice
bool IsTopField() const {return m_SliceHeader.bottom_field_flag == 0;}
// Check top field slice
bool IsBottomField() const {return !IsTopField();}
// Check slice organization
bool IsSliceGroups(void) const {return (1 < m_pPicParamSet->num_slice_groups);};
// Is slice's size unknown
bool IsSizeUnknown(void) const {return m_bUnknownSize;};
// Do we require to do deblocking through slice boundaries
bool DeblockThroughBoundaries(void) const {return (DEBLOCK_FILTER_ON_NO_SLICE_EDGES != m_SliceHeader.disable_deblocking_filter_idc);};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -