|
/******************************************************************************* Copyright(c) 2000 - 2002 Analog Devices. All Rights Reserved. Developed by Joint Development Software Application Team, IPDC, Bangalore, India for Blackfin DSPs ( Micro Signal Architecture 1.0 specification).
By using this module you agree to the terms of the Analog Devices License Agreement for DSP Software. ******************************************************************************** File name : test_arith_encoder_mpeg4.c Description : This file contains test cases to validate arithmetic encoder for shape coding (MPEG4) *******************************************************************************/ #include<stdio.h> #include"bin_ar_code.h" #include"test_input.h"
int error_flag = 0; void (*f1)();
void _StartArCoder(); void _arith_encoder_mpeg4(); void _arith_StopArCoder();
void main() { int i,j,k,C,D; int error;
coder=&code; // test 1;
_StartArCoder(coder,&bit_output[0]) ;
for(i=0;i<MAX_PAIR;i++) { j=arrayIn0_C[i]; C=intra_prob[j]; D=arrayIn0_D[i]; _arith_encoder_mpeg4(D,C,coder); }
_arith_StopArCoder(coder);
for(i=0;i<472;i++) { error=bit_output[i]-exp_output0[i]; if(abs(error) >MAX_PERMISSIBLE_ERROR) { error_flag = error_flag | 1; } }
// test 2
_StartArCoder(coder,&bit_output[0]) ;
for(i=0;i<MAX_PAIR;i++) { j=arrayIn1_C[i]; C=intra_prob[j]; D=arrayIn1_D[i]; _arith_encoder_mpeg4(D,C,coder);
}
_arith_StopArCoder(coder);
for(i=0;i<1191;i++) { error=bit_output[i]-exp_output1[i]; if(abs(error) >MAX_PERMISSIBLE_ERROR) { error_flag = error_flag | 2; } }
// test 3 _StartArCoder(coder,&bit_output[0]) ;
for(i=0;i<MAX_PAIR;i++) { j=arrayIn2_C[i]; C=intra_prob[j]; D=arrayIn2_D[i]; _arith_encoder_mpeg4(D,C,coder); }
_arith_StopArCoder(coder);
for(i=0;i<1197;i++) { error=bit_output[i]-exp_output2[i]; if(abs(error) >MAX_PERMISSIBLE_ERROR) { error_flag = error_flag | 4; } }
// test 4 _StartArCoder(coder,&bit_output[0]) ;
for(i=0;i<MAX_PAIR;i++) { j=arrayIn3_C[i]; C=intra_prob[j]; D=arrayIn3_D[i]; _arith_encoder_mpeg4(D,C,coder); }
_arith_StopArCoder(coder);
for(i=0;i<1069;i++) { error=bit_output[i]-exp_output3[i]; if(abs(error) >MAX_PERMISSIBLE_ERROR) { error_flag = error_flag | 8; } } // test 5 _StartArCoder(coder,&bit_output[0]) ;
for(i=0;i<MAX_PAIR;i++) { j=arrayIn4_C[i]; C=intra_prob[j]; D=arrayIn3_D[i]; _arith_encoder_mpeg4(D,C,coder); }
_arith_StopArCoder(coder);
for(i=0;i<939;i++) { error=bit_output[i]-exp_output4[i]; if(abs(error) >MAX_PERMISSIBLE_ERROR) { error_flag = error_flag | 16; } }
// test 6 _StartArCoder(coder,&bit_output[0]) ;
for(i=0;i<MAX_PAIR;i++) { j=arrayIn0_C[i]; C=intra_prob[j]; D=1; _arith_encoder_mpeg4(D,C,coder); }
_arith_StopArCoder(coder);
for(i=0;i<150;i++) { error=bit_output[i]-exp_output5[i]; if(abs(error) >MAX_PERMISSIBLE_ERROR) { error_flag = error_flag | 32; } } #ifdef PRINTF_SUPPORT if(error_flag & 1) printf("Test Case 1 failed\n"); else printf("Test Case 1 passed\n"); if(error_flag & 2) printf("Test Case 2 failed\n"); else printf("Test Case 2 passed\n"); if(error_flag & 4) printf("Test Case 3 failed\n"); else printf("Test Case 3 passed\n"); if(error_flag & 8) printf("Test Case 4 failed\n"); else printf("Test Case 4 passed\n"); if(error_flag & 16) printf("Test Case 5 failed\n"); else printf("Test Case 5 passed\n"); if(error_flag & 32) printf("Test Case 6 failed\n"); else printf("Test Case 6 passed\n"); #endif }
|