From 5ab38f925838bedc13c88536522e0be3c6374527 Mon Sep 17 00:00:00 2001 From: "fbarchard@google.com" Date: Wed, 11 Feb 2015 18:20:54 +0000 Subject: [PATCH] Remove Q420 fourcc support. BUG=396 TESTED=local build of unittest builds and passes R=harryjin@google.com Review URL: https://webrtc-codereview.appspot.com/39089004 git-svn-id: http://libyuv.googlecode.com/svn/trunk@1278 16f28f9a-4ce2-e073-06de-1de4eb20be90 --- include/libyuv/convert.h | 9 --- include/libyuv/convert_argb.h | 8 --- include/libyuv/convert_from.h | 1 - include/libyuv/video_common.h | 2 +- source/convert.cc | 108 --------------------------------- source/convert_from.cc | 2 +- source/convert_to_argb.cc | 9 --- source/convert_to_i420.cc | 11 ---- unit_test/video_common_test.cc | 2 +- 9 files changed, 3 insertions(+), 149 deletions(-) diff --git a/include/libyuv/convert.h b/include/libyuv/convert.h index a9230c273..97936adb2 100644 --- a/include/libyuv/convert.h +++ b/include/libyuv/convert.h @@ -113,15 +113,6 @@ int M420ToI420(const uint8* src_m420, int src_stride_m420, uint8* dst_v, int dst_stride_v, int width, int height); -// Convert Q420 to I420. -LIBYUV_API -int Q420ToI420(const uint8* src_y, int src_stride_y, - const uint8* src_yuy2, int src_stride_yuy2, - 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, diff --git a/include/libyuv/convert_argb.h b/include/libyuv/convert_argb.h index 89124ebb4..a0de89efd 100644 --- a/include/libyuv/convert_argb.h +++ b/include/libyuv/convert_argb.h @@ -18,7 +18,6 @@ #include "libyuv/rotate.h" // TODO(fbarchard): This set of functions should exactly match convert.h -// 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. @@ -104,13 +103,6 @@ int M420ToARGB(const uint8* src_m420, int src_stride_m420, uint8* dst_argb, int dst_stride_argb, int width, int height); -// TODO(fbarchard): Convert Q420 to ARGB. -// LIBYUV_API -// int Q420ToARGB(const uint8* src_y, int src_stride_y, -// const uint8* src_yuy2, int src_stride_yuy2, -// uint8* dst_argb, int dst_stride_argb, -// int width, int height); - // Convert YUY2 to ARGB. LIBYUV_API int YUY2ToARGB(const uint8* src_yuy2, int src_stride_yuy2, diff --git a/include/libyuv/convert_from.h b/include/libyuv/convert_from.h index 447a6a725..d6c0e3d87 100644 --- a/include/libyuv/convert_from.h +++ b/include/libyuv/convert_from.h @@ -57,7 +57,6 @@ int I400Copy(const uint8* src_y, int src_stride_y, int width, int height); // TODO(fbarchard): I420ToM420 -// TODO(fbarchard): I420ToQ420 LIBYUV_API int I420ToNV12(const uint8* src_y, int src_stride_y, diff --git a/include/libyuv/video_common.h b/include/libyuv/video_common.h index a2d88f9ee..cb6582f24 100644 --- a/include/libyuv/video_common.h +++ b/include/libyuv/video_common.h @@ -62,7 +62,7 @@ enum FourCC { // 2 Secondary YUV formats: row biplanar. FOURCC_M420 = FOURCC('M', '4', '2', '0'), - FOURCC_Q420 = FOURCC('Q', '4', '2', '0'), + FOURCC_Q420 = FOURCC('Q', '4', '2', '0'), // deprecated. // 9 Primary RGB formats: 4 32 bpp, 2 24 bpp, 3 16 bpp. FOURCC_ARGB = FOURCC('A', 'R', 'G', 'B'), diff --git a/source/convert.cc b/source/convert.cc index 5f58f55af..41696c18f 100644 --- a/source/convert.cc +++ b/source/convert.cc @@ -381,114 +381,6 @@ int M420ToI420(const uint8* src_m420, int src_stride_m420, width, height); } -// Convert Q420 to I420. -// Format is rows of YY/YUYV -LIBYUV_API -int Q420ToI420(const uint8* src_y, int src_stride_y, - const uint8* src_yuy2, int src_stride_yuy2, - 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; - int halfheight; - void (*CopyRow)(const uint8* src, uint8* dst, int width) = CopyRow_C; - void (*YUY2ToUV422Row)(const uint8* src_yuy2, uint8* dst_u, uint8* dst_v, - int pix) = YUY2ToUV422Row_C; - void (*YUY2ToYRow)(const uint8* src_yuy2, uint8* dst_y, int pix) = - YUY2ToYRow_C; - if (!src_y || !src_yuy2 || - !dst_y || !dst_u || !dst_v || - width <= 0 || height == 0) { - return -1; - } - // Negative height means invert the image. - if (height < 0) { - height = -height; - halfheight = (height + 1) >> 1; - dst_y = dst_y + (height - 1) * dst_stride_y; - dst_u = dst_u + (halfheight - 1) * dst_stride_u; - dst_v = dst_v + (halfheight - 1) * dst_stride_v; - dst_stride_y = -dst_stride_y; - dst_stride_u = -dst_stride_u; - dst_stride_v = -dst_stride_v; - } - // CopyRow for rows of just Y in Q420 copied to Y plane of I420. -#if defined(HAS_COPYROW_SSE2) - if (TestCpuFlag(kCpuHasSSE2)) { - CopyRow = IS_ALIGNED(width, 32) ? CopyRow_SSE2 : CopyRow_Any_SSE2; - } -#endif -#if defined(HAS_COPYROW_AVX) - if (TestCpuFlag(kCpuHasAVX)) { - CopyRow = IS_ALIGNED(width, 64) ? CopyRow_AVX : CopyRow_Any_AVX; - } -#endif -#if defined(HAS_COPYROW_ERMS) - if (TestCpuFlag(kCpuHasERMS)) { - CopyRow = CopyRow_ERMS; - } -#endif -#if defined(HAS_COPYROW_NEON) - if (TestCpuFlag(kCpuHasNEON)) { - CopyRow = IS_ALIGNED(width, 32) ? CopyRow_NEON : CopyRow_Any_NEON; - } -#endif -#if defined(HAS_COPYROW_MIPS) - if (TestCpuFlag(kCpuHasMIPS)) { - CopyRow = CopyRow_MIPS; - } -#endif -#if defined(HAS_YUY2TOYROW_SSE2) - if (TestCpuFlag(kCpuHasSSE2)) { - YUY2ToUV422Row = YUY2ToUV422Row_Any_SSE2; - YUY2ToYRow = YUY2ToYRow_Any_SSE2; - if (IS_ALIGNED(width, 16)) { - YUY2ToUV422Row = YUY2ToUV422Row_SSE2; - YUY2ToYRow = YUY2ToYRow_SSE2; - } - } -#endif -#if defined(HAS_YUY2TOYROW_AVX2) - if (TestCpuFlag(kCpuHasAVX2)) { - YUY2ToUV422Row = YUY2ToUV422Row_Any_AVX2; - YUY2ToYRow = YUY2ToYRow_Any_AVX2; - if (IS_ALIGNED(width, 32)) { - YUY2ToUV422Row = YUY2ToUV422Row_AVX2; - YUY2ToYRow = YUY2ToYRow_AVX2; - } - } -#endif -#if defined(HAS_YUY2TOYROW_NEON) - if (TestCpuFlag(kCpuHasNEON)) { - YUY2ToYRow = YUY2ToYRow_Any_NEON; - YUY2ToUV422Row = YUY2ToUV422Row_Any_NEON; - if (IS_ALIGNED(width, 16)) { - YUY2ToYRow = YUY2ToYRow_NEON; - YUY2ToUV422Row = YUY2ToUV422Row_NEON; - } - } -#endif - - for (y = 0; y < height - 1; y += 2) { - CopyRow(src_y, dst_y, width); - src_y += src_stride_y; - dst_y += dst_stride_y; - - YUY2ToUV422Row(src_yuy2, dst_u, dst_v, width); - YUY2ToYRow(src_yuy2, dst_y, width); - src_yuy2 += src_stride_yuy2; - dst_y += dst_stride_y; - dst_u += dst_stride_u; - dst_v += dst_stride_v; - } - if (height & 1) { - CopyRow(src_y, dst_y, width); - YUY2ToUV422Row(src_yuy2, dst_u, dst_v, width); - } - return 0; -} - // Convert YUY2 to I420. LIBYUV_API int YUY2ToI420(const uint8* src_yuy2, int src_stride_yuy2, diff --git a/source/convert_from.cc b/source/convert_from.cc index d11449cdc..cfe37bf97 100644 --- a/source/convert_from.cc +++ b/source/convert_from.cc @@ -1103,7 +1103,7 @@ int ConvertFromI420(const uint8* y, int y_stride, width, height); break; } - // TODO(fbarchard): Add M420 and Q420. + // TODO(fbarchard): Add M420. // Triplanar formats // TODO(fbarchard): halfstride instead of halfwidth case FOURCC_I420: diff --git a/source/convert_to_argb.cc b/source/convert_to_argb.cc index c93182daf..af829fbd3 100644 --- a/source/convert_to_argb.cc +++ b/source/convert_to_argb.cc @@ -174,15 +174,6 @@ int ConvertToARGB(const uint8* sample, size_t sample_size, crop_argb, argb_stride, crop_width, inv_crop_height); break; -// case FOURCC_Q420: -// src = sample + (src_width + aligned_src_width * 2) * crop_y + crop_x; -// src_uv = sample + (src_width + aligned_src_width * 2) * crop_y + -// src_width + crop_x * 2; -// r = Q420ToARGB(src, src_width * 3, -// src_uv, src_width * 3, -// crop_argb, argb_stride, -// crop_width, inv_crop_height); -// break; // Triplanar formats case FOURCC_I420: case FOURCC_YU12: diff --git a/source/convert_to_i420.cc b/source/convert_to_i420.cc index ab25f5abf..5e75369b5 100644 --- a/source/convert_to_i420.cc +++ b/source/convert_to_i420.cc @@ -212,17 +212,6 @@ int ConvertToI420(const uint8* sample, v, v_stride, crop_width, inv_crop_height); break; - case FOURCC_Q420: - src = sample + (src_width + aligned_src_width * 2) * crop_y + crop_x; - src_uv = sample + (src_width + aligned_src_width * 2) * crop_y + - src_width + crop_x * 2; - r = Q420ToI420(src, src_width * 3, - src_uv, src_width * 3, - y, y_stride, - u, u_stride, - v, v_stride, - crop_width, inv_crop_height); - break; // Triplanar formats case FOURCC_I420: case FOURCC_YU12: diff --git a/unit_test/video_common_test.cc b/unit_test/video_common_test.cc index acfb782ee..5c2f7e1a8 100644 --- a/unit_test/video_common_test.cc +++ b/unit_test/video_common_test.cc @@ -72,7 +72,7 @@ TEST_F(libyuvTest, TestFourCC) { EXPECT_TRUE(TestValidFourCC(FOURCC_YUY2, FOURCC_BPP_YUY2)); 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_Q420, FOURCC_BPP_Q420)); // deprecated. EXPECT_TRUE(TestValidFourCC(FOURCC_ARGB, FOURCC_BPP_ARGB)); EXPECT_TRUE(TestValidFourCC(FOURCC_BGRA, FOURCC_BPP_BGRA)); EXPECT_TRUE(TestValidFourCC(FOURCC_ABGR, FOURCC_BPP_ABGR));