Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(734)

Side by Side Diff: source/planar_functions.cc

Issue 1419103007: Raw 24 bit RGB to RGB24 (bgr) (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: st3 for neon 24 bit stores Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/libyuv/row.h ('k') | source/row_any.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. 2 * Copyright 2011 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 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 NV12ToRGB565Row(src_y, src_uv, dst_rgb565, &kYuvIConstants, width); 913 NV12ToRGB565Row(src_y, src_uv, dst_rgb565, &kYuvIConstants, width);
914 dst_rgb565 += dst_stride_rgb565; 914 dst_rgb565 += dst_stride_rgb565;
915 src_y += src_stride_y; 915 src_y += src_stride_y;
916 if (y & 1) { 916 if (y & 1) {
917 src_uv += src_stride_uv; 917 src_uv += src_stride_uv;
918 } 918 }
919 } 919 }
920 return 0; 920 return 0;
921 } 921 }
922 922
923 // Convert RAW to RGB24.
924 LIBYUV_API
925 int RAWToRGB24(const uint8* src_raw, int src_stride_raw,
926 uint8* dst_rgb24, int dst_stride_rgb24,
927 int width, int height) {
928 int y;
929 void (*RAWToRGB24Row)(const uint8* src_rgb, uint8* dst_rgb24, int width) =
930 RAWToRGB24Row_C;
931 if (!src_raw || !dst_rgb24 ||
932 width <= 0 || height == 0) {
933 return -1;
934 }
935 // Negative height means invert the image.
936 if (height < 0) {
937 height = -height;
938 src_raw = src_raw + (height - 1) * src_stride_raw;
939 src_stride_raw = -src_stride_raw;
940 }
941 // Coalesce rows.
942 if (src_stride_raw == width * 3 &&
943 dst_stride_rgb24 == width * 3) {
944 width *= height;
945 height = 1;
946 src_stride_raw = dst_stride_rgb24 = 0;
947 }
948 #if defined(HAS_RAWTORGB24ROW_SSSE3)
949 if (TestCpuFlag(kCpuHasSSSE3)) {
950 RAWToRGB24Row = RAWToRGB24Row_Any_SSSE3;
951 if (IS_ALIGNED(width, 8)) {
952 RAWToRGB24Row = RAWToRGB24Row_SSSE3;
953 }
954 }
955 #endif
956 #if defined(HAS_RAWTORGB24ROW_NEON)
957 if (TestCpuFlag(kCpuHasNEON)) {
958 RAWToRGB24Row = RAWToRGB24Row_Any_NEON;
959 if (IS_ALIGNED(width, 8)) {
960 RAWToRGB24Row = RAWToRGB24Row_NEON;
961 }
962 }
963 #endif
964
965 for (y = 0; y < height; ++y) {
966 RAWToRGB24Row(src_raw, dst_rgb24, width);
967 src_raw += src_stride_raw;
968 dst_rgb24 += dst_stride_rgb24;
969 }
970 return 0;
971 }
972
923 LIBYUV_API 973 LIBYUV_API
924 void SetPlane(uint8* dst_y, int dst_stride_y, 974 void SetPlane(uint8* dst_y, int dst_stride_y,
925 int width, int height, 975 int width, int height,
926 uint32 value) { 976 uint32 value) {
927 int y; 977 int y;
928 void (*SetRow)(uint8* dst, uint8 value, int width) = SetRow_C; 978 void (*SetRow)(uint8* dst, uint8 value, int width) = SetRow_C;
929 if (height < 0) { 979 if (height < 0) {
930 height = -height; 980 height = -height;
931 dst_y = dst_y + (height - 1) * dst_stride_y; 981 dst_y = dst_y + (height - 1) * dst_stride_y;
932 dst_stride_y = -dst_stride_y; 982 dst_stride_y = -dst_stride_y;
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
2365 } 2415 }
2366 free_aligned_buffer_64(rows); 2416 free_aligned_buffer_64(rows);
2367 } 2417 }
2368 return 0; 2418 return 0;
2369 } 2419 }
2370 2420
2371 #ifdef __cplusplus 2421 #ifdef __cplusplus
2372 } // extern "C" 2422 } // extern "C"
2373 } // namespace libyuv 2423 } // namespace libyuv
2374 #endif 2424 #endif
OLDNEW
« no previous file with comments | « include/libyuv/row.h ('k') | source/row_any.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698