lint fix test

BUG=none
TEST=gcl lint lintfix2
Review URL: https://webrtc-codereview.appspot.com/458003

git-svn-id: http://libyuv.googlecode.com/svn/trunk@220 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
fbarchard@google.com 2012-03-22 22:36:44 +00:00
parent 8670b1ae04
commit 2b9c210803
17 changed files with 161 additions and 174 deletions

View File

@ -1,6 +1,6 @@
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 219 Version: 220
License: BSD License: BSD
License File: LICENSE License File: LICENSE

View File

@ -11,7 +11,7 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ #ifndef INCLUDE_LIBYUV_VERSION_H_
#define INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 219 #define LIBYUV_VERSION 220
#endif // INCLUDE_LIBYUV_VERSION_H_ #endif // INCLUDE_LIBYUV_VERSION_H_

View File

@ -25,6 +25,7 @@ extern "C" {
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// Definition of FourCC codes // Definition of FourCC codes
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// Convert four characters to a FourCC code. // Convert four characters to a FourCC code.
// Needs to be a macro otherwise the OS X compiler complains when the kFormat* // Needs to be a macro otherwise the OS X compiler complains when the kFormat*
// constants are used in a switch. // constants are used in a switch.

View File

@ -18,7 +18,7 @@
#include "libyuv/basic_types.h" #include "libyuv/basic_types.h"
#include "libyuv/cpu_id.h" #include "libyuv/cpu_id.h"
#include "row.h" #include "source/row.h"
#ifdef __cplusplus #ifdef __cplusplus
namespace libyuv { namespace libyuv {
@ -71,8 +71,7 @@ static uint32 SumSquareError_NEON(const uint8* src_a, const uint8* src_b,
"+r"(count), "+r"(count),
"=r"(sse) "=r"(sse)
: :
: "memory", "cc", "q0", "q1", "q2", "q3", "q7", "q8", "q9", "q10" : "memory", "cc", "q0", "q1", "q2", "q3", "q7", "q8", "q9", "q10");
);
return sse; return sse;
} }

View File

@ -19,7 +19,7 @@
#include "libyuv/planar_functions.h" #include "libyuv/planar_functions.h"
#include "libyuv/rotate.h" #include "libyuv/rotate.h"
#include "libyuv/video_common.h" #include "libyuv/video_common.h"
#include "row.h" #include "source/row.h"
#ifdef __cplusplus #ifdef __cplusplus
namespace libyuv { namespace libyuv {
@ -78,7 +78,7 @@ static void HalfRow_SSE2(const uint8* src_uv, int src_uv_stride,
movdqa xmm0, [eax] movdqa xmm0, [eax]
pavgb xmm0, [eax + edx] pavgb xmm0, [eax + edx]
sub ecx, 16 sub ecx, 16
movdqa [eax + edi], xmm0 movdqa [eax + edi], xmm0 // NOLINT
lea eax, [eax + 16] lea eax, [eax + 16]
jg convertloop jg convertloop
pop edi pop edi
@ -86,7 +86,7 @@ static void HalfRow_SSE2(const uint8* src_uv, int src_uv_stride,
} }
} }
#elif (defined(__x86_64__) || defined(__i386__)) && !defined(YUV_DISABLE_ASM) #elif defined(__x86_64__) || defined(__i386__) && !defined(YUV_DISABLE_ASM)
#define HAS_HALFROW_SSE2 #define HAS_HALFROW_SSE2
static void HalfRow_SSE2(const uint8* src_uv, int src_uv_stride, static void HalfRow_SSE2(const uint8* src_uv, int src_uv_stride,
uint8* dst_uv, int pix) { uint8* dst_uv, int pix) {
@ -137,7 +137,7 @@ int I422ToI420(const uint8* src_y, int src_stride_y,
} }
int halfwidth = (width + 1) >> 1; int halfwidth = (width + 1) >> 1;
void (*HalfRow)(const uint8* src_uv, int src_uv_stride, void (*HalfRow)(const uint8* src_uv, int src_uv_stride,
uint8* dst_uv, int pix); uint8* dst_uv, int pix) = HalfRow_C;
#if defined(HAS_HALFROW_SSE2) #if defined(HAS_HALFROW_SSE2)
if (TestCpuFlag(kCpuHasSSE2) && if (TestCpuFlag(kCpuHasSSE2) &&
IS_ALIGNED(halfwidth, 16) && IS_ALIGNED(halfwidth, 16) &&
@ -146,11 +146,8 @@ int I422ToI420(const uint8* src_y, int src_stride_y,
IS_ALIGNED(dst_u, 16) && IS_ALIGNED(dst_stride_u, 16) && IS_ALIGNED(dst_u, 16) && IS_ALIGNED(dst_stride_u, 16) &&
IS_ALIGNED(dst_v, 16) && IS_ALIGNED(dst_stride_v, 16)) { IS_ALIGNED(dst_v, 16) && IS_ALIGNED(dst_stride_v, 16)) {
HalfRow = HalfRow_SSE2; HalfRow = HalfRow_SSE2;
} else
#endif
{
HalfRow = HalfRow_C;
} }
#endif
// Copy Y plane // Copy Y plane
if (dst_y) { if (dst_y) {
@ -186,7 +183,7 @@ int I422ToI420(const uint8* src_y, int src_stride_y,
#define HAS_SCALEROWDOWN2_NEON #define HAS_SCALEROWDOWN2_NEON
void ScaleRowDown2Int_NEON(const uint8* src_ptr, int src_stride, void ScaleRowDown2Int_NEON(const uint8* src_ptr, int src_stride,
uint8* dst, int dst_width); uint8* dst, int dst_width);
#elif (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) && \ #elif defined(_M_IX86) || defined(__x86_64__) || defined(__i386__) && \
!defined(YUV_DISABLE_ASM) !defined(YUV_DISABLE_ASM)
void ScaleRowDown2Int_SSE2(const uint8* src_ptr, int src_stride, void ScaleRowDown2Int_SSE2(const uint8* src_ptr, int src_stride,
uint8* dst_ptr, int dst_width); uint8* dst_ptr, int dst_width);
@ -213,14 +210,13 @@ int I444ToI420(const uint8* src_y, int src_stride_y,
} }
int halfwidth = (width + 1) >> 1; int halfwidth = (width + 1) >> 1;
void (*ScaleRowDown2)(const uint8* src_ptr, int src_stride, void (*ScaleRowDown2)(const uint8* src_ptr, int src_stride,
uint8* dst_ptr, int dst_width); uint8* dst_ptr, int dst_width) = ScaleRowDown2Int_C;
#if defined(HAS_SCALEROWDOWN2_NEON) #if defined(HAS_SCALEROWDOWN2_NEON)
if (TestCpuFlag(kCpuHasNEON) && if (TestCpuFlag(kCpuHasNEON) &&
IS_ALIGNED(halfwidth, 16)) { IS_ALIGNED(halfwidth, 16)) {
ScaleRowDown2 = ScaleRowDown2Int_NEON; ScaleRowDown2 = ScaleRowDown2Int_NEON;
} else }
#endif #elif defined(HAS_SCALEROWDOWN2_SSE2)
#if defined(HAS_SCALEROWDOWN2_SSE2)
if (TestCpuFlag(kCpuHasSSE2) && if (TestCpuFlag(kCpuHasSSE2) &&
IS_ALIGNED(halfwidth, 16) && IS_ALIGNED(halfwidth, 16) &&
IS_ALIGNED(src_u, 16) && IS_ALIGNED(src_stride_u, 16) && IS_ALIGNED(src_u, 16) && IS_ALIGNED(src_stride_u, 16) &&
@ -228,10 +224,8 @@ int I444ToI420(const uint8* src_y, int src_stride_y,
IS_ALIGNED(dst_u, 16) && IS_ALIGNED(dst_stride_u, 16) && IS_ALIGNED(dst_u, 16) && IS_ALIGNED(dst_stride_u, 16) &&
IS_ALIGNED(dst_v, 16) && IS_ALIGNED(dst_stride_v, 16)) { IS_ALIGNED(dst_v, 16) && IS_ALIGNED(dst_stride_v, 16)) {
ScaleRowDown2 = ScaleRowDown2Int_SSE2; ScaleRowDown2 = ScaleRowDown2Int_SSE2;
#endif
{
ScaleRowDown2 = ScaleRowDown2Int_C;
} }
#endif
// Copy Y plane // Copy Y plane
if (dst_y) { if (dst_y) {
@ -395,11 +389,12 @@ static int X420ToI420(const uint8* src_y,
} }
int halfwidth = (width + 1) >> 1; int halfwidth = (width + 1) >> 1;
void (*SplitUV)(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix); void (*SplitUV)(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix) =
SplitUV_C;
#if defined(HAS_SPLITUV_NEON) #if defined(HAS_SPLITUV_NEON)
if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(halfwidth, 16)) { if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(halfwidth, 16)) {
SplitUV = SplitUV_NEON; SplitUV = SplitUV_NEON;
} else }
#elif defined(HAS_SPLITUV_SSE2) #elif defined(HAS_SPLITUV_SSE2)
if (TestCpuFlag(kCpuHasSSE2) && if (TestCpuFlag(kCpuHasSSE2) &&
IS_ALIGNED(halfwidth, 16) && IS_ALIGNED(halfwidth, 16) &&
@ -407,11 +402,8 @@ static int X420ToI420(const uint8* src_y,
IS_ALIGNED(dst_u, 16) && IS_ALIGNED(dst_stride_u, 16) && IS_ALIGNED(dst_u, 16) && IS_ALIGNED(dst_stride_u, 16) &&
IS_ALIGNED(dst_v, 16) && IS_ALIGNED(dst_stride_v, 16)) { IS_ALIGNED(dst_v, 16) && IS_ALIGNED(dst_stride_v, 16)) {
SplitUV = SplitUV_SSE2; SplitUV = SplitUV_SSE2;
} else
#endif
{
SplitUV = SplitUV_C;
} }
#endif
if (dst_y) { if (dst_y) {
CopyPlane2(src_y, src_stride_y0, src_stride_y1, dst_y, dst_stride_y, CopyPlane2(src_y, src_stride_y0, src_stride_y1, dst_y, dst_stride_y,
@ -483,7 +475,7 @@ static void SplitYUY2_SSE2(const uint8* src_yuy2,
pand xmm2, xmm5 // even bytes are Y pand xmm2, xmm5 // even bytes are Y
pand xmm3, xmm5 pand xmm3, xmm5
packuswb xmm2, xmm3 packuswb xmm2, xmm3
movdqa [edx], xmm2 movdqa [edx], xmm2 // NOLINT
lea edx, [edx + 16] lea edx, [edx + 16]
psrlw xmm0, 8 // YUYV -> UVUV psrlw xmm0, 8 // YUYV -> UVUV
psrlw xmm1, 8 psrlw xmm1, 8
@ -491,12 +483,12 @@ static void SplitYUY2_SSE2(const uint8* src_yuy2,
movdqa xmm1, xmm0 movdqa xmm1, xmm0
pand xmm0, xmm5 // U pand xmm0, xmm5 // U
packuswb xmm0, xmm0 packuswb xmm0, xmm0
movq qword ptr [esi], xmm0 movq qword ptr [esi], xmm0 // NOLINT
lea esi, [esi + 8] lea esi, [esi + 8]
psrlw xmm1, 8 // V psrlw xmm1, 8 // V
packuswb xmm1, xmm1 packuswb xmm1, xmm1
sub ecx, 16 sub ecx, 16
movq qword ptr [edi], xmm1 movq qword ptr [edi], xmm1 // NOLINT
lea edi, [edi + 8] lea edi, [edi + 8]
jg convertloop jg convertloop
@ -506,7 +498,7 @@ static void SplitYUY2_SSE2(const uint8* src_yuy2,
} }
} }
#elif (defined(__x86_64__) || defined(__i386__)) && !defined(YUV_DISABLE_ASM) #elif defined(__x86_64__) || defined(__i386__) && !defined(YUV_DISABLE_ASM)
#define HAS_SPLITYUY2_SSE2 #define HAS_SPLITYUY2_SSE2
static void SplitYUY2_SSE2(const uint8* src_yuy2, uint8* dst_y, static void SplitYUY2_SSE2(const uint8* src_yuy2, uint8* dst_y,
uint8* dst_u, uint8* dst_v, int pix) { uint8* dst_u, uint8* dst_v, int pix) {
@ -604,19 +596,17 @@ int Q420ToI420(const uint8* src_y, int src_stride_y,
} }
#endif #endif
void (*SplitYUY2)(const uint8* src_yuy2, void (*SplitYUY2)(const uint8* src_yuy2, uint8* dst_y, uint8* dst_u,
uint8* dst_y, uint8* dst_u, uint8* dst_v, int pix); uint8* dst_v, int pix) = SplitYUY2_C;
#if defined(HAS_SPLITYUY2_SSE2) #if defined(HAS_SPLITYUY2_SSE2)
if (TestCpuFlag(kCpuHasSSE2) && if (TestCpuFlag(kCpuHasSSE2) &&
IS_ALIGNED(width, 16) && IS_ALIGNED(width, 16) &&
IS_ALIGNED(src_yuy2, 16) && IS_ALIGNED(src_stride_yuy2, 16) && IS_ALIGNED(src_yuy2, 16) && IS_ALIGNED(src_stride_yuy2, 16) &&
IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) { IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) {
SplitYUY2 = SplitYUY2_SSE2; SplitYUY2 = SplitYUY2_SSE2;
} else
#endif
{
SplitYUY2 = SplitYUY2_C;
} }
#endif
for (int y = 0; y < height; y += 2) { for (int y = 0; y < height; y += 2) {
CopyRow(src_y, dst_y, width); CopyRow(src_y, dst_y, width);
dst_y += dst_stride_y; dst_y += dst_stride_y;
@ -800,13 +790,13 @@ int UYVYToI420(const uint8* src_uyvy, int src_stride_uyvy,
#endif #endif
#ifdef LIBYUV_LITTLE_ENDIAN #ifdef LIBYUV_LITTLE_ENDIAN
#define READWORD(p) (*((uint32*) (p))) #define READWORD(p) (*reinterpret_cast<const uint32*>(p))
#else #else
static inline uint32 READWORD(const uint8* p) { static inline uint32 READWORD(const uint8* p) {
return (uint32) p[0] | return static_cast<uint32>(p[0]) |
((uint32) (p[1]) << 8) | (static_cast<uint32>(p[1]) << 8) |
((uint32) (p[2]) << 16) | (static_cast<uint32>(p[2]) << 16) |
((uint32) (p[3]) << 24); (static_cast<uint32>(p[3]) << 24);
} }
#endif #endif
@ -1599,7 +1589,7 @@ int ConvertToI420(const uint8* sample, size_t sample_size,
int tmp_y_stride = y_stride; int tmp_y_stride = y_stride;
int tmp_u_stride = u_stride; int tmp_u_stride = u_stride;
int tmp_v_stride = v_stride; int tmp_v_stride = v_stride;
uint8* buf = 0; uint8* buf = NULL;
int abs_dst_height = (dst_height < 0) ? -dst_height : dst_height; int abs_dst_height = (dst_height < 0) ? -dst_height : dst_height;
if (need_rot) { if (need_rot) {
int y_size = dst_width * abs_dst_height; int y_size = dst_width * abs_dst_height;

View File

@ -17,7 +17,7 @@
#include "libyuv/planar_functions.h" #include "libyuv/planar_functions.h"
#include "libyuv/rotate.h" #include "libyuv/rotate.h"
#include "libyuv/video_common.h" #include "libyuv/video_common.h"
#include "row.h" #include "source/row.h"
#ifdef __cplusplus #ifdef __cplusplus
namespace libyuv { namespace libyuv {

View File

@ -29,16 +29,14 @@ static __inline void __cpuid(int cpu_info[4], int info_type) {
"cpuid \n" "cpuid \n"
"xchg %%edi, %%ebx \n" "xchg %%edi, %%ebx \n"
: "=a"(cpu_info[0]), "=D"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3]) : "=a"(cpu_info[0]), "=D"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3])
: "a"(info_type) : "a"(info_type));
);
} }
#elif defined(__i386__) || defined(__x86_64__) #elif defined(__i386__) || defined(__x86_64__)
static __inline void __cpuid(int cpu_info[4], int info_type) { static __inline void __cpuid(int cpu_info[4], int info_type) {
asm volatile( asm volatile(
"cpuid \n" "cpuid \n"
: "=a"(cpu_info[0]), "=b"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3]) : "=a"(cpu_info[0]), "=b"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3])
: "a"(info_type) : "a"(info_type));
);
} }
#endif #endif

View File

@ -13,7 +13,7 @@
#include "libyuv/basic_types.h" #include "libyuv/basic_types.h"
#include "libyuv/cpu_id.h" #include "libyuv/cpu_id.h"
#include "libyuv/video_common.h" #include "libyuv/video_common.h"
#include "row.h" #include "source/row.h"
#ifdef __cplusplus #ifdef __cplusplus
namespace libyuv { namespace libyuv {

View File

@ -13,7 +13,7 @@
#include <string.h> // for memset() #include <string.h> // for memset()
#include "libyuv/cpu_id.h" #include "libyuv/cpu_id.h"
#include "row.h" #include "source/row.h"
#ifdef __cplusplus #ifdef __cplusplus
namespace libyuv { namespace libyuv {

View File

@ -13,8 +13,8 @@
#include "libyuv/cpu_id.h" #include "libyuv/cpu_id.h"
#include "libyuv/convert.h" #include "libyuv/convert.h"
#include "libyuv/planar_functions.h" #include "libyuv/planar_functions.h"
#include "rotate_priv.h" #include "source/rotate_priv.h"
#include "row.h" #include "source/row.h"
#ifdef __cplusplus #ifdef __cplusplus
namespace libyuv { namespace libyuv {

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include "row.h" #include "source/row.h"
#include "libyuv/basic_types.h" #include "libyuv/basic_types.h"

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include "row.h" #include "source/row.h"
#include "libyuv/basic_types.h" #include "libyuv/basic_types.h"
#include <string.h> // For memcpy #include <string.h> // For memcpy

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include "row.h" #include "source/row.h"
#ifdef __cplusplus #ifdef __cplusplus
namespace libyuv { namespace libyuv {

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include "row.h" #include "source/row.h"
#include "libyuv/basic_types.h" #include "libyuv/basic_types.h"

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include "row.h" #include "source/row.h"
#if defined(_M_IX86) #if defined(_M_IX86)
#include "emmintrin.h" #include "emmintrin.h"

View File

@ -16,7 +16,7 @@
#include "libyuv/cpu_id.h" #include "libyuv/cpu_id.h"
#include "libyuv/planar_functions.h" // For CopyPlane #include "libyuv/planar_functions.h" // For CopyPlane
#include "row.h" #include "source/row.h"
#ifdef __cplusplus #ifdef __cplusplus
namespace libyuv { namespace libyuv {

View File

@ -8,12 +8,11 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include "unit_test.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include "unit_test/unit_test.h"
#include "libyuv/basic_types.h" #include "libyuv/basic_types.h"
#include "libyuv/compare.h" #include "libyuv/compare.h"
#include "libyuv/cpu_id.h" #include "libyuv/cpu_id.h"
@ -153,7 +152,7 @@ TEST_F(libyuvTest, BenchmarkPsnr_C) {
_benchmark_width, _benchmark_height); _benchmark_width, _benchmark_height);
c_time = (get_time() - c_time) / _benchmark_iterations; c_time = (get_time() - c_time) / _benchmark_iterations;
printf ("BenchmarkPsnr_C - %8d us c\n", (int)(c_time*1e6)); printf("BenchmarkPsnr_C - %8.2f us c\n", c_time * 1e6);
MaskCpuFlags(-1); MaskCpuFlags(-1);
@ -176,7 +175,7 @@ TEST_F(libyuvTest, BenchmarkPsnr_OPT) {
_benchmark_width, _benchmark_height); _benchmark_width, _benchmark_height);
opt_time = (get_time() - opt_time) / _benchmark_iterations; opt_time = (get_time() - opt_time) / _benchmark_iterations;
printf ("BenchmarkPsnr_OPT - %8d us opt\n", (int)(opt_time*1e6)); printf("BenchmarkPsnr_OPT - %8.2f us opt\n", opt_time * 1e6);
EXPECT_EQ(0, 0); EXPECT_EQ(0, 0);
@ -274,7 +273,7 @@ TEST_F(libyuvTest, BenchmarkSsim_C) {
_benchmark_width, _benchmark_height); _benchmark_width, _benchmark_height);
c_time = (get_time() - c_time) / _benchmark_iterations; c_time = (get_time() - c_time) / _benchmark_iterations;
printf ("BenchmarkSsim_C - %8d us c\n", (int)(c_time*1e6)); printf("BenchmarkSsim_C - %8.2f us c\n", c_time * 1e6);
MaskCpuFlags(-1); MaskCpuFlags(-1);
@ -297,7 +296,7 @@ TEST_F(libyuvTest, BenchmarkSsim_OPT) {
_benchmark_width, _benchmark_height); _benchmark_width, _benchmark_height);
opt_time = (get_time() - opt_time) / _benchmark_iterations; opt_time = (get_time() - opt_time) / _benchmark_iterations;
printf ("BenchmarkPsnr_OPT - %8d us opt\n", (int)(opt_time*1e6)); printf("BenchmarkPsnr_OPT - %8.2f us opt\n", opt_time * 1e6);
EXPECT_EQ(0, 0); EXPECT_EQ(0, 0);