﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1216	Changes to TComSlice.h required in order to compile with GCC 4.8.1	yetish		"Minor Bug

Changes to TComSlice.h required in order to compile with GCC 4.8.1

When compiling with GCC 4.8.1 TComSlice.h is flagged up multiple times with a single compiler error (""array subscript is above array bounds""). 

In effect, the compiler does not like it that  tLayer (or tlayer is is called elsewhere) is assumed to be valid, it could be abused and thus unsafe. 

To resolve this fear, test  tLayer against  getMaxTLayers to decide if it is safe prior to accepting or reverting to the maximum possible value. e.g.

m_numReorderPics[(tLayer = tLayer > getMaxTLayers  ()? getMaxTLayers  () : tLayer)] = v;  

Making the following modifications will suppress these errors and the codebase will compile.

//-------------
// Around Line 450
// Change from
  //Void    setNumReorderPics(UInt v, UInt tLayer)                { m_numReorderPics[tLayer] = v;    }
// To
  Void    setNumReorderPics(UInt v, UInt tLayer)                { m_numReorderPics[(tLayer = tLayer > getMaxTLayers  ()? getMaxTLayers  () : tLayer)] = v;    }

// Change from
  //Void    setMaxDecPicBuffering(UInt v, UInt tLayer)            { m_uiMaxDecPicBuffering[tLayer] = v;    }
  Void    setMaxDecPicBuffering(UInt v, UInt tLayer)            { m_uiMaxDecPicBuffering[(tLayer = tLayer > getMaxTLayers  ()? getMaxTLayers  () : tLayer)] = v;    }

// Change from 
  //Void    setMaxLatencyIncrease(UInt v, UInt tLayer)            { m_uiMaxLatencyIncrease[tLayer] = v;    }
// To
  Void    setMaxLatencyIncrease(UInt v, UInt tLayer)            { m_uiMaxLatencyIncrease[(tLayer = tLayer > getMaxTLayers  ()? getMaxTLayers  () : tLayer)] = v;    }
//-------------

//-------------
// Around Line 820
// Change from
//Void setNumReorderPics(Int i, UInt tlayer)              { m_numReorderPics[tlayer] = i;    }
// To
  Void setNumReorderPics(Int i, UInt tlayer)              { m_numReorderPics[(tlayer = tlayer > getMaxTLayers  ()? getMaxTLayers  () : tlayer)] = i;    }
  
// Change from
 //Void setMaxDecPicBuffering  ( UInt ui, UInt tlayer ) { m_uiMaxDecPicBuffering[tlayer] = ui;   }
// To
  Void setMaxDecPicBuffering  ( UInt ui, UInt tlayer ) { m_uiMaxDecPicBuffering[(tlayer = tlayer > getMaxTLayers  ()? getMaxTLayers  () : tlayer)] = ui;    }

// Change from
  //Void setMaxLatencyIncrease  ( UInt ui , UInt tlayer) { m_uiMaxLatencyIncrease[tlayer] = ui;      }
// To
  Void setMaxLatencyIncrease  ( UInt ui , UInt tlayer) { m_uiMaxLatencyIncrease[(tlayer = tlayer > getMaxTLayers  ()? getMaxTLayers  () : tlayer)] = ui;    }

//-------------"	defect	closed	minor	HM-13.0	HM	HM-12.1	fixed	GCC 4.8.1, TComSlice.h	fbossen ksuehring davidf jct-vc@…
