[5] | 1 | /* The copyright in this software is being made available under the BSD |
---|
| 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
[56] | 4 | * granted under this license. |
---|
[5] | 5 | * |
---|
[1179] | 6 | * Copyright (c) 2010-2015, ITU/ISO/IEC |
---|
[5] | 7 | * All rights reserved. |
---|
| 8 | * |
---|
| 9 | * Redistribution and use in source and binary forms, with or without |
---|
| 10 | * modification, are permitted provided that the following conditions are met: |
---|
| 11 | * |
---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
---|
| 13 | * this list of conditions and the following disclaimer. |
---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
---|
| 16 | * and/or other materials provided with the distribution. |
---|
[56] | 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
[5] | 18 | * be used to endorse or promote products derived from this software without |
---|
| 19 | * specific prior written permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | */ |
---|
[2] | 33 | |
---|
| 34 | /** \file TDecSbac.cpp |
---|
| 35 | \brief Context-adaptive entropy decoder class |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #include "TDecSbac.h" |
---|
| 39 | |
---|
[56] | 40 | //! \ingroup TLibDecoder |
---|
| 41 | //! \{ |
---|
| 42 | |
---|
[2] | 43 | ////////////////////////////////////////////////////////////////////// |
---|
| 44 | // Construction/Destruction |
---|
| 45 | ////////////////////////////////////////////////////////////////////// |
---|
| 46 | |
---|
| 47 | TDecSbac::TDecSbac() |
---|
| 48 | // new structure here |
---|
| 49 | : m_pcBitstream ( 0 ) |
---|
| 50 | , m_pcTDecBinIf ( NULL ) |
---|
[56] | 51 | , m_numContextModels ( 0 ) |
---|
| 52 | , m_cCUSplitFlagSCModel ( 1, 1, NUM_SPLIT_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels ) |
---|
| 53 | , m_cCUSkipFlagSCModel ( 1, 1, NUM_SKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
[1196] | 54 | #if H_3D |
---|
[1179] | 55 | , m_cCUDISFlagSCModel ( 1, 1, NUM_DIS_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 56 | , m_cCUDISTypeSCModel ( 1, 1, NUM_DIS_TYPE_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
[1039] | 57 | #endif |
---|
[56] | 58 | , m_cCUMergeFlagExtSCModel ( 1, 1, NUM_MERGE_FLAG_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 59 | , m_cCUMergeIdxExtSCModel ( 1, 1, NUM_MERGE_IDX_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
[608] | 60 | #if H_3D_ARP |
---|
| 61 | , m_cCUPUARPWSCModel ( 1, 1, NUM_ARPW_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
[2] | 62 | #endif |
---|
[608] | 63 | #if H_3D_IC |
---|
| 64 | , m_cCUICFlagSCModel ( 1, 1, NUM_IC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
[443] | 65 | #endif |
---|
[56] | 66 | , m_cCUPartSizeSCModel ( 1, 1, NUM_PART_SIZE_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 67 | , m_cCUPredModeSCModel ( 1, 1, NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 68 | , m_cCUIntraPredSCModel ( 1, 1, NUM_ADI_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 69 | , m_cCUChromaPredSCModel ( 1, 1, NUM_CHROMA_PRED_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 70 | , m_cCUDeltaQpSCModel ( 1, 1, NUM_DELTA_QP_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 71 | , m_cCUInterDirSCModel ( 1, 1, NUM_INTER_DIR_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 72 | , m_cCURefPicSCModel ( 1, 1, NUM_REF_NO_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 73 | , m_cCUMvdSCModel ( 1, 1, NUM_MV_RES_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 74 | , m_cCUQtCbfSCModel ( 1, 2, NUM_QT_CBF_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 75 | , m_cCUTransSubdivFlagSCModel ( 1, 1, NUM_TRANS_SUBDIV_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 76 | , m_cCUQtRootCbfSCModel ( 1, 1, NUM_QT_ROOT_CBF_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 77 | , m_cCUSigCoeffGroupSCModel ( 1, 2, NUM_SIG_CG_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 78 | , m_cCUSigSCModel ( 1, 1, NUM_SIG_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 79 | , m_cCuCtxLastX ( 1, 2, NUM_CTX_LAST_FLAG_XY , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 80 | , m_cCuCtxLastY ( 1, 2, NUM_CTX_LAST_FLAG_XY , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 81 | , m_cCUOneSCModel ( 1, 1, NUM_ONE_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 82 | , m_cCUAbsSCModel ( 1, 1, NUM_ABS_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 83 | , m_cMVPIdxSCModel ( 1, 1, NUM_MVP_IDX_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
[608] | 84 | , m_cSaoMergeSCModel ( 1, 1, NUM_SAO_MERGE_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
[443] | 85 | , m_cSaoTypeIdxSCModel ( 1, 1, NUM_SAO_TYPE_IDX_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
[608] | 86 | , m_cTransformSkipSCModel ( 1, 2, NUM_TRANSFORMSKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 87 | , m_CUTransquantBypassFlagSCModel( 1, 1, NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX, m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 88 | #if H_3D_DIM |
---|
| 89 | , m_cDepthIntraModeSCModel ( 1, 1, NUM_DEPTH_INTRA_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 90 | , m_cDdcFlagSCModel ( 1, 1, NUM_DDC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 91 | , m_cDdcDataSCModel ( 1, 1, NUM_DDC_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
[833] | 92 | , m_cAngleFlagSCModel ( 1, 1, NUM_ANGLE_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
[608] | 93 | #if H_3D_DIM_SDC |
---|
| 94 | , m_cSDCResidualFlagSCModel ( 1, 1, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 95 | , m_cSDCResidualSCModel ( 1, 1, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
[100] | 96 | #endif |
---|
| 97 | #endif |
---|
[884] | 98 | #if H_3D_DIM_SDC |
---|
[833] | 99 | , m_cSDCFlagSCModel ( 1, 1, NUM_SDC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 100 | #endif |
---|
| 101 | #if H_3D_DBBP |
---|
| 102 | , m_cDBBPFlagSCModel ( 1, 1, DBBP_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
| 103 | #endif |
---|
[2] | 104 | { |
---|
[56] | 105 | assert( m_numContextModels <= MAX_NUM_CTX_MOD ); |
---|
[2] | 106 | } |
---|
| 107 | |
---|
| 108 | TDecSbac::~TDecSbac() |
---|
| 109 | { |
---|
| 110 | } |
---|
| 111 | |
---|
| 112 | // ==================================================================================================================== |
---|
| 113 | // Public member functions |
---|
| 114 | // ==================================================================================================================== |
---|
| 115 | |
---|
[56] | 116 | Void TDecSbac::resetEntropy(TComSlice* pSlice) |
---|
[2] | 117 | { |
---|
[56] | 118 | SliceType sliceType = pSlice->getSliceType(); |
---|
| 119 | Int qp = pSlice->getSliceQp(); |
---|
| 120 | |
---|
| 121 | if (pSlice->getPPS()->getCabacInitPresentFlag() && pSlice->getCabacInitFlag()) |
---|
| 122 | { |
---|
| 123 | switch (sliceType) |
---|
| 124 | { |
---|
| 125 | case P_SLICE: // change initialization table to B_SLICE initialization |
---|
| 126 | sliceType = B_SLICE; |
---|
| 127 | break; |
---|
| 128 | case B_SLICE: // change initialization table to P_SLICE initialization |
---|
| 129 | sliceType = P_SLICE; |
---|
| 130 | break; |
---|
| 131 | default : // should not occur |
---|
| 132 | assert(0); |
---|
| 133 | } |
---|
| 134 | } |
---|
| 135 | |
---|
| 136 | m_cCUSplitFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SPLIT_FLAG ); |
---|
| 137 | m_cCUSkipFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SKIP_FLAG ); |
---|
[1196] | 138 | #if H_3D |
---|
[1179] | 139 | m_cCUDISFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DIS_FLAG ); |
---|
| 140 | m_cCUDISTypeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DIS_TYPE ); |
---|
[1039] | 141 | #endif |
---|
[56] | 142 | m_cCUMergeFlagExtSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT ); |
---|
| 143 | m_cCUMergeIdxExtSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MERGE_IDX_EXT ); |
---|
[608] | 144 | #if H_3D_ARP |
---|
| 145 | m_cCUPUARPWSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ARPW ); |
---|
[2] | 146 | #endif |
---|
[608] | 147 | #if H_3D_IC |
---|
| 148 | m_cCUICFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_IC_FLAG ); |
---|
[443] | 149 | #endif |
---|
[56] | 150 | m_cCUPartSizeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_PART_SIZE ); |
---|
| 151 | m_cCUPredModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_PRED_MODE ); |
---|
| 152 | m_cCUIntraPredSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_INTRA_PRED_MODE ); |
---|
| 153 | m_cCUChromaPredSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_CHROMA_PRED_MODE ); |
---|
| 154 | m_cCUInterDirSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_INTER_DIR ); |
---|
| 155 | m_cCUMvdSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MVD ); |
---|
| 156 | m_cCURefPicSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_REF_PIC ); |
---|
| 157 | m_cCUDeltaQpSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DQP ); |
---|
| 158 | m_cCUQtCbfSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_QT_CBF ); |
---|
| 159 | m_cCUQtRootCbfSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_QT_ROOT_CBF ); |
---|
| 160 | m_cCUSigCoeffGroupSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SIG_CG_FLAG ); |
---|
| 161 | m_cCUSigSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SIG_FLAG ); |
---|
| 162 | m_cCuCtxLastX.initBuffer ( sliceType, qp, (UChar*)INIT_LAST ); |
---|
| 163 | m_cCuCtxLastY.initBuffer ( sliceType, qp, (UChar*)INIT_LAST ); |
---|
| 164 | m_cCUOneSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ONE_FLAG ); |
---|
| 165 | m_cCUAbsSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ABS_FLAG ); |
---|
| 166 | m_cMVPIdxSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MVP_IDX ); |
---|
[608] | 167 | m_cSaoMergeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_MERGE_FLAG ); |
---|
[443] | 168 | m_cSaoTypeIdxSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_TYPE_IDX ); |
---|
[56] | 169 | |
---|
| 170 | m_cCUTransSubdivFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); |
---|
[608] | 171 | m_cTransformSkipSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_TRANSFORMSKIP_FLAG ); |
---|
| 172 | m_CUTransquantBypassFlagSCModel.initBuffer( sliceType, qp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG ); |
---|
| 173 | #if H_3D_DIM |
---|
| 174 | m_cDepthIntraModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DEPTH_INTRA_MODE ); |
---|
| 175 | m_cDdcFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DDC_FLAG ); |
---|
| 176 | m_cDdcDataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DDC_DATA ); |
---|
[833] | 177 | m_cAngleFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ANGLE_FLAG ); |
---|
[608] | 178 | #if H_3D_DIM_SDC |
---|
| 179 | m_cSDCResidualFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); |
---|
| 180 | m_cSDCResidualSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL ); |
---|
[2] | 181 | #endif |
---|
[443] | 182 | #endif |
---|
[884] | 183 | #if H_3D_DIM_SDC |
---|
[833] | 184 | m_cSDCFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_FLAG ); |
---|
| 185 | #endif |
---|
| 186 | #if H_3D_DBBP |
---|
| 187 | m_cDBBPFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DBBP_FLAG ); |
---|
| 188 | #endif |
---|
[608] | 189 | m_uiLastDQpNonZero = 0; |
---|
[2] | 190 | |
---|
| 191 | // new structure |
---|
[56] | 192 | m_uiLastQp = qp; |
---|
[2] | 193 | |
---|
| 194 | m_pcTDecBinIf->start(); |
---|
| 195 | } |
---|
| 196 | |
---|
[56] | 197 | /** The function does the following: Read out terminate bit. Flush CABAC. Byte-align for next tile. |
---|
| 198 | * Intialize CABAC states. Start CABAC. |
---|
| 199 | */ |
---|
| 200 | Void TDecSbac::updateContextTables( SliceType eSliceType, Int iQp ) |
---|
| 201 | { |
---|
| 202 | UInt uiBit; |
---|
| 203 | m_pcTDecBinIf->decodeBinTrm(uiBit); |
---|
[608] | 204 | assert(uiBit); // end_of_sub_stream_one_bit must be equal to 1 |
---|
[56] | 205 | m_pcTDecBinIf->finish(); |
---|
| 206 | m_pcBitstream->readOutTrailingBits(); |
---|
| 207 | m_cCUSplitFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SPLIT_FLAG ); |
---|
| 208 | m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); |
---|
[1196] | 209 | #if H_3D |
---|
[1179] | 210 | m_cCUDISFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DIS_FLAG ); |
---|
| 211 | m_cCUDISTypeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DIS_TYPE ); |
---|
[1039] | 212 | #endif |
---|
[56] | 213 | m_cCUMergeFlagExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT ); |
---|
| 214 | m_cCUMergeIdxExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT ); |
---|
[608] | 215 | #if H_3D_ARP |
---|
| 216 | m_cCUPUARPWSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ARPW ); |
---|
[56] | 217 | #endif |
---|
[608] | 218 | #if H_3D_IC |
---|
| 219 | m_cCUICFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_IC_FLAG ); |
---|
[443] | 220 | #endif |
---|
[56] | 221 | m_cCUPartSizeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PART_SIZE ); |
---|
| 222 | m_cCUPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PRED_MODE ); |
---|
| 223 | m_cCUIntraPredSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTRA_PRED_MODE ); |
---|
| 224 | m_cCUChromaPredSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_CHROMA_PRED_MODE ); |
---|
| 225 | m_cCUInterDirSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_DIR ); |
---|
| 226 | m_cCUMvdSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MVD ); |
---|
| 227 | m_cCURefPicSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_REF_PIC ); |
---|
| 228 | m_cCUDeltaQpSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DQP ); |
---|
| 229 | m_cCUQtCbfSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_QT_CBF ); |
---|
| 230 | m_cCUQtRootCbfSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_QT_ROOT_CBF ); |
---|
| 231 | m_cCUSigCoeffGroupSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SIG_CG_FLAG ); |
---|
| 232 | m_cCUSigSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SIG_FLAG ); |
---|
| 233 | m_cCuCtxLastX.initBuffer ( eSliceType, iQp, (UChar*)INIT_LAST ); |
---|
| 234 | m_cCuCtxLastY.initBuffer ( eSliceType, iQp, (UChar*)INIT_LAST ); |
---|
| 235 | m_cCUOneSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ONE_FLAG ); |
---|
| 236 | m_cCUAbsSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ABS_FLAG ); |
---|
| 237 | m_cMVPIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MVP_IDX ); |
---|
[608] | 238 | m_cSaoMergeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_FLAG ); |
---|
[443] | 239 | m_cSaoTypeIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX ); |
---|
[56] | 240 | m_cCUTransSubdivFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); |
---|
[608] | 241 | m_cTransformSkipSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANSFORMSKIP_FLAG ); |
---|
| 242 | m_CUTransquantBypassFlagSCModel.initBuffer( eSliceType, iQp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG ); |
---|
| 243 | |
---|
| 244 | #if H_3D_DIM |
---|
| 245 | m_cDepthIntraModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DEPTH_INTRA_MODE ); |
---|
| 246 | m_cDdcFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG ); |
---|
| 247 | m_cDdcDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DDC_DATA ); |
---|
[833] | 248 | m_cAngleFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ANGLE_FLAG ); |
---|
[608] | 249 | #if H_3D_DIM_SDC |
---|
| 250 | m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); |
---|
| 251 | m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL ); |
---|
[443] | 252 | #endif |
---|
[189] | 253 | #endif |
---|
[884] | 254 | #if H_3D_DIM_SDC |
---|
[833] | 255 | m_cSDCFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG ); |
---|
| 256 | #endif |
---|
| 257 | #if H_3D_DBBP |
---|
| 258 | m_cDBBPFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DBBP_FLAG ); |
---|
| 259 | #endif |
---|
[56] | 260 | m_pcTDecBinIf->start(); |
---|
| 261 | } |
---|
| 262 | |
---|
[608] | 263 | Void TDecSbac::parseTerminatingBit( UInt& ruiBit ) |
---|
[56] | 264 | { |
---|
[608] | 265 | m_pcTDecBinIf->decodeBinTrm( ruiBit ); |
---|
| 266 | if ( ruiBit ) |
---|
[56] | 267 | { |
---|
[608] | 268 | m_pcTDecBinIf->finish(); |
---|
[56] | 269 | } |
---|
| 270 | } |
---|
| 271 | |
---|
[2] | 272 | |
---|
| 273 | Void TDecSbac::xReadUnaryMaxSymbol( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, UInt uiMaxSymbol ) |
---|
| 274 | { |
---|
| 275 | if (uiMaxSymbol == 0) |
---|
| 276 | { |
---|
| 277 | ruiSymbol = 0; |
---|
| 278 | return; |
---|
| 279 | } |
---|
| 280 | |
---|
| 281 | m_pcTDecBinIf->decodeBin( ruiSymbol, pcSCModel[0] ); |
---|
| 282 | |
---|
| 283 | if( ruiSymbol == 0 || uiMaxSymbol == 1 ) |
---|
| 284 | { |
---|
| 285 | return; |
---|
| 286 | } |
---|
| 287 | |
---|
| 288 | UInt uiSymbol = 0; |
---|
| 289 | UInt uiCont; |
---|
| 290 | |
---|
| 291 | do |
---|
| 292 | { |
---|
| 293 | m_pcTDecBinIf->decodeBin( uiCont, pcSCModel[ iOffset ] ); |
---|
| 294 | uiSymbol++; |
---|
| 295 | } |
---|
| 296 | while( uiCont && ( uiSymbol < uiMaxSymbol - 1 ) ); |
---|
| 297 | |
---|
| 298 | if( uiCont && ( uiSymbol == uiMaxSymbol - 1 ) ) |
---|
| 299 | { |
---|
| 300 | uiSymbol++; |
---|
| 301 | } |
---|
| 302 | |
---|
| 303 | ruiSymbol = uiSymbol; |
---|
| 304 | } |
---|
| 305 | |
---|
| 306 | Void TDecSbac::xReadEpExGolomb( UInt& ruiSymbol, UInt uiCount ) |
---|
| 307 | { |
---|
| 308 | UInt uiSymbol = 0; |
---|
| 309 | UInt uiBit = 1; |
---|
| 310 | |
---|
| 311 | while( uiBit ) |
---|
| 312 | { |
---|
| 313 | m_pcTDecBinIf->decodeBinEP( uiBit ); |
---|
| 314 | uiSymbol += uiBit << uiCount++; |
---|
| 315 | } |
---|
| 316 | |
---|
[56] | 317 | if ( --uiCount ) |
---|
[2] | 318 | { |
---|
[56] | 319 | UInt bins; |
---|
| 320 | m_pcTDecBinIf->decodeBinsEP( bins, uiCount ); |
---|
| 321 | uiSymbol += bins; |
---|
[2] | 322 | } |
---|
| 323 | |
---|
| 324 | ruiSymbol = uiSymbol; |
---|
| 325 | } |
---|
| 326 | |
---|
| 327 | Void TDecSbac::xReadUnarySymbol( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset ) |
---|
| 328 | { |
---|
| 329 | m_pcTDecBinIf->decodeBin( ruiSymbol, pcSCModel[0] ); |
---|
| 330 | |
---|
| 331 | if( !ruiSymbol ) |
---|
| 332 | { |
---|
| 333 | return; |
---|
| 334 | } |
---|
| 335 | |
---|
| 336 | UInt uiSymbol = 0; |
---|
| 337 | UInt uiCont; |
---|
| 338 | |
---|
| 339 | do |
---|
| 340 | { |
---|
| 341 | m_pcTDecBinIf->decodeBin( uiCont, pcSCModel[ iOffset ] ); |
---|
| 342 | uiSymbol++; |
---|
| 343 | } |
---|
| 344 | while( uiCont ); |
---|
| 345 | |
---|
| 346 | ruiSymbol = uiSymbol; |
---|
| 347 | } |
---|
| 348 | |
---|
[608] | 349 | |
---|
| 350 | /** Parsing of coeff_abs_level_remaing |
---|
| 351 | * \param ruiSymbol reference to coeff_abs_level_remaing |
---|
| 352 | * \param ruiParam reference to parameter |
---|
[2] | 353 | * \returns Void |
---|
| 354 | */ |
---|
[608] | 355 | Void TDecSbac::xReadCoefRemainExGolomb ( UInt &rSymbol, UInt &rParam ) |
---|
[2] | 356 | { |
---|
| 357 | |
---|
[608] | 358 | UInt prefix = 0; |
---|
| 359 | UInt codeWord = 0; |
---|
[2] | 360 | do |
---|
| 361 | { |
---|
[608] | 362 | prefix++; |
---|
| 363 | m_pcTDecBinIf->decodeBinEP( codeWord ); |
---|
[2] | 364 | } |
---|
[608] | 365 | while( codeWord); |
---|
| 366 | codeWord = 1 - codeWord; |
---|
| 367 | prefix -= codeWord; |
---|
| 368 | codeWord=0; |
---|
| 369 | if (prefix < COEF_REMAIN_BIN_REDUCTION ) |
---|
| 370 | { |
---|
| 371 | m_pcTDecBinIf->decodeBinsEP(codeWord,rParam); |
---|
| 372 | rSymbol = (prefix<<rParam) + codeWord; |
---|
| 373 | } |
---|
| 374 | else |
---|
| 375 | { |
---|
| 376 | m_pcTDecBinIf->decodeBinsEP(codeWord,prefix-COEF_REMAIN_BIN_REDUCTION+rParam); |
---|
| 377 | rSymbol = (((1<<(prefix-COEF_REMAIN_BIN_REDUCTION))+COEF_REMAIN_BIN_REDUCTION-1)<<rParam)+codeWord; |
---|
| 378 | } |
---|
| 379 | } |
---|
[2] | 380 | |
---|
[608] | 381 | #if H_3D_DIM |
---|
| 382 | Void TDecSbac::xReadExGolombLevel( UInt& ruiSymbol, ContextModel& rcSCModel ) |
---|
| 383 | { |
---|
| 384 | UInt uiSymbol; |
---|
| 385 | UInt uiCount = 0; |
---|
| 386 | do |
---|
| 387 | { |
---|
| 388 | m_pcTDecBinIf->decodeBin( uiSymbol, rcSCModel ); |
---|
| 389 | uiCount++; |
---|
| 390 | } |
---|
[950] | 391 | while( uiSymbol && ( uiCount != 3 ) ); |
---|
[608] | 392 | ruiSymbol = uiCount - 1; |
---|
| 393 | |
---|
| 394 | if( uiSymbol ) |
---|
[2] | 395 | { |
---|
[608] | 396 | xReadEpExGolomb( uiSymbol, 0 ); |
---|
| 397 | ruiSymbol += uiSymbol + 1; |
---|
[2] | 398 | } |
---|
| 399 | |
---|
[608] | 400 | return; |
---|
| 401 | } |
---|
[2] | 402 | |
---|
[724] | 403 | Void TDecSbac::xParseDimDeltaDC( Pel& rValDeltaDC, UInt uiNumSeg ) |
---|
| 404 | { |
---|
| 405 | UInt absValDeltaDC = 0; |
---|
| 406 | xReadExGolombLevel( absValDeltaDC, m_cDdcDataSCModel.get(0, 0, 0) ); |
---|
| 407 | rValDeltaDC = (Pel)absValDeltaDC + ( uiNumSeg > 1 ? 0 : 1 ); |
---|
| 408 | |
---|
| 409 | if( rValDeltaDC != 0 ) |
---|
| 410 | { |
---|
| 411 | UInt uiSign; |
---|
| 412 | m_pcTDecBinIf->decodeBinEP( uiSign ); |
---|
| 413 | if ( uiSign ) |
---|
| 414 | { |
---|
| 415 | rValDeltaDC = -rValDeltaDC; |
---|
| 416 | } |
---|
| 417 | } |
---|
| 418 | } |
---|
[608] | 419 | |
---|
[724] | 420 | |
---|
[608] | 421 | #if H_3D_DIM_DMM |
---|
| 422 | Void TDecSbac::xParseDmm1WedgeIdx( UInt& ruiTabIdx, Int iNumBit ) |
---|
| 423 | { |
---|
| 424 | UInt uiSymbol, uiIdx = 0; |
---|
| 425 | for( Int i = 0; i < iNumBit; i++ ) |
---|
| 426 | { |
---|
[976] | 427 | m_pcTDecBinIf->decodeBinEP( uiSymbol ); |
---|
[608] | 428 | uiIdx += uiSymbol << i; |
---|
| 429 | } |
---|
| 430 | ruiTabIdx = uiIdx; |
---|
| 431 | } |
---|
| 432 | #endif |
---|
[2] | 433 | |
---|
[1084] | 434 | |
---|
[608] | 435 | #endif |
---|
[56] | 436 | /** Parse I_PCM information. |
---|
| 437 | * \param pcCU |
---|
| 438 | * \param uiAbsPartIdx |
---|
| 439 | * \param uiDepth |
---|
| 440 | * \returns Void |
---|
| 441 | * |
---|
| 442 | * If I_PCM flag indicates that the CU is I_PCM, parse its PCM alignment bits and codes. |
---|
| 443 | */ |
---|
| 444 | Void TDecSbac::parseIPCMInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
[2] | 445 | { |
---|
| 446 | UInt uiSymbol; |
---|
[56] | 447 | |
---|
[1196] | 448 | m_pcTDecBinIf->decodeBinTrm(uiSymbol); |
---|
[2] | 449 | |
---|
[608] | 450 | #if H_MV_ENC_DEC_TRAC |
---|
[1196] | 451 | DTRACE_CU("pcm_flag", uiSymbol) |
---|
[608] | 452 | #endif |
---|
[1196] | 453 | if (uiSymbol) |
---|
| 454 | { |
---|
[56] | 455 | Bool bIpcmFlag = true; |
---|
| 456 | |
---|
| 457 | pcCU->setPartSizeSubParts ( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
| 458 | pcCU->setSizeSubParts ( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
[608] | 459 | pcCU->setTrIdxSubParts ( 0, uiAbsPartIdx, uiDepth ); |
---|
[56] | 460 | pcCU->setIPCMFlagSubParts ( bIpcmFlag, uiAbsPartIdx, uiDepth ); |
---|
[2] | 461 | |
---|
[56] | 462 | UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight(); |
---|
| 463 | UInt uiLumaOffset = uiMinCoeffSize*uiAbsPartIdx; |
---|
| 464 | UInt uiChromaOffset = uiLumaOffset>>2; |
---|
| 465 | |
---|
| 466 | Pel* piPCMSample; |
---|
| 467 | UInt uiWidth; |
---|
| 468 | UInt uiHeight; |
---|
| 469 | UInt uiSampleBits; |
---|
| 470 | UInt uiX, uiY; |
---|
| 471 | |
---|
| 472 | piPCMSample = pcCU->getPCMSampleY() + uiLumaOffset; |
---|
| 473 | uiWidth = pcCU->getWidth(uiAbsPartIdx); |
---|
| 474 | uiHeight = pcCU->getHeight(uiAbsPartIdx); |
---|
| 475 | uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthLuma(); |
---|
| 476 | |
---|
| 477 | for(uiY = 0; uiY < uiHeight; uiY++) |
---|
| 478 | { |
---|
| 479 | for(uiX = 0; uiX < uiWidth; uiX++) |
---|
| 480 | { |
---|
| 481 | UInt uiSample; |
---|
| 482 | m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample); |
---|
| 483 | piPCMSample[uiX] = uiSample; |
---|
| 484 | } |
---|
| 485 | piPCMSample += uiWidth; |
---|
| 486 | } |
---|
[1179] | 487 | #if H_3D_DISABLE_CHROMA |
---|
| 488 | if( pcCU->getSlice()->getSPS()->getChromaFormatIdc() != 0 ) |
---|
| 489 | { |
---|
| 490 | #endif |
---|
[1196] | 491 | piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset; |
---|
| 492 | uiWidth = pcCU->getWidth(uiAbsPartIdx)/2; |
---|
| 493 | uiHeight = pcCU->getHeight(uiAbsPartIdx)/2; |
---|
| 494 | uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma(); |
---|
[56] | 495 | |
---|
[1196] | 496 | for(uiY = 0; uiY < uiHeight; uiY++) |
---|
[56] | 497 | { |
---|
[1196] | 498 | for(uiX = 0; uiX < uiWidth; uiX++) |
---|
| 499 | { |
---|
| 500 | UInt uiSample; |
---|
| 501 | m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample); |
---|
| 502 | piPCMSample[uiX] = uiSample; |
---|
| 503 | } |
---|
| 504 | piPCMSample += uiWidth; |
---|
[56] | 505 | } |
---|
| 506 | |
---|
[1196] | 507 | piPCMSample = pcCU->getPCMSampleCr() + uiChromaOffset; |
---|
| 508 | uiWidth = pcCU->getWidth(uiAbsPartIdx)/2; |
---|
| 509 | uiHeight = pcCU->getHeight(uiAbsPartIdx)/2; |
---|
| 510 | uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma(); |
---|
[56] | 511 | |
---|
[1196] | 512 | for(uiY = 0; uiY < uiHeight; uiY++) |
---|
[56] | 513 | { |
---|
[1196] | 514 | for(uiX = 0; uiX < uiWidth; uiX++) |
---|
| 515 | { |
---|
| 516 | UInt uiSample; |
---|
| 517 | m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample); |
---|
| 518 | piPCMSample[uiX] = uiSample; |
---|
| 519 | } |
---|
| 520 | piPCMSample += uiWidth; |
---|
[56] | 521 | } |
---|
[1179] | 522 | #if H_3D_DISABLE_CHROMA |
---|
| 523 | } |
---|
| 524 | #endif |
---|
[608] | 525 | m_pcTDecBinIf->start(); |
---|
[2] | 526 | } |
---|
| 527 | } |
---|
| 528 | |
---|
[608] | 529 | Void TDecSbac::parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 530 | { |
---|
| 531 | UInt uiSymbol; |
---|
| 532 | m_pcTDecBinIf->decodeBin( uiSymbol, m_CUTransquantBypassFlagSCModel.get( 0, 0, 0 ) ); |
---|
| 533 | #if H_MV_ENC_DEC_TRAC |
---|
| 534 | DTRACE_CU("cu_transquant_bypass_flag", uiSymbol); |
---|
| 535 | #endif |
---|
| 536 | pcCU->setCUTransquantBypassSubParts(uiSymbol ? true : false, uiAbsPartIdx, uiDepth); |
---|
| 537 | } |
---|
| 538 | |
---|
[2] | 539 | /** parse skip flag |
---|
| 540 | * \param pcCU |
---|
| 541 | * \param uiAbsPartIdx |
---|
| 542 | * \param uiDepth |
---|
| 543 | * \returns Void |
---|
| 544 | */ |
---|
| 545 | Void TDecSbac::parseSkipFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 546 | { |
---|
| 547 | if( pcCU->getSlice()->isIntra() ) |
---|
| 548 | { |
---|
| 549 | return; |
---|
| 550 | } |
---|
| 551 | |
---|
| 552 | UInt uiSymbol = 0; |
---|
| 553 | UInt uiCtxSkip = pcCU->getCtxSkipFlag( uiAbsPartIdx ); |
---|
| 554 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSkipFlagSCModel.get( 0, 0, uiCtxSkip ) ); |
---|
[608] | 555 | #if !H_MV_ENC_DEC_TRAC |
---|
[56] | 556 | DTRACE_CABAC_VL( g_nSymbolCounter++ ); |
---|
[2] | 557 | DTRACE_CABAC_T( "\tSkipFlag" ); |
---|
| 558 | DTRACE_CABAC_T( "\tuiCtxSkip: "); |
---|
| 559 | DTRACE_CABAC_V( uiCtxSkip ); |
---|
| 560 | DTRACE_CABAC_T( "\tuiSymbol: "); |
---|
| 561 | DTRACE_CABAC_V( uiSymbol ); |
---|
| 562 | DTRACE_CABAC_T( "\n"); |
---|
[608] | 563 | #endif |
---|
[2] | 564 | |
---|
| 565 | if( uiSymbol ) |
---|
| 566 | { |
---|
[608] | 567 | pcCU->setSkipFlagSubParts( true, uiAbsPartIdx, uiDepth ); |
---|
| 568 | pcCU->setPredModeSubParts( MODE_INTER, uiAbsPartIdx, uiDepth ); |
---|
[2] | 569 | pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
| 570 | pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
| 571 | pcCU->setMergeFlagSubParts( true , uiAbsPartIdx, 0, uiDepth ); |
---|
| 572 | } |
---|
[608] | 573 | #if H_MV_ENC_DEC_TRAC |
---|
| 574 | DTRACE_CU("cu_skip_flag", uiSymbol); |
---|
| 575 | #endif |
---|
[2] | 576 | } |
---|
[1196] | 577 | #if H_3D |
---|
[1179] | 578 | Void TDecSbac::parseDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 579 | { |
---|
| 580 | pcCU->setDISFlagSubParts( false, uiAbsPartIdx, uiDepth ); |
---|
| 581 | UInt uiSymbol = 0; |
---|
| 582 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUDISFlagSCModel.get( 0, 0, 0 ) ); |
---|
| 583 | if( uiSymbol ) |
---|
| 584 | { |
---|
| 585 | pcCU->setDISFlagSubParts( true, uiAbsPartIdx, uiDepth ); |
---|
| 586 | pcCU->setSkipFlagSubParts( false, uiAbsPartIdx, uiDepth ); |
---|
| 587 | pcCU->setSDCFlagSubParts( false, uiAbsPartIdx, uiDepth ); |
---|
| 588 | pcCU->setPredModeSubParts( MODE_INTRA, uiAbsPartIdx, uiDepth ); |
---|
| 589 | pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
| 590 | pcCU->setLumaIntraDirSubParts (DC_IDX, uiAbsPartIdx, uiDepth ); |
---|
| 591 | pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
| 592 | pcCU->setMergeFlagSubParts( false , uiAbsPartIdx, 0, uiDepth ); |
---|
| 593 | pcCU->setTrIdxSubParts(0, uiAbsPartIdx, uiDepth); |
---|
| 594 | pcCU->setCbfSubParts(0, 1, 1, uiAbsPartIdx, uiDepth); |
---|
| 595 | |
---|
| 596 | UInt uiUnaryIdx = 0; |
---|
| 597 | UInt uiNumCand = 4; |
---|
| 598 | |
---|
| 599 | if ( uiNumCand > 1 ) |
---|
| 600 | { |
---|
| 601 | for( ; uiUnaryIdx < uiNumCand - 1; ++uiUnaryIdx ) |
---|
| 602 | { |
---|
| 603 | UInt uiSymbol2 = 0; |
---|
| 604 | if ( uiUnaryIdx==0 ) |
---|
| 605 | { |
---|
| 606 | m_pcTDecBinIf->decodeBin( uiSymbol2, m_cCUDISTypeSCModel.get( 0, 0, 0 ) ); |
---|
| 607 | } |
---|
| 608 | else |
---|
| 609 | { |
---|
| 610 | m_pcTDecBinIf->decodeBinEP( uiSymbol2); |
---|
| 611 | } |
---|
| 612 | if( uiSymbol2 == 0 ) |
---|
| 613 | { |
---|
| 614 | break; |
---|
| 615 | } |
---|
| 616 | } |
---|
| 617 | } |
---|
| 618 | pcCU->setDISTypeSubParts(uiUnaryIdx, uiAbsPartIdx, 0, uiDepth); |
---|
| 619 | } |
---|
| 620 | } |
---|
| 621 | #endif |
---|
[2] | 622 | /** parse merge flag |
---|
| 623 | * \param pcCU |
---|
| 624 | * \param uiAbsPartIdx |
---|
| 625 | * \param uiDepth |
---|
| 626 | * \param uiPUIdx |
---|
| 627 | * \returns Void |
---|
| 628 | */ |
---|
| 629 | Void TDecSbac::parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) |
---|
| 630 | { |
---|
| 631 | UInt uiSymbol; |
---|
[56] | 632 | m_pcTDecBinIf->decodeBin( uiSymbol, *m_cCUMergeFlagExtSCModel.get( 0 ) ); |
---|
[608] | 633 | #if H_MV_ENC_DEC_TRAC |
---|
| 634 | DTRACE_PU("merge_flag", uiSymbol) |
---|
| 635 | #endif |
---|
[2] | 636 | pcCU->setMergeFlagSubParts( uiSymbol ? true : false, uiAbsPartIdx, uiPUIdx, uiDepth ); |
---|
| 637 | |
---|
[608] | 638 | #if !H_MV_ENC_DEC_TRAC |
---|
[56] | 639 | DTRACE_CABAC_VL( g_nSymbolCounter++ ); |
---|
[2] | 640 | DTRACE_CABAC_T( "\tMergeFlag: " ); |
---|
| 641 | DTRACE_CABAC_V( uiSymbol ); |
---|
| 642 | DTRACE_CABAC_T( "\tAddress: " ); |
---|
| 643 | DTRACE_CABAC_V( pcCU->getAddr() ); |
---|
| 644 | DTRACE_CABAC_T( "\tuiAbsPartIdx: " ); |
---|
| 645 | DTRACE_CABAC_V( uiAbsPartIdx ); |
---|
| 646 | DTRACE_CABAC_T( "\n" ); |
---|
[608] | 647 | #endif |
---|
[2] | 648 | } |
---|
| 649 | |
---|
[608] | 650 | Void TDecSbac::parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex ) |
---|
[2] | 651 | { |
---|
[56] | 652 | UInt uiUnaryIdx = 0; |
---|
[608] | 653 | UInt uiNumCand = pcCU->getSlice()->getMaxNumMergeCand(); |
---|
[56] | 654 | if ( uiNumCand > 1 ) |
---|
[2] | 655 | { |
---|
[56] | 656 | for( ; uiUnaryIdx < uiNumCand - 1; ++uiUnaryIdx ) |
---|
[2] | 657 | { |
---|
[56] | 658 | UInt uiSymbol = 0; |
---|
| 659 | if ( uiUnaryIdx==0 ) |
---|
[2] | 660 | { |
---|
[56] | 661 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUMergeIdxExtSCModel.get( 0, 0, 0 ) ); |
---|
[2] | 662 | } |
---|
[56] | 663 | else |
---|
| 664 | { |
---|
| 665 | m_pcTDecBinIf->decodeBinEP( uiSymbol ); |
---|
| 666 | } |
---|
| 667 | if( uiSymbol == 0 ) |
---|
[2] | 668 | { |
---|
[56] | 669 | break; |
---|
[2] | 670 | } |
---|
| 671 | } |
---|
[608] | 672 | #if H_MV_ENC_DEC_TRAC |
---|
| 673 | DTRACE_PU("merge_idx", uiUnaryIdx) |
---|
| 674 | #endif |
---|
[2] | 675 | } |
---|
| 676 | ruiMergeIndex = uiUnaryIdx; |
---|
| 677 | |
---|
[608] | 678 | #if !H_MV_ENC_DEC_TRAC |
---|
[56] | 679 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
| 680 | DTRACE_CABAC_T( "\tparseMergeIndex()" ) |
---|
| 681 | DTRACE_CABAC_T( "\tuiMRGIdx= " ) |
---|
| 682 | DTRACE_CABAC_V( ruiMergeIndex ) |
---|
| 683 | DTRACE_CABAC_T( "\n" ) |
---|
[2] | 684 | #endif |
---|
| 685 | } |
---|
| 686 | |
---|
[56] | 687 | Void TDecSbac::parseMVPIdx ( Int& riMVPIdx ) |
---|
| 688 | { |
---|
| 689 | UInt uiSymbol; |
---|
| 690 | xReadUnaryMaxSymbol(uiSymbol, m_cMVPIdxSCModel.get(0), 1, AMVP_MAX_NUM_CANDS-1); |
---|
| 691 | riMVPIdx = uiSymbol; |
---|
| 692 | } |
---|
[2] | 693 | |
---|
| 694 | Void TDecSbac::parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 695 | { |
---|
| 696 | if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth ) |
---|
| 697 | { |
---|
| 698 | pcCU->setDepthSubParts( uiDepth, uiAbsPartIdx ); |
---|
| 699 | return; |
---|
| 700 | } |
---|
[608] | 701 | |
---|
[2] | 702 | UInt uiSymbol; |
---|
[608] | 703 | #if H_3D_QTLPC |
---|
[189] | 704 | Bool bParseSplitFlag = true; |
---|
[1124] | 705 | Bool bLimQtPredFlag = pcCU->getPic()->getSlice(0)->getQtPredFlag(); |
---|
[189] | 706 | TComPic *pcTexture = pcCU->getSlice()->getTexturePic(); |
---|
| 707 | Bool bDepthMapDetect = (pcTexture != NULL); |
---|
| 708 | Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE); |
---|
| 709 | |
---|
[608] | 710 | Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA); |
---|
| 711 | |
---|
[1084] | 712 | #if H_3D_FCO |
---|
[1066] | 713 | if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFlag && pcTexture->getReconMark()) |
---|
| 714 | #else |
---|
[1039] | 715 | if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFlag) |
---|
[1066] | 716 | #endif |
---|
[189] | 717 | { |
---|
| 718 | TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr()); |
---|
| 719 | assert(pcTextureCU->getDepth(uiAbsPartIdx) >= uiDepth); |
---|
| 720 | bParseSplitFlag = (pcTextureCU->getDepth(uiAbsPartIdx) > uiDepth); |
---|
| 721 | } |
---|
| 722 | |
---|
| 723 | if(bParseSplitFlag) |
---|
| 724 | { |
---|
| 725 | #endif |
---|
| 726 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSplitFlagSCModel.get( 0, 0, pcCU->getCtxSplitFlag( uiAbsPartIdx, uiDepth ) ) ); |
---|
[608] | 727 | #if H_MV_ENC_DEC_TRAC |
---|
| 728 | DTRACE_CU("split_cu_flag", uiSymbol); |
---|
| 729 | #else |
---|
[189] | 730 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
| 731 | DTRACE_CABAC_T( "\tSplitFlag\n" ) |
---|
[608] | 732 | #endif |
---|
| 733 | #if H_3D_QTLPC |
---|
[189] | 734 | } |
---|
| 735 | else |
---|
[608] | 736 | { |
---|
[189] | 737 | uiSymbol = 0; |
---|
[608] | 738 | } |
---|
[189] | 739 | #endif |
---|
[2] | 740 | pcCU->setDepthSubParts( uiDepth + uiSymbol, uiAbsPartIdx ); |
---|
[1196] | 741 | |
---|
[2] | 742 | return; |
---|
| 743 | } |
---|
| 744 | |
---|
| 745 | /** parse partition size |
---|
| 746 | * \param pcCU |
---|
| 747 | * \param uiAbsPartIdx |
---|
| 748 | * \param uiDepth |
---|
| 749 | * \returns Void |
---|
| 750 | */ |
---|
| 751 | Void TDecSbac::parsePartSize( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 752 | { |
---|
| 753 | UInt uiSymbol, uiMode = 0; |
---|
| 754 | PartSize eMode; |
---|
[189] | 755 | |
---|
[608] | 756 | #if H_3D_QTLPC |
---|
[189] | 757 | Bool bParsePartSize = true; |
---|
[1196] | 758 | |
---|
[1124] | 759 | Bool bLimQtPredFlag = pcCU->getPic()->getSlice(0)->getQtPredFlag(); |
---|
[189] | 760 | TComPic *pcTexture = pcCU->getSlice()->getTexturePic(); |
---|
| 761 | Bool bDepthMapDetect = (pcTexture != NULL); |
---|
| 762 | Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE); |
---|
| 763 | |
---|
[608] | 764 | Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA); |
---|
| 765 | |
---|
[833] | 766 | Bool depthDependent = false; |
---|
| 767 | UInt uiTexturePart = uiMode; |
---|
[1084] | 768 | |
---|
| 769 | #if H_3D_FCO |
---|
[1066] | 770 | if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFlag && pcTexture->getReconMark()) |
---|
| 771 | #else |
---|
[1039] | 772 | if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFlag ) |
---|
[1066] | 773 | #endif |
---|
[189] | 774 | { |
---|
| 775 | TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr()); |
---|
| 776 | assert(pcTextureCU->getDepth(uiAbsPartIdx) >= uiDepth); |
---|
[833] | 777 | if(pcTextureCU->getDepth(uiAbsPartIdx) == uiDepth ) |
---|
[189] | 778 | { |
---|
[833] | 779 | depthDependent = true; |
---|
| 780 | uiTexturePart = pcTextureCU->getPartitionSize( uiAbsPartIdx ); |
---|
| 781 | } |
---|
| 782 | if (pcTextureCU->getDepth(uiAbsPartIdx) == uiDepth && pcTextureCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N) |
---|
| 783 | { |
---|
[189] | 784 | bParsePartSize = false; |
---|
| 785 | eMode = SIZE_2Nx2N; |
---|
| 786 | } |
---|
| 787 | } |
---|
| 788 | #endif |
---|
[608] | 789 | |
---|
[1196] | 790 | |
---|
[2] | 791 | if ( pcCU->isIntra( uiAbsPartIdx ) ) |
---|
| 792 | { |
---|
[608] | 793 | #if H_3D_QTLPC |
---|
[189] | 794 | if(bParsePartSize) |
---|
[2] | 795 | { |
---|
[189] | 796 | #endif |
---|
[1196] | 797 | uiSymbol = 1; |
---|
[189] | 798 | if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth ) |
---|
| 799 | { |
---|
| 800 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 0) ); |
---|
[608] | 801 | #if H_MV_ENC_DEC_TRAC |
---|
| 802 | DTRACE_CU("part_mode", uiSymbol) |
---|
| 803 | #endif |
---|
[189] | 804 | } |
---|
| 805 | eMode = uiSymbol ? SIZE_2Nx2N : SIZE_NxN; |
---|
[608] | 806 | #if H_3D_QTLPC |
---|
[2] | 807 | } |
---|
[189] | 808 | #endif |
---|
[56] | 809 | UInt uiTrLevel = 0; |
---|
| 810 | UInt uiWidthInBit = g_aucConvertToBit[pcCU->getWidth(uiAbsPartIdx)]+2; |
---|
| 811 | UInt uiTrSizeInBit = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxTrSize()]+2; |
---|
| 812 | uiTrLevel = uiWidthInBit >= uiTrSizeInBit ? uiWidthInBit - uiTrSizeInBit : 0; |
---|
| 813 | if( eMode == SIZE_NxN ) |
---|
| 814 | { |
---|
| 815 | pcCU->setTrIdxSubParts( 1+uiTrLevel, uiAbsPartIdx, uiDepth ); |
---|
| 816 | } |
---|
| 817 | else |
---|
| 818 | { |
---|
| 819 | pcCU->setTrIdxSubParts( uiTrLevel, uiAbsPartIdx, uiDepth ); |
---|
| 820 | } |
---|
[2] | 821 | } |
---|
| 822 | else |
---|
| 823 | { |
---|
[608] | 824 | #if H_3D_QTLPC |
---|
[189] | 825 | if(bParsePartSize) |
---|
[2] | 826 | { |
---|
[833] | 827 | if (depthDependent==false || uiTexturePart == SIZE_NxN|| uiTexturePart == SIZE_2Nx2N) |
---|
| 828 | { |
---|
| 829 | #endif |
---|
[1196] | 830 | UInt uiMaxNumBits = 2; |
---|
| 831 | if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( (g_uiMaxCUWidth>>uiDepth) == 8 && (g_uiMaxCUHeight>>uiDepth) == 8 ) ) |
---|
[189] | 832 | { |
---|
[1196] | 833 | uiMaxNumBits ++; |
---|
[189] | 834 | } |
---|
[1196] | 835 | for ( UInt ui = 0; ui < uiMaxNumBits; ui++ ) |
---|
[189] | 836 | { |
---|
[1196] | 837 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) ); |
---|
| 838 | if ( uiSymbol ) |
---|
[189] | 839 | { |
---|
[1196] | 840 | break; |
---|
[189] | 841 | } |
---|
[1196] | 842 | uiMode++; |
---|
[56] | 843 | } |
---|
[1196] | 844 | eMode = (PartSize) uiMode; |
---|
| 845 | if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) ) |
---|
[189] | 846 | { |
---|
[1196] | 847 | if (eMode == SIZE_2NxN) |
---|
[189] | 848 | { |
---|
[1196] | 849 | m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 3 )); |
---|
| 850 | if (uiSymbol == 0) |
---|
| 851 | { |
---|
| 852 | m_pcTDecBinIf->decodeBinEP(uiSymbol); |
---|
| 853 | eMode = (uiSymbol == 0? SIZE_2NxnU : SIZE_2NxnD); |
---|
| 854 | } |
---|
[189] | 855 | } |
---|
[1196] | 856 | else if (eMode == SIZE_Nx2N) |
---|
| 857 | { |
---|
| 858 | m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 3 )); |
---|
| 859 | if (uiSymbol == 0) |
---|
| 860 | { |
---|
| 861 | m_pcTDecBinIf->decodeBinEP(uiSymbol); |
---|
| 862 | eMode = (uiSymbol == 0? SIZE_nLx2N : SIZE_nRx2N); |
---|
| 863 | } |
---|
| 864 | } |
---|
[2] | 865 | } |
---|
[884] | 866 | #if H_3D_QTLPC |
---|
[833] | 867 | } |
---|
| 868 | else if(uiTexturePart == SIZE_2NxN || uiTexturePart == SIZE_2NxnU || uiTexturePart == SIZE_2NxnD) |
---|
| 869 | { |
---|
| 870 | UInt uiMaxNumBits = 1; |
---|
| 871 | if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) ) |
---|
| 872 | { |
---|
| 873 | uiMaxNumBits ++; |
---|
| 874 | } |
---|
| 875 | for ( UInt ui = 0; ui < uiMaxNumBits; ui++ ) |
---|
| 876 | { |
---|
| 877 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) ); |
---|
| 878 | if ( uiSymbol ) |
---|
| 879 | { |
---|
| 880 | break; |
---|
| 881 | } |
---|
| 882 | uiMode++; |
---|
| 883 | } |
---|
| 884 | eMode = (PartSize) uiMode; |
---|
| 885 | if(uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) && uiSymbol==1 ) |
---|
| 886 | { |
---|
| 887 | eMode = SIZE_2NxN; |
---|
| 888 | } |
---|
| 889 | else if (uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth )==0 && uiSymbol==0) |
---|
| 890 | { |
---|
| 891 | eMode = SIZE_2NxN; |
---|
| 892 | } |
---|
| 893 | else if (uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) && uiSymbol==0) |
---|
| 894 | { |
---|
| 895 | m_pcTDecBinIf->decodeBinEP(uiSymbol); |
---|
| 896 | eMode = (uiSymbol == 0? SIZE_2NxnU : SIZE_2NxnD); |
---|
| 897 | } |
---|
| 898 | } |
---|
| 899 | else if(uiTexturePart == SIZE_Nx2N|| uiTexturePart==SIZE_nLx2N || uiTexturePart==SIZE_nRx2N) |
---|
| 900 | { |
---|
| 901 | UInt uiMaxNumBits = 1; |
---|
| 902 | if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) ) |
---|
| 903 | { |
---|
| 904 | uiMaxNumBits ++; |
---|
| 905 | } |
---|
| 906 | for ( UInt ui = 0; ui < uiMaxNumBits; ui++ ) |
---|
| 907 | { |
---|
| 908 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) ); |
---|
| 909 | if ( uiSymbol ) |
---|
| 910 | { |
---|
| 911 | break; |
---|
| 912 | } |
---|
| 913 | uiMode++; |
---|
| 914 | } |
---|
| 915 | eMode = (PartSize) uiMode; |
---|
| 916 | if(uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) && uiSymbol==1 ) |
---|
| 917 | { |
---|
| 918 | eMode = SIZE_Nx2N; |
---|
| 919 | } |
---|
| 920 | else if (uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth )==0 && uiSymbol==0) |
---|
| 921 | { |
---|
| 922 | eMode = SIZE_Nx2N; |
---|
| 923 | } |
---|
| 924 | else if (uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) && uiSymbol==0) |
---|
| 925 | { |
---|
| 926 | m_pcTDecBinIf->decodeBinEP(uiSymbol); |
---|
| 927 | eMode = (uiSymbol == 0? SIZE_nLx2N : SIZE_nRx2N); |
---|
| 928 | } |
---|
| 929 | } |
---|
| 930 | else |
---|
[884] | 931 | { |
---|
[833] | 932 | assert(0); |
---|
[884] | 933 | } |
---|
[964] | 934 | #endif |
---|
[608] | 935 | #if H_MV_ENC_DEC_TRAC |
---|
| 936 | DTRACE_CU("part_mode", eMode ) |
---|
| 937 | #endif |
---|
[964] | 938 | #if H_3D_QTLPC |
---|
[2] | 939 | } |
---|
[189] | 940 | #endif |
---|
[2] | 941 | } |
---|
| 942 | pcCU->setPartSizeSubParts( eMode, uiAbsPartIdx, uiDepth ); |
---|
| 943 | pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
| 944 | } |
---|
| 945 | |
---|
| 946 | /** parse prediction mode |
---|
| 947 | * \param pcCU |
---|
| 948 | * \param uiAbsPartIdx |
---|
| 949 | * \param uiDepth |
---|
| 950 | * \returns Void |
---|
| 951 | */ |
---|
| 952 | Void TDecSbac::parsePredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 953 | { |
---|
| 954 | if( pcCU->getSlice()->isIntra() ) |
---|
| 955 | { |
---|
| 956 | pcCU->setPredModeSubParts( MODE_INTRA, uiAbsPartIdx, uiDepth ); |
---|
| 957 | return; |
---|
| 958 | } |
---|
| 959 | |
---|
| 960 | UInt uiSymbol; |
---|
| 961 | Int iPredMode = MODE_INTER; |
---|
[56] | 962 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPredModeSCModel.get( 0, 0, 0 ) ); |
---|
[2] | 963 | iPredMode += uiSymbol; |
---|
[608] | 964 | #if H_MV_ENC_DEC_TRAC |
---|
| 965 | DTRACE_CU("pred_mode_flag", uiSymbol) |
---|
| 966 | #endif |
---|
[2] | 967 | pcCU->setPredModeSubParts( (PredMode)iPredMode, uiAbsPartIdx, uiDepth ); |
---|
| 968 | } |
---|
[608] | 969 | |
---|
| 970 | Void TDecSbac::parseIntraDirLumaAng ( TComDataCU* pcCU, UInt absPartIdx, UInt depth ) |
---|
[443] | 971 | { |
---|
[608] | 972 | PartSize mode = pcCU->getPartitionSize( absPartIdx ); |
---|
| 973 | UInt partNum = mode==SIZE_NxN?4:1; |
---|
| 974 | UInt partOffset = ( pcCU->getPic()->getNumPartInCU() >> ( pcCU->getDepth(absPartIdx) << 1 ) ) >> 2; |
---|
| 975 | UInt mpmPred[4],symbol; |
---|
| 976 | Int j,intraPredMode; |
---|
| 977 | if (mode==SIZE_NxN) |
---|
[443] | 978 | { |
---|
[608] | 979 | depth++; |
---|
[443] | 980 | } |
---|
[608] | 981 | for (j=0;j<partNum;j++) |
---|
[443] | 982 | { |
---|
[608] | 983 | #if H_3D_DIM |
---|
[1124] | 984 | if( pcCU->getSlice()->getIntraSdcWedgeFlag() || pcCU->getSlice()->getIntraContourFlag() ) |
---|
[443] | 985 | { |
---|
[608] | 986 | parseIntraDepth( pcCU, absPartIdx+partOffset*j, depth ); |
---|
[443] | 987 | } |
---|
[608] | 988 | if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE ) |
---|
| 989 | { |
---|
| 990 | #endif |
---|
[1196] | 991 | m_pcTDecBinIf->decodeBin( symbol, m_cCUIntraPredSCModel.get( 0, 0, 0) ); |
---|
| 992 | mpmPred[j] = symbol; |
---|
[608] | 993 | #if H_MV_ENC_DEC_TRAC |
---|
[1196] | 994 | DTRACE_CU("prev_intra_luma_pred_flag", symbol) |
---|
[608] | 995 | #endif |
---|
| 996 | #if H_3D_DIM |
---|
| 997 | } |
---|
| 998 | #endif |
---|
[443] | 999 | } |
---|
[608] | 1000 | for (j=0;j<partNum;j++) |
---|
[443] | 1001 | { |
---|
[608] | 1002 | #if H_3D_DIM |
---|
| 1003 | if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE ) |
---|
[443] | 1004 | { |
---|
[608] | 1005 | #endif |
---|
[1196] | 1006 | Int preds[3] = {-1, -1, -1}; |
---|
| 1007 | Int predNum = pcCU->getIntraDirLumaPredictor(absPartIdx+partOffset*j, preds); |
---|
| 1008 | if (mpmPred[j]) |
---|
[608] | 1009 | { |
---|
| 1010 | m_pcTDecBinIf->decodeBinEP( symbol ); |
---|
[1196] | 1011 | if (symbol) |
---|
| 1012 | { |
---|
| 1013 | m_pcTDecBinIf->decodeBinEP( symbol ); |
---|
| 1014 | symbol++; |
---|
| 1015 | } |
---|
[608] | 1016 | #if H_MV_ENC_DEC_TRAC |
---|
[1196] | 1017 | DTRACE_CU("mpm_idx", symbol) |
---|
[608] | 1018 | #endif |
---|
[1196] | 1019 | intraPredMode = preds[symbol]; |
---|
| 1020 | } |
---|
| 1021 | else |
---|
| 1022 | { |
---|
| 1023 | m_pcTDecBinIf->decodeBinsEP( symbol, 5 ); |
---|
| 1024 | intraPredMode = symbol; |
---|
[608] | 1025 | #if H_MV_ENC_DEC_TRAC |
---|
[1196] | 1026 | DTRACE_CU("rem_intra_luma_pred_mode", symbol) |
---|
[608] | 1027 | #endif |
---|
[1196] | 1028 | //postponed sorting of MPMs (only in remaining branch) |
---|
| 1029 | if (preds[0] > preds[1]) |
---|
| 1030 | { |
---|
| 1031 | std::swap(preds[0], preds[1]); |
---|
| 1032 | } |
---|
| 1033 | if (preds[0] > preds[2]) |
---|
| 1034 | { |
---|
| 1035 | std::swap(preds[0], preds[2]); |
---|
| 1036 | } |
---|
| 1037 | if (preds[1] > preds[2]) |
---|
| 1038 | { |
---|
| 1039 | std::swap(preds[1], preds[2]); |
---|
| 1040 | } |
---|
| 1041 | for ( Int i = 0; i < predNum; i++ ) |
---|
| 1042 | { |
---|
| 1043 | intraPredMode += ( intraPredMode >= preds[i] ); |
---|
| 1044 | } |
---|
[443] | 1045 | } |
---|
[1196] | 1046 | pcCU->setLumaIntraDirSubParts( (UChar)intraPredMode, absPartIdx+partOffset*j, depth ); |
---|
[608] | 1047 | #if H_3D_DIM |
---|
| 1048 | } |
---|
| 1049 | #endif |
---|
[443] | 1050 | } |
---|
| 1051 | } |
---|
[608] | 1052 | |
---|
| 1053 | Void TDecSbac::parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
[443] | 1054 | { |
---|
[608] | 1055 | UInt uiSymbol; |
---|
| 1056 | |
---|
| 1057 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUChromaPredSCModel.get( 0, 0, 0 ) ); |
---|
| 1058 | |
---|
| 1059 | if( uiSymbol == 0 ) |
---|
[443] | 1060 | { |
---|
[608] | 1061 | #if H_MV_ENC_DEC_TRAC |
---|
| 1062 | DTRACE_CU("intra_chroma_pred_mode", uiSymbol ) |
---|
| 1063 | #endif |
---|
[1196] | 1064 | uiSymbol = DM_CHROMA_IDX; |
---|
[443] | 1065 | } |
---|
[608] | 1066 | else |
---|
[443] | 1067 | { |
---|
[608] | 1068 | { |
---|
| 1069 | UInt uiIPredMode; |
---|
| 1070 | m_pcTDecBinIf->decodeBinsEP( uiIPredMode, 2 ); |
---|
| 1071 | #if H_MV_ENC_DEC_TRAC |
---|
| 1072 | DTRACE_CU("intra_chroma_pred_mode", uiIPredMode ) |
---|
| 1073 | #endif |
---|
[1196] | 1074 | UInt uiAllowedChromaDir[ NUM_CHROMA_MODE ]; |
---|
[608] | 1075 | pcCU->getAllowedChromaDir( uiAbsPartIdx, uiAllowedChromaDir ); |
---|
| 1076 | uiSymbol = uiAllowedChromaDir[ uiIPredMode ]; |
---|
| 1077 | } |
---|
[443] | 1078 | } |
---|
[608] | 1079 | pcCU->setChromIntraDirSubParts( uiSymbol, uiAbsPartIdx, uiDepth ); |
---|
| 1080 | return; |
---|
| 1081 | } |
---|
| 1082 | |
---|
| 1083 | #if H_3D_DIM |
---|
| 1084 | Void TDecSbac::parseIntraDepth( TComDataCU* pcCU, UInt absPartIdx, UInt depth ) |
---|
| 1085 | { |
---|
| 1086 | parseIntraDepthMode( pcCU, absPartIdx, depth ); |
---|
| 1087 | |
---|
| 1088 | UInt dir = pcCU->getLumaIntraDir( absPartIdx ); |
---|
| 1089 | UInt dimType = getDimType( dir ); |
---|
| 1090 | |
---|
| 1091 | switch( dimType ) |
---|
[443] | 1092 | { |
---|
[608] | 1093 | #if H_3D_DIM_DMM |
---|
| 1094 | case( DMM1_IDX ): |
---|
[443] | 1095 | { |
---|
[608] | 1096 | UInt uiTabIdx = 0; |
---|
| 1097 | xParseDmm1WedgeIdx( uiTabIdx, g_dmm1TabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] ); |
---|
[1124] | 1098 | |
---|
| 1099 | assert( uiTabIdx < g_dmmWedgeLists[ g_aucConvertToBit[ pcCU->getDMM1BasePatternWidth( pcCU->getWidth( absPartIdx ) )]].size()); |
---|
| 1100 | |
---|
[608] | 1101 | pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dimType, absPartIdx, depth ); |
---|
| 1102 | } break; |
---|
| 1103 | case( DMM4_IDX ): break; |
---|
| 1104 | #endif |
---|
| 1105 | default: break; |
---|
| 1106 | } |
---|
[443] | 1107 | |
---|
[608] | 1108 | pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth ); |
---|
| 1109 | } |
---|
[443] | 1110 | |
---|
[608] | 1111 | Void TDecSbac::parseIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx, UInt depth ) |
---|
[2] | 1112 | { |
---|
[833] | 1113 | UInt uiSymbol, uiIsDimMode; |
---|
| 1114 | |
---|
| 1115 | if( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() >> pcCU->getDepth( absPartIdx ) ) < 64 ) //DMM and HEVC intra modes are both allowed |
---|
| 1116 | { |
---|
[950] | 1117 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cAngleFlagSCModel.get( 0, 0, 0 ) ); |
---|
[833] | 1118 | } |
---|
| 1119 | else |
---|
| 1120 | { |
---|
| 1121 | uiSymbol = 1; |
---|
| 1122 | } |
---|
| 1123 | uiIsDimMode = uiSymbol ? 0 : 1; |
---|
| 1124 | pcCU->setLumaIntraDirSubParts( 0, absPartIdx, depth ); |
---|
| 1125 | |
---|
| 1126 | //decode DMM index |
---|
| 1127 | if( uiIsDimMode ) |
---|
| 1128 | { |
---|
[1124] | 1129 | if( pcCU->getSlice()->getIntraSdcWedgeFlag() && pcCU->getSlice()->getIntraContourFlag() ) |
---|
[1039] | 1130 | { |
---|
| 1131 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cDepthIntraModeSCModel.get( 0, 0, 0 ) ); |
---|
| 1132 | if( !uiSymbol ) |
---|
| 1133 | { |
---|
| 1134 | pcCU->setLumaIntraDirSubParts( DIM_OFFSET, absPartIdx, depth ); |
---|
| 1135 | } |
---|
| 1136 | else |
---|
| 1137 | { |
---|
| 1138 | pcCU->setLumaIntraDirSubParts( ( 1+ DIM_OFFSET ), absPartIdx, depth ); |
---|
| 1139 | } |
---|
| 1140 | } |
---|
[1124] | 1141 | else if ( pcCU->getSlice()->getIntraSdcWedgeFlag() ) |
---|
[1039] | 1142 | { |
---|
| 1143 | pcCU->setLumaIntraDirSubParts( DIM_OFFSET, absPartIdx, depth ); |
---|
| 1144 | } |
---|
[1124] | 1145 | else if( pcCU->getSlice()->getIntraContourFlag() ) |
---|
[1039] | 1146 | { |
---|
| 1147 | pcCU->setLumaIntraDirSubParts( ( 1+ DIM_OFFSET ), absPartIdx, depth ); |
---|
| 1148 | } |
---|
[833] | 1149 | } |
---|
| 1150 | } |
---|
[2] | 1151 | #endif |
---|
| 1152 | |
---|
[608] | 1153 | Void TDecSbac::parseInterDir( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx ) |
---|
[2] | 1154 | { |
---|
| 1155 | UInt uiSymbol; |
---|
[608] | 1156 | const UInt uiCtx = pcCU->getCtxInterDir( uiAbsPartIdx ); |
---|
| 1157 | ContextModel *pCtx = m_cCUInterDirSCModel.get( 0 ); |
---|
| 1158 | uiSymbol = 0; |
---|
| 1159 | if (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N || pcCU->getHeight(uiAbsPartIdx) != 8 ) |
---|
[2] | 1160 | { |
---|
[608] | 1161 | m_pcTDecBinIf->decodeBin( uiSymbol, *( pCtx + uiCtx ) ); |
---|
[2] | 1162 | } |
---|
| 1163 | |
---|
[56] | 1164 | if( uiSymbol ) |
---|
[2] | 1165 | { |
---|
| 1166 | uiSymbol = 2; |
---|
| 1167 | } |
---|
[608] | 1168 | else |
---|
| 1169 | { |
---|
| 1170 | m_pcTDecBinIf->decodeBin( uiSymbol, *( pCtx + 4 ) ); |
---|
| 1171 | assert(uiSymbol == 0 || uiSymbol == 1); |
---|
| 1172 | } |
---|
[56] | 1173 | |
---|
[2] | 1174 | uiSymbol++; |
---|
| 1175 | ruiInterDir = uiSymbol; |
---|
[608] | 1176 | #if H_MV_ENC_DEC_TRAC |
---|
| 1177 | DTRACE_PU("inter_pred_idc", ruiInterDir - 1 ) |
---|
| 1178 | #endif |
---|
| 1179 | |
---|
[2] | 1180 | return; |
---|
| 1181 | } |
---|
| 1182 | |
---|
[608] | 1183 | Void TDecSbac::parseRefFrmIdx( TComDataCU* pcCU, Int& riRefFrmIdx, RefPicList eRefList ) |
---|
[2] | 1184 | { |
---|
| 1185 | UInt uiSymbol; |
---|
| 1186 | { |
---|
[56] | 1187 | ContextModel *pCtx = m_cCURefPicSCModel.get( 0 ); |
---|
| 1188 | m_pcTDecBinIf->decodeBin( uiSymbol, *pCtx ); |
---|
[2] | 1189 | |
---|
[56] | 1190 | if( uiSymbol ) |
---|
[2] | 1191 | { |
---|
[608] | 1192 | UInt uiRefNum = pcCU->getSlice()->getNumRefIdx( eRefList ) - 2; |
---|
| 1193 | pCtx++; |
---|
| 1194 | UInt ui; |
---|
| 1195 | for( ui = 0; ui < uiRefNum; ++ui ) |
---|
| 1196 | { |
---|
| 1197 | if( ui == 0 ) |
---|
| 1198 | { |
---|
| 1199 | m_pcTDecBinIf->decodeBin( uiSymbol, *pCtx ); |
---|
| 1200 | } |
---|
| 1201 | else |
---|
| 1202 | { |
---|
| 1203 | m_pcTDecBinIf->decodeBinEP( uiSymbol ); |
---|
| 1204 | } |
---|
| 1205 | if( uiSymbol == 0 ) |
---|
| 1206 | { |
---|
| 1207 | break; |
---|
| 1208 | } |
---|
| 1209 | } |
---|
| 1210 | uiSymbol = ui + 1; |
---|
[2] | 1211 | } |
---|
| 1212 | riRefFrmIdx = uiSymbol; |
---|
| 1213 | } |
---|
[608] | 1214 | |
---|
| 1215 | #if H_MV_ENC_DEC_TRAC |
---|
| 1216 | #if ENC_DEC_TRACE |
---|
| 1217 | if ( eRefList == REF_PIC_LIST_0 ) |
---|
| 1218 | { |
---|
| 1219 | DTRACE_PU("ref_idx_l0", uiSymbol) |
---|
| 1220 | } |
---|
[2] | 1221 | else |
---|
| 1222 | { |
---|
[608] | 1223 | DTRACE_PU("ref_idx_l1", uiSymbol) |
---|
[2] | 1224 | } |
---|
[608] | 1225 | #endif |
---|
| 1226 | #endif |
---|
[2] | 1227 | return; |
---|
| 1228 | } |
---|
| 1229 | |
---|
[56] | 1230 | Void TDecSbac::parseMvd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth, RefPicList eRefList ) |
---|
[2] | 1231 | { |
---|
| 1232 | UInt uiSymbol; |
---|
[56] | 1233 | UInt uiHorAbs; |
---|
| 1234 | UInt uiVerAbs; |
---|
| 1235 | UInt uiHorSign = 0; |
---|
| 1236 | UInt uiVerSign = 0; |
---|
| 1237 | ContextModel *pCtx = m_cCUMvdSCModel.get( 0 ); |
---|
[2] | 1238 | |
---|
[56] | 1239 | if(pcCU->getSlice()->getMvdL1ZeroFlag() && eRefList == REF_PIC_LIST_1 && pcCU->getInterDir(uiAbsPartIdx)==3) |
---|
| 1240 | { |
---|
| 1241 | uiHorAbs=0; |
---|
| 1242 | uiVerAbs=0; |
---|
| 1243 | } |
---|
| 1244 | else |
---|
| 1245 | { |
---|
| 1246 | m_pcTDecBinIf->decodeBin( uiHorAbs, *pCtx ); |
---|
| 1247 | m_pcTDecBinIf->decodeBin( uiVerAbs, *pCtx ); |
---|
[2] | 1248 | |
---|
[56] | 1249 | const Bool bHorAbsGr0 = uiHorAbs != 0; |
---|
| 1250 | const Bool bVerAbsGr0 = uiVerAbs != 0; |
---|
| 1251 | pCtx++; |
---|
| 1252 | |
---|
| 1253 | if( bHorAbsGr0 ) |
---|
| 1254 | { |
---|
| 1255 | m_pcTDecBinIf->decodeBin( uiSymbol, *pCtx ); |
---|
| 1256 | uiHorAbs += uiSymbol; |
---|
| 1257 | } |
---|
| 1258 | |
---|
| 1259 | if( bVerAbsGr0 ) |
---|
| 1260 | { |
---|
| 1261 | m_pcTDecBinIf->decodeBin( uiSymbol, *pCtx ); |
---|
| 1262 | uiVerAbs += uiSymbol; |
---|
| 1263 | } |
---|
| 1264 | |
---|
| 1265 | if( bHorAbsGr0 ) |
---|
| 1266 | { |
---|
| 1267 | if( 2 == uiHorAbs ) |
---|
| 1268 | { |
---|
| 1269 | xReadEpExGolomb( uiSymbol, 1 ); |
---|
| 1270 | uiHorAbs += uiSymbol; |
---|
| 1271 | } |
---|
| 1272 | |
---|
| 1273 | m_pcTDecBinIf->decodeBinEP( uiHorSign ); |
---|
| 1274 | } |
---|
| 1275 | |
---|
| 1276 | if( bVerAbsGr0 ) |
---|
| 1277 | { |
---|
| 1278 | if( 2 == uiVerAbs ) |
---|
| 1279 | { |
---|
| 1280 | xReadEpExGolomb( uiSymbol, 1 ); |
---|
| 1281 | uiVerAbs += uiSymbol; |
---|
| 1282 | } |
---|
| 1283 | |
---|
| 1284 | m_pcTDecBinIf->decodeBinEP( uiVerSign ); |
---|
| 1285 | } |
---|
| 1286 | |
---|
| 1287 | } |
---|
[2] | 1288 | |
---|
[56] | 1289 | const TComMv cMv( uiHorSign ? -Int( uiHorAbs ): uiHorAbs, uiVerSign ? -Int( uiVerAbs ) : uiVerAbs ); |
---|
| 1290 | pcCU->getCUMvField( eRefList )->setAllMvd( cMv, pcCU->getPartitionSize( uiAbsPartIdx ), uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
[2] | 1291 | return; |
---|
| 1292 | } |
---|
| 1293 | |
---|
| 1294 | |
---|
| 1295 | Void TDecSbac::parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize ) |
---|
| 1296 | { |
---|
| 1297 | m_pcTDecBinIf->decodeBin( ruiSubdivFlag, m_cCUTransSubdivFlagSCModel.get( 0, 0, uiLog2TransformBlockSize ) ); |
---|
[608] | 1298 | #if !H_MV_ENC_DEC_TRAC |
---|
[56] | 1299 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
[2] | 1300 | DTRACE_CABAC_T( "\tparseTransformSubdivFlag()" ) |
---|
| 1301 | DTRACE_CABAC_T( "\tsymbol=" ) |
---|
| 1302 | DTRACE_CABAC_V( ruiSubdivFlag ) |
---|
| 1303 | DTRACE_CABAC_T( "\tctx=" ) |
---|
| 1304 | DTRACE_CABAC_V( uiLog2TransformBlockSize ) |
---|
| 1305 | DTRACE_CABAC_T( "\n" ) |
---|
[1179] | 1306 | #else |
---|
| 1307 | DTRACE_TU("split_transform_flag", ruiSubdivFlag ) |
---|
[608] | 1308 | #endif |
---|
[2] | 1309 | } |
---|
| 1310 | |
---|
[608] | 1311 | Void TDecSbac::parseQtRootCbf( UInt uiAbsPartIdx, UInt& uiQtRootCbf ) |
---|
[2] | 1312 | { |
---|
| 1313 | UInt uiSymbol; |
---|
[56] | 1314 | const UInt uiCtx = 0; |
---|
[2] | 1315 | m_pcTDecBinIf->decodeBin( uiSymbol , m_cCUQtRootCbfSCModel.get( 0, 0, uiCtx ) ); |
---|
[608] | 1316 | #if !H_MV_ENC_DEC_TRAC |
---|
[56] | 1317 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
[2] | 1318 | DTRACE_CABAC_T( "\tparseQtRootCbf()" ) |
---|
| 1319 | DTRACE_CABAC_T( "\tsymbol=" ) |
---|
| 1320 | DTRACE_CABAC_V( uiSymbol ) |
---|
| 1321 | DTRACE_CABAC_T( "\tctx=" ) |
---|
| 1322 | DTRACE_CABAC_V( uiCtx ) |
---|
| 1323 | DTRACE_CABAC_T( "\tuiAbsPartIdx=" ) |
---|
| 1324 | DTRACE_CABAC_V( uiAbsPartIdx ) |
---|
| 1325 | DTRACE_CABAC_T( "\n" ) |
---|
[608] | 1326 | #else |
---|
| 1327 | DTRACE_CU( "rqt_root_cbf", uiSymbol ) |
---|
| 1328 | #endif |
---|
[2] | 1329 | |
---|
| 1330 | uiQtRootCbf = uiSymbol; |
---|
| 1331 | } |
---|
| 1332 | |
---|
| 1333 | Void TDecSbac::parseDeltaQP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 1334 | { |
---|
[56] | 1335 | Int qp; |
---|
[2] | 1336 | UInt uiDQp; |
---|
| 1337 | Int iDQp; |
---|
| 1338 | |
---|
[608] | 1339 | UInt uiSymbol; |
---|
| 1340 | |
---|
| 1341 | xReadUnaryMaxSymbol (uiDQp, &m_cCUDeltaQpSCModel.get( 0, 0, 0 ), 1, CU_DQP_TU_CMAX); |
---|
| 1342 | |
---|
| 1343 | if( uiDQp >= CU_DQP_TU_CMAX) |
---|
[2] | 1344 | { |
---|
[608] | 1345 | xReadEpExGolomb( uiSymbol, CU_DQP_EG_k ); |
---|
| 1346 | uiDQp+=uiSymbol; |
---|
[2] | 1347 | } |
---|
[608] | 1348 | |
---|
| 1349 | if ( uiDQp > 0 ) |
---|
[2] | 1350 | { |
---|
[56] | 1351 | UInt uiSign; |
---|
| 1352 | Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY(); |
---|
| 1353 | m_pcTDecBinIf->decodeBinEP(uiSign); |
---|
[608] | 1354 | iDQp = uiDQp; |
---|
[56] | 1355 | if(uiSign) |
---|
[2] | 1356 | { |
---|
| 1357 | iDQp = -iDQp; |
---|
| 1358 | } |
---|
[56] | 1359 | qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+qpBdOffsetY)) - qpBdOffsetY; |
---|
[2] | 1360 | } |
---|
[608] | 1361 | else |
---|
| 1362 | { |
---|
| 1363 | qp = pcCU->getRefQP(uiAbsPartIdx); |
---|
| 1364 | } |
---|
| 1365 | pcCU->setQPSubParts(qp, uiAbsPartIdx, uiDepth); |
---|
| 1366 | pcCU->setCodedQP(qp); |
---|
[2] | 1367 | } |
---|
| 1368 | |
---|
| 1369 | Void TDecSbac::parseQtCbf( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth ) |
---|
| 1370 | { |
---|
| 1371 | UInt uiSymbol; |
---|
[608] | 1372 | const UInt uiCtx = pcCU->getCtxQtCbf( eType, uiTrDepth ); |
---|
[56] | 1373 | m_pcTDecBinIf->decodeBin( uiSymbol , m_cCUQtCbfSCModel.get( 0, eType ? TEXT_CHROMA: eType, uiCtx ) ); |
---|
[608] | 1374 | #if !H_MV_ENC_DEC_TRAC |
---|
[56] | 1375 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
[2] | 1376 | DTRACE_CABAC_T( "\tparseQtCbf()" ) |
---|
| 1377 | DTRACE_CABAC_T( "\tsymbol=" ) |
---|
| 1378 | DTRACE_CABAC_V( uiSymbol ) |
---|
| 1379 | DTRACE_CABAC_T( "\tctx=" ) |
---|
| 1380 | DTRACE_CABAC_V( uiCtx ) |
---|
| 1381 | DTRACE_CABAC_T( "\tetype=" ) |
---|
| 1382 | DTRACE_CABAC_V( eType ) |
---|
| 1383 | DTRACE_CABAC_T( "\tuiAbsPartIdx=" ) |
---|
| 1384 | DTRACE_CABAC_V( uiAbsPartIdx ) |
---|
| 1385 | DTRACE_CABAC_T( "\n" ) |
---|
[1179] | 1386 | #else |
---|
| 1387 | if ( eType == TEXT_CHROMA_U ) |
---|
| 1388 | { |
---|
| 1389 | DTRACE_TU("cbf_cb", uiSymbol ) |
---|
| 1390 | } |
---|
| 1391 | else if ( eType == TEXT_CHROMA_V ) |
---|
| 1392 | { |
---|
| 1393 | DTRACE_TU("cbf_cr", uiSymbol ) |
---|
| 1394 | } |
---|
| 1395 | else |
---|
| 1396 | { |
---|
| 1397 | DTRACE_TU("cbf_luma", uiSymbol ) |
---|
| 1398 | } |
---|
[608] | 1399 | #endif |
---|
[2] | 1400 | |
---|
| 1401 | pcCU->setCbfSubParts( uiSymbol << uiTrDepth, eType, uiAbsPartIdx, uiDepth ); |
---|
| 1402 | } |
---|
| 1403 | |
---|
[608] | 1404 | void TDecSbac::parseTransformSkipFlags (TComDataCU* pcCU, UInt uiAbsPartIdx, UInt width, UInt height, UInt uiDepth, TextType eTType) |
---|
| 1405 | { |
---|
| 1406 | if (pcCU->getCUTransquantBypass(uiAbsPartIdx)) |
---|
| 1407 | { |
---|
| 1408 | return; |
---|
| 1409 | } |
---|
| 1410 | if(width != 4 || height != 4) |
---|
| 1411 | { |
---|
| 1412 | return; |
---|
| 1413 | } |
---|
| 1414 | |
---|
| 1415 | UInt useTransformSkip; |
---|
| 1416 | m_pcTDecBinIf->decodeBin( useTransformSkip , m_cTransformSkipSCModel.get( 0, eTType? TEXT_CHROMA: TEXT_LUMA, 0 ) ); |
---|
| 1417 | if(eTType!= TEXT_LUMA) |
---|
| 1418 | { |
---|
| 1419 | const UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()] + 2 - uiDepth; |
---|
| 1420 | if(uiLog2TrafoSize == 2) |
---|
| 1421 | { |
---|
| 1422 | uiDepth --; |
---|
| 1423 | } |
---|
| 1424 | } |
---|
| 1425 | #if !H_MV_ENC_DEC_TRAC |
---|
| 1426 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
| 1427 | DTRACE_CABAC_T("\tparseTransformSkip()"); |
---|
| 1428 | DTRACE_CABAC_T( "\tsymbol=" ) |
---|
| 1429 | DTRACE_CABAC_V( useTransformSkip ) |
---|
| 1430 | DTRACE_CABAC_T( "\tAddr=" ) |
---|
| 1431 | DTRACE_CABAC_V( pcCU->getAddr() ) |
---|
| 1432 | DTRACE_CABAC_T( "\tetype=" ) |
---|
| 1433 | DTRACE_CABAC_V( eTType ) |
---|
| 1434 | DTRACE_CABAC_T( "\tuiAbsPartIdx=" ) |
---|
| 1435 | DTRACE_CABAC_V( uiAbsPartIdx ) |
---|
| 1436 | DTRACE_CABAC_T( "\n" ) |
---|
| 1437 | #endif |
---|
| 1438 | |
---|
| 1439 | pcCU->setTransformSkipSubParts( useTransformSkip, eTType, uiAbsPartIdx, uiDepth); |
---|
| 1440 | } |
---|
| 1441 | |
---|
[2] | 1442 | /** Parse (X,Y) position of the last significant coefficient |
---|
| 1443 | * \param uiPosLastX reference to X component of last coefficient |
---|
| 1444 | * \param uiPosLastY reference to Y component of last coefficient |
---|
[56] | 1445 | * \param width Block width |
---|
| 1446 | * \param height Block height |
---|
[2] | 1447 | * \param eTType plane type / luminance or chrominance |
---|
| 1448 | * \param uiScanIdx scan type (zig-zag, hor, ver) |
---|
[56] | 1449 | * |
---|
[2] | 1450 | * This method decodes the X and Y component within a block of the last significant coefficient. |
---|
| 1451 | */ |
---|
[56] | 1452 | Void TDecSbac::parseLastSignificantXY( UInt& uiPosLastX, UInt& uiPosLastY, Int width, Int height, TextType eTType, UInt uiScanIdx ) |
---|
[2] | 1453 | { |
---|
| 1454 | UInt uiLast; |
---|
[56] | 1455 | ContextModel *pCtxX = m_cCuCtxLastX.get( 0, eTType ); |
---|
| 1456 | ContextModel *pCtxY = m_cCuCtxLastY.get( 0, eTType ); |
---|
[2] | 1457 | |
---|
[608] | 1458 | Int blkSizeOffsetX, blkSizeOffsetY, shiftX, shiftY; |
---|
| 1459 | blkSizeOffsetX = eTType ? 0: (g_aucConvertToBit[ width ] *3 + ((g_aucConvertToBit[ width ] +1)>>2)); |
---|
| 1460 | blkSizeOffsetY = eTType ? 0: (g_aucConvertToBit[ height ]*3 + ((g_aucConvertToBit[ height ]+1)>>2)); |
---|
| 1461 | shiftX= eTType ? g_aucConvertToBit[ width ] :((g_aucConvertToBit[ width ]+3)>>2); |
---|
| 1462 | shiftY= eTType ? g_aucConvertToBit[ height ] :((g_aucConvertToBit[ height ]+3)>>2); |
---|
[56] | 1463 | // posX |
---|
| 1464 | for( uiPosLastX = 0; uiPosLastX < g_uiGroupIdx[ width - 1 ]; uiPosLastX++ ) |
---|
[2] | 1465 | { |
---|
[608] | 1466 | m_pcTDecBinIf->decodeBin( uiLast, *( pCtxX + blkSizeOffsetX + (uiPosLastX >>shiftX) ) ); |
---|
[56] | 1467 | if( !uiLast ) |
---|
| 1468 | { |
---|
[2] | 1469 | break; |
---|
| 1470 | } |
---|
| 1471 | } |
---|
| 1472 | |
---|
[56] | 1473 | // posY |
---|
| 1474 | for( uiPosLastY = 0; uiPosLastY < g_uiGroupIdx[ height - 1 ]; uiPosLastY++ ) |
---|
[2] | 1475 | { |
---|
[608] | 1476 | m_pcTDecBinIf->decodeBin( uiLast, *( pCtxY + blkSizeOffsetY + (uiPosLastY >>shiftY)) ); |
---|
[56] | 1477 | if( !uiLast ) |
---|
| 1478 | { |
---|
[2] | 1479 | break; |
---|
| 1480 | } |
---|
| 1481 | } |
---|
[56] | 1482 | if ( uiPosLastX > 3 ) |
---|
| 1483 | { |
---|
| 1484 | UInt uiTemp = 0; |
---|
| 1485 | UInt uiCount = ( uiPosLastX - 2 ) >> 1; |
---|
| 1486 | for ( Int i = uiCount - 1; i >= 0; i-- ) |
---|
| 1487 | { |
---|
| 1488 | m_pcTDecBinIf->decodeBinEP( uiLast ); |
---|
| 1489 | uiTemp += uiLast << i; |
---|
| 1490 | } |
---|
| 1491 | uiPosLastX = g_uiMinInGroup[ uiPosLastX ] + uiTemp; |
---|
| 1492 | } |
---|
| 1493 | if ( uiPosLastY > 3 ) |
---|
| 1494 | { |
---|
| 1495 | UInt uiTemp = 0; |
---|
| 1496 | UInt uiCount = ( uiPosLastY - 2 ) >> 1; |
---|
| 1497 | for ( Int i = uiCount - 1; i >= 0; i-- ) |
---|
| 1498 | { |
---|
| 1499 | m_pcTDecBinIf->decodeBinEP( uiLast ); |
---|
| 1500 | uiTemp += uiLast << i; |
---|
| 1501 | } |
---|
| 1502 | uiPosLastY = g_uiMinInGroup[ uiPosLastY ] + uiTemp; |
---|
| 1503 | } |
---|
| 1504 | |
---|
[2] | 1505 | if( uiScanIdx == SCAN_VER ) |
---|
| 1506 | { |
---|
| 1507 | swap( uiPosLastX, uiPosLastY ); |
---|
| 1508 | } |
---|
| 1509 | } |
---|
| 1510 | |
---|
| 1511 | Void TDecSbac::parseCoeffNxN( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType ) |
---|
| 1512 | { |
---|
[608] | 1513 | #if !H_MV_ENC_DEC_TRAC |
---|
[56] | 1514 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
[2] | 1515 | DTRACE_CABAC_T( "\tparseCoeffNxN()\teType=" ) |
---|
| 1516 | DTRACE_CABAC_V( eTType ) |
---|
| 1517 | DTRACE_CABAC_T( "\twidth=" ) |
---|
| 1518 | DTRACE_CABAC_V( uiWidth ) |
---|
| 1519 | DTRACE_CABAC_T( "\theight=" ) |
---|
| 1520 | DTRACE_CABAC_V( uiHeight ) |
---|
| 1521 | DTRACE_CABAC_T( "\tdepth=" ) |
---|
| 1522 | DTRACE_CABAC_V( uiDepth ) |
---|
| 1523 | DTRACE_CABAC_T( "\tabspartidx=" ) |
---|
| 1524 | DTRACE_CABAC_V( uiAbsPartIdx ) |
---|
| 1525 | DTRACE_CABAC_T( "\ttoCU-X=" ) |
---|
| 1526 | DTRACE_CABAC_V( pcCU->getCUPelX() ) |
---|
| 1527 | DTRACE_CABAC_T( "\ttoCU-Y=" ) |
---|
| 1528 | DTRACE_CABAC_V( pcCU->getCUPelY() ) |
---|
| 1529 | DTRACE_CABAC_T( "\tCU-addr=" ) |
---|
| 1530 | DTRACE_CABAC_V( pcCU->getAddr() ) |
---|
| 1531 | DTRACE_CABAC_T( "\tinCU-X=" ) |
---|
| 1532 | DTRACE_CABAC_V( g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ] ) |
---|
| 1533 | DTRACE_CABAC_T( "\tinCU-Y=" ) |
---|
| 1534 | DTRACE_CABAC_V( g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ] ) |
---|
| 1535 | DTRACE_CABAC_T( "\tpredmode=" ) |
---|
| 1536 | DTRACE_CABAC_V( pcCU->getPredictionMode( uiAbsPartIdx ) ) |
---|
| 1537 | DTRACE_CABAC_T( "\n" ) |
---|
[608] | 1538 | #endif |
---|
[2] | 1539 | |
---|
| 1540 | if( uiWidth > pcCU->getSlice()->getSPS()->getMaxTrSize() ) |
---|
| 1541 | { |
---|
| 1542 | uiWidth = pcCU->getSlice()->getSPS()->getMaxTrSize(); |
---|
| 1543 | uiHeight = pcCU->getSlice()->getSPS()->getMaxTrSize(); |
---|
| 1544 | } |
---|
[608] | 1545 | if(pcCU->getSlice()->getPPS()->getUseTransformSkip()) |
---|
| 1546 | { |
---|
| 1547 | parseTransformSkipFlags( pcCU, uiAbsPartIdx, uiWidth, uiHeight, uiDepth, eTType); |
---|
| 1548 | } |
---|
| 1549 | |
---|
[2] | 1550 | eTType = eTType == TEXT_LUMA ? TEXT_LUMA : ( eTType == TEXT_NONE ? TEXT_NONE : TEXT_CHROMA ); |
---|
| 1551 | |
---|
| 1552 | //----- parse significance map ----- |
---|
| 1553 | const UInt uiLog2BlockSize = g_aucConvertToBit[ uiWidth ] + 2; |
---|
[56] | 1554 | const UInt uiMaxNumCoeff = uiWidth * uiHeight; |
---|
[2] | 1555 | const UInt uiMaxNumCoeffM1 = uiMaxNumCoeff - 1; |
---|
[56] | 1556 | UInt uiScanIdx = pcCU->getCoefScanIdx(uiAbsPartIdx, uiWidth, eTType==TEXT_LUMA, pcCU->isIntra(uiAbsPartIdx)); |
---|
[2] | 1557 | |
---|
[56] | 1558 | //===== decode last significant ===== |
---|
| 1559 | UInt uiPosLastX, uiPosLastY; |
---|
| 1560 | parseLastSignificantXY( uiPosLastX, uiPosLastY, uiWidth, uiHeight, eTType, uiScanIdx ); |
---|
| 1561 | UInt uiBlkPosLast = uiPosLastX + (uiPosLastY<<uiLog2BlockSize); |
---|
| 1562 | pcCoef[ uiBlkPosLast ] = 1; |
---|
[2] | 1563 | |
---|
[56] | 1564 | //===== decode significance flags ===== |
---|
[608] | 1565 | UInt uiScanPosLast; |
---|
| 1566 | const UInt *scan = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlockSize-1 ]; |
---|
[56] | 1567 | for( uiScanPosLast = 0; uiScanPosLast < uiMaxNumCoeffM1; uiScanPosLast++ ) |
---|
| 1568 | { |
---|
| 1569 | UInt uiBlkPos = scan[ uiScanPosLast ]; |
---|
| 1570 | if( uiBlkPosLast == uiBlkPos ) |
---|
[2] | 1571 | { |
---|
[56] | 1572 | break; |
---|
[2] | 1573 | } |
---|
[56] | 1574 | } |
---|
[2] | 1575 | |
---|
[56] | 1576 | ContextModel * const baseCoeffGroupCtx = m_cCUSigCoeffGroupSCModel.get( 0, eTType ); |
---|
| 1577 | ContextModel * const baseCtx = (eTType==TEXT_LUMA) ? m_cCUSigSCModel.get( 0, 0 ) : m_cCUSigSCModel.get( 0, 0 ) + NUM_SIG_FLAG_CTX_LUMA; |
---|
| 1578 | |
---|
| 1579 | const Int iLastScanSet = uiScanPosLast >> LOG2_SCAN_SET_SIZE; |
---|
[608] | 1580 | UInt c1 = 1; |
---|
[56] | 1581 | UInt uiGoRiceParam = 0; |
---|
| 1582 | |
---|
| 1583 | Bool beValid; |
---|
[608] | 1584 | if (pcCU->getCUTransquantBypass(uiAbsPartIdx)) |
---|
[2] | 1585 | { |
---|
[56] | 1586 | beValid = false; |
---|
| 1587 | } |
---|
| 1588 | else |
---|
| 1589 | { |
---|
| 1590 | beValid = pcCU->getSlice()->getPPS()->getSignHideFlag() > 0; |
---|
| 1591 | } |
---|
| 1592 | UInt absSum = 0; |
---|
| 1593 | |
---|
| 1594 | UInt uiSigCoeffGroupFlag[ MLS_GRP_NUM ]; |
---|
| 1595 | ::memset( uiSigCoeffGroupFlag, 0, sizeof(UInt) * MLS_GRP_NUM ); |
---|
| 1596 | const UInt uiNumBlkSide = uiWidth >> (MLS_CG_SIZE >> 1); |
---|
| 1597 | const UInt * scanCG; |
---|
| 1598 | { |
---|
| 1599 | scanCG = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlockSize > 3 ? uiLog2BlockSize-2-1 : 0 ]; |
---|
| 1600 | if( uiLog2BlockSize == 3 ) |
---|
[2] | 1601 | { |
---|
[56] | 1602 | scanCG = g_sigLastScan8x8[ uiScanIdx ]; |
---|
[2] | 1603 | } |
---|
[56] | 1604 | else if( uiLog2BlockSize == 5 ) |
---|
| 1605 | { |
---|
| 1606 | scanCG = g_sigLastScanCG32x32; |
---|
| 1607 | } |
---|
[2] | 1608 | } |
---|
[56] | 1609 | Int iScanPosSig = (Int) uiScanPosLast; |
---|
| 1610 | for( Int iSubSet = iLastScanSet; iSubSet >= 0; iSubSet-- ) |
---|
| 1611 | { |
---|
| 1612 | Int iSubPos = iSubSet << LOG2_SCAN_SET_SIZE; |
---|
| 1613 | uiGoRiceParam = 0; |
---|
| 1614 | Int numNonZero = 0; |
---|
| 1615 | |
---|
| 1616 | Int lastNZPosInCG = -1, firstNZPosInCG = SCAN_SET_SIZE; |
---|
| 1617 | |
---|
| 1618 | Int pos[SCAN_SET_SIZE]; |
---|
| 1619 | if( iScanPosSig == (Int) uiScanPosLast ) |
---|
| 1620 | { |
---|
| 1621 | lastNZPosInCG = iScanPosSig; |
---|
| 1622 | firstNZPosInCG = iScanPosSig; |
---|
| 1623 | iScanPosSig--; |
---|
| 1624 | pos[ numNonZero ] = uiBlkPosLast; |
---|
| 1625 | numNonZero = 1; |
---|
| 1626 | } |
---|
[2] | 1627 | |
---|
[608] | 1628 | // decode significant_coeffgroup_flag |
---|
| 1629 | Int iCGBlkPos = scanCG[ iSubSet ]; |
---|
| 1630 | Int iCGPosY = iCGBlkPos / uiNumBlkSide; |
---|
| 1631 | Int iCGPosX = iCGBlkPos - (iCGPosY * uiNumBlkSide); |
---|
| 1632 | if( iSubSet == iLastScanSet || iSubSet == 0) |
---|
| 1633 | { |
---|
| 1634 | uiSigCoeffGroupFlag[ iCGBlkPos ] = 1; |
---|
| 1635 | } |
---|
| 1636 | else |
---|
| 1637 | { |
---|
| 1638 | UInt uiSigCoeffGroup; |
---|
| 1639 | UInt uiCtxSig = TComTrQuant::getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiWidth, uiHeight ); |
---|
| 1640 | m_pcTDecBinIf->decodeBin( uiSigCoeffGroup, baseCoeffGroupCtx[ uiCtxSig ] ); |
---|
| 1641 | uiSigCoeffGroupFlag[ iCGBlkPos ] = uiSigCoeffGroup; |
---|
| 1642 | } |
---|
[56] | 1643 | |
---|
[608] | 1644 | // decode significant_coeff_flag |
---|
| 1645 | Int patternSigCtx = TComTrQuant::calcPatternSigCtx( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiWidth, uiHeight ); |
---|
| 1646 | UInt uiBlkPos, uiPosY, uiPosX, uiSig, uiCtxSig; |
---|
| 1647 | for( ; iScanPosSig >= iSubPos; iScanPosSig-- ) |
---|
| 1648 | { |
---|
| 1649 | uiBlkPos = scan[ iScanPosSig ]; |
---|
| 1650 | uiPosY = uiBlkPos >> uiLog2BlockSize; |
---|
| 1651 | uiPosX = uiBlkPos - ( uiPosY << uiLog2BlockSize ); |
---|
| 1652 | uiSig = 0; |
---|
| 1653 | |
---|
| 1654 | if( uiSigCoeffGroupFlag[ iCGBlkPos ] ) |
---|
[56] | 1655 | { |
---|
[608] | 1656 | if( iScanPosSig > iSubPos || iSubSet == 0 || numNonZero ) |
---|
[2] | 1657 | { |
---|
[608] | 1658 | uiCtxSig = TComTrQuant::getSigCtxInc( patternSigCtx, uiScanIdx, uiPosX, uiPosY, uiLog2BlockSize, eTType ); |
---|
| 1659 | m_pcTDecBinIf->decodeBin( uiSig, baseCtx[ uiCtxSig ] ); |
---|
[2] | 1660 | } |
---|
[608] | 1661 | else |
---|
[2] | 1662 | { |
---|
[608] | 1663 | uiSig = 1; |
---|
[2] | 1664 | } |
---|
[56] | 1665 | } |
---|
[608] | 1666 | pcCoef[ uiBlkPos ] = uiSig; |
---|
| 1667 | if( uiSig ) |
---|
| 1668 | { |
---|
| 1669 | pos[ numNonZero ] = uiBlkPos; |
---|
| 1670 | numNonZero ++; |
---|
| 1671 | if( lastNZPosInCG == -1 ) |
---|
| 1672 | { |
---|
| 1673 | lastNZPosInCG = iScanPosSig; |
---|
| 1674 | } |
---|
| 1675 | firstNZPosInCG = iScanPosSig; |
---|
| 1676 | } |
---|
| 1677 | } |
---|
[2] | 1678 | |
---|
[56] | 1679 | if( numNonZero ) |
---|
[2] | 1680 | { |
---|
[608] | 1681 | Bool signHidden = ( lastNZPosInCG - firstNZPosInCG >= SBH_THRESHOLD ); |
---|
[56] | 1682 | absSum = 0; |
---|
| 1683 | UInt uiCtxSet = (iSubSet > 0 && eTType==TEXT_LUMA) ? 2 : 0; |
---|
| 1684 | UInt uiBin; |
---|
[608] | 1685 | if( c1 == 0 ) |
---|
[2] | 1686 | { |
---|
[56] | 1687 | uiCtxSet++; |
---|
| 1688 | } |
---|
[608] | 1689 | c1 = 1; |
---|
[56] | 1690 | ContextModel *baseCtxMod = ( eTType==TEXT_LUMA ) ? m_cCUOneSCModel.get( 0, 0 ) + 4 * uiCtxSet : m_cCUOneSCModel.get( 0, 0 ) + NUM_ONE_FLAG_CTX_LUMA + 4 * uiCtxSet; |
---|
| 1691 | Int absCoeff[SCAN_SET_SIZE]; |
---|
| 1692 | |
---|
| 1693 | for ( Int i = 0; i < numNonZero; i++) absCoeff[i] = 1; |
---|
| 1694 | Int numC1Flag = min(numNonZero, C1FLAG_NUMBER); |
---|
| 1695 | Int firstC2FlagIdx = -1; |
---|
| 1696 | |
---|
| 1697 | for( Int idx = 0; idx < numC1Flag; idx++ ) |
---|
| 1698 | { |
---|
| 1699 | m_pcTDecBinIf->decodeBin( uiBin, baseCtxMod[c1] ); |
---|
| 1700 | if( uiBin == 1 ) |
---|
[2] | 1701 | { |
---|
[56] | 1702 | c1 = 0; |
---|
| 1703 | if (firstC2FlagIdx == -1) |
---|
| 1704 | { |
---|
| 1705 | firstC2FlagIdx = idx; |
---|
| 1706 | } |
---|
| 1707 | } |
---|
| 1708 | else if( (c1 < 3) && (c1 > 0) ) |
---|
| 1709 | { |
---|
[2] | 1710 | c1++; |
---|
| 1711 | } |
---|
[56] | 1712 | absCoeff[ idx ] = uiBin + 1; |
---|
| 1713 | } |
---|
| 1714 | |
---|
| 1715 | if (c1 == 0) |
---|
| 1716 | { |
---|
| 1717 | baseCtxMod = ( eTType==TEXT_LUMA ) ? m_cCUAbsSCModel.get( 0, 0 ) + uiCtxSet : m_cCUAbsSCModel.get( 0, 0 ) + NUM_ABS_FLAG_CTX_LUMA + uiCtxSet; |
---|
| 1718 | if ( firstC2FlagIdx != -1) |
---|
[2] | 1719 | { |
---|
[56] | 1720 | m_pcTDecBinIf->decodeBin( uiBin, baseCtxMod[0] ); |
---|
| 1721 | absCoeff[ firstC2FlagIdx ] = uiBin + 2; |
---|
[2] | 1722 | } |
---|
| 1723 | } |
---|
[56] | 1724 | |
---|
| 1725 | UInt coeffSigns; |
---|
| 1726 | if ( signHidden && beValid ) |
---|
| 1727 | { |
---|
| 1728 | m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero-1 ); |
---|
| 1729 | coeffSigns <<= 32 - (numNonZero-1); |
---|
| 1730 | } |
---|
| 1731 | else |
---|
| 1732 | { |
---|
| 1733 | m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero ); |
---|
| 1734 | coeffSigns <<= 32 - numNonZero; |
---|
| 1735 | } |
---|
[2] | 1736 | |
---|
[56] | 1737 | Int iFirstCoeff2 = 1; |
---|
| 1738 | if (c1 == 0 || numNonZero > C1FLAG_NUMBER) |
---|
[2] | 1739 | { |
---|
[56] | 1740 | for( Int idx = 0; idx < numNonZero; idx++ ) |
---|
[2] | 1741 | { |
---|
[56] | 1742 | UInt baseLevel = (idx < C1FLAG_NUMBER)? (2 + iFirstCoeff2) : 1; |
---|
[2] | 1743 | |
---|
[56] | 1744 | if( absCoeff[ idx ] == baseLevel) |
---|
[2] | 1745 | { |
---|
[56] | 1746 | UInt uiLevel; |
---|
[608] | 1747 | xReadCoefRemainExGolomb( uiLevel, uiGoRiceParam ); |
---|
[56] | 1748 | absCoeff[ idx ] = uiLevel + baseLevel; |
---|
[608] | 1749 | if(absCoeff[idx]>3*(1<<uiGoRiceParam)) |
---|
| 1750 | { |
---|
| 1751 | uiGoRiceParam = min<UInt>(uiGoRiceParam+ 1, 4); |
---|
| 1752 | } |
---|
[2] | 1753 | } |
---|
[56] | 1754 | |
---|
| 1755 | if(absCoeff[ idx ] >= 2) |
---|
[2] | 1756 | { |
---|
[56] | 1757 | iFirstCoeff2 = 0; |
---|
[2] | 1758 | } |
---|
| 1759 | } |
---|
| 1760 | } |
---|
[56] | 1761 | |
---|
| 1762 | for( Int idx = 0; idx < numNonZero; idx++ ) |
---|
[2] | 1763 | { |
---|
[56] | 1764 | Int blkPos = pos[ idx ]; |
---|
| 1765 | // Signs applied later. |
---|
| 1766 | pcCoef[ blkPos ] = absCoeff[ idx ]; |
---|
| 1767 | absSum += absCoeff[ idx ]; |
---|
| 1768 | |
---|
| 1769 | if ( idx == numNonZero-1 && signHidden && beValid ) |
---|
| 1770 | { |
---|
| 1771 | // Infer sign of 1st element. |
---|
| 1772 | if (absSum&0x1) |
---|
[608] | 1773 | { |
---|
[56] | 1774 | pcCoef[ blkPos ] = -pcCoef[ blkPos ]; |
---|
[608] | 1775 | } |
---|
[56] | 1776 | } |
---|
| 1777 | else |
---|
| 1778 | { |
---|
| 1779 | Int sign = static_cast<Int>( coeffSigns ) >> 31; |
---|
| 1780 | pcCoef[ blkPos ] = ( pcCoef[ blkPos ] ^ sign ) - sign; |
---|
| 1781 | coeffSigns <<= 1; |
---|
| 1782 | } |
---|
[2] | 1783 | } |
---|
| 1784 | } |
---|
| 1785 | } |
---|
| 1786 | |
---|
| 1787 | return; |
---|
| 1788 | } |
---|
| 1789 | |
---|
[608] | 1790 | |
---|
[443] | 1791 | Void TDecSbac::parseSaoMaxUvlc ( UInt& val, UInt maxSymbol ) |
---|
| 1792 | { |
---|
[608] | 1793 | if (maxSymbol == 0) |
---|
[2] | 1794 | { |
---|
[608] | 1795 | val = 0; |
---|
[2] | 1796 | return; |
---|
| 1797 | } |
---|
[56] | 1798 | |
---|
[608] | 1799 | UInt code; |
---|
[2] | 1800 | Int i; |
---|
[608] | 1801 | m_pcTDecBinIf->decodeBinEP( code ); |
---|
| 1802 | if ( code == 0 ) |
---|
[2] | 1803 | { |
---|
[608] | 1804 | val = 0; |
---|
[2] | 1805 | return; |
---|
| 1806 | } |
---|
[56] | 1807 | |
---|
[2] | 1808 | i=1; |
---|
| 1809 | while (1) |
---|
| 1810 | { |
---|
[608] | 1811 | m_pcTDecBinIf->decodeBinEP( code ); |
---|
| 1812 | if ( code == 0 ) |
---|
| 1813 | { |
---|
| 1814 | break; |
---|
| 1815 | } |
---|
[2] | 1816 | i++; |
---|
[608] | 1817 | if (i == maxSymbol) |
---|
[56] | 1818 | { |
---|
[608] | 1819 | break; |
---|
[56] | 1820 | } |
---|
| 1821 | } |
---|
[608] | 1822 | |
---|
| 1823 | val = i; |
---|
[2] | 1824 | } |
---|
[608] | 1825 | Void TDecSbac::parseSaoUflc (UInt uiLength, UInt& riVal) |
---|
[56] | 1826 | { |
---|
[608] | 1827 | m_pcTDecBinIf->decodeBinsEP ( riVal, uiLength ); |
---|
[56] | 1828 | } |
---|
[608] | 1829 | Void TDecSbac::parseSaoMerge (UInt& ruiVal) |
---|
[2] | 1830 | { |
---|
| 1831 | UInt uiCode; |
---|
[608] | 1832 | m_pcTDecBinIf->decodeBin( uiCode, m_cSaoMergeSCModel.get( 0, 0, 0 ) ); |
---|
[56] | 1833 | ruiVal = (Int)uiCode; |
---|
| 1834 | } |
---|
| 1835 | Void TDecSbac::parseSaoTypeIdx (UInt& ruiVal) |
---|
| 1836 | { |
---|
| 1837 | UInt uiCode; |
---|
| 1838 | m_pcTDecBinIf->decodeBin( uiCode, m_cSaoTypeIdxSCModel.get( 0, 0, 0 ) ); |
---|
[608] | 1839 | if (uiCode == 0) |
---|
[2] | 1840 | { |
---|
| 1841 | ruiVal = 0; |
---|
| 1842 | } |
---|
[608] | 1843 | else |
---|
[2] | 1844 | { |
---|
[608] | 1845 | m_pcTDecBinIf->decodeBinEP( uiCode ); |
---|
| 1846 | if (uiCode == 0) |
---|
| 1847 | { |
---|
[872] | 1848 | ruiVal = 1; |
---|
[608] | 1849 | } |
---|
| 1850 | else |
---|
| 1851 | { |
---|
[872] | 1852 | ruiVal = 2; |
---|
[608] | 1853 | } |
---|
[2] | 1854 | } |
---|
| 1855 | } |
---|
| 1856 | |
---|
[872] | 1857 | Void TDecSbac::parseSaoSign(UInt& val) |
---|
[2] | 1858 | { |
---|
[872] | 1859 | m_pcTDecBinIf->decodeBinEP ( val ); |
---|
[56] | 1860 | } |
---|
[608] | 1861 | |
---|
[872] | 1862 | Void TDecSbac::parseSAOBlkParam (SAOBlkParam& saoBlkParam |
---|
| 1863 | , Bool* sliceEnabled |
---|
| 1864 | , Bool leftMergeAvail |
---|
| 1865 | , Bool aboveMergeAvail |
---|
| 1866 | ) |
---|
[56] | 1867 | { |
---|
| 1868 | UInt uiSymbol; |
---|
[2] | 1869 | |
---|
[872] | 1870 | Bool isLeftMerge = false; |
---|
| 1871 | Bool isAboveMerge= false; |
---|
| 1872 | |
---|
| 1873 | if(leftMergeAvail) |
---|
[608] | 1874 | { |
---|
[872] | 1875 | parseSaoMerge(uiSymbol); //sao_merge_left_flag |
---|
| 1876 | isLeftMerge = (uiSymbol?true:false); |
---|
[608] | 1877 | } |
---|
[872] | 1878 | |
---|
| 1879 | if( aboveMergeAvail && !isLeftMerge) |
---|
[608] | 1880 | { |
---|
[872] | 1881 | parseSaoMerge(uiSymbol); //sao_merge_up_flag |
---|
| 1882 | isAboveMerge = (uiSymbol?true:false); |
---|
[608] | 1883 | } |
---|
| 1884 | |
---|
[872] | 1885 | if(isLeftMerge || isAboveMerge) //merge mode |
---|
[56] | 1886 | { |
---|
[872] | 1887 | saoBlkParam[SAO_Y].modeIdc = saoBlkParam[SAO_Cb].modeIdc = saoBlkParam[SAO_Cr].modeIdc = SAO_MODE_MERGE; |
---|
| 1888 | saoBlkParam[SAO_Y].typeIdc = saoBlkParam[SAO_Cb].typeIdc = saoBlkParam[SAO_Cr].typeIdc = (isLeftMerge)?SAO_MERGE_LEFT:SAO_MERGE_ABOVE; |
---|
[56] | 1889 | } |
---|
[872] | 1890 | else //new or off mode |
---|
[608] | 1891 | { |
---|
[872] | 1892 | for(Int compIdx=0; compIdx < NUM_SAO_COMPONENTS; compIdx++) |
---|
[608] | 1893 | { |
---|
[872] | 1894 | SAOOffset& ctbParam = saoBlkParam[compIdx]; |
---|
| 1895 | |
---|
| 1896 | if(!sliceEnabled[compIdx]) |
---|
[608] | 1897 | { |
---|
[872] | 1898 | //off |
---|
| 1899 | ctbParam.modeIdc = SAO_MODE_OFF; |
---|
| 1900 | continue; |
---|
[608] | 1901 | } |
---|
[872] | 1902 | |
---|
| 1903 | //type |
---|
| 1904 | if(compIdx == SAO_Y || compIdx == SAO_Cb) |
---|
[56] | 1905 | { |
---|
[872] | 1906 | parseSaoTypeIdx(uiSymbol); //sao_type_idx_luma or sao_type_idx_chroma |
---|
| 1907 | |
---|
| 1908 | assert(uiSymbol ==0 || uiSymbol ==1 || uiSymbol ==2); |
---|
| 1909 | |
---|
| 1910 | if(uiSymbol ==0) //OFF |
---|
[608] | 1911 | { |
---|
[872] | 1912 | ctbParam.modeIdc = SAO_MODE_OFF; |
---|
[608] | 1913 | } |
---|
[872] | 1914 | else if(uiSymbol == 1) //BO |
---|
| 1915 | { |
---|
| 1916 | ctbParam.modeIdc = SAO_MODE_NEW; |
---|
| 1917 | ctbParam.typeIdc = SAO_TYPE_START_BO; |
---|
[56] | 1918 | } |
---|
[872] | 1919 | else //2, EO |
---|
[56] | 1920 | { |
---|
[872] | 1921 | ctbParam.modeIdc = SAO_MODE_NEW; |
---|
| 1922 | ctbParam.typeIdc = SAO_TYPE_START_EO; |
---|
| 1923 | } |
---|
| 1924 | |
---|
[56] | 1925 | } |
---|
[872] | 1926 | else //Cr, follow Cb SAO type |
---|
| 1927 | { |
---|
| 1928 | ctbParam.modeIdc = saoBlkParam[SAO_Cb].modeIdc; |
---|
| 1929 | ctbParam.typeIdc = saoBlkParam[SAO_Cb].typeIdc; |
---|
[56] | 1930 | } |
---|
[2] | 1931 | |
---|
[872] | 1932 | if(ctbParam.modeIdc == SAO_MODE_NEW) |
---|
[56] | 1933 | { |
---|
[872] | 1934 | Int offset[4]; |
---|
| 1935 | for(Int i=0; i< 4; i++) |
---|
[2] | 1936 | { |
---|
[872] | 1937 | parseSaoMaxUvlc(uiSymbol, g_saoMaxOffsetQVal[compIdx] ); //sao_offset_abs |
---|
| 1938 | offset[i] = (Int)uiSymbol; |
---|
| 1939 | } |
---|
[56] | 1940 | |
---|
[872] | 1941 | if(ctbParam.typeIdc == SAO_TYPE_START_BO) |
---|
[608] | 1942 | { |
---|
[872] | 1943 | for(Int i=0; i< 4; i++) |
---|
[56] | 1944 | { |
---|
[872] | 1945 | if(offset[i] != 0) |
---|
[608] | 1946 | { |
---|
[872] | 1947 | parseSaoSign(uiSymbol); //sao_offset_sign |
---|
| 1948 | if(uiSymbol) |
---|
[56] | 1949 | { |
---|
[872] | 1950 | offset[i] = -offset[i]; |
---|
[56] | 1951 | } |
---|
[608] | 1952 | } |
---|
| 1953 | } |
---|
[872] | 1954 | parseSaoUflc(NUM_SAO_BO_CLASSES_LOG2, uiSymbol ); //sao_band_position |
---|
| 1955 | ctbParam.typeAuxInfo = uiSymbol; |
---|
[608] | 1956 | |
---|
[872] | 1957 | for(Int i=0; i<4; i++) |
---|
[608] | 1958 | { |
---|
[872] | 1959 | ctbParam.offset[(ctbParam.typeAuxInfo+i)%MAX_NUM_SAO_CLASSES] = offset[i]; |
---|
[608] | 1960 | } |
---|
[56] | 1961 | |
---|
| 1962 | } |
---|
[872] | 1963 | else //EO |
---|
[56] | 1964 | { |
---|
[872] | 1965 | ctbParam.typeAuxInfo = 0; |
---|
| 1966 | |
---|
| 1967 | if(compIdx == SAO_Y || compIdx == SAO_Cb) |
---|
[56] | 1968 | { |
---|
[872] | 1969 | parseSaoUflc(NUM_SAO_EO_TYPES_LOG2, uiSymbol ); //sao_eo_class_luma or sao_eo_class_chroma |
---|
| 1970 | ctbParam.typeIdc += uiSymbol; |
---|
[56] | 1971 | } |
---|
| 1972 | else |
---|
| 1973 | { |
---|
[872] | 1974 | ctbParam.typeIdc = saoBlkParam[SAO_Cb].typeIdc; |
---|
[56] | 1975 | } |
---|
[872] | 1976 | ctbParam.offset[SAO_CLASS_EO_FULL_VALLEY] = offset[0]; |
---|
| 1977 | ctbParam.offset[SAO_CLASS_EO_HALF_VALLEY] = offset[1]; |
---|
| 1978 | ctbParam.offset[SAO_CLASS_EO_PLAIN ] = 0; |
---|
| 1979 | ctbParam.offset[SAO_CLASS_EO_HALF_PEAK ] = -offset[2]; |
---|
| 1980 | ctbParam.offset[SAO_CLASS_EO_FULL_PEAK ] = -offset[3]; |
---|
[56] | 1981 | } |
---|
| 1982 | } |
---|
| 1983 | } |
---|
[2] | 1984 | } |
---|
[56] | 1985 | } |
---|
[608] | 1986 | |
---|
[56] | 1987 | /** |
---|
| 1988 | - Initialize our contexts from the nominated source. |
---|
| 1989 | . |
---|
| 1990 | \param pSrc Contexts to be copied. |
---|
| 1991 | */ |
---|
| 1992 | Void TDecSbac::xCopyContextsFrom( TDecSbac* pSrc ) |
---|
| 1993 | { |
---|
| 1994 | memcpy(m_contextModels, pSrc->m_contextModels, m_numContextModels*sizeof(m_contextModels[0])); |
---|
| 1995 | } |
---|
[2] | 1996 | |
---|
[56] | 1997 | Void TDecSbac::xCopyFrom( TDecSbac* pSrc ) |
---|
| 1998 | { |
---|
| 1999 | m_pcTDecBinIf->copyState( pSrc->m_pcTDecBinIf ); |
---|
[2] | 2000 | |
---|
[56] | 2001 | m_uiLastQp = pSrc->m_uiLastQp; |
---|
| 2002 | xCopyContextsFrom( pSrc ); |
---|
| 2003 | |
---|
| 2004 | } |
---|
| 2005 | |
---|
| 2006 | Void TDecSbac::load ( TDecSbac* pScr ) |
---|
| 2007 | { |
---|
| 2008 | xCopyFrom(pScr); |
---|
| 2009 | } |
---|
| 2010 | |
---|
| 2011 | Void TDecSbac::loadContexts ( TDecSbac* pScr ) |
---|
| 2012 | { |
---|
| 2013 | xCopyContextsFrom(pScr); |
---|
| 2014 | } |
---|
| 2015 | |
---|
[608] | 2016 | #if H_3D_ARP |
---|
| 2017 | Void TDecSbac::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
[56] | 2018 | { |
---|
[608] | 2019 | UInt uiMaxW = pcCU->getSlice()->getARPStepNum() - 1; |
---|
| 2020 | UInt uiW = 0; |
---|
| 2021 | UInt uiOffset = pcCU->getCTXARPWFlag(uiAbsPartIdx); |
---|
| 2022 | UInt uiCode = 0; |
---|
[56] | 2023 | |
---|
[608] | 2024 | assert ( uiMaxW > 0 ); |
---|
[56] | 2025 | |
---|
[608] | 2026 | m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPWSCModel.get( 0, 0, 0 + uiOffset ) ); |
---|
[2] | 2027 | |
---|
[608] | 2028 | uiW = uiCode; |
---|
| 2029 | if( 1 == uiW ) |
---|
[56] | 2030 | { |
---|
[833] | 2031 | m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPWSCModel.get( 0, 0, 2 ) ); |
---|
[608] | 2032 | uiW += ( 1 == uiCode ? 1 : 0 ); |
---|
[56] | 2033 | } |
---|
[608] | 2034 | #if H_MV_ENC_DEC_TRAC |
---|
| 2035 | DTRACE_CU("iv_res_pred_weight_idx", uiW ) |
---|
| 2036 | #endif |
---|
| 2037 | pcCU->setARPWSubParts( ( UChar )( uiW ) , uiAbsPartIdx, uiDepth ); |
---|
[2] | 2038 | } |
---|
| 2039 | #endif |
---|
[56] | 2040 | |
---|
[608] | 2041 | #if H_3D_IC |
---|
| 2042 | /** parse illumination compensation flag |
---|
| 2043 | * \param pcCU |
---|
| 2044 | * \param uiAbsPartIdx |
---|
| 2045 | * \param uiDepth |
---|
| 2046 | * \returns Void |
---|
| 2047 | */ |
---|
| 2048 | Void TDecSbac::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 2049 | { |
---|
| 2050 | UInt uiSymbol = 0; |
---|
[833] | 2051 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, 0 ) ); |
---|
[608] | 2052 | #if !H_MV_ENC_DEC_TRAC |
---|
| 2053 | DTRACE_CABAC_VL( g_nSymbolCounter++ ); |
---|
| 2054 | DTRACE_CABAC_T( "\tICFlag" ); |
---|
| 2055 | DTRACE_CABAC_T( "\tuiCtxIC: "); |
---|
| 2056 | DTRACE_CABAC_V( uiCtxIC ); |
---|
| 2057 | DTRACE_CABAC_T( "\tuiSymbol: "); |
---|
| 2058 | DTRACE_CABAC_V( uiSymbol ); |
---|
| 2059 | DTRACE_CABAC_T( "\n"); |
---|
| 2060 | #else |
---|
| 2061 | DTRACE_CU("ic_flag", uiSymbol) |
---|
[56] | 2062 | #endif |
---|
[608] | 2063 | |
---|
| 2064 | pcCU->setICFlagSubParts( uiSymbol ? true : false , uiAbsPartIdx, 0, uiDepth ); |
---|
[296] | 2065 | } |
---|
| 2066 | #endif |
---|
| 2067 | |
---|
[655] | 2068 | #if H_3D_INTER_SDC |
---|
[833] | 2069 | Void TDecSbac::parseDeltaDC( TComDataCU* pcCU, UInt absPartIdx, UInt depth ) |
---|
| 2070 | { |
---|
| 2071 | if( ! ( pcCU->getSDCFlag( absPartIdx ) || ( pcCU->isIntra( absPartIdx ) && getDimType( pcCU->getLumaIntraDir( absPartIdx ) ) < DIM_NUM_TYPE ) ) ) |
---|
| 2072 | { |
---|
| 2073 | assert( 0 ); |
---|
| 2074 | } |
---|
| 2075 | |
---|
[1039] | 2076 | UInt symbol = 1; |
---|
| 2077 | UInt uiNumSegments = isDimMode( pcCU->getLumaIntraDir( absPartIdx ) ) ? 2 : 1; |
---|
[833] | 2078 | |
---|
[1039] | 2079 | if( pcCU->isIntra( absPartIdx ) && pcCU->getSDCFlag( absPartIdx )) |
---|
| 2080 | { |
---|
[1084] | 2081 | |
---|
[950] | 2082 | m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get( 0, 0, 0 ) ); |
---|
[833] | 2083 | assert( pcCU->getPartitionSize( absPartIdx ) == SIZE_2Nx2N ); |
---|
| 2084 | pcCU->setTrIdxSubParts( 0, absPartIdx, depth ); |
---|
| 2085 | pcCU->setCbfSubParts( 1, 1, 1, absPartIdx, depth ); |
---|
| 2086 | } |
---|
| 2087 | |
---|
| 2088 | for( UInt segment = 0; segment < uiNumSegments; segment++ ) |
---|
| 2089 | { |
---|
| 2090 | Pel valDeltaDC = 0; |
---|
| 2091 | if( symbol ) |
---|
| 2092 | { |
---|
| 2093 | xParseDimDeltaDC( valDeltaDC, uiNumSegments ); |
---|
| 2094 | } |
---|
| 2095 | |
---|
| 2096 | if( pcCU->isIntra( absPartIdx ) ) |
---|
| 2097 | { |
---|
| 2098 | UInt dir = pcCU->getLumaIntraDir( absPartIdx ); |
---|
| 2099 | |
---|
| 2100 | if( pcCU->getSDCFlag( absPartIdx ) ) |
---|
| 2101 | { |
---|
| 2102 | pcCU->setSDCSegmentDCOffset( valDeltaDC, segment, absPartIdx ); |
---|
| 2103 | } |
---|
| 2104 | else |
---|
| 2105 | { |
---|
| 2106 | pcCU->setDimDeltaDC( getDimType( dir ), segment, absPartIdx, valDeltaDC ); |
---|
| 2107 | } |
---|
| 2108 | } |
---|
| 2109 | else |
---|
| 2110 | { |
---|
| 2111 | pcCU->setSDCSegmentDCOffset( valDeltaDC, segment, absPartIdx ); |
---|
| 2112 | } |
---|
| 2113 | } |
---|
| 2114 | } |
---|
| 2115 | |
---|
| 2116 | Void TDecSbac::parseSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 2117 | { |
---|
| 2118 | UInt uiSymbol = 0; |
---|
| 2119 | UInt uiCtxSDCFlag = pcCU->getCtxSDCFlag( uiAbsPartIdx ); |
---|
| 2120 | |
---|
| 2121 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cSDCFlagSCModel.get( 0, 0, uiCtxSDCFlag ) ); |
---|
[1179] | 2122 | DTRACE_CU("dc_only_flag", uiSymbol) |
---|
[833] | 2123 | if( uiSymbol ) |
---|
| 2124 | { |
---|
| 2125 | pcCU->setSDCFlagSubParts( true, uiAbsPartIdx, uiDepth ); |
---|
| 2126 | pcCU->setTrIdxSubParts( 0, uiAbsPartIdx, uiDepth ); |
---|
| 2127 | pcCU->setCbfSubParts( 1, 1, 1, uiAbsPartIdx, uiDepth ); |
---|
| 2128 | } |
---|
| 2129 | else |
---|
| 2130 | { |
---|
| 2131 | pcCU->setSDCFlagSubParts( false, uiAbsPartIdx, uiDepth ); |
---|
| 2132 | } |
---|
| 2133 | } |
---|
[100] | 2134 | |
---|
[189] | 2135 | #endif |
---|
| 2136 | |
---|
[833] | 2137 | #if H_3D_DBBP |
---|
| 2138 | Void TDecSbac::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 2139 | { |
---|
[1124] | 2140 | AOF( pcCU->getSlice()->getDepthBasedBlkPartFlag() ); |
---|
[833] | 2141 | AOF( !pcCU->getSlice()->getIsDepth() ); |
---|
| 2142 | |
---|
| 2143 | UInt uiSymbol = 0; |
---|
| 2144 | |
---|
| 2145 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cDBBPFlagSCModel.get( 0, 0, 0 ) ); |
---|
[1179] | 2146 | DTRACE_CU("dbbp_flag", uiSymbol) |
---|
[1039] | 2147 | PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); |
---|
| 2148 | AOF( ePartSize == SIZE_2NxN || ePartSize == SIZE_Nx2N ); |
---|
| 2149 | UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4; |
---|
| 2150 | pcCU->setDBBPFlagSubParts(uiSymbol, uiAbsPartIdx, 0, uiDepth); |
---|
| 2151 | pcCU->setDBBPFlagSubParts(uiSymbol, uiAbsPartIdx+uiPUOffset, 1, uiDepth); |
---|
[833] | 2152 | } |
---|
| 2153 | #endif |
---|
| 2154 | |
---|
[872] | 2155 | |
---|
| 2156 | |
---|
[56] | 2157 | //! \} |
---|