儲存庫 vbox 的更動 63169
- 時間撮記:
- 2016-8-8 下午02:34:15 (8 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Main/src-client/VideoRec.cpp
r62485 r63169 290 290 */ 291 291 template <class T> 292 inline bool colorConvWriteYUV420p(unsigned aWidth, unsigned aHeight, 293 uint8_t *aDestBuf, uint8_t *aSrcBuf) 294 { 295 AssertReturn(0 == (aWidth & 1), false); 296 AssertReturn(0 == (aHeight & 1), false); 297 bool rc = true; 292 inline bool colorConvWriteYUV420p(unsigned aWidth, unsigned aHeight, uint8_t *aDestBuf, uint8_t *aSrcBuf) 293 { 294 AssertReturn(!(aWidth & 1), false); 295 AssertReturn(!(aHeight & 1), false); 296 bool fRc = true; 298 297 T iter1(aWidth, aHeight, aSrcBuf); 299 298 T iter2 = iter1; … … 303 302 unsigned offU = cPixels; 304 303 unsigned offV = cPixels + cPixels / 4; 305 for (unsigned i = 0; (i < aHeight / 2) && rc; ++i) 306 { 307 for (unsigned j = 0; (j < aWidth / 2) && rc; ++j) 308 { 309 unsigned red, green, blue, u, v; 310 rc = iter1.getRGB(&red, &green, &blue); 311 if (rc) 312 { 313 aDestBuf[offY] = ((66 * red + 129 * green + 25 * blue + 128) >> 8) + 16; 314 u = (((-38 * red - 74 * green + 112 * blue + 128) >> 8) + 128) / 4; 315 v = (((112 * red - 94 * green - 18 * blue + 128) >> 8) + 128) / 4; 316 rc = iter1.getRGB(&red, &green, &blue); 317 } 318 if (rc) 319 { 320 aDestBuf[offY + 1] = ((66 * red + 129 * green + 25 * blue + 128) >> 8) + 16; 321 u += (((-38 * red - 74 * green + 112 * blue + 128) >> 8) + 128) / 4; 322 v += (((112 * red - 94 * green - 18 * blue + 128) >> 8) + 128) / 4; 323 rc = iter2.getRGB(&red, &green, &blue); 324 } 325 if (rc) 326 { 327 aDestBuf[offY + aWidth] = ((66 * red + 129 * green + 25 * blue + 128) >> 8) + 16; 328 u += (((-38 * red - 74 * green + 112 * blue + 128) >> 8) + 128) / 4; 329 v += (((112 * red - 94 * green - 18 * blue + 128) >> 8) + 128) / 4; 330 rc = iter2.getRGB(&red, &green, &blue); 331 } 332 if (rc) 333 { 334 aDestBuf[offY + aWidth + 1] = ((66 * red + 129 * green + 25 * blue + 128) >> 8) + 16; 335 u += (((-38 * red - 74 * green + 112 * blue + 128) >> 8) + 128) / 4; 336 v += (((112 * red - 94 * green - 18 * blue + 128) >> 8) + 128) / 4; 337 aDestBuf[offU] = u; 338 aDestBuf[offV] = v; 339 offY += 2; 340 ++offU; 341 ++offV; 342 } 343 } 344 if (rc) 345 { 346 iter1.skip(aWidth); 347 iter2.skip(aWidth); 348 offY += aWidth; 349 } 350 } 351 return rc; 304 unsigned const cyHalf = aHeight / 2; 305 unsigned const cxHalf = aWidth / 2; 306 for (unsigned i = 0; i < cyHalf && fRc; ++i) 307 { 308 for (unsigned j = 0; j < cxHalf; ++j) 309 { 310 unsigned red, green, blue; 311 fRc = iter1.getRGB(&red, &green, &blue); 312 AssertReturn(fRc, false); 313 aDestBuf[offY] = ((66 * red + 129 * green + 25 * blue + 128) >> 8) + 16; 314 unsigned u = (((-38 * red - 74 * green + 112 * blue + 128) >> 8) + 128) / 4; 315 unsigned v = (((112 * red - 94 * green - 18 * blue + 128) >> 8) + 128) / 4; 316 317 fRc = iter1.getRGB(&red, &green, &blue); 318 AssertReturn(fRc, false); 319 aDestBuf[offY + 1] = ((66 * red + 129 * green + 25 * blue + 128) >> 8) + 16; 320 u += (((-38 * red - 74 * green + 112 * blue + 128) >> 8) + 128) / 4; 321 v += (((112 * red - 94 * green - 18 * blue + 128) >> 8) + 128) / 4; 322 323 fRc = iter2.getRGB(&red, &green, &blue); 324 AssertReturn(fRc, false); 325 aDestBuf[offY + aWidth] = ((66 * red + 129 * green + 25 * blue + 128) >> 8) + 16; 326 u += (((-38 * red - 74 * green + 112 * blue + 128) >> 8) + 128) / 4; 327 v += (((112 * red - 94 * green - 18 * blue + 128) >> 8) + 128) / 4; 328 329 fRc = iter2.getRGB(&red, &green, &blue); 330 AssertReturn(fRc, false); 331 aDestBuf[offY + aWidth + 1] = ((66 * red + 129 * green + 25 * blue + 128) >> 8) + 16; 332 u += (((-38 * red - 74 * green + 112 * blue + 128) >> 8) + 128) / 4; 333 v += (((112 * red - 94 * green - 18 * blue + 128) >> 8) + 128) / 4; 334 335 aDestBuf[offU] = u; 336 aDestBuf[offV] = v; 337 offY += 2; 338 ++offU; 339 ++offV; 340 } 341 342 iter1.skip(aWidth); 343 iter2.skip(aWidth); 344 offY += aWidth; 345 } 346 347 return true; 352 348 } 353 349
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器