mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 11:24:05 +00:00
Update unit tests to work with current build.
- Updating picture_list wasn't really worth it so I removed it.
This commit is contained in:
parent
87261ea91c
commit
9a3569b5c6
|
@ -203,9 +203,6 @@
|
|||
<ClInclude Include="..\..\src\strategies\nal.h">
|
||||
<Filter>Header Files\strategies</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\strategies\picture-altivec.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\image.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -227,6 +224,9 @@
|
|||
<ClInclude Include="..\..\src\videoframe.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\strategies\picture-altivec.c">
|
||||
<Filter>Header Files\strategies</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<YASM Include="..\..\src\x86\cpu.asm">
|
||||
|
|
|
@ -89,12 +89,10 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\tests\picture_list_tests.c" />
|
||||
<ClCompile Include="..\..\tests\sad_tests.c" />
|
||||
<ClCompile Include="..\..\tests\tests_main.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\tests\picture_list_tests.h" />
|
||||
<ClInclude Include="..\..\tests\sad_tests.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
|
|
@ -18,17 +18,11 @@
|
|||
<ClCompile Include="..\..\tests\tests_main.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\tests\picture_list_tests.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\tests\sad_tests.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\tests\picture_list_tests.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\tests\sad_tests.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
#include "greatest/greatest.h"
|
||||
|
||||
#include "src/picture.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
picture_list *list; // picturelist used by all tests.
|
||||
} picture_list_env;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// SETUP, TEARDOWN AND HELPER FUNCTIONS
|
||||
|
||||
/**
|
||||
* Alloc and initialize picture. Initialize yuv-data with parameter init.
|
||||
*/
|
||||
picture * make_pic(unsigned lcu_width, unsigned lcu_height, char init) {
|
||||
picture *pic = picture_init(LCU_WIDTH * lcu_width, LCU_WIDTH * lcu_height,
|
||||
lcu_width, lcu_height);
|
||||
unsigned luma_size = pic->width * pic->height;
|
||||
unsigned chroma_size = luma_size >> 2;
|
||||
|
||||
memset(pic->y_data, init, luma_size);
|
||||
memset(pic->u_data, init, chroma_size);
|
||||
memset(pic->v_data, init, chroma_size);
|
||||
|
||||
return pic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup initial conditions for all tests.
|
||||
*
|
||||
* The conditions are that g_pl is a picture list of size 10 with 10 pictures.
|
||||
* The pictures have their yuv-data initialized with their index in the list,
|
||||
* meaning that the first picture is filled with 0 values and the second with
|
||||
* 1 values.
|
||||
*/
|
||||
void picture_list_setup(picture_list_env *env)
|
||||
{
|
||||
unsigned lcu_width = 2;
|
||||
unsigned lcu_height = 2;
|
||||
unsigned i;
|
||||
|
||||
env->list = picture_list_init(10);
|
||||
//ASSERT(g_pl->size == 10);
|
||||
//ASSERT(g_pl->used_size == 0);
|
||||
|
||||
for (i = 0; i < env->list->size; ++i) {
|
||||
picture *pic = make_pic(lcu_width, lcu_height, i);
|
||||
picture_list_add(env->list, pic);
|
||||
}
|
||||
//ASSERT(g_pl->used_size == 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deallocate all memory allocated by picturelist_setup.
|
||||
*/
|
||||
void picture_list_teardown(picture_list_env *env)
|
||||
{
|
||||
picture_list_destroy(env->list);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// TEST FUNCTIONS
|
||||
|
||||
/**
|
||||
* Check that pictures have been added to the list in the correct order and
|
||||
* that they can be retrieved.
|
||||
*/
|
||||
TEST test_add(picture_list_env *env)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < env->list->used_size; ++i) {
|
||||
picture *pic = env->list->pics[i];
|
||||
unsigned luma_size = pic->width * pic->height;
|
||||
unsigned chroma_size = luma_size >> 2;
|
||||
|
||||
// Identify that the correct picture is in the correct place by checking
|
||||
// that the data values are the same as the index.
|
||||
ASSERT(pic->y_data[0] == i);
|
||||
ASSERT(pic->u_data[0] == i);
|
||||
ASSERT(pic->v_data[0] == i);
|
||||
ASSERT(pic->y_data[luma_size - 1] == i);
|
||||
ASSERT(pic->u_data[chroma_size - 1] == i);
|
||||
ASSERT(pic->v_data[chroma_size - 1] == i);
|
||||
}
|
||||
PASS();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// TEST FIXTURES
|
||||
SUITE(picture_list_tests)
|
||||
{
|
||||
picture_list_env env;
|
||||
SET_SETUP(picture_list_setup, &env);
|
||||
SET_TEARDOWN(picture_list_teardown, &env);
|
||||
|
||||
RUN_TEST1(test_add, &env);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#ifndef PICTURE_LIST_TESTS_H_
|
||||
#define PICTURE_LIST_TESTS_H_
|
||||
|
||||
void picture_list_tests(void);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
#include "greatest/greatest.h"
|
||||
|
||||
#include "src/picture.h"
|
||||
|
||||
#include "src/image.h"
|
||||
#include "src/strategyselector.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EXTERNAL FUNCTIONS
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// DEFINES
|
||||
#define TEST_SAD(X, Y) calc_sad(g_pic, g_ref, 0, 0, (X), (Y), 8, 8)
|
||||
#define TEST_SAD(X, Y) image_calc_sad(g_pic, g_ref, 0, 0, (X), (Y), 8, 8)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// GLOBALS
|
||||
|
@ -34,29 +34,30 @@ const uint8_t pic_data[64] = {
|
|||
1,1,1,1,1,1,1,1
|
||||
};
|
||||
|
||||
picture *g_pic = 0;
|
||||
picture *g_ref = 0;
|
||||
image *g_pic = 0;
|
||||
image *g_ref = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// SETUP, TEARDOWN AND HELPER FUNCTIONS
|
||||
void sad_setup(void *environment)
|
||||
{
|
||||
unsigned i;
|
||||
g_pic = picture_init(8, 8, 1, 1);
|
||||
for (i = 0; i < 64; ++i) {
|
||||
g_pic->y_data[i] = pic_data[i] + 48;
|
||||
strategyselector_init();
|
||||
|
||||
g_pic = image_alloc(8, 8, 1);
|
||||
for (int i = 0; i < 64; ++i) {
|
||||
g_pic->y[i] = pic_data[i] + 48;
|
||||
}
|
||||
|
||||
g_ref = picture_init(8, 8, 1, 1);
|
||||
for (i = 0; i < 64; ++i) {
|
||||
g_ref->y_data[i] = ref_data[i] + 48;
|
||||
g_ref = image_alloc(8, 8, 0);
|
||||
for (int i = 0; i < 64; ++i) {
|
||||
g_ref->y[i] = ref_data[i] + 48;
|
||||
}
|
||||
}
|
||||
|
||||
void sad_teardown(void *environment)
|
||||
{
|
||||
free(g_pic); g_pic = 0;
|
||||
free(g_ref); g_ref = 0;
|
||||
image_free(g_pic);
|
||||
image_free(g_ref);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -201,6 +202,7 @@ TEST test_bottomright_out(void)
|
|||
PASS();
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// TEST FIXTURES
|
||||
SUITE(sad_tests)
|
||||
|
@ -235,5 +237,5 @@ SUITE(sad_tests)
|
|||
RUN_TEST(test_bottom_out);
|
||||
RUN_TEST(test_bottomright_out);
|
||||
|
||||
sad_setup(0);
|
||||
sad_teardown(0);
|
||||
}
|
||||
|
|
|
@ -3,12 +3,10 @@
|
|||
|
||||
GREATEST_MAIN_DEFS();
|
||||
extern SUITE(sad_tests);
|
||||
extern SUITE(picture_list_tests);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GREATEST_MAIN_BEGIN();
|
||||
RUN_SUITE(sad_tests);
|
||||
RUN_SUITE(picture_list_tests);
|
||||
GREATEST_MAIN_BEGIN();
|
||||
GREATEST_MAIN_END();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue