mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2026-01-01 03:12:16 +08:00
scale tests use int64 for size
BUG=none TESTED=untested R=harryjin@google.com Review URL: https://webrtc-codereview.appspot.com/51199004 git-svn-id: http://libyuv.googlecode.com/svn/trunk@1421 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
01ca0712c7
commit
a09fd1aa0f
@ -18,6 +18,9 @@
|
||||
|
||||
namespace libyuv {
|
||||
|
||||
#define STRINGIZE(line) #line
|
||||
#define FILELINESTR(file, line) file ":" STRINGIZE(line)
|
||||
|
||||
// Test scaling with C vs Opt and return maximum pixel difference. 0 = exact.
|
||||
static int ARGBTestFilter(int src_width, int src_height,
|
||||
int dst_width, int dst_height,
|
||||
@ -25,19 +28,27 @@ static int ARGBTestFilter(int src_width, int src_height,
|
||||
int disable_cpu_flags) {
|
||||
int i, j;
|
||||
const int b = 0; // 128 to test for padding/stride.
|
||||
int src_argb_plane_size = (Abs(src_width) + b * 2) *
|
||||
(Abs(src_height) + b * 2) * 4;
|
||||
int64 src_argb_plane_size = (Abs(src_width) + b * 2) *
|
||||
(Abs(src_height) + b * 2) * 4LL;
|
||||
int src_stride_argb = (b * 2 + Abs(src_width)) * 4;
|
||||
|
||||
align_buffer_page_end(src_argb, src_argb_plane_size);
|
||||
if (!src_argb) {
|
||||
printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
|
||||
return 0;
|
||||
}
|
||||
srandom(time(NULL));
|
||||
MemRandomize(src_argb, src_argb_plane_size);
|
||||
|
||||
int dst_argb_plane_size = (dst_width + b * 2) * (dst_height + b * 2) * 4;
|
||||
int64 dst_argb_plane_size = (dst_width + b * 2) * (dst_height + b * 2) * 4LL;
|
||||
int dst_stride_argb = (b * 2 + dst_width) * 4;
|
||||
|
||||
align_buffer_page_end(dst_argb_c, dst_argb_plane_size);
|
||||
align_buffer_page_end(dst_argb_opt, dst_argb_plane_size);
|
||||
if (!dst_argb_c || !dst_argb_opt) {
|
||||
printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
|
||||
return 0;
|
||||
}
|
||||
memset(dst_argb_c, 2, dst_argb_plane_size);
|
||||
memset(dst_argb_opt, 3, dst_argb_plane_size);
|
||||
|
||||
@ -137,9 +148,13 @@ static int ARGBClipTestFilter(int src_width, int src_height,
|
||||
int src_stride_argb = (b * 2 + Abs(src_width)) * 4;
|
||||
|
||||
align_buffer_64(src_argb, src_argb_plane_size);
|
||||
if (!src_argb) {
|
||||
printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
|
||||
return 0;
|
||||
}
|
||||
memset(src_argb, 1, src_argb_plane_size);
|
||||
|
||||
int dst_argb_plane_size = (dst_width + b * 2) * (dst_height + b * 2) * 4;
|
||||
int64 dst_argb_plane_size = (dst_width + b * 2) * (dst_height + b * 2) * 4;
|
||||
int dst_stride_argb = (b * 2 + dst_width) * 4;
|
||||
|
||||
srandom(time(NULL));
|
||||
@ -153,6 +168,10 @@ static int ARGBClipTestFilter(int src_width, int src_height,
|
||||
|
||||
align_buffer_64(dst_argb_c, dst_argb_plane_size);
|
||||
align_buffer_64(dst_argb_opt, dst_argb_plane_size);
|
||||
if (!dst_argb_c || !dst_argb_opt) {
|
||||
printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
|
||||
return 0;
|
||||
}
|
||||
memset(dst_argb_c, 2, dst_argb_plane_size);
|
||||
memset(dst_argb_opt, 3, dst_argb_plane_size);
|
||||
|
||||
|
||||
@ -15,6 +15,9 @@
|
||||
#include "libyuv/scale.h"
|
||||
#include "../unit_test/unit_test.h"
|
||||
|
||||
#define STRINGIZE(line) #line
|
||||
#define FILELINESTR(file, line) file ":" STRINGIZE(line)
|
||||
|
||||
namespace libyuv {
|
||||
|
||||
// Test scaling with C vs Opt and return maximum pixel difference. 0 = exact.
|
||||
@ -36,6 +39,10 @@ static int TestFilter(int src_width, int src_height,
|
||||
align_buffer_page_end(src_y, src_y_plane_size)
|
||||
align_buffer_page_end(src_u, src_uv_plane_size)
|
||||
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");
|
||||
return 0;
|
||||
}
|
||||
srandom(time(NULL));
|
||||
MemRandomize(src_y, src_y_plane_size);
|
||||
MemRandomize(src_u, src_uv_plane_size);
|
||||
@ -44,8 +51,8 @@ static int TestFilter(int src_width, int src_height,
|
||||
int dst_width_uv = (dst_width + 1) >> 1;
|
||||
int dst_height_uv = (dst_height + 1) >> 1;
|
||||
|
||||
int dst_y_plane_size = (dst_width + b * 2) * (dst_height + b * 2);
|
||||
int dst_uv_plane_size = (dst_width_uv + b * 2) * (dst_height_uv + b * 2);
|
||||
int64 dst_y_plane_size = (dst_width + b * 2) * (dst_height + b * 2);
|
||||
int64 dst_uv_plane_size = (dst_width_uv + b * 2) * (dst_height_uv + b * 2);
|
||||
|
||||
int dst_stride_y = b * 2 + dst_width;
|
||||
int dst_stride_uv = b * 2 + dst_width_uv;
|
||||
@ -56,6 +63,11 @@ static int TestFilter(int src_width, int src_height,
|
||||
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_v_opt, dst_uv_plane_size)
|
||||
if (!dst_y_c || !dst_u_c || !dst_v_c ||
|
||||
!dst_y_opt|| !dst_u_opt|| !dst_v_opt) {
|
||||
printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
|
||||
double c_time = get_time();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user