| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This webpage shows layout of YV12 and other YUV formats | 5 // This webpage shows layout of YV12 and other YUV formats |
| 6 // http://www.fourcc.org/yuv.php | 6 // http://www.fourcc.org/yuv.php |
| 7 // The actual conversion is best described here | 7 // The actual conversion is best described here |
| 8 // http://en.wikipedia.org/wiki/YUV | 8 // http://en.wikipedia.org/wiki/YUV |
| 9 // An article on optimizing YUV conversion using tables instead of multiplies | 9 // An article on optimizing YUV conversion using tables instead of multiplies |
| 10 // http://lestourtereaux.free.fr/papers/data/yuvrgb.pdf | 10 // http://lestourtereaux.free.fr/papers/data/yuvrgb.pdf |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 } | 501 } |
| 502 for (int j = 0; j < (width / 2); ++j) { | 502 for (int j = 0; j < (width / 2); ++j) { |
| 503 yplane[0] = src[0]; | 503 yplane[0] = src[0]; |
| 504 yplane[1] = src[2]; | 504 yplane[1] = src[2]; |
| 505 src += 4; | 505 src += 4; |
| 506 yplane += 2; | 506 yplane += 2; |
| 507 } | 507 } |
| 508 } | 508 } |
| 509 } | 509 } |
| 510 | 510 |
| 511 void ConvertNV21ToYUV(const uint8* src, |
| 512 uint8* yplane, |
| 513 uint8* uplane, |
| 514 uint8* vplane, |
| 515 int width, |
| 516 int height) { |
| 517 int y_plane_size = width * height; |
| 518 memcpy(yplane, src, y_plane_size); |
| 519 |
| 520 src += y_plane_size; |
| 521 int u_plane_size = y_plane_size >> 2; |
| 522 for (int i = 0; i < u_plane_size; ++i) { |
| 523 *vplane++ = *src++; |
| 524 *uplane++ = *src++; |
| 525 } |
| 526 } |
| 527 |
| 511 void ConvertYUVToRGB32(const uint8* yplane, | 528 void ConvertYUVToRGB32(const uint8* yplane, |
| 512 const uint8* uplane, | 529 const uint8* uplane, |
| 513 const uint8* vplane, | 530 const uint8* vplane, |
| 514 uint8* rgbframe, | 531 uint8* rgbframe, |
| 515 int width, | 532 int width, |
| 516 int height, | 533 int height, |
| 517 int ystride, | 534 int ystride, |
| 518 int uvstride, | 535 int uvstride, |
| 519 int rgbstride, | 536 int rgbstride, |
| 520 YUVType yuv_type) { | 537 YUVType yuv_type) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 531 else | 548 else |
| 532 convert_proc = &ConvertYUVToRGB32_C; | 549 convert_proc = &ConvertYUVToRGB32_C; |
| 533 } | 550 } |
| 534 | 551 |
| 535 convert_proc(yplane, uplane, vplane, rgbframe, | 552 convert_proc(yplane, uplane, vplane, rgbframe, |
| 536 width, height, ystride, uvstride, rgbstride, yuv_type); | 553 width, height, ystride, uvstride, rgbstride, yuv_type); |
| 537 #endif | 554 #endif |
| 538 } | 555 } |
| 539 | 556 |
| 540 } // namespace media | 557 } // namespace media |
| OLD | NEW |