mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-08 01:36:47 +08:00
Port conversion functions to c.
BUG=303 TESTED=cl /c /TC /Iinclude source\convert_from.cc source\convert_argb.cc source\convert_from_argb.cc R=harryjin@google.com Review URL: https://webrtc-codereview.appspot.com/17909004 git-svn-id: http://libyuv.googlecode.com/svn/trunk@1030 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
a2fbf9dee6
commit
8798e04075
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 1029
|
||||
Version: 1030
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
||||
#define INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
#define LIBYUV_VERSION 1029
|
||||
#define LIBYUV_VERSION 1030
|
||||
|
||||
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
||||
|
||||
@ -519,9 +519,9 @@ int YUY2ToI420(const uint8* src_yuy2, int src_stride_yuy2,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*YUY2ToUVRow)(const uint8* src_yuy2, int src_stride_yuy2,
|
||||
uint8* dst_u, uint8* dst_v, int pix) = YUY2ToUVRow_C;
|
||||
uint8* dst_u, uint8* dst_v, int pix) = YUY2ToUVRow_C;
|
||||
void (*YUY2ToYRow)(const uint8* src_yuy2,
|
||||
uint8* dst_y, int pix) = YUY2ToYRow_C;
|
||||
uint8* dst_y, int pix) = YUY2ToYRow_C;
|
||||
// Negative height means invert the image.
|
||||
if (height < 0) {
|
||||
height = -height;
|
||||
@ -592,9 +592,9 @@ int UYVYToI420(const uint8* src_uyvy, int src_stride_uyvy,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*UYVYToUVRow)(const uint8* src_uyvy, int src_stride_uyvy,
|
||||
uint8* dst_u, uint8* dst_v, int pix) = UYVYToUVRow_C;
|
||||
uint8* dst_u, uint8* dst_v, int pix) = UYVYToUVRow_C;
|
||||
void (*UYVYToYRow)(const uint8* src_uyvy,
|
||||
uint8* dst_y, int pix) = UYVYToYRow_C;
|
||||
uint8* dst_y, int pix) = UYVYToYRow_C;
|
||||
// Negative height means invert the image.
|
||||
if (height < 0) {
|
||||
height = -height;
|
||||
@ -665,7 +665,7 @@ int ARGBToI420(const uint8* src_argb, int src_stride_argb,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
if (!src_argb ||
|
||||
@ -745,7 +745,7 @@ int BGRAToI420(const uint8* src_bgra, int src_stride_bgra,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*BGRAToUVRow)(const uint8* src_bgra0, int src_stride_bgra,
|
||||
uint8* dst_u, uint8* dst_v, int width) = BGRAToUVRow_C;
|
||||
uint8* dst_u, uint8* dst_v, int width) = BGRAToUVRow_C;
|
||||
void (*BGRAToYRow)(const uint8* src_bgra, uint8* dst_y, int pix) =
|
||||
BGRAToYRow_C;
|
||||
if (!src_bgra ||
|
||||
@ -814,7 +814,7 @@ int ABGRToI420(const uint8* src_abgr, int src_stride_abgr,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*ABGRToUVRow)(const uint8* src_abgr0, int src_stride_abgr,
|
||||
uint8* dst_u, uint8* dst_v, int width) = ABGRToUVRow_C;
|
||||
uint8* dst_u, uint8* dst_v, int width) = ABGRToUVRow_C;
|
||||
void (*ABGRToYRow)(const uint8* src_abgr, uint8* dst_y, int pix) =
|
||||
ABGRToYRow_C;
|
||||
if (!src_abgr ||
|
||||
@ -883,7 +883,7 @@ int RGBAToI420(const uint8* src_rgba, int src_stride_rgba,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*RGBAToUVRow)(const uint8* src_rgba0, int src_stride_rgba,
|
||||
uint8* dst_u, uint8* dst_v, int width) = RGBAToUVRow_C;
|
||||
uint8* dst_u, uint8* dst_v, int width) = RGBAToUVRow_C;
|
||||
void (*RGBAToYRow)(const uint8* src_rgba, uint8* dst_y, int pix) =
|
||||
RGBAToYRow_C;
|
||||
if (!src_rgba ||
|
||||
@ -960,7 +960,7 @@ int RGB24ToI420(const uint8* src_rgb24, int src_stride_rgb24,
|
||||
void (*RGB24ToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int pix) =
|
||||
RGB24ToARGBRow_C;
|
||||
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
// Allocate 2 rows of ARGB.
|
||||
@ -1072,7 +1072,7 @@ int RAWToI420(const uint8* src_raw, int src_stride_raw,
|
||||
void (*RAWToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int pix) =
|
||||
RAWToARGBRow_C;
|
||||
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
// Allocate 2 rows of ARGB.
|
||||
@ -1184,7 +1184,7 @@ int RGB565ToI420(const uint8* src_rgb565, int src_stride_rgb565,
|
||||
void (*RGB565ToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int pix) =
|
||||
RGB565ToARGBRow_C;
|
||||
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
// Allocate 2 rows of ARGB.
|
||||
@ -1282,10 +1282,10 @@ int RGB565ToI420(const uint8* src_rgb565, int src_stride_rgb565,
|
||||
// Convert ARGB1555 to I420.
|
||||
LIBYUV_API
|
||||
int ARGB1555ToI420(const uint8* src_argb1555, int src_stride_argb1555,
|
||||
uint8* dst_y, int dst_stride_y,
|
||||
uint8* dst_u, int dst_stride_u,
|
||||
uint8* dst_v, int dst_stride_v,
|
||||
int width, int height) {
|
||||
uint8* dst_y, int dst_stride_y,
|
||||
uint8* dst_u, int dst_stride_u,
|
||||
uint8* dst_v, int dst_stride_v,
|
||||
int width, int height) {
|
||||
int y;
|
||||
#if defined(HAS_ARGB1555TOYROW_NEON)
|
||||
void (*ARGB1555ToUVRow)(const uint8* src_argb1555, int src_stride_argb1555,
|
||||
@ -1296,7 +1296,7 @@ int ARGB1555ToI420(const uint8* src_argb1555, int src_stride_argb1555,
|
||||
void (*ARGB1555ToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int pix) =
|
||||
ARGB1555ToARGBRow_C;
|
||||
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
// Allocate 2 rows of ARGB.
|
||||
@ -1396,10 +1396,10 @@ int ARGB1555ToI420(const uint8* src_argb1555, int src_stride_argb1555,
|
||||
// Convert ARGB4444 to I420.
|
||||
LIBYUV_API
|
||||
int ARGB4444ToI420(const uint8* src_argb4444, int src_stride_argb4444,
|
||||
uint8* dst_y, int dst_stride_y,
|
||||
uint8* dst_u, int dst_stride_u,
|
||||
uint8* dst_v, int dst_stride_v,
|
||||
int width, int height) {
|
||||
uint8* dst_y, int dst_stride_y,
|
||||
uint8* dst_u, int dst_stride_u,
|
||||
uint8* dst_v, int dst_stride_v,
|
||||
int width, int height) {
|
||||
int y;
|
||||
#if defined(HAS_ARGB4444TOYROW_NEON)
|
||||
void (*ARGB4444ToUVRow)(const uint8* src_argb4444, int src_stride_argb4444,
|
||||
@ -1410,7 +1410,7 @@ int ARGB4444ToI420(const uint8* src_argb4444, int src_stride_argb4444,
|
||||
void (*ARGB4444ToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int pix) =
|
||||
ARGB4444ToARGBRow_C;
|
||||
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
// Allocate 2 rows of ARGB.
|
||||
|
||||
@ -52,6 +52,12 @@ int I444ToARGB(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_v, int src_stride_v,
|
||||
uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*I444ToARGBRow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I444ToARGBRow_C;
|
||||
if (!src_y || !src_u || !src_v ||
|
||||
!dst_argb ||
|
||||
width <= 0 || height == 0) {
|
||||
@ -72,11 +78,6 @@ int I444ToARGB(const uint8* src_y, int src_stride_y,
|
||||
height = 1;
|
||||
src_stride_y = src_stride_u = src_stride_v = dst_stride_argb = 0;
|
||||
}
|
||||
void (*I444ToARGBRow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I444ToARGBRow_C;
|
||||
#if defined(HAS_I444TOARGBROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) {
|
||||
I444ToARGBRow = I444ToARGBRow_Any_SSSE3;
|
||||
@ -96,7 +97,7 @@ int I444ToARGB(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
I444ToARGBRow(src_y, src_u, src_v, dst_argb, width);
|
||||
dst_argb += dst_stride_argb;
|
||||
src_y += src_stride_y;
|
||||
@ -113,6 +114,12 @@ int I422ToARGB(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_v, int src_stride_v,
|
||||
uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*I422ToARGBRow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToARGBRow_C;
|
||||
if (!src_y || !src_u || !src_v ||
|
||||
!dst_argb ||
|
||||
width <= 0 || height == 0) {
|
||||
@ -133,11 +140,6 @@ int I422ToARGB(const uint8* src_y, int src_stride_y,
|
||||
height = 1;
|
||||
src_stride_y = src_stride_u = src_stride_v = dst_stride_argb = 0;
|
||||
}
|
||||
void (*I422ToARGBRow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToARGBRow_C;
|
||||
#if defined(HAS_I422TOARGBROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) {
|
||||
I422ToARGBRow = I422ToARGBRow_Any_SSSE3;
|
||||
@ -175,7 +177,7 @@ int I422ToARGB(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
I422ToARGBRow(src_y, src_u, src_v, dst_argb, width);
|
||||
dst_argb += dst_stride_argb;
|
||||
src_y += src_stride_y;
|
||||
@ -192,6 +194,12 @@ int I411ToARGB(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_v, int src_stride_v,
|
||||
uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*I411ToARGBRow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I411ToARGBRow_C;
|
||||
if (!src_y || !src_u || !src_v ||
|
||||
!dst_argb ||
|
||||
width <= 0 || height == 0) {
|
||||
@ -212,11 +220,6 @@ int I411ToARGB(const uint8* src_y, int src_stride_y,
|
||||
height = 1;
|
||||
src_stride_y = src_stride_u = src_stride_v = dst_stride_argb = 0;
|
||||
}
|
||||
void (*I411ToARGBRow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I411ToARGBRow_C;
|
||||
#if defined(HAS_I411TOARGBROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) {
|
||||
I411ToARGBRow = I411ToARGBRow_Any_SSSE3;
|
||||
@ -236,7 +239,7 @@ int I411ToARGB(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
I411ToARGBRow(src_y, src_u, src_v, dst_argb, width);
|
||||
dst_argb += dst_stride_argb;
|
||||
src_y += src_stride_y;
|
||||
@ -251,6 +254,10 @@ LIBYUV_API
|
||||
int I400ToARGB_Reference(const uint8* src_y, int src_stride_y,
|
||||
uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*YToARGBRow)(const uint8* y_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = YToARGBRow_C;
|
||||
if (!src_y || !dst_argb ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -268,9 +275,6 @@ int I400ToARGB_Reference(const uint8* src_y, int src_stride_y,
|
||||
height = 1;
|
||||
src_stride_y = dst_stride_argb = 0;
|
||||
}
|
||||
void (*YToARGBRow)(const uint8* y_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = YToARGBRow_C;
|
||||
#if defined(HAS_YTOARGBROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2) && width >= 8 &&
|
||||
IS_ALIGNED(dst_argb, 16) && IS_ALIGNED(dst_stride_argb, 16)) {
|
||||
@ -288,7 +292,7 @@ int I400ToARGB_Reference(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
YToARGBRow(src_y, dst_argb, width);
|
||||
dst_argb += dst_stride_argb;
|
||||
src_y += src_stride_y;
|
||||
@ -301,6 +305,9 @@ LIBYUV_API
|
||||
int I400ToARGB(const uint8* src_y, int src_stride_y,
|
||||
uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*I400ToARGBRow)(const uint8* src_y, uint8* dst_argb, int pix) =
|
||||
I400ToARGBRow_C;
|
||||
if (!src_y || !dst_argb ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -318,8 +325,6 @@ int I400ToARGB(const uint8* src_y, int src_stride_y,
|
||||
height = 1;
|
||||
src_stride_y = dst_stride_argb = 0;
|
||||
}
|
||||
void (*I400ToARGBRow)(const uint8* src_y, uint8* dst_argb, int pix) =
|
||||
I400ToARGBRow_C;
|
||||
#if defined(HAS_I400TOARGBROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2) && width >= 8) {
|
||||
I400ToARGBRow = I400ToARGBRow_Any_SSE2;
|
||||
@ -338,7 +343,7 @@ int I400ToARGB(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
I400ToARGBRow(src_y, dst_argb, width);
|
||||
src_y += src_stride_y;
|
||||
dst_argb += dst_stride_argb;
|
||||
@ -421,6 +426,9 @@ LIBYUV_API
|
||||
int RGB24ToARGB(const uint8* src_rgb24, int src_stride_rgb24,
|
||||
uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*RGB24ToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int pix) =
|
||||
RGB24ToARGBRow_C;
|
||||
if (!src_rgb24 || !dst_argb ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -438,8 +446,6 @@ int RGB24ToARGB(const uint8* src_rgb24, int src_stride_rgb24,
|
||||
height = 1;
|
||||
src_stride_rgb24 = dst_stride_argb = 0;
|
||||
}
|
||||
void (*RGB24ToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int pix) =
|
||||
RGB24ToARGBRow_C;
|
||||
#if defined(HAS_RGB24TOARGBROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16 &&
|
||||
IS_ALIGNED(dst_argb, 16) && IS_ALIGNED(dst_stride_argb, 16)) {
|
||||
@ -457,7 +463,7 @@ int RGB24ToARGB(const uint8* src_rgb24, int src_stride_rgb24,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
RGB24ToARGBRow(src_rgb24, dst_argb, width);
|
||||
src_rgb24 += src_stride_rgb24;
|
||||
dst_argb += dst_stride_argb;
|
||||
@ -470,6 +476,9 @@ LIBYUV_API
|
||||
int RAWToARGB(const uint8* src_raw, int src_stride_raw,
|
||||
uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*RAWToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int pix) =
|
||||
RAWToARGBRow_C;
|
||||
if (!src_raw || !dst_argb ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -487,8 +496,6 @@ int RAWToARGB(const uint8* src_raw, int src_stride_raw,
|
||||
height = 1;
|
||||
src_stride_raw = dst_stride_argb = 0;
|
||||
}
|
||||
void (*RAWToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int pix) =
|
||||
RAWToARGBRow_C;
|
||||
#if defined(HAS_RAWTOARGBROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16 &&
|
||||
IS_ALIGNED(dst_argb, 16) && IS_ALIGNED(dst_stride_argb, 16)) {
|
||||
@ -506,7 +513,7 @@ int RAWToARGB(const uint8* src_raw, int src_stride_raw,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
RAWToARGBRow(src_raw, dst_argb, width);
|
||||
src_raw += src_stride_raw;
|
||||
dst_argb += dst_stride_argb;
|
||||
@ -519,6 +526,9 @@ LIBYUV_API
|
||||
int RGB565ToARGB(const uint8* src_rgb565, int src_stride_rgb565,
|
||||
uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*RGB565ToARGBRow)(const uint8* src_rgb565, uint8* dst_argb, int pix) =
|
||||
RGB565ToARGBRow_C;
|
||||
if (!src_rgb565 || !dst_argb ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -536,8 +546,6 @@ int RGB565ToARGB(const uint8* src_rgb565, int src_stride_rgb565,
|
||||
height = 1;
|
||||
src_stride_rgb565 = dst_stride_argb = 0;
|
||||
}
|
||||
void (*RGB565ToARGBRow)(const uint8* src_rgb565, uint8* dst_argb, int pix) =
|
||||
RGB565ToARGBRow_C;
|
||||
#if defined(HAS_RGB565TOARGBROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2) && width >= 8 &&
|
||||
IS_ALIGNED(dst_argb, 16) && IS_ALIGNED(dst_stride_argb, 16)) {
|
||||
@ -555,7 +563,7 @@ int RGB565ToARGB(const uint8* src_rgb565, int src_stride_rgb565,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
RGB565ToARGBRow(src_rgb565, dst_argb, width);
|
||||
src_rgb565 += src_stride_rgb565;
|
||||
dst_argb += dst_stride_argb;
|
||||
@ -568,6 +576,9 @@ LIBYUV_API
|
||||
int ARGB1555ToARGB(const uint8* src_argb1555, int src_stride_argb1555,
|
||||
uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*ARGB1555ToARGBRow)(const uint8* src_argb1555, uint8* dst_argb,
|
||||
int pix) = ARGB1555ToARGBRow_C;
|
||||
if (!src_argb1555 || !dst_argb ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -585,8 +596,6 @@ int ARGB1555ToARGB(const uint8* src_argb1555, int src_stride_argb1555,
|
||||
height = 1;
|
||||
src_stride_argb1555 = dst_stride_argb = 0;
|
||||
}
|
||||
void (*ARGB1555ToARGBRow)(const uint8* src_argb1555, uint8* dst_argb,
|
||||
int pix) = ARGB1555ToARGBRow_C;
|
||||
#if defined(HAS_ARGB1555TOARGBROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2) && width >= 8 &&
|
||||
IS_ALIGNED(dst_argb, 16) && IS_ALIGNED(dst_stride_argb, 16)) {
|
||||
@ -604,7 +613,7 @@ int ARGB1555ToARGB(const uint8* src_argb1555, int src_stride_argb1555,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
ARGB1555ToARGBRow(src_argb1555, dst_argb, width);
|
||||
src_argb1555 += src_stride_argb1555;
|
||||
dst_argb += dst_stride_argb;
|
||||
@ -617,6 +626,9 @@ LIBYUV_API
|
||||
int ARGB4444ToARGB(const uint8* src_argb4444, int src_stride_argb4444,
|
||||
uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*ARGB4444ToARGBRow)(const uint8* src_argb4444, uint8* dst_argb,
|
||||
int pix) = ARGB4444ToARGBRow_C;
|
||||
if (!src_argb4444 || !dst_argb ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -634,8 +646,6 @@ int ARGB4444ToARGB(const uint8* src_argb4444, int src_stride_argb4444,
|
||||
height = 1;
|
||||
src_stride_argb4444 = dst_stride_argb = 0;
|
||||
}
|
||||
void (*ARGB4444ToARGBRow)(const uint8* src_argb4444, uint8* dst_argb,
|
||||
int pix) = ARGB4444ToARGBRow_C;
|
||||
#if defined(HAS_ARGB4444TOARGBROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2) && width >= 8 &&
|
||||
IS_ALIGNED(dst_argb, 16) && IS_ALIGNED(dst_stride_argb, 16)) {
|
||||
@ -653,7 +663,7 @@ int ARGB4444ToARGB(const uint8* src_argb4444, int src_stride_argb4444,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
ARGB4444ToARGBRow(src_argb4444, dst_argb, width);
|
||||
src_argb4444 += src_stride_argb4444;
|
||||
dst_argb += dst_stride_argb;
|
||||
@ -667,6 +677,11 @@ int NV12ToARGB(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_uv, int src_stride_uv,
|
||||
uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*NV12ToARGBRow)(const uint8* y_buf,
|
||||
const uint8* uv_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = NV12ToARGBRow_C;
|
||||
if (!src_y || !src_uv || !dst_argb ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -677,10 +692,6 @@ int NV12ToARGB(const uint8* src_y, int src_stride_y,
|
||||
dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
||||
dst_stride_argb = -dst_stride_argb;
|
||||
}
|
||||
void (*NV12ToARGBRow)(const uint8* y_buf,
|
||||
const uint8* uv_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = NV12ToARGBRow_C;
|
||||
#if defined(HAS_NV12TOARGBROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) {
|
||||
NV12ToARGBRow = NV12ToARGBRow_Any_SSSE3;
|
||||
@ -700,7 +711,7 @@ int NV12ToARGB(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
NV12ToARGBRow(src_y, src_uv, dst_argb, width);
|
||||
dst_argb += dst_stride_argb;
|
||||
src_y += src_stride_y;
|
||||
@ -717,6 +728,11 @@ int NV21ToARGB(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_uv, int src_stride_uv,
|
||||
uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*NV21ToARGBRow)(const uint8* y_buf,
|
||||
const uint8* uv_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = NV21ToARGBRow_C;
|
||||
if (!src_y || !src_uv || !dst_argb ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -727,10 +743,6 @@ int NV21ToARGB(const uint8* src_y, int src_stride_y,
|
||||
dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
||||
dst_stride_argb = -dst_stride_argb;
|
||||
}
|
||||
void (*NV21ToARGBRow)(const uint8* y_buf,
|
||||
const uint8* uv_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = NV21ToARGBRow_C;
|
||||
#if defined(HAS_NV21TOARGBROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) {
|
||||
NV21ToARGBRow = NV21ToARGBRow_Any_SSSE3;
|
||||
@ -751,7 +763,7 @@ int NV21ToARGB(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
NV21ToARGBRow(src_y, src_uv, dst_argb, width);
|
||||
dst_argb += dst_stride_argb;
|
||||
src_y += src_stride_y;
|
||||
@ -767,6 +779,11 @@ LIBYUV_API
|
||||
int M420ToARGB(const uint8* src_m420, int src_stride_m420,
|
||||
uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*NV12ToARGBRow)(const uint8* y_buf,
|
||||
const uint8* uv_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = NV12ToARGBRow_C;
|
||||
if (!src_m420 || !dst_argb ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -777,10 +794,6 @@ int M420ToARGB(const uint8* src_m420, int src_stride_m420,
|
||||
dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
||||
dst_stride_argb = -dst_stride_argb;
|
||||
}
|
||||
void (*NV12ToARGBRow)(const uint8* y_buf,
|
||||
const uint8* uv_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = NV12ToARGBRow_C;
|
||||
#if defined(HAS_NV12TOARGBROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) {
|
||||
NV12ToARGBRow = NV12ToARGBRow_Any_SSSE3;
|
||||
@ -800,7 +813,7 @@ int M420ToARGB(const uint8* src_m420, int src_stride_m420,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height - 1; y += 2) {
|
||||
for (y = 0; y < height - 1; y += 2) {
|
||||
NV12ToARGBRow(src_m420, src_m420 + src_stride_m420 * 2, dst_argb, width);
|
||||
NV12ToARGBRow(src_m420 + src_stride_m420, src_m420 + src_stride_m420 * 2,
|
||||
dst_argb + dst_stride_argb, width);
|
||||
@ -818,6 +831,9 @@ LIBYUV_API
|
||||
int YUY2ToARGB(const uint8* src_yuy2, int src_stride_yuy2,
|
||||
uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*YUY2ToARGBRow)(const uint8* src_yuy2, uint8* dst_argb, int pix) =
|
||||
YUY2ToARGBRow_C;
|
||||
if (!src_yuy2 || !dst_argb ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -835,8 +851,6 @@ int YUY2ToARGB(const uint8* src_yuy2, int src_stride_yuy2,
|
||||
height = 1;
|
||||
src_stride_yuy2 = dst_stride_argb = 0;
|
||||
}
|
||||
void (*YUY2ToARGBRow)(const uint8* src_yuy2, uint8* dst_argb, int pix) =
|
||||
YUY2ToARGBRow_C;
|
||||
#if defined(HAS_YUY2TOARGBROW_SSSE3)
|
||||
// Posix is 16, Windows is 8.
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16) {
|
||||
@ -857,7 +871,7 @@ int YUY2ToARGB(const uint8* src_yuy2, int src_stride_yuy2,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
YUY2ToARGBRow(src_yuy2, dst_argb, width);
|
||||
src_yuy2 += src_stride_yuy2;
|
||||
dst_argb += dst_stride_argb;
|
||||
@ -870,6 +884,9 @@ LIBYUV_API
|
||||
int UYVYToARGB(const uint8* src_uyvy, int src_stride_uyvy,
|
||||
uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*UYVYToARGBRow)(const uint8* src_uyvy, uint8* dst_argb, int pix) =
|
||||
UYVYToARGBRow_C;
|
||||
if (!src_uyvy || !dst_argb ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -887,8 +904,6 @@ int UYVYToARGB(const uint8* src_uyvy, int src_stride_uyvy,
|
||||
height = 1;
|
||||
src_stride_uyvy = dst_stride_argb = 0;
|
||||
}
|
||||
void (*UYVYToARGBRow)(const uint8* src_uyvy, uint8* dst_argb, int pix) =
|
||||
UYVYToARGBRow_C;
|
||||
#if defined(HAS_UYVYTOARGBROW_SSSE3)
|
||||
// Posix is 16, Windows is 8.
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16) {
|
||||
@ -909,7 +924,7 @@ int UYVYToARGB(const uint8* src_uyvy, int src_stride_uyvy,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
UYVYToARGBRow(src_uyvy, dst_argb, width);
|
||||
src_uyvy += src_stride_uyvy;
|
||||
dst_argb += dst_stride_argb;
|
||||
|
||||
@ -39,14 +39,14 @@ static int I420ToI4xx(const uint8* src_y, int src_stride_y,
|
||||
uint8* dst_v, int dst_stride_v,
|
||||
int src_y_width, int src_y_height,
|
||||
int dst_uv_width, int dst_uv_height) {
|
||||
if (src_y_width == 0 || src_y_height == 0 ||
|
||||
dst_uv_width <= 0 || dst_uv_height <= 0) {
|
||||
return -1;
|
||||
}
|
||||
const int dst_y_width = Abs(src_y_width);
|
||||
const int dst_y_height = Abs(src_y_height);
|
||||
const int src_uv_width = SUBSAMPLE(src_y_width, 1, 1);
|
||||
const int src_uv_height = SUBSAMPLE(src_y_height, 1, 1);
|
||||
if (src_y_width == 0 || src_y_height == 0 ||
|
||||
dst_uv_width <= 0 || dst_uv_height <= 0) {
|
||||
return -1;
|
||||
}
|
||||
ScalePlane(src_y, src_stride_y, src_y_width, src_y_height,
|
||||
dst_y, dst_stride_y, dst_y_width, dst_y_height,
|
||||
kFilterBilinear);
|
||||
@ -150,6 +150,10 @@ int I422ToYUY2(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_v, int src_stride_v,
|
||||
uint8* dst_yuy2, int dst_stride_yuy2,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*I422ToYUY2Row)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_yuy2, int width) =
|
||||
I422ToYUY2Row_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_yuy2 ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -169,9 +173,6 @@ int I422ToYUY2(const uint8* src_y, int src_stride_y,
|
||||
height = 1;
|
||||
src_stride_y = src_stride_u = src_stride_v = dst_stride_yuy2 = 0;
|
||||
}
|
||||
void (*I422ToYUY2Row)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_yuy2, int width) =
|
||||
I422ToYUY2Row_C;
|
||||
#if defined(HAS_I422TOYUY2ROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2) && width >= 16) {
|
||||
I422ToYUY2Row = I422ToYUY2Row_Any_SSE2;
|
||||
@ -188,7 +189,7 @@ int I422ToYUY2(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
I422ToYUY2Row(src_y, src_u, src_v, dst_yuy2, width);
|
||||
src_y += src_stride_y;
|
||||
src_u += src_stride_u;
|
||||
@ -204,6 +205,10 @@ int I420ToYUY2(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_v, int src_stride_v,
|
||||
uint8* dst_yuy2, int dst_stride_yuy2,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*I422ToYUY2Row)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_yuy2, int width) =
|
||||
I422ToYUY2Row_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_yuy2 ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -214,9 +219,6 @@ int I420ToYUY2(const uint8* src_y, int src_stride_y,
|
||||
dst_yuy2 = dst_yuy2 + (height - 1) * dst_stride_yuy2;
|
||||
dst_stride_yuy2 = -dst_stride_yuy2;
|
||||
}
|
||||
void (*I422ToYUY2Row)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_yuy2, int width) =
|
||||
I422ToYUY2Row_C;
|
||||
#if defined(HAS_I422TOYUY2ROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2) && width >= 16) {
|
||||
I422ToYUY2Row = I422ToYUY2Row_Any_SSE2;
|
||||
@ -233,7 +235,7 @@ int I420ToYUY2(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height - 1; y += 2) {
|
||||
for (y = 0; y < height - 1; y += 2) {
|
||||
I422ToYUY2Row(src_y, src_u, src_v, dst_yuy2, width);
|
||||
I422ToYUY2Row(src_y + src_stride_y, src_u, src_v,
|
||||
dst_yuy2 + dst_stride_yuy2, width);
|
||||
@ -254,6 +256,10 @@ int I422ToUYVY(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_v, int src_stride_v,
|
||||
uint8* dst_uyvy, int dst_stride_uyvy,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*I422ToUYVYRow)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_uyvy, int width) =
|
||||
I422ToUYVYRow_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_uyvy ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -273,9 +279,6 @@ int I422ToUYVY(const uint8* src_y, int src_stride_y,
|
||||
height = 1;
|
||||
src_stride_y = src_stride_u = src_stride_v = dst_stride_uyvy = 0;
|
||||
}
|
||||
void (*I422ToUYVYRow)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_uyvy, int width) =
|
||||
I422ToUYVYRow_C;
|
||||
#if defined(HAS_I422TOUYVYROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2) && width >= 16) {
|
||||
I422ToUYVYRow = I422ToUYVYRow_Any_SSE2;
|
||||
@ -292,7 +295,7 @@ int I422ToUYVY(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
I422ToUYVYRow(src_y, src_u, src_v, dst_uyvy, width);
|
||||
src_y += src_stride_y;
|
||||
src_u += src_stride_u;
|
||||
@ -308,6 +311,10 @@ int I420ToUYVY(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_v, int src_stride_v,
|
||||
uint8* dst_uyvy, int dst_stride_uyvy,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*I422ToUYVYRow)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_uyvy, int width) =
|
||||
I422ToUYVYRow_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_uyvy ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -318,9 +325,6 @@ int I420ToUYVY(const uint8* src_y, int src_stride_y,
|
||||
dst_uyvy = dst_uyvy + (height - 1) * dst_stride_uyvy;
|
||||
dst_stride_uyvy = -dst_stride_uyvy;
|
||||
}
|
||||
void (*I422ToUYVYRow)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_uyvy, int width) =
|
||||
I422ToUYVYRow_C;
|
||||
#if defined(HAS_I422TOUYVYROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2) && width >= 16) {
|
||||
I422ToUYVYRow = I422ToUYVYRow_Any_SSE2;
|
||||
@ -337,7 +341,7 @@ int I420ToUYVY(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height - 1; y += 2) {
|
||||
for (y = 0; y < height - 1; y += 2) {
|
||||
I422ToUYVYRow(src_y, src_u, src_v, dst_uyvy, width);
|
||||
I422ToUYVYRow(src_y + src_stride_y, src_u, src_v,
|
||||
dst_uyvy + dst_stride_uyvy, width);
|
||||
@ -359,6 +363,12 @@ int I420ToNV12(const uint8* src_y, int src_stride_y,
|
||||
uint8* dst_y, int dst_stride_y,
|
||||
uint8* dst_uv, int dst_stride_uv,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*MergeUVRow_)(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
|
||||
int width) = MergeUVRow_C;
|
||||
// Coalesce rows.
|
||||
int halfwidth = (width + 1) >> 1;
|
||||
int halfheight = (height + 1) >> 1;
|
||||
if (!src_y || !src_u || !src_v || !dst_y || !dst_uv ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -366,15 +376,12 @@ int I420ToNV12(const uint8* src_y, int src_stride_y,
|
||||
// Negative height means invert the image.
|
||||
if (height < 0) {
|
||||
height = -height;
|
||||
int halfheight = (height + 1) >> 1;
|
||||
halfheight = (height + 1) >> 1;
|
||||
dst_y = dst_y + (height - 1) * dst_stride_y;
|
||||
dst_uv = dst_uv + (halfheight - 1) * dst_stride_uv;
|
||||
dst_stride_y = -dst_stride_y;
|
||||
dst_stride_uv = -dst_stride_uv;
|
||||
}
|
||||
// Coalesce rows.
|
||||
int halfwidth = (width + 1) >> 1;
|
||||
int halfheight = (height + 1) >> 1;
|
||||
if (src_stride_y == width &&
|
||||
dst_stride_y == width) {
|
||||
width *= height;
|
||||
@ -389,8 +396,6 @@ int I420ToNV12(const uint8* src_y, int src_stride_y,
|
||||
halfheight = 1;
|
||||
src_stride_u = src_stride_v = dst_stride_uv = 0;
|
||||
}
|
||||
void (*MergeUVRow_)(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
|
||||
int width) = MergeUVRow_C;
|
||||
#if defined(HAS_MERGEUVROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2) && halfwidth >= 16) {
|
||||
MergeUVRow_ = MergeUVRow_Any_SSE2;
|
||||
@ -422,7 +427,7 @@ int I420ToNV12(const uint8* src_y, int src_stride_y,
|
||||
#endif
|
||||
|
||||
CopyPlane(src_y, src_stride_y, dst_y, dst_stride_y, width, height);
|
||||
for (int y = 0; y < halfheight; ++y) {
|
||||
for (y = 0; y < halfheight; ++y) {
|
||||
// Merge a row of U and V into a row of UV.
|
||||
MergeUVRow_(src_u, src_v, dst_uv, halfwidth);
|
||||
src_u += src_stride_u;
|
||||
@ -454,6 +459,12 @@ int I420ToARGB(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_v, int src_stride_v,
|
||||
uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*I422ToARGBRow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToARGBRow_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_argb ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -464,11 +475,6 @@ int I420ToARGB(const uint8* src_y, int src_stride_y,
|
||||
dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
||||
dst_stride_argb = -dst_stride_argb;
|
||||
}
|
||||
void (*I422ToARGBRow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToARGBRow_C;
|
||||
#if defined(HAS_I422TOARGBROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) {
|
||||
I422ToARGBRow = I422ToARGBRow_Any_SSSE3;
|
||||
@ -506,7 +512,7 @@ int I420ToARGB(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
I422ToARGBRow(src_y, src_u, src_v, dst_argb, width);
|
||||
dst_argb += dst_stride_argb;
|
||||
src_y += src_stride_y;
|
||||
@ -525,6 +531,12 @@ int I420ToBGRA(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_v, int src_stride_v,
|
||||
uint8* dst_bgra, int dst_stride_bgra,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*I422ToBGRARow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToBGRARow_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_bgra ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -535,11 +547,6 @@ int I420ToBGRA(const uint8* src_y, int src_stride_y,
|
||||
dst_bgra = dst_bgra + (height - 1) * dst_stride_bgra;
|
||||
dst_stride_bgra = -dst_stride_bgra;
|
||||
}
|
||||
void (*I422ToBGRARow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToBGRARow_C;
|
||||
#if defined(HAS_I422TOBGRAROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) {
|
||||
I422ToBGRARow = I422ToBGRARow_Any_SSSE3;
|
||||
@ -567,7 +574,7 @@ int I420ToBGRA(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
I422ToBGRARow(src_y, src_u, src_v, dst_bgra, width);
|
||||
dst_bgra += dst_stride_bgra;
|
||||
src_y += src_stride_y;
|
||||
@ -586,6 +593,12 @@ int I420ToABGR(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_v, int src_stride_v,
|
||||
uint8* dst_abgr, int dst_stride_abgr,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*I422ToABGRRow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToABGRRow_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_abgr ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -596,11 +609,6 @@ int I420ToABGR(const uint8* src_y, int src_stride_y,
|
||||
dst_abgr = dst_abgr + (height - 1) * dst_stride_abgr;
|
||||
dst_stride_abgr = -dst_stride_abgr;
|
||||
}
|
||||
void (*I422ToABGRRow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToABGRRow_C;
|
||||
#if defined(HAS_I422TOABGRROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) {
|
||||
I422ToABGRRow = I422ToABGRRow_Any_SSSE3;
|
||||
@ -620,7 +628,7 @@ int I420ToABGR(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
I422ToABGRRow(src_y, src_u, src_v, dst_abgr, width);
|
||||
dst_abgr += dst_stride_abgr;
|
||||
src_y += src_stride_y;
|
||||
@ -639,6 +647,12 @@ int I420ToRGBA(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_v, int src_stride_v,
|
||||
uint8* dst_rgba, int dst_stride_rgba,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*I422ToRGBARow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToRGBARow_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_rgba ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -649,11 +663,6 @@ int I420ToRGBA(const uint8* src_y, int src_stride_y,
|
||||
dst_rgba = dst_rgba + (height - 1) * dst_stride_rgba;
|
||||
dst_stride_rgba = -dst_stride_rgba;
|
||||
}
|
||||
void (*I422ToRGBARow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToRGBARow_C;
|
||||
#if defined(HAS_I422TORGBAROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) {
|
||||
I422ToRGBARow = I422ToRGBARow_Any_SSSE3;
|
||||
@ -673,7 +682,7 @@ int I420ToRGBA(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
I422ToRGBARow(src_y, src_u, src_v, dst_rgba, width);
|
||||
dst_rgba += dst_stride_rgba;
|
||||
src_y += src_stride_y;
|
||||
@ -692,6 +701,12 @@ int I420ToRGB24(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_v, int src_stride_v,
|
||||
uint8* dst_rgb24, int dst_stride_rgb24,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*I422ToRGB24Row)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToRGB24Row_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_rgb24 ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -702,11 +717,6 @@ int I420ToRGB24(const uint8* src_y, int src_stride_y,
|
||||
dst_rgb24 = dst_rgb24 + (height - 1) * dst_stride_rgb24;
|
||||
dst_stride_rgb24 = -dst_stride_rgb24;
|
||||
}
|
||||
void (*I422ToRGB24Row)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToRGB24Row_C;
|
||||
#if defined(HAS_I422TORGB24ROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) {
|
||||
I422ToRGB24Row = I422ToRGB24Row_Any_SSSE3;
|
||||
@ -723,7 +733,7 @@ int I420ToRGB24(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
I422ToRGB24Row(src_y, src_u, src_v, dst_rgb24, width);
|
||||
dst_rgb24 += dst_stride_rgb24;
|
||||
src_y += src_stride_y;
|
||||
@ -742,6 +752,12 @@ int I420ToRAW(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_v, int src_stride_v,
|
||||
uint8* dst_raw, int dst_stride_raw,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*I422ToRAWRow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToRAWRow_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_raw ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -752,11 +768,6 @@ int I420ToRAW(const uint8* src_y, int src_stride_y,
|
||||
dst_raw = dst_raw + (height - 1) * dst_stride_raw;
|
||||
dst_stride_raw = -dst_stride_raw;
|
||||
}
|
||||
void (*I422ToRAWRow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToRAWRow_C;
|
||||
#if defined(HAS_I422TORAWROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) {
|
||||
I422ToRAWRow = I422ToRAWRow_Any_SSSE3;
|
||||
@ -773,7 +784,7 @@ int I420ToRAW(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
I422ToRAWRow(src_y, src_u, src_v, dst_raw, width);
|
||||
dst_raw += dst_stride_raw;
|
||||
src_y += src_stride_y;
|
||||
@ -792,6 +803,12 @@ int I420ToARGB1555(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_v, int src_stride_v,
|
||||
uint8* dst_argb1555, int dst_stride_argb1555,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*I422ToARGB1555Row)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToARGB1555Row_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_argb1555 ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -802,11 +819,6 @@ int I420ToARGB1555(const uint8* src_y, int src_stride_y,
|
||||
dst_argb1555 = dst_argb1555 + (height - 1) * dst_stride_argb1555;
|
||||
dst_stride_argb1555 = -dst_stride_argb1555;
|
||||
}
|
||||
void (*I422ToARGB1555Row)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToARGB1555Row_C;
|
||||
#if defined(HAS_I422TOARGB1555ROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) {
|
||||
I422ToARGB1555Row = I422ToARGB1555Row_Any_SSSE3;
|
||||
@ -823,7 +835,7 @@ int I420ToARGB1555(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
I422ToARGB1555Row(src_y, src_u, src_v, dst_argb1555, width);
|
||||
dst_argb1555 += dst_stride_argb1555;
|
||||
src_y += src_stride_y;
|
||||
@ -843,6 +855,12 @@ int I420ToARGB4444(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_v, int src_stride_v,
|
||||
uint8* dst_argb4444, int dst_stride_argb4444,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*I422ToARGB4444Row)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToARGB4444Row_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_argb4444 ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -853,11 +871,6 @@ int I420ToARGB4444(const uint8* src_y, int src_stride_y,
|
||||
dst_argb4444 = dst_argb4444 + (height - 1) * dst_stride_argb4444;
|
||||
dst_stride_argb4444 = -dst_stride_argb4444;
|
||||
}
|
||||
void (*I422ToARGB4444Row)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToARGB4444Row_C;
|
||||
#if defined(HAS_I422TOARGB4444ROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) {
|
||||
I422ToARGB4444Row = I422ToARGB4444Row_Any_SSSE3;
|
||||
@ -874,7 +887,7 @@ int I420ToARGB4444(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
I422ToARGB4444Row(src_y, src_u, src_v, dst_argb4444, width);
|
||||
dst_argb4444 += dst_stride_argb4444;
|
||||
src_y += src_stride_y;
|
||||
@ -893,6 +906,12 @@ int I420ToRGB565(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_v, int src_stride_v,
|
||||
uint8* dst_rgb565, int dst_stride_rgb565,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*I422ToRGB565Row)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToRGB565Row_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_rgb565 ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -903,11 +922,6 @@ int I420ToRGB565(const uint8* src_y, int src_stride_y,
|
||||
dst_rgb565 = dst_rgb565 + (height - 1) * dst_stride_rgb565;
|
||||
dst_stride_rgb565 = -dst_stride_rgb565;
|
||||
}
|
||||
void (*I422ToRGB565Row)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
const uint8* v_buf,
|
||||
uint8* rgb_buf,
|
||||
int width) = I422ToRGB565Row_C;
|
||||
#if defined(HAS_I422TORGB565ROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) {
|
||||
I422ToRGB565Row = I422ToRGB565Row_Any_SSSE3;
|
||||
@ -924,7 +938,7 @@ int I420ToRGB565(const uint8* src_y, int src_stride_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
I422ToRGB565Row(src_y, src_u, src_v, dst_rgb565, width);
|
||||
dst_rgb565 += dst_stride_rgb565;
|
||||
src_y += src_stride_y;
|
||||
@ -945,11 +959,11 @@ int ConvertFromI420(const uint8* y, int y_stride,
|
||||
int width, int height,
|
||||
uint32 fourcc) {
|
||||
uint32 format = CanonicalFourCC(fourcc);
|
||||
int r = 0;
|
||||
if (!y || !u|| !v || !dst_sample ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
}
|
||||
int r = 0;
|
||||
switch (format) {
|
||||
// Single plane formats
|
||||
case FOURCC_YUY2:
|
||||
|
||||
@ -28,6 +28,11 @@ int ARGBToI444(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_u, int dst_stride_u,
|
||||
uint8* dst_v, int dst_stride_v,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
void (*ARGBToUV444Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
|
||||
int pix) = ARGBToUV444Row_C;
|
||||
if (!src_argb || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
}
|
||||
@ -45,10 +50,6 @@ int ARGBToI444(const uint8* src_argb, int src_stride_argb,
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_y = dst_stride_u = dst_stride_v = 0;
|
||||
}
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
void (*ARGBToUV444Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
|
||||
int pix) = ARGBToUV444Row_C;
|
||||
#if defined(HAS_ARGBTOUV444ROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16) {
|
||||
ARGBToUV444Row = ARGBToUV444Row_Any_SSSE3;
|
||||
@ -83,7 +84,7 @@ int ARGBToI444(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
ARGBToUV444Row(src_argb, dst_u, dst_v, width);
|
||||
ARGBToYRow(src_argb, dst_y, width);
|
||||
src_argb += src_stride_argb;
|
||||
@ -101,6 +102,11 @@ int ARGBToI422(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_u, int dst_stride_u,
|
||||
uint8* dst_v, int dst_stride_v,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*ARGBToUV422Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
|
||||
int pix) = ARGBToUV422Row_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
if (!src_argb || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
}
|
||||
@ -118,8 +124,6 @@ int ARGBToI422(const uint8* src_argb, int src_stride_argb,
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_y = dst_stride_u = dst_stride_v = 0;
|
||||
}
|
||||
void (*ARGBToUV422Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
|
||||
int pix) = ARGBToUV422Row_C;
|
||||
#if defined(HAS_ARGBTOUV422ROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16) {
|
||||
ARGBToUV422Row = ARGBToUV422Row_Any_SSSE3;
|
||||
@ -132,8 +136,6 @@ int ARGBToI422(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
#if defined(HAS_ARGBTOYROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16) {
|
||||
ARGBToYRow = ARGBToYRow_Any_SSSE3;
|
||||
@ -160,7 +162,7 @@ int ARGBToI422(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
ARGBToUV422Row(src_argb, dst_u, dst_v, width);
|
||||
ARGBToYRow(src_argb, dst_y, width);
|
||||
src_argb += src_stride_argb;
|
||||
@ -178,6 +180,11 @@ int ARGBToI411(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_u, int dst_stride_u,
|
||||
uint8* dst_v, int dst_stride_v,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*ARGBToUV411Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
|
||||
int pix) = ARGBToUV411Row_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
if (!src_argb || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
}
|
||||
@ -195,10 +202,6 @@ int ARGBToI411(const uint8* src_argb, int src_stride_argb,
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_y = dst_stride_u = dst_stride_v = 0;
|
||||
}
|
||||
void (*ARGBToUV411Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
|
||||
int pix) = ARGBToUV411Row_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
#if defined(HAS_ARGBTOYROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16) {
|
||||
ARGBToYRow = ARGBToYRow_Any_SSSE3;
|
||||
@ -234,7 +237,7 @@ int ARGBToI411(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
ARGBToUV411Row(src_argb, dst_u, dst_v, width);
|
||||
ARGBToYRow(src_argb, dst_y, width);
|
||||
src_argb += src_stride_argb;
|
||||
@ -250,6 +253,17 @@ int ARGBToNV12(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_y, int dst_stride_y,
|
||||
uint8* dst_uv, int dst_stride_uv,
|
||||
int width, int height) {
|
||||
int y;
|
||||
int halfwidth = (width + 1) >> 1;
|
||||
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
void (*MergeUVRow_)(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
|
||||
int width) = MergeUVRow_C;
|
||||
// Allocate a rows of uv.
|
||||
align_buffer_64(row_u, ((halfwidth + 15) & ~15) * 2);
|
||||
uint8* row_v = row_u + ((halfwidth + 15) & ~15);
|
||||
if (!src_argb ||
|
||||
!dst_y || !dst_uv ||
|
||||
width <= 0 || height == 0) {
|
||||
@ -261,10 +275,6 @@ int ARGBToNV12(const uint8* src_argb, int src_stride_argb,
|
||||
src_argb = src_argb + (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
#if defined(HAS_ARGBTOYROW_SSSE3) && defined(HAS_ARGBTOUVROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16) {
|
||||
ARGBToUVRow = ARGBToUVRow_Any_SSSE3;
|
||||
@ -294,9 +304,6 @@ int ARGBToNV12(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
int halfwidth = (width + 1) >> 1;
|
||||
void (*MergeUVRow_)(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
|
||||
int width) = MergeUVRow_C;
|
||||
#if defined(HAS_MERGEUVROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2) && halfwidth >= 16) {
|
||||
MergeUVRow_ = MergeUVRow_Any_SSE2;
|
||||
@ -325,11 +332,7 @@ int ARGBToNV12(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
// Allocate a rows of uv.
|
||||
align_buffer_64(row_u, ((halfwidth + 15) & ~15) * 2);
|
||||
uint8* row_v = row_u + ((halfwidth + 15) & ~15);
|
||||
|
||||
for (int y = 0; y < height - 1; y += 2) {
|
||||
for (y = 0; y < height - 1; y += 2) {
|
||||
ARGBToUVRow(src_argb, src_stride_argb, row_u, row_v, width);
|
||||
MergeUVRow_(row_u, row_v, dst_uv, halfwidth);
|
||||
ARGBToYRow(src_argb, dst_y, width);
|
||||
@ -353,6 +356,17 @@ int ARGBToNV21(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_y, int dst_stride_y,
|
||||
uint8* dst_uv, int dst_stride_uv,
|
||||
int width, int height) {
|
||||
int y;
|
||||
int halfwidth = (width + 1) >> 1;
|
||||
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
void (*MergeUVRow_)(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
|
||||
int width) = MergeUVRow_C;
|
||||
// Allocate a rows of uv.
|
||||
align_buffer_64(row_u, ((halfwidth + 15) & ~15) * 2);
|
||||
uint8* row_v = row_u + ((halfwidth + 15) & ~15);
|
||||
if (!src_argb ||
|
||||
!dst_y || !dst_uv ||
|
||||
width <= 0 || height == 0) {
|
||||
@ -364,10 +378,6 @@ int ARGBToNV21(const uint8* src_argb, int src_stride_argb,
|
||||
src_argb = src_argb + (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
#if defined(HAS_ARGBTOYROW_SSSE3) && defined(HAS_ARGBTOUVROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16) {
|
||||
ARGBToUVRow = ARGBToUVRow_Any_SSSE3;
|
||||
@ -397,9 +407,6 @@ int ARGBToNV21(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
int halfwidth = (width + 1) >> 1;
|
||||
void (*MergeUVRow_)(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
|
||||
int width) = MergeUVRow_C;
|
||||
#if defined(HAS_MERGEUVROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2) && halfwidth >= 16) {
|
||||
MergeUVRow_ = MergeUVRow_Any_SSE2;
|
||||
@ -428,11 +435,7 @@ int ARGBToNV21(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
// Allocate a rows of uv.
|
||||
align_buffer_64(row_u, ((halfwidth + 15) & ~15) * 2);
|
||||
uint8* row_v = row_u + ((halfwidth + 15) & ~15);
|
||||
|
||||
for (int y = 0; y < height - 1; y += 2) {
|
||||
for (y = 0; y < height - 1; y += 2) {
|
||||
ARGBToUVRow(src_argb, src_stride_argb, row_u, row_v, width);
|
||||
MergeUVRow_(row_v, row_u, dst_uv, halfwidth);
|
||||
ARGBToYRow(src_argb, dst_y, width);
|
||||
@ -455,6 +458,14 @@ LIBYUV_API
|
||||
int ARGBToYUY2(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_yuy2, int dst_stride_yuy2,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*ARGBToUV422Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
|
||||
int pix) = ARGBToUV422Row_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
void (*I422ToYUY2Row)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_yuy2, int width) = I422ToYUY2Row_C;
|
||||
|
||||
if (!src_argb || !dst_yuy2 ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -472,8 +483,6 @@ int ARGBToYUY2(const uint8* src_argb, int src_stride_argb,
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_yuy2 = 0;
|
||||
}
|
||||
void (*ARGBToUV422Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
|
||||
int pix) = ARGBToUV422Row_C;
|
||||
#if defined(HAS_ARGBTOUV422ROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16) {
|
||||
ARGBToUV422Row = ARGBToUV422Row_Any_SSSE3;
|
||||
@ -485,8 +494,6 @@ int ARGBToYUY2(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
#if defined(HAS_ARGBTOYROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16) {
|
||||
ARGBToYRow = ARGBToYRow_Any_SSSE3;
|
||||
@ -512,9 +519,6 @@ int ARGBToYUY2(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
void (*I422ToYUY2Row)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_yuy2, int width) =
|
||||
I422ToYUY2Row_C;
|
||||
#if defined(HAS_I422TOYUY2ROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2) && width >= 16) {
|
||||
I422ToYUY2Row = I422ToYUY2Row_Any_SSE2;
|
||||
@ -531,20 +535,22 @@ int ARGBToYUY2(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
// Allocate a rows of yuv.
|
||||
align_buffer_64(row_y, ((width + 63) & ~63) * 2);
|
||||
uint8* row_u = row_y + ((width + 63) & ~63);
|
||||
uint8* row_v = row_u + ((width + 63) & ~63) / 2;
|
||||
{
|
||||
// Allocate a rows of yuv.
|
||||
align_buffer_64(row_y, ((width + 63) & ~63) * 2);
|
||||
uint8* row_u = row_y + ((width + 63) & ~63);
|
||||
uint8* row_v = row_u + ((width + 63) & ~63) / 2;
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
ARGBToUV422Row(src_argb, row_u, row_v, width);
|
||||
ARGBToYRow(src_argb, row_y, width);
|
||||
I422ToYUY2Row(row_y, row_u, row_v, dst_yuy2, width);
|
||||
src_argb += src_stride_argb;
|
||||
dst_yuy2 += dst_stride_yuy2;
|
||||
for (y = 0; y < height; ++y) {
|
||||
ARGBToUV422Row(src_argb, row_u, row_v, width);
|
||||
ARGBToYRow(src_argb, row_y, width);
|
||||
I422ToYUY2Row(row_y, row_u, row_v, dst_yuy2, width);
|
||||
src_argb += src_stride_argb;
|
||||
dst_yuy2 += dst_stride_yuy2;
|
||||
}
|
||||
|
||||
free_aligned_buffer_64(row_y);
|
||||
}
|
||||
|
||||
free_aligned_buffer_64(row_y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -553,6 +559,14 @@ LIBYUV_API
|
||||
int ARGBToUYVY(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_uyvy, int dst_stride_uyvy,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*ARGBToUV422Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
|
||||
int pix) = ARGBToUV422Row_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
void (*I422ToUYVYRow)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_uyvy, int width) = I422ToUYVYRow_C;
|
||||
|
||||
if (!src_argb || !dst_uyvy ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -570,8 +584,6 @@ int ARGBToUYVY(const uint8* src_argb, int src_stride_argb,
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_uyvy = 0;
|
||||
}
|
||||
void (*ARGBToUV422Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
|
||||
int pix) = ARGBToUV422Row_C;
|
||||
#if defined(HAS_ARGBTOUV422ROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16) {
|
||||
ARGBToUV422Row = ARGBToUV422Row_Any_SSSE3;
|
||||
@ -583,8 +595,6 @@ int ARGBToUYVY(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
#if defined(HAS_ARGBTOYROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16) {
|
||||
ARGBToYRow = ARGBToYRow_Any_SSSE3;
|
||||
@ -610,9 +620,6 @@ int ARGBToUYVY(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
void (*I422ToUYVYRow)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_uyvy, int width) =
|
||||
I422ToUYVYRow_C;
|
||||
#if defined(HAS_I422TOUYVYROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2) && width >= 16) {
|
||||
I422ToUYVYRow = I422ToUYVYRow_Any_SSE2;
|
||||
@ -629,20 +636,22 @@ int ARGBToUYVY(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
// Allocate a rows of yuv.
|
||||
align_buffer_64(row_y, ((width + 63) & ~63) * 2);
|
||||
uint8* row_u = row_y + ((width + 63) & ~63);
|
||||
uint8* row_v = row_u + ((width + 63) & ~63) / 2;
|
||||
{
|
||||
// Allocate a rows of yuv.
|
||||
align_buffer_64(row_y, ((width + 63) & ~63) * 2);
|
||||
uint8* row_u = row_y + ((width + 63) & ~63);
|
||||
uint8* row_v = row_u + ((width + 63) & ~63) / 2;
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
ARGBToUV422Row(src_argb, row_u, row_v, width);
|
||||
ARGBToYRow(src_argb, row_y, width);
|
||||
I422ToUYVYRow(row_y, row_u, row_v, dst_uyvy, width);
|
||||
src_argb += src_stride_argb;
|
||||
dst_uyvy += dst_stride_uyvy;
|
||||
for (y = 0; y < height; ++y) {
|
||||
ARGBToUV422Row(src_argb, row_u, row_v, width);
|
||||
ARGBToYRow(src_argb, row_y, width);
|
||||
I422ToUYVYRow(row_y, row_u, row_v, dst_uyvy, width);
|
||||
src_argb += src_stride_argb;
|
||||
dst_uyvy += dst_stride_uyvy;
|
||||
}
|
||||
|
||||
free_aligned_buffer_64(row_y);
|
||||
}
|
||||
|
||||
free_aligned_buffer_64(row_y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -651,6 +660,9 @@ LIBYUV_API
|
||||
int ARGBToI400(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_y, int dst_stride_y,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
if (!src_argb || !dst_y || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
}
|
||||
@ -666,8 +678,6 @@ int ARGBToI400(const uint8* src_argb, int src_stride_argb,
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_y = 0;
|
||||
}
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
#if defined(HAS_ARGBTOYROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16) {
|
||||
ARGBToYRow = ARGBToYRow_Any_SSSE3;
|
||||
@ -697,7 +707,7 @@ int ARGBToI400(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
ARGBToYRow(src_argb, dst_y, width);
|
||||
src_argb += src_stride_argb;
|
||||
dst_y += dst_stride_y;
|
||||
@ -726,6 +736,9 @@ LIBYUV_API
|
||||
int ARGBToRGB24(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_rgb24, int dst_stride_rgb24,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*ARGBToRGB24Row)(const uint8* src_argb, uint8* dst_rgb, int pix) =
|
||||
ARGBToRGB24Row_C;
|
||||
if (!src_argb || !dst_rgb24 || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
}
|
||||
@ -741,8 +754,6 @@ int ARGBToRGB24(const uint8* src_argb, int src_stride_argb,
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_rgb24 = 0;
|
||||
}
|
||||
void (*ARGBToRGB24Row)(const uint8* src_argb, uint8* dst_rgb, int pix) =
|
||||
ARGBToRGB24Row_C;
|
||||
#if defined(HAS_ARGBTORGB24ROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16) {
|
||||
ARGBToRGB24Row = ARGBToRGB24Row_Any_SSSE3;
|
||||
@ -759,7 +770,7 @@ int ARGBToRGB24(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
ARGBToRGB24Row(src_argb, dst_rgb24, width);
|
||||
src_argb += src_stride_argb;
|
||||
dst_rgb24 += dst_stride_rgb24;
|
||||
@ -772,6 +783,9 @@ LIBYUV_API
|
||||
int ARGBToRAW(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_raw, int dst_stride_raw,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*ARGBToRAWRow)(const uint8* src_argb, uint8* dst_rgb, int pix) =
|
||||
ARGBToRAWRow_C;
|
||||
if (!src_argb || !dst_raw || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
}
|
||||
@ -787,8 +801,6 @@ int ARGBToRAW(const uint8* src_argb, int src_stride_argb,
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_raw = 0;
|
||||
}
|
||||
void (*ARGBToRAWRow)(const uint8* src_argb, uint8* dst_rgb, int pix) =
|
||||
ARGBToRAWRow_C;
|
||||
#if defined(HAS_ARGBTORAWROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16) {
|
||||
ARGBToRAWRow = ARGBToRAWRow_Any_SSSE3;
|
||||
@ -805,7 +817,7 @@ int ARGBToRAW(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
ARGBToRAWRow(src_argb, dst_raw, width);
|
||||
src_argb += src_stride_argb;
|
||||
dst_raw += dst_stride_raw;
|
||||
@ -818,6 +830,9 @@ LIBYUV_API
|
||||
int ARGBToRGB565(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_rgb565, int dst_stride_rgb565,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*ARGBToRGB565Row)(const uint8* src_argb, uint8* dst_rgb, int pix) =
|
||||
ARGBToRGB565Row_C;
|
||||
if (!src_argb || !dst_rgb565 || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
}
|
||||
@ -833,8 +848,6 @@ int ARGBToRGB565(const uint8* src_argb, int src_stride_argb,
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_rgb565 = 0;
|
||||
}
|
||||
void (*ARGBToRGB565Row)(const uint8* src_argb, uint8* dst_rgb, int pix) =
|
||||
ARGBToRGB565Row_C;
|
||||
#if defined(HAS_ARGBTORGB565ROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2) && width >= 4 &&
|
||||
IS_ALIGNED(src_argb, 16) && IS_ALIGNED(src_stride_argb, 16)) {
|
||||
@ -852,7 +865,7 @@ int ARGBToRGB565(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
ARGBToRGB565Row(src_argb, dst_rgb565, width);
|
||||
src_argb += src_stride_argb;
|
||||
dst_rgb565 += dst_stride_rgb565;
|
||||
@ -865,6 +878,9 @@ LIBYUV_API
|
||||
int ARGBToARGB1555(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_argb1555, int dst_stride_argb1555,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*ARGBToARGB1555Row)(const uint8* src_argb, uint8* dst_rgb, int pix) =
|
||||
ARGBToARGB1555Row_C;
|
||||
if (!src_argb || !dst_argb1555 || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
}
|
||||
@ -880,8 +896,6 @@ int ARGBToARGB1555(const uint8* src_argb, int src_stride_argb,
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_argb1555 = 0;
|
||||
}
|
||||
void (*ARGBToARGB1555Row)(const uint8* src_argb, uint8* dst_rgb, int pix) =
|
||||
ARGBToARGB1555Row_C;
|
||||
#if defined(HAS_ARGBTOARGB1555ROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2) && width >= 4 &&
|
||||
IS_ALIGNED(src_argb, 16) && IS_ALIGNED(src_stride_argb, 16)) {
|
||||
@ -899,7 +913,7 @@ int ARGBToARGB1555(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
ARGBToARGB1555Row(src_argb, dst_argb1555, width);
|
||||
src_argb += src_stride_argb;
|
||||
dst_argb1555 += dst_stride_argb1555;
|
||||
@ -912,6 +926,9 @@ LIBYUV_API
|
||||
int ARGBToARGB4444(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_argb4444, int dst_stride_argb4444,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*ARGBToARGB4444Row)(const uint8* src_argb, uint8* dst_rgb, int pix) =
|
||||
ARGBToARGB4444Row_C;
|
||||
if (!src_argb || !dst_argb4444 || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
}
|
||||
@ -927,8 +944,6 @@ int ARGBToARGB4444(const uint8* src_argb, int src_stride_argb,
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_argb4444 = 0;
|
||||
}
|
||||
void (*ARGBToARGB4444Row)(const uint8* src_argb, uint8* dst_rgb, int pix) =
|
||||
ARGBToARGB4444Row_C;
|
||||
#if defined(HAS_ARGBTOARGB4444ROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2) && width >= 4 &&
|
||||
IS_ALIGNED(src_argb, 16) && IS_ALIGNED(src_stride_argb, 16)) {
|
||||
@ -946,7 +961,7 @@ int ARGBToARGB4444(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
ARGBToARGB4444Row(src_argb, dst_argb4444, width);
|
||||
src_argb += src_stride_argb;
|
||||
dst_argb4444 += dst_stride_argb4444;
|
||||
@ -961,6 +976,11 @@ int ARGBToJ420(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_u, int dst_stride_u,
|
||||
uint8* dst_v, int dst_stride_v,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*ARGBToUVJRow)(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVJRow_C;
|
||||
void (*ARGBToYJRow)(const uint8* src_argb, uint8* dst_yj, int pix) =
|
||||
ARGBToYJRow_C;
|
||||
if (!src_argb ||
|
||||
!dst_yj || !dst_u || !dst_v ||
|
||||
width <= 0 || height == 0) {
|
||||
@ -972,10 +992,6 @@ int ARGBToJ420(const uint8* src_argb, int src_stride_argb,
|
||||
src_argb = src_argb + (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
void (*ARGBToUVJRow)(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVJRow_C;
|
||||
void (*ARGBToYJRow)(const uint8* src_argb, uint8* dst_yj, int pix) =
|
||||
ARGBToYJRow_C;
|
||||
#if defined(HAS_ARGBTOYJROW_SSSE3) && defined(HAS_ARGBTOUVJROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16) {
|
||||
ARGBToUVJRow = ARGBToUVJRow_Any_SSSE3;
|
||||
@ -1015,7 +1031,7 @@ int ARGBToJ420(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height - 1; y += 2) {
|
||||
for (y = 0; y < height - 1; y += 2) {
|
||||
ARGBToUVJRow(src_argb, src_stride_argb, dst_u, dst_v, width);
|
||||
ARGBToYJRow(src_argb, dst_yj, width);
|
||||
ARGBToYJRow(src_argb + src_stride_argb, dst_yj + dst_stride_yj, width);
|
||||
@ -1036,6 +1052,9 @@ LIBYUV_API
|
||||
int ARGBToJ400(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_yj, int dst_stride_yj,
|
||||
int width, int height) {
|
||||
int y;
|
||||
void (*ARGBToYJRow)(const uint8* src_argb, uint8* dst_yj, int pix) =
|
||||
ARGBToYJRow_C;
|
||||
if (!src_argb || !dst_yj || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
}
|
||||
@ -1051,8 +1070,6 @@ int ARGBToJ400(const uint8* src_argb, int src_stride_argb,
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_yj = 0;
|
||||
}
|
||||
void (*ARGBToYJRow)(const uint8* src_argb, uint8* dst_yj, int pix) =
|
||||
ARGBToYJRow_C;
|
||||
#if defined(HAS_ARGBTOYJROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16) {
|
||||
ARGBToYJRow = ARGBToYJRow_Any_SSSE3;
|
||||
@ -1082,7 +1099,7 @@ int ARGBToJ400(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
ARGBToYJRow(src_argb, dst_yj, width);
|
||||
src_argb += src_stride_argb;
|
||||
dst_yj += dst_stride_yj;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user