﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1041	Compilation error when BLOCK_STATS_AS_CSV is set to 1	arthurcerveira		"VTM fails to compile when BLOCK_STATS_AS_CSV is enabled in TypeDef.h. This is how the macros are defined:

{{{
#ifndef ENABLE_TRACING
#define ENABLE_TRACING                                    1 // DISABLE by default (enable only when debugging, requires 15% run-time in decoding) -- see documentation in 'doc/DTrace for NextSoftware.pdf'
#endif

#if ENABLE_TRACING
#define K0149_BLOCK_STATISTICS                            1 // enables block statistics, which can be analysed with YUView (https://github.com/IENT/YUView)
#if K0149_BLOCK_STATISTICS
#define BLOCK_STATS_AS_CSV                                1 // statistics will be written in a comma separated value format. this is not supported by YUView
#endif
#endif
}}}

This error occurs because there is a mistake in the file dtrace_blockstatistics.cpp.

The function CDTrace::dtrace_block_vector uses the variable pu instead of tu.

{{{
void CDTrace::dtrace_block_vector(int k, const TransformUnit &tu, std::string stat_type, signed val_x, signed val_y)
{
  const CodingStructure& cs = *tu.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);
#else
  dtrace<false>(k, ""BlockStat: POC %d @(%4d,%4d) [%2dx%2d] %s={%4d,%4d}\n"", cs.picture->poc, tu.lx(), tu.ly(), tu.lwidth(), tu.lheight(), stat_type.c_str(), val_x, val_y);
#endif
}
}}}

To fix this error, it's necessary to change the variable name.

{{{
void CDTrace::dtrace_block_vector(int k, const TransformUnit &tu, std::string stat_type, signed val_x, signed val_y)
{
  const CodingStructure& cs = *tu.cs;
#if BLOCK_STATS_AS_CSV
  dtrace<false>(k, ""BlockStat;%d;%4d;%4d;%2d;%2d;%s;%4d;%4d\n"", cs.picture->poc, tu.lx(), tu.ly(), tu.lwidth(), tu.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, tu.lx(), tu.ly(), tu.lwidth(), tu.lheight(), stat_type.c_str(), val_x, val_y);
#endif
}
}}}
"	defect	closed	minor		VTM	VTM-8.1	fixed		ksuehring XiangLi fbossen jvet@…
