Commit 3cf056f8 authored by Frank Barchard's avatar Frank Barchard Committed by Commit Bot

clang-format for align_buffer_page_end and free_aligned_buffer_page_end

clang-format does nested indents for macros that dont end with ;
example:
  align_buffer_page_end(dst_y_8, dst_y_plane_size)
      align_buffer_page_end(dst_u_8, dst_uv_plane_size)
          align_buffer_page_end(dst_v_8, dst_uv_plane_size)
              align_buffer_page_end(dst_y_16, dst_y_plane_size * 2)
                  align_buffer_page_end(dst_u_16, dst_uv_plane_size * 2)
                      align_buffer_page_end(dst_v_16, dst_uv_plane_size * 2)

use a similar allocator to the one used within libyuv in row.h which makes the caller add ;
  align_buffer_page_end(dst_y_8, dst_y_plane_size);
  align_buffer_page_end(dst_u_8, dst_uv_plane_size);
  align_buffer_page_end(dst_v_8, dst_uv_plane_size);
  align_buffer_page_end(dst_y_16, dst_y_plane_size * 2);
  align_buffer_page_end(dst_u_16, dst_uv_plane_size * 2);
  align_buffer_page_end(dst_v_16, dst_uv_plane_size * 2);

Bug: libyuv:758
Test: try bots
Change-Id: I4a0770707e7053e094a37bbfc3c5884d5663d078
Reviewed-on: https://chromium-review.googlesource.com/762757Reviewed-by: 's avatarPatrik Höglund <phoglund@chromium.org>
Reviewed-by: 's avatarFrank Barchard <fbarchard@google.com>
Commit-Queue: Frank Barchard <fbarchard@google.com>
parent 49d1e3b0
...@@ -45,9 +45,10 @@ static int TestFilter(int src_width, ...@@ -45,9 +45,10 @@ static int TestFilter(int src_width,
int src_stride_y = b * 2 + Abs(src_width); int src_stride_y = b * 2 + Abs(src_width);
int src_stride_uv = b * 2 + src_width_uv; int src_stride_uv = b * 2 + src_width_uv;
align_buffer_page_end(src_y, src_y_plane_size) align_buffer_page_end(src_y, src_y_plane_size);
align_buffer_page_end(src_u, src_uv_plane_size) align_buffer_page_end( align_buffer_page_end(src_u, src_uv_plane_size);
src_v, src_uv_plane_size) if (!src_y || !src_u || !src_v) { align_buffer_page_end(src_v, src_uv_plane_size);
if (!src_y || !src_u || !src_v) {
printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n"); printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
return 0; return 0;
} }
...@@ -64,16 +65,14 @@ static int TestFilter(int src_width, ...@@ -64,16 +65,14 @@ static int TestFilter(int src_width,
int dst_stride_y = b * 2 + dst_width; int dst_stride_y = b * 2 + dst_width;
int dst_stride_uv = b * 2 + dst_width_uv; int dst_stride_uv = b * 2 + dst_width_uv;
align_buffer_page_end(dst_y_c, dst_y_plane_size) align_buffer_page_end(dst_y_c, dst_y_plane_size);
align_buffer_page_end(dst_u_c, dst_uv_plane_size) align_buffer_page_end(dst_u_c, dst_uv_plane_size);
align_buffer_page_end(dst_v_c, dst_uv_plane_size) align_buffer_page_end(dst_v_c, dst_uv_plane_size);
align_buffer_page_end(dst_y_opt, dst_y_plane_size) align_buffer_page_end(dst_y_opt, dst_y_plane_size);
align_buffer_page_end(dst_u_opt, dst_uv_plane_size) align_buffer_page_end(dst_u_opt, dst_uv_plane_size);
align_buffer_page_end( align_buffer_page_end(dst_v_opt, dst_uv_plane_size);
dst_v_opt, if (!dst_y_c || !dst_u_c || !dst_v_c || !dst_y_opt || !dst_u_opt ||
dst_uv_plane_size) if (!dst_y_c || !dst_u_c || !dst_v_opt) {
!dst_v_c || !dst_y_opt ||
!dst_u_opt || !dst_v_opt) {
printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n"); printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
return 0; return 0;
} }
...@@ -135,17 +134,17 @@ static int TestFilter(int src_width, ...@@ -135,17 +134,17 @@ static int TestFilter(int src_width,
} }
} }
free_aligned_buffer_page_end(dst_y_c) free_aligned_buffer_page_end(dst_u_c) free_aligned_buffer_page_end(dst_y_c);
free_aligned_buffer_page_end(dst_v_c) free_aligned_buffer_page_end(dst_u_c);
free_aligned_buffer_page_end(dst_y_opt) free_aligned_buffer_page_end(dst_v_c);
free_aligned_buffer_page_end(dst_u_opt) free_aligned_buffer_page_end(dst_y_opt);
free_aligned_buffer_page_end(dst_v_opt) free_aligned_buffer_page_end(dst_u_opt);
free_aligned_buffer_page_end(dst_v_opt);
free_aligned_buffer_page_end(src_y) free_aligned_buffer_page_end(src_y);
free_aligned_buffer_page_end(src_u) free_aligned_buffer_page_end(src_u);
free_aligned_buffer_page_end(src_v) free_aligned_buffer_page_end(src_v);
return max_diff; return max_diff;
} }
// Test scaling with 8 bit C vs 16 bit C and return maximum pixel difference. // Test scaling with 8 bit C vs 16 bit C and return maximum pixel difference.
...@@ -171,12 +170,13 @@ static int TestFilter_16(int src_width, ...@@ -171,12 +170,13 @@ static int TestFilter_16(int src_width,
int src_stride_y = b * 2 + Abs(src_width); int src_stride_y = b * 2 + Abs(src_width);
int src_stride_uv = b * 2 + src_width_uv; int src_stride_uv = b * 2 + src_width_uv;
align_buffer_page_end(src_y, src_y_plane_size) align_buffer_page_end( align_buffer_page_end(src_y, src_y_plane_size);
src_u, src_uv_plane_size) align_buffer_page_end(src_v, src_uv_plane_size) align_buffer_page_end(src_u, src_uv_plane_size);
align_buffer_page_end(src_y_16, src_y_plane_size * 2) align_buffer_page_end(src_v, src_uv_plane_size);
align_buffer_page_end(src_u_16, src_uv_plane_size * 2) align_buffer_page_end(src_y_16, src_y_plane_size * 2);
align_buffer_page_end(src_v_16, src_uv_plane_size * 2) align_buffer_page_end(src_u_16, src_uv_plane_size * 2);
uint16* p_src_y_16 = reinterpret_cast<uint16*>(src_y_16); align_buffer_page_end(src_v_16, src_uv_plane_size * 2);
uint16* p_src_y_16 = reinterpret_cast<uint16*>(src_y_16);
uint16* p_src_u_16 = reinterpret_cast<uint16*>(src_u_16); uint16* p_src_u_16 = reinterpret_cast<uint16*>(src_u_16);
uint16* p_src_v_16 = reinterpret_cast<uint16*>(src_v_16); uint16* p_src_v_16 = reinterpret_cast<uint16*>(src_v_16);
...@@ -206,15 +206,14 @@ static int TestFilter_16(int src_width, ...@@ -206,15 +206,14 @@ static int TestFilter_16(int src_width,
int dst_stride_y = b * 2 + dst_width; int dst_stride_y = b * 2 + dst_width;
int dst_stride_uv = b * 2 + dst_width_uv; int dst_stride_uv = b * 2 + dst_width_uv;
align_buffer_page_end(dst_y_8, dst_y_plane_size) align_buffer_page_end(dst_y_8, dst_y_plane_size);
align_buffer_page_end(dst_u_8, dst_uv_plane_size) align_buffer_page_end(dst_u_8, dst_uv_plane_size);
align_buffer_page_end(dst_v_8, dst_uv_plane_size) align_buffer_page_end(dst_v_8, dst_uv_plane_size);
align_buffer_page_end(dst_y_16, dst_y_plane_size * 2) align_buffer_page_end(dst_y_16, dst_y_plane_size * 2);
align_buffer_page_end(dst_u_16, dst_uv_plane_size * 2) align_buffer_page_end(dst_u_16, dst_uv_plane_size * 2);
align_buffer_page_end(dst_v_16, dst_uv_plane_size * 2) align_buffer_page_end(dst_v_16, dst_uv_plane_size * 2);
uint16* p_dst_y_16 = uint16* p_dst_y_16 = reinterpret_cast<uint16*>(dst_y_16);
reinterpret_cast<uint16*>(dst_y_16);
uint16* p_dst_u_16 = reinterpret_cast<uint16*>(dst_u_16); uint16* p_dst_u_16 = reinterpret_cast<uint16*>(dst_u_16);
uint16* p_dst_v_16 = reinterpret_cast<uint16*>(dst_v_16); uint16* p_dst_v_16 = reinterpret_cast<uint16*>(dst_v_16);
...@@ -263,20 +262,20 @@ static int TestFilter_16(int src_width, ...@@ -263,20 +262,20 @@ static int TestFilter_16(int src_width,
} }
} }
free_aligned_buffer_page_end(dst_y_8) free_aligned_buffer_page_end(dst_u_8) free_aligned_buffer_page_end(dst_y_8);
free_aligned_buffer_page_end(dst_v_8) free_aligned_buffer_page_end(dst_u_8);
free_aligned_buffer_page_end(dst_y_16) free_aligned_buffer_page_end(dst_v_8);
free_aligned_buffer_page_end(dst_u_16) free_aligned_buffer_page_end(dst_y_16);
free_aligned_buffer_page_end(dst_v_16) free_aligned_buffer_page_end(dst_u_16);
free_aligned_buffer_page_end(dst_v_16);
free_aligned_buffer_page_end(src_y) free_aligned_buffer_page_end(src_y);
free_aligned_buffer_page_end(src_u) free_aligned_buffer_page_end(src_u);
free_aligned_buffer_page_end(src_v) free_aligned_buffer_page_end(src_v);
free_aligned_buffer_page_end(src_y_16) free_aligned_buffer_page_end(src_y_16);
free_aligned_buffer_page_end(src_u_16) free_aligned_buffer_page_end(src_u_16);
free_aligned_buffer_page_end(src_v_16) free_aligned_buffer_page_end(src_v_16);
return max_diff; return max_diff;
} }
// The following adjustments in dimensions ensure the scale factor will be // The following adjustments in dimensions ensure the scale factor will be
......
...@@ -69,19 +69,15 @@ static inline bool SizeValid(int src_width, ...@@ -69,19 +69,15 @@ static inline bool SizeValid(int src_width,
return true; return true;
} }
#define align_buffer_page_end(var, size) \ #define align_buffer_page_end(var, size) \
uint8* var; \ uint8* var##_mem = \
uint8* var##_mem; \ reinterpret_cast<uint8*>(malloc(((size) + 4095 + 63) & ~4095)); \
var##_mem = reinterpret_cast<uint8*>(malloc(((size) + 4095 + 63) & ~4095)); \ uint8* var = reinterpret_cast<uint8*>( \
var = (uint8*)((intptr_t)(var##_mem + \ (intptr_t)(var##_mem + (((size) + 4095 + 63) & ~4095) - (size)) & ~63)
(((size) + 4095 + 63) & /* NOLINT */ \
~4095) - \
(size)) & \
~63);
#define free_aligned_buffer_page_end(var) \ #define free_aligned_buffer_page_end(var) \
free(var##_mem); \ free(var##_mem); \
var = 0; var = 0
#ifdef WIN32 #ifdef WIN32
static inline double get_time() { static inline double get_time() {
......
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