📄 test_arith_decoder_mpeg4.c
字号:
/*******************************************************************************
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_decoder_mpeg4
Description : This file contains test cases to test arithmetic decoder for shape
codeing (MPEG4)
*******************************************************************************/
#include<stdio.h>
#include"bin_ar_decode.h"
#include"test_input.h"
int error_flag = 0;
void (*f1)();
int cycle_count[513];
extern void _StartArDecoder();
extern void _StopArDecoder();
extern int _arith_decoder_mpeg4();
void main()
{
int i,j,k,C,D;
int error;
decoder=&code;
// test 1
f1 = _StartArDecoder;
_StartArDecoder(decoder,&input0[0],&bit_output[0]);
cycle_count[0] = Compute_Cycle_Count(decoder,&input0[0],&bit_output[0]);
//This function inturn calls StartArDecoder()
// f1 = _arith_decoder_mpeg4;
for(i=0;i<MAX_PAIR;i++)
{
j=arrayIn0_C[i];
C=intra_prob[j];
k=_arith_decoder_mpeg4(C,decoder);
// cycle_count[i+1] = Compute_Cycle_Count(C,decoder);
//This function inturn calls arith_decoder_mpeg4()
bit_output[i]=k;
}
// f1 = _StopArDecoder;
_StopArDecoder(decoder);
// cycle_count[0] = Compute_Cycle_Count(decoder);
//This function inturn calls StopArDecoder()
for(i=0;i<512;i++)
{
error=bit_output[i]-exp_output0[i];
if(abs(error) >MAX_PERMISSIBLE_ERROR)
{
error_flag = error_flag | 1;
}
}
// test 2
_StartArDecoder(decoder,&input1[0],&bit_output[0]);
for(i=0;i<MAX_PAIR;i++)
{
j=arrayIn1_C[i];
C=intra_prob[j];
k=_arith_decoder_mpeg4(C,decoder);
bit_output[i]=k;
}
_StopArDecoder(decoder);
for(i=0;i<512;i++)
{
error=bit_output[i]-exp_output1[i];
if(abs(error) >MAX_PERMISSIBLE_ERROR)
{
error_flag = error_flag | 2;
}
}
// test 3
_StartArDecoder(decoder,&input3[0],&bit_output[0]);
f1 = _StartArDecoder;
for(i=0;i<MAX_PAIR;i++)
{
j=arrayIn3_C[i];
C=intra_prob[j];
k=_arith_decoder_mpeg4(C,decoder);
bit_output[i]=k;
}
_StopArDecoder(decoder);
for(i=0;i<512;i++)
{
error=bit_output[i]-exp_output3[i];
if(abs(error) >MAX_PERMISSIBLE_ERROR)
{
error_flag = error_flag | 4;
}
}
// test 4
_StartArDecoder(decoder,&input3[0],&bit_output[0]);
for(i=0;i<MAX_PAIR;i++)
{
j=arrayIn3_C[i];
C=intra_prob[j];
k=_arith_decoder_mpeg4(C,decoder);
bit_output[i]=k;
}
_StopArDecoder(decoder);
for(i=0;i<512;i++)
{
error=bit_output[i]-exp_output3[i];
if(abs(error) >MAX_PERMISSIBLE_ERROR)
{
error_flag = error_flag | 8;
}
}
// test 5
_StartArDecoder(decoder,&input4[0],&bit_output[0]);
for(i=0;i<MAX_PAIR;i++)
{
j=arrayIn4_C[i];
C=intra_prob[j];
k=_arith_decoder_mpeg4(C,decoder);
bit_output[i]=k;
}
_StopArDecoder(decoder);
for(i=0;i<512;i++)
{
error=bit_output[i]-exp_output4[i];
if(abs(error) >MAX_PERMISSIBLE_ERROR)
{
error_flag = error_flag | 16;
}
}
//test 6
_StartArDecoder(decoder,&input5[0],&bit_output[0]);
for(i=0;i<MAX_PAIR;i++)
{
j=arrayIn0_C[i];
C=intra_prob[j];
k=_arith_decoder_mpeg4(C,decoder);
bit_output[i]=k;
}
_StopArDecoder(decoder);
for(i=0;i<512;i++)
{
error=bit_output[i]- 1;
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
printf("cycle_count[0]=%d,cycle_count[1]=%d,cycle_count[2]=%dcycle_count[3]=%d,cycle_count[4]=%d,cycle_count[5]=%dcycle_count[6]=%d\n",cycle_count[0],cycle_count[1],cycle_count[2],cycle_count[3],cycle_count[4],cycle_count[5],cycle_count[6]);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -