mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-06 16:56:55 +08:00
Reorder functions for consistency when doing RGB functions. Order should now be ARGB, BGRA, ABGR, RGB24, RAW, RGB565, ARGB1555, ARGB4444
BUG=none TEST=none Review URL: https://webrtc-codereview.appspot.com/352013 git-svn-id: http://libyuv.googlecode.com/svn/trunk@136 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
44477b260a
commit
ecb3f4cc4e
@ -1,6 +1,6 @@
|
|||||||
Name: libyuv
|
Name: libyuv
|
||||||
URL: http://code.google.com/p/libyuv/
|
URL: http://code.google.com/p/libyuv/
|
||||||
Version: 135
|
Version: 136
|
||||||
License: BSD
|
License: BSD
|
||||||
License File: LICENSE
|
License File: LICENSE
|
||||||
|
|
||||||
|
|||||||
@ -1621,63 +1621,88 @@ int I420ToABGR(const uint8* src_y, int src_stride_y,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert NV12 to RGB565.
|
// Convert I420 to RGB24.
|
||||||
int NV12ToRGB565(const uint8* src_y, int src_stride_y,
|
int I420ToRGB24(const uint8* src_y, int src_stride_y,
|
||||||
const uint8* src_uv, int src_stride_uv,
|
const uint8* src_u, int src_stride_u,
|
||||||
uint8* dst_rgb, int dst_stride_rgb,
|
const uint8* src_v, int src_stride_v,
|
||||||
|
uint8* dst_argb, int dst_stride_argb,
|
||||||
int width, int height) {
|
int width, int height) {
|
||||||
// Negative height means invert the image.
|
// Negative height means invert the image.
|
||||||
if (height < 0) {
|
if (height < 0) {
|
||||||
height = -height;
|
height = -height;
|
||||||
dst_rgb = dst_rgb + (height - 1) * dst_stride_rgb;
|
dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
||||||
dst_stride_rgb = -dst_stride_rgb;
|
dst_stride_argb = -dst_stride_argb;
|
||||||
}
|
}
|
||||||
void (*FastConvertYUVToRGB565Row)(const uint8* y_buf,
|
void (*FastConvertYUVToRGB24Row)(const uint8* y_buf,
|
||||||
const uint8* u_buf,
|
const uint8* u_buf,
|
||||||
const uint8* v_buf,
|
const uint8* v_buf,
|
||||||
uint8* rgb_buf,
|
uint8* rgb_buf,
|
||||||
int width);
|
int width);
|
||||||
#if defined(HAS_FASTCONVERTYUVTORGB565ROW_NEON)
|
#if defined(HAS_FASTCONVERTYUVTORGB24ROW_NEON)
|
||||||
if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 16)) {
|
if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 16)) {
|
||||||
FastConvertYUVToRGB565Row = FastConvertYUVToRGB565Row_NEON;
|
FastConvertYUVToRGB24Row = FastConvertYUVToRGB24Row_NEON;
|
||||||
} else
|
} else
|
||||||
#elif defined(HAS_FASTCONVERTYUVTORGB565ROW_SSSE3)
|
#elif defined(HAS_FASTCONVERTYUVTORGB24ROW_SSSE3)
|
||||||
if (TestCpuFlag(kCpuHasSSSE3) &&
|
if (TestCpuFlag(kCpuHasSSSE3) &&
|
||||||
IS_ALIGNED(width, 8) &&
|
IS_ALIGNED(width, 8) &&
|
||||||
IS_ALIGNED(dst_rgb, 16) && IS_ALIGNED(dst_stride_rgb, 16)) {
|
IS_ALIGNED(dst_argb, 16) && IS_ALIGNED(dst_stride_argb, 16)) {
|
||||||
FastConvertYUVToRGB565Row = FastConvertYUVToRGB565Row_SSSE3;
|
FastConvertYUVToRGB24Row = FastConvertYUVToRGB24Row_SSSE3;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
FastConvertYUVToRGB565Row = FastConvertYUVToRGB565Row_C;
|
FastConvertYUVToRGB24Row = FastConvertYUVToRGB24Row_C;
|
||||||
}
|
}
|
||||||
int halfwidth = (width + 1) >> 1;
|
|
||||||
void (*SplitUV)(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix);
|
|
||||||
#if defined(HAS_SPLITUV_NEON)
|
|
||||||
if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(halfwidth, 16)) {
|
|
||||||
SplitUV = SplitUV_NEON;
|
|
||||||
} else
|
|
||||||
#elif defined(HAS_SPLITUV_SSE2)
|
|
||||||
if (TestCpuFlag(kCpuHasSSE2) &&
|
|
||||||
IS_ALIGNED(halfwidth, 16) &&
|
|
||||||
IS_ALIGNED(src_uv, 16) && IS_ALIGNED(src_stride_uv, 16)) {
|
|
||||||
SplitUV = SplitUV_SSE2;
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
SplitUV = SplitUV_C;
|
|
||||||
}
|
|
||||||
SIMD_ALIGNED(uint8 row[kMaxStride * 2]);
|
|
||||||
|
|
||||||
for (int y = 0; y < height; ++y) {
|
for (int y = 0; y < height; ++y) {
|
||||||
if ((y & 1) == 0) {
|
FastConvertYUVToRGB24Row(src_y, src_u, src_v, dst_argb, width);
|
||||||
// Copy a row of UV.
|
dst_argb += dst_stride_argb;
|
||||||
SplitUV(src_uv, row, row + kMaxStride, halfwidth);
|
|
||||||
src_uv += src_stride_uv;
|
|
||||||
}
|
|
||||||
FastConvertYUVToRGB565Row(src_y, row, row + kMaxStride, dst_rgb, width);
|
|
||||||
dst_rgb += dst_stride_rgb;
|
|
||||||
src_y += src_stride_y;
|
src_y += src_stride_y;
|
||||||
|
if (y & 1) {
|
||||||
|
src_u += src_stride_u;
|
||||||
|
src_v += src_stride_v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert I420 to RAW.
|
||||||
|
int I420ToRAW(const uint8* src_y, int src_stride_y,
|
||||||
|
const uint8* src_u, int src_stride_u,
|
||||||
|
const uint8* src_v, int src_stride_v,
|
||||||
|
uint8* dst_argb, int dst_stride_argb,
|
||||||
|
int width, int height) {
|
||||||
|
// Negative height means invert the image.
|
||||||
|
if (height < 0) {
|
||||||
|
height = -height;
|
||||||
|
dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
||||||
|
dst_stride_argb = -dst_stride_argb;
|
||||||
|
}
|
||||||
|
void (*FastConvertYUVToRAWRow)(const uint8* y_buf,
|
||||||
|
const uint8* u_buf,
|
||||||
|
const uint8* v_buf,
|
||||||
|
uint8* rgb_buf,
|
||||||
|
int width);
|
||||||
|
#if defined(HAS_FASTCONVERTYUVTORAWROW_NEON)
|
||||||
|
if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 16)) {
|
||||||
|
FastConvertYUVToRAWRow = FastConvertYUVToRAWRow_NEON;
|
||||||
|
} else
|
||||||
|
#elif defined(HAS_FASTCONVERTYUVTORAWROW_SSSE3)
|
||||||
|
if (TestCpuFlag(kCpuHasSSSE3) &&
|
||||||
|
IS_ALIGNED(width, 8) &&
|
||||||
|
IS_ALIGNED(dst_argb, 16) && IS_ALIGNED(dst_stride_argb, 16)) {
|
||||||
|
FastConvertYUVToRAWRow = FastConvertYUVToRAWRow_SSSE3;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
FastConvertYUVToRAWRow = FastConvertYUVToRAWRow_C;
|
||||||
|
}
|
||||||
|
for (int y = 0; y < height; ++y) {
|
||||||
|
FastConvertYUVToRAWRow(src_y, src_u, src_v, dst_argb, width);
|
||||||
|
dst_argb += dst_stride_argb;
|
||||||
|
src_y += src_stride_y;
|
||||||
|
if (y & 1) {
|
||||||
|
src_u += src_stride_u;
|
||||||
|
src_v += src_stride_v;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1809,90 +1834,6 @@ int I420ToARGB4444(const uint8* src_y, int src_stride_y,
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// Convert I420 to RGB24.
|
|
||||||
int I420ToRGB24(const uint8* src_y, int src_stride_y,
|
|
||||||
const uint8* src_u, int src_stride_u,
|
|
||||||
const uint8* src_v, int src_stride_v,
|
|
||||||
uint8* dst_argb, int dst_stride_argb,
|
|
||||||
int width, int height) {
|
|
||||||
// Negative height means invert the image.
|
|
||||||
if (height < 0) {
|
|
||||||
height = -height;
|
|
||||||
dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
|
||||||
dst_stride_argb = -dst_stride_argb;
|
|
||||||
}
|
|
||||||
void (*FastConvertYUVToRGB24Row)(const uint8* y_buf,
|
|
||||||
const uint8* u_buf,
|
|
||||||
const uint8* v_buf,
|
|
||||||
uint8* rgb_buf,
|
|
||||||
int width);
|
|
||||||
#if defined(HAS_FASTCONVERTYUVTORGB24ROW_NEON)
|
|
||||||
if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 16)) {
|
|
||||||
FastConvertYUVToRGB24Row = FastConvertYUVToRGB24Row_NEON;
|
|
||||||
} else
|
|
||||||
#elif defined(HAS_FASTCONVERTYUVTORGB24ROW_SSSE3)
|
|
||||||
if (TestCpuFlag(kCpuHasSSSE3) &&
|
|
||||||
IS_ALIGNED(width, 8) &&
|
|
||||||
IS_ALIGNED(dst_argb, 16) && IS_ALIGNED(dst_stride_argb, 16)) {
|
|
||||||
FastConvertYUVToRGB24Row = FastConvertYUVToRGB24Row_SSSE3;
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
FastConvertYUVToRGB24Row = FastConvertYUVToRGB24Row_C;
|
|
||||||
}
|
|
||||||
for (int y = 0; y < height; ++y) {
|
|
||||||
FastConvertYUVToRGB24Row(src_y, src_u, src_v, dst_argb, width);
|
|
||||||
dst_argb += dst_stride_argb;
|
|
||||||
src_y += src_stride_y;
|
|
||||||
if (y & 1) {
|
|
||||||
src_u += src_stride_u;
|
|
||||||
src_v += src_stride_v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
// Convert I420 to RAW.
|
|
||||||
int I420ToRAW(const uint8* src_y, int src_stride_y,
|
|
||||||
const uint8* src_u, int src_stride_u,
|
|
||||||
const uint8* src_v, int src_stride_v,
|
|
||||||
uint8* dst_argb, int dst_stride_argb,
|
|
||||||
int width, int height) {
|
|
||||||
// Negative height means invert the image.
|
|
||||||
if (height < 0) {
|
|
||||||
height = -height;
|
|
||||||
dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
|
||||||
dst_stride_argb = -dst_stride_argb;
|
|
||||||
}
|
|
||||||
void (*FastConvertYUVToRAWRow)(const uint8* y_buf,
|
|
||||||
const uint8* u_buf,
|
|
||||||
const uint8* v_buf,
|
|
||||||
uint8* rgb_buf,
|
|
||||||
int width);
|
|
||||||
#if defined(HAS_FASTCONVERTYUVTORAWROW_NEON)
|
|
||||||
if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 16)) {
|
|
||||||
FastConvertYUVToRAWRow = FastConvertYUVToRAWRow_NEON;
|
|
||||||
} else
|
|
||||||
#elif defined(HAS_FASTCONVERTYUVTORAWROW_SSSE3)
|
|
||||||
if (TestCpuFlag(kCpuHasSSSE3) &&
|
|
||||||
IS_ALIGNED(width, 8) &&
|
|
||||||
IS_ALIGNED(dst_argb, 16) && IS_ALIGNED(dst_stride_argb, 16)) {
|
|
||||||
FastConvertYUVToRAWRow = FastConvertYUVToRAWRow_SSSE3;
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
FastConvertYUVToRAWRow = FastConvertYUVToRAWRow_C;
|
|
||||||
}
|
|
||||||
for (int y = 0; y < height; ++y) {
|
|
||||||
FastConvertYUVToRAWRow(src_y, src_u, src_v, dst_argb, width);
|
|
||||||
dst_argb += dst_stride_argb;
|
|
||||||
src_y += src_stride_y;
|
|
||||||
if (y & 1) {
|
|
||||||
src_u += src_stride_u;
|
|
||||||
src_v += src_stride_v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert I422 to ARGB.
|
// Convert I422 to ARGB.
|
||||||
int I422ToARGB(const uint8* src_y, int src_stride_y,
|
int I422ToARGB(const uint8* src_y, int src_stride_y,
|
||||||
@ -2179,6 +2120,67 @@ int BG24ToARGB(const uint8* src_rgb24, int src_stride_rgb24,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Convert NV12 to RGB565.
|
||||||
|
int NV12ToRGB565(const uint8* src_y, int src_stride_y,
|
||||||
|
const uint8* src_uv, int src_stride_uv,
|
||||||
|
uint8* dst_rgb, int dst_stride_rgb,
|
||||||
|
int width, int height) {
|
||||||
|
// Negative height means invert the image.
|
||||||
|
if (height < 0) {
|
||||||
|
height = -height;
|
||||||
|
dst_rgb = dst_rgb + (height - 1) * dst_stride_rgb;
|
||||||
|
dst_stride_rgb = -dst_stride_rgb;
|
||||||
|
}
|
||||||
|
void (*FastConvertYUVToRGB565Row)(const uint8* y_buf,
|
||||||
|
const uint8* u_buf,
|
||||||
|
const uint8* v_buf,
|
||||||
|
uint8* rgb_buf,
|
||||||
|
int width);
|
||||||
|
#if defined(HAS_FASTCONVERTYUVTORGB565ROW_NEON)
|
||||||
|
if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 16)) {
|
||||||
|
FastConvertYUVToRGB565Row = FastConvertYUVToRGB565Row_NEON;
|
||||||
|
} else
|
||||||
|
#elif defined(HAS_FASTCONVERTYUVTORGB565ROW_SSSE3)
|
||||||
|
if (TestCpuFlag(kCpuHasSSSE3) &&
|
||||||
|
IS_ALIGNED(width, 8) &&
|
||||||
|
IS_ALIGNED(dst_rgb, 16) && IS_ALIGNED(dst_stride_rgb, 16)) {
|
||||||
|
FastConvertYUVToRGB565Row = FastConvertYUVToRGB565Row_SSSE3;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
FastConvertYUVToRGB565Row = FastConvertYUVToRGB565Row_C;
|
||||||
|
}
|
||||||
|
int halfwidth = (width + 1) >> 1;
|
||||||
|
void (*SplitUV)(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix);
|
||||||
|
#if defined(HAS_SPLITUV_NEON)
|
||||||
|
if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(halfwidth, 16)) {
|
||||||
|
SplitUV = SplitUV_NEON;
|
||||||
|
} else
|
||||||
|
#elif defined(HAS_SPLITUV_SSE2)
|
||||||
|
if (TestCpuFlag(kCpuHasSSE2) &&
|
||||||
|
IS_ALIGNED(halfwidth, 16) &&
|
||||||
|
IS_ALIGNED(src_uv, 16) && IS_ALIGNED(src_stride_uv, 16)) {
|
||||||
|
SplitUV = SplitUV_SSE2;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
SplitUV = SplitUV_C;
|
||||||
|
}
|
||||||
|
SIMD_ALIGNED(uint8 row[kMaxStride * 2]);
|
||||||
|
|
||||||
|
for (int y = 0; y < height; ++y) {
|
||||||
|
if ((y & 1) == 0) {
|
||||||
|
// Copy a row of UV.
|
||||||
|
SplitUV(src_uv, row, row + kMaxStride, halfwidth);
|
||||||
|
src_uv += src_stride_uv;
|
||||||
|
}
|
||||||
|
FastConvertYUVToRGB565Row(src_y, row, row + kMaxStride, dst_rgb, width);
|
||||||
|
dst_rgb += dst_stride_rgb;
|
||||||
|
src_y += src_stride_y;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// SetRow8 writes 'count' bytes using a 32 bit value repeated
|
// SetRow8 writes 'count' bytes using a 32 bit value repeated
|
||||||
// SetRow32 writes 'count' words using a 32 bit value repeated
|
// SetRow32 writes 'count' words using a 32 bit value repeated
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user