Commit 9780dd4e authored by fbarchard@google.com's avatar fbarchard@google.com

Remove V210. Quality of this code is insufficient for libyuv. Unable to make…

Remove V210. Quality of this code is insufficient for libyuv. Unable to make V210 pass valgrind.  Would require effort to add missing support and optimization.
BUG=91
TEST=valgrind
Review URL: https://webrtc-codereview.appspot.com/1021009

git-svn-id: http://libyuv.googlecode.com/svn/trunk@536 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 73478758
......@@ -122,14 +122,6 @@ int Q420ToI420(const uint8* src_y, int src_stride_y,
uint8* dst_v, int dst_stride_v,
int width, int height);
// Convert V210 to I420.
LIBYUV_API
int V210ToI420(const uint8* src_uyvy, int src_stride_uyvy,
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);
// ARGB little endian (bgra in memory) to I420.
LIBYUV_API
int ARGBToI420(const uint8* src_frame, int src_stride_frame,
......
......@@ -18,7 +18,7 @@
#include "libyuv/rotate.h"
// TODO(fbarchard): This set of functions should exactly match convert.h
// Add missing V210 and Q420.
// Add missing Q420.
// TODO(fbarchard): Add tests. Create random content of right size and convert
// with C vs Opt and or to I420 and compare.
// TODO(fbarchard): Some of these functions lack parameter setting.
......@@ -123,12 +123,6 @@ int UYVYToARGB(const uint8* src_uyvy, int src_stride_uyvy,
uint8* dst_argb, int dst_stride_argb,
int width, int height);
// TODO(fbarchard): Convert V210 to ARGB.
// LIBYUV_API
// int V210ToARGB(const uint8* src_uyvy, int src_stride_uyvy,
// uint8* dst_argb, int dst_stride_argb,
// int width, int height);
// BGRA little endian (argb in memory) to ARGB.
LIBYUV_API
int BGRAToARGB(const uint8* src_frame, int src_stride_frame,
......
......@@ -89,13 +89,6 @@ int I420ToUYVY(const uint8* src_y, int src_stride_y,
uint8* dst_frame, int dst_stride_frame,
int width, int height);
LIBYUV_API
int I420ToV210(const uint8* src_y, int src_stride_y,
const uint8* src_u, int src_stride_u,
const uint8* src_v, int src_stride_v,
uint8* dst_frame, int dst_stride_frame,
int width, int height);
LIBYUV_API
int I420ToARGB(const uint8* src_y, int src_stride_y,
const uint8* src_u, int src_stride_u,
......
......@@ -295,12 +295,6 @@ void ARGBAffineRow_SSE2(const uint8* src_argb, int src_argb_stride,
#define HAS_ARGBAFFINEROW_SSE2
#endif
// Convert V210 to UYVY.
LIBYUV_API
int V210ToUYVY(const uint8* src_v210, int src_stride_v210,
uint8* dst_uyvy, int dst_stride_uyvy,
int width, int height);
#ifdef __cplusplus
} // extern "C"
} // namespace libyuv
......
......@@ -1279,9 +1279,6 @@ 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 535
#define LIBYUV_VERSION 536
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
......@@ -54,10 +54,9 @@ enum FourCC {
FOURCC_YUY2 = FOURCC('Y', 'U', 'Y', '2'),
FOURCC_UYVY = FOURCC('U', 'Y', 'V', 'Y'),
// 3 Secondary YUV formats: 2 row biplanar, 1 packed.
// 2 Secondary YUV formats: row biplanar.
FOURCC_M420 = FOURCC('M', '4', '2', '0'),
FOURCC_Q420 = FOURCC('Q', '4', '2', '0'),
FOURCC_V210 = FOURCC('V', '2', '1', '0'),
// 9 Primary RGB formats: 4 32 bpp, 2 24 bpp, 3 16 bpp.
FOURCC_ARGB = FOURCC('A', 'R', 'G', 'B'),
......@@ -119,7 +118,6 @@ enum FourCCBpp {
FOURCC_BPP_UYVY = 16,
FOURCC_BPP_M420 = 12,
FOURCC_BPP_Q420 = 12,
FOURCC_BPP_V210 = 22, // 128 / 6 actually.
FOURCC_BPP_ARGB = 32,
FOURCC_BPP_BGRA = 32,
FOURCC_BPP_ABGR = 32,
......
......@@ -692,101 +692,6 @@ int UYVYToI420(const uint8* src_uyvy, int src_stride_uyvy,
return 0;
}
// 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.
LIBYUV_API
int V210ToI420(const uint8* src_v210, int src_stride_v210,
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) {
if (!src_v210 || !dst_y || !dst_u || !dst_v ||
width <= 0 || height == 0 ||
width * 2 * 2 > kMaxStride) {
return -1;
}
// Negative height means invert the image.
if (height < 0) {
height = -height;
src_v210 = src_v210 + (height - 1) * src_stride_v210;
src_stride_v210 = -src_stride_v210;
}
SIMD_ALIGNED(uint8 row[kMaxStride * 2]);
void (*V210ToUYVYRow)(const uint8* src_v210, uint8* dst_uyvy, int pix);
V210ToUYVYRow = V210ToUYVYRow_C;
void (*UYVYToUVRow)(const uint8* src_uyvy, int src_stride_uyvy,
uint8* dst_u, uint8* dst_v, int pix);
void (*UYVYToYRow)(const uint8* src_uyvy,
uint8* dst_y, int pix);
UYVYToYRow = UYVYToYRow_C;
UYVYToUVRow = UYVYToUVRow_C;
#if defined(HAS_UYVYTOYROW_SSE2)
if (TestCpuFlag(kCpuHasSSE2) && IS_ALIGNED(width, 16)) {
UYVYToUVRow = UYVYToUVRow_SSE2;
UYVYToYRow = UYVYToYRow_Unaligned_SSE2;
if (IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) {
UYVYToYRow = UYVYToYRow_SSE2;
}
}
#elif defined(HAS_UYVYTOYROW_NEON)
if (TestCpuFlag(kCpuHasNEON) && width >= 8) {
UYVYToYRow = UYVYToYRow_Any_NEON;
if (width >= 16) {
UYVYToUVRow = UYVYToUVRow_Any_NEON;
}
if (IS_ALIGNED(width, 16)) {
UYVYToYRow = UYVYToYRow_NEON;
UYVYToUVRow = UYVYToUVRow_NEON;
}
}
#endif
#if defined(HAS_UYVYTOYROW_SSE2)
if (TestCpuFlag(kCpuHasSSE2) && width >= 16) {
UYVYToUVRow = UYVYToUVRow_Any_SSE2;
UYVYToYRow = UYVYToYRow_Any_SSE2;
if (IS_ALIGNED(width, 16)) {
UYVYToYRow = UYVYToYRow_Unaligned_SSE2;
UYVYToUVRow = UYVYToUVRow_SSE2;
if (IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) {
UYVYToYRow = UYVYToYRow_SSE2;
}
}
}
#elif defined(HAS_UYVYTOYROW_NEON)
if (TestCpuFlag(kCpuHasNEON) && width >= 8) {
UYVYToYRow = UYVYToYRow_Any_NEON;
if (width >= 16) {
UYVYToUVRow = UYVYToUVRow_Any_NEON;
}
if (IS_ALIGNED(width, 16)) {
UYVYToYRow = UYVYToYRow_NEON;
UYVYToUVRow = UYVYToUVRow_NEON;
}
}
#endif
for (int y = 0; y < height - 1; y += 2) {
V210ToUYVYRow(src_v210, row, width);
V210ToUYVYRow(src_v210 + src_stride_v210, row + kMaxStride, width);
UYVYToUVRow(row, kMaxStride, dst_u, dst_v, width);
UYVYToYRow(row, dst_y, width);
UYVYToYRow(row + kMaxStride, dst_y + dst_stride_y, width);
src_v210 += src_stride_v210 * 2;
dst_y += dst_stride_y * 2;
dst_u += dst_stride_u;
dst_v += dst_stride_v;
}
if (height & 1) {
V210ToUYVYRow(src_v210, row, width);
UYVYToUVRow(row, 0, dst_u, dst_v, width);
UYVYToYRow(row, dst_y, width);
}
return 0;
}
// Convert ARGB to I420.
LIBYUV_API
int ARGBToI420(const uint8* src_argb, int src_stride_argb,
......@@ -1865,17 +1770,6 @@ int ConvertToI420(const uint8* sample,
v, v_stride,
dst_width, inv_dst_height);
break;
case FOURCC_V210:
// stride is multiple of 48 pixels (128 bytes).
// pixels come in groups of 6 = 16 bytes
src = sample + (aligned_src_width + 47) / 48 * 128 * crop_y +
crop_x / 6 * 16;
r = V210ToI420(src, (aligned_src_width + 47) / 48 * 128,
y, y_stride,
u, u_stride,
v, v_stride,
dst_width, inv_dst_height);
break;
case FOURCC_24BG:
src = sample + (src_width * crop_y + crop_x) * 3;
r = RGB24ToI420(src, src_width * 3,
......
......@@ -1084,15 +1084,6 @@ int ConvertToARGB(const uint8* sample, size_t sample_size,
dst_argb, argb_stride,
dst_width, inv_dst_height);
break;
// case FOURCC_V210:
// stride is multiple of 48 pixels (128 bytes).
// pixels come in groups of 6 = 16 bytes
// src = sample + (aligned_src_width + 47) / 48 * 128 * crop_y +
// crop_x / 6 * 16;
// r = V210ToARGB(src, (aligned_src_width + 47) / 48 * 128,
// dst_argb, argb_stride,
// dst_width, inv_dst_height);
// break;
case FOURCC_24BG:
src = sample + (src_width * crop_y + crop_x) * 3;
r = RGB24ToARGB(src, src_width * 3,
......
......@@ -408,43 +408,6 @@ int I420ToUYVY(const uint8* src_y, int src_stride_y,
return 0;
}
LIBYUV_API
int I420ToV210(const uint8* src_y, int src_stride_y,
const uint8* src_u, int src_stride_u,
const uint8* src_v, int src_stride_v,
uint8* dst_v210, int dst_stride_v210,
int width, int height) {
if (width * 16 / 6 > kMaxStride ||
!src_y || !src_u || !src_v || !dst_v210 ||
width <= 0 || height == 0) {
return -1;
}
// Negative height means invert the image.
if (height < 0) {
height = -height;
dst_v210 = dst_v210 + (height - 1) * dst_stride_v210;
dst_stride_v210 = -dst_stride_v210;
}
SIMD_ALIGNED(uint8 row[kMaxStride]);
for (int y = 0; y < height - 1; y += 2) {
I422ToUYVYRow_C(src_y, src_u, src_v, row, width);
UYVYToV210Row_C(row, dst_v210, width);
I422ToUYVYRow_C(src_y + src_stride_y, src_u, src_v, row, width);
UYVYToV210Row_C(row, dst_v210 + dst_stride_v210, width);
src_y += src_stride_y * 2;
src_u += src_stride_u;
src_v += src_stride_v;
dst_v210 += dst_stride_v210 * 2;
}
if (height & 1) {
I422ToUYVYRow_C(src_y, src_u, src_v, row, width);
UYVYToV210Row_C(row, dst_v210, width);
}
return 0;
}
LIBYUV_API
int I420ToNV12(const uint8* src_y, int src_stride_y,
const uint8* src_u, int src_stride_u,
......@@ -1046,15 +1009,6 @@ int ConvertFromI420(const uint8* y, int y_stride,
dst_sample_stride ? dst_sample_stride : width * 2,
width, height);
break;
case FOURCC_V210:
r = I420ToV210(y, y_stride,
u, u_stride,
v, v_stride,
dst_sample,
dst_sample_stride ? dst_sample_stride :
(width + 47) / 48 * 128,
width, height);
break;
case FOURCC_RGBP:
r = I420ToRGB565(y, y_stride,
u, u_stride,
......
......@@ -1207,32 +1207,6 @@ int ARGBInterpolate(const uint8* src_argb0, int src_stride_argb0,
return 0;
}
// Convert V210 to UYVY.
LIBYUV_API
int V210ToUYVY(const uint8* src_v210, int src_stride_v210,
uint8* dst_uyvy, int dst_stride_uyvy,
int width, int height) {
if (!src_v210 || !dst_uyvy ||
width <= 0 || height == 0) {
return -1;
}
// Negative height means invert the image.
if (height < 0) {
height = -height;
src_v210 = src_v210 + (height - 1) * src_stride_v210;
src_stride_v210 = -src_stride_v210;
}
void (*V210ToUYVYRow)(const uint8* src_v210, uint8* dst_uyvy, int pix) =
V210ToUYVYRow_C;
for (int y = 0; y < height; ++y) {
V210ToUYVYRow(src_v210, dst_uyvy, width);
src_v210 += src_stride_v210;
dst_uyvy += dst_stride_uyvy;
}
return 0;
}
#ifdef __cplusplus
} // extern "C"
} // namespace libyuv
......
......@@ -20,15 +20,8 @@ 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);
......@@ -37,27 +30,6 @@ static inline void WRITEWORD(uint8* p, uint32 v) {
}
#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.
......@@ -230,7 +202,7 @@ void ARGBToRGB565Row_C(const uint8* src_argb, uint8* dst_rgb, int width) {
uint8 g1 = src_argb[5] >> 2;
uint8 r1 = src_argb[6] >> 3;
WRITEWORD(dst_rgb, b0 | (g0 << 5) | (r0 << 11) |
(b1 << 16) | (g1 << 21) | (r1 << 27));
(b1 << 16) | (g1 << 21) | (r1 << 27));
dst_rgb += 4;
src_argb += 8;
}
......@@ -1789,35 +1761,6 @@ 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
......
......@@ -417,7 +417,7 @@ TEST_F(libyuvTest, FMT_PLANAR##To##FMT_B##N) { \
TESTPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \
benchmark_width_, DIFF, _Invert, -, 0, FMT_C, BPP_C) \
TESTPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \
benchmark_width_, DIFF, _Opt, +, 0, FMT_C, BPP_C)
benchmark_width_, DIFF, _Opt, +, 0, FMT_C, BPP_C)
TESTPLANARTOB(I420, 2, 2, ARGB, 4, 4, 2, ARGB, 4)
TESTPLANARTOB(I420, 2, 2, BGRA, 4, 4, 2, ARGB, 4)
......@@ -434,7 +434,6 @@ TESTPLANARTOB(I422, 2, 1, ABGR, 4, 4, 2, ARGB, 4)
TESTPLANARTOB(I422, 2, 1, RGBA, 4, 4, 2, ARGB, 4)
TESTPLANARTOB(I411, 4, 1, ARGB, 4, 4, 2, ARGB, 4)
TESTPLANARTOB(I444, 1, 1, ARGB, 4, 4, 2, ARGB, 4)
TESTPLANARTOB(I420, 2, 2, V210, 16 / 6, 128, 2, UYVY, 2)
TESTPLANARTOB(I420, 2, 2, YUY2, 2, 4, 1, ARGB, 4)
TESTPLANARTOB(I420, 2, 2, UYVY, 2, 4, 1, ARGB, 4)
TESTPLANARTOB(I422, 2, 1, YUY2, 2, 4, 0, ARGB, 4)
......@@ -624,7 +623,6 @@ TESTATOPLANAR(ARGB4444, 2, I420, 2, 2, 17)
TESTATOPLANAR(ARGB, 4, I411, 4, 1, 4)
TESTATOPLANAR(ARGB, 4, I422, 2, 1, 2)
TESTATOPLANAR(ARGB, 4, I444, 1, 1, 2)
TESTATOPLANAR(V210, 16 / 6, I420, 2, 2, 2)
TESTATOPLANAR(YUY2, 2, I420, 2, 2, 2)
TESTATOPLANAR(UYVY, 2, I420, 2, 2, 2)
TESTATOPLANAR(YUY2, 2, I422, 2, 1, 2)
......
......@@ -69,7 +69,6 @@ TEST_F(libyuvTest, TestFourCC) {
EXPECT_TRUE(TestValidFourCC(FOURCC_UYVY, FOURCC_BPP_UYVY));
EXPECT_TRUE(TestValidFourCC(FOURCC_M420, FOURCC_BPP_M420));
EXPECT_TRUE(TestValidFourCC(FOURCC_Q420, FOURCC_BPP_Q420));
EXPECT_TRUE(TestValidFourCC(FOURCC_V210, FOURCC_BPP_V210));
EXPECT_TRUE(TestValidFourCC(FOURCC_ARGB, FOURCC_BPP_ARGB));
EXPECT_TRUE(TestValidFourCC(FOURCC_BGRA, FOURCC_BPP_BGRA));
EXPECT_TRUE(TestValidFourCC(FOURCC_ABGR, FOURCC_BPP_ABGR));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment