source: SHVCSoftware/branches/SHM-upgrade/source/Lib/TLibDecoder/TDecGop.cpp @ 1263

Last change on this file since 1263 was 931, checked in by seregin, 10 years ago

fix compiler warnings

  • Property svn:eol-style set to native
File size: 19.4 KB
Line 
1/* The copyright in this software is being made available under the BSD
2 * License, included below. This software may be subject to other third party
3 * and contributor rights, including patent rights, and no such rights are
4 * granted under this license.
5 *
6 * Copyright (c) 2010-2014, ITU/ISO/IEC
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 *  * Redistributions of source code must retain the above copyright notice,
13 *    this list of conditions and the following disclaimer.
14 *  * Redistributions in binary form must reproduce the above copyright notice,
15 *    this list of conditions and the following disclaimer in the documentation
16 *    and/or other materials provided with the distribution.
17 *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
18 *    be used to endorse or promote products derived from this software without
19 *    specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31 * THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34/** \file     TDecGop.cpp
35    \brief    GOP decoder class
36*/
37
38#include "TDecGop.h"
39#include "TDecCAVLC.h"
40#include "TDecSbac.h"
41#include "TDecBinCoder.h"
42#include "TDecBinCoderCABAC.h"
43#include "libmd5/MD5.h"
44#include "TLibCommon/SEI.h"
45#if SVC_EXTENSION
46#include "TDecTop.h"
47#if CONFORMANCE_BITSTREAM_MODE
48#include <algorithm>
49#endif
50#endif
51
52#include <time.h>
53
54extern Bool g_md5_mismatch; ///< top level flag to signal when there is a decode problem
55
56#if CONFORMANCE_BITSTREAM_MODE
57Bool pocCompareFunction( const TComPic &pic1, const TComPic &pic2 )
58{
59  return (const_cast<TComPic&>(pic1).getPOC() < const_cast<TComPic&>(pic2).getPOC());
60}
61#endif
62
63//! \ingroup TLibDecoder
64//! \{
65static Void calcAndPrintHashStatus(TComPicYuv& pic, const SEIDecodedPictureHash* pictureHashSEI);
66#if Q0074_COLOUR_REMAPPING_SEI
67static Void applyColourRemapping(TComPicYuv& pic, const SEIColourRemappingInfo* colourRemappingInfoSEI, UInt layerId=0 );
68static std::vector<SEIColourRemappingInfo> storeCriSEI; //Persistent Colour Remapping Information SEI
69#endif
70// ====================================================================================================================
71// Constructor / destructor / initialization / destroy
72// ====================================================================================================================
73
74TDecGop::TDecGop()
75{
76  m_dDecTime = 0;
77}
78
79TDecGop::~TDecGop()
80{
81
82}
83
84#if SVC_EXTENSION
85Void TDecGop::create(UInt layerId)
86{
87  m_layerId = layerId;
88}
89#else
90Void TDecGop::create()
91{
92
93}
94#endif
95
96Void TDecGop::destroy()
97{
98}
99
100#if SVC_EXTENSION
101Void TDecGop::init( TDecTop**               ppcDecTop,
102                   TDecEntropy*             pcEntropyDecoder,
103#else
104Void TDecGop::init( TDecEntropy*            pcEntropyDecoder,
105#endif
106                   TDecSbac*               pcSbacDecoder,
107                   TDecBinCABAC*           pcBinCABAC,
108                   TDecCavlc*              pcCavlcDecoder,
109                   TDecSlice*              pcSliceDecoder,
110                   TComLoopFilter*         pcLoopFilter,
111                   TComSampleAdaptiveOffset* pcSAO
112                   )
113{
114  m_pcEntropyDecoder      = pcEntropyDecoder;
115  m_pcSbacDecoder         = pcSbacDecoder;
116  m_pcBinCABAC            = pcBinCABAC;
117  m_pcCavlcDecoder        = pcCavlcDecoder;
118  m_pcSliceDecoder        = pcSliceDecoder;
119  m_pcLoopFilter          = pcLoopFilter;
120  m_pcSAO  = pcSAO;
121#if SVC_EXTENSION   
122  m_ppcTDecTop            = ppcDecTop;
123#endif
124}
125
126
127// ====================================================================================================================
128// Private member functions
129// ====================================================================================================================
130// ====================================================================================================================
131// Public member functions
132// ====================================================================================================================
133
134Void TDecGop::decompressSlice(TComInputBitstream* pcBitstream, TComPic* pcPic)
135{
136  TComSlice*  pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx());
137  // Table of extracted substreams.
138  // These must be deallocated AND their internal fifos, too.
139  TComInputBitstream **ppcSubstreams = NULL;
140
141  //-- For time output for each slice
142  clock_t iBeforeTime = clock();
143  m_pcSbacDecoder->init( (TDecBinIf*)m_pcBinCABAC );
144  m_pcEntropyDecoder->setEntropyDecoder (m_pcSbacDecoder);
145
146  const UInt uiNumSubstreams = pcSlice->getNumberOfSubstreamSizes()+1;
147//  const UInt uiNumSubstreams = pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag() ? pcSlice->getNumberOfSubstreamSizes()+1 : pcSlice->getPPS()->getNumSubstreams();
148
149  // init each couple {EntropyDecoder, Substream}
150  ppcSubstreams    = new TComInputBitstream*[uiNumSubstreams];
151  for ( UInt ui = 0 ; ui < uiNumSubstreams ; ui++ )
152  {
153    ppcSubstreams[ui] = pcBitstream->extractSubstream(ui+1 < uiNumSubstreams ? (pcSlice->getSubstreamSize(ui)<<3) : pcBitstream->getNumBitsLeft());
154  }
155
156  m_pcSliceDecoder->decompressSlice( ppcSubstreams, pcPic, m_pcSbacDecoder);
157  // deallocate all created substreams, including internal buffers.
158  for (UInt ui = 0; ui < uiNumSubstreams; ui++)
159  {
160    ppcSubstreams[ui]->deleteFifo();
161    delete ppcSubstreams[ui];
162  }
163  delete[] ppcSubstreams;
164
165  m_dDecTime += (Double)(clock()-iBeforeTime) / CLOCKS_PER_SEC;
166}
167
168Void TDecGop::filterPicture(TComPic* pcPic)
169{
170  TComSlice*  pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx());
171
172  //-- For time output for each slice
173  clock_t iBeforeTime = clock();
174
175  // deblocking filter
176  Bool bLFCrossTileBoundary = pcSlice->getPPS()->getLoopFilterAcrossTilesEnabledFlag();
177  m_pcLoopFilter->setCfg(bLFCrossTileBoundary);
178  m_pcLoopFilter->loopFilterPic( pcPic );
179
180  if( pcSlice->getSPS()->getUseSAO() )
181  {
182    m_pcSAO->reconstructBlkSAOParams(pcPic, pcPic->getPicSym()->getSAOBlkParam());
183    m_pcSAO->SAOProcess(pcPic);
184    m_pcSAO->PCMLFDisableProcess(pcPic);
185  }
186
187  pcPic->compressMotion();
188  Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B');
189  if (!pcSlice->isReferenced()) c += 32;
190
191  //-- For time output for each slice
192#if SVC_EXTENSION
193  printf("POC %4d LId: %1d TId: %1d ( %c-SLICE %s, QP%3d ) ", pcSlice->getPOC(),
194                                                    pcPic->getLayerId(),
195                                                    pcSlice->getTLayer(),
196                                                    c,
197                                                    NaluToStr( pcSlice->getNalUnitType() ).data(),
198                                                    pcSlice->getSliceQp() );
199#else
200  printf("POC %4d TId: %1d ( %c-SLICE, QP%3d ) ", pcSlice->getPOC(),
201                                                  pcSlice->getTLayer(),
202                                                  c,
203                                                  pcSlice->getSliceQp() );
204
205#endif
206  m_dDecTime += (Double)(clock()-iBeforeTime) / CLOCKS_PER_SEC;
207  printf ("[DT %6.3f] ", m_dDecTime );
208  m_dDecTime  = 0;
209
210  for (Int iRefList = 0; iRefList < 2; iRefList++)
211  {
212    printf ("[L%d ", iRefList);
213    for (Int iRefIndex = 0; iRefIndex < pcSlice->getNumRefIdx(RefPicList(iRefList)); iRefIndex++)
214    {
215#if SVC_EXTENSION
216#if VPS_EXTN_DIRECT_REF_LAYERS
217      if( pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->isILR( m_layerId ) )
218      {
219        UInt refLayerId = pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->getLayerId();
220        UInt refLayerIdc = pcSlice->getReferenceLayerIdc(refLayerId);
221        assert( g_posScalingFactor[refLayerIdc][0] );
222        assert( g_posScalingFactor[refLayerIdc][1] );
223
224        printf( "%d(%d, {%1.2f, %1.2f}x)", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex), refLayerId, 65536.0/g_posScalingFactor[refLayerIdc][0], 65536.0/g_posScalingFactor[refLayerIdc][1] );
225      }
226      else
227      {
228        printf ("%d", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex));
229      }
230#endif
231      if( pcSlice->getEnableTMVPFlag() && iRefList == 1 - pcSlice->getColFromL0Flag() && iRefIndex == pcSlice->getColRefIdx() )
232      {
233        printf( "c" );
234      }
235
236      printf( " " );
237#else
238      printf ("%d ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex));
239#endif
240    }
241    printf ("] ");
242  }
243  if (m_decodedPictureHashSEIEnabled)
244  {
245    SEIMessages pictureHashes = getSeisByType(pcPic->getSEIs(), SEI::DECODED_PICTURE_HASH );
246    const SEIDecodedPictureHash *hash = ( pictureHashes.size() > 0 ) ? (SEIDecodedPictureHash*) *(pictureHashes.begin()) : NULL;
247    if (pictureHashes.size() > 1)
248    {
249      printf ("Warning: Got multiple decoded picture hash SEI messages. Using first.");
250    }
251    calcAndPrintHashStatus(*(pcPic->getPicYuvRec()), hash);
252  }
253#if CONFORMANCE_BITSTREAM_MODE
254  if( this->getLayerDec(pcPic->getLayerId())->getConfModeFlag() ) 
255  {
256    // Add this reconstructed picture to the parallel buffer.
257    std::vector<TComPic> *thisLayerBuffer = (this->getLayerDec(pcPic->getLayerId()))->getConfListPic();
258    thisLayerBuffer->push_back(*pcPic);
259    std::sort( thisLayerBuffer->begin(), thisLayerBuffer->end(), pocCompareFunction );
260  }
261#endif
262#if Q0074_COLOUR_REMAPPING_SEI
263  if (m_colourRemapSEIEnabled)
264  {
265    SEIMessages colourRemappingInfo = getSeisByType(pcPic->getSEIs(), SEI::COLOUR_REMAPPING_INFO );
266    const SEIColourRemappingInfo *seiColourRemappingInfo = ( colourRemappingInfo.size() > 0 ) ? (SEIColourRemappingInfo*) *(colourRemappingInfo.begin()) : NULL;
267    if (colourRemappingInfo.size() > 1)
268    {
269      printf ("Warning: Got multiple Colour Remapping Information SEI messages. Using first.");
270    }
271    applyColourRemapping(*pcPic->getPicYuvRec(), seiColourRemappingInfo
272#if SVC_EXTENSION
273     , pcPic->getLayerId()
274#endif
275     );
276  }
277#endif
278
279  printf("\n");
280
281  pcPic->setOutputMark(pcPic->getSlice(0)->getPicOutputFlag() ? true : false);
282  pcPic->setReconMark(true);
283}
284
285/**
286 * Calculate and print hash for pic, compare to picture_digest SEI if
287 * present in seis.  seis may be NULL.  Hash is printed to stdout, in
288 * a manner suitable for the status line. Theformat is:
289 *  [Hash_type:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,(yyy)]
290 * Where, x..x is the hash
291 *        yyy has the following meanings:
292 *            OK          - calculated hash matches the SEI message
293 *            ***ERROR*** - calculated hash does not match the SEI message
294 *            unk         - no SEI message was available for comparison
295 */
296static Void calcAndPrintHashStatus(TComPicYuv& pic, const SEIDecodedPictureHash* pictureHashSEI)
297{
298  /* calculate MD5sum for entire reconstructed picture */
299  TComDigest recon_digest;
300  Int numChar=0;
301  const Char* hashType = "\0";
302
303  if (pictureHashSEI)
304  {
305    switch (pictureHashSEI->method)
306    {
307      case SEIDecodedPictureHash::MD5:
308        {
309          hashType = "MD5";
310          numChar = calcMD5(pic, recon_digest);
311          break;
312        }
313      case SEIDecodedPictureHash::CRC:
314        {
315          hashType = "CRC";
316          numChar = calcCRC(pic, recon_digest);
317          break;
318        }
319      case SEIDecodedPictureHash::CHECKSUM:
320        {
321          hashType = "Checksum";
322          numChar = calcChecksum(pic, recon_digest);
323          break;
324        }
325      default:
326        {
327          assert (!"unknown hash type");
328          break;
329        }
330    }
331  }
332
333  /* compare digest against received version */
334  const Char* ok = "(unk)";
335  Bool mismatch = false;
336
337  if (pictureHashSEI)
338  {
339    ok = "(OK)";
340    if (recon_digest != pictureHashSEI->m_digest)
341    {
342      ok = "(***ERROR***)";
343      mismatch = true;
344    }
345  }
346
347  printf("[%s:%s,%s] ", hashType, digestToString(recon_digest, numChar).c_str(), ok);
348
349  if (mismatch)
350  {
351    g_md5_mismatch = true;
352    printf("[rx%s:%s] ", hashType, digestToString(pictureHashSEI->m_digest, numChar).c_str());
353  }
354}
355
356#if Q0074_COLOUR_REMAPPING_SEI
357Void xInitColourRemappingLut( const Int bitDepthY, const Int bitDepthC, std::vector<Int>(&preLut)[3], std::vector<Int>(&postLut)[3], const SEIColourRemappingInfo* const pCriSEI )
358{
359  for ( Int c=0 ; c<3 ; c++ )
360  { 
361    Int bitDepth = c ? bitDepthC : bitDepthY ;
362    preLut[c].resize(1 << bitDepth);
363    postLut[c].resize(1 << pCriSEI->m_colourRemapBitDepth);
364   
365    Int bitDepthDiff = pCriSEI->m_colourRemapBitDepth - bitDepth;
366    Int iShift1 = (bitDepthDiff>0) ? bitDepthDiff : 0; //bit scale from bitdepth to ColourRemapBitdepth (manage only case colourRemapBitDepth>= bitdepth)
367    if( bitDepthDiff<0 )
368      printf ("Warning: CRI SEI - colourRemapBitDepth (%d) <bitDepth (%d) - case not handled\n", pCriSEI->m_colourRemapBitDepth, bitDepth);
369    bitDepthDiff = pCriSEI->m_colourRemapBitDepth - pCriSEI->m_colourRemapInputBitDepth;
370    Int iShift2 = (bitDepthDiff>0) ? bitDepthDiff : 0; //bit scale from ColourRemapInputBitdepth to ColourRemapBitdepth (manage only case colourRemapBitDepth>= colourRemapInputBitDepth)
371    if( bitDepthDiff<0 )
372      printf ("Warning: CRI SEI - colourRemapBitDepth (%d) <colourRemapInputBitDepth (%d) - case not handled\n", pCriSEI->m_colourRemapBitDepth, pCriSEI->m_colourRemapInputBitDepth);
373
374    //Fill preLut
375    for ( Int k=0 ; k<(1<<bitDepth) ; k++ )
376    {
377      Int iSample = k << iShift1 ;
378      for ( Int iPivot=0 ; iPivot<=pCriSEI->m_preLutNumValMinus1[c] ; iPivot++ )
379      {
380        Int iCodedPrev  = pCriSEI->m_preLutCodedValue[c][iPivot]    << iShift2; //Coded in CRInputBitdepth
381        Int iCodedNext  = pCriSEI->m_preLutCodedValue[c][iPivot+1]  << iShift2; //Coded in CRInputBitdepth
382        Int iTargetPrev = pCriSEI->m_preLutTargetValue[c][iPivot];              //Coded in CRBitdepth
383        Int iTargetNext = pCriSEI->m_preLutTargetValue[c][iPivot+1];            //Coded in CRBitdepth
384        if ( iCodedPrev <= iSample && iSample <= iCodedNext )
385        {
386          Float fInterpol = (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) * 1.f / (Float)(iCodedNext - iCodedPrev);
387          preLut[c][k]  = (Int)( 0.5f + fInterpol );
388          iPivot = pCriSEI->m_preLutNumValMinus1[c] + 1;
389        }
390      }
391    }
392   
393    //Fill postLut
394    for ( Int k=0 ; k<(1<<pCriSEI->m_colourRemapBitDepth) ; k++ )
395    {
396      Int iSample = k;
397      for ( Int iPivot=0 ; iPivot<=pCriSEI->m_postLutNumValMinus1[c] ; iPivot++ )
398      {
399        Int iCodedPrev  = pCriSEI->m_postLutCodedValue[c][iPivot];    //Coded in CRBitdepth
400        Int iCodedNext  = pCriSEI->m_postLutCodedValue[c][iPivot+1];  //Coded in CRBitdepth
401        Int iTargetPrev = pCriSEI->m_postLutTargetValue[c][iPivot];   //Coded in CRBitdepth
402        Int iTargetNext = pCriSEI->m_postLutTargetValue[c][iPivot+1]; //Coded in CRBitdepth
403        if ( iCodedPrev <= iSample && iSample <= iCodedNext )
404        {
405          Float fInterpol =  (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) * 1.f / (Float)(iCodedNext - iCodedPrev) ;
406          postLut[c][k]  = (Int)( 0.5f + fInterpol );
407          iPivot = pCriSEI->m_postLutNumValMinus1[c] + 1;
408        }
409      }
410    }
411  }
412}
413
414static Void applyColourRemapping(TComPicYuv& pic, const SEIColourRemappingInfo* pCriSEI, UInt layerId )
415{ 
416  if( !storeCriSEI.size() )
417#if SVC_EXTENSION
418    storeCriSEI.resize(MAX_LAYERS);
419#else
420    storeCriSEI.resize(1);
421#endif
422
423  if ( pCriSEI ) //if a CRI SEI has just been retrieved, keep it in memory (persistence management)
424    storeCriSEI[layerId] = *pCriSEI;
425
426  if( !storeCriSEI[layerId].m_colourRemapCancelFlag )
427  {
428    Int iHeight  = pic.getHeight(COMPONENT_Y);
429    Int iWidth   = pic.getWidth(COMPONENT_Y);
430    Int iStride  = pic.getStride(COMPONENT_Y);
431    Int iCStride = pic.getStride(COMPONENT_Cb);
432
433    Pel *YUVIn[3], *YUVOut[3];
434    YUVIn[0] = pic.getAddr(COMPONENT_Y);
435    YUVIn[1] = pic.getAddr(COMPONENT_Cb);
436    YUVIn[2] = pic.getAddr(COMPONENT_Cr);
437   
438    TComPicYuv picColourRemapped;
439#if SVC_EXTENSION
440    picColourRemapped.create( pic.getWidth(COMPONENT_Y), pic.getHeight(COMPONENT_Y), pic.getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, NULL );
441#else
442    picColourRemapped.create( pic.getWidth(COMPONENT_Y), pic.getHeight(COMPONENT_Y), pic.getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
443#endif
444    YUVOut[0] = picColourRemapped.getAddr(COMPONENT_Y);
445    YUVOut[1] = picColourRemapped.getAddr(COMPONENT_Cb);
446    YUVOut[2] = picColourRemapped.getAddr(COMPONENT_Cr);
447
448#if SVC_EXTENSION
449    Int bitDepthY = g_bitDepthLayer[CHANNEL_TYPE_LUMA][layerId];
450    Int bitDepthC = g_bitDepthLayer[CHANNEL_TYPE_CHROMA][layerId];
451
452    assert( g_bitDepth[CHANNEL_TYPE_LUMA] == bitDepthY );
453    assert( g_bitDepth[CHANNEL_TYPE_CHROMA] == bitDepthC );
454#else
455    Int bitDepthY = g_bitDepth[CHANNEL_TYPE_LUMA];
456    Int bitDepthC = g_bitDepth[CHANNEL_TYPE_CHROMA];
457#endif
458
459    std::vector<Int> preLut[3];
460    std::vector<Int> postLut[3];
461    xInitColourRemappingLut( bitDepthY, bitDepthC, preLut, postLut, &storeCriSEI[layerId] );
462   
463    Int roundingOffset = (storeCriSEI[layerId].m_log2MatrixDenom==0) ? 0 : (1 << (storeCriSEI[layerId].m_log2MatrixDenom - 1));
464
465    for( Int y = 0; y < iHeight ; y++ )
466    {
467      for( Int x = 0; x < iWidth ; x++ )
468      {
469        Int YUVPre[3], YUVMat[3];
470        YUVPre[0] = preLut[0][ YUVIn[0][x]   ];
471        YUVPre[1] = preLut[1][ YUVIn[1][x>>1] ];
472        YUVPre[2] = preLut[2][ YUVIn[2][x>>1] ];
473
474        YUVMat[0] = ( storeCriSEI[layerId].m_colourRemapCoeffs[0][0]*YUVPre[0]
475                    + storeCriSEI[layerId].m_colourRemapCoeffs[0][1]*YUVPre[1] 
476                    + storeCriSEI[layerId].m_colourRemapCoeffs[0][2]*YUVPre[2] 
477                    + roundingOffset ) >> ( storeCriSEI[layerId].m_log2MatrixDenom );
478        YUVMat[0] = Clip3( 0, (1<<storeCriSEI[layerId].m_colourRemapBitDepth)-1, YUVMat[0] );
479        YUVOut[0][x] = postLut[0][ YUVMat[0] ];
480
481        if( (y&1) && (x&1) )
482        {
483          for(Int c=1 ; c<3 ; c++)
484          {
485            YUVMat[c] = ( storeCriSEI[layerId].m_colourRemapCoeffs[c][0]*YUVPre[0] 
486                        + storeCriSEI[layerId].m_colourRemapCoeffs[c][1]*YUVPre[1] 
487                        + storeCriSEI[layerId].m_colourRemapCoeffs[c][2]*YUVPre[2] 
488                        + roundingOffset ) >> ( storeCriSEI[layerId].m_log2MatrixDenom );
489            YUVMat[c] = Clip3( 0, (1<<storeCriSEI[layerId].m_colourRemapBitDepth)-1, YUVMat[c] );
490            YUVOut[c][x>>1] = postLut[c][ YUVMat[c] ];   
491          }
492        }
493      }
494      YUVIn[0]  += iStride;
495      YUVOut[0] += iStride;
496      if( y&1 )
497      {
498        YUVIn[1]  += iCStride;
499        YUVIn[2]  += iCStride;
500        YUVOut[1] += iCStride;
501        YUVOut[2] += iCStride;
502      }
503    }
504
505    //Write remapped picture in decoding order
506    Char  cTemp[255];
507    sprintf(cTemp, "seiColourRemappedPic_L%d_%dx%d_%dbits.yuv", layerId, iWidth, iHeight, storeCriSEI[layerId].m_colourRemapBitDepth );
508    picColourRemapped.dump( cTemp, true, storeCriSEI[layerId].m_colourRemapBitDepth );
509
510    picColourRemapped.destroy();
511
512    storeCriSEI[layerId].m_colourRemapCancelFlag = !storeCriSEI[layerId].m_colourRemapPersistenceFlag; //Handling persistence
513  }
514}
515#endif
516//! \}
Note: See TracBrowser for help on using the repository browser.