From: Anuradha S. <asu...@us...> - 2006-05-16 11:18:46
|
Update of /cvsroot/dirac/compress/libdirac_byteio In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv29334/libdirac_byteio Modified Files: transform_byteio.cpp Log Message: Spec compliance: - Zero transform flag applies only to Intra frames. - Read/write code blocks from/to bitstream if Default spatial partitioning is disabled. Throw error when non-default transform depth is specified but default spatial partitioning is set. - Replace Multiple quantisers flag with Code block mode enumerated type. Index: transform_byteio.cpp =================================================================== RCS file: /cvsroot/dirac/compress/libdirac_byteio/transform_byteio.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** transform_byteio.cpp 20 Apr 2006 15:39:30 -0000 1.2 --- transform_byteio.cpp 16 May 2006 11:18:43 -0000 1.3 *************** *** 38,41 **** --- 38,42 ---- #include <libdirac_byteio/transform_byteio.h> + #include <libdirac_common/dirac_exception.h> using namespace dirac; *************** *** 93,98 **** { // FIXME - outputting all default parameters at the moment ! // Zero Transform flag ! OutputBit(false); // Non-default Wavelet flag OutputBit(false); --- 94,100 ---- { // FIXME - outputting all default parameters at the moment ! // Zero Transform flag - applies only to inter frames ! if (m_fparams.FSort().IsInter()) ! OutputBit(false); // Non-default Wavelet flag OutputBit(false); *************** *** 117,128 **** if (!m_cparams.DefaultSpatialPartition()) { ! // non-default partitoning ! OutputVarLengthUint(m_cparams.MaxXBlocks()); ! OutputVarLengthUint(m_cparams.MaxYBlocks()); } ! // Multiple quantisers flag ! OutputBit(m_cparams.MultiQuants()); ! // Flush output for bend alignment } ByteAlignOutput(); } --- 119,136 ---- if (!m_cparams.DefaultSpatialPartition()) { ! for (unsigned int i = 0; i <= m_cparams.TransformDepth(); ++i) ! { ! // non-default partitoning ! const CodeBlocks &cb = m_cparams.GetCodeBlocks(i); ! // Number of Horizontal code blocks for level i ! OutputVarLengthUint(cb.HorizontalCodeBlocks()); ! // Number of Vertical code block for level i ! OutputVarLengthUint(cb.VerticalCodeBlocks()); ! } } ! // Code block mode index ! OutputVarLengthUint(m_cparams.GetCodeBlockMode()); } + // Flush output for bend alignment ByteAlignOutput(); } *************** *** 133,138 **** ByteAlignInput(); ! // Zero transform flag ! m_cparams.SetZeroTransform(InputBit()); if (m_cparams.ZeroTransform()) return; --- 141,150 ---- ByteAlignInput(); ! // Zero transform flag - applies only for inter frames ! if (m_fparams.FSort().IsInter()) ! m_cparams.SetZeroTransform(InputBit()); ! else ! m_cparams.SetZeroTransform(false); ! if (m_cparams.ZeroTransform()) return; *************** *** 140,149 **** // Transform filter if (InputBit()) ! m_cparams.SetTransformFilter(static_cast<WltFilter>(InputVarLengthUint())); else m_cparams.SetTransformFilter(m_default_cparams.TransformFilter()); // transform depth ! if (InputBit()) m_cparams.SetTransformDepth(InputVarLengthUint()); else --- 152,162 ---- // Transform filter if (InputBit()) ! m_cparams.SetTransformFilter(InputVarLengthUint()); else m_cparams.SetTransformFilter(m_default_cparams.TransformFilter()); // transform depth ! bool non_default_transform_depth = InputBit(); ! if (non_default_transform_depth) m_cparams.SetTransformDepth(InputVarLengthUint()); else *************** *** 157,170 **** // Is default spatial partitioning being used m_cparams.SetDefaultSpatialPartition(!InputBit()); if (!m_cparams.DefaultSpatialPartition()) { ! // if not using default spatial partitioning ! // max horiz coeff blocks ! m_cparams.SetMaxXBlocks(InputVarLengthUint()); ! // max vertical coeff blocks ! m_cparams.SetMaxYBlocks(InputVarLengthUint()); } ! // Multiple quantisers flag ! m_cparams.SetMultiQuants(InputBit()); } // Byte Alignment --- 170,202 ---- // Is default spatial partitioning being used m_cparams.SetDefaultSpatialPartition(!InputBit()); + // If we are using non-default transform depth, spatial partitioning + // must be explicitly defined i.e number of code blocks for each + // level MUST be specified in bitstream + if (m_cparams.DefaultSpatialPartition() && non_default_transform_depth) + { + DIRAC_THROW_EXCEPTION( + ERR_UNSUPPORTED_STREAM_DATA, + "Default spatial partitioning is disabled for non-default transform depths", + SEVERITY_FRAME_ERROR); + } if (!m_cparams.DefaultSpatialPartition()) { ! // Input number of code blocks for each level ! for (unsigned int i = 0; i <= m_cparams.TransformDepth(); ++i) ! { ! // number of horizontal code blocks for level i ! unsigned int hblocks = InputVarLengthUint(); ! // number of vertical code blocks for level i ! unsigned int vblocks = InputVarLengthUint(); ! m_cparams.SetCodeBlocks(i, hblocks, vblocks); ! } } ! else ! { ! // Set the default number of code blocks for each level ! m_cparams.SetDefaultCodeBlocks(m_fparams.GetFrameType()); ! } ! // Code block mode index ! m_cparams.SetCodeBlockMode(InputVarLengthUint()); } // Byte Alignment |