[x265] [PATCH] testharness cleanup: Testharness uses the same malloc/free wrapper as the rest of the encoder
deepthi at multicorewareinc.com
deepthi at multicorewareinc.com
Thu Sep 19 05:47:23 CEST 2013
# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1379562423 -19800
# Node ID eea9154229a0aa91da16b1323d7999cfcb1cd0b7
# Parent 26d6f155f8df69147f40f4945d99c29a52988c56
testharness cleanup: Testharness uses the same malloc/free wrapper as the rest of the encoder.
Aligned mallocs in testharness use the wrapper (X265_MALLOC/FREE) defined in CommonDef.h. Remove
alignedMalloc/Free definitions in the test class.
diff -r 26d6f155f8df -r eea9154229a0 source/test/intrapredharness.cpp
--- a/source/test/intrapredharness.cpp Wed Sep 18 16:13:33 2013 -0500
+++ b/source/test/intrapredharness.cpp Thu Sep 19 09:17:03 2013 +0530
@@ -47,8 +47,8 @@
pixel_out_c = (pixel*)malloc(out_size * sizeof(pixel));
pixel_out_vec = (pixel*)malloc(out_size * sizeof(pixel));
- pixel_out_33_c = (pixel*)TestHarness::alignedMalloc(sizeof(pixel), out_size_33, 32);
- pixel_out_33_vec = (pixel*)TestHarness::alignedMalloc(sizeof(pixel), out_size_33, 32);
+ pixel_out_33_c = (pixel*)X265_MALLOC(pixel, out_size_33);
+ pixel_out_33_vec = (pixel*)X265_MALLOC(pixel, out_size_33);
if (!pixel_out_c || !pixel_out_vec)
{
@@ -64,8 +64,8 @@
free(pixel_buff);
free(pixel_out_c);
free(pixel_out_vec);
- TestHarness::alignedFree(pixel_out_33_c);
- TestHarness::alignedFree(pixel_out_33_vec);
+ X265_FREE(pixel_out_33_c);
+ X265_FREE(pixel_out_33_vec);
}
bool IntraPredHarness::check_dc_primitive(intra_dc_t ref, intra_dc_t opt)
diff -r 26d6f155f8df -r eea9154229a0 source/test/ipfilterharness.cpp
--- a/source/test/ipfilterharness.cpp Wed Sep 18 16:13:33 2013 -0500
+++ b/source/test/ipfilterharness.cpp Thu Sep 19 09:17:03 2013 +0530
@@ -43,7 +43,7 @@
{
ipf_t_size = 200 * 200;
pixel_buff = (pixel*)malloc(ipf_t_size * sizeof(pixel)); // Assuming max_height = max_width = max_srcStride = max_dstStride = 100
- short_buff = (short*)TestHarness::alignedMalloc(sizeof(short), ipf_t_size, 32);
+ short_buff = (short*)X265_MALLOC(short, ipf_t_size);
IPF_vec_output_s = (short*)malloc(ipf_t_size * sizeof(short)); // Output Buffer1
IPF_C_output_s = (short*)malloc(ipf_t_size * sizeof(short)); // Output Buffer2
IPF_vec_output_p = (pixel*)malloc(ipf_t_size * sizeof(pixel)); // Output Buffer1
@@ -70,7 +70,7 @@
free(IPF_C_output_s);
free(IPF_vec_output_p);
free(IPF_C_output_p);
- TestHarness::alignedFree(short_buff);
+ X265_FREE(short_buff);
free(pixel_buff);
}
diff -r 26d6f155f8df -r eea9154229a0 source/test/mbdstharness.cpp
--- a/source/test/mbdstharness.cpp Wed Sep 18 16:13:33 2013 -0500
+++ b/source/test/mbdstharness.cpp Thu Sep 19 09:17:03 2013 +0530
@@ -57,22 +57,22 @@
MBDstHarness::MBDstHarness()
{
- mbuf1 = (short*)TestHarness::alignedMalloc(sizeof(short), mb_t_size, 32);
- mbufdct = (short*)TestHarness::alignedMalloc(sizeof(short), mb_t_size, 32);
- mbufidct = (int*)TestHarness::alignedMalloc(sizeof(int), mb_t_size, 32);
+ mbuf1 = (short*)X265_MALLOC(short, mb_t_size);
+ mbufdct = (short*)X265_MALLOC(short, mb_t_size);
+ mbufidct = (int*)X265_MALLOC(int, mb_t_size);
- mbuf2 = (short*)TestHarness::alignedMalloc(sizeof(short), mem_cmp_size, 32);
- mbuf3 = (short*)TestHarness::alignedMalloc(sizeof(short), mem_cmp_size, 32);
- mbuf4 = (short*)TestHarness::alignedMalloc(sizeof(short), mem_cmp_size, 32);
+ mbuf2 = (short*)X265_MALLOC(short, mem_cmp_size);
+ mbuf3 = (short*)X265_MALLOC(short, mem_cmp_size);
+ mbuf4 = (short*)X265_MALLOC(short, mem_cmp_size);
- mintbuf1 = (int*)TestHarness::alignedMalloc(sizeof(int), mb_t_size, 32);
- mintbuf2 = (int*)TestHarness::alignedMalloc(sizeof(int), mb_t_size, 32);
- mintbuf3 = (int*)TestHarness::alignedMalloc(sizeof(int), mem_cmp_size, 32);
- mintbuf4 = (int*)TestHarness::alignedMalloc(sizeof(int), mem_cmp_size, 32);
- mintbuf5 = (int*)TestHarness::alignedMalloc(sizeof(int), mem_cmp_size, 32);
- mintbuf6 = (int*)TestHarness::alignedMalloc(sizeof(int), mem_cmp_size, 32);
- mintbuf7 = (int*)TestHarness::alignedMalloc(sizeof(int), mem_cmp_size, 32);
- mintbuf8 = (int*)TestHarness::alignedMalloc(sizeof(int), mem_cmp_size, 32);
+ mintbuf1 = (int*)X265_MALLOC(int, mb_t_size);
+ mintbuf2 = (int*)X265_MALLOC(int, mb_t_size);
+ mintbuf3 = (int*)X265_MALLOC(int, mem_cmp_size);
+ mintbuf4 = (int*)X265_MALLOC(int, mem_cmp_size);
+ mintbuf5 = (int*)X265_MALLOC(int, mem_cmp_size);
+ mintbuf6 = (int*)X265_MALLOC(int, mem_cmp_size);
+ mintbuf7 = (int*)X265_MALLOC(int, mem_cmp_size);
+ mintbuf8 = (int*)X265_MALLOC(int, mem_cmp_size);
if (!mbuf1 || !mbuf2 || !mbuf3 || !mbuf4 || !mbufdct)
{
@@ -117,21 +117,21 @@
MBDstHarness::~MBDstHarness()
{
- TestHarness::alignedFree(mbuf1);
- TestHarness::alignedFree(mbuf2);
- TestHarness::alignedFree(mbuf3);
- TestHarness::alignedFree(mbuf4);
- TestHarness::alignedFree(mbufdct);
- TestHarness::alignedFree(mbufidct);
+ X265_FREE(mbuf1);
+ X265_FREE(mbuf2);
+ X265_FREE(mbuf3);
+ X265_FREE(mbuf4);
+ X265_FREE(mbufdct);
+ X265_FREE(mbufidct);
- TestHarness::alignedFree(mintbuf1);
- TestHarness::alignedFree(mintbuf2);
- TestHarness::alignedFree(mintbuf3);
- TestHarness::alignedFree(mintbuf4);
- TestHarness::alignedFree(mintbuf5);
- TestHarness::alignedFree(mintbuf6);
- TestHarness::alignedFree(mintbuf7);
- TestHarness::alignedFree(mintbuf8);
+ X265_FREE(mintbuf1);
+ X265_FREE(mintbuf2);
+ X265_FREE(mintbuf3);
+ X265_FREE(mintbuf4);
+ X265_FREE(mintbuf5);
+ X265_FREE(mintbuf6);
+ X265_FREE(mintbuf7);
+ X265_FREE(mintbuf8);
}
bool MBDstHarness::check_dct_primitive(dct_t ref, dct_t opt, int width)
diff -r 26d6f155f8df -r eea9154229a0 source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp Wed Sep 18 16:13:33 2013 -0500
+++ b/source/test/pixelharness.cpp Thu Sep 19 09:17:03 2013 +0530
@@ -53,13 +53,13 @@
int bufsize = STRIDE * (maxheight + padrows) + INCR * ITERS;
/* 64 pixels wide, 2k deep */
- pbuf1 = (pixel*)TestHarness::alignedMalloc(sizeof(pixel), bufsize, 32);
- pbuf2 = (pixel*)TestHarness::alignedMalloc(sizeof(pixel), bufsize, 32);
- pbuf3 = (pixel*)TestHarness::alignedMalloc(sizeof(pixel), bufsize, 32);
- pbuf4 = (pixel*)TestHarness::alignedMalloc(sizeof(pixel), bufsize, 32);
+ pbuf1 = (pixel*)X265_MALLOC(pixel, bufsize);
+ pbuf2 = (pixel*)X265_MALLOC(pixel, bufsize);
+ pbuf3 = (pixel*)X265_MALLOC(pixel, bufsize);
+ pbuf4 = (pixel*)X265_MALLOC(pixel, bufsize);
- sbuf1 = (short*)TestHarness::alignedMalloc(sizeof(short), bufsize, 32);
- sbuf2 = (short*)TestHarness::alignedMalloc(sizeof(short), bufsize, 32);
+ sbuf1 = (short*)X265_MALLOC(short, bufsize);
+ sbuf2 = (short*)X265_MALLOC(short, bufsize);
if (!pbuf1 || !pbuf2 || !pbuf3 || !pbuf4 || !sbuf1 || !sbuf2)
{
@@ -81,12 +81,12 @@
PixelHarness::~PixelHarness()
{
- TestHarness::alignedFree(pbuf1);
- TestHarness::alignedFree(pbuf2);
- TestHarness::alignedFree(pbuf3);
- TestHarness::alignedFree(pbuf4);
- TestHarness::alignedFree(sbuf1);
- TestHarness::alignedFree(sbuf2);
+ X265_FREE(pbuf1);
+ X265_FREE(pbuf2);
+ X265_FREE(pbuf3);
+ X265_FREE(pbuf4);
+ X265_FREE(sbuf1);
+ X265_FREE(sbuf2);
}
bool PixelHarness::check_pixelcmp(pixelcmp_t ref, pixelcmp_t opt)
diff -r 26d6f155f8df -r eea9154229a0 source/test/testbench.cpp
--- a/source/test/testbench.cpp Wed Sep 18 16:13:33 2013 -0500
+++ b/source/test/testbench.cpp Thu Sep 19 09:17:03 2013 +0530
@@ -23,8 +23,6 @@
* For more information, contact us at licensing at multicorewareinc.com.
*****************************************************************************/
-#include "TLibCommon/CommonDef.h"
-
#include "primitives.h"
#include "pixelharness.h"
#include "mbdstharness.h"
@@ -38,16 +36,6 @@
using namespace x265;
-void *TestHarness::alignedMalloc(size_t size, int count, int)
-{
- return x265_malloc(size * count);
-}
-
-void TestHarness::alignedFree(void *ptr)
-{
- x265_free(ptr);
-}
-
static const char *CpuType[] =
{
"",
diff -r 26d6f155f8df -r eea9154229a0 source/test/testharness.h
--- a/source/test/testharness.h Wed Sep 18 16:13:33 2013 -0500
+++ b/source/test/testharness.h Thu Sep 19 09:17:03 2013 +0530
@@ -24,6 +24,7 @@
#ifndef _TESTHARNESS_H_
#define _TESTHARNESS_H_ 1
+#include "TLibCommon/CommonDef.h"
#include "primitives.h"
#include <stddef.h>
@@ -48,11 +49,7 @@
virtual void measureSpeed(const EncoderPrimitives& ref, const EncoderPrimitives& opt) = 0;
- virtual const char *getName() const = 0;
-
- static void *alignedMalloc(size_t size, int count, int alignment);
-
- static void alignedFree(void *ptr);
+ virtual const char *getName() const = 0;
};
#ifdef _MSC_VER
More information about the x265-devel
mailing list