Ticket #98: JVET_L0361_DualITreeFix.patch

File JVET_L0361_DualITreeFix.patch, 2.6 KB (added by adamjw, 6 years ago)
  • source/Lib/CommonLib/ContextModelling.cpp

     source/Lib/CommonLib/ContextModelling.cpp | 19 ++++++++++++++++++-
     source/Lib/CommonLib/TypeDef.h            |  1 +
     2 files changed, 19 insertions(+), 1 deletion(-)
    
    diff --git a/source/Lib/CommonLib/ContextModelling.cpp b/source/Lib/CommonLib/ContextModelling.cpp
    index 859f5f5..2f61246 100644
    a b unsigned DeriveCtx::CtxBTsplit(const CodingStructure& cs, Partitioner& partition 
    315315
    316316  {
    317317#if JVET_L0361_SPLIT_CTX
    318     unsigned widthCurr = partitioner.currArea().lwidth();
     318#if L0361_BUGFIX
     319    unsigned widthCurr  = partitioner.currArea().blocks[partitioner.chType].width;
     320    unsigned heightCurr = partitioner.currArea().blocks[partitioner.chType].height;
     321#else
     322    unsigned widthCurr  = partitioner.currArea().lwidth();
    319323    unsigned heightCurr = partitioner.currArea().lheight();
     324#endif
    320325
    321326    if( cuLeft )
    322327    {
     328#if L0361_BUGFIX
     329      unsigned heightLeft = cuLeft->blocks[partitioner.chType].height;
     330#else
    323331      unsigned heightLeft = cuLeft->Y().height;
     332#endif
    324333      ctx += ( heightLeft < heightCurr ? 1 : 0 );
    325334    }
    326335    if( cuAbove )
    327336    {
     337#if L0361_BUGFIX
     338      unsigned widthAbove = cuAbove->blocks[partitioner.chType].width;
     339#else
    328340      unsigned widthAbove = cuAbove->Y().width;
     341#endif
    329342      ctx += ( widthAbove < widthCurr ? 1 : 0 );
    330343    }
    331344
    unsigned DeriveCtx::CtxBTsplit(const CodingStructure& cs, Partitioner& partition 
    338351      int maxBTSize = cs.pcv->getMaxBtSize( *cs.slice, partitioner.chType );
    339352      int th1 = ( maxBTSize == 128 ) ? 128  : ( ( maxBTSize == 64 ) ? 64  : 64  );
    340353      int th2 = ( maxBTSize == 128 ) ? 1024 : ( ( maxBTSize == 64 ) ? 512 : 256 );
     354#if L0361_BUGFIX
     355      unsigned int sizeCurr = partitioner.currArea().lumaSize().area();
     356#else
    341357      unsigned int sizeCurr = widthCurr * heightCurr;
     358#endif
    342359      ctx += sizeCurr > th2 ? 0 : ( sizeCurr > th1 ? 3 : 6 );
    343360    }
    344361#else
  • source/Lib/CommonLib/TypeDef.h

    diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
    index ebde21e..dd3d8a2 100644
    a b  
    100100#define JVET_L0194_ONE_CTX_FOR_MRG_IDX                    1 // one context for full-block Merge index
    101101
    102102#define JVET_L0361_SPLIT_CTX                              1 // context for cu-split-related flags
     103#define L0361_BUGFIX                                    ( 1 && JVET_L0361_SPLIT_CTX )
    103104
    104105#define JVET_L0274                                        1
    105106#define JVET_L0274_ENCODER_SPEED_UP                     ( 1 && JVET_L0274 ) // encoder speed-up by pre-calculating position dependent parameters