From 8a00c2bb4daf016d5111d089335d44eece110ce3 Mon Sep 17 00:00:00 2001 From: Frank Barchard Date: Fri, 9 Feb 2018 12:19:02 -0800 Subject: [PATCH] Tidy applied with all safe checks on all arm, mips and intel, 32 and 64 bit Using clang-tidy 7. warnings=-*,mpi-*,objc-*,llvm-*,hicpp-*,-hicpp-use-noexcept,llvm-*,-hicpp-deprecated-headers,-hicpp-use-auto,bugprone-*,cert-*,google-*,-google-readability-casting,misc-*,,-misc-unused-parameters,-misc-macro-parentheses,cppcoreguidelines-*,-cppcoreguidelines-pro-type-member-init,readability-*,-readability-non-const-parameter,-readability-implicit-bool-conversion,fuchsia-*,-fuchsia-multiple-inheritance,-android-cloexec-* ~/bin/clang-tidy -fix-errors -format-style=file -checks=$warnings $* -- -Iinclude -D__ARM_NEON__ -D__arm__ -D__clang__ -D__clang_major__=6 -DHAVE_JPEG ~/bin/clang-tidy -fix-errors -format-style=file -checks=$warnings $* -- -Iinclude -D__mips_msa -D__clang__ -D__clang_major__=6 -DHAVE_JPEG ~/bin/clang-tidy -fix-errors -format-style=file -checks=$warnings $* -- -Iinclude -D__aarch64__ -D__clang__ -D__clang_major__=6 -DHAVE_JPEG ~/bin/clang-tidy -fix-errors -format-style=file -checks=$warnings $* -- -Iinclude -D_MSC_VER=1600 -D_M_IX86 -D__clang__ -D__clang_major__=6 -DHAVE_JPEG ~/bin/clang-tidy -fix-errors -format-style=file -checks=$warnings $* -- -Iinclude -D_MSC_VER=1600 -D_M_X64 -D__clang__ -D__clang_major__=6 -DHAVE_JPEG ~/bin/clang-tidy -fix-errors -format-style=file -checks=$warnings $* -- -Iinclude -D__i386__ -D__clang__ -D__clang_major__=6 -DHAVE_JPEG ~/bin/clang-tidy -fix-errors -format-style=file -checks=$warnings $* -- -Iinclude -D__x86_64__ -D__clang__ -D__clang_major__=6 -DHAVE_JPEG Bug: libyuv:750 Test: builds and runs and passes more tidy tests Change-Id: Ieb0f026c5b5a1d2daf8aca18b9290927fdaaa55c Reviewed-on: https://chromium-review.googlesource.com/907853 Reviewed-by: Weiyong Yao --- include/libyuv/mjpeg_decoder.h | 12 ++++++------ include/libyuv/row.h | 4 ++-- include/libyuv/version.h | 2 +- source/convert.cc | 5 +++-- source/convert_argb.cc | 5 +++-- source/mjpeg_decoder.cc | 6 +++--- unit_test/planar_test.cc | 2 -- unit_test/video_common_test.cc | 7 ++----- 8 files changed, 20 insertions(+), 23 deletions(-) diff --git a/include/libyuv/mjpeg_decoder.h b/include/libyuv/mjpeg_decoder.h index 275f8d4c1..6c1263338 100644 --- a/include/libyuv/mjpeg_decoder.h +++ b/include/libyuv/mjpeg_decoder.h @@ -168,8 +168,8 @@ class LIBYUV_API MJpegDecoder { int GetComponentScanlinePadding(int component); // A buffer holding the input data for a frame. - Buffer buf_; - BufferVector buf_vec_; + Buffer buf_{}; + BufferVector buf_vec_{}; jpeg_decompress_struct* decompress_struct_; jpeg_source_mgr* source_mgr_; @@ -181,12 +181,12 @@ class LIBYUV_API MJpegDecoder { // Temporaries used to point to scanline outputs. int num_outbufs_; // Outermost size of all arrays below. - uint8_t*** scanlines_; - int* scanlines_sizes_; + uint8_t*** scanlines_{}; + int* scanlines_sizes_{}; // Temporary buffer used for decoding when we can't decode directly to the // output buffers. Large enough for just one iMCU row. - uint8_t** databuf_; - int* databuf_strides_; + uint8_t** databuf_{}; + int* databuf_strides_{}; }; } // namespace libyuv diff --git a/include/libyuv/row.h b/include/libyuv/row.h index a51327468..7a1d4ddca 100644 --- a/include/libyuv/row.h +++ b/include/libyuv/row.h @@ -1445,8 +1445,8 @@ void Convert16To8Row_Any_AVX2(const uint16_t* src_ptr, int scale, int width); -void CopyRow_SSE2(const uint8_t* src, uint8_t* dst, int count); -void CopyRow_AVX(const uint8_t* src, uint8_t* dst, int count); +void CopyRow_SSE2(const uint8_t* src, uint8_t* dst, int width); +void CopyRow_AVX(const uint8_t* src, uint8_t* dst, int width); void CopyRow_ERMS(const uint8_t* src, uint8_t* dst, int width); void CopyRow_NEON(const uint8_t* src, uint8_t* dst, int width); void CopyRow_MIPS(const uint8_t* src, uint8_t* dst, int count); diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 49eb6e60e..683ac0482 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 1697 +#define LIBYUV_VERSION 1698 #endif // INCLUDE_LIBYUV_VERSION_H_ diff --git a/source/convert.cc b/source/convert.cc index b71ba012e..55a2341e6 100644 --- a/source/convert.cc +++ b/source/convert.cc @@ -1709,8 +1709,9 @@ int Android420ToI420(const uint8_t* src_y, CopyPlane(src_v, src_stride_v, dst_v, dst_stride_v, halfwidth, halfheight); return 0; // Split UV planes - NV21 - } else if (src_pixel_stride_uv == 2 && vu_off == -1 && - src_stride_u == src_stride_v) { + } + if (src_pixel_stride_uv == 2 && vu_off == -1 && + src_stride_u == src_stride_v) { SplitUVPlane(src_v, src_stride_v, dst_v, dst_stride_v, dst_u, dst_stride_u, halfwidth, halfheight); return 0; diff --git a/source/convert_argb.cc b/source/convert_argb.cc index 6925414de..d024e1af1 100644 --- a/source/convert_argb.cc +++ b/source/convert_argb.cc @@ -1944,8 +1944,9 @@ int Android420ToARGBMatrix(const uint8_t* src_y, src_stride_v, dst_argb, dst_stride_argb, yuvconstants, width, height); // NV21 - } else if (src_pixel_stride_uv == 2 && vu_off == -1 && - src_stride_u == src_stride_v) { + } + if (src_pixel_stride_uv == 2 && vu_off == -1 && + src_stride_u == src_stride_v) { return NV21ToARGBMatrix(src_y, src_stride_y, src_v, src_stride_v, dst_argb, dst_stride_argb, yuvconstants, width, height); // NV12 diff --git a/source/mjpeg_decoder.cc b/source/mjpeg_decoder.cc index a7f55a9a5..8b0858c7b 100644 --- a/source/mjpeg_decoder.cc +++ b/source/mjpeg_decoder.cc @@ -552,9 +552,9 @@ JpegSubsamplingType MJpegDecoder::JpegSubsamplingTypeHelper( if (subsample_x[0] == 1 && subsample_y[0] == 1 && subsample_x[1] == 2 && subsample_y[1] == 2 && subsample_x[2] == 2 && subsample_y[2] == 2) { return kJpegYuv420; - } else if (subsample_x[0] == 1 && subsample_y[0] == 1 && - subsample_x[1] == 2 && subsample_y[1] == 1 && - subsample_x[2] == 2 && subsample_y[2] == 1) { + } + if (subsample_x[0] == 1 && subsample_y[0] == 1 && subsample_x[1] == 2 && + subsample_y[1] == 1 && subsample_x[2] == 2 && subsample_y[2] == 1) { return kJpegYuv422; } else if (subsample_x[0] == 1 && subsample_y[0] == 1 && subsample_x[1] == 1 && subsample_y[1] == 1 && diff --git a/unit_test/planar_test.cc b/unit_test/planar_test.cc index b52c0f491..9f95941ce 100644 --- a/unit_test/planar_test.cc +++ b/unit_test/planar_test.cc @@ -1192,7 +1192,6 @@ static void TestBlendPlane(int width, free_aligned_buffer_page_end(src_argb_alpha); free_aligned_buffer_page_end(dst_argb_c); free_aligned_buffer_page_end(dst_argb_opt); - return; } TEST_F(LibYUVPlanarTest, BlendPlane_Opt) { @@ -1286,7 +1285,6 @@ static void TestI420Blend(int width, free_aligned_buffer_page_end(dst_y_opt); free_aligned_buffer_page_end(dst_u_opt); free_aligned_buffer_page_end(dst_v_opt); - return; } TEST_F(LibYUVPlanarTest, I420Blend_Opt) { diff --git a/unit_test/video_common_test.cc b/unit_test/video_common_test.cc index 93b159fcc..3de4f4c24 100644 --- a/unit_test/video_common_test.cc +++ b/unit_test/video_common_test.cc @@ -19,11 +19,8 @@ namespace libyuv { // Tests FourCC codes in video common, which are used for ConvertToI420(). static bool TestValidChar(uint32_t onecc) { - if ((onecc >= '0' && onecc <= '9') || (onecc >= 'A' && onecc <= 'Z') || - (onecc >= 'a' && onecc <= 'z') || (onecc == ' ') || (onecc == 0xff)) { - return true; - } - return false; + return (onecc >= '0' && onecc <= '9') || (onecc >= 'A' && onecc <= 'Z') || + (onecc >= 'a' && onecc <= 'z') || (onecc == ' ') || (onecc == 0xff); } static bool TestValidFourCC(uint32_t fourcc, int bpp) {