| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 typedef void (*ConvertYUVToRGB32Proc)(const uint8*, | 53 typedef void (*ConvertYUVToRGB32Proc)(const uint8*, |
| 54 const uint8*, | 54 const uint8*, |
| 55 const uint8*, | 55 const uint8*, |
| 56 uint8*, | 56 uint8*, |
| 57 int, | 57 int, |
| 58 int, | 58 int, |
| 59 int, | 59 int, |
| 60 int, | 60 int, |
| 61 int, | 61 int, |
| 62 YUVType); | 62 YUVType, |
| 63 YUVRange); |
| 63 | 64 |
| 64 typedef void (*ConvertYUVAToARGBProc)(const uint8*, | 65 typedef void (*ConvertYUVAToARGBProc)(const uint8*, |
| 65 const uint8*, | 66 const uint8*, |
| 66 const uint8*, | 67 const uint8*, |
| 67 const uint8*, | 68 const uint8*, |
| 68 uint8*, | 69 uint8*, |
| 69 int, | 70 int, |
| 70 int, | 71 int, |
| 71 int, | 72 int, |
| 72 int, | 73 int, |
| 73 int, | 74 int, |
| 74 int, | 75 int, |
| 75 YUVType); | 76 YUVType, |
| 77 YUVRange); |
| 76 | 78 |
| 77 typedef void (*ConvertYUVToRGB32RowProc)(const uint8*, | 79 typedef void (*ConvertYUVToRGB32RowProc)(const uint8*, |
| 78 const uint8*, | 80 const uint8*, |
| 79 const uint8*, | 81 const uint8*, |
| 80 uint8*, | 82 uint8*, |
| 81 ptrdiff_t); | 83 ptrdiff_t); |
| 82 | 84 |
| 83 typedef void (*ConvertYUVAToARGBRowProc)(const uint8*, | 85 typedef void (*ConvertYUVAToARGBRowProc)(const uint8*, |
| 84 const uint8*, | 86 const uint8*, |
| 85 const uint8*, | 87 const uint8*, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 const uint8* v_buf, | 196 const uint8* v_buf, |
| 195 uint8* rgb_buf, | 197 uint8* rgb_buf, |
| 196 int source_width, | 198 int source_width, |
| 197 int source_height, | 199 int source_height, |
| 198 int width, | 200 int width, |
| 199 int height, | 201 int height, |
| 200 int y_pitch, | 202 int y_pitch, |
| 201 int uv_pitch, | 203 int uv_pitch, |
| 202 int rgb_pitch, | 204 int rgb_pitch, |
| 203 YUVType yuv_type, | 205 YUVType yuv_type, |
| 206 YUVRange yuv_range, |
| 204 Rotate view_rotate, | 207 Rotate view_rotate, |
| 205 ScaleFilter filter) { | 208 ScaleFilter filter) { |
| 206 // Handle zero sized sources and destinations. | 209 // Handle zero sized sources and destinations. |
| 207 if ((yuv_type == YV12 && (source_width < 2 || source_height < 2)) || | 210 if ((yuv_type == YV12 && (source_width < 2 || source_height < 2)) || |
| 208 (yuv_type == YV16 && (source_width < 2 || source_height < 1)) || | 211 (yuv_type == YV16 && (source_width < 2 || source_height < 1)) || |
| 209 width == 0 || height == 0) | 212 width == 0 || height == 0) |
| 210 return; | 213 return; |
| 211 | 214 |
| 212 // 4096 allows 3 buffers to fit in 12k. | 215 // 4096 allows 3 buffers to fit in 12k. |
| 213 // Helps performance on CPU with 16K L1 cache. | 216 // Helps performance on CPU with 16K L1 cache. |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 | 608 |
| 606 void ConvertYUVToRGB32(const uint8* yplane, | 609 void ConvertYUVToRGB32(const uint8* yplane, |
| 607 const uint8* uplane, | 610 const uint8* uplane, |
| 608 const uint8* vplane, | 611 const uint8* vplane, |
| 609 uint8* rgbframe, | 612 uint8* rgbframe, |
| 610 int width, | 613 int width, |
| 611 int height, | 614 int height, |
| 612 int ystride, | 615 int ystride, |
| 613 int uvstride, | 616 int uvstride, |
| 614 int rgbstride, | 617 int rgbstride, |
| 615 YUVType yuv_type) { | 618 YUVType yuv_type, |
| 619 YUVRange yuv_range) { |
| 616 g_convert_yuv_to_rgb32_proc_(yplane, | 620 g_convert_yuv_to_rgb32_proc_(yplane, |
| 617 uplane, | 621 uplane, |
| 618 vplane, | 622 vplane, |
| 619 rgbframe, | 623 rgbframe, |
| 620 width, | 624 width, |
| 621 height, | 625 height, |
| 622 ystride, | 626 ystride, |
| 623 uvstride, | 627 uvstride, |
| 624 rgbstride, | 628 rgbstride, |
| 625 yuv_type); | 629 yuv_type, |
| 630 yuv_range); |
| 626 } | 631 } |
| 627 | 632 |
| 628 void ConvertYUVAToARGB(const uint8* yplane, | 633 void ConvertYUVAToARGB(const uint8* yplane, |
| 629 const uint8* uplane, | 634 const uint8* uplane, |
| 630 const uint8* vplane, | 635 const uint8* vplane, |
| 631 const uint8* aplane, | 636 const uint8* aplane, |
| 632 uint8* rgbframe, | 637 uint8* rgbframe, |
| 633 int width, | 638 int width, |
| 634 int height, | 639 int height, |
| 635 int ystride, | 640 int ystride, |
| 636 int uvstride, | 641 int uvstride, |
| 637 int astride, | 642 int astride, |
| 638 int rgbstride, | 643 int rgbstride, |
| 639 YUVType yuv_type) { | 644 YUVType yuv_type, |
| 645 YUVRange yuv_range) { |
| 640 g_convert_yuva_to_argb_proc_(yplane, | 646 g_convert_yuva_to_argb_proc_(yplane, |
| 641 uplane, | 647 uplane, |
| 642 vplane, | 648 vplane, |
| 643 aplane, | 649 aplane, |
| 644 rgbframe, | 650 rgbframe, |
| 645 width, | 651 width, |
| 646 height, | 652 height, |
| 647 ystride, | 653 ystride, |
| 648 uvstride, | 654 uvstride, |
| 649 astride, | 655 astride, |
| 650 rgbstride, | 656 rgbstride, |
| 651 yuv_type); | 657 yuv_type, |
| 658 yuv_range); |
| 652 } | 659 } |
| 653 | 660 |
| 654 } // namespace media | 661 } // namespace media |
| OLD | NEW |