/* * Copyright 2012 The LibYuv Project Authors. All rights reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
if (kBpp == 1) {
MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
RotatePlane(src_argb, src_stride_argb, dst_argb_c, dst_stride_argb,
src_width, src_height, mode);
MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization. for (int i = 0; i < benchmark_iterations; ++i) {
RotatePlane(src_argb, src_stride_argb, dst_argb_opt, dst_stride_argb,
src_width, src_height, mode);
}
} elseif (kBpp == 4) {
MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
ARGBRotate(src_argb, src_stride_argb, dst_argb_c, dst_stride_argb,
src_width, src_height, mode);
MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization. for (int i = 0; i < benchmark_iterations; ++i) {
ARGBRotate(src_argb, src_stride_argb, dst_argb_opt, dst_stride_argb,
src_width, src_height, mode);
}
}
// Rotation should be exact. for (int i = 0; i < dst_argb_plane_size; ++i) {
EXPECT_EQ(dst_argb_c[i], dst_argb_opt[i]);
}
staticvoid ARGBTestRotate(int src_width, int src_height, int dst_width, int dst_height,
libyuv::RotationMode mode, int benchmark_iterations, int disable_cpu_flags, int benchmark_cpu_info) {
TestRotateBpp(src_width, src_height, dst_width, dst_height, mode,
benchmark_iterations, disable_cpu_flags, benchmark_cpu_info, 4);
}
staticvoid TestRotatePlane(int src_width, int src_height, int dst_width, int dst_height,
libyuv::RotationMode mode, int benchmark_iterations, int disable_cpu_flags, int benchmark_cpu_info) {
TestRotateBpp(src_width, src_height, dst_width, dst_height, mode,
benchmark_iterations, disable_cpu_flags, benchmark_cpu_info, 1);
}
staticvoid TestRotatePlane_16(int src_width, int src_height, int dst_width, int dst_height,
libyuv::RotationMode mode, int benchmark_iterations, int disable_cpu_flags, int benchmark_cpu_info) { if (src_width < 1) {
src_width = 1;
} if (src_height < 1) {
src_height = 1;
} if (dst_width < 1) {
dst_width = 1;
} if (dst_height < 1) {
dst_height = 1;
} int src_stride = src_width; int src_plane_size = src_stride * abs(src_height);
align_buffer_page_end_16(src, src_plane_size); for (int i = 0; i < src_plane_size; ++i) {
src[i] = fastrand() & 0xff;
}
int dst_stride = dst_width; int dst_plane_size = dst_stride * dst_height;
align_buffer_page_end_16(dst_c, dst_plane_size);
align_buffer_page_end_16(dst_opt, dst_plane_size);
memset(dst_c, 2, dst_plane_size);
memset(dst_opt, 3, dst_plane_size);
MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
RotatePlane_16(src, src_stride, dst_c, dst_stride, src_width, src_height,
mode);
MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization. for (int i = 0; i < benchmark_iterations; ++i) {
RotatePlane_16(src, src_stride, dst_opt, dst_stride, src_width, src_height,
mode);
}
// Rotation should be exact. for (int i = 0; i < dst_plane_size; ++i) {
EXPECT_EQ(dst_c[i], dst_opt[i]);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.