Commit 20005e64 authored by fbarchard@google.com's avatar fbarchard@google.com

fix convertToI420 rowbytes and add assembly calls

BUG=none
TEST=camtool
Review URL: http://webrtc-codereview.appspot.com/343008

git-svn-id: http://libyuv.googlecode.com/svn/trunk@130 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 17272be5
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 129
Version: 130
License: BSD
License File: LICENSE
......
......@@ -1293,24 +1293,36 @@ int ConvertToI420(const uint8* sample, size_t sample_size,
dst_width, inv_dst_height);
break;
case FOURCC_RGBP:
src = sample + (src_width * crop_y + crop_x) * 4;
RGB565ToI420(src, src_width * 4,
src = sample + (src_width * crop_y + crop_x) * 2;
RGB565ToI420(src, src_width * 2,
y, y_stride,
u, u_stride,
v, v_stride,
dst_width, inv_dst_height);
break;
// V4L2_PIX_FMT_RGB555 'RGBO'
// Byte 0 Byte 1
// Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
// g2 g1 g0 b4 b3 b2 b1 b0 a r4 r3 r2 r1 r0 g4 g3
// Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
// a r4 r3 r2 r1 r0 g4 g3 g2 g1 g0 b4 b3 b2 b1 b0
case FOURCC_RGBO:
src = sample + (src_width * crop_y + crop_x) * 4;
ARGB1555ToI420(src, src_width * 4,
src = sample + (src_width * crop_y + crop_x) * 2;
ARGB1555ToI420(src, src_width * 2,
y, y_stride,
u, u_stride,
v, v_stride,
dst_width, inv_dst_height);
break;
// V4L2_PIX_FMT_RGB444 'R444'
// Byte 0 Byte 1
// Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
// g3 g2 g1 g0 b3 b2 b1 b0 a3 a2 a1 a0 r3 r2 r1 r0
// Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
// a3 a2 a1 a0 r3 r2 r1 r0 g3 g2 g1 g0 b3 b2 b1 b0
case FOURCC_R444:
src = sample + (src_width * crop_y + crop_x) * 4;
ARGB4444ToI420(src, src_width * 4,
src = sample + (src_width * crop_y + crop_x) * 2;
ARGB4444ToI420(src, src_width * 2,
y, y_stride,
u, u_stride,
v, v_stride,
......
......@@ -53,6 +53,11 @@
#define HAS_REVERSE_ROW_SSE2
#endif
// The following are available on Windows platforms
#if defined(_M_IX86) && !defined(YUV_DISABLE_ASM)
#define HAS_ARGB4444TOARGBROW_SSE2
#endif
// The following are available on Neon platforms
#if defined(__ARM_NEON__) && !defined(YUV_DISABLE_ASM)
#define HAS_REVERSE_ROW_NEON
......@@ -166,7 +171,9 @@ void RAWToARGBRow_SSSE3(const uint8* src_bg24, uint8* dst_argb, int pix);
// TODO(fbarchard): SSE2 565 etc
//void RGB565ToARGBRow_SSE2(const uint8* src_rgb, uint8* dst_argb, int pix);
//void ARGB1555ToARGBRow_SSE2(const uint8* src_argb, uint8* dst_argb, int pix);
//void ARGB4444ToARGBRow_SSE2(const uint8* src_argb, uint8* dst_argb, int pix);
#endif
#ifdef HAS_ARGB4444TOARGBROW_SSE2
void ARGB4444ToARGBRow_SSE2(const uint8* src_argb, uint8* dst_argb, int pix);
#endif
void ABGRToARGBRow_C(const uint8* src_abgr, uint8* dst_argb, int pix);
void BGRAToARGBRow_C(const uint8* src_bgra, uint8* dst_argb, int pix);
......
......@@ -108,10 +108,10 @@ void ARGB1555ToARGBRow_C(const uint8* src_rgb, uint8* dst_argb, int pix) {
void ARGB4444ToARGBRow_C(const uint8* src_rgb, uint8* dst_argb, int pix) {
for (int x = 0; x < pix; ++x) {
uint8 b = src_rgb[0] & 0x1f;
uint8 g = src_rgb[0] >> 4;
uint8 r = src_rgb[1] & 0x1f;
uint8 a = src_rgb[1] >> 4;
uint8 r = src_rgb[1] & 0x0f;
uint8 g = src_rgb[0] >> 4;
uint8 b = src_rgb[0] & 0x0f;
dst_argb[0] = (b << 4) | b;
dst_argb[1] = (g << 4) | g;
dst_argb[2] = (r << 4) | r;
......@@ -270,7 +270,11 @@ void ARGB1555ToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix) {
void ARGB4444ToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix) {
SIMD_ALIGNED(uint8 row[kMaxStride]);
#ifdef HAS_ARGB4444TOARGBROW_SSE2
ARGB4444ToARGBRow_SSE2(src_argb, row, pix);
#else
ARGB4444ToARGBRow_C(src_argb, row, pix);
#endif
ARGBToYRow_SSSE3(row, dst_y, pix);
}
#endif
......@@ -313,8 +317,13 @@ void ARGB1555ToUVRow_SSSE3(const uint8* src_argb, int src_stride_argb,
void ARGB4444ToUVRow_SSSE3(const uint8* src_argb, int src_stride_argb,
uint8* dst_u, uint8* dst_v, int pix) {
SIMD_ALIGNED(uint8 row[kMaxStride * 2]);
#ifdef HAS_ARGB4444TOARGBROW_SSE2
ARGB4444ToARGBRow_SSE2(src_argb, row, pix);
ARGB4444ToARGBRow_SSE2(src_argb + src_stride_argb, row + kMaxStride, pix);
#else
ARGB4444ToARGBRow_C(src_argb, row, pix);
ARGB4444ToARGBRow_C(src_argb + src_stride_argb, row + kMaxStride, pix);
#endif
ARGBToUVRow_SSSE3(row, kMaxStride, dst_u, dst_v, pix);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment