Commit b92735ef authored by jehan's avatar jehan

add test function for rotation/downscaling functions

parent cebd5a0e
......@@ -34,6 +34,9 @@
<tool id="cdt.managedbuild.tool.gnu.archiver.macosx.base.1639679087" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.macosx.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.macosx.base.1401593352" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.macosx.base"/>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.macosx.base.1973640523" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.macosx.base">
<option id="gnu.c.compiler.option.preprocessor.def.symbols.369096869" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="VIDEO_ENABLED=1"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1596178168" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
</toolChain>
......
......@@ -65,9 +65,81 @@ static void filter_register_tester(void) {
ms_exit();
CU_ASSERT_PTR_NULL(ms_factory_get_fallback());
}
#ifdef VIDEO_ENABLED
static void test_video_processing (void) {
MSVideoSize src_size = MS_VIDEO_SIZE_VGA;
MSVideoSize src_dest = MS_VIDEO_SIZE_VGA;
mblk_t * yuv_block2;
YuvBuf yuv;
int y_bytes_per_row = src_size.width + src_size.width%32 ;
uint8_t* y = (uint8_t*)ms_malloc(y_bytes_per_row*src_size.height); /*to allow bloc to work with multiple of 32*/
int crcb_bytes_per_row = src_size.width/2 + (src_size.width/2)%32 ;
uint8_t* cbcr = (uint8_t*)ms_malloc(crcb_bytes_per_row*src_size.height);
int i,j;
for (i=0;i<src_size.height*src_size.width;i++) {
y[i]=i%256;
}
for (i=0;i<src_size.height*src_size.width/2;i++) {
cbcr[i]=i%256;
}
yuv_block2 = copy_ycbcrbiplanar_to_true_yuv_with_rotation_and_down_scale_by_2( y
,cbcr
,0
, src_size.width
, src_size.height
, y_bytes_per_row
, crcb_bytes_per_row
, 1
, 0);
CU_ASSERT_FALSE(ms_yuv_buf_init_from_mblk(&yuv, yuv_block2));
CU_ASSERT_EQUAL(src_dest.width,yuv.w);
CU_ASSERT_EQUAL(src_dest.height,yuv.h);
/*check y*/
for (i=0;i<yuv.h;i++) {
for (j=0;j<yuv.w;j++)
if (yuv.planes[0][i*yuv.strides[0]+j] != y[i*y_bytes_per_row+j]) {
ms_error("Wrong value [%i] at ofset [%i], should be [%i]",yuv.planes[0][i*yuv.strides[0]+j],i*yuv.strides[0]+j,y[i*y_bytes_per_row+j]);
CU_FAIL("bad y value");
break;
}
}
/*check cb*/
for (i=0;i<yuv.h/2;i++) {
for (j=0;j<yuv.w/2;j++)
if (yuv.planes[1][i*yuv.strides[1]+j] != cbcr[i*crcb_bytes_per_row+2*j]) {
ms_error("Wrong value [%i] at ofset [%i], should be [%i]",yuv.planes[1][i*yuv.strides[1]+j],i*yuv.strides[1]+j,y[i*crcb_bytes_per_row+2*j]);
CU_FAIL("bad cb value");
break;
}
}
/*check cr*/
for (i=0;i<yuv.h/2;i++) {
for (j=0;j<yuv.w/2;j++)
if (yuv.planes[2][i*yuv.strides[2]+j] != cbcr[i*crcb_bytes_per_row+2*j+1]) {
ms_error("Wrong value [%i] at ofset [%i], should be [%i]",yuv.planes[2][i*yuv.strides[2]+j],i*yuv.strides[2]+j,y[i*crcb_bytes_per_row+2*j+1]);
CU_FAIL("bad cr value");
break;
}
}
ms_free(y);
ms_free(cbcr);
}
#endif
static test_t tests[] = {
{ "Multiple ms_voip_init", filter_register_tester }
#ifdef VIDEO_ENABLED
, { "Video processing function", test_video_processing}
#endif
};
test_suite_t framework_test_suite = {
......
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