mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-06 16:56:55 +08:00
YUY2 directly to ARGB.
BUG=31 TEST=none Review URL: https://webrtc-codereview.appspot.com/537003 git-svn-id: http://libyuv.googlecode.com/svn/trunk@253 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
5566302866
commit
87e2390fd8
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 252
|
||||
Version: 253
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -52,6 +52,11 @@ int NV12ToRGB565(const uint8* src_y, int src_stride_y,
|
||||
uint8* dst_frame, int dst_stride_frame,
|
||||
int width, int height);
|
||||
|
||||
// Convert YUY2 to ARGB.
|
||||
int YUY2ToARGB(const uint8* src_yuy2, int src_stride_yuy2,
|
||||
uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height);
|
||||
|
||||
// Convert I422 to ARGB.
|
||||
int I422ToARGB(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_u, int src_stride_u,
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
#ifndef INCLUDE_LIBYUV_VERSION_H_
|
||||
#define INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
#define LIBYUV_VERSION 252
|
||||
#define LIBYUV_VERSION 253
|
||||
|
||||
#endif // INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
|
||||
@ -571,7 +571,6 @@ int NV12ToARGB(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int halfwidth = (width + 1) >> 1;
|
||||
void (*SplitUV)(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix) =
|
||||
SplitUV_C;
|
||||
@ -600,6 +599,72 @@ int NV12ToARGB(const uint8* src_y, int src_stride_y,
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Convert YUY2 to ARGB.
|
||||
int YUY2ToARGB(const uint8* src_yuy2, int src_stride_yuy2,
|
||||
uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height) {
|
||||
// Negative height means invert the image.
|
||||
if (height < 0) {
|
||||
height = -height;
|
||||
src_yuy2 = src_yuy2 + (height - 1) * src_stride_yuy2;
|
||||
src_stride_yuy2 = -src_stride_yuy2;
|
||||
}
|
||||
void (*YUY2ToUVRow)(const uint8* src_yuy2, int src_stride_yuy2,
|
||||
uint8* dst_u, uint8* dst_v, int pix) = YUY2ToUVRow_C;
|
||||
void (*YUY2ToYRow)(const uint8* src_yuy2,
|
||||
uint8* dst_y, int pix) = YUY2ToYRow_C;
|
||||
#if defined(HAS_YUY2TOYROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2)) {
|
||||
if (width > 16) {
|
||||
YUY2ToUVRow = YUY2ToUVRow_Any_SSE2;
|
||||
YUY2ToYRow = YUY2ToYRow_Any_SSE2;
|
||||
}
|
||||
if (IS_ALIGNED(width, 16)) {
|
||||
YUY2ToUVRow = YUY2ToUVRow_Unaligned_SSE2;
|
||||
YUY2ToYRow = YUY2ToYRow_Unaligned_SSE2;
|
||||
if (IS_ALIGNED(src_yuy2, 16) && IS_ALIGNED(src_stride_yuy2, 16)) {
|
||||
YUY2ToUVRow = YUY2ToUVRow_SSE2;
|
||||
YUY2ToYRow = YUY2ToYRow_SSE2;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
void (*I420ToARGBRow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* argb_buf,
|
||||
int width) = I420ToARGBRow_C;
|
||||
#if defined(HAS_I420TOARGBROW_NEON)
|
||||
if (TestCpuFlag(kCpuHasNEON)) {
|
||||
I420ToARGBRow = I420ToARGBRow_Any_NEON;
|
||||
if (IS_ALIGNED(width, 16)) {
|
||||
I420ToARGBRow = I420ToARGBRow_NEON;
|
||||
}
|
||||
}
|
||||
#elif defined(HAS_I420TOARGBROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) {
|
||||
I420ToARGBRow = I420ToARGBRow_Any_SSSE3;
|
||||
if (IS_ALIGNED(width, 8) &&
|
||||
IS_ALIGNED(dst_argb, 16) && IS_ALIGNED(dst_stride_argb, 16)) {
|
||||
I420ToARGBRow = I420ToARGBRow_SSSE3;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
SIMD_ALIGNED(uint8 rowy[kMaxStride]);
|
||||
SIMD_ALIGNED(uint8 rowu[kMaxStride]);
|
||||
SIMD_ALIGNED(uint8 rowv[kMaxStride]);
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
YUY2ToUVRow(src_yuy2, src_stride_yuy2, rowu, rowv, width);
|
||||
YUY2ToYRow(src_yuy2, rowy, width);
|
||||
I420ToARGBRow(rowy, rowu, rowv, dst_argb, width);
|
||||
src_yuy2 += src_stride_yuy2;
|
||||
dst_argb += dst_stride_argb;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Convert NV12 to RGB565.
|
||||
int NV12ToRGB565(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_uv, int src_stride_uv,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user