mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-08 01:36:47 +08:00
move READWORD and WRITEWORD into row_common along with row functions that use them
BUG=171 TEST=still builds Review URL: https://webrtc-codereview.appspot.com/1021008 git-svn-id: http://libyuv.googlecode.com/svn/trunk@528 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
aa64b6b14c
commit
ceee491c24
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 527
|
||||
Version: 528
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -22,24 +22,6 @@ extern "C" {
|
||||
#define kMaxStride (2880 * 4)
|
||||
#define IS_ALIGNED(p, a) (!((uintptr_t)(p) & ((a) - 1)))
|
||||
|
||||
#ifdef LIBYUV_LITTLE_ENDIAN
|
||||
#define READWORD(p) (*reinterpret_cast<const uint32*>(p))
|
||||
#define WRITEWORD(p, v) *reinterpret_cast<uint32*>(p) = v
|
||||
#else
|
||||
static inline uint32 READWORD(const uint8* p) {
|
||||
return static_cast<uint32>(p[0]) |
|
||||
(static_cast<uint32>(p[1]) << 8) |
|
||||
(static_cast<uint32>(p[2]) << 16) |
|
||||
(static_cast<uint32>(p[3]) << 24);
|
||||
}
|
||||
static inline void WRITEWORD(uint8* p, uint32 v) {
|
||||
p[0] = (uint8)(v & 255);
|
||||
p[1] = (uint8)((v >> 8) & 255);
|
||||
p[2] = (uint8)((v >> 16) & 255);
|
||||
p[3] = (uint8)((v >> 24) & 255);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__CLR_VER) || defined(COVERAGE_ENABLED) || \
|
||||
defined(TARGET_IPHONE_SIMULATOR)
|
||||
#define YUV_DISABLE_ASM
|
||||
@ -1297,6 +1279,9 @@ void ARGBInterpolateRow_NEON(uint8* dst_argb, const uint8* src_argb,
|
||||
ptrdiff_t src_stride_argb, int dst_width,
|
||||
int source_y_fraction);
|
||||
|
||||
void UYVYToV210Row_C(const uint8* src_uyvy, uint8* dst_v210, int width);
|
||||
void V210ToUYVYRow_C(const uint8* src_v210, uint8* dst_uyvy, int width);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace libyuv
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
||||
#define INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
#define LIBYUV_VERSION 527
|
||||
#define LIBYUV_VERSION 528
|
||||
|
||||
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
||||
|
||||
@ -692,35 +692,6 @@ int UYVYToI420(const uint8* src_uyvy, int src_stride_uyvy,
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Must be multiple of 6 pixels. Will over convert to handle remainder.
|
||||
// https://developer.apple.com/quicktime/icefloe/dispatch019.html#v210
|
||||
static void V210ToUYVYRow_C(const uint8* src_v210, uint8* dst_uyvy, int width) {
|
||||
for (int x = 0; x < width; x += 6) {
|
||||
uint32 w = READWORD(src_v210 + 0);
|
||||
dst_uyvy[0] = (w >> 2) & 0xff;
|
||||
dst_uyvy[1] = (w >> 12) & 0xff;
|
||||
dst_uyvy[2] = (w >> 22) & 0xff;
|
||||
|
||||
w = READWORD(src_v210 + 4);
|
||||
dst_uyvy[3] = (w >> 2) & 0xff;
|
||||
dst_uyvy[4] = (w >> 12) & 0xff;
|
||||
dst_uyvy[5] = (w >> 22) & 0xff;
|
||||
|
||||
w = READWORD(src_v210 + 8);
|
||||
dst_uyvy[6] = (w >> 2) & 0xff;
|
||||
dst_uyvy[7] = (w >> 12) & 0xff;
|
||||
dst_uyvy[8] = (w >> 22) & 0xff;
|
||||
|
||||
w = READWORD(src_v210 + 12);
|
||||
dst_uyvy[9] = (w >> 2) & 0xff;
|
||||
dst_uyvy[10] = (w >> 12) & 0xff;
|
||||
dst_uyvy[11] = (w >> 22) & 0xff;
|
||||
|
||||
src_v210 += 16;
|
||||
dst_uyvy += 12;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert V210 to I420.
|
||||
// V210 is 10 bit version of UYVY. 16 bytes to store 6 pixels.
|
||||
// Width is multiple of 48 pixels = 128 bytes.
|
||||
|
||||
@ -210,26 +210,6 @@ int I400Copy(const uint8* src_y, int src_stride_y,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define EIGHTTOTEN(x) (x << 2 | x >> 6)
|
||||
static void UYVYToV210Row_C(const uint8* src_uyvy, uint8* dst_v210, int width) {
|
||||
for (int x = 0; x < width; x += 6) {
|
||||
WRITEWORD(dst_v210 + 0, (EIGHTTOTEN(src_uyvy[0])) |
|
||||
(EIGHTTOTEN(src_uyvy[1]) << 10) |
|
||||
(EIGHTTOTEN(src_uyvy[2]) << 20));
|
||||
WRITEWORD(dst_v210 + 4, (EIGHTTOTEN(src_uyvy[3])) |
|
||||
(EIGHTTOTEN(src_uyvy[4]) << 10) |
|
||||
(EIGHTTOTEN(src_uyvy[5]) << 20));
|
||||
WRITEWORD(dst_v210 + 8, (EIGHTTOTEN(src_uyvy[6])) |
|
||||
(EIGHTTOTEN(src_uyvy[7]) << 10) |
|
||||
(EIGHTTOTEN(src_uyvy[8]) << 20));
|
||||
WRITEWORD(dst_v210 + 12, (EIGHTTOTEN(src_uyvy[9])) |
|
||||
(EIGHTTOTEN(src_uyvy[10]) << 10) |
|
||||
(EIGHTTOTEN(src_uyvy[11]) << 20));
|
||||
src_uyvy += 12;
|
||||
dst_v210 += 16;
|
||||
}
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
int I422ToYUY2(const uint8* src_y, int src_stride_y,
|
||||
const uint8* src_u, int src_stride_u,
|
||||
|
||||
@ -19,6 +19,45 @@ namespace libyuv {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef LIBYUV_LITTLE_ENDIAN
|
||||
#define READWORD(p) (*reinterpret_cast<const uint32*>(p))
|
||||
#define WRITEWORD(p, v) *reinterpret_cast<uint32*>(p) = v
|
||||
#else
|
||||
static inline uint32 READWORD(const uint8* p) {
|
||||
return static_cast<uint32>(p[0]) |
|
||||
(static_cast<uint32>(p[1]) << 8) |
|
||||
(static_cast<uint32>(p[2]) << 16) |
|
||||
(static_cast<uint32>(p[3]) << 24);
|
||||
}
|
||||
static inline void WRITEWORD(uint8* p, uint32 v) {
|
||||
p[0] = (uint8)(v & 255);
|
||||
p[1] = (uint8)((v >> 8) & 255);
|
||||
p[2] = (uint8)((v >> 16) & 255);
|
||||
p[3] = (uint8)((v >> 24) & 255);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define EIGHTTOTEN(x) (x << 2 | x >> 6)
|
||||
void UYVYToV210Row_C(const uint8* src_uyvy, uint8* dst_v210, int width) {
|
||||
for (int x = 0; x < width; x += 6) {
|
||||
WRITEWORD(dst_v210 + 0, (EIGHTTOTEN(src_uyvy[0])) |
|
||||
(EIGHTTOTEN(src_uyvy[1]) << 10) |
|
||||
(EIGHTTOTEN(src_uyvy[2]) << 20));
|
||||
WRITEWORD(dst_v210 + 4, (EIGHTTOTEN(src_uyvy[3])) |
|
||||
(EIGHTTOTEN(src_uyvy[4]) << 10) |
|
||||
(EIGHTTOTEN(src_uyvy[5]) << 20));
|
||||
WRITEWORD(dst_v210 + 8, (EIGHTTOTEN(src_uyvy[6])) |
|
||||
(EIGHTTOTEN(src_uyvy[7]) << 10) |
|
||||
(EIGHTTOTEN(src_uyvy[8]) << 20));
|
||||
WRITEWORD(dst_v210 + 12, (EIGHTTOTEN(src_uyvy[9])) |
|
||||
(EIGHTTOTEN(src_uyvy[10]) << 10) |
|
||||
(EIGHTTOTEN(src_uyvy[11]) << 20));
|
||||
src_uyvy += 12;
|
||||
dst_v210 += 16;
|
||||
}
|
||||
}
|
||||
#undef EIGHTTOTEN
|
||||
|
||||
void BGRAToARGBRow_C(const uint8* src_bgra, uint8* dst_argb, int width) {
|
||||
for (int x = 0; x < width; ++x) {
|
||||
// To support in-place conversion.
|
||||
@ -1750,6 +1789,35 @@ void UYVYToARGBRow_Unaligned_SSSE3(const uint8* src_uyvy,
|
||||
#endif // defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)
|
||||
#endif // !defined(YUV_DISABLE_ASM)
|
||||
|
||||
// Must be multiple of 6 pixels. Will over convert to handle remainder.
|
||||
// https://developer.apple.com/quicktime/icefloe/dispatch019.html#v210
|
||||
void V210ToUYVYRow_C(const uint8* src_v210, uint8* dst_uyvy, int width) {
|
||||
for (int x = 0; x < width; x += 6) {
|
||||
uint32 w = READWORD(src_v210 + 0);
|
||||
dst_uyvy[0] = (w >> 2) & 0xff;
|
||||
dst_uyvy[1] = (w >> 12) & 0xff;
|
||||
dst_uyvy[2] = (w >> 22) & 0xff;
|
||||
|
||||
w = READWORD(src_v210 + 4);
|
||||
dst_uyvy[3] = (w >> 2) & 0xff;
|
||||
dst_uyvy[4] = (w >> 12) & 0xff;
|
||||
dst_uyvy[5] = (w >> 22) & 0xff;
|
||||
|
||||
w = READWORD(src_v210 + 8);
|
||||
dst_uyvy[6] = (w >> 2) & 0xff;
|
||||
dst_uyvy[7] = (w >> 12) & 0xff;
|
||||
dst_uyvy[8] = (w >> 22) & 0xff;
|
||||
|
||||
w = READWORD(src_v210 + 12);
|
||||
dst_uyvy[9] = (w >> 2) & 0xff;
|
||||
dst_uyvy[10] = (w >> 12) & 0xff;
|
||||
dst_uyvy[11] = (w >> 22) & 0xff;
|
||||
|
||||
src_v210 += 16;
|
||||
dst_uyvy += 12;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace libyuv
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user