openh264/codec/encoder/core/inc/slice.h

186 lines
5.7 KiB
C
Raw Normal View History

2013-12-09 13:51:09 +01:00
/*!
* \copy
* Copyright (c) 2013, Cisco Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
//wels_slice.h
#ifndef WELS_SLICE_H__
#define WELS_SLICE_H__
#include "typedefs.h"
#include "wels_const.h"
#include "wels_common_basis.h"
#include "mb_cache.h"
#include "picture.h"
#include "parameter_sets.h"
#include "svc_enc_slice_segment.h"
#include "bit_stream.h"
namespace WelsSVCEnc {
/*******************************sub struct of slice header****************************/
/*
* Reference picture list reordering syntax, refer to page 64 in JVT X201wcm
*/
typedef struct TagRefPicListReorderSyntax {
2014-06-26 03:50:41 +02:00
struct {
uint32_t uiAbsDiffPicNumMinus1; //uiAbsDiffPicNumMinus1 SHOULD be in the range of [4, (1<<pSps->uiLog2MaxFrameNum)-1], {p104, JVT-X201wcm1}
//but int8_t can't cover the range, SHOULD modify it.
uint16_t iLongTermPicNum;
uint16_t uiReorderingOfPicNumsIdc; //in order to pack 2-uint16_t into 1-(u)int32_t, so modify the type into uint16_t.
} SReorderingSyntax[MAX_REFERENCE_REORDER_COUNT_NUM]; // MAX_REF_PIC_COUNT
} SRefPicListReorderSyntax;
2013-12-09 13:51:09 +01:00
/* Decoded reference picture marking syntax, refer to Page 66 in JVT X201wcm */
typedef struct TagRefPicMarking {
2014-06-26 03:50:41 +02:00
struct {
int32_t iMmcoType;
int32_t iShortFrameNum;
int32_t iDiffOfPicNum;
int32_t iLongTermPicNum;
int32_t iLongTermFrameIdx;
int32_t iMaxLongTermFrameIdx;
} SMmcoRef[MAX_REFERENCE_MMCO_COUNT_NUM]; // MAX_MMCO_COUNT
// int32_t mmco_index;
uint8_t uiMmcoCount;
bool bNoOutputOfPriorPicsFlag;
bool bLongTermRefFlag;
bool bAdaptiveRefPicMarkingModeFlag;
2013-12-09 13:51:09 +01:00
} SRefPicMarking;
/* Header of slice syntax elements, refer to Page 63 in JVT X201wcm */
typedef struct TagSliceHeader {
2014-06-26 03:50:41 +02:00
/*****************************slice header syntax and generated****************************/
int32_t iFirstMbInSlice;
2013-12-09 13:51:09 +01:00
// uint32_t pic_parameter_set_id;
2014-06-26 03:50:41 +02:00
int32_t iFrameNum;
int32_t iPicOrderCntLsb;
2013-12-09 13:51:09 +01:00
// int32_t delta_pic_order_cnt_bottom;
// int32_t delta_pic_order_cnt[2];
// int32_t redundant_pic_cnt;
2014-06-26 03:50:41 +02:00
EWelsSliceType eSliceType;
uint8_t uiNumRefIdxL0Active; //
//int32_t num_ref_idx_l1_active_minus1 //B frame is not supported
uint8_t uiRefCount;
//Ref_Pic *ref_pic;
uint8_t uiRefIndex; // exact reference picture index for slice
2014-06-26 03:50:41 +02:00
int8_t iSliceQpDelta;
// int32_t slice_qp;
2013-12-09 13:51:09 +01:00
// int32_t slice_qs_delta; // For SP/SI slices
2014-06-26 03:50:41 +02:00
uint8_t uiDisableDeblockingFilterIdc;
int8_t iSliceAlphaC0Offset;
int8_t iSliceBetaOffset;
2013-12-09 13:51:09 +01:00
#if !defined(DISABLE_FMO_FEATURE)
2014-06-26 03:50:41 +02:00
int32_t iSliceGroupChangeCycle;
2013-12-09 13:51:09 +01:00
#endif//!DISABLE_FMO_FEATURE
2014-06-26 03:50:41 +02:00
SWelsSPS* pSps;
SWelsPPS* pPps;
int32_t iSpsId;
int32_t iPpsId;
2013-12-09 13:51:09 +01:00
2014-06-26 03:50:41 +02:00
uint16_t uiIdrPicId;
2013-12-09 13:51:09 +01:00
// uint8_t color_plane_id;//from?
2014-06-26 03:50:41 +02:00
bool bNumRefIdxActiveOverrideFlag;
// bool field_pic_flag; //not supported in base profile
// bool bottom_field_flag; //not supported in base profile
2014-06-26 03:50:41 +02:00
uint8_t uiPadding1Bytes;
2013-12-09 13:51:09 +01:00
2014-06-26 03:50:41 +02:00
SRefPicMarking sRefMarking; // Decoded reference picture marking syntaxs
2013-12-09 13:51:09 +01:00
2014-06-26 03:50:41 +02:00
SRefPicListReorderSyntax sRefReordering; // Reference picture list reordering syntaxs
} SSliceHeader, *PSliceHeader;
2013-12-09 13:51:09 +01:00
/* SSlice header in scalable extension syntax, refer to Page 394 in JVT X201wcm */
typedef struct TagSliceHeaderExt {
2014-06-26 03:50:41 +02:00
SSliceHeader sSliceHeader;
2014-06-26 03:50:41 +02:00
SSubsetSps* pSubsetSps;
2014-06-26 03:50:41 +02:00
uint32_t uiNumMbsInSlice;
2014-06-26 03:50:41 +02:00
bool bStoreRefBasePicFlag;
bool bConstrainedIntraResamplingFlag;
bool bSliceSkipFlag;
2014-06-26 03:50:41 +02:00
bool bAdaptiveBaseModeFlag;
bool bDefaultBaseModeFlag;
bool bAdaptiveMotionPredFlag;
bool bDefaultMotionPredFlag;
2014-06-26 03:50:41 +02:00
bool bAdaptiveResidualPredFlag;
bool bDefaultResidualPredFlag;
bool bTcoeffLevelPredFlag;
uint8_t uiDisableInterLayerDeblockingFilterIdc;
} SSliceHeaderExt, *PSliceHeaderExt;
typedef struct TagSlice {
2014-06-26 03:50:41 +02:00
// mainly for multiple threads imp.
SMbCache sMbCacheInfo; // MBCache is introduced within slice dependency
SBitStringAux* pSliceBsa;
2014-06-26 03:50:41 +02:00
/*******************************sSliceHeader****************************/
SSliceHeaderExt sSliceHeaderExt;
2014-06-26 03:50:41 +02:00
SMVUnitXY sMvStartMin;
SMVUnitXY sMvStartMax;
SMVUnitXY sMvc[5];
uint8_t uiMvcNum;
uint8_t sScaleShift;
2014-06-26 03:50:41 +02:00
uint8_t uiSliceIdx;
bool bSliceHeaderExtFlag; // Indicate which slice header is used, avc or ext?
uint8_t uiLastMbQp; // stored qp for last mb coded, maybe more efficient for mb skip detection etc.
2014-06-26 03:50:41 +02:00
bool bDynamicSlicingSliceSizeCtrlFlag;
uint8_t uiAssumeLog2BytePerMb;
2014-03-31 10:11:31 +02:00
2014-06-26 03:50:41 +02:00
uint32_t uiSliceFMECostDown;//TODO: for FME switch under MT, to opt after ME final?
2014-03-31 10:11:31 +02:00
2014-06-26 03:50:41 +02:00
uint8_t uiReservedFillByte; // reserved to meet 4 bytes alignment
} SSlice, *PSlice;
2013-12-09 13:51:09 +01:00
}
#endif//WELS_SLICE_H__
2014-03-31 10:11:31 +02:00