mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-07 17:26:49 +08:00
remove wrapper functions that call 2 row functions internally
BUG=none TEST=still builds/runs Review URL: https://webrtc-codereview.appspot.com/350016 git-svn-id: http://libyuv.googlecode.com/svn/trunk@139 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
9eefb2e8dd
commit
8af21a57f5
@ -21,11 +21,16 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
// Convert I420 to specified format
|
||||
// TODO(fbarchard): sample_size should be used to ensure the low levels do
|
||||
// not read outside the buffer provided. It is measured in bytes and is the
|
||||
// size of the frame. With MJPEG it is the compressed size of the frame.
|
||||
// dst_sample_stride is bytes in a row for the destination. Pass 0 if the
|
||||
// buffer has contiguous rows. Can be negative. A multiple of 16 is optimal.
|
||||
int ConvertFromI420Stride(const uint8* y, int y_stride,
|
||||
const uint8* u, int u_stride,
|
||||
const uint8* v, int v_stride,
|
||||
uint8* dst_sample, size_t dst_sample_stride,
|
||||
size_t dst_sample_size,
|
||||
size_t /*dst_sample_size*/,
|
||||
int width, int height,
|
||||
uint32 format) {
|
||||
|
||||
@ -208,10 +213,6 @@ int ConvertFromI420Stride(const uint8* y, int y_stride,
|
||||
}
|
||||
|
||||
// Convert I420 to specified format.
|
||||
// TODO(fbarchard): sample_size should be used to ensure the low levels do
|
||||
// not read outside the buffer provided. It is measured in bytes and is the
|
||||
// size of the frame. With MJPEG it is the compressed size of the frame.
|
||||
// TODO(fbarchard): add I400, I444 and RAW support.
|
||||
int ConvertFromI420(const uint8* y, int y_stride,
|
||||
const uint8* u, int u_stride,
|
||||
const uint8* v, int v_stride,
|
||||
|
||||
107
source/row.h
107
source/row.h
@ -27,22 +27,12 @@
|
||||
#define HAS_BGRATOARGBROW_SSSE3
|
||||
#define HAS_RGB24TOARGBROW_SSSE3
|
||||
#define HAS_RAWTOARGBROW_SSSE3
|
||||
#define HAS_RGB24TOYROW_SSSE3
|
||||
#define HAS_RAWTOYROW_SSSE3
|
||||
#define HAS_RGB24TOUVROW_SSSE3
|
||||
#define HAS_RAWTOUVROW_SSSE3
|
||||
#define HAS_ARGBTOYROW_SSSE3
|
||||
#define HAS_BGRATOYROW_SSSE3
|
||||
#define HAS_ABGRTOYROW_SSSE3
|
||||
#define HAS_ARGBTOUVROW_SSSE3
|
||||
#define HAS_BGRATOUVROW_SSSE3
|
||||
#define HAS_ABGRTOUVROW_SSSE3
|
||||
#define HAS_RGB565TOYROW_SSSE3
|
||||
#define HAS_ARGB1555TOYROW_SSSE3
|
||||
#define HAS_ARGB4444TOYROW_SSSE3
|
||||
#define HAS_RGB565TOUVROW_SSSE3
|
||||
#define HAS_ARGB1555TOUVROW_SSSE3
|
||||
#define HAS_ARGB4444TOUVROW_SSSE3
|
||||
#define HAS_I400TOARGBROW_SSE2
|
||||
#define HAS_FASTCONVERTYTOARGBROW_SSE2
|
||||
#define HAS_FASTCONVERTYUVTOARGBROW_SSSE3
|
||||
@ -152,22 +142,6 @@ void BGRAToUVRow_SSSE3(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width);
|
||||
void ABGRToUVRow_SSSE3(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width);
|
||||
void RGB24ToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
|
||||
void RAWToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
|
||||
void RGB565ToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
|
||||
void ARGB1555ToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
|
||||
void ARGB4444ToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
|
||||
|
||||
void RGB24ToUVRow_SSSE3(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width);
|
||||
void RAWToUVRow_SSSE3(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width);
|
||||
void RGB565ToUVRow_SSSE3(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width);
|
||||
void ARGB1555ToUVRow_SSSE3(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width);
|
||||
void ARGB4444ToUVRow_SSSE3(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width);
|
||||
|
||||
void ReverseRow_SSSE3(const uint8* src, uint8* dst, int width);
|
||||
void ReverseRow_SSE2(const uint8* src, uint8* dst, int width);
|
||||
@ -177,11 +151,6 @@ void ReverseRow_C(const uint8* src, uint8* dst, int width);
|
||||
void ARGBToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
|
||||
void BGRAToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
|
||||
void ABGRToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
|
||||
void RGB24ToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
|
||||
void RAWToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
|
||||
void RGB565ToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
|
||||
void ARGB1555ToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
|
||||
void ARGB4444ToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
|
||||
|
||||
void ARGBToUVRow_C(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width);
|
||||
@ -189,16 +158,6 @@ void BGRAToUVRow_C(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width);
|
||||
void ABGRToUVRow_C(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width);
|
||||
void RGB24ToUVRow_C(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width);
|
||||
void RAWToUVRow_C(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width);
|
||||
void RGB565ToUVRow_C(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width);
|
||||
void ARGB1555ToUVRow_C(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width);
|
||||
void ARGB4444ToUVRow_C(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width);
|
||||
|
||||
void ABGRToARGBRow_SSSE3(const uint8* src_abgr, uint8* dst_argb, int pix);
|
||||
void BGRAToARGBRow_SSSE3(const uint8* src_bgra, uint8* dst_argb, int pix);
|
||||
@ -251,36 +210,6 @@ void FastConvertYUVToABGRRow_C(const uint8* y_buf,
|
||||
uint8* rgb_buf,
|
||||
int width);
|
||||
|
||||
void FastConvertYUVToRGB565Row_C(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width);
|
||||
|
||||
void FastConvertYUVToARGB1555Row_C(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width);
|
||||
|
||||
void FastConvertYUVToARGB4444Row_C(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width);
|
||||
|
||||
void FastConvertYUVToRGB24Row_C(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width);
|
||||
|
||||
void FastConvertYUVToRAWRow_C(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width);
|
||||
|
||||
void FastConvertYUV444ToARGBRow_C(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
@ -297,12 +226,6 @@ void FastConvertYUVToARGBRow_SSE2(const uint8* y_buf,
|
||||
uint8* rgb_buf,
|
||||
int width);
|
||||
|
||||
void FastConvertYUVToARGBRow4_SSE2(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width);
|
||||
|
||||
void FastConvertYUVToBGRARow_SSE2(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
@ -349,36 +272,6 @@ void FastConvertYUV444ToARGBRow_SSSE3(const uint8* y_buf,
|
||||
uint8* rgb_buf,
|
||||
int width);
|
||||
|
||||
void FastConvertYUVToRGB565Row_SSSE3(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width);
|
||||
|
||||
void FastConvertYUVToARGB1555Row_SSSE3(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width);
|
||||
|
||||
void FastConvertYUVToARGB4444Row_SSSE3(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width);
|
||||
|
||||
void FastConvertYUVToRGB24Row_SSSE3(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width);
|
||||
|
||||
void FastConvertYUVToRAWRow_SSSE3(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width);
|
||||
|
||||
void FastConvertYToARGBRow_SSE2(const uint8* y_buf,
|
||||
uint8* rgb_buf,
|
||||
int width);
|
||||
|
||||
@ -49,20 +49,6 @@ void BGRAToARGBRow_C(const uint8* src_bgra, uint8* dst_argb, int pix) {
|
||||
}
|
||||
}
|
||||
|
||||
void RAWToARGBRow_C(const uint8* src_raw, uint8* dst_argb, int pix) {
|
||||
for (int x = 0; x < pix; ++x) {
|
||||
uint8 r = src_raw[0];
|
||||
uint8 g = src_raw[1];
|
||||
uint8 b = src_raw[2];
|
||||
dst_argb[0] = b;
|
||||
dst_argb[1] = g;
|
||||
dst_argb[2] = r;
|
||||
dst_argb[3] = 255u;
|
||||
dst_argb += 4;
|
||||
src_raw += 3;
|
||||
}
|
||||
}
|
||||
|
||||
void RGB24ToARGBRow_C(const uint8* src_rgb24, uint8* dst_argb, int pix) {
|
||||
for (int x = 0; x < pix; ++x) {
|
||||
uint8 b = src_rgb24[0];
|
||||
@ -77,6 +63,20 @@ void RGB24ToARGBRow_C(const uint8* src_rgb24, uint8* dst_argb, int pix) {
|
||||
}
|
||||
}
|
||||
|
||||
void RAWToARGBRow_C(const uint8* src_raw, uint8* dst_argb, int pix) {
|
||||
for (int x = 0; x < pix; ++x) {
|
||||
uint8 r = src_raw[0];
|
||||
uint8 g = src_raw[1];
|
||||
uint8 b = src_raw[2];
|
||||
dst_argb[0] = b;
|
||||
dst_argb[1] = g;
|
||||
dst_argb[2] = r;
|
||||
dst_argb[3] = 255u;
|
||||
dst_argb += 4;
|
||||
src_raw += 3;
|
||||
}
|
||||
}
|
||||
|
||||
void RGB565ToARGBRow_C(const uint8* src_rgb, uint8* dst_argb, int pix) {
|
||||
for (int x = 0; x < pix; ++x) {
|
||||
uint8 b = src_rgb[0] & 0x1f;
|
||||
@ -183,76 +183,6 @@ void ARGBToARGB4444Row_C(const uint8* src_argb, uint8* dst_rgb, int pix) {
|
||||
}
|
||||
}
|
||||
|
||||
void RGB24ToYRow_C(const uint8* src_argb, uint8* dst_y, int pix) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride]);
|
||||
RGB24ToARGBRow_C(src_argb, row, pix);
|
||||
ARGBToYRow_C(row, dst_y, pix);
|
||||
}
|
||||
|
||||
void RAWToYRow_C(const uint8* src_argb, uint8* dst_y, int pix) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride]);
|
||||
RAWToARGBRow_C(src_argb, row, pix);
|
||||
ARGBToYRow_C(row, dst_y, pix);
|
||||
}
|
||||
|
||||
void RGB565ToYRow_C(const uint8* src_argb, uint8* dst_y, int pix) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride]);
|
||||
RGB565ToARGBRow_C(src_argb, row, pix);
|
||||
ARGBToYRow_C(row, dst_y, pix);
|
||||
}
|
||||
|
||||
void ARGB1555ToYRow_C(const uint8* src_argb, uint8* dst_y, int pix) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride]);
|
||||
ARGB1555ToARGBRow_C(src_argb, row, pix);
|
||||
ARGBToYRow_C(row, dst_y, pix);
|
||||
}
|
||||
|
||||
void ARGB4444ToYRow_C(const uint8* src_argb, uint8* dst_y, int pix) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride]);
|
||||
ARGB4444ToARGBRow_C(src_argb, row, pix);
|
||||
ARGBToYRow_C(row, dst_y, pix);
|
||||
}
|
||||
|
||||
void RGB24ToUVRow_C(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int pix) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride * 2]);
|
||||
RGB24ToARGBRow_C(src_argb, row, pix);
|
||||
RGB24ToARGBRow_C(src_argb + src_stride_argb, row + kMaxStride, pix);
|
||||
ARGBToUVRow_C(row, kMaxStride, dst_u, dst_v, pix);
|
||||
}
|
||||
|
||||
void RAWToUVRow_C(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int pix) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride * 2]);
|
||||
RAWToARGBRow_C(src_argb, row, pix);
|
||||
RAWToARGBRow_C(src_argb + src_stride_argb, row + kMaxStride, pix);
|
||||
ARGBToUVRow_C(row, kMaxStride, dst_u, dst_v, pix);
|
||||
}
|
||||
|
||||
void RGB565ToUVRow_C(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int pix) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride * 2]);
|
||||
RGB565ToARGBRow_C(src_argb, row, pix);
|
||||
RGB565ToARGBRow_C(src_argb + src_stride_argb, row + kMaxStride, pix);
|
||||
ARGBToUVRow_C(row, kMaxStride, dst_u, dst_v, pix);
|
||||
}
|
||||
|
||||
void ARGB1555ToUVRow_C(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int pix) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride * 2]);
|
||||
ARGB1555ToARGBRow_C(src_argb, row, pix);
|
||||
ARGB1555ToARGBRow_C(src_argb + src_stride_argb, row + kMaxStride, pix);
|
||||
ARGBToUVRow_C(row, kMaxStride, dst_u, dst_v, pix);
|
||||
}
|
||||
|
||||
void ARGB4444ToUVRow_C(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int pix) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride * 2]);
|
||||
ARGB4444ToARGBRow_C(src_argb, row, pix);
|
||||
ARGB4444ToARGBRow_C(src_argb + src_stride_argb, row + kMaxStride, pix);
|
||||
ARGBToUVRow_C(row, kMaxStride, dst_u, dst_v, pix);
|
||||
}
|
||||
|
||||
static __inline int RGBToY(uint8 r, uint8 g, uint8 b) {
|
||||
return (( 66 * r + 129 * g + 25 * b + 128) >> 8) + 16;
|
||||
}
|
||||
@ -302,234 +232,6 @@ MAKEROWY(ARGB,2,1,0)
|
||||
MAKEROWY(BGRA,1,2,3)
|
||||
MAKEROWY(ABGR,0,1,2)
|
||||
|
||||
#if defined(HAS_RAWTOYROW_SSSE3)
|
||||
void RGB24ToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride]);
|
||||
RGB24ToARGBRow_SSSE3(src_argb, row, pix);
|
||||
ARGBToYRow_SSSE3(row, dst_y, pix);
|
||||
}
|
||||
|
||||
void RAWToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride]);
|
||||
RAWToARGBRow_SSSE3(src_argb, row, pix);
|
||||
ARGBToYRow_SSSE3(row, dst_y, pix);
|
||||
}
|
||||
|
||||
// TODO(fbarchard): RGB565ToARGBRow_SSE2 for rgb conversion
|
||||
void RGB565ToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride]);
|
||||
#ifdef HAS_RGB565TOARGBROW_SSE2
|
||||
RGB565ToARGBRow_SSE2(src_argb, row, pix);
|
||||
#else
|
||||
RGB565ToARGBRow_C(src_argb, row, pix);
|
||||
#endif
|
||||
ARGBToYRow_SSSE3(row, dst_y, pix);
|
||||
}
|
||||
|
||||
void ARGB1555ToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride]);
|
||||
#ifdef HAS_ARGB1555TOARGBROW_SSE2
|
||||
ARGB1555ToARGBRow_SSE2(src_argb, row, pix);
|
||||
#else
|
||||
ARGB1555ToARGBRow_C(src_argb, row, pix);
|
||||
#endif
|
||||
ARGBToYRow_SSSE3(row, dst_y, 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
|
||||
|
||||
#if defined(HAS_RAWTOUVROW_SSSE3)
|
||||
#if defined(HAS_ARGBTOUVROW_SSSE3)
|
||||
void RGB24ToUVRow_SSSE3(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int pix) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride * 2]);
|
||||
RGB24ToARGBRow_SSSE3(src_argb, row, pix);
|
||||
RGB24ToARGBRow_SSSE3(src_argb + src_stride_argb, row + kMaxStride, pix);
|
||||
ARGBToUVRow_SSSE3(row, kMaxStride, dst_u, dst_v, pix);
|
||||
}
|
||||
|
||||
void RAWToUVRow_SSSE3(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int pix) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride * 2]);
|
||||
RAWToARGBRow_SSSE3(src_argb, row, pix);
|
||||
RAWToARGBRow_SSSE3(src_argb + src_stride_argb, row + kMaxStride, pix);
|
||||
ARGBToUVRow_SSSE3(row, kMaxStride, dst_u, dst_v, pix);
|
||||
}
|
||||
|
||||
// TODO(fbarchard): RGB565ToARGBRow_SSE2 for rgb conversion
|
||||
void RGB565ToUVRow_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_RGB565TOARGBROW_SSE2
|
||||
RGB565ToARGBRow_SSE2(src_argb, row, pix);
|
||||
RGB565ToARGBRow_SSE2(src_argb + src_stride_argb, row + kMaxStride, pix);
|
||||
#else
|
||||
RGB565ToARGBRow_C(src_argb, row, pix);
|
||||
RGB565ToARGBRow_C(src_argb + src_stride_argb, row + kMaxStride, pix);
|
||||
#endif
|
||||
ARGBToUVRow_SSSE3(row, kMaxStride, dst_u, dst_v, pix);
|
||||
}
|
||||
|
||||
void ARGB1555ToUVRow_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_ARGB1555TOARGBROW_SSE2
|
||||
ARGB1555ToARGBRow_SSE2(src_argb, row, pix);
|
||||
ARGB1555ToARGBRow_SSE2(src_argb + src_stride_argb, row + kMaxStride, pix);
|
||||
#else
|
||||
ARGB1555ToARGBRow_C(src_argb, row, pix);
|
||||
ARGB1555ToARGBRow_C(src_argb + src_stride_argb, row + kMaxStride, pix);
|
||||
#endif
|
||||
ARGBToUVRow_SSSE3(row, kMaxStride, dst_u, dst_v, pix);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void RGB24ToUVRow_SSSE3(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int pix) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride * 2]);
|
||||
RGB24ToARGBRow_SSSE3(src_argb, row, pix);
|
||||
RGB24ToARGBRow_SSSE3(src_argb + src_stride_argb, row + kMaxStride, pix);
|
||||
ARGBToUVRow_C(row, kMaxStride, dst_u, dst_v, pix);
|
||||
}
|
||||
|
||||
void RAWToUVRow_SSSE3(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int pix) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride * 2]);
|
||||
RAWToARGBRow_SSSE3(src_argb, row, pix);
|
||||
RAWToARGBRow_SSSE3(src_argb + src_stride_argb, row + kMaxStride, pix);
|
||||
ARGBToUVRow_C(row, kMaxStride, dst_u, dst_v, pix);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAS_FASTCONVERTYUVTOARGBROW_SSSE3
|
||||
// TODO(fbarchard): ARGBToRGB565Row_SSSE3
|
||||
void FastConvertYUVToRGB565Row_SSSE3(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride]);
|
||||
FastConvertYUVToARGBRow_SSSE3(y_buf, u_buf, v_buf, row, width);
|
||||
ARGBToRGB565Row_C(row, rgb_buf, width);
|
||||
}
|
||||
|
||||
void FastConvertYUVToARGB1555Row_SSSE3(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride]);
|
||||
FastConvertYUVToARGBRow_SSSE3(y_buf, u_buf, v_buf, row, width);
|
||||
ARGBToARGB1555Row_C(row, rgb_buf, width);
|
||||
}
|
||||
|
||||
void FastConvertYUVToARGB4444Row_SSSE3(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride]);
|
||||
FastConvertYUVToARGBRow_SSSE3(y_buf, u_buf, v_buf, row, width);
|
||||
ARGBToARGB4444Row_C(row, rgb_buf, width);
|
||||
}
|
||||
|
||||
void FastConvertYUVToRGB24Row_SSSE3(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride]);
|
||||
FastConvertYUVToARGBRow_SSSE3(y_buf, u_buf, v_buf, row, width);
|
||||
ARGBToRGB24Row_C(row, rgb_buf, width);
|
||||
}
|
||||
|
||||
void FastConvertYUVToRAWRow_SSSE3(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride]);
|
||||
FastConvertYUVToARGBRow_SSSE3(y_buf, u_buf, v_buf, row, width);
|
||||
ARGBToRAWRow_C(row, rgb_buf, width);
|
||||
}
|
||||
#endif
|
||||
#ifdef HAS_FASTCONVERTYUVTOARGBROW_NEON
|
||||
// TODO(fbarchard): ARGBToRGB565Row_NEON
|
||||
void FastConvertYUVToRGB565Row_NEON(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride]);
|
||||
FastConvertYUVToARGBRow_NEON(y_buf, u_buf, v_buf, row, width);
|
||||
ARGBToRGB565Row_C(row, rgb_buf, width);
|
||||
}
|
||||
|
||||
void FastConvertYUVToARGB1555Row_NEON(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride]);
|
||||
FastConvertYUVToARGBRow_NEON(y_buf, u_buf, v_buf, row, width);
|
||||
ARGBToARGB1555Row_C(row, rgb_buf, width);
|
||||
}
|
||||
|
||||
void FastConvertYUVToARGB4444Row_NEON(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride]);
|
||||
FastConvertYUVToARGBRow_NEON(y_buf, u_buf, v_buf, row, width);
|
||||
ARGBToARGB4444Row_C(row, rgb_buf, width);
|
||||
}
|
||||
|
||||
void FastConvertYUVToRGB24Row_NEON(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride]);
|
||||
FastConvertYUVToARGBRow_NEON(y_buf, u_buf, v_buf, row, width);
|
||||
ARGBToRGB24Row_C(row, rgb_buf, width);
|
||||
}
|
||||
|
||||
void FastConvertYUVToRAWRow_NEON(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) {
|
||||
SIMD_ALIGNED(uint8 row[kMaxStride]);
|
||||
FastConvertYUVToARGBRow_NEON(y_buf, u_buf, v_buf, row, width);
|
||||
ARGBToRAWRow_C(row, rgb_buf, width);
|
||||
}
|
||||
#endif
|
||||
|
||||
void I400ToARGBRow_C(const uint8* src_y, uint8* dst_argb, int pix) {
|
||||
// Copy a Y to RGB.
|
||||
for (int x = 0; x < pix; ++x) {
|
||||
@ -647,132 +349,6 @@ void FastConvertYUV444ToARGBRow_C(const uint8* y_buf,
|
||||
}
|
||||
}
|
||||
|
||||
static __inline void YuvPixel16(uint8 y, uint8 u, uint8 v, uint8* rgb_buf,
|
||||
int ar, int rr,
|
||||
int gr, int br,
|
||||
int ashift, int rshift,
|
||||
int gshift, int bshift) {
|
||||
int32 y1 = (static_cast<int32>(y) - 16) * YG;
|
||||
uint32 a = 255u >> ar;
|
||||
uint32 b = Clip(static_cast<int32>((u * UB + v * VB) - (BB) + y1) >> 6) >> br;
|
||||
uint32 g = Clip(static_cast<int32>((u * UG + v * VG) - (BG) + y1) >> 6) >> gr;
|
||||
uint32 r = Clip(static_cast<int32>((u * UR + v * VR) - (BR) + y1) >> 6) >> rr;
|
||||
*reinterpret_cast<uint16*>(rgb_buf) = (b << bshift) |
|
||||
(g << gshift) |
|
||||
(r << rshift) |
|
||||
(a << ashift);
|
||||
}
|
||||
|
||||
void FastConvertYUVToRGB565Row_C(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) {
|
||||
for (int x = 0; x < width - 1; x += 2) {
|
||||
YuvPixel16(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0,
|
||||
8, 3, 2, 3, 0, 11, 5, 0);
|
||||
YuvPixel16(y_buf[1], u_buf[0], v_buf[0], rgb_buf + 2,
|
||||
8, 3, 2, 3, 0, 11, 5, 0);
|
||||
y_buf += 2;
|
||||
u_buf += 1;
|
||||
v_buf += 1;
|
||||
rgb_buf += 4; // Advance 2 pixels.
|
||||
}
|
||||
if (width & 1) {
|
||||
YuvPixel16(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0,
|
||||
8, 3, 2, 3, 0, 11, 5, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void FastConvertYUVToARGB1555Row_C(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) {
|
||||
for (int x = 0; x < width - 1; x += 2) {
|
||||
YuvPixel16(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0,
|
||||
7, 3, 3, 3, 15, 10, 5, 0);
|
||||
YuvPixel16(y_buf[1], u_buf[0], v_buf[0], rgb_buf + 2,
|
||||
7, 3, 3, 3, 15, 10, 5, 0);
|
||||
y_buf += 2;
|
||||
u_buf += 1;
|
||||
v_buf += 1;
|
||||
rgb_buf += 4; // Advance 2 pixels.
|
||||
}
|
||||
if (width & 1) {
|
||||
YuvPixel16(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0,
|
||||
7, 3, 3, 3, 15, 10, 5, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void FastConvertYUVToARGB4444Row_C(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) {
|
||||
for (int x = 0; x < width - 1; x += 2) {
|
||||
YuvPixel16(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0,
|
||||
4, 4, 4, 4, 12, 8, 4, 0);
|
||||
YuvPixel16(y_buf[1], u_buf[0], v_buf[0], rgb_buf + 2,
|
||||
4, 4, 4, 4, 12, 8, 4, 0);
|
||||
y_buf += 2;
|
||||
u_buf += 1;
|
||||
v_buf += 1;
|
||||
rgb_buf += 4; // Advance 2 pixels.
|
||||
}
|
||||
if (width & 1) {
|
||||
YuvPixel16(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0,
|
||||
4, 4, 4, 4, 12, 8, 4, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static __inline void YuvPixel24(uint8 y, uint8 u, uint8 v, uint8* rgb_buf,
|
||||
int roffset, int goffset, int boffset) {
|
||||
int32 y1 = (static_cast<int32>(y) - 16) * YG;
|
||||
uint32 b = Clip(static_cast<int32>((u * UB + v * VB) - (BB) + y1) >> 6);
|
||||
uint32 g = Clip(static_cast<int32>((u * UG + v * VG) - (BG) + y1) >> 6);
|
||||
uint32 r = Clip(static_cast<int32>((u * UR + v * VR) - (BR) + y1) >> 6);
|
||||
rgb_buf[boffset] = static_cast<uint8>(b);
|
||||
rgb_buf[goffset] = static_cast<uint8>(g);
|
||||
rgb_buf[roffset] = static_cast<uint8>(r);
|
||||
}
|
||||
|
||||
void FastConvertYUVToRGB24Row_C(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) {
|
||||
for (int x = 0; x < width - 1; x += 2) {
|
||||
YuvPixel24(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 2, 1, 0);
|
||||
YuvPixel24(y_buf[1], u_buf[0], v_buf[0], rgb_buf + 3, 2, 1, 0);
|
||||
y_buf += 2;
|
||||
u_buf += 1;
|
||||
v_buf += 1;
|
||||
rgb_buf += 6; // Advance 2 pixels.
|
||||
}
|
||||
if (width & 1) {
|
||||
YuvPixel24(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 2, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void FastConvertYUVToRAWRow_C(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) {
|
||||
for (int x = 0; x < width - 1; x += 2) {
|
||||
YuvPixel24(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 0, 1, 2);
|
||||
YuvPixel24(y_buf[1], u_buf[0], v_buf[0], rgb_buf + 3, 0, 1, 2);
|
||||
y_buf += 2;
|
||||
u_buf += 1;
|
||||
v_buf += 1;
|
||||
rgb_buf += 6; // Advance 2 pixels.
|
||||
}
|
||||
if (width & 1) {
|
||||
YuvPixel24(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 0, 1, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void FastConvertYToARGBRow_C(const uint8* y_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user