Changeset 1442 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibVideoIO


Ignore:
Timestamp:
13 Aug 2015, 19:11:53 (10 years ago)
Author:
seregin
Message:

port rev 4590

Location:
branches/SHM-dev/source/Lib/TLibVideoIO
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibVideoIO/TVideoIOYuv.cpp

    r1427 r1442  
    118118 * \param internalBitDepth bit-depth array to scale image data to/from when reading/writing.
    119119 */
    120 Void TVideoIOYuv::open( Char* pchFile, Bool bWriteMode, const Int fileBitDepth[MAX_NUM_CHANNEL_TYPE], const Int MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE], const Int internalBitDepth[MAX_NUM_CHANNEL_TYPE] )
     120Void TVideoIOYuv::open( const std::string &fileName, Bool bWriteMode, const Int fileBitDepth[MAX_NUM_CHANNEL_TYPE], const Int MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE], const Int internalBitDepth[MAX_NUM_CHANNEL_TYPE] )
    121121{
    122122  //NOTE: files cannot have bit depth greater than 16
     
    143143  if ( bWriteMode )
    144144  {
    145     m_cHandle.open( pchFile, ios::binary | ios::out );
     145    m_cHandle.open( fileName.c_str(), ios::binary | ios::out );
    146146
    147147    if( m_cHandle.fail() )
     
    153153  else
    154154  {
    155     m_cHandle.open( pchFile, ios::binary | ios::in );
     155    m_cHandle.open( fileName.c_str(), ios::binary | ios::in );
    156156
    157157    if( m_cHandle.fail() )
     
    219219
    220220  /* fall back to consuming the input */
    221   Char buf[512];
     221  TChar buf[512];
    222222  const streamoff offset_mod_bufsize = offset % sizeof(buf);
    223223  for (streamoff i = 0; i < offset - offset_mod_bufsize; i += sizeof(buf))
     
    275275
    276276  const UInt stride_file      = (width444 * (is16bit ? 2 : 1)) >> csx_file;
    277 
    278   UChar  *buf   = new UChar[stride_file];
     277  std::vector<UChar> bufVec(stride_file);
     278  UChar *buf=&(bufVec[0]);
    279279
    280280  if (compID!=COMPONENT_Y && (fileFormat==CHROMA_400 || destFormat==CHROMA_400))
     
    299299      if (fd.eof() || fd.fail() )
    300300      {
    301         delete[] buf;
    302301        return false;
    303302      }
     
    313312      {
    314313        // read a new line
    315         fd.read(reinterpret_cast<Char*>(buf), stride_file);
     314        fd.read(reinterpret_cast<TChar*>(buf), stride_file);
    316315        if (fd.eof() || fd.fail() )
    317316        {
    318           delete[] buf;
    319317          return false;
    320318        }
     
    383381    }
    384382  }
    385   delete[] buf;
    386383  return true;
    387384}
     
    421418  const UInt height_file      = height444>>csy_file;
    422419
    423   UChar  *buf   = new UChar[stride_file];
     420  std::vector<UChar> bufVec(stride_file);
     421  UChar *buf=&(bufVec[0]);
    424422
    425423  if (compID!=COMPONENT_Y && (fileFormat==CHROMA_400 || srcFormat==CHROMA_400))
     
    449447        }
    450448
    451         fd.write(reinterpret_cast<Char*>(buf), stride_file);
     449        fd.write(reinterpret_cast<const TChar*>(buf), stride_file);
    452450        if (fd.eof() || fd.fail() )
    453451        {
    454           delete[] buf;
    455452          return false;
    456453        }
     
    508505        }
    509506
    510         fd.write(reinterpret_cast<Char*>(buf), stride_file);
     507        fd.write(reinterpret_cast<const TChar*>(buf), stride_file);
    511508        if (fd.eof() || fd.fail() )
    512509        {
    513           delete[] buf;
    514510          return false;
    515511        }
     
    523519    }
    524520  }
    525   delete[] buf;
    526521  return true;
    527522}
     
    546541  const UInt height_file      = height444>>csy_file;
    547542
    548   UChar  *buf   = new UChar[stride_file * 2];
     543  std::vector<UChar> bufVec(stride_file * 2);
     544  UChar *buf=&(bufVec[0]);
    549545
    550546  if (compID!=COMPONENT_Y && (fileFormat==CHROMA_400 || srcFormat==CHROMA_400))
     
    579575        }
    580576
    581         fd.write(reinterpret_cast<Char*>(buf), (stride_file * 2));
     577        fd.write(reinterpret_cast<const TChar*>(buf), (stride_file * 2));
    582578        if (fd.eof() || fd.fail() )
    583579        {
    584           delete[] buf;
    585580          return false;
    586581        }
     
    644639        }
    645640
    646         fd.write(reinterpret_cast<Char*>(buf), (stride_file * 2));
     641        fd.write(reinterpret_cast<const TChar*>(buf), (stride_file * 2));
    647642        if (fd.eof() || fd.fail() )
    648643        {
    649           delete[] buf;
    650644          return false;
    651645        }
     
    660654    }
    661655  }
    662   delete[] buf;
    663656  return true;
    664657}
  • branches/SHM-dev/source/Lib/TLibVideoIO/TVideoIOYuv.h

    r1323 r1442  
    6464  virtual ~TVideoIOYuv()  {}
    6565
    66   Void  open  ( Char* pchFile, Bool bWriteMode, const Int fileBitDepth[MAX_NUM_CHANNEL_TYPE], const Int MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE], const Int internalBitDepth[MAX_NUM_CHANNEL_TYPE] ); ///< open or create file
     66  Void  open  ( const std::string &fileName, Bool bWriteMode, const Int fileBitDepth[MAX_NUM_CHANNEL_TYPE], const Int MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE], const Int internalBitDepth[MAX_NUM_CHANNEL_TYPE] ); ///< open or create file
    6767  Void  close ();                                           ///< close file
    6868
Note: See TracChangeset for help on using the changeset viewer.