Changeset 1427 in SHVCSoftware
- Timestamp:
- 5 Aug 2015, 20:04:35 (9 years ago)
- Location:
- branches/SHM-dev/source
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/App/utils/convert_NtoMbit_YCbCr.cpp
r1289 r1427 105 105 106 106 TComPicYuv frame; 107 frame.create ( width, height, chromaFormatIDC, width, height, 0, false);107 frame.createWithoutCUInfo( width, height, chromaFormatIDC); 108 108 109 109 Int pad[2] = {0, 0}; 110 110 111 111 TComPicYuv cPicYuvTrueOrg; 112 cPicYuvTrueOrg.create ( width, height, chromaFormatIDC, width, height, 0, false);112 cPicYuvTrueOrg.createWithoutCUInfo( width, height, chromaFormatIDC ); 113 113 114 114 UInt num_frames_processed = 0; -
branches/SHM-dev/source/Lib/TLibCommon/TComPicYuv.cpp
r1416 r1427 78 78 79 79 80 81 Void TComPicYuv::create ( const Int iPicWidth, ///< picture width 82 const Int iPicHeight, ///< picture height 83 const ChromaFormat chromaFormatIDC, ///< chroma format 84 const UInt uiMaxCUWidth, ///< used for generating offsets to CUs. Can use iPicWidth if no offsets are required 85 const UInt uiMaxCUHeight, ///< used for generating offsets to CUs. Can use iPicHeight if no offsets are required 86 const UInt uiMaxCUDepth, ///< used for generating offsets to CUs. Can use 0 if no offsets are required 80 Void TComPicYuv::createWithoutCUInfo ( const Int picWidth, ///< picture width 81 const Int picHeight, ///< picture height 82 const ChromaFormat chromaFormatIDC, ///< chroma format 83 const Bool bUseMargin, ///< if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image. 84 const UInt maxCUWidth, ///< used for margin only 85 const UInt maxCUHeight ///< used for margin only 87 86 #if SVC_EXTENSION 88 const Bool bUseMargin, ///< if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image. 89 const Window* conformanceWindow) 90 #else 91 const Bool bUseMargin) ///< if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image. 92 #endif 87 , const Window* conformanceWindow 88 #endif 89 ) 93 90 94 91 { … … 101 98 #endif 102 99 103 m_ iPicWidth = iPicWidth;104 m_ iPicHeight = iPicHeight;100 m_picWidth = picWidth; 101 m_picHeight = picHeight; 105 102 m_chromaFormatIDC = chromaFormatIDC; 106 m_ iMarginX = (bUseMargin?uiMaxCUWidth:0) + 16; // for 16-byte alignment107 m_ iMarginY = (bUseMargin?uiMaxCUHeight:0) + 16; // margin for 8-tap filter and infinite padding103 m_marginX = (bUseMargin?maxCUWidth:0) + 16; // for 16-byte alignment 104 m_marginY = (bUseMargin?maxCUHeight:0) + 16; // margin for 8-tap filter and infinite padding 108 105 m_bIsBorderExtended = false; 109 106 110 107 // assign the picture arrays and set up the ptr to the top left of the original picture 111 { 112 Int chan=0; 113 for(; chan<getNumberValidComponents(); chan++) 114 { 115 const ComponentID ch=ComponentID(chan); 116 m_apiPicBuf[chan] = (Pel*)xMalloc( Pel, getStride(ch) * getTotalHeight(ch)); 117 m_piPicOrg[chan] = m_apiPicBuf[chan] + (m_iMarginY >> getComponentScaleY(ch)) * getStride(ch) + (m_iMarginX >> getComponentScaleX(ch)); 118 } 119 for(;chan<MAX_NUM_COMPONENT; chan++) 120 { 121 m_apiPicBuf[chan] = NULL; 122 m_piPicOrg[chan] = NULL; 123 } 124 } 125 126 127 const Int numCuInWidth = m_iPicWidth / uiMaxCUWidth + (m_iPicWidth % uiMaxCUWidth != 0); 128 const Int numCuInHeight = m_iPicHeight / uiMaxCUHeight + (m_iPicHeight % uiMaxCUHeight != 0); 129 for(Int chan=0; chan<2; chan++) 130 { 131 const ComponentID ch=ComponentID(chan); 132 const Int ctuHeight=uiMaxCUHeight>>getComponentScaleY(ch); 133 const Int ctuWidth=uiMaxCUWidth>>getComponentScaleX(ch); 134 const Int stride = getStride(ch); 108 for(UInt comp=0; comp<getNumberValidComponents(); comp++) 109 { 110 const ComponentID ch=ComponentID(comp); 111 m_apiPicBuf[comp] = (Pel*)xMalloc( Pel, getStride(ch) * getTotalHeight(ch)); 112 m_piPicOrg[comp] = m_apiPicBuf[comp] + (m_marginY >> getComponentScaleY(ch)) * getStride(ch) + (m_marginX >> getComponentScaleX(ch)); 113 } 114 // initialize pointers for unused components to NULL 115 for(UInt comp=getNumberValidComponents();comp<MAX_NUM_COMPONENT; comp++) 116 { 117 m_apiPicBuf[comp] = NULL; 118 m_piPicOrg[comp] = NULL; 119 } 120 121 for(Int chan=0; chan<MAX_NUM_CHANNEL_TYPE; chan++) 122 { 123 m_ctuOffsetInBuffer[chan] = NULL; 124 m_subCuOffsetInBuffer[chan] = NULL; 125 } 126 } 127 128 129 130 Void TComPicYuv::create ( const Int picWidth, ///< picture width 131 const Int picHeight, ///< picture height 132 const ChromaFormat chromaFormatIDC, ///< chroma format 133 const UInt maxCUWidth, ///< used for generating offsets to CUs. 134 const UInt maxCUHeight, ///< used for generating offsets to CUs. 135 const UInt maxCUDepth, ///< used for generating offsets to CUs. 136 const Bool bUseMargin ///< if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image. 137 #if SVC_EXTENSION 138 , const Window* conformanceWindow 139 #endif 140 ) 141 142 { 143 #if SVC_EXTENSION 144 createWithoutCUInfo(picWidth, picHeight, chromaFormatIDC, bUseMargin, maxCUWidth, maxCUHeight, conformanceWindow); 145 #else 146 createWithoutCUInfo(picWidth, picHeight, chromaFormatIDC, bUseMargin, maxCUWidth, maxCUHeight); 147 #endif 148 149 150 const Int numCuInWidth = m_picWidth / maxCUWidth + (m_picWidth % maxCUWidth != 0); 151 const Int numCuInHeight = m_picHeight / maxCUHeight + (m_picHeight % maxCUHeight != 0); 152 for(Int chan=0; chan<MAX_NUM_CHANNEL_TYPE; chan++) 153 { 154 const ChannelType ch= ChannelType(chan); 155 const Int ctuHeight = maxCUHeight>>getChannelTypeScaleY(ch); 156 const Int ctuWidth = maxCUWidth>>getChannelTypeScaleX(ch); 157 const Int stride = getStride(ch); 135 158 136 159 m_ctuOffsetInBuffer[chan] = new Int[numCuInWidth * numCuInHeight]; … … 144 167 } 145 168 146 m_subCuOffsetInBuffer[chan] = new Int[(size_t)1 << (2 * uiMaxCUDepth)];147 148 const Int numSubBlockPartitions=(1<< uiMaxCUDepth);149 const Int minSubBlockHeight =(ctuHeight >> uiMaxCUDepth);150 const Int minSubBlockWidth =(ctuWidth >> uiMaxCUDepth);169 m_subCuOffsetInBuffer[chan] = new Int[(size_t)1 << (2 * maxCUDepth)]; 170 171 const Int numSubBlockPartitions=(1<<maxCUDepth); 172 const Int minSubBlockHeight =(ctuHeight >> maxCUDepth); 173 const Int minSubBlockWidth =(ctuWidth >> maxCUDepth); 151 174 152 175 for (Int buRow = 0; buRow < numSubBlockPartitions; buRow++) … … 154 177 for (Int buCol = 0; buCol < numSubBlockPartitions; buCol++) 155 178 { 156 m_subCuOffsetInBuffer[chan][(buRow << uiMaxCUDepth) + buCol] = stride * buRow * minSubBlockHeight + buCol * minSubBlockWidth; 157 } 158 } 159 } 160 return; 161 } 162 163 179 m_subCuOffsetInBuffer[chan][(buRow << maxCUDepth) + buCol] = stride * buRow * minSubBlockHeight + buCol * minSubBlockWidth; 180 } 181 } 182 } 183 } 164 184 165 185 Void TComPicYuv::destroy() 166 186 { 167 for(Int c han=0; chan<MAX_NUM_COMPONENT; chan++)168 { 169 m_piPicOrg[c han] = NULL;170 171 if( m_apiPicBuf[c han] )172 { 173 xFree( m_apiPicBuf[c han] );174 m_apiPicBuf[c han] = NULL;187 for(Int comp=0; comp<MAX_NUM_COMPONENT; comp++) 188 { 189 m_piPicOrg[comp] = NULL; 190 191 if( m_apiPicBuf[comp] ) 192 { 193 xFree( m_apiPicBuf[comp] ); 194 m_apiPicBuf[comp] = NULL; 175 195 } 176 196 } … … 195 215 Void TComPicYuv::copyToPic (TComPicYuv* pcPicYuvDst) const 196 216 { 197 assert( m_iPicWidth == pcPicYuvDst->getWidth(COMPONENT_Y) );198 assert( m_iPicHeight == pcPicYuvDst->getHeight(COMPONENT_Y) );199 217 assert( m_chromaFormatIDC == pcPicYuvDst->getChromaFormat() ); 200 218 201 for(Int chan=0; chan<getNumberValidComponents(); chan++) 202 { 203 const ComponentID ch=ComponentID(chan); 204 ::memcpy ( pcPicYuvDst->getBuf(ch), m_apiPicBuf[ch], sizeof (Pel) * getStride(ch) * getTotalHeight(ch)); 205 } 206 return; 219 for(Int comp=0; comp<getNumberValidComponents(); comp++) 220 { 221 const ComponentID compId=ComponentID(comp); 222 const Int width = getWidth(compId); 223 const Int height = getHeight(compId); 224 const Int strideSrc = getStride(compId); 225 assert(pcPicYuvDst->getWidth(compId) == width); 226 assert(pcPicYuvDst->getHeight(compId) == height); 227 if (strideSrc==pcPicYuvDst->getStride(compId)) 228 { 229 ::memcpy ( pcPicYuvDst->getBuf(compId), getBuf(compId), sizeof(Pel)*strideSrc*getTotalHeight(compId)); 230 } 231 else 232 { 233 const Pel *pSrc = getAddr(compId); 234 Pel *pDest = pcPicYuvDst->getAddr(compId); 235 const UInt strideDest = pcPicYuvDst->getStride(compId); 236 237 for(Int y=0; y<height; y++, pSrc+=strideSrc, pDest+=strideDest) 238 { 239 ::memcpy(pDest, pSrc, width*sizeof(Pel)); 240 } 241 } 242 } 207 243 } 208 244 … … 215 251 } 216 252 217 for(Int c han=0; chan<getNumberValidComponents(); chan++)218 { 219 const ComponentID c h=ComponentID(chan);220 Pel *piTxt=getAddr(c h); // piTxt = point to (0,0) of image within bigger picture.221 const Int iStride=getStride(ch);222 const Int iWidth=getWidth(ch);223 const Int iHeight=getHeight(ch);224 const Int iMarginX=getMarginX(ch);225 const Int iMarginY=getMarginY(ch);253 for(Int comp=0; comp<getNumberValidComponents(); comp++) 254 { 255 const ComponentID compId=ComponentID(comp); 256 Pel *piTxt=getAddr(compId); // piTxt = point to (0,0) of image within bigger picture. 257 const Int stride=getStride(compId); 258 const Int width=getWidth(compId); 259 const Int height=getHeight(compId); 260 const Int marginX=getMarginX(compId); 261 const Int marginY=getMarginY(compId); 226 262 227 263 Pel* pi = piTxt; 228 264 // do left and right margins 229 for (Int y = 0; y < iHeight; y++)230 { 231 for (Int x = 0; x < iMarginX; x++ )232 { 233 pi[ - iMarginX + x ] = pi[0];234 pi[ iWidth + x ] = pi[iWidth-1];235 } 236 pi += iStride;265 for (Int y = 0; y < height; y++) 266 { 267 for (Int x = 0; x < marginX; x++ ) 268 { 269 pi[ -marginX + x ] = pi[0]; 270 pi[ width + x ] = pi[width-1]; 271 } 272 pi += stride; 237 273 } 238 274 239 275 // pi is now the (0,height) (bottom left of image within bigger picture 240 pi -= ( iStride + iMarginX);276 pi -= (stride + marginX); 241 277 // pi is now the (-marginX, height-1) 242 for (Int y = 0; y < iMarginY; y++ )243 { 244 ::memcpy( pi + (y+1)* iStride, pi, sizeof(Pel)*(iWidth + (iMarginX<<1)) );278 for (Int y = 0; y < marginY; y++ ) 279 { 280 ::memcpy( pi + (y+1)*stride, pi, sizeof(Pel)*(width + (marginX<<1)) ); 245 281 } 246 282 247 283 // pi is still (-marginX, height-1) 248 pi -= (( iHeight-1) * iStride);284 pi -= ((height-1) * stride); 249 285 // pi is now (-marginX, 0) 250 for (Int y = 0; y < iMarginY; y++ )251 { 252 ::memcpy( pi - (y+1)* iStride, pi, sizeof(Pel)*(iWidth + (iMarginX<<1)) );286 for (Int y = 0; y < marginY; y++ ) 287 { 288 ::memcpy( pi - (y+1)*stride, pi, sizeof(Pel)*(width + (marginX<<1)) ); 253 289 } 254 290 } … … 273 309 274 310 275 for(Int c han = 0; chan < getNumberValidComponents(); chan++)276 { 277 const ComponentID c h = ComponentID(chan);278 const Int shift = bitDepths.recon[toChannelType(c h)] - 8;311 for(Int comp = 0; comp < getNumberValidComponents(); comp++) 312 { 313 const ComponentID compId = ComponentID(comp); 314 const Int shift = bitDepths.recon[toChannelType(compId)] - 8; 279 315 const Int offset = (shift>0)?(1<<(shift-1)):0; 280 const Pel *pi = getAddr(c h);281 const Int stride = getStride(c h);282 const Int height = getHeight(c h);283 const Int width = getWidth(c h);316 const Pel *pi = getAddr(compId); 317 const Int stride = getStride(compId); 318 const Int height = getHeight(compId); 319 const Int width = getWidth(compId); 284 320 285 321 for (Int y = 0; y < height; y++ ) -
branches/SHM-dev/source/Lib/TLibCommon/TComPicYuv.h
r1289 r1427 71 71 // ------------------------------------------------------------------------------------------------ 72 72 73 Int m_ iPicWidth;///< Width of picture in pixels74 Int m_ iPicHeight;///< Height of picture in pixels73 Int m_picWidth; ///< Width of picture in pixels 74 Int m_picHeight; ///< Height of picture in pixels 75 75 ChromaFormat m_chromaFormatIDC; ///< Chroma Format 76 76 … … 78 78 Int* m_subCuOffsetInBuffer[MAX_NUM_CHANNEL_TYPE];///< Gives an offset in the buffer for a given sub-CU (and channel), relative to start of CTU 79 79 80 Int m_ iMarginX;///< margin of Luma channel (chroma's may be smaller, depending on ratio)81 Int m_ iMarginY;///< margin of Luma channel (chroma's may be smaller, depending on ratio)80 Int m_marginX; ///< margin of Luma channel (chroma's may be smaller, depending on ratio) 81 Int m_marginY; ///< margin of Luma channel (chroma's may be smaller, depending on ratio) 82 82 83 83 Bool m_bIsBorderExtended; … … 96 96 // ------------------------------------------------------------------------------------------------ 97 97 98 Void create (const Int iPicWidth,99 const Int iPicHeight,98 Void create (const Int picWidth, 99 const Int picHeight, 100 100 const ChromaFormat chromaFormatIDC, 101 const UInt uiMaxCUWidth, ///< used for generating offsets to CUs. Can use iPicWidth if no offsets are required 102 const UInt uiMaxCUHeight, ///< used for generating offsets to CUs. Can use iPicHeight if no offsets are required 103 const UInt uiMaxCUDepth, ///< used for generating offsets to CUs. Can use 0 if no offsets are required 104 #if SVC_EXTENSION 105 const Bool bUseMargin, ///< if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image. 106 const Window* conformanceWindow = NULL); 107 #else 108 const Bool bUseMargin); ///< if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image. 109 #endif 110 101 const UInt maxCUWidth, ///< used for generating offsets to CUs. 102 const UInt maxCUHeight, ///< used for generating offsets to CUs. 103 const UInt maxCUDepth, ///< used for generating offsets to CUs. 104 const Bool bUseMargin ///< if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image. 105 #if SVC_EXTENSION 106 , const Window* conformanceWindow = NULL 107 #endif 108 ); 109 110 Void createWithoutCUInfo(const Int picWidth, 111 const Int picHeight, 112 const ChromaFormat chromaFormatIDC, 113 const Bool bUseMargin=false, ///< if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image. 114 const UInt maxCUWidth=0, ///< used for margin only 115 const UInt maxCUHeight=0 ///< used for margin only 116 #if SVC_EXTENSION 117 , const Window* conformanceWindow = NULL 118 #endif 119 ); 120 111 121 Void destroy (); 112 122 … … 119 129 // ------------------------------------------------------------------------------------------------ 120 130 121 Int getWidth (const ComponentID id) const { return m_ iPicWidth >> getComponentScaleX(id); }122 Int getHeight (const ComponentID id) const { return m_ iPicHeight >> getComponentScaleY(id); }131 Int getWidth (const ComponentID id) const { return m_picWidth >> getComponentScaleX(id); } 132 Int getHeight (const ComponentID id) const { return m_picHeight >> getComponentScaleY(id); } 123 133 ChromaFormat getChromaFormat () const { return m_chromaFormatIDC; } 124 134 UInt getNumberValidComponents() const { return ::getNumberValidComponents(m_chromaFormatIDC); } 125 135 126 Int getStride (const ComponentID id) const { return ((m_iPicWidth ) + (m_iMarginX <<1)) >> getComponentScaleX(id); } 127 Int getTotalHeight (const ComponentID id) const { return ((m_iPicHeight ) + (m_iMarginY <<1)) >> getComponentScaleY(id); } 128 129 Int getMarginX (const ComponentID id) const { return m_iMarginX >> getComponentScaleX(id); } 130 Int getMarginY (const ComponentID id) const { return m_iMarginY >> getComponentScaleY(id); } 136 Int getStride (const ComponentID id) const { return ((m_picWidth ) + (m_marginX <<1)) >> getComponentScaleX(id); } 137 private: 138 Int getStride (const ChannelType id) const { return ((m_picWidth ) + (m_marginX <<1)) >> getChannelTypeScaleX(id); } 139 public: 140 Int getTotalHeight (const ComponentID id) const { return ((m_picHeight ) + (m_marginY <<1)) >> getComponentScaleY(id); } 141 142 Int getMarginX (const ComponentID id) const { return m_marginX >> getComponentScaleX(id); } 143 Int getMarginY (const ComponentID id) const { return m_marginY >> getComponentScaleY(id); } 131 144 132 145 // ------------------------------------------------------------------------------------------------ … … 136 149 // Access starting position of picture buffer with margin 137 150 Pel* getBuf (const ComponentID ch) { return m_apiPicBuf[ch]; } 151 const Pel* getBuf (const ComponentID ch) const { return m_apiPicBuf[ch]; } 138 152 139 153 // Access starting position of original picture … … 152 166 UInt getComponentScaleY(const ComponentID id) const { return ::getComponentScaleY(id, m_chromaFormatIDC); } 153 167 168 UInt getChannelTypeScaleX(const ChannelType id) const { return ::getChannelTypeScaleX(id, m_chromaFormatIDC); } 169 UInt getChannelTypeScaleY(const ChannelType id) const { return ::getChannelTypeScaleY(id, m_chromaFormatIDC); } 170 154 171 // ------------------------------------------------------------------------------------------------ 155 172 // Miscellaneous … … 169 186 170 187 #if SVC_EXTENSION 171 Void setHeight ( Int iPicHeight ) { m_iPicHeight = iPicHeight;}188 Void setHeight ( Int picHeight ) { m_picHeight = picHeight; } 172 189 Window& getConformanceWindow() { return m_conformanceWindow; } 173 190 Void setConformanceWindow(Window& conformanceWindow ) { m_conformanceWindow = conformanceWindow; } -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r1422 r1427 3161 3161 if (conversion!=IPCOLOURSPACE_UNCHANGED) 3162 3162 { 3163 cscd.create (pcPicD->getWidth(COMPONENT_Y), pcPicD->getHeight(COMPONENT_Y), pcPicD->getChromaFormat(), pcPicD->getWidth(COMPONENT_Y), pcPicD->getHeight(COMPONENT_Y), 0, false);3163 cscd.createWithoutCUInfo(pcPicD->getWidth(COMPONENT_Y), pcPicD->getHeight(COMPONENT_Y), pcPicD->getChromaFormat() ); 3164 3164 TVideoIOYuv::ColourSpaceConvert(*pcPicD, cscd, conversion, false); 3165 3165 } … … 3367 3367 { 3368 3368 TComPicYuv &reconField=*(apcPicRecFields[fieldNum]); 3369 cscd[fieldNum].create (reconField.getWidth(COMPONENT_Y), reconField.getHeight(COMPONENT_Y), reconField.getChromaFormat(), reconField.getWidth(COMPONENT_Y), reconField.getHeight(COMPONENT_Y), 0, false);3369 cscd[fieldNum].createWithoutCUInfo(reconField.getWidth(COMPONENT_Y), reconField.getHeight(COMPONENT_Y), reconField.getChromaFormat() ); 3370 3370 TVideoIOYuv::ColourSpaceConvert(reconField, cscd[fieldNum], conversion, false); 3371 3371 apcPicRecFields[fieldNum]=cscd+fieldNum; -
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.