Changeset 1442 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibVideoIO
- Timestamp:
- 13 Aug 2015, 19:11:53 (10 years ago)
- Location:
- branches/SHM-dev/source/Lib/TLibVideoIO
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibVideoIO/TVideoIOYuv.cpp
r1427 r1442 118 118 * \param internalBitDepth bit-depth array to scale image data to/from when reading/writing. 119 119 */ 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] )120 Void 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] ) 121 121 { 122 122 //NOTE: files cannot have bit depth greater than 16 … … 143 143 if ( bWriteMode ) 144 144 { 145 m_cHandle.open( pchFile, ios::binary | ios::out );145 m_cHandle.open( fileName.c_str(), ios::binary | ios::out ); 146 146 147 147 if( m_cHandle.fail() ) … … 153 153 else 154 154 { 155 m_cHandle.open( pchFile, ios::binary | ios::in );155 m_cHandle.open( fileName.c_str(), ios::binary | ios::in ); 156 156 157 157 if( m_cHandle.fail() ) … … 219 219 220 220 /* fall back to consuming the input */ 221 Char buf[512];221 TChar buf[512]; 222 222 const streamoff offset_mod_bufsize = offset % sizeof(buf); 223 223 for (streamoff i = 0; i < offset - offset_mod_bufsize; i += sizeof(buf)) … … 275 275 276 276 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]); 279 279 280 280 if (compID!=COMPONENT_Y && (fileFormat==CHROMA_400 || destFormat==CHROMA_400)) … … 299 299 if (fd.eof() || fd.fail() ) 300 300 { 301 delete[] buf;302 301 return false; 303 302 } … … 313 312 { 314 313 // read a new line 315 fd.read(reinterpret_cast< Char*>(buf), stride_file);314 fd.read(reinterpret_cast<TChar*>(buf), stride_file); 316 315 if (fd.eof() || fd.fail() ) 317 316 { 318 delete[] buf;319 317 return false; 320 318 } … … 383 381 } 384 382 } 385 delete[] buf;386 383 return true; 387 384 } … … 421 418 const UInt height_file = height444>>csy_file; 422 419 423 UChar *buf = new UChar[stride_file]; 420 std::vector<UChar> bufVec(stride_file); 421 UChar *buf=&(bufVec[0]); 424 422 425 423 if (compID!=COMPONENT_Y && (fileFormat==CHROMA_400 || srcFormat==CHROMA_400)) … … 449 447 } 450 448 451 fd.write(reinterpret_cast< Char*>(buf), stride_file);449 fd.write(reinterpret_cast<const TChar*>(buf), stride_file); 452 450 if (fd.eof() || fd.fail() ) 453 451 { 454 delete[] buf;455 452 return false; 456 453 } … … 508 505 } 509 506 510 fd.write(reinterpret_cast< Char*>(buf), stride_file);507 fd.write(reinterpret_cast<const TChar*>(buf), stride_file); 511 508 if (fd.eof() || fd.fail() ) 512 509 { 513 delete[] buf;514 510 return false; 515 511 } … … 523 519 } 524 520 } 525 delete[] buf;526 521 return true; 527 522 } … … 546 541 const UInt height_file = height444>>csy_file; 547 542 548 UChar *buf = new UChar[stride_file * 2]; 543 std::vector<UChar> bufVec(stride_file * 2); 544 UChar *buf=&(bufVec[0]); 549 545 550 546 if (compID!=COMPONENT_Y && (fileFormat==CHROMA_400 || srcFormat==CHROMA_400)) … … 579 575 } 580 576 581 fd.write(reinterpret_cast< Char*>(buf), (stride_file * 2));577 fd.write(reinterpret_cast<const TChar*>(buf), (stride_file * 2)); 582 578 if (fd.eof() || fd.fail() ) 583 579 { 584 delete[] buf;585 580 return false; 586 581 } … … 644 639 } 645 640 646 fd.write(reinterpret_cast< Char*>(buf), (stride_file * 2));641 fd.write(reinterpret_cast<const TChar*>(buf), (stride_file * 2)); 647 642 if (fd.eof() || fd.fail() ) 648 643 { 649 delete[] buf;650 644 return false; 651 645 } … … 660 654 } 661 655 } 662 delete[] buf;663 656 return true; 664 657 } -
branches/SHM-dev/source/Lib/TLibVideoIO/TVideoIOYuv.h
r1323 r1442 64 64 virtual ~TVideoIOYuv() {} 65 65 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 file66 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 67 67 Void close (); ///< close file 68 68
Note: See TracChangeset for help on using the changeset viewer.