Changeset 1246 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibVideoIO
- Timestamp:
- 14 Jul 2015, 00:26:07 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibVideoIO/TVideoIOYuv.cpp
r1077 r1246 73 73 { 74 74 for (UInt y = 0; y < height; y++, img+=stride) 75 { 75 76 for (UInt x = 0; x < width; x++) 77 { 76 78 img[x] <<= shiftbits; 79 } 80 } 77 81 } 78 82 else if (shiftbits < 0) … … 82 86 Pel rounding = 1 << (shiftbits-1); 83 87 for (UInt y = 0; y < height; y++, img+=stride) 88 { 84 89 for (UInt x = 0; x < width; x++) 90 { 85 91 img[x] = Clip3(minval, maxval, Pel((img[x] + rounding) >> shiftbits)); 92 } 93 } 86 94 } 87 95 } … … 178 186 { 179 187 if (!numFrames) 188 { 180 189 return; 190 } 181 191 182 192 //------------------ … … 188 198 ComponentID compID=ComponentID(component); 189 199 frameSize += (width >> getComponentScaleX(compID, format)) * (height >> getComponentScaleY(compID, format)); 190 if (m_fileBitdepth[toChannelType(compID)] > 8) wordsize=2; 200 if (m_fileBitdepth[toChannelType(compID)] > 8) 201 { 202 wordsize=2; 203 } 191 204 } 192 205 frameSize *= wordsize; … … 197 210 /* attempt to seek */ 198 211 if (!!m_cHandle.seekg(offset, ios::cur)) 212 { 199 213 return; /* success */ 214 } 200 215 m_cHandle.clear(); 201 216 202 217 /* fall back to consuming the input */ 203 218 Char buf[512]; 204 const streamoffoffset_mod_bufsize = offset % sizeof(buf);219 const UInt offset_mod_bufsize = offset % sizeof(buf); 205 220 for (streamoff i = 0; i < offset - offset_mod_bufsize; i += sizeof(buf)) 206 221 { … … 263 278 const Pel value=Pel(1<<(fileBitDepth-1)); 264 279 for (UInt y = 0; y < full_height_dest; y++, dst+=stride_dest) 280 { 265 281 for (UInt x = 0; x < full_width_dest; x++) 282 { 266 283 dst[x] = value; 284 } 285 } 267 286 } 268 287 … … 305 324 { 306 325 for (UInt x = 0; x < width_dest; x++) 326 { 307 327 dst[x] = buf[x<<sx]; 328 } 308 329 } 309 330 else … … 322 343 { 323 344 for (UInt x = 0; x < width_dest; x++) 345 { 324 346 dst[x] = buf[x>>sx]; 347 } 325 348 } 326 349 else 327 350 { 328 351 for (UInt x = 0; x < width_dest; x++) 352 { 329 353 dst[x] = Pel(buf[(x>>sx)*2+0]) | (Pel(buf[(x>>sx)*2+1])<<8); 354 } 330 355 } 331 356 } … … 334 359 const Pel val=dst[width_dest-1]; 335 360 for (UInt x = width_dest; x < full_width_dest; x++) 361 { 336 362 dst[x] = val; 363 } 337 364 338 365 dst += stride_dest; … … 342 369 // process lower padding 343 370 for (UInt y = height_dest; y < full_height_dest; y++, dst+=stride_dest) 371 { 344 372 for (UInt x = 0; x < full_width_dest; x++) 373 { 345 374 dst[x] = (dst - stride_dest)[x]; 375 } 376 } 346 377 } 347 378 delete[] buf; … … 393 424 UChar val(value); 394 425 for (UInt x = 0; x < width_file; x++) 426 { 395 427 buf[x]=val; 428 } 396 429 } 397 430 else … … 520 553 UChar val(value); 521 554 for (UInt x = 0; x < width_file; x++) 555 { 522 556 fieldBuffer[x]=val; 557 } 523 558 } 524 559 else … … 634 669 { 635 670 // check end-of-file 636 if ( isEof() ) return false; 671 if ( isEof() ) 672 { 673 return false; 674 } 637 675 TComPicYuv *pPicYuv=pPicYuvTrueOrg; 638 if (format>=NUM_CHROMA_FORMAT) format=pPicYuv->getChromaFormat(); 676 if (format>=NUM_CHROMA_FORMAT) 677 { 678 format=pPicYuv->getChromaFormat(); 679 } 639 680 640 681 Bool is16bit = false; … … 642 683 for(UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) 643 684 { 644 if (m_fileBitdepth[ch] > 8) is16bit=true; 685 if (m_fileBitdepth[ch] > 8) 686 { 687 is16bit=true; 688 } 645 689 } 646 690 … … 733 777 for(UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) 734 778 { 735 if (m_fileBitdepth[ch] > 8) is16bit=true; 736 if (m_bitdepthShift[ch] != 0) nonZeroBitDepthShift=true; 779 if (m_fileBitdepth[ch] > 8) 780 { 781 is16bit=true; 782 } 783 if (m_bitdepthShift[ch] != 0) 784 { 785 nonZeroBitDepthShift=true; 786 } 737 787 } 738 788 739 789 TComPicYuv *dstPicYuv = NULL; 740 790 Bool retval = true; 741 if (format>=NUM_CHROMA_FORMAT) format=pPicYuv->getChromaFormat(); 791 if (format>=NUM_CHROMA_FORMAT) 792 { 793 format=pPicYuv->getChromaFormat(); 794 } 742 795 743 796 if (nonZeroBitDepthShift) … … 817 870 for(UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) 818 871 { 819 if (m_fileBitdepth[ch] > 8) is16bit=true; 820 if (m_bitdepthShift[ch] != 0) nonZeroBitDepthShift=true; 872 if (m_fileBitdepth[ch] > 8) 873 { 874 is16bit=true; 875 } 876 if (m_bitdepthShift[ch] != 0) 877 { 878 nonZeroBitDepthShift=true; 879 } 821 880 } 822 881 … … 828 887 TComPicYuv *pPicYuv = (field == 0) ? pPicYuvTop : pPicYuvBottom; 829 888 830 if (format>=NUM_CHROMA_FORMAT) format=pPicYuv->getChromaFormat(); 889 if (format>=NUM_CHROMA_FORMAT) 890 { 891 format=pPicYuv->getChromaFormat(); 892 } 831 893 832 894 TComPicYuv* &dstPicYuv = (field == 0) ? dstPicYuvTop : dstPicYuvBottom; … … 949 1011 { 950 1012 for(UInt comp=0; comp<numValidComp; comp++) 1013 { 951 1014 copyPlane(src, ComponentID(bIsForwards?0:comp), dest, ComponentID(comp)); 1015 } 952 1016 } 953 1017 break; … … 955 1019 { 956 1020 for(UInt comp=0; comp<numValidComp; comp++) 1021 { 957 1022 copyPlane(src, ComponentID(comp), dest, ComponentID((numValidComp-comp)%numValidComp)); 1023 } 958 1024 } 959 1025 break; … … 982 1048 { 983 1049 for(UInt comp=0; comp<numValidComp; comp++) 1050 { 984 1051 copyPlane(src, ComponentID(comp), dest, ComponentID(comp)); 1052 } 985 1053 } 986 1054 break;
Note: See TracChangeset for help on using the changeset viewer.