mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-07 01:06:46 +08:00
Row coalesce convert_from.cc for I420ToNV12, YUY2ToI422, UYVYToI422
BUG=197 TESTED=I420ToNV12_Opt Review URL: https://webrtc-codereview.appspot.com/1196004 git-svn-id: http://libyuv.googlecode.com/svn/trunk@605 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
04de744106
commit
07a99dc278
@ -1,6 +1,6 @@
|
|||||||
Name: libyuv
|
Name: libyuv
|
||||||
URL: http://code.google.com/p/libyuv/
|
URL: http://code.google.com/p/libyuv/
|
||||||
Version: 604
|
Version: 605
|
||||||
License: BSD
|
License: BSD
|
||||||
License File: LICENSE
|
License File: LICENSE
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,6 @@
|
|||||||
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
||||||
#define INCLUDE_LIBYUV_VERSION_H_
|
#define INCLUDE_LIBYUV_VERSION_H_
|
||||||
|
|
||||||
#define LIBYUV_VERSION 604
|
#define LIBYUV_VERSION 605
|
||||||
|
|
||||||
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
||||||
|
|||||||
@ -237,6 +237,17 @@ int I422ToYUY2(const uint8* src_y, int src_stride_y,
|
|||||||
dst_yuy2 = dst_yuy2 + (height - 1) * dst_stride_yuy2;
|
dst_yuy2 = dst_yuy2 + (height - 1) * dst_stride_yuy2;
|
||||||
dst_stride_yuy2 = -dst_stride_yuy2;
|
dst_stride_yuy2 = -dst_stride_yuy2;
|
||||||
}
|
}
|
||||||
|
// Coalesce contiguous rows.
|
||||||
|
if (src_stride_y == width &&
|
||||||
|
src_stride_u * 2 == width &&
|
||||||
|
src_stride_v * 2 == width &&
|
||||||
|
dst_stride_yuy2 == width * 2) {
|
||||||
|
return I422ToYUY2(src_y, 0,
|
||||||
|
src_u, 0,
|
||||||
|
src_v, 0,
|
||||||
|
dst_yuy2, 0,
|
||||||
|
width * height, 1);
|
||||||
|
}
|
||||||
void (*I422ToYUY2Row)(const uint8* src_y, const uint8* src_u,
|
void (*I422ToYUY2Row)(const uint8* src_y, const uint8* src_u,
|
||||||
const uint8* src_v, uint8* dst_yuy2, int width) =
|
const uint8* src_v, uint8* dst_yuy2, int width) =
|
||||||
I422ToYUY2Row_C;
|
I422ToYUY2Row_C;
|
||||||
@ -336,6 +347,17 @@ int I422ToUYVY(const uint8* src_y, int src_stride_y,
|
|||||||
dst_uyvy = dst_uyvy + (height - 1) * dst_stride_uyvy;
|
dst_uyvy = dst_uyvy + (height - 1) * dst_stride_uyvy;
|
||||||
dst_stride_uyvy = -dst_stride_uyvy;
|
dst_stride_uyvy = -dst_stride_uyvy;
|
||||||
}
|
}
|
||||||
|
// Coalesce contiguous rows.
|
||||||
|
if (src_stride_y == width &&
|
||||||
|
src_stride_u * 2 == width &&
|
||||||
|
src_stride_v * 2 == width &&
|
||||||
|
dst_stride_uyvy == width * 2) {
|
||||||
|
return I422ToUYVY(src_y, 0,
|
||||||
|
src_u, 0,
|
||||||
|
src_v, 0,
|
||||||
|
dst_uyvy, 0,
|
||||||
|
width * height, 1);
|
||||||
|
}
|
||||||
void (*I422ToUYVYRow)(const uint8* src_y, const uint8* src_u,
|
void (*I422ToUYVYRow)(const uint8* src_y, const uint8* src_u,
|
||||||
const uint8* src_v, uint8* dst_uyvy, int width) =
|
const uint8* src_v, uint8* dst_uyvy, int width) =
|
||||||
I422ToUYVYRow_C;
|
I422ToUYVYRow_C;
|
||||||
@ -439,8 +461,19 @@ int I420ToNV12(const uint8* src_y, int src_stride_y,
|
|||||||
dst_stride_y = -dst_stride_y;
|
dst_stride_y = -dst_stride_y;
|
||||||
dst_stride_uv = -dst_stride_uv;
|
dst_stride_uv = -dst_stride_uv;
|
||||||
}
|
}
|
||||||
|
// Coalesce contiguous rows.
|
||||||
int halfwidth = (width + 1) >> 1;
|
int halfwidth = (width + 1) >> 1;
|
||||||
|
int halfheight = (height + 1) >> 1;
|
||||||
|
if (src_stride_y == width &&
|
||||||
|
src_stride_u * 2 == width &&
|
||||||
|
src_stride_v * 2 == width &&
|
||||||
|
dst_stride_y == width &&
|
||||||
|
dst_stride_uv == width) {
|
||||||
|
width = width * height;
|
||||||
|
height = 1;
|
||||||
|
halfwidth = halfwidth * halfheight;
|
||||||
|
halfheight = 1;
|
||||||
|
}
|
||||||
void (*MergeUVRow_)(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
|
void (*MergeUVRow_)(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
|
||||||
int width) = MergeUVRow_C;
|
int width) = MergeUVRow_C;
|
||||||
#if defined(HAS_MERGEUVROW_SSE2)
|
#if defined(HAS_MERGEUVROW_SSE2)
|
||||||
@ -476,7 +509,6 @@ int I420ToNV12(const uint8* src_y, int src_stride_y,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
CopyPlane(src_y, src_stride_y, dst_y, dst_stride_y, width, height);
|
CopyPlane(src_y, src_stride_y, dst_y, dst_stride_y, width, height);
|
||||||
int halfheight = (height + 1) >> 1;
|
|
||||||
for (int y = 0; y < halfheight; ++y) {
|
for (int y = 0; y < halfheight; ++y) {
|
||||||
// Merge a row of U and V into a row of UV.
|
// Merge a row of U and V into a row of UV.
|
||||||
MergeUVRow_(src_u, src_v, dst_uv, halfwidth);
|
MergeUVRow_(src_u, src_v, dst_uv, halfwidth);
|
||||||
|
|||||||
@ -271,8 +271,6 @@ YANY(ARGBAttenuateRow_Any_NEON, ARGBAttenuateRow_NEON, ARGBAttenuateRow_C,
|
|||||||
#endif
|
#endif
|
||||||
#undef YANY
|
#undef YANY
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// RGB/YUV to UV does multiple of 16 with SIMD and remainder with C.
|
// RGB/YUV to UV does multiple of 16 with SIMD and remainder with C.
|
||||||
#define UVANY(NAMEANY, ANYTOUV_SIMD, ANYTOUV_C, BPP, MASK) \
|
#define UVANY(NAMEANY, ANYTOUV_SIMD, ANYTOUV_C, BPP, MASK) \
|
||||||
void NAMEANY(const uint8* src_argb, int src_stride_argb, \
|
void NAMEANY(const uint8* src_argb, int src_stride_argb, \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user