OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The LibYuv Project Authors. All rights reserved. | 2 * Copyright 2012 The LibYuv Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #endif | 21 #endif |
22 | 22 |
23 // ARGB little endian (bgra in memory) to I444 | 23 // ARGB little endian (bgra in memory) to I444 |
24 LIBYUV_API | 24 LIBYUV_API |
25 int ARGBToI444(const uint8* src_argb, int src_stride_argb, | 25 int ARGBToI444(const uint8* src_argb, int src_stride_argb, |
26 uint8* dst_y, int dst_stride_y, | 26 uint8* dst_y, int dst_stride_y, |
27 uint8* dst_u, int dst_stride_u, | 27 uint8* dst_u, int dst_stride_u, |
28 uint8* dst_v, int dst_stride_v, | 28 uint8* dst_v, int dst_stride_v, |
29 int width, int height) { | 29 int width, int height) { |
30 int y; | 30 int y; |
31 void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) = | 31 void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) = |
32 ARGBToYRow_C; | 32 ARGBToYRow_C; |
33 void (*ARGBToUV444Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v, | 33 void (*ARGBToUV444Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v, |
34 int pix) = ARGBToUV444Row_C; | 34 int width) = ARGBToUV444Row_C; |
35 if (!src_argb || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) { | 35 if (!src_argb || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) { |
36 return -1; | 36 return -1; |
37 } | 37 } |
38 if (height < 0) { | 38 if (height < 0) { |
39 height = -height; | 39 height = -height; |
40 src_argb = src_argb + (height - 1) * src_stride_argb; | 40 src_argb = src_argb + (height - 1) * src_stride_argb; |
41 src_stride_argb = -src_stride_argb; | 41 src_stride_argb = -src_stride_argb; |
42 } | 42 } |
43 // Coalesce rows. | 43 // Coalesce rows. |
44 if (src_stride_argb == width * 4 && | 44 if (src_stride_argb == width * 4 && |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 // ARGB little endian (bgra in memory) to I422 | 104 // ARGB little endian (bgra in memory) to I422 |
105 LIBYUV_API | 105 LIBYUV_API |
106 int ARGBToI422(const uint8* src_argb, int src_stride_argb, | 106 int ARGBToI422(const uint8* src_argb, int src_stride_argb, |
107 uint8* dst_y, int dst_stride_y, | 107 uint8* dst_y, int dst_stride_y, |
108 uint8* dst_u, int dst_stride_u, | 108 uint8* dst_u, int dst_stride_u, |
109 uint8* dst_v, int dst_stride_v, | 109 uint8* dst_v, int dst_stride_v, |
110 int width, int height) { | 110 int width, int height) { |
111 int y; | 111 int y; |
112 void (*ARGBToUV422Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v, | 112 void (*ARGBToUV422Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v, |
113 int pix) = ARGBToUV422Row_C; | 113 int width) = ARGBToUV422Row_C; |
114 void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) = | 114 void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) = |
115 ARGBToYRow_C; | 115 ARGBToYRow_C; |
116 if (!src_argb || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) { | 116 if (!src_argb || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) { |
117 return -1; | 117 return -1; |
118 } | 118 } |
119 if (height < 0) { | 119 if (height < 0) { |
120 height = -height; | 120 height = -height; |
121 src_argb = src_argb + (height - 1) * src_stride_argb; | 121 src_argb = src_argb + (height - 1) * src_stride_argb; |
122 src_stride_argb = -src_stride_argb; | 122 src_stride_argb = -src_stride_argb; |
123 } | 123 } |
124 // Coalesce rows. | 124 // Coalesce rows. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 184 |
185 // ARGB little endian (bgra in memory) to I411 | 185 // ARGB little endian (bgra in memory) to I411 |
186 LIBYUV_API | 186 LIBYUV_API |
187 int ARGBToI411(const uint8* src_argb, int src_stride_argb, | 187 int ARGBToI411(const uint8* src_argb, int src_stride_argb, |
188 uint8* dst_y, int dst_stride_y, | 188 uint8* dst_y, int dst_stride_y, |
189 uint8* dst_u, int dst_stride_u, | 189 uint8* dst_u, int dst_stride_u, |
190 uint8* dst_v, int dst_stride_v, | 190 uint8* dst_v, int dst_stride_v, |
191 int width, int height) { | 191 int width, int height) { |
192 int y; | 192 int y; |
193 void (*ARGBToUV411Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v, | 193 void (*ARGBToUV411Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v, |
194 int pix) = ARGBToUV411Row_C; | 194 int width) = ARGBToUV411Row_C; |
195 void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) = | 195 void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) = |
196 ARGBToYRow_C; | 196 ARGBToYRow_C; |
197 if (!src_argb || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) { | 197 if (!src_argb || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) { |
198 return -1; | 198 return -1; |
199 } | 199 } |
200 if (height < 0) { | 200 if (height < 0) { |
201 height = -height; | 201 height = -height; |
202 src_argb = src_argb + (height - 1) * src_stride_argb; | 202 src_argb = src_argb + (height - 1) * src_stride_argb; |
203 src_stride_argb = -src_stride_argb; | 203 src_stride_argb = -src_stride_argb; |
204 } | 204 } |
205 // Coalesce rows. | 205 // Coalesce rows. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 257 |
258 LIBYUV_API | 258 LIBYUV_API |
259 int ARGBToNV12(const uint8* src_argb, int src_stride_argb, | 259 int ARGBToNV12(const uint8* src_argb, int src_stride_argb, |
260 uint8* dst_y, int dst_stride_y, | 260 uint8* dst_y, int dst_stride_y, |
261 uint8* dst_uv, int dst_stride_uv, | 261 uint8* dst_uv, int dst_stride_uv, |
262 int width, int height) { | 262 int width, int height) { |
263 int y; | 263 int y; |
264 int halfwidth = (width + 1) >> 1; | 264 int halfwidth = (width + 1) >> 1; |
265 void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb, | 265 void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb, |
266 uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C; | 266 uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C; |
267 void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) = | 267 void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) = |
268 ARGBToYRow_C; | 268 ARGBToYRow_C; |
269 void (*MergeUVRow_)(const uint8* src_u, const uint8* src_v, uint8* dst_uv, | 269 void (*MergeUVRow_)(const uint8* src_u, const uint8* src_v, uint8* dst_uv, |
270 int width) = MergeUVRow_C; | 270 int width) = MergeUVRow_C; |
271 if (!src_argb || | 271 if (!src_argb || |
272 !dst_y || !dst_uv || | 272 !dst_y || !dst_uv || |
273 width <= 0 || height == 0) { | 273 width <= 0 || height == 0) { |
274 return -1; | 274 return -1; |
275 } | 275 } |
276 // Negative height means invert the image. | 276 // Negative height means invert the image. |
277 if (height < 0) { | 277 if (height < 0) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 // Same as NV12 but U and V swapped. | 366 // Same as NV12 but U and V swapped. |
367 LIBYUV_API | 367 LIBYUV_API |
368 int ARGBToNV21(const uint8* src_argb, int src_stride_argb, | 368 int ARGBToNV21(const uint8* src_argb, int src_stride_argb, |
369 uint8* dst_y, int dst_stride_y, | 369 uint8* dst_y, int dst_stride_y, |
370 uint8* dst_uv, int dst_stride_uv, | 370 uint8* dst_uv, int dst_stride_uv, |
371 int width, int height) { | 371 int width, int height) { |
372 int y; | 372 int y; |
373 int halfwidth = (width + 1) >> 1; | 373 int halfwidth = (width + 1) >> 1; |
374 void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb, | 374 void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb, |
375 uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C; | 375 uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C; |
376 void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) = | 376 void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) = |
377 ARGBToYRow_C; | 377 ARGBToYRow_C; |
378 void (*MergeUVRow_)(const uint8* src_u, const uint8* src_v, uint8* dst_uv, | 378 void (*MergeUVRow_)(const uint8* src_u, const uint8* src_v, uint8* dst_uv, |
379 int width) = MergeUVRow_C; | 379 int width) = MergeUVRow_C; |
380 if (!src_argb || | 380 if (!src_argb || |
381 !dst_y || !dst_uv || | 381 !dst_y || !dst_uv || |
382 width <= 0 || height == 0) { | 382 width <= 0 || height == 0) { |
383 return -1; | 383 return -1; |
384 } | 384 } |
385 // Negative height means invert the image. | 385 // Negative height means invert the image. |
386 if (height < 0) { | 386 if (height < 0) { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 return 0; | 472 return 0; |
473 } | 473 } |
474 | 474 |
475 // Convert ARGB to YUY2. | 475 // Convert ARGB to YUY2. |
476 LIBYUV_API | 476 LIBYUV_API |
477 int ARGBToYUY2(const uint8* src_argb, int src_stride_argb, | 477 int ARGBToYUY2(const uint8* src_argb, int src_stride_argb, |
478 uint8* dst_yuy2, int dst_stride_yuy2, | 478 uint8* dst_yuy2, int dst_stride_yuy2, |
479 int width, int height) { | 479 int width, int height) { |
480 int y; | 480 int y; |
481 void (*ARGBToUV422Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v, | 481 void (*ARGBToUV422Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v, |
482 int pix) = ARGBToUV422Row_C; | 482 int width) = ARGBToUV422Row_C; |
483 void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) = | 483 void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) = |
484 ARGBToYRow_C; | 484 ARGBToYRow_C; |
485 void (*I422ToYUY2Row)(const uint8* src_y, const uint8* src_u, | 485 void (*I422ToYUY2Row)(const uint8* src_y, const uint8* src_u, |
486 const uint8* src_v, uint8* dst_yuy2, int width) = I422ToYUY2Row_C; | 486 const uint8* src_v, uint8* dst_yuy2, int width) = I422ToYUY2Row_C; |
487 | 487 |
488 if (!src_argb || !dst_yuy2 || | 488 if (!src_argb || !dst_yuy2 || |
489 width <= 0 || height == 0) { | 489 width <= 0 || height == 0) { |
490 return -1; | 490 return -1; |
491 } | 491 } |
492 // Negative height means invert the image. | 492 // Negative height means invert the image. |
493 if (height < 0) { | 493 if (height < 0) { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 return 0; | 579 return 0; |
580 } | 580 } |
581 | 581 |
582 // Convert ARGB to UYVY. | 582 // Convert ARGB to UYVY. |
583 LIBYUV_API | 583 LIBYUV_API |
584 int ARGBToUYVY(const uint8* src_argb, int src_stride_argb, | 584 int ARGBToUYVY(const uint8* src_argb, int src_stride_argb, |
585 uint8* dst_uyvy, int dst_stride_uyvy, | 585 uint8* dst_uyvy, int dst_stride_uyvy, |
586 int width, int height) { | 586 int width, int height) { |
587 int y; | 587 int y; |
588 void (*ARGBToUV422Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v, | 588 void (*ARGBToUV422Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v, |
589 int pix) = ARGBToUV422Row_C; | 589 int width) = ARGBToUV422Row_C; |
590 void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) = | 590 void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) = |
591 ARGBToYRow_C; | 591 ARGBToYRow_C; |
592 void (*I422ToUYVYRow)(const uint8* src_y, const uint8* src_u, | 592 void (*I422ToUYVYRow)(const uint8* src_y, const uint8* src_u, |
593 const uint8* src_v, uint8* dst_uyvy, int width) = I422ToUYVYRow_C; | 593 const uint8* src_v, uint8* dst_uyvy, int width) = I422ToUYVYRow_C; |
594 | 594 |
595 if (!src_argb || !dst_uyvy || | 595 if (!src_argb || !dst_uyvy || |
596 width <= 0 || height == 0) { | 596 width <= 0 || height == 0) { |
597 return -1; | 597 return -1; |
598 } | 598 } |
599 // Negative height means invert the image. | 599 // Negative height means invert the image. |
600 if (height < 0) { | 600 if (height < 0) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 } | 685 } |
686 return 0; | 686 return 0; |
687 } | 687 } |
688 | 688 |
689 // Convert ARGB to I400. | 689 // Convert ARGB to I400. |
690 LIBYUV_API | 690 LIBYUV_API |
691 int ARGBToI400(const uint8* src_argb, int src_stride_argb, | 691 int ARGBToI400(const uint8* src_argb, int src_stride_argb, |
692 uint8* dst_y, int dst_stride_y, | 692 uint8* dst_y, int dst_stride_y, |
693 int width, int height) { | 693 int width, int height) { |
694 int y; | 694 int y; |
695 void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) = | 695 void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) = |
696 ARGBToYRow_C; | 696 ARGBToYRow_C; |
697 if (!src_argb || !dst_y || width <= 0 || height == 0) { | 697 if (!src_argb || !dst_y || width <= 0 || height == 0) { |
698 return -1; | 698 return -1; |
699 } | 699 } |
700 if (height < 0) { | 700 if (height < 0) { |
701 height = -height; | 701 height = -height; |
702 src_argb = src_argb + (height - 1) * src_stride_argb; | 702 src_argb = src_argb + (height - 1) * src_stride_argb; |
703 src_stride_argb = -src_stride_argb; | 703 src_stride_argb = -src_stride_argb; |
704 } | 704 } |
705 // Coalesce rows. | 705 // Coalesce rows. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 (const uint8*)(&kShuffleMaskARGBToRGBA), | 757 (const uint8*)(&kShuffleMaskARGBToRGBA), |
758 width, height); | 758 width, height); |
759 } | 759 } |
760 | 760 |
761 // Convert ARGB To RGB24. | 761 // Convert ARGB To RGB24. |
762 LIBYUV_API | 762 LIBYUV_API |
763 int ARGBToRGB24(const uint8* src_argb, int src_stride_argb, | 763 int ARGBToRGB24(const uint8* src_argb, int src_stride_argb, |
764 uint8* dst_rgb24, int dst_stride_rgb24, | 764 uint8* dst_rgb24, int dst_stride_rgb24, |
765 int width, int height) { | 765 int width, int height) { |
766 int y; | 766 int y; |
767 void (*ARGBToRGB24Row)(const uint8* src_argb, uint8* dst_rgb, int pix) = | 767 void (*ARGBToRGB24Row)(const uint8* src_argb, uint8* dst_rgb, int width) = |
768 ARGBToRGB24Row_C; | 768 ARGBToRGB24Row_C; |
769 if (!src_argb || !dst_rgb24 || width <= 0 || height == 0) { | 769 if (!src_argb || !dst_rgb24 || width <= 0 || height == 0) { |
770 return -1; | 770 return -1; |
771 } | 771 } |
772 if (height < 0) { | 772 if (height < 0) { |
773 height = -height; | 773 height = -height; |
774 src_argb = src_argb + (height - 1) * src_stride_argb; | 774 src_argb = src_argb + (height - 1) * src_stride_argb; |
775 src_stride_argb = -src_stride_argb; | 775 src_stride_argb = -src_stride_argb; |
776 } | 776 } |
777 // Coalesce rows. | 777 // Coalesce rows. |
(...skipping 27 matching lines...) Expand all Loading... |
805 } | 805 } |
806 return 0; | 806 return 0; |
807 } | 807 } |
808 | 808 |
809 // Convert ARGB To RAW. | 809 // Convert ARGB To RAW. |
810 LIBYUV_API | 810 LIBYUV_API |
811 int ARGBToRAW(const uint8* src_argb, int src_stride_argb, | 811 int ARGBToRAW(const uint8* src_argb, int src_stride_argb, |
812 uint8* dst_raw, int dst_stride_raw, | 812 uint8* dst_raw, int dst_stride_raw, |
813 int width, int height) { | 813 int width, int height) { |
814 int y; | 814 int y; |
815 void (*ARGBToRAWRow)(const uint8* src_argb, uint8* dst_rgb, int pix) = | 815 void (*ARGBToRAWRow)(const uint8* src_argb, uint8* dst_rgb, int width) = |
816 ARGBToRAWRow_C; | 816 ARGBToRAWRow_C; |
817 if (!src_argb || !dst_raw || width <= 0 || height == 0) { | 817 if (!src_argb || !dst_raw || width <= 0 || height == 0) { |
818 return -1; | 818 return -1; |
819 } | 819 } |
820 if (height < 0) { | 820 if (height < 0) { |
821 height = -height; | 821 height = -height; |
822 src_argb = src_argb + (height - 1) * src_stride_argb; | 822 src_argb = src_argb + (height - 1) * src_stride_argb; |
823 src_stride_argb = -src_stride_argb; | 823 src_stride_argb = -src_stride_argb; |
824 } | 824 } |
825 // Coalesce rows. | 825 // Coalesce rows. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 7, 3, 6, 2, | 862 7, 3, 6, 2, |
863 }; | 863 }; |
864 | 864 |
865 // Convert ARGB To RGB565 with 4x4 dither matrix (16 bytes). | 865 // Convert ARGB To RGB565 with 4x4 dither matrix (16 bytes). |
866 LIBYUV_API | 866 LIBYUV_API |
867 int ARGBToRGB565Dither(const uint8* src_argb, int src_stride_argb, | 867 int ARGBToRGB565Dither(const uint8* src_argb, int src_stride_argb, |
868 uint8* dst_rgb565, int dst_stride_rgb565, | 868 uint8* dst_rgb565, int dst_stride_rgb565, |
869 const uint8* dither4x4, int width, int height) { | 869 const uint8* dither4x4, int width, int height) { |
870 int y; | 870 int y; |
871 void (*ARGBToRGB565DitherRow)(const uint8* src_argb, uint8* dst_rgb, | 871 void (*ARGBToRGB565DitherRow)(const uint8* src_argb, uint8* dst_rgb, |
872 const uint32 dither4, int pix) = ARGBToRGB565DitherRow_C; | 872 const uint32 dither4, int width) = ARGBToRGB565DitherRow_C; |
873 if (!src_argb || !dst_rgb565 || width <= 0 || height == 0) { | 873 if (!src_argb || !dst_rgb565 || width <= 0 || height == 0) { |
874 return -1; | 874 return -1; |
875 } | 875 } |
876 if (height < 0) { | 876 if (height < 0) { |
877 height = -height; | 877 height = -height; |
878 src_argb = src_argb + (height - 1) * src_stride_argb; | 878 src_argb = src_argb + (height - 1) * src_stride_argb; |
879 src_stride_argb = -src_stride_argb; | 879 src_stride_argb = -src_stride_argb; |
880 } | 880 } |
881 if (!dither4x4) { | 881 if (!dither4x4) { |
882 dither4x4 = kDither565_4x4; | 882 dither4x4 = kDither565_4x4; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 return 0; | 914 return 0; |
915 } | 915 } |
916 | 916 |
917 // Convert ARGB To RGB565. | 917 // Convert ARGB To RGB565. |
918 // TODO(fbarchard): Consider using dither function low level with zeros. | 918 // TODO(fbarchard): Consider using dither function low level with zeros. |
919 LIBYUV_API | 919 LIBYUV_API |
920 int ARGBToRGB565(const uint8* src_argb, int src_stride_argb, | 920 int ARGBToRGB565(const uint8* src_argb, int src_stride_argb, |
921 uint8* dst_rgb565, int dst_stride_rgb565, | 921 uint8* dst_rgb565, int dst_stride_rgb565, |
922 int width, int height) { | 922 int width, int height) { |
923 int y; | 923 int y; |
924 void (*ARGBToRGB565Row)(const uint8* src_argb, uint8* dst_rgb, int pix) = | 924 void (*ARGBToRGB565Row)(const uint8* src_argb, uint8* dst_rgb, int width) = |
925 ARGBToRGB565Row_C; | 925 ARGBToRGB565Row_C; |
926 if (!src_argb || !dst_rgb565 || width <= 0 || height == 0) { | 926 if (!src_argb || !dst_rgb565 || width <= 0 || height == 0) { |
927 return -1; | 927 return -1; |
928 } | 928 } |
929 if (height < 0) { | 929 if (height < 0) { |
930 height = -height; | 930 height = -height; |
931 src_argb = src_argb + (height - 1) * src_stride_argb; | 931 src_argb = src_argb + (height - 1) * src_stride_argb; |
932 src_stride_argb = -src_stride_argb; | 932 src_stride_argb = -src_stride_argb; |
933 } | 933 } |
934 // Coalesce rows. | 934 // Coalesce rows. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 } | 970 } |
971 return 0; | 971 return 0; |
972 } | 972 } |
973 | 973 |
974 // Convert ARGB To ARGB1555. | 974 // Convert ARGB To ARGB1555. |
975 LIBYUV_API | 975 LIBYUV_API |
976 int ARGBToARGB1555(const uint8* src_argb, int src_stride_argb, | 976 int ARGBToARGB1555(const uint8* src_argb, int src_stride_argb, |
977 uint8* dst_argb1555, int dst_stride_argb1555, | 977 uint8* dst_argb1555, int dst_stride_argb1555, |
978 int width, int height) { | 978 int width, int height) { |
979 int y; | 979 int y; |
980 void (*ARGBToARGB1555Row)(const uint8* src_argb, uint8* dst_rgb, int pix) = | 980 void (*ARGBToARGB1555Row)(const uint8* src_argb, uint8* dst_rgb, int width) = |
981 ARGBToARGB1555Row_C; | 981 ARGBToARGB1555Row_C; |
982 if (!src_argb || !dst_argb1555 || width <= 0 || height == 0) { | 982 if (!src_argb || !dst_argb1555 || width <= 0 || height == 0) { |
983 return -1; | 983 return -1; |
984 } | 984 } |
985 if (height < 0) { | 985 if (height < 0) { |
986 height = -height; | 986 height = -height; |
987 src_argb = src_argb + (height - 1) * src_stride_argb; | 987 src_argb = src_argb + (height - 1) * src_stride_argb; |
988 src_stride_argb = -src_stride_argb; | 988 src_stride_argb = -src_stride_argb; |
989 } | 989 } |
990 // Coalesce rows. | 990 // Coalesce rows. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 } | 1026 } |
1027 return 0; | 1027 return 0; |
1028 } | 1028 } |
1029 | 1029 |
1030 // Convert ARGB To ARGB4444. | 1030 // Convert ARGB To ARGB4444. |
1031 LIBYUV_API | 1031 LIBYUV_API |
1032 int ARGBToARGB4444(const uint8* src_argb, int src_stride_argb, | 1032 int ARGBToARGB4444(const uint8* src_argb, int src_stride_argb, |
1033 uint8* dst_argb4444, int dst_stride_argb4444, | 1033 uint8* dst_argb4444, int dst_stride_argb4444, |
1034 int width, int height) { | 1034 int width, int height) { |
1035 int y; | 1035 int y; |
1036 void (*ARGBToARGB4444Row)(const uint8* src_argb, uint8* dst_rgb, int pix) = | 1036 void (*ARGBToARGB4444Row)(const uint8* src_argb, uint8* dst_rgb, int width) = |
1037 ARGBToARGB4444Row_C; | 1037 ARGBToARGB4444Row_C; |
1038 if (!src_argb || !dst_argb4444 || width <= 0 || height == 0) { | 1038 if (!src_argb || !dst_argb4444 || width <= 0 || height == 0) { |
1039 return -1; | 1039 return -1; |
1040 } | 1040 } |
1041 if (height < 0) { | 1041 if (height < 0) { |
1042 height = -height; | 1042 height = -height; |
1043 src_argb = src_argb + (height - 1) * src_stride_argb; | 1043 src_argb = src_argb + (height - 1) * src_stride_argb; |
1044 src_stride_argb = -src_stride_argb; | 1044 src_stride_argb = -src_stride_argb; |
1045 } | 1045 } |
1046 // Coalesce rows. | 1046 // Coalesce rows. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 // Convert ARGB to J420. (JPeg full range I420). | 1086 // Convert ARGB to J420. (JPeg full range I420). |
1087 LIBYUV_API | 1087 LIBYUV_API |
1088 int ARGBToJ420(const uint8* src_argb, int src_stride_argb, | 1088 int ARGBToJ420(const uint8* src_argb, int src_stride_argb, |
1089 uint8* dst_yj, int dst_stride_yj, | 1089 uint8* dst_yj, int dst_stride_yj, |
1090 uint8* dst_u, int dst_stride_u, | 1090 uint8* dst_u, int dst_stride_u, |
1091 uint8* dst_v, int dst_stride_v, | 1091 uint8* dst_v, int dst_stride_v, |
1092 int width, int height) { | 1092 int width, int height) { |
1093 int y; | 1093 int y; |
1094 void (*ARGBToUVJRow)(const uint8* src_argb0, int src_stride_argb, | 1094 void (*ARGBToUVJRow)(const uint8* src_argb0, int src_stride_argb, |
1095 uint8* dst_u, uint8* dst_v, int width) = ARGBToUVJRow_C; | 1095 uint8* dst_u, uint8* dst_v, int width) = ARGBToUVJRow_C; |
1096 void (*ARGBToYJRow)(const uint8* src_argb, uint8* dst_yj, int pix) = | 1096 void (*ARGBToYJRow)(const uint8* src_argb, uint8* dst_yj, int width) = |
1097 ARGBToYJRow_C; | 1097 ARGBToYJRow_C; |
1098 if (!src_argb || | 1098 if (!src_argb || |
1099 !dst_yj || !dst_u || !dst_v || | 1099 !dst_yj || !dst_u || !dst_v || |
1100 width <= 0 || height == 0) { | 1100 width <= 0 || height == 0) { |
1101 return -1; | 1101 return -1; |
1102 } | 1102 } |
1103 // Negative height means invert the image. | 1103 // Negative height means invert the image. |
1104 if (height < 0) { | 1104 if (height < 0) { |
1105 height = -height; | 1105 height = -height; |
1106 src_argb = src_argb + (height - 1) * src_stride_argb; | 1106 src_argb = src_argb + (height - 1) * src_stride_argb; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 | 1159 |
1160 // ARGB little endian (bgra in memory) to J422 | 1160 // ARGB little endian (bgra in memory) to J422 |
1161 LIBYUV_API | 1161 LIBYUV_API |
1162 int ARGBToJ422(const uint8* src_argb, int src_stride_argb, | 1162 int ARGBToJ422(const uint8* src_argb, int src_stride_argb, |
1163 uint8* dst_y, int dst_stride_y, | 1163 uint8* dst_y, int dst_stride_y, |
1164 uint8* dst_u, int dst_stride_u, | 1164 uint8* dst_u, int dst_stride_u, |
1165 uint8* dst_v, int dst_stride_v, | 1165 uint8* dst_v, int dst_stride_v, |
1166 int width, int height) { | 1166 int width, int height) { |
1167 int y; | 1167 int y; |
1168 void (*ARGBToUVJ422Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v, | 1168 void (*ARGBToUVJ422Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v, |
1169 int pix) = ARGBToUVJ422Row_C; | 1169 int width) = ARGBToUVJ422Row_C; |
1170 void (*ARGBToYJRow)(const uint8* src_argb, uint8* dst_y, int pix) = | 1170 void (*ARGBToYJRow)(const uint8* src_argb, uint8* dst_y, int width) = |
1171 ARGBToYJRow_C; | 1171 ARGBToYJRow_C; |
1172 if (!src_argb || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) { | 1172 if (!src_argb || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) { |
1173 return -1; | 1173 return -1; |
1174 } | 1174 } |
1175 if (height < 0) { | 1175 if (height < 0) { |
1176 height = -height; | 1176 height = -height; |
1177 src_argb = src_argb + (height - 1) * src_stride_argb; | 1177 src_argb = src_argb + (height - 1) * src_stride_argb; |
1178 src_stride_argb = -src_stride_argb; | 1178 src_stride_argb = -src_stride_argb; |
1179 } | 1179 } |
1180 // Coalesce rows. | 1180 // Coalesce rows. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 } | 1238 } |
1239 return 0; | 1239 return 0; |
1240 } | 1240 } |
1241 | 1241 |
1242 // Convert ARGB to J400. | 1242 // Convert ARGB to J400. |
1243 LIBYUV_API | 1243 LIBYUV_API |
1244 int ARGBToJ400(const uint8* src_argb, int src_stride_argb, | 1244 int ARGBToJ400(const uint8* src_argb, int src_stride_argb, |
1245 uint8* dst_yj, int dst_stride_yj, | 1245 uint8* dst_yj, int dst_stride_yj, |
1246 int width, int height) { | 1246 int width, int height) { |
1247 int y; | 1247 int y; |
1248 void (*ARGBToYJRow)(const uint8* src_argb, uint8* dst_yj, int pix) = | 1248 void (*ARGBToYJRow)(const uint8* src_argb, uint8* dst_yj, int width) = |
1249 ARGBToYJRow_C; | 1249 ARGBToYJRow_C; |
1250 if (!src_argb || !dst_yj || width <= 0 || height == 0) { | 1250 if (!src_argb || !dst_yj || width <= 0 || height == 0) { |
1251 return -1; | 1251 return -1; |
1252 } | 1252 } |
1253 if (height < 0) { | 1253 if (height < 0) { |
1254 height = -height; | 1254 height = -height; |
1255 src_argb = src_argb + (height - 1) * src_stride_argb; | 1255 src_argb = src_argb + (height - 1) * src_stride_argb; |
1256 src_stride_argb = -src_stride_argb; | 1256 src_stride_argb = -src_stride_argb; |
1257 } | 1257 } |
1258 // Coalesce rows. | 1258 // Coalesce rows. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 src_argb += src_stride_argb; | 1292 src_argb += src_stride_argb; |
1293 dst_yj += dst_stride_yj; | 1293 dst_yj += dst_stride_yj; |
1294 } | 1294 } |
1295 return 0; | 1295 return 0; |
1296 } | 1296 } |
1297 | 1297 |
1298 #ifdef __cplusplus | 1298 #ifdef __cplusplus |
1299 } // extern "C" | 1299 } // extern "C" |
1300 } // namespace libyuv | 1300 } // namespace libyuv |
1301 #endif | 1301 #endif |
OLD | NEW |