Commit f291ade5 authored by Johannes Sauer's avatar Johannes Sauer

added CPR (K0076) block statistics

parent f211d5e8
......@@ -132,7 +132,7 @@ public:
void dtrace_block_vector( int k, const CodingUnit &cu, std::string stat_type, signed val_x, signed val_y );
// PU
void dtrace_block_scalar( int k, const PredictionUnit &pu, std::string stat_type, signed value, bool isChroma = false );
void dtrace_block_vector( int k, const PredictionUnit &pu, std::string stat_type, signed val_x, signed val_y );
void dtrace_block_vector( int k, const PredictionUnit &pu, std::string stat_type, signed val_x, signed val_y, bool isChroma = false );
void dtrace_block_affinetf( int k, const PredictionUnit &pu, std::string stat_type, signed val_x0, signed val_y0, signed val_x1, signed val_y1, signed val_x2, signed val_y2 );
// TU
void dtrace_block_scalar(int k, const TransformUnit &tu, std::string stat_type, signed value, bool isChroma = false );
......
......@@ -156,13 +156,27 @@ void CDTrace::dtrace_block_scalar( int k, const PredictionUnit &pu, std::string
#endif
}
void CDTrace::dtrace_block_vector( int k, const PredictionUnit &pu, std::string stat_type, signed val_x, signed val_y )
void CDTrace::dtrace_block_vector( int k, const PredictionUnit &pu, std::string stat_type, signed val_x, signed val_y, bool isChroma /*= false*/ )
{
const CodingStructure& cs = *pu.cs;
#if BLOCK_STATS_AS_CSV
dtrace<false>( k, "BlockStat;%d;%4d;%4d;%2d;%2d;%s;%4d;%4d\n", cs.picture->poc, pu.lx(), pu.ly(), pu.lwidth(), pu.lheight(), stat_type.c_str(), val_x, val_y );
if(isChroma)
{
dtrace<false>( k, "BlockStat;%d;%4d;%4d;%2d;%2d;%s;%4d;%4d\n", cs.picture->poc, pu.Cb().x*2, pu.Cb().y*2, pu.Cb().width*2, pu.Cb().height*2, stat_type.c_str(), val_x*2, val_y*2 );
}
else
{
dtrace<false>( k, "BlockStat;%d;%4d;%4d;%2d;%2d;%s;%4d;%4d\n", cs.picture->poc, pu.lx(), pu.ly(), pu.lwidth(), pu.lheight(), stat_type.c_str(), val_x, val_y );
}
#else
dtrace<false>( k, "BlockStat: POC %d @(%4d,%4d) [%2dx%2d] %s={%4d,%4d}\n", cs.picture->poc, pu.lx(), pu.ly(), pu.lwidth(), pu.lheight(), stat_type.c_str(), val_x, val_y );
if(isChroma)
{
dtrace<false>( k, "BlockStat: POC %d @(%4d,%4d) [%2dx%2d] %s={%4d,%4d}\n", cs.picture->poc, pu.Cb().x*2, pu.Cb().y*2, pu.Cb().width*2, pu.Cb().height*2, stat_type.c_str(), val_x*2, val_y*2 );
}
else
{
dtrace<false>( k, "BlockStat: POC %d @(%4d,%4d) [%2dx%2d] %s={%4d,%4d}\n", cs.picture->poc, pu.lx(), pu.ly(), pu.lwidth(), pu.lheight(), stat_type.c_str(), val_x, val_y );
}
#endif
}
......@@ -436,6 +450,45 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea)
#if JVET_K0248_GBI
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::GBiIdx), cu.GBiIdx);
#endif
#if JVET_K0076_CPR
if(chType == CHANNEL_TYPE_LUMA)
{
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::IBCFlag), cu.ibc);
}
else if(chType == CHANNEL_TYPE_CHROMA)
{
DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::IBCFlag_Chroma), cu.ibc);
}
const uint32_t numChType = ::getNumberValidChannels( cu.chromaFormat );
for( uint32_t chType = CHANNEL_TYPE_LUMA; chType < numChType; chType++ )
{
if( cu.blocks[chType].valid() )
{
for( const PredictionUnit &pu : CU::traversePUs( cu ) )
{
if( isLuma( ChannelType( chType ) ) )
{
if(cu.ibc)
{
DTRACE_BLOCK_VECTOR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::IBC_BV), pu.mv[0].hor, pu.mv[0].ver);
DTRACE_BLOCK_VECTOR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::IBC_BVD), pu.mvd[0].hor, pu.mvd[0].ver);
}
}
else
{
if(cu.ibc)
{
DTRACE_BLOCK_VECTOR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::IBC_BV_Chroma), pu.mv[0].hor, pu.mv[0].ver);
DTRACE_BLOCK_VECTOR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::IBC_BVD_Chroma), pu.mvd[0].hor, pu.mvd[0].ver);
}
}
}
}
}
#endif
}
break;
case MODE_INTRA:
......
......@@ -47,6 +47,7 @@
#define DTRACE_BLOCK_SCALAR(ctx,channel,cs_cu_pu,stat_type,val) ctx->dtrace_block_scalar( channel, cs_cu_pu, stat_type, val )
#define DTRACE_BLOCK_SCALAR_CHROMA(ctx,channel,cs_cu_pu,stat_type,val) ctx->dtrace_block_scalar( channel, cs_cu_pu, stat_type, val, true)
#define DTRACE_BLOCK_VECTOR(ctx,channel,cu_pu,stat_type,v_x,v_y) ctx->dtrace_block_vector( channel, cu_pu, stat_type, v_x, v_y )
#define DTRACE_BLOCK_VECTOR_CHROMA(ctx,channel,pu,stat_type,v_x,v_y) ctx->dtrace_block_vector( channel, pu, stat_type, v_x, v_y, true )
#define DTRACE_BLOCK_AFFINETF(ctx,channel,pu,stat_type,v_x0,v_y0,v_x1,v_y1,v_x2,v_y2) ctx->dtrace_block_affinetf( channel, pu, stat_type, v_x0, v_y0, v_x1, v_y1, v_x2, v_y2 )
enum class BlockStatistic {
......@@ -76,6 +77,15 @@ enum class BlockStatistic {
PDPCFlag,
NSSTIdx,
#endif
#if JVET_K0076_CPR
IBCFlag,
IBCFlag_Chroma,
IBC_BV,
IBC_BV_Chroma,
IBC_BVD,
IBC_BVD_Chroma,
#endif
// inter
SkipFlag,
RootCbf,
......@@ -208,7 +218,14 @@ static const std::map<BlockStatistic, std::tuple<std::string, BlockStatisticType
{ BlockStatistic::PDPCFlag, std::tuple<std::string, BlockStatisticType, std::string>{"PDPCFlag", BlockStatisticType::Flag, ""}},
{ BlockStatistic::NSSTIdx, std::tuple<std::string, BlockStatisticType, std::string>{"NSSTIdx", BlockStatisticType::Integer, "[0, 3]"}},
#endif
#if JVET_K0076_CPR
{ BlockStatistic::IBCFlag, std::tuple<std::string, BlockStatisticType, std::string>{"IBCFlag", BlockStatisticType::Flag, ""}},
{ BlockStatistic::IBCFlag_Chroma, std::tuple<std::string, BlockStatisticType, std::string>{"IBCFlag_Chroma", BlockStatisticType::Flag, ""}},
{ BlockStatistic::IBC_BV, std::tuple<std::string, BlockStatisticType, std::string>{"IBC_BV", BlockStatisticType::Vector, "Scale: 4"}},
{ BlockStatistic::IBC_BV_Chroma, std::tuple<std::string, BlockStatisticType, std::string>{"IBC_BV_Chroma", BlockStatisticType::Vector, "Scale: 4"}},
{ BlockStatistic::IBC_BVD, std::tuple<std::string, BlockStatisticType, std::string>{"IBC_BD", BlockStatisticType::Vector, "Scale: 4"}},
{ BlockStatistic::IBC_BVD_Chroma, std::tuple<std::string, BlockStatisticType, std::string>{"IBC_BD_Chroma", BlockStatisticType::Vector, "Scale: 4"}},
#endif
#if JVET_K0248_GBI
{ BlockStatistic::GBiIdx, std::tuple<std::string, BlockStatisticType, std::string>{"GBiIdx", BlockStatisticType::Integer, "[0, " + std::to_string(GBI_NUM) + "]"}},
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment