Changeset 1427 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibVideoIO
- Timestamp:
- 5 Aug 2015, 20:04:35 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibVideoIO/TVideoIOYuv.cpp
r1354 r1427 95 95 } 96 96 97 static Void 98 copyPlane(const TComPicYuv &src, const ComponentID srcPlane, TComPicYuv &dest, const ComponentID destPlane); 97 99 98 100 // ==================================================================================================================== … … 760 762 if (ipCSC!=IPCOLOURSPACE_UNCHANGED) 761 763 { 762 cPicYuvCSCd.create (pPicYuvUser->getWidth(COMPONENT_Y), pPicYuvUser->getHeight(COMPONENT_Y), pPicYuvUser->getChromaFormat(), pPicYuvUser->getWidth(COMPONENT_Y), pPicYuvUser->getHeight(COMPONENT_Y), 0, false);764 cPicYuvCSCd.createWithoutCUInfo(pPicYuvUser->getWidth(COMPONENT_Y), pPicYuvUser->getHeight(COMPONENT_Y), pPicYuvUser->getChromaFormat() ); 763 765 ColourSpaceConvert(*pPicYuvUser, cPicYuvCSCd, ipCSC, false); 764 766 } … … 766 768 767 769 // compute actual YUV frame size excluding padding size 768 const Int iStride444 = pPicYuv->getStride(COMPONENT_Y);769 const UInt width444 = pPicYuv->getWidth(COMPONENT_Y) - confLeft - confRight;770 const UInt height444 = pPicYuv->getHeight(COMPONENT_Y) - confTop - confBottom;771 770 Bool is16bit = false; 772 771 Bool nonZeroBitDepthShift=false; 773 774 if ((width444 == 0) || (height444 == 0))775 {776 printf ("\nWarning: writing %d x %d luma sample output picture!", width444, height444);777 }778 772 779 773 for(UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) … … 799 793 { 800 794 dstPicYuv = new TComPicYuv; 801 dstPicYuv->create( pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), pPicYuv->getChromaFormat(), pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), 0, false ); 802 pPicYuv->copyToPic(dstPicYuv); 795 dstPicYuv->createWithoutCUInfo( pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), pPicYuv->getChromaFormat() ); 803 796 804 797 for(UInt comp=0; comp<dstPicYuv->getNumberValidComponents(); comp++) … … 810 803 const Pel maxval = b709Compliance? ((0xff << (m_MSBExtendedBitDepth[ch] - 8)) -1) : (1 << m_MSBExtendedBitDepth[ch]) - 1; 811 804 805 copyPlane(*pPicYuv, compID, *dstPicYuv, compID); 812 806 scalePlane(dstPicYuv->getAddr(compID), dstPicYuv->getStride(compID), dstPicYuv->getWidth(compID), dstPicYuv->getHeight(compID), -m_bitdepthShift[ch], minval, maxval); 813 807 } … … 816 810 { 817 811 dstPicYuv = pPicYuv; 812 } 813 814 const Int stride444 = dstPicYuv->getStride(COMPONENT_Y); 815 const UInt width444 = dstPicYuv->getWidth(COMPONENT_Y) - confLeft - confRight; 816 const UInt height444 = dstPicYuv->getHeight(COMPONENT_Y) - confTop - confBottom; 817 818 if ((width444 == 0) || (height444 == 0)) 819 { 820 printf ("\nWarning: writing %d x %d luma sample output picture!", width444, height444); 818 821 } 819 822 … … 822 825 const ComponentID compID = ComponentID(comp); 823 826 const ChannelType ch=toChannelType(compID); 824 const UInt csx = pPicYuv->getComponentScaleX(compID);825 const UInt csy = pPicYuv->getComponentScaleY(compID);826 const Int planeOffset = (confLeft>>csx) + (confTop>>csy) * pPicYuv->getStride(compID);827 if (! writePlane(m_cHandle, dstPicYuv->getAddr(compID) + planeOffset, is16bit, iStride444, width444, height444, compID, dstPicYuv->getChromaFormat(), format, m_fileBitdepth[ch]))827 const UInt csx = dstPicYuv->getComponentScaleX(compID); 828 const UInt csy = dstPicYuv->getComponentScaleY(compID); 829 const Int planeOffset = (confLeft>>csx) + (confTop>>csy) * dstPicYuv->getStride(compID); 830 if (! writePlane(m_cHandle, dstPicYuv->getAddr(compID) + planeOffset, is16bit, stride444, width444, height444, compID, dstPicYuv->getChromaFormat(), format, m_fileBitdepth[ch])) 828 831 { 829 832 retval=false; … … 849 852 if (ipCSC!=IPCOLOURSPACE_UNCHANGED) 850 853 { 851 cPicYuvTopCSCd .create (pPicYuvUserTop ->getWidth(COMPONENT_Y), pPicYuvUserTop ->getHeight(COMPONENT_Y), pPicYuvUserTop ->getChromaFormat(), pPicYuvUserTop ->getWidth(COMPONENT_Y), pPicYuvUserTop ->getHeight(COMPONENT_Y), 0, false);852 cPicYuvBottomCSCd.create (pPicYuvUserBottom->getWidth(COMPONENT_Y), pPicYuvUserBottom->getHeight(COMPONENT_Y), pPicYuvUserBottom->getChromaFormat(), pPicYuvUserBottom->getWidth(COMPONENT_Y), pPicYuvUserBottom->getHeight(COMPONENT_Y), 0, false);854 cPicYuvTopCSCd .createWithoutCUInfo(pPicYuvUserTop ->getWidth(COMPONENT_Y), pPicYuvUserTop ->getHeight(COMPONENT_Y), pPicYuvUserTop ->getChromaFormat() ); 855 cPicYuvBottomCSCd.createWithoutCUInfo(pPicYuvUserBottom->getWidth(COMPONENT_Y), pPicYuvUserBottom->getHeight(COMPONENT_Y), pPicYuvUserBottom->getChromaFormat() ); 853 856 ColourSpaceConvert(*pPicYuvUserTop, cPicYuvTopCSCd, ipCSC, false); 854 857 ColourSpaceConvert(*pPicYuvUserBottom, cPicYuvBottomCSCd, ipCSC, false); … … 889 892 { 890 893 dstPicYuv = new TComPicYuv; 891 dstPicYuv->create( pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), pPicYuv->getChromaFormat(), pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), 0, false ); 892 pPicYuv->copyToPic(dstPicYuv); 894 dstPicYuv->createWithoutCUInfo( pPicYuv->getWidth(COMPONENT_Y), pPicYuv->getHeight(COMPONENT_Y), pPicYuv->getChromaFormat() ); 893 895 894 896 for(UInt comp=0; comp<dstPicYuv->getNumberValidComponents(); comp++) … … 900 902 const Pel maxval = b709Compliance? ((0xff << (m_MSBExtendedBitDepth[ch] - 8)) -1) : (1 << m_MSBExtendedBitDepth[ch]) - 1; 901 903 904 copyPlane(*pPicYuv, compID, *dstPicYuv, compID); 902 905 scalePlane(dstPicYuv->getAddr(compID), dstPicYuv->getStride(compID), dstPicYuv->getWidth(compID), dstPicYuv->getHeight(compID), -m_bitdepthShift[ch], minval, maxval); 903 906 } … … 913 916 assert(dstPicYuvTop->getNumberValidComponents() == dstPicYuvBottom->getNumberValidComponents()); 914 917 assert(dstPicYuvTop->getChromaFormat() == dstPicYuvBottom->getChromaFormat() ); 915 assert(dstPicYuvTop->getWidth(COMPONENT_Y) == dstPicYuvBottom->getWidth(COMPONENT_Y) );916 assert(dstPicYuvTop->getHeight(COMPONENT_Y) == dstPicYuvBottom->getHeight(COMPONENT_Y) );917 assert(dstPicYuvTop->getStride(COMPONENT_Y) == dstPicYuvBottom->getStride(COMPONENT_Y) );918 918 919 919 for(UInt comp=0; retval && comp<dstPicYuvTop->getNumberValidComponents(); comp++) … … 922 922 const ChannelType ch=toChannelType(compID); 923 923 924 assert(dstPicYuvTop->getWidth (compID) == dstPicYuvBottom->getWidth (compID)); 925 assert(dstPicYuvTop->getHeight (compID) == dstPicYuvBottom->getHeight (compID)); 924 926 assert(dstPicYuvTop->getComponentScaleX(compID) == dstPicYuvBottom->getComponentScaleX(compID)); 925 927 assert(dstPicYuvTop->getComponentScaleY(compID) == dstPicYuvBottom->getComponentScaleY(compID));
Note: See TracChangeset for help on using the changeset viewer.